//! Tool trait, execution context, and the registry of all built-in tools. //! //! This module defines the core `Tool` trait that every agent-invocable tool //! must implement, the shared `ToolCtx` execution context, and utility //! functions for path resolution, command execution, argument extraction, //! and graduated-check rules. //! //! # Organisation //! //! ```text //! tools/ //! ├── mod.rs — Tool trait, re-exports //! ├── context.rs — ToolCtx, ToolCtxBuilder //! ├── registry.rs — all_tools(), tool_defs(), tool_is_risky() //! ├── util.rs — arg_str(), execute_cmd(), resolve_path(), //! │ log_write_edit_tool() //! ├── graduated.rs — GraduatedCheck, check_graduated_checks() //! ├── executor.rs — InfrastructureToolExecutor //! ├── fs/ — read, write, edit, delete //! ├── git/ — git_operator, git_worktree, git_cred //! ├── memory/ — remember, forget, recall //! ├── utility/ — cd, dir_list, pong, todowrite, todofinish, etc. //! ├── shell.rs — Bash tool //! ├── bash_tools.rs //! ├── search.rs — Grep, Glob //! ├── semantic_search.rs //! ├── web_search.rs //! ├── sequential_think.rs //! ├── plan.rs, spawn.rs, workflow.rs //! └── parallel_delegate.rs //! ``` use anyhow::Result; use serde_json::Value; pub mod bash_tools; pub mod best_practice; pub mod context; pub mod executor; pub mod fs; pub mod git; pub mod graduated; pub mod memory; pub mod parallel_delegate; pub mod plan; pub mod registry; pub mod search; pub mod semantic_search; pub mod sequential_think; pub mod shell; pub mod shell_filter; pub mod spawn; pub mod util; pub mod utility; pub mod web_search; pub mod workflow; // Re-export commonly used items at the `tools` root so existing imports // like `crate::tools::{Tool, ToolCtx}` continue to work. pub use context::{ToolCtx, ToolCtxBuilder}; pub use graduated::{check_graduated_checks, GraduatedCheck}; pub use registry::{all_tools, tool_defs, tool_is_parallel_safe, tool_is_risky}; pub use util::{arg_str, execute_cmd, log_write_edit_tool, resolve_path}; /// Common interface every agent-invocable tool implements. pub trait Tool: Send + Sync { fn name(&self) -> &'static str; fn description(&self) -> &'static str; fn parameters(&self) -> Value; fn run(&self, ctx: &ToolCtx, args: &Value) -> Result; } pub use git::git_cred; pub use git::git_operator; pub use git::git_worktree;