import { Tool } from '@anthropic-ai/sdk/resources/messages';
import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './types.js';
import '../utils/resilience.js';

/**
 * Anthropic SDK adapter for codebase_search tool
 */

/**
 * Create Anthropic-native codebase_search tool with execute and formatResult methods
 *
 * @param config - Configuration with repoId
 * @returns Anthropic Tool definition with execute and formatResult methods
 *
 * @example
 * ```ts
 * import Anthropic from '@anthropic-ai/sdk';
 * import { createCodebaseSearchTool } from 'morphsdk/tools/anthropic';
 *
 * const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
 * const tool = createCodebaseSearchTool({ repoId: 'my-project' });
 *
 * const response = await client.messages.create({
 *   model: "claude-sonnet-4-5-20250929",
 *   tools: [tool], // tool itself is the Tool definition
 *   messages: [{ role: "user", content: "Find authentication code" }]
 * });
 *
 * // Execute tool and format result
 * const result = await tool.execute(toolUseBlock.input);
 * const formatted = tool.formatResult(result);
 * ```
 */
declare function createCodebaseSearchTool(config: CodebaseSearchConfig): Tool & {
    execute: (input: CodebaseSearchInput) => Promise<CodebaseSearchResult>;
    formatResult: (result: CodebaseSearchResult) => string;
    getSystemPrompt: () => string;
};

export { createCodebaseSearchTool };
