> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# mutations.apply

> Execute a mutation plan atomically against the document.

## Summary

Execute a mutation plan atomically against the document.

* Operation ID: `mutations.apply`
* API member path: `editor.doc.mutations.apply(...)`
* Mutates document: `yes`
* Idempotency: `non-idempotent`
* Supports tracked mode: `yes`
* Supports dry run: `no`
* Deterministic target resolution: `yes`

## Expected result

Returns a PlanReceipt with per-step results for the atomically applied mutation plan.

## Supported step operations

Use these values in `steps[].op` when authoring mutation plans.

### Assert

| Step op (`steps[].op`) | Description | Related API operation |
| - | - | - |
| `assert` | Assert selector cardinality after mutation steps complete. | - |

### Text

| Step op (`steps[].op`) | Description | Related API operation |
| - | - | - |
| `text.rewrite` | Rewrite matched text ranges with replacement content. | [`replace`](https://docs.superdoc.dev/document-api/reference/replace) |
| `text.insert` | Insert text before or after a matched range. | [`insert`](https://docs.superdoc.dev/document-api/reference/insert) |
| `text.delete` | Delete matched text ranges. | [`delete`](https://docs.superdoc.dev/document-api/reference/delete) |

### Format

| Step op (`steps[].op`) | Description | Related API operation |
| - | - | - |
| `format.apply` | Apply inline formatting patch changes to matched text ranges. | [`format.apply`](https://docs.superdoc.dev/document-api/reference/format/apply) |

### Create

| Step op (`steps[].op`) | Description | Related API operation |
| - | - | - |
| `create.paragraph` | Create a paragraph adjacent to the matched block. | [`create.paragraph`](https://docs.superdoc.dev/document-api/reference/create/paragraph) |
| `create.heading` | Create a heading adjacent to the matched block. | [`create.heading`](https://docs.superdoc.dev/document-api/reference/create/heading) |
| `create.table` | Create a table at the requested location. | [`create.table`](https://docs.superdoc.dev/document-api/reference/create/table) |

### Tables

| Step op (`steps[].op`) | Description | Related API operation |
| - | - | - |
| `tables.delete` | Delete the target table from the document. | [`tables.delete`](https://docs.superdoc.dev/document-api/reference/tables/delete) |
| `tables.clearContents` | Clear contents from a target table or cell range. | [`tables.clearContents`](https://docs.superdoc.dev/document-api/reference/tables/clear-contents) |
| `tables.move` | Move a table to a new position. | [`tables.move`](https://docs.superdoc.dev/document-api/reference/tables/move) |
| `tables.split` | Split a table into two tables at a target row. | [`tables.split`](https://docs.superdoc.dev/document-api/reference/tables/split) |
| `tables.convertFromText` | Convert a text range into a table. | [`tables.convertFromText`](https://docs.superdoc.dev/document-api/reference/tables/convert-from-text) |
| `tables.convertToText` | Convert a table to plain text. | [`tables.convertToText`](https://docs.superdoc.dev/document-api/reference/tables/convert-to-text) |
| `tables.setLayout` | Set table layout mode. | [`tables.setLayout`](https://docs.superdoc.dev/document-api/reference/tables/set-layout) |
| `tables.insertRow` | Insert a row into the target table. | [`tables.insertRow`](https://docs.superdoc.dev/document-api/reference/tables/insert-row) |
| `tables.deleteRow` | Delete a row from the target table. | [`tables.deleteRow`](https://docs.superdoc.dev/document-api/reference/tables/delete-row) |
| `tables.setRowHeight` | Set row height in the target table. | [`tables.setRowHeight`](https://docs.superdoc.dev/document-api/reference/tables/set-row-height) |
| `tables.distributeRows` | Distribute row heights evenly. | [`tables.distributeRows`](https://docs.superdoc.dev/document-api/reference/tables/distribute-rows) |
| `tables.setRowOptions` | Set row-level options (header repeat, page break, etc.). | [`tables.setRowOptions`](https://docs.superdoc.dev/document-api/reference/tables/set-row-options) |
| `tables.insertColumn` | Insert a column into the target table. | [`tables.insertColumn`](https://docs.superdoc.dev/document-api/reference/tables/insert-column) |
| `tables.deleteColumn` | Delete a column from the target table. | [`tables.deleteColumn`](https://docs.superdoc.dev/document-api/reference/tables/delete-column) |
| `tables.setColumnWidth` | Set column width in the target table. | [`tables.setColumnWidth`](https://docs.superdoc.dev/document-api/reference/tables/set-column-width) |
| `tables.distributeColumns` | Distribute column widths evenly. | [`tables.distributeColumns`](https://docs.superdoc.dev/document-api/reference/tables/distribute-columns) |
| `tables.insertCell` | Insert a cell into a table row. | [`tables.insertCell`](https://docs.superdoc.dev/document-api/reference/tables/insert-cell) |
| `tables.deleteCell` | Delete a cell from a table row. | [`tables.deleteCell`](https://docs.superdoc.dev/document-api/reference/tables/delete-cell) |
| `tables.mergeCells` | Merge a range of table cells. | [`tables.mergeCells`](https://docs.superdoc.dev/document-api/reference/tables/merge-cells) |
| `tables.unmergeCells` | Unmerge a merged table cell. | [`tables.unmergeCells`](https://docs.superdoc.dev/document-api/reference/tables/unmerge-cells) |
| `tables.splitCell` | Split a table cell into multiple cells. | [`tables.splitCell`](https://docs.superdoc.dev/document-api/reference/tables/split-cell) |
| `tables.setCellProperties` | Set properties on target table cells. | [`tables.setCellProperties`](https://docs.superdoc.dev/document-api/reference/tables/set-cell-properties) |
| `tables.sort` | Sort table rows by a column value. | [`tables.sort`](https://docs.superdoc.dev/document-api/reference/tables/sort) |
| `tables.setAltText` | Set table alt text properties. | [`tables.setAltText`](https://docs.superdoc.dev/document-api/reference/tables/set-alt-text) |
| `tables.setStyle` | Set table style identifier. | [`tables.setStyle`](https://docs.superdoc.dev/document-api/reference/tables/set-style) |
| `tables.clearStyle` | Clear direct table style assignment. | [`tables.clearStyle`](https://docs.superdoc.dev/document-api/reference/tables/clear-style) |
| `tables.setStyleOption` | Set table style option flags. | [`tables.setStyleOption`](https://docs.superdoc.dev/document-api/reference/tables/set-style-option) |
| `tables.setBorder` | Set table border properties. | [`tables.setBorder`](https://docs.superdoc.dev/document-api/reference/tables/set-border) |
| `tables.clearBorder` | Clear table border properties. | [`tables.clearBorder`](https://docs.superdoc.dev/document-api/reference/tables/clear-border) |
| `tables.applyBorderPreset` | Apply a border preset to a table. | [`tables.applyBorderPreset`](https://docs.superdoc.dev/document-api/reference/tables/apply-border-preset) |
| `tables.setShading` | Set table shading properties. | [`tables.setShading`](https://docs.superdoc.dev/document-api/reference/tables/set-shading) |
| `tables.clearShading` | Clear table shading properties. | [`tables.clearShading`](https://docs.superdoc.dev/document-api/reference/tables/clear-shading) |
| `tables.setTablePadding` | Set table-level cell padding. | [`tables.setTablePadding`](https://docs.superdoc.dev/document-api/reference/tables/set-table-padding) |
| `tables.setCellPadding` | Set cell padding for target cells. | [`tables.setCellPadding`](https://docs.superdoc.dev/document-api/reference/tables/set-cell-padding) |
| `tables.setCellSpacing` | Set table cell spacing. | [`tables.setCellSpacing`](https://docs.superdoc.dev/document-api/reference/tables/set-cell-spacing) |
| `tables.clearCellSpacing` | Clear table cell spacing. | [`tables.clearCellSpacing`](https://docs.superdoc.dev/document-api/reference/tables/clear-cell-spacing) |

The runtime capability snapshot also exposes this allowlist at `planEngine.supportedStepOps`.

## Input fields

| Field | Type | Required | Description |
| - | - | - | - |
| `atomic` | `true` | yes | Constant: `true` |
| `changeMode` | enum | yes | `"direct"`, `"tracked"` |
| `expectedRevision` | string | no | |
| `in` | StoryLocator | no | StoryLocator |
| `steps` | object(op="text.rewrite") \| object(op="text.insert") \| object(op="text.delete") \| object(op="format.apply") \| object(op="assert")\[] | yes | |

### Example request

```json theme={null}
{
  "atomic": true,
  "changeMode": "direct",
  "expectedRevision": "rev-001",
  "in": {
    "kind": "story",
    "storyType": "body"
  },
  "steps": [
    {
      "args": {
        "replacement": {
          "text": "Hello, world."
        },
        "style": {
          "inline": {
            "mode": "preserve",
            "onNonUniform": "error",
            "requireUniform": true
          },
          "paragraph": {
            "mode": "preserve"
          }
        }
      },
      "id": "id-001",
      "op": "text.rewrite",
      "where": {
        "by": "select",
        "require": "first",
        "select": {
          "caseSensitive": true,
          "mode": "contains",
          "pattern": "hello world",
          "type": "text"
        },
        "within": {
          "kind": "block",
          "nodeId": "node-def456",
          "nodeType": "paragraph",
          "story": {
            "kind": "story",
            "storyType": "body"
          }
        }
      }
    }
  ]
}
```

## Output fields

| Field | Type | Required | Description |
| - | - | - | - |
| `revision` | object | yes | |
| `revision.after` | string | yes | |
| `revision.before` | string | yes | |
| `steps` | object\[] | yes | |
| `success` | `true` | yes | Constant: `true` |
| `timing` | object | yes | |
| `timing.totalMs` | number | yes | |
| `trackedChanges` | object\[] | no | |

### Example response

```json theme={null}
{
  "revision": {
    "after": "example",
    "before": "example"
  },
  "steps": [
    {}
  ],
  "success": true,
  "timing": {
    "totalMs": 12.5
  },
  "trackedChanges": [
    {}
  ]
}
```

## Pre-apply throws

* `REVISION_MISMATCH`
* `MATCH_NOT_FOUND`
* `AMBIGUOUS_MATCH`
* `STYLE_CONFLICT`
* `PRECONDITION_FAILED`
* `INVALID_INPUT`
* `CROSS_BLOCK_MATCH`
* `SPAN_FRAGMENTED`
* `TARGET_MOVED`
* `PLAN_CONFLICT_OVERLAP`
* `INVALID_STEP_COMBINATION`
* `REVISION_CHANGED_SINCE_COMPILE`
* `INVALID_INSERTION_CONTEXT`
* `DOCUMENT_IDENTITY_CONFLICT`
* `CAPABILITY_UNAVAILABLE`
* `DUPLICATE_ID`
* `RAW_MODE_REQUIRED`
* `PRESERVE_ONLY_VIOLATION`
* `CAPABILITY_UNSUPPORTED`
* `STORY_NOT_FOUND`
* `STORY_MISMATCH`
* `STORY_NOT_SUPPORTED`
* `CROSS_STORY_PLAN`
* `MATERIALIZATION_FAILED`

## Non-applied failure codes

* `INVALID_CONTEXT`

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "atomic": {
>       "const": true,
>       "description": "Must be true. All steps execute as one atomic transaction.",
>       "type": "boolean"
>     },
>     "changeMode": {
>       "description": "Required. Use 'direct' for immediate edits or 'tracked' for suggestions. Must always be provided.",
>       "enum": [
>         "direct",
>         "tracked"
>       ]
>     },
>     "expectedRevision": {
>       "description": "Document revision for optimistic concurrency. Mutation fails if document was modified since this revision.",
>       "type": "string"
>     },
>     "in": {
>       "$ref": "#/$defs/StoryLocator"
>     },
>     "steps": {
>       "description": "Ordered array of mutation steps. Each step needs 'op' (text.rewrite, text.insert, text.delete, format.apply, or assert) and a 'where' targeting clause.",
>       "items": {
>         "oneOf": [
>           {
>             "additionalProperties": false,
>             "properties": {
>               "args": {
>                 "additionalProperties": false,
>                 "properties": {
>                   "replacement": {
>                     "oneOf": [
>                       {
>                         "additionalProperties": false,
>                         "properties": {
>                           "text": {
>                             "type": "string"
>                           }
>                         },
>                         "required": [
>                           "text"
>                         ],
>                         "type": "object"
>                       },
>                       {
>                         "additionalProperties": false,
>                         "properties": {
>                           "blocks": {
>                             "items": {
>                               "additionalProperties": false,
>                               "properties": {
>                                 "text": {
>                                   "type": "string"
>                                 }
>                               },
>                               "required": [
>                                 "text"
>                               ],
>                               "type": "object"
>                             },
>                             "type": "array"
>                           }
>                         },
>                         "required": [
>                           "blocks"
>                         ],
>                         "type": "object"
>                       }
>                     ]
>                   },
>                   "style": {
>                     "additionalProperties": false,
>                     "properties": {
>                       "inline": {
>                         "additionalProperties": false,
>                         "properties": {
>                           "mode": {
>                             "enum": [
>                               "preserve",
>                               "set",
>                               "clear",
>                               "merge"
>                             ],
>                             "type": "string"
>                           },
>                           "onNonUniform": {
>                             "enum": [
>                               "error",
>                               "useLeadingRun",
>                               "majority",
>                               "union"
>                             ]
>                           },
>                           "requireUniform": {
>                             "type": "boolean"
>                           },
>                           "setMarks": {
>                             "additionalProperties": false,
>                             "properties": {
>                               "bold": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               },
>                               "italic": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               },
>                               "strike": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               },
>                               "underline": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           }
>                         },
>                         "required": [
>                           "mode"
>                         ],
>                         "type": "object"
>                       },
>                       "paragraph": {
>                         "additionalProperties": false,
>                         "properties": {
>                           "mode": {
>                             "enum": [
>                               "preserve",
>                               "set",
>                               "clear"
>                             ],
>                             "type": "string"
>                           }
>                         },
>                         "required": [
>                           "mode"
>                         ],
>                         "type": "object"
>                       }
>                     },
>                     "required": [
>                       "inline"
>                     ],
>                     "type": "object"
>                   }
>                 },
>                 "required": [
>                   "replacement"
>                 ],
>                 "type": "object"
>               },
>               "id": {
>                 "type": "string"
>               },
>               "op": {
>                 "const": "text.rewrite",
>                 "type": "string"
>               },
>               "where": {
>                 "oneOf": [
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "select",
>                         "type": "string"
>                       },
>                       "require": {
>                         "enum": [
>                           "first",
>                           "exactlyOne",
>                           "all"
>                         ]
>                       },
>                       "select": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "caseSensitive": {
>                                 "description": "Case-sensitive matching. Default: false.",
>                                 "type": "boolean"
>                               },
>                               "mode": {
>                                 "description": "Match mode: 'contains' (literal substring, recommended for literal text) or 'regex' (validated regular expression).",
>                                 "enum": [
>                                   "contains",
>                                   "regex"
>                                 ]
>                               },
>                               "pattern": {
>                                 "description": "Text to match. In regex mode, patterns are validated for syntax, maximum length, and safety before execution.",
>                                 "type": "string"
>                               },
>                               "type": {
>                                 "const": "text",
>                                 "description": "Must be 'text' for text pattern search."
>                               },
>                               "wholeWord": {
>                                 "description": "Require word-boundary matches. Default: false.",
>                                 "type": "boolean"
>                               }
>                             },
>                             "required": [
>                               "type",
>                               "pattern"
>                             ],
>                             "type": "object"
>                           },
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "kind": {
>                                 "description": "Filter: 'block' or 'inline'.",
>                                 "enum": [
>                                   "block",
>                                   "inline"
>                                 ]
>                               },
>                               "nodeType": {
>                                 "description": "Block type to match (paragraph, heading, table, listItem, etc.).",
>                                 "enum": [
>                                   "paragraph",
>                                   "heading",
>                                   "listItem",
>                                   "table",
>                                   "tableRow",
>                                   "tableCell",
>                                   "tableOfContents",
>                                   "image",
>                                   "sdt",
>                                   "run",
>                                   "bookmark",
>                                   "comment",
>                                   "hyperlink",
>                                   "footnoteRef",
>                                   "endnoteRef",
>                                   "crossRef",
>                                   "indexEntry",
>                                   "citation",
>                                   "authorityEntry",
>                                   "sequenceField",
>                                   "tab",
>                                   "lineBreak"
>                                 ]
>                               },
>                               "type": {
>                                 "const": "node",
>                                 "description": "Must be 'node' for node type search."
>                               }
>                             },
>                             "required": [
>                               "type"
>                             ],
>                             "type": "object"
>                           }
>                         ]
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "select",
>                       "require"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "ref",
>                         "type": "string"
>                       },
>                       "ref": {
>                         "type": "string"
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "ref"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "target",
>                         "type": "string"
>                       },
>                       "target": {
>                         "$ref": "#/$defs/SelectionTarget"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "target"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "block",
>                         "type": "string"
>                       },
>                       "nodeId": {
>                         "type": "string"
>                       },
>                       "nodeType": {
>                         "enum": [
>                           "paragraph",
>                           "heading",
>                           "listItem",
>                           "table",
>                           "tableRow",
>                           "tableCell",
>                           "tableOfContents",
>                           "image",
>                           "sdt"
>                         ]
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "nodeType",
>                       "nodeId"
>                     ],
>                     "type": "object"
>                   }
>                 ]
>               }
>             },
>             "required": [
>               "id",
>               "op",
>               "where",
>               "args"
>             ],
>             "type": "object"
>           },
>           {
>             "additionalProperties": false,
>             "properties": {
>               "args": {
>                 "additionalProperties": false,
>                 "properties": {
>                   "content": {
>                     "additionalProperties": false,
>                     "properties": {
>                       "text": {
>                         "type": "string"
>                       }
>                     },
>                     "required": [
>                       "text"
>                     ],
>                     "type": "object"
>                   },
>                   "position": {
>                     "enum": [
>                       "before",
>                       "after"
>                     ]
>                   },
>                   "style": {
>                     "additionalProperties": false,
>                     "properties": {
>                       "inline": {
>                         "additionalProperties": false,
>                         "properties": {
>                           "mode": {
>                             "enum": [
>                               "inherit",
>                               "set",
>                               "clear"
>                             ],
>                             "type": "string"
>                           },
>                           "setMarks": {
>                             "additionalProperties": false,
>                             "properties": {
>                               "bold": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               },
>                               "italic": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               },
>                               "strike": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               },
>                               "underline": {
>                                 "enum": [
>                                   "on",
>                                   "off",
>                                   "clear"
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           }
>                         },
>                         "required": [
>                           "mode"
>                         ],
>                         "type": "object"
>                       }
>                     },
>                     "required": [
>                       "inline"
>                     ],
>                     "type": "object"
>                   }
>                 },
>                 "required": [
>                   "position",
>                   "content"
>                 ],
>                 "type": "object"
>               },
>               "id": {
>                 "type": "string"
>               },
>               "op": {
>                 "const": "text.insert",
>                 "type": "string"
>               },
>               "where": {
>                 "oneOf": [
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "select",
>                         "type": "string"
>                       },
>                       "require": {
>                         "enum": [
>                           "first",
>                           "exactlyOne"
>                         ]
>                       },
>                       "select": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "caseSensitive": {
>                                 "description": "Case-sensitive matching. Default: false.",
>                                 "type": "boolean"
>                               },
>                               "mode": {
>                                 "description": "Match mode: 'contains' (literal substring, recommended for literal text) or 'regex' (validated regular expression).",
>                                 "enum": [
>                                   "contains",
>                                   "regex"
>                                 ]
>                               },
>                               "pattern": {
>                                 "description": "Text to match. In regex mode, patterns are validated for syntax, maximum length, and safety before execution.",
>                                 "type": "string"
>                               },
>                               "type": {
>                                 "const": "text",
>                                 "description": "Must be 'text' for text pattern search."
>                               },
>                               "wholeWord": {
>                                 "description": "Require word-boundary matches. Default: false.",
>                                 "type": "boolean"
>                               }
>                             },
>                             "required": [
>                               "type",
>                               "pattern"
>                             ],
>                             "type": "object"
>                           },
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "kind": {
>                                 "description": "Filter: 'block' or 'inline'.",
>                                 "enum": [
>                                   "block",
>                                   "inline"
>                                 ]
>                               },
>                               "nodeType": {
>                                 "description": "Block type to match (paragraph, heading, table, listItem, etc.).",
>                                 "enum": [
>                                   "paragraph",
>                                   "heading",
>                                   "listItem",
>                                   "table",
>                                   "tableRow",
>                                   "tableCell",
>                                   "tableOfContents",
>                                   "image",
>                                   "sdt",
>                                   "run",
>                                   "bookmark",
>                                   "comment",
>                                   "hyperlink",
>                                   "footnoteRef",
>                                   "endnoteRef",
>                                   "crossRef",
>                                   "indexEntry",
>                                   "citation",
>                                   "authorityEntry",
>                                   "sequenceField",
>                                   "tab",
>                                   "lineBreak"
>                                 ]
>                               },
>                               "type": {
>                                 "const": "node",
>                                 "description": "Must be 'node' for node type search."
>                               }
>                             },
>                             "required": [
>                               "type"
>                             ],
>                             "type": "object"
>                           }
>                         ]
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "select",
>                       "require"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "ref",
>                         "type": "string"
>                       },
>                       "ref": {
>                         "type": "string"
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "ref"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "target",
>                         "type": "string"
>                       },
>                       "target": {
>                         "$ref": "#/$defs/SelectionTarget"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "target"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "block",
>                         "type": "string"
>                       },
>                       "nodeId": {
>                         "type": "string"
>                       },
>                       "nodeType": {
>                         "enum": [
>                           "paragraph",
>                           "heading",
>                           "listItem",
>                           "table",
>                           "tableRow",
>                           "tableCell",
>                           "tableOfContents",
>                           "image",
>                           "sdt"
>                         ]
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "nodeType",
>                       "nodeId"
>                     ],
>                     "type": "object"
>                   }
>                 ]
>               }
>             },
>             "required": [
>               "id",
>               "op",
>               "where",
>               "args"
>             ],
>             "type": "object"
>           },
>           {
>             "additionalProperties": false,
>             "properties": {
>               "args": {
>                 "additionalProperties": false,
>                 "properties": {
>                   "behavior": {
>                     "$ref": "#/$defs/DeleteBehavior"
>                   }
>                 },
>                 "type": "object"
>               },
>               "id": {
>                 "type": "string"
>               },
>               "op": {
>                 "const": "text.delete",
>                 "type": "string"
>               },
>               "where": {
>                 "oneOf": [
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "select",
>                         "type": "string"
>                       },
>                       "require": {
>                         "enum": [
>                           "first",
>                           "exactlyOne",
>                           "all"
>                         ]
>                       },
>                       "select": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "caseSensitive": {
>                                 "description": "Case-sensitive matching. Default: false.",
>                                 "type": "boolean"
>                               },
>                               "mode": {
>                                 "description": "Match mode: 'contains' (literal substring, recommended for literal text) or 'regex' (validated regular expression).",
>                                 "enum": [
>                                   "contains",
>                                   "regex"
>                                 ]
>                               },
>                               "pattern": {
>                                 "description": "Text to match. In regex mode, patterns are validated for syntax, maximum length, and safety before execution.",
>                                 "type": "string"
>                               },
>                               "type": {
>                                 "const": "text",
>                                 "description": "Must be 'text' for text pattern search."
>                               },
>                               "wholeWord": {
>                                 "description": "Require word-boundary matches. Default: false.",
>                                 "type": "boolean"
>                               }
>                             },
>                             "required": [
>                               "type",
>                               "pattern"
>                             ],
>                             "type": "object"
>                           },
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "kind": {
>                                 "description": "Filter: 'block' or 'inline'.",
>                                 "enum": [
>                                   "block",
>                                   "inline"
>                                 ]
>                               },
>                               "nodeType": {
>                                 "description": "Block type to match (paragraph, heading, table, listItem, etc.).",
>                                 "enum": [
>                                   "paragraph",
>                                   "heading",
>                                   "listItem",
>                                   "table",
>                                   "tableRow",
>                                   "tableCell",
>                                   "tableOfContents",
>                                   "image",
>                                   "sdt",
>                                   "run",
>                                   "bookmark",
>                                   "comment",
>                                   "hyperlink",
>                                   "footnoteRef",
>                                   "endnoteRef",
>                                   "crossRef",
>                                   "indexEntry",
>                                   "citation",
>                                   "authorityEntry",
>                                   "sequenceField",
>                                   "tab",
>                                   "lineBreak"
>                                 ]
>                               },
>                               "type": {
>                                 "const": "node",
>                                 "description": "Must be 'node' for node type search."
>                               }
>                             },
>                             "required": [
>                               "type"
>                             ],
>                             "type": "object"
>                           }
>                         ]
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "select",
>                       "require"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "ref",
>                         "type": "string"
>                       },
>                       "ref": {
>                         "type": "string"
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "ref"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "target",
>                         "type": "string"
>                       },
>                       "target": {
>                         "$ref": "#/$defs/SelectionTarget"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "target"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "block",
>                         "type": "string"
>                       },
>                       "nodeId": {
>                         "type": "string"
>                       },
>                       "nodeType": {
>                         "enum": [
>                           "paragraph",
>                           "heading",
>                           "listItem",
>                           "table",
>                           "tableRow",
>                           "tableCell",
>                           "tableOfContents",
>                           "image",
>                           "sdt"
>                         ]
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "nodeType",
>                       "nodeId"
>                     ],
>                     "type": "object"
>                   }
>                 ]
>               }
>             },
>             "required": [
>               "id",
>               "op",
>               "where",
>               "args"
>             ],
>             "type": "object"
>           },
>           {
>             "additionalProperties": false,
>             "properties": {
>               "args": {
>                 "additionalProperties": false,
>                 "minProperties": 1,
>                 "properties": {
>                   "alignment": {
>                     "description": "Set paragraph alignment on the target block(s). Can be combined with inline formatting in the same step.",
>                     "enum": [
>                       "left",
>                       "center",
>                       "right",
>                       "justify"
>                     ],
>                     "type": "string"
>                   },
>                   "inline": {
>                     "additionalProperties": false,
>                     "minProperties": 1,
>                     "properties": {
>                       "bCs": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "bold": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "border": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "color": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "space": {
>                                 "oneOf": [
>                                   {
>                                     "type": "number"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "sz": {
>                                 "oneOf": [
>                                   {
>                                     "type": "number"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "val": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "caps": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "charScale": {
>                         "oneOf": [
>                           {
>                             "type": "number"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "color": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "contextualAlternates": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "cs": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "dstrike": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "eastAsianLayout": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "combine": {
>                                 "oneOf": [
>                                   {
>                                     "type": "boolean"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "combineBrackets": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "id": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "vert": {
>                                 "oneOf": [
>                                   {
>                                     "type": "boolean"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "vertCompress": {
>                                 "oneOf": [
>                                   {
>                                     "type": "boolean"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "em": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "emboss": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "fitText": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "id": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "val": {
>                                 "oneOf": [
>                                   {
>                                     "type": "number"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "fontFamily": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "fontSize": {
>                         "oneOf": [
>                           {
>                             "type": "number"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "fontSizeCs": {
>                         "oneOf": [
>                           {
>                             "type": "number"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "highlight": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "iCs": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "imprint": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "italic": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "kerning": {
>                         "oneOf": [
>                           {
>                             "type": "number"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "lang": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "bidi": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "eastAsia": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "val": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "letterSpacing": {
>                         "oneOf": [
>                           {
>                             "type": "number"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "ligatures": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "numForm": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "numSpacing": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "oMath": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "outline": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "position": {
>                         "oneOf": [
>                           {
>                             "type": "number"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "rFonts": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "ascii": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "asciiTheme": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "cs": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "csTheme": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "eastAsia": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "eastAsiaTheme": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "hAnsi": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "hAnsiTheme": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "hint": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "rStyle": {
>                         "oneOf": [
>                           {
>                             "minLength": 1,
>                             "type": "string"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "rtl": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "shading": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "color": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "fill": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "val": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "shadow": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "smallCaps": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "snapToGrid": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "specVanish": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "strike": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "stylisticSets": {
>                         "oneOf": [
>                           {
>                             "items": {
>                               "additionalProperties": false,
>                               "properties": {
>                                 "id": {
>                                   "type": "number"
>                                 },
>                                 "val": {
>                                   "type": "boolean"
>                                 }
>                               },
>                               "required": [
>                                 "id"
>                               ],
>                               "type": "object"
>                             },
>                             "minItems": 1,
>                             "type": "array"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "underline": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           },
>                           {
>                             "additionalProperties": false,
>                             "minProperties": 1,
>                             "properties": {
>                               "color": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "style": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               },
>                               "themeColor": {
>                                 "oneOf": [
>                                   {
>                                     "minLength": 1,
>                                     "type": "string"
>                                   },
>                                   {
>                                     "type": "null"
>                                   }
>                                 ]
>                               }
>                             },
>                             "type": "object"
>                           }
>                         ]
>                       },
>                       "vanish": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "vertAlign": {
>                         "oneOf": [
>                           {
>                             "enum": [
>                               "superscript",
>                               "subscript",
>                               "baseline"
>                             ]
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       },
>                       "webHidden": {
>                         "oneOf": [
>                           {
>                             "type": "boolean"
>                           },
>                           {
>                             "type": "null"
>                           }
>                         ]
>                       }
>                     },
>                     "type": "object"
>                   },
>                   "scope": {
>                     "description": "When \"block\", inline formatting expands to cover the entire parent paragraph(s), not just the matched text. Use \"block\" after markdown inserts to format whole paragraphs with a short identifying pattern. Default: \"match\".",
>                     "enum": [
>                       "match",
>                       "block"
>                     ],
>                     "type": "string"
>                   }
>                 },
>                 "type": "object"
>               },
>               "id": {
>                 "type": "string"
>               },
>               "op": {
>                 "const": "format.apply",
>                 "type": "string"
>               },
>               "where": {
>                 "oneOf": [
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "select",
>                         "type": "string"
>                       },
>                       "require": {
>                         "enum": [
>                           "first",
>                           "exactlyOne",
>                           "all"
>                         ]
>                       },
>                       "select": {
>                         "oneOf": [
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "caseSensitive": {
>                                 "description": "Case-sensitive matching. Default: false.",
>                                 "type": "boolean"
>                               },
>                               "mode": {
>                                 "description": "Match mode: 'contains' (literal substring, recommended for literal text) or 'regex' (validated regular expression).",
>                                 "enum": [
>                                   "contains",
>                                   "regex"
>                                 ]
>                               },
>                               "pattern": {
>                                 "description": "Text to match. In regex mode, patterns are validated for syntax, maximum length, and safety before execution.",
>                                 "type": "string"
>                               },
>                               "type": {
>                                 "const": "text",
>                                 "description": "Must be 'text' for text pattern search."
>                               },
>                               "wholeWord": {
>                                 "description": "Require word-boundary matches. Default: false.",
>                                 "type": "boolean"
>                               }
>                             },
>                             "required": [
>                               "type",
>                               "pattern"
>                             ],
>                             "type": "object"
>                           },
>                           {
>                             "additionalProperties": false,
>                             "properties": {
>                               "kind": {
>                                 "description": "Filter: 'block' or 'inline'.",
>                                 "enum": [
>                                   "block",
>                                   "inline"
>                                 ]
>                               },
>                               "nodeType": {
>                                 "description": "Block type to match (paragraph, heading, table, listItem, etc.).",
>                                 "enum": [
>                                   "paragraph",
>                                   "heading",
>                                   "listItem",
>                                   "table",
>                                   "tableRow",
>                                   "tableCell",
>                                   "tableOfContents",
>                                   "image",
>                                   "sdt",
>                                   "run",
>                                   "bookmark",
>                                   "comment",
>                                   "hyperlink",
>                                   "footnoteRef",
>                                   "endnoteRef",
>                                   "crossRef",
>                                   "indexEntry",
>                                   "citation",
>                                   "authorityEntry",
>                                   "sequenceField",
>                                   "tab",
>                                   "lineBreak"
>                                 ]
>                               },
>                               "type": {
>                                 "const": "node",
>                                 "description": "Must be 'node' for node type search."
>                               }
>                             },
>                             "required": [
>                               "type"
>                             ],
>                             "type": "object"
>                           }
>                         ]
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "select",
>                       "require"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "ref",
>                         "type": "string"
>                       },
>                       "ref": {
>                         "type": "string"
>                       },
>                       "within": {
>                         "$ref": "#/$defs/BlockNodeAddress"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "ref"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "target",
>                         "type": "string"
>                       },
>                       "target": {
>                         "$ref": "#/$defs/SelectionTarget"
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "target"
>                     ],
>                     "type": "object"
>                   },
>                   {
>                     "additionalProperties": false,
>                     "properties": {
>                       "by": {
>                         "const": "block",
>                         "type": "string"
>                       },
>                       "nodeId": {
>                         "type": "string"
>                       },
>                       "nodeType": {
>                         "enum": [
>                           "paragraph",
>                           "heading",
>                           "listItem",
>                           "table",
>                           "tableRow",
>                           "tableCell",
>                           "tableOfContents",
>                           "image",
>                           "sdt"
>                         ]
>                       }
>                     },
>                     "required": [
>                       "by",
>                       "nodeType",
>                       "nodeId"
>                     ],
>                     "type": "object"
>                   }
>                 ]
>               }
>             },
>             "required": [
>               "id",
>               "op",
>               "where",
>               "args"
>             ],
>             "type": "object"
>           },
>           {
>             "additionalProperties": false,
>             "properties": {
>               "args": {
>                 "additionalProperties": false,
>                 "properties": {
>                   "expectCount": {
>                     "type": "number"
>                   }
>                 },
>                 "required": [
>                   "expectCount"
>                 ],
>                 "type": "object"
>               },
>               "id": {
>                 "type": "string"
>               },
>               "op": {
>                 "const": "assert",
>                 "type": "string"
>               },
>               "where": {
>                 "additionalProperties": false,
>                 "properties": {
>                   "by": {
>                     "const": "select",
>                     "type": "string"
>                   },
>                   "select": {
>                     "oneOf": [
>                       {
>                         "additionalProperties": false,
>                         "properties": {
>                           "caseSensitive": {
>                             "description": "Case-sensitive matching. Default: false.",
>                             "type": "boolean"
>                           },
>                           "mode": {
>                             "description": "Match mode: 'contains' (literal substring, recommended for literal text) or 'regex' (validated regular expression).",
>                             "enum": [
>                               "contains",
>                               "regex"
>                             ]
>                           },
>                           "pattern": {
>                             "description": "Text to match. In regex mode, patterns are validated for syntax, maximum length, and safety before execution.",
>                             "type": "string"
>                           },
>                           "type": {
>                             "const": "text",
>                             "description": "Must be 'text' for text pattern search."
>                           },
>                           "wholeWord": {
>                             "description": "Require word-boundary matches. Default: false.",
>                             "type": "boolean"
>                           }
>                         },
>                         "required": [
>                           "type",
>                           "pattern"
>                         ],
>                         "type": "object"
>                       },
>                       {
>                         "additionalProperties": false,
>                         "properties": {
>                           "kind": {
>                             "description": "Filter: 'block' or 'inline'.",
>                             "enum": [
>                               "block",
>                               "inline"
>                             ]
>                           },
>                           "nodeType": {
>                             "description": "Block type to match (paragraph, heading, table, listItem, etc.).",
>                             "enum": [
>                               "paragraph",
>                               "heading",
>                               "listItem",
>                               "table",
>                               "tableRow",
>                               "tableCell",
>                               "tableOfContents",
>                               "image",
>                               "sdt",
>                               "run",
>                               "bookmark",
>                               "comment",
>                               "hyperlink",
>                               "footnoteRef",
>                               "endnoteRef",
>                               "crossRef",
>                               "indexEntry",
>                               "citation",
>                               "authorityEntry",
>                               "sequenceField",
>                               "tab",
>                               "lineBreak"
>                             ]
>                           },
>                           "type": {
>                             "const": "node",
>                             "description": "Must be 'node' for node type search."
>                           }
>                         },
>                         "required": [
>                           "type"
>                         ],
>                         "type": "object"
>                       }
>                     ]
>                   },
>                   "within": {
>                     "$ref": "#/$defs/BlockNodeAddress"
>                   }
>                 },
>                 "required": [
>                   "by",
>                   "select"
>                 ],
>                 "type": "object"
>               }
>             },
>             "required": [
>               "id",
>               "op",
>               "where",
>               "args"
>             ],
>             "type": "object"
>           }
>         ]
>       },
>       "type": "array"
>     }
>   },
>   "required": [
>     "atomic",
>     "changeMode",
>     "steps"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "revision": {
>       "additionalProperties": false,
>       "properties": {
>         "after": {
>           "type": "string"
>         },
>         "before": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "before",
>         "after"
>       ],
>       "type": "object"
>     },
>     "steps": {
>       "items": {
>         "type": "object"
>       },
>       "type": "array"
>     },
>     "success": {
>       "const": true
>     },
>     "timing": {
>       "additionalProperties": false,
>       "properties": {
>         "totalMs": {
>           "type": "number"
>         }
>       },
>       "required": [
>         "totalMs"
>       ],
>       "type": "object"
>     },
>     "trackedChanges": {
>       "items": {
>         "type": "object"
>       },
>       "type": "array"
>     }
>   },
>   "required": [
>     "success",
>     "revision",
>     "steps",
>     "timing"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw success schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "revision": {
>       "additionalProperties": false,
>       "properties": {
>         "after": {
>           "type": "string"
>         },
>         "before": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "before",
>         "after"
>       ],
>       "type": "object"
>     },
>     "steps": {
>       "items": {
>         "type": "object"
>       },
>       "type": "array"
>     },
>     "success": {
>       "const": true
>     },
>     "timing": {
>       "additionalProperties": false,
>       "properties": {
>         "totalMs": {
>           "type": "number"
>         }
>       },
>       "required": [
>         "totalMs"
>       ],
>       "type": "object"
>     }
>   },
>   "required": [
>     "success",
>     "revision",
>     "steps",
>     "timing"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw failure schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "failure": {
>       "additionalProperties": false,
>       "properties": {
>         "code": {
>           "enum": [
>             "REVISION_MISMATCH",
>             "MATCH_NOT_FOUND",
>             "AMBIGUOUS_MATCH",
>             "STYLE_CONFLICT",
>             "PRECONDITION_FAILED",
>             "INVALID_INPUT",
>             "CROSS_BLOCK_MATCH",
>             "SPAN_FRAGMENTED",
>             "TARGET_MOVED",
>             "PLAN_CONFLICT_OVERLAP",
>             "INVALID_STEP_COMBINATION",
>             "REVISION_CHANGED_SINCE_COMPILE",
>             "INVALID_INSERTION_CONTEXT",
>             "DOCUMENT_IDENTITY_CONFLICT",
>             "CAPABILITY_UNAVAILABLE",
>             "DUPLICATE_ID",
>             "RAW_MODE_REQUIRED",
>             "PRESERVE_ONLY_VIOLATION",
>             "CAPABILITY_UNSUPPORTED",
>             "STORY_NOT_FOUND",
>             "STORY_MISMATCH",
>             "STORY_NOT_SUPPORTED",
>             "CROSS_STORY_PLAN",
>             "MATERIALIZATION_FAILED"
>           ]
>         },
>         "details": {},
>         "message": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "code",
>         "message"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": false
>     }
>   },
>   "required": [
>     "success",
>     "failure"
>   ],
>   "type": "object"
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.