symfonic.capabilities.memory.operation_journal¶
operation_journal ¶
Durable caller operation binding for receipt-backed Agent memory.
CheckpointIncomplete
dataclass
¶
A partial checkpoint exists and requires operator reconciliation.
CheckpointMissing
dataclass
¶
No complete output is durably known for this phase.
ClaimAcquired
dataclass
¶
Only the atomic first insert may return this owner and revision zero.
ClaimExisting
dataclass
¶
Identical prior claim, deliberately without owner authority.
CompleteCheckpoint
dataclass
¶
CompleteCheckpoint(phase_key: str, ordinal: int, output_bytes: bytes, record_ids: tuple[str, ...], revision: int, selected_manifest: SelectedRecordManifest | None = None)
Immutable output and optional exact pending-row manifest for one phase.
InvocationOwner
dataclass
¶
First claimant's opaque authority; the adapter persists only its verifier.
Construction alone grants nothing: every mutation must compare the token's verifier, complete scope and request digest with the durable claim.
JournalUnknown
dataclass
¶
Ambiguous persistence/read; no provider, tool, or mutation retry.
MemoryOperationJournalPort ¶
Bases: Protocol
Persist exact phase identity and intent before the corresponding I/O.
Claim (tenant, invocation ID) against the full scope and request digest before any model call. A changed claim refuses. Prepare atomically binds (tenant, invocation ID, phase, ordinal) to one exact operation. Repeating equivalent intent returns that binding; a mismatch refuses. Persist an opaque collision-resistant operation ID bound to the tenant and a frozen canonical intent digest, never joined user strings or a mutable mapping. FLUSH binds the ordered authenticated pending manifest and exact IDs. Its full-owner claims and publication generations must equal the complete checkpoint manifest; an IDs-only checkpoint cannot authorize publication. For FLUSH, prepare must reject missing, duplicate, or differently ordered selected IDs unless they equal the complete checkpoint's record-ID tuple. Storage must survive restart and be shared across worker processes. Only an atomic first insert returns an unforgeable owner token and revision zero. Persist only its verifier; never reissue it or expire/reassign it. An identical repeat is Existing without owner; an ambiguous claim is UNKNOWN without owner. Every mutation verifies owner and expected revision with one atomic compare-and-swap. A complete output/record-ID checkpoint must precede prepare for the exact phase. The adapter must protect output bytes at rest and exclude output, token and digests from logs and errors. Missing, incomplete or UNKNOWN state on an existing claim never authorizes provider, tool or mutation replay; operator recovery or refusal is required. Manual cycles crossing invocations need a separate claim namespace. This protocol alone does not enable receipt-backed Agent composition.
An in-memory test double cannot satisfy the durability requirement.
PreparedOperation
dataclass
¶
Persisted operation binding and the next owner CAS revision.
receipt_backed ¶
Detect known receipt ownership; unresolved wrapper paths refuse.
Opaque custom wrappers must expose a checked reference or receipt marker; this bounded walk cannot prove ownership hidden under arbitrary field names.