revise 2.0.0 → 2.1.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 (129) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +4 -1
  3. package/assets/historyMaterializeWorker-C4uxcZEh.js +607 -0
  4. package/backend.d.ts +22 -0
  5. package/backend.js +3 -1
  6. package/chunks/AgentPageRenderer-BFB0arQL.js +1 -0
  7. package/chunks/AgentPageRenderer-Dn6SaRjW.js +1 -0
  8. package/chunks/AttachmentDocumentImporter-BHDJAdky.js +1 -0
  9. package/chunks/AttachmentDocumentImporter-CxOZqzt1.js +1 -0
  10. package/chunks/BidiText-C8PBPSQY.js +160 -0
  11. package/chunks/ColorParserFull-BKH72fK8.js +446 -1
  12. package/chunks/DocumentMutator-4vBJQ74L.js +31 -0
  13. package/chunks/DocumentScrubber-COPepQKE.js +1 -0
  14. package/chunks/DocumentScrubber-Cf_QqHhF.js +1 -0
  15. package/chunks/DocumentScrubber-DS4LFDKS.js +18 -0
  16. package/chunks/DocumentStylesheet-byN5dtC6.js +7 -1
  17. package/chunks/DocxConverter-BCEB7jWY.js +1083 -0
  18. package/chunks/{DocxConverter-COV6CjUM.js → DocxConverter-C3NflpDr.js} +7 -7
  19. package/chunks/{DocxConverter-B7P52lw7.js → DocxConverter-D9ZNn4nX.js} +6 -6
  20. package/chunks/{DocxGraft-CJ12C9WP.js → DocxGraft-Ba63IRP4.js} +1 -1
  21. package/chunks/DocxGraft-DjERgl-z.js +7 -0
  22. package/chunks/{DocxGraft-DcmFuUkd.js → DocxGraft-cYlmw4Ab.js} +1 -1
  23. package/chunks/FileImporter-CHXj9sNX.js +1 -0
  24. package/chunks/FileImporter-DetvRoJc.js +1 -0
  25. package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +3 -1
  26. package/chunks/HtmlConverter-Sd9t49vH.js +267 -0
  27. package/chunks/ListNumbering-Qlu6AuRZ.js +23 -1
  28. package/chunks/MarkdownConverter-BdJgh8xt.js +57 -0
  29. package/chunks/MathRenderer-B0Y1h1JU.js +36 -7
  30. package/chunks/OdtConverter-BKtyx012.js +1 -0
  31. package/chunks/OdtConverter-Ce9j8PRt.js +1 -0
  32. package/chunks/OdtConverter-D709qfYb.js +31 -0
  33. package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +36 -0
  34. package/chunks/PdfConverter-BA8XLTAM.js +21 -0
  35. package/chunks/PdfConverter-CkDClffR.js +438 -0
  36. package/chunks/PdfConverter-CxLxd-LJ.js +21 -0
  37. package/chunks/PdfImportService-CQCgsRX1.js +2 -0
  38. package/chunks/PdfImportService-xl7fstr-.js +2 -0
  39. package/chunks/{RtfConverter-oIwzoqCD.js → RtfConverter-BZOnMUGH.js} +5 -5
  40. package/chunks/{RtfConverter-BQGge3K-.js → RtfConverter-Bs81AfXt.js} +5 -5
  41. package/chunks/RtfConverter-DfuE5olb.js +45 -0
  42. package/chunks/TableBorders-Cdkc62cX.js +30 -0
  43. package/chunks/TableGrid-DbroRucl.js +12 -0
  44. package/chunks/TextFileDecoder--rsVs3NR.js +9 -2
  45. package/chunks/{TxtConverter-C1lp6dBS.js → TxtConverter-C-oiFUAp.js} +6 -3
  46. package/chunks/UnicodeUtils-CXtusU4g.js +10 -0
  47. package/chunks/XmlConverter-C0FnrVYk.js +70 -0
  48. package/chunks/XmlConverter-CQa8baOF.js +2 -0
  49. package/chunks/XmlConverter-DjEYaIyf.js +2 -0
  50. package/chunks/_commonjsHelpers-DaMA6jEr.js +2 -1
  51. package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -1
  52. package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -1
  53. package/chunks/ar-BdmGnaKI.js +14 -0
  54. package/chunks/backend-BIhAX-Gi.js +484 -0
  55. package/chunks/base64-Qx0OzT4p.js +196 -0
  56. package/chunks/browser-module-CFmqfGkE.js +1791 -3
  57. package/chunks/{browser-module-6b2Fq-5C.js → browser-module-CYGCfEyx.js} +1 -1
  58. package/chunks/{browser-module-CkO57IPL.js → browser-module-DgvTMhpA.js} +1 -1
  59. package/chunks/bundle.min-DRpfgV69.js +779 -5
  60. package/chunks/capture-BAJ2in5p.js +9 -0
  61. package/chunks/carrier-C5VZRMxZ.js +6 -0
  62. package/chunks/de-DldIXRFC.js +14 -0
  63. package/chunks/es-CnyKlSPK.js +14 -0
  64. package/chunks/footnoteFlatten-Bekh8ZfM.js +6 -0
  65. package/chunks/graftExport-CRRm1Oe_.js +82 -0
  66. package/chunks/html2canvas.esm-CntiHiYW.js +994 -2
  67. package/chunks/index-B1idHquf.js +1094 -0
  68. package/chunks/index-BWdRWxoH.js +1796 -13
  69. package/chunks/index-C-4H81OE.js +378 -0
  70. package/chunks/index-iZC8xN0t.js +378 -0
  71. package/chunks/{index.es-DOqegDGr.js → index.es-Bwt05m_b.js} +1 -1
  72. package/chunks/index.es-CI0QPo8w.js +780 -5
  73. package/chunks/{index.es-tXDO0RMv.js → index.es-DAQD57G4.js} +1 -1
  74. package/chunks/{jspdf.es.min-CzYti8jo.js → jspdf.es.min-CnNRolk9.js} +1 -1
  75. package/chunks/jspdf.es.min-DU74zN8b.js +1747 -32
  76. package/chunks/{jspdf.es.min-ejWOGhkJ.js → jspdf.es.min-DlTF8uTw.js} +1 -1
  77. package/chunks/jszip.min-CPW0h1Kx.js +476 -2
  78. package/chunks/katex-DWj8TvwO.js +1209 -8
  79. package/chunks/pdf-BLWDCiFF.js +1826 -10
  80. package/chunks/{pseudoLocale-CdBtPHRi.js → pseudoLocale-BoJwIubw.js} +1 -1
  81. package/chunks/{pseudoLocale-DEVWLkGC.js → pseudoLocale-DWAm7Dpa.js} +1 -1
  82. package/chunks/purify.es-BwLardii.js +107 -2
  83. package/chunks/serverDocumentSession-DASrQAbW.js +15 -0
  84. package/chunks/signatures-CBF7NZUy.js +17 -0
  85. package/chunks/tree-sitter-D6zWWUMP.js +1 -1
  86. package/chunks/web-tree-sitter-BXGZGnNj.js +2 -1
  87. package/full.js +1 -1
  88. package/index.d.ts +58 -16
  89. package/index.js +1 -1
  90. package/package.json +2 -2
  91. package/root.js +2 -2
  92. package/serverToolContract.d.ts +21 -3
  93. package/serverToolInputs.generated.d.ts +23 -2
  94. package/style.css +1 -1
  95. package/assets/historyMaterializeWorker-CoAX9ZAi.js +0 -3
  96. package/chunks/AgentPageRenderer-C0n4EnuW.js +0 -1
  97. package/chunks/AgentPageRenderer-DURfmiu0.js +0 -1
  98. package/chunks/AttachmentDocumentImporter-DSic_6At.js +0 -1
  99. package/chunks/AttachmentDocumentImporter-dNMtkxrv.js +0 -1
  100. package/chunks/BidiText-B4Hzrjg9.js +0 -1
  101. package/chunks/DocxConverter-Cq_zCEJC.js +0 -11
  102. package/chunks/DocxGraft-CQpvFcYb.js +0 -1
  103. package/chunks/FileImporter-DVnYOJHp.js +0 -1
  104. package/chunks/FileImporter-q9mCch0J.js +0 -1
  105. package/chunks/HtmlConverter-JvRlkQM3.js +0 -61
  106. package/chunks/MarkdownConverter-B-tPY7X3.js +0 -17
  107. package/chunks/OdtConverter-Br81BSoJ.js +0 -1
  108. package/chunks/OdtConverter-CQjh0vlo.js +0 -1
  109. package/chunks/OdtConverter-DYHnR4E8.js +0 -1
  110. package/chunks/PdfConverter-D26rXumc.js +0 -21
  111. package/chunks/PdfConverter-DGZpUSVf.js +0 -21
  112. package/chunks/PdfConverter-DZzVP0-B.js +0 -21
  113. package/chunks/PdfImportService-CBD8TL1k.js +0 -2
  114. package/chunks/PdfImportService-D6uUKGMf.js +0 -2
  115. package/chunks/RtfConverter-CMfZ4olw.js +0 -14
  116. package/chunks/TableBorders-BLkZYt1k.js +0 -1
  117. package/chunks/TableGrid-DVWaRZv0.js +0 -1
  118. package/chunks/ar-kgSWdrXF.js +0 -8
  119. package/chunks/backend-Cq-khfdG.js +0 -1
  120. package/chunks/base64-CfDUyGi8.js +0 -36
  121. package/chunks/capture-DU3MC7tb.js +0 -1
  122. package/chunks/carrier-WgcRSu7a.js +0 -1
  123. package/chunks/de-C2QTHrqo.js +0 -8
  124. package/chunks/es-BKboUn4q.js +0 -8
  125. package/chunks/footnoteFlatten-CW-DUcgK.js +0 -1
  126. package/chunks/graftExport-CVg7PO2A.js +0 -2
  127. package/chunks/index-CLw_BlSL.js +0 -353
  128. package/chunks/index-F-kHIwWT.js +0 -353
  129. package/chunks/serverDocumentSession-DZrYbdpk.js +0 -42
package/CHANGELOG.md CHANGED
@@ -1,5 +1,133 @@
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
+
3
131
  ## 2.0.0
4
132
 
5
133
  The SDK is now public: `npm i revise`. No account, token, or contact
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