Transactional durable storage engine (SuperPi.Durable.Storage) implementing:
- Monotonic sequence numbers (
Seq) - Conversation creation (with reserved
ROOT_CONVERSATION_ID = 1) and atomic built-in documents - Conversation forking at any visible entry with
asOfrewind ofpi.agentand freshpi.providerUUIDv7 - Entry appending with
headmarkers andContextEditoperations
Summary
Functions
Appends an immutable entry to conversation_id.
Supports head_entry_id: :self (used by pi.reset) or an explicit integer EntryId (used by pi.compaction).
Executes a durable commit, first draining any pending deferred updates (REQ-DUR-05)
and allocating a monotonic seq number.
Updates the conversation's pi.agent rewindable document (Conversation.configure()).
Atomically creates a conversation and initializes its 5 built-in documents:
pi.agent, pi.provider (UUIDv7), pi.live, pi.inbox, and pi.usage.
Opens or lazily creates the root conversation (id = 1) with its 5 built-in documents (spec.md §2.5).
Atomically forks parent_conversation_id at at_entry_id (spec.md §2.5, §3.7)
The most recently created top-level conversation (no owning task), or nil.
Used by --continue.
Allocates and returns the next monotonic sequence number (Seq).
True when the backend supports SELECT ... FOR UPDATE.
Options for Repo.transaction/2. SQLite takes the write lock up front
(BEGIN IMMEDIATE) so a read-then-write transaction cannot lose a race.
Functions
Appends an immutable entry to conversation_id.
Supports head_entry_id: :self (used by pi.reset) or an explicit integer EntryId (used by pi.compaction).
Executes a durable commit, first draining any pending deferred updates (REQ-DUR-05)
and allocating a monotonic seq number.
Updates the conversation's pi.agent rewindable document (Conversation.configure()).
Atomically creates a conversation and initializes its 5 built-in documents:
pi.agent, pi.provider (UUIDv7), pi.live, pi.inbox, and pi.usage.
Opens or lazily creates the root conversation (id = 1) with its 5 built-in documents (spec.md §2.5).
Atomically forks parent_conversation_id at at_entry_id (spec.md §2.5, §3.7):
- Copies
pi.agentasOfthe target entry's commitseq - Mints a fresh
pi.providerUUIDv7 (forks never copy parent's provider UUID) - Initializes fresh
pi.live,pi.inbox, andpi.usagedocuments
The most recently created top-level conversation (no owning task), or nil.
Used by --continue.
Allocates and returns the next monotonic sequence number (Seq).
One atomic upsert, valid on SQLite and PostgreSQL. The row lock held until commit serializes concurrent allocators.
True when the backend supports SELECT ... FOR UPDATE.
Options for Repo.transaction/2. SQLite takes the write lock up front
(BEGIN IMMEDIATE) so a read-then-write transaction cannot lose a race.