import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@earendil-works/pi-agent-core"; import type { Static, TSchema } from "typebox"; import type { ExtensionToolContext, ToolDefinition } from "../extensions/types.ts"; /** * An `AgentTool` with a TypeBox parameter schema whose `execute` and `prepareArguments` are typed by TypeBox's * `Static`, as the built-in tools are (pi-agent-core types `params` through pi-schema, which maps only the common * TypeBox kinds). Spreads into a `ToolDefinition` of the same schema. */ export type TypeBoxAgentTool = Omit, "prepareArguments" | "execute"> & { prepareArguments?: (args: unknown) => Static; execute: (toolCallId: string, params: Static, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback) => Promise>; }; /** Creates the context for one tool call. */ export type ToolContextFactory = (toolCallId: string, signal: AbortSignal | undefined) => ExtensionToolContext; /** Wrap a ToolDefinition into an AgentTool for the core runtime. */ export declare function wrapToolDefinition(definition: ToolDefinition, ctxFactory?: ToolContextFactory): AgentTool; /** Wrap multiple ToolDefinitions into AgentTools for the core runtime. */ export declare function wrapToolDefinitions(definitions: ToolDefinition[], ctxFactory?: ToolContextFactory): AgentTool[]; /** * Synthesize a minimal ToolDefinition from an AgentTool. * * This keeps AgentSession's internal registry definition-first even when a caller * provides plain AgentTool overrides that do not include prompt metadata or renderers. */ export declare function createToolDefinitionFromAgentTool(tool: AgentTool): ToolDefinition;