import { LLMToolCall } from "../grok/client.js"; import { ToolResult } from "../types/index.js"; /** * Executes tool calls from LLM with validation, approval hooks, and error handling * * Handles: * - Tool argument parsing and validation * - JSON encoding bug fixes (nested strings, concatenated objects) * - Tool approval hooks for security * - Parameter defaults and validation * - Built-in and MCP tool execution */ export declare class ToolExecutor { /** Main LLM agent instance */ private agent; /** Text editor tool for file operations */ private textEditor; /** Morph editor for fast code editing */ private morphEditor; /** Shell execution tool */ private zsh; /** Search tool for code/file searching */ private search; /** Environment variable tool */ private env; /** Introspection tool for system info */ private introspect; /** Cache clearing tool */ private clearCacheTool; /** Restart tool */ private restartTool; /** Character/persona management tool */ private characterTool; /** Task management tool */ private taskTool; /** Internet/web tool */ private internetTool; /** Image processing tool */ private imageTool; /** File conversion tool */ private fileConversionTool; /** Audio processing tool */ private audioTool; constructor( /** Main LLM agent instance */ agent: any, /** Text editor tool for file operations */ textEditor: any, /** Morph editor for fast code editing */ morphEditor: any, /** Shell execution tool */ zsh: any, /** Search tool for code/file searching */ search: any, /** Environment variable tool */ env: any, /** Introspection tool for system info */ introspect: any, /** Cache clearing tool */ clearCacheTool: any, /** Restart tool */ restartTool: any, /** Character/persona management tool */ characterTool: any, /** Task management tool */ taskTool: any, /** Internet/web tool */ internetTool: any, /** Image processing tool */ imageTool: any, /** File conversion tool */ fileConversionTool: any, /** Audio processing tool */ audioTool: any); /** * Apply default parameter values for specific tools * Ensures tools have sensible defaults when parameters are omitted * * @param toolName Name of the tool being executed * @param params Tool parameters object * @returns Parameters with defaults applied */ private applyToolParameterDefaults; /** * Validate tool arguments against tool schema * Checks parameter names, required parameters, and parameter counts * * @param toolName Name of the tool to validate * @param args Arguments to validate * @returns Error message if invalid, null if valid */ private validateToolArguments; /** * Execute a tool call with full validation and error handling * Main entry point for tool execution from LLM responses * * @param toolCall LLM tool call object with function name and arguments * @returns Tool execution result with success/error status */ executeTool(toolCall: LLMToolCall): Promise; /** * Execute tool by name with parsed arguments * Routes to appropriate tool implementation based on tool name * * @param toolName Name of tool to execute * @param args Parsed and validated arguments * @returns Tool execution result */ private executeToolByName; private executeMCPTool; }