revise 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +47 -1088
  2. package/LICENSE +24 -41
  3. package/README.md +103 -26
  4. package/agent.d.ts +139 -0
  5. package/chunks/chunk-U5X47PZ6.js +135 -0
  6. package/chunks/chunk-U6YKQBKL.js +15 -0
  7. package/chunks/chunk-ZLQVPMBN.js +1650 -0
  8. package/chunks/package-5SHL5FOJ.js +14 -0
  9. package/chunks/render-QD5VWKSV.js +109 -0
  10. package/cli-output.schema.json +1984 -0
  11. package/cli.js +3604 -0
  12. package/document.d.ts +320 -0
  13. package/docx.d.ts +73 -0
  14. package/errors.d.ts +14 -0
  15. package/index.d.ts +13 -967
  16. package/index.js +31 -1
  17. package/legacy/editor.d.ts +19 -0
  18. package/legacy/editor.js +16 -0
  19. package/legacy/server.d.ts +37 -0
  20. package/legacy/server.js +25 -0
  21. package/legacy/style.css +2 -0
  22. package/package.d.ts +23 -0
  23. package/package.json +49 -55
  24. package/render.d.ts +27 -0
  25. package/FONT-LICENSE-HAN-EXT-B.txt +0 -91
  26. package/FONT-LICENSE-KATEX.txt +0 -95
  27. package/FONT-LICENSE-LIBERATION.txt +0 -102
  28. package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +0 -93
  29. package/FONT-LICENSE-NOTO-SANS-SC.txt +0 -93
  30. package/FONT-LICENSE-NOTO.txt +0 -94
  31. package/FONT-LICENSE-SOURCE-CODE-PRO.txt +0 -94
  32. package/FONT-LICENSE-SOURCE-SERIF-4.txt +0 -93
  33. package/THIRD-PARTY-NOTICES.md +0 -3376
  34. package/assets/historyMaterializeWorker-C4uxcZEh.js +0 -607
  35. package/backend.d.ts +0 -155
  36. package/backend.js +0 -3
  37. package/chunks/AgentPageRenderer-BFB0arQL.js +0 -1
  38. package/chunks/AgentPageRenderer-Dn6SaRjW.js +0 -1
  39. package/chunks/AttachmentDocumentImporter-BHDJAdky.js +0 -1
  40. package/chunks/AttachmentDocumentImporter-CxOZqzt1.js +0 -1
  41. package/chunks/BidiText-C8PBPSQY.js +0 -160
  42. package/chunks/ColorParserFull-BKH72fK8.js +0 -446
  43. package/chunks/DocumentMutator-4vBJQ74L.js +0 -31
  44. package/chunks/DocumentScrubber-COPepQKE.js +0 -1
  45. package/chunks/DocumentScrubber-Cf_QqHhF.js +0 -1
  46. package/chunks/DocumentScrubber-DS4LFDKS.js +0 -18
  47. package/chunks/DocumentStylesheet-byN5dtC6.js +0 -7
  48. package/chunks/DocxConverter-BCEB7jWY.js +0 -1083
  49. package/chunks/DocxConverter-C3NflpDr.js +0 -11
  50. package/chunks/DocxConverter-D9ZNn4nX.js +0 -11
  51. package/chunks/DocxGraft-Ba63IRP4.js +0 -1
  52. package/chunks/DocxGraft-DjERgl-z.js +0 -7
  53. package/chunks/DocxGraft-cYlmw4Ab.js +0 -1
  54. package/chunks/FileImporter-CHXj9sNX.js +0 -1
  55. package/chunks/FileImporter-DetvRoJc.js +0 -1
  56. package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +0 -3
  57. package/chunks/HtmlConverter-Sd9t49vH.js +0 -267
  58. package/chunks/ListNumbering-Qlu6AuRZ.js +0 -23
  59. package/chunks/MarkdownConverter-BdJgh8xt.js +0 -57
  60. package/chunks/MathRenderer-B0Y1h1JU.js +0 -62
  61. package/chunks/OdtConverter-BKtyx012.js +0 -1
  62. package/chunks/OdtConverter-Ce9j8PRt.js +0 -1
  63. package/chunks/OdtConverter-D709qfYb.js +0 -31
  64. package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +0 -36
  65. package/chunks/PdfConverter-BA8XLTAM.js +0 -21
  66. package/chunks/PdfConverter-CkDClffR.js +0 -438
  67. package/chunks/PdfConverter-CxLxd-LJ.js +0 -21
  68. package/chunks/PdfImportService-CQCgsRX1.js +0 -2
  69. package/chunks/PdfImportService-xl7fstr-.js +0 -2
  70. package/chunks/RtfConverter-BZOnMUGH.js +0 -14
  71. package/chunks/RtfConverter-Bs81AfXt.js +0 -14
  72. package/chunks/RtfConverter-DfuE5olb.js +0 -45
  73. package/chunks/TableBorders-Cdkc62cX.js +0 -30
  74. package/chunks/TableGrid-DbroRucl.js +0 -12
  75. package/chunks/TextFileDecoder--rsVs3NR.js +0 -9
  76. package/chunks/TxtConverter-C-oiFUAp.js +0 -14
  77. package/chunks/UnicodeUtils-CXtusU4g.js +0 -10
  78. package/chunks/XmlConverter-C0FnrVYk.js +0 -70
  79. package/chunks/XmlConverter-CQa8baOF.js +0 -2
  80. package/chunks/XmlConverter-DjEYaIyf.js +0 -2
  81. package/chunks/__vite-browser-external-l0sNRNKZ.js +0 -0
  82. package/chunks/_commonjsHelpers-DaMA6jEr.js +0 -2
  83. package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +0 -1
  84. package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +0 -1
  85. package/chunks/ar-BdmGnaKI.js +0 -14
  86. package/chunks/backend-BIhAX-Gi.js +0 -484
  87. package/chunks/base64-Qx0OzT4p.js +0 -196
  88. package/chunks/browser-module-CFmqfGkE.js +0 -1791
  89. package/chunks/browser-module-CYGCfEyx.js +0 -3
  90. package/chunks/browser-module-DgvTMhpA.js +0 -3
  91. package/chunks/bundle.min-DRpfgV69.js +0 -782
  92. package/chunks/capture-BAJ2in5p.js +0 -9
  93. package/chunks/carrier-C5VZRMxZ.js +0 -6
  94. package/chunks/de-DldIXRFC.js +0 -14
  95. package/chunks/es-CnyKlSPK.js +0 -14
  96. package/chunks/footnoteFlatten-Bekh8ZfM.js +0 -6
  97. package/chunks/graftExport-CRRm1Oe_.js +0 -82
  98. package/chunks/html2canvas.esm-CntiHiYW.js +0 -997
  99. package/chunks/index-B1idHquf.js +0 -1094
  100. package/chunks/index-BWdRWxoH.js +0 -1807
  101. package/chunks/index-C-4H81OE.js +0 -378
  102. package/chunks/index-iZC8xN0t.js +0 -378
  103. package/chunks/index.es-Bwt05m_b.js +0 -5
  104. package/chunks/index.es-CI0QPo8w.js +0 -780
  105. package/chunks/index.es-DAQD57G4.js +0 -5
  106. package/chunks/jspdf.es.min-CnNRolk9.js +0 -77
  107. package/chunks/jspdf.es.min-DU74zN8b.js +0 -1792
  108. package/chunks/jspdf.es.min-DlTF8uTw.js +0 -77
  109. package/chunks/jszip.min-CPW0h1Kx.js +0 -476
  110. package/chunks/katex-DWj8TvwO.js +0 -1462
  111. package/chunks/pdf-BLWDCiFF.js +0 -1828
  112. package/chunks/persistInlineDocumentImages-DQj2iaqg.js +0 -1
  113. package/chunks/pseudoLocale-BoJwIubw.js +0 -1
  114. package/chunks/pseudoLocale-DWAm7Dpa.js +0 -1
  115. package/chunks/purify.es-BwLardii.js +0 -107
  116. package/chunks/serverDocumentSession-DASrQAbW.js +0 -15
  117. package/chunks/signatures-CBF7NZUy.js +0 -17
  118. package/chunks/tree-sitter-D6zWWUMP.js +0 -4
  119. package/chunks/wasmInline.generated-CBYFkdSM.js +0 -1
  120. package/chunks/web-tree-sitter-BXGZGnNj.js +0 -2
  121. package/full.js +0 -1
  122. package/root.d.ts +0 -5
  123. package/root.js +0 -2
  124. package/serverToolContract.d.ts +0 -391
  125. package/serverToolInputs.generated.d.ts +0 -250
  126. package/style.css +0 -1
