"""Meerkat Python SDK — communicate with the Meerkat agent runtime.

Quick start::

    import asyncio
    from meerkat import MeerkatClient, TextDelta

    async def main():
        async with MeerkatClient() as client:
            session = await client.create_session("Hello, Meerkat!")
            print(session.text)

            async with session.stream("Tell me a joke") as events:
                async for event in events:
                    match event:
                        case TextDelta(delta=chunk):
                            print(chunk, end="", flush=True)
                print()

    asyncio.run(main())
"""

# Core client and session
from .client import MeerkatClient
from .live import LiveChannel
from .mob import (
    MemberDeliveryReceipt,
    MemberRespawnReceipt,
    Mob,
    MobHelperResult,
    MobKickoffMemberSnapshot,
    MobMemberSnapshot,
    MobPeerConnectivitySnapshot,
    MobReadyMemberSnapshot,
    MobRespawnResult,
    MobSpawnSpec,
    MobUnreachablePeer,
)
from .session import DeferredSession, Session
from .streaming import EventStream, EventSubscription

# Domain types (clean, Wire-free public names)
from .types import (
    BlobImageBlock,
    BlobPayload,
    CatalogModelEntry,
    ContractVersion,
    ConfigEnvelope,
    CONTRACT_VERSION,
    ContentBlock,
    ContentInput,
    DeletedMobProfile,
    ExternalEventOutcome,
    AttributedEvent,
    Capability,
    ModelProfile,
    ModelsCatalogResponse,
    MobEventCursorEntry,
    MobEventsResult,
    MobProfile,
    MobProfileTools,
    EventEnvelope,
    EventSourceIdentity,
    HelpExecutionMode,
    HelpRequest,
    InlineVideoBlock,
    McpAddParams,
    McpHttpConfig,
    McpHttpServerConfig,
    McpHttpTransport,
    McpLiveOpResponse,
    McpReloadParams,
    McpRemoveParams,
    McpServerConfig,
    McpStdioConfig,
    McpStdioServerConfig,
    MobBackendConfigInput,
    MobCreateParams,
    MobCreateResult,
    MobDefinitionInput,
    MobEnsureMemberParams,
    MobEnsureMemberResult,
    MobEventRouterConfigInput,
    MobExternalBackendConfigInput,
    PeerCorrelationId,
    PeerId,
    LiveChannelParams,
    LiveCommitInputParams,
    LiveInputChunkWire,
    LiveOpenParams,
    LiveOpenResult,
    LiveWebrtcAnswerParams,
    LiveWebrtcAnswerResult,
    LiveSendInputParams,
    LiveStatusResult,
    LiveTruncateParams,
    RealtimeAudioChunk,
    RealtimeCapabilities,
    RealtimeTextChunk,
    RealtimeTurningMode,
    RealtimeVideoChunk,
    ExtractionError,
    RunResult,
    RuntimeAcceptResult,
    RuntimeStateResult,
    MobFlowNodeInput,
    MobFlowSpecInput,
    MobFlowStepInput,
    MobFrameSpecInput,
    MobLimitsSpecInput,
    MobMemberListEntryWire,
    MobMemberSpecWire,
    MobOrchestratorInput,
    MobProfileBindingInput,
    MobProfileInput,
    MobReconcileParams,
    MobReconcileReportWire,
    MobReconcileResult,
    MobSpawnManyFailedResult,
    MobSpawnManyFailureCause,
    MobSpawnManyParams,
    MobSpawnManyResult,
    MobSpawnManyResultEntry,
    MobSpawnManyResultPayload,
    MobSpawnManyResultStatus,
    MobSpawnManySpawnedResult,
    MobSpawnParams,
    MobSpawnPolicyInput,
    MobSpawnReceiptWire,
    MobSpawnSpecParams,
    MobSupervisorSpecInput,
    MobToolConfigInput,
    MobTopologySpecInput,
    MobTurnStartParams,
    MobWireMembersBatchEdge,
    MobWireMembersBatchParams,
    MobWireMembersBatchResult,
    MobWiringRulesInput,
    WireAssistantImageRef,
    WireBudgetSplitPolicy,
    WireAuthBindingRef,
    WireGenerateImageExecutionPlan,
    WireGenerateImageRequest,
    WireImageGenerationToolResult,
    WireImageOperationPhase,
    WireMemberLaunchMode,
    WireMemberRef,
    WireMemberState,
    WireMobBackendKind,
    WireMobMemberStatus,
    WireMobProfile,
    WireMobRuntimeMode,
    WireMobToolConfig,
    WireRuntimeBinding,
    WireToolAccessPolicy,
    WireToolFilter,
    SchemaWarning,
    ScheduleListResult,
    ScheduleOccurrencesResult,
    ScheduleOccurrenceRecord,
    ScheduleRecord,
    ScheduleToolCall,
    ScheduleToolsResult,
    SessionDetails,
    SessionAssistantBlock,
    SessionForkResult,
    SessionHistory,
    SessionInfo,
    SessionSummary,
    SessionMessage,
    SessionToolCall,
    SessionToolResult,
    SkillQuarantineDiagnostic,
    SkillRuntimeDiagnostics,
    SkillKey,
    SkillRef,
    SourceHealthSnapshot,
    StoredMobProfile,
    TranscriptAssistantBlockReplacement,
    TranscriptEditRunningBehavior,
    TranscriptMessageReplacement,
    TranscriptReplacement,
    TranscriptToolResultContentBlockReplacement,
    TranscriptUserContentBlockReplacement,
    WireInputState,
    Usage,
    InlineImageBlock,
    TextBlock,
    ExternalWorkRef,
    WorkEvidenceRef,
    WorkGraphClaim,
    WorkGraphEdge,
    WorkGraphEdgeKind,
    WorkGraphEvent,
    WorkGraphEventFilter,
    WorkGraphEventsResult,
    WorkGraphEventKind,
    WorkGraphItemFilter,
    WorkGraphOwner,
    WorkGraphOwnerKey,
    WorkGraphOwnerKind,
    WorkGraphPriority,
    WorkGraphReadyFilter,
    WorkGraphSnapshot,
    WorkGraphSnapshotFilter,
    WorkGraphStatus,
    WorkItem,
    WorkItemListResult,
)

