import * as ai from 'ai'; import { tool } from 'ai'; import { d as WarpGrepToolConfig, c as WarpGrepContext, b as WarpGrepResult, g as GitHubSearchToolConfig, h as GitHubReadFileToolConfig, f as GitHubReadFileResult } from '../../types-qwD753FR.js'; export { formatResult } from './client.js'; import './providers/types.js'; import '../utils/resilience.js'; import './agent/types.js'; import '../../core/client.js'; import '../../core/resource.js'; /** * Raw JSON Schema for warp grep input (no Zod dependency). * Use this with jsonSchema() from 'ai' if you have Zod version conflicts. * * @example * ```typescript * import { jsonSchema } from 'ai'; * import { warpGrepJsonSchema, createWarpGrepToolWithSchema } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const grepTool = createWarpGrepToolWithSchema({ * repoRoot: '.', * inputSchema: jsonSchema(warpGrepJsonSchema), * }); * ``` */ declare const warpGrepJsonSchema: { type: "object"; properties: { search_term: { type: "string"; description: string; }; }; required: readonly ["search_term"]; additionalProperties: false; }; /** Type for the model-facing warp grep tool input (snake_case to match JSON schema) */ type WarpGrepToolInput = { search_term: string; }; /** * Extended config that accepts a custom inputSchema */ interface WarpGrepVercelConfig extends WarpGrepToolConfig { /** * Custom Zod schema or AI SDK schema. Use this to provide your own Zod instance * to avoid version conflicts between your project and the SDK. * * @example Using your own Zod * ```typescript * import { z } from 'zod'; // Your Zod version * * const grepTool = createWarpGrepTool({ * repoRoot: '.', * inputSchema: z.object({ * search_term: z.string().describe('Search problem statement'), * }), * }); * ``` * * @example Using jsonSchema (no Zod needed) * ```typescript * import { jsonSchema } from 'ai'; * import { warpGrepJsonSchema } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const grepTool = createWarpGrepTool({ * repoRoot: '.', * inputSchema: jsonSchema(warpGrepJsonSchema), * }); * ``` */ inputSchema?: Parameters[0]['inputSchema']; } /** * Execute warp grep search * * @param input - Tool input with search_term * @param config - Configuration with repoRoot and optional provider * @returns Search results */ declare function execute(input: { search_term: string; }, config: WarpGrepToolConfig): Promise; /** * Create Vercel AI SDK warp grep tool * * @param config - Configuration options * @returns Vercel AI SDK tool * * @example Local usage (uses SDK's Zod) * ```typescript * import { generateText } from 'ai'; * import { anthropic } from '@ai-sdk/anthropic'; * import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const grepTool = createWarpGrepTool({ repoRoot: '.' }); * * const result = await generateText({ * model: anthropic('claude-sonnet-4-5-20250929'), * tools: { grep: grepTool }, * prompt: 'Find authentication middleware' * }); * ``` * * @example With your own Zod (avoids version conflicts) * ```typescript * import { z } from 'zod'; // Your project's Zod * import { createWarpGrepTool } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const grepTool = createWarpGrepTool({ * repoRoot: '.', * inputSchema: z.object({ * search_term: z.string().describe('Search problem statement'), * }), * }); * ``` * * @example Without Zod (using jsonSchema) * ```typescript * import { jsonSchema } from 'ai'; * import { createWarpGrepTool, warpGrepJsonSchema } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const grepTool = createWarpGrepTool({ * repoRoot: '.', * inputSchema: jsonSchema(warpGrepJsonSchema), * }); * ``` * * @example Remote sandbox (E2B, Modal, etc.) * ```typescript * const grepTool = createWarpGrepTool({ * repoRoot: '/home/repo', * remoteCommands: { * grep: async (pattern, path) => (await sandbox.run(`rg '${pattern}' '${path}'`)).stdout, * read: async (path, start, end) => (await sandbox.run(`sed -n '${start},${end}p' '${path}'`)).stdout, * listDir: async (path, maxDepth) => (await sandbox.run(`find '${path}' -maxdepth ${maxDepth}`)).stdout, * }, * }); * ``` */ declare function createWarpGrepTool(config: WarpGrepVercelConfig): ai.Tool; }[]; } | undefined; }>; /** * Create a GitHub search tool for Vercel AI SDK * * @param config - Configuration options (morphApiKey, morphApiUrl, codeSearchUrl, timeout) * @returns Vercel AI SDK tool * * @example * ```typescript * import { generateText } from 'ai'; * import { anthropic } from '@ai-sdk/anthropic'; * import { createGitHubSearchTool } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const githubTool = createGitHubSearchTool({ morphApiKey: process.env.MORPH_API_KEY }); * * const result = await generateText({ * model: anthropic('claude-sonnet-4-5-20250929'), * tools: { githubSearch: githubTool }, * prompt: 'How does auth work in vercel/next.js?' * }); * ``` */ declare function createGitHubSearchTool(config: GitHubSearchToolConfig): 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 a GitHub read file tool for Vercel AI SDK * * @param config - Optional configuration (timeout) * @returns Vercel AI SDK tool * * @example * ```typescript * import { generateText } from 'ai'; * import { anthropic } from '@ai-sdk/anthropic'; * import { createGitHubReadFileTool } from '@morphllm/morphsdk/tools/warp-grep/vercel'; * * const readFileTool = createGitHubReadFileTool(); * * const result = await generateText({ * model: anthropic('claude-sonnet-4-5-20250929'), * tools: { readFile: readFileTool }, * prompt: 'Read the package.json from vercel/next.js' * }); * ``` */ declare function createGitHubReadFileTool(config?: GitHubReadFileToolConfig): ai.Tool<{ path: string; github: string; branch?: string | undefined; startLine?: number | undefined; endLine?: number | undefined; }, GitHubReadFileResult>; export { type WarpGrepToolInput, type WarpGrepVercelConfig, createGitHubReadFileTool, createGitHubSearchTool, createWarpGrepTool, createWarpGrepTool as default, execute, warpGrepJsonSchema };