package/CHANGELOG.md CHANGED
@@ -1,1090 +1,49 @@
1
1
  # Changelog
2
2
 
3
- ## 2.1.0
4
-
5
- ### Added
6
-
7
- - **`source` on document inputs.** `{ id, source: file }` names the field for
8
- what it takes: DOCX, Markdown, plain text, or HTML. `docx` still works as the
9
- same field; passing both with different values throws.
10
- - **`context_notes` is optional in typed host calls.** `tools.execute()` and
11
- `tools.call()` (browser and `revise/server`) fill in `"N/A"` for the read and
12
- search tools, so application code no longer passes a model's working memory.
13
- `executeDynamic()` keeps the schema requirement for model-provided calls.
14
- - **`leave_comment` reports a retargeted anchor.** When the anchor text is not
15
- in the named block and the comment goes to the only read block that has it,
16
- `data.requestedBlockId` names the block you asked for and the message says so.
17
-
18
- - **`read_table` and `edit_table_cells` agent tools.** Read a large table in
19
- bounded windows (a summary, up to 50 rows, or one oversized cell in pages),
20
- then set the plain text of up to 50 cells per call by row ID and column.
21
- Cell text is written literally. Only cells a `read_table` call returned in
22
- full can be edited, and that read stays valid across later `execute()` calls
23
- on the same document while the cell and table geometry remain unchanged.
24
- An invalid target rejects the whole batch with no changes. In suggesting mode each cell is its own suggestion. Read-only
25
- surfaces and viewers get `read_table` only. Both tools are also in the
26
- `revise/server` session. The SDK's `read_table` does not take the native
27
- agent's task-declaration arguments (`task_kind`, `scope_*`,
28
- `source_attachment_id`, `deliberate_blanks`). They are left out of the
29
- published schema, and a call that supplies one fails with
30
- `unsupported_argument` without reading anything. Empty placeholders
31
- (`null`, `""`, `[]`) are ignored.
32
-
33
- ### Changed
34
-
35
- - **The delegated agent plans long tasks.** `agent.run()`, `revise_run_agent`,
36
- and comment agents keep a step-by-step plan for multi-step work, update it
37
- in the same turns as their edits, and save it with the conversation, so
38
- fewer turns go to bookkeeping. The embedded tool list is unchanged: plan
39
- tools stay inside the delegated agent.
40
- - **Faster on long documents.** The scrollbar track and its markers are drawn
41
- once and reused while scrolling, Find reuses each block's normalized text
42
- between keystrokes, and tracked-change records are indexed in one pass
43
- instead of one document walk per suggestion.
44
-
45
- ### Fixed
46
-
47
- - **DOCX paragraph spacing follows the document's rules.** `w:contextualSpacing` no longer
48
- zeroes a paragraph's declared space before and after on import. Spacing is
49
- resolved from neighboring paragraphs on screen, in table cells and
50
- containers, and in PDF export: the gap between two paragraphs is the larger
51
- of their spacings, not the sum, and contextual spacing drops it only between
52
- paragraphs of the same style. PDF keep-with-next reserves the whole gap, and
53
- exported DOCX keeps the declared spacing. Documents whose paragraphs both
54
- declare spacing lay out tighter than in 2.0.x.
55
- - **`style_blocks` with `list-style-type: none` turns list items into plain
56
- paragraphs**, keeping their spacing and line spacing and applying the call's
57
- other paragraph attributes in the same step.
58
- - **Unsupported DOCX content can be suggested for removal.** In suggesting
59
- mode, removing a block the editor preserves but cannot render (an opaque
60
- DOCX payload) now becomes a tracked deletion.
61
- - **Comment previews keep their layout.** In a comment chip's hover preview,
62
- the avatar holds its size and a long author name is truncated.
63
- - **An editor with no agent configured sends nothing.** `agent.run()`, the
64
- `revise_run_agent` tool, and comment agents used to stream the document,
65
- unauthenticated, to Revise's hosted agent and then report a generic
66
- connection error. Without a `turnStream`, `baseUrl`, or `token`, they now
67
- fail at once with `agent_not_configured` (`AgentNotConfiguredError` from
68
- `agent.run()`), and `getToolDefinitions()` leaves the delegation tool out.
69
- - **`documents.open()` activates the new document every time.** Opening a
70
- document straight after another open, or after `documents.activate()`, left
71
- the earlier one active. `documents.list()` status was also briefly stale
72
- right after a document became ready.
73
- - **`tools.getDefinitions()` lists only the native tools.** It included
74
- `revise_run_agent`, which the docs say it leaves out.
75
- - **Changing `agent.turnStream` no longer reloads the document.** A new
76
- `turnStream` or `disableMetrics` value re-created the document runtime,
77
- re-parsing the source and dropping unsaved edits, so an inline generator in
78
- JSX reloaded the document on every render. Agent settings now apply to the
79
- next run in place.
80
- - **Reads are not refused for the life of the editor.** After a window had
81
- been read once, every later `read_blocks_from_index` of it failed with
82
- `no_new_read_context`, so a host agent's second conversation could not read
83
- the document. The guard now resets with each call, like the other per-turn
84
- limits.
85
- - **Tool errors speak to SDK callers.** Messages no longer carry the internal
86
- `Failed operation: <tool>: <Error>:` prefix or point at `<document_content>`,
87
- which only Revise's own agent sees; they point at read results instead.
88
- - **The open-error screen shows a plain message.** A corrupt file showed the
89
- parser's internals (a zip library's message and link) to the person who
90
- picked it. `onError` still receives the full detail. Loading text no longer
91
- says "DOCX" for other formats, and a `File` source's title drops `.md`,
92
- `.txt`, and `.html` extensions as well as `.docx`.
93
- - **PDF export requests a failing font once.** When a font download failed
94
- (a CSP or firewall blocking revise.io, say), export requested the same URL a
95
- second time. The warning now says a fallback font was used and names
96
- `setAssetBaseUrl()` for mirroring the fonts.
97
- - **Readable errors from the package in Node.** Bundled code is wrapped at
98
- short lines, so an uncaught error (such as the missing-`jsdom` hint) is no
99
- longer printed under a 100 KB line of minified source.
100
- - **Quieter host builds.** Vite no longer warns that `"buffer"` was
101
- externalized, or prints the inlined WebAssembly's base64 as a file that
102
- "doesn't exist at build time".
103
-
104
- ## 2.0.1
105
-
106
- ### Added
107
-
108
- - **`tools.export({ format, mode })`.** Export as DOCX, PDF, HTML, Markdown,
109
- or plain text from code, not just the ribbon's Export menu. `mode: "final"`
110
- accepts every pending change and drops comments first for a clean copy;
111
- the default `"review"` keeps tracked changes and comments in a .docx. The
112
- editor-level `tools.export(options, documentId?)` routes to any open
113
- document.
114
- - **`exportDocument(source, options)` in `revise/server`.** The same export
115
- for a room or a parsed document on the server: DOCX, HTML, Markdown, and
116
- plain text, in review or final mode.
117
- - **`onImageUpload(file, documentId)`.** Store images users insert, paste, or
118
- drop in your own storage and return the URL the document should use.
119
-
120
- ### Fixed
121
-
122
- - **Inserting, pasting, or dropping an image works.** It used to post to
123
- Revise's app API, which the SDK cannot reach, so the image never appeared.
124
- Without `onImageUpload`, images are now embedded in the document as data
125
- URLs and export into the .docx. `toolbar.insertImage()` resolves `false`
126
- when an upload fails, and the failure reaches `onError`.
127
- - **Docs:** linked moves are described correctly in Support, the reserved
128
- collaboration keys point to `RESERVED_DOCUMENT_KEYS`, and the delegated
129
- agent page says how to get hosted-agent access.
130
-
131
- ## 2.0.0
132
-
133
- The SDK is now public: `npm i revise`. No account, token, or contact
134
- with us is needed to install it. 2.0.0 also ships everything from the
135
- 2.0.0-alpha releases below.
136
-
137
- ### Changed
138
-
139
- - **BREAKING: the package is now `revise`.** The private `@reviseio/sdk`
140
- package is retired. Update the dependency and imports:
141
- `@reviseio/sdk` → `revise/editor`, `@reviseio/sdk/full` →
142
- `revise/editor/full`, `@reviseio/sdk/backend` → `revise/server`, and
143
- `@reviseio/sdk/style.css` → `revise/style.css`. Remove the `@reviseio`
144
- scope and token lines from `.npmrc`.
145
- - **New license: free for evaluation, personal projects, and education.**
146
- Production use by businesses, nonprofits, and government requires a paid
147
- license. See `LICENSE` and [developer.revise.io](https://developer.revise.io/editor-sdk/license).
148
- The previous 60-day evaluation terms no longer apply.
149
- - **The editor fills its container at any size.** The 640×560px minimum is
150
- gone, so the editor fits phone-width columns and short panels without
151
- overflowing them. A container with no height gets a 560px fallback and a
152
- one-time console warning instead of a collapsed editor.
153
- - **Hosted agent defaults to production.** Without `agent.baseUrl`, the
154
- delegated Revise agent now targets `https://agent.revise.io` instead of a
155
- development address.
156
-
157
- ### Added
158
-
159
- - **A 4.5 MB package, with assets loaded on demand.** PDF export fonts were
160
- inlined as base64 and made up three quarters of the package; they, the math
161
- fonts and stylesheet, the pdf.js worker, and Tree-sitter grammars now load
162
- from `https://revise.io` when first needed. **`setAssetBaseUrl(url)`**
163
- points the SDK at a self-hosted mirror.
164
- - **`import ReviseEditor from "revise/editor"`.** The editor entry now has a
165
- default export. The named `ReviseEditor` export still works.
166
- - **`revise` root entry** with `REVISE_SDK_VERSION`, `REVISE_SDK_BUILD`, and
167
- the shared types, and no runtime weight.
168
- - **`THIRD-PARTY-NOTICES.md`** lists every bundled open-source package with
169
- its license.
170
- - **Anonymous usage ping, and the `telemetry` prop to turn it off.** Once
171
- per page load, the editor sends Revise its version; the browser adds the
172
- site's origin. Development hosts are counted per day and version without
173
- their origin. No cookies, user data, or document content.
174
- `telemetry={false}` disables it.
175
-
176
- ### Fixed
177
-
178
- - **Math renders with its real fonts in host apps.** Equations looked for
179
- their fonts and stylesheet at the host's own `/fonts` and `/katex.min.css`
180
- and fell back to system fonts; the help link in the editor menu also
181
- pointed at the host's `/help`. All now resolve to Revise's assets.
182
- - **The SDK no longer reaches for development servers.** Revise application
183
- endpoints (document history, preferences, uploads, failure reports) and the
184
- sync-server addresses no longer resolve to `localhost` in an embedding
185
- host. Document history in particular fetched from `localhost:3001` in
186
- browsers without a `process` global.
187
- - **No debug globals on the host's `window`.** `__getEditor`,
188
- `__getDocLayout`, and `__aiLogs` are no longer installed.
189
- - **DOCX math export uses Revise's own MathML → OMML converter.** Equations
190
- export to native Word math (fractions, radicals, scripts, sums and
191
- integrals with limits, delimiters, matrices, accents, bars, braces,
192
- functions, boxed and text runs) with no third-party copyleft code in the
193
- package. Re-importing them is more faithful: `\left\{ … \right.`,
194
- `\underline`, `\overbrace`, `\boxed`, `\text{…}`, `\mathbb`, binomials,
195
- and named functions (`\sin`, `\log`, `\lim_{…}`) now come back as the
196
- same LaTeX instead of approximations, and symbols no longer run into the
197
- following letter (`\alpha x`, not `\alphax`).
198
-
199
- ## 2.0.0-alpha.7
200
-
201
- ### Fixed
202
-
203
- - **DOCX round trips keep every modeled mark and block.** A new
204
- export → import matrix (every formatting mark in every text context,
205
- every paragraph, list, table, cell, image, code, math, note, header,
206
- footer, and page-layout attribute, plus a second-pass fixed-point
207
- check) found and pinned a set of losses: lists inside table cells
208
- were dropped on export; hanging indents exported as zero and
209
- `w:hanging` was ignored on import; headings came back as Word's blue
210
- 16pt built-ins (export now writes the editor's heading sizes with
211
- inherited color); unscoped header/footer blocks were not exported;
212
- hyperlinks discarded an explicit text color; links inside footnotes
213
- were lost on import; header and footer runs used a reduced codec in
214
- both directions and now share the body run codec, links and inline
215
- code included; inline code and code blocks flattened to Courier text
216
- and now travel as `CodeInline` / `CodeBlock_<language>` styles and
217
- return as the original nodes; todo items exported as literal
218
- `[x]` text and now use checkbox glyphs that re-import as todo lists
219
- with their checked state; code-block line breaks doubled on
220
- re-import; and a single run in another font restamped the whole
221
- document (the inferred document font is now the character-weighted
222
- majority).
223
- - **Table borders export and re-import faithfully.** Export no longer
224
- throws on non-hex colors such as `TRANSPARENT`, `rgba()`, or CSS
225
- names — unresolvable values are omitted or written as `auto`. The
226
- uniform `borderWidth`/`borderColor` pair is honored (width 0 means
227
- no borders), width-0 spec edges export as `none` instead of a
228
- hairline, and an explicit `w:sz="0"` imports as hidden rather than a
229
- 1px line. Table Settings border changes now rewrite the structured
230
- table spec and clear per-cell overrides, so hiding borders on an
231
- imported table takes effect.
232
- - **Byte-preserving DOCX export degrades instead of failing.** A carrier
233
- that fails to load falls back to the regenerated package like every
234
- other graft failure; the graft option reports its outcome (exact,
235
- grafted, regenerated, and the fallback code) through an isolated
236
- callback that can never break an export. Untouched imports of rich
237
- documents now export byte-identical: note-body font inheritance,
238
- header/footer zone ids, and legacy chrome no longer drift the
239
- fidelity signatures; watermark and settings edits graft instead of
240
- restoring carrier values; body grafting is invalidated when wrapper
241
- or style sidecars change; single-quoted and non-numeric relationship
242
- ids parse; and a changed header image is replaced even when its
243
- media filename collides.
244
- - **Formatting suggestions preserve footnotes.** Accepting a
245
- `style_blocks` suggestion keeps footnote references and bodies.
246
- - **Large documents no longer stall on batch edits.** Styling 205 blocks
247
- in a 10,000-block document, applying 100 replacements, and large
248
- multi-block insertions run without re-decoding the document per
249
- action; suggestion projection latency is bounded; batch paragraph
250
- formatting suggestions behave identically through preview,
251
- acceptance, and rejection.
252
- - **Semantic tool errors and inputs.** Errors distinguish Markdown find
253
- syntax from stored plain text; metric CSS paragraph indentation
254
- (`cm`, `mm`) is accepted; number-dot prose can be parsed as inline
255
- text instead of a list when requested.
256
- - **Comments render AI citations.** Structured citations persist on
257
- replies and render in the panel; unsupported provider citation
258
- markers are hidden, including on legacy comments.
259
- - **Agent image rehosting.** Wikimedia thumbnail URLs are recovered by
260
- rehosting the original image, and rate-limited rehosts surface the
261
- backend reason and status.
262
- - **Revision timeline never collapses to zero.** A stale or missing
263
- server update counter no longer disables history or pins every frame
264
- to the first update; loaded frames are authoritative.
265
- - **Pasted images write once.** A pasted image no longer inserts a
266
- temporary base64 placeholder that is replaced later; the final hosted
267
- URL is written at the captured paste position when the upload
268
- completes.
269
-
270
- ### Changed
271
-
272
- - **Comment margin geometry is direction-aware.** Chip, floating-stack,
273
- and insert-chip positions are computed along an outward axis with a
274
- single conversion to physical coordinates. The embedded document
275
- surface itself is still laid out left-to-right: the margin chrome
276
- stays on the page's right regardless of the host page's direction.
277
- Mirroring the embed for right-to-left hosts is not part of this
278
- release.
279
-
280
- ## 2.0.0-alpha.6
281
-
282
- ### Fixed
283
-
284
- - **A healed seed race now recovers full fidelity — and never loses a
285
- comment.** Three repair refinements: the winner is the seed whose
286
- metadata survived the merge (each seed stamps a ballot in the same
287
- transaction), so the kept content matches the surviving import
288
- capture; a shared deterministic id keeps the WINNER's element, not an
289
- arbitrary one; and map records under a shared key (deterministic
290
- comment ids) are never deleted — the merge already deduplicated them,
291
- and alpha.5's repair removed the only surviving record. A raced,
292
- repaired room now reports "exact" and exports byte-identically.
293
-
294
- ## 2.0.0-alpha.5
295
-
296
- ### Fixed
297
-
298
- - **Seed-race repair kept a duplicate footnote.** Deterministic ids that
299
- every seed generates identically (docx footnotes) were protected from
300
- repair as a collision safeguard, leaving one copy per seed. Repair now
301
- keeps exactly one occurrence of a shared id. Supersedes 2.0.0-alpha.4,
302
- which was deprecated minutes after publish.
303
-
304
- ## 2.0.0-alpha.4
305
-
306
- ### Fixed
307
-
308
- - **Double-seed connect race no longer duplicates the document.** Two
309
- peers that each found an empty room and seeded the same file before
310
- syncing used to merge into a perfectly-synced, perfectly-duplicated
311
- document. Every seed now records a claim in the same transaction as
312
- its content, and any peer that sees two claims deterministically
313
- removes the losing seed's content — idempotent, convergent, and
314
- content added after a seed is never touched. `seedYDocFromFile` is
315
- now genuinely safe to call on every connection: a later call also
316
- heals an already-raced room, and every live editor session repairs
317
- one the moment the second claim syncs in.
318
- - **Editing no longer rewrites document properties.** A structural edit
319
- (or a rejected tracked change) permanently dropped the imported core
320
- properties from the live model, so every later export regenerated
321
- `docProps/core.xml` with an "Un-named" creator, the title removed,
322
- and the creation date reset to export time. Core properties now
323
- survive every model rebuild, and when core.xml IS legitimately
324
- regenerated it is a faithful merge: `cp:revision` round-trips and
325
- fields the original never had are not invented.
326
- - **`docProps/app.xml` passes through untouched.** It is never
327
- regenerated (preserving Application/Company/TotalTime) and never
328
- added to a package that did not have one.
329
-
330
- ### Added
331
-
332
- - **`repairSeedRace(ydoc)`** on the backend entry (with
333
- `SeedRaceRepairResult`): detect and repair a double-seed race on
334
- demand. Editor sessions and `seedYDocFromFile` run it for you.
335
-
336
- ### Changed
337
-
338
- - **New reserved top-level key in shared documents: `"seed-claims"`**
339
- (see `RESERVED_DOCUMENT_KEYS`) — where seed claims live.
340
-
341
- ## 2.0.0-alpha.3
342
-
343
- ### Fixed
344
-
345
- - **Backspace before a chip deleted the chip.** A preserved-object chip
346
- has two caret stops — before and after — and a delete now respects
347
- which side the caret is on, like a caret between two characters:
348
- backspace at the before-stop targets the block BEFORE the chip (an
349
- atomic neighbor is deleted whole, a text neighbor loses its last
350
- character), and forward delete at the after-stop targets the block
351
- after. Deletes pointing AT the chip still remove it.
352
- - **Up/down arrows at a chip slid the caret to the chip's other side**
353
- instead of changing lines. Vertical movement now leaves the chip's
354
- line and lands on the neighboring block's stop nearest the caret's
355
- column — arrowing through a stack of chips keeps the caret on the
356
- same side all the way down.
357
-
358
- ## 2.0.0-alpha.2
359
-
360
- ### Fixed
361
-
362
- - **Exporting .docx could crash in production builds of the host app**
363
- ("Cannot destructure property 'default' … as it is undefined" from
364
- the converter's zip loader). The SDK's build emitted duplicate
365
- interop chunks for its zip dependency behind dynamic imports, and
366
- some consumer bundlers resolved one family to `undefined` when
367
- producing production builds — development builds were unaffected,
368
- which is why the crash only appeared after deployment. The dependency
369
- is now a static import inside the (still lazily loaded) converter
370
- modules: the load profile is unchanged and the chunk graph no longer
371
- depends on the host bundler's interop handling.
372
- - **Backspace in an empty paragraph directly after a chip deleted the
373
- chip** instead of the paragraph. Preserved payloads are content the
374
- source file owns, not editor furniture: the empty paragraph dies, the
375
- chip survives. (Page and section breaks keep their old
376
- consume-on-backspace behavior.)
377
- - **Chips gained real before/after caret stops.** The caret can now be
378
- placed on either side of a chip — arrow keys walk across it, and
379
- clicking the left or right half of the chip places the caret on the
380
- matching side.
381
-
382
- ## 2.0.0-alpha.1
383
-
384
- Prerelease for evaluation. The 2.0 line's headline is DOCX source
385
- fidelity: a document imported from .docx can now leave the editor as the
386
- file it came from, not a reconstruction of it.
387
-
388
- ### Added
389
-
390
- - **DOCX source-fidelity mode (default on).** Importing a .docx keeps the
391
- original package inside the document (the "carrier", shared documents
392
- included, capped at 25MB). On export, content you did not touch is
393
- emitted as the exact bytes that arrived — byte-for-byte, unannotated —
394
- and only changed content is regenerated. A verification stage inspects
395
- every composed package and falls back to full regeneration rather than
396
- ship anything it cannot verify.
397
- - **`handle.getSourceFidelity()`** (and `ydocSourceFidelity(ydoc)` /
398
- `documentToDocx(doc, { originalDocx })` on the backend entry) reports
399
- the honest relationship of the next export to the original file:
400
- `"exact"` (byte-identical), `"grafted"` (original bytes plus your
401
- edits), or `"converted"` (no usable original; the report says why).
402
- - **Unmodeled Word formatting survives editing.** Run, paragraph, table,
403
- row, cell, and section properties the editor does not model (vendor
404
- effects such as `w14:glow`, revision-save ids, row heights, table
405
- look flags, page borders, note-numbering properties…) are carried
406
- through the model and re-emitted — so an EDITED paragraph keeps them
407
- too, with or without the carrier.
408
- - **Preserved objects render as labeled chips.** OLE embeds (Excel,
409
- Visio), SmartArt without a raster fallback, and unknown OOXML
410
- constructs import as atomic blocks labeled with their source tag
411
- (e.g. "w:object · Excel.Sheet.12"), render as chips on canvas and in
412
- PDF export, and re-export verbatim. In agent HTML they appear as
413
- `<docx-raw id tag/>`: an agent can keep, move, or omit one
414
- (omission deletes), but can never inject raw OOXML of its own.
415
- - **Editable-region permissions preserved.** `w:permStart`/`w:permEnd`
416
- pairs (and future paired ranges) survive import, editing, and export
417
- with balance guaranteed by construction: typing inside extends the
418
- region, deleting its text retires it, and unbalanced pairs in source
419
- files are repaired at import.
420
-
421
- ### Changed
422
-
423
- - **BREAKING: two new reserved top-level keys in shared documents** —
424
- `"docx-carrier"` and `"oxml-ranges"` (see
425
- `RESERVED_DOCUMENT_KEYS`). A host-built Y.Doc already using these
426
- names is rejected by `assertUsableSharedDocument`.
427
- - **BREAKING: docx-sourced exports are byte-preserving by default.**
428
- 1.x regenerated every export from the model; 2.0 reproduces original
429
- bytes for untouched content. Hosts that depended on exports being
430
- normalized into the generated dialect should convert explicitly.
431
- - `ReviseDocument` block children may now include the `"docx-raw"`
432
- node type (opaque; convert rather than inspect, as ever).
433
- - Shared documents built from a .docx are larger by roughly the size of
434
- the source file (the carrier). It is stored once, chunked, and synced
435
- like any other document state.
436
-
437
- ## 1.3.1
438
-
439
- ### Fixed
440
-
441
- - **Delegated page inspection now reaches the embedded editor canvas.** The
442
- SDK connects the delegated agent's `render_document_pages` tool to the
443
- mounted document renderer, so appearance and layout requests return the
444
- actual pages instead of reporting that canvas inspection is unavailable.
445
- - **Agent-tool documentation now matches the generated SDK catalog.** The
446
- public docs use the canonical `remove_blocks` name, distinguish the
447
- deterministic document-local tool subset from delegated-agent-only tools,
448
- and explain where visual page inspection is available.
449
-
450
- ## 1.3.0
451
-
452
- ### Added
453
-
454
- - **The built-in editor UI now localizes itself in English, Spanish, and
455
- German.** Ribbon controls, menus, dialogs, comments, Review mode, and agent
456
- chrome follow the browser language or the persisted Revise UI-language
457
- preference, while English remains the fallback if a locale chunk cannot be
458
- loaded.
459
- - **The delegated browser agent can inspect the document's rendered pages.**
460
- It can request bounded appearance contact sheets or layout diagnostics from
461
- the real canvas renderer, including page geometry, tables, images, math,
462
- headers, footers, and safe placeholders for unavailable visual assets.
463
-
464
- ### Changed
465
-
466
- - **Tab editing and layout now follow Word-style paragraph behavior.** Tab and
467
- Shift+Tab at the start of a block keep indenting or outdenting, while either
468
- key inside paragraph text inserts a tab. Long tabbed lines wrap at word
469
- boundaries, restart their ruler on each visual line, and preserve custom,
470
- aligned, leader, and right-to-left tab stops.
471
-
472
- ### Fixed
473
-
474
- - **DOCX named styles remain stable through editing and repeated round trips.**
475
- Imported paragraph styles and document defaults now drive newly created
476
- headings and agent-created styled blocks, survive Yjs persistence, suppress
477
- redundant direct formatting on export, and converge without accumulating
478
- unused generated Word styles. Explicit formatting resets, borders, spacing,
479
- fonts, and styles inside table cells remain intact.
480
- - **Agent document measurements reconcile pending Review changes.** Primary
481
- totals consistently measure the final, as-if-accepted document and include
482
- the original review projection when pending suggestions make the visible
483
- word or character count differ.
484
-
485
- ## 1.2.0
486
-
487
- ### Added
488
-
489
- - **International text support now extends across the editing and conversion
490
- pipeline.** Unicode-aware line breaking, search, list numbering, font
491
- fallback, and IME composition preserve multilingual text more reliably, and
492
- text import now detects UTF-8 and UTF-16 files. HTML, DOCX, RTF, ODT, and
493
- plain-text conversions keep the expanded script coverage intact.
494
- - **Orange and purple join the SDK highlight palette.** The editor UI,
495
- `find_highlights`, `style_blocks`, agent HTML, and DOCX round trips now
496
- share the same seven canonical highlight colors.
497
- - **Agent styling covers richer document structures.** `style_blocks` adds
498
- span, descendant-wildcard, first-row, and named-paragraph-style selectors,
499
- with durable mappings for image sizing and alignment, paragraph borders,
500
- nested tables and lists, per-edge cell borders, cell fills, padding, and
501
- table-cell text styles.
502
-
503
- ### Fixed
504
-
505
- - **DOCX import follows Word's effective paragraph and table styling.**
506
- Unstyled paragraphs inherit the document's default style; exact and
507
- at-least line rules use the resolved font size; paragraph before/after and
508
- contextual spacing replace the editor's fallback gap; missing table borders
509
- remain borderless; and non-uniform cell margins survive import. The imported
510
- spacing persists through Yjs, paragraph splits and merges, HTML, DOCX, and
511
- PDF output, keeping compact Word layouts from growing onto extra pages.
512
- - **Unavailable Word fonts use the document's own substitution hints.** DOCX
513
- import reads `fontTable.xml` alternate names and PANOSE/family/pitch
514
- metadata, persists them with the document, and chooses metric-compatible
515
- fallbacks before resorting to a generic family.
516
- - **Multilingual PDF export embeds and shapes the scripts it needs.** Chinese,
517
- Japanese, Korean, Indic, Southeast Asian, Tibetan, Ethiopic, Armenian,
518
- Georgian, Syriac, Thaana, symbols, emoji, and rare Han use bundled lazy
519
- fallback faces, while a hidden logical-text layer preserves search and text
520
- extraction.
521
- - **Agent edits preserve complex formatting and pending review state.** Styled
522
- tables, nested content, list-item formatting, explicit text overrides,
523
- comments, and edits layered over pending insertions now survive preview,
524
- acceptance, and rejection without duplicating or flattening structure.
525
- - **Borderless layout tables stay visually borderless while editing.** The
526
- canvas now reveals only the specific invisible vertical edge under a resize
527
- pointer instead of ghosting the table's entire grid on hover or focus.
528
- - **Imported pale-yellow highlights remain highlights.** HTML clipboard import
529
- no longer remaps Word's pale yellow to the editor's green palette entry.
530
-
531
- ## 1.1.0
532
-
533
- ### Added
534
-
535
- - **First-class right-to-left editing.** The built-in toolbar can set paragraph
536
- and list direction to automatic, LTR, or RTL. Mixed Hebrew, Arabic, and
537
- left-to-right text now uses bidi-aware line layout, visual arrow-key
538
- movement, stable caret and selection geometry, direction-aware alignment and
539
- indents, mirrored list markers, and RTL tab stops. Direction survives Yjs,
540
- clipboard and agent edits, HTML, and DOCX round trips; PDF export preserves
541
- mixed-direction reading order and positioning.
542
- - **Multi-column sections.** Page layout now supports one, two, or three
543
- newspaper-style columns with a configurable gap. Continuous section breaks
544
- balance their final columns, while page and next-page sections keep ordinary
545
- pagination. The canvas editor and PDF export share the flow rules, DOCX and
546
- HTML import/export preserve the settings, and `set_page_layout` exposes
547
- `columnCount`, `columnGap`, and section-scoped updates to browser and
548
- server agent sessions.
549
- - **Native document-structure tools.** `insert_block` can create a live table
550
- of contents with `<toc levels="3"></toc>`. The canonical
551
- `remove_blocks` tool can delete a counted range, exact IDs, a saved search
552
- result, or an explicitly authorized document tail with `through_end`.
553
-
554
- ### Changed
555
-
556
- - **Agent tool sessions avoid unproductive read cycles.** Sequential reads now
557
- reject windows containing only blocks already returned in the same request
558
- with `no_new_read_context`; `read_specific_blocks` remains available for
559
- intentional revisits. `remove_blocks` is now the model-facing name, while
560
- the previous `remove_block` name remains an executable compatibility alias.
561
-
562
- ### Fixed
563
-
564
- - **Strict-provider nulls behave like omitted optional tool fields.** Browser
565
- and server tool execution normalize provider-materialized `null` values
566
- from the generated schema before dispatch, without stripping required or
567
- deliberately nullable values. Optional layout and mutation inputs therefore
568
- no longer take invalid branches merely because a provider filled them in.
569
- - **Agent-generated Unicode escapes become the intended text.** Literal
570
- `\uXXXX` sequences in agent HTML and replacement paths are decoded without
571
- disturbing escaped backslashes or code spans, preventing visible escape text
572
- in edited documents.
573
- - **Review decisions preserve the reader's place.** Accepting or rejecting a
574
- tracked change no longer forces the embedded editor to scroll back to the
575
- active suggestion.
576
- - **SDK PDF export keeps Hebrew and Arabic text self-contained.** The package
577
- now bundles the Noto fallback faces used by RTL export, so embedding hosts do
578
- not need to mirror Revise's public font directory to avoid dropped glyphs.
579
-
580
- ## 1.0.1
581
-
582
- ### Fixed
583
-
584
- - **Malformed model input can no longer crash a host's agent loop.** A bare
585
- string where `search_document` expects a `queries` array — the most
586
- common model slip — threw a raw `TypeError` out of `execute()` /
587
- `executeDynamic()` instead of returning a structured failure. Bare
588
- strings are now coerced to one-element arrays (also for
589
- `read_specific_blocks`' `block_ids`), anything uncoercible fails
590
- structurally, and both surfaces gained a safety net that converts an
591
- unexpected handler throw into an `internal_error` result. The documented
592
- contract — expected failures as results, only environment errors reject —
593
- now holds for arbitrary input.
594
- - **Invalid enum values no longer mutate the wrong target silently.** An
595
- insert tool called with `position: "above"` placed content _after_ the
596
- reference block while reporting success, and `set_header_footer` with a
597
- misspelled or missing `side` edited the header. Both now return a
598
- structured failure naming the valid values.
599
-
600
- ## 1.0.0
601
-
602
- One package, one tool contract. The browser and server surfaces now speak
603
- the same canonical envelope, so host result-handling code is shared verbatim
604
- between web and Node. That convergence is breaking on the browser side —
605
- every change is listed below.
606
-
607
- ### Breaking
608
-
609
- - **`tools.execute()` returns the canonical discriminated envelope.** The
610
- flat `{ toolCallId, name, success, error?, agentFeedback?, output?,
611
- documentContent? }` result is gone. Both surfaces now return
612
- `{ ok: true, value: { callId, tool, message, data, context, suggestionIds } }`
613
- or `{ ok: false, error: { callId, tool, code, message } }`
614
- (`ReviseToolResult`). Field mapping: `toolCallId → value.callId`,
615
- `name → value.tool`, `agentFeedback → value.message`,
616
- `output → value.data`, `documentContent → value.context.html`;
617
- `view_image`'s attachment lives on `value.image`.
618
- `ReviseEditorToolExecutionResult` no longer exists.
619
- - **`tools.execute()` is typed and no longer routes `document_id`.**
620
- `execute()`/`call()` take the generated per-tool input types and
621
- cover the shared 24-tool contract; untrusted model calls — including the
622
- browser-only `get_selection`, `view_image`, and
623
- `revise_run_agent`, and model-facing `document_id` routing — go
624
- through the new `executeDynamic()`, exactly as on the server.
625
- - **Unknown tools and role denials are results, not throws.** `execute()`
626
- returns `{ ok: false }` with `code: "unknown_tool"` or
627
- `"role_not_permitted"` instead of throwing; the new `tools.call()`
628
- throws a typed `ReviseToolError` for hosts that prefer exceptions.
629
- `ReviseRoleError` is still thrown by `agent.run()` and UI
630
- controllers.
631
- - **ID-keyed suggestion decisions return per-ID outcomes.**
632
- `review.acceptSuggestions`/`rejectSuggestions`,
633
- `review.acceptCommentSuggestions`/`rejectCommentSuggestions`, and
634
- `tools.acceptAllSuggestions`/`rejectAllSuggestions`, and the server
635
- session's `acceptSuggestions`/`rejectSuggestions` return
636
- `{ resolved, missing, unresolved }` (`ReviseSuggestionDecision`)
637
- instead of a bare count. Stale IDs land in `missing`; a role that may
638
- not resolve reports everything `unresolved`. `review.acceptAll()` /
639
- `rejectAll()` keep their boolean UI-gesture contract.
640
- - **Server sessions default to suggesting mode.** `createServerDocumentSession`
641
- without `mode` now proposes tracked changes instead of applying edits
642
- directly — the same default posture as the browser surface, and the safe
643
- one. Pass `mode: "editing"` (or per-call `directMode: true`) for
644
- direct application.
645
-
646
- ### Added
647
-
648
- - **Browser mutation results report created suggestion IDs.** Successful
649
- mutations carry `suggestionIds` — the tracked records that call created
650
- (empty for direct edits, `null` for read/search/measure tools) — with a
651
- concurrent human suggestion never attributed to the tool call. Feed them
652
- straight to `review.acceptSuggestions()`.
653
- - **The tool contract types ship from both entries.** `ReviseToolResult`,
654
- `ReviseToolResponse`, `ReviseToolFailure`, `ReviseToolError`,
655
- `ReviseSuggestionDecision`, the generated `ReviseToolInputMap`, and
656
- friends are exported by `@reviseio/sdk` and `@reviseio/sdk/backend`
657
- alike.
658
-
659
- - **Server mutation results report the tracked records they created.**
660
- Successful mutation calls from `createServerDocumentSession` now carry
661
- `suggestionIds` — the tracked suggestion records that call created (empty
662
- for direct edits, `null` for read/search/measure tools) — so a host can
663
- persist per-edit IDs with its review workflow instead of diffing the
664
- document-global pending set.
665
- - **`listSuggestions()`** returns every pending suggestion as a reviewable
666
- record with authorship metadata (`authorType`, `agentName`,
667
- `agentModel`, `source`, `label`, `createdAt`), so hosts can decide on
668
- their own agent's suggestions and leave collaborators' pending work alone.
669
- - **`acceptAllSuggestions()` / `rejectAllSuggestions()`** make the
670
- whole-document decision an explicit, greppable call instead of the
671
- `acceptSuggestions(getPendingSuggestionIds())` idiom.
672
-
673
- ### Fixed
674
-
675
- - **Server tool types now resolve for `moduleResolution: "NodeNext"`
676
- consumers.** The packaged declarations re-exported the server tool contract
677
- through extensionless relative specifiers, which NodeNext cannot resolve —
678
- every tool input/output type silently degraded to `any`, and importing a
679
- contract type by name (e.g. `ServerDocumentSession`) failed to compile.
680
- The declarations now use explicit `.js` specifiers, which every supported
681
- resolution mode maps to the sibling `.d.ts` files.
682
- - **Importing a document with code blocks no longer risks crashing a Node
683
- host.** The canvas syntax highlighter tried to fetch its tree-sitter wasm
684
- under Node (the server DOM shims install a jsdom `window`, defeating its
685
- browser check), failing as an unhandled promise rejection. Highlighting now
686
- recognizes the server runtime explicitly and stays off, and a failed
687
- highlighter init in the browser no longer poisons later attempts.
688
- - **Table and list mutations no longer spam `Invalid access` warnings.**
689
- Building table rows, cells, and list items called Yjs `push()` on
690
- elements not yet integrated into a document, which logs a warning per
691
- child. Construction now inserts children at explicit indices — dozens of
692
- stderr lines per table insert in server logs, gone.
693
- - **Editing mode applies server edits directly again.** A server session in
694
- `"editing"` mode quietly recorded every mutation as a
695
- pending tracked suggestion instead of applying it. Editing-mode calls now
696
- run in the runtime's direct mode and settle within the call, matching the
697
- documented behavior; an explicit per-call `directMode` still overrides in
698
- either direction.
699
-
700
- ## 0.9.0
701
-
702
- ### Added
703
-
704
- - **`review.listChanges()` now reports linked moves as moves.** A move pair
705
- surfaces as ONE `ReviseTrackedChange` with `kind: "move"`,
706
- `moveSourceBlockIds`/`moveDestinationBlockIds` locating each half, and
707
- `deletedText`/`insertedText` carrying the text as it left and as it
708
- arrived. Previously both halves were folded into a single change labeled
709
- `"delete"`, leaving a host review panel no way to distinguish a move from
710
- a replacement. Accept/reject semantics are unchanged: resolving the change
711
- settles both locations atomically.
712
-
713
- ## 0.8.0
714
-
715
- ### Added
716
-
717
- - **Cut and paste now creates native linked moves in Suggesting mode.** Cutting
718
- text from supported paragraphs and pasting that same internal clipboard
719
- payload elsewhere in the document produces one atomic “Moved from”/“Moved
720
- here” pair. Accepting or rejecting either half resolves both locations, undo
721
- cannot strand an orphaned half, and DOCX export/reimport preserves native
722
- linked move markup. Copy/paste, editing mode, reused or mismatched clipboard
723
- payloads, and unsupported structural selections continue to use ordinary
724
- insertion/deletion behavior.
725
-
726
- ## 0.7.0
727
-
728
- ### Added
729
-
730
- - **Server-side semantic tools.** `await createServerDocumentSession(ydoc,
731
- { documentId, mode })` in `@reviseio/sdk/backend` binds the canonical
732
- document-local agent tools — read, search, measure, mutate, layout,
733
- footnotes, tables, comments — to a host-owned Y.Doc under plain Node.
734
- `mode: "suggesting"` produces Word-compatible tracked changes with
735
- accept/reject; concurrent calls are serialized; literal tool calls infer
736
- their schema inputs and structured outputs. See the README's "Server semantic
737
- tools" section.
738
- - **Linked Word moves now round-trip as atomic move suggestions.** DOCX import
739
- pairs native `w:moveFrom` and `w:moveTo` ranges across runs, paragraphs,
740
- and table cells. Accepting either half keeps the text at its
741
- destination; rejecting either half restores its original location; export
742
- re-emits native paired move markup. Suggestion cards distinguish “Moved from”
743
- and “Moved here”, and focusing either half highlights its partner even across
744
- paragraphs.
745
-
746
- ### Fixed
747
-
748
- - **Node-side DOCX imports preserve tracked table-row revisions without a
749
- browser `FileReader`.** The backend DOM shims and table-revision
750
- postprocessor now work from `Blob.arrayBuffer()`, retaining row insertion
751
- and deletion metadata in server integrations.
752
- - **Word comment anchors preserve their identity and semantic range.** Safe
753
- native numeric IDs no longer shift, cross-paragraph and table-cell ranges
754
- emit one anchor triple instead of duplicates, and collapsed, overlapping,
755
- threaded, and resolved comments survive repeated round trips.
756
- - **Visible drawing text survives DOCX import when shape geometry is
757
- flattened.** Inline and anchored DrawingML, grouped shapes, legacy VML,
758
- headers, and standards-valid `mc:AlternateContent` Choice/Fallback content
759
- become editable paragraphs in reading order without duplicate fallback text.
760
- - **DOCX archives no longer inflate and large imports avoid repeated work.**
761
- Generated packages use DEFLATE compression, parse the main document XML once,
762
- and skip move indexing when a file has no moves, preventing the reported
763
- multi-fold output growth and superlinear no-move scan.
764
-
765
- ## 0.6.0
766
-
767
- ### Added
768
-
769
- - **Horizontal rules and ornamental dividers are now supported throughout the
770
- editor.** Insert thin, thick, double, dashed, dotted, star, or diamond
771
- dividers from the toolbar or context menu, or create them with text triggers
772
- such as `---`, `===`, `-**-`, and `-<>-`. DOCX, HTML, Markdown, agent HTML,
773
- PDF, and plain-text output preserve the divider where the format permits;
774
- DOCX, HTML, Markdown, RTF, and ODT imports recognize their native divider or
775
- paragraph-border representations.
776
-
777
- ### Changed
778
-
779
- - **Em-dash autocorrection now waits for a word boundary.** Typing `--` remains
780
- literal until Space or Enter, allowing `---` to be used for horizontal-rule
781
- insertion and preserving word-initial values such as `--flag`.
782
-
783
- ### Fixed
784
-
785
- - **Words no longer wrap in the middle at formatting or tracked-change run
786
- boundaries.** A word split across differently styled text nodes now wraps as
787
- one unit and keeps a stable layout when suggestions are accepted.
788
- - **Suggestion editing produces stable runs and caret placement.** Continued
789
- typing or backspacing merges into the existing suggestion instead of creating
790
- one run per keystroke, replacement normalization no longer leaves the caret
791
- inside hidden deleted text, and Enter after a pending deletion creates the
792
- expected paragraph or list item without moving the deleted content.
793
- - **Structural editing keeps the expected document shape and keyboard focus.**
794
- Backspace exits or splits empty list items correctly, compatible lists rejoin
795
- when their separating empty paragraph is removed, Enter at the start of a
796
- leading heading or code block creates a body paragraph above it, and toolbar
797
- commands no longer steal keyboard focus from the editor.
798
-
799
- ## 0.5.1
800
-
801
- ### Fixed
802
-
803
- - **PDF table-of-contents page numbers stay accurate when a heading moves to
804
- the next page.** Export now records a heading's destination after paragraph
805
- pagination, so a keep-with-next or end-of-page preflight cannot leave the
806
- TOC pointing at the page the heading would have occupied before it moved.
807
-
808
- ## 0.5.0
809
-
810
- ### Added
811
-
812
- - **Comments now work on list items, including nested items.** Selecting list
813
- text, expanding a word from the caret, and commenting on a whole item all
814
- create item-local anchors. Returning the caret to that text activates the
815
- thread, list-item threads survive agent-HTML round trips, and the
816
- `leave_comment` agent tool accepts list-item IDs.
817
-
818
- ### Changed
819
-
820
- - **PDF export now follows the editor's layout and print semantics much more
821
- closely.** It shares wrapping and pagination rules for tab stops and
822
- leaders, hyphenation, keep-with-next, keep-lines, widows and orphans, code
823
- blocks, nested tables, footnotes, page and section breaks, live TOC page
824
- numbers, line numbers, and watermarks. Editor-only placeholders and review
825
- chrome are not printed, and Word hidden text remains hidden in ordinary PDF
826
- output. The SDK now carries its metric-compatible PDF fonts itself, so an
827
- embedding host does not need to mirror Revise's public font directory.
828
- - **Agent tool sessions reject redundant full-document read loops.** After a
829
- session has read the complete document, another sequential `read_document`
830
- returns `no_new_read_context`; agents can still revisit known content with
831
- `read_specific_blocks`.
832
-
833
- ### Fixed
834
-
835
- - **DOCX formatting exceptions survive a complete edit and export cycle.**
836
- Explicit run-property clears over named styles, zero paragraph indents,
837
- paragraph border and shading clears, decimal font sizes, and mixed small-cap
838
- and all-cap overrides now remain distinct from inherited formatting and do
839
- not leak into adjacent text.
840
- - **Complex Word structures no longer lose modeled content on re-export.**
841
- Internal bookmark links stay internal; exact table widths, columns,
842
- alignment, cell padding, and vertical alignment survive; nested tables keep
843
- the paragraphs around them; display equations are not flattened when a file
844
- is immediately re-exported; and multi-block footnotes and endnotes can retain
845
- their lists and tables.
846
- - **Accepting or rejecting a compound agent edit is atomic.** Mixed text,
847
- formatting, and structural suggestions are resolved together, so accepting
848
- a rewrite no longer retains deleted fragments and rejecting it restores the
849
- original content and formatting.
850
- - **Comment cards stay where users put them.** A previously active card no
851
- longer drifts with the viewport, and selecting text inside a card no longer
852
- jumps focus back to the document or clears the selection. Inline code in
853
- comment bodies is also styled as code.
854
- - **Package managers can no longer omit the Yjs runtime.** Every editor session
855
- is Yjs-backed even without a collaboration provider, so `yjs` and
856
- `y-protocols` are now required peers instead of optional peers. This makes
857
- package managers install or validate them instead of letting bundlers
858
- substitute empty optional-peer modules and fail the consumer build.
859
-
860
- ## 0.4.5
861
-
862
- ### Fixed
863
-
864
- - **Starting a list no longer drops the font.** Typing a list trigger
865
- (`- `, `1. `, `[] `) in a paragraph set in a non-default font produced
866
- a list item that fell back to the default font: clearing the trigger text
867
- left an empty item with nowhere to carry its formatting. The formatting at
868
- the trigger's trailing edge — the font family included — is now preserved
869
- on the empty item and applies to the next character typed.
870
-
871
- ## 0.4.4
872
-
873
- ### Fixed
874
-
875
- - **Suggestion cards now hang from the suggested text.** The floating
876
- accept/reject card anchored to the caret; it now follows the suggested
877
- fragment (or your selection) and sits centered below its line, the same
878
- placement the revise.io app uses, falling back to the caret only when the
879
- fragment cannot be measured. Wide cards are clamped to the page edges
880
- instead of a fixed margin.
881
-
882
- ## 0.4.3
883
-
884
- Identical in content to 0.4.2; republished.
885
-
886
- ## 0.4.2
887
-
888
- ### Fixed
889
-
890
- - **Word-level diffs misplaced edits next to repeated words.** When the text
891
- adjacent to an edit repeated a word from the edit itself (replacing
892
- "[Berkshire County / appropriate Massachusetts county]," with "Suffolk
893
- County, Massachusetts," just before "Massachusetts will"), the unchanged
894
- suffix could be drawn as deleted and retyped. Unchanged repeated words now
895
- stay anchored as unchanged, in tracked changes and the diff view alike.
896
- - **Writing a comment no longer collapses the comments margin.** Finishing a
897
- draft that had itself opened the margin always collapsed it — even when
898
- submitting had just created a thread, so the pages jerked sideways in both
899
- directions and hid the card the user just wrote. The margin now stays open
900
- on the new thread; only an abandoned draft with no other open thread
901
- collapses it.
902
- - **Comment card placement around drafts and tracked changes.** A comment
903
- draft started while hovering the card stack could pin its card — and drag
904
- the viewport — to the top of page 1; it now anchors where the draft was
905
- made. A caret inside a resolved thread's highlight, or inside an imported
906
- thread's replies, activated no card at all; it now activates the right
907
- open thread. And when a commented paragraph also contains tracked changes,
908
- the card describes the change under the cursor instead of jumping to the
909
- top of the paragraph.
910
- - **The selection card no longer chases the pointer mid-drag.** While the
911
- mouse button is down nothing pops up under the pointer; the card appears
912
- on release, anchored below the selection the user meant.
913
-
914
- ## 0.4.1
915
-
916
- ### Fixed
917
-
918
- - **Opening the export menu crashed.** An icon component in the export menu
919
- referenced React without importing it, which the packaged build has no
920
- global to fall back on.
921
-
922
- ## 0.4.0
923
-
924
- ### Changed
925
-
926
- - **The default entry no longer ships Tree-sitter syntax highlighting or the
927
- embedded WASM payload.** Code blocks still render as code, and every WASM
928
- hot path has a TypeScript implementation. This keeps the normal
929
- integration smaller and compatible with strict Content Security Policies.
930
- Optional features now load as async chunks inside the package.
931
-
932
- ### Added
933
-
934
- - **`@reviseio/sdk/full`** — an opt-in entry point that keeps token-colored
935
- code blocks and the WASM hot paths. The API and stylesheet are identical
936
- between the two entries.
937
-
938
- ## 0.3.4
939
-
940
- ### Fixed
941
-
942
- - **The SDK no longer attempts any telemetry.** Earlier builds emitted
943
- editor health metrics toward a Revise backend that does not exist in your
944
- deployment, which could only fail — loudly, as console CORS errors — and
945
- represented network calls you never asked for. Telemetry is now something
946
- only the revise.io application itself can switch on; embedded editors
947
- send nothing anywhere: no metric POSTs, no analytics vendor code, no
948
- beacons.
949
-
950
- ### Added
951
-
952
- - **`onAnalyticsEvent`** — the editor's own instrumentation, delivered to
953
- the host instead:
954
- `<ReviseEditor onAnalyticsEvent={(event, properties) => ...} />`.
955
- Forward events to your own analytics service; a throwing handler never
956
- breaks the editor. Event names and property shapes are internal and
957
- version-unstable.
958
-
959
- ## 0.3.3
960
-
961
- Four suggesting-mode fixes, two of them content corruption. If your users
962
- edit in `suggesting` mode — the mode this SDK exists for — take this
963
- release.
964
-
965
- ### Fixed
966
-
967
- - **Pasting in suggesting mode corrupted the document.** The paste path
968
- predated suggesting mode: it duplicated the rest of the paragraph and
969
- inserted the pasted text without tracked-change marks, so the paste was
970
- invisible to review and survived reject. Pasting is now recorded exactly
971
- as if the pasted characters had been typed — an insertion suggestion, plus
972
- a deletion suggestion for any replaced selection.
973
- - **Formatting across a pending change destroyed it.** Applying bold (or any
974
- inline format) over a range touching a pending insertion or deletion
975
- overwrote the change's identity; resolving the format then silently turned
976
- a pending insertion into accepted text, or resurrected deleted text.
977
- Formatting now leaves deletion spans alone, folds into insertion spans (as
978
- Word nests run properties inside `w:ins`), and records a reviewable
979
- format change only on unmarked text.
980
- - **Accepting a deletion that crossed a paragraph boundary left the
981
- paragraphs unmerged.** The boundary is now part of the suggestion, as the
982
- pilcrow is in Word: accepting merges the paragraphs, in any resolution
983
- order, for any number of paragraphs in the selection.
984
- - **Copying a selection inside your own pending insertion copied nothing.**
985
- It now copies the selected text. Clipboard payloads are also sanitized so
986
- tracked-change marks never travel with copied content.
987
-
988
- ### Console
989
-
990
- - Opening a document no longer logs to the console (previously one Yjs
991
- warning per block plus two internal debug lines). `console.warn` and
992
- `console.error` remain for genuinely actionable problems.
993
-
994
- ## 0.3.2
995
-
996
- ### Fixed
997
-
998
- - `editor.whenReady()` was missing from the published type declarations. It
999
- worked at runtime, but TypeScript rejected the call the documentation tells
1000
- you to make.
1001
-
1002
- ## 0.3.1
1003
-
1004
- ### Fixed
1005
-
1006
- - Using the editor handle from `onReady` no longer throws. `onReady` fires
1007
- before any document exists, and "subscribe to everything on ready" is the
1008
- first thing a host writes — a subscription placed then now waits and
1009
- attaches when a document arrives. `selection.observe()` was affected too.
1010
- Methods that act on a document still fail loudly, and the message now names
1011
- the fix.
1012
-
1013
- ### Added
1014
-
1015
- - `editor.whenReady()` — resolves once a document is open and its
1016
- controllers are usable.
1017
- - `REVISE_SDK_VERSION` and `REVISE_SDK_BUILD` exports, and a `bugs` entry
1018
- in the manifest: a support ticket can name the exact build it came from.
1019
-
1020
- ## 0.3.0
1021
-
1022
- ### Collaboration
1023
-
1024
- Multi-user editing over a Yjs transport you own. The editor builds the
1025
- document; you attach the connection:
1026
-
1027
- ```ts
1028
- collaboration: {
1029
- connect: (doc, awareness) =>
1030
- new HocuspocusProvider({ url, name, document: doc, awareness }),
1031
- synced,
1032
- }
1033
- ```
1034
-
1035
- Remote carets, a presence roster (`editor.collaboration`), seed-or-join
1036
- semantics, and validation of any document you supply. See the collaboration
1037
- guide.
1038
-
1039
- ### Roles
1040
-
1041
- `role="editor" | "suggester" | "viewer"`, editor-wide or per document, and
1042
- enforced on every surface: typing, the built-in chrome, the handle, and agent
1043
- tool calls. A suggester cannot leave suggesting mode, apply anything directly,
1044
- or accept and reject.
1045
-
1046
- ### Tracked changes you can list
1047
-
1048
- `review.listChanges()` and `review.getChange(id)` return each pending change
1049
- with its kind, author, timestamp, affected blocks, and text — enough to build
1050
- your own review panel. Imported Word redlines keep their original reviewers.
1051
-
1052
- ### Server-side primitives
1053
-
1054
- New subpath export `@reviseio/sdk/backend` (Node only): `parseDocument`,
1055
- `fileToYDoc`, `seedYDocFromFile`, `ydocToDocx`, `encodeYDoc`/`decodeYDoc`.
1056
- Your server can create a collaborative room from a .docx before any browser
1057
- connects, and export a live room without one. Requires `jsdom`.
1058
-
1059
- ### Breaking
1060
-
1061
- - **`yjs` and `y-protocols` are now peer dependencies** and are no longer
1062
- bundled. Install them yourself, and make sure your bundler resolves ONE copy
1063
- — Yjs identifies its own types with `instanceof`, so a second copy breaks a
1064
- shared document. Only collaboration needs them; they are optional peers.
1065
- - **`ReviseDocumentInput.docx` is now optional**, since a document joining a
1066
- collaborative room needs no source file. Inputs must supply `docx`,
1067
- `collaboration`, or both.
1068
-
1069
- ### Fixed
1070
-
1071
- - `search_result_id`, which the agent tool schemas advertise for bulk edits,
1072
- was unusable: tool state did not survive between `tools.execute()` calls.
1073
- - `exportDocx()` omitted TOC page numbers, which only the live layout knows.
1074
- - Exports lost imported named styles and reset core property dates in any
1075
- non-browser environment.
1076
- - `collaboration.synced` was read once at mount, so a host reporting sync
1077
- later was ignored and the document never opened.
1078
- - The margin insert-comment chip was missing from the embedded editor.
1079
- - Presence colors: an explicit `currentUser.color` was ignored whenever the
1080
- user had an id.
1081
-
1082
- ## 0.2.0
1083
-
1084
- Multi-document sessions, host-owned chrome, skinning props, per-embed
1085
- theming, the selection controller, and comment-thread agents.
1086
-
1087
- ## 0.1.0
1088
-
1089
- First release: the editor, DOCX in and out, tracked changes, comments, and
1090
- the agent tool surface.
3
+ ## 3.0.0
4
+
5
+ The first release of `revise` as a command-line tool and TypeScript library
6
+ for reading, editing, and redlining Word documents.
7
+
8
+ Versions 2.x of this package were the Revise editor for React. The editor is
9
+ now [`@reviseio/editor`](https://www.npmjs.com/package/@reviseio/editor); 2.x
10
+ stays installable.
11
+
12
+ ### Added
13
+
14
+ - **The `revise` CLI.** Read a document as HTML with block ids, search it,
15
+ edit it with the same tools the Revise agent uses, and save the file in
16
+ place, as tracked changes by default in .docx. Review with `changes`,
17
+ `diff`, `accept`, and `reject`; `undo` and `restore` work across edits;
18
+ `render` draws pages as images; `export`, `convert`, `compare`, and `new`
19
+ write .docx, PDF, Markdown, HTML, and text. `convert` also works in a
20
+ pipe: `-` reads stdin (the format is recognized from its bytes) or writes
21
+ stdout. `--out new.docx` on an edit saves the result as a new file and
22
+ leaves the original as it is. Every command has its own
23
+ `--help`, and colored output on a terminal (not in pipes unless
24
+ `FORCE_COLOR` is set; never with `--json`).
25
+ - **`--json` on every command**: one envelope (`schema`, `ok`, `command`,
26
+ `meta`, `data`, `warnings`, `error`) with stable error codes, structured
27
+ partial results, and exit codes that say whether anything was saved.
28
+ Specified in [JSON output](https://revise.io/developer/docs/revise/json) and shipped as a JSON Schema,
29
+ `revise/cli-output.schema.json`.
30
+ - **`ReviseDocument`**, the same operations as a library: open a file or
31
+ bytes, run typed tools, review changes, export with a fidelity report,
32
+ and snapshot and restore state.
33
+ - **`agentTools(doc, { provider })`**: the editing tools in the shapes the
34
+ Anthropic and OpenAI SDKs expect, with a matching result formatter.
35
+ - **Collaboration rooms.** `seedYDoc(room, file)` seeds a sync server's
36
+ Y.Doc on every connection (idempotent, repairs two peers that seeded at
37
+ once, keeps the original Word file in the room), and
38
+ `ReviseDocument.fromYDoc(room)` edits and exports a live room.
39
+ - **Word fidelity.** Untouched content in a .docx exports byte for byte;
40
+ `xml` commands read and patch the raw package for what the tools don't
41
+ cover (styles, numbering, settings).
42
+ - **An agent skill**: `revise skill install` writes a SKILL.md that teaches
43
+ coding agents the CLI.
44
+
45
+ ### Removed
46
+
47
+ - **The editor entry points of 2.x.** `revise/editor`, `revise/editor/full`,
48
+ and `revise/server` now throw an error pointing to `@reviseio/editor`, and
49
+ `revise/style.css` is an empty stylesheet that says the same.