1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum RuntimeError {
8 #[error("Session not found: {session_id}")]
10 SessionNotFound {
11 session_id: String,
13 },
14
15 #[error("Session already exists: {session_id}")]
17 SessionExists {
18 session_id: String,
20 },
21
22 #[error("LLM error: {0}")]
24 LlmError(#[from] astrid_llm::LlmError),
25
26 #[error("MCP error: {0}")]
28 McpError(#[from] astrid_mcp::McpError),
29
30 #[error("Audit error: {0}")]
32 AuditError(#[from] astrid_audit::AuditError),
33
34 #[error("Capability error: {0}")]
36 CapabilityError(#[from] astrid_capabilities::CapabilityError),
37
38 #[error("Security error: {0}")]
40 SecurityError(#[from] astrid_core::SecurityError),
41
42 #[error("Storage error: {0}")]
44 StorageError(String),
45
46 #[error("Serialization error: {0}")]
48 SerializationError(String),
49
50 #[error("Context overflow: {current} tokens exceeds limit of {max}")]
52 ContextOverflow {
53 current: usize,
55 max: usize,
57 },
58
59 #[error("Approval required for: {action}")]
61 ApprovalRequired {
62 action: String,
64 },
65
66 #[error("Approval denied: {reason}")]
68 ApprovalDenied {
69 reason: String,
71 },
72
73 #[error("Configuration error: {0}")]
75 ConfigError(String),
76
77 #[error("Sub-agent error: {0}")]
79 SubAgentError(String),
80
81 #[error("IO error: {0}")]
83 IoError(#[from] std::io::Error),
84}
85
86pub type RuntimeResult<T> = Result<T, RuntimeError>;