use thiserror::Error;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum DaimonError {
#[error("model error: {0}")]
Model(String),
#[error("tool execution failed for '{tool}': {message}")]
ToolExecution {
tool: String,
message: String,
},
#[error("tool '{0}' not found in registry")]
ToolNotFound(String),
#[error("duplicate tool '{0}' in registry")]
DuplicateTool(String),
#[error("agent builder validation failed: {0}")]
Builder(String),
#[error("max iterations ({0}) exceeded")]
MaxIterations(usize),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("schema validation failed for tool '{tool}': {errors}")]
SchemaValidation {
tool: String,
errors: String,
},
#[error("stream closed unexpectedly")]
StreamClosed,
#[error("request timed out after {0:?}")]
Timeout(std::time::Duration),
#[error("operation cancelled")]
Cancelled,
#[error("orchestration error: {0}")]
Orchestration(String),
#[error("MCP error: {0}")]
Mcp(String),
#[error("budget exceeded: ${spent:.6} spent, limit was ${limit:.6}")]
BudgetExceeded {
spent: f64,
limit: f64,
},
#[error("guardrail blocked: {0}")]
GuardrailBlocked(String),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, DaimonError>;