"""AICC exception hierarchy.""" from __future__ import annotations from aicc.protocol import ErrorCode class AICCError(Exception): """Base for all AICC SDK errors.""" class ProtocolError(AICCError): """Protocol-level error (version mismatch, malformed message).""" class ConnectionError_(AICCError): """Transport / session connection failure.""" class SessionExpiredError(AICCError): """Session id is unknown or closed.""" class ToolError(AICCError): """Tool execution failure surfaced by the bridge.""" def __init__(self, code: ErrorCode, message: str, retryable: bool): super().__init__(message) self.code = code self.message = message self.retryable = retryable class CapabilityError(AICCError): """Tool requires a capability the agent does not hold."""