Skip to main content

lifeloop/
lib.rs

1//! Provider-neutral lifecycle contracts for AI harnesses.
2//!
3//! `docs/specs/lifecycle-contract/body.md` is the normative target. This module
4//! implements the `lifeloop.v0.2` slice of that contract: the wire enums,
5//! lifecycle receipt, payload envelope, and the callback request/response
6//! envelopes that clients implement.
7
8pub mod host_assets;
9pub mod protocol;
10pub mod router;
11pub mod telemetry;
12
13mod callback_contract;
14mod manifest_contract;
15mod receipt_contract;
16mod renewal_status;
17mod wire;
18
19pub const SCHEMA_VERSION: &str = "lifeloop.v0.2";
20
21pub use callback_contract::{CallbackRequest, CallbackResponse, DispatchEnvelope};
22pub use manifest_contract::*;
23pub use receipt_contract::LifecycleReceipt;
24pub use renewal_status::{RenewalAutomationState, RenewalAutomationStatus};
25pub use wire::*;
26
27pub(crate) use wire::require_non_empty;
28
29// ============================================================================
30// Domain module aliases (added 0.1.1)
31//
32// These submodules are pure re-exports of the canonical top-level surface
33// they exist so consumers can write `use lifeloop::event::LifecycleEventKind`
34// instead of `use lifeloop::LifecycleEventKind`. The canonical paths remain
35// authoritative; aliases must stay in lockstep. See
36// `tests/domain_modules.rs` for the alias-identity contract.
37// ============================================================================
38
39/// Lifecycle event vocabulary. Re-exports of canonical crate-root items.
40pub mod event {
41    pub use crate::{LifecycleEventKind, lifecycle_event_kinds};
42}
43
44/// Adapter manifest types and registry. Re-exports of canonical crate-root items.
45pub mod manifest {
46    pub use crate::{
47        AdapterManifest, ConformanceLevel, ManifestApprovalSurface, ManifestContextPressure,
48        ManifestKnownDegradation, ManifestLifecycleEventSupport, ManifestPlacementClass,
49        ManifestPlacementSupport, ManifestReceipts, ManifestRenewal, ManifestRenewalContinuation,
50        ManifestRenewalReset, ManifestSessionIdentity, ManifestSessionRename,
51        ManifestTelemetrySource, RegisteredAdapter, lookup_manifest, manifest_registry,
52    };
53}
54
55/// Built-in adapter registry and per-harness manifest constructors.
56/// Re-exports of canonical crate-root items.
57pub mod adapters {
58    pub use crate::{
59        claude_manifest, codex_manifest, gemini_manifest, hermes_manifest, lookup_manifest,
60        manifest_registry, openclaw_manifest, opencode_manifest,
61    };
62}
63
64/// Capability vocabulary and negotiation entry point. Re-exports the canonical
65/// router items so consumers can use `lifeloop::capability::*` without taking
66/// a dependency on the `router` module path. The `CapabilityKind` /
67/// `CapabilityRequest` split is preserved deliberately — `CapabilityKind` is
68/// the identity used as a manifest lookup key, and `CapabilityRequest` adds
69/// policy (`desired`, `level`).
70pub mod capability {
71    pub use crate::router::{
72        CapabilityKind, CapabilityRequest, CapabilityRequirement, DefaultNegotiationStrategy,
73        NegotiatedPlan, PayloadPlacementDecision, PlacementRejection, negotiate,
74    };
75}