Skip to main content

Module package

Module package 

Source
Expand description

The package’s derived parts: snapshot naming and compaction (spec/package.md, spec/session.md “Snapshots”). The file moves themselves stay with the host app — this crate is the format’s serde-only core — so what lives here are the decisions a host could get wrong: which name a snapshot goes under, and what compaction changes on paper.

Constants§

BASE_SNAPSHOT
The oldest state the log folds from. Present whenever ops.jsonl holds entries; a package without history is manifest.json alone.
MANIFEST
The world now — the state at the tip of main. Viewers read only this.
PACKAGE_FORMAT_VERSION
The package format version this crate writes: 2, head-first.

Functions§

compact_plan
What compaction does to a package, as data: base_revision moves to the head, the old log becomes ops.archive.jsonl (or is deleted — both are legal), and a fresh ops.jsonl starts from empty. Nothing observable about the current state changes — manifest.json already is the head — and structural replay is what gets truncated.
manifest_text
A manifest’s canonical text (spec/package.md, “Canonical text”): what an authority writes to manifest.json, so that one world is always the same bytes — small diffs, ordinary git merges, a world_sha256 that means something. Members sorted by code point, null members left out, entities in id order, two-space indentation, arrays of plain values on one line, integral numbers without a fraction, a trailing newline. The JS reference’s manifestText writes the same bytes.
manifest_text_of
manifest_text of a typed manifest. It goes through its own JSON text first, so a float prints the way it was written (0.1, not the widened 0.10000000149011612).
snapshot_filename
A snapshot’s path inside the package: snapshots/entry-<id>.json for logs whose entries carry identity — the branch-aware name, one file per entry regardless of which branch it tips — falling back to snapshots/rev-<N>.json for linear logs without explicit ids.