open-standards/smart-byte/smart-byte-rs/crates/smart-byte-crdt/src/lib.rs
Transaction Science 3fe109d58f ingest batch 4: 9 crates · table-stakes completers across all three workspaces
OpenPay (3 crates, ~13k LOC, 175 tests)
  op-connect           sub-merchant onboarding + KYB + split-payments + payouts + 1099-K
  op-3ds2              3DS2.3 SCA processor (AReq/ARes/CReq/CRes/RReq/RRes + exemptions)
  op-tax               US/EU/UK/AU/CA/IN tax with Avalara/Stripe/CCH/Vertex/TaxJar adapters

Smart Byte (3 crates, ~7k LOC, 57 tests)
  smart-byte-libp2p    libp2p transport (kad/gossipsub/mdns/autonat/relay/dcutr/identify/ping/req_resp)
  smart-byte-crdt      LWW/GCounter/PnCounter/OrSet/LwwMap/RgaList/2P-Set + HLC + vector clock + Automerge/Yjs interop
  smart-byte-keri-witness  KERI key-rotation cycle + witness layer + watchers + recovery + delegation

EOC (3 crates, ~8k LOC, 108 tests)
  eoc-tools            function-calling across Anthropic/OpenAI/Google/Mistral/Cohere + parallel exec + sandbox
  eoc-multimodal       vision (CLIP/SigLIP/ColPali) + audio (Whisper/MMS) + video sampling + modality router
  eoc-spec-decode      vanilla + SpS-with-temp + lookahead speculative decoding + EAGLE/Medusa stubs

All three workspaces compile cleanly. Forbidden-unsafe, no unwrap outside tests.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 04:00:04 -04:00

62 lines
2.2 KiB
Rust

//! Smart Byte CRDT engine.
//!
//! Provides Conflict-Free Replicated Data Types (CRDTs) for collaborative
//! cargo: shared documents, shared inventories, collaborative budgets.
//! Every replica converges on the same state without coordination.
//!
//! ## Modules
//!
//! * [`types`] — native CRDTs: LWW register, G/PN counters, OR-set, LWW
//! map, RGA list, two-phase set, plus the [`Crdt`](types::Crdt) trait.
//! * [`hlc`] — Hybrid Logical Clock (Kulkarni et al. 2014) used as the
//! universal timestamp for LWW-style merges.
//! * [`vector_clock`] — vector clocks for causal-history comparisons and
//! delta computation.
//! * [`document`] — tree-structured [`CrdtDocument`](document::CrdtDocument)
//! with addressable paths.
//! * [`ops`] — content-addressed operations and the op log.
//! * [`sync`] — delta computation and idempotent application.
//! * [`cargo_bridge`] — wraps a [`CrdtDocument`](document::CrdtDocument)
//! as a Smart Byte `Cargo::Custom` envelope.
//! * [`sharing`] — Simplex (one writer, many readers) and Multiplex
//! (many writers) sharing patterns.
//! * [`automerge_interop`] — feature `automerge-interop`.
//! * [`yjs_interop`] — feature `yjs-interop`.
//! * [`error`] — typed errors.
//!
//! ## Design
//!
//! Native CRDT types do not depend on `automerge` or `yrs`; those crates
//! are used only behind their feature flags for ecosystem interop.
//! Operations are content-addressed (BLAKE3 over canonical CBOR) and
//! ordered by HLC, mirroring Smart Byte's envelope model.
#![forbid(unsafe_code)]
pub mod cargo_bridge;
pub mod document;
pub mod error;
pub mod hlc;
pub mod ops;
pub mod sharing;
pub mod sync;
pub mod types;
pub mod vector_clock;
#[cfg(feature = "automerge-interop")]
pub mod automerge_interop;
#[cfg(feature = "yjs-interop")]
pub mod yjs_interop;
pub use document::{CrdtDocument, CrdtNode, DocumentId, Value};
pub use error::{CrdtError, Result};
pub use hlc::{HybridLogicalClock, HlcClock, ReplicaId};
pub use ops::{Op, OpId, OpKind, Path};
pub use sharing::{ShareMultiplex, ShareSimplex};
pub use sync::{apply, diff};
pub use types::{
Crdt, CrdtId, GCounter, LwwMap, LwwRegister, OrSet, PnCounter, RgaList, TwoPhaseSet,
UniqueTag,
};
pub use vector_clock::VectorClock;