Skip to main content

Module session

Module session 

Source
Expand description

Per-session state: holds the AgentRuntime, working directory, turn counter, transcript, and a [CancellationToken] for cooperative abort for a single ACP session.

AcpSessionManager is a lightweight HashMap-based registry. It is owned by the server’s dispatch loop. No parallel session-management infrastructure exists outside this module — all lifecycle state is tracked through the AgentRuntime and this simple container.

§Session persistence (ACP-S1-02)

Sessions are persisted to <persistence_dir>/<session_id>/:

  • transcript.jsonl – one JSON line per Message.
  • metadata.json – session metadata (system prompt, MCP configs, turn count).

Every message object in the saved transcript has an id field matching the SHA-256 content hash (first 12 hex chars), computed by crate::acp::bridge::sha256_first_12.

Structs§

AcpSession
State for one active ACP session.
AcpSessionManager
Registry of active ACP sessions, keyed by SessionId.
CompactionHint
A compaction hint entry, identifying which turn indices are safe to compress.
SavedMessage
A message saved to the JSONL transcript, with a content-hash id field.
SessionMetadata
Metadata saved alongside the session transcript.
SummarizedContext
The result of local transcript summarization (ACP-S1-04).

Functions§

apply_compaction_hints
Apply compaction hints to saved messages (sets compressible field).
compute_compaction_hints
Compute compaction hints for a list of saved messages.
summarize_transcript
Produce a summary paragraph of the transcript using a local heuristic.

Type Aliases§

SessionId
A unique session identifier.