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/index.d.ts CHANGED
@@ -1,971 +1,17 @@
1
- import * as React from "react";
2
- // The canonical tool contract, shared verbatim with the backend entry: the
3
- // browser surface returns the same envelopes and throws the same error.
4
- import type {
5
- ReviseHostToolInput,
6
- ReviseSuggestionDecision,
7
- ReviseToolName,
8
- ReviseToolResponse,
9
- ReviseToolResult,
10
- } from "./serverToolContract.js";
11
- export type * from "./serverToolContract.js";
12
-
13
- export declare class ReviseToolError<Name extends string = string> extends Error {
14
- readonly failure: import("./serverToolContract.js").ReviseToolFailure<Name>;
15
- readonly callId: string;
16
- readonly tool: Name;
17
- readonly code: string;
18
- constructor(failure: import("./serverToolContract.js").ReviseToolFailure<Name>);
19
- }
20
-
21
- /** The version of this package, at runtime. Include it when you escalate. */
22
- export declare const REVISE_SDK_VERSION: string;
23
-
24
- /** The commit this bundle was built from. Empty in a development build. */
25
- export declare const REVISE_SDK_BUILD: string;
26
-
27
- export interface ReviseDocument {
28
- type: "doc";
29
- children: unknown[];
30
- [key: string]: unknown;
31
- }
32
-
33
- export interface EditorUserIdentity {
34
- id?: string;
35
- name?: string;
36
- email?: string;
37
- image?: string;
38
- /** Caret and presence color. Any CSS color. Without one, a stable color
39
- * is derived from the id. */
40
- color?: string;
41
- }
42
-
43
- export interface ReviseAgentMessage {
44
- role: string;
45
- content: string;
46
- timestamp?: number;
47
- toolName?: string;
48
- incomplete?: boolean;
49
- [key: string]: unknown;
50
- }
51
-
52
- export interface ReviseAgentTurnRequest {
53
- prompt: string;
54
- currentDocument: ReviseDocument;
55
- currentTurn: number;
56
- config: Record<string, unknown>;
57
- [key: string]: unknown;
58
- }
59
-
60
- export interface ReviseAgentStreamEvent {
61
- type: "text" | "tool_call" | "tool_result" | "tool_start" | "usage" | "error" | "done" | "request_mode" | "web_search" | "reasoning" | "history_repair";
62
- data: any;
63
- }
64
-
65
- export type ReviseAgentTurnStream = (
66
- request: ReviseAgentTurnRequest,
67
- ) => AsyncGenerator<ReviseAgentStreamEvent, void, unknown>;
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. */
72
- export interface ReviseAgentConfig {
73
- /** Display name for comments and tracked changes made through
74
- * `tools.execute` and agent runs. Defaults to "Revise Agent". */
75
- name?: string;
76
- /** Your own Revise agent backend. Without it, runs go to Revise's hosted
77
- * agent, which needs a `token`. */
78
- baseUrl?: string;
79
- /** Bearer token. Required for Revise's hosted agent; an anonymous
80
- * `baseUrl` backend needs none. */
81
- token?: string;
82
- conversationId?: string;
83
- provider?: string;
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. */
87
- turnStream?: ReviseAgentTurnStream;
88
- /** Skip the run-completion call (cost accounting) to the agent backend at
89
- * `baseUrl`. Implied by `turnStream`. */
90
- disableMetrics?: boolean;
91
- }
92
-
93
- export interface ReviseAgentEvent {
94
- state: "idle" | "streaming" | "complete" | "error";
95
- activeTool: string | null;
96
- status: string | null;
97
- error?: string;
98
- messages: ReviseAgentMessage[];
99
- }
100
-
101
- export interface ReviseAgentRunOptions {
102
- /** Narrows host authority for this run; cannot raise it. */
103
- executionPolicy?: {
104
- documentAccess: "read" | "comment" | "edit";
105
- interaction: "interactive" | "best_effort";
106
- allowedTools?: readonly string[] | null;
107
- };
108
- developerPrePrompt?: string;
109
- allowedToolNames?: string[];
110
- providerOverride?: string;
111
- modelOverride?: string;
112
- forceFirstTurnNoTools?: boolean;
113
- attachments?: unknown[];
114
- directMode?: boolean;
115
- }
116
-
117
- export interface ReviseAgentRunResult extends ReviseAgentEvent {
118
- actionCount: number;
119
- }
120
-
121
- export interface ReviseEditorToolDefinition {
122
- name: string;
123
- description: string;
124
- inputSchema: Record<string, unknown>;
125
- }
126
-
127
- export interface ReviseEditorToolExecutionOptions {
128
- /** Target an open document. Omit to use the active document. */
129
- documentId?: string;
130
- /** Apply mutation tools directly instead of leaving tracked suggestions. */
131
- directMode?: boolean;
132
- }
133
-
134
- /** Tool arguments, with input optional only when its schema has no required
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. */
138
- export type ReviseEditorToolArguments<Name extends ReviseToolName> =
139
- Record<string, never> extends ReviseHostToolInput<Name>
140
- ? [input?: ReviseHostToolInput<Name>, options?: ReviseEditorToolExecutionOptions]
141
- : [input: ReviseHostToolInput<Name>, options?: ReviseEditorToolExecutionOptions];
142
-
143
- export interface ReviseEditorTool extends ReviseEditorToolDefinition {
144
- execute(
145
- input?: Record<string, unknown>,
146
- options?: ReviseEditorToolExecutionOptions,
147
- ): Promise<ReviseToolResult<string>>;
148
- }
149
-
150
- /** The document tool surface. Speaks the same contract as
151
- * the backend entry: the same discriminated result envelope, the
152
- * same typed inputs, the same execute/executeDynamic/call split. */
153
- export interface ReviseEditorTools {
154
- /** Execute a known tool; expected failures come back as { ok: false }. */
155
- execute<Name extends ReviseToolName>(
156
- name: Name,
157
- ...args: ReviseEditorToolArguments<Name>
158
- ): Promise<ReviseToolResult<Name>>;
159
- /** Execute an untrusted model-provided name and JSON input; also the door
160
- * to browser-only tools (get_selection, view_image, revise_run_agent) and
161
- * model-facing document_id routing. */
162
- executeDynamic(
163
- name: string,
164
- input?: Record<string, unknown>,
165
- options?: ReviseEditorToolExecutionOptions,
166
- ): Promise<ReviseToolResult<string>>;
167
- /** Returns only the successful response and throws ReviseToolError when
168
- * the tool rejects the call. */
169
- call<Name extends ReviseToolName>(
170
- name: Name,
171
- ...args: ReviseEditorToolArguments<Name>
172
- ): Promise<ReviseToolResponse<Name>>;
173
- getDefinitions(): ReviseEditorToolDefinition[];
174
- exportDocx(): Promise<Blob>;
175
- /**
176
- * Export the document as a file. `format` defaults to "docx". In
177
- * "review" mode (the default) a .docx keeps pending tracked changes and
178
- * comments; other formats show the text with changes accepted. "final"
179
- * accepts every pending change and drops comments first: a clean copy.
180
- */
181
- export(options?: ReviseExportOptions): Promise<Blob>;
182
- /** Settle every open suggestion, collaborators' included. Prefer ID-based
183
- * review.acceptSuggestions() with IDs from mutation results. */
184
- acceptAllSuggestions(): ReviseSuggestionDecision;
185
- rejectAllSuggestions(): ReviseSuggestionDecision;
186
- }
187
-
188
- export interface ReviseAgentSubagent {
189
- run(task: string, options?: ReviseAgentRunOptions): Promise<ReviseAgentRunResult>;
190
- steer(message: string): boolean;
191
- cancel(): void;
192
- subscribe(listener: (event: ReviseAgentEvent) => void): () => void;
193
- }
194
-
195
- export function createEmptyDocx(title?: string): Promise<Blob>;
196
1
  /**
197
- * Where Revise's static assets load from: PDF export and math fonts, the
198
- * KaTeX stylesheet, the pdf.js worker, and (revise/editor/full) Tree-sitter
199
- * grammars. Defaults to https://revise.io. To self-host, mirror revise.io's
200
- * fonts/, katex.min.css, pdfjs/, and tree-sitter/ at your own origin and pass
201
- * it here; null restores the default.
202
- */
203
- export declare function setAssetBaseUrl(url: string | null): void;
204
-
205
- export type ReviseCommentAgentStatus =
206
- | "running"
207
- | "complete"
208
- | "error"
209
- | "interrupted"
210
- | "canceled";
211
-
212
- export interface ReviseCommentAgentState {
213
- threadId: string;
214
- status: ReviseCommentAgentStatus;
215
- statusText?: string;
216
- error?: string;
217
- relatedSuggestionIds?: string[];
218
- updatedAt: number;
219
- [key: string]: unknown;
220
- }
221
-
222
- export interface ReviseCommentAgentRunResult {
223
- threadId: string;
224
- status: ReviseCommentAgentStatus;
225
- reply?: string;
226
- relatedSuggestionIds: string[];
227
- error?: string;
228
- }
229
-
230
- export interface ReviseCommentAgent {
231
- run(threadId: string, prompt?: string): Promise<ReviseCommentAgentRunResult>;
232
- steer(threadId: string, message: string): boolean;
233
- cancel(threadId: string): void;
234
- getState(threadId: string): ReviseCommentAgentState | undefined;
235
- subscribe(
236
- listener: (states: ReadonlyMap<string, ReviseCommentAgentState>) => void,
237
- ): () => void;
238
- }
239
-
240
- export type InlineFormattingCommand =
241
- | "bold"
242
- | "italic"
243
- | "underline"
244
- | "strikethrough"
245
- | "doubleStrikethrough"
246
- | "smallCaps"
247
- | "allCaps"
248
- | "code"
249
- | "latex"
250
- | "superscript"
251
- | "subscript";
252
-
253
- /** File formats `tools.export()` can produce. */
254
- export type ReviseExportFormat = "docx" | "pdf" | "html" | "markdown" | "txt";
255
-
256
- export interface ReviseExportOptions {
257
- format?: ReviseExportFormat;
258
- mode?: "review" | "final";
259
- }
260
-
261
- export type ReviseToolbarMode = "native" | "none";
262
- export type ReviseZoom = number | "fit-width";
263
-
264
- export interface ReviseFontDefinition {
265
- family: string;
266
- label?: string;
267
- cssFamily?: string;
268
- fontWeight?: number | string;
269
- }
270
-
271
- export interface ReviseZoomState {
272
- zoom: ReviseZoom;
273
- scale: number;
274
- }
275
-
276
- export interface ReviseEditorZoomController {
277
- getState(): ReviseZoomState;
278
- setZoom(zoom: ReviseZoom): void;
279
- fitWidth(): void;
280
- subscribe(listener: (state: ReviseZoomState) => void): () => void;
281
- }
282
-
283
- export interface ReviseSelectionPosition {
284
- kind: "text";
285
- blockId: string;
286
- offset: number;
287
- }
288
-
289
- export interface ReviseTextTargetSegment {
290
- blockId: string;
291
- range: { start: number; end: number };
292
- }
293
-
294
- export interface ReviseTextTarget {
295
- kind: "text";
296
- segments: ReviseTextTargetSegment[];
297
- }
298
-
299
- export interface ReviseSelectionTarget {
300
- kind: "selection";
301
- start: ReviseSelectionPosition;
302
- end: ReviseSelectionPosition;
303
- }
304
-
305
- export interface ReviseSelectionSnapshot {
306
- documentId: string | null;
307
- anchor: ReviseSelectionPosition | null;
308
- focus: ReviseSelectionPosition | null;
309
- start: ReviseSelectionPosition | null;
310
- end: ReviseSelectionPosition | null;
311
- target: ReviseTextTarget | null;
312
- selectionTarget: ReviseSelectionTarget | null;
313
- activeMarks: string[];
314
- activeCommentIds: string[];
315
- activeChangeIds: string[];
316
- quotedText: string;
317
- text: string;
318
- collapsed: boolean;
319
- empty: boolean;
320
- }
321
-
322
- export type ReviseSelectionCapture = ReviseSelectionSnapshot & {
323
- documentId: string;
324
- target: ReviseTextTarget;
325
- selectionTarget: ReviseSelectionTarget;
326
- };
327
-
328
- export type ReviseSelectionRestoreResult =
329
- | { success: true }
330
- | {
331
- success: false;
332
- reason: "not-ready" | "read-only" | "missing-target" | "stale";
333
- };
334
-
335
- export interface ReviseEditorSelection {
336
- getSnapshot(): ReviseSelectionSnapshot;
337
- subscribe(listener: (event: { snapshot: ReviseSelectionSnapshot }) => void): () => void;
338
- observe(listener: (snapshot: ReviseSelectionSnapshot) => void): () => void;
339
- capture(): ReviseSelectionCapture | null;
340
- restore(capture: ReviseSelectionCapture): ReviseSelectionRestoreResult;
341
- clear(): void;
342
- }
343
-
344
- export interface ReviseToolbarState {
345
- ready: boolean;
346
- readOnly: boolean;
347
- documentMode: ReviseDocumentMode;
348
- activeTab: "edit" | "layout" | "insert" | "tools" | "review";
349
- hasSelection: boolean;
350
- canUndo: boolean;
351
- canRedo: boolean;
352
- formatting: Record<string, unknown> & {
353
- bold?: boolean;
354
- italic?: boolean;
355
- underline?: boolean;
356
- strikethrough?: boolean;
357
- color?: string;
358
- backgroundColor?: string;
359
- fontFamily?: string;
360
- };
361
- heading?: 1 | 2 | 3 | 4 | 5 | 6;
362
- alignment?: "left" | "center" | "right" | "justify";
363
- lineSpacing?: number;
364
- fontSizePt?: number;
365
- blockType: { type: string; variant?: string } | null;
366
- review: {
367
- open: boolean;
368
- targetCount: number;
369
- currentTargetSuggestionCount: number;
370
- allOpenSuggestionCount: number;
371
- showRemovals: boolean;
372
- viewMode: "all-markup" | "final" | "original";
373
- };
374
- }
375
-
376
- export interface ReviseDocumentStatistics {
377
- wordCount: number;
378
- characterCount: number;
379
- }
380
-
381
- /**
382
- * DOCX-mode fidelity: what relationship the next export has to the original
383
- * .docx file.
2
+ * `revise`: read, edit, review, render, and convert documents from Node.
384
3
  *
385
- * "exact" — byte-identical to the imported file
386
- * "grafted" — original bytes plus this document's edits; untouched
387
- * content exports byte-for-byte
388
- * "converted" — no usable original; export regenerates everything
389
- */
390
- export type ReviseSourceFidelity = "exact" | "grafted" | "converted";
391
-
392
- export interface ReviseSourceFidelityReport {
393
- fidelity: ReviseSourceFidelity;
394
- /** Body blocks an export would regenerate (empty for "exact"). */
395
- regeneratedBlockIds: string[];
396
- /** Part domains an export would regenerate (notes, chrome, comments…). */
397
- changedDomains: string[];
398
- /** Why "converted", when it is. */
399
- convertedReason?:
400
- | "no-capture"
401
- | "no-carrier"
402
- | "carrier-hash-mismatch"
403
- | "unpaired-capture";
404
- }
405
-
406
- export interface ReviseEditorToolbar {
407
- getState(): ReviseToolbarState;
408
- subscribe(listener: (state: ReviseToolbarState) => void): () => void;
409
- /** Switches the ribbon row. "tools" is Revise-app chrome and is ignored in
410
- * the SDK — use `getStatistics()` for word and character counts. */
411
- setActiveTab(tab: ReviseToolbarState["activeTab"]): void;
412
- openFind(): void;
413
- undo(): boolean;
414
- redo(): boolean;
415
- copy(): Promise<void>;
416
- copyAs(format: "plaintext" | "markdown" | "html"): Promise<void>;
417
- cut(): boolean;
418
- paste(): Promise<boolean>;
419
- pasteTextOnly(): Promise<boolean>;
420
- pasteFormattingOnly(): Promise<boolean>;
421
- toggleInline(command: InlineFormattingCommand): boolean;
422
- toggleBold(): boolean;
423
- toggleItalic(): boolean;
424
- toggleUnderline(): boolean;
425
- toggleStrikethrough(): boolean;
426
- toggleDoubleStrikethrough(): boolean;
427
- toggleSmallCaps(): boolean;
428
- toggleAllCaps(): boolean;
429
- toggleCode(): boolean;
430
- toggleLatex(): boolean;
431
- toggleSuperscript(): boolean;
432
- toggleSubscript(): boolean;
433
- clearFormatting(): boolean;
434
- setFontFamily(fontFamily?: string): boolean;
435
- setFontSize(fontSizePt?: number): boolean;
436
- setLetterSpacing(spacing?: number): boolean;
437
- setTextColor(color?: string): boolean;
438
- setHighlightColor(color?: string): boolean;
439
- setHeading(level?: 1 | 2 | 3 | 4 | 5 | 6): boolean;
440
- setAlignment(alignment?: "left" | "center" | "right" | "justify"): boolean;
441
- setLineSpacing(spacing?: number): boolean;
442
- toggleList(variant: "ordered" | "unordered" | "todo"): boolean;
443
- createLink(): boolean;
444
- increaseIndent(): boolean;
445
- decreaseIndent(): boolean;
446
- insertTable(rows: number, columns: number): boolean;
447
- insertImage(file: File): Promise<boolean>;
448
- insertContainer(): boolean;
449
- insertCodeBlock(language?: string): boolean;
450
- insertMathBlock(content?: string): boolean;
451
- insertDiagram(content?: string): boolean;
452
- insertFootnote(kind?: "footnote" | "endnote"): boolean;
453
- insertPageNumber(): boolean;
454
- insertPageBreak(): boolean;
455
- insertSectionBreak(): boolean;
456
- openReview(): void;
457
- closeReview(): void;
458
- reviewPrevious(): boolean;
459
- reviewNext(): boolean;
460
- acceptCurrent(): boolean;
461
- rejectCurrent(): boolean;
462
- acceptAll(): boolean;
463
- rejectAll(): boolean;
464
- setShowRemovals(show: boolean): void;
465
- setSuggestionViewMode(mode: "all-markup" | "final" | "original"): void;
466
- }
467
-
468
- export interface ReviseCommentMention {
469
- id: string;
470
- type: "user" | "agent";
471
- label: string;
472
- start: number;
473
- end: number;
474
- email?: string;
475
- }
476
-
477
- export interface ReviseCommentRecord {
478
- id: string;
479
- author: string;
480
- initials?: string;
481
- authorId?: string;
482
- authorImageUrl?: string;
483
- createdAt: string;
484
- bodyMd: string;
485
- mentions?: ReviseCommentMention[];
486
- parentId?: string;
487
- relatedSuggestionIds?: string[];
488
- resolved?: boolean;
489
- }
490
-
491
- export interface ReviseCommentAnchor {
492
- blockId: string;
493
- start: number;
494
- end: number;
495
- }
496
-
497
- export interface ReviseCommentThread {
498
- root: ReviseCommentRecord;
499
- replies: ReviseCommentRecord[];
500
- anchor: ReviseCommentAnchor | null;
501
- relatedSuggestionIds: string[];
502
- }
503
-
504
- export interface ReviseReviewState {
505
- open: boolean;
506
- commentsOpen: boolean;
507
- targetCount: number;
508
- currentTargetSuggestionCount: number;
509
- allOpenSuggestionCount: number;
510
- openSuggestionIds: string[];
511
- currentSuggestionIds: string[];
512
- visibleAgentSuggestionIds: string[];
513
- activeCommentId: string | null;
514
- showRemovals: boolean;
515
- viewMode: "all-markup" | "final" | "original";
516
- commentThreads: ReviseCommentThread[];
517
- }
518
-
519
- export interface ReviseEditorReview {
520
- getState(): ReviseReviewState;
521
- subscribe(listener: (state: ReviseReviewState) => void): () => void;
522
- open(): void;
523
- close(): void;
524
- previous(): boolean;
525
- next(): boolean;
526
- nextAgentSuggestion(): boolean;
527
- acceptCurrent(): boolean;
528
- rejectCurrent(): boolean;
529
- acceptAll(): boolean;
530
- rejectAll(): boolean;
531
- previewCurrent(mode: "accept" | "reject" | null): boolean;
532
- previewAll(mode: "accept" | "reject" | null): boolean;
533
- getOpenSuggestionIds(): string[];
534
- /** Every pending change with its kind, author, timestamp, location, and
535
- * text. A pull, not part of the subscribed state. */
536
- listChanges(): ReviseTrackedChange[];
537
- getChange(suggestionId: string): ReviseTrackedChange | null;
538
- navigateToSuggestion(suggestionId: string): boolean;
539
- navigateWithinSuggestions(suggestionIds: string[], direction: "previous" | "next"): boolean;
540
- previewSuggestions(suggestionIds: string[], mode: "accept" | "reject" | null): void;
541
- /** Per-ID outcome, same shape as the server surface: stale IDs land in
542
- * missing; a role that may not resolve reports all unresolved. */
543
- acceptSuggestions(suggestionIds: string[]): ReviseSuggestionDecision;
544
- rejectSuggestions(suggestionIds: string[]): ReviseSuggestionDecision;
545
- setShowRemovals(show: boolean): void;
546
- setSuggestionViewMode(mode: "all-markup" | "final" | "original"): void;
547
- openComments(): void;
548
- closeComments(): void;
549
- selectComment(commentId: string | null): boolean;
550
- addCommentAtSelection(bodyMd: string, mentions?: ReviseCommentMention[]): string | null;
551
- addCommentToRanges(ranges: ReviseCommentAnchor[], bodyMd: string, mentions?: ReviseCommentMention[]): string | null;
552
- addCommentToBlock(blockId: string, bodyMd: string, mentions?: ReviseCommentMention[]): string | null;
553
- addCommentForSuggestion(suggestionId: string, bodyMd: string, mentions?: ReviseCommentMention[]): string | null;
554
- replyToComment(commentId: string, bodyMd: string, mentions?: ReviseCommentMention[]): string | null;
555
- setCommentResolved(commentId: string, resolved: boolean): boolean;
556
- deleteComment(commentId: string): boolean;
557
- getRelatedSuggestionIds(commentId: string): string[];
558
- acceptCommentSuggestions(commentId: string): ReviseSuggestionDecision;
559
- rejectCommentSuggestions(commentId: string): ReviseSuggestionDecision;
560
- }
561
-
562
- /** Chrome the SDK no longer renders buttons for; the host drives it. */
563
- export interface ReviseViewState {
564
- ready: boolean;
565
- title: string;
566
- documentMode: ReviseDocumentMode;
567
- readOnly: boolean;
568
- commentsOpen: boolean;
569
- /** Comment threads in the document, open panel or not. */
570
- commentCount: number;
571
- reviewOpen: boolean;
572
- /** Suggestions and comment threads Review would step through. */
573
- reviewTargetCount: number;
574
- }
575
-
576
- export interface ReviseEditorView {
577
- getState(): ReviseViewState;
578
- subscribe(listener: (state: ReviseViewState) => void): () => void;
579
- setTitle(title: string): void;
580
- setDocumentMode(mode: ReviseDocumentMode): void;
581
- setCommentsOpen(open: boolean): void;
582
- setReviewOpen(open: boolean): void;
583
- }
584
-
585
- export interface ReviseDocumentHandle {
586
- readonly id: string;
587
- readonly title: string;
588
- tools: ReviseEditorTools;
589
- toolbar: ReviseEditorToolbar;
590
- review: ReviseEditorReview;
591
- /** Title and the comments/review/document-mode chrome the host now owns. */
592
- view: ReviseEditorView;
593
- zoom: ReviseEditorZoomController;
594
- selection: ReviseEditorSelection;
595
- agent: ReviseAgentSubagent;
596
- comments: ReviseCommentAgent;
597
- /** Presence and sync state for a shared document. */
598
- collaboration: ReviseCollaborationController;
599
- /** What this participant is permitted to do. */
600
- getRole(): ReviseDocumentRole;
601
- getDocument(): ReviseDocument;
602
- /** DOCX-mode fidelity of the next export relative to the original file.
603
- * Computed on demand from content signatures; cheap enough for UI
604
- * badges, not for per-keystroke calls. */
605
- getSourceFidelity(): ReviseSourceFidelityReport;
606
- /** Live word and character counts (text statistics, no layout pass). */
607
- getStatistics(): ReviseDocumentStatistics;
608
- getDocumentMode(): ReviseDocumentMode;
609
- setDocumentMode(mode: ReviseDocumentMode): void;
610
- getToolDefinitions(): ReviseEditorTool[];
611
- focus(): void;
612
- openReview(): void;
613
- closeReview(): void;
614
- openComments(): void;
615
- closeComments(): void;
616
- }
617
-
618
- export type ReviseDocumentMode = "editing" | "suggesting" | "viewing";
619
-
620
- export type ReviseDocumentSource = File | Blob | ArrayBuffer;
621
-
622
- /** Input formats the SDK parses. DOCX is the only one carrying comments,
623
- * tracked changes, sections, and headers. */
624
- export type ReviseDocumentFormat = "docx" | "markdown" | "txt" | "html";
625
-
626
- /**
627
- * Yjs types, left deliberately loose.
4
+ * const doc = await ReviseDocument.open("contract.docx", { author: "Legal bot" });
5
+ * await doc.replaceText("Provider", "Northstar"); // tracked changes
6
+ * await doc.reject({ section: "8" });
7
+ * const { bytes } = await doc.export({ format: "docx" });
8
+ * fs.writeFileSync("contract-out.docx", bytes);
628
9
  *
629
- * Naming them structurally made the package dependency-free but broke the
630
- * thing hosts actually write: a `connect` callback annotated with the real
631
- * `Y.Doc` is not assignable to a minimal stand-in, because callback
632
- * parameters are contravariant. Declaring them permissively keeps your own
633
- * code fully typed — annotate the callback with yjs's types, as you would
634
- * anyway — without this package importing yjs for every consumer, including
635
- * those who never collaborate.
10
+ * The `revise` CLI is built on exactly this API.
636
11
  */
