pub struct KernelAdapter<T: ?Sized> { /* private fields */ }Expand description
Any OutcomeTool as a kernel tool: every description of a call
(annotations, effects, access, outbound data) comes from the tool’s
ToolSemantics.
Implementations§
Source§impl<T: OutcomeTool + ?Sized> KernelAdapter<T>
impl<T: OutcomeTool + ?Sized> KernelAdapter<T>
pub fn new(tool: Arc<T>) -> Self
Sourcepub fn with_call_facts(self, facts: ToolCallContext) -> Self
pub fn with_call_facts(self, facts: ToolCallContext) -> Self
Call the tool with these facts (who is asking, from which chat) instead of none: what the host knows about the turn the tool is offered in, such as its audience.
Sourcepub fn with_spec(self, spec: ToolSpec) -> Self
pub fn with_spec(self, spec: ToolSpec) -> Self
Offer the tool under this spec instead of its own schema.
Sourcepub fn with_trust_roots(self, roots: Arc<Vec<String>>) -> Self
pub fn with_trust_roots(self, roots: Arc<Vec<String>>) -> Self
The run’s trusted roots: where an effect lands can decide its class.
Sourcepub fn with_owned_folders(self, owned: OwnedFolders) -> Self
pub fn with_owned_folders(self, owned: OwnedFolders) -> Self
The folders the request’s work made for itself: an effect landing there is the work’s own, so its class is judged like one inside the trusted roots (read live: a folder claimed mid-turn counts at once).
Sourcepub fn with_validator(self, validator: CallValidator) -> Self
pub fn with_validator(self, validator: CallValidator) -> Self
Check arguments with this instead of the schema’s required keys.
pub fn with_timeout(self, timeout: Duration) -> Self
Sourcepub fn with_runner(self, runner: Arc<dyn OutcomeRunner>) -> Self
pub fn with_runner(self, runner: Arc<dyn OutcomeRunner>) -> Self
Run calls through runner instead of OutcomeTool::execute.
Trait Implementations§
Source§impl<T: OutcomeTool + ?Sized + 'static> Tool for KernelAdapter<T>
impl<T: OutcomeTool + ?Sized + 'static> Tool for KernelAdapter<T>
Source§fn annotations(&self) -> ToolAnnotations
fn annotations(&self) -> ToolAnnotations
Worst case for the tool as a whole: only a tool that is read-only for every call says so; any other may be destructive and egress.
Source§fn concurrent_peers(&self) -> usize
fn concurrent_peers(&self) -> usize
Sub-agents spawned in one batch run together, up to
MAX_CONCURRENT_CHILDREN: the coordination ledger arbitrates what
they write. Every other non-read-only tool runs alone.
Source§fn annotations_for(&self, arguments: &Value) -> ToolAnnotations
fn annotations_for(&self, arguments: &Value) -> ToolAnnotations
Judged per call: a mixed tool such as a shell reads for ls and
writes for rm.
Source§fn effects(&self, arguments: &Value) -> CallEffects
fn effects(&self, arguments: &Value) -> CallEffects
The tool’s own declaration for the arguments it will run with (after its argument canonicalization).
Source§fn access(&self, arguments: &Value) -> AccessManifest
fn access(&self, arguments: &Value) -> AccessManifest
The declared effects as the kernel’s access manifest: egress targets
as hosts, path effects as writes, a shell tool’s command line given
as command or script, and a file tool’s guarded paths.
Source§fn source_trust(&self, _arguments: &Value) -> SourceTrust
fn source_trust(&self, _arguments: &Value) -> SourceTrust
Fallback only: a result that knows its trust says so itself.
fn spec(&self) -> ToolSpec
Source§fn outbound(&self, arguments: &Value) -> Outbound
fn outbound(&self, arguments: &Value) -> Outbound
Source§fn validate(&self, arguments: &Value) -> Result<(), String>
fn validate(&self, arguments: &Value) -> Result<(), String>
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 timeout(&self) -> Option<Duration>
fn timeout(&self) -> Option<Duration>
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.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 suspends(&self) -> bool
fn suspends(&self) -> bool
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,
Tool::call would have returned: a
result, or ToolOutput::suspended if the child paused again. Read more