pub struct AcpManager { /* private fields */ }Expand description
Manages ACP agent sessions and process lifecycle.
Each session maps to a long-lived child process that communicates via stdio JSON-RPC. Notifications are forwarded to subscribers via broadcast.
Implementations§
Source§impl AcpManager
impl AcpManager
pub fn rewrite_notification_session_id( session_id: &str, notification: Value, ) -> Value
pub fn new() -> AcpManager
Sourcepub async fn list_sessions(&self) -> Vec<AcpSessionRecord>
pub async fn list_sessions(&self) -> Vec<AcpSessionRecord>
List all session records.
Sourcepub async fn get_session(&self, session_id: &str) -> Option<AcpSessionRecord>
pub async fn get_session(&self, session_id: &str) -> Option<AcpSessionRecord>
Get a session record by ID.
Sourcepub async fn rename_session(&self, session_id: &str, name: &str) -> Option<()>
pub async fn rename_session(&self, session_id: &str, name: &str) -> Option<()>
Rename a session.
Returns Some(()) if the session was found and renamed, None if not found.
Sourcepub async fn set_routa_agent_id(
&self,
session_id: &str,
routa_agent_id: &str,
) -> Option<()>
pub async fn set_routa_agent_id( &self, session_id: &str, routa_agent_id: &str, ) -> Option<()>
Attach a ROUTA agent ID to an existing session record.
Returns Some(()) if the session was found, None if not found.
Sourcepub async fn delete_session(&self, session_id: &str) -> Option<()>
pub async fn delete_session(&self, session_id: &str) -> Option<()>
Delete a session.
Returns Some(()) if the session was found and deleted, None if not found.
Sourcepub async fn get_session_history(&self, session_id: &str) -> Option<Vec<Value>>
pub async fn get_session_history(&self, session_id: &str) -> Option<Vec<Value>>
Get session message history.
Returns Some(history) if the session exists, None if not found.
Sourcepub async fn push_to_history(&self, session_id: &str, notification: Value)
pub async fn push_to_history(&self, session_id: &str, notification: Value)
Add a notification to session history.
Child agent notifications (those with childAgentId) are NOT stored in the
parent session’s history — they would flood out the ROUTA coordinator’s own
messages. Child messages are persisted in their own child session’s history.
Sourcepub async fn emit_session_update(
&self,
session_id: &str,
update: Value,
) -> Result<(), String>
pub async fn emit_session_update( &self, session_id: &str, update: Value, ) -> Result<(), String>
Broadcast a synthetic session/update event and persist it into in-memory history.
Sourcepub async fn mark_first_prompt_sent(&self, session_id: &str)
pub async fn mark_first_prompt_sent(&self, session_id: &str)
Mark a session as having had its first prompt dispatched.
Sourcepub async fn create_session(
&self,
session_id: String,
cwd: String,
workspace_id: String,
provider: Option<String>,
role: Option<String>,
model: Option<String>,
parent_session_id: Option<String>,
tool_mode: Option<String>,
mcp_profile: Option<String>,
) -> Result<(String, String), String>
pub async fn create_session( &self, session_id: String, cwd: String, workspace_id: String, provider: Option<String>, role: Option<String>, model: Option<String>, parent_session_id: Option<String>, tool_mode: Option<String>, mcp_profile: Option<String>, ) -> Result<(String, String), String>
Create a new ACP session: spawn agent process, initialize, create session. Supports both static presets and registry-based agents. Claude uses stream-json protocol instead of ACP.
Returns (our_session_id, agent_session_id).
Sourcepub async fn load_session_with_options(
&self,
session_id: String,
cwd: String,
workspace_id: String,
provider: Option<String>,
role: Option<String>,
model: Option<String>,
parent_session_id: Option<String>,
tool_mode: Option<String>,
mcp_profile: Option<String>,
provider_session_id: Option<String>,
options: SessionLaunchOptions,
) -> Result<(String, String), String>
pub async fn load_session_with_options( &self, session_id: String, cwd: String, workspace_id: String, provider: Option<String>, role: Option<String>, model: Option<String>, parent_session_id: Option<String>, tool_mode: Option<String>, mcp_profile: Option<String>, provider_session_id: Option<String>, options: SessionLaunchOptions, ) -> Result<(String, String), String>
Resume a persisted ACP session using the provider’s native session/load path.
Returns (our_session_id, agent_session_id).
pub async fn load_session( &self, session_id: String, cwd: String, workspace_id: String, provider: Option<String>, role: Option<String>, model: Option<String>, parent_session_id: Option<String>, tool_mode: Option<String>, mcp_profile: Option<String>, provider_session_id: Option<String>, ) -> Result<(String, String), String>
pub async fn create_session_from_inline( &self, session_id: String, cwd: String, workspace_id: String, provider_name: String, role: Option<String>, model: Option<String>, parent_session_id: Option<String>, command: String, args: Vec<String>, options: SessionLaunchOptions, ) -> Result<(String, String), String>
pub async fn load_session_from_inline( &self, session_id: String, cwd: String, workspace_id: String, provider_name: String, role: Option<String>, model: Option<String>, parent_session_id: Option<String>, command: String, args: Vec<String>, provider_session_id: Option<String>, options: SessionLaunchOptions, ) -> Result<(String, String), String>
pub async fn create_session_with_options( &self, session_id: String, cwd: String, workspace_id: String, provider: Option<String>, role: Option<String>, model: Option<String>, parent_session_id: Option<String>, tool_mode: Option<String>, mcp_profile: Option<String>, options: SessionLaunchOptions, ) -> Result<(String, String), String>
Sourcepub async fn prompt(
&self,
session_id: &str,
text: &str,
) -> Result<Value, String>
pub async fn prompt( &self, session_id: &str, text: &str, ) -> Result<Value, String>
Send a prompt to an existing session’s agent process.
Sourcepub async fn kill_session(&self, session_id: &str)
pub async fn kill_session(&self, session_id: &str)
Kill a session’s agent process and remove it.
Sourcepub async fn subscribe(&self, session_id: &str) -> Option<Receiver<Value>>
pub async fn subscribe(&self, session_id: &str) -> Option<Receiver<Value>>
Subscribe to SSE notifications for a session.
Returns a broadcast receiver that yields session/update JSON-RPC messages.
Sourcepub async fn is_alive(&self, session_id: &str) -> bool
pub async fn is_alive(&self, session_id: &str) -> bool
Check if a session’s agent process is alive.
Sourcepub async fn get_acp_session_id(&self, session_id: &str) -> Option<String>
pub async fn get_acp_session_id(&self, session_id: &str) -> Option<String>
Get the managed ACP session id for a live session.
Sourcepub async fn get_preset_id(&self, session_id: &str) -> Option<String>
pub async fn get_preset_id(&self, session_id: &str) -> Option<String>
Get the preset ID for a session.
Sourcepub async fn is_claude_session(&self, session_id: &str) -> bool
pub async fn is_claude_session(&self, session_id: &str) -> bool
Check if a session uses Claude (stream-json protocol, not ACP).
Trait Implementations§
Source§impl Clone for AcpManager
impl Clone for AcpManager
Source§fn clone(&self) -> AcpManager
fn clone(&self) -> AcpManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for AcpManager
impl Default for AcpManager
Source§fn default() -> AcpManager
fn default() -> AcpManager
Auto Trait Implementations§
impl Freeze for AcpManager
impl !RefUnwindSafe for AcpManager
impl Send for AcpManager
impl Sync for AcpManager
impl Unpin for AcpManager
impl UnsafeUnpin for AcpManager
impl !UnwindSafe for AcpManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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