`wai-pack live` used to gather every object and window in memory and write
them all after the end of the stream. It now writes:
- each object when it is published;
- each window's index, then its receipt, when the window is sealed;
- the plan file and LISTING at the end.
Each file is written to a hidden temporary file beside it, then renamed into
place.
If the source fails mid-stream (a short frame or a frame of another size):
- every sealed window and the objects it lists are kept;
- the objects only unsealed pieces published are removed;
- no plan file and no LISTING are written;
- it exits 1, naming what it kept.
Once an object is written, its bytes are no longer held. A coded piece's stages
now carry their entry lengths (`pack::Lens`), so window_index builds an entry
without the envelope. The live packer moves each envelope into its publication.
The packer hands out sealed windows with `take_sealed()` and keeps none. With
--window 0, the packer still holds every piece's entry fields until the end of
the stream. The module doc, the CLI help and packaging §9.2 now say exactly what
is held.
wai::pin::listing_from_sha256 builds the listing from per-file digests (the
same lines as listing_from), so LISTING needs no file's bytes.
Tests:
- A CLI test feeds the stream through a pipe and checks that windows 0 and 1
and their objects are on disk while the stream is still open.
- A second CLI test checks that a stream cut inside a frame keeps window 0 and
its objects and nothing else.
- A unit test checks that no open piece holds an envelope.
- A wai-rs test checks that the listing from digests equals the listing from
bytes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>