mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
3404ecff15
Co-authored-by: Codex <noreply@openai.com>
22 lines
806 B
Rust
22 lines
806 B
Rust
use codex_protocol::protocol::AgentStatus;
|
|
|
|
/// Helpers for model-visible session state markers that are stored in user-role
|
|
/// messages but are not user intent.
|
|
use crate::contextual_user_message::SUBAGENT_NOTIFICATION_FRAGMENT;
|
|
|
|
pub(crate) fn format_subagent_notification_message(agent_id: &str, status: &AgentStatus) -> String {
|
|
let payload_json = serde_json::json!({
|
|
"agent_id": agent_id,
|
|
"status": status,
|
|
})
|
|
.to_string();
|
|
SUBAGENT_NOTIFICATION_FRAGMENT.wrap(payload_json)
|
|
}
|
|
|
|
pub(crate) fn format_subagent_context_line(agent_id: &str, agent_nickname: Option<&str>) -> String {
|
|
match agent_nickname.filter(|nickname| !nickname.is_empty()) {
|
|
Some(agent_nickname) => format!("- {agent_id}: {agent_nickname}"),
|
|
None => format!("- {agent_id}"),
|
|
}
|
|
}
|