# Error hierarchy
from .errors import (
    CapabilityUnavailableError,
    MeerkatError,
    SessionNotFoundError,
    SkillNotFoundError,
)

# Typed event hierarchy — every event variant is a frozen dataclass
from .events import (
    AgentErrorClass,
    AgentErrorReason,
    AgentErrorReport,
    BackgroundJobCompleted,
    BackgroundJobTerminalStatus,
    BoundaryAppliedToolConfigChangeStatus,
    BudgetWarning,
    CompactionCompleted,
    CompactionFailed,
    CompactionStarted,
    DeferredCatalogDeltaToolConfigChangeStatus,
    Event,
    ExtractionFailed,
    ExtractionSucceeded,
    ExternalToolDeltaToolConfigChangeStatus,
    HookId,
    HookCompleted,
    HookDenied,
    HookFailed,
    HookStarted,
    InteractionComplete,
    InteractionFailed,
    Retrying,
    RunCompleted,
    RunFailed,
    RunStarted,
    ScopedEvent,
    SkillResolutionFailed,
    SkillResolutionFailureReason,
    SkillsResolved,
    StreamTruncated,
    TextComplete,
    TextDelta,
    ToolConfigChangeStatus,
    ToolConfigChanged,
    ToolConfigChangedPayload,
    ToolCallRequested,
    ToolExecutionCompleted,
    ToolExecutionStarted,
    ToolExecutionTimedOut,
    ToolResultReceived,
    TurnCompleted,
    TurnTerminalCauseKind,
    TurnTerminalOutcome,
    TurnStarted,
    UnknownEvent,
    WarningFailedClosedToolConfigChangeStatus,
    parse_event,
)

