/**
 * Apply a target string to a Y.Text via a Yjs-aware text diff.
 *
 * Why this exists: the previous "sync Y.Doc from disk" path did a blind
 * `ytext.delete(0, ytext.length); ytext.insert(0, target)`. That:
 *   - Invalidated every Y.UndoManager stack referencing the old chars.
 *     Pressing undo after an external write could resurrect deleted content.
 *   - Invalidated every relative-position cursor anchor created via
 *     `Y.createRelativePositionFromTypeIndex`. Cursors flickered or jumped
 *     to nonsense positions.
 *   - Silently destroyed user edits that were in the live Y.Doc but not yet
 *     reflected in the .md file when an agent or external process wrote it.
 *   - Wrote the entire content under the server's clientID. When merging
 *     with a connected client that retained its own clientID's version of
 *     the same text, the CRDT kept both insertions and the document doubled.
 *
 * The fix: diff the current ytext against the target, apply only the
 * differences as ytext.delete/insert ops within a single transaction.
 * Chars in equal regions retain their original `(clientID, clock)` — Yjs
 * treats them as untouched. Cursor anchors in equal regions resolve
 * correctly. Undo stacks see one atomic merge step instead of a full
 * delete-then-insert pair.
 */
import * as Y from 'yjs';
/**
 * Mutate `ytext` in place so its content equals `target`. Mutations happen
 * inside a single `ydoc.transact` with the given origin tag so observers can
 * filter the merge from user-driven edits.
 *
 * No-op when ytext already equals target (no transaction, no event).
 */
export declare function applyTextDiff(ydoc: Y.Doc, ytext: Y.Text, target: string, origin: string): void;
