pub struct EditFile { /* private fields */ }Implementations§
Source§impl EditFile
impl EditFile
Sourcepub fn on_backend(
backend: Arc<dyn ExecutionBackend>,
policy: Arc<dyn FilePolicy>,
) -> Self
pub fn on_backend( backend: Arc<dyn ExecutionBackend>, policy: Arc<dyn FilePolicy>, ) -> Self
A tool working through backend under an application’s policy.
Trait Implementations§
Source§impl OutcomeTool for EditFile
impl OutcomeTool for EditFile
fn name(&self) -> &str
Source§fn description(&self) -> &str
fn description(&self) -> &str
One-line description.
Source§fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
arguments: &'life1 str,
facts: &'life2 ToolCallContext,
) -> Pin<Box<dyn Future<Output = Result<ToolCallOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
arguments: &'life1 str,
facts: &'life2 ToolCallContext,
) -> Pin<Box<dyn Future<Output = Result<ToolCallOutcome>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Run one call.
Err is a failed call whose message the model reads.Source§fn validate_call(&self, arguments: &Value) -> Result<(), String>
fn validate_call(&self, arguments: &Value) -> Result<(), String>
Checks made before a kernel agent runs the call.
Source§fn approval_card_mode(&self) -> Option<PermissionMode>
fn approval_card_mode(&self) -> Option<PermissionMode>
The permission mode the owner’s cards for this tool are sent with
(it picks the buttons offered).
None: the default, Cautious.Source§fn approval_card_kind(&self, _request: &OwnerApprovalRequest) -> ApprovalKind
fn approval_card_kind(&self, _request: &OwnerApprovalRequest) -> ApprovalKind
The kind of card the owner is asked
request (from
ToolSemantics::owner_approval_request) with, which picks the
buttons offered: a one-time card or a goal confirmation offers no
session or persistent grant. The default is a standard command card.Source§fn record_owner_answer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_call: &'life1 ApprovalCall<'life2>,
_facts: &'life3 ToolCallContext,
_response: Option<ApprovalResponse>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn record_owner_answer<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_call: &'life1 ApprovalCall<'life2>,
_facts: &'life3 ToolCallContext,
_response: Option<ApprovalResponse>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Apply the owner’s answer to a card asked for
call (from
ToolSemantics::owner_approval_request) to the tool’s own grant
stores. None: the card timed out or never reached the owner. The
default keeps nothing; the kernel’s session grants are separate.Source§impl Tool for EditFile
impl Tool for EditFile
fn spec(&self) -> ToolSpec
fn annotations(&self) -> ToolAnnotations
Source§fn validate(&self, arguments: &Value) -> Result<(), String>
fn validate(&self, arguments: &Value) -> Result<(), String>
Deterministic argument checks, run before any policy or I/O. The
kernel checks the arguments against the declared schema
(
check_arguments: required keys, types, enums, nested objects
and array items) before calling this, whatever a tool does here, so
an override only adds checks. The default is that schema check.Source§fn access(&self, arguments: &Value) -> AccessManifest
fn access(&self, arguments: &Value) -> AccessManifest
Declare what this call will touch. Optional; policies treat an empty
manifest as undeclared.
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
arguments: Value,
_ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn annotations_for(&self, _arguments: &Value) -> ToolAnnotations
fn annotations_for(&self, _arguments: &Value) -> ToolAnnotations
Annotations for one call. Tools whose effect depends on the arguments
(a shell running
ls versus rm) override this; the default is the
tool-wide Tool::annotations. Read moreSource§fn source_trust(&self, _arguments: &Value) -> SourceTrust
fn source_trust(&self, _arguments: &Value) -> SourceTrust
Who authored what this call returns. The default is
Untrusted; a
tool whose output is the owner’s own (a workspace file, the
kernel’s bookkeeping) returns Trusted. A result may override this
with ToolOutput::with_trust.Source§fn outbound(&self, _arguments: &Value) -> Outbound
fn outbound(&self, _arguments: &Value) -> Outbound
What this call carries out of the machine if it only reads. The
default says nothing does.
Source§fn timeout(&self) -> Option<Duration>
fn timeout(&self) -> Option<Duration>
How long this tool may run, overriding
Limits::tool_timeout. Tools
that take their own timeout argument (such as a shell) return a value
at least as long as their own maximum.Source§fn effects(&self, arguments: &Value) -> CallEffects
fn effects(&self, arguments: &Value) -> CallEffects
The typed effects of this call (effect class and normalized target).
The default is
CallEffects::none for a call that is read-only and
not egress (per Tool::annotations_for). Otherwise it is what the
call’s declared Tool::access implies (CallEffects::from_access:
a written path is a write effect, a host an egress effect), so an
owner’s denial of the call binds the rest of the run; and
CallEffects::unknown when it declares no access: a read from
another host still sends the request off the machine, so a tool
annotated egress should declare its host or its
EffectKey::egress target. Recomputed
after a hook rewrites the arguments.Source§fn concurrent_peers(&self) -> usize
fn concurrent_peers(&self) -> usize
How many calls of this tool may run together in one batch although
the tool is not read-only: 0 (the default) runs each call alone. A
tool returns more only when it coordinates the shared state its
concurrent calls touch itself (sub-agents whose writes a coordination
ledger arbitrates). Calls queued this way still run after every
earlier call in the batch has been judged, and before any later call
that is not concurrent-safe.
Source§fn suspends(&self) -> bool
fn suspends(&self) -> bool
Whether this tool may answer with
ToolOutput::suspended. A call
of such a tool always runs alone, because a run pauses on one call at
a time.Source§fn resume_child<'life0, 'life1, 'async_trait>(
&'life0 self,
_child: RunState,
_resolution: Resolution,
_ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn resume_child<'life0, 'life1, 'async_trait>(
&'life0 self,
_child: RunState,
_resolution: Resolution,
_ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Continue the child run this tool suspended, with the answer to its
interruption, and return what
Tool::call would have returned: a
result, or ToolOutput::suspended if the child paused again. Read moreSource§impl ToolSemantics for EditFile
impl ToolSemantics for EditFile
Source§fn call_effects(&self, arguments: &str) -> CallEffects
fn call_effects(&self, arguments: &str) -> CallEffects
A write of the target path (absolute; a relative path resolves where the execution backend puts it, which is not known here).
Source§fn owner_approval_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ApprovalCall<'life2>,
facts: &'life3 ToolCallContext,
) -> Pin<Box<dyn Future<Output = OwnerApprovalNeed> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn owner_approval_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ApprovalCall<'life2>,
facts: &'life3 ToolCallContext,
) -> Pin<Box<dyn Future<Output = OwnerApprovalNeed> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
A write that plants persistence (a shell start-up file, a launch agent, a git hook, the agent’s own instructions) always asks.
Source§fn dispatch_facts(&self) -> ToolDispatchFacts
fn dispatch_facts(&self) -> ToolDispatchFacts
How the dispatcher and the engine treat this tool. Default: nothing
special.
Source§fn tool_role(&self) -> ToolRole
fn tool_role(&self) -> ToolRole
Categorize this tool for role-based scoping.
Default: Action (most tools are action tools).
Source§fn capabilities(&self) -> ToolCapabilities
fn capabilities(&self) -> ToolCapabilities
Capability metadata used by the execution policy and risk gate.
Defaults are intentionally conservative.
Source§fn call_semantics(&self, arguments: &str) -> ToolCallSemantics
fn call_semantics(&self, arguments: &str) -> ToolCallSemantics
Structured completion semantics for a specific call. Read more
Source§fn call_file_write(&self, arguments: &str) -> Option<FileWrite>
fn call_file_write(&self, arguments: &str) -> Option<FileWrite>
The file this exact call writes and how, read from its arguments. A
tool that does not declare one is invisible to stale-write checks.
Source§fn file_write_result(
&self,
arguments: &str,
current: Option<&[u8]>,
) -> Option<Result<Vec<u8>, String>>
fn file_write_result( &self, arguments: &str, current: Option<&[u8]>, ) -> Option<Result<Vec<u8>, String>>
What the file would hold after this exact call, were it holding
current now (None: no such file). Err is the tool’s own reason
the call cannot apply to that content. A tool that cannot say returns
None, and a host that asks then treats the call as changing all of
the file.Source§fn call_annotations_in(
&self,
arguments: &str,
_roots: &TrustRoots<'_>,
) -> ToolAnnotations
fn call_annotations_in( &self, arguments: &str, _roots: &TrustRoots<'_>, ) -> ToolAnnotations
Authority annotations for this exact call, judged against the turn’s
trusted roots: read-only, destructive, idempotent, and whether it
sends data or acts outside the owner’s machine and workspace
(
egress). Derived from the call’s typed semantics, never from the
tool’s name. Roots matter for effects whose class depends on where
they land (a delete inside the owner’s roots is not egress); empty
roots mean every such target counts as outside them. The default
ignores the roots.Source§fn canonicalize_arguments(
&self,
arguments: &str,
) -> Result<String, ToolArgumentContractViolation>
fn canonicalize_arguments( &self, arguments: &str, ) -> Result<String, ToolArgumentContractViolation>
Canonicalize provider argument projections before any semantics,
authority, retry, or access decision is made. The default is identity;
adapters with representational aliases or optional-empty projection
quirks can normalize them without teaching the orchestration layer
adapter-specific rules.
Source§fn validate_arguments(
&self,
_arguments: &str,
) -> Result<(), ToolArgumentContractViolation>
fn validate_arguments( &self, _arguments: &str, ) -> Result<(), ToolArgumentContractViolation>
Adapter-owned, deterministic argument invariants evaluated by the
common dispatcher before any tool I/O. The default accepts all schema-
valid calls. Rejections become typed
contract_rejected receipts.Source§fn on_task_end<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_task_id: &'life1 str,
_session_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_task_end<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_task_id: &'life1 str,
_session_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Task lifecycle callback fired after the agent emits
TaskEnd.
Tools that spawn background activity can use this to clean up
task-scoped resources.Source§fn session_context_note<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn session_context_note<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Live state this tool holds for a session that outlives a turn (for
example background processes still running), rendered for the next
turn’s task context so a follow-up sees it instead of guessing.
Source§fn background_jobs<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Vec<BackgroundJob>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn background_jobs<'life0, 'life1, 'async_trait>(
&'life0 self,
_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Vec<BackgroundJob>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The jobs this tool is running in the background for
session_id
(they outlive the turn that started them), as the chat’s list of
running work shows them.Source§fn stop_background_job<'life0, 'life1, 'async_trait>(
&'life0 self,
_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_background_job<'life0, 'life1, 'async_trait>(
&'life0 self,
_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop the background job
key (from Self::background_jobs) and
read its state back: true only once the job is gone.Source§fn jobs_ended_by_task_end<'life0, 'life1, 'async_trait>(
&'life0 self,
_task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn jobs_ended_by_task_end<'life0, 'life1, 'async_trait>(
&'life0 self,
_task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
How many jobs task
task_id started that are still running and that
the task’s end would stop: nothing reports their result, so a run that
ended now would lose their work.Source§fn owner_control_plane(&self) -> bool
fn owner_control_plane(&self) -> bool
The tool only manages the owner’s own durable policy (mandates). A
request assessment that narrows a turn’s tools still offers it to the
owner in a private chat, but only calls
owner_control_plane_call
accepts are admitted there.Source§fn owner_control_plane_call(&self, _arguments: &str) -> bool
fn owner_control_plane_call(&self, _arguments: &str) -> bool
Whether this exact call is safe on a turn whose assessment did not
name the tool: read-only, or committing only through an explicit
owner confirmation. Decided from the tool’s own schema enum.
Source§fn receipt_kind(&self, _arguments: &str) -> ToolReceiptKind
fn receipt_kind(&self, _arguments: &str) -> ToolReceiptKind
Machine-receipt protocol emitted by this adapter. Read more
Source§fn call_access_manifest(&self, arguments: &str) -> ToolCallAccessManifest
fn call_access_manifest(&self, arguments: &str) -> ToolCallAccessManifest
Filesystem access roles for this exact call. Open-ended adapters should
override this when their schema exposes explicit read/write grants.
Source§fn guarded_paths(&self, arguments: &str) -> (Vec<String>, Vec<String>)
fn guarded_paths(&self, arguments: &str) -> (Vec<String>, Vec<String>)
The paths this call reads and writes, as
ProtectedPathGuard judges
them. Defaults to the access manifest; a tool overrides it for a path
that scope checks must not see as a task read.Source§fn adapter_owned_access_manifest(
&self,
_arguments: &str,
) -> ToolCallAccessManifest
fn adapter_owned_access_manifest( &self, _arguments: &str, ) -> ToolCallAccessManifest
Capabilities supplied by the adapter rather than requested as task
data. The common dispatcher uses this typed lane when attenuating the
call against the task manifest. The default is empty so an adapter
cannot accidentally widen authority by inheriting a generic grant.
Source§fn durable_replay_decision<'life0, 'life1, 'async_trait>(
&'life0 self,
_arguments: &'life1 str,
) -> Pin<Box<dyn Future<Output = DurableReplayDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn durable_replay_decision<'life0, 'life1, 'async_trait>(
&'life0 self,
_arguments: &'life1 str,
) -> Pin<Box<dyn Future<Output = DurableReplayDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reconcile a successful durable receipt with current state before replay. Read more
Source§fn stable_observation_subjects(&self) -> Vec<StableObservationSubject>
fn stable_observation_subjects(&self) -> Vec<StableObservationSubject>
Exact receipt subjects this adapter reports verbatim: fixed collection
IDs and the namespaces of member identities it mints. The checklist
tool publishes the union so declared targets bind only to identities a
receipt can carry. The default advertises nothing.
Source§fn call_outbound(&self, _arguments: &str) -> Outbound
fn call_outbound(&self, _arguments: &str) -> Outbound
What this call carries out of the machine if it only reads.
Source§fn named_files(&self, arguments: &str) -> Vec<String>
fn named_files(&self, arguments: &str) -> Vec<String>
Every file or resource this exact call names as something it reads
or writes, from typed facts only (never its prose): its declared
target hints, its access manifest and its typed path effects. A tool
whose arguments name more structurally (a shell command’s operands)
adds them. One reading for every tool, so a fact about a file (the
request’s own work produced it) reaches each call that names it.
Source§fn output_trust(&self, _arguments: &str, _roots: &TrustRoots<'_>) -> SourceTrust
fn output_trust(&self, _arguments: &str, _roots: &TrustRoots<'_>) -> SourceTrust
Who authored what this exact call returns. The default is
Untrusted iff the tool reaches outside the machine
(external_side_effect); local tools override with the owner’s
trusted roots.Source§fn call_title(&self, _arguments: &str) -> Option<String>
fn call_title(&self, _arguments: &str) -> Option<String>
A few plain words the call itself gave for what it does (“running
the site installer”), for the owner’s status line and lists of
running work. Never authority. Default: none.
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Whether this tool is currently operational. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for EditFile
impl !UnwindSafe for EditFile
impl Forget for EditFile
impl Freeze for EditFile
impl Move for EditFile
impl Send for EditFile
impl Sync for EditFile
impl Unpin for EditFile
impl UnsafeUnpin for EditFile
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