Dashboard › opencode-lore › Distillation
b8c5ed0a-4462-4165-976f-95b33d99d769["lore_tm_v1_1jZUAY6A0CbLMG27e8TbuKPWyiuEV5n8lazakUjOvtE","lore_tm_v1_ZYEx9ElXHF4l70Xv_bQlWtPAY0WdxsP2fBlitCRoHJM","lore_tm_v1_c3-3KKgzGnaIsg-00hDJNiMdwwDX9iyUcFwSs64ZM_Y","lore_tm_v1_ezPNDl4dIgLiguvI7nbvMkQWVe4L46w5Z3ElFU0j1LU","lore_tm_v1_gfXWjTnXSXxlPOlIWRSmUkwAEWYq_HVAjMPDX7bczN8","lore_tm_v1_l_8oTAN6Q9R9W5eRaGyaVF6EuKamzcPJdexImrD0Uwk","lore_tm_v1_PC3e7_KByY1XFLwMtsc8so6j2q5NiIDbsS4fRF3lLlY"]
Date: Sep 16, 2026
resolveNativeOrtBindingPath() never resolves an undeclared ancestor workspace package. A nested @loreai/gateway without a declared onnxruntime-node dependency must return null, even if an ancestor workspace package exists.resolveNativeOrtBindingPath("/nonexistent/lore-test/x.js") returns null and never throws when native packages are absent.closeSync(fd), must never interrupt WASM fallback; native resolution is fail-closed.onnxruntime-node dependency and never selects an arbitrary ancestor’s potentially ABI-incompatible runtime.resolveNativeOrtBindingPath() must never throw and must degrade to WASM rather than crash embedding.packages/core/src/ort-native.ts resolves declared packages via createRequire(fromPath).resolve(\${packageName}/package.json`), canonicalizes the package directory with realpathSync(dirname(manifest)), and returns null` on any resolution error.validNativeBinding(path, packageDir, platform) in packages/core/src/ort-native.ts canonicalizes both paths, requires the binding to remain within the declared package and be a regular file, then checks its first 4 bytes: Linux ELF [0x7f, 0x45, 0x4c, 0x46]; Darwin Mach-O [0xcf, 0xfa, 0xed, 0xfe] or [0xfe, 0xed, 0xfa, 0xcf]; Windows starts with MZ bytes 0x4d, 0x5a. Any failure returns null.packages/core/src/ort-native.ts requires gateway name @loreai/gateway, an exact declared onnxruntime-node version matching expectedOrtVersion, package manifest name onnxruntime-node with that exact version, a canonical bin directory contained within the package, and exactly one directory matching /^napi-v\d+$/; otherwise it returns null.@loreai/onnxruntime-<target>, gateway name @loreai/gateway, matching gateway/package/dependency versions, publishedManifest.loreOrtNodeVersion === expectedOrtVersion, and exact one-element os/cpu arrays matching the runtime.packages/core/test/ort-native.test.ts verifies package-symlink escape rejection by symlinking onnxruntime-node/bin to outside-bin; it also verifies rejection of a binding containing "not a native addon".ORT_NATIVE_TARGETS in exact order: 1. linux-x64, 2. linux-arm64, 3. darwin-arm64, 4. win32-x64, 5. win32-arm64; darwin-x64 is derivable via ortPlatformTarget("darwin", "x64") but is not shipped in that generated target list. ORT_NATIVE_BINDING_FILE is onnxruntime_binding.node.nativeIntraOpThreads() tests require unconstrained pairs (4,4), (8,8), (1,1), and (8,4) to return undefined, while cgroup-limited pairs (2,8) and (1,16) return 2 and 1, respectively.packages/gateway/test/bundle-exports.test.ts uses isBundleFresh() so bundle-export assertions never run against missing or stale artifacts. It compares the newest recursive mtime across packages/gateway/src, packages/core/src, packages/gateway/script, and packages/gateway/package.json with the oldest mtime of dist/index.cjs and dist/index.bun.js; freshness requires both artifacts to exist and oldestArtifact > newestSource, with timestamp ties forcing a rebuild.node_modules or ORT WASM dependency mtimes because pnpm install postinstall rebuilds the bundle. The entire packages/gateway/script directory is tracked because bundle.ts imports sibling ORT plugins, debug-id, and import-meta-url helpers.beforeAll() emits [bundle-exports] dist/ bundle missing or stale — building it (pnpm --filter @loreai/gateway run bundle)… and executes pnpm --filter @loreai/gateway run bundle from the repository root via execSync; a shell command is used so Windows resolves pnpm.cmd.@loreai/* import to src, core worker threads resolving .ts siblings under Vitest, and pool: "forks" to prevent the dist/ wipe/recreate from racing another test file.WorkerInitData.forceWasm, termination of the native worker, successful resolution from the WASM worker, rejection after a second "protobuf parsing failed" fallback request, and ignoring trailing/stale native-worker messages after respawn.texts: ["probe"], dimensions: 64, and a 10_000 timeout; a preload intercepts attempts to load filenames ending in onnxruntime_binding.node, while globalThis.fetch is replaced with a function throwing Error("lore-wasm-probe-stop").