Skip to main content

Module bundle

Module bundle 

Source
Expand description

Portable session bundle format (hh export --bundle / hh import).

A bundle is a single zstd-compressed tar containing:

  • manifest.jsonformat_version, the hh version that wrote it, a redacted session block, and integrity hashes.
  • events.ndjson — one compact JSON object per event, in original (ts_ms, id) order, position-indexed by seq (DB row ids do not survive import, so correlates is expressed as correlates_seq instead).
  • blobs/<hash[0..2]>/<hash> — raw content for every blob any event or file_change references. Only the outer tar is zstd-compressed; blobs are stored raw inside it (no double compression).

Tar entries are added in a fixed order (manifest, events, then blobs sorted ascending by hash) with fixed mtime/uid/gid/mode, so two exports of an unchanged session produce byte-identical bundles.

export is the trusted-data path (built from a live crate::store::Store). parse is the untrusted-input path (hh import file.hh): it must never panic on malformed input, and every failure mode reports precisely what is wrong (v1.0.0 addendum).

Structs§

Bundle
A parsed, validated bundle — the output of parse and the input to crate::store::Store::import.

Constants§

FORMAT_VERSION
The bundle format version this build of hh writes, and the highest version it will read. Bumped only for a breaking change to the manifest/ events/blob layout; new optional fields do not require a bump.

Functions§

export
Build a portable bundle for session_id (the trusted-data path).
parse
Parse and validate an untrusted bundle (hh import file.hh). Never panics: every malformed-input path returns a precise BundleError.