@superdoc/sdk 2.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/agent/actions.cjs +1869 -160
  2. package/dist/agent/actions.d.ts +77 -10
  3. package/dist/agent/actions.js +1870 -161
  4. package/dist/agent/catalog.cjs +102 -9
  5. package/dist/agent/catalog.d.ts +243 -0
  6. package/dist/agent/catalog.js +99 -9
  7. package/dist/agent/doc-snapshot.cjs +200 -2
  8. package/dist/agent/doc-snapshot.d.ts +91 -0
  9. package/dist/agent/doc-snapshot.js +199 -2
  10. package/dist/agent/runtime.cjs +9 -1
  11. package/dist/agent/runtime.d.ts +8 -0
  12. package/dist/agent/runtime.js +9 -1
  13. package/dist/generated/client.cjs +754 -770
  14. package/dist/generated/client.d.ts +10 -9
  15. package/dist/generated/client.js +754 -770
  16. package/dist/generated/contract.cjs +16178 -272
  17. package/dist/generated/contract.d.ts +38 -0
  18. package/dist/generated/contract.js +17419 -1510
  19. package/dist/index.cjs +6 -5
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +6 -5
  22. package/dist/introspection.cjs +59 -0
  23. package/dist/introspection.d.ts +3 -0
  24. package/dist/introspection.js +53 -0
  25. package/dist/runtime/document-rpc.cjs +179 -40
  26. package/dist/runtime/document-rpc.d.ts +13 -4
  27. package/dist/runtime/document-rpc.js +175 -40
  28. package/dist/runtime/embedded-cli.cjs +5 -68
  29. package/dist/runtime/embedded-cli.js +5 -67
  30. package/dist/runtime/embedded-document-host.cjs +28 -0
  31. package/dist/runtime/embedded-document-host.d.ts +1 -0
  32. package/dist/runtime/embedded-document-host.js +23 -0
  33. package/dist/runtime/embedded-platform.cjs +108 -0
  34. package/dist/runtime/embedded-platform.d.ts +5 -0
  35. package/dist/runtime/embedded-platform.js +99 -0
  36. package/dist/runtime/host.cjs +237 -24
  37. package/dist/runtime/host.d.ts +17 -0
  38. package/dist/runtime/host.js +237 -25
  39. package/dist/runtime/process.cjs +30 -9
  40. package/dist/runtime/process.d.ts +9 -0
  41. package/dist/runtime/process.js +29 -9
  42. package/dist/runtime/sdk-version.generated.cjs +8 -0
  43. package/dist/runtime/sdk-version.generated.d.ts +1 -0
  44. package/dist/runtime/sdk-version.generated.js +4 -0
  45. package/dist/runtime/transport-common.cjs +1 -0
  46. package/dist/runtime/transport-common.d.ts +28 -10
  47. package/dist/runtime/transport-common.js +1 -1
  48. package/package.json +7 -7
  49. package/tools/__pycache__/__init__.cpython-311.pyc +0 -0
  50. package/tools/__pycache__/intent_dispatch_generated.cpython-311.pyc +0 -0
  51. package/tools/tools-policy.json +1 -1
@@ -32,6 +32,86 @@ const SELECTOR_SCHEMA = {
32
32
  kind: { type: 'string' },
33
33
  },
34
34
  };
