Dashboard › opencode-lore › Distillation
6b1f5c1c-9b48-4380-b01b-509c0cac32d7["lore_tm_v1_WcQGymt6uJXLkoy20sWYFhSljLsF2pC61kvMFAjUo-c","lore_tm_v1_H1qZGDLA4sE34nf6wfYDxHp_YNVHNXM7N1JApgQgvxk","lore_tm_v1_hOvDnHYuGOFYeD0Iq1uNjQ-o_qDJYSKY67Wma6_F05c","lore_tm_v1_2PJo5BaFM1tKTI_We1M1E5hML3xmK3fA1kt2zSGhNpM","lore_tm_v1_xu2Gus5Bd6NBwFk4CFJOk0mIdRUzrYrZZAekorzRt9w","lore_tm_v1__yiXQkWbnW_ChqNZqeCquCvfk0b_FY4vimArhcZx0Is"]
Date: Sep 16, 2026
packages/core/src/embedding-worker.ts is only safe in npm mode and is never called for vendored binaries.packages/gateway/script/ort-platform-package.ts generates esbuild-style per-platform packages containing the native onnxruntime-node addon and shared libraries, avoiding onnxruntime-node’s GitHub-release postinstall download and remaining compatible with npm 12, offline, air-gapped, and proxied installs.ORT_NPM_PLATFORM_DEFINITIONS contains exactly 5 targets in order: 1. linux-x64 (linux/x64), 2. linux-arm64 (linux/arm64), 3. darwin-arm64 (darwin/arm64), 4. win32-x64 (win32/x64), 5. win32-arm64 (win32/arm64). darwin-x64 is absent because onnxruntime-node 1.27.0 dropped its Intel macOS prebuilt, so Intel Macs fall back to WASM.buildOrtPlatformPackages() writes each package beneath outDir/onnxruntime-<target>/, copies native files flat into the package root, and generates package.json with name, gateway-locked version, loreOrtNodeVersion, one-element os and cpu arrays, preferUnplugged: true, sorted files, license: "FSL-1.1-Apache-2.0", and publishConfig: { access: "public" }. It intentionally omits an exports field so require.resolve("<pkg>/onnxruntime_binding.node") can deep-resolve the addon.tsx script/ort-platform-package.ts --out <dir> [--version x.y.z]; --out is required and exits with status 1 when absent, while --version defaults to the gateway package version.packages/core/src/embedding/local.ts persists adaptive embedding-cap state under kv_meta key lore:embedding_cap with fields cap, freeMemBytes, and optional positive knownBadCap; malformed or inaccessible persisted data is ignored.packages/core/src/embedding/local.ts sets EMBED_REPROBE_INTERVAL_MS = 5 * 60_000. containerFreeBytes() clamps host freemem() through clampFreeToContainerLimit() using constrainedMemoryLimit() and availableMemoryHeadroom().availableMemoryHeadroom() uses Linux cgroup headroom from readLinuxCgroupMemoryHeadroomBytes(). For Bun it avoids trusting process.availableMemory() because Bun currently aliases host freemem() inside constrained cgroups; Node uses process.availableMemory() when available and falls back safely if it throws.packages/core/src/embedding/pool.ts lazily grows beyond the primary worker only after at least one slot has completed a real embed. This prevents concurrent cold workers sharing the HuggingFace cache from reading or purging one another’s partial downloads.this.ceiling, and live free memory of at least (unhealthy slot count + 1) * PER_WORKER_MEM_BUDGET_BYTES.LocalProvider receives the pool ceiling as its memory divisor, sizing each worker’s token cap from free / ceiling; because the ceiling is memory-gated by desiredEmbedPoolSize, provisioned workers collectively remain within one EMBED_MEM_FRACTION share of free memory instead of independently claiming memory and summing to an OOM.packages/core/src/embedding/pool.ts routes new work only to healthy slots. After cooldown it admits exactly one recovery probe, while exhausted retry debt prevents a replacement storm; if a healthy sibling remains, preserveHealthyServiceAfterExhaustion() clears the global FTS-only latch without resetting the exhausted retry budget.