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 { CompactClient } from './tools/compact/core.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, g as GitHubSearchToolConfig, c as WarpGrepContext } from './types-CtkD4o1_.js';
import * as openai_resources_index_mjs from 'openai/resources/index.mjs';
import { ExploreSubagentConfig, ExploreResult, ExploreSession, ExploreEvent } from './subagents/types.js';
import * as _anthropic_ai_sdk_resources_messages_mjs from '@anthropic-ai/sdk/resources/messages.mjs';
import * as ai from 'ai';
import { LanguageModel } from 'ai';
import { WarpGrepToolInput } from './tools/warp_grep/vercel.js';

/**
 * GitHub SDK Types
 *
 * Type definitions for the Morph GitHub integration.
 * Users connect GitHub in the Morph dashboard, then use these
 * types to interact with their GitHub repos through the SDK.
 */
/**
 * Configuration for the GitHub client
 */
interface GitHubClientConfig {
    /** Morph API key (defaults to MORPH_API_KEY env var) */
    apiKey?: string;
    /** Default installation ID to use (optional, can be specified per-request) */
    installationId?: string;
    /** Base URL for the Morph API (defaults to https://api.morphllm.com) */
    baseUrl?: string;
    /** Request timeout in milliseconds */
    timeout?: number;
    /** Enable debug logging */
    debug?: boolean;
}
/**
 * A GitHub App installation (connected GitHub account)
 */
interface Installation {
    /** Installation ID (use this for subsequent requests) */
    id: string;
    /** GitHub account login (username or org name) */
    accountLogin: string;
    /** Account type */
    accountType: "User" | "Organization";
    /** Custom display name (set in Morph dashboard) */
    displayName?: string;
    /** Whether check runs are disabled (only PR comments posted) */
    disableCheckRun: boolean;
    /** Whether to keep all previous PR comments (vs. replacing with latest) */
    keepCommentHistory: boolean;
    /** Browser automation model used for preview tests */
    model: string;
}
/**
 * Input for updating installation settings
 */
interface UpdateInstallationInput {
    /** Installation ID to update */
    installationId: string;
    /** Custom display name */
    displayName?: string;
    /** Whether to disable check runs */
    disableCheckRun?: boolean;
    /** Whether to keep comment history */
    keepCommentHistory?: boolean;
    /** Browser automation model */
    model?: string;
}
/**
 * Site authentication credentials for a repo or project
 */
interface SiteAuth {
    /** Login username or email */
    username: string | null;
    /** Login password */
    password: string | null;
}
/**
 * A repository with its Morph configuration
 */
interface RepoConfig {
    /** Database UUID — use this for update/remove operations */
    id: string;
    /** GitHub's numeric repo ID */
    githubId: number;
    /** Full name including owner (e.g., "acme/app") */
    fullName: string;
    /** Repository name (e.g., "app") */
    name: string;
    /** Whether Morph tests are enabled */
    enabled: boolean;
    /** Whether to also test on mobile viewport */
    testMobile: boolean;
    /** Path filter — only trigger tests when files match this prefix */
    pathFilter: string | null;
    /** Custom instructions for the AI agent */
    customInstructions: string | null;
    /** Site authentication credentials */
    auth: SiteAuth | null;
}
/**
 * Input for updating a repo's configuration
 */
interface UpdateRepoInput {
    /** Repo DB ID (from RepoConfig.id) */
    repoId: string;
    /** Whether Morph tests are enabled */
    enabled?: boolean;
    /** Whether to also test on mobile viewport */
    testMobile?: boolean;
    /** Path filter for conditional triggers */
    pathFilter?: string | null;
    /** Custom instructions for the AI agent */
    customInstructions?: string | null;
    /** Site auth credentials (null to clear) */
    auth?: {
        username?: string;
        password?: string;
        cookies?: unknown;
    } | null;
}
/**
 * Input for syncing repos from GitHub
 */
