pub struct ToolBox {
pub skills_dir: PathBuf,
pub searxng_url: Option<String>,
pub langsearch_key: Option<String>,
pub search_provider: String,
pub blocked_domains: Vec<String>,
pub supports_images: bool,
pub image_gen_backend: Option<(OpenRouter, String)>,
pub space_files_dir: PathBuf,
pub space_apps_dir: PathBuf,
pub space_scripts_dir: PathBuf,
pub session_id: String,
pub video_gen_backend: Option<(OpenRouter, String)>,
/* private fields */
}Fields§
§skills_dir: PathBufApp-managed destination for newly created or downloaded skills.
searxng_url: Option<String>Base URL of a SearXNG instance (e.g. http://localhost:8080), no
trailing slash. Free and self-hosted — no API key needed.
langsearch_key: Option<String>LangSearch API key (free tier, no card): https://langsearch.com/dashboard
search_provider: StringWhich backend search(mode=web) prefers: “auto” (LangSearch, then SearXNG,
DuckDuckGo, and Brave), or an explicit “langsearch”/“searxng”/“duckduckgo”.
blocked_domains: Vec<String>Domains a per-space setting always excludes from search(mode=web) results
(appended to any exclude_domains the model passes).
supports_images: boolWhether the current model supports image inputs. When false, tool image results are returned as text references instead of being injected as vision content (which would cause a 400).
image_gen_backend: Option<(OpenRouter, String)>Provider + model for AI image generation. None = tool disabled.
space_files_dir: PathBufDirectory to save generated images into / search for reference images.
space_apps_dir: PathBuf§space_scripts_dir: PathBufDirectory holding space-local scripts (created by the model via the
scripts tool).
session_id: StringCurrent session id — for attaching generated images to a message.
video_gen_backend: Option<(OpenRouter, String)>Provider + model for video generation. None = tools hidden.
Implementations§
Source§impl ToolBox
impl ToolBox
Sourcepub fn new(
skills_dir: PathBuf,
searxng_url: Option<String>,
langsearch_key: Option<String>,
search_provider: String,
blocked_domains: Vec<String>,
db_path: Option<PathBuf>,
files: Option<FilesCtx>,
apps: Option<AppsCtx>,
) -> Self
pub fn new( skills_dir: PathBuf, searxng_url: Option<String>, langsearch_key: Option<String>, search_provider: String, blocked_domains: Vec<String>, db_path: Option<PathBuf>, files: Option<FilesCtx>, apps: Option<AppsCtx>, ) -> Self
All config knobs; kept flat because ~17 test call sites construct
this with inline None/default args — a config struct would churn
every one of them for no readability gain.
Sourcepub fn with_skill_dirs(self, skill_dirs: Vec<PathBuf>) -> Self
pub fn with_skill_dirs(self, skill_dirs: Vec<PathBuf>) -> Self
Replace the skill roots used for reads while retaining skills_dir as
the app-managed install/create destination.
Sourcepub fn research(
searxng_url: Option<String>,
langsearch_key: Option<String>,
search_provider: String,
blocked_domains: Vec<String>,
db_path: Option<PathBuf>,
) -> Self
pub fn research( searxng_url: Option<String>, langsearch_key: Option<String>, search_provider: String, blocked_domains: Vec<String>, db_path: Option<PathBuf>, ) -> Self
A toolbox restricted to search/fetch_url — for deep-research
searcher agents, which get no filesystem/app/script access.
Sourcepub fn with_research_session(self, session_id: String) -> Self
pub fn with_research_session(self, session_id: String) -> Self
Attach a research session id, enabling research_lookup for follow-up
turns in that session’s chat. Also merges any domains the user has
discarded in this session into blocked_domains, so a later
search/fetch_url call excludes them the same way the global
setting does.
Sourcepub const fn cache_only(self) -> Self
pub const fn cache_only(self) -> Self
Restrict fetch_url to serving from web_cache only — a cache miss
returns [not cached] instead of fetching. Used for the Verifier’s
quote-checking pass (Task 8).
Sourcepub fn defs(&self) -> Vec<ToolDef>
pub fn defs(&self) -> Vec<ToolDef>
Tool definitions to attach to the request, or empty to send a request
identical to one from before tool-calling existed (keeps models that
don’t support tools working unchanged). search always works —
it prefers configured API backends, then uses keyless HTML fallbacks
when those are unavailable, so it needs no setup.
Trait Implementations§
Source§impl ToolExecutor for ToolBox
impl ToolExecutor for ToolBox
Source§fn is_read_only(&self, name: &str, args: &str) -> bool
fn is_read_only(&self, name: &str, args: &str) -> bool
is_read_only_tool) — parallel
calls run concurrently only when every one of them is.Source§fn run<'a>(
&'a self,
name: &'a str,
args: &'a str,
) -> Pin<Box<dyn Future<Output = (String, String)> + Send + 'a>>
fn run<'a>( &'a self, name: &'a str, args: &'a str, ) -> Pin<Box<dyn Future<Output = (String, String)> + Send + 'a>>
(result, status-label). Boxed future
so the trait stays dyn-compatible (the loops hold Arc<dyn ToolExecutor>).Source§fn supports_images(&self) -> bool
fn supports_images(&self) -> bool
Source§fn space_files_dir(&self) -> Option<PathBuf>
fn space_files_dir(&self) -> Option<PathBuf>
Auto Trait Implementations§
impl !RefUnwindSafe for ToolBox
impl !UnwindSafe for ToolBox
impl Freeze for ToolBox
impl Send for ToolBox
impl Sync for ToolBox
impl Unpin for ToolBox
impl UnsafeUnpin for ToolBox
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.