Skip to main content

zenith_session/
lib.rs

1//! zenith-session: local-machine history/session state for `.zen` documents.
2//!
3//! Pure crate with injected fs/clock/rng adapters; never depended on by the
4//! deterministic render pipeline.
5//!
6//! # Module layout
7//!
8//! - [`adapter`] — injectable trait boundaries (filesystem, clock, RNG)
9//! - [`mod@bundle`] — deterministic DEFLATE bundle/unbundle for portable transfer
10//! - [`datadir`] — platform data-directory resolution
11//! - [`docid`] — ULID document-identity minting
12//! - [`error`] — [`SessionError`] (the single error type for this crate)
13//! - [`mod@gc`] — object garbage collection ([`gc()`])
14//! - [`global`] — global cross-document LRU storage cap ([`enforce_global_cap`])
15//! - [`identity`] — document-identity reconciliation ([`reconcile`])
16//! - [`layout`] — [`StorePaths`] pure path builders
17//! - [`manifest`] — [`HistoryRecord`] schema and append-only JSONL manifest I/O
18//! - [`retention`] — Time-Machine-style retention thinning for Tier-2 version history
19//! - [`revspec`] — revision-spec resolver: map a human/agent revspec string to a record id
20//! - [`session`] — Tier-1 ephemeral session: snapshot DAG with HEAD + redo stack
21//! - [`store`] — content-addressed object store (SHA-256 + DEFLATE)
22//! - [`previews`] — [`PreviewRecord`] schema and append-only preview-artifact log
23//! - [`runs`] — [`RunRecord`] schema and append-only agent-run provenance log
24//! - [`scratch`] — [`CandidateEntry`] schema and append-only scratch/candidate index
25//! - [`tier2`] — Tier-2 durable version history: bounded flat list in `versions.jsonl`
26
27pub mod adapter;
28pub mod bundle;
29pub mod datadir;
30pub mod docid;
31pub mod error;
32pub mod gc;
33pub mod global;
34pub mod identity;
35pub mod layout;
36pub mod manifest;
37pub mod previews;
38pub mod retention;
39pub mod revspec;
40pub mod runs;
41pub mod scratch;
42pub mod session;
43pub mod store;
44pub mod tier2;
45
46pub use bundle::{bundle, unbundle};
47pub use datadir::{resolve_data_dir, resolve_data_dir_with};
48pub use docid::mint_ulid;
49pub use error::SessionError;
50pub use gc::{GcReport, gc};
51pub use global::{GlobalCapReport, enforce_global_cap};
52pub use identity::{DocMeta, Outcome, Reconciled, reconcile};
53pub use layout::StorePaths;
54pub use manifest::{CheckpointMeta, HistoryRecord, append_record, read_records};
55pub use previews::{PreviewCritique, PreviewRecord, append_preview, read_previews};
56pub use retention::{
57    CapReport, MaintainReport, RetentionPolicy, ThinReport, apply_caps, apply_thinning, maintain,
58    thin_versions,
59};
60pub use revspec::{resolve_revspec, resolve_revspec_for};
61pub use runs::{RunDiagnostic, RunRecord, RunStep, append_run, read_runs};
62pub use scratch::{
63    CandidateEntry, CandidateMeta, CandidateStatus, FinalizeReport, NewCandidate,
64    finalize_candidates, get_scratch_snapshot, list_scratch, put_scratch, set_candidate_status,
65};
66pub use session::{
67    RecordOutcome, SessionState, clear_session, current_content, record_state, redo, undo,
68};
69pub use store::{
70    get_object, has_object, object_hash, object_size, put_object, put_object_with_hash,
71};
72pub use tier2::{
73    VersionMeta, VersionOutcome, list_versions, record_version, resolve_version, restore_content,
74    version_content,
75};