pub struct LocalBackend { /* private fields */ }Expand description
The local backend: the host filesystem, confined to a workspace unless told otherwise.
Implementations§
Source§impl LocalBackend
impl LocalBackend
Sourcepub fn current_unrestricted() -> Self
pub fn current_unrestricted() -> Self
The current directory as workspace, with no confinement: for tests that construct a tool directly.
Sourcepub fn with_env_allowlist(
self,
names: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_env_allowlist( self, names: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Let commands also inherit these host variables (a trailing * is a
prefix), on top of LOCAL_ENV_ALLOWLIST.
Trait Implementations§
Source§impl ExecutionBackend for LocalBackend
impl ExecutionBackend for LocalBackend
fn kind(&self) -> BackendKind
fn id(&self) -> &str
fn approval_scope(&self) -> &str
fn workspace_root(&self) -> &BackendPath
fn home_hint(&self) -> &BackendPath
fn allows_outside_workspace(&self) -> bool
fn home_dir<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BackendPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resolve_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<BackendPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn canonicalize<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<BackendPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<BackendMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
content: &'life2 [u8],
mode: WriteMode,
create_parents: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_dir_all<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 BackendPath,
destination: &'life2 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 BackendPath,
destination: &'life2 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn remove_empty_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_empty_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a directory only if it is empty; never recursive.
fn read_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<Vec<BackendDirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn spawn<'life0, 'async_trait>(
&'life0 self,
request: ExecutionRequest,
) -> Pin<Box<dyn Future<Output = Result<SpawnedProcess>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn terminate<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 ProcessHandle,
grace: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn import_local_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
local_path: &'life1 Path,
destination: &'life2 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<BackendPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn import_local_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
local_path: &'life1 Path,
destination: &'life2 BackendPath,
) -> Pin<Box<dyn Future<Output = Result<BackendPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Copy a daemon-host file into the execution workspace. Local execution
preserves the original path when it is permitted.
Source§fn export_local_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 BackendPath,
local_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn export_local_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 BackendPath,
local_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Copy an execution-side file to a daemon-host staging path.
fn execute<'life0, 'async_trait>(
&'life0 self,
request: ExecutionRequest,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<ExecutionOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn resolve_executable<'life0, 'life1, 'async_trait>(
&'life0 self,
executable: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<BackendPath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_executable<'life0, 'life1, 'async_trait>(
&'life0 self,
executable: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<BackendPath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resolve an executable in the same environment used for agent work.
Bare names are checked against PATH first, then against conventional
user-local and system prefixes. The returned path is concrete so callers
do not have to rediscover it through a differently configured shell.
fn executable_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
executable: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Forget for LocalBackend
impl Freeze for LocalBackend
impl Move for LocalBackend
impl RefUnwindSafe for LocalBackend
impl Send for LocalBackend
impl Sync for LocalBackend
impl Unpin for LocalBackend
impl UnsafeUnpin for LocalBackend
impl UnwindSafe for LocalBackend
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