Expand description
Archive lifecycle, browsing, and previews for agent session zones.
Structs§
- Archive
Summary - A single archive row. Mirrors the shape of
RecentSessionRow’s preview fields so the frontend can reuse the same row component.
Constants§
- MAX_
PREVIEW_ 🔒SNAPSHOT_ BYTES - Snapshots larger than this are not parsed for a preview, so a corrupted one can’t stall a listing.
Functions§
- archive_
global_ current - Archive the agent’s GLOBAL
agent:<defId>:currentcontent into a local (per-filestore) archive zone, so a cross-channel viewer’s conversation is preserved + browsable in this channel before the global current is cleared. - archive_
session - Archive
agent:<defId>:currenttoagent:<defId>:archive:<now_ms>. - clear_
global_ current_ zone - Delete
output.state.json+outputfrom the agent’s GLOBALagent:<defId>:currentzone, if a global store is installed. Best-effort: a missing file is the expected “agent never mirrored” case (silent), other errors are logged but never propagated. Keeps the global zone in lockstep with the per-channel:currentclear inarchive_session. - clear_
local_ current_ zone - Delete
output.state.json+outputfrom a per-channel:currentzone, only for files that are present (so absence isn’t logged as an error). Best-effort — used after the global-preferred archive has persisted the content, to retire this channel’s (subset) copy. - collapse_
preview 🔒 - Collapse newlines + extra whitespace, cap at 240 chars. Output is safe to render inline in a single-line preview row.
- copy_
tsidx_ 🔒best_ effort - Copy the
output.tsidxsidecar fromsrczone todstzone, best-effort: absence is normal (pre-sidecar history), and no failure here may abort the surrounding archive — the sidecar is auxiliary timing data, not conversation content. - list_
archives - List archive zones for
definition_id, newest first. - read_
archive_ 🔒preview - Pull a small preview + node_count out of an archive’s
output.state.json. Returns("", 0)on any error. - read_
snapshot_ 🔒bytes - Read a zone file’s full bytes, mapping absence to
Ok(None). - snapshot_
preview 🔒 (preview, node_count)from anoutput.state.jsonsnapshot’s bytes, or("", 0)when they don’t parse or have nonodesarray. The preview is the firstuser_message, skipping a leading “# Session Context” bootstrap message when a later one exists, collapsed to one line of at most 240 chars.