import type { NodeFn } from "../types.js"; import type { ONIMessage } from "../graph.js"; import type { ToolHandler } from "./types.js"; export interface DynamicToolState { messages: ONIMessage[]; pendingTools: Array<{ name: string; args: Record; id: string; }>; } export interface ToolRegistration { name: string; description: string; parameters: Record; handler: ToolHandler; } export declare class DynamicToolRegistry { private handlers; /** * Register a tool handler. If a handler with the same name already exists, * it is replaced silently (hot-swap). */ register(name: string, handler: ToolHandler, opts?: { description?: string; parameters?: Record; }): this; /** Remove a tool by name. Returns true if it existed. */ unregister(name: string): boolean; /** List currently registered tool names. */ list(): string[]; /** Check if a tool is registered. */ has(name: string): boolean; /** * Returns a StateGraph-compatible node function. * * The node reads `state.pendingTools[0]`, dispatches to the matching * handler, and returns the result merged into messages. If the tool * is not found it returns a structured error (never throws). */ asNode(): NodeFn; /** * Returns a JSON schema array describing all registered tools, * suitable for passing to an LLM node as available tool definitions. */ asSchema(): Array<{ type: "function"; function: { name: string; description: string; parameters: Record; }; }>; } //# sourceMappingURL=dynamic-tool-registry.d.ts.map