Dashboard › opencode-lore › Distillation
8b50b791-5c59-4aaf-9454-67c73944eab7["lore_tm_v1_i6VBTj_2IzKi49qpZgW6b21PcNnCkWMFirAwIDqXfSU","lore_tm_v1_er2NNcHsPKyx4Uy9z-QUkptrCEuHtRIJwMAdiNwhQdw","lore_tm_v1_Wf0lZwFEmEg23ypOKsFUMmSre3xx1gMk7BLSQG9mctY","lore_tm_v1_Qdc6CQ2mY-jYEBKs_HmVea_k7x-i7c9a9svjQkig64g","lore_tm_v1__edtmBUZlInDzBHsn7xUa_Q2hkGtmghUUSK-4FSCWyY","lore_tm_v1_qVngLZMDPorFawlM0kao9jI5gMP11LikNJkRy3hLXmk","lore_tm_v1_JHQyCIWIQ93VLxQdKPneBn0W8W1PtK8cQ3PZOLzXpwc","lore_tm_v1_JNrmPO3IpKIEfCh30sQAZT4WyCv8lMpO4iwgr8GOWUQ","lore_tm_v1_021iKiqnbyvuG7V4oC1Ja9mapWDdhTiuch-oGQ5ELdI"]
Date: Sep 16, 2026
packages/core/package.json defines @loreai/core version 0.40.0, type module, license FSL-1.1-Apache-2.0, description “Shared memory engine for Lore — three-tier storage, distillation, gradient context management,” public npm access, author BYK, and repository git+https://github.com/BYK/loreai.git under packages/core.@loreai/core exports types from ./dist/types/index.d.ts, development source from ./src/index.ts, Bun build from ./dist/bun/index.js, and default Node build from ./dist/node/index.js; #db/driver maps Bun to ./src/db/driver.bun.ts and other runtimes to ./src/db/driver.node.ts.packages/core/package.json scripts are typecheck: "tsc --noEmit && tsc --noEmit -p tsconfig.eval.json" and build: "tsx script/build.ts"; published files are src/, dist/, README.md, and LICENSE.@loreai/core dependencies include @hpke/core ^1.9.0, @huggingface/hub 2.11.0, @noble/ciphers ^2.2.0, @noble/curves ^2.2.0, @noble/hashes ^2.2.0, micromark ^4.0.0, p-limit 7, pickleparser 0.2.1, remark ^15.0.1, sqlite-vec 0.1.9, unbash ^4.0.4, uuidv7 ^1.1.0, and zod ^4.3.6; optional dependencies are @huggingface/transformers ^3.7.1, onnxruntime-node 1.27.0, and sharp ^0.35.0; dev dependencies are @types/bun ^1.2.0, @types/mdast ^4.0.4, and ai-tokenizer ^1.0.6.tmzmtlss / commit e6d0f1edc8504c79ef3a6baacb1d74e4908e116b, bookmark fix/embedding-runtime-admission, description fix(core): correct embedding runtime selection and admission; it is non-empty and conflict-free. Parent is change pxrvwsvv / commit 2cbf40060c67df229731cf1b9e34d5bf22ec2145 on main, description feat(cch): add seeds for Claude Code up to 2.1.272 (#1780).fix/responses-private-references; suggested inspection command was jj bookmark list and resolution command was jj bookmark set <name> -r <rev>.packages/core/src/cgroup-memory.ts and packages/core/test/cgroup-memory.test.ts; modified packages/core/src/embedding/local.ts, packages/core/src/embedding/pool.ts, packages/core/src/embedding-cap.ts, packages/core/src/embedding-worker-types.ts, packages/core/src/embedding-worker.ts, packages/core/src/embedding.ts, packages/core/src/ort-native.ts, packages/core/test/embedding-cap.test.ts, packages/core/test/embedding-pool-memory.test.ts, packages/core/test/embedding-pool.test.ts, packages/core/test/embedding-worker-types.test.ts, packages/core/test/ort-native.test.ts, packages/gateway/script/bundle.ts, packages/gateway/script/ort-platform-package.ts, packages/gateway/test/bundle-exports.test.ts, and packages/gateway/test/ort-platform-package.test.ts.63ee4287e8fa794a661519a52a493edf6dba857a33b5da39b33bc0e40d7950da -.memoryFiles() in packages/core/src/cgroup-memory.ts therefore re-reads /proc/self/cgroup and /proc/self/mountinfo on every discovery.readLinuxCgroupMemoryHeadroomBytes(), every descendant cgroup boundary must remain readable; only the cgroup v2 root may omit memory.current, memory.high, and memory.max.packages/core/src/cgroup-memory.ts supports Linux cgroup v1 and v2 discovery. parseCgroupMemberships() prefers an explicit v1 memory controller over a v2 unified hierarchy on hybrid hosts; decodeProcPath() decodes octal procfs escapes and rejects non-absolute paths, NUL bytes, and .. traversal.resolveLinuxCgroupMemoryFiles(cgroupContent, mountInfoContent) matches v2 membership to cgroup2 mounts and v1 memory membership to cgroup mounts whose super-options include memory; direct candidates are sorted by longest mount root, while a namespaced interpretation is accepted only when exactly one candidate exists.readLinuxCgroupMemoryHeadroomBytes() reads v2 usage from memory.current and limits from both memory.high and memory.max; v1 usage comes from memory.usage_in_bytes and its limit from memory.limit_in_bytes. It walks from the process cgroup directory to the mount point and returns the minimum finite max(0, limit - usage) across all boundaries.max and numeric limits above Number.MAX_SAFE_INTEGER as Number.POSITIVE_INFINITY; malformed/unsafe usage values, malformed limits, ambiguous/unreadable state, path escape, and I/O failures cause readLinuxCgroupMemoryHeadroomBytes() to return undefined.packages/core/src/embedding/local.ts identifies MODEL_MAX_TOKENS as approximately 8,192 tokens and sets LOCAL_MAX_CHARS = MODEL_MAX_TOKENS * 4, with surrogate-pair-safe truncation.0.7 and respawns the worker on a fresh heap; repeated failure eventually stops backing off and latches FTS-only.freemem() alone does not prove the fixed WASM heap grew.packages/core/src/embedding-cap.ts defines EMBED_POOL_ABS_MAX = 8; pool sizing clamps configured finite values to this absolute maximum.baseline + K·L²; the documented WASM hard-cap calculation is sqrt((MAX·fraction − baseline) / K) ≈ 4962. Native onnxruntime-node does not use the WASM 4 GiB heap wall.packages/core/src/embedding/local.ts adds container-aware memory admission through constrainedMemoryLimit(), availableMemoryHeadroom(), containerFreeBytes(), clampFreeToContainerLimit(), resolveMemoryHeadroom(), and readLinuxCgroupMemoryHeadroomBytes().constrainedMemoryLimit() calls process.constrainedMemory() and returns a positive finite limit or 0; its documentation notes that the API is libuv-backed, supports cgroup v1/v2 without hard-coded paths, and exists in Node ≥18.15 and Bun.availableMemoryHeadroom() omits Bun’s process.availableMemory() because Bun currently aliases host freemem() inside constrained cgroups; on Node it combines cgroup-derived headroom with process.availableMemory() when available, falls back safely if the function is absent or throws, and uses test seams _setConstrainedMemoryForTest(), _setContainerFreeForTest(), and _setAvailableMemoryForTest().kv_meta key lore:embedding_cap with JSON fields cap, freeMemBytes, and optional positive knownBadCap. Reads tolerate missing/corrupt state; writes use INSERT INTO kv_meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = ? and are best-effort.Math.max(1, memDivisor), computes memoryModelEmbedCap(free), and reconciles it with persisted cap, freeMemBytes, and knownBadCap. Test helpers are _persistEmbedCap() and _readPersistedEmbedCap().EMBED_REPROBE_INTERVAL_MS = 5 * 60_000; the ceiling is based on the worker’s pool share of current free memory so the sum across N workers does not exceed host capacity, and the recovery baseline is anchored at OOM-time free memory.EmbeddingFailureInfo telemetry in packages/core/src/embedding/local.ts reports kind: "oom-backoff" | "floor-latch", capBefore, capAfter, in-flight batchSize, longestChars, freeMemBytes, and rssBytes; setEmbeddingFailureHook() registers the optional host hook.