//! MobKit core — orchestration engine for the Meerkat multi-agent runtime.

pub mod identity_first;

pub mod access;
pub mod auth;
pub mod baseline;
pub mod blob_store;
pub mod config_convention;
pub mod console_aggregator;
pub mod console_config;
pub mod console_contracts;
pub(crate) mod console_spawn;
pub mod contact_directory;
pub mod decisions;
pub mod governance;
pub mod http_auth;
pub mod http_console;
pub mod http_flow_editor;
pub mod http_sse;
pub mod member_comms_id;
pub mod mob_handle_runtime;
pub mod mobpack;
pub mod mocks;
pub mod process;
pub mod protocol;
pub mod rpc;
pub mod runtime;
pub mod types;
pub mod unified_runtime;

pub use access::{
    ACCESS_ACTIONS, AccessConfigError, AccessControlConfig, AccessController, AccessDecision,
    AccessEffect, AccessGroup, AccessPrincipal, AccessResource, AccessRule, AccessView,
    AgentResourceAttributes, evaluate_access, validate_access_config,
};
pub use auth::{
    GATEWAY_PEER_KEY_FILE, GatewayPeerKeyError, GatewayPeerKeys, Jwk, JwksCache, JwksCacheConfig,
    JwksCacheError, JwksDocument, JwtHeaderView, JwtValidationConfig, JwtValidationError,
    OidcContractError, OidcDiscoveryDocument, PubkeyDecodeError, ValidatedJwt, decode_pubkey_b64,
    extract_hs256_shared_secret, inspect_jwt_header, parse_jwks_json, parse_oidc_discovery_json,
    select_jwk_for_token, validate_jwt_locally,
};
pub use baseline::{
    BaselineVerificationError, BaselineVerificationReport, DEFAULT_MEERKAT_REPO,
    REQUIRED_MEERKAT_SYMBOLS, verify_meerkat_baseline_symbols,
};
pub use blob_store::{
    Base64BlobStoreAdapter, BinaryBlobPayload, BinaryBlobStore, BinaryBlobStoreAdapter,
    ObjectStoreBlobStore,
};
pub use config_convention::ConventionalPaths;
pub use console_aggregator::{
    AllowAllConsoleVisibilityPolicy, AppendDisposition, AppendOutcome, ConsoleAggregatorOptions,
    ConsoleCursor, ConsoleFrame, ConsoleFrameSource, ConsoleFrameSourceKind, ConsoleFrameStatus,
    ConsoleIdentityInspection, ConsoleIdentityRecord,
    ConsoleInteractionAccepted as ConsoleTimelineInteractionAccepted, ConsoleLogError,
    ConsoleLogResult, ConsoleLogStore, ConsoleReplayUnavailable, ConsoleRuntimeRegistration,
    ConsoleSendRequest, ConsoleTimelineEvent, ConsoleTimelineMode, ConsoleTimelinePage,
    ConsoleTimelineQuery, ConsoleTimelineWindowPage, ConsoleTimelineWindowQuery, ConsoleVisibility,
    ConsoleVisibilityPolicy, HideImplicitDelegateMembersConsoleVisibilityPolicy,
    InMemoryConsoleLogStore, MobKitConsoleAggregator, NewConsoleFrame, ReplaySubscriptionEffect,
    ReplaySubscriptionState, ReplaySubscriptionTransition, SendEffect, SendState, SendTransition,
    SourceIngestionEffect, SourceIngestionState, SourceIngestionTransition, SqliteConsoleLogStore,
};
pub use console_config::{
    ConsoleActionsUiConfig, ConsoleAgentBadgeConfig, ConsoleAgentListConfig,
    ConsoleAgentSectionConfig, ConsoleAppearanceConfig, ConsoleBrandingConfig, ConsoleConfigError,
    ConsoleEnvironmentConfig, ConsoleLayoutConfig, ConsoleRailFilterPresetConfig,
    ConsoleRailUiConfig, ConsoleSidebarButtonConfig, ConsoleSidebarUiConfig, ConsoleUiConfig,
    load_console_ui_config_from_path_for_realm, load_console_ui_config_from_toml,
    load_console_ui_config_from_toml_for_realm,
};
pub use console_contracts::{
    ConsoleIdentityEventEnvelope, ConsoleInteractionRejectedError, ReplayUnavailableError,
};
pub use decisions::{
    AuthPolicy, AuthProvider, BigQueryNaming, ConsoleAccessRequest, ConsolePolicy,
    DecisionPolicyError, MetricsPolicy, REQUIRED_RELEASE_TARGETS, ReleaseMetadata,
    RuntimeOpsPolicy, enforce_console_route_access, load_trusted_mobkit_modules_from_toml,
    parse_release_metadata_json, validate_bigquery_naming, validate_release_metadata,
    validate_runtime_ops_policy,
};
#[allow(deprecated)]
pub use governance::validate_phase0_governance_contracts;
pub use governance::{
    GovernanceValidationError, STRICT_TRACEABILITY_STATUSES, validate_governance_contracts,
    validate_governance_state, validate_traceability_statuses,
};
pub use http_auth::{auth_middleware, with_auth_layer};
pub use http_console::{
    ConsoleJsonState, console_frontend_app_js_handler, console_frontend_index_handler,
    console_frontend_router, console_json_handler, console_json_router,
    console_json_router_with_aggregator, console_json_router_with_aggregator_and_access,
    console_json_router_with_runtime,
};
pub use http_flow_editor::{
    flow_editor_frontend_app_css_handler, flow_editor_frontend_app_js_handler,
    flow_editor_frontend_index_handler, flow_editor_frontend_router,
    flow_editor_frontend_vendor_js_handler, flow_editor_router,
    flow_editor_router_with_host_deploy, flow_editor_rpc_handler,
    flow_editor_rpc_handler_allowing_host_deploy, flow_editor_rpc_router,
    flow_editor_rpc_router_allowing_host_deploy,
};
pub use http_sse::{
    AgentEventSubscribeFn, MobEventSubscribeFn, agent_event_sse, agent_events_sse_router,
    agent_events_sse_router_with_access, mob_events_sse_router, mob_events_sse_router_with_access,
    mob_structural_events_sse_router, mob_structural_events_sse_router_with_access,
};
pub use mob_handle_runtime::{
    AfterCreateHook, CapabilityFlags, MobBootstrapOptions, MobBootstrapSpec, MobRuntime,
    MobRuntimeError, RealMobRuntime, SessionCreatedContext, SessionHook, member_entry_to_json,
    send_message_on_mob,
};
pub use mobpack::{
    MOBPACK_MEDIA_TYPE, MOBPACK_SCHEMA_VERSION, MobpackDeployCommandResult, MobpackDiagnostic,
    MobpackDocument, MobpackExportResult, MobpackValidationResult, deploy_command_preview,
    export_mobpack, import_mobpack, mobpack_schema_response, validate_mobpack,
};
pub use mocks::{MockModuleProcess, MockProcessError};
pub use process::{ProcessBoundaryError, run_process_json_line};
pub use protocol::{ProtocolParseError, parse_module_event_line, parse_unified_event_line};
pub use rpc::{
    CONSOLE_TIMELINE_REPLAY_UNAVAILABLE_CODE, IdentityFirstContext, JsonRpcError, JsonRpcRequest,
    JsonRpcResponse, MEMORY_BACKEND_UNAVAILABLE_CODE, MOB_EVENTS_STALE_CURSOR_CODE,
    MOBKIT_CONTRACT_VERSION, handle_console_ingress_json, handle_mobkit_rpc_json,
    handle_unified_rpc_json,
};
pub use rpc::{RpcCapabilities, RpcCapabilitiesError, parse_rpc_capabilities};
pub use runtime::{
    BaselineRuntimeError, BigQueryGcConfig, BigQuerySessionStoreAdapter, BigQuerySessionStoreError,
    ConfigResolutionError, ConsoleAgentLiveSnapshot, ConsoleLiveSnapshot, ConsoleModelCapabilities,
    ConsoleRestJsonRequest, ConsoleRestJsonResponse, DecisionRuntimeError,
    ElephantMemoryBackendConfig, ElephantMemoryStoreError, GatingAuditEntry, GatingDecideError,
    GatingDecideRequest, GatingDecision, GatingDecisionResult, GatingEvaluateRequest,
    GatingEvaluateResult, GatingOutcome, GatingPendingEntry, GatingRiskTier, InMemoryMetadataStore,
    JsonFileSessionStore, JsonFileSessionStoreError, JsonStoreLockRecord, LifecycleEvent,
    LifecycleStage, McpBoundaryError, MemoryAssertion, MemoryBackendConfig, MemoryConflictSignal,
    MemoryIndexError, MemoryIndexRequest, MemoryIndexResult, MemoryQueryRequest, MemoryQueryResult,
    MemoryStoreInfo, MetadataScope, MetadataStoreError, MobkitRuntimeError, MobkitRuntimeHandle,
    ModuleHealthState, ModuleHealthTransition, ModuleRouteError, ModuleRouteRequest,
    ModuleRouteResponse, NormalizationError, PersistentMetadataStore, RpcRouteError,
    RpcRuntimeError, RuntimeBoundaryError, RuntimeDecisionInputs, RuntimeDecisionState,
    RuntimeFromConfigError, RuntimeMetadataTable, RuntimeMutationError, RuntimeOptions,
    RuntimeRoute, RuntimeRouteMutationError, RuntimeShutdownReport, ScheduleDefinition,
    ScheduleDispatch, ScheduleDispatchReport, ScheduleEvaluation, ScheduleRuntimeInjection,
    ScheduleTrigger, SchedulingSupervisorSignal, SessionPersistenceRow, SessionStoreContract,
    SessionStoreKind, SqliteMetadataStore, SubscribeRequest, SubscribeResponse, SubscribeScope,
    SupervisorReport, TrustedOidcRuntimeConfig, WILDCARD_ROUTE, build_runtime_decision_state,
    evaluate_schedules_at_tick, handle_console_rest_json_route,
    handle_console_rest_json_route_with_snapshot,
    handle_console_rest_json_route_with_snapshot_and_access, materialize_latest_session_rows,
    materialize_live_session_rows, normalize_event_line, route_module_call,
    route_module_call_rpc_json, route_module_call_rpc_subprocess, run_discovered_module_once,
    run_meerkat_baseline_verification_once, run_module_boundary_once,
    run_rpc_capabilities_boundary_once, session_store_contracts, start_mobkit_runtime,
    start_mobkit_runtime_with_options,
};
pub use types::{
    AgentDiscoverySpec, DiscoverySpec, EventEnvelope, MobKitConfig, MobStructuralEventEnvelope,
    ModuleConfig, ModuleEvent, PreSpawnData, RestartPolicy, UnifiedEvent,
};
pub use unified_runtime::{
    DEFAULT_REFERENCE_APP_MAX_CONCURRENT_REQUESTS, DesiredPeerEdge, DesiredPeerEdgeError,
    Discovery, EdgeDiscovery, EdgeReconcileFailure, ErrorEvent, ErrorHook, EventLogConfig,
    EventLogStore, EventQuery, IdentityBootstrapMode, PersistedEvent, PostReconcileHook,
    PostSpawnHook, PreSpawnContext, PreSpawnHook, RediscoverReport, ShutdownDrainReport,
    UnifiedRuntime, UnifiedRuntimeBootstrapError, UnifiedRuntimeBuilder,
    UnifiedRuntimeBuilderError, UnifiedRuntimeBuilderField, UnifiedRuntimeError,
    UnifiedRuntimeReconcileEdgesReport, UnifiedRuntimeReconcileError,
    UnifiedRuntimeReconcileReport, UnifiedRuntimeReconcileRoutingReport, UnifiedRuntimeRunReport,
    UnifiedRuntimeShutdownReport, discovery_spec_to_spawn_spec,
};
