#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum QuerySource {
ReplMainThread,
SubAgent { agent_id: String },
Compact,
SessionMemory,
Hook { event: String },
BackgroundTask { task_id: String },
OneShot,
}
impl QuerySource {
pub fn should_retry_on_overload(&self) -> bool {
match self {
Self::ReplMainThread | Self::OneShot => true,
Self::SubAgent { .. } | Self::BackgroundTask { .. } => false,
Self::Compact | Self::SessionMemory | Self::Hook { .. } => true,
}
}
pub fn label(&self) -> String {
match self {
Self::ReplMainThread => "repl_main".to_string(),
Self::SubAgent { agent_id } => format!("subagent_{agent_id}"),
Self::Compact => "compact".to_string(),
Self::SessionMemory => "session_memory".to_string(),
Self::Hook { event } => format!("hook_{event}"),
Self::BackgroundTask { task_id } => format!("bg_task_{task_id}"),
Self::OneShot => "oneshot".to_string(),
}
}
}