import { type Tool as AiTool, type ToolSet as AiToolSet, type ToolExecutionOptions as AiToolExecutionOptions, type ToolExecuteFunction } from 'ai'; import type { ZodTypeAny, z } from 'zod'; /** * The AI SDK's own tool type, re-exported under a name that says so. * * It was called `Tool`, which collided with the framework's own effect-tool * contract in `types/effectTool.ts` — and because the root index exported this * one explicitly while the other arrived through `export type *`, this one won. * So `import { Tool } from '@kuralle-agents/core'` handed you the AI SDK's type, * not Kuralle's, and the framework's primary noun shipped as `EffectTool`. */ export type AiSdkTool = AiTool; export type ToolSet = AiToolSet; export interface ToolExecutionContext { session?: unknown; sessionId?: string; agentId?: string; step?: number; turn?: number; toolName?: string; toolCallId?: string; idempotencyKey?: string; runtime?: unknown; [key: string]: unknown; } export type ToolExecutionOptions = AiToolExecutionOptions; export interface ToolDefinition { description: string; inputSchema: ZodTypeAny; execute: ToolExecuteFunction; /** If true (default), failure blocks turn success completion. */ critical?: boolean; /** Action to take on execution error. */ errorPolicy?: 'abort' | 'warn' | 'continue'; } export interface ToolWithFiller extends ToolDefinition { /** @deprecated Use `interim` on effect tools (`defineTool`). */ filler?: string; /** @deprecated Use `interimAfterMs` on effect tools (`defineTool`). */ estimatedDurationMs?: number; interim?: string; interimAfterMs?: number; } type SchemaToolDefinition = { description: string; inputSchema: TSchema; execute: ToolExecuteFunction, TResult, ToolExecutionContext>; critical?: boolean; errorPolicy?: 'abort' | 'warn' | 'continue'; }; type SchemaToolWithFiller = SchemaToolDefinition & { /** @deprecated Use `interim`. */ filler?: string; /** @deprecated Use `interimAfterMs`. */ estimatedDurationMs?: number; interim?: string; interimAfterMs?: number; }; export declare function createTool(definition: SchemaToolDefinition): AiSdkTool, TResult> & ToolDefinition, TResult>; export declare function createToolWithFiller(definition: SchemaToolWithFiller): AiSdkTool, TResult> & ToolWithFiller, TResult>; export {};