mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
4c2e730488
Organize context fragments under `core/context`. Implement same trait on all of them.
26 lines
809 B
Rust
26 lines
809 B
Rust
use codex_protocol::protocol::AgentStatus;
|
|
|
|
use crate::context::ContextualUserFragment;
|
|
use crate::context::SubagentNotification;
|
|
|
|
// Helpers for model-visible session state markers that are stored in user-role
|
|
// messages but are not user intent.
|
|
|
|
// TODO(jif) unify with structured schema
|
|
pub(crate) fn format_subagent_notification_message(
|
|
agent_reference: &str,
|
|
status: &AgentStatus,
|
|
) -> String {
|
|
SubagentNotification::new(agent_reference, status.clone()).render()
|
|
}
|
|
|
|
pub(crate) fn format_subagent_context_line(
|
|
agent_reference: &str,
|
|
agent_nickname: Option<&str>,
|
|
) -> String {
|
|
match agent_nickname.filter(|nickname| !nickname.is_empty()) {
|
|
Some(agent_nickname) => format!("- {agent_reference}: {agent_nickname}"),
|
|
None => format!("- {agent_reference}"),
|
|
}
|
|
}
|