CheckpointRewindController class final

Orchestrates the checkpoint/rewind flow for one Agent.

Created once per agent (the CLI creates one next to builtinTools); the tools register next to the other built-ins. Capture and application ride the agent's event stream, so the tools themselves stay simple.

Constructors

CheckpointRewindController({required Agent agent, required CheckpointSessionSink sink, void onRewindApplied(int messageCount)?, CheckpointAutoCloseCallback? onAutoClose})
Creates a controller and attaches it to agent: subscribes to the event stream and wraps Agent.prepareNextTurn (preserving any existing hook, the same composition pattern attachApproval uses).

Properties

activeCheckpoint → CheckpointState?
The active checkpoint, if any.
no setter
hashCode → int
The hash code for this object.
no setterinherited
lastCompletedRewind → CompletedRewind?
The last completed rewind, if any (drives the repeat-call guard).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tools → List<AgentTool>
The checkpoint and rewind tools bound to this controller.
latefinal

Methods

clear() → void
Clears all checkpoint/rewind state (e.g. when the host resets the session).
dispose() → void
Detaches from the agent: unsubscribes the event listener and restores the Agent.prepareNextTurn hook this controller wrapped.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestContextResync() → void
gh-1425 AC4: arms a context resync at the next turn boundary — the loop's live context is stale because the host replaced state.messages MID-RUN (the restore-budget compaction after a user-turn checkpoint auto-close), so the next prepareNextTurn must swap in the authoritative transcript. The same adoption the rewind rides; the run continues on the capped context without re-sending an over-budget request.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited