Skip to main content

Workspace

Trait Workspace 

Source
pub trait Workspace:
    Send
    + Sync
    + Debug {
    // Required methods
    fn environment<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<EnvironmentInfo, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn metadata(&self) -> WorkspaceMetadata;
    fn invalidate_environment_cache<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn list_files<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: Option<&'life1 str>,
        max_results: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn working_directory(&self) -> &Path;
    fn execute_tool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tool_call: &'life1 ToolCall,
        context: ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn available_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<ToolSchema>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn requires_approval<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tool_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Core workspace abstraction for environment information and file operations

Required Methods§

Source

fn environment<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<EnvironmentInfo, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get environment information for this workspace

Source

fn metadata(&self) -> WorkspaceMetadata

Get workspace metadata

Source

fn invalidate_environment_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Invalidate cached environment information (force refresh on next call)

Source

fn list_files<'life0, 'life1, 'async_trait>( &'life0 self, query: Option<&'life1 str>, max_results: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

List files in the workspace for fuzzy finding Returns workspace-relative paths, filtered by optional query

Source

fn working_directory(&self) -> &Path

Get the working directory for this workspace

Source

fn execute_tool<'life0, 'life1, 'async_trait>( &'life0 self, tool_call: &'life1 ToolCall, context: ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<ToolResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Execute a tool in this workspace

Source

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<ToolSchema>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get available tools in this workspace

Source

fn requires_approval<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if a tool requires approval

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Workspace for RemoteWorkspace

Source§

fn environment<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<EnvironmentInfo, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn metadata(&self) -> WorkspaceMetadata

Source§

fn invalidate_environment_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn list_files<'life0, 'life1, 'async_trait>( &'life0 self, query: Option<&'life1 str>, max_results: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn working_directory(&self) -> &Path

Source§

fn execute_tool<'life0, 'life1, 'async_trait>( &'life0 self, tool_call: &'life1 ToolCall, context: ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<ToolResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<ToolSchema>> + Send + 'async_trait>>
where 'life0: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn requires_approval<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Implementors§