Skip to main content

AcpSessionStore

Struct AcpSessionStore 

Source
pub struct AcpSessionStore { /* private fields */ }
Expand description

Deterministic ACP session state map used by protocol handlers.

Implementations§

Source§

impl AcpSessionStore

Source

pub fn new() -> Self

Create an empty store.

Source

pub fn next_id(&mut self) -> String

Generate a deterministic opaque ACP session id.

Source

pub fn create_session( &mut self, local_session_id: impl Into<String>, workspace_root: &Path, requested_cwd: Option<&Path>, ) -> Result<String, AcpSessionError>

Create a new ACP session and attach local session metadata placeholders.

Returns Err when the local session id already exists.

Source

pub fn attach_existing_session( &mut self, acp_session_id: impl Into<String>, local_session_id: impl Into<String>, cwd: &Path, session_writer: Option<SessionWriter>, ) -> Result<String, AcpSessionError>

Attach an existing local session to a caller-supplied ACP session id.

Used by session/load and session/resume, where the client names a persisted session returned from session/list.

Source

pub fn acp_session_id_for_local(&self, local_session_id: &str) -> Option<&str>

Return the opaque ACP session id for a local session id.

Source

pub fn local_session_id(&self, acp_session_id: &str) -> Option<&str>

Return the local session id for an ACP session id.

Source

pub fn session(&self, acp_session_id: &str) -> Option<&AcpServerSession>

Return a snapshot of one ACP session.

Source

pub fn sessions(&self) -> Vec<&AcpServerSession>

Return snapshots of all active ACP sessions sorted by ACP id.

Source

pub fn begin_turn( &mut self, acp_session_id: &str, ) -> Result<(), AcpSessionError>

Mark a turn as active for this ACP session.

This is a strict guard: only one active turn is allowed per session.

Source

pub fn end_turn(&mut self, acp_session_id: &str) -> Result<(), AcpSessionError>

Mark a turn as complete for this ACP session.

Source

pub fn update_session_metadata( &mut self, acp_session_id: &str, model: Option<String>, websearch: Option<WebSearchMode>, ) -> Result<(), AcpSessionError>

Update local metadata placeholders for a session.

Source

pub fn update_session_reasoning( &mut self, acp_session_id: &str, effort: Option<ReasoningEffort>, summary: Option<ReasoningSummary>, ) -> Result<(), AcpSessionError>

Update reasoning controls without changing model or web-search metadata.

Source

pub fn attach_session_writer( &mut self, acp_session_id: &str, session_writer: SessionWriter, ) -> Result<(), AcpSessionError>

Attach a local session writer for persistence.

Source

pub fn attach_mcp_config( &mut self, acp_session_id: &str, mcp_config: McpConfig, ) -> Result<(), AcpSessionError>

Attach ACP-provided MCP server config to a session.

Source

pub fn session_writer(&self, acp_session_id: &str) -> Option<&SessionWriter>

Return the active session writer when persistence is enabled.

Source

pub fn session_writer_mut( &mut self, acp_session_id: &str, ) -> Option<&mut SessionWriter>

Return a mutable session writer when persistence is enabled.

Source

pub fn remove_session(&mut self, acp_session_id: &str) -> Option<String>

Drop a stored session and return its local session id when present.

Source

pub fn is_turn_active(&self, acp_session_id: &str) -> bool

Return true when the ACP session currently has an active turn.

Source

pub fn clear_turns_for_test(&mut self)

Force clear all active turns in store state. Intended for tests only.

Trait Implementations§

Source§

impl Debug for AcpSessionStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AcpSessionStore

Source§

fn default() -> AcpSessionStore

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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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