Dashboard › opencode › Distillation
49e6fdf6-92d4-4daa-9270-f2defba8463c["lore_tm_v1_pV4Pf8_dWSS5_USh4nasOMWVP38byQKJ6ZyT-UpFKcY","lore_tm_v1_GG3nFuq7XEEbIycXxi-XG22Q86sOOaeMQQiLGXpr4Wk"]
Date: Sep 16, 2026
packages/core/src/event.ts lines 205-367 defining commitDurableEvent(definition, event, input?, commit?). Durable events derive aggregateID from event.data[durable.aggregate]; a non-string aggregate field dies with InvalidDurableEventError message Expected string aggregate field ${durable.aggregate}, and a mismatch with input.aggregateID dies with Aggregate mismatch: expected ${input.aggregateID}, got ${aggregateID}.commitDurableEvent transaction behavior in packages/core/src/event.ts: processing is wrapped in Effect.uninterruptible; the database transaction uses { behavior: "immediate" }; current seq and owner_id are read from EventSequenceTable; latest defaults to -1; and event data is encoded with Schema.encodeUnknownSync(definition.data)(event.data).packages/core/src/event.ts: with input.strictOwner, a conflicting existing ownerID dies with Replay owner mismatch for aggregate ${aggregateID}: expected ${row.ownerID}, got ${input.ownerID ?? "none"}; an exact replay requires matching event ID, versioned type, and deeply equal encoded data; an exact replay may claim a previously null owner_id; a divergent replay dies with Replay diverged at aggregate ${aggregateID} sequence ${input.seq}; and a non-strict new event from a mismatched owner returns without committing.packages/core/src/event.ts: new sequence defaults to latest + 1; a supplied noncontiguous sequence dies with Sequence mismatch for aggregate ${aggregateID}: expected ${latest + 1}, got ${seq}; reusing an event ID dies with Event ${event.id} already exists at aggregate ${stored.aggregateID} sequence ${stored.seq}.packages/core/src/event.ts: construct the event with durable: { aggregateID, seq, version: durable.version }; run every registered projector; invoke optional commit(seq); upsert EventSequenceTable; insert into EventTable with versionedType(definition.type, durable.version); then, after the transaction, publish undefined to each subscriber in pubsub.durable.get(committed.aggregateID).publishEvent behavior in packages/core/src/event.ts lines 369-379: providing a local commit hook for a non-durable event dies with InvalidDurableEventError message "Local commit hooks require a durable event"; durable definitions delegate to commitDurableEvent(definition, event as Payload, undefined, commit).packages/core/test/database-migration.test.ts index expectations after migration: exactly these 8 indexes are expected in sorted output: event_aggregate_seq_idx, event_aggregate_type_seq_idx, session_input_session_admitted_seq_idx, session_input_session_pending_delivery_seq_idx, session_input_session_promoted_seq_idx, session_message_session_seq_idx, session_message_session_time_created_id_idx, and session_message_session_type_seq_idx. The test also expects table session_context_epoch, absence of its former agent, replacement_seq, and revision columns at that stage, and migration row count equal to migrations.length.adds final recovery ownership tables to a populated predecessor in packages/core/test/database-migration.test.ts: predecessor rows ses_existing, msg_existing, and msg_input survive DatabaseMigration.applyOnly(db, [sessionRecoveryMigration]); session_execution.id is required; session_input.wake_pending defaults to "false"; session_recovery.execution_id is a required primary key; session_recovery.assistant_message_id and session_recovery.recovery_error are nullable; session_recovery.phase is required; and inserting session_execution.phase = 'invalid' must fail.rejects a non-empty database without a session table: after creating only unrelated (id text PRIMARY KEY), DatabaseMigration.apply(db) must throw "Database is not empty and has no session table".backfills existing Context Epoch rows to the build agent: applying contextEpochAgentMigration to an existing session_context_epoch row for ses_existing must set agent to "build".keeps legacy credential fields nullable: after simplifyIntegrationCredentialsMigration, a current credential inserted with integration_id = 'anthropic' and without legacy fields must read back { connector_id: null, method_id: null, active: null }; the predecessor schema had required connector_id, method_id, label, value, active, time_created, and time_updated, plus unique partial index credential_connector_active_idx where active = 1.resets beta history and rebuilds event-sourced Session input storage: predecessor tables include session, workspace, message, part, event_sequence, event, session_message, and session_input; indexes include event_aggregate_seq_idx, event_aggregate_type_seq_idx, session_message_session_seq_idx, and session_input_session_pending_delivery_seq_idx; seeded legacy records include workspace wrk_old, event evt_old of type old.1, and session message msg_old.