interface SyncReposInput {
    /** Installation ID to sync repos for */
    installationId: string;
}
/**
 * A monorepo sub-project scoped under a repo
 */
interface Project {
    /** Project DB UUID */
    id: string;
    /** Parent repo DB UUID */
    repoId: string;
    /** Project name */
    name: string;
    /** Path filter within the repo */
    pathFilter: string | null;
    /** Whether tests are enabled */
    enabled: boolean;
    /** Whether to test on mobile viewport */
    testMobile: boolean;
    /** Custom instructions for the AI agent */
    customInstructions: string | null;
    /** Site authentication credentials */
    auth: SiteAuth | null;
    /** Creation timestamp (ISO 8601) */
    createdAt: string;
}
/**
 * Input for creating a project
 */
interface CreateProjectInput {
    /** Parent repo DB ID */
    repoId: string;
    /** Project name (must be unique within the repo) */
    name: string;
    /** Path filter within the repo (e.g., "packages/web/") */
    pathFilter: string;
    /** Custom instructions for the AI agent */
    customInstructions?: string;
}
/**
 * Input for updating a project
 */
interface UpdateProjectInput {
    /** Project DB ID */
    projectId: string;
    /** Whether tests are enabled */
    enabled?: boolean;
    /** Whether to test on mobile viewport */
    testMobile?: boolean;
    /** Path filter within the repo */
    pathFilter?: string | null;
    /** Custom instructions for the AI agent */
    customInstructions?: string | null;
    /** Site auth credentials (null to clear) */
    auth?: {
        username?: string;
        password?: string;
        cookies?: unknown;
    } | null;
}
/**
 * Input for listing projects
 */
interface ListProjectsInput {
    /** Parent repo DB ID */
    repoId: string;
}
/**
 * A GitHub repository
 */
interface Repo {
    /** GitHub's numeric repo ID */
    id: number;
    /** Repository name (e.g., "app") */
    name: string;
    /** Full name including owner (e.g., "acme/app") */
    fullName: string;
    /** Whether the repo is private */
    private: boolean;
    /** Default branch name */
    defaultBranch?: string;
}
/**
 * A pull request (basic info)
 */
interface PullRequest {
    /** PR number */
    number: number;
    /** PR title */
    title: string;
    /** PR description/body */
    body: string | null;
    /** PR state */
    state: "open" | "closed";
    /** Author's GitHub username */
    author: string;
    /** HEAD commit SHA */
    headSha: string;
    /** Base branch name */
    baseBranch: string;
    /** HEAD branch name */
    headBranch: string;
    /** Creation timestamp (ISO 8601) */
    createdAt: string;
    /** Last update timestamp (ISO 8601) */
    updatedAt: string;
}
/**
 * A pull request with full context (diff and files)
 */
interface PullRequestWithContext extends PullRequest {
    /** Full unified diff */
    diff: string;
    /** List of changed files with patches */
    files: FileChange[];
}
/**
 * A file changed in a pull request
 */
interface FileChange {
    /** File path */
    filename: string;
    /** Change status */
    status: "added" | "removed" | "modified" | "renamed";
    /** Number of lines added */
    additions: number;
    /** Number of lines deleted */
    deletions: number;
    /** Unified diff patch for this file */
    patch?: string;
}
/**
 * A deployment (e.g., Vercel preview)
 */
interface Deployment {
    /** Deployment ID */
    id: number;
    /** Commit SHA this deployment is for */
    sha: string;
    /** Environment name (e.g., "preview", "production") */
    environment: string;
    /** Deployment state */
    state: "pending" | "success" | "failure" | "error" | "inactive" | "in_progress" | "queued";
    /** Preview/deployment URL (if available) */
    url: string | null;
    /** Creation timestamp (ISO 8601) */
    createdAt: string;
}
/**
 * A comment on a PR/issue
 */
