Skip to main content

Module tier2

Module tier2 

Source
Expand description

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.

Structs§

VersionMeta
Metadata recorded alongside a durable version: an optional human label, an optional op-kind tag, and optional agent-checkpoint metadata.

Enums§

VersionOutcome
The outcome of a record_version call.

Functions§

list_versions
List all durable versions for doc_id, oldest first (append order).
record_version
Record content as a new durable version. meta.label names it (a named version is retained forever by the retention pass). meta.op_kind is an optional category label. UNNAMED (auto) versions deduplicate against the LATEST version: if content is byte-identical to it, the call returns Unchanged and appends nothing. A NAMED version (meta.label.is_some()) is an explicit checkpoint and is ALWAYS recorded, even when its content matches the latest version.
resolve_version
Resolve a revspec against the version list (HEAD = the latest version) to a version id. Supports the same forms as the session resolver (@head, @head~N, seq, @latest:<label>, id/prefix, @time:).
restore_content
Restore: resolve spec to a version and return its content (the caller writes it back to the .zen). Does NOT itself mutate the working file or record a new version — that is the caller’s responsibility so the write-through stays in one place.
version_content
The content of the version with the given id.