/** * Zoe Core — Tool executor * * Tool registry, resolution, factory, and execution logic. * Transport-agnostic: no chalk, no HTTP, no CLI concerns. */ import { ToolModule, ToolDefinition, ToolExecExtra } from "../tools/interface.js"; import { UserToolDefinition, ToolResult } from "./types.js"; /** * Return the tool definitions for all registered tools (built-in + custom). */ export declare function getAllToolDefinitions(): ToolDefinition[]; /** * Return all registered tool modules (built-in + custom). */ export declare function getAllToolModules(): ToolModule[]; export declare const CORE_TOOLS: string[]; export declare const COMM_TOOLS: string[]; export declare const ADVANCED_TOOLS: string[]; export declare const ALL_TOOLS: string[]; /** * Create a custom tool module from a Zod-like schema definition. * * Returns a `ToolModule` compatible with the built-in tool registry, * so custom tools can be mixed freely with built-in ones. * * @example * ```ts * const myTool = tool({ * description: "Greets a person", * parameters: z.object({ name: z.string() }), * execute: async ({ name }) => `Hello, ${name}!`, * }); * ``` */ export declare function tool(definition: UserToolDefinition): ToolModule; /** * Register a tool module in the global tool registry. * * @param module A `ToolModule` to add to the registry */ export declare function registerTool(module: ToolModule): void; /** * Coerce a tool handler's `string | ToolResult` return into a `ToolResult`. * Plain strings (the common case) become `{ output, success: true }` with no * metadata. Structured ToolResults pass through with `metadata` preserved. */ export declare function normalizeToolResult(raw: string | ToolResult): ToolResult; /** * Execute a tool by name with the given arguments and optional config. * * @param name Tool function name (e.g. "execute_shell_command") * @param args Arguments object for the tool * @param config Optional runtime config passed to the tool handler * @returns ToolResult — `output` (what the LLM sees) + optional `metadata` * for adapters (e.g. write_file's FileWriteMetadata for the diff) * @throws Error if the tool name is not found in the registry */ export declare function executeTool(name: string, args: Record, config?: Record, extra?: ToolExecExtra): Promise; /** * Return the built-in tool definitions belonging to a named group. * * @param group One of "core", "comm", "advanced", or "all" * @returns Array of OpenAI function definitions for the matching tools * @throws Error if the group name is not recognised */ export declare function getToolGroup(group: "core" | "comm" | "advanced" | "all"): ToolDefinition[]; type ToolInput = string | UserToolDefinition; /** * Resolve a mixed array of tool references into concrete OpenAI function * definitions ready to send to the LLM. * * Accepted input shapes: * - `"all"` — expands to all built-in tools * - `"core"` / `"comm"` / `"advanced"` — expands to the named group * - A built-in tool name string — looked up from the internal registry * - A `UserToolDefinition` object — converted via `tool()` factory * * @param tools Array of tool references (defaults to all built-in tools) * @returns Deduplicated array of OpenAI function definitions * @throws Error if a string name is not found in the built-in registry */ export declare function resolveTools(tools?: ToolInput[]): ToolDefinition[]; export {};