revise 2.0.1 → 2.2.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 (147) hide show
  1. package/CHANGELOG.md +195 -0
  2. package/README.md +4 -1
  3. package/assets/historyMaterializeWorker-B51R08XN.js +612 -0
  4. package/backend.d.ts +8 -2
  5. package/backend.js +3 -1
  6. package/chunks/AgentPageRenderer-CH8kSTJn.js +1 -0
  7. package/chunks/AgentPageRenderer-P23XVguo.js +1 -0
  8. package/chunks/AttachmentDocumentImporter-B1WOaa7d.js +1 -0
  9. package/chunks/AttachmentDocumentImporter-CT_PJp_e.js +1 -0
  10. package/chunks/BidiText-Swm5fl9J.js +160 -0
  11. package/chunks/ColorParserFull-BKH72fK8.js +446 -1
  12. package/chunks/DocumentMutator-btiDK57e.js +31 -0
  13. package/chunks/DocumentScrubber-CMPfm_HF.js +18 -0
  14. package/chunks/{DocumentScrubber-DrgzBlx4.js → DocumentScrubber-Cm2kH8op.js} +1 -1
  15. package/chunks/{DocumentScrubber-W0EfGmL-.js → DocumentScrubber-bJoKijol.js} +1 -1
  16. package/chunks/DocumentStylesheet-DreoD7sD.js +7 -0
  17. package/chunks/DocxConverter-BcVG-p5K.js +13 -0
  18. package/chunks/DocxConverter-D2bO5RE-.js +1125 -0
  19. package/chunks/DocxConverter-haCfRuWb.js +13 -0
  20. package/chunks/{DocxGraft-B6W7fbh4.js → DocxGraft-BRKh4mHQ.js} +1 -1
  21. package/chunks/DocxGraft-BxSQtl12.js +7 -0
  22. package/chunks/{DocxGraft-Cj7v78BO.js → DocxGraft-C9MBQCnf.js} +1 -1
  23. package/chunks/FileImporter-CszqRfVU.js +1 -0
  24. package/chunks/FileImporter-DObFoCCn.js +1 -0
  25. package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +3 -1
  26. package/chunks/HtmlConverter-DwXB4IDh.js +267 -0
  27. package/chunks/ListNumbering-Qlu6AuRZ.js +23 -1
  28. package/chunks/MarkdownConverter-CUC8GgsS.js +57 -0
  29. package/chunks/MathRenderer-DT6GyJXb.js +68 -0
  30. package/chunks/OdtConverter-7h9HHMpL.js +125 -0
  31. package/chunks/OdtConverter-Ct4qypJk.js +6 -0
  32. package/chunks/OdtConverter-DFl__sJc.js +6 -0
  33. package/chunks/OfficeImportShared-BY6FdZ8d.js +1 -0
  34. package/chunks/OfficeImportShared-BrZoDM0j.js +30 -0
  35. package/chunks/OfficeImportShared-Bvm-mOyj.js +1 -0
  36. package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +36 -0
  37. package/chunks/PdfConverter-1wyvoT7X.js +21 -0
  38. package/chunks/PdfConverter-BAoEHILo.js +21 -0
  39. package/chunks/PdfConverter-CKEvFj11.js +448 -0
  40. package/chunks/{PdfImportService-Dj1-3L2B.js → PdfImportService-BhLPp5uG.js} +2 -2
  41. package/chunks/{PdfImportService-OE9G383I.js → PdfImportService-xbzrN__L.js} +2 -2
  42. package/chunks/RtfConverter-Bxn-enp8.js +15 -0
  43. package/chunks/RtfConverter-LZPzBDSr.js +15 -0
  44. package/chunks/RtfConverter-_bacXqr1.js +186 -0
  45. package/chunks/TableBorders-CwnF3jvH.js +30 -0
  46. package/chunks/TableGrid-DbroRucl.js +12 -0
  47. package/chunks/TextFileDecoder--rsVs3NR.js +9 -2
  48. package/chunks/{TxtConverter-BYazsp6P.js → TxtConverter-C7FOwHpH.js} +5 -2
  49. package/chunks/UnicodeUtils-CXtusU4g.js +10 -0
  50. package/chunks/XmlConverter-7oo8oeQB.js +2 -0
  51. package/chunks/XmlConverter-DGORHJcZ.js +96 -0
  52. package/chunks/XmlConverter-DeLHReK_.js +2 -0
  53. package/chunks/_commonjsHelpers-DaMA6jEr.js +2 -1
  54. package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -1
  55. package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -1
  56. package/chunks/ar-ComXvtmh.js +13 -0
  57. package/chunks/backend-DecaBz-I.js +490 -0
  58. package/chunks/base64-sSPOzq-u.js +198 -0
  59. package/chunks/browser-module-CFmqfGkE.js +1791 -3
  60. package/chunks/{browser-module-BbaxnHNK.js → browser-module-Dj5o3kuL.js} +1 -1
  61. package/chunks/{browser-module-D2ixluMg.js → browser-module-UuM_O36W.js} +1 -1
  62. package/chunks/bundle.min-DRpfgV69.js +779 -5
  63. package/chunks/capture-1btcWcPF.js +9 -0
  64. package/chunks/carrier-DQeng6yq.js +6 -0
  65. package/chunks/de-BkbpIKxx.js +13 -0
  66. package/chunks/es-CKkXujOF.js +13 -0
  67. package/chunks/fil-piIHMc8F.js +13 -0
  68. package/chunks/footnoteFlatten-DUQticYy.js +6 -0
  69. package/chunks/fr-DuA8qLje.js +13 -0
  70. package/chunks/graftExport-CYnStOdU.js +82 -0
  71. package/chunks/html2canvas.esm-CntiHiYW.js +994 -2
  72. package/chunks/index-2TBhRkX7.js +387 -0
  73. package/chunks/index-BWdRWxoH.js +1796 -13
  74. package/chunks/index-Bf14eTEW.js +1096 -0
  75. package/chunks/index-BwcX_r62.js +387 -0
  76. package/chunks/index.es-CI0QPo8w.js +780 -5
  77. package/chunks/{index.es-B97tjxvW.js → index.es-CI7cDExj.js} +1 -1
  78. package/chunks/{index.es-mTU7Sl3w.js → index.es-DHpGt6Y5.js} +1 -1
  79. package/chunks/ja-DgrSs555.js +13 -0
  80. package/chunks/{jspdf.es.min-Mykp4BZO.js → jspdf.es.min--GshOuIm.js} +1 -1
  81. package/chunks/jspdf.es.min-DU74zN8b.js +1747 -32
  82. package/chunks/{jspdf.es.min-DGiD4mlU.js → jspdf.es.min-DurJZ1zW.js} +1 -1
  83. package/chunks/jszip.min-CPW0h1Kx.js +476 -2
  84. package/chunks/katex-DWj8TvwO.js +1209 -8
  85. package/chunks/pdf-BLWDCiFF.js +1826 -10
  86. package/chunks/pseudoLocale-BoYTjmiK.js +1 -0
  87. package/chunks/pseudoLocale-DG2NnZmz.js +1 -0
  88. package/chunks/purify.es-BwLardii.js +107 -2
  89. package/chunks/serverDocumentSession-CJ1EH3Tp.js +15 -0
  90. package/chunks/signatures-Bwt_OGik.js +17 -0
  91. package/chunks/suggestionAuthorship-B-IuLQlE.js +1 -0
  92. package/chunks/tree-sitter-D6zWWUMP.js +1 -1
  93. package/chunks/web-tree-sitter-BXGZGnNj.js +2 -1
  94. package/chunks/zh-9OF3SWWO.js +13 -0
  95. package/full.js +1 -1
  96. package/index.d.ts +42 -15
  97. package/index.js +1 -1
  98. package/package.json +1 -1
  99. package/root.js +2 -2
  100. package/serverToolContract.d.ts +21 -3
  101. package/serverToolInputs.generated.d.ts +23 -2
  102. package/style.css +1 -1
  103. package/assets/historyMaterializeWorker-C4uxcZEh.js +0 -3
  104. package/chunks/AgentPageRenderer-BIf_Fza8.js +0 -1
  105. package/chunks/AgentPageRenderer-DT9sNxEn.js +0 -1
  106. package/chunks/AttachmentDocumentImporter-BUavYRxO.js +0 -1
  107. package/chunks/AttachmentDocumentImporter-DGwfDJSH.js +0 -1
  108. package/chunks/BidiText-D7LYTAUL.js +0 -1
  109. package/chunks/DocumentMutator-CjN7Kk-X.js +0 -31
  110. package/chunks/DocumentScrubber-C9ZZEcYW.js +0 -1
  111. package/chunks/DocumentStylesheet-byN5dtC6.js +0 -1
  112. package/chunks/DocxConverter-Be3uPNcD.js +0 -11
  113. package/chunks/DocxConverter-CGYMfz-j.js +0 -11
  114. package/chunks/DocxConverter-DabDLfsu.js +0 -11
  115. package/chunks/DocxGraft-Duvo2cpy.js +0 -1
  116. package/chunks/FileImporter-CjUX2S4s.js +0 -1
  117. package/chunks/FileImporter-DtkbI6rF.js +0 -1
  118. package/chunks/HtmlConverter-ikXImzTY.js +0 -61
  119. package/chunks/MarkdownConverter-CFrcLyO_.js +0 -17
  120. package/chunks/MathRenderer-B0Y1h1JU.js +0 -33
  121. package/chunks/OdtConverter-BFT_P8SI.js +0 -1
  122. package/chunks/OdtConverter-Cnda9T0q.js +0 -1
  123. package/chunks/OdtConverter-WdwwXKVM.js +0 -1
  124. package/chunks/PdfConverter-D7UM58vc.js +0 -21
  125. package/chunks/PdfConverter-TB-QPw29.js +0 -21
  126. package/chunks/PdfConverter-wVP63986.js +0 -21
  127. package/chunks/RtfConverter-D-oqPWNl.js +0 -14
  128. package/chunks/RtfConverter-D9zhE07-.js +0 -14
  129. package/chunks/RtfConverter-DZgwU-_R.js +0 -14
  130. package/chunks/TableBorders-BorZS8aZ.js +0 -1
  131. package/chunks/TableGrid-DVWaRZv0.js +0 -1
  132. package/chunks/ar-C8zx2RwP.js +0 -8
  133. package/chunks/backend-MFpDFVrD.js +0 -1
  134. package/chunks/base64-BNMNG-lN.js +0 -1
  135. package/chunks/capture-qC26xmfy.js +0 -1
  136. package/chunks/carrier-BWONvrA7.js +0 -1
  137. package/chunks/de-ByQFqecF.js +0 -8
  138. package/chunks/es-PHpJXv5S.js +0 -8
  139. package/chunks/footnoteFlatten-Bdnn_bz1.js +0 -1
  140. package/chunks/graftExport-CP3h2T88.js +0 -2
  141. package/chunks/index-CjeGoI2g.js +0 -351
  142. package/chunks/index-D7V8zn4w.js +0 -36
  143. package/chunks/index-DyOcu9mD.js +0 -351
  144. package/chunks/pseudoLocale-C90lXrPg.js +0 -1
  145. package/chunks/pseudoLocale-UA_TkGrH.js +0 -1
  146. package/chunks/serverDocumentSession-CRZSb5SO.js +0 -11
  147. package/chunks/signatures-CsL_TjvW.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,200 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Added
