Expand description
Central event-drain and wake-action policy — mode-agnostic engine layer.
drain_event_queue pops every pending event from the queue in priority
order, formats it, and classifies it as Steered / Buffered / Injected.
wake_action decides what the caller should do next.
event_payload_from_drained builds the canonical wire-format payload
(shared by RPC and server) from a DrainedEvent.
Structs§
- Drained
Event - A single event that was drained, together with its formatted payload and how it was handled.
- Event
Payload - Canonical runtime event payload carried by
RpcEvent::Event. Server mode internalizes the same formatted event into its owning conversation rather than exposing a raw transport frame.
Enums§
- Event
Disposition - What happened to a single event that was drained from the queue.
- Wake
Action - What the caller’s event-loop arm should do after
drain_event_queue+wake_action.
Constants§
- AUTO_
TURN_ CAP - Default cap: how many consecutive auto-triggered model turns can fire before the engine parks and waits for real user input.
- AUTO_
TURN_ CAP_ CONFIG_ KEY - The config key users should raise when the cap trips (used in messages).
- AUTO_
TURN_ UNLIMITED - Sentinel:
events.auto_turn_cap = 0disables the cap entirely.
Functions§
- auto_
turn_ cap_ reached - Single source of truth for “has the consecutive auto-turn cap been hit?”
- claim_
auto_ turn - Centralised auto-turn claim gate.
- claim_
auto_ turn_ with_ cap claim_auto_turnwith an explicit cap;cap == 0means unlimited.- describe_
auto_ turn_ cap - Human-readable rendering of a cap value for user-facing messages.
- drain_
event_ queue - Drain every event currently in
queue. - event_
payload_ from_ drained - Build the canonical
EventPayloadfrom aDrainedEvent. - idle_
should_ wait - Returns
truewhen the agent idle loop should park onqueue.notified()instead of immediately nagging with a user message. - spawn_
prompt_ registration_ check - Pure decision logic for the
spawn_promptregistration re-check (Bug 1 fix). - terminal_
flush_ seam - Pure decision logic mirroring
terminal_flushfromcmd/rpc.rsfor use in integration tests. - terminal_
flush_ seam_ with_ cap terminal_flush_seamwith an explicit cap;cap == 0means unlimited.- wake_
action - Decide what the caller should do after draining the queue.
- wake_
action_ with_ cap wake_actionwith an explicit cap (events.auto_turn_cap);cap == 0means unlimited.