import { RetryConfig } from './tools/utils/resilience.js';
import { FastApplyClient } from './tools/fastapply/core.js';
import { CodebaseSearchClient } from './tools/codebase_search/core.js';
import { BrowserClient } from './tools/browser/core.js';
import { WarpGrepClient } from './tools/warp_grep/client.js';
import { MorphGit } from './git/client.js';
import { OpenAIRouter, AnthropicRouter, GeminiRouter, RawRouter } from './modelrouter/core.js';
import { EditFileConfig, EditFileInput, EditFileResult, EditChanges } from './tools/fastapply/types.js';
import { CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult } from './tools/codebase_search/types.js';
import { d as WarpGrepToolConfig, b as WarpGrepResult, c as WarpGrepContext } from './types-BMowL9iZ.js';
import * as openai_resources_index_mjs from 'openai/resources/index.mjs';
import * as _anthropic_ai_sdk_resources_messages_mjs from '@anthropic-ai/sdk/resources/messages.mjs';
import * as ai from 'ai';
import { WarpGrepInput } from './tools/warp_grep/vercel.js';

/**
 * Factory for creating OpenAI-compatible tools with inherited API key
 *
 * @example
 * ```typescript
 * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
 *
 * const grepTool = morph.openai.createWarpGrepTool({ repoRoot: '.' });
 * const searchTool = morph.openai.createCodebaseSearchTool({ repoId: 'my-project' });
 * const editTool = morph.openai.createEditFileTool({ baseDir: './src' });
 *
 * // Use with OpenAI client
 * const response = await openai.chat.completions.create({
 *   model: 'gpt-4o',
 *   tools: [grepTool, searchTool, editTool],
 *   messages: [{ role: 'user', content: 'Find and fix the bug' }]
 * });
 * ```
 */
declare class OpenAIToolFactory {
    private config;
    constructor(config: MorphClientConfig);
    /**
     * Create an OpenAI-compatible warp grep tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns OpenAI ChatCompletionTool with execute and formatResult methods
     */
    createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
        execute: (input: unknown) => Promise<WarpGrepResult>;
        formatResult: (result: WarpGrepResult) => string;
        getSystemPrompt: () => string;
    };
    /**
     * Create an OpenAI-compatible codebase search tool
     *
     * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
     * @returns OpenAI ChatCompletionTool with execute and formatResult methods
     */
    createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
        execute: (input: CodebaseSearchInput | string) => Promise<CodebaseSearchResult>;
        formatResult: (result: CodebaseSearchResult) => string;
        getSystemPrompt: () => string;
    };
    /**
     * Create an OpenAI-compatible edit file tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns OpenAI ChatCompletionTool with execute and formatResult methods
     */
    createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
        execute: (input: EditFileInput | string) => Promise<EditFileResult>;
        formatResult: (result: EditFileResult) => string;
        getSystemPrompt: () => string;
    };
}

/**
 * Factory for creating Anthropic-compatible tools with inherited API key
 *
 * @example
 * ```typescript
 * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
 *
 * const grepTool = morph.anthropic.createWarpGrepTool({ repoRoot: '.' });
 * const searchTool = morph.anthropic.createCodebaseSearchTool({ repoId: 'my-project' });
 * const editTool = morph.anthropic.createEditFileTool({ baseDir: './src' });
 *
 * // Use with Anthropic client
 * const response = await anthropic.messages.create({
 *   model: 'claude-sonnet-4-5-20250929',
 *   tools: [grepTool, searchTool, editTool],
 *   messages: [{ role: 'user', content: 'Find and fix the bug' }]
 * });
 * ```
 */
declare class AnthropicToolFactory {
    private config;
    constructor(config: MorphClientConfig);
    /**
     * Create an Anthropic-compatible warp grep tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns Anthropic Tool with execute and formatResult methods
     */
    createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
        execute: (input: unknown) => Promise<WarpGrepResult>;
        formatResult: (result: WarpGrepResult) => string;
        getSystemPrompt: () => string;
    };
    /**
     * Create an Anthropic-compatible codebase search tool
     *
     * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
     * @returns Anthropic Tool with execute and formatResult methods
     */
    createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
        execute: (input: CodebaseSearchInput) => Promise<CodebaseSearchResult>;
        formatResult: (result: CodebaseSearchResult) => string;
        getSystemPrompt: () => string;
    };
    /**
     * Create an Anthropic-compatible edit file tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns Anthropic Tool with execute and formatResult methods
     */
    createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
        execute: (input: EditFileInput) => Promise<EditFileResult>;
        formatResult: (result: EditFileResult) => string;
        getSystemPrompt: () => string;
    };
}

/**
 * Factory for creating Vercel AI SDK-compatible tools with inherited API key
 *
 * @example
 * ```typescript
 * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
 *
 * const grepTool = morph.vercel.createWarpGrepTool({ repoRoot: '.' });
 * const searchTool = morph.vercel.createCodebaseSearchTool({ repoId: 'my-project' });
 * const editTool = morph.vercel.createEditFileTool({ baseDir: './src' });
 *
 * // Use with Vercel AI SDK
 * const result = await generateText({
 *   model: anthropic('claude-sonnet-4-5-20250929'),
 *   tools: { grep: grepTool, search: searchTool, edit: editTool },
 *   prompt: 'Find and fix the bug'
 * });
 * ```
 */
