"""SessionSource Protocol — the adapter contract implemented by per-tool adapters."""

from typing import Protocol, runtime_checkable

from session_store.models import SessionExport, SessionInfo


@runtime_checkable
class SessionSource(Protocol):
    """Protocol that every per-tool adapter implements.

    This is the adapter contract — not the client API. Clients use
    SessionStore, which composes adapters implementing this protocol.
    """

    def tool_name(self) -> str: ...
    def list_sessions(self, limit: int = 20) -> list[SessionInfo]: ...
    def load_session(self, session_id: str) -> SessionExport: ...
    def detect_current_session(self) -> str | None: ...
