triblespace-core 0.47.1

The triblespace core implementation.
Documentation
//! Canonical records, coverage, and typed views for collections.
//!
//! Wire decoding and strict self-signature checks remain structural. What a
//! collection stands for is read from the coverage index, which admits only
//! authorized records as it folds them. The larger generic oracle remains
//! test-only: it exercises algebraic laws rather than serving as another
//! runtime implementation.

use crate::blob::{encodings::simplearchive::SimpleArchive, IntoBlob};
use crate::capability::CapabilityHandle;
use crate::id::{id_hex, Id};
use std::sync::OnceLock;

/// The exact action required to contribute a signed commit to a collection.
///
/// Minted with `trible genid` on 2026-08-22. Capability policies pair this
/// stable action with one exact collection descriptor handle.
pub const ACTION_WRITE: Id = id_hex!("66B660A5481E04E552A1FA96AA9ECC48");

/// The exact action required to receive or inspect one collection.
///
/// Minted with `trible genid` on 2026-08-30. Capability policies pair this
/// stable action with one exact collection descriptor handle.
pub const ACTION_READ: Id = id_hex!("76583A671BBD61A6A8E66405DE75873F");

/// Exact definition handle of collection READ; descriptor builders attach it.
pub fn read_capability() -> CapabilityHandle {
    static HANDLE: OnceLock<CapabilityHandle> = OnceLock::new();
    *HANDLE.get_or_init(|| {
        IntoBlob::<SimpleArchive>::to_blob(policy::read_definition().facts().clone()).get_handle()
    })
}

/// Exact definition handle of collection WRITE; descriptor builders attach it.
pub fn write_capability() -> CapabilityHandle {
    static HANDLE: OnceLock<CapabilityHandle> = OnceLock::new();
    *HANDLE.get_or_init(|| {
        IntoBlob::<SimpleArchive>::to_blob(policy::write_definition().facts().clone()).get_handle()
    })
}

/// Narrow write facade for a scoped fact collection.
pub mod api;
/// Downward coverage: which of its own collection's foundations a lattice
/// node covers.
pub mod coverage;
pub mod covered;
/// Reading one collection descriptor's facts.
pub mod derived;
pub mod descriptor;
pub mod discovery;
/// Canonical collection encodings and join-preserving mappings.
pub mod encoding;
/// Realization operations and their acquisition loop.
mod exact_derived;
/// Same-named collection generations, and the records they strand.
pub mod generation;
/// Which resident blobs each synced collection holds.
pub mod held;
/// Maintained positive latest states and historical supersession evidence.
pub mod latest;
/// Maintained stated last-write-wins registers over exact source covers.
pub mod lww_register;
/// Maintenance: carries into the host's merges, leaves and attachments.
mod maintenance;
/// Carrying content between collections, and proving it arrived.
pub mod migration;
mod observation;
pub mod observed_store;
mod operation_snapshot;
/// Who produced a foundation: "you own what you signed".
pub mod ownership;
/// Immutable collection-local READ and WRITE authorization ceilings.
pub mod policy;
pub mod records;
/// Canonical `SimpleArchive` set-union collection kind.
pub mod simplearchive_union;
/// Native grow-only storage for collection-calculus records.
pub mod store;
/// Canonical raw `SuccinctArchiveBlob` set-union collection kind.
pub mod succinctarchive_union;
/// Logical values reconstructed from typed physical covers.
pub mod view;

/// Ed25519 public key, re-exported for collection admission policies.
///
/// Each action policy may name one or more capability trust roots. Downstream
/// crates should not need a direct `ed25519-dalek` dependency merely to state
/// those roots.
pub use ed25519_dalek::VerifyingKey;

pub use api::*;
pub use derived::*;
pub use discovery::*;
pub use encoding::*;
pub use exact_derived::CollectionRealizationError;
pub use generation::*;
pub use held::{HeldBlobs, HeldRead, HeldStore, HeldWalkConfig, HeldWalker};
pub use maintenance::MERGE_FAN_IN;
pub use policy::*;
pub use records::*;
pub use simplearchive_union::{PreparedCollectionCommit, StagedCollectionCommit};
pub use store::*;
pub use view::*;

#[cfg(test)]
mod oracle;

#[cfg(test)]
mod equation_admission_tests;

#[cfg(test)]
mod attached_tests;

#[cfg(test)]
pub(crate) mod test_support;