Dashboard › opencode › Distillation
092cbe2a-788e-4d47-92d4-33d4377f834b["lore_tm_v1_DzvhY85M9KroIMkh7cr-_QuVfcIFGPyiq_U_xWjD2eI","lore_tm_v1_7tF3uxb6em3XRNrljOZ_BYotY7-uikyxO7nAG6BeMEY","lore_tm_v1_fHrudq46TxmF9xMUo_a-FAkbMVSdYGo9qWhuwazHI0s"]
Date: Sep 17, 2026
SessionAlreadyProjected extends Error, maps session/message data into SessionTable, MessageTable, and SessionMessageTable, and updates token usage through applyUsage(...); cache-read usage is accumulated with tokens_cache_read: sql\${SessionTable.tokens_cache_read} + ${value.tokens.cache.read * sign}``.decodeRow(...) and getAssistant(messageID), handles shell rows where SessionMessageTable.type is "shell", and enforces the newer-turn supersession rule when selecting incomplete assistant projections.SessionV1.Event.Updated, message upserts using .onConflictDoUpdate({ target: MessageTable.id, set: { data } }), SessionEvent.ModelSwitched, SessionEvent.Prompted, SessionEvent.Tool.Called, and session deletion via db.delete(SessionTable).where(eq(SessionTable.id, event.data.sessionID)).if (previous) yield* applyUsage(db, row.session_id, previous, -1).messages: SessionMessage.Message[], tracks active shells through activeShellIndex(callID), and only mutates shell entries when current?.type === "shell".item.type === "tool" && (callID === undefined || item.id === callID) and centralizes owned-assistant mutation in updateOwnedAssistant(messageID: SessionMessage.ID, recipe: (draft: DraftAssistant) => void).session.next.prompted, session.next.step.started, step completion/failure/interruption, session.next.text.started, tool-input lifecycle events, tool completion/error, and shell updates; failed assistant steps set draft.finish = "error", while recovery output uses IDs of the form recovery:${event.data.executionID} and status "error".match.time = { created: match.time?.created ?? event.data.timestamp, completed: event.data.timestamp }.createLLMEventPublisher(events: EventV2.Interface, input: Input) tracks tools in a Map, lazily establishes an assistantMessageID, publishes session text/tool/assistant lifecycle events, and exposes interruptAssistant.Tool input end before start: ${callID}, Tool input end before start: ${event.id}, and Tool input delta before start: ${event.id}.if (!tool.inputEnded) yield* endToolInput(event), derives output using settledOutput(event.output, event.result), and associates emitted tool events with both callID and the toolβs assistantMessageID.