Skip to main content

Module agent_session

Module agent_session 

Source
Expand description

Agent-anchored session zones: one zone per agent definition, keyed by definition_id (not account or block).

Zone names: active = agent:<defId>:current, archived = agent:<defId>:archive:<unix_ms>. Each zone holds output.state.json (full UI snapshot) and output (raw NDJSON stream). (This used to cite a SPEC_CONTINUATION_SESSION_PERSISTENCE_2026_05_23 design doc that was never committed; the zone layout above is the contract.)

§Public API surface

Every public item is reachable as agent_session::<submod>::<item> (the submodules are pub). The pub use re-exports below additionally preserve the pre-split flat paths (agent_session::<item>) that callers across the crate already import, so this reorganization changed no call site. The flat re-export set is exactly the names other modules import; the remaining public items (zone-name builders, archive internals, migration stat/marker types) stay reachable through their submodule path — and the test module reaches them there.

Re-exports§

pub use archive::archive_session;
pub use archive::list_archives;
pub use global_store::agent_zone_for_block_meta;
pub use global_store::global_transcript_store;
pub use global_store::set_global_transcript_store;
pub use migrations::block_zones_look_incomplete;
pub use migrations::migrate_block_zones_v1;
pub use migrations::migrate_promote_template_sessions_v1;
pub use migrations::MIGRATION_MARKER_V1;
pub use session_io::append_session_output;
pub use session_io::heal_global_snapshot_source_block_ids;
pub use session_io::read_session_state;
pub use session_io::write_session_state;
pub use session_io::OUTPUT_FILE;
pub use session_io::SNAPSHOT_FILE;
pub use session_io::TSIDX_FILE;
pub use zone_naming::agent_current_zone;
pub use zone_naming::is_valid_definition_id;

Modules§

archive
Archive lifecycle, browsing, and previews for agent session zones.
global_store
Cross-channel transcript singleton + block-meta zone resolution.
helpers 🔒
Small shared helpers: monotonic-ish timestamp + FileStore I/O wrappers.
history_summary
What an agent was last asked, read from its GLOBAL transcript zone.
migrations
One-time / self-idempotent migrations for agent session zones.
session_io
Read/write/append snapshot state for the agent:<defId>:current zone, including the global-mirror normalization + one-shot heal.
zone_naming
Zone-name validation + builders for agent session zones.