//! Provider-neutral lifecycle contracts for AI harnesses.
//!
//! `docs/specs/lifecycle-contract/body.md` is the normative target. This module
//! implements the `lifeloop.v0.2` slice of that contract: the wire enums,
//! lifecycle receipt, payload envelope, and the callback request/response
//! envelopes that clients implement.

pub mod host_assets;
pub mod protocol;
pub mod router;
pub mod telemetry;

mod callback_contract;
mod manifest_contract;
mod receipt_contract;
mod renewal_status;
mod wire;

pub const SCHEMA_VERSION: &str = "lifeloop.v0.2";

pub use callback_contract::{CallbackRequest, CallbackResponse, DispatchEnvelope};
pub use manifest_contract::*;
pub use receipt_contract::LifecycleReceipt;
pub use renewal_status::{RenewalAutomationState, RenewalAutomationStatus};
pub use wire::*;

pub(crate) use wire::require_non_empty;

// ============================================================================
// Domain module aliases (added 0.1.1)
//
// These submodules are pure re-exports of the canonical top-level surface
// they exist so consumers can write `use lifeloop::event::LifecycleEventKind`
// instead of `use lifeloop::LifecycleEventKind`. The canonical paths remain
// authoritative; aliases must stay in lockstep. See
// `tests/domain_modules.rs` for the alias-identity contract.
// ============================================================================

/// Lifecycle event vocabulary. Re-exports of canonical crate-root items.
pub mod event {
    pub use crate::{LifecycleEventKind, lifecycle_event_kinds};
}

/// Adapter manifest types and registry. Re-exports of canonical crate-root items.
pub mod manifest {
    pub use crate::{
        AdapterManifest, ConformanceLevel, ManifestApprovalSurface, ManifestContextPressure,
        ManifestKnownDegradation, ManifestLifecycleEventSupport, ManifestPlacementClass,
        ManifestPlacementSupport, ManifestReceipts, ManifestRenewal, ManifestRenewalContinuation,
        ManifestRenewalReset, ManifestSessionIdentity, ManifestSessionRename,
        ManifestTelemetrySource, RegisteredAdapter, lookup_manifest, manifest_registry,
    };
}

/// Built-in adapter registry and per-harness manifest constructors.
/// Re-exports of canonical crate-root items.
pub mod adapters {
    pub use crate::{
        claude_manifest, codex_manifest, gemini_manifest, hermes_manifest, lookup_manifest,
        manifest_registry, openclaw_manifest, opencode_manifest,
    };
}

/// Capability vocabulary and negotiation entry point. Re-exports the canonical
/// router items so consumers can use `lifeloop::capability::*` without taking
/// a dependency on the `router` module path. The `CapabilityKind` /
/// `CapabilityRequest` split is preserved deliberately — `CapabilityKind` is
/// the identity used as a manifest lookup key, and `CapabilityRequest` adds
/// policy (`desired`, `level`).
pub mod capability {
    pub use crate::router::{
        CapabilityKind, CapabilityRequest, CapabilityRequirement, DefaultNegotiationStrategy,
        NegotiatedPlan, PayloadPlacementDecision, PlacementRejection, negotiate,
    };
}
