pub struct ScriptToolSet { /* private fields */ }Expand description
The set of script tools available to one agent, keyed by tool name.
Implementations§
Source§impl ScriptToolSet
impl ScriptToolSet
Sourcepub fn discover(dirs: &[PathBuf]) -> (Self, Vec<SkippedTool>)
pub fn discover(dirs: &[PathBuf]) -> (Self, Vec<SkippedTool>)
Discover and compile every *.rhai tool in dirs, in order. Earlier
directories win on a name collision (so a per-agent tools/ shadows the
global one). A file that fails to parse (bad annotations/tool.toml) or
compile is skipped and reported in the returned SkippedTool list,
never failing the whole agent. A tool.toml sitting beside
<name>.rhai overrides that script’s annotations.
Sourcepub fn get(&self, name: &str) -> Option<&ScriptTool>
pub fn get(&self, name: &str) -> Option<&ScriptTool>
Look up a compiled tool by name.
Sourcepub fn metas(&self) -> Vec<ScriptToolMeta>
pub fn metas(&self) -> Vec<ScriptToolMeta>
The metadata of every tool, for building Tool defs in the caller.
Sourcepub fn sources(&self) -> Vec<(ScriptToolMeta, PathBuf)>
pub fn sources(&self) -> Vec<(ScriptToolMeta, PathBuf)>
The metadata of every tool paired with the file it was compiled from.
metas answers what a tool advertises; a caller listing
tools for a picker also has to say where each one came from, because
“the agent’s own file” and “a global drop-in every agent gets” are
different answers to whether the tool travels with the agent. Recovering
the path through get would mean a lookup whose miss arm
can never be taken.
Trait Implementations§
Source§impl Clone for ScriptToolSet
impl Clone for ScriptToolSet
Source§fn clone(&self) -> ScriptToolSet
fn clone(&self) -> ScriptToolSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more