/** * Test fixtures and helpers for Tool testing. * This module provides utilities for testing Tool implementations. */ import type { Tool, ToolContext } from '../tools/tool.js'; import type { JSONValue } from '../types/json.js'; import type { PlainToolResultBlock } from './slim-types.js'; import type { InvocationState } from '../types/agent.js'; /** * Helper to create a mock ToolContext for testing. * * @param toolUse - The tool use request * @param appState - Optional initial app state * @param invocationState - Optional initial invocation state * @returns Mock ToolContext object */ export declare function createMockContext(toolUse: { name: string; toolUseId: string; input: JSONValue; }, appState?: Record, invocationState?: InvocationState): ToolContext; /** * Result function type for createMockTool - accepts plain objects or class instances. * Can optionally receive the ToolContext for interrupt-aware tools. */ type ToolResultFn = (() => PlainToolResultBlock | AsyncGenerator) | ((context: ToolContext) => PlainToolResultBlock | AsyncGenerator | string | void); /** * Helper to create a mock tool for testing. * * @param name - The name of the mock tool * @param resultFn - Function that returns a ToolResultBlock (plain object or class instance) or an AsyncGenerator * @returns Mock Tool object */ export declare function createMockTool(name: string, resultFn: ToolResultFn): Tool; /** * Helper to create a simple mock tool with minimal configuration for testing. * This is a lighter-weight version of createMockTool for scenarios where the tool's * execution behavior is not relevant to the test. * * @param name - Optional name of the mock tool (defaults to a random UUID) * @returns Mock Tool object */ export declare function createRandomTool(name?: string): Tool; export {}; //# sourceMappingURL=tool-helpers.d.ts.map