pub trait AcpHostHandler: Send + Sync {
// Provided methods
fn fs_read_text_file(&self, path: &str) -> Result<String, String> { ... }
fn terminal_create(
&self,
_cwd: Option<&str>,
_env: Option<&HashMap<String, String>>,
) -> Result<String, String> { ... }
fn terminal_write(
&self,
terminal_id: &str,
input: &str,
) -> Result<String, String> { ... }
fn request_permission(
&self,
_tool_name: &str,
_description: &str,
_session_id: &str,
) -> Result<bool, String> { ... }
}Expand description
Typed handler for agent → host ACP requests.
All methods have default implementations that return safe denials, so callers only need to override the operations they actually support.
Implementations must be Send + Sync because the handler is called from
the reader loop’s blocking thread.
Provided Methods§
Sourcefn fs_read_text_file(&self, path: &str) -> Result<String, String>
fn fs_read_text_file(&self, path: &str) -> Result<String, String>
Agent wants to read a file from the host filesystem.
Return Ok(content) or Err(human-readable message).
Sourcefn terminal_create(
&self,
_cwd: Option<&str>,
_env: Option<&HashMap<String, String>>,
) -> Result<String, String>
fn terminal_create( &self, _cwd: Option<&str>, _env: Option<&HashMap<String, String>>, ) -> Result<String, String>
Agent wants to create a terminal session on the host.
Return Ok(terminal_id) or Err(human-readable message).