revise 2.0.1 → 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 (123) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +4 -1
  3. package/assets/historyMaterializeWorker-C4uxcZEh.js +607 -3
  4. package/backend.js +3 -1
  5. package/chunks/{AgentPageRenderer-BIf_Fza8.js → AgentPageRenderer-BFB0arQL.js} +1 -1
  6. package/chunks/{AgentPageRenderer-DT9sNxEn.js → AgentPageRenderer-Dn6SaRjW.js} +1 -1
  7. package/chunks/AttachmentDocumentImporter-BHDJAdky.js +1 -0
  8. package/chunks/AttachmentDocumentImporter-CxOZqzt1.js +1 -0
  9. package/chunks/BidiText-C8PBPSQY.js +160 -0
  10. package/chunks/ColorParserFull-BKH72fK8.js +446 -1
  11. package/chunks/DocumentMutator-4vBJQ74L.js +31 -0
  12. package/chunks/{DocumentScrubber-DrgzBlx4.js → DocumentScrubber-COPepQKE.js} +1 -1
  13. package/chunks/{DocumentScrubber-W0EfGmL-.js → DocumentScrubber-Cf_QqHhF.js} +1 -1
  14. package/chunks/DocumentScrubber-DS4LFDKS.js +18 -0
  15. package/chunks/DocumentStylesheet-byN5dtC6.js +7 -1
  16. package/chunks/DocxConverter-BCEB7jWY.js +1083 -0
  17. package/chunks/{DocxConverter-CGYMfz-j.js → DocxConverter-C3NflpDr.js} +2 -2
  18. package/chunks/{DocxConverter-DabDLfsu.js → DocxConverter-D9ZNn4nX.js} +2 -2
  19. package/chunks/{DocxGraft-B6W7fbh4.js → DocxGraft-Ba63IRP4.js} +1 -1
  20. package/chunks/DocxGraft-DjERgl-z.js +7 -0
  21. package/chunks/{DocxGraft-Cj7v78BO.js → DocxGraft-cYlmw4Ab.js} +1 -1
  22. package/chunks/{FileImporter-CjUX2S4s.js → FileImporter-CHXj9sNX.js} +1 -1
  23. package/chunks/{FileImporter-DtkbI6rF.js → FileImporter-DetvRoJc.js} +1 -1
  24. package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +3 -1
  25. package/chunks/HtmlConverter-Sd9t49vH.js +267 -0
  26. package/chunks/ListNumbering-Qlu6AuRZ.js +23 -1
  27. package/chunks/MarkdownConverter-BdJgh8xt.js +57 -0
  28. package/chunks/MathRenderer-B0Y1h1JU.js +36 -7
  29. package/chunks/{OdtConverter-Cnda9T0q.js → OdtConverter-BKtyx012.js} +1 -1
  30. package/chunks/{OdtConverter-WdwwXKVM.js → OdtConverter-Ce9j8PRt.js} +1 -1
  31. package/chunks/OdtConverter-D709qfYb.js +31 -0
  32. package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +36 -0
  33. package/chunks/PdfConverter-BA8XLTAM.js +21 -0
  34. package/chunks/PdfConverter-CkDClffR.js +438 -0
  35. package/chunks/PdfConverter-CxLxd-LJ.js +21 -0
  36. package/chunks/{PdfImportService-Dj1-3L2B.js → PdfImportService-CQCgsRX1.js} +2 -2
  37. package/chunks/{PdfImportService-OE9G383I.js → PdfImportService-xl7fstr-.js} +2 -2
  38. package/chunks/{RtfConverter-D-oqPWNl.js → RtfConverter-BZOnMUGH.js} +1 -1
  39. package/chunks/{RtfConverter-D9zhE07-.js → RtfConverter-Bs81AfXt.js} +1 -1
  40. package/chunks/RtfConverter-DfuE5olb.js +45 -0
  41. package/chunks/TableBorders-Cdkc62cX.js +30 -0
  42. package/chunks/TableGrid-DbroRucl.js +12 -0
  43. package/chunks/TextFileDecoder--rsVs3NR.js +9 -2
  44. package/chunks/{TxtConverter-BYazsp6P.js → TxtConverter-C-oiFUAp.js} +5 -2
  45. package/chunks/UnicodeUtils-CXtusU4g.js +10 -0
  46. package/chunks/XmlConverter-C0FnrVYk.js +70 -0
  47. package/chunks/XmlConverter-CQa8baOF.js +2 -0
  48. package/chunks/XmlConverter-DjEYaIyf.js +2 -0
  49. package/chunks/_commonjsHelpers-DaMA6jEr.js +2 -1
  50. package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -1
  51. package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -1
  52. package/chunks/ar-BdmGnaKI.js +14 -0
  53. package/chunks/backend-BIhAX-Gi.js +484 -0
  54. package/chunks/base64-Qx0OzT4p.js +196 -0
  55. package/chunks/browser-module-CFmqfGkE.js +1791 -3
  56. package/chunks/{browser-module-BbaxnHNK.js → browser-module-CYGCfEyx.js} +1 -1
  57. package/chunks/{browser-module-D2ixluMg.js → browser-module-DgvTMhpA.js} +1 -1
  58. package/chunks/bundle.min-DRpfgV69.js +779 -5
  59. package/chunks/capture-BAJ2in5p.js +9 -0
  60. package/chunks/carrier-C5VZRMxZ.js +6 -0
  61. package/chunks/de-DldIXRFC.js +14 -0
  62. package/chunks/es-CnyKlSPK.js +14 -0
  63. package/chunks/footnoteFlatten-Bekh8ZfM.js +6 -0
  64. package/chunks/graftExport-CRRm1Oe_.js +82 -0
  65. package/chunks/html2canvas.esm-CntiHiYW.js +994 -2
  66. package/chunks/index-B1idHquf.js +1094 -0
  67. package/chunks/index-BWdRWxoH.js +1796 -13
  68. package/chunks/index-C-4H81OE.js +378 -0
  69. package/chunks/index-iZC8xN0t.js +378 -0
  70. package/chunks/{index.es-mTU7Sl3w.js → index.es-Bwt05m_b.js} +1 -1
  71. package/chunks/index.es-CI0QPo8w.js +780 -5
  72. package/chunks/{index.es-B97tjxvW.js → index.es-DAQD57G4.js} +1 -1
  73. package/chunks/{jspdf.es.min-Mykp4BZO.js → jspdf.es.min-CnNRolk9.js} +1 -1
  74. package/chunks/jspdf.es.min-DU74zN8b.js +1747 -32
  75. package/chunks/{jspdf.es.min-DGiD4mlU.js → jspdf.es.min-DlTF8uTw.js} +1 -1
  76. package/chunks/jszip.min-CPW0h1Kx.js +476 -2
  77. package/chunks/katex-DWj8TvwO.js +1209 -8
  78. package/chunks/pdf-BLWDCiFF.js +1826 -10
  79. package/chunks/{pseudoLocale-C90lXrPg.js → pseudoLocale-BoJwIubw.js} +1 -1
  80. package/chunks/{pseudoLocale-UA_TkGrH.js → pseudoLocale-DWAm7Dpa.js} +1 -1
  81. package/chunks/purify.es-BwLardii.js +107 -2
  82. package/chunks/serverDocumentSession-DASrQAbW.js +15 -0
  83. package/chunks/signatures-CBF7NZUy.js +17 -0
  84. package/chunks/tree-sitter-D6zWWUMP.js +1 -1
  85. package/chunks/web-tree-sitter-BXGZGnNj.js +2 -1
  86. package/full.js +1 -1
  87. package/index.d.ts +31 -12
  88. package/index.js +1 -1
  89. package/package.json +1 -1
  90. package/root.js +2 -2
  91. package/serverToolContract.d.ts +21 -3
  92. package/serverToolInputs.generated.d.ts +23 -2
  93. package/style.css +1 -1
  94. package/chunks/AttachmentDocumentImporter-BUavYRxO.js +0 -1
  95. package/chunks/AttachmentDocumentImporter-DGwfDJSH.js +0 -1
  96. package/chunks/BidiText-D7LYTAUL.js +0 -1
  97. package/chunks/DocumentMutator-CjN7Kk-X.js +0 -31
  98. package/chunks/DocumentScrubber-C9ZZEcYW.js +0 -1
  99. package/chunks/DocxConverter-Be3uPNcD.js +0 -11
  100. package/chunks/DocxGraft-Duvo2cpy.js +0 -1
  101. package/chunks/HtmlConverter-ikXImzTY.js +0 -61
  102. package/chunks/MarkdownConverter-CFrcLyO_.js +0 -17
  103. package/chunks/OdtConverter-BFT_P8SI.js +0 -1
  104. package/chunks/PdfConverter-D7UM58vc.js +0 -21
  105. package/chunks/PdfConverter-TB-QPw29.js +0 -21
  106. package/chunks/PdfConverter-wVP63986.js +0 -21
  107. package/chunks/RtfConverter-DZgwU-_R.js +0 -14
  108. package/chunks/TableBorders-BorZS8aZ.js +0 -1
  109. package/chunks/TableGrid-DVWaRZv0.js +0 -1
  110. package/chunks/ar-C8zx2RwP.js +0 -8
  111. package/chunks/backend-MFpDFVrD.js +0 -1
  112. package/chunks/base64-BNMNG-lN.js +0 -1
  113. package/chunks/capture-qC26xmfy.js +0 -1
  114. package/chunks/carrier-BWONvrA7.js +0 -1
  115. package/chunks/de-ByQFqecF.js +0 -8
  116. package/chunks/es-PHpJXv5S.js +0 -8
  117. package/chunks/footnoteFlatten-Bdnn_bz1.js +0 -1
  118. package/chunks/graftExport-CP3h2T88.js +0 -2
  119. package/chunks/index-CjeGoI2g.js +0 -351
  120. package/chunks/index-D7V8zn4w.js +0 -36
  121. package/chunks/index-DyOcu9mD.js +0 -351
  122. package/chunks/serverDocumentSession-CRZSb5SO.js +0 -11
  123. package/chunks/signatures-CsL_TjvW.js +0 -1
