pub struct AcpSessionManager { /* private fields */ }Expand description
Registry of active ACP sessions, keyed by SessionId.
Manages persistence of transcripts and metadata to disk.
Implementations§
Source§impl AcpSessionManager
impl AcpSessionManager
Sourcepub fn set_client_capabilities(&mut self, caps: Option<ClientCapabilities>)
pub fn set_client_capabilities(&mut self, caps: Option<ClientCapabilities>)
Set the client capabilities declared during initialize.
These are used by session/new to conditionally register reverse-fs tools.
Sourcepub fn get_client_capabilities(&self) -> Option<&ClientCapabilities>
pub fn get_client_capabilities(&self) -> Option<&ClientCapabilities>
Get the client capabilities (if any) declared during initialize.
Sourcepub fn with_persistence_dir(self, dir: PathBuf) -> Self
pub fn with_persistence_dir(self, dir: PathBuf) -> Self
Set the persistence directory for session storage. If not set, sessions are not persisted.
Sourcepub fn persistence_dir(&self) -> Option<&Path>
pub fn persistence_dir(&self) -> Option<&Path>
Get the persistence directory.
Sourcepub fn next_session_id(&self) -> SessionId
pub fn next_session_id(&self) -> SessionId
Generate the next sequential session id (e.g. "acp-sess-1").
Sourcepub fn insert_with_id(&mut self, session_id: SessionId, session: AcpSession)
pub fn insert_with_id(&mut self, session_id: SessionId, session: AcpSession)
Insert a session with a pre-generated id.
session_id must match session.session_id. This is a convenience
to avoid double-allocating a SessionId in the caller.
Sourcepub fn get_mut(&mut self, sid: &str) -> Option<&mut AcpSession>
pub fn get_mut(&mut self, sid: &str) -> Option<&mut AcpSession>
Look up a mutable reference to a session by id.
Sourcepub fn remove(&mut self, sid: &str) -> Option<AcpSession>
pub fn remove(&mut self, sid: &str) -> Option<AcpSession>
Remove and return a session, releasing its resources.
Sourcepub fn all_turns(&self) -> Vec<(String, u64)>
pub fn all_turns(&self) -> Vec<(String, u64)>
Return the id and turn of every session (immutable snapshot).
Used by session/cancel (empty-params mode) to find the most recently
active session.
Sourcepub fn get(&self, sid: &str) -> Option<&AcpSession>
pub fn get(&self, sid: &str) -> Option<&AcpSession>
Get a reference to a session by id (immutable).
Sourcepub fn permission_store(&mut self) -> &mut PendingPermissionStore
pub fn permission_store(&mut self) -> &mut PendingPermissionStore
Get the shared permission store for ACP permission bridge.
Sourcepub fn session_dir(&self, sid: &str) -> Option<PathBuf>
pub fn session_dir(&self, sid: &str) -> Option<PathBuf>
Return the on-disk directory for a given session ID.
Sourcepub fn save_transcript(&self, sid: &str) -> Result<()>
pub fn save_transcript(&self, sid: &str) -> Result<()>
Save the current transcript to disk as JSONL.
Each line is a SavedMessage with id, message, and compressible fields.
Sourcepub fn load_transcript_from_disk(&self, sid: &str) -> Result<Vec<SavedMessage>>
pub fn load_transcript_from_disk(&self, sid: &str) -> Result<Vec<SavedMessage>>
Load session transcript from disk (reads transcript.jsonl).
Sourcepub fn save_metadata(&self, sid: &str) -> Result<()>
pub fn save_metadata(&self, sid: &str) -> Result<()>
Save metadata explicitly (called after turn increment).
Sourcepub fn load_metadata_from_disk(&self, sid: &str) -> Result<SessionMetadata>
pub fn load_metadata_from_disk(&self, sid: &str) -> Result<SessionMetadata>
Load session metadata from disk.
Sourcepub fn session_exists_on_disk(&self, sid: &str) -> bool
pub fn session_exists_on_disk(&self, sid: &str) -> bool
Check if a session exists on disk (for load/resume).