Dashboard › opencode › Distillation
5d798ecd-398a-4f07-8277-6beceb4814e9["lore_tm_v1_d4JU4VR02k__CoyaQtnsegvQ8rKRrhD_MSEUP5km6EQ","lore_tm_v1_JrU9GiZGjfW2UAqiFc46T5WedSgMs8WD36klOYf_e38","lore_tm_v1_vPGhaLgCVCTJqjv3ZNSdIDqR_JHPVQd7kwquodMdnCI","lore_tm_v1_dRZEhuv6HVRd5EfLI3aRj2wkmmTVYrsVL5rHxhKmhDg","lore_tm_v1_TPttw7Hg2NRKZ71O5-SvrsrxccQrhochgyrqBu0SAUo","lore_tm_v1_hMNPCI2QodcMZh737b68OM5NuAZZe45MMR5CXYZr1dE"]
/home/byk/Code/opencode-lore-v2/packages/core/src/index.ts:348-373 exports distillLimiter, curatorLimiter, tokenization APIs estimateTokens, encodingForModel, and TOKEN_ESTIMATE_CACHE_VERSION, SemanticTokenCache, fetch-interceptor APIs installFetchInterceptor, rewriteRequest, shouldIntercept, DynamicRequestHeaders, DynamicRequestHeadersSource, and FetchInterceptorConfig, namespace workerModel, and search APIs ftsQuery, ftsQueryOr, ftsQueryRelaxed, EMPTY_QUERY, reciprocalRankFusion, expandQuery, extractTopTerms, and exactTermMatchRank./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:11-51 defines createMockClient() with mocked tui.showToast and session methods get, list, create, messages, message, and prompt; initPlugin() creates a timestamped __tmp_plugin_${Date.now()}__ directory and invokes LorePlugin with project ID "test", serverUrl: new URL("http://localhost:0"), and that temporary path as project.path, directory, and worktree./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:54-65 tests that the LorePlugin config hook disables built-in compaction by setting cfg.compaction to { auto: false, prune: false }./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:67-107 tests registration of 3 hidden worker agents: "lore-distill" with description "Lore memory distillation worker", "lore-curator" with description "Lore knowledge curator worker", and "lore-query-expand" with description "Lore query expansion worker"; each must have mode: "subagent" and hidden: true.mode: "subagent" rather than "all" or "primary" because OpenCode honors hidden only for subagent-mode agents, ensuring it “never surfaces in the host project's agent/skill picker.”/home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:109-126 tests that the config hook preserves an existing "my-agent" entry with { hidden: false, description: "Custom" } while also adding "lore-distill"./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:128-151 contains a regression test requiring applyLoreProviderConfig(cfg, "http://127.0.0.1:3207") to set options.baseURL to "http://127.0.0.1:3207/v1" for every configured provider, specifically openai, anthropic, google, and mistral.OPENAI_BASE_URL by stripping /v1, causing requests to http://host/messages instead of /v1/messages and a gateway 404; the plugin pins every provider because OpenCode’s resolveSDK() bypasses OPENAI_BASE_URL and ANTHROPIC_BASE_URL, while other @ai-sdk providers have no baseURL environment variable./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:153-170 tests preservation of existing per-provider options, including Anthropic defaultHeaders: { "X-Custom": "value" }./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:278-309 guards against the v1.17.4 crash undefined is not an object (evaluating 'A.event') by requiring the plugin entry module to expose exactly 2 export keys, "LorePlugin" and "default", with default being the same function reference as LorePlugin.getLegacyPlugins/getServerPlugin loader iterating Object.values(mod): every function export was invoked as a plugin and its return value appended to host hooks, so invoking applyLoreProviderConfig inserted undefined and later crashed dispatch; every non-function export instead caused Plugin export is not a function and dropped the plugin entirely./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:295-308 strictly rejects any plugin entry export beyond LorePlugin and default, whether function or non-function, and simulates legacy-loader reference deduplication by asserting the set of function-valued exports has size 1 and contains mod.LorePlugin./home/byk/Code/opencode-lore-v2/.github/workflows/ci.yml:130-150 defines job-level permissions contents: read, pull-requests: write, statuses: write, and actions: read; exposes output nightly-version: ${{ steps.nightly.outputs.version }}; uses actions/checkout@v6 with fetch-tags: true, pnpm/action-setup@v6, and actions/setup-node@v6 with Node '24' and registry 'https://registry.npmjs.org'.pull-requests: write, statuses: write, and actions: read support Codecov PR comments and commit statuses./home/byk/Code/opencode-lore-v2/.github/workflows/ci.yml:152-184 runs pnpm install --frozen-lockfile, pnpm run build, pnpm run typecheck, pnpm run lint, and pnpm run format:check in that order.pretest hook in package.json to build the @loreai/gateway bundle before pnpm test; a later "Build npm bundle" step rebuilds it with SENTRY_AUTH_TOKEN for sourcemap upload and binary smoke tests./home/byk/Code/opencode-lore-v2/.github/workflows/ci.yml:163-175 restores .vendor-build with actions/cache@v5 using key vendor-${{ hashFiles('packages/core/package.json', 'packages/gateway/script/vendor-embeddings.ts', 'packages/gateway/script/vendor-paths.ts', 'packages/gateway/script/vendor-sqlite-vec.ts') }}; on a cache miss it runs pnpm tsx packages/gateway/script/vendor-embeddings.ts. The vendored embedding model avoids transient HuggingFace Hub 429 errors./home/byk/Code/opencode-lore-v2/packages/opencode/node_modules/@opencode/plugin/dist/host.js:4-29 implements resolve(target) by probing server subpaths in order ["server", ""], TUI subpaths ["tui"], and RPC subpaths ["rpc"]; named targets form [target.name, subpath].filter(Boolean).join("/"), while directory targets use path.resolve(target.directory, subpath || "index").host.js suppresses resolution failures only for error codes ENOENT, ENOTDIR, MODULE_NOT_FOUND, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_PATH_NOT_EXPORTED, and ERR_UNSUPPORTED_DIR_IMPORT; unmatched entrypoint searches return undefined./home/byk/Code/opencode-lore-v2/packages/opencode/node_modules/@opencode/plugin/dist/host.js:29-32 returns { server, tui, rpc } entrypoints from resolve(target), and load(entrypoint) delegates directly to importModule(entrypoint).