pub struct ReplayCursor<S: KernelState> {
pub events: Box<dyn EventStore>,
pub snaps: Option<Box<dyn SnapshotStore<S>>>,
pub reducer: Box<dyn Reducer<S>>,
}Expand description
Replay cursor: reconstructs state from the event log. No executor, no live execution.
Use this when you need to replay a run (e.g. verify, debug, or resume). The cursor loads the latest checkpoint if available, then applies all subsequent events in order. Action results are taken from the log (ActionSucceeded/ActionFailed), not from live execution.
Fields§
§events: Box<dyn EventStore>Event store (source of truth).
snaps: Option<Box<dyn SnapshotStore<S>>>Optional snapshot store for checkpoint-based replay (optimization).
reducer: Box<dyn Reducer<S>>Reducer to apply each event to state (deterministic).
Implementations§
Source§impl<S: KernelState> ReplayCursor<S>
impl<S: KernelState> ReplayCursor<S>
Sourcepub fn replay(&self, run_id: &RunId, initial_state: S) -> Result<S, KernelError>
pub fn replay(&self, run_id: &RunId, initial_state: S) -> Result<S, KernelError>
Replays the run: load checkpoint (if any) → replay events → return final state.
Recorded outputs are injected via the event log (reducer applies ActionSucceeded/ActionFailed). No live tool or LLM execution occurs.
Sourcepub fn replay_from(
&self,
run_id: &RunId,
initial_state: S,
snapshot: Option<&Snapshot<S>>,
) -> Result<S, KernelError>
pub fn replay_from( &self, run_id: &RunId, initial_state: S, snapshot: Option<&Snapshot<S>>, ) -> Result<S, KernelError>
Replays from an optional snapshot. If snapshot is provided, state starts at
snapshot.state and only events with seq > snapshot.at_seq are applied.
Sourcepub fn replay_from_checkpoint(
&self,
run_id: &RunId,
initial_state: S,
) -> Result<S, KernelError>
pub fn replay_from_checkpoint( &self, run_id: &RunId, initial_state: S, ) -> Result<S, KernelError>
Replays using the latest snapshot from the snapshot store (if any). Equivalent to load checkpoint → replay events → reconstruct state.
Sourcepub fn replay_step<'a>(
&'a self,
run_id: &RunId,
initial_state: S,
from_seq: Seq,
) -> Result<ReplayStepIter<'a, S>, KernelError>
pub fn replay_step<'a>( &'a self, run_id: &RunId, initial_state: S, from_seq: Seq, ) -> Result<ReplayStepIter<'a, S>, KernelError>
Replays event-by-event, yielding state after each applied event (for debugging/verify). No live execution; each event is applied via the reducer only.