/**
 * Merge Engine
 *
 * Three-way file-level merge with text-based fallback (Tier 0 / P3).
 * Merges a source branch into the current branch by:
 *   1. Finding the common ancestor (fork point) in the op stream
 *   2. Building file states at ancestor, ours, and theirs
 *   3. Producing a merged file state or conflicts
 *
 * DESIGN.md §4.4 — Patch Commutativity and Conflict Detection
 */
import type { BlobResolver } from './blob-resolver.js';
import { type FileState } from './diff.js';
export interface MergeConflict {
    path: string;
    kind: 'modify-modify' | 'modify-delete' | 'add-add';
    /** Content from the current (ours) branch. */
    ours?: string;
    /** Content from the source (theirs) branch. */
    theirs?: string;
    /** Content from the common ancestor. */
    base?: string;
    /** For text conflicts: attempted merge with conflict markers. */
    mergedWithMarkers?: string;
}
export interface MergeResult {
    /** True if merge completed without conflicts. */
    clean: boolean;
    /** Merged file states to apply (path → content string). */
    mergedFiles: Map<string, string | null>;
    /** Conflicts requiring manual resolution. */
    conflicts: MergeConflict[];
    /** Summary stats. */
    stats: {
        added: number;
        modified: number;
        deleted: number;
        conflicted: number;
    };
}
/**
 * Perform a three-way merge given ancestor, ours, and theirs file states.
 */
export declare function threeWayMerge(base: Map<string, FileState>, ours: Map<string, FileState>, theirs: Map<string, FileState>, blobResolver?: BlobResolver | null): MergeResult;
export interface TextMergeResult {
    clean: boolean;
    merged: string;
}
/**
 * Three-way line-level text merge.
 * Uses a simple approach: diff base→ours and base→theirs, then interleave.
 * Produces conflict markers when both sides change the same region.
 */
export declare function threeWayTextMerge(baseText: string, oursText: string, theirsText: string): TextMergeResult;
//# sourceMappingURL=merge.d.ts.map