Expand description
Salvor core: the stable public surface for the event model, replay engine, and deterministic context of durable agent runs.
A run is an append-only sequence of events; nothing else is state. On resume, completed model and tool calls are read from the log, never re-executed, and execution continues live from the first unrecorded step.
§What lives where
The types themselves live in salvor_replay, a pure, IO-free crate that
also builds for wasm32-unknown-unknown so the v0.3 browser inspector can
fold event logs client-side. That crate holds the event vocabulary
(Event, EventEnvelope, RunId, SequenceNumber,
SCHEMA_VERSION), the replay cursor (ReplayCursor and its typed
Outcome permits), the state fold (derive_state into RunState),
the values read back out of a log (ParkReason, RunSummary), and the
event renderers (event_kind, event_detail).
salvor-core re-exports that surface unchanged. Every salvor_core:: path
that existed before the extraction keeps resolving, so the store, the
runtime, the tools layer, and the CLI compile against the same names they
always used. New code may depend on either crate; the names are identical.
The split exists so the runtime and the browser inspector fold events with
literally the same code, without the runtime’s IO edge leaking into the
pure path.
Structs§
- Begin
Permit - Live permission to start a fresh run.
- Budget
- A budget limit: which dimension, and the ceiling set for it.
- Emitted
- An event the cursor produced in live mode, with the log position it must occupy.
- Event
Envelope - One record in a run’s append-only log.
- Fork
Origin - The recorded link from a forked run back to the run it forked from.
- Graph
Begin Permit - Live permission to start a fresh graph run.
- LogValidator
- A growing, always-well-formed log you fold candidates into one at a time.
- Model
Call Permit - Live permission to execute a model call.
- Model
Reply - A replayed or freshly executed model call result.
- NowPermit
- Live permission to observe the clock.
- Parked
- A run parked awaiting resume input that has not arrived.
- Random
Permit - Live permission to draw random bits.
- Replay
Cursor - The pure replay/live cursor over one run’s event log.
- RunId
- Identifies a single run.
- RunState
- Everything a log prefix implies about a run.
- RunSummary
- A one-line-per-run projection of the log, returned by
EventStore::list_runs. - Sequence
Number - A monotonic position within a run’s event log.
- Token
Totals - Token usage accumulated across every completed model call in a log.
- Token
Usage - Token counts reported for a model call.
- Tool
Call Permit - Live permission to execute a tool call.
- Unresolved
Write - The outstanding write an abandonment left unsettled.
Enums§
- Budget
Kind - Which declared budget dimension a run can bump against.
- Effect
- How a tool call may be retried and how it behaves on replay.
- Event
- Everything that can happen in a run.
- Logged
Step - What the log holds at a divergence position.
- Outcome
- How the cursor answered a request: from recorded history, or with a permission to execute live.
- Park
Reason - Why a run parked instead of completing.
- Pending
Call - A recorded call intent with no recorded completion.
- Replay
Error - Why replay could not continue.
- Requested
Step - What orchestration produced at a divergence position.
- RunStatus
- Where a run stands, as derived from its log alone.
- Validation
Error - Why a candidate envelope is not the legal next event for a log.
Constants§
- SCHEMA_
VERSION - The schema version stamped onto every serialized event.
Functions§
- derive_
state - Folds an event log into the
RunStateit implies. - event_
detail - The informative payload of one event, rendered as a single line. Picks the
fields that matter per kind: a tool call shows its name and effect, a model
completion its token usage, a suspension its reason. Hashes are shortened
and every payload is truncated, so no full input, output, or error text
reaches the progress stream;
salvor history --jsonis the escape hatch for the untruncated envelope. - event_
kind - The stable
kindlabel for one event, matching the enum variant name so it reads the same as the wire form’skindtag. - validate_
next - Decides whether
candidateis the one legal next event to append tolog.