Skip to main content

Module agent

Module agent 

Source
Expand description

Harness-blind trait driver (NOI-4): spawn_agent drives any AgentHarness. The harness-blind trait driver: spawn_agent drives ANY [AgentHarness] generically (NOI-4, §3A.1).

This is a NEW additive spawn mode beside the worker’s existing one-shot .output() capture (the run_norn_step path in the norn-fan-worker example, which stays working and unchanged). It is the single place the worker DRIVES an agent session:

  • it pumps the session’s neutral [AgentSession::events] stream OUT to a caller-supplied event sink (the worker’s transcript delivery — an [mpsc::UnboundedSender<ActivityEvent>], the event_sender NOI-5 wires to liminal),
  • it feeds neutral commands IN from a caller-supplied control source (the control_receiver NOI-6 wires from the server’s intervention PUSH) to [AgentSession::intervene], and
  • it correlates the single terminal [AgentSession::wait_result] into DispatchOutcome::Completed { output } — the same replay-authoritative output the one-shot capture produces today.

The worker stays harness-blind. spawn_agent is generic over AgentHarness; it never names a concrete adapter, a transport, or a wire protocol. The concrete harness (Norn, or a future one) is injected by the binary composition root (aion-cli), never chosen here. This crate depends on aion-integrations for the TRAIT ONLY and has NO edge to aion-integration-norn or norn (the §3A.4 invariant, CI-gated).

§Result/event split (structural, §4.1)

Events flow only to the event sink; the terminal result flows only from [AgentSession::wait_result]. An event can never be captured as the result and the result is never delivered as an event — the two are distinct channels of the session by construction, so the driver never has to disambiguate them.

Structs§

ControlMessage
One routed intervention on the driver’s control channel: the neutral command plus an OPTIONAL reply channel the driver answers with the neutral InterventionOutcome ack.

Functions§

harness_error_to_outcome
Maps a HarnessError into a DispatchOutcome::Failed a caller can report.
spawn_agent
Drives one activity attempt through the neutral AgentHarness seam and returns its terminal DispatchOutcome.
spawn_dyn_agent
Drives one activity attempt through an ERASED DynAgentHarness — the same harness-blind driver as spawn_agent, but over a dyn harness a worker can HOLD without being generic (the typed AgentHarness is not object-safe).

Type Aliases§

ActivityEventSender
The neutral event sink the driver pumps a session’s AgentSession::events out to. This is the event_sender the worker’s ActivityContext transcript delivery installs; NOI-5 forwards it onto a liminal events channel.
ControlReceiver
The neutral command source the driver feeds into a session’s AgentSession::intervene. This is the control_receiver the worker installs per attempt; NOI-6 delivers server-routed operator commands (each with its ack reply channel) onto it.