Dashboard › opencode-lore › Distillation
61fd1ad6-d31e-46d4-9585-bc56958a4c24["lore_tm_v1_hgWED_m4UxZNjGprBT90DD8nuYClHn3hy5vu5_RuzWw","lore_tm_v1_ieg7-S3EJcVdmgJzgFyO8ax4J-mqWyvOkwIzPmgoZvc","lore_tm_v1_BRLEi-MtAcNYWYutQSYTAk-ItEhmfnPoFBez0Fx-C3Y"]
Date: September 16, 2026
undici@7 path is never bundled or evaluated under Bun; the Bun path uses Bun-native fetch and never touches undici.undici is safe as a devDependency only because its import is Node-only and lazy, so the Bun path never imports it; if the Bun path ever imports undici, it must become a runtime dependency.numThreads=1, causing ort-web to take its single-thread path and never call its pthread new Worker(...).β Debug ID injected: ${debugId}.packages/core/src/embedding-worker.ts: sessionRun() catches every inference error and emits two console.error() callsβan error message and a dump of every input tensor including .data, potentially about 21K token IDs at the 8192-token cap. logSeverityLevel: 4 does not suppress this because the logging comes from transformers.js rather than the ONNX Runtime C++ logger.packages/core/src/embedding-worker.ts: TRANSFORMERS_INFERENCE_DUMP_PREFIXES contains exactly "An error occurred during model execution:" and "Inputs given to model:"; isTransformersInferenceDumpLine(arg) matches only a leading string beginning with either prefix; suppressTransformersInferenceDump() temporarily wraps console.error, filters only those lines using args[0], and returns a restore function.runInference() installs suppressTransformersInferenceDump() only around pipeline(texts, { pooling: "mean", truncation: true }) and restores console.error in a finally block. This is safe because worker inference is strictly sequential, so no concurrent inference can race the temporary console swap.TRANSFORMERS_INFERENCE_DUMP_PREFIXES and isTransformersInferenceDumpLine() in packages/core/src/embedding-worker.ts must stay byte-identical/in sync with the canonical definitions in embedding-worker-types.ts; embedding-worker-types.test.ts drift-guards both the prefix array and function body because the native worker resolver cannot map a runtime .js import back to the .ts source.runInference(): mean pooling with truncation at the 8192-token model limit, layer normalization over the full hidden dimension (768), optional Matryoshka slicing to dimensions, then L2 normalization; per-text vectors are copied into separate Float32Array instances.processEmbed() error behavior in packages/core/src/embedding-worker.ts: expected OOM errors do not post a per-request error, optionally emit a console.debug message when stderrSilenced is false, then exit with EMBED_OOM_EXIT_CODE so the main thread can respawn with a fresh heap, lower the token cap, and resubmit; fatal WASM errors post WASM fatal error (worker exiting): ${raw} and exit with code 1; other nonfatal errors reject only the affected request while the worker continues serving.packages/core/src/embedding-worker.ts: a "shutdown" message sets shutdownRequested = true, drops queued but not in-flight requests with queue.length = 0, and maybeExit() waits for inflight === 0 before scheduling process.exit(0) via setTimeout(..., 0) so pending N-API conversion callbacks can finish.packages/gateway/script/ort-platform-package.ts, modeled after @esbuild/<os>-<arch>: each @loreai/onnxruntime-<os>-<arch> package contains only one platformβs native addon and shared libraries, uses npm os/cpu gating, is referenced as an optionalDependency, sets preferUnplugged: true for Yarn PnP, has no install script, and is loaded through require.resolve("@loreai/onnxruntime-<target>/onnxruntime_binding.node").onnxruntime-node was rejected because its native binary arrives through a GitHub-release postinstall download, npm 12 will stop automatically running that postinstall, and the download fails in offline, air-gapped, or proxied installs. Per-platform packages were chosen to remain npm-12-safe and installation-independent.@loreai/gateway retains a self-contained bundled WASM ONNX Runtime for dist-only/AUR/vendored-dist/ installations with no node_modules, but normal npm/plugin installations should use native ONNX Runtime because single-threaded WASM is 2.7β4.1Γ slower. If no platform package resolves, the gateway falls back to bundled WASM.ORT_NPM_PLATFORM_DEFINITIONS: 1. linux-x64 with subdir linux/x64, OS linux, CPU x64; 2. linux-arm64 with subdir linux/arm64, OS linux, CPU arm64; 3. darwin-arm64 with subdir darwin/arm64, OS darwin, CPU arm64; 4. win32-x64 with subdir win32/x64, OS win32, CPU x64; 5. win32-arm64 with subdir win32/arm64, OS win32, CPU arm64.darwin-x64 is intentionally absent because onnxruntime-node 1.27.0 dropped the Intel macOS prebuilt; Intel Macs therefore receive a null native binding-path resolution and fall back to WASM.ortPackageName(target) as returning @loreai/onnxruntime-${target}, ortPlatformTarget(platform = process.platform, arch = process.arch) as returning ${platform}-${arch}, and ORT_PACKAGE_BINDING_SUBPATH as ORT_BINDING_FILE; keeping target computation next to ORT_NPM_PLATFORMS prevents build-time package names from drifting from runtime resolution keys.buildOrtPlatformPackages() creates outDir/onnxruntime-<target>/, copies the native addon and shared-library files flat into the package root, and writes package metadata including name, gateway-locked version, loreOrtNodeVersion, license: "FSL-1.1-Apache-2.0", repository git+https://github.com/BYK/loreai.git under packages/gateway, os, cpu, preferUnplugged: true, sorted files, and publishConfig: { access: "public" }."exports" field because an exports map would block the required deep resolution of <pkg>/onnxruntime_binding.node; sibling native libraries remain beside the addon so $ORIGIN, @loader_path, or Windows DLL search resolves them by construction.tsx script/ort-platform-package.ts --out <dir> [--version x.y.z]; --out is mandatory, --version defaults to the gateway package version, and the generator reports the number of @loreai/onnxruntime-* packages, gateway/package version, onnxruntime-node version, generated file lists, and output directories.