Skip to main content

Modes

A document in suggesting mode records every change as a tracked suggestion instead of applying it. This covers typing, toolbar commands, and agent tool calls. An agent can draft in this mode, and the user reviews each change.
Set the starting mode per document, or editor-wide:
defaultDocumentMode sets the starting mode only. Changing the prop later does not affect a document that is already open. Use view.setDocumentMode() for that.
The user can switch modes. To lock a participant into suggesting, use a role instead. role="suggester" pins the mode, refuses direct edits, and hides accept and reject everywhere.

Reviewing

The review controller is the host API for tracked changes. It is not an agent tool: it exposes interactive state and moves the caret and viewport.
Subscribe to render your own review UI:

Targeted operations

To act on specific suggestions, such as everything one agent run produced, pass their IDs:
previewCurrent() and previewAll() do the same for the current stop and the whole document. Pass null to clear a preview.

Display

"final" shows the document with every suggestion accepted. "original" shows it with none accepted. Neither changes the document, so either works as a read-only “clean copy” toggle.

Direct mode

To apply an agent edit without tracking it, such as a formatting sweep or a find-and-replace the user asked for, pass directMode per call:
In a delegated agent run, every tool call in the loop inherits the mode. One flag covers the whole task.
Direct mode skips tracked changes. Use it only for changes the user already approved in your UI.

Attribution

Each suggestion records its author, and agent suggestions are marked as such. review.getState().visibleAgentSuggestionIds lists only the agent’s suggestions, and nextAgentSuggestion() steps through only those. Use them to review the agent’s changes without the user’s own edits. Changes made through tools.execute() and agent runs are agent changes, signed “Revise Agent”. To sign them as your product’s assistant, name it:
People’s own edits use currentUser.

Export

exportDocx() writes tracked changes as Word revision marks. A reviewer who opens the file in Word sees the same suggestions, and accepting them there gives the same result as accepting them in Revise.
Suggestions use the identity you pass as currentUser. Without it, human suggestions export with the reviewer name “Anonymous” and agent suggestions as “Revise Agent”. The name is recorded at edit time, not at export, so pass currentUser before anyone edits.

Word round trip

DOCX import and export preserve revision marks. From a Word file, through the editor, and back: Tracked row insertions and deletions (w:trPr → w:ins / w:del), cell revisions (w:cellIns, w:cellDel, w:cellMerge), and table property changes (w:tblPrChange) import as resolvable suggestions. They export as the same markup, with authors intact. Linked moves (w:moveFrom / w:moveTo pairs) import as one move suggestion. Accepting either half keeps the text at its destination. Rejecting either half restores the original location. Export writes the paired move markup back. An orphaned or mismatched half imports as an ordinary insertion or deletion, so unrelated content is never resolved together.

Custom review panel

listChanges() returns every pending change with the metadata a panel needs. Use it to render the list yourself instead of using the built-in ribbon:
A replacement made in one operation, such as the agent’s replace tool, is one change with both deletedText and insertedText set. Its kind is the one it was recorded with, usually "delete", so check for both texts to show it as a replacement. One accept or reject settles both halves. A move is also one change for both halves, and one accept or reject settles both locations. Wire a row to the controller with the ID:
listChanges() is not a subscription. It computes the list from the document on each call, in one pass. Call it when you render, for example after review.subscribe() reports that the counts changed.