@@ -1 +1,2 @@
1
- class e{constructor(t){this.endIndex=t,this.childCount=0,this.startIndex=0,this.parent=null,this.type="text"}child(){return this}}class s{static async load(){return new s}}class n{static async init(){}setLanguage(){}parse(t){return{rootNode:new e(t.length)}}}export{s as Language,n as Parser};
1
+ class e{constructor(t){this.endIndex=t,this.childCount=0,this.startIndex=0,this.parent=null,this.type="text"}child(){return this}}class s{static async load(){return new s}}class n{static async init(){}setLanguage(){}parse(t){
2
+ return{rootNode:new e(t.length)}}}export{s as Language,n as Parser};
package/full.js CHANGED
@@ -1 +1 @@
1
- import{ca as s,c9 as a,cc as e,cf as c,cd as r,cb as o,cc as E,cg as t,ce as R}from"./chunks/index-DyOcu9mD.js";export{s as REVISE_SDK_BUILD,a as REVISE_SDK_VERSION,e as ReviseEditor,c as ReviseRoleError,r as ReviseToolError,o as createEmptyDocx,E as default,t as rolePolicy,R as setAssetBaseUrl};
1
+ import{cf as s,ce as a,ch as e,ck as r,ci as c,cg as o,ch as E,cl as t,cj as i}from"./chunks/index-C-4H81OE.js";export{s as REVISE_SDK_BUILD,a as REVISE_SDK_VERSION,e as ReviseEditor,r as ReviseRoleError,c as ReviseToolError,o as createEmptyDocx,E as default,t as rolePolicy,i as setAssetBaseUrl};
package/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as React from "react";
2
2
  // The canonical tool contract, shared verbatim with the backend entry: the
