pub struct LocalSubstrate;Expand description
Host filesystem / process substrate.
Reproduces the historic agent_basics host behavior exactly: the entire
host-locality contract is one rule — absolute paths are used verbatim;
relative paths join std::env::current_dir().
Implementations§
Trait Implementations§
Source§impl Clone for LocalSubstrate
impl Clone for LocalSubstrate
Source§fn clone(&self) -> LocalSubstrate
fn clone(&self) -> LocalSubstrate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalSubstrate
impl Debug for LocalSubstrate
Source§impl Default for LocalSubstrate
impl Default for LocalSubstrate
Source§fn default() -> LocalSubstrate
fn default() -> LocalSubstrate
Returns the “default value” for a type. Read more
Source§impl Substrate for LocalSubstrate
impl Substrate for LocalSubstrate
Source§fn is_local(&self) -> bool
fn is_local(&self) -> bool
Whether this substrate is the host process itself. Convenience tools
(
list_dir/find_files/grep_files) that walk a directory tree use
this to keep their byte-identical host-fs implementation on the local
path; non-local environments fall back to composing on run_command.Source§fn run_command<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str,
timeout_s: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_command<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str,
timeout_s: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run a one-shot command, returning stdout/stderr/exit_code.
Source§fn read_text<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_text<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a UTF-8 text file in full.
Source§fn write_text<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_text<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write (truncate) a UTF-8 text file.
Source§fn path_state<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = PathState> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn path_state<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = PathState> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Determine whether
path exists without requiring it to be valid UTF-8.
The default is intentionally unknown: custom substrates can retain their
existing trait implementation, while guarded writes fail closed until
the adapter supplies a trustworthy presence check.Source§fn read_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
offset: Option<u64>,
len: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
offset: Option<u64>,
len: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read raw bytes, optionally a window
[offset, offset+len).Source§fn write_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
bytes: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
bytes: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write (truncate) raw bytes.
Source§fn display_path(&self, path: &str) -> String
fn display_path(&self, path: &str) -> String
How a path should appear in tool-result metadata for this environment.
Pure/synchronous; no I/O. The default echoes the input unchanged. The
local environment overrides this to reproduce the historic behavior of
reporting the resolved absolute path (relative paths joined to the host
CWD). Not a capability — just display canonicalization.
fn pty_start<'life0, 'life1, 'async_trait>(
&'life0 self,
_cmd: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pty_input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_data: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pty_read<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pty_resize<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
_rows: u16,
_cols: u16,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pty_kill<'life0, 'life1, 'async_trait>(
&'life0 self,
_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for LocalSubstrate
impl RefUnwindSafe for LocalSubstrate
impl Send for LocalSubstrate
impl Sync for LocalSubstrate
impl Unpin for LocalSubstrate
impl UnsafeUnpin for LocalSubstrate
impl UnwindSafe for LocalSubstrate
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more