pub struct ReadFile {
pub root: PathBuf,
pub extra_roots: Vec<(PathBuf, AccessTier)>,
pub session_roots: Option<SharedSandboxRoots>,
pub max_bytes: usize,
pub read_state: Option<Arc<Mutex<ReadFileState>>>,
}Fields§
§root: PathBuf§extra_roots: Vec<(PathBuf, AccessTier)>Additional sandbox roots beyond the primary workspace, each tagged
with an access tier. The primary root is always
AccessTier::ReadWrite and is prepended to this list at resolution
time so the agent can read files in declared extra directories.
session_roots: Option<SharedSandboxRoots>Session-scoped, runtime-mutable roots (e.g. added via the TUI
/add-dir command). Consulted on every call so newly added roots
take effect immediately.
max_bytes: usize§read_state: Option<Arc<Mutex<ReadFileState>>>Optional shared state slot. When Some, every successful read is
recorded so EditTool can enforce the partial-read guard.
Implementations§
Source§impl ReadFile
impl ReadFile
pub fn new(root: impl Into<PathBuf>) -> Self
pub fn with_read_state(self, slot: Arc<Mutex<ReadFileState>>) -> Self
Sourcepub fn with_extra_roots(
self,
extra: impl IntoIterator<Item = (PathBuf, AccessTier)>,
) -> Self
pub fn with_extra_roots( self, extra: impl IntoIterator<Item = (PathBuf, AccessTier)>, ) -> Self
Append additional allowed sandbox roots (e.g. from [sandbox] extra_dirs). The primary workspace root is always prepended at
resolution time, so callers only need to pass the extra ones here.
Sourcepub fn with_session_roots(self, slot: SharedSandboxRoots) -> Self
pub fn with_session_roots(self, slot: SharedSandboxRoots) -> Self
Attach the shared, session-mutable roots slot. See SharedSandboxRoots.
Sourcepub fn with_session_roots_opt(self, slot: Option<SharedSandboxRoots>) -> Self
pub fn with_session_roots_opt(self, slot: Option<SharedSandboxRoots>) -> Self
Convenience: attach the shared slot only when Some. Used by
crate::tools::build_standard_tools_with_roots so headless/CLI
builds can pass None without conditional chaining at every call site.
Trait Implementations§
Source§impl Tool for ReadFile
impl Tool for ReadFile
fn spec(&self) -> ToolSpec
Source§fn side_effect_class(&self) -> ToolSideEffect
fn side_effect_class(&self) -> ToolSideEffect
External) so any unannotated tool is treated
as risky on resume. Override to ReadOnly or Mutating for
built-in tools; MCP tools derive this from their annotations.Source§fn kind(&self) -> ToolKind
fn kind(&self) -> ToolKind
ToolKind for tool_call notifications (Sprint 3).
Defaults to ToolKind::Other. Concrete tools override to map
to their corresponding ACP category.fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn is_deferred(&self) -> bool
fn is_deferred(&self) -> bool
true to send this tool as deferred (name-only) in the initial
prompt; the model must call ToolSearch to load its full schema.
Default is false (eager). Override in low-frequency tools.Source§fn is_readonly(&self) -> bool
fn is_readonly(&self) -> bool
ReadOnly.
Used by the parallel-dispatch path in agent.rs. Override only if
you have an unusual reason (you almost never should — override
side_effect_class instead and let this default through).