declare class VercelToolFactory {
    private config;
    constructor(config: MorphClientConfig);
    /**
     * Create a Vercel AI SDK-compatible warp grep tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns Vercel AI SDK tool
     */
    createWarpGrepTool(toolConfig: Omit<WarpGrepToolConfig, 'morphApiKey'>): ai.Tool<WarpGrepInput, {
        success: boolean;
        contexts: WarpGrepContext[] | undefined;
        summary: string | undefined;
    }>;
    /**
     * Create a Vercel AI SDK-compatible codebase search tool
     *
     * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
     * @returns Vercel AI SDK tool
     */
    createCodebaseSearchTool(toolConfig: Omit<CodebaseSearchConfig, 'apiKey'>): ai.Tool<{
        query: string;
        target_directories: string[];
        explanation: string;
        limit?: number | undefined;
    }, {
        error: string | undefined;
        results: never[];
        found?: undefined;
        searchTime?: undefined;
    } | {
        found: number;
        searchTime: string;
        results: {
            file: string;
            symbol: string;
            lines: string;
            language: string;
            relevance: string;
            code: string;
        }[];
        error?: undefined;
    }>;
    /**
     * Create a Vercel AI SDK-compatible edit file tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns Vercel AI SDK tool
     */
    createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): ai.Tool<{
        target_filepath: string;
        instructions: string;
        code_edit: string;
    }, {
        success: boolean;
        filepath: string;
        changes: EditChanges;
        udiff: string | undefined;
    }>;
}

/**
 * Unified Morph SDK Client
 *
 * Provides access to all Morph tools through a single interface
 *
 * @example
 * ```typescript
 * import { MorphClient } from '@morphllm/morphsdk';
 *
 * const morph = new MorphClient({
 *   apiKey: process.env.MORPH_API_KEY,
 *   debug: true,
 *   timeout: 60000
 * });
 *
 * // Direct execution
 * await morph.fastApply.execute({ target_filepath: 'src/index.ts', ... });
 * await morph.warpGrep.execute({ query: 'Find auth', repoRoot: '.' });
 * await morph.codebaseSearch.search({ query: 'auth logic', repoId: 'x' });
 *
 * // Tool creation for AI agents (API key inherited)
 * const grepTool = morph.openai.createWarpGrepTool({ repoRoot: '.' });
 * const searchTool = morph.anthropic.createCodebaseSearchTool({ repoId: 'x' });
 * const editTool = morph.vercel.createEditFileTool({ baseDir: './src' });
 *
 * // Use tools with OpenAI
 * const response = await openai.chat.completions.create({
 *   model: 'gpt-4o',
 *   tools: [grepTool],
 *   messages: [{ role: 'user', content: 'Find the bug' }]
 * });
 * ```
 */

/**
 * Configuration for the MorphClient
 */
interface MorphClientConfig {
    /** Morph API key for authentication (defaults to MORPH_API_KEY env var) */
    apiKey?: string;
    /** Enable debug logging across all tools */
    debug?: boolean;
    /** Default timeout in milliseconds for API requests */
    timeout?: number;
    /** Retry configuration for failed requests */
    retryConfig?: RetryConfig;
}
/**
 * Unified Morph SDK Client
 *
 * Provides access to all Morph tools through a single interface:
 * - fastApply: AI-powered file editing with intelligent merging
 * - codebaseSearch: Semantic code search
 * - warpGrep: Fast code search with ripgrep
 * - browser: AI-powered browser automation
 * - git: Version control operations
 * - routers: Intelligent model selection (OpenAI, Anthropic, Gemini)
 * - openai/anthropic/vercel: Tool factories for agent frameworks
 */
declare class MorphClient {
    /** Client configuration */
    config: MorphClientConfig;
    /** FastApply tool for editing files with AI-powered merge */
    fastApply: FastApplyClient;
    /** CodebaseSearch tool for semantic code search */
    codebaseSearch: CodebaseSearchClient;
    /** WarpGrep tool for fast code search using ripgrep */
    warpGrep: WarpGrepClient;
    /** Browser tool for AI-powered browser automation */
    browser: BrowserClient;
    /** Git tool for version control operations */
    git: MorphGit;
    /** Model routers for intelligent model selection */
    routers: {
        openai: OpenAIRouter;
        anthropic: AnthropicRouter;
        gemini: GeminiRouter;
        raw: RawRouter;
    };
    /** OpenAI-compatible tool factories */
    openai: OpenAIToolFactory;
    /** Anthropic-compatible tool factories */
    anthropic: AnthropicToolFactory;
    /** Vercel AI SDK tool factories */
    vercel: VercelToolFactory;
    /**
     * Create a new Morph SDK client
     *
     * @param config - Client configuration (apiKey, debug, timeout, retryConfig)
     *
     * @example
     * ```typescript
     * const morph = new MorphClient({
     *   apiKey: process.env.MORPH_API_KEY,
     *   debug: true,
     *   timeout: 60000
     * });
     * ```
     */
    constructor(config?: MorphClientConfig);
}

export { AnthropicToolFactory as A, MorphClient as M, OpenAIToolFactory as O, VercelToolFactory as V, type MorphClientConfig as a };
