Dashboard › opencode › Distillation
163bf5ac-c036-4441-97dc-ab9c85e49cd8["lore_tm_v1_875nHhuVcr8wlRArjUVfAw3W2qpUtUsWQwvpLDFaxH4","lore_tm_v1_RY93GnQTfyclvO-McP8irlQ0EZvd_J3gH79tSrnOf0Q","lore_tm_v1_qSypdaozQ1bMBHhIhI7DYqnaRwjXv73iSGJ8PrEdnsU","lore_tm_v1_QYMq3WODo04hy96LjCHXb_p54ADewMHKUpJQxkZAUXg","lore_tm_v1_ojFRl5L_cqpM3uz9X0npHB0EffeKKQX9mFIGvXXohpQ","lore_tm_v1_WcxC7ZGZapah6yEHpaXjiDkPxl6hheJEi8MaMRq_sss","lore_tm_v1_iqzwq2ZHihyuFwn-LIkh-amtFYB8N-mfFG8jnWrT8C4","lore_tm_v1_Sh2eK7lOMXHPs-vjy6StwKMr5zFMlvLLDsK_Gtc3lMM","lore_tm_v1_j1FpbD11bPZ0TkNQ2Atvv0Iy_4tlwLDQR5b1hLRDtEQ","lore_tm_v1_9c6ID7ylHDdobI6Y5dAwhSrT5LFP5b2MFZ2BfoReRFA","lore_tm_v1_kXUeWnbJ3RGCwQem0jG_efAxcr0vdtGAaMjetv9GMnE","lore_tm_v1_GMhruLZDm3-2HImlULHRCtQQXMKhAV6VARrK1XTEDdc","lore_tm_v1_pEf8VsWvrlI-mMkii6xoaF1fEZXDepSIboK0wy1WSu8"]
/home/byk/Code/opencode-v2-pilot/packages/server/test/plugin-activation.test.ts, whose fixture creates independent first and second directories, registers an SDK plugin, and sends authenticated requests with location[directory] using Basic credentials opencode:secret./home/byk/Code/opencode-v2-pilot/packages/server/test/plugin-activation.test.ts:60-120 tests that /api/plugin/await-activation waits only for the requested location: blocked setup for first does not block /api/model, /api/plugin, or successful activation of second; after release, first exposes configured model acme/reasoner (Configured Reasoner, context 96_000, output 8_000) and plugin slow-plugin as { source: { type: "sdk" }, state: { status: "active" } }./home/byk/Code/opencode-v2-pilot/packages/server/test/plugin-activation.test.ts:123-165 tests that aborting a request waiting for activation returns HTTP 499 but does not interrupt plugin setup; after releasing setup, a later wait returns 204, completion is true, interruption is false, and slow-plugin is active./home/byk/Code/opencode-v2-pilot/packages/server/test/plugin-activation.test.ts:167-192 tests that setup failure still settles /api/plugin/await-activation with 204 and exposes failing-plugin in inventory as SDK-sourced with state.status: "failed" and an error containing fixture setup failed./home/byk/Code/opencode-v2-pilot/packages/sdk/test/contract-identity.test.ts; it asserts SDK canonical exports in exact sorted order: 1. AbsolutePath, 2. Agent, 3. ClientError, 4. Command, 5. Config, 6. Credential, 7. Event, 8. FileSystem, 9. Integration, 10. Location, 11. Model, 12. OpenCode, 13. Permission, 14. PermissionSaved, 15. Project, 16. Prompt, 17. PromptInput, 18. Provider, 19. Pty, 20. Question, 21. Reference, 22. RelativePath, 23. Session, 24. SessionInbox, 25. SessionMessage, 26. Skill, 27. Tool, 28. WebSearch, 29. Workspace, 30. Worktree./home/byk/Code/opencode-v2-pilot/packages/sdk/test/contract-identity.test.ts:72-93 asserts Core and Server reuse authoritative Schema and Protocol values, including CoreAgent.ID === Agent.ID, CoreLocation.Ref === Location.Ref, CoreModel.Ref === Model.Ref, CoreSession.Info === Session.Info, CoreProject.Current === Project.Current, CoreWorktree.List === Worktree.List, CoreWorktree.Info === Worktree.Info, corresponding SessionInbox and SessionMessage identities, matching API group keys, and ID prefixes/constants ses_, global, anthropic, and wrk_./home/byk/Code/opencode-v2-pilot/packages/sdk/test/contract-identity.test.ts:95-100 compiles Api and ClientApi with { groupNames, omitEndpoints: promiseOmitEndpoints } and requires emitPromise(client) to equal emitPromise(server)./home/byk/Code/opencode-lore/packages/opencode/src/index.ts:117-153 keeps process-wide processInitDone, processLoreActive, and processLoreBase, plus paired fallback currentProject: { path: string; gitRemote: string } | undefined; project state is keyed by ctx.project.id and stores { projectPath, gitRemote, lastSeenAt }.SESSION_STATE_TTL_MS = 24 * 60 * 60 * 1000; stale projectState and sessionParent entries are opportunistically deleted when lastSeenAt is older than the cutoff./home/byk/Code/opencode-lore/packages/opencode/src/index.ts:167-216 caches immutable session-parent lookups as session.id → { parentID: string | null, lastSeenAt }; successful lookups, including null for primary sessions, are cached, while failed lookups are not cached and return null./home/byk/Code/opencode-lore/packages/opencode/src/index.ts:219-288 memoizes gateway initialization in loreInitPromise, honors LORE_DISABLED values "1" and "true", probes with resolveGatewayUrl() before startInProcess(), and stores successful initialization in processLoreActive and processLoreBase.LORE_OPENCODE_FORCE_ACTIVE === "1"; otherwise it is inert when NODE_ENV === "test" or any process.argv entry contains .test.. Active tests can use LORE_GATEWAY_URL while retaining test logging/DB behavior.log.silenceStderr() before gateway initialization because OpenCode owns a full-screen TUI; logging still goes to the log file and Sentry sink. In inert test mode, console behavior is left unchanged.surfaceGatewayUnavailable(ctx.client, msg); module-resolution-like failures additionally recommend pnpm --filter @loreai/gateway run bundle or run build for a dev checkout.discoverWorkspaceRoot(ctx.worktree || ctx.directory) and reuses a cached git remote only when the cached projectPath equals the newly discovered path; otherwise it runs getGitRemote(thisProjectPath) ?? ""./home/byk/Code/opencode-lore/packages/opencode/src/index.ts:420-455 sets x-lore-provider, maps provider IDs to LORE_UPSTREAM_<PROVIDER> by uppercasing and replacing - with _, and sets x-lore-upstream-url only if it is not already present.LORE_UPSTREAM_EXTRA_HEADERS line-by-line using the first : separator, trims names and values, skips blank/malformed lines, and forwards only names accepted by shouldForwardUpstreamExtraHeader(name) so gateway-managed headers are not clobbered.log and “NEVER a raw stderr write: OpenCode owns a full-screen TUI and any stray byte corrupts it.”/home/byk/Code/opencode-lore/packages/opencode/src/index.ts:459-490 logs active: <projectPath> once during process initialization; when active, it installs the fetch interceptor once, logs routing through <gatewayBase> and dashboard: <gatewayBase>/ui, then sets processInitDone = true.gatewayAccessHeadersForRemote(gatewayBase), x-lore-project from currentProject.path, and x-lore-git-remote only from the same paired currentProject object—“never a remote left over from a different project's plugin call.”log.error("init failed: ...") before being rethrown, preserving the cause in file/Sentry logging even when stderr is silenced./home/byk/Code/opencode-lore/packages/opencode/src/index.ts:505-510 warns that the legacy entry module must export only LorePlugin plus the same-reference default; the legacy loader invokes every function export as a plugin and throws on non-function exports, so helpers must remain in ./internal.ts. This shape is guarded by the plugin entry module export shape test in test/index.test.ts./home/byk/Code/opencode-v2-pilot/packages/plugin/src/host.ts:17-43 resolves server entrypoints in priority order ["server", ""], and separately resolves ["tui"] and ["rpc"]; it suppresses only resolution errors with codes ENOENT, ENOTDIR, MODULE_NOT_FOUND, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_PATH_NOT_EXPORTED, and ERR_UNSUPPORTED_DIR_IMPORT./home/byk/Code/opencode-v2-pilot/packages/sdk/src/internal/host.ts:27-65 creates a ManagedRuntime, gets its services, starts SessionRestart.Service.resumeSuspendedSessions using runtime.runFork(...), builds an owned in-memory fetch transport with OwnedFetch.make(handler, runtime.dispose), and returns { runtime, fetch, plugins, workspace, close }; creation errors dispose the runtime through Effect.onError(() => runtime.disposeEffect).app.name to "sdk" and database path to ":memory:"; optional workspace providers replace WorkspaceDriver.node, and optional instance configuration is supplied through SdkInstances.node./home/byk/Code/opencode-v2-pilot/packages/core/test/state.test.ts:55-71 demonstrates that transforms rerun against fresh initial state on every reload(): a captured value changing from "first" to "second" produces state ["second"], not accumulated ["first", "second"]./home/byk/Code/opencode-v2-pilot/packages/core/test/state.test.ts:74-93 demonstrates idempotent transform disposal: disposing the registration that adds "second" rebuilds state from ["first", "second"] to ["first"], and disposing it again leaves ["first"] unchanged.