35
+ /**
36
+ * Inline run marks the agent can attach to a whole list item or a single run of
37
+ * one. `fontSize` is in POINTS; `color`/`highlight` are hex. Booleans may be set
38
+ * to `false` to explicitly clear a mark inherited from the anchor/whole-item.
39
+ */
40
+ const RUN_MARKS_SCHEMA = {
41
+ type: 'object',
42
+ additionalProperties: false,
43
+ properties: {
44
+ bold: { type: 'boolean' },
45
+ italic: { type: 'boolean' },
46
+ underline: { type: 'boolean' },
47
+ strikethrough: { type: 'boolean' },
48
+ fontFamily: { type: 'string' },
49
+ fontSize: { type: 'number', description: 'point size, e.g. 16' },
50
+ color: { type: 'string', description: 'hex color, e.g. #1a1a1a' },
51
+ highlight: { type: 'string', description: 'hex highlight color' },
52
+ },
53
+ };
54
+ /**
55
+ * One list item to add. Either a plain string, or an object with ordered styled
56
+ * `runs` so the agent can replicate an intra-item formatting PATTERN it inferred
57
+ * from the sibling items (e.g. first word plain, second word italic). `marks`
58
+ * are whole-item defaults applied under the per-run marks; `level` nests the
59
+ * item relative to the anchor (0 = same level). Unstyled items still inherit the
60
+ * list's existing run formatting automatically.
61
+ */
62
+ const LIST_ITEM_SCHEMA = {
63
+ oneOf: [
64
+ { type: 'string' },
65
+ {
66
+ type: 'object',
67
+ additionalProperties: false,
68
+ properties: {
69
+ text: { type: 'string', description: 'plain item text (use instead of runs when unstyled)' },
70
+ runs: {
71
+ type: 'array',
72
+ description: 'ordered styled segments; concatenated they form the item text',
73
+ items: {
74
+ type: 'object',
75
+ additionalProperties: false,
76
+ properties: { text: { type: 'string' }, marks: RUN_MARKS_SCHEMA },
77
+ required: ['text'],
78
+ },
79
+ },
80
+ marks: RUN_MARKS_SCHEMA,
81
+ level: { type: 'number' },
82
+ },
83
+ },
84
+ ],
85
+ };
86
+ /**
87
+ * One table cell: a plain string, or a styled object {text | runs, marks?} —
88
+ * same run/marks model as list items, so a cell can reproduce an intra-cell
89
+ * formatting pattern. Used by create_table (rows of cells) and
90
+ * insert_table_row / insert_table_column (a single row/column of cells).
91
+ */
92
+ const CELL_SCHEMA = {
93
+ oneOf: [
94
+ { type: 'string' },
95
+ {
96
+ type: 'object',
97
+ additionalProperties: false,
98
+ properties: {
99
+ text: { type: 'string', description: 'plain cell text (use instead of runs when unstyled)' },
100
+ runs: {
101
+ type: 'array',
102
+ description: 'ordered styled segments; concatenated they form the cell text',
103
+ items: {
104
+ type: 'object',
105
+ additionalProperties: false,
106
+ properties: { text: { type: 'string' }, marks: RUN_MARKS_SCHEMA },
107
+ required: ['text'],
108
+ },
109
+ },
110
+ marks: RUN_MARKS_SCHEMA,
111
+ },
112
+ },
113
+ ],
114
+ };
35
115
  /**
36
116
  * Per-argument JSON schema for every `superdoc_perform_action` argument EXCEPT `action`.
37
117
  * The single source of truth for each arg's JSON schema. ACTION_ARG_PROPERTIES
@@ -40,16 +120,22 @@ const SELECTOR_SCHEMA = {
40
120
  */
