use zeph_subagent::SubAgentError;
use super::lineage::LineageEntry;
#[derive(Debug, thiserror::Error)]
pub enum OrchestrationError {
#[error("orchestration is disabled")]
Disabled,
#[error("planning failed: {0}")]
PlanningFailed(String),
#[error("invalid graph: {0}")]
InvalidGraph(String),
#[error("cycle detected in task graph")]
CycleDetected,
#[error("task not found: {0}")]
TaskNotFound(String),
#[error("no agent available for task: {0}")]
NoAgentAvailable(String),
#[error("graph not found: {0}")]
GraphNotFound(String),
#[error("scheduler error: {0}")]
Scheduler(String),
#[error("aggregation failed: {0}")]
AggregationFailed(String),
#[error("persistence error: {0}")]
Persistence(String),
#[error("task timed out: {0}")]
TaskTimeout(String),
#[error("canceled")]
Canceled,
#[error("invalid command: {0}")]
InvalidCommand(String),
#[error("verification failed: {0}")]
VerificationFailed(String),
#[error("invalid configuration: {0}")]
InvalidConfig(String),
#[error(transparent)]
SubAgent(#[from] SubAgentError),
#[error("predicate type not supported: {0}")]
PredicateNotSupported(String),
#[error("replan budget exhausted for task {task_id}: {reason}")]
ReplanBudgetExhausted {
task_id: String,
reason: String,
},
#[error("cascade abort: root={root:?}, chain_depth={}", chain.len())]
CascadeAborted {
root: super::graph::TaskId,
chain: Vec<LineageEntry>,
},
}