use super::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SubagentScope {
WithSubagents,
TopLevelOnly,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Caller {
Files,
Other,
}
impl From<bool> for SubagentScope {
fn from(include_subagents: bool) -> Self {
if include_subagents {
SubagentScope::WithSubagents
} else {
SubagentScope::TopLevelOnly
}
}
}
pub fn resolve_env_session() -> Result<String> {
let read = |k: &str| std::env::var(k).ok().filter(|v| !v.trim().is_empty());
read("CLAUDE_CODE_SESSION_ID")
.or_else(|| read("CODEX_COMPANION_SESSION_ID"))
.ok_or_else(|| {
anyhow::anyhow!(
"needs the calling session id, but CLAUDE_CODE_SESSION_ID is not set (running \
outside Claude Code, or an old build). Pass an explicit `@<uuid>` target instead."
)
})
}