Skip to main content

Module state

Module state 

Source
Expand description

EngineState — the single Mutex-guarded state object — plus the supporting types.

EngineState holds every mutable piece of engine flow state (task table, session table, prompts, token records, worker handles, resume table, per-task notifiers, resources, per-attempt output events, and the event log tail). It sits on the Domain side of the Data / Domain split and is unchanged by the Data-plane (output_store module) refactor.

Structs§

CapTokenRecord
Server-side counter/state holder paired 1:1 with a minted CapToken (keyed by nonce in EngineState.tokens). Tracks remaining uses, revocation, and — for Worker tokens — the task the token is bound to.
EngineState
The single Mutex-guarded blob of engine flow state, accessed only through Engine::with_state (see the R1-R4 discipline documented there).
OperatorSession
Persisted record of one attached Operator session: identity, role, heartbeat bookkeeping, owned tasks, and the OperatorKind cascade inputs plus registry IDs used to rebuild OperatorInfo on dispatch (see Engine::resolve_operator_info).
ResumeKey
Opaque handle identifying one query_senior suspend/resume cycle. Stored on TaskState.suspended_on and as the key of EngineState.pending_resumes.
ResumePending
Entry for a task suspended via query_senior, waiting to be resumed.
TaskSpec
Static task definition supplied to start_task: which agent runs it and the initial prompt/directive text.
TaskState
The full mutable record of one task: its static spec, current status, attempt counter, and bookkeeping timestamps. Cloned out of EngineState on every read (e.g. by read_task_state / poll_task).

Enums§

CapTokenConsumeError
Why CapTokenRecord::consume refused to spend a use.
DispatchOutcome
Result of a dispatch_attempt_with call (or the conceptual outcome of a task attempt more broadly).
Event
Engine lifecycle event. Every event is both appended to EngineState.event_log_tail (in-process ring buffer) and broadcast on Engine::event_tx for live subscribers.
TaskStatus
Lifecycle state of a task. Pending is the only non-terminal, non-Suspended state before the first dispatch_attempt_with; Pass / Blocked / Cancelled are terminal.

Type Aliases§

EventStream
Receiver half of the engine-wide Event broadcast channel, obtained via Engine::subscribe.