__all__ = [
    # Client & session
    "MeerkatClient",
    "LiveChannel",
    "DeferredSession",
    "Session",
    "Mob",
    "MobHelperResult",
    "MobMemberSnapshot",
    "MobKickoffMemberSnapshot",
    "MobReadyMemberSnapshot",
    "MobRespawnResult",
    "MobSpawnSpec",
    "MemberDeliveryReceipt",
    "MemberRespawnReceipt",
    "MobPeerConnectivitySnapshot",
    "MobUnreachablePeer",
    "EventStream",
    "EventSubscription",
    # Types
    "CONTRACT_VERSION",
    "AttributedEvent",
    "BlobImageBlock",
    "BlobPayload",
    "CatalogModelEntry",
    "ContractVersion",
    "Capability",
    "ConfigEnvelope",
    "ContentBlock",
    "ContentInput",
    "DeletedMobProfile",
    "EventEnvelope",
    "EventSourceIdentity",
    "ExternalEventOutcome",
    "HelpExecutionMode",
    "HelpRequest",
    "InlineVideoBlock",
    "McpAddParams",
    "McpHttpConfig",
    "McpHttpServerConfig",
    "McpHttpTransport",
    "McpRemoveParams",
    "McpReloadParams",
    "McpLiveOpResponse",
    "McpServerConfig",
    "McpStdioConfig",
    "McpStdioServerConfig",
    "MobBackendConfigInput",
    "MobCreateParams",
    "MobCreateResult",
    "MobDefinitionInput",
    "MobEnsureMemberParams",
    "MobEnsureMemberResult",
    "MobEventRouterConfigInput",
    "MobExternalBackendConfigInput",
    "PeerCorrelationId",
    "PeerId",
    "MobFlowNodeInput",
    "MobFlowSpecInput",
    "MobFlowStepInput",
    "MobFrameSpecInput",
    "MobLimitsSpecInput",
    "MobMemberListEntryWire",
    "MobMemberSpecWire",
    "MobOrchestratorInput",
    "MobProfileBindingInput",
    "MobProfileInput",
    "MobReconcileParams",
    "MobReconcileReportWire",
    "MobReconcileResult",
    "MobSpawnManyFailedResult",
    "MobSpawnManyFailureCause",
    "MobSpawnManyParams",
    "MobSpawnManyResult",
    "MobSpawnManyResultEntry",
    "MobSpawnManyResultPayload",
    "MobSpawnManyResultStatus",
    "MobSpawnManySpawnedResult",
    "MobSpawnParams",
    "MobSpawnPolicyInput",
    "MobSpawnReceiptWire",
    "MobSpawnSpecParams",
    "MobSupervisorSpecInput",
    "MobToolConfigInput",
    "MobTopologySpecInput",
    "MobTurnStartParams",
    "MobWireMembersBatchEdge",
    "MobWireMembersBatchParams",
    "MobWireMembersBatchResult",
    "MobWiringRulesInput",
    "LiveChannelParams",
    "LiveCommitInputParams",
    "LiveInputChunkWire",
    "LiveOpenParams",
    "LiveOpenResult",
    "LiveWebrtcAnswerParams",
    "LiveWebrtcAnswerResult",
    "LiveSendInputParams",
    "LiveStatusResult",
    "LiveTruncateParams",
    "RealtimeAudioChunk",
    "RealtimeCapabilities",
    "RealtimeTextChunk",
    "RealtimeTurningMode",
    "RealtimeVideoChunk",
    "RuntimeAcceptResult",
    "RuntimeStateResult",
    "WireAssistantImageRef",
    "WireBudgetSplitPolicy",
    "WireAuthBindingRef",
    "WireGenerateImageExecutionPlan",
    "WireGenerateImageRequest",
    "WireImageGenerationToolResult",
    "WireImageOperationPhase",
    "WireMemberLaunchMode",
    "WireMemberRef",
    "WireMemberState",
    "WireMobBackendKind",
    "WireMobMemberStatus",
    "WireMobProfile",
    "WireMobRuntimeMode",
    "WireMobToolConfig",
    "WireRuntimeBinding",
    "WireToolAccessPolicy",
    "WireToolFilter",
    "RunResult",
    "ExtractionError",
    "SchemaWarning",
    "ScheduleListResult",
    "ScheduleOccurrencesResult",
    "ScheduleOccurrenceRecord",
    "ScheduleRecord",
    "ScheduleToolCall",
    "ScheduleToolsResult",
    "SessionDetails",
    "SessionAssistantBlock",
    "SessionForkResult",
    "SessionHistory",
    "SessionInfo",
    "SessionSummary",
    "SessionMessage",
    "SessionToolCall",
    "SessionToolResult",
    "SkillQuarantineDiagnostic",
    "SkillRuntimeDiagnostics",
    "SkillKey",
    "SkillRef",
    "SourceHealthSnapshot",
    "StoredMobProfile",
    "TranscriptAssistantBlockReplacement",
    "TranscriptEditRunningBehavior",
    "TranscriptMessageReplacement",
    "TranscriptReplacement",
    "TranscriptToolResultContentBlockReplacement",
    "TranscriptUserContentBlockReplacement",
    "ModelProfile",
    "ModelsCatalogResponse",
    "MobEventCursorEntry",
    "MobEventsResult",
    "MobProfile",
    "MobProfileTools",
    "WireInputState",
    "Usage",
    "InlineImageBlock",
    "TextBlock",
    # Errors
    "MeerkatError",
    "CapabilityUnavailableError",
    "SessionNotFoundError",
    "SkillNotFoundError",
    # Events (base + all variants)
    "AgentErrorClass",
    "AgentErrorReason",
    "AgentErrorReport",
    "Event",
    "RunStarted",
    "ScopedEvent",
    "RunCompleted",
    "ExtractionSucceeded",
    "ExtractionFailed",
    "RunFailed",
    "TurnStarted",
    "TextDelta",
    "TextComplete",
    "ToolCallRequested",
    "ToolResultReceived",
    "TurnCompleted",
    "TurnTerminalCauseKind",
    "TurnTerminalOutcome",
    "ToolExecutionStarted",
    "ToolExecutionCompleted",
    "ToolExecutionTimedOut",
    "CompactionStarted",
    "CompactionCompleted",
    "CompactionFailed",
    "BudgetWarning",
    "Retrying",
    "HookId",
    "HookStarted",
    "HookCompleted",
    "HookFailed",
    "HookDenied",
    "SkillsResolved",
    "SkillResolutionFailed",
    "SkillResolutionFailureReason",
    "InteractionComplete",
    "InteractionFailed",
    "StreamTruncated",
    "BackgroundJobCompleted",
    "BackgroundJobTerminalStatus",
    "BoundaryAppliedToolConfigChangeStatus",
    "DeferredCatalogDeltaToolConfigChangeStatus",
    "WarningFailedClosedToolConfigChangeStatus",
    "ExternalToolDeltaToolConfigChangeStatus",
    "ToolConfigChangeStatus",
    "ToolConfigChanged",
    "ToolConfigChangedPayload",
    "UnknownEvent",
    "parse_event",
]
