import type { AgentToolConfig } from '@contractspec/lib.contracts-spec/agent';
import type { AnyOperationSpec } from '@contractspec/lib.contracts-spec/operations/operation';
import type { OperationSpecRegistry } from '@contractspec/lib.contracts-spec/operations/registry';
import { type Tool } from 'ai';
import * as z from 'zod';
import type { ToolExecutionContext, ToolHandler } from '../types';
import { type SubagentLike } from './subagent-tool';
export declare function specToolToAISDKTool(specTool: AgentToolConfig, handler: ToolHandler, context?: Partial<ToolExecutionContext>, effectiveInputSchema?: z.ZodType, 
/** Optional operation spec for output ref fallback when specTool has no output refs */
operationSpec?: AnyOperationSpec): Tool<any, any>;
/**
 * Registry for resolving subagents by agentId.
 */
export type SubagentRegistry = Map<string, SubagentLike>;
/**
 * Options for specToolsToAISDKTools.
 */
export interface SpecToolsToAISDKToolsOptions {
    /** Optional OperationSpecRegistry for operation-backed tools (operationRef) */
    operationRegistry?: OperationSpecRegistry;
    /** Optional registry for subagent-backed tools (subagentRef) */
    subagentRegistry?: SubagentRegistry;
}
/**
 * Convert multiple ContractSpec tool configs to AI SDK tools.
 *
 * When a tool has operationRef and operationRegistry is provided, the handler
 * and input schema are derived from the operation. Otherwise, handlers must
 * be supplied for each tool.
 *
 * @param specTools - Array of tool configurations
 * @param handlers - Map of tool name to handler function (for inline tools)
 * @param context - Partial context to inject into handler calls
 * @param options - Optional operationRegistry for operation-backed tools
 * @returns Record of AI SDK tools keyed by name
 */
export declare function specToolsToAISDKTools(specTools: AgentToolConfig[], handlers: Map<string, ToolHandler>, context?: Partial<ToolExecutionContext>, options?: SpecToolsToAISDKToolsOptions): Record<string, Tool<any, any>>;
/**
 * Type-safe tool handler builder.
 *
 * @example
 * ```typescript
 * const handler = createToolHandler<{ query: string }>((input, ctx) => {
 *   return `Searched for: ${input.query}`;
 * });
 * ```
 */
export declare function createToolHandler<TInput = unknown, TOutput = string>(handler: (input: TInput, context: ToolExecutionContext) => Promise<TOutput> | TOutput | AsyncGenerator<TOutput>): ToolHandler<TInput, TOutput>;
/**
 * Build a tool handlers map from an object.
 *
 * @example
 * ```typescript
 * const handlers = buildToolHandlers({
 *   search: async (input: { query: string }) => `Found: ${input.query}`,
 *   calculate: async (input: { a: number, b: number }) => `${input.a + input.b}`,
 * });
 * ```
 */
export declare function buildToolHandlers(handlersObj: Record<string, ToolHandler>): Map<string, ToolHandler>;
