/** * Ported from opencode (https://github.com/opencodenpm/opencode). * Original by opencode contributors. * Adapted for llxprt-code by Vybestack. */ /** * Type definition for replacer functions that generate potential matches */ export type Replacer = (content: string, find: string) => Generator; /** * Levenshtein distance algorithm implementation */ export declare function levenshtein(a: string, b: string): number; /** * Simple exact match replacer */ export declare const SimpleReplacer: Replacer; /** * Replacer that matches lines with trimmed content */ export declare const LineTrimmedReplacer: Replacer; /** * Replacer that matches blocks using first and last line anchors with fuzzy middle content */ export declare const BlockAnchorReplacer: Replacer; /** * Replacer that normalizes whitespace before matching */ export declare const WhitespaceNormalizedReplacer: Replacer; /** * Replacer that matches content regardless of indentation level */ export declare const IndentationFlexibleReplacer: Replacer; /** * Replacer that handles escape sequences */ export declare const EscapeNormalizedReplacer: Replacer; /** * Replacer that yields all exact matches for handling multiple occurrences */ export declare const MultiOccurrenceReplacer: Replacer; /** * Replacer that tries to match trimmed versions of the find string */ export declare const TrimmedBoundaryReplacer: Replacer; /** * Replacer that uses first and last lines as context anchors with similarity checking */ export declare const ContextAwareReplacer: Replacer; /** * Main fuzzy replace function that tries multiple replacement strategies * @param content - The content to search in * @param oldString - The string to find and replace * @param newString - The replacement string * @param replaceAll - Whether to replace all occurrences (default: false) * @returns Object with result and occurrences count, or null if no replacement was made */ export declare function fuzzyReplace(content: string, oldString: string, newString: string, replaceAll?: boolean): { result: string; occurrences: number; } | null;