# Changelog

> Release history for revise, the Revise Editor SDK.

## 4.6.0

### Added

- **Optional `@reviseio/assets` companion package** for self-hosting optional static assets (`fonts/`, `katex.min.css`, and `tree-sitter/`). Run `npx @reviseio/assets copy public/revise` (copies `fonts/` and `katex.min.css` by default; pass `--tree-sitter` / `--full` for `revise/full` grammars or `--no-cjk` to omit CJK fallback fonts) and call `setAssetBaseUrl("/revise")`. Also exports `assetsDir`, `manifest`, and `copyAssets()` for Node servers and build tools.
- **`setAssetBaseUrl(false)` (or `""`)** to disable all remote fetches to `revise.io` when you rely on installed/web fonts and don't need hosted fallback fonts, KaTeX, or Tree-sitter. `setAssetBaseUrl()` is also exported from `revise/server`.
- **Automatic local font discovery in `revise/server`:** when `@reviseio/assets` is installed (or `REVISE_ASSETS_DIR` is set), `doc.export({ format: "pdf" })` reads fallback fonts from disk before attempting any network fetch.

### Changed

- **PDF export WASM and pdf.js import assets are now bundled directly in `revise`** (and the PDF writer WASM is bundled in `@reviseio/cli`'s runtime). Browser bundlers serve `revise_pdf_bg.<hash>.wasm`, the pdf.js worker, and the OpenJPEG codec from your app's own origin automatically, and `revise/server` reads the PDF writer WASM straight off disk—no `wasm/` or `pdfjs/` mirroring and no Node `public/wasm/` directory are required.

## 4.5.0

### Added

- `agent.stagingWorker` on `ReviseEditor` (opt-in): the built-in agent's edits are validated and planned in a Web Worker and the page only commits the result, so typing and scrolling stay smooth while many edits arrive. Pass `() => new Worker(new URL("revise/staging-worker", import.meta.url), { type: "module" })`; the new `revise/staging-worker` entry is that worker. It is an ES module sharing the editor's chunks, so the host's bundler must build workers as modules (Vite: `worker: { format: "es" }`). An edit the worker cannot handle is applied on the main thread, as without the option.
- `settings.trackedChanges.strictMode` on `ReviseEditor` (default `true`): agent and tool edits never rewrite, fold in or withdraw another author's pending suggestion (a person, another agent or conversation, an imported Word redline); the edit is laid beside it, or refused with nothing changed. `false` lets the edit win, and rejecting it does not bring back what it overwrote. People typing in suggesting mode are unaffected.
- The built-in agent can split a whole-document task, such as a proofread, into chunks of about 2,000 words (`run_subagents`), each suggesting edits and comments only inside its chunk, and has a `duplicate_blocks` tool that copies a run of blocks as tracked insertions in one undo step. Neither is added to `editor.tools`.
- Agent and tool edits can insert section breaks (`insert_block` with `<section-break />` alone), number or un-number one section (`set_page_layout` with `sectionIndex` and `showPageNumbers`, which keeps other header and footer text), indent list items and paragraphs (`style_blocks` `leftIndent`, `firstLineIndent` and the new `rightIndent`), and style list items at one level (`li[data-indent-level="N"]`). Layout-changing calls report the new page count.
- Ruby annotations (`<ruby>`, `<rp>`) survive rich paste and agent HTML and are drawn above their base text on the canvas and in PDF; .docx export writes each reading in parentheses after its base.
- Tables keep their direction: an RTL table keeps its first column on the right while editing and in PDF, .docx and HTML export.
- Row headers (`<th scope="row">`, `role="rowheader"`) are kept through HTML import and export, and an HTML table's `<caption>` stays with its table through editing, copy, paste and moves. Tagged PDF tags row headers as row-scoped, puts captions inside their table and gives merged cells `RowSpan`/`ColSpan`.
- PDF export bundles Noto fonts for Cherokee, N'Ko and Mongolian, which came out as boxes. Hosts that mirror `fonts/` need the new files; the package adds `FONT-LICENSE-NOTO-ADDITIONAL-SCRIPTS.txt`.

### Changed

- PDF export draws Times New Roman and Times with TeX Gyre Termes, a much closer match than Liberation Serif (which still covers Cyrillic and Greek). Hosts that mirror `fonts/` need the four `texgyretermes-*.otf` files; the package adds `FONT-LICENSE-TEX-GYRE-TERMES.txt`. The PDF writer under `wasm/` was rebuilt, so hosts that mirror it must refresh it.
- On Chromium, a PDF export from the ribbon asks once per browser for Local Font Access when the document uses an installed font Revise does not ship, so the PDF embeds the real font. `tools.export()` never prompts, but uses access already granted.
- Rich paste from other apps keeps the source's fonts and sizes; plain-text paste still takes the destination's formatting.
- Backspace at the start of a list item works as in Word and Google Docs, one undo step each: the item becomes an indented paragraph, then the indent goes, then it joins the item above. Backspace at the start of an indented paragraph removes one indent step. Suggesting mode keeps the old behavior.
- Tab and Shift+Tab never move focus out of an editable editor; Shift+Tab on an unindented line used to focus the ribbon's Export button. Tab on a list item's continuation line inserts a tab instead of nesting the item.
- Removing a list in editing mode toggles only the items under the caret or selection, not the whole list. Pasting copied list items into a list item merges them at the caret.
- Tables wider than their container are fitted to the page or cell on the canvas and in PDF, and images are scaled down to fit the printable page height; the authored sizes are kept for settings and export.
- The selection highlight sits behind the content, so it no longer hides under code-block, shading or cell fills.
- An agent comment that arrives with its edit shows as one card in the comments panel, with the change inline and Accept/Reject.
- Agent `replace` with several replacements applies the ones that can apply and lists the rest under `NOT APPLIED` with reasons; it skips matches that already read as the replacement ("Mr" → "Mrs" leaves "Mrs" alone). A width-only or height-only `style_blocks` image resize keeps the aspect ratio. Tool descriptions for `leave_comment`, `replace` and `remove_blocks` changed, which hosts passing them to their own model will see.
- Large agent and tool calls are much faster (removing half of a 5,000-block document took nearly five minutes), and long agent runs keep the page responsive: tool calls take turns with painting, and the comment threads behind `review.getState()` are worked out in one pass.
- When the built-in agent drafts into a blank document, the draft replaces the empty paragraph instead of starting below it. Its rollback picks what to undo by request or edit, proposes accepted edits back as suggestions, and skips and names blocks a person changed.
- Page layout changes carry into package-preserving .docx export.

### Fixed

- The editor bundles parse in WebKit without regex lookbehind (Safari before 16.4), and the canvas paints when `localStorage` is unavailable (Safari with cookies blocked, storage-restricted iframes); both used to fail.
- Keyboard: shortcuts work on non-Latin layouts such as Russian; Ctrl/Alt/Option+Backspace and Delete remove one word and join paragraphs at a boundary without eating the next word; Backspace after a vowel sign or accent removes only the mark; Shift+Arrow in mixed-direction text extends in logical order; Shift+PageUp/PageDown extend the selection; Option+Up/Down move by paragraph; End in a document with no body blocks no longer throws.
- IME composition is no longer discarded when a collaborator or the agent edits elsewhere, and a keyboard-extended selection survives a collaborator's update. Unrelated edits made within a second of each other are separate undo steps.
- Tables: collapsed Backspace and Delete no longer cross cells; typing over selected cells replaces their contents; Delete Row and Delete Column remove every selected row or column; navigation in nested tables uses the innermost table; pasting a range past the table's edge grows the table, merged cells keep their geometry, and tab-separated text fills the selected cells; copying cells with a pending replacement copies one version.
- Footnotes and endnotes: notes can no longer contain notes (`toolbar.insertFootnote()` returns `false` inside one); deleting a range or table removes the bodies of the notes it referenced, and undo restores them; typing, paste, copy and cut inside note bodies work across their paragraphs; text direction commands work inside notes.
- Find and Replace searches footnotes, endnotes, headers and footers, matches across bidi isolates, respects Turkish dotted and dotless I, keeps each match's marks, and no longer deletes characters around combining marks or expanded matches such as ß.
- Accepting or rejecting a formatting suggestion after someone typed in that paragraph keeps the typed text. Comments survive cut and paste, including a tracked move, and rejecting a move's destination keeps the source text. Two edits to one list no longer overwrite each other.
- Paste and HTML import keep multi-paragraph list items, nested lists inside wrappers, checklist states, equations, soft breaks, whitespace, physical indents, percentage column widths, row heights, per-cell and paragraph borders, inherited alignment and typography, `<mark>`, explicit ordinals and localized list numerals, and inline bidi scopes.
- .docx import keeps complex-script size, bold and italic, and Word's default LTR for paragraphs that start with Arabic. RTF import keeps tab stops and language tags. A .docx section without its own header or footer no longer repeats the previous section's.
- Layout: shaping survives a color change inside a word (Arabic joining, Devanagari conjuncts); Thai wraps at word boundaries; Japanese closing punctuation no longer starts a line; justified CJK lines and justified list items stretch; soft hyphens and zero-width spaces are break points; decimal tabs align on a decimal comma; RTL notes, headers and watermarks are placed correctly.
- PDF export: brackets and numbers in RTL text are balanced, copied Indic, Khmer and Arabic text is complete and in order, spaces between emoji keep their width, repeated table headers are tagged once, and exporting no longer turns the editor's emoji monochrome.
- Styled HTML export writes the contrasting text color shown on filled table cells.
- Agent tools: `replace` on code or math blocks writes text exactly as given, and a whole-block `replace` keeps the block's kind; table replacements keep captions and Word table properties; empty footnote markers create their note; `leave_comment` finds phrases with apostrophes; `search_document` treats a whitespace-only query literally; `read_table` and `remove_blocks` on partly read tables name the rows still to read.
- A built-in agent tool that finishes after Stop no longer breaks later messages, and edits made before a disconnect are kept.
- The link dialog accepts internationalized domains, and automatic links leave trailing `،` and `。` outside the link.
- Word Count counts supplementary characters once.

## 4.4.0

### Added

- PDF export has a new engine: the editor's own page painter recorded into [krilla](https://github.com/LaurenzV/krilla) (WebAssembly, loaded from your asset base URL on the first PDF export; the previous engine remains the fallback). Text in every script is real, shaped and searchable (Tamil, Malayalam, Devanagari, Thai, Khmer, Myanmar and others were drawn as outlines before), files are several times smaller, and long documents in those scripts no longer fail. PDFs are tagged for accessibility (headings, paragraphs, lists, tables, figures with alt text, TOC, links, notes), with heading bookmarks, clickable links, TOC entries and footnote references, page labels and document language. Hosts that mirror Revise's assets should mirror `wasm/` alongside `fonts/`, and refresh it with every release: the writer's file name changes with its contents. In Node (`revise/server`), the writer is read from a `public/wasm` directory under the working directory when there is one, and otherwise fetched from revise.io once per process (about 2.2 MB), and pages are recorded on `@napi-rs/canvas` or `canvas`, whichever is installed. Without either, or when the writer cannot be loaded, export falls back to the previous engine.
- `ReviseDocument.export({ format: "pdf", pdfStandard })`: `"pdf-a-2b"`, `"pdf-a-3a"`, `"pdf-ua-1"` and the other PDF/A and PDF/UA levels. The export fails with the validator's reasons when the document cannot conform, and when the new engine cannot be loaded, since the previous engine cannot produce a conforming file.
- `showClipboardButtons` on `ReviseEditor` (default `true`): `false` hides Paste, Cut and Copy in the ribbon, for hosts such as sandboxed iframes where the browser blocks scripted clipboard access and only the keyboard shortcuts work. Without that group, Insert and Find stay visible at narrower widths.
- `review.selectComment(id, { openPanel: false })` selects a thread without opening the comments panel, for hosts that list threads in their own UI. The chrome guide has a tested narrow-host recipe (page width with and without the panel at 390/420/768px, reading zoom, toolbar modes).
- `tools.export({ format: "pdf", onWarnings, strict })`: `onWarnings` receives what a PDF export could not do faithfully (a font or math asset that did not load, missing glyphs, unavailable shaping), and `strict: true` rejects with the new `ReviseExportError` (`code: "export_degraded"`, `warnings`) instead of returning the file. `ReviseDocument.export({ strict: true })` on the server throws `ReviseError` with code `export_degraded` (the server engine leaves formulas out of PDFs, so a strict export refuses a document with math).
- While a PDF exports, the ribbon's Export button shows a progress ring, and a screen-reader status announces progress; the fallback engine shows a spinner.
- The comment thread's more menu has Minimize, which collapses expanded comments back to margin chips.
- Add Comment in the Review ribbon with nothing selected comments on the whole block under the caret (in a list, the item); it used to do nothing.
- Tables can have a header of several rows. Every leading .docx row marked as a header row (`w:tblHeader`) is imported and written back (only the first was), and HTML import takes every `<thead>` row, or the leading rows made only of `<th>` cells. On the canvas and in PDF, continuation pages repeat the whole header, including cells that span into the body; only the first row used to repeat, and nothing did when that row had a rowspan. Inserting or deleting rows inside the header, directly or as a suggestion, keeps the header on the same rows.

### Changed

- A table of contents exported to .docx has page numbers on every export path (`ReviseDocument.export`, `tools.export`, the ribbon and the server), written as Word PAGEREF fields to hidden `_Toc` bookmarks so Word recalculates them, with Revise's estimate as the cached value. Only the ribbon export used to print numbers.
- An exported .docx never ends its body with a table: an empty paragraph follows a final table, because Word for the web refuses such a file. Import drops it again.
- When a writable document that came from a .docx opens, blocks unchanged since import get back layout details older versions discarded (first-line, hanging and right indents, line-spacing rules, tab stops, table widths, inline image offsets). This happens once per document, never touches text, block IDs, revisions or edited blocks, and reaches collaborators as an ordinary update.
- Title and Subtitle paragraphs without a matching style in the document's stylesheet use a built-in look (Title 26pt, Subtitle 15pt in `#666666`); the canvas and server PDF drew them as body text while Word drew a title. A stylesheet style or explicit formatting still wins.
- A regenerated .docx declares the document's body font in its defaults (the imported default font, otherwise Arial); LibreOffice drew such files in a serif font.
- `set_page_layout` reports a call that changes nothing as "No change…" instead of "Page layout updated.", and a page-border result says whether the frame encloses the header and footer.
- Server page rendering (`renderPages()`) draws Cambria in the metric-compatible Caladea instead of Noto Serif, so line breaks match the PDF export. The package includes `FONT-LICENSE-CALADEA.txt`.
- PDF export sets Calibri text in Carlito, a metric-compatible font loaded from your asset base URL like the other PDF fonts, instead of a wider fallback face; hosts that mirror `fonts/` need the new Carlito files. The package includes `FONT-LICENSE-CARLITO.txt`.
- A .docx imports with Word's own defaults where the file states none: a document that sets no line spacing anywhere is single spaced (it was drawn at the editor's 1.4 and reached the next page several lines before Word), a package with no paragraph defaults at all gets Word's 1.16 lines and 8pt after, text whose run, styles and defaults name no font is Times New Roman (it was Arial), and table cells take their margins from the table, its style or Word's built-in zero (they had 8px on every side, so Word tables came in about twice as tall). Cell paragraphs take their table style's paragraph properties as Word applies them (Table Grid's single spacing and no space after). Paragraphs added in Revise or by an agent in such a document match it, and export leaves those defaults to Word.
- Table rows break across pages as in Word: a row that does not fit the rest of the page continues on the next one instead of moving there whole, unless the .docx marks it `w:cantSplit`. Header rows, rows with an exact height and rows whose cells start with an image or table stay whole. A page break inside a table cell no longer moves the cell's content to the next page (Word prints it as nothing); it is kept and written back.
- A section that starts on an odd or even page starts on a page of that parity, with a blank page before it when needed, as Word prints; the blank page has no header, footer, page number or notes. The fallback PDF engine does not insert it.
- Lists are spaced like Word: an item without spacing of its own takes the list's space before and after, between two items the larger of the first's After and the second's Before applies (they used to add up), and the gap after a list is its last item's After. In .docx export, items without spacing of their own sit together (each used to get the document gap as After). Nested levels import their numbering definition's indents (Word's 0.5in steps; they sat 20px apart), and sub-levels count from their own start and restart as the file says.
- Exact and at-least line heights stay absolute: every line of such a paragraph or list item is that height on the canvas, in PDF and in .docx, whatever the sizes of the text on it. Choosing a line spacing multiple for such a paragraph, in the menu or with `style_blocks` or `set_block_attribute`, makes it automatic, as in Word.
- Line numbers follow each section's settings on the canvas and in PDF: they restart where a section begins instead of at every page top, continuous sections sharing a page each use their own start and count-by, and paragraphs that suppress line numbers get none.
- A table of contents exported to .docx is written inside Word's Table of Contents content control (Word for the web drew a bare field's entries without their level indents), and a contents field with `\h` writes its entries as links to their headings.
- Agent HTML for tables writes the padding each cell shows: the table carries `data-cell-padding` and `data-cell-margins`, a cell's own sides ride `data-padding` (`"inherit"` when it only shows the table's), and an edited CSS padding wins over them. An unchanged round trip no longer gives every cell padding of its own. Styled HTML export writes each cell's resolved padding too.

