/**
 * Apply Patch Tool (Codex-inspired)
 *
 * Parses and applies unified diffs to files. The model outputs diffs
 * instead of full files, which is more token-efficient and safer.
 *
 * Supports:
 *   - Standard unified diff format (--- a/file, +++ b/file, @@ hunks)
 *   - Multiple file patches in one input
 *   - New file creation (--- /dev/null)
 *   - File deletion (+++ /dev/null)
 *   - Dry-run mode for preview
 */
import { ToolResult } from '../types/index.js';
export interface PatchHunk {
    oldStart: number;
    oldCount: number;
    newStart: number;
    newCount: number;
    lines: string[];
}
export interface FilePatch {
    oldPath: string;
    newPath: string;
    hunks: PatchHunk[];
    isNew: boolean;
    isDelete: boolean;
}
export interface ApplyPatchOptions {
    /** Working directory for relative paths */
    cwd?: string;
    /** Dry run — don't write files, just validate */
    dryRun?: boolean;
    /** Number of context lines to tolerate mismatch (fuzz factor) */
    fuzz?: number;
}
export interface PatchResult {
    file: string;
    applied: boolean;
    error?: string;
    hunksApplied: number;
    hunksTotal: number;
}
/**
 * Parse a unified diff string into FilePatch objects.
 */
export declare function parsePatch(diffText: string): FilePatch[];
/**
 * Apply a unified diff patch to one or more files.
 * Uses atomic rollback: if any file fails, all changes are reverted.
 */
export declare function applyPatch(diffText: string, options?: ApplyPatchOptions): Promise<ToolResult>;
/**
 * Preview what a patch would do without applying it.
 */
export declare function previewPatch(diffText: string, cwd?: string): Promise<ToolResult>;