637
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
638
- export type ReviseYDoc = any;
639
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
640
- export type ReviseAwareness = any;
641
-
642
- /** Any Yjs provider: Hocuspocus exposes `document`, y-websocket and y-webrtc
643
- * expose `doc`, and some wrappers expose `getYDoc()`. */
644
- export interface ReviseCollaborationProvider {
645
- document?: ReviseYDoc;
646
- doc?: ReviseYDoc;
647
- getYDoc?: () => ReviseYDoc;
648
- awareness?: ReviseAwareness | null;
649
- }
650
-
651
- /** Attach a transport to a document the SDK built. Return the provider so the
652
- * editor can recognize its transactions as remote. */
653
- export type ReviseCollaborationConnect = (
654
- ydoc: ReviseYDoc,
655
- awareness: ReviseAwareness,
656
- ) => ReviseCollaborationProvider | { destroy?: () => void } | void;
657
-
658
- export interface ReviseCollaborationConfig {
659
- /**
660
- * The recommended form: the editor builds the document and awareness with
661
- * the settings it requires, and this connects them.
662
- *
663
- * The editor reserves the top-level keys listed in RESERVED_DOCUMENT_KEYS
664
- * (content, comments, metadata, and others), so a document built elsewhere
665
- * may already use those names or hold another schema. Let the editor build
666
- * its own.
667
- */
668
- connect?: ReviseCollaborationConnect;
669
- /** A provider that already owns its document. The document is validated
670
- * before use. */
671
- provider?: ReviseCollaborationProvider;
672
- /** A document you own. Validated before use; prefer `connect`. */
673
- ydoc?: ReviseYDoc;
674
- /** Awareness, for remote carets and presence. Pass null to opt out. */
675
- awareness?: ReviseAwareness | null;
676
- /** The transaction origin your transport applies remote updates with.
677
- * Required when passing `ydoc` without a `provider`. */
678
- remoteOrigin?: unknown;
679
- /** Whether the transport has finished its initial sync. The document stays
680
- * closed until this is true. */
681
- synced?: boolean;
682
- /** "if-empty" (default) writes the source file into an empty room;
683
- * "never" always joins. */
684
- seed?: "if-empty" | "never";
685
- }
686
-
687
- export interface RevisePeer {
688
- clientId: number;
689
- isLocal: boolean;
690
- id?: string;
691
- name?: string;
692
- email?: string;
693
- image?: string;
694
- color: string;
695
- }
696
-
697
- export interface ReviseCollaborationState {
698
- enabled: boolean;
699
- synced: boolean;
700
- peers: RevisePeer[];
701
- }
702
-
703
- export interface ReviseCollaborationController {
704
- getState(): ReviseCollaborationState;
705
- subscribe(listener: (state: ReviseCollaborationState) => void): () => void;
706
- }
707
-
708
- /** What a participant may do. A boundary, not a starting point: unlike
709
- * `documentMode` it cannot be escaped from inside the editor. */
710
- export type ReviseDocumentRole = "editor" | "suggester" | "viewer";
711
-
712
- export interface ReviseRolePolicy {
713
- readonly modes: readonly ReviseDocumentMode[];
714
- readonly canEdit: boolean;
715
- readonly canEditDirectly: boolean;
716
- readonly canResolveSuggestions: boolean;
717
- readonly canComment: boolean;
718
- }
719
-
720
- export declare function rolePolicy(role: ReviseDocumentRole): ReviseRolePolicy;
721
-
722
- /** Thrown by `agent.run()` and UI controllers when a role forbids an
723
- * action. Tool calls report role denials as structured
724
- * `{ ok: false, error: { code: "role_not_permitted" } }` results instead. */
725
- export declare class ReviseRoleError extends Error {
726
- readonly role: ReviseDocumentRole;
727
- readonly action: string;
728
- }
729
-
730
- /** A pending tracked change, with the metadata a review panel needs. */
731
- export interface ReviseTrackedChange {
732
- id: string;
733
- /** Word's three revision kinds, plus "move" for a linked move pair. A
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. */
739
- kind: "insert" | "delete" | "format" | "move";
740
- /** A person, "Revise Agent", an external agent, or "Anonymous". */
741
- author: string;
742
- authorType: "human" | "ai";
743
- agentModel?: string;
744
- /** Epoch milliseconds. */
745
- createdAt?: number;
746
- description?: string;
747
- /** Blocks this change touches, in document order. */
748
- blockIds: string[];
749
- /** For kind "move": blocks the text moved out of, in document order. */
750
- moveSourceBlockIds?: string[];
751
- /** For kind "move": blocks the text moved into, in document order. */
752
- moveDestinationBlockIds?: string[];
753
- insertedText?: string;
754
- deletedText?: string;
755
- commentThreadId?: string;
756
- }
757
-
758
- export interface ReviseDocumentInput {
759
- /** Stable host-owned ID used by APIs, agent tools, and callbacks. */
760
- id: string;
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. */
766
- docx?: ReviseDocumentSource;
767
- /** Share this document over a Yjs transport you own. */
768
- collaboration?: ReviseCollaborationConfig;
769
- /** Overrides the editor-wide role for this document. */
770
- role?: ReviseDocumentRole;
771
- /** Declare the format explicitly. Inferred from filename, then MIME type,
772
- * defaulting to DOCX. */
773
- format?: ReviseDocumentFormat;
774
- title?: string;
775
- documentMode?: ReviseDocumentMode;
776
- readOnly?: boolean;
777
- zoom?: ReviseZoom;
778
- defaultCommentsOpen?: boolean;
779
- /** Per-document agent settings override the editor-wide defaults. */
780
- agent?: ReviseAgentConfig;
781
- }
782
-
783
- export interface ReviseOpenDocument {
784
- id: string;
785
- title: string;
786
- status: "opening" | "ready" | "error";
787
- active: boolean;
788
- error?: string;
789
- }
790
-
791
- export interface ReviseDocumentCollectionState {
792
- activeDocumentId: string | null;
793
- documents: ReviseOpenDocument[];
794
- }
795
-
796
- export interface ReviseOpenDocumentOptions {
797
- /** Newly opened documents become active by default. */
798
- activate?: boolean;
799
- }
800
-
801
- export interface ReviseEditorDocuments {
802
- open(
803
- document: ReviseDocumentInput,
804
- options?: ReviseOpenDocumentOptions,
805
- ): Promise<ReviseDocumentHandle>;
806
- close(documentId: string): boolean;
807
- activate(documentId: string): boolean;
808
- get(documentId?: string): ReviseDocumentHandle | null;
809
- require(documentId?: string): ReviseDocumentHandle;
810
- getActiveId(): string | null;
811
- list(): ReviseOpenDocument[];
812
- getState(): ReviseDocumentCollectionState;
813
- subscribe(
814
- listener: (state: ReviseDocumentCollectionState) => void,
815
- ): () => void;
816
- }
817
-
818
- export type ReviseDocumentScoped<T> = T & {
819
- /** Bind this controller to one open document instead of the active one. */
820
- forDocument(documentId: string): T;
821
- };
822
-
823
- export interface ReviseMultiDocumentTools extends ReviseEditorTools {
824
- forDocument(documentId: string): ReviseEditorTools;
825
- exportDocx(documentId?: string): Promise<Blob>;
826
- export(options?: ReviseExportOptions, documentId?: string): Promise<Blob>;
827
- acceptAllSuggestions(documentId?: string): ReviseSuggestionDecision;
828
- rejectAllSuggestions(documentId?: string): ReviseSuggestionDecision;
829
- }
830
-
831
- export interface ReviseEditorHandle {
832
- documents: ReviseEditorDocuments;
833
- /** Resolve an explicit document, or the active document when omitted. */
834
- document(documentId?: string): ReviseDocumentHandle;
835
- tools: ReviseMultiDocumentTools;
836
- toolbar: ReviseDocumentScoped<ReviseEditorToolbar>;
837
- review: ReviseDocumentScoped<ReviseEditorReview>;
838
- /** Title and the comments/review/document-mode chrome the host now owns. */
839
- view: ReviseDocumentScoped<ReviseEditorView>;
840
- zoom: ReviseDocumentScoped<ReviseEditorZoomController>;
841
- selection: ReviseDocumentScoped<ReviseEditorSelection>;
842
- agent: ReviseDocumentScoped<ReviseAgentSubagent>;
843
- comments: ReviseDocumentScoped<ReviseCommentAgent>;
844
- /** Presence and sync state for shared documents. */
845
- collaboration: ReviseDocumentScoped<ReviseCollaborationController>;
846
- /** What this participant may do with a document. */
847
- getRole(documentId?: string): ReviseDocumentRole;
848
- /**
849
- * Resolves once a document is open and its controllers are usable.
850
- *
851
- * `onReady` hands you the editor before any document exists; everything
852
- * that acts on a document throws until one does. Subscriptions are the
853
- * exception and can be placed immediately.
854
- */
855
- whenReady(documentId?: string): Promise<ReviseDocumentHandle>;
856
- getDocument(documentId?: string): ReviseDocument;
857
- /** Live word and character counts for a document (active by default). */
858
- getStatistics(documentId?: string): ReviseDocumentStatistics;
859
- getDocumentMode(documentId?: string): ReviseDocumentMode;
860
- setDocumentMode(mode: ReviseDocumentMode, documentId?: string): void;
861
- getToolDefinitions(documentId?: string): ReviseEditorTool[];
862
- focus(documentId?: string): void;
863
- openReview(documentId?: string): void;
864
- closeReview(documentId?: string): void;
865
- openComments(documentId?: string): void;
866
- closeComments(documentId?: string): void;
867
- }
868
-
869
- /** Behavior settings for tracked changes. */
870
- export interface ReviseTrackedChangesSettings {
871
- /** Start review with deleted text shown inline (strikethrough). Reviewers
872
- * used to Word usually want this on. Default false. */
873
- showRemovalsInReview?: boolean;
874
- /** "revise" (default): per-kind colors with a soft background tint.
875
- * "word": classic redlines — all revisions in red, insertions underlined,
876
- * deletions struck through, no background tint. */
877
- markupStyle?: "revise" | "word";
878
- }
879
-
880
- export interface ReviseEditorSettings {
881
- trackedChanges?: ReviseTrackedChangesSettings;
882
- }
883
-
884
- export interface ReviseEditorProps {
885
- findShortcut?: "editor" | "browser";
886
- /** Behavior settings. */
887
- settings?: ReviseEditorSettings;
888
- /** Receive the editor's internal instrumentation events (tool
889
- * invocations, exports, review interactions, …) for the host's own
890
- * analytics. These events never leave the page except through this
891
- * callback. Event names and property shapes may change between versions. */
892
- onAnalyticsEvent?: (
893
- event: string,
894
- properties?: Record<string, unknown>,
895
- ) => void;
896
- /** Once per page load, the SDK sends Revise one anonymous ping carrying
897
- * its version; the browser adds your site's origin. Development hosts
898
- * (localhost and similar) are only counted, never named. No cookies, user
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. */
901
- telemetry?: boolean;
902
- initialDocuments?: readonly ReviseDocumentInput[];
903
- /** Controlled active document ID. */
904
- activeDocumentId?: string | null;
905
- /** Initial active ID for uncontrolled use. Defaults to the first document. */
906
- defaultActiveDocumentId?: string | null;
907
- currentUser?: EditorUserIdentity | null;
908
- agent?: ReviseAgentConfig;
909
- theme?: "light" | "dark";
910
- /** What this participant may do, across every open document. Overridden per
911
- * document by `ReviseDocumentInput.role`. */
912
- role?: ReviseDocumentRole;
913
- defaultDocumentMode?: ReviseDocumentMode;
914
- defaultZoom?: ReviseZoom;
915
- defaultCommentsOpen?: boolean;
916
- showDocumentModeToggle?: boolean;
917
- /**
918
- * Render the built-in tab strip (one tab per open document). Off by default:
919
- * hosts with their own file switcher drive `documents` instead.
920
- */
921
- showTabs?: boolean;
922
- /**
923
- * Render the built-in title bar above the ribbon. Hosts that build their own
924
- * chrome turn this off and drive `view` (title, mode, review) themselves.
925
- */
926
- showTitleBar?: boolean;
927
- /** Adds a "+" button to the tab strip. Without it, no button is rendered. */
928
- onNewTab?: () => void;
929
- /**
930
- * Take keyboard focus when a document becomes active. Defaults to true; set
931
- * false when the editor sits inside a larger page and should wait for a click.
932
- */
933
- autoFocus?: boolean;
934
- /** Opt in to the Rust/WASM hot paths (word diff, agent text matching,
935
- * document stats). Off by default; the TypeScript implementations remain the
936
- * fallback, so this only ever changes speed, never behavior. Available only
937
- * from the explicit `revise/editor/full` entry point. */
938
- wasmHotPaths?: boolean;
939
- /** The area behind the page — not the page itself. Any CSS background. */
940
- canvasBackground?: string;
941
- /** The paper color. Any CSS color. */
942
- pageBackground?: string;
943
- /** The 1px outline around each page. Any CSS color. */
944
- pageBorderColor?: string;
945
- toolbarMode?: ReviseToolbarMode;
946
- fonts?: readonly ReviseFontDefinition[];
947
- /**
948
- * Store an image the user inserts, pastes, or drops, and resolve to the URL
949
- * the document should reference. Without it, images are embedded in the
950
- * document as data URLs, which export into the .docx like any other image.
951
- * A rejection shows the user a notice and reaches onError.
952
- */
953
- onImageUpload?: (file: File, documentId: string) => Promise<string>;
954
- className?: string;
955
- style?: React.CSSProperties;
956
- onReady?: (editor: ReviseEditorHandle) => void;
957
- onDocumentReady?: (document: ReviseDocumentHandle) => void;
958
- onDocumentsChange?: (state: ReviseDocumentCollectionState) => void;
959
- onActiveDocumentChange?: (documentId: string | null) => void;
960
- onChange?: (documentId: string, document: ReviseDocument) => void;
961
- onDocumentTitleChange?: (documentId: string, title: string) => void;
962
- onDocumentModeChange?: (documentId: string, mode: ReviseDocumentMode) => void;
963
- onZoomChange?: (documentId: string, zoom: ReviseZoom) => void;
964
- onAgentEvent?: (documentId: string, event: ReviseAgentEvent) => void;
965
- onError?: (error: Error, documentId?: string) => void;
966
- }
967
-
968
- export const ReviseEditor: React.ForwardRefExoticComponent<
969
- ReviseEditorProps & React.RefAttributes<ReviseEditorHandle>
970
- >;
971
- export default ReviseEditor;
12
+ export { ReviseDocument, compare, convert, formatForPath, seedYDoc, type ChangeEntry, type ChangeSelection, type CompareResult, type DocumentMode, type DocumentSource, type DocumentSummary, type ExportFormat, type ExportOptions, type ExportResult, type GrepHit, type OpenOptions, type ReplaceTextResult, type SettleResult, type TextDiff, } from "./document.js";
13
+ export { agentTools, formatToolResult, type AgentProvider, type AgentTools, type AgentToolsOptions, type AnthropicToolUse, type OpenAIResponsesFunctionCall, type OpenAIToolCall, } from "./agent.js";
14
+ export { catPart, listParts, patchPackage, type PatchRequest, type PatchResult, } from "./package.js";
15
+ export type { ImageFetchPolicy, ReviseJsonObject, ReviseToolName, ReviseToolResult, ServerDocumentSession, } from "@reviseio/engine";
16
+ export type { RenderOptions, RenderResult, RenderView } from "./render.js";
17
+ export { ReviseError } from "./errors.js";