import { ToolExecutionOptions } from 'ai'; import { z } from 'zod'; export declare const ToolParameterSchema: any; export type ToolParameter = z.infer; export interface ToolRequest { id: string; name: string; parameters?: any; description?: string; handler: (arg_string: string, options?: ToolExecutionOptions) => Promise; providerName?: string; } export declare namespace ToolRequest { function isToolParameter(obj: unknown): obj is ToolParameter; } export declare const ToolInvocationRegistry: unique symbol; /** * 为 Agent 提供的所有可用函数调用的注册表 */ export interface ToolInvocationRegistry { /** * 在注册表中注册一个工具 * * @param tool - 要注册的 `ToolRequest` 对象 */ registerTool(tool: ToolRequest): void; /** * 从注册表中获取特定的 `ToolRequest` * * @param toolId - 要获取的工具的唯一标识符 * @returns 对应提供的工具 ID 的 `ToolRequest` 对象, * 如果在注册表中找不到该工具,则返回 `undefined` */ getFunction(toolId: string): ToolRequest | undefined; /** * 从注册表中获取多个 `ToolRequest` * * @param toolIds - 要获取的工具 ID 列表 * @returns 指定工具 ID 的 `ToolRequest` 对象数组 * 如果找不到某个工具 ID,将在返回的数组中跳过该工具 */ getFunctions(...toolIds: string[]): ToolRequest[]; /** * 获取当前注册表中的所有 `ToolRequest` * * @returns 注册表中所有 `ToolRequest` 对象的数组 */ getAllFunctions(): ToolRequest[]; /** * 注销特定工具提供者的所有工具 * * @param providerName - 要移除其工具的工具提供者名称(在 `ToolRequest` 中指定) */ unregisterProviderTools(providerName: string): void; } export declare const ToolProvider: unique symbol; export interface ToolProvider { getTool(): ToolRequest; } export declare class ToolInvocationRegistryImpl implements ToolInvocationRegistry { private tools; unregisterProviderTools(providerName: string): void; getAllFunctions(): ToolRequest[]; registerTool(tool: ToolRequest): void; getFunction(toolId: string): ToolRequest | undefined; getFunctions(...toolIds: string[]): ToolRequest[]; } /** * 管理多个 ToolInvocationRegistry 实例的管理器,每个实例与一个 clientId 关联 */ export interface IToolInvocationRegistryManager { /** * 获取或创建特定 clientId 的 ToolInvocationRegistry */ getRegistry(clientId: string): ToolInvocationRegistry; /** * 移除特定 clientId 的 ToolInvocationRegistry */ removeRegistry(clientId: string): void; /** * 检查特定 clientId 是否存在对应的注册表 */ hasRegistry(clientId: string): boolean; } export declare const ToolInvocationRegistryManager: unique symbol; export declare class ToolInvocationRegistryManagerImpl implements IToolInvocationRegistryManager { private registries; getRegistry(clientId: string): ToolInvocationRegistry; removeRegistry(clientId: string): void; hasRegistry(clientId: string): boolean; } //# sourceMappingURL=tool-invocation-registry.d.ts.map