mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Stack split from #25708. Original PR intentionally left open. This third PR resolves the effective per-thread multi-agent runtime from persisted metadata, inherited runtime, and current model selection.
32 lines
1.0 KiB
Rust
32 lines
1.0 KiB
Rust
use crate::session::turn_context::TurnContext;
|
|
use codex_protocol::protocol::MultiAgentVersion;
|
|
use codex_protocol::protocol::SessionSource;
|
|
use codex_protocol::protocol::SubAgentSource;
|
|
|
|
pub(super) fn usage_hint_text<'a>(
|
|
turn_context: &'a TurnContext,
|
|
session_source: &SessionSource,
|
|
) -> Option<&'a str> {
|
|
if turn_context.multi_agent_version != MultiAgentVersion::V2 {
|
|
return None;
|
|
}
|
|
|
|
let multi_agent_v2 = &turn_context.config.multi_agent_v2;
|
|
if !multi_agent_v2.usage_hint_enabled {
|
|
return None;
|
|
}
|
|
|
|
match session_source {
|
|
SessionSource::SubAgent(SubAgentSource::ThreadSpawn { .. }) => {
|
|
multi_agent_v2.subagent_usage_hint_text.as_deref()
|
|
}
|
|
SessionSource::Cli
|
|
| SessionSource::VSCode
|
|
| SessionSource::Exec
|
|
| SessionSource::Mcp
|
|
| SessionSource::Custom(_)
|
|
| SessionSource::Unknown => multi_agent_v2.root_agent_usage_hint_text.as_deref(),
|
|
SessionSource::Internal(_) | SessionSource::SubAgent(_) => None,
|
|
}
|
|
}
|