use thiserror::Error;
#[derive(Debug, Error)]
pub enum RuntimeError {
#[error("Session not found: {session_id}")]
SessionNotFound {
session_id: String,
},
#[error("Session already exists: {session_id}")]
SessionExists {
session_id: String,
},
#[error("LLM error: {0}")]
LlmError(#[from] astrid_llm::LlmError),
#[error("MCP error: {0}")]
McpError(#[from] astrid_mcp::McpError),
#[error("Audit error: {0}")]
AuditError(#[from] astrid_audit::AuditError),
#[error("Capability error: {0}")]
CapabilityError(#[from] astrid_capabilities::CapabilityError),
#[error("Security error: {0}")]
SecurityError(#[from] astrid_core::SecurityError),
#[error("Storage error: {0}")]
StorageError(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("Context overflow: {current} tokens exceeds limit of {max}")]
ContextOverflow {
current: usize,
max: usize,
},
#[error("Approval required for: {action}")]
ApprovalRequired {
action: String,
},
#[error("Approval denied: {reason}")]
ApprovalDenied {
reason: String,
},
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("Sub-agent error: {0}")]
SubAgentError(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
}
pub type RuntimeResult<T> = Result<T, RuntimeError>;