Skip to main content

Crate zenith_session

Crate zenith_session 

Source
Expand description

zenith-session: local-machine history/session state for .zen documents.

Pure crate with injected fs/clock/rng adapters; never depended on by the deterministic render pipeline.

§Module layout

  • adapter — injectable trait boundaries (filesystem, clock, RNG)
  • bundle — deterministic DEFLATE bundle/unbundle for portable transfer
  • datadir — platform data-directory resolution
  • docid — ULID document-identity minting
  • errorSessionError (the single error type for this crate)
  • gc — object garbage collection (gc())
  • global — global cross-document LRU storage cap (enforce_global_cap)
  • identity — document-identity reconciliation (reconcile)
  • layoutStorePaths pure path builders
  • manifestHistoryRecord schema and append-only JSONL manifest I/O
  • retention — Time-Machine-style retention thinning for Tier-2 version history
  • revspec — revision-spec resolver: map a human/agent revspec string to a record id
  • session — Tier-1 ephemeral session: snapshot DAG with HEAD + redo stack
  • store — content-addressed object store (SHA-256 + DEFLATE)
  • previewsPreviewRecord schema and append-only preview-artifact log
  • runsRunRecord schema and append-only agent-run provenance log
  • scratchCandidateEntry schema and append-only scratch/candidate index
  • tier2 — Tier-2 durable version history: bounded flat list in versions.jsonl

Re-exports§

pub use bundle::bundle;
pub use bundle::unbundle;
pub use datadir::resolve_data_dir;
pub use datadir::resolve_data_dir_with;
pub use docid::mint_ulid;
pub use error::SessionError;
pub use gc::GcReport;
pub use gc::gc;
pub use global::GlobalCapReport;
pub use global::enforce_global_cap;
pub use identity::DocMeta;
pub use identity::Outcome;
pub use identity::Reconciled;
pub use identity::reconcile;
pub use layout::StorePaths;
pub use manifest::CheckpointMeta;
pub use manifest::HistoryRecord;
pub use manifest::append_record;
pub use manifest::read_records;
pub use previews::PreviewCritique;
pub use previews::PreviewRecord;
pub use previews::append_preview;
pub use previews::read_previews;
pub use retention::CapReport;
pub use retention::MaintainReport;
pub use retention::RetentionPolicy;
pub use retention::ThinReport;
pub use retention::apply_caps;
pub use retention::apply_thinning;
pub use retention::maintain;
pub use retention::thin_versions;
pub use revspec::resolve_revspec;
pub use revspec::resolve_revspec_for;
pub use runs::RunDiagnostic;
pub use runs::RunRecord;
pub use runs::RunStep;
pub use runs::append_run;
pub use runs::read_runs;
pub use scratch::CandidateEntry;
pub use scratch::CandidateMeta;
pub use scratch::CandidateStatus;
pub use scratch::FinalizeReport;
pub use scratch::NewCandidate;
pub use scratch::finalize_candidates;
pub use scratch::get_scratch_snapshot;
pub use scratch::list_scratch;
pub use scratch::put_scratch;
pub use scratch::set_candidate_status;
pub use session::RecordOutcome;
pub use session::SessionState;
pub use session::clear_session;
pub use session::current_content;
pub use session::record_state;
pub use session::redo;
pub use session::undo;
pub use store::get_object;
pub use store::has_object;
pub use store::object_hash;
pub use store::object_size;
pub use store::put_object;
pub use store::put_object_with_hash;
pub use tier2::VersionMeta;
pub use tier2::VersionOutcome;
pub use tier2::list_versions;
pub use tier2::record_version;
pub use tier2::resolve_version;
pub use tier2::restore_content;
pub use tier2::version_content;

Modules§

adapter
Injected adapter traits for filesystem, clock, and RNG access.
bundle
Portable, deterministic document-store bundle (*.zenithbundle).
datadir
Platform data-directory resolution for zenith-session.
docid
Document-identity minting: 128-bit ULID encoded as 26 Crockford base-32 chars. Deterministic under injected Clock + Rng for testability.
error
SessionError: the single error type for the zenith-session crate.
gc
Object garbage collection.
global
Global cross-document LRU storage cap.
identity
Document-identity reconciliation: bind a .zen’s doc-id to local history, detecting first-edit / move / copy / adoption. Pure over injected adapters.
layout
Pure path-builder helpers for the zenith store layout.
manifest
History records and the append-only JSONL manifest.
previews
Preview-artifact records: schema and append-only JSONL log.
retention
Time-Machine-style retention thinning for Tier-2 version history.
revspec
Revision-spec resolution: map a revspec string to a session record id.
runs
Agent-run provenance records: schema and append-only JSONL log.
scratch
Scratch/candidate store: content-addressed .zen snapshots indexed in scratch/index.jsonl.
session
Tier-1 ephemeral session: a content-addressed snapshot DAG with a HEAD pointer and a redo stack, persisted under session_dir(doc_id).
store
Content-addressed object store.
tier2
Tier-2 durable version history: a bounded, flat list of state snapshots in versions.jsonl (the “light git per file” — a Google-Docs-style version panel, NOT a full VCS: no branches/merge). Each version is a full content snapshot (content-addressed); named versions carry a label. Restore returns a past version’s content for the caller to write back to the .zen.