#[derive(Debug, thiserror::Error)]
pub enum SubAgentError {
#[error("parse error in {path}: {reason}")]
Parse { path: String, reason: String },
#[error("invalid definition: {0}")]
Invalid(String),
#[error("agent not found: {0}")]
NotFound(String),
#[error("spawn failed: {0}")]
Spawn(String),
#[error("concurrency limit reached (active: {active}, max: {max})")]
ConcurrencyLimit { active: usize, max: usize },
#[error("cancelled")]
Cancelled,
#[error("invalid command: {0}")]
InvalidCommand(String),
#[error("transcript error: {0}")]
Transcript(String),
#[error("ambiguous id prefix '{0}': matches {1} agents")]
AmbiguousId(String, usize),
#[error("agent '{0}' is still running; cancel it first or wait for completion")]
StillRunning(String),
#[error("memory error for agent '{name}': {reason}")]
Memory { name: String, reason: String },
#[error("I/O error at {path}: {reason}")]
Io { path: String, reason: String },
#[error("LLM call failed: {0}")]
Llm(String),
#[error("channel send failed: {0}")]
Channel(String),
#[error("task panicked: {0}")]
TaskPanic(String),
}