Skip to main content

Module executor

Module executor 

Source
Expand description

ActionExecutor seam (M3 design §3) — the kernel’s one hole for “how a turn’s output becomes actions, and how actions become observations”.

Domain-neutral by construction: the kernel knows nothing about tool calls or CodeAct. Backends implement ActionExecutor (and own their history protocol — the kernel pushes Observation::history_messages verbatim). Session life-and-death is a separate axis (SessionHandle) so neither trait becomes a god-face (OV-12).

Contracts encoded here:

Structs§

ExecCtx
Execution context threaded through execute (OV-6): one cancel token for user interrupt / timeout / watchdog, one interaction channel for consent and ask_user. Reach the channel only through ExecCtx::request_consent / ExecCtx::ask_user — those carry the suspension discipline (answer / cancel / watchdog deadline); calling the trait directly drops it.

Enums§

ExecError
Batch-level execution failure — reserved for “not one action ran” (D15).
InteractionError
The product layer failed to carry an interaction to completion.
ParseError
parse failed to classify at all (internal invariant broken).
ParseOutcome
The four-state verdict of parse (D4+OV-7).
SessionError
Session lifecycle failure (SessionHandle::rebuild).

Constants§

DEFAULT_INTERACT_TIMEOUT
Default per-interaction watchdog (ExecCtx::interact_timeout) — an unanswered suspension must not deadlock the run (M3 failure table: an unanswered consent hangs forever). Generous, because this is human reading time; a product that owns the human relationship (phimint’s TUI) clears it to None and leans on the run’s cancel token alone.
INTERRUPTED_SUMMARY
Model-visible fate for an action the crash window cut off (OV-4). The kernel owns this vocabulary and hands it to the backend inside ActionOutcome::summary; a backend only renders the fate in its own history shape (ActionBackend::render_fates).

Traits§

ActionBackend
The kernel’s mount face for one runtime’s injected action backend (T10c). The built-in tool-call backend keeps its own flow; this face serves any other action format one session can interleave with it (envelope turns go to tools, text turns go here).
ActionExecutor
The seam: one turn’s output in, one observation out.
InteractionChannel
Product-layer interaction surface hung off ExecCtx (OV-6): consent and ask_user suspend the executing action and wait for the product to answer. Routed through the host’s single throat — the same seam policy and journal already use. cancel is the run’s one token (interrupt / timeout / watchdog); implementations must release promptly on it.
SessionHandle
Session life-and-death (OV-12): a different axis from the action face.