### Fixed

- `editor.tools.execute()` and `call()` with `{ documentId }` (or a `document_id` in the input) run on that document when it is open in the background, as the routing guide shows; they used to throw "not scoped to this document handle".
- A tool call that names a document which is not open, still opening, or failed to open no longer throws from `execute()` or `executeDynamic()`: it returns `{ ok: false, error }` with `document_not_open`, `document_not_ready` or `document_open_failed`, and nothing falls back to the active document. `call()` throws it as a `ReviseToolError`. Null or non-object model input returns `invalid_input` on the browser and server surfaces.
- A controller from `editor.tools.forDocument(id)` or `editor.document(id).tools` refuses a different `document_id` with `document_scope_mismatch` instead of running on its own document or blaming a read-only source.
- A document whose open failed is reported as failed, with its error, by every controller and by `whenReady(id)` (which now rejects), instead of "still opening". Opening its ID again says to close it first.
- An ambiguous `replace` recommends `occurrence: "all"`, not a `replace_all` tool that no agent tool catalog (browser, server, native or MCP) exposes.
- An empty or non-string `document_id`/`documentId`, or the two naming different documents, returns `invalid_input` instead of running on the active document.
- A Node script that renders pages (`renderPages()`) and disposes its document now exits on its own. A stale-cursor cleanup timer kept the process alive; pages are also drawn on canvases created at their final size, since resizing an `@napi-rs/canvas` canvas aborted Node at exit, and a document with a diagram or formula no longer crashes the process with an uncaught jsdom `TypeError`.
- With the previous PDF engine (the fallback), Node PDF export shapes emoji, symbols and complex scripts such as Devanagari again: the bundled HarfBuzz runtime tried to open its inlined WebAssembly as a file path (`ENAMETOOLONG`), dropped those glyphs, and logged megabytes of base64 per export. A shaping font that still fails to load is reported in `ExportResult.warnings` with a one-line log.
- Tables keep their geometry when a document the SDK wrote is reopened from its own .docx: the last paragraph in a cell exports with no space after (rows grew by one paragraph gap each), a paragraph after a table carries the gap above it as Space Before, and a table under a paragraph with its own Space After no longer adds the document gap on top (as in Word). Spacing a Word file declares is kept as is.
- Whole-block comments (`review.addCommentToBlock`, `leave_comment` with `whole_block`) on a paragraph, an empty paragraph, an image or a table are anchored in the .docx and reopen, including in a document opened from Word, where the untouched paragraph used to keep its original bytes and drop the new anchor.
- A comment thread whose text was deleted is no longer lost silently on .docx export: `review.getState().commentThreads` marks it with the new `ReviseCommentThread.detached: true` (with `anchor: null` instead of a stale block), and `ReviseDocument.export({ format: "docx" })` checks the file it wrote and reports in `warnings` how many comments have no place in its text and will not reopen.
- `review.setSuggestionViewMode()` repaints the page; the canvas kept the previous view until a zoom change. In Final, accepted insertions and formatting changes draw as plain text, and in Original, rejected deletions do, instead of keeping their markup colour. In a view that cannot be edited (viewing mode, read-only), Final and Original also leave out whole inserted or deleted blocks, as a clean copy should; editable views keep them so the caret can't reach invisible content.
- Markdown keeps literal text: export escapes characters that would read back as markup (`*`, `_` at word edges, backticks, `[`, `<`, `\`, `~~`, an entity-like `&`, a `$` that could open math, block markers at a line start, and `|` in table cells), and import honors CommonMark backslash escapes and entity references, GFM escaped pipes in table cells, and code fences and inline code delimited by any number of backticks. Backslashes no longer double on every round trip, and a price such as "$5 and $10" is no longer read as math.
- `insert_table_column` refuses a call without an integer `referenceIndex` (or with an invalid `position` or `content`) before changing anything; it used to insert at the left edge and report "after column undefined". `edit_table_cells` names every missing field and any unknown one (for example `edits` instead of `cells`).
- PDF export no longer drops Arabic text next to `/`, `(`, `·`, `_` or `—` (bilingual labels, parenthesized Arabic, Arabic and Hebrew in one paragraph, italic Arabic), and brackets in right-to-left text are mirrored as on the canvas.
- PDF export keeps the Japanese prolonged sound mark `ー` and Simplified Chinese characters next to kana (`东京の`, `园艺`).
- PDF export no longer turns punctuation, currency or dashes right after an emoji (`🌱.`, `🍕€12`, `✅ — after`) into boxes, and emoji next to ☕ no longer come out as boxes.
- PDF export reports a warning for a character the embedded font has no glyph for, instead of losing it silently.
- A PDF exported while a font could not load (for example with revise.io unreachable) reports it in its warnings on every export, not only in a console line the first time; so does a formula that could not be drawn (left out of the PDF, as in the Node engine) or was drawn without the KaTeX fonts.
- A bullet list nested in a numbered list stays bulleted through Markdown import and export, HTML import, `read_blocks` and `copyAs("markdown")`; sibling sublists of different kinds at the same depth no longer overwrite each other.
- Markdown export indents nested items to the parent's content column (3 spaces under `1. `, 4 under `10. `), so CommonMark parsers keep the nesting; nested bullets export as `-`.
- Lists keep up to nine levels: deep levels indent and number on their own on the canvas, in PDF, Markdown and DOCX, and Tab/Shift+Tab move one level at a time.
- Reopening a .docx the SDK exported keeps a mixed numbered/bullet list as one list with its bullets; Word multilevel lists with bullet sublevels import as one list too.
- `toolbar.increaseIndent()` / `decreaseIndent()` (and the native indent buttons) nest and un-nest list items instead of returning false.
- HTML import collapses source whitespace like a browser: newlines inside `<p>` no longer become paragraph breaks, and indentation between list-item text and a nested list no longer leaks in.
- Dialogs the editor opens, such as Table Settings, mount in the editor's theme-scoped portal root instead of `document.body`, where they drew with a transparent background and invisible controls on a host page. Menus inside a dialog open inside it, above its overlay.
- The editor is its own stacking context (`isolation: isolate` on `.revise-editor-sdk-manager` and `.revise-editor-sdk`): comment cards and other inner layers no longer paint over a host's sheets or modals with a lower z-index on narrow pages.
- Text typed at machine speed keeps its order: a key pressed right after an `insertText` input (what Playwright's `keyboard.type` and CDP `Input.insertText` send for non-ASCII characters) no longer lands before it (`naïve café` → `nave caféï`), and back-to-back `insertText` events no longer swap (`日本語` → `日語本`). A click right after such input commits it at the old caret first. Tested with synthetic Chromium input only; native IME composition keeps its deferred commit.
- The editor lays out the document's own page size, orientation and margins (A5, landscape, 2in margins, …), on open and after `set_page_layout`; it showed every document on a Letter portrait page with 1in margins, so its line and page breaks and page count differed from `measure_document`, `renderPages()` and the PDF. A document marked pageless (`set_page_layout` with `pageless: true`, or a pageless cloud document) now shows pageless in the editor too, as in the Revise app.
- Headers and footers sit at their header/footer distance from the page edge, as in Word, on the canvas and in PDF export, instead of being centered in the margin: the distance a .docx declares (`w:pgMar w:header`/`w:footer`) is read and written back, and a document without one uses Word's default 0.49in, which is what the SDK's own .docx export always declared. With small margins a header used to print about 10pt from the paper edge, across a page border. A band taller than the room left before the body ends at the body margin instead of overlapping it (Word would push the body down instead).
- `set_page_layout` refuses a length it cannot read (`"20mm"`, `"12pt"`, `"wide"`) and changes nothing, naming the field and, for mm and pt, the value to send instead (`"2cm"`); it used to skip the field and report success. A `pageWidth`/`pageHeight` pair that matches no supported paper size (or only one of the two) is refused too, instead of snapping to the nearest preset. A margin, indent step or block spacing outside the supported range is still stored at the nearest bound, but the result now says so, and every successful result reads back the stored size, orientation, margins and columns.
- HTML import keeps a table `<caption>` as a paragraph (above the table, or below with `caption-side: bottom`); reads `<pre>` and `<pre><code>` as one code block with its lines, indentation and language, so a code block from Revise's own HTML export reopens as one; keeps a `<br>` inside a heading as a line break in that heading instead of turning the rest into body text; and no longer adds an empty paragraph for a `<br>` after bare text in a container such as `<blockquote>`.
- No export writes a `javascript:`, `vbscript:` or `data:` link any more: Markdown, DOCX and PDF export the link's text alone, as HTML already did (schemes are read the way a browser reads them, so `JavaScript:` and `java\tscript:` count). Other targets, custom schemes included, are written as stored. The formats guide documents the policy per format.
- A one-line `$$x^2$$` in Markdown imports as a formula; it used to become an empty formula that swallowed the paragraphs after it. An unclosed `$$` stays text.
- Markdown emphasis follows CommonMark both ways. Import reads italic after a bold span (`**bold** then *italic*`) and nested emphasis (`**bold *nested* bold**`); export nests bold and italic across runs instead of wrapping each run, and keeps spaces outside the delimiters (`**42** units`, not `**42 **units`). Bold or italic CJK text next to CJK punctuation (`**「強調」**です`) round-trips.
- Images inside table cells, including nested tables, are kept in a regenerated .docx with their paragraph indent; they used to be dropped.
- Word layout fidelity on the canvas, in PDF and through .docx round trips: minimum table row heights are honored, including in merged header rows; hanging indents keep their size (any hanging indent used to become one full step) and stay inside their cell or column; header text boxes positioned on the page sit at their page coordinates, and page-anchored pictures no longer take up height in the text; character scaling (`w:w`) affects wrapping and caret movement; auto line spacing uses the font's line box; imported list indents move with the indent buttons; copy and paste keep list and paragraph geometry.
- A .docx header with a logo and text shows the text on first open (only the logo drew until the first edit), and its paragraphs stay on separate lines instead of running together.
- Footer page fields from Word: a `PAGE` or `NUMPAGES` field written as `w:fldSimple` becomes one live field ("Page 1 of 2" used to show as "11" or "12"), and `PAGEREF`, `DATE` and other fields keep their cached text instead of turning into the page number.
- Line numbering starts where the .docx says: Word's `w:start` counts from zero, so a document numbered from 1 used to open in Word numbered from 2.
- A header or footer with text in only one column exports as an aligned paragraph instead of tab stops, which Word broke apart for a long right-aligned running header.
- When only the footer has a first-page variant, page 1 keeps the regular header in Word.
- Inline code keeps its code style in .docx when the run also has its own font.
- Imported images keep their aspect ratio: inline `data:` PNG, JPEG, GIF and WebP images in HTML and Markdown take a missing dimension from the image itself (an `<img width=600>` of a wide chart came out 600×200, an unsized image 200×200), Revise's own HTML export no longer hides its `height` attribute behind `height: auto`, and rotated JPEGs swap width and height.
- `toolbar.insertImage` with the caret in a list puts the image at the caret, splitting the list there with numbering continuing, as one undo step; it went above the list and left an empty numbered item.
- HTML input reads `<ol type="a|A|i|I|1">` and CSS `list-style-type` as the list's numbering.
- Tracked changes from different authors stay independent. An agent's correction inside a paragraph a person inserted as a suggestion is its own suggestion: accepting the paragraph leaves it pending, and rejecting the paragraph removes it too. An agent split, join or removal of such a pending paragraph is refused with the document unchanged. In .docx these export as sibling insertions that Word decides independently; accepting the person's insertion in Word used to accept the agent's correction too.
- All-caps and small-caps text with letter spacing no longer overlaps the following text when uppercasing adds letters (ß → SS, ﬃ → FFI); caret and hit-testing line up with each source character, and Greek words take their whole-word uppercase.
- Table of contents entries draw Tamil, Arabic, CJK and other scripts with the bundled fonts, like body text, instead of system fonts or empty boxes.
- React 18 hosts no longer lose the ref of the editor's scroll container in the context-menu wrapper, and React no longer warns about reading `ref` from props.
- The ribbon's Copy and Cut work when the Clipboard API is blocked (for example a sandboxed iframe without `clipboard-write`), through a native copy event.
- Toggle Comments in the Review ribbon is disabled when there are no open threads.
- Word for the web opens edited .docx exports for editing again: a regenerated header or footer reuses the original relationship to its part instead of adding a second one, which made Word for the web open the file read-only after editing a footer, an even-page header or adding a different first page. Editing a file exported with that defect drops the spare relationship.
- Edited runs keep their formatting in Word: run, paragraph, cell, table and section properties are written in Word's canonical order (Word for the web dropped out-of-order ones, so an edited Georgia run showed in the default face, and editing one cell hid its neighbours' fills); an explicit Arial survives on edited runs in files that name no default font; dotted, wavy and colored underlines are kept, in headers and footers too; and inline code inside prose in another font keeps a monospace face.
- A .docx the export has to regenerate instead of splicing carries the original theme, with the theme's relationships and images, so the body keeps its theme font and headings their theme color (Word showed Aptos).
- .docx exports of documents whose every run names its font (a PDF import's, for example) default to the body's main font instead of Arial, so the footnote numbers, fields and other text Word generates match the body; line numbers use the body's font as the editor draws them.
- Agent HTML carries `font-variant: small-caps` and `text-transform: uppercase` from a paragraph or heading's own `style` to its text; they were only read on `<span>`.
- Paragraph borders keep their text-to-border gap (`w:space`) through import and export, with closed corners, including after agent edits and in rejected tracked changes.
- Header and footer paragraphs keep their own tab stops, including stops they clear or inherit, through import, the Headers & Footers dialog and export; editing a footer used to move its right part to the margin. Header and footer runs take their paragraph and run styles and the document defaults (text in Word's Header style showed in the editor's default face).
- A negative left indent or a zero hanging indent in a style resets an inherited one, and a table style's justification follows Word's precedence over Normal.
- A Word table whose cells have no widths keeps Word's own column sizing after an edit while its columns are unchanged (edited cells were written at even widths); resizing, adding or removing a column writes widths, and rejecting a suggested column change restores Word's sizing.
- A page break inside a Word paragraph exports back inside one paragraph instead of three, and a page break inside a table cell is kept when the cell is edited (it was dropped).
- A page number inserted in the body exports as a `PAGE` field; it was plain text.
- Paragraph and cell shading patterns (such as pct25 or stripes) and their color survive export; Revise still paints the plain fill.
- A Word table of contents is no longer exported twice, the original beside the regenerated one, including when its field is split across runs, spelled with character references, or crosses a content control.
- Keep with next: a heading moves with a follower that keeps its lines together, a chain of kept paragraphs decides once so its first paragraph is never left alone, and a follower taller than a page splits, on the canvas and in PDF.
- Clicking text directly above a table places the caret instead of selecting a column, selecting cells from the table rail moves the caret into the anchor cell (typing went to the document start), and a click in a table cell that continues onto another page lands in its text.
- Margin comment chips and cards follow the editor when it is replaced under them; they kept the old document's comments until the caret moved.
- A dialog closes when its document moves to the background; it used to hide while the page stayed unclickable.
- The Review ribbon is centered in `toolbarMode="compact"`.

## 4.3.0

### Changed

- **Breaking:** Programmatic access uses `revise/server` and follows the Revise SDK license, including commercial-use requirements.
- `revise` includes its engine and TypeScript bindings; no separately installed runtime package is required.

### Fixed

- Inserting an image into an empty document no longer throws while checking whether the insertion targets a header or footer.

## 4.2.0

### Added

- **`migrateDocument(ydoc)`** (from `revise/server`):
  the one-time migration of table proposals stored by earlier versions.
  With your own collaboration provider, run it on your server when a
  document loads, before clients receive it; the browser editor never
  migrates a document it does not own alone. It is idempotent, and a
  migrated document carries `tableRecordsMigrated` in its metadata.
- **`refused` in decision results.** `acceptSuggestions`,
  `rejectSuggestions`, and the library's `accept`/`reject` may return
  `refused: [{ id, code }]` for IDs they left unresolved:
  `decision_unsupported_structure` when a proposal spanning several blocks
  could not be settled as a whole (nothing changed; it stays pending), or
  `decision_incomplete` if a decision failed partway (it should not happen;
  please report it).
- **`leave_comment` manages existing threads.** `action: "resolve"`,
  `"reopen"`, or `"delete"` with `reply_to_comment_id` (and no `comment`,
  `id`, or `anchor`) resolves, reopens, or deletes a thread. `delete`
  removes the whole thread with its replies. The default action, `comment`,
  creates or replies as before.

### Changed

- **Table tools need a prior read.** `insert_table_row`,
  `remove_table_rows`, `insert_table_column`, `remove_table_column`, and
  `replace_block` on a table act on the table as a read delivered it
  (`read_table`, or a block read that includes the table). Without a read
  they fail with `document_state_changed` and
  `failure.code: "table_not_read"`; if the table changed since the read,
  with `"table_stale"`. Nothing is changed: read the table, then retry. A
  call that would reorder an existing table's rows, cells, or cell blocks
  fails with `table_order_changed`.
- **Each tool call is one update.** A tool call runs in full before
  anything reaches the document, then lands as one Yjs update and one undo
  step. A call that fails partway leaves nothing behind. Before, the
  title, notes, footnote, and header-image changes it made before the
  failure stayed in the document.
- **Earlier calls' pending revisions stay their own.** Every SDK tool call
  is its own request. A later call never re-authors or silently withdraws
  a revision an earlier call (or a person) left pending: an edit inside
  its text becomes a separate revision beside it, and each is decided on
  its own. Where that cannot be represented, the call is refused with
  nothing changed: `pending_revision_withdrawal` (for example
  `remove_block` on a block an earlier call inserted and is still pending;
  accept or reject it first), `pending_list_changes` (list-level changes,
  adding or removing items, or rewriting a list that holds an earlier
  call's pending list revision), or `pending_table_changes` (a table edit
  that would rebuild a table holding another revision's pending rows or
  cells). Formatting-only changes to a list are separate revisions per
  item, so later calls can still format or edit those items.
- **Table task messages name row ids.** The table completion check,
  table summary, and task status list remaining empty cells by row id
  beside the 0-based `row_index` (for example
  `row_index 137,230 (row_ids row_138,row_231)`), so agents fill the right
  rows.

### Fixed

- **Tables edited by several people.** Peers editing one table at the
  same time no longer end up with two copies of it or lose each other's
  typing: row inserts and deletions, cell content, table, row, and cell
  properties, and decisions on table proposals are written into the
  existing table. Column operations, merges and splits, and rows across a
  vertically merged cell still rewrite the whole table. Documents with
  table proposals stored by earlier versions are migrated once (by
  `migrateDocument`, or at open when the editor or `ReviseDocument` owns
  the document alone); pending proposals, content, and export are
  unchanged. An agent edit in a table no longer re-authors other authors'
  pending row, cell, or imported Word grid revisions.
- **Tracked changes across DOCX round trips.** Each proposal exported to
  .docx reopens as one decidable proposal (the fragments carry an
  `rvse:group` attribute Word ignores), with its author and date; a
  revision without a date stays undated. Rejecting one author's inserted
  paragraph no longer deletes another author's insertion inside it.
  Other editors may drop the grouping when they save.
- **Word files from other producers.** Files whose XML uses other
  namespace prefixes (or a default namespace), the Strict namespaces and
  relationship types, or parts at unconventional locations open with
  their content instead of empty or failing. They export as a newly
  written package (`fidelity.fallbackCode: "nonCanonicalSource"`). ZIP
  entries nothing references no longer affect whether a file opens.
- **Malformed DOCX files are refused.** A package whose main document part
  is missing or not well-formed, whose content types or relationships are
  present but malformed, or that repeats a relationship Id fails with
  `import_failed` instead of opening with parts silently missing.
- **DOCX export of vertically merged cells.** `revise/server` exports of a
  table with a `rowspan` cell write well-formed XML; the continuation
  cell no longer takes the next row's attributes.
- **DOCX export of tabs** writes `w:tab` elements, so tab-aligned text and
  table-of-contents leaders line up in Word.
- **Read-only state is live.** Switching a document to viewing mode, or
  changing `role`, takes effect immediately for the review API and the
  tool list: mutating tools and decisions fail with `read_only` while
  viewing, and returning to editing restores them.
- **Independent edits keep their revision IDs.** Independent tool edits in
  plain paragraphs and list items keep earlier revision IDs and return
  only their own new IDs. Pending formatting survives later tracked text
  replacements and their rejection. Review changes that both insert and
  delete text report `kind: "delete"`, matching the replacement contract.
- **Sentence-boundary edits** leave unchanged words in joined or split
  sentences out of the revision, so they stay independently reviewable.
- **Collaboration startup errors.** A collaboration room whose shared
  document has an incompatible shape is reported once through `onError`
  and the document's load error, instead of crashing the editor or opening
  the seed locally. An inline `connect` factory no longer reconnects on
  every host render.
- **Review state is current.** Review snapshots include new suggestions
  and the current target without waiting for a render, and decisions act
  on the current state across mode and role transitions.
- **Concurrent insertions keep their authors.** Two people inserting text
  inside each other's pending insertions keep their own authorship.
- **Links.** Escape in the link editor no longer saves the draft; a URL
  prefilled from the selected text commits; a link draft keeps its text
  boundaries while the document changes. Tool replacements right after a
  hyperlink no longer take on its link.
- **Host focus.** Deferred focus restoration (after moving to the next
  comment or suggestion, or accepting with auto-advance or accept all) no
  longer takes focus back from an input, another editor, or a shadow-DOM
  editable the user moved to.
- **Headers and footers.** An image inserted with the caret in a header or
  footer column becomes that band's image instead of splitting the
  column, and a stored header column that is not a paragraph no longer
  breaks opening the document. Tool edits to header and footer text keep
  the column's formatting.
- **`style_blocks`** clears paragraph shading when given
  `backgroundColor: null`, `"none"`, or `"transparent"`, sets white shading
  as white, and maps `listStyleType` (`lower-alpha`, `upper-roman`, ...) to
  the list's numbering format, keeping imported numbering patterns and
  nested levels.
- **The caret** stays inside its line on tight line spacing.
- **PDF export** names Revise as the creating application.
- **Accessibility.** The editor's focused input is labeled "Document
  editor" instead of being `aria-hidden`.

## 4.1.0

### Added

- **`licenseKey`.** Pass your commercial license key to the editor:
  `<ReviseEditor licenseKey="revise-…" />`. The key is checked offline against
  Revise's signature and is never sent anywhere, so it is safe to ship in a
  client bundle. Without a valid key the editor works the same and logs one notice
  to the browser console per page load. See
  [licensing](https://revise.io/developer/docs/editor-sdk/license#license-key).
- **`revise/server`.** Added a server entry point exposing `ReviseDocument`, `seedYDoc`, and `agentTools`. The 2.x server names remain importable and throw a pointer to their replacements when used.

### Fixed

- **Page keys in a longer page.** PageUp, PageDown, Home, and End scroll the
  editor only when the keystroke is the editor's: when it has focus, when the
  key comes from inside it, or when the page around it cannot scroll. They no
  longer scroll the editor instead of the host page, or from inside the
  host's own inputs.
- **Document tabs.** The whole tab is clickable, not only its title text.

## 4.0.1

### Fixed

- **The package README** no longer shows a broken image.

## 4.0.0

The editor is the `revise` package.

### Added

- **Live lists of figures and tables.** `<toc source="captions">` lists
  the document's figure captions with page numbers and stays current as
  captions change; `label="Table"` (or any other label, such as Chart or
  Exhibit, matched literally) collects that kind instead. Appendix and
  supplementary numbers (A.2, S1, B-2) are listed. Word's `TOC \c "Label"`
  field imports as one and exports back as the same field, and the list
  renders in PDF, Markdown, RTF, and plain-text exports.
- **`join_paragraphs` joins ranges.** Pass
  `ranges: [{ firstId, lastId, separator? }]` (up to 100) to join each run
  of consecutive sibling paragraphs, such as lines pasted from a PDF,
  without retyping the text. Every range is checked first: if any is
  invalid, the call reports every problem and changes nothing. Each joined
  range is one tracked change.
- **Comment anchors across wrapped lines.** A `leave_comment` anchor, or a
  start/end anchor pair, whose text runs on into the following paragraphs
  is anchored across them, as long as every block it spans has been read.
  It used to fail with "Anchor text was not found". A miss now quotes the
  block's text or names a letter-case difference.
- **`showImportButton`.** With `onImportFile`, controls whether the ribbon
  shows Import (default true). Hosts that import only into an empty
  document (through `uploadPlaceholder`) or by drop can turn it off.
- **Per-edge cell borders and padding shorthand.** `style_blocks` on table
  cells takes `borderTop`, `borderRight`, `borderBottom`, and `borderLeft`.
  `none` sets that edge to no border, and `null` clears the setting. CSS
  padding shorthand such as `"7px 9px 7px 0"` is accepted (it was refused
  before).
- **`style_blocks` `fontVariant`** takes `small-caps` or `normal`.

### Changed

- **Install `revise`.** `npm i revise`, and import from `revise`,
  `revise/full`, `revise/version`, and `revise/style.css`. Projects on
  `@reviseio/editor` change the dependency and imports; see
  [upgrading](https://revise.io/developer/docs/editor-sdk/installation#upgrade-from-an-earlier-version).

- **`agent.run()` during a run waits its turn.** A second call while a
  run was in progress used to return at once without running. It now
  starts once the current run has finished, including a run that is still
  ending after an error or `cancel()`.
- **New table rows and columns match their neighbors.** They take the
  adjacent cell's borders, padding, shading, and vertical alignment. A row
  added under a shaded header row takes the body rows' formatting, and a
  row added to a table with alternating row shading continues the pattern.
  This applies to the editor's table commands and to `insert_table_row` and
  `insert_table_column`.
- **`replace_block` keeps paragraph layout.** A replacement paragraph keeps
  the replaced paragraph's alignment, indents, spacing, line height, named
  style, and text direction unless its HTML sets them. An explicit value,
  including `line-height: normal` or `data-style-id=""`, still changes it.
- **A `replace` find may span paragraphs.** A plain-text `find` containing
  line breaks can match the target block and the paragraphs right after
  it. Each replacement line goes into its own block, and text outside the
  match stays where it was. A miss explains the rule.
- **`join_paragraphs` keeps line-end hyphens.** Without a `separator`, a
  line ending in a hyphen followed by a lowercase word joins with no space
  ("exam-" + "ple" gives "exam-ple"). Other boundaries still get a space.
- **`remove_blocks` needs no read for page breaks and empty paragraphs.**
  Section breaks and empty paragraphs that carry formatting (horizontal
  rules, for example) still do.
- **Empty numbered list items show their number** in tool HTML
  (`data-marker`).
- **The word count shows pages and the selection.** The figures under the
  word count on the Tools tab show pages instead of characters (no page
  count in pageless documents). With text selected they read "N of M
  words" and "N of M pages". The selection count reads pending changes the
  same way the total does, so selecting everything matches the total.
- **The change at the caret stands out** with
  `settings.trackedChanges.markupStyle: "word"`. The tracked change under
  the caret, or the one Review navigation is on, gets a faint red
  highlight.
- **The ribbon keeps Export longest.** As the editor narrows, the full
  ribbon first reduces cut, copy, and paste to undo and redo, and the
  compact ribbon drops lists, then headings. Export and Import stay until
  only undo, redo, and the font controls are left. The compact ribbon shows
  Insert when there is room.
- **Clearer tool errors.** A negative `leftIndent` explains how to make a
  hanging indent, and `leftIndent` or `firstLineIndent` on a list item
  points to `indentLevel`. An `edit_table_cells` target inside a merged
  cell names the merged cell's `row_id` and column. A delegated agent's
  `move_blocks` refused only because of its own pending formatting says to
  roll that back, move, and reformat.
- **Delegated agent: whole-document reviews are held to coverage.** A
  review, audit, or summary that declares the whole document as its scope
  is sent back to the ranges it skipped, as edits already were. A finish
  reported as incomplete is not. A finish whose only edit is page setup on
  a document the agent hasn't read is asked once to confirm that page setup
  was the whole task.
- **Delegated agent: searches return up to 200 matches per page** (was 25).
  The `search_document` default for `tools.execute` is unchanged.
- **Delegated agent: `cancel()` keeps the reasoning so far.** The next
  `agent.run()` continues from the model's reasoning in the turns that
  finished instead of starting without it.
- **Delegated agent: long conversations reuse the prompt cache.** Earlier
  tool results and images are no longer trimmed from the history on each
  request. The history is summarized only near the model's context budget.
- **Delegated agent: `render_document_pages` with placeholders** returns
  the pages and marks the images and formulas it couldn't draw
  (`visualVerification: "incomplete"`). It used to refuse every page.

### Fixed

- **Footnotes and endnotes in suggesting mode stay with their references.**
  A later edit to a sentence holding a pending note's reference used to
  recreate the reference under the new suggestion or drop it, and rejecting
  either change left a note with no reference. Now the paragraph is edited
  around the reference, deletions over it are layered on top, and
  formatting never moves it. An edit that would rebuild the block (changing
  its type, splitting or joining it, or adding or removing list items
  around it) fails with `pending_footnote_reference` and changes nothing.
- **Pending notes are credited to the right author.** A person's deletion,
  or a note reference they type, inside an agent's pending text is credited
  to the person, not to the agent's request. A note the agent writes into a
  block it replaces no longer stops that block from being rejected.
- **Pending footnotes from Word.** A footnote or endnote reference inside a
  tracked insertion or deletion imports with its note as part of the same
  pending change, so accepting or rejecting settles both.
- **Footnote numbers with collaborators and undo.** Removing a note while a
  collaborator renumbers no longer brings it back. Numbers left stale by an
  undo are corrected on the next edit by any peer that can write, and undo
  or redo of a removed note keeps its reference. A collaborator's typing no
  longer makes every peer scan every paragraph of a long document, and two
  peers renumbering at once no longer produce wrong numbers.
- **Viewers no longer write to the document when they open it.** In
  `viewing` mode the editor applied legacy-format migrations and footnote
  repairs to the shared Y.Doc, where a sync server rejected them and the
  viewer's copy drifted. A viewer now shows a legacy document as it looks
  after migration, without writing. The migrations run once the session
  gets write access.
- **`replace` no longer rewrites similar paragraphs next to an exact
  match.** In a table, list, or other container, a `find` that matches one
  paragraph exactly no longer also fuzzy-matches near-identical paragraphs
  beside it ("Paragraph 9 opens…" no longer matches every "Paragraph N
  opens…"). `replace_all` never fuzzy-matches.
- **Fewer unnecessary "not fully read" refusals on tables.** Inserting a
  block before or after a partly read table, and an exact-text `replace`
  inside one (including `occurrence: "all"` and batches spanning several
  tables), no longer require reading the whole table. Whole-block and
  whole-cell edits still do.
- **`th` in `style_blocks` selectors** matches only the header row of a
  table that has one. It used to match every body cell in that column.
- **The agent's own edits no longer look like someone else's.** After a
  `style_blocks` call that restyled many blocks, editing one of them no
  longer fails as "edited after you last read it". A block that is really
  stale fails with the retryable `target_stale`. The agent's own edits no
  longer invalidate its other search results, and cells of a row or column
  it inserted as a pending change are no longer refused (or skipped while
  reporting success) by `edit_table_cells`.
- **Images in `replace_block`.** An image can be replaced with text,
  including when it is the document's only block (it failed with "not a
  directly editable text block"). Replacing an image keeps the referenced
  image's settings, CSS width and height in px set its size, and the result
  names CSS that images ignore. It used to fall back to 200×200 and report
  success.
- **A `replace` that matches an image's alt text** fails and says to use
  `replace_block` instead of reporting success without changing anything.
- **`style_blocks` `letterSpacing: "normal"`** means no extra spacing. It
  was rejected as not a number.
- **Web-search citation markers** that some OpenAI models emit are removed
  from tool arguments, so they no longer show up as boxes in text,
  footnotes, or comments.
- **PDF exports open in strict PDF readers.** Embedded TrueType fonts get
  spec-conformant font dictionaries (Identity ordering, a unique subset name
  per face, correctly scaled cap height, and correct italic flags). Pages
  look the same.
- **Pasting a table with an empty line before or after it**, such as one
  copied from Google Docs, pastes it. It used to do nothing.
- **Selection observers** no longer log "The selection endpoints no longer
  exist" when a change removes the blocks holding the caret (an import into
  the whole document, or a collaborator deleting them). The selection
  snapshot is empty until the caret is back in the document.
- **Ribbon menus** no longer overflow their bounds in hosts without a global
  `box-sizing` reset.
- **Delegated agent: a stalled model stream no longer hangs the run.** A
  turn that receives nothing for five minutes is retried once. A second
  stall in the same request ends the run with an error.
- **Delegated agent: whole-document coverage.** The coverage check credits
  every range the request read, including reads that were trimmed or
  repeated, reads from before a pause, and what a stopped request read
  before the next one. A short document laid out as a table no longer lets
  the agent stop as "incomplete" without trying, and the agent is sent back
  at most once per blocker.
- **Delegated agent: edits outside the user's selection** are no longer
  refused.
- **Delegated agent: removals after a clarifying question.** Blocks the
  agent read before asking can be removed in the answer's request without
  reading them again, if nobody has changed them since.
- **Delegated agent: page renders in a narrow editor** use the document's
  page layout. On phone-width editors, a multi-page document rendered as
  one long page.
- **Delegated agent: finishing with `completed_plan_steps` and no plan**
  creates the plan instead of failing.

### Security

- **jsPDF 4.2.1.** The bundled PDF writer moves from jsPDF 3.0.1 to a fork
  of 4.2.1, which clears the npm advisories filed against 3.0.1, including
  two critical ones. The fork leaves out `html()` and `addSvgAsImage()`,
  which Revise does not use. THIRD-PARTY-NOTICES.md now lists jsPDF and the
  packages it inlines (fflate, fast-png, pako, iobuffer, Babel helpers).

## 3.1.7

This release aligned the editor and runtime versions.

### Removed

- **`@reviseio/editor/server`.** Removed this entry point. For current server integration, see [`revise/server`](https://revise.io/developer/docs/editor-sdk/api/backend).

### Added

- **`uploadPlaceholder`.** With `onImportFile`, an empty document shows
  "Type or paste your text or [Upload] a document" until something is typed
  or pasted. Upload opens a file picker for the same formats as Import and
  hands the file to `onImportFile`. Off by default, and never shown in a
  read-only editor.
- **Markdown shortcuts while typing.** `#` through `######` and a space at
  the start of a paragraph make it a heading. Typing the closing delimiter of
  `**bold**`, `__bold__`, `*italic*`, `_italic_`, or `` `code` `` formats the
  text and removes the markers. Only keyboard typing converts (paste and
  agent edits don't), never in suggesting mode or inside code, and one undo
  restores the literal text. Like smart quotes, they're on in every editor;
  there is no prop to turn them off yet.
- **Failed tool results carry `details`** when the tool reported more than
  its message, for example `edit_table_cells`' per-cell `errors` and the
  `recovery_read` that fixes them (`ReviseToolFailure.details`, also on a
  thrown `ReviseToolError`'s `failure`).

### Changed

- **`revise` is an optional peer dependency** at the same version. Install
  it for server-side work; a browser-only host doesn't need it. `jsdom` is
  no longer a peer of this package (`revise` brings it).
- **`remove_blocks` accepts up to 200 ids** per call (was 50). A larger
  batch fails without removing anything and points to `search_result_id`.
- **`search_document` doesn't page through empty paragraphs.** When every
  match is an empty paragraph, asking for a later page fails and points to
  acting on all of them at once with `search_result_id`.
- **`insert_table_row` matches its neighbors.** Text in a new row takes the
  paragraph spacing, alignment, font, size, and color of the reference row's
  cell in the same column wherever the HTML leaves them unset. Bold and
  italic are not copied (the reference is often a totals row).
- **`<del>` in tool HTML** is strikethrough. A `<del data-change-id>` (how
  `revise` shows a tracked deletion) is left out, so HTML copied from a
  tracked read edits the text as it reads with changes accepted.
- **The delegated agent on long documents.** `agent.run()` and comment
  agents keep long requests within each model's context budget: earlier
  document snapshots leave the conversation and the latest read window is
  sent again. When a document-wide edit leaves thousands of blocks pending,
  the document overview lists a sample of them with the total instead of
  every one. An agent that stops "incomplete" with budget left and nothing
  blocking it is sent back to work, and one that finishes a task it declared
  whole-document after reading under 90% of the document is sent back to the
  ranges it skipped. A request restarted after a reload keeps credit for the
  edits its first attempt made.

### Fixed

- **Word-numbered headings stay headings.** Word often numbers clause
  headings ("8.1 Cap on liability") through its heading styles, so they
  import as list items, and their heading level was dropped. They keep it
  now: `measure_document` and the delegated agent count them as sections,
  titled with their number, tool HTML marks them `data-heading`, and
  Markdown export writes them as `## 8.1 Cap on liability`. A paragraph whose
  .docx sets `numId` 0 is no longer numbered by its style.
- **Markdown export numbers nested lists per level.** An item under "8." is
  "1.", not "9.".
- **Tracked changes in headers and footers** import from .docx as pending
  changes (they were silently accepted) and export as Word revisions (the old
  and new text were both written, side by side).
- **Exporting an edited Word file no longer restyles it.** A file whose
  package declares no document defaults exported with 12pt ones, so text that
  inherits its size grew from Word's 10pt to 12pt, and runs that inherit
  Word's default font were written back as explicit Arial. Both now export as
  the original had them.
- **`set_page_layout` page numbers next to an authored header or footer.**
  When the requested header or footer already has text, the number goes into
  its empty left or right zone (a running head keeps its text and gains the
  number), and the result says where the number is or why it could not be
  placed. It used to report success with no number shown. The `apa7` preset's
  page numbers work the same way; any existing header used to hide them.

## 2.3.2

### Fixed

- **Reordering a list** with `replace_block` reported success without
  reordering, and rejecting it after a .docx round trip could duplicate an
  item.
- **Hyperlinks across a .docx round trip:** tracked changes that add, remove,
  or retarget a link in a list item (including lists in table cells) are
  saved as revisions, so accepting or rejecting them after reopening gives
  the same result as in the editor. A link removed in direct mode stays
  removed when another author has a pending change on it, and a tracked
  removal of a linked list item restores the whole link on reject.
- **Spacing and list levels across a .docx round trip:** tracked paragraph
  spacing changes, including in list items and table cells, and tracked list
  indent-level changes are saved as revisions, so rejecting them after
  reopening restores the original. Deciding a reopened spacing change no
  longer moves a nested list item to the top level.
- **Footnotes and table cells across a .docx round trip:** tracked paragraph
  splits and joins in footnotes and table cells are saved as revisions; a
  joined footnote stays joined after accepting, and rejecting no longer
  leaves an extra empty paragraph. Accepting a reopened deletion of a list
  item in a table cell no longer leaves an empty item.

## 2.3.1

### Fixed

Agent edits (`tools.call`, `tools.execute`, a delegated `agent.run()`, and
`@reviseio/editor/server` sessions) no longer change other people's pending
tracked changes. Before, an edit on or next to content that held someone
else's suggestions could silently accept them (with `directMode`) or re-create
them under the editing agent's name and today's date.

- **Paragraphs and list items** with pending changes: only the edit itself is
  applied; existing suggestions keep their ids, authors, and dates. This
  covers replacing text, formatting (`style_blocks`, `clear_formatting`),
  appending, splitting, joining, inserting next to them, and item spacing and
  indents.
- **Tables:** editing one cell changes only that cell. Inserting or removing
  rows and columns keeps the other cells' suggestions.
- **New refusals instead of silent loss.** A few structural edits can't yet
  keep existing suggestions, so they now fail with a clear error and change
  nothing: `pending_table_changes` (row/column changes or merges on a table
  that already has a pending row or column change or merged cells) and
  `pending_list_changes` (converting a list's type, reordering, or other
  list-level changes while the list holds pending changes). Resolve the
  pending changes first, or edit the text directly.
- **Rejecting a format change after a .docx round trip** keeps footnote
  references, comment anchors, fields, and hyperlinks. A rejected tracked
  format change could delete a footnote's text.
- **DOCX export:** imported revision ids stay stable when new suggestions are
  added; deletions over another author's insertion round-trip; replaced
  paragraphs have no stray space after accept or reject in Word; suggestions
  carry their author and date (some were written as "Anonymous"); deleted
  list items accept cleanly after reopening; deleted links restore on reject.
- **DOCX import:** tracked insertions and deletions inside hyperlinks are
  read; a list item that is wholly inserted or deleted imports as one
  revision.
- `insert_footnote` works in paragraphs that have pending changes.
- Removing a table cell's only paragraph empties it instead of leaving a
  change that can't be accepted.

## 2.3.0

### Added

- **`toolbarMode="compact"`.** The everyday part of the ribbon, centered,
  for narrow fixed-width hosts (about 760px): undo and redo, font, size,
  styles, paragraph, links, indents, lists, Find, and Export. The clipboard,
  Insert, and Print are left out.
- **`toolbarMode="floating"`.** The full ribbon as a centered card over the
  canvas, the way the Revise app shows it.
- **`onImportFile`.** Shows Import before Export in the ribbon (a file picker
  for DOCX, ODT, RTF, Markdown, HTML, text, and XML) and accepts files
  dropped anywhere on the editor, with a "Drop to import" overlay. Image
  drops still insert images. The host receives the file and decides what
  importing means.
- **Header and footer images.** Logos in Word headers and footers now show
  on the page and in PDF export. They were kept for DOCX round trips but
  never drawn. Images are scaled down to fit the margin band and never
  overlap body text. `set_header_footer` takes an `image` (`image_id` of an
  image already in the document, with `zone`, `alt`, `width`, and `height`)
  and a one-based `sectionIndex` to edit one section's own header or footer.
  Concurrent edits to different bands' images merge instead of overwriting
  each other. DOCX export keeps the logo's alignment. It turns on Word's
  first-page or odd/even headers when a logo needs them, and leaves a logo
  out of sections whose margin is too small to show it.
- **`@reviseio/editor/server`: `agentName`.**
  `createServerDocumentSession({ agentName })` sets the author on the
  suggestions and comments the session's tools create, which DOCX export
  writes as `w:author`. Defaults to "Revise Agent".
- **The delegated agent can move any block** as one tracked move: images,
  code, equations, horizontal rules, page breaks, and tables of contents as
  well as paragraphs, lists, and tables. Section breaks are still refused.

### Changed

- **Import paths.** `revise/editor` → `@reviseio/editor`,
  `revise/editor/full` → `@reviseio/editor/full`, `revise/server` →
  `@reviseio/editor/server`, `revise/style.css` →
  `@reviseio/editor/style.css`, and the build identity →
  `@reviseio/editor/version`. The editor, license, and API are unchanged. The
  docs moved to
  [revise.io/developer/docs](https://revise.io/developer/docs/editor-sdk/introduction).
- **`replace_block` and `remove_blocks` name a range by its last block.**
  `end_id` (inclusive, same container as `id`) replaces `count` in the tool
  definitions and in `ReviseToolInputMap`. Calls with `count` still run, but
  TypeScript callers that pass it need `end_id`. A reversed, unknown, or
  cross-container range fails with `invalid_block_range` before anything
  changes.
- **`remove_table_rows` replaces `remove_table_row`.** It removes one or more
  rows per call, named by stable row ID (`rowIds`, a string or an array).
  Rows the agent read stay removable after other rows change, without
  reading the table again. `remove_table_row` with `{ tableId, rowIndex }`
  is still accepted.
- **`read_table` `mode: "cell_text"` pages list their nested blocks**
  (`blocks`: block ID and text offset), and each nested block's text opens
  with an inline `[[block_id]]` marker. Text inside an oversized cell can be
  read with `read_specific_blocks` and edited. A `replace` aimed at a table,
  row, or cell edits the one nested block that contains the text.
- **`set_header_footer` reports what actually changed.** `clear: true`
  without `slot` or `sectionIndex` removes that side from every page and
  section. A call that changes nothing fails with "No changes detected" and
  the current header/footer listing. An unknown `slot` is an error instead
  of widening a clear. Clearing the first-page or even-page slot while the
  document-wide footer shows there leaves an empty slot that hides it, as in
  Word. `search_document` also matches header and footer text.
- **Mutation tools refuse empty arrays** (`content`, `replacements`,
  `cells`, `ids`, `rowIds`, style `attrs` or `selectors`) before changing
  anything, and name the tool that fits instead. The definitions mark these
  `minItems: 1`. Empty table-insert content still inserts empty cells.
- **Edits next to an unresolved paragraph split or merge are refused** with
  `pending_paragraph_boundary`: accept or reject the split first. Such edits
  used to lose or duplicate text on review.
- **`style_blocks` headings take the document's heading style.** In an
  imported Word document, a paragraph made a heading gets the heading
  style's spacing and run formatting, and exports like the document's other
  headings.
- **Agent-inserted content follows the surrounding font.** Inserted tables
  take the font and body size at the insertion point. One `insert_block`
  call uses one font for all its pieces. Rows and columns added by
  `insert_table_row` and `insert_table_column` keep the table's font. A
  heading's size no longer carries into paragraphs inserted after it. Cells
  holding only inline markup (`<td><b>Total</b></td>`) keep their
  formatting. Tables inserted from the editor take the caret's font.
- **DOCX export keeps more of the original file.** Untouched table rows,
  cells, and list items are written as the original bytes when a neighbor
  changes. Paragraphs with only text edits keep their original paragraph
  properties. The original `styles.xml` is kept, with only the missing style
  definitions added. Opening a document with page numbers no longer forces
  headers, footers, and styles to be regenerated. In
  `@reviseio/editor/server`, `exportDocument(room, { mode: "final" })` to
  .docx keeps untouched content as the original bytes too.
- **The delegated agent** (`agent.run()` and comment agents) sees the
  document's headers and footers. It stays inside a locked user selection
  unless asked to go wider. It may re-read blocks it has already read. It
  puts content asked to be added into the document rather than only in
  chat, and it no longer finishes before results it asked for arrive. With
  Anthropic models, requests that follow edits keep the prompt cache.

### Fixed

- **Comment cards sit beside the page**, as in the Revise app, instead of
  at the far right edge of a wide editor.
- **The ribbon stays centered on the pages** when the comments margin moves
  them aside, as far as its width allows.
- **Add Comment and Toggle Comments** in the Review ribbon work. They were
  always disabled.
- **Find shows in the native ribbon.** It was hidden whenever Dictate was,
  which the SDK always hides.
- **The ribbon keeps text color and the styling menu down to 352px**, where
  they were dropped below 430px.
- **The selection stays visible, dimmed, when focus leaves the editor**, for
  example to a chat input in the host page, instead of disappearing.
- **Copy and Cut work in iframes that deny clipboard access** (no
  `clipboard-write` permission).
- **Agent avatars on suggestion cards load**, where they used to resolve
  against the host page's origin and show a generic avatar.
- **Hovering Accept all or Reject all previews the decided document.** Blocks
  the decision removes, such as a moved table's source, are hidden, while
  edited code and math blocks stay. Typing ends the preview, so keys never
  edit a hidden block.
- **Word redlines with inserted or deleted paragraphs accept and reject
  fully.** Consecutive paragraph-mark revisions used to overwrite each
  other, so rejecting inserted clauses left them in place and accepting
  could leave an empty paragraph. Rejecting a split keeps the paragraph's
  current text, formatting, and pending revisions. Settling a
  paragraph-formatting change no longer undoes later inline decisions.
  Accept all and Reject all finish in one call when one decision uncovers
  another.
- **Tracked table changes export to Word as revisions.** A suggested row
  insertion, alone or combined with cell edits, is a Word row revision with
  attributed inline cell changes instead of an untracked table. A
  repeating header row survives a tracked deletion of the first row.
- **Moves of images, code, equations, rules, page breaks, and tables of
  contents export once** to DOCX, not as two copies. Accepting or rejecting
  a moved table with code or math in its cells no longer leaves a damaged
  copy. Copied content no longer carries suggestion records.
- **A DOCX export never brings back a removed paragraph** (for example, a
  rejected insertion) by returning the original file unchanged.
- **Highlight colors map by hue.** Office tints such as lavender no longer
  show as gray, and mid or dark neutrals no longer show as green or yellow.
  `style_blocks` can restore a block's original highlight.
- **PDF export draws SVG images** instead of blank space, and fetches an
  image used on every page once.
- **HTML input with `<!-- comments -->`** no longer fails, and loose text
  before a block keeps its place.
- **Turning page numbers off keeps an empty first-page footer**, so the
  footer stays hidden on page 1.
- **Footnote edits.** Text in a just-inserted footnote is edited in place
  instead of moving into the body. A find matches only visible footnote
  text, not pending deletions. A batch that includes a footnote edit fails
  or succeeds as a whole. `leave_comment` accepts a footnote that was read.
- **`replace` batches apply as planned.** Chained steps
  (`Alpha→Beta`, `Beta→Gamma`), finds over a `search_result_id`, and
  id-less `occurrence: "all"` finds are checked against each block's text
  as earlier steps leave it. A step no longer lands on the wrong block or
  sentence. Errors say when a long find drifts from the block, when the
  block already contains the replacement, and that none of a failed call's
  replacements applied.
- **`read_specific_blocks` reads a list item inside a table cell.**
- **NEL, LS, and PS characters read as spaces**, so a find copied from a
  read matches.

## 2.2.0

### Added

- **ODT and RTF input.** `ReviseDocumentFormat` and `ReviseServerFormat` gain
  `"odt"` and `"rtf"`, detected from `.odt` / `.rtf` filenames and from the
  `application/vnd.oasis.opendocument.text`, `application/rtf`, and
  `text/rtf` MIME types. Both import fonts, sizes, colors, highlighting,
  character and paragraph formatting, headings, lists with their numbering,
  tables with merged cells and column widths, images, hyperlinks, footnotes
  and endnotes, headers and footers, comments, tracked changes, and page
  size and margins. RTF from Word, WordPad, TextEdit, and LibreOffice is
  supported, in any Windows code page or East Asian encoding. Each converter
  loads only when a host first opens that format. `revise/server`'s
  `parseDocument`, `fileToYDoc`, and `seedYDocFromFile` accept both. Host
  code with an exhaustive `switch` over either type needs cases for the two
  new values.
- **Delete whole table rows, columns, or tables from a cell selection.**
  Backspace or Delete over fully selected rows or columns removes them, and
  over every cell removes the table; a partial selection still clears only
  the cell contents. Removing several rows is one undo step, and a table that
  was the only block leaves an empty paragraph. Shift+click in another cell
  of the same table now extends a cell selection, as dragging does.
- **Move connectors.** When a tracked move is focused, a line in the left
  margin links where the text moved from to where it moved to, across pages.
  It is not drawn in print preview.
- **Pleading-paper line numbers.** Documents whose page layout carries a
  pleading grid show numbered rows (for example 1 to 28) at fixed positions
  on every page, independent of the text, on screen and in PDF export. DOCX
  export writes them as Word line numbers restarting on each page.

### Changed

- **Margin line numbers behave like Word's.** Each number sits on its line's
  baseline, table lines are not counted on screen (PDF already skipped
  them), and a section that turns numbering off shows none instead of
  inheriting the document setting. Numbers are set in the font that
  dominates each page's text, on screen and in PDF, where they were always
  Helvetica before.
- **The delegated agent can move blocks.** `agent.run()` and comment agents
  can move paragraphs, lists, and tables as one tracked move (applied
  directly in editing mode); blocks with anchored comments are not moved.
  `move_blocks` is not part of the embedded tool list for `tools.*` hosts.
  The delegated agent also recovers more reliably: it repairs a run that
  edited and then reported no change, checks table fill work before it
  finishes, and keeps the request and latest tool results when it recovers
  from a context limit.
- **Suggestion cards show a date once a change is over a week old.** Old
  changes read "Sep 4" or "Oct 11, 2013" instead of "4739d ago".
- **The footnote card is a compact row.** Clicking a footnote reference shows
  its label with **Go to note** and **Remove**; the note is edited in the
  note itself. In narrow layouts the card is centered under its reference
  mark.

### Fixed

- **Links.** Bare email addresses link and autolink as `mailto:`;
  `mailto:` and `tel:` URLs are kept as typed; an `@` before the path is not
  read as `https://` user info. Cmd+K uses the selected text as the link
  target only when it is a full URL or an email address, and the link popup
  finds a link Cmd+K just made on a backward selection.
- **Link, footnote, and inline-math popups line up at every zoom level.**
- **Math is no longer clipped when it renders before the KaTeX fonts load.**
  Such results show provisionally and re-render once the fonts arrive, and
  failed font or stylesheet fetches are not cached.
- **DOCX tracked moves of whole paragraphs, lists, and tables.** On import,
  Word's paragraph-mark `w:moveFrom` / `w:moveTo` make the whole block part
  of the move, so accepting it removes the source paragraph instead of
  leaving an empty one, and a list split across a move becomes two lists.
  Export writes paragraph marks and table rows with the move, and accepting
  or rejecting resolves both halves together.
- **Accepting the deletion of every row of a table removes the table**, as
  in Word, instead of leaving a table with no rows.
- **DOCX header and footer line breaks.** `w:br` in headers and footers is
  imported, and export writes `w:br` instead of a raw newline that Word
  showed as a space.
- **Header and footer layout.** In multi-column sections, headers and
  footers span the full text width instead of one column; a zone is as wide
  as its widest line; a bordered zone, such as a footer rule, spans the whole
  band; and empty zones give up their space.
- **`replace_block` and `append_to_paragraph` on a non-text target**, such as
  a table, fail with `target_type_mismatch` instead of doing nothing.
- **DOCX, ODT, and RTF open where `Blob.arrayBuffer` is missing** (Safari
  before 14, jsdom). Files are read with a `FileReader` fallback.

### Security

- **ODT and RTF import is hardened against hostile files.** Links pass a
  scheme allowlist (http, https, mailto, tel, ftp, and relative), so
  `javascript:` and similar are dropped. Self-referencing ODT deletions and
  RTF control words such as `\constructor` can no longer overflow the stack
  or swallow text, and imported tables are capped at 1,000 columns and
  100,000 cells.

## 2.1.0

### Added

- **`source` on document inputs.** `{ id, source: file }` names the field for
  what it takes: DOCX, Markdown, plain text, or HTML. `docx` still works as the
  same field; passing both with different values throws.
- **`context_notes` is optional in typed host calls.** `tools.execute()` and
  `tools.call()` (browser and `revise/server`) fill in `"N/A"` for the read and
  search tools, so application code no longer passes a model's working memory.
  `executeDynamic()` keeps the schema requirement for model-provided calls.
- **`leave_comment` reports a retargeted anchor.** When the anchor text is not
  in the named block and the comment goes to the only read block that has it,
  `data.requestedBlockId` names the block you asked for and the message says so.

- **`read_table` and `edit_table_cells` agent tools.** Read a large table in
  bounded windows (a summary, up to 50 rows, or one oversized cell in pages),
  then set the plain text of up to 50 cells per call by row ID and column.
  Cell text is written literally. Only cells a `read_table` call returned in
  full can be edited, and that read stays valid across later `execute()` calls
  on the same document while the cell and table geometry remain unchanged.
  An invalid target rejects the whole batch with no changes. In suggesting mode each cell is its own suggestion. Read-only
  surfaces and viewers get `read_table` only. Both tools are also in the
  `revise/server` session. The SDK's `read_table` does not take the native
  agent's task-declaration arguments (`task_kind`, `scope_*`,
  `source_attachment_id`, `deliberate_blanks`). They are left out of the
  published schema, and a call that supplies one fails with
  `unsupported_argument` without reading anything. Empty placeholders
  (`null`, `""`, `[]`) are ignored.

### Changed

- **The delegated agent plans long tasks.** `agent.run()`, `revise_run_agent`,
  and comment agents keep a step-by-step plan for multi-step work, update it
  in the same turns as their edits, and save it with the conversation, so
  fewer turns go to bookkeeping. The embedded tool list is unchanged: plan
  tools stay inside the delegated agent.
- **Faster on long documents.** The scrollbar track and its markers are drawn
  once and reused while scrolling, Find reuses each block's normalized text
  between keystrokes, and tracked-change records are indexed in one pass
  instead of one document walk per suggestion.

### Fixed

- **DOCX paragraph spacing follows the document's rules.** `w:contextualSpacing` no longer
  zeroes a paragraph's declared space before and after on import. Spacing is
  resolved from neighboring paragraphs on screen, in table cells and
  containers, and in PDF export: the gap between two paragraphs is the larger
  of their spacings, not the sum, and contextual spacing drops it only between
  paragraphs of the same style. PDF keep-with-next reserves the whole gap, and
  exported DOCX keeps the declared spacing. Documents whose paragraphs both
  declare spacing lay out tighter than in 2.0.x.
- **`style_blocks` with `list-style-type: none` turns list items into plain
  paragraphs**, keeping their spacing and line spacing and applying the call's
  other paragraph attributes in the same step.
- **Unsupported DOCX content can be suggested for removal.** In suggesting
  mode, removing a block the editor preserves but cannot render (an opaque
  DOCX payload) now becomes a tracked deletion.
- **Comment previews keep their layout.** In a comment chip's hover preview,
  the avatar holds its size and a long author name is truncated.
- **An editor with no agent configured sends nothing.** `agent.run()`, the
  `revise_run_agent` tool, and comment agents used to stream the document,
  unauthenticated, to Revise's hosted agent and then report a generic
  connection error. Without a `turnStream`, `baseUrl`, or `token`, they now
  fail at once with `agent_not_configured` (`AgentNotConfiguredError` from
  `agent.run()`), and `getToolDefinitions()` leaves the delegation tool out.
- **`documents.open()` activates the new document every time.** Opening a
  document straight after another open, or after `documents.activate()`, left
  the earlier one active. `documents.list()` status was also briefly stale
  right after a document became ready.
- **`tools.getDefinitions()` lists only the native tools.** It included
  `revise_run_agent`, which the docs say it leaves out.
- **Changing `agent.turnStream` no longer reloads the document.** A new
  `turnStream` or `disableMetrics` value re-created the document runtime,
  re-parsing the source and dropping unsaved edits, so an inline generator in
  JSX reloaded the document on every render. Agent settings now apply to the
  next run in place.
- **Reads are not refused for the life of the editor.** After a window had
  been read once, every later `read_blocks_from_index` of it failed with
  `no_new_read_context`, so a host agent's second conversation could not read
  the document. The guard now resets with each call, like the other per-turn
  limits.
- **Tool errors speak to SDK callers.** Messages no longer carry the internal
  `Failed operation: <tool>: <Error>:` prefix or point at `<document_content>`,
  which only Revise's own agent sees; they point at read results instead.
- **The open-error screen shows a plain message.** A corrupt file showed the
  parser's internals (a zip library's message and link) to the person who
  picked it. `onError` still receives the full detail. Loading text no longer
  says "DOCX" for other formats, and a `File` source's title drops `.md`,
  `.txt`, and `.html` extensions as well as `.docx`.
- **PDF export requests a failing font once.** When a font download failed
  (a CSP or firewall blocking revise.io, say), export requested the same URL a
  second time. The warning now says a fallback font was used and names
  `setAssetBaseUrl()` for mirroring the fonts.
- **Readable errors from the package in Node.** Bundled code is wrapped at
  short lines, so an uncaught error (such as the missing-`jsdom` hint) is no
  longer printed under a 100 KB line of minified source.
- **Quieter host builds.** Vite no longer warns that `"buffer"` was
  externalized, or prints the inlined WebAssembly's base64 as a file that
  "doesn't exist at build time".

## 2.0.1

### Added

- **`tools.export({ format, mode })`.** Export as DOCX, PDF, HTML, Markdown,
  or plain text from code, not just the ribbon's Export menu. `mode: "final"`
  accepts every pending change and drops comments first for a clean copy;
  the default `"review"` keeps tracked changes and comments in a .docx. The
  editor-level `tools.export(options, documentId?)` routes to any open
  document.
- **`exportDocument(source, options)` in `revise/server`.** The same export
  for a room or a parsed document on the server: DOCX, HTML, Markdown, and
  plain text, in review or final mode.
- **`onImageUpload(file, documentId)`.** Store images users insert, paste, or
  drop in your own storage and return the URL the document should use.

### Fixed

- **Inserting, pasting, or dropping an image works.** It used to post to
  Revise's app API, which the SDK cannot reach, so the image never appeared.
  Without `onImageUpload`, images are now embedded in the document as data
  URLs and export into the .docx. `toolbar.insertImage()` resolves `false`
  when an upload fails, and the failure reaches `onError`.
- **Docs:** linked moves are described correctly in Support, the reserved
  collaboration keys point to `RESERVED_DOCUMENT_KEYS`, and the delegated
  agent page says how to get hosted-agent access.

## 2.0.0

The SDK is now public: `npm i revise`. No account, token, or contact
with us is needed to install it. 2.0.0 also ships everything from the
2.0.0-alpha releases below.

### Changed

- **BREAKING: the package is now `revise`.** The private `@reviseio/sdk`
  package is retired. Update the dependency and imports:
  `@reviseio/sdk` → `revise/editor`, `@reviseio/sdk/full` →
  `revise/editor/full`, `@reviseio/sdk/backend` → `revise/server`, and
  `@reviseio/sdk/style.css` → `revise/style.css`. Remove the `@reviseio`
  scope and token lines from `.npmrc`.
- **New license: free for evaluation, personal projects, and education.**
  Production use by businesses, nonprofits, and government requires a paid
  license. See `LICENSE` and [the license page](https://revise.io/developer/docs/editor-sdk/license).
  The previous 60-day evaluation terms no longer apply.
- **The editor fills its container at any size.** The 640×560px minimum is
  gone, so the editor fits phone-width columns and short panels without
  overflowing them. A container with no height gets a 560px fallback and a
  one-time console warning instead of a collapsed editor.
- **Hosted agent defaults to production.** Without `agent.baseUrl`, the
  delegated Revise agent now targets `https://agent.revise.io` instead of a
  development address.

### Added

- **A 4.5 MB package, with assets loaded on demand.** PDF export fonts were
  inlined as base64 and made up three quarters of the package; they, the math
  fonts and stylesheet, the pdf.js worker, and Tree-sitter grammars now load
  from `https://revise.io` when first needed. **`setAssetBaseUrl(url)`**
  points the SDK at a self-hosted mirror.
- **`import ReviseEditor from "revise/editor"`.** The editor entry now has a
  default export. The named `ReviseEditor` export still works.
- **`revise` root entry** with `REVISE_SDK_VERSION`, `REVISE_SDK_BUILD`, and
  the shared types, and no runtime weight.
- **`THIRD-PARTY-NOTICES.md`** lists every bundled open-source package with
  its license.
- **Anonymous usage ping, and the `telemetry` prop to turn it off.** Once
  per page load, the editor sends Revise its version; the browser adds the
  site's origin. Development hosts are counted per day and version without
  their origin. No cookies, user data, or document content.
  `telemetry={false}` disables it.

### Fixed

- **Math renders with its real fonts in host apps.** Equations looked for
  their fonts and stylesheet at the host's own `/fonts` and `/katex.min.css`
  and fell back to system fonts; the help link in the editor menu also
  pointed at the host's `/help`. All now resolve to Revise's assets.
- **The SDK no longer reaches for development servers.** Revise application
  endpoints (document history, preferences, uploads, failure reports) and the
  sync-server addresses no longer resolve to `localhost` in an embedding
  host. Document history in particular fetched from `localhost:3001` in
  browsers without a `process` global.
- **No debug globals on the host's `window`.** `__getEditor`,
  `__getDocLayout`, and `__aiLogs` are no longer installed.
- **DOCX math export uses Revise's own MathML → OMML converter.** Equations
  export to native Word math (fractions, radicals, scripts, sums and
  integrals with limits, delimiters, matrices, accents, bars, braces,
  functions, boxed and text runs) with no third-party copyleft code in the
  package. Re-importing them is more faithful: `\left\{ … \right.`,
  `\underline`, `\overbrace`, `\boxed`, `\text{…}`, `\mathbb`, binomials,
  and named functions (`\sin`, `\log`, `\lim_{…}`) now come back as the
  same LaTeX instead of approximations, and symbols no longer run into the
  following letter (`\alpha x`, not `\alphax`).

## 2.0.0-alpha.7

### Fixed

- **DOCX round trips keep every modeled mark and block.** A new
  export → import matrix (every formatting mark in every text context,
  every paragraph, list, table, cell, image, code, math, note, header,
  footer, and page-layout attribute, plus a second-pass fixed-point
  check) found and pinned a set of losses: lists inside table cells
  were dropped on export; hanging indents exported as zero and
  `w:hanging` was ignored on import; headings came back as Word's blue
  16pt built-ins (export now writes the editor's heading sizes with
  inherited color); unscoped header/footer blocks were not exported;
  hyperlinks discarded an explicit text color; links inside footnotes
  were lost on import; header and footer runs used a reduced codec in
  both directions and now share the body run codec, links and inline
  code included; inline code and code blocks flattened to Courier text
  and now travel as `CodeInline` / `CodeBlock_<language>` styles and
  return as the original nodes; todo items exported as literal
  `[x]` text and now use checkbox glyphs that re-import as todo lists
  with their checked state; code-block line breaks doubled on
  re-import; and a single run in another font restamped the whole
  document (the inferred document font is now the character-weighted
  majority).
- **Table borders export and re-import faithfully.** Export no longer
  throws on non-hex colors such as `TRANSPARENT`, `rgba()`, or CSS
  names — unresolvable values are omitted or written as `auto`. The
  uniform `borderWidth`/`borderColor` pair is honored (width 0 means
  no borders), width-0 spec edges export as `none` instead of a
  hairline, and an explicit `w:sz="0"` imports as hidden rather than a
  1px line. Table Settings border changes now rewrite the structured
  table spec and clear per-cell overrides, so hiding borders on an
  imported table takes effect.
- **Byte-preserving DOCX export degrades instead of failing.** A carrier
  that fails to load falls back to the regenerated package like every
  other graft failure; the graft option reports its outcome (exact,
  grafted, regenerated, and the fallback code) through an isolated
  callback that can never break an export. Untouched imports of rich
  documents now export byte-identical: note-body font inheritance,
  header/footer zone ids, and legacy chrome no longer drift the
  fidelity signatures; watermark and settings edits graft instead of
  restoring carrier values; body grafting is invalidated when wrapper
  or style sidecars change; single-quoted and non-numeric relationship
  ids parse; and a changed header image is replaced even when its
  media filename collides.
- **Formatting suggestions preserve footnotes.** Accepting a
  `style_blocks` suggestion keeps footnote references and bodies.
- **Large documents no longer stall on batch edits.** Styling 205 blocks
  in a 10,000-block document, applying 100 replacements, and large
  multi-block insertions run without re-decoding the document per
  action; suggestion projection latency is bounded; batch paragraph
  formatting suggestions behave identically through preview,
  acceptance, and rejection.
- **Semantic tool errors and inputs.** Errors distinguish Markdown find
  syntax from stored plain text; metric CSS paragraph indentation
  (`cm`, `mm`) is accepted; number-dot prose can be parsed as inline
  text instead of a list when requested.
- **Comments render AI citations.** Structured citations persist on
  replies and render in the panel; unsupported provider citation
  markers are hidden, including on legacy comments.
- **Agent image rehosting.** Wikimedia thumbnail URLs are recovered by
  rehosting the original image, and rate-limited rehosts surface the
  backend reason and status.
- **Revision timeline never collapses to zero.** A stale or missing
  server update counter no longer disables history or pins every frame
  to the first update; loaded frames are authoritative.
- **Pasted images write once.** A pasted image no longer inserts a
  temporary base64 placeholder that is replaced later; the final hosted
  URL is written at the captured paste position when the upload
  completes.

### Changed

- **Comment margin geometry is direction-aware.** Chip, floating-stack,
  and insert-chip positions are computed along an outward axis with a
  single conversion to physical coordinates. The embedded document
  surface itself is still laid out left-to-right: the margin chrome
  stays on the page's right regardless of the host page's direction.
  Mirroring the embed for right-to-left hosts is not part of this
  release.

## 2.0.0-alpha.6

### Fixed

- **A healed seed race now recovers full fidelity — and never loses a
  comment.** Three repair refinements: the winner is the seed whose
  metadata survived the merge (each seed stamps a ballot in the same
  transaction), so the kept content matches the surviving import
  capture; a shared deterministic id keeps the WINNER's element, not an
  arbitrary one; and map records under a shared key (deterministic
  comment ids) are never deleted — the merge already deduplicated them,
  and alpha.5's repair removed the only surviving record. A raced,
  repaired room now reports "exact" and exports byte-identically.

## 2.0.0-alpha.5

### Fixed

- **Seed-race repair kept a duplicate footnote.** Deterministic ids that
  every seed generates identically (docx footnotes) were protected from
  repair as a collision safeguard, leaving one copy per seed. Repair now
  keeps exactly one occurrence of a shared id. Supersedes 2.0.0-alpha.4,
  which was deprecated minutes after publish.

## 2.0.0-alpha.4

### Fixed

- **Double-seed connect race no longer duplicates the document.** Two
  peers that each found an empty room and seeded the same file before
  syncing used to merge into a perfectly-synced, perfectly-duplicated
  document. Every seed now records a claim in the same transaction as
  its content, and any peer that sees two claims deterministically
  removes the losing seed's content — idempotent, convergent, and
  content added after a seed is never touched. `seedYDocFromFile` is
  now genuinely safe to call on every connection: a later call also
  heals an already-raced room, and every live editor session repairs
  one the moment the second claim syncs in.
- **Editing no longer rewrites document properties.** A structural edit
  (or a rejected tracked change) permanently dropped the imported core
  properties from the live model, so every later export regenerated
  `docProps/core.xml` with an "Un-named" creator, the title removed,
  and the creation date reset to export time. Core properties now
  survive every model rebuild, and when core.xml IS legitimately
  regenerated it is a faithful merge: `cp:revision` round-trips and
  fields the original never had are not invented.
- **`docProps/app.xml` passes through untouched.** It is never
  regenerated (preserving Application/Company/TotalTime) and never
  added to a package that did not have one.

### Added

- **`repairSeedRace(ydoc)`** on the backend entry (with
  `SeedRaceRepairResult`): detect and repair a double-seed race on
  demand. Editor sessions and `seedYDocFromFile` run it for you.

### Changed

- **New reserved top-level key in shared documents: `"seed-claims"`**
  (see `RESERVED_DOCUMENT_KEYS`) — where seed claims live.

## 2.0.0-alpha.3

### Fixed

- **Backspace before a chip deleted the chip.** A preserved-object chip
  has two caret stops — before and after — and a delete now respects
  which side the caret is on, like a caret between two characters:
  backspace at the before-stop targets the block BEFORE the chip (an
  atomic neighbor is deleted whole, a text neighbor loses its last
  character), and forward delete at the after-stop targets the block
  after. Deletes pointing AT the chip still remove it.
- **Up/down arrows at a chip slid the caret to the chip's other side**
  instead of changing lines. Vertical movement now leaves the chip's
  line and lands on the neighboring block's stop nearest the caret's
  column — arrowing through a stack of chips keeps the caret on the
  same side all the way down.

## 2.0.0-alpha.2

### Fixed

- **Exporting .docx could crash in production builds of the host app**
  ("Cannot destructure property 'default' … as it is undefined" from
  the converter's zip loader). The SDK's build emitted duplicate
  interop chunks for its zip dependency behind dynamic imports, and
  some consumer bundlers resolved one family to `undefined` when
  producing production builds — development builds were unaffected,
  which is why the crash only appeared after deployment. The dependency
  is now a static import inside the (still lazily loaded) converter
  modules: the load profile is unchanged and the chunk graph no longer
  depends on the host bundler's interop handling.
- **Backspace in an empty paragraph directly after a chip deleted the
  chip** instead of the paragraph. Preserved payloads are content the
  source file owns, not editor furniture: the empty paragraph dies, the
  chip survives. (Page and section breaks keep their old
  consume-on-backspace behavior.)
- **Chips gained real before/after caret stops.** The caret can now be
  placed on either side of a chip — arrow keys walk across it, and
  clicking the left or right half of the chip places the caret on the
  matching side.

## 2.0.0-alpha.1

Prerelease for evaluation. The 2.0 line's headline is DOCX source
fidelity: a document imported from .docx can now leave the editor as the
file it came from, not a reconstruction of it.

### Added

- **DOCX source-fidelity mode (default on).** Importing a .docx keeps the
  original package inside the document (the "carrier", shared documents
  included, capped at 25MB). On export, content you did not touch is
  emitted as the exact bytes that arrived — byte-for-byte, unannotated —
  and only changed content is regenerated. A verification stage inspects
  every composed package and falls back to full regeneration rather than
  ship anything it cannot verify.
- **`handle.getSourceFidelity()`** (and `ydocSourceFidelity(ydoc)` /
  `documentToDocx(doc, { originalDocx })` on the backend entry) reports
  the honest relationship of the next export to the original file:
  `"exact"` (byte-identical), `"grafted"` (original bytes plus your
  edits), or `"converted"` (no usable original; the report says why).
- **Unmodeled Word formatting survives editing.** Run, paragraph, table,
  row, cell, and section properties the editor does not model (vendor
  effects such as `w14:glow`, revision-save ids, row heights, table
  look flags, page borders, note-numbering properties…) are carried
  through the model and re-emitted — so an EDITED paragraph keeps them
  too, with or without the carrier.
- **Preserved objects render as labeled chips.** OLE embeds (Excel,
  Visio), SmartArt without a raster fallback, and unknown OOXML
  constructs import as atomic blocks labeled with their source tag
  (e.g. "w:object · Excel.Sheet.12"), render as chips on canvas and in
  PDF export, and re-export verbatim. In agent HTML they appear as
  `<docx-raw id tag/>`: an agent can keep, move, or omit one
  (omission deletes), but can never inject raw OOXML of its own.
- **Editable-region permissions preserved.** `w:permStart`/`w:permEnd`
  pairs (and future paired ranges) survive import, editing, and export
  with balance guaranteed by construction: typing inside extends the
  region, deleting its text retires it, and unbalanced pairs in source
  files are repaired at import.

### Changed

- **BREAKING: two new reserved top-level keys in shared documents** —
  `"docx-carrier"` and `"oxml-ranges"` (see
  `RESERVED_DOCUMENT_KEYS`). A host-built Y.Doc already using these
  names is rejected by `assertUsableSharedDocument`.
- **BREAKING: docx-sourced exports are byte-preserving by default.**
  1.x regenerated every export from the model; 2.0 reproduces original
  bytes for untouched content. Hosts that depended on exports being
  normalized into the generated dialect should convert explicitly.
- `ReviseDocument` block children may now include the `"docx-raw"`
  node type (opaque; convert rather than inspect, as ever).
- Shared documents built from a .docx are larger by roughly the size of
  the source file (the carrier). It is stored once, chunked, and synced
  like any other document state.

## 1.3.1

### Fixed

- **Delegated page inspection now reaches the embedded editor canvas.** The
  SDK connects the delegated agent's `render_document_pages` tool to the
  mounted document renderer, so appearance and layout requests return the
  actual pages instead of reporting that canvas inspection is unavailable.
- **Agent-tool documentation now matches the generated SDK catalog.** The
  public docs use the canonical `remove_blocks` name, distinguish the
  deterministic document-local tool subset from delegated-agent-only tools,
  and explain where visual page inspection is available.

## 1.3.0

### Added

- **The built-in editor UI now localizes itself in English, Spanish, and
  German.** Ribbon controls, menus, dialogs, comments, Review mode, and agent
  chrome follow the browser language or the persisted Revise UI-language
  preference, while English remains the fallback if a locale chunk cannot be
  loaded.
- **The delegated browser agent can inspect the document's rendered pages.**
  It can request bounded appearance contact sheets or layout diagnostics from
  the real canvas renderer, including page geometry, tables, images, math,
  headers, footers, and safe placeholders for unavailable visual assets.

### Changed

- **Tab editing and layout now follow Word-style paragraph behavior.** Tab and
  Shift+Tab at the start of a block keep indenting or outdenting, while either
  key inside paragraph text inserts a tab. Long tabbed lines wrap at word
  boundaries, restart their ruler on each visual line, and preserve custom,
  aligned, leader, and right-to-left tab stops.

### Fixed

- **DOCX named styles remain stable through editing and repeated round trips.**
  Imported paragraph styles and document defaults now drive newly created
  headings and agent-created styled blocks, survive Yjs persistence, suppress
  redundant direct formatting on export, and converge without accumulating
  unused generated Word styles. Explicit formatting resets, borders, spacing,
  fonts, and styles inside table cells remain intact.
- **Agent document measurements reconcile pending Review changes.** Primary
  totals consistently measure the final, as-if-accepted document and include
  the original review projection when pending suggestions make the visible
  word or character count differ.

## 1.2.0

### Added

- **International text support now extends across the editing and conversion
  pipeline.** Unicode-aware line breaking, search, list numbering, font
  fallback, and IME composition preserve multilingual text more reliably, and
  text import now detects UTF-8 and UTF-16 files. HTML, DOCX, RTF, ODT, and
  plain-text conversions keep the expanded script coverage intact.
- **Orange and purple join the SDK highlight palette.** The editor UI,
  `find_highlights`, `style_blocks`, agent HTML, and DOCX round trips now
  share the same seven canonical highlight colors.
- **Agent styling covers richer document structures.** `style_blocks` adds
  span, descendant-wildcard, first-row, and named-paragraph-style selectors,
  with durable mappings for image sizing and alignment, paragraph borders,
  nested tables and lists, per-edge cell borders, cell fills, padding, and
  table-cell text styles.

### Fixed

- **DOCX import follows Word's effective paragraph and table styling.**
  Unstyled paragraphs inherit the document's default style; exact and
  at-least line rules use the resolved font size; paragraph before/after and
  contextual spacing replace the editor's fallback gap; missing table borders
  remain borderless; and non-uniform cell margins survive import. The imported
  spacing persists through Yjs, paragraph splits and merges, HTML, DOCX, and
  PDF output, keeping compact Word layouts from growing onto extra pages.
- **Unavailable Word fonts use the document's own substitution hints.** DOCX
  import reads `fontTable.xml` alternate names and PANOSE/family/pitch
  metadata, persists them with the document, and chooses metric-compatible
  fallbacks before resorting to a generic family.
- **Multilingual PDF export embeds and shapes the scripts it needs.** Chinese,
  Japanese, Korean, Indic, Southeast Asian, Tibetan, Ethiopic, Armenian,
  Georgian, Syriac, Thaana, symbols, emoji, and rare Han use bundled lazy
  fallback faces, while a hidden logical-text layer preserves search and text
  extraction.
- **Agent edits preserve complex formatting and pending review state.** Styled
  tables, nested content, list-item formatting, explicit text overrides,
  comments, and edits layered over pending insertions now survive preview,
  acceptance, and rejection without duplicating or flattening structure.
- **Borderless layout tables stay visually borderless while editing.** The
  canvas now reveals only the specific invisible vertical edge under a resize
  pointer instead of ghosting the table's entire grid on hover or focus.
- **Imported pale-yellow highlights remain highlights.** HTML clipboard import
  no longer remaps Word's pale yellow to the editor's green palette entry.

## 1.1.0

### Added

- **First-class right-to-left editing.** The built-in toolbar can set paragraph
  and list direction to automatic, LTR, or RTL. Mixed Hebrew, Arabic, and
  left-to-right text now uses bidi-aware line layout, visual arrow-key
  movement, stable caret and selection geometry, direction-aware alignment and
  indents, mirrored list markers, and RTL tab stops. Direction survives Yjs,
  clipboard and agent edits, HTML, and DOCX round trips; PDF export preserves
  mixed-direction reading order and positioning.
- **Multi-column sections.** Page layout now supports one, two, or three
  newspaper-style columns with a configurable gap. Continuous section breaks
  balance their final columns, while page and next-page sections keep ordinary
  pagination. The canvas editor and PDF export share the flow rules, DOCX and
  HTML import/export preserve the settings, and `set_page_layout` exposes
  `columnCount`, `columnGap`, and section-scoped updates to browser and
  server agent sessions.
- **Native document-structure tools.** `insert_block` can create a live table
  of contents with `<toc levels="3"></toc>`. The canonical
  `remove_blocks` tool can delete a counted range, exact IDs, a saved search
  result, or an explicitly authorized document tail with `through_end`.

### Changed

- **Agent tool sessions avoid unproductive read cycles.** Sequential reads now
  reject windows containing only blocks already returned in the same request
  with `no_new_read_context`; `read_specific_blocks` remains available for
  intentional revisits. `remove_blocks` is now the model-facing name, while
  the previous `remove_block` name remains an executable compatibility alias.

### Fixed

- **Strict-provider nulls behave like omitted optional tool fields.** Browser
  and server tool execution normalize provider-materialized `null` values
  from the generated schema before dispatch, without stripping required or
  deliberately nullable values. Optional layout and mutation inputs therefore
  no longer take invalid branches merely because a provider filled them in.
- **Agent-generated Unicode escapes become the intended text.** Literal
  `\uXXXX` sequences in agent HTML and replacement paths are decoded without
  disturbing escaped backslashes or code spans, preventing visible escape text
  in edited documents.
- **Review decisions preserve the reader's place.** Accepting or rejecting a
  tracked change no longer forces the embedded editor to scroll back to the
  active suggestion.
- **SDK PDF export keeps Hebrew and Arabic text self-contained.** The package
  now bundles the Noto fallback faces used by RTL export, so embedding hosts do
  not need to mirror Revise's public font directory to avoid dropped glyphs.

## 1.0.1

### Fixed

- **Malformed model input can no longer crash a host's agent loop.** A bare
  string where `search_document` expects a `queries` array — the most
  common model slip — threw a raw `TypeError` out of `execute()` /
  `executeDynamic()` instead of returning a structured failure. Bare
  strings are now coerced to one-element arrays (also for
  `read_specific_blocks`' `block_ids`), anything uncoercible fails
  structurally, and both surfaces gained a safety net that converts an
  unexpected handler throw into an `internal_error` result. The documented
  contract — expected failures as results, only environment errors reject —
  now holds for arbitrary input.
- **Invalid enum values no longer mutate the wrong target silently.** An
  insert tool called with `position: "above"` placed content _after_ the
  reference block while reporting success, and `set_header_footer` with a
  misspelled or missing `side` edited the header. Both now return a
  structured failure naming the valid values.

## 1.0.0

One package, one tool contract. The browser and server surfaces now speak
the same canonical envelope, so host result-handling code is shared verbatim
between web and Node. That convergence is breaking on the browser side —
every change is listed below.

### Breaking

- **`tools.execute()` returns the canonical discriminated envelope.** The
  flat `{ toolCallId, name, success, error?, agentFeedback?, output?,
documentContent? }` result is gone. Both surfaces now return
  `{ ok: true, value: { callId, tool, message, data, context, suggestionIds } }`
  or `{ ok: false, error: { callId, tool, code, message } }`
  (`ReviseToolResult`). Field mapping: `toolCallId → value.callId`,
  `name → value.tool`, `agentFeedback → value.message`,
  `output → value.data`, `documentContent → value.context.html`;
  `view_image`'s attachment lives on `value.image`.
  `ReviseEditorToolExecutionResult` no longer exists.
- **`tools.execute()` is typed and no longer routes `document_id`.**
  `execute()`/`call()` take the generated per-tool input types and
  cover the shared 24-tool contract; untrusted model calls — including the
  browser-only `get_selection`, `view_image`, and
  `revise_run_agent`, and model-facing `document_id` routing — go
  through the new `executeDynamic()`, exactly as on the server.
- **Unknown tools and role denials are results, not throws.** `execute()`
  returns `{ ok: false }` with `code: "unknown_tool"` or
  `"role_not_permitted"` instead of throwing; the new `tools.call()`
  throws a typed `ReviseToolError` for hosts that prefer exceptions.
  `ReviseRoleError` is still thrown by `agent.run()` and UI
  controllers.
- **ID-keyed suggestion decisions return per-ID outcomes.**
  `review.acceptSuggestions`/`rejectSuggestions`,
  `review.acceptCommentSuggestions`/`rejectCommentSuggestions`, and
  `tools.acceptAllSuggestions`/`rejectAllSuggestions`, and the server
  session's `acceptSuggestions`/`rejectSuggestions` return
  `{ resolved, missing, unresolved }` (`ReviseSuggestionDecision`)
  instead of a bare count. Stale IDs land in `missing`; a role that may
  not resolve reports everything `unresolved`. `review.acceptAll()` /
  `rejectAll()` keep their boolean UI-gesture contract.
- **Server sessions default to suggesting mode.** `createServerDocumentSession`
  without `mode` now proposes tracked changes instead of applying edits
  directly — the same default posture as the browser surface, and the safe
  one. Pass `mode: "editing"` (or per-call `directMode: true`) for
  direct application.

### Added

- **Browser mutation results report created suggestion IDs.** Successful
  mutations carry `suggestionIds` — the tracked records that call created
  (empty for direct edits, `null` for read/search/measure tools) — with a
  concurrent human suggestion never attributed to the tool call. Feed them
  straight to `review.acceptSuggestions()`.
- **The tool contract types ship from both entries.** `ReviseToolResult`,
  `ReviseToolResponse`, `ReviseToolFailure`, `ReviseToolError`,
  `ReviseSuggestionDecision`, the generated `ReviseToolInputMap`, and
  friends are exported by `@reviseio/sdk` and `@reviseio/sdk/backend`
  alike.

- **Server mutation results report the tracked records they created.**
  Successful mutation calls from `createServerDocumentSession` now carry
  `suggestionIds` — the tracked suggestion records that call created (empty
  for direct edits, `null` for read/search/measure tools) — so a host can
  persist per-edit IDs with its review workflow instead of diffing the
  document-global pending set.
- **`listSuggestions()`** returns every pending suggestion as a reviewable
  record with authorship metadata (`authorType`, `agentName`,
  `agentModel`, `source`, `label`, `createdAt`), so hosts can decide on
  their own agent's suggestions and leave collaborators' pending work alone.
- **`acceptAllSuggestions()` / `rejectAllSuggestions()`** make the
  whole-document decision an explicit, greppable call instead of the
  `acceptSuggestions(getPendingSuggestionIds())` idiom.

### Fixed

- **Server tool types now resolve for `moduleResolution: "NodeNext"`
  consumers.** The packaged declarations re-exported the server tool contract
  through extensionless relative specifiers, which NodeNext cannot resolve —
  every tool input/output type silently degraded to `any`, and importing a
  contract type by name (e.g. `ServerDocumentSession`) failed to compile.
  The declarations now use explicit `.js` specifiers, which every supported
  resolution mode maps to the sibling `.d.ts` files.
- **Importing a document with code blocks no longer risks crashing a Node
  host.** The canvas syntax highlighter tried to fetch its tree-sitter wasm
  under Node (the server DOM shims install a jsdom `window`, defeating its
  browser check), failing as an unhandled promise rejection. Highlighting now
  recognizes the server runtime explicitly and stays off, and a failed
  highlighter init in the browser no longer poisons later attempts.
- **Table and list mutations no longer spam `Invalid access` warnings.**
  Building table rows, cells, and list items called Yjs `push()` on
  elements not yet integrated into a document, which logs a warning per
  child. Construction now inserts children at explicit indices — dozens of
  stderr lines per table insert in server logs, gone.
- **Editing mode applies server edits directly again.** A server session in
  `"editing"` mode quietly recorded every mutation as a
  pending tracked suggestion instead of applying it. Editing-mode calls now
  run in the runtime's direct mode and settle within the call, matching the
  documented behavior; an explicit per-call `directMode` still overrides in
  either direction.

## 0.9.0

### Added

- **`review.listChanges()` now reports linked moves as moves.** A move pair
  surfaces as ONE `ReviseTrackedChange` with `kind: "move"`,
  `moveSourceBlockIds`/`moveDestinationBlockIds` locating each half, and
  `deletedText`/`insertedText` carrying the text as it left and as it
  arrived. Previously both halves were folded into a single change labeled
  `"delete"`, leaving a host review panel no way to distinguish a move from
  a replacement. Accept/reject semantics are unchanged: resolving the change
  settles both locations atomically.

## 0.8.0

### Added

- **Cut and paste now creates native linked moves in Suggesting mode.** Cutting
  text from supported paragraphs and pasting that same internal clipboard
  payload elsewhere in the document produces one atomic “Moved from”/“Moved
  here” pair. Accepting or rejecting either half resolves both locations, undo
  cannot strand an orphaned half, and DOCX export/reimport preserves native
  linked move markup. Copy/paste, editing mode, reused or mismatched clipboard
  payloads, and unsupported structural selections continue to use ordinary
  insertion/deletion behavior.

## 0.7.0

### Added

- **Server-side semantic tools.** `await createServerDocumentSession(ydoc,
{ documentId, mode })` in `@reviseio/sdk/backend` binds the canonical
  document-local agent tools — read, search, measure, mutate, layout,
  footnotes, tables, comments — to a host-owned Y.Doc under plain Node.
  `mode: "suggesting"` produces Word-compatible tracked changes with
  accept/reject; concurrent calls are serialized; literal tool calls infer
  their schema inputs and structured outputs. See the README's "Server semantic
  tools" section.
- **Linked Word moves now round-trip as atomic move suggestions.** DOCX import
  pairs native `w:moveFrom` and `w:moveTo` ranges across runs, paragraphs,
  and table cells. Accepting either half keeps the text at its
  destination; rejecting either half restores its original location; export
  re-emits native paired move markup. Suggestion cards distinguish “Moved from”
  and “Moved here”, and focusing either half highlights its partner even across
  paragraphs.

### Fixed

- **Node-side DOCX imports preserve tracked table-row revisions without a
  browser `FileReader`.** The backend DOM shims and table-revision
  postprocessor now work from `Blob.arrayBuffer()`, retaining row insertion
  and deletion metadata in server integrations.
- **Word comment anchors preserve their identity and semantic range.** Safe
  native numeric IDs no longer shift, cross-paragraph and table-cell ranges
  emit one anchor triple instead of duplicates, and collapsed, overlapping,
  threaded, and resolved comments survive repeated round trips.
- **Visible drawing text survives DOCX import when shape geometry is
  flattened.** Inline and anchored DrawingML, grouped shapes, legacy VML,
  headers, and standards-valid `mc:AlternateContent` Choice/Fallback content
  become editable paragraphs in reading order without duplicate fallback text.
- **DOCX archives no longer inflate and large imports avoid repeated work.**
  Generated packages use DEFLATE compression, parse the main document XML once,
  and skip move indexing when a file has no moves, preventing the reported
  multi-fold output growth and superlinear no-move scan.

## 0.6.0

### Added

- **Horizontal rules and ornamental dividers are now supported throughout the
  editor.** Insert thin, thick, double, dashed, dotted, star, or diamond
  dividers from the toolbar or context menu, or create them with text triggers
  such as `---`, `===`, `-**-`, and `-<>-`. DOCX, HTML, Markdown, agent HTML,
  PDF, and plain-text output preserve the divider where the format permits;
  DOCX, HTML, Markdown, RTF, and ODT imports recognize their native divider or
  paragraph-border representations.

### Changed

- **Em-dash autocorrection now waits for a word boundary.** Typing `--` remains
  literal until Space or Enter, allowing `---` to be used for horizontal-rule
  insertion and preserving word-initial values such as `--flag`.

### Fixed

- **Words no longer wrap in the middle at formatting or tracked-change run
  boundaries.** A word split across differently styled text nodes now wraps as
  one unit and keeps a stable layout when suggestions are accepted.
- **Suggestion editing produces stable runs and caret placement.** Continued
  typing or backspacing merges into the existing suggestion instead of creating
  one run per keystroke, replacement normalization no longer leaves the caret
  inside hidden deleted text, and Enter after a pending deletion creates the
  expected paragraph or list item without moving the deleted content.
- **Structural editing keeps the expected document shape and keyboard focus.**
  Backspace exits or splits empty list items correctly, compatible lists rejoin
  when their separating empty paragraph is removed, Enter at the start of a
  leading heading or code block creates a body paragraph above it, and toolbar
  commands no longer steal keyboard focus from the editor.

## 0.5.1

### Fixed

- **PDF table-of-contents page numbers stay accurate when a heading moves to
  the next page.** Export now records a heading's destination after paragraph
  pagination, so a keep-with-next or end-of-page preflight cannot leave the
  TOC pointing at the page the heading would have occupied before it moved.

## 0.5.0

### Added

- **Comments now work on list items, including nested items.** Selecting list
  text, expanding a word from the caret, and commenting on a whole item all
  create item-local anchors. Returning the caret to that text activates the
  thread, list-item threads survive agent-HTML round trips, and the
  `leave_comment` agent tool accepts list-item IDs.

### Changed

- **PDF export now follows the editor's layout and print semantics much more
  closely.** It shares wrapping and pagination rules for tab stops and
  leaders, hyphenation, keep-with-next, keep-lines, widows and orphans, code
  blocks, nested tables, footnotes, page and section breaks, live TOC page
  numbers, line numbers, and watermarks. Editor-only placeholders and review
  chrome are not printed, and Word hidden text remains hidden in ordinary PDF
  output. The SDK now carries its metric-compatible PDF fonts itself, so an
  embedding host does not need to mirror Revise's public font directory.
- **Agent tool sessions reject redundant full-document read loops.** After a
  session has read the complete document, another sequential `read_document`
  returns `no_new_read_context`; agents can still revisit known content with
  `read_specific_blocks`.

### Fixed

- **DOCX formatting exceptions survive a complete edit and export cycle.**
  Explicit run-property clears over named styles, zero paragraph indents,
  paragraph border and shading clears, decimal font sizes, and mixed small-cap
  and all-cap overrides now remain distinct from inherited formatting and do
  not leak into adjacent text.
- **Complex Word structures no longer lose modeled content on re-export.**
  Internal bookmark links stay internal; exact table widths, columns,
  alignment, cell padding, and vertical alignment survive; nested tables keep
  the paragraphs around them; display equations are not flattened when a file
  is immediately re-exported; and multi-block footnotes and endnotes can retain
  their lists and tables.
- **Accepting or rejecting a compound agent edit is atomic.** Mixed text,
  formatting, and structural suggestions are resolved together, so accepting
  a rewrite no longer retains deleted fragments and rejecting it restores the
  original content and formatting.
- **Comment cards stay where users put them.** A previously active card no
  longer drifts with the viewport, and selecting text inside a card no longer
  jumps focus back to the document or clears the selection. Inline code in
  comment bodies is also styled as code.
- **Package managers can no longer omit the Yjs runtime.** Every editor session
  is Yjs-backed even without a collaboration provider, so `yjs` and
  `y-protocols` are now required peers instead of optional peers. This makes
  package managers install or validate them instead of letting bundlers
  substitute empty optional-peer modules and fail the consumer build.

## 0.4.5

### Fixed

- **Starting a list no longer drops the font.** Typing a list trigger
  (`- `, `1. `, `[] `) in a paragraph set in a non-default font produced
  a list item that fell back to the default font: clearing the trigger text
  left an empty item with nowhere to carry its formatting. The formatting at
  the trigger's trailing edge — the font family included — is now preserved
  on the empty item and applies to the next character typed.

## 0.4.4

### Fixed

- **Suggestion cards now hang from the suggested text.** The floating
  accept/reject card anchored to the caret; it now follows the suggested
  fragment (or your selection) and sits centered below its line, the same
  placement the revise.io app uses, falling back to the caret only when the
  fragment cannot be measured. Wide cards are clamped to the page edges
  instead of a fixed margin.

## 0.4.3

Identical in content to 0.4.2; republished.

## 0.4.2

### Fixed

- **Word-level diffs misplaced edits next to repeated words.** When the text
  adjacent to an edit repeated a word from the edit itself (replacing
  "[Berkshire County / appropriate Massachusetts county]," with "Suffolk
  County, Massachusetts," just before "Massachusetts will"), the unchanged
  suffix could be drawn as deleted and retyped. Unchanged repeated words now
  stay anchored as unchanged, in tracked changes and the diff view alike.
- **Writing a comment no longer collapses the comments margin.** Finishing a
  draft that had itself opened the margin always collapsed it — even when
  submitting had just created a thread, so the pages jerked sideways in both
  directions and hid the card the user just wrote. The margin now stays open
  on the new thread; only an abandoned draft with no other open thread
  collapses it.
- **Comment card placement around drafts and tracked changes.** A comment
  draft started while hovering the card stack could pin its card — and drag
  the viewport — to the top of page 1; it now anchors where the draft was
  made. A caret inside a resolved thread's highlight, or inside an imported
  thread's replies, activated no card at all; it now activates the right
  open thread. And when a commented paragraph also contains tracked changes,
  the card describes the change under the cursor instead of jumping to the
  top of the paragraph.
- **The selection card no longer chases the pointer mid-drag.** While the
  mouse button is down nothing pops up under the pointer; the card appears
  on release, anchored below the selection the user meant.

## 0.4.1

### Fixed

- **Opening the export menu crashed.** An icon component in the export menu
  referenced React without importing it, which the packaged build has no
  global to fall back on.

## 0.4.0

### Changed

- **The default entry no longer ships Tree-sitter syntax highlighting or the
  embedded WASM payload.** Code blocks still render as code, and every WASM
  hot path has a TypeScript implementation. This keeps the normal
  integration smaller and compatible with strict Content Security Policies.
  Optional features now load as async chunks inside the package.

### Added

- **`@reviseio/sdk/full`** — an opt-in entry point that keeps token-colored
  code blocks and the WASM hot paths. The API and stylesheet are identical
  between the two entries.

## 0.3.4

### Fixed

- **The SDK no longer attempts any telemetry.** Earlier builds emitted
  editor health metrics toward a Revise backend that does not exist in your
  deployment, which could only fail — loudly, as console CORS errors — and
  represented network calls you never asked for. Telemetry is now something
  only the revise.io application itself can switch on; embedded editors
  send nothing anywhere: no metric POSTs, no analytics vendor code, no
  beacons.

### Added

- **`onAnalyticsEvent`** — the editor's own instrumentation, delivered to
  the host instead:
  `<ReviseEditor onAnalyticsEvent={(event, properties) => ...} />`.
  Forward events to your own analytics service; a throwing handler never
  breaks the editor. Event names and property shapes are internal and
  version-unstable.

## 0.3.3

Four suggesting-mode fixes, two of them content corruption. If your users
edit in `suggesting` mode — the mode this SDK exists for — take this
release.

### Fixed

- **Pasting in suggesting mode corrupted the document.** The paste path
  predated suggesting mode: it duplicated the rest of the paragraph and
  inserted the pasted text without tracked-change marks, so the paste was
  invisible to review and survived reject. Pasting is now recorded exactly
  as if the pasted characters had been typed — an insertion suggestion, plus
  a deletion suggestion for any replaced selection.
- **Formatting across a pending change destroyed it.** Applying bold (or any
  inline format) over a range touching a pending insertion or deletion
  overwrote the change's identity; resolving the format then silently turned
  a pending insertion into accepted text, or resurrected deleted text.
  Formatting now leaves deletion spans alone, folds into insertion spans (as
  Word nests run properties inside `w:ins`), and records a reviewable
  format change only on unmarked text.
- **Accepting a deletion that crossed a paragraph boundary left the
  paragraphs unmerged.** The boundary is now part of the suggestion, as the
  pilcrow is in Word: accepting merges the paragraphs, in any resolution
  order, for any number of paragraphs in the selection.
- **Copying a selection inside your own pending insertion copied nothing.**
  It now copies the selected text. Clipboard payloads are also sanitized so
  tracked-change marks never travel with copied content.

### Console

- Opening a document no longer logs to the console (previously one Yjs
  warning per block plus two internal debug lines). `console.warn` and
  `console.error` remain for genuinely actionable problems.

## 0.3.2

### Fixed

- `editor.whenReady()` was missing from the published type declarations. It
  worked at runtime, but TypeScript rejected the call the documentation tells
  you to make.

## 0.3.1

### Fixed

- Using the editor handle from `onReady` no longer throws. `onReady` fires
  before any document exists, and "subscribe to everything on ready" is the
  first thing a host writes — a subscription placed then now waits and
  attaches when a document arrives. `selection.observe()` was affected too.
  Methods that act on a document still fail loudly, and the message now names
  the fix.

### Added

- `editor.whenReady()` — resolves once a document is open and its
  controllers are usable.
- `REVISE_SDK_VERSION` and `REVISE_SDK_BUILD` exports, and a `bugs` entry
  in the manifest: a support ticket can name the exact build it came from.

## 0.3.0

### Collaboration

Multi-user editing over a Yjs transport you own. The editor builds the
document; you attach the connection:

```ts
collaboration: {
  connect: (doc, awareness) =>
    new HocuspocusProvider({ url, name, document: doc, awareness }),
  synced,
}
```

Remote carets, a presence roster (`editor.collaboration`), seed-or-join
semantics, and validation of any document you supply. See the collaboration
guide.

### Roles

`role="editor" | "suggester" | "viewer"`, editor-wide or per document, and
enforced on every surface: typing, the built-in chrome, the handle, and agent
tool calls. A suggester cannot leave suggesting mode, apply anything directly,
or accept and reject.

### Tracked changes you can list

`review.listChanges()` and `review.getChange(id)` return each pending change
with its kind, author, timestamp, affected blocks, and text — enough to build
your own review panel. Imported Word redlines keep their original reviewers.

### Server-side primitives

New subpath export `@reviseio/sdk/backend` (Node only): `parseDocument`,
`fileToYDoc`, `seedYDocFromFile`, `ydocToDocx`, `encodeYDoc`/`decodeYDoc`.
Your server can create a collaborative room from a .docx before any browser
connects, and export a live room without one. Requires `jsdom`.

### Breaking

- **`yjs` and `y-protocols` are now peer dependencies** and are no longer
  bundled. Install them yourself, and make sure your bundler resolves ONE copy
  — Yjs identifies its own types with `instanceof`, so a second copy breaks a
  shared document. Only collaboration needs them; they are optional peers.
- **`ReviseDocumentInput.docx` is now optional**, since a document joining a
  collaborative room needs no source file. Inputs must supply `docx`,
  `collaboration`, or both.

### Fixed

- `search_result_id`, which the agent tool schemas advertise for bulk edits,
  was unusable: tool state did not survive between `tools.execute()` calls.
- `exportDocx()` omitted TOC page numbers, which only the live layout knows.
- Exports lost imported named styles and reset core property dates in any
  non-browser environment.
- `collaboration.synced` was read once at mount, so a host reporting sync
  later was ignored and the document never opened.
- The margin insert-comment chip was missing from the embedded editor.
- Presence colors: an explicit `currentUser.color` was ignored whenever the
  user had an id.

## 0.2.0

Multi-document sessions, host-owned chrome, skinning props, per-embed
theming, the selection controller, and comment-thread agents.

## 0.1.0

First release: the editor, DOCX in and out, tracked changes, comments, and
the agent tool surface.