interface Comment {
    /** Comment ID */
    id: number;
    /** Comment body/content */
    body: string;
    /** Author's GitHub username */
    author: string;
    /** Creation timestamp (ISO 8601) */
    createdAt: string;
    /** Last update timestamp (ISO 8601) */
    updatedAt: string;
}
/**
 * A GitHub check run (CI status)
 */
interface CheckRun {
    /** Check run ID */
    id: number;
    /** Check run name */
    name: string;
    /** Current status */
    status: "queued" | "in_progress" | "completed";
    /** Conclusion (only set when status is "completed") */
    conclusion?: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required";
    /** Start timestamp (ISO 8601) */
    startedAt?: string;
    /** Completion timestamp (ISO 8601) */
    completedAt?: string;
}
/**
 * Input for listing repositories
 */
interface ListReposInput {
    /** Installation ID to list repos for */
    installationId: string;
}
/**
 * Input for listing pull requests
 */
interface ListPullRequestsInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Filter by PR state (default: "open") */
    state?: "open" | "closed" | "all";
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for getting a single pull request
 */
interface GetPullRequestInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** PR number */
    number: number;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for listing deployments
 */
interface ListDeploymentsInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Filter by commit SHA */
    sha?: string;
    /** Filter by environment name */
    environment?: string;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for listing comments on a PR
 */
interface ListCommentsInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** PR number */
    pr: number;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for creating a comment
 */
interface CreateCommentInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** PR number */
    pr: number;
    /** Comment body (Markdown supported) */
    body: string;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for updating a comment
 */
interface UpdateCommentInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Comment ID to update */
    commentId: number;
    /** New comment body */
    body: string;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for deleting a comment
 */
interface DeleteCommentInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Comment ID to delete */
    commentId: number;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for creating a check run
 */
interface CreateCheckRunInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Commit SHA to create check run for */
    sha: string;
    /** Check run name (e.g., "Preview Test") */
    name: string;
    /** Initial status */
    status: "queued" | "in_progress";
    /** Output title */
    title?: string;
    /** Output summary (Markdown supported) */
    summary?: string;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Input for updating a check run
 */
interface UpdateCheckRunInput {
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Check run ID to update */
    checkRunId: number;
    /** New status */
    status?: "queued" | "in_progress" | "completed";
    /** Conclusion (required if status is "completed") */
    conclusion?: CheckRun["conclusion"];
    /** Output title */
    title?: string;
    /** Output summary (Markdown supported) */
    summary?: string;
    /** Output text (detailed info, Markdown supported) */
    text?: string;
    /** Installation ID (uses default if not specified) */
    installationId?: string;
}
/**
 * Error thrown by GitHub operations
 */
declare class GitHubError extends Error {
    /** HTTP status code */
    status: number;
    /** Error code from API */
    code?: string;
    constructor(message: string, status: number, code?: string);
}
/**
 * Error thrown when no installation is found or specified
 */
declare class NoInstallationError extends GitHubError {
    constructor(message?: string);
}
/**
 * Error thrown when resource is not found
 */
declare class NotFoundError extends GitHubError {
    constructor(resource: string);
}
/**
 * Error thrown when user lacks permission
 */
declare class PermissionError extends GitHubError {
    constructor(message?: string);
}

/**
 * GitHub SDK Client
 *
 * Provides access to GitHub repositories, pull requests, deployments,
 * comments, and check runs through the user's connected GitHub account.
 *
 * All operations are proxied through the Morph API - installation tokens
 * are never exposed to the client.
 */

/**
 * GitHub SDK Client
 *
 * @example
 * ```typescript
 * import { MorphClient } from '@morphllm/morphsdk';
 *
 * const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });
 *
 * // List installations
 * const installations = await morph.github.installations.list();
 *
 * // Get PR with context
 * const pr = await morph.github.pullRequests.get({
 *   owner: "acme",
 *   repo: "app",
 *   number: 42
 * });
 * ```
 */
