Dashboard › opencode › Distillation
721150bc-fbb7-45e5-b479-b2d9cddaec98["lore_tm_v1_NcJGXSegHIDO7hx_O3fM3ez0cAiPKKeUzEDiumoDU90","lore_tm_v1_yeCIF3Yu2WShwAH0Hxs-bdlho9V6wmNXCQyGofeCzvI","lore_tm_v1_ObuxEAEk_PHUA_1eGiN2KEFfmM9W2JMYOjEhAZEAj70","lore_tm_v1_7xb5DcK_43AoVE6HR7coHUfGockoPPtsWkofgKeG_Kw","lore_tm_v1_BaRzPfY-HTo610uvnww1r13Bp23vgHcrcteO9x9TKvo","lore_tm_v1_GqMoPKgvZyP-aZySjVq89p_vbuj41mhtdxWhxOdR6hQ","lore_tm_v1_cL8uxHZ5XjOlgyD25Da6eRd6dP0CnQUPNsS_c01pwbY","lore_tm_v1_N_QD0snpxc1agFTawvhjO_Be7Z2CzavRC0dSnNqr3VI","lore_tm_v1_td9yv4c4AU9TO7udN4-b1EkaPap9qSBQvRzVSg-w8ME","lore_tm_v1_vH4lGmurCRaVEeTRgKcpH9P7lP5LjC5JzOqIPA-r8iU","lore_tm_v1_YCFZgopNda9hdKfOl49aLXrwEKxsXjWowj8MZkdB-nI","lore_tm_v1_yZggEFz3q3eXrEM2uuBBT5uOiaNxAIYCOvNWR88JciA","lore_tm_v1_rD8exnziaNaeJfALR5QPz6PjemPewLHqMM5qYhJppqw"]
Date: Sep 15, 2026
/home/byk/Code/opencode/packages/core/src/session/input.ts:241-273 found historical prompt synthesis inserts a fully promoted SessionInputTable row with admitted_seq and promoted_seq both set to input.promotedSeq, then calls settleRecoveryWake(...); that helper clears SessionRecoveryTable.wake_pending only where session_id, continuation_message_id, and existing wake_pending: true all match./home/byk/Code/opencode/packages/core/src/session/input.ts:275-319 found hasPending(...) tests for any unpromoted input matching Session ID and delivery; equivalent(...) requires identical delivery, Session ID, and JSON-encoded prompt; matchesProjection(...) additionally requires identical timeCreated epoch milliseconds./home/byk/Code/opencode/packages/core/src/session/input.ts:321-353 found publish(...) emits SessionEvent.Prompted for each selected row in order and optionally supplies a durable local commit hook. A LifecycleConflict defect is treated as successful idempotency only if rereading the input shows promotedSeq is already defined; other defects are rethrown. The function returns the exact number of rows processed./home/byk/Code/opencode/packages/core/src/session/input.ts:355-424 found promotion ordering and selection rules: promoteSteers(...) promotes every unpromoted "steer" row with admitted_seq <= cutoff, ordered ascending by admitted_seq; promoteNextQueued(...) promotes only the earliest unpromoted "queue" row and returns a boolean; promoteExact(...) requires a specific unpromoted queued message for the Session and dies with Pending recovery input not found: ${messageID} when absent./home/byk/Code/opencode/packages/core/src/session/projector.ts:357-390 confirmed SessionEvent.Prompted requires a durable aggregate sequence, projects the prompt through SessionInput.projectPrompted(...), and then runs the ordinary Session projection; PromptAdmitted also requires a durable sequence and defaults missing requestExecution to false; PromptExecutionRequested delegates to SessionInput.projectExecutionRequested(...)./home/byk/Code/opencode/packages/core/src/session/projector.ts:399-454 found SessionEvent.Step.Recovered derives a deterministic continuation message ID, ignores an already-recorded recovery for the same Session and execution, and validates any assistantMessageID as the latest stored assistant message. It then projects the recovered event, admits a synthetic queued prompt Prompt.make({ text: "continue" }) with requestExecution: false, and inserts SessionRecoveryTable state with wake_pending: true, the execution ID, continuation message ID, optional assistant message ID, phase, and event timestamp./home/byk/Code/opencode/packages/core/src/session.ts:360-386 confirmed V2Session.prompt(...) runs uninterruptibly, validates the Session, defaults messageID to SessionMessage.ID.create() and delivery to "steer", admits with requestExecution: input.resume !== false, maps SessionInput.LifecycleConflict to PromptConflictError, independently verifies admission equivalence, and calls execution.wake(admitted.sessionID) only when resume !== false./home/byk/Code/opencode/packages/core/src/event.ts:294-395 found durable publication occurs transactionally in this order: validate next aggregate sequence, reject duplicate event IDs, construct the durable payload, execute registered projectors, execute the optional local commit(seq) hook, upsert EventSequenceTable, and insert EventTable. After commit it wakes aggregate subscribers, attaches durable metadata, and isolates failures from durable-event listeners; local commit hooks on non-durable events fail with InvalidDurableEventError./home/byk/Code/opencode/packages/core/src/event.ts:441-532 found replay resolves definitions from the durable manifest, decodes event data with the definition schema, and commits with the supplied seq, aggregateID, optional ownerID, and optional strictOwner; publication to listeners is optional. replayAll(...) requires one aggregate and contiguous sequences beginning at the first event’s sequence. remove(...) deletes both aggregate sequence and event rows, while claim(...) directly updates EventSequenceTable.owner_id./home/byk/Code/opencode/packages/core/src/event.ts:541-633 found durable streams subscribe before their initial read, read rows after the tracked sequence in ascending order, emit historical rows first, and then reread after each sliding-capacity-1 aggregate wake; the sequence advances to the final decoded event’s durable sequence. The service exposes publish, subscribe, all, durable, listen, project, replay, replayAll, remove, and claim./home/byk/Code/opencode/packages/schema/src/event.ts found event IDs are branded strings beginning with evt_; Event.define(...) builds optional metadata, durable, and location fields with the package optional(...) helper. Event.latest(...) retains the greatest durable version for a type and rejects duplicate latest definitions, while Event.durable(...) keys definitions by ${type}.${version} and rejects duplicate versioned keys./home/byk/Code/opencode/packages/schema/src/durable-event-manifest.ts found SessionDurable contains only SessionEvent.DurableDefinitions and SessionEvent.Durable, whereas the global Durable map combines durable SessionV1.Event.Definitions with current SessionEvent.DurableDefinitions./home/byk/Code/opencode/packages/schema/src/event-manifest.ts and /home/byk/Code/opencode/packages/core/src/public-event-manifest.ts found coreDefinitions includes durable Session V1 definitions plus all current SessionEvent.Definitions; ServerDefinitions combines foundation, feature, and SessionTodo.Event.Definitions, while the broader Definitions additionally includes Session V1 live events and installation, LSP, Permission V1, TUI, MCP, legacy, project, status, Question V1, compaction, VCS, workspace, worktree, and server events. Core’s public manifest is exactly EventManifest.ServerDefinitions, with Latest = Event.latest(Definitions)./home/byk/Code/opencode/packages/core/src/session/recovery.ts, including recovery rows selected where wake_pending: true and recovery_error is null, and input rows selected where wake_pending: true and promoted_seq is null; failures are logged separately as Failed to redrive Session recovery and Failed to redrive Session input./home/byk/Code/opencode/packages/core/src/session/sql.ts, generated schema in /home/byk/Code/opencode/packages/core/src/database/schema.gen.ts, and migration /home/byk/Code/opencode/packages/core/src/database/migration/20260914170650_session-recovery.ts; session_input.wake_pending defaults to false, recovery wake_pending defaults to true, and the input redrive index is session_input_wake_pending_promoted_time_created_id_idx over wake_pending, promoted_seq, time_created, and id.