/**
 * Fuzzy edit-replacer cascade.
 *
 * Adapted from sst/opencode (`packages/opencode/src/tool/edit.ts`), which
 * in turn credits cline and gemini-cli as upstream:
 *   - https://github.com/cline/cline/blob/main/evals/diff-edits/diff-apply/diff-06-23-25.ts
 *   - https://github.com/google-gemini/gemini-cli/blob/main/packages/core/src/utils/editCorrector.ts
 *
 * Why this exists: small models routinely emit `old_string` with subtly
 * wrong indentation, whitespace, or `\n`-vs-`\\n` escaping. A strict
 * exact-match `indexOf` rejects these and the model retries with marginally
 * different whitespace, looping until the agent's duplicate-tool-call guard
 * trips. The cascade gives each candidate a series of progressively-fuzzier
 * passes; the first one that yields a uniquely-matchable substring in the
 * actual file content wins. This converts a class of edit-loop failures
 * into successful edits without changing the agent's prompt.
 *
 * Each replacer is a generator that yields candidate substrings present in
 * `content`. The orchestrator (`replaceWithCascade`) picks the first
 * candidate that occurs exactly once.
 */
export type Replacer = (content: string, find: string) => Generator<string, void, unknown>;
/** Exact-match. The original `indexOf` behaviour. */
export declare const SimpleReplacer: Replacer;
/** Match line-by-line ignoring per-line leading/trailing whitespace. */
export declare const LineTrimmedReplacer: Replacer;
/**
 * Anchor on the first and last lines of a multi-line block, fuzzy-match the
 * middle. Useful when the model gets the structural anchors right but
 * miscopies an intermediate line.
 */
export declare const BlockAnchorReplacer: Replacer;
/** Collapse all whitespace runs to single spaces and compare. */
export declare const WhitespaceNormalizedReplacer: Replacer;
/**
 * Strip the common leading indentation across both `find` and content blocks
 * before comparing. Useful when the model emits a snippet without the
 * surrounding indentation that the file actually has.
 */
export declare const IndentationFlexibleReplacer: Replacer;
/** Handle backslash-escapes in the model's `find` string (\\n, \\t, etc.). */
export declare const EscapeNormalizedReplacer: Replacer;
/** Trim leading/trailing whitespace from `find` before searching. */
export declare const TrimmedBoundaryReplacer: Replacer;
/**
 * Same anchor strategy as BlockAnchorReplacer but with a relaxed similarity
 * threshold (50% line overlap instead of Levenshtein-weighted). Catches
 * cases the anchor replacer misses on heavily-modified middles.
 */
export declare const ContextAwareReplacer: Replacer;
/** Yield each occurrence of an exact-match `find` (used for replaceAll). */
export declare const MultiOccurrenceReplacer: Replacer;
/**
 * Apply the cascade. Returns the post-replacement content if a unique
 * candidate is found at any tier; throws with a descriptive error
 * otherwise. Mirrors opencode's `replace` orchestrator.
 */
export declare function replaceWithCascade(content: string, oldString: string, newString: string, replaceAll?: boolean): string;
//# sourceMappingURL=edit-file-replacers.d.ts.map