Skip to main content

llimorse_tools/
lib.rs

1//! Basic set of tools to be made available to harnesses written with llimorse
2
3pub mod bash;
4pub mod file;
5pub mod subagent;
6pub mod web_search;
7
8pub use bash::Bash;
9pub use file::{Edit, View, Write};
10use std::any::Any;
11use std::fmt::{Debug, Display};
12pub use subagent::{Subagent, ToolFactory};
13pub use web_search::WebSearch;
14
15/// Pseudo-trait for gateable tool parameters
16pub trait GateableToolParams: Any + Debug + Display {}
17
18impl<T: Any + Debug + Display> GateableToolParams for T {}
19
20/// Permission gate for tool call execution
21#[allow(async_fn_in_trait)]
22pub trait ToolGate: Debug + Send + Sync {
23    /// Ask for permission to execute the given tool call.
24    ///
25    /// Rejection must be indicated by returning an error.
26    async fn permitted(&self, params: &dyn GateableToolParams) -> std::result::Result<(), String>;
27}
28
29/// Permission gate that permits everything.
30#[derive(Debug)]
31pub struct AutoApprove;
32
33#[allow(async_fn_in_trait)]
34impl ToolGate for AutoApprove {
35    async fn permitted(&self, _params: &dyn GateableToolParams) -> std::result::Result<(), String> {
36        Ok(())
37    }
38}