use thiserror::Error;
#[derive(Debug, Error)]
pub enum AgentKitError {
#[error("Configuration error: {0}")]
Config(String),
#[error("Failed to read config file '{path}': {source}")]
ConfigIo {
path: String,
#[source]
source: std::io::Error,
},
#[error("Failed to parse YAML config: {0}")]
ConfigParse(#[from] serde_yaml::Error),
#[error("Unknown agent type: '{0}'")]
UnknownAgentType(String),
#[error("Agent build error: {0}")]
AgentBuild(String),
#[error("Unknown tool type: '{0}'")]
UnknownToolType(String),
#[error("Tool load error for '{name}': {reason}")]
ToolLoad { name: String, reason: String },
#[error("Invalid tool configuration: {0}")]
ToolConfig(String),
#[error("Remote agent '{name}' not found")]
RemoteAgentNotFound { name: String },
#[error("A2A client error: {0}")]
A2aClient(String),
#[error("A2A server error: {0}")]
A2aServer(String),
#[error("Authentication error: {0}")]
Auth(String),
#[error("JWT validation error: {0}")]
JwtValidation(String),
#[error("Missing or malformed Authorization header")]
InvalidAuthHeader,
#[error("JWKS fetch error: {0}")]
JwksFetch(String),
#[error("Forbidden: missing required claims: {0:?}")]
Forbidden(Vec<String>),
#[error("Session error: {0}")]
Session(String),
#[error("DynamoDB error: {0}")]
DynamoDB(String),
#[error("Observability setup error: {0}")]
Observability(String),
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, AgentKitError>;