/** * Generate a TypeScript-style declaration block for the koi's tool * surface, so the model emitting JavaScript inside `run_code` knows * what's available and how to call it. * * The output looks like: * * declare const tools: { * web_search(args: { query: string }): Promise<{ results: ... }>; * read_file(args: { path: string }): Promise<{ content: string }>; * ... * }; * * We derive these from the same TypeBox / JSON-Schema parameters that * back the existing tool-use surface, so the model sees identical * argument shapes whether code-mode is on or off. */ import type { AgentTool as KoiTool } from "@mariozechner/pi-agent-core"; type AnyKoiTool = KoiTool; /** * Build the full declaration block for all tools — used at the top of * the system prompt when code-mode is enabled. */ export declare function buildToolDeclarations(tools: AnyKoiTool[]): string; /** * Lightweight inventory used by the run-code tool when constructing * the sandbox: just names and the original execute callback. We * intentionally keep this separate from the prompt-side declarations * so the model and the runtime can't get out of sync — both walk the * same `AgentTool[]`. */ export interface ToolHandle { name: string; invoke: (args: unknown, signal?: AbortSignal) => Promise; } export declare function toToolHandles(tools: AnyKoiTool[]): ToolHandle[]; export {};