Dashboard › opencode › Distillation
8ae9c133-bd82-4542-80bc-674831cba10c["lore_tm_v1_t7ks8QmqKYYp1dGChiLBe6LlzzIAuGJFIyqgK48aw8Q"]
given is a Map from hook-facing definition objects { description: tool.description, input: { ...tool.inputSchema } } back to their original tools; definitions is created with canonical tool.name keys and those definition objects as values."session" / "context" hook receives context with sessionID: session.id, agent: input.scope.contextAgentID ?? input.scope.agentID, model: resolved.ref, transcript system and messages, mutable tools: definitions, and initially empty generation: {} and providerOptions: {}."session" / "context" hook is skipped only when input.contextHooks === false; otherwise it runs through hooks.trigger("session", "context", context).hooked matches each surviving context.tools entry first by definition-object identity through given.get(definition), then by key through registry.get(name).tool.name internally while receiving the hook-facing map key as its request name; its description becomes definition.description and its inputSchema becomes definition.input, allowing renamed calls to be translated back during execution.LLM.request(...) passed to applyModelHooks() uses the resolved model, sessionHeaders(session, app), context.system, processed context messages, context-hooked tools, input.toolChoice, and conditional generation/provider options.promptCacheKey is derived from session.fork?.sessionID ?? session.id; a TODO states cache lineage should be persisted so nested forks reuse the root session’s cache key.boundImages(unsupportedParts(context.messages, resolved.capabilities)).Array.from(hooked, ([name, tool]) => ({ ...tool, name })), exposing the post-hook name while retaining the matched tool data.context.generation and context.providerOptions are omitted from the request as undefined when their respective objects have no keys; otherwise their hook-mutated objects are passed through.input.webSocket === "session", the provider-specific webSocket capability/config result is true, and !hasHttpHooks; the transport is transport.bind(session.id).hasHttpHooks is true, options contains http, and the WebSocket option is not installed.options: StreamOptions conditionally spreads { http } when HTTP middleware exists and conditionally spreads { webSocket: transport.bind(session.id) } for eligible session WebSocket transport.executeTool: Prepared["executeTool"] calls tools.execute({ ...input, definitions: hooked }), supplying the hooked-name mapping for tool dispatch.executeTool applies Effect.catchCauseFilter(declineDefect, (decline) => Effect.fail(decline)), converting matching tool-decline defects into ordinary failures.retry: Prepared["retry"] triggers the "session" / "retry" hook with the retry event and discards its result through Effect.asVoid.request and options.