peat_protocol/lib.rs
1//! # Peat Protocol - Hierarchical Intelligence for Versatile Entities
2//!
3//! A hierarchical capability composition protocol using CRDTs for autonomous systems.
4//!
5//! ## Overview
6//!
7//! The Peat protocol enables scalable coordination of autonomous nodes through:
8//! - **Three-phase protocol**: Discovery, Cell Formation, Hierarchical Operations
9//! - **CRDT-based state**: Eventual consistency via Automerge over Iroh QUIC
10//! - **Capability composition**: Additive, emergent, redundant, and constraint-based patterns
11//!
12//! ## Facade
13//!
14//! `peat-protocol` is the public entry point to the Peat stack. It re-exports
15//! `peat_schema` (wire types) and `peat_mesh` (P2P plumbing) so downstream
16//! consumers can depend on `peat-protocol` alone:
17//!
18//! ```toml
19//! # During an rc window, Cargo does not pick pre-release versions by default
20//! # — use the exact pin:
21//! peat-protocol = "=0.9.0-rc.1"
22//!
23//! # Once 0.9.0 stable is published, the normal caret selector is fine:
24//! # peat-protocol = "0.9"
25//! ```
26//!
27//! ## Architecture
28//!
29//! ```text
30//! ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
31//! │ Phase 1: │→ │ Phase 2: │→ │ Phase 3: │
32//! │ Discovery │ │ Cell │ │ Hierarchical │
33//! │ │ │ Formation │ │ Operations │
34//! └──────────────┘ └──────────────┘ └──────────────┘
35//! ```
36
37pub mod cell;
38pub mod command; // Bidirectional command coordination
39pub mod composition;
40pub mod cot; // Cursor-on-Target translation layer (ADR-020, ADR-028)
41pub mod credentials; // Backend-agnostic credential management
42pub mod discovery;
43pub mod distribution; // AI model distribution (manifests, updates, requirements)
44pub mod error;
45pub mod event; // Event routing and aggregation (ADR-027)
46pub mod ffi; // FFI bindings for ATAK and other native consumers (Issue #258)
47pub mod geohash; // Vendored geohash algorithm (supply chain audit)
48pub mod hierarchy;
49pub mod mesh_integration;
50pub mod models;
51pub mod network;
52pub mod policy; // Generic policy engine for conflict resolution
53pub mod qos; // Quality of Service framework (ADR-019)
54pub mod security; // Device authentication and PKI (ADR-006)
55pub mod storage;
56pub mod sync; // Data synchronization abstraction layer
57pub mod testing;
58pub mod traits;
59pub mod transport; // Backend-agnostic transport abstraction for mesh topology // Peat-specific adapters for peat-mesh
60
61pub use error::{Error, Result};
62
63// Facade re-exports: downstream consumers depend on peat-protocol alone.
64pub use peat_mesh;
65pub use peat_schema;
66
67/// Protocol version
68pub const VERSION: &str = env!("CARGO_PKG_VERSION");
69
70/// Default cell size (nodes per cell)
71pub const DEFAULT_CELL_SIZE: usize = 5;
72
73/// Default discovery timeout in seconds
74pub const DEFAULT_DISCOVERY_TIMEOUT_SECS: u64 = 60;
75
76/// Default hierarchy depth (node -> cell -> zone -> network)
77pub const DEFAULT_HIERARCHY_DEPTH: usize = 4;