Dashboard › opencode › Distillation
1530dcce-a165-4d84-93f7-180b6719c457["lore_tm_v1_ZQZmrav1aR8HdienlsZXoC5HxnSgwrW7zoOPAPmeSKk"]
/home/byk/Code/opencode-v2-pilot/packages/core/test/session-model-request-hooks.test.ts is an 80-line Bun test file using testEffect(PluginTestLayer) and defines const it = testEffect(PluginTestLayer).session-model-request-hooks.test.ts defines KINDS: ReadonlyArray<SessionRequestKind> = ["primary", "compaction", "title", "generate"], preserving that exact request-kind order.session is created with Session.Info.make(...): ID ses_hook_kind, Project.ID.global, zero USD cost, zero input/output/reasoning/cache-read/cache-write tokens, created and updated times from DateTime.makeUnsafe(0), and location directory /project.model resolves OpenAIChat.route.model({ id: "gpt-5.5", provider: "test" }) through SessionRunnerModel.resolved(...); capabilities are tools enabled with text input and text output, cost is [], and limits are context: 200_000 and output: 32_000.transport implements SessionModelTransport.Service: bind() returns an executor that dies with "unused WebSocket execution", close() returns Effect.void, and closeAll is Effect.void.describe("SessionModelRequest HTTP hooks", ...) suite contains one test, "tags every Session request kind on http.request and http.response".PluginHooks handlers for "session", "http.request" and "session", "http.response"; each records { hook, kind: event.kind, agent: event.agent } into seen, with hook labels "request" and "response" respectively.SessionModelRequest.Service by providing SessionModelRequest.layer, then calls requests.prepare(...) once for each of "primary", "compaction", "title", and "generate".requests.prepare(...) call uses scope: { session, agentID: Agent.ID.make("build"), model } and an empty transcript { system: [], messages: [] }.prepared.options.http; if absent, it throws Expected HTTP middleware for ${kind}.https://example.test/v1/chat/completions; the downstream handler returns HttpClientResponse.fromWeb(request, new Response("{}", { status: 200 })).KINDS.flatMap(...): for each kind in order, first { hook: "request", kind, agent: Agent.ID.make("build") }, then { hook: "response", kind, agent: Agent.ID.make("build") }.Effect.provideService(SessionModelTransport.Service, transport), ensuring HTTP behavior is tested without WebSocket execution.