declare class GitHubClient {
    private apiKey;
    private baseUrl;
    private timeout;
    private debug;
    private defaultInstallationId?;
    /** Installation operations */
    installations: {
        list: () => Promise<Installation[]>;
        get: (installationId: string) => Promise<Installation>;
        update: (input: UpdateInstallationInput) => Promise<Installation>;
        disconnect: (installationId: string) => Promise<{
            success: boolean;
            alreadyDeleted: boolean;
        }>;
    };
    /** Repository operations */
    repos: {
        list: (input: ListReposInput) => Promise<RepoConfig[]>;
        get: (repoId: string) => Promise<RepoConfig>;
        update: (input: UpdateRepoInput) => Promise<RepoConfig>;
        remove: (repoId: string) => Promise<{
            success: boolean;
            alreadyRemoved: boolean;
        }>;
        sync: (input: SyncReposInput) => Promise<{
            count: number;
        }>;
    };
    /** Project operations (monorepo sub-projects) */
    projects: {
        list: (input: ListProjectsInput) => Promise<Project[]>;
        create: (input: CreateProjectInput) => Promise<Project>;
        update: (input: UpdateProjectInput) => Promise<Project>;
        delete: (projectId: string) => Promise<{
            success: boolean;
        }>;
    };
    /** Pull request operations */
    pullRequests: {
        list: (input: ListPullRequestsInput) => Promise<PullRequest[]>;
        get: (input: GetPullRequestInput) => Promise<PullRequestWithContext>;
    };
    /** Deployment operations */
    deployments: {
        list: (input: ListDeploymentsInput) => Promise<Deployment[]>;
    };
    /** Comment operations */
    comments: {
        list: (input: ListCommentsInput) => Promise<Comment[]>;
        create: (input: CreateCommentInput) => Promise<Comment>;
        update: (input: UpdateCommentInput) => Promise<Comment>;
        delete: (input: DeleteCommentInput) => Promise<void>;
    };
    /** Check run operations */
    checkRuns: {
        create: (input: CreateCheckRunInput) => Promise<CheckRun>;
        update: (input: UpdateCheckRunInput) => Promise<CheckRun>;
    };
    /**
     * Get the GitHub App installation URL.
     * Users visit this URL once to install the Morph GitHub App on their account/org.
     */
    getInstallUrl(): string;
    constructor(config?: GitHubClientConfig);
    /**
     * Make an authenticated API request
     */
    private request;
    /**
     * Get the installation ID to use for a request
     */
    private getInstallationId;
    private listInstallations;
    private getInstallation;
    private updateInstallation;
    private disconnectInstallation;
    private listRepos;
    private getRepo;
    private updateRepo;
    private removeRepo;
    private syncRepos;
    private listProjects;
    private createProject;
    private updateProject;
    private deleteProject;
    private listPullRequests;
    private getPullRequest;
    private listDeployments;
    private listComments;
    private createComment;
    private updateComment;
    private deleteComment;
    private createCheckRun;
    private updateCheckRun;
}

/**
 * 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;
    };
    /**
     * 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;
    };
    /**
     * Create an OpenAI-compatible GitHub search tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns OpenAI ChatCompletionTool with execute and formatResult methods
     */
    createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): openai_resources_index_mjs.ChatCompletionTool & {
        execute: (input: {
            search_term: string;
            github_url?: string;
            owner_repo?: string;
            branch?: string;
        }) => Promise<WarpGrepResult>;
        formatResult: (result: WarpGrepResult) => 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;
    };
    /**
     * 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;
    };
    /**
     * Create an Anthropic-compatible GitHub search tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns Anthropic Tool with execute and formatResult methods
     */
    createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): _anthropic_ai_sdk_resources_messages_mjs.Tool & {
        execute: (input: {
            search_term: string;
            github_url?: string;
            owner_repo?: string;
            branch?: string;
        }) => Promise<WarpGrepResult>;
        formatResult: (result: WarpGrepResult) => string;
    };
    /**
     * Create an Explore subagent that searches the codebase and returns summaries
     *
     * @param config - Subagent configuration including client and model (morphApiKey inherited from MorphClient)
     * @returns Explore subagent with .tool, .run(), and .stream() methods
     */
    createExploreSubagent(config: Omit<ExploreSubagentConfig, 'morphApiKey'> & {
        client: any;
        model: string;
    }): {
        tool: _anthropic_ai_sdk_resources_messages_mjs.Tool & {
            execute: (input: {
                searchRequest: string;
            }) => Promise<ExploreResult>;
            formatResult: (result: ExploreResult) => string;
        };
        run(prompt: string): ExploreSession;
        stream(prompt: string): AsyncGenerator<ExploreEvent, ExploreResult, undefined>;
    };
}

