pub struct AcpSession { /* private fields */ }Expand description
A persistent connection to an ACP agent with session reuse.
The agent process stays alive between prompts, preserving conversation context and reducing spawn overhead. Use this when you need multiple interactions with the same agent in sequence.
Implementations§
Source§impl AcpSession
impl AcpSession
Sourcepub async fn start(
config: AcpAgentConfig,
policy: Arc<PermissionPolicy>,
) -> Result<Self>
pub async fn start( config: AcpAgentConfig, policy: Arc<PermissionPolicy>, ) -> Result<Self>
Start a new persistent session with an ACP agent.
Spawns the agent process, performs the ACP handshake, and creates a session.
The connection stays alive until close() is called or the
session is dropped.
Sourcepub async fn prompt(&mut self, text: &str) -> Result<PromptResult>
pub async fn prompt(&mut self, text: &str) -> Result<PromptResult>
Send a prompt to the agent within the existing session.
The agent retains context from previous prompts in this session, so you don’t need to re-explain project structure or repeat instructions.
Sourcepub fn prompt_count(&self) -> u32
pub fn prompt_count(&self) -> u32
Number of prompts sent in this session.
Sourcepub fn working_dir(&self) -> &PathBuf
pub fn working_dir(&self) -> &PathBuf
Get the working directory for this session.
Trait Implementations§
Source§impl Drop for AcpSession
impl Drop for AcpSession
Auto Trait Implementations§
impl Freeze for AcpSession
impl !RefUnwindSafe for AcpSession
impl Send for AcpSession
impl Sync for AcpSession
impl Unpin for AcpSession
impl UnsafeUnpin for AcpSession
impl !UnwindSafe for AcpSession
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