/** * True when a sketch line is an elision marker (`// ... existing code ...`, * `# ...`, bare `...` at column 0, etc.). * * Indented bare `...` / `…` WITHOUT an elision phrase is NOT a marker — that is * idiomatic Python Ellipsis (stub bodies, Protocol/ABC methods, `.pyi`). Comment- * wrapped markers and bare column-0 `...` stay markers so AI-style elision keeps * working; only the Python-shaped false positive is carved out. * @param {string} line * @returns {boolean} */ export function isElisionMarker(line: string): boolean; /** * Parse a sketch into content segments split on elision markers. * @param {unknown} sketch * @returns {{ok: true, segments: string[][], leading: boolean, trailing: boolean, markers: boolean} | {ok: false, reason: string}} */ export function parseSketch(sketch: unknown): { ok: true; segments: string[][]; leading: boolean; trailing: boolean; markers: boolean; } | { ok: false; reason: string; }; /** * Align a full sketch against the original file content. Original may be the * full text (CRLF tolerated) or a pre-split line array. Sketches without any * elision marker only apply to files of <= maxUnmarkedLines lines (whole-file * replace); anything larger is rejected as too risky to infer. * @param {string | string[]} original * @param {unknown} sketch * @param {{maxUnmarkedLines?: number}} [opts] * @returns {{ok: true, ops: WarpOp[], tierMax: number} | {ok: false, reason: string}} */ export function alignSketch(original: string | string[], sketch: unknown, opts?: { maxUnmarkedLines?: number; }): { ok: true; ops: WarpOp[]; tierMax: number; } | { ok: false; reason: string; }; /** * Coalesce aligned ops into ONE byte-exact old_string/new_string replacement * spanning first..last changed line, grown symmetrically until old_string is * unique in fullText. All-or-nothing on any harness — no MultiEdit needed. * @param {string[]} origLines * @param {string} fullText joined origLines (caller supplies the snapshot's fullText) * @param {WarpOp[]} ops monotonic non-overlapping ops from alignSketch * @returns {{ok: true, i0: number, i1: number, oldString: string, newString: string} | {ok: false, reason: string}} */ export function lowerOpsToSpan(origLines: string[], fullText: string, ops: WarpOp[]): { ok: true; i0: number; i1: number; oldString: string; newString: string; } | { ok: false; reason: string; }; export const WARP_EDIT: boolean; export type WarpOp = { /** * first replaced original line index (0-based, inclusive) */ i0: number; /** * last replaced original line index (inclusive; >= i0) */ i1: number; /** * replacement lines */ newLines: string[]; /** * match tier that placed this op (1 exact, 2 normalized) */ tier: number; };