Skip to main content

wake_action

Function wake_action 

Source
pub fn wake_action(
    drained: &[DrainedEvent],
    messages: &[SharedMessage],
    busy: bool,
    auto_turn_enabled: bool,
    consecutive_auto_turns: u32,
) -> WakeAction
Expand description

Decide what the caller should do after draining the queue.

Rules (in order):

  1. Nothing drained → Nothing.
  2. Any Injected event + idle + auto-turn enabled + last message is role=user + consecutive cap not reached → RunTurn.
  3. Otherwise → Forward (show events; caller may still steer/display).

Convenience wrapper over wake_action_with_cap using the default AUTO_TURN_CAP. Production callers should pass the configured cap.