pub struct AcpProcess { /* private fields */ }Expand description
A managed ACP agent child process.
Implementations§
Source§impl AcpProcess
impl AcpProcess
Sourcepub async fn spawn(
command: &str,
args: &[&str],
cwd: &str,
notification_tx: Sender<Value>,
display_name: &str,
our_session_id: &str,
) -> Result<AcpProcess, String>
pub async fn spawn( command: &str, args: &[&str], cwd: &str, notification_tx: Sender<Value>, display_name: &str, our_session_id: &str, ) -> Result<AcpProcess, String>
Spawn the agent process and start the background reader.
our_session_id is used to rewrite the agent’s session ID in notifications
so the frontend SSE stream matches on the correct session.
Sourcepub async fn send_request(
&self,
method: &str,
params: Value,
timeout_ms: Option<u64>,
) -> Result<Value, String>
pub async fn send_request( &self, method: &str, params: Value, timeout_ms: Option<u64>, ) -> Result<Value, String>
Send a JSON-RPC request and wait for the response.
Sourcepub async fn initialize(&self) -> Result<Value, String>
pub async fn initialize(&self) -> Result<Value, String>
Initialize the ACP protocol.
Sourcepub async fn initialize_with_timeout(
&self,
timeout_ms: Option<u64>,
) -> Result<Value, String>
pub async fn initialize_with_timeout( &self, timeout_ms: Option<u64>, ) -> Result<Value, String>
Initialize the ACP protocol with an optional timeout override.
Sourcepub async fn new_session(
&self,
cwd: &str,
mcp_servers: &[Value],
) -> Result<String, String>
pub async fn new_session( &self, cwd: &str, mcp_servers: &[Value], ) -> Result<String, String>
Create a new ACP session. Returns the agent’s session ID.
Sourcepub async fn load_session(
&self,
session_id: &str,
cwd: &str,
mcp_servers: &[Value],
) -> Result<String, String>
pub async fn load_session( &self, session_id: &str, cwd: &str, mcp_servers: &[Value], ) -> Result<String, String>
Load a persisted ACP session. Returns the agent’s resumed session ID.
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. 5-minute timeout.
Sourcepub async fn cancel(&self, session_id: &str)
pub async fn cancel(&self, session_id: &str)
Send session/cancel notification (no response expected).
Sourcepub fn notification_sender(&self) -> &Sender<Value>
pub fn notification_sender(&self) -> &Sender<Value>
Get the notification broadcast sender (for subscribing to SSE).
Auto Trait Implementations§
impl Freeze for AcpProcess
impl !RefUnwindSafe for AcpProcess
impl Send for AcpProcess
impl Sync for AcpProcess
impl Unpin for AcpProcess
impl UnsafeUnpin for AcpProcess
impl !UnwindSafe for AcpProcess
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
Mutably borrows from an owned value. Read more
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>
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 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>
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