Dashboard › opencode › Distillation
030e0edc-f936-4916-b03e-d302d560eef6["lore_tm_v1_eehaquJs-4YMMxdIBlxfHN0DoQVxBCKtu_AvECHmI_w","lore_tm_v1_Z9KGPhoT2C2gzqt2vrtTCbrbaT5_OVhBrO_pUmQDT-M","lore_tm_v1_KBdH48vB5as9ITc3JYArRrsNjNf2_uDeeriqXCRcKpA","lore_tm_v1_qbqG8p7jc74_bSy-RFOpujyngsU3Tutso0DMubKyGog","lore_tm_v1_SeBTuRBZRvC5ms5sNkyFcs62MI546av1A8GqcdLDEzw","lore_tm_v1_ZV4Bw4mnSuAKA90mcLfrGze7bzPpI71rKh3VaVXLe2Q","lore_tm_v1_9XE84UIwicv_ApKDi_aMtuOcZBsY59DuIUdxghRgO8U","lore_tm_v1_F5eXMBN3LmtnhsxbU5XCNXe5AwbfP6-3r9WlbqNFEp0","lore_tm_v1_DbMiAbxdexmaDoSBqJH5WM5KjBXLxyxIArUvKHnlySw","lore_tm_v1_taaSpQC4gP88YarH3fbnZ5eB4YIYT8oNMMM7PkWPSOc","lore_tm_v1_0GpVioMZC5sjnlObayecdLhrfBe0zoGmP0ikSq2wEO4","lore_tm_v1_pDwSkDm0vLVJbagktoKuXdGt5eUDKv4k-RmiJWUAUdU","lore_tm_v1_KmtB6VzE4G_ERrWNd_J9gofhefKN02SKOSRCspevGfY","lore_tm_v1_WvQq0nsa_miZPo3TlQzCooMpfRCsX3x0m7FQn1sbthQ","lore_tm_v1_uWFgW3xswh3Wt44nOT-vEHKVGohAvPeaLb09YnlDSoU","lore_tm_v1_W-LicvvgOS84SQfSxVjF8Rlvw2-G-SSBzCaSSCDXWjU","lore_tm_v1_2rZgthj9DBXEluft6354eh-roaj45b-tkjlB_SSn2Ig","lore_tm_v1_ga84wVbib6gcyn3PXoeZoBemzpuIPxIEysuz6FLPc0s","lore_tm_v1_WHnsw1uM4fpoLl5-GAf45_iwAMiVsyr6Q2gATCgud5g","lore_tm_v1_vUm6ziMDsFrCGc0LRvBUQC5qLb_jeNWs85ft1mT00p0","lore_tm_v1_RYoB6SiBmTbIWKeJz3lbSoUW0stKwEVNponxzPZtXa0","lore_tm_v1_bGcbjzs0Og6pls9GUwVmn78uG_6fossBx9l24hC4xhM","lore_tm_v1_8YGMQ64PkLhy0SDv7371fV1mAfEx_o7tTaUGBVq8grA"]
11 matches across OpenCode session code: packages/core/src/session/title.ts uses source: "title", kind: "title", and scope: { session: input.session, agentID: input.agent.id, model: input.model }; packages/core/src/session/model-request.ts defines readonly agentID: Agent.ID and uses input.scope.contextAgentID ?? input.scope.agentID plus input.scope.agentID; packages/core/src/session/generate.ts supplies scope: { session: selection.session, agentID: selection.agent.id, model, tools: selection.tools }; packages/core/src/session/context.ts gets Agent.ID.make("title"); packages/core/src/session/compaction.ts uses agentID: Agent.ID.make("compaction"); and packages/core/src/session/runner/llm.ts passes loaded.agent.id./home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts:45-84, SessionTitle.attempt prepares a request with kind: "title", the title agentβs ID/model/session scope, one user message containing input.text, optional title-agent system instructions, and contextHooks: false; streaming collects textDelta chunks, marks provider errors via failed = true, accumulates step usage with SessionUsage.record/SessionUsage.add, and publishes SessionEvent.UsageRecorded with source: "title" when usage exists./home/byk/Code/opencode-lore-v2/packages/core/src/log.ts:463-505 defines logging behavior: info(...) and warn(...) are stderr debug-gated by LORE_DEBUG=1; notice(...) is user-facing and not debug-gated, reports to the sink at warning severity, and writes at "warn" level; all levels respect embedded/TUI stderr silencing while continuing to hit the file and sink.error(...) in /home/byk/Code/opencode-lore-v2/packages/core/src/log.ts:496-505 emits to stderr unless stderr is silenced, reports to sink?.error, writes at "error" level, and sends a sanitized discovered Error to sink?.captureException./home/byk/Code/opencode-lore-v2 displayed exactly 100 matches with more available, spanning gateway server debug output, upgrade/version-check/inventory/invariant-check/uninstall/error/command/progress/output utilities, and team-cmd.ts./home/byk/Code/opencode-lore-v2/packages/gateway/src/server.ts:870-914 requires matching gateway access credentials for data-plane paths when config.remoteGateway || config.hostedMode, rejects conflicting provider-auth headers, strips the gateway access header, returns no-CORS 204 for OPTIONS, debug-logs method/path only when stderr is not silenced, and definitively rejects WebSocket upgrades rather than returning a misleading 404./home/byk/Code/opencode-lore-v2/packages/gateway/src/server.ts:1194-1231 returns 400 Bad Request with Cache-Control: no-store for conflicting provider authentication headers; otherwise it returns an error body with type websocket_not_supported and message WebSocket transport is not supported for ${url}; use HTTP..socket.end(data) so the response flushes before EOF; socket.destroy() was rejected because it races response delivery and can cause undici/Bun fetch to see ECONNRESET instead of parsing the HTTP 426.packages/core/src/fetch-interceptor.ts, packages/core/src/index.ts, packages/opencode/package.json, packages/opencode/src/index.ts, packages/opencode/src/internal.ts, packages/opencode/test/internal.test.ts, and pnpm-lock.yaml; added files packages/core/test/fetch-interceptor-request.test.ts, packages/opencode/script/build.ts, packages/opencode/src/server-runtime.ts, packages/opencode/src/server.ts, packages/opencode/test/package.test.ts, packages/opencode/test/server-runtime.test.ts, and packages/opencode/test/server.test.ts; and untracked file packages/opencode/src/server-core.ts./home/byk/Code/opencode-lore-v2/packages/opencode/src/server-core.ts contains exactly 4 lines and exports GATEWAY_AUTH_HEADER from ../../core/src/credential-headers, rewriteRequest from ../../core/src/fetch-interceptor, getGitRemote from ../../core/src/git, and * as log from ../../core/src/log./home/byk/Code/opencode-lore-v2/packages/opencode/src/index.ts:170-218 maintains a sessionParent cache keyed by session ID with { parentID: string | null; lastSeenAt: number }, reaped using SESSION_STATE_TTL_MS; successful lookups cache both real parent IDs and the common primary-session null, while failures are not cached so transient errors retry on the next turn.resolveParentSession(client, sessionID) calls client.session.get({ path: { id: sessionID } }), derives res.data?.parentID ?? null, refreshes cache timestamps on hits, and forwards non-null parent IDs through x-parent-session-id so the gateway identifies Task child sessions as sub-agents and sizes LTM injection according to issue #1300.null without throwing./home/byk/Code/opencode-lore-v2/packages/opencode/src/index.ts:220-240 memoizes Lore initialization with loreInitPromise; isInertTestEnv() keeps the plugin inert under NODE_ENV=test or a .test. argv entry unless LORE_OPENCODE_FORCE_ACTIVE=1, allowing controlled active-path tests via LORE_GATEWAY_URL while retaining test logging/database behavior, mirroring LORE_PI_FORCE_ACTIVE.v4.1.8 in /home/byk/Code/opencode-lore-v2 passed exactly 3 test files and 22 tests; start time was 15:07:52, total duration 7.64s, with transform 6.50s, setup 4.05s, import 6.06s, tests 584ms, and environment 0ms.11 @loreai/core/rewriteRequest-related matches: packages/opencode/script/build.ts aliases @loreai/core to src/server-core.ts; packages/opencode/src/server.ts imports and invokes rewriteRequest; packages/opencode/src/internal.ts imports GATEWAY_AUTH_HEADER and log; packages/opencode/src/server-core.ts exports GATEWAY_AUTH_HEADER and rewriteRequest; and packages/opencode/test/server.test.ts mocks and asserts rewriteRequest./home/byk/Code/opencode-lore-v2/packages/opencode/script/build.ts deletes and recreates dist, then bundles src/server.ts to dist/server.js using esbuild with format: "esm", platform: "node", target: "esnext", sourcemap: true, alias @loreai/core β src/server-core.ts, externals ["@opencode/plugin", "@loreai/gateway"], and logLevel: "info".No files found; the supplied result did not identify the search pattern./home/byk/Code/opencode-lore-v2/packages/opencode/src/server.ts defines three hidden subagent workers in order: 1. lore-distill β Lore memory distillation worker; 2. lore-curator β Lore knowledge curator worker; 3. lore-query-expand β Lore query expansion worker.model.request hook best-effort fetches the session, builds headers with runtime/session/optional parentID/agent/provider ID, merges them into event.headers, and redirects event.baseURL to ${runtime.gatewayBase}/v1 when x-lore-upstream-url is present.http.request hook replaces event.request with await rewriteRequest(event.request, runtime.gatewayBase, {})./home/byk/Code/opencode-lore-v2/packages/opencode/src/server.ts disposes completed registrations and releases the runtime with Promise.allSettled if setup fails, then rethrows the original error; normal cleanup is idempotent and throws AggregateError(failures, "Lore plugin cleanup failed") when any disposal/release operation rejects.packages/opencode/src/server-core.ts has SHA-256 checksum 767eaba533f86fc7ef171d6718267853f80436cf3dcfcfc661d8aca08d9abdf4./home/byk/Code/opencode-v2-pilot found exactly 9 matches: packages/core/src/session/title.ts exports SessionTitle, defines Service, SessionTitle.attempt, and SessionTitle.generate; packages/core/src/session/runner/llm.ts imports/injects SessionTitle, triggers title.generate(sessionID) after promotion when the selected session has no parent and is untitled, and includes SessionTitle.node./home/byk/Code/opencode-v2-pilot/packages/core/src/session/title.ts:101-149 generates titles from the first user message; for an already titled session it constructs Original request: plus recent user/assistant conversation, bounded by MAX_FIRST_MESSAGE_LENGTH and MAX_CONTEXT_LENGTH, with fallback to the first-user text if context loading fails.selection.selected; if that fails and selection.primary differs from it, generation retries with selection.primary. A successful title is only published as SessionEvent.Renamed if the session still exists, its prior title is unchanged, and the truncated candidate differs; sequence checking prevents racing title changes./home/byk/Code/opencode-v2-pilot/packages/core/src/session/context.ts separates model-request resolution into select (session, agent, instructions, tools) and load (model and active history), while auxiliary title work uses selectTitle without instruction/tool preflight and request preparation remains separate.SessionContext.selectTitle(session) gets the "title" agent, resolves the primary session model best-effort, prefers the title agentβs configured model or the providerβs small model, chooses the first supported minimal-reasoning variant from MINIMAL_REASONING_VARIANTS unless the agent specifies a variant, resolves that preferred model best-effort, and returns preferred ?? primary; it returns undefined if no title agent/model is available.SessionContext.select(sessionID) validates the session location, flushes MCP tools, resolves the selected agent, and concurrently loads tool snapshots plus built-in, discovered, skill, reference, MCP, and session-entry instructions with concurrency: "unbounded" before combining them in that order.5 x-lore-agent matches: "build" appears in packages/opencode/test/server.test.ts, packages/opencode/test/server-runtime.test.ts, and twice in packages/opencode/test/routing.e2e.test.ts; packages/opencode/test/session-state.test.ts expects "x-lore-agent" to equal "coder"./home/byk/Code/opencode-lore-v2/packages/opencode/test/index.test.ts:33 creates a temporary plugin directory using ${fileURLToPath(new URL(".", import.meta.url))}/__tmp_plugin_${Date.now()}__./home/byk/Code/opencode-v2-pilot/packages/core/test found exactly 16 relevant matches: provider-github-copilot.test.ts passes SessionRequestKind and tests compaction classification by kind; session-model-request-hooks.test.ts records request/response hook, kind, and Agent.ID; session-execution.test.ts contains 7 displayed kind: "subagent" matches; and job.test.ts contains 2./home/byk/Code/opencode-v2-pilot/packages/core/test/plugin/provider-github-copilot.test.ts, test helpers create a parent session and a child whose parentID is that parent, then trigger session/model.request with session ID, Agent.ID, GitHub Copilot model gpt-5.4, request kind, and empty headers.apiEndpoint wins over enterpriseUrl; explicit chat_enabled: false yields either a Copilot Free or subscription or a seat error; chat_enabled: true or absent entitlement does not block; device OAuth is registered as github-copilot method ID device with label Login with GitHub Copilot; and the generic key method is removed while GITHUB_TOKEN env auth remains.Authorization: Bearer token, removal of x-api-key, x-initiator: user, copilot-vision-request: true for image requests, x-github-api-version: 2026-08-01, user agent opencode/beta/1.2.3/test, and Anthropic beta interleaved-thinking-2025-05-14 for native Anthropic requests.X-Interaction-Type: conversation-agent; primary child-session requests β conversation-subagent plus x-initiator: agent; title requests β conversation-background plus x-initiator: agent; compaction requests β conversation-compaction by request kind even when the agent is "build"; a primary request from an agent named "compaction" remains conversation-agent; all include X-Interaction-Id: event.sessionID.openai are ignored and retain empty headers./home/byk/Code/opencode-lore-v2/packages/gateway/src/translate/bedrock-runtime.ts found exactly 11 matches involving AbortSignal, request cancellation, and authorization: readBedrockRuntimeRequestBody accepts a signal, passes it through, calls signal.throwIfAborted(), and invokes cancelAndReleaseReader(reader, signal.reason); "proxy-authorization" is handled among headers; end-to-end AWS headers include Authorization and signed x-amz-*; and request handling creates createForegroundAbortScope(req.signal) and consistently passes abortScope.signal through body reading and upstream operations.