"""
Session Doctor — Automatic Error Recovery for AI Agent Sessions

Detects stuck AI agent sessions (loops, rate limits, token overflows, timeouts)
and recovers from them automatically using configurable strategies.

Quick start::

    from session_doctor import SessionDoctor, Config

    doctor = SessionDoctor()
    doctor.register_session("my-run", label="coding-agent")

    # Feed events from your agent
    doctor.ingest_event("my-run", "Error: 429 rate limit exceeded")
    doctor.ingest_event("my-run", "Error: context length exceeded", budget_used=0.75)

Supported error types: http_400, token_limit, json_parse, timeout,
tool_repeat, rate_limit, auth_error, budget_over.

Recovery strategies: MONITOR, BACKOFF, RETRY_PROMPT_FIX, COMPACT_CONTEXT,
BREAK_LOOP, RESET, HALT.
"""

from .core import (
    # Main class
    SessionDoctor,

    # Configuration
    Config,

    # Data models
    SessionState,
    ErrorEvent,

    # Enums
    Severity,
    Strategy,
    SessionStatus,

    # Components (for advanced use / testing)
    StateStore,
    Detector,
    Recoverer,
    Notifier,

    # Constants
    ERROR_PATTERNS,
    ERROR_POLICY,

    # CLI helpers
    print_dashboard,
    print_report,
    main,
)

__version__ = "0.1.0"
__author__ = "Water Woods"
__email__ = "woodwater2026@gmail.com"

__all__ = [
    # Main class
    "SessionDoctor",

    # Configuration
    "Config",

    # Data models
    "SessionState",
    "ErrorEvent",

    # Enums
    "Severity",
    "Strategy",
    "SessionStatus",

    # Components
    "StateStore",
    "Detector",
    "Recoverer",
    "Notifier",

    # Constants
    "ERROR_PATTERNS",
    "ERROR_POLICY",

    # CLI helpers
    "print_dashboard",
    "print_report",
    "main",
]
