Skip to main content

AcpSessionManager

Struct AcpSessionManager 

Source
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

Source

pub fn new() -> Self

Create an empty session manager.

Source

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.

Source

pub fn get_client_capabilities(&self) -> Option<&ClientCapabilities>

Get the client capabilities (if any) declared during initialize.

Source

pub fn with_persistence_dir(self, dir: PathBuf) -> Self

Set the persistence directory for session storage. If not set, sessions are not persisted.

Source

pub fn persistence_dir(&self) -> Option<&Path>

Get the persistence directory.

Source

pub fn next_session_id(&self) -> SessionId

Generate the next sequential session id (e.g. "acp-sess-1").

Source

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.

Source

pub fn get_mut(&mut self, sid: &str) -> Option<&mut AcpSession>

Look up a mutable reference to a session by id.

Source

pub fn remove(&mut self, sid: &str) -> Option<AcpSession>

Remove and return a session, releasing its resources.

Source

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.

Source

pub fn get(&self, sid: &str) -> Option<&AcpSession>

Get a reference to a session by id (immutable).

Source

pub fn contains(&self, sid: &str) -> bool

Check if a session exists.

Source

pub fn permission_store(&mut self) -> &mut PendingPermissionStore

Get the shared permission store for ACP permission bridge.

Source

pub fn session_dir(&self, sid: &str) -> Option<PathBuf>

Return the on-disk directory for a given session ID.

Source

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.

Source

pub fn load_transcript_from_disk(&self, sid: &str) -> Result<Vec<SavedMessage>>

Load session transcript from disk (reads transcript.jsonl).

Source

pub fn save_metadata(&self, sid: &str) -> Result<()>

Save metadata explicitly (called after turn increment).

Source

pub fn load_metadata_from_disk(&self, sid: &str) -> Result<SessionMetadata>

Load session metadata from disk.

Source

pub fn session_exists_on_disk(&self, sid: &str) -> bool

Check if a session exists on disk (for load/resume).

Trait Implementations§

Source§

impl Default for AcpSessionManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more