/**
 * 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<WarpGrepToolInput, {
        success: boolean;
        contexts: WarpGrepContext[] | undefined;
        summary: string | undefined;
        progress: {
            turn: number;
            toolCalls: {
                name: string;
                arguments: Record<string, unknown>;
            }[];
        } | 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;
        instruction: string;
        code_edit: string;
    }, {
        success: boolean;
        filepath: string;
        changes: EditChanges;
        udiff: string | undefined;
    }>;
    /**
     * Create a Vercel AI SDK-compatible GitHub search tool
     *
     * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
     * @returns Vercel AI SDK tool
     */
    createGitHubSearchTool(toolConfig?: Omit<GitHubSearchToolConfig, 'morphApiKey'>): ai.Tool<{
        search_term: string;
        branch?: string | undefined;
        owner_repo?: string | undefined;
        github_url?: string | undefined;
    }, {
        success: boolean;
        contexts: WarpGrepContext[] | undefined;
        summary: string | undefined;
    }>;
    /**
     * Create an Explore subagent that searches the codebase and returns summaries
     *
     * @param config - Subagent configuration including model (morphApiKey inherited from MorphClient)
     * @returns Explore subagent with .tool, .run(), and .stream() methods
     */
    createExploreSubagent(config: Omit<ExploreSubagentConfig, 'morphApiKey'> & {
        model: LanguageModel;
    }): {
        tool: ai.Tool<{
            searchRequest: string;
        }, {
            success: boolean;
            summary: string;
            searchCount: number;
            error: string | undefined;
        }>;
        run(prompt: string): ExploreSession;
        stream(prompt: string): AsyncGenerator<ExploreEvent, ExploreResult, 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;
    /** GitHub-specific configuration */
    github?: {
        /** Default installation ID for GitHub operations */
        installationId?: string;
    };
}
/**
 * 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;
    /** GitHub tool for PR context, comments, and check runs */
    github: GitHubClient;
    /** 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;
    /** Compact context with line ranges */
    compact: CompactClient['compact'];
    /**
     * 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, type Comment as C, type Deployment as D, type FileChange as F, GitHubClient as G, type Installation as I, type ListReposInput as L, MorphClient as M, NoInstallationError as N, OpenAIToolFactory as O, type Project as P, type Repo as R, type SiteAuth as S, type UpdateCommentInput as U, VercelToolFactory as V, type MorphClientConfig as a, type GitHubClientConfig as b, type RepoConfig as c, type PullRequest as d, type PullRequestWithContext as e, type CheckRun as f, type ListPullRequestsInput as g, type GetPullRequestInput as h, type ListDeploymentsInput as i, type ListCommentsInput as j, type CreateCommentInput as k, type DeleteCommentInput as l, type CreateCheckRunInput as m, type UpdateCheckRunInput as n, type UpdateInstallationInput as o, type UpdateRepoInput as p, type SyncReposInput as q, type CreateProjectInput as r, type UpdateProjectInput as s, type ListProjectsInput as t, GitHubError as u, NotFoundError as v, PermissionError as w };
