Skip to main content

salvor_core/
lib.rs

1//! Salvor core: the stable public surface for the event model, replay engine,
2//! and deterministic context of durable agent runs.
3//!
4//! A run is an append-only sequence of events; nothing else is state. On
5//! resume, completed model and tool calls are read from the log, never
6//! re-executed, and execution continues live from the first unrecorded step.
7//!
8//! # What lives where
9//!
10//! The types themselves live in [`salvor_replay`], a pure, IO-free crate that
11//! also builds for `wasm32-unknown-unknown` so the v0.3 browser inspector can
12//! fold event logs client-side. That crate holds the event vocabulary
13//! ([`Event`], [`EventEnvelope`], [`RunId`], [`SequenceNumber`],
14//! [`SCHEMA_VERSION`]), the replay cursor ([`ReplayCursor`] and its typed
15//! [`Outcome`] permits), and the state fold ([`derive_state`] into
16//! [`RunState`]).
17//!
18//! `salvor-core` re-exports that surface unchanged. Every `salvor_core::` path
19//! that existed before the extraction keeps resolving, so the store, the
20//! runtime, the tools layer, and the CLI compile against the same names they
21//! always used. New code may depend on either crate; the names are identical.
22//! The split exists so the runtime and the browser inspector fold events with
23//! literally the same code, without the runtime's IO edge leaking into the
24//! pure path.
25
26pub use salvor_replay::{
27    BeginPermit, Budget, BudgetKind, Effect, Emitted, Event, EventEnvelope, ForkOrigin,
28    GraphBeginPermit, LogValidator, LoggedStep, ModelCallPermit, ModelReply, NowPermit, Outcome,
29    Parked, PendingCall, RandomPermit, ReplayCursor, ReplayError, RequestedStep, RunId, RunState,
30    RunStatus, SCHEMA_VERSION, SequenceNumber, TokenTotals, TokenUsage, ToolCallPermit,
31    UnresolvedWrite, ValidationError, derive_state, validate_next,
32};