41
121
  const ACTION_ARG_SCHEMA = {
42
122
  text: { type: 'string' },
43
- texts: { type: 'array', items: { type: 'string' } },
123
+ // insert_paragraphs: each entry is a plain string or a styled {text|runs,
124
+ // marks?} object (same run/marks model as list items) so an inserted
125
+ // paragraph can mirror its section's intra-paragraph formatting pattern.
126
+ texts: { type: 'array', items: CELL_SCHEMA },
44
127
  level: { type: 'number' },
45
128
  headingText: { type: 'string' },
46
129
  headingLevel: { type: 'number' },
47
130
  kind: { type: 'string', enum: ['ordered', 'bullet'] },
48
- items: { type: 'array', items: { type: 'string' } },
131
+ items: { type: 'array', items: LIST_ITEM_SCHEMA },
49
132
  listOrdinal: { type: 'number' },
50
133
  rows: { type: 'number' },
51
134
  columns: { type: 'number' },
52
- cellTexts: { type: 'array', items: {} },
135
+ // create_table passes rows of cells (2D); insert_table_row/column pass a
136
+ // single row/column of cells (1D). Accept either: each entry is a cell or an
137
+ // array of cells.
138
+ cellTexts: { type: 'array', items: { oneOf: [CELL_SCHEMA, { type: 'array', items: CELL_SCHEMA }] } },
53
139
  edits: {
54
140
  type: 'array',
55
141
  items: {
@@ -117,11 +203,7 @@ const ACTION_ARG_SCHEMA = {
117
203
  accentColor: { type: 'string' },
118
204
  entries: {
119
205
  type: 'array',
120
- items: {
121
- type: 'object',
122
- properties: { text: { type: 'string' }, level: { type: 'number' } },
123
- required: ['text'],
124
- },
206
+ items: LIST_ITEM_SCHEMA,
125
207
  },
126
208
  lineSpacing: { type: 'number' },
127
209
  spaceBefore: { type: 'number' },
@@ -244,16 +326,24 @@ function buildPerformActionDefinition(includedActions) {
244
326
  const AGENT_TOOL_DEFINITIONS = [
245
327
  {
246
328
  name: 'superdoc_inspect',
247
- description: 'Build a deterministic document snapshot. Prefer the narrowest inspect that answers the question: countsOnly for pure counts, includeDomains to limit which domains are returned, and blockNodeTypes when only specific block types matter. For LARGE documents, read in windows: blockOffset/blockLimit return a contiguous slice of blocks (ordinals are absolute, so windows line up), and omitEmptyBlocks/dropTextPreview trim payload for a reading pass.',
329
+ description: "Build a deterministic document snapshot. Prefer the narrowest inspect that answers the question: countsOnly for pure counts, includeDomains to limit which domains are returned, and blockNodeTypes when only specific block types matter. TO FIND A SECTION/PHRASE IN A LARGE DOCUMENT, pass findText: the full-text scan runs server-side, `finds` reports every matching block's ordinal + preview, and the returned block window auto-centers on the first match — ONE findText call replaces a linear sweep of wide windows; never page through a large document hunting for a heading. For sequential reading, use windows: blockOffset/blockLimit return a contiguous slice of blocks (ordinals are absolute, so windows line up), and omitEmptyBlocks/dropTextPreview trim payload for a reading pass. Each list item carries a `runs` array of its inline segments {start,end,text, bold/italic/underline/strike?, fontFamily?, fontSize?, color?} BY DEFAULT, revealing the intra-item formatting pattern (e.g. first word plain, second italic) to reproduce via add_list_items `runs` — pass includeListItemRuns:false to omit it for a pure read. Table cells do NOT carry runs by default (tables can be large); pass includeTableCellRuns:true to attach the same per-run formatting to each cell when you need to match a table's cell styling. Body blocks likewise: pass includeBlockRuns:true (with a NARROW blockOffset/blockLimit window around the target) to attach per-run formatting to paragraphs, revealing a section's pattern (e.g. clauses with a bold '(m)' lead-in) to reproduce via insert_paragraphs styled texts.",
248
330
  inputSchema: {
249
331
  type: 'object',
250
332
  additionalProperties: false,
251
333
  properties: {
252
334
  countsOnly: { type: 'boolean' },
335
+ findText: { type: 'string' },
336
+ findLimit: { type: 'number', minimum: 1 },
253
337
  blockOffset: { type: 'number', minimum: 0 },
254
338
  blockLimit: { type: 'number', minimum: 1 },
255
339
  omitEmptyBlocks: { type: 'boolean' },
256
340
  dropTextPreview: { type: 'boolean' },
341
+ includeListItemRuns: { type: 'boolean' },
342
+ listItemRunsLimit: { type: 'number', minimum: 1 },
343
+ includeTableCellRuns: { type: 'boolean' },
344
+ tableCellRunsLimit: { type: 'number', minimum: 1 },
345
+ includeBlockRuns: { type: 'boolean' },
346
+ blockRunsLimit: { type: 'number', minimum: 1 },
257
347
  includeDomains: {
258
348
  type: 'array',
259
349
  items: {
@@ -476,7 +566,10 @@ function isAgentToolName(toolName) {
476
566
  exports.ACTION_ARG_SCHEMA = ACTION_ARG_SCHEMA;
477
567
  exports.AGENT_TOOL_DEFINITIONS = AGENT_TOOL_DEFINITIONS;
478
568
  exports.AGENT_TOOL_NAMES = AGENT_TOOL_NAMES;
569
+ exports.CELL_SCHEMA = CELL_SCHEMA;
570
+ exports.LIST_ITEM_SCHEMA = LIST_ITEM_SCHEMA;
479
571
  exports.PUBLIC_AGENT_TOOL_NAMES = PUBLIC_AGENT_TOOL_NAMES;
572
+ exports.RUN_MARKS_SCHEMA = RUN_MARKS_SCHEMA;
480
573
  exports.SELECTOR_SCHEMA = SELECTOR_SCHEMA;
481
574
  exports.isAgentToolName = isAgentToolName;
482
575
  exports.listAgentTools = listAgentTools;
@@ -67,6 +67,249 @@ export declare const SELECTOR_SCHEMA: {
67
67
  };
68
68
  };
69
69
  };
70
+ /**
71
+ * Inline run marks the agent can attach to a whole list item or a single run of
72
+ * one. `fontSize` is in POINTS; `color`/`highlight` are hex. Booleans may be set
73
+ * to `false` to explicitly clear a mark inherited from the anchor/whole-item.
74
+ */
75
+ export declare const RUN_MARKS_SCHEMA: {
76
+ readonly type: "object";
77
+ readonly additionalProperties: false;
78
+ readonly properties: {
79
+ readonly bold: {
80
+ readonly type: "boolean";
81
+ };
82
+ readonly italic: {
83
+ readonly type: "boolean";
84
+ };
85
+ readonly underline: {
86
+ readonly type: "boolean";
87
+ };
88
+ readonly strikethrough: {
89
+ readonly type: "boolean";
90
+ };
91
+ readonly fontFamily: {
92
+ readonly type: "string";
93
+ };
94
+ readonly fontSize: {
95
+ readonly type: "number";
96
+ readonly description: "point size, e.g. 16";
97
+ };
98
+ readonly color: {
99
+ readonly type: "string";
100
+ readonly description: "hex color, e.g. #1a1a1a";
101
+ };
102
+ readonly highlight: {
103
+ readonly type: "string";
104
+ readonly description: "hex highlight color";
105
+ };
106
+ };
107
+ };
108
+ /**
109
+ * One list item to add. Either a plain string, or an object with ordered styled
110
+ * `runs` so the agent can replicate an intra-item formatting PATTERN it inferred
111
+ * from the sibling items (e.g. first word plain, second word italic). `marks`
112
+ * are whole-item defaults applied under the per-run marks; `level` nests the
113
+ * item relative to the anchor (0 = same level). Unstyled items still inherit the
114
+ * list's existing run formatting automatically.
115
+ */
116
+ export declare const LIST_ITEM_SCHEMA: {
117
+ readonly oneOf: readonly [{
118
+ readonly type: "string";
119
+ }, {
120
+ readonly type: "object";
121
+ readonly additionalProperties: false;
122
+ readonly properties: {
123
+ readonly text: {
124
+ readonly type: "string";
125
+ readonly description: "plain item text (use instead of runs when unstyled)";
126
+ };
127
+ readonly runs: {
128
+ readonly type: "array";
129
+ readonly description: "ordered styled segments; concatenated they form the item text";
130
+ readonly items: {
131
+ readonly type: "object";
132
+ readonly additionalProperties: false;
133
+ readonly properties: {
134
+ readonly text: {
135
+ readonly type: "string";
136
+ };
137
+ readonly marks: {
138
+ readonly type: "object";
139
+ readonly additionalProperties: false;
140
+ readonly properties: {
141
+ readonly bold: {
142
+ readonly type: "boolean";
143
+ };
144
+ readonly italic: {
145
+ readonly type: "boolean";
146
+ };
147
+ readonly underline: {
148
+ readonly type: "boolean";
149
+ };
150
+ readonly strikethrough: {
151
+ readonly type: "boolean";
152
+ };
153
+ readonly fontFamily: {
154
+ readonly type: "string";
155
+ };
156
+ readonly fontSize: {
157
+ readonly type: "number";
158
+ readonly description: "point size, e.g. 16";
159
+ };
160
+ readonly color: {
161
+ readonly type: "string";
162
+ readonly description: "hex color, e.g. #1a1a1a";
163
+ };
164
+ readonly highlight: {
165
+ readonly type: "string";
166
+ readonly description: "hex highlight color";
167
+ };
168
+ };
169
+ };
170
+ };
171
+ readonly required: readonly ["text"];
172
+ };
173
+ };
174
+ readonly marks: {
175
+ readonly type: "object";
176
+ readonly additionalProperties: false;
177
+ readonly properties: {
178
+ readonly bold: {
179
+ readonly type: "boolean";
180
+ };
181
+ readonly italic: {
182
+ readonly type: "boolean";
183
+ };
184
+ readonly underline: {
185
+ readonly type: "boolean";
186
+ };
187
+ readonly strikethrough: {
188
+ readonly type: "boolean";
189
+ };
190
+ readonly fontFamily: {
191
+ readonly type: "string";
192
+ };
193
+ readonly fontSize: {
194
+ readonly type: "number";
195
+ readonly description: "point size, e.g. 16";
196
+ };
197
+ readonly color: {
198
+ readonly type: "string";
199
+ readonly description: "hex color, e.g. #1a1a1a";
200
+ };
201
+ readonly highlight: {
202
+ readonly type: "string";
203
+ readonly description: "hex highlight color";
204
+ };
205
+ };
206
+ };
207
+ readonly level: {
208
+ readonly type: "number";
209
+ };
210
+ };
211
+ }];
212
+ };
213
+ /**
214
+ * One table cell: a plain string, or a styled object {text | runs, marks?} —
215
+ * same run/marks model as list items, so a cell can reproduce an intra-cell
216
+ * formatting pattern. Used by create_table (rows of cells) and
217
+ * insert_table_row / insert_table_column (a single row/column of cells).
218
+ */
219
+ export declare const CELL_SCHEMA: {
220
+ readonly oneOf: readonly [{
221
+ readonly type: "string";
222
+ }, {
223
+ readonly type: "object";
224
+ readonly additionalProperties: false;
225
+ readonly properties: {
226
+ readonly text: {
227
+ readonly type: "string";
228
+ readonly description: "plain cell text (use instead of runs when unstyled)";
229
+ };
230
+ readonly runs: {
231
+ readonly type: "array";
232
+ readonly description: "ordered styled segments; concatenated they form the cell text";
233
+ readonly items: {
234
+ readonly type: "object";
235
+ readonly additionalProperties: false;
236
+ readonly properties: {
237
+ readonly text: {
238
+ readonly type: "string";
239
+ };
240
+ readonly marks: {
241
+ readonly type: "object";
242
+ readonly additionalProperties: false;
243
+ readonly properties: {
244
+ readonly bold: {
245
+ readonly type: "boolean";
246
+ };
247
+ readonly italic: {
248
+ readonly type: "boolean";
249
+ };
250
+ readonly underline: {
251
+ readonly type: "boolean";
252
+ };
253
+ readonly strikethrough: {
254
+ readonly type: "boolean";
255
+ };
256
+ readonly fontFamily: {
257
+ readonly type: "string";
258
+ };
259
+ readonly fontSize: {
260
+ readonly type: "number";
261
+ readonly description: "point size, e.g. 16";
262
+ };
263
+ readonly color: {
264
+ readonly type: "string";
265
+ readonly description: "hex color, e.g. #1a1a1a";
266
+ };
267
+ readonly highlight: {
268
+ readonly type: "string";
269
+ readonly description: "hex highlight color";
270
+ };
271
+ };
272
+ };
273
+ };
274
+ readonly required: readonly ["text"];
275
+ };
276
+ };
277
+ readonly marks: {
278
+ readonly type: "object";
279
+ readonly additionalProperties: false;
280
+ readonly properties: {
281
+ readonly bold: {
282
+ readonly type: "boolean";
283
+ };
284
+ readonly italic: {
285
+ readonly type: "boolean";
286
+ };
287
+ readonly underline: {
288
+ readonly type: "boolean";
289
+ };
290
+ readonly strikethrough: {
291
+ readonly type: "boolean";
292
+ };
293
+ readonly fontFamily: {
294
+ readonly type: "string";
295
+ };
296
+ readonly fontSize: {
297
+ readonly type: "number";
298
+ readonly description: "point size, e.g. 16";
299
+ };
300
+ readonly color: {
301
+ readonly type: "string";
302
+ readonly description: "hex color, e.g. #1a1a1a";
303
+ };
304
+ readonly highlight: {
305
+ readonly type: "string";
306
+ readonly description: "hex highlight color";
307
+ };
308
+ };
309
+ };
310
+ };
311
+ }];
312
+ };
70
313
  /**
71
314
  * Per-argument JSON schema for every `superdoc_perform_action` argument EXCEPT `action`.
72
315
  * The single source of truth for each arg's JSON schema. ACTION_ARG_PROPERTIES
@@ -29,6 +29,86 @@ export const SELECTOR_SCHEMA = {
29
29
  kind: { type: 'string' },
30
30
  },
31
31
  };
32
+ /**
33
+ * Inline run marks the agent can attach to a whole list item or a single run of
34
+ * one. `fontSize` is in POINTS; `color`/`highlight` are hex. Booleans may be set
35
+ * to `false` to explicitly clear a mark inherited from the anchor/whole-item.
36
+ */
37
+ export const RUN_MARKS_SCHEMA = {
38
+ type: 'object',
39
+ additionalProperties: false,
40
+ properties: {
41
+ bold: { type: 'boolean' },
42
+ italic: { type: 'boolean' },
43
+ underline: { type: 'boolean' },
44
+ strikethrough: { type: 'boolean' },
45
+ fontFamily: { type: 'string' },
46
+ fontSize: { type: 'number', description: 'point size, e.g. 16' },
47
+ color: { type: 'string', description: 'hex color, e.g. #1a1a1a' },
48
+ highlight: { type: 'string', description: 'hex highlight color' },
49
+ },
50
+ };
51
+ /**
52
+ * One list item to add. Either a plain string, or an object with ordered styled
53
+ * `runs` so the agent can replicate an intra-item formatting PATTERN it inferred
54
+ * from the sibling items (e.g. first word plain, second word italic). `marks`
55
+ * are whole-item defaults applied under the per-run marks; `level` nests the
56
+ * item relative to the anchor (0 = same level). Unstyled items still inherit the
57
+ * list's existing run formatting automatically.
58
+ */
59
+ export const LIST_ITEM_SCHEMA = {
60
+ oneOf: [
61
+ { type: 'string' },
62
+ {
63
+ type: 'object',
64
+ additionalProperties: false,
65
+ properties: {
66
+ text: { type: 'string', description: 'plain item text (use instead of runs when unstyled)' },
67
+ runs: {
68
+ type: 'array',
69
+ description: 'ordered styled segments; concatenated they form the item text',
70
+ items: {
71
+ type: 'object',
72
+ additionalProperties: false,
73
+ properties: { text: { type: 'string' }, marks: RUN_MARKS_SCHEMA },
74
+ required: ['text'],
75
+ },
76
+ },
77
+ marks: RUN_MARKS_SCHEMA,
78
+ level: { type: 'number' },
79
+ },
80
+ },
81
+ ],
82
+ };
83
+ /**
84
+ * One table cell: a plain string, or a styled object {text | runs, marks?} —
85
+ * same run/marks model as list items, so a cell can reproduce an intra-cell
86
+ * formatting pattern. Used by create_table (rows of cells) and
87
+ * insert_table_row / insert_table_column (a single row/column of cells).
88
+ */
89
+ export const CELL_SCHEMA = {
90
+ oneOf: [
91
+ { type: 'string' },
92
+ {
93
+ type: 'object',
94
+ additionalProperties: false,
95
+ properties: {
96
+ text: { type: 'string', description: 'plain cell text (use instead of runs when unstyled)' },
97
+ runs: {
98
+ type: 'array',
99
+ description: 'ordered styled segments; concatenated they form the cell text',
100
+ items: {
101
+ type: 'object',
102
+ additionalProperties: false,
103
+ properties: { text: { type: 'string' }, marks: RUN_MARKS_SCHEMA },
104
+ required: ['text'],
105
+ },
106
+ },
107
+ marks: RUN_MARKS_SCHEMA,
108
+ },
109
+ },
110
+ ],
111
+ };
32
112
  /**
33
113
  * Per-argument JSON schema for every `superdoc_perform_action` argument EXCEPT `action`.
34
114
  * The single source of truth for each arg's JSON schema. ACTION_ARG_PROPERTIES
@@ -37,16 +117,22 @@ export const SELECTOR_SCHEMA = {
37
117
  */
38
118
  export const ACTION_ARG_SCHEMA = {
39
119
  text: { type: 'string' },
40
- texts: { type: 'array', items: { type: 'string' } },
120
+ // insert_paragraphs: each entry is a plain string or a styled {text|runs,
121
+ // marks?} object (same run/marks model as list items) so an inserted
122
+ // paragraph can mirror its section's intra-paragraph formatting pattern.
123
+ texts: { type: 'array', items: CELL_SCHEMA },
41
124
  level: { type: 'number' },
42
125
  headingText: { type: 'string' },
43
126
  headingLevel: { type: 'number' },
44
127
  kind: { type: 'string', enum: ['ordered', 'bullet'] },
45
- items: { type: 'array', items: { type: 'string' } },
128
+ items: { type: 'array', items: LIST_ITEM_SCHEMA },
46
129
  listOrdinal: { type: 'number' },
47
130
  rows: { type: 'number' },
48
131
  columns: { type: 'number' },
49
- cellTexts: { type: 'array', items: {} },
132
+ // create_table passes rows of cells (2D); insert_table_row/column pass a
133
+ // single row/column of cells (1D). Accept either: each entry is a cell or an
134
+ // array of cells.
135
+ cellTexts: { type: 'array', items: { oneOf: [CELL_SCHEMA, { type: 'array', items: CELL_SCHEMA }] } },
50
136
  edits: {
51
137
  type: 'array',
52
138
  items: {
@@ -114,11 +200,7 @@ export const ACTION_ARG_SCHEMA = {
114
200
  accentColor: { type: 'string' },
115
201
  entries: {
116
202
  type: 'array',
117
- items: {
118
- type: 'object',
119
- properties: { text: { type: 'string' }, level: { type: 'number' } },
120
- required: ['text'],
121
- },
203
+ items: LIST_ITEM_SCHEMA,
122
204
  },
123
205
  lineSpacing: { type: 'number' },
124
206
  spaceBefore: { type: 'number' },
@@ -241,16 +323,24 @@ function buildPerformActionDefinition(includedActions) {
241
323
  export const AGENT_TOOL_DEFINITIONS = [
242
324
  {
243
325
  name: 'superdoc_inspect',
244
- description: 'Build a deterministic document snapshot. Prefer the narrowest inspect that answers the question: countsOnly for pure counts, includeDomains to limit which domains are returned, and blockNodeTypes when only specific block types matter. For LARGE documents, read in windows: blockOffset/blockLimit return a contiguous slice of blocks (ordinals are absolute, so windows line up), and omitEmptyBlocks/dropTextPreview trim payload for a reading pass.',
326
+ description: "Build a deterministic document snapshot. Prefer the narrowest inspect that answers the question: countsOnly for pure counts, includeDomains to limit which domains are returned, and blockNodeTypes when only specific block types matter. TO FIND A SECTION/PHRASE IN A LARGE DOCUMENT, pass findText: the full-text scan runs server-side, `finds` reports every matching block's ordinal + preview, and the returned block window auto-centers on the first match — ONE findText call replaces a linear sweep of wide windows; never page through a large document hunting for a heading. For sequential reading, use windows: blockOffset/blockLimit return a contiguous slice of blocks (ordinals are absolute, so windows line up), and omitEmptyBlocks/dropTextPreview trim payload for a reading pass. Each list item carries a `runs` array of its inline segments {start,end,text, bold/italic/underline/strike?, fontFamily?, fontSize?, color?} BY DEFAULT, revealing the intra-item formatting pattern (e.g. first word plain, second italic) to reproduce via add_list_items `runs` — pass includeListItemRuns:false to omit it for a pure read. Table cells do NOT carry runs by default (tables can be large); pass includeTableCellRuns:true to attach the same per-run formatting to each cell when you need to match a table's cell styling. Body blocks likewise: pass includeBlockRuns:true (with a NARROW blockOffset/blockLimit window around the target) to attach per-run formatting to paragraphs, revealing a section's pattern (e.g. clauses with a bold '(m)' lead-in) to reproduce via insert_paragraphs styled texts.",
245
327
  inputSchema: {
246
328
  type: 'object',
247
329
  additionalProperties: false,
248
330
  properties: {
249
331
  countsOnly: { type: 'boolean' },
332
+ findText: { type: 'string' },
333
+ findLimit: { type: 'number', minimum: 1 },
250
334
  blockOffset: { type: 'number', minimum: 0 },
251
335
  blockLimit: { type: 'number', minimum: 1 },
252
336
  omitEmptyBlocks: { type: 'boolean' },
253
337
  dropTextPreview: { type: 'boolean' },
338
+ includeListItemRuns: { type: 'boolean' },
339
+ listItemRunsLimit: { type: 'number', minimum: 1 },
340
+ includeTableCellRuns: { type: 'boolean' },
341
+ tableCellRunsLimit: { type: 'number', minimum: 1 },
342
+ includeBlockRuns: { type: 'boolean' },
343
+ blockRunsLimit: { type: 'number', minimum: 1 },
254
344
  includeDomains: {
255
345
  type: 'array',
256
346
  items: {