import { WarpGrepStep } from './agent/types.js'; import { W as WarpGrepClientConfig, a as WarpGrepInput, b as WarpGrepResult, G as GitHubSearchInput, e as GitHubReadFileInput, f as GitHubReadFileResult, d as WarpGrepToolConfig } from '../../types-qwD753FR.js'; import { MorphAPIClient } from '../../core/client.js'; import { APIResource } from '../../core/resource.js'; import '../utils/resilience.js'; import './providers/types.js'; /** * WarpGrep client for programmatic code search */ /** * WarpGrep client for programmatic code search * * @example * ```typescript * import { WarpGrepClient } from '@morphllm/morphsdk'; * * const client = new WarpGrepClient({ morphApiKey: process.env.MORPH_API_KEY }); * * // Simple usage - defaults to LocalRipgrepProvider * const result = await client.execute({ * searchTerm: 'Find authentication middleware', * repoRoot: '.' * }); * * // With custom excludes * const result = await client.execute({ * searchTerm: 'Find database models', * repoRoot: '.', * excludes: ['node_modules', '.git', 'dist'] * }); * ``` * * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).warpGrep`). * Standalone clients remain only for backwards compatibility and may be removed in a future * major version — do not use them in new code. */ declare class WarpGrepClient extends APIResource { private config; constructor(clientOrConfig?: MorphAPIClient | WarpGrepClientConfig); /** * Execute a code search * * @param input - Search parameters including searchTerm, repoRoot, and optional provider * @returns Search results with relevant code contexts, or an AsyncGenerator if streamSteps is true * * @example * ```typescript * // Standard execution * const result = await client.execute({ * searchTerm: 'Find authentication middleware', * repoRoot: '.' * }); * * if (result.success) { * for (const ctx of result.contexts) { * console.log(`File: ${ctx.file}`); * console.log(ctx.content); * } * } * * // Streaming execution * const stream = client.execute({ * searchTerm: 'Find auth middleware', * repoRoot: '.', * streamSteps: true * }); * * for await (const step of stream) { * console.log(`Turn ${step.turn}:`, step.toolCalls); * } * ``` */ execute(input: WarpGrepInput & { streamSteps: true; }): AsyncGenerator; execute(input: WarpGrepInput & { streamSteps?: false | undefined; }): Promise; /** * Search a public GitHub repository * * @example * ```typescript * // Simple usage * const result = await client.searchGitHub({ * searchTerm: 'Find authentication middleware', * github: 'vercel/next.js', * }); * * // With streaming * const stream = client.searchGitHub({ * searchTerm: 'Find auth middleware', * github: 'https://github.com/vercel/next.js', * streamSteps: true, * }); * for await (const step of stream) { * console.log(`Turn ${step.turn}:`, step.toolCalls); * } * ``` */ searchGitHub(input: GitHubSearchInput & { streamSteps: true; }): AsyncGenerator; searchGitHub(input: GitHubSearchInput & { streamSteps?: false | undefined; }): Promise; /** * Read a single file from a public GitHub repository * * @example * ```typescript * const result = await client.readGitHubFile({ * github: 'vercel/next.js', * path: 'src/server/app-render/index.tsx', * startLine: 1, * endLine: 50, * }); * if (result.success) console.log(result.content); * ``` */ readGitHubFile(input: GitHubReadFileInput): Promise; private _resolveGitHubRepo; private _searchGitHubAsync; private _searchGitHubStreaming; } /** * Execute a warp grep search directly * * @param input - Search parameters * @param config - Optional client configuration * @returns Search results, or an AsyncGenerator if streamSteps is true * * @example * ```typescript * import { executeWarpGrep } from '@morphllm/morphsdk/tools/warp-grep'; * * const result = await executeWarpGrep({ * searchTerm: 'Find authentication middleware', * repoRoot: '.' * }); * * // Streaming * const stream = executeWarpGrep({ * searchTerm: 'Find auth', * repoRoot: '.', * streamSteps: true * }); * for await (const step of stream) { * console.log(step.turn, step.toolCalls); * } * ``` */ declare function executeWarpGrep(input: WarpGrepInput & { streamSteps: true; }, config?: WarpGrepClientConfig): AsyncGenerator; declare function executeWarpGrep(input: WarpGrepInput & { streamSteps?: false | undefined; }, config?: WarpGrepClientConfig): Promise; declare function executeToolCall(input: { search_term: string; } | string, config: WarpGrepToolConfig): Promise; /** * Streaming version of executeToolCall that yields WarpGrepStep for each turn. */ declare function executeToolCallStreaming(input: { search_term: string; } | string, config: WarpGrepToolConfig): AsyncGenerator; /** * Read a single file (or line range) from a public GitHub repository */ declare function executeGitHubReadFile(input: GitHubReadFileInput, config?: { timeout?: number; }): Promise; /** * Format a GitHub read file result for display or tool responses */ declare function formatGitHubReadFileResult(result: GitHubReadFileResult): string; /** * Format warp grep results for display or tool responses * * @param result - The search result * @returns Formatted string representation */ declare function formatResult(result: WarpGrepResult): string; export { WarpGrepClient, executeGitHubReadFile, executeToolCall, executeToolCallStreaming, executeWarpGrep, formatGitHubReadFileResult, formatResult };