Dashboard › opencode › Distillation
6d8a9104-1e0d-42b6-b178-3dee104774db["lore_tm_v1_QSmSdGT6o8L_DFhna-hRgJlkvqPnlhyoNLL5KPhVvvo"]
Date: Sep 15, 2026
/home/byk/Code/opencode/packages/core/src/event.ts:320-353 showed durable-event transaction ordering: run all projectors with committed, run optional commit(seq), upsert EventSequenceTable, then insert into EventTable, using transaction behavior "immediate" and Effect.orDie.EventSequenceTable upsert writes { aggregate_id: aggregateID, seq, owner_id: input?.ownerID }; on conflict it always updates seq, but sets owner_id only when input?.ownerID exists and the prior row?.ownerID is null./home/byk/Code/opencode/packages/core/src/event.ts:354-361 wakes every subscriber in pubsub.durable for the committed aggregate via PubSub.publish(wake, undefined).publishEvent() rejects a commit hook on a non-durable definition by dying with InvalidDurableEventError, event type event.type, and message "Local commit hooks require a durable event".publishEvent() adds durable: { aggregateID, seq, version }, calls notify(event, true), and returns the enriched event; if no durable commit occurs, it calls notify(event, false) and returns the original event.observe() catches non-interruption failures and logs "Event listener failed" with eventID, eventType, and cause; interruption causes are not caught. notify() isolates listeners only when isolateListeners is true, then publishes to the event-type-specific pubsub channel and pubsub.all.publish() resolves event location in precedence order: options.location, then optional Location.Service as { directory, workspaceID }, otherwise no location. It uses options.id ?? ID.create(), includes optional metadata, and forwards options.commit to publishEvent().replay() resolves the definition through Durable.get(event.type) and dies with InvalidDurableEventError plus message Unknown durable event type ${event.type} when absent or non-durable. Otherwise it decodes event.data with Schema.decodeUnknownSync(definition.data), commits using the serialized seq and aggregateID plus optional ownerID and strictOwner, and only calls isolated notify() when the commit succeeds and options.publish is true.replayAll() in /home/byk/Code/opencode/packages/core/src/event.ts:480-489 uses the first eventβs aggregateID as source, returns undefined for an empty input, and rejects a batch if any event has a different aggregateID.