//! Error types for the robit-agent crate.

use thiserror::Error;

/// Unified error type for Agent operations.
#[derive(Debug, Error)]
pub enum AgentError {
    #[error(transparent)]
    LlmError(#[from] robit_ai::LlmError),

    #[error(transparent)]
    DbError(#[from] rusqlite::Error),

    #[error("Configuration error: {0}")]
    ConfigError(String),

    #[error("Tool execution error: {0}")]
    ToolError(String),

    #[error("Context overflow: current {current} tokens, max {max} tokens")]
    ContextOverflow { current: usize, max: usize },

    #[error("Agent internal error: {0}")]
    InternalError(String),
}

pub type Result<T> = std::result::Result<T, AgentError>;