6
+
7
+ - **ODT and RTF input.** `ReviseDocumentFormat` and `ReviseServerFormat` gain
8
+ `"odt"` and `"rtf"`, detected from `.odt` / `.rtf` filenames and from the
9
+ `application/vnd.oasis.opendocument.text`, `application/rtf`, and
10
+ `text/rtf` MIME types. Both import fonts, sizes, colors, highlighting,
11
+ character and paragraph formatting, headings, lists with their numbering,
12
+ tables with merged cells and column widths, images, hyperlinks, footnotes
13
+ and endnotes, headers and footers, comments, tracked changes, and page
14
+ size and margins. RTF from Word, WordPad, TextEdit, and LibreOffice is
15
+ supported, in any Windows code page or East Asian encoding. Each converter
16
+ loads only when a host first opens that format. `revise/server`'s
17
+ `parseDocument`, `fileToYDoc`, and `seedYDocFromFile` accept both. Host
18
+ code with an exhaustive `switch` over either type needs cases for the two
19
+ new values.
20
+ - **Delete whole table rows, columns, or tables from a cell selection.**
21
+ Backspace or Delete over fully selected rows or columns removes them, and
22
+ over every cell removes the table; a partial selection still clears only
23
+ the cell contents. Removing several rows is one undo step, and a table that
24
+ was the only block leaves an empty paragraph. Shift+click in another cell
25
+ of the same table now extends a cell selection, as dragging does.
26
+ - **Move connectors.** When a tracked move is focused, a line in the left
27
+ margin links where the text moved from to where it moved to, across pages.
28
+ It is not drawn in print preview.
29
+ - **Pleading-paper line numbers.** Documents whose page layout carries a
30
+ pleading grid show numbered rows (for example 1 to 28) at fixed positions
31
+ on every page, independent of the text, on screen and in PDF export. DOCX
32
+ export writes them as Word line numbers restarting on each page.
33
+
34
+ ### Changed
35
+
36
+ - **Margin line numbers behave like Word's.** Each number sits on its line's
37
+ baseline, table lines are not counted on screen (PDF already skipped
38
+ them), and a section that turns numbering off shows none instead of
39
+ inheriting the document setting. Numbers are set in the font that
40
+ dominates each page's text, on screen and in PDF, where they were always
41
+ Helvetica before.
42
+ - **The delegated agent can move blocks.** `agent.run()` and comment agents
43
+ can move paragraphs, lists, and tables as one tracked move (applied
44
+ directly in editing mode); blocks with anchored comments are not moved.
45
+ `move_blocks` is not part of the embedded tool list for `tools.*` hosts.
46
+ The delegated agent also recovers more reliably: it repairs a run that
47
+ edited and then reported no change, checks table fill work before it
48
+ finishes, and keeps the request and latest tool results when it recovers
49
+ from a context limit.
50
+ - **Suggestion cards show a date once a change is over a week old.** Old
51
+ changes read "Sep 4" or "Oct 11, 2013" instead of "4739d ago".
52
+ - **The footnote card is a compact row.** Clicking a footnote reference shows
53
+ its label with **Go to note** and **Remove**; the note is edited in the
54
+ note itself. In narrow layouts the card is centered under its reference
55
+ mark.
56
+
57
+ ### Fixed
58
+
59
+ - **Links.** Bare email addresses link and autolink as `mailto:`;
60
+ `mailto:` and `tel:` URLs are kept as typed; an `@` before the path is not
61
+ read as `https://` user info. Cmd+K uses the selected text as the link
62
+ target only when it is a full URL or an email address, and the link popup
63
+ finds a link Cmd+K just made on a backward selection.
64
+ - **Link, footnote, and inline-math popups line up at every zoom level.**
65
+ - **Math is no longer clipped when it renders before the KaTeX fonts load.**
66
+ Such results show provisionally and re-render once the fonts arrive, and
67
+ failed font or stylesheet fetches are not cached.
68
+ - **DOCX tracked moves of whole paragraphs, lists, and tables.** On import,
69
+ Word's paragraph-mark `w:moveFrom` / `w:moveTo` make the whole block part
70
+ of the move, so accepting it removes the source paragraph instead of
71
+ leaving an empty one, and a list split across a move becomes two lists.
72
+ Export writes paragraph marks and table rows with the move, and accepting
73
+ or rejecting resolves both halves together.
74
+ - **Accepting the deletion of every row of a table removes the table**, as
75
+ in Word, instead of leaving a table with no rows.
76
+ - **DOCX header and footer line breaks.** `w:br` in headers and footers is
77
+ imported, and export writes `w:br` instead of a raw newline that Word
78
+ showed as a space.
79
+ - **Header and footer layout.** In multi-column sections, headers and
80
+ footers span the full text width instead of one column; a zone is as wide
81
+ as its widest line; a bordered zone, such as a footer rule, spans the whole
82
+ band; and empty zones give up their space.
83
+ - **`replace_block` and `append_to_paragraph` on a non-text target**, such as
84
+ a table, fail with `target_type_mismatch` instead of doing nothing.
85
+ - **DOCX, ODT, and RTF open where `Blob.arrayBuffer` is missing** (Safari
86
+ before 14, jsdom). Files are read with a `FileReader` fallback.
87
+
88
+ ### Security
89
+
90
+ - **ODT and RTF import is hardened against hostile files.** Links pass a
91
+ scheme allowlist (http, https, mailto, tel, ftp, and relative), so
92
+ `javascript:` and similar are dropped. Self-referencing ODT deletions and
93
+ RTF control words such as `\constructor` can no longer overflow the stack
94
+ or swallow text, and imported tables are capped at 1,000 columns and
95
+ 100,000 cells.
96
+
97
+ ## 2.1.0
98
+
99
+ ### Added
100
+
101
+ - **`source` on document inputs.** `{ id, source: file }` names the field for
102
+ what it takes: DOCX, Markdown, plain text, or HTML. `docx` still works as the
103
+ same field; passing both with different values throws.
104
+ - **`context_notes` is optional in typed host calls.** `tools.execute()` and
105
+ `tools.call()` (browser and `revise/server`) fill in `"N/A"` for the read and
106
+ search tools, so application code no longer passes a model's working memory.
107
+ `executeDynamic()` keeps the schema requirement for model-provided calls.
108
+ - **`leave_comment` reports a retargeted anchor.** When the anchor text is not
109
+ in the named block and the comment goes to the only read block that has it,
110
+ `data.requestedBlockId` names the block you asked for and the message says so.
111
+
112
+ - **`read_table` and `edit_table_cells` agent tools.** Read a large table in
113
+ bounded windows (a summary, up to 50 rows, or one oversized cell in pages),
114
+ then set the plain text of up to 50 cells per call by row ID and column.
115
+ Cell text is written literally. Only cells a `read_table` call returned in
116
+ full can be edited, and that read stays valid across later `execute()` calls
117
+ on the same document while the cell and table geometry remain unchanged.
118
+ An invalid target rejects the whole batch with no changes. In suggesting mode each cell is its own suggestion. Read-only
119
+ surfaces and viewers get `read_table` only. Both tools are also in the
120
+ `revise/server` session. The SDK's `read_table` does not take the native
121
+ agent's task-declaration arguments (`task_kind`, `scope_*`,
122
+ `source_attachment_id`, `deliberate_blanks`). They are left out of the
123
+ published schema, and a call that supplies one fails with
124
+ `unsupported_argument` without reading anything. Empty placeholders
125
+ (`null`, `""`, `[]`) are ignored.
126
+
127
+ ### Changed
128
+
129
+ - **The delegated agent plans long tasks.** `agent.run()`, `revise_run_agent`,
130
+ and comment agents keep a step-by-step plan for multi-step work, update it
131
+ in the same turns as their edits, and save it with the conversation, so
132
+ fewer turns go to bookkeeping. The embedded tool list is unchanged: plan
133
+ tools stay inside the delegated agent.
134
+ - **Faster on long documents.** The scrollbar track and its markers are drawn
135
+ once and reused while scrolling, Find reuses each block's normalized text
136
+ between keystrokes, and tracked-change records are indexed in one pass
137
+ instead of one document walk per suggestion.
138
+
139
+ ### Fixed
140
+
141
+ - **DOCX paragraph spacing follows the document's rules.** `w:contextualSpacing` no longer
142
+ zeroes a paragraph's declared space before and after on import. Spacing is
143
+ resolved from neighboring paragraphs on screen, in table cells and
144
+ containers, and in PDF export: the gap between two paragraphs is the larger
145
+ of their spacings, not the sum, and contextual spacing drops it only between
146
+ paragraphs of the same style. PDF keep-with-next reserves the whole gap, and
147
+ exported DOCX keeps the declared spacing. Documents whose paragraphs both
148
+ declare spacing lay out tighter than in 2.0.x.
149
+ - **`style_blocks` with `list-style-type: none` turns list items into plain
150
+ paragraphs**, keeping their spacing and line spacing and applying the call's
151
+ other paragraph attributes in the same step.
152
+ - **Unsupported DOCX content can be suggested for removal.** In suggesting
153
+ mode, removing a block the editor preserves but cannot render (an opaque
154
+ DOCX payload) now becomes a tracked deletion.
155
+ - **Comment previews keep their layout.** In a comment chip's hover preview,
156
+ the avatar holds its size and a long author name is truncated.
157
+ - **An editor with no agent configured sends nothing.** `agent.run()`, the
158
+ `revise_run_agent` tool, and comment agents used to stream the document,
159
+ unauthenticated, to Revise's hosted agent and then report a generic
160
+ connection error. Without a `turnStream`, `baseUrl`, or `token`, they now
161
+ fail at once with `agent_not_configured` (`AgentNotConfiguredError` from
162
+ `agent.run()`), and `getToolDefinitions()` leaves the delegation tool out.
163
+ - **`documents.open()` activates the new document every time.** Opening a
164
+ document straight after another open, or after `documents.activate()`, left
165
+ the earlier one active. `documents.list()` status was also briefly stale
166
+ right after a document became ready.
167
+ - **`tools.getDefinitions()` lists only the native tools.** It included
168
+ `revise_run_agent`, which the docs say it leaves out.
169
+ - **Changing `agent.turnStream` no longer reloads the document.** A new
170
+ `turnStream` or `disableMetrics` value re-created the document runtime,
171
+ re-parsing the source and dropping unsaved edits, so an inline generator in
172
+ JSX reloaded the document on every render. Agent settings now apply to the
173
+ next run in place.
174
+ - **Reads are not refused for the life of the editor.** After a window had
175
+ been read once, every later `read_blocks_from_index` of it failed with
176
+ `no_new_read_context`, so a host agent's second conversation could not read
177
+ the document. The guard now resets with each call, like the other per-turn
178
+ limits.
179
+ - **Tool errors speak to SDK callers.** Messages no longer carry the internal
180
+ `Failed operation: <tool>: <Error>:` prefix or point at `<document_content>`,
181
+ which only Revise's own agent sees; they point at read results instead.
182
+ - **The open-error screen shows a plain message.** A corrupt file showed the
183
+ parser's internals (a zip library's message and link) to the person who
184
+ picked it. `onError` still receives the full detail. Loading text no longer
185
+ says "DOCX" for other formats, and a `File` source's title drops `.md`,
186
+ `.txt`, and `.html` extensions as well as `.docx`.
187
+ - **PDF export requests a failing font once.** When a font download failed
188
+ (a CSP or firewall blocking revise.io, say), export requested the same URL a
189
+ second time. The warning now says a fallback font was used and names
190
+ `setAssetBaseUrl()` for mirroring the fonts.
191
+ - **Readable errors from the package in Node.** Bundled code is wrapped at
192
+ short lines, so an uncaught error (such as the missing-`jsdom` hint) is no
193
+ longer printed under a 100 KB line of minified source.
194
+ - **Quieter host builds.** Vite no longer warns that `"buffer"` was
195
+ externalized, or prints the inlined WebAssembly's base64 as a file that
196
+ "doesn't exist at build time".
197
+
3
198
  ## 2.0.1
4
199
 
5
200
  ### Added
package/README.md CHANGED
@@ -19,7 +19,7 @@ import "revise/style.css";
19
19
  export function DocumentPane({ file }: { file: File }) {
20
20
  return (
21
21
  <ReviseEditor
22
- initialDocuments={[{ id: "contract-1", title: "Contract", docx: file }]}
22
+ initialDocuments={[{ id: "contract-1", title: "Contract", source: file }]}
23
23
  onChange={(documentId, document) => {
24
24
  console.log(documentId, "now has", document.children.length, "blocks");
25
25
  }}
@@ -28,6 +28,9 @@ export function DocumentPane({ file }: { file: File }) {
28
28
  }
29
29
  ```
30
30
 
31
+ The editor sends Revise one anonymous ping per page load, with its version and
32
+ no user data or document content. Pass `telemetry={false}` to turn it off.
33
+
31
34
  Refer to the [SDK Docs](https://developer.revise.io/editor-sdk) for the full editor API, including agentic tool calling.
32
35
 
33
36
  ## License