import { ApplyEditInput, ApplyEditConfig, ApplyEditResult, EditChanges } from './types.js';
import '../utils/resilience.js';

/**
 * Edge-compatible code application API
 *
 * This module works on:
 * - Node.js
 * - Cloudflare Workers
 * - Vercel Edge Functions
 * - Deno Deploy
 * - Browser environments
 *
 * For file-based operations, use executeEditFile from core.ts
 */

/**
 * Generate a unified diff between two strings
 */
declare function generateUdiff(original: string, modified: string, filepath: string): string;
/**
 * Count changes from a unified diff
 */
declare function countChanges(original: string, modified: string): EditChanges;
/**
 * Call Morph Apply API to merge code edits
 * Uses OpenAI SDK for reliable connection handling, retries, and timeouts
 */
declare function callMorphAPI(originalCode: string, codeEdit: string, instructions: string, filepath: string, config: ApplyEditConfig): Promise<{
    content: string;
    completionId?: string;
}>;
/**
 * Apply an edit to code directly without file I/O
 *
 * This is the edge-compatible code-in/code-out API that accepts code content directly
 * and returns the merged result without reading or writing any files.
 *
 * Works on Cloudflare Workers, Vercel Edge Functions, Deno, and browsers.
 *
 * @param input - Code and edit parameters
 * @param config - Optional configuration
 * @returns Result with merged code
 *
 * @example
 * ```typescript
 * import { applyEdit } from '@morphllm/morphsdk';
 *
 * const result = await applyEdit({
 *   originalCode: fs.readFileSync('file.ts', 'utf-8'),
 *   codeEdit: '// ... existing code ...\nconst newVar = 42;\n// ... existing code ...',
 *   instructions: 'Add a new variable',
 *   // filepath is accepted but does nothing
 * });
 *
 * if (result.success) {
 *   fs.writeFileSync('file.ts', result.mergedCode);
 * }
 * ```
 */
declare function applyEdit(input: ApplyEditInput, config?: ApplyEditConfig): Promise<ApplyEditResult>;

export { applyEdit, callMorphAPI, countChanges, generateUdiff };
