pub struct AcpSessionStore { /* private fields */ }Expand description
Deterministic ACP session state map used by protocol handlers.
Implementations§
Source§impl AcpSessionStore
impl AcpSessionStore
Sourcepub fn create_session(
&mut self,
local_session_id: impl Into<String>,
workspace_root: &Path,
requested_cwd: Option<&Path>,
) -> Result<String, AcpSessionError>
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.
Sourcepub 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>
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.
Sourcepub fn acp_session_id_for_local(&self, local_session_id: &str) -> Option<&str>
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.
Sourcepub fn local_session_id(&self, acp_session_id: &str) -> Option<&str>
pub fn local_session_id(&self, acp_session_id: &str) -> Option<&str>
Return the local session id for an ACP session id.
Sourcepub fn session(&self, acp_session_id: &str) -> Option<&AcpServerSession>
pub fn session(&self, acp_session_id: &str) -> Option<&AcpServerSession>
Return a snapshot of one ACP session.
Sourcepub fn sessions(&self) -> Vec<&AcpServerSession>
pub fn sessions(&self) -> Vec<&AcpServerSession>
Return snapshots of all active ACP sessions sorted by ACP id.
Sourcepub fn begin_turn(
&mut self,
acp_session_id: &str,
) -> Result<(), AcpSessionError>
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.
Sourcepub fn end_turn(&mut self, acp_session_id: &str) -> Result<(), AcpSessionError>
pub fn end_turn(&mut self, acp_session_id: &str) -> Result<(), AcpSessionError>
Mark a turn as complete for this ACP session.
Sourcepub fn update_session_metadata(
&mut self,
acp_session_id: &str,
model: Option<String>,
websearch: Option<WebSearchMode>,
) -> Result<(), AcpSessionError>
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.
Sourcepub fn update_session_reasoning(
&mut self,
acp_session_id: &str,
effort: Option<ReasoningEffort>,
summary: Option<ReasoningSummary>,
) -> Result<(), AcpSessionError>
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.
Sourcepub fn attach_session_writer(
&mut self,
acp_session_id: &str,
session_writer: SessionWriter,
) -> Result<(), AcpSessionError>
pub fn attach_session_writer( &mut self, acp_session_id: &str, session_writer: SessionWriter, ) -> Result<(), AcpSessionError>
Attach a local session writer for persistence.
Sourcepub fn attach_mcp_config(
&mut self,
acp_session_id: &str,
mcp_config: McpConfig,
) -> Result<(), AcpSessionError>
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.
Sourcepub fn session_writer(&self, acp_session_id: &str) -> Option<&SessionWriter>
pub fn session_writer(&self, acp_session_id: &str) -> Option<&SessionWriter>
Return the active session writer when persistence is enabled.
Sourcepub fn session_writer_mut(
&mut self,
acp_session_id: &str,
) -> Option<&mut SessionWriter>
pub fn session_writer_mut( &mut self, acp_session_id: &str, ) -> Option<&mut SessionWriter>
Return a mutable session writer when persistence is enabled.
Sourcepub fn remove_session(&mut self, acp_session_id: &str) -> Option<String>
pub fn remove_session(&mut self, acp_session_id: &str) -> Option<String>
Drop a stored session and return its local session id when present.
Sourcepub fn is_turn_active(&self, acp_session_id: &str) -> bool
pub fn is_turn_active(&self, acp_session_id: &str) -> bool
Return true when the ACP session currently has an active turn.
Sourcepub fn clear_turns_for_test(&mut self)
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
impl Debug for AcpSessionStore
Source§impl Default for AcpSessionStore
impl Default for AcpSessionStore
Source§fn default() -> AcpSessionStore
fn default() -> AcpSessionStore
Auto Trait Implementations§
impl Freeze for AcpSessionStore
impl RefUnwindSafe for AcpSessionStore
impl Send for AcpSessionStore
impl Sync for AcpSessionStore
impl Unpin for AcpSessionStore
impl UnsafeUnpin for AcpSessionStore
impl UnwindSafe for AcpSessionStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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