Dashboard › opencode › Distillation
fa62384a-2935-4835-8470-087a82729a66["lore_tm_v1_BzvjuOBQoFQsT4pQY34m-58X91JZC7KfJk5qxvg4rx4","lore_tm_v1_96-7mrXtoplDTwcqB0tdhKSIootApPERNQSIZwOF0JU","lore_tm_v1_tmC_Zs-A7oISK9ElY7cd8l7s_0Saphciuw-sgFT-eJw","lore_tm_v1_buGM55kF1W-NgR6Hi0ckb4bWOoqnxlb_a5mxQggzowo"]
Date: Sep 15, 2026
packages/core/src/session/runner/publish-llm-event.ts:360-379 tool-call publication ensures tool input has ended, rejects a changed tool name with Tool call name changed for ${event.id}: ${tool.name} -> ${event.name}, rejects duplicate calls with Duplicate tool call: ${event.id}, records providerExecuted and providerMetadata, and publishes SessionEvent.Tool.Called with sessionID, timestamp, assistantMessageID, callID, tool name, recorded input, and provider execution metadata.packages/core/src/session/runner/publish-llm-event.ts:382-419 tool-result handling rejects results before a call and changed tool names. If already settled, duplicate error results are ignored, while duplicate non-error results die with Duplicate tool result: ${event.id}.settledOutput(event.output, event.result). Errors publish SessionEvent.Tool.Failed with the normalized error, original event.result, and provider data; successes publish SessionEvent.Tool.Success with normalized output, outputPaths, provider data, and include the original event.result only when provider.executed is true.packages/core/src/session/runner/publish-llm-event.ts:421-438 tool-error handling requires a prior call, stable tool name, and an unsettled tool; it publishes SessionEvent.Tool.Failed with { type: "unknown", message: event.message } and the stored provider execution/metadata state.packages/core/src/session/runner/publish-llm-event.ts:441-452 handles step-finish by calling flush(), setting assistantActive = false, rejecting duplicate finishes with Duplicate step finish, and storing { finish: event.reason, tokens: tokens(event.usage) }; finish itself is a no-op, while provider-error sets providerFailed = true and calls failAssistant(event.message).packages/core/src/session/runner/publish-llm-event.ts exposes publish, flush, failAssistant, interruptAssistant, failUnsettledTools, hasActiveAssistant, hasAssistantStarted, hasProviderError, stepSettlement, startAssistant, and assistantMessageID.packages/core/src/session/runner/llm.ts control flow defines a ContinueAfterCompaction result carrying step, promotes recovery input with SessionInput.promoteExact(...), sets execution to { phase: "unknown", assistant_message_id: null } on an uncertain path, invokes recoverOverflow(...) for overflow recovery, and clears toolFibers when the stream fails with interrupts.packages/core/src/session/runner/llm.ts run-loop logic suppresses pending-steer detection while recovering (recovering ? false : SessionInput.hasPending(..., "steer")) and advances the step counter with step = result.step + 1.