"""Akashic exception hierarchy.

Every message follows the pattern: What happened → Why → What to do.
"""

DASHBOARD_URL = "https://taski-ai.com/agents"


class AkashicError(Exception):
    """Base exception for all Akashic SDK errors."""


class AuthenticationError(AkashicError):
    """Raised when an API key is rejected (HTTP 401) or inactive."""


class OAuthError(AkashicError):
    """Raised when an OAuth flow fails, is denied, or times out."""


class ConfigurationError(AkashicError):
    """Raised when the API response shape is unexpected or a connector is misconfigured."""


class MCPError(AkashicError):
    """Raised when an MCP server returns a JSON-RPC error."""

    def __init__(self, message: str, *, code: int = -1, server_label: str = ""):
        self.code = code
        self.server_label = server_label
        super().__init__(message)


class MCPConnectionError(AkashicError):
    """Raised when an MCP server is unreachable (network / HTTP error)."""


class ToolNotFoundError(AkashicError):
    """Raised when a tool name is not registered with any connected server."""


class DeciderError(AkashicError):
    """Raised when the tool-selection model call fails."""