3
3
  // browser surface returns the same envelopes and throws the same error.
4
4
  import type {
5
+ ReviseHostToolInput,
5
6
  ReviseSuggestionDecision,
6
- ReviseToolInput,
7
7
  ReviseToolName,
8
8
  ReviseToolResponse,
9
9
  ReviseToolResult,
@@ -66,15 +66,27 @@ export type ReviseAgentTurnStream = (
66
66
  request: ReviseAgentTurnRequest,
67
67
  ) => AsyncGenerator<ReviseAgentStreamEvent, void, unknown>;
68
68
 
69
+ /** Where agent work goes, and how it is signed. Configure one transport —
70
+ * `turnStream`, `baseUrl`, or `token` — or agent runs fail fast with
71
+ * `agent_not_configured` and send nothing. */
69
72
  export interface ReviseAgentConfig {
70
- /** Display name for comments and tracked changes. Defaults to Revise Agent. */
73
+ /** Display name for comments and tracked changes made through
74
+ * `tools.execute` and agent runs. Defaults to "Revise Agent". */
71
75
  name?: string;
76
+ /** Your own Revise agent backend. Without it, runs go to Revise's hosted
77
+ * agent, which needs a `token`. */
72
78
  baseUrl?: string;
79
+ /** Bearer token. Required for Revise's hosted agent; an anonymous
80
+ * `baseUrl` backend needs none. */
73
81
  token?: string;
74
82
  conversationId?: string;
75
83
  provider?: string;
76
84
  model?: string;
85
+ /** Run turns through your own model or gateway. Changing it takes effect on
86
+ * the next run, without reopening the document. */
77
87
  turnStream?: ReviseAgentTurnStream;
88
+ /** Skip the run-completion call (cost accounting) to the agent backend at
89
+ * `baseUrl`. Implied by `turnStream`. */
78
90
  disableMetrics?: boolean;
79
91
  }
80
92
 
@@ -121,10 +133,12 @@ export interface ReviseEditorToolExecutionOptions {
121
133
 
122
134
  /** Tool arguments, with input optional only when its schema has no required
123
135
  * fields — the browser twin of the server contract's argument tuple. */
136
+ /** Typed host arguments. `context_notes` is optional here and defaults to
137
+ * "N/A"; `executeDynamic()`, for model-provided calls, still requires it. */
124
138
  export type ReviseEditorToolArguments<Name extends ReviseToolName> =
125
- Record<string, never> extends ReviseToolInput<Name>
126
- ? [input?: ReviseToolInput<Name>, options?: ReviseEditorToolExecutionOptions]
127
- : [input: ReviseToolInput<Name>, options?: ReviseEditorToolExecutionOptions];
139
+ Record<string, never> extends ReviseHostToolInput<Name>
140
+ ? [input?: ReviseHostToolInput<Name>, options?: ReviseEditorToolExecutionOptions]
141
+ : [input: ReviseHostToolInput<Name>, options?: ReviseEditorToolExecutionOptions];
128
142
 
129
143
  export interface ReviseEditorTool extends ReviseEditorToolDefinition {
130
144
  execute(
@@ -717,10 +731,11 @@ export declare class ReviseRoleError extends Error {
717
731
  export interface ReviseTrackedChange {
718
732
  id: string;
719
733
  /** Word's three revision kinds, plus "move" for a linked move pair. A
720
- * replacement appears as both a delete and an insert, as it does in Word.
721
- * A linked move is ONE change: `deletedText` is the text at the source,
722
- * `insertedText` the text at the destination, and resolving it settles
723
- * both locations atomically. */
734
+ * replacement made in one operation (the agent's `replace` tool) is ONE
735
+ * change with both `deletedText` and `insertedText` set; its kind is
736
+ * the one it was recorded with, usually "delete". A linked move is also ONE
737
+ * change: `deletedText` is the text at the source, `insertedText` the
738
+ * text at the destination, and resolving it settles both locations. */
724
739
  kind: "insert" | "delete" | "format" | "move";
725
740
  /** A person, "Revise Agent", an external agent, or "Anonymous". */
726
741
  author: string;
@@ -743,8 +758,11 @@ export interface ReviseTrackedChange {
743
758
  export interface ReviseDocumentInput {
744
759
  /** Stable host-owned ID used by APIs, agent tools, and callbacks. */
745
760
  id: string;
746
- /** The source document: DOCX, Markdown, plain text, or HTML. Optional when
747
- * joining an established collaborative document. */
761
+ /** The document to open: DOCX, Markdown, plain text, or HTML. Optional
762
+ * when joining an established collaborative document. */
763
+ source?: ReviseDocumentSource;
764
+ /** The original name for `source`, accepted for compatibility. Pass one
765
+ * or the other. */
748
766
  docx?: ReviseDocumentSource;
749
767
  /** Share this document over a Yjs transport you own. */
750
768
  collaboration?: ReviseCollaborationConfig;
@@ -878,7 +896,8 @@ export interface ReviseEditorProps {
878
896
  /** Once per page load, the SDK sends Revise one anonymous ping carrying
879
897
  * its version; the browser adds your site's origin. Development hosts
880
898
  * (localhost and similar) are only counted, never named. No cookies, user
881
- * data, or document content. Set false to turn it off. Defaults to true. */
899
+ * data, or document content. Set false to turn it off. Defaults to true.
900
+ * An agent, when you configure one, talks only to the backend you chose. */
882
901
  telemetry?: boolean;
883
902
  initialDocuments?: readonly ReviseDocumentInput[];
884
903
  /** Controlled active document ID. */
package/index.js CHANGED
@@ -1 +1 @@
1
- import{ca as s,c9 as a,cc as e,cf as c,cd as r,cb as o,cc as E,cg as t,ce as R}from"./chunks/index-CjeGoI2g.js";export{s as REVISE_SDK_BUILD,a as REVISE_SDK_VERSION,e as ReviseEditor,c as ReviseRoleError,r as ReviseToolError,o as createEmptyDocx,E as default,t as rolePolicy,R as setAssetBaseUrl};
1
+ import{cf as s,ce as a,ch as e,ck as r,ci as c,cg as o,ch as E,cl as t,cj as i}from"./chunks/index-iZC8xN0t.js";export{s as REVISE_SDK_BUILD,a as REVISE_SDK_VERSION,e as ReviseEditor,r as ReviseRoleError,c as ReviseToolError,o as createEmptyDocx,E as default,t as rolePolicy,i as setAssetBaseUrl};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revise",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "A word processor for React: DOCX in and out, real pagination, tracked changes, comments, collaboration, and agent tools. Free for evaluation, personal projects, and education.",
5
5
  "keywords": [
6
6
  "docx",
package/root.js CHANGED
@@ -1,2 +1,2 @@
1
- export const REVISE_SDK_VERSION = "2.0.1";
2
- export const REVISE_SDK_BUILD = "d2e5b1c73";
1
+ export const REVISE_SDK_VERSION = "2.1.0";
2
+ export const REVISE_SDK_BUILD = "86f2c47ed";
@@ -221,7 +221,11 @@ export interface ReviseMutationData {
221
221
 
222
222
  export interface ReviseCommentData {
223
223
  commentId: string;
224
+ /** The block the comment is anchored to. */
224
225
  blockId: string;
226
+ /** Set when the requested block did not hold the anchor text and the
227
+ * comment went to the only read block that did. */
228
+ requestedBlockId?: string;
225
229
  anchor: ReviseJsonObject;
226
230
  }
227
231
 
@@ -253,11 +257,25 @@ export type ReviseToolDataMap = {
253
257
  export type ReviseToolData<Name extends ReviseToolName> =
254
258
  ReviseToolDataMap[Name];
255
259
 
260
+ /**
261
+ * A tool's input as application code writes it for typed `execute()` and
262
+ * `call()`.
263
+ *
264
+ * `context_notes` is a model's working memory, carried from one read to the
265
+ * next, and the model-facing schemas require it. Host code keeps its own
266
+ * state, so the field is optional here and defaults to `"N/A"`.
267
+ * `executeDynamic()`, the path for model-provided calls, still requires it.
268
+ */
269
+ export type ReviseHostToolInput<Name extends ReviseToolName> =
270
+ ReviseToolInput<Name> extends { context_notes: string }
271
+ ? Omit<ReviseToolInput<Name>, "context_notes"> & { context_notes?: string }
272
+ : ReviseToolInput<Name>;
273
+
256
274
  /** Tool arguments, with input optional only when its schema has no required fields. */
257
275
  export type ReviseToolArguments<Name extends ReviseToolName> =
258
- Record<string, never> extends ReviseToolInput<Name>
259
- ? [input?: ReviseToolInput<Name>, options?: ReviseToolCallOptions]
260
- : [input: ReviseToolInput<Name>, options?: ReviseToolCallOptions];
276
+ Record<string, never> extends ReviseHostToolInput<Name>
277
+ ? [input?: ReviseHostToolInput<Name>, options?: ReviseToolCallOptions]
278
+ : [input: ReviseHostToolInput<Name>, options?: ReviseToolCallOptions];
261
279
 
262
280
  /** Semantic document context returned by read and search calls. */
263
281
  export interface ReviseDocumentContext {
@@ -1,5 +1,4 @@
1
- // Generated from backend/agent/internal/tools/definitions.go.
2
- // Run `npm run generate:sdk-tools` after changing agent tool schemas.
1
+ // Input types for every Revise tool, generated from the tool schemas.
3
2
  export type ReviseJsonPrimitive = string | number | boolean | null;
4
3
  export type ReviseJsonValue =
5
4
  | ReviseJsonPrimitive
@@ -26,6 +25,19 @@ export interface ReviseToolInputMap {
26
25
  block_ids: Array<string>;
27
26
  context_notes: string;
28
27
  };
28
+ read_table: {
29
+ cell_id?: string;
30
+ column_count?: number;
31
+ column_start?: number;
32
+ context_notes: string;
33
+ continuation_revision?: string;
34
+ mode?: "summary" | "rows" | "cell_text";
35
+ row_count?: number;
36
+ row_ids?: Array<string>;
37
+ row_start?: number;
38
+ table_id: string;
39
+ text_offset?: number;
40
+ };
29
41
  measure_document: {
30
42
  heading_levels?: Array<1 | 2 | 3>;
31
43
  include_sections?: boolean;
@@ -215,6 +227,15 @@ export interface ReviseToolInputMap {
215
227
  columnIndex: number;
216
228
  tableId: string;
217
229
  };
230
+ edit_table_cells: {
231
+ cells: Array<{
232
+ column: number;
233
+ row_id: string;
234
+ text: string;
235
+ }>;
236
+ mode: "fill_if_empty" | "replace";
237
+ table_id: string;
238
+ };
218
239
  remove_block: {
219
240
  count?: number;
220
241
  id?: string;