pub struct DockerToolHandler { /* private fields */ }Expand description
Handle tool execution inside Docker containers.
Implementations§
Source§impl DockerToolHandler
impl DockerToolHandler
Sourcepub fn new(
session: DockerSession,
workspace_dir: impl Into<String>,
shell_init: impl Into<String>,
) -> Self
pub fn new( session: DockerSession, workspace_dir: impl Into<String>, shell_init: impl Into<String>, ) -> Self
Create a new tool handler.
Sourcepub fn session(&self) -> &DockerSession
pub fn session(&self) -> &DockerSession
Reference to the underlying session.
Sourcepub fn session_mut(&mut self) -> &mut DockerSession
pub fn session_mut(&mut self) -> &mut DockerSession
Mutable reference to the underlying session.
Sourcepub async fn run_command(
&self,
command: &str,
timeout: f64,
working_dir: Option<&str>,
) -> ToolResult
pub async fn run_command( &self, command: &str, timeout: f64, working_dir: Option<&str>, ) -> ToolResult
Execute a bash command inside the container.
Sourcepub async fn read_file(&self, path: &str) -> ToolResult
pub async fn read_file(&self, path: &str) -> ToolResult
Read a file from the container.
Sourcepub async fn write_file(&self, path: &str, content: &str) -> ToolResult
pub async fn write_file(&self, path: &str, content: &str) -> ToolResult
Write a file inside the container.
Sourcepub async fn list_files(
&self,
path: &str,
pattern: Option<&str>,
recursive: bool,
) -> ToolResult
pub async fn list_files( &self, path: &str, pattern: Option<&str>, recursive: bool, ) -> ToolResult
List files in a directory inside the container.
Sourcepub async fn search(&self, query: &str, path: Option<&str>) -> ToolResult
pub async fn search(&self, query: &str, path: Option<&str>) -> ToolResult
Search for text in files inside the container.
Sourcepub fn translate_path(&self, path: &str) -> String
pub fn translate_path(&self, path: &str) -> String
Translate a host path to a container path.
Sourcepub fn check_command_has_error(exit_code: i32, output: &str) -> bool
pub fn check_command_has_error(exit_code: i32, output: &str) -> bool
Check if command output indicates an error.
Auto Trait Implementations§
impl Freeze for DockerToolHandler
impl RefUnwindSafe for DockerToolHandler
impl Send for DockerToolHandler
impl Sync for DockerToolHandler
impl Unpin for DockerToolHandler
impl UnsafeUnpin for DockerToolHandler
impl UnwindSafe for DockerToolHandler
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