2026-07-21 06:42:37 +07:00
|
|
|
//! Tool registry: the master list of all built-in tools, plus conversion
|
|
|
|
|
//! utilities for generating provider-facing tool definitions.
|
|
|
|
|
|
|
|
|
|
/// Construct one instance of every built-in tool.
|
|
|
|
|
pub fn all_tools() -> Vec<Box<dyn super::Tool>> {
|
|
|
|
|
vec![
|
|
|
|
|
Box::new(super::fs::read::Read),
|
|
|
|
|
Box::new(super::fs::write::Write),
|
|
|
|
|
Box::new(super::fs::edit::Edit),
|
|
|
|
|
Box::new(super::fs::delete::Delete),
|
|
|
|
|
Box::new(super::search::Grep),
|
|
|
|
|
Box::new(super::search::Glob),
|
|
|
|
|
Box::new(super::bash_tools::BashOutput),
|
|
|
|
|
Box::new(super::bash_tools::BashKill),
|
|
|
|
|
Box::new(super::shell::Bash),
|
|
|
|
|
Box::new(super::git::git_operator::GitOperator),
|
|
|
|
|
Box::new(super::git::git_worktree::GitWorktree),
|
|
|
|
|
Box::new(super::git::git_cred::GitCred),
|
|
|
|
|
Box::new(super::sequential_think::SeqThink),
|
|
|
|
|
Box::new(super::plan::PlanEnter),
|
|
|
|
|
Box::new(super::plan::PlanReady),
|
|
|
|
|
Box::new(super::workflow::WorkflowRun),
|
|
|
|
|
Box::new(super::workflow::NoteFinding),
|
|
|
|
|
Box::new(super::workflow::ReadFindings),
|
|
|
|
|
Box::new(super::workflow::HiveMind),
|
|
|
|
|
Box::new(super::spawn::SpawnAgents),
|
|
|
|
|
Box::new(super::spawn::SpawnPipeline),
|
|
|
|
|
Box::new(super::memory::remember::Remember),
|
|
|
|
|
Box::new(super::memory::forget::Forget),
|
|
|
|
|
Box::new(super::memory::recall::Recall),
|
|
|
|
|
Box::new(super::utility::cd::Cd),
|
|
|
|
|
Box::new(super::utility::dir_list::DirList),
|
|
|
|
|
Box::new(super::utility::dir_cache_update::DirCacheUpdate),
|
|
|
|
|
Box::new(super::utility::pong::Pong),
|
|
|
|
|
Box::new(super::utility::todowrite::Todowrite),
|
|
|
|
|
Box::new(super::utility::todofinish::Todofinish),
|
|
|
|
|
Box::new(super::lsp::LspConnect),
|
|
|
|
|
Box::new(super::lsp::LspDiagnostics),
|
|
|
|
|
Box::new(super::lsp::LspHover),
|
|
|
|
|
Box::new(super::lsp::LspCompletion),
|
|
|
|
|
Box::new(super::lsp::LspDefinition),
|
|
|
|
|
Box::new(super::lsp::LspReferences),
|
|
|
|
|
Box::new(super::lsp::LspDisconnect),
|
|
|
|
|
Box::new(super::web_search::WebSearch),
|
|
|
|
|
Box::new(super::semantic_search::SemanticSearch),
|
|
|
|
|
Box::new(super::semantic_search::RebuildIndex),
|
2026-07-21 07:41:28 +07:00
|
|
|
Box::new(super::semantic_search::ListSymbols),
|
2026-07-21 06:42:37 +07:00
|
|
|
Box::new(super::parallel_delegate::ParallelDelegate),
|
2026-07-21 07:21:22 +07:00
|
|
|
// ── Best-practice tools (built-in) ─────────────────────────
|
|
|
|
|
Box::new(super::best_practice::BestPractice),
|
|
|
|
|
Box::new(super::best_practice::CommitConvention),
|
2026-07-21 06:42:37 +07:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Whether a tool by name can mutate the filesystem or run arbitrary shell
|
|
|
|
|
/// commands.
|
|
|
|
|
pub fn tool_is_risky(name: &str) -> bool {
|
|
|
|
|
matches!(name, "write" | "delete" | "edit" | "bash" | "git_operator")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Convert a list of tools into provider-facing `ToolDef` request schema.
|
|
|
|
|
pub fn tool_defs(tools: &[Box<dyn super::Tool>]) -> Vec<zesdex_domain::core::ToolDef> {
|
|
|
|
|
tools
|
|
|
|
|
.iter()
|
|
|
|
|
.map(|t| zesdex_domain::core::ToolDef {
|
|
|
|
|
type_: "function".to_string(),
|
|
|
|
|
function: zesdex_domain::core::ToolFunctionDef {
|
|
|
|
|
name: t.name().to_string(),
|
|
|
|
|
description: t.description().to_string(),
|
|
|
|
|
parameters: t.parameters(),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.collect()
|
|
|
|
|
}
|