llm_sync/lib.rs
1// SPDX-License-Identifier: MIT
2//! # llm-sync
3//!
4//! CRDT and vector clock primitives for distributed LLM agent state synchronization.
5//! Every merge operation is commutative, associative, and idempotent.
6//!
7//! ## Example
8//! ```rust
9//! use llm_sync::{AgentState, GCounter};
10//!
11//! let mut s1 = AgentState::new();
12//! let mut g = GCounter::new();
13//! g.increment("agent-1", 10);
14//! s1.counters.insert("requests".into(), g);
15//!
16//! let s2 = AgentState::new();
17//! let merged = s1.merge(&s2);
18//! assert_eq!(merged.counters["requests"].value(), 10);
19//! ```
20
21pub mod crdt;
22pub mod error;
23pub mod session;
24pub mod vclock;
25
26pub use error::SyncError;
27pub use vclock::VectorClock;
28pub use crdt::{GCounter, GSet, LWWRegister, ORMap, PNCounter};
29pub use session::{AgentState, SessionId};