Dashboard › opencode › Distillation
b8560fee-e874-43c4-9365-5282259e274d["lore_tm_v1_oWh_PL2ZCmIh08LuGuOlIWemx3ZVuRAQKuf96drjewU","lore_tm_v1_n3X7ijsaWjWsgMswlo7F0gFGMW7ZYmN502sf0e7llBo","lore_tm_v1_u2pe8GOR_sAL4IYbWbaH_FV3rptbR5PITLznO5TlKBE","lore_tm_v1_SxVR62ZvP90JMkUEfKLNCtfdql8BBlbta1bpbrzOjF8","lore_tm_v1_dvolw8Wr5Dv3S5xXf5YC8LNR28d_X7D280Pu-WvIvhM","lore_tm_v1_0gu8NdgRgeHN8OcngNTCRuBUVSUh_e9Tcj5tc7ovuCc","lore_tm_v1_AfiMoDFBp0R6dcYuLNXscRKh6kFzL-3SYNHtBzEp0og","lore_tm_v1_DTo40h0iT1BL75lYhm2TLamiU1QNHHH79WLlTjYHbU4"]
Date: Sep 14, 2026
packages/schema/src/session-message.ts defines current session-message IDs as strings beginning with msg_, branded "Session.Message.ID", with create() producing "msg_" + ascending().packages/schema/src/session-message.ts defines 8 SessionMessage.Message variants in this order: 1. AgentSwitched, 2. ModelSwitched, 3. User, 4. Synthetic, 5. System, 6. Shell, 7. Assistant, 8. Compaction; the tagged union uses discriminator type and identifier "Session.Message".packages/schema/src/session-message.ts defines assistant content as the tagged union AssistantText | AssistantReasoning | AssistantTool; tool state is the tagged union ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError.SessionMessage.Assistant contains agent, model, content, optional snapshot (start, end, files), optional finish, optional cost, optional token accounting, optional UnknownError, and created/completed timestamps; it has no explicit durable run identity, provider-turn status, recovery claim, or recovery epoch.SessionMessage.ToolStateRunning persists input, structured, and content; completed/error states persist their final content and structured data, with optional result, and completed state additionally permits optional attachments and outputPaths.packages/schema/src/session-input.ts defines SessionInput.Admitted with admittedSeq, message id, sessionID, prompt, delivery, timeCreated, and optional promotedSeq, annotated with identifier "SessionInput.Admitted".packages/schema/src/session-event.ts defines durable session events with aggregate "sessionID" and version 1; Step.Ended and Step.Failed instead use durable version 2.packages/schema/src/session-event.ts treats stream fragments as live-only: Text.Delta, Reasoning.Delta, Tool.Input.Delta, and Compaction.Delta are included in Definitions but excluded from DurableDefinitions; their replayable boundaries are respectively Text.Ended, Reasoning.Ended, Tool.Input.Ended, and Compaction.Ended.SessionEvent.Tool.Progress is a durable bounded running-tool checkpoint carrying structured and content; its documentation says tools should checkpoint semantic transitions or at a bounded cadence rather than persist every stdout/stderr chunk.SessionEvent.DurableDefinitions contains 29 events in order: 1. AgentSwitched, 2. ModelSwitched, 3. Moved, 4. Prompted, 5. PromptAdmitted, 6. ContextUpdated, 7. Synthetic, 8. Shell.Started, 9. Shell.Ended, 10. Step.Started, 11. Step.Ended, 12. Step.Failed, 13. Text.Started, 14. Text.Ended, 15. Tool.Input.Started, 16. Tool.Input.Ended, 17. Tool.Called, 18. Tool.Progress, 19. Tool.Success, 20. Tool.Failed, 21. Reasoning.Started, 22. Reasoning.Ended, 23. Retried, 24. Compaction.Started, 25. Compaction.Ended, 26. RevertEvent.Staged, 27. RevertEvent.Cleared, 28. RevertEvent.Committed.SessionEvent.Definitions contains the durable events plus live-only Text.Delta, Reasoning.Delta, Tool.Input.Delta, and Compaction.Delta; Durable is annotated with identifier "SessionDurableEvent".SessionEvent.Step.Started records assistantMessageID, agent, model, and optional snapshot; Step.Ended records finish, cost, complete token accounting, optional snapshot, and optional files; Step.Failed records UnknownError.SessionEvent.Tool.Called records tool name, decoded input, and provider execution metadata; Tool.Success records structured/content output, optional outputPaths, optional result, and provider metadata; Tool.Failed records UnknownError, optional result, and provider metadata.packages/core/src/session/schema.ts is an exact Core facade over canonical Schema values: ID = Session.ID and Info = Session.Info.packages/core/src/session/sql.ts defines current persistence tables SessionTable, SessionMessageTable, SessionInputTable, and SessionContextEpochTable, alongside retained V1 tables MessageTable, PartTable, and TodoTable.SessionTable persists session metadata and accounting, including project_id, optional workspace_id and parent_id, slug, directory, optional path, title, version, optional share_url, summary fields, metadata, cost, token counters, optional revert, V1 permission rules, optional agent and model, timestamps, time_compacting, and time_archived; it has no columns for active-run identity, provider-turn status, tool-work status, recovery claim, recovery epoch, or recovery timestamp.SessionMessageTable stores one row per current message with primary-key id, session_id, discriminator type, per-session seq, timestamps, and JSON data; it enforces unique (session_id, seq) and indexes (session_id, type, seq), (session_id, time_created, id), and time_created.SessionInputTable stores admitted prompts with id, session_id, JSON prompt, delivery, admitted_seq, optional promoted_seq, and time_created; it indexes pending inputs by (session_id, promoted_seq, delivery, admitted_seq) and enforces unique per-session admitted and promoted sequence numbers.SessionContextEpochTable stores exactly one context epoch per session using primary-key session_id, plus baseline, JSON snapshot: SystemContext.Snapshot, and baseline_seq.packages/core/src/session/store.ts exposes SessionStore.Interface methods get(sessionID), context(sessionID), runnerContext(sessionID, baselineSeq), and message(messageID); context delegates to SessionHistory.load, while runnerContext delegates to SessionHistory.loadForRunner.SessionStore.message() reads SessionMessageTable, reconstructs { ...row.data, id: row.id, type: row.type }, and decodes it with Schema.decodeUnknownEffect(SessionMessage.Message); decode failures are converted to defects with Effect.orDie.