Skip to main content

Module session_archive

Module session_archive 

Source
Expand description

Session archival and cleanup (Phase 3.3 — ultra-long-sessions).

Responsibilities:

  1. Periodic sweep: archive sessions inactive for inactive_days days by compressing their FileStore “output” file to archive_dir/<block_id>.jsonl.gz and freeing the FileStore entry.

Archives are never deleted: AgentMux keeps agent history forever.

The sweep archives through the same archive_session_output the RPC handlers in server/app_api/session.rs call; those handlers also use restore_session_output and read_session_output from this module.

Structs§

SessionArchiver
Periodic session archival.
SessionArchiverStats
Statistics from a single sweep run.

Constants§

META_SESSION_ARCHIVED_AT
Unix ms when the session was last archived.
META_SESSION_ARCHIVED_BYTES
Byte count before compression (original output size).
META_SESSION_ARCHIVE_PATH
Absolute path to the .jsonl.gz archive file.

Functions§

archive_session_output
Archive the FileStore “output” file for block_id:
archive_session_output_with
archive_session_output with the global transcript store given (tests install none).
default_archive_dir
Returns ~/.agentmux/archives/, or None if the home directory cannot be determined.
read_session_output
Read the raw session output bytes, whether from FileStore (live) or archive. Returns (bytes, line_count).
read_session_output_with
read_session_output with the global transcript store given (tests install none).
restore_session_output
Restore an archived session back into FileStore: