pub fn terminal_flush_seam(
allow_chain: bool,
auto_turn_pending: &mut bool,
pending_events: &mut Vec<String>,
api_messages: &mut Vec<Arc<Value>>,
events_auto_turn: bool,
consecutive_auto_turns: &mut u32,
) -> Option<String>Expand description
Pure decision logic mirroring terminal_flush from cmd/rpc.rs for use in
integration tests.
This seam allows tests to verify the allow_chain contract on the mutable
state fields that terminal_flush operates on, without requiring a live
Runtime, Session, or Mutex<RpcState>.
Rules (identical to terminal_flush):
- Always: clear
auto_turn_pending; takepending_events→ inject intoapi_messages. allow_chain = false: never reserve; returnNone; leavecounterunchanged.allow_chain = true: if all conditions met, incrementcounter, setauto_turn_pending = true, returnSome("auto:seam").