"""
core.coherence — Multi-agent state coherence package.

Exports the StateDelta dataclass and supporting utilities for
RFC 6902 JSON Patch-based state change proposals.

Also exports RedisMasterState and CommitResult for versioned,
OCC-protected Redis state management.

Also exports TaskDAGPusher for pushing task DAGs to Redis Streams
for exactly-once delivery to Gemini swarm workers via Consumer Groups.

Also exports StagingArea for Redis Hash-backed delta collection hub.

Also exports BulkheadGuard and BulkheadResult for asyncio.gather
exception isolation — one crashed agent never brings down the swarm.

Also exports OCCCommitEngine, OccCommitResult, and MAX_RETRIES for the
barrier-sync + OCC commit cycle that orchestrates multi-agent swarm rounds.

Also exports CoherenceOrchestrator and CoherenceResult for the complete
8-step coherence execution flow coordinator (MAP → CLAIM → PROPOSE →
BARRIER → REDUCE → COMMIT → RELEASE → SCAR).
"""

from core.coherence.state_delta import (
    StateDelta,
    PatchConflictError,
    validate_patch,
    apply_patch,
    VALID_OPS,
)

from core.coherence.redis_master_state import (
    RedisMasterState,
    CommitResult,
)

from core.coherence.task_dag_pusher import (
    TaskDAGPusher,
    STREAM_KEY,
    DEFAULT_GROUP,
)

from core.coherence.staging_area import (
    StagingArea,
    STAGING_KEY_PREFIX,
    STAGING_TTL_SECONDS,
)

from core.coherence.swarm_worker_base import (
    SwarmWorkerBase,
    PEL_TIMEOUT_MS,
)

from core.coherence.bulkhead import (
    BulkheadGuard,
    BulkheadResult,
    CRITICAL_THRESHOLD,
)

from core.coherence.occ_commit import (
    OCCCommitEngine,
    OccCommitResult,
    MAX_RETRIES,
)

from core.coherence.coherence_orchestrator import (
    CoherenceOrchestrator,
    CoherenceResult,
    ORCHESTRATION_TIMEOUT_SECONDS,
    EVENTS_LOG_PATH,
)

__all__ = [
    # state_delta exports
    "StateDelta",
    "PatchConflictError",
    "validate_patch",
    "apply_patch",
    "VALID_OPS",
    # redis_master_state exports
    "RedisMasterState",
    "CommitResult",
    # task_dag_pusher exports
    "TaskDAGPusher",
    "STREAM_KEY",
    "DEFAULT_GROUP",
    # staging_area exports
    "StagingArea",
    "STAGING_KEY_PREFIX",
    "STAGING_TTL_SECONDS",
    # swarm_worker_base exports
    "SwarmWorkerBase",
    "PEL_TIMEOUT_MS",
    # bulkhead exports
    "BulkheadGuard",
    "BulkheadResult",
    "CRITICAL_THRESHOLD",
    # occ_commit exports
    "OCCCommitEngine",
    "OccCommitResult",
    "MAX_RETRIES",
    # coherence_orchestrator exports
    "CoherenceOrchestrator",
    "CoherenceResult",
    "ORCHESTRATION_TIMEOUT_SECONDS",
    "EVENTS_LOG_PATH",
]
