Files
zesdex/apps/infrastructure/src/tools/registry.rs
T
asepharyana f368f3a1c0 feat: implement mandatory explore phase with parallel subagents
- Added `ExploreService` trait and `ExploreServiceImpl` struct to handle the exploration of codebase context before agent turns.
- Implemented three parallel subagents: Code Structure, Symbol Index, and Semantic Context, each with specific directives.
- Integrated the explore phase into the agent turn process, ensuring that each turn starts with a consolidated context message.
- Enhanced `spawn_agent_turn` function to include explore service wiring and context preparation.
2026-07-21 07:41:28 +07:00

75 lines
3.2 KiB
Rust

//! 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),
Box::new(super::semantic_search::ListSymbols),
Box::new(super::parallel_delegate::ParallelDelegate),
// ── Best-practice tools (built-in) ─────────────────────────
Box::new(super::best_practice::BestPractice),
Box::new(super::best_practice::CommitConvention),
]
}
/// 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()
}