Dashboard › opencode › Distillation
753bfe84-4b12-4bce-818d-00e1affb6f7b["lore_tm_v1_Mg1VVomOlYVnOOAdy5bt5wqjfn_B0o5-0cDrhzjC6PI","lore_tm_v1_0KzGrtksbcSkAksV1DD4u85EIcOKl-U_nVEzLQa8XUc","lore_tm_v1_XSLm-VPDacTT3Egs0yLj9Hmsu4WAsk5HiW4hDx16lBs","lore_tm_v1_iCSdxdogd0CpWxI5WuX2t2mAznb5IL6Ac_WZ3c790xc","lore_tm_v1_A25CW11sVrrLv7ZtOb3gsFSjUJYG38K680uavWv_OXA","lore_tm_v1_B7t568Jm9Tbjod0HDnFt0FiG2zUeaMNR5WJNUDmQzCE","lore_tm_v1_CnxywX8dDmiwz5ziqgVhC-EpNmSzVQziUxDO3ie6pMg","lore_tm_v1_ih-dX42gbtNbu5S3Htb-gvkyrcXDBsxF8syUaZMv7A4","lore_tm_v1_NW3uTyQGdR7enlarTxPTJFzVFIxGOyTrWQsiHElQ0NY","lore_tm_v1_XqPlNNKFuS5q_Sy0Cw-ThHk2gDqdaInj_QiXg6bP-u4","lore_tm_v1_V2C9rSwLvNLUVl0J1gE5NfgIHAPt9Kw1EMnhPQB3z3U","lore_tm_v1_LRS8ViRwTzMG91WMoIvmd27P3860G86QURSEAiSsQHM"]
/home/byk/Code/opencode-lore-v2 repository root contains 27 entries: .craft.yml, .git, .github/, .gitignore, .jj/, .lore.md, .oxfmtrc.json, .oxlintrc.json, AGENTS.md, CHANGELOG.md, codecov.yml, LICENSE, package.json, packages/, patches/, pnpm-lock.yaml, pnpm-workspace.yaml, quality/, README.md, scripts/, stryker.config.mjs, supabase/, tsconfig.base.json, tsconfig.json, vitest.config.ts, vitest.evals.config.ts, and vitest.mutation.config.ts.installFetchInterceptor/detectProtocolFromBody/interceptUrlForProtocol references: active callers in packages/pi/src/index.ts lines 31 and 132 and packages/opencode/src/index.ts lines 6 and 470; tests in packages/core/test/fetch-interceptor-install.test.ts, packages/core/test/fetch-interceptor-global.test.ts, and packages/core/test/fetch-interceptor-body.test.ts; bundle commentary in packages/gateway/script/bundle.ts line 144; exports in packages/core/src/index.ts line 356; and implementations/usages in packages/core/src/fetch-interceptor.ts lines 148, 240, 322, 338, 421, 522, and 528.lore-v2-plugin at empty commit wlpqmtos 43a74d7e, description feat(opencode): add V2 server plugin, based on parent uutomtup 42911412 main | fix(gateway): preserve large recall continuations (#1730); working copy had no changes./home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts lines 243–270 implement httpMiddleware, exposing each outbound HTTP exchange to session.http.request and session.http.response hooks as web-standard Request/Response values.httpMiddleware, hooks.trigger("session", "http.request", {...scope, request}) may replace the request; the result is converted with HttpClientRequest.fromWeb(), and a present body is cloned into a Uint8Array with its content-type before dispatch through handler(sent).httpMiddleware, the response hook receives request: before.request and a web Response; statuses 204, 205, and 304 receive a null body, while other response streams use Stream.toReadableStreamEffect(response.stream). The hook-returned response is converted via HttpClientResponse.fromWeb(sent, after.response), and non-Error causes are wrapped with new Error(String(cause)).SessionModelRequest.prepare in /home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts checks hooks.has("session", "http.request", resolved.ref.providerID) and hooks.has("session", "http.response", resolved.ref.providerID); when either exists, it installs httpMiddleware with scope fields sessionID, agent, model, and kind.SessionModelRequest.prepare enables response WebSockets only when resolved.capabilities.responsesWebsockets === true, the provider-specific responsesWebSocketFlag() resolves true, input.webSocket === "session", and no HTTP hooks are installed; HTTP hooks therefore take precedence over transport.bind(session.id)./home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts defines location-scoped Service as @opencode/SessionModelRequest; its node depends on PluginHooks.node, SessionModelTransport.node, and App.node./home/byk/Code/opencode-lore-v2/packages/opencode/test/routing.e2e.test.ts explicitly validates process-wide fetch patching, gateway discovery, provider config rewriting, Lore attribution headers, and Anthropic request rerouting through a real in-process Lore gateway with a mocked upstream.globalThis.fetch before plugin activation, forces the active path with LORE_OPENCODE_FORCE_ACTIVE=1, points discovery at an ephemeral LORE_GATEWAY_URL, clears LORE_REMOTE_URL and LORE_DISABLED, and restores fetch and all saved environment variables in afterAll.config.port = 0, config.hosts = ["127.0.0.1"], config.remoteGateway = false, and config.hostedMode = false; setUpstreamInterceptor() increments upstreamCalls and returns an Anthropic response containing "hello from mock upstream".LorePlugin with project ID proj-e2e, directory and worktree equal to process.cwd(), and serverUrl: new URL("http://localhost:0").options.baseURL to become ${baseURL}/v1, preserves existing apiKey: "x", and sets cfg.compaction to { auto: false, prune: false }.chat.headers E2E assertion requires x-lore-session-id: oc-sess-1, x-lore-agent: build, and x-lore-provider: anthropic for agent build, provider anthropic, model claude-3-5-sonnet, and message msg-1.POST https://api.anthropic.com/v1/messages with content-type: application/json, x-api-key: test-key, anthropic-version: 2023-06-01, Lore session/agent/provider/project headers, model claude-sonnet-4-20250514, max_tokens: 64, and one user message "hi"; it requires a successful response containing "hello from mock upstream" and an increase in upstreamCalls.setUpstreamInterceptor(undefined), closeDB(), and resetPipelineState({ fast: true }) after stopping the gateway, with best-effort error handling./home/byk/Code/opencode-v2-pilot/packages/schema/src/session.ts defines Session.Info with required id, projectID, cost, tokens, time, and location; optional parentID, fork, agent, model, outcome, title, subpath, metadata, and revert.Session.Info.fork, when present, contains sessionID and boundary: ForkBoundary; outcome is one of "succeeded", "failed", or "interrupted" and records the last completed execution at time.idle.Session.Info.time requires created and updated, with optional idle, viewed, and archived, all using DateTimeUtcFromMillis.parentID in /home/byk/Code/opencode-v2-pilot/packages/schema/src/session.ts line 34 and in /home/byk/Code/opencode-v2-pilot/packages/schema/src/v1/session.ts lines 461 and 550./home/byk/Code/opencode-v2-pilot/packages/client/src/promise/api.ts line 7 exports AgentApi = Client["agent"]./home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/client.ts defines agent.list as GET /api/agent with optional location, success status 200, and declared statuses 400 and 401; agent.get is GET /api/agent/${encodeURIComponent(input.agentID)} with optional location, success status 200, and declared statuses 400, 401, and 404.plugin.list as GET /api/plugin, plugin.awaitActivation as POST /api/plugin/await-activation with empty 204 success, and plugin.check as POST /api/plugin/check with body { target }; each accepts optional location.AgentListOutput in /home/byk/Code/opencode-v2-pilot/packages/client/src/promise/generated/types.ts line 2582 and /home/byk/Code/opencode-v2-pilot/packages/client/src/effect/api/api.ts line 70.AgentListInput with optional location fields directory and workspace; AgentListOutput wraps data: Array<AgentInfo> with location metadata { directory, workspaceID?, project: { id, directory, canonical } }.AgentGetInput with required string agentID and optional location fields directory and workspace; AgentGetOutput wraps data: AgentInfo with location metadata { directory, workspaceID?, project: { id, directory, canonical } }.