agentmux_srv_core/backend/reactive/system_turn.rs
1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! A turn started by AgentMux itself (a note that asks the agent for something, such as its status
5//! after a sign-in), by the same sender a message takes. Split out of `handler.rs` (over the file-size
6//! baseline) the way `sensitive_audit.rs` is.
7
8use super::handler::ReactiveHandler;
9use super::types::SenderDelivery;
10
11impl ReactiveHandler {
12 /// `text` as a turn for the agent in `block_id`, from AgentMux itself: a running persistent agent has it on
13 /// its stdin, a one-shot or not-yet-started one gets a turn started. Not a jekt: no marker, no hold, no
14 /// audit row. The sender is cloned out of the lock first, since starting a turn can wait for a process.
15 pub fn send_system_turn(&self, block_id: &str, text: &str) -> Result<SenderDelivery, String> {
16 let sender = self.inner.lock().message_sender.clone().ok_or_else(|| "no message sender is installed".to_string())?;
17 sender(block_id, text, &[], &crate::backend::message_origin::MessageOrigin::system(), None)
18 }
19}