Dashboard › opencode › Distillation
0b735e51-1a68-43ac-8f7f-53e9c14d8e66["lore_tm_v1_TW7h66eOG19BXhIU41YDG5zBrXTOoYpKfcLCe4SsUr8","lore_tm_v1_rHAH9SWG7xO66TxSRml5PUCNJZodHr4wp9vgDHCMYF8","lore_tm_v1_pTbE23Ty8HHKjVqmOwZUg5T4ByXvIJNZEGEhF49HAt8"]
Date: Sep 16, 2026
packages/core/src/session/sql.ts: SessionMessageTable stores messages with id, session_id, type, monotonically unique per-session seq, timestamps, and JSON data; indexes are unique session_message_session_seq_idx, session_message_session_type_seq_idx, session_message_session_time_created_id_idx, and session_message_time_created_idx.SessionInputTable schema in packages/core/src/session/sql.ts: id references a SessionMessage.ID, session_id cascades from SessionTable, and each input stores JSON prompt, required delivery, required admitted_seq, optional promoted_seq, wake_pending defaulting to false, wake_attempts defaulting to 0, and time_created defaulting to Date.now().SessionInputTable ordering/uniqueness constraints: session_input_session_admitted_seq_idx uniquely constrains (session_id, admitted_seq); session_input_session_promoted_seq_idx uniquely constrains (session_id, promoted_seq); pending-delivery lookup uses (session_id, promoted_seq, delivery, admitted_seq); wake scanning uses (wake_pending, promoted_seq, wake_attempts, time_created, id).SessionRecoveryTable schema in packages/core/src/session/sql.ts: primary key execution_id; required session_id; optional cascading assistant_message_id; required cascading and uniquely indexed continuation_message_id; required phase "ready" | "unknown" | "continue"; wake_pending defaults to true; wake_attempts defaults to 0; optional recovery_error; and required time_created.session_recovery_wake_pending_error_attempts_created_execution_idx over (wake_pending, recovery_error, wake_attempts, time_created, execution_id).SessionExecutionTable schema in packages/core/src/session/sql.ts: execution id is the primary key; session_id is required, cascading, and uniquely indexed so only one execution row exists per Session; owner_id is required and indexed; assistant_message_id is optional; phase is required; time_created and expires_at are required; and recovery_error is optional.session_execution_phase_check, which restricts SessionExecutionTable.phase to exactly 'ready', 'safe', 'unknown', or 'continue'.SESSION_EXECUTION_LEASE_MS = 30_000 in packages/core/src/session/sql.ts.SessionContextEpochTable schema in packages/core/src/session/sql.ts: one row per session_id primary key with cascading Session deletion, required text baseline, required JSON snapshot typed as SystemContext.Snapshot, and required integer baseline_seq.packages/core/src/session/sql.ts: SessionTable tracks project/workspace/parent relationships, directory/path, title/version/share URL, summary counts and diffs, metadata, cost, input/output/reasoning/cache token totals, revert state, permission rules, agent/model selection, timestamps, compaction time, and archive time; related MessageTable, PartTable, and TodoTable rows use Session-oriented indexes and cascading foreign keys where declared.message.time.completed.event.data.assistantMessageID through updateOwnedAssistant(...); shell, text, and tool updates locate their active/latest entries by identifiers such as callID and textID."unknown" and creates recovery-related projected content keyed as recovery:${event.data.executionID}, with error status available for failed recovery representation.