Dashboard › opencode-lore › Distillation
90910a3e-08f1-43ce-a2fd-4e9e990c99b2["lore_tm_v1_1DDtF1G7AOR4rMPm7rjuqbDs42P6QXymxuf9kVNtVGI","lore_tm_v1_hUuwDqOuZYTIohjIEuKEfDSoxEiib2BvchnP7ZngqP4","lore_tm_v1_y2Ph9GLKU8ij8YO7cFO3-6SPCFSkE9cDMRDbQVqHEEo","lore_tm_v1_dIqpqQGMinkyK0NJIkNtx3gQR296BwrN0iWEtQSbeSQ","lore_tm_v1_ukFdYPi7Vr6Rsdi9lYmRshnzaGhpRt1G8DamoRP-enI"]
Date: Sep 17, 2026
shouldReprobeEmbedCap() must never fire when the learn-time memory baseline is non-positive.reprobeEmbedCap() must never step down; it returns the current cap unchanged when the memory-model ceiling is lower.reprobeEmbedCap() must never re-probe above the WASM ceiling.packages/core/test/embedding-cap.test.ts defines EMBED_TOKEN_CEILING as a fixed bound below MODEL_MAX_TOKENS, derived from the 4 GiB WASM MAXIMUM_MEMORY with 0.85 headroom minus baseline and divided by K; tests require it to be greater than 4000, at most 5200, and binding for free-memory inputs of 16, 32, 64, and 256 GiB.reconcileEmbedCap() tests specify: no persisted value returns the model cap; free-memory ratios 1.0, 1.1, and 0.8 trust a learned cap; ratio 2.0 re-probes upward through the model; ratio 0.4 chooses the safer minimum of model and learned caps; persisted values below the floor clamp to MIN_EMBED_TOKENS; and stored freeMemBytes: 0 trusts the learned cap.reconcileEmbedCap(4 * GB, { cap: 1500, freeMemBytes: 1 * GB }, 4000, 3000) must return 2999, enforcing knownBad - 1; a safe learned cap below that bound remains unchanged, knownBad = 0 means none has been learned, and a stale persisted cap of 7000 is reduced to EMBED_TOKEN_CEILING.shouldReprobeEmbedCap() tests require recovery to at least 1.3× the learn-time free-memory level: 1.3× and 2× return true, while 1.29×, 1×, and learn-time baselines 0 or -1 return false.reprobeEmbedCap() uses a gentle upward step of approximately 1 / 0.7 (1000 → 1429, 2000 → 2857), bounded by the current memory model, EMBED_TOKEN_CEILING, and knownBad - 1. Tests require reprobeEmbedCap(3000, 1 * GB) === 3000, reprobeEmbedCap(MODEL_MAX_TOKENS, 64 * GB) === EMBED_TOKEN_CEILING, and a known-bad cap of 2400 to bound reprobes at 2399.packages/core/src/embedding/contract.ts defines WORKER_SHUTDOWN_TIMEOUT_MS = 1_500 and EmbeddingOperationOptions with optional signal?: AbortSignal and deadlineMs?: number, where deadlineMs is a duration from invocation.EmbeddingAbortPhase values are "provider-readiness", "settle-document-embeds", and "knowledge-backfill"; EmbeddingAbortCode values are "aborted" and "deadline-exceeded".EmbeddingAbortError carries code and phase; its messages are Embedding phase '${phase}' exceeded its deadline or Embedding phase '${phase}' was aborted. A signal reason named "TimeoutError" maps to "deadline-exceeded"; other reasons map to "aborted" unless already represented by an EmbeddingAbortError.createEmbeddingAbortGuard() rejects non-finite or negative deadlineMs with RangeError("embedding deadlineMs must be a finite non-negative number"); otherwise it records deadlineAt = Date.now() + deadlineMs.awaitEmbeddingOperation() races scheduled work against abort and deadline boundaries, removes its timer and abort listener in finally, and attaches void work.catch(() => {}) when the guard is already aborted so a later worker/API rejection cannot become unhandled.packages/core/src/embedding/contract.ts defines EmbeddingRequestAbortedError with message "Embedding request aborted", EmbeddingQueueCapacityError with message "Embedding queue capacity exceeded", and EmbeddingWorkerWatchdogError with stage "init" or "execution" and message Embedding worker ${stage} watchdog expired.awaitWorkerShutdown(worker, timeoutMs) posts { type: "shutdown" }, resolves on worker "exit", and starts a hard timeout with setTimeout(forceTerminate, Math.max(0, timeoutMs)) plus killTimer.unref?.(). If posting fails or the timeout expires, it calls worker.terminate(); rejected termination produces Error("embedding worker termination was not confirmed", { cause }).isRecallEmbed(texts, inputType) returns true only for one query text. l2Normalize(vec) returns the original vector when its norm is non-positive or non-finite; otherwise it returns a new Float32Array whose elements are divided by the Euclidean norm.