Skip to main content

Module reactor

Module reactor 

Source
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§

DrainedEvent
A single event that was drained, together with its formatted payload and how it was handled.
EventPayload
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§

EventDisposition
What happened to a single event that was drained from the queue.
WakeAction
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 = 0 disables 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_turn with an explicit cap; cap == 0 means 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 EventPayload from a DrainedEvent.
idle_should_wait
Returns true when the agent idle loop should park on queue.notified() instead of immediately nagging with a user message.
spawn_prompt_registration_check
Pure decision logic for the spawn_prompt registration re-check (Bug 1 fix).
terminal_flush_seam
Pure decision logic mirroring terminal_flush from cmd/rpc.rs for use in integration tests.
terminal_flush_seam_with_cap
terminal_flush_seam with an explicit cap; cap == 0 means unlimited.
wake_action
Decide what the caller should do after draining the queue.
wake_action_with_cap
wake_action with an explicit cap (events.auto_turn_cap); cap == 0 means unlimited.