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.jsonlholds entries; a package without history ismanifest.jsonalone. - 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_revisionmoves to the head, the old log becomesops.archive.jsonl(or is deleted — both are legal), and a freshops.jsonlstarts from empty. Nothing observable about the current state changes —manifest.jsonalready 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, aworld_sha256that 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’smanifestTextwrites the same bytes. - manifest_
text_ of manifest_textof a typed manifest. It goes through its own JSON text first, so a float prints the way it was written (0.1, not the widened0.10000000149011612).- snapshot_
filename - A snapshot’s path inside the package:
snapshots/entry-<id>.jsonfor logs whose entries carry identity — the branch-aware name, one file per entry regardless of which branch it tips — falling back tosnapshots/rev-<N>.jsonfor linear logs without explicit ids.