#![recursion_limit = "1024"]

//! Meerkat contracts — canonical wire types, surface schemas, and error contracts.
//!
//! This crate is the single source of truth for all wire-facing types.
//! Surface crates (RPC, REST, MCP, CLI) consume these types directly.

pub mod capability;
pub mod error;
pub mod event_catalog;
pub mod protocol;
pub mod request_lifecycle;
pub mod rest_catalog;
pub mod rpc_catalog;
pub mod session_locator;
pub mod version;
pub mod wire;

#[cfg(feature = "schema")]
pub mod emit;

// Re-exports for convenience
pub use capability::{
    CapabilitiesResponse, CapabilityEntry, CapabilityId, CapabilityRegistration, CapabilityScope,
    CapabilityStatus, available_capabilities, build_capabilities, resolve_capabilities,
};
pub use error::{CapabilityHint, ErrorCategory, ErrorCode, WireError};
pub use event_catalog::KNOWN_AGENT_EVENT_TYPES;
pub use meerkat_core::{
    ExecutionPlacement, ExecutionPlacementIdentity, SessionForkResult,
    TranscriptEditRunningBehavior, TranscriptReplacement,
};
pub use protocol::Protocol;
pub use request_lifecycle::{
    MCP_TOOL_REQUEST_LIFECYCLE_CATALOG, McpToolRequestLifecycleCatalog,
    McpToolRequestLifecycleDescriptor, RequestLifecycle, RpcRequestLifecycleRule,
    mcp_tool_request_lifecycle, rpc_request_lifecycle,
};
pub use rest_catalog::{
    RestOperationDescriptor, RestPathDescriptor, rest_documented_paths, rest_path_catalog,
};
pub use rpc_catalog::{
    RpcMethodCatalogOptions, RpcMethodDescriptor, RpcNotificationDescriptor, rpc_method_catalog,
    rpc_method_names, rpc_notification_catalog, rpc_notification_names,
};
pub use session_locator::{SessionLocator, SessionLocatorError, format_session_ref};
pub use version::ContractVersion;
pub use wire::supervisor_bridge::{
    BridgeAck, BridgeBindPayload, BridgeBindResponse, BridgeCapabilities, BridgeCommand,
    BridgeCommandDecodeError, BridgeDeliveryOutcome, BridgeDeliveryPayload,
    BridgeDeliveryRejectionCause, BridgeDeliveryResponse, BridgeDestroyResponse,
    BridgeHardCancelPayload, BridgeMemberRuntimeState, BridgeObservationResponse,
    BridgePeerConnectivity, BridgePeerSpec, BridgePeerWiringPayload, BridgeProtocolVersion,
    BridgeReply, BridgeRetireResponse, BridgeSupervisorPayload,
    SUPERVISOR_BRIDGE_CURRENT_PROTOCOL_VERSION, SUPERVISOR_BRIDGE_DEFAULT_PROTOCOL_VERSION,
    SUPERVISOR_BRIDGE_PROTOCOL_VERSION, SUPERVISOR_BRIDGE_SUPPORTED_PROTOCOL_VERSIONS,
    UnsupportedBridgeProtocolVersion, decode_bridge_command,
    supervisor_bridge_current_protocol_version, supervisor_bridge_default_protocol_version,
    supervisor_bridge_protocol_version_supported, supervisor_bridge_supported_protocol_versions,
};
pub use wire::{
    ApprovalActionKind,
    ApprovalDecideParams,
    ApprovalDecision,
    ApprovalDecisionRecord,
    ApprovalGetParams,
    ApprovalId,
    ApprovalListFilter,
    ApprovalListParams,
    ApprovalListResult,
    ApprovalOwnerRef,
    ApprovalPrincipalId,
    ApprovalProposedAction,
    ApprovalRecord,
    ApprovalRequest,
    ApprovalRequestParams,
    ApprovalResourceKind,
    ApprovalResourceRef,
    ApprovalRisk,
    ApprovalStatus,
    ArtifactDownloadParams,
    ArtifactDownloadResult,
    ArtifactIdParams,
    ArtifactListParams,
    ArtifactListResult,
    AuthGrant,
    BindingIdParams,
    CatalogModelEntry,
    CommsChecksumTokenParams,
    CommsChecksumTokenResult,
    CommsChecksumTokenResultIntent,
    CommsCommandError,
    CommsCommandProjectionError,
    CommsCommandRequest,
    CommsParams,
    CommsPeerEntry,
    CommsPeerLifecycleParams,
    CommsPeerRequestIntent,
    CommsPeerRequestParams,
    CommsPeerResponseResult,
    CommsPeersParams,
    CommsPeersResult,
    CommsSendParams,
    CommsSendResult,
    CoreCreateParams,
    CreateProfileParams,
    DeviceCompleteParams,
    DeviceStartParams,
    EventReplayCursor,
    EventReplayCursorError,
    EventReplayEnvelope,
    EventReplayEventId,
    EventReplayScope,
    EventsLatestCursorParams,
    EventsLatestCursorResult,
    EventsListSinceParams,
    EventsListSinceResult,
    EventsSnapshotBody,
    EventsSnapshotParams,
    EventsSnapshotResult,
    ForkSessionAtParams,
    ForkSessionReplaceParams,
    GrantAction,
    GrantScope,
    HelpExecutionMode,
    HelpRequest,
    HelpResponse,
    HookParams,
    ListSchedulesParams,
    LiveChannelParams,
    LiveCommitInputParams,
    LiveInputChunkWire,
    LiveOpenParams,
    LiveOpenResult,
    LiveOpenTransport,
    LiveRefreshResult,
    LiveRefreshStatus,
    LiveSendInputParams,
    LiveStatusResult,
    LiveTruncateParams,
    LiveWebrtcAnswerParams,
    LiveWebrtcAnswerResult,
    LoginCompleteParams,
    LoginStartParams,
    McpAddParams,
    McpLiveOpResponse,
    McpLiveOpStatus,
    McpLiveOperation,
    McpReloadParams,
    McpRemoveParams,
    MobAppendSystemContextParams,
    MobAppendSystemContextResult,
    MobCancelAllWorkParams,
    MobCancelAllWorkResult,
    MobCancelWorkParams,
    MobCancelWorkResult,
    MobCreateParams,
    MobCreateResult,
    MobDefinitionInput,
    MobDestroyResult,
    MobEnsureMemberOutcomeWire,
    MobEnsureMemberParams,
    MobEnsureMemberResult,
    MobEventsParams,
    MobEventsResult,
    MobFlowCancelParams,
    MobFlowCancelResult,
    MobFlowRunParams,
    MobFlowRunResult,
    MobFlowStatusParams,
    MobFlowStatusResult,
    MobFlowsResult,
    MobForceCancelResult,
    MobForkHelperParams,
    MobHelperResult,
    MobIdParams,
    MobIngressInteractionParams,
    MobIngressInteractionResult,
    MobLifecycleParams,
    MobLifecycleResult,
    MobListMembersMatchingParams,
    MobListMembersMatchingResult,
    MobListResult,
    MobMemberFilterWire,
    MobMemberListEntryWire,
    MobMemberParams,
    MobMemberSendParams,
    MobMemberSendResult,
    MobMemberSpecWire,
    MobMemberStatusResult,
    MobMembersResult,
    MobPeerTarget,
    MobProfileCreateParams,
    MobProfileDeleteParams,
    MobProfileDeleteResult,
    MobProfileInput,
    MobProfileListResult,
    MobProfileLookupResult,
    MobProfileNameParams,
    MobProfileUpdateParams,
    MobReconcileFailureWire,
    MobReconcileOptionsWire,
    MobReconcileParams,
    MobReconcileReportWire,
    MobReconcileResult,
    MobRespawnParams,
    MobRespawnReceipt,
    MobRespawnResult,
    MobRetireResult,
    MobRotateSupervisorResult,
    MobSnapshotResult,
    MobSpawnHelperParams,
    MobSpawnManyFailedResult,
    MobSpawnManyFailureCause,
    MobSpawnManyParams,
    MobSpawnManyResult,
    MobSpawnManyResultEntry,
    MobSpawnManyResultPayload,
    MobSpawnManyResultStatus,
    MobSpawnManySpawnedResult,
    MobSpawnParams,
    MobSpawnReceiptWire,
    MobSpawnResult,
    MobSpawnSpecParams,
    MobStatusResult,
    MobStreamCloseParams,
    MobStreamCloseResult,
    MobStreamOpenParams,
    MobStreamOpenResult,
    MobSubmitWorkParams,
    MobSubmitWorkResult,
    MobTurnStartParams,
    MobUnwireParams,
    MobUnwireResult,
    MobWaitMembersResult,
    MobWaitParams,
    MobWireMembersBatchEdge,
    MobWireMembersBatchParams,
    MobWireMembersBatchResult,
    MobWireParams,
    MobWireResult,
    ModelsCatalogResponse,
    PeerAddress,
    PeerCapabilitySet,
    PeerDirectoryEntry,
    PeerDirectoryListing,
    PeerDirectorySource,
    PeerId,
    PeerReachability,
    PeerReachabilityReason,
    PeerResponseTerminalStatusWire,
    PeerSendability,
    PeerTransport,
    PrincipalId,
    PrincipalKind,
    PrincipalRef,
    ProviderCatalog,
    ProvisionApiKeyParams,
    RealmIdParams,
    RealtimeAudioChunk,
    RealtimeAudioFormat,
    RealtimeCapabilities,
    RealtimeInputChunk,
    RealtimeInputKind,
    RealtimeOutputKind,
    RealtimeTextChunk,
    RealtimeTurningMode,
    RealtimeVideoChunk,
    RuntimeAcceptOutcomeType,
    RuntimeAcceptResult,
    RuntimeHostCapabilities,
    RuntimeHostEndpointProjection,
    RuntimeHostFeatureFlags,
    RuntimeHostHealth,
    RuntimeHostHealthStatus,
    RuntimeHostIdScope,
    RuntimeHostInfo,
    RuntimeHostRealmProjection,
    RuntimeStateResult,
    ScheduleIdParams,
    ScheduleListResult,
    ScheduleOccurrencesParams,
    ScheduleOccurrencesResult,
    SessionExternalEventEnvelope,
    SessionPeerResponseTerminalParams,
    SessionStreamCloseParams,
    SessionStreamCloseResult,
    SessionStreamOpenParams,
    SessionStreamOpenResult,
    SkillEntry,
    SkillInspectResponse,
    SkillListResponse,
    SkillSourceProvenance,
    SkillsParams,
    StructuredOutputParams,
    SupervisorRotationReportWire,
    UpdateScheduleParams,
    VisibilityClass,
    WireAgentRuntimeId,
    WireAssistantBlock,
    WireAssistantImageRef,
    WireAuthBindingRef,
    // Phase 4c — auth-binding wire types.
    WireAuthError,
    WireAuthProfile,
    WireAuthProfileCleared,
    WireAuthProfileCreated,
    WireAuthProfileDetail,
    WireAuthProfilesList,
    WireAuthStatus,
    WireAuthStatusDetail,
    WireBackendProfile,
    WireBindingIdentity,
    WireContentBlock,
    WireContentInput,
    WireDeviceCompleteResult,
    WireDeviceStart,
    WireEvent,
    WireGenerateImageExecutionPlan,
    WireGenerateImageRequest,
    WireHandlingMode,
    WireImageGenerationToolResult,
    WireImageOperationPhase,
    WireInputLifecycleState,
    WireInputState,
    WireInputStateHistoryEntry,
    WireLiveAdapterErrorCode,
    WireLiveAdapterObservation,
    WireLiveAdapterStatus,
    WireLiveChannelCapabilities,
    WireLiveContinuityMode,
    WireLiveDegradationReason,
    WireLiveResponseModality,
    WireLiveTransportBootstrap,
    WireLoginReady,
    WireLoginStart,
    WireMemberRef,
    WireMemberRefError,
    WireMemberState,
    WireMobBackendKind,
    WireMobLifecycleAction,
    WireMobMemberStatus,
    WireMobReconcileStage,
    WireMobRuntimeMode,
    WireModelBetaHeader,
    WireModelProfile,
    WireModelRoutingApprovalPhase,
    WireModelRoutingApprovalRequest,
    WireModelTier,
    WireProviderBinding,
    WireProviderMeta,
    WireProvisionApiKeyResult,
    WireRealmConnectionSet,
    WireRealmList,
    WireRealmSummary,
    WireRenderClass,
    WireRenderMetadata,
    WireRenderSalience,
    WireResolvedModelCapabilities,
    WireRunResult,
    WireRuntimeBinding,
    WireRuntimeState,
    WireScopedModelOverride,
    WireSessionHistory,
    WireSessionInfo,
    WireSessionMessage,
    WireSessionModelRoutingStatus,
    WireSessionSummary,
    WireStopReason,
    WireSwitchTurnControlResult,
    WireSwitchTurnIntent,
    WireSwitchTurnPhase,
    WireToolCall,
    WireToolResult,
    WireToolResultContent,
    WireTrustedPeerIdentity,
    WireTrustedPeerSpec,
    WireUsage,
    WireWorkOrigin,
};
