@superdoc-dev/sdk 1.8.0-next.4 → 1.8.0-next.6
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.
- package/dist/generated/client.cjs +4 -0
- package/dist/generated/client.d.ts +84 -0
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +4 -0
- package/dist/generated/contract.cjs +802 -222
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +802 -222
- package/dist/generated/intent-dispatch.generated.cjs +5 -0
- package/dist/generated/intent-dispatch.generated.d.ts.map +1 -1
- package/dist/generated/intent-dispatch.generated.js +5 -0
- package/package.json +6 -6
- package/tools/__pycache__/__init__.cpython-312.pyc +0 -0
- package/tools/__pycache__/intent_dispatch_generated.cpython-312.pyc +0 -0
- package/tools/catalog.json +85 -4
- package/tools/intent_dispatch_generated.py +10 -0
- package/tools/prompt-templates/system-prompt-core.md +88 -0
- package/tools/system-prompt-mcp.md +88 -0
- package/tools/system-prompt.md +88 -0
- package/tools/tools-policy.json +1 -1
- package/tools/tools.anthropic.json +47 -4
- package/tools/tools.generic.json +53 -5
- package/tools/tools.openai.json +47 -4
- package/tools/tools.vercel.json +47 -4
|
@@ -53,10 +53,15 @@ function dispatchIntentTool(toolName, args, execute) {
|
|
|
53
53
|
switch (action) {
|
|
54
54
|
case 'insert': return execute('doc.lists.insert', rest);
|
|
55
55
|
case 'create': return execute('doc.lists.create', rest);
|
|
56
|
+
case 'attach': return execute('doc.lists.attach', rest);
|
|
56
57
|
case 'detach': return execute('doc.lists.detach', rest);
|
|
57
58
|
case 'indent': return execute('doc.lists.indent', rest);
|
|
58
59
|
case 'outdent': return execute('doc.lists.outdent', rest);
|
|
60
|
+
case 'merge': return execute('doc.lists.merge', rest);
|
|
61
|
+
case 'split': return execute('doc.lists.split', rest);
|
|
59
62
|
case 'set_level': return execute('doc.lists.setLevel', rest);
|
|
63
|
+
case 'set_value': return execute('doc.lists.setValue', rest);
|
|
64
|
+
case 'continue_previous': return execute('doc.lists.continuePrevious', rest);
|
|
60
65
|
case 'set_type': return execute('doc.lists.setType', rest);
|
|
61
66
|
default: throw new Error(`Unknown action for superdoc_list: ${action}`);
|
|
62
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent-dispatch.generated.d.ts","sourceRoot":"","sources":["../../src/generated/intent-dispatch.generated.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,GACxE,OAAO,
|
|
1
|
+
{"version":3,"file":"intent-dispatch.generated.d.ts","sourceRoot":"","sources":["../../src/generated/intent-dispatch.generated.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,GACxE,OAAO,CAiGT"}
|
|
@@ -51,10 +51,15 @@ export function dispatchIntentTool(toolName, args, execute) {
|
|
|
51
51
|
switch (action) {
|
|
52
52
|
case 'insert': return execute('doc.lists.insert', rest);
|
|
53
53
|
case 'create': return execute('doc.lists.create', rest);
|
|
54
|
+
case 'attach': return execute('doc.lists.attach', rest);
|
|
54
55
|
case 'detach': return execute('doc.lists.detach', rest);
|
|
55
56
|
case 'indent': return execute('doc.lists.indent', rest);
|
|
56
57
|
case 'outdent': return execute('doc.lists.outdent', rest);
|
|
58
|
+
case 'merge': return execute('doc.lists.merge', rest);
|
|
59
|
+
case 'split': return execute('doc.lists.split', rest);
|
|
57
60
|
case 'set_level': return execute('doc.lists.setLevel', rest);
|
|
61
|
+
case 'set_value': return execute('doc.lists.setValue', rest);
|
|
62
|
+
case 'continue_previous': return execute('doc.lists.continuePrevious', rest);
|
|
58
63
|
case 'set_type': return execute('doc.lists.setType', rest);
|
|
59
64
|
default: throw new Error(`Unknown action for superdoc_list: ${action}`);
|
|
60
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/sdk",
|
|
3
|
-
"version": "1.8.0-next.
|
|
3
|
+
"version": "1.8.0-next.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"typescript": "^5.9.2"
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@superdoc-dev/sdk-darwin-
|
|
30
|
-
"@superdoc-dev/sdk-linux-x64": "1.8.0-next.
|
|
31
|
-
"@superdoc-dev/sdk-
|
|
32
|
-
"@superdoc-dev/sdk-
|
|
33
|
-
"@superdoc-dev/sdk-
|
|
29
|
+
"@superdoc-dev/sdk-darwin-x64": "1.8.0-next.6",
|
|
30
|
+
"@superdoc-dev/sdk-linux-x64": "1.8.0-next.6",
|
|
31
|
+
"@superdoc-dev/sdk-darwin-arm64": "1.8.0-next.6",
|
|
32
|
+
"@superdoc-dev/sdk-linux-arm64": "1.8.0-next.6",
|
|
33
|
+
"@superdoc-dev/sdk-windows-x64": "1.8.0-next.6"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
Binary file
|
|
Binary file
|
package/tools/catalog.json
CHANGED
|
@@ -1268,22 +1268,27 @@
|
|
|
1268
1268
|
},
|
|
1269
1269
|
{
|
|
1270
1270
|
"toolName": "superdoc_list",
|
|
1271
|
-
"description": "Create and manipulate bullet and numbered lists.
|
|
1271
|
+
"description": "Create and manipulate bullet and numbered lists. Most actions require a list-item target: {kind:\"block\", nodeType:\"listItem\", nodeId:\"<id>\"}. Exceptions: \"create\" and \"attach\" operate on paragraph targets (they turn paragraphs into list items). Find nodeIds via superdoc_get_content({action:\"blocks\"}) — pick listItem blocks for most actions, paragraph blocks for create/attach.\n\nCREATE & CONVERT:\n• \"create\" — make a NEW list from paragraphs. Two modes: mode:\"empty\" with at:{kind:\"block\", nodeType:\"paragraph\", nodeId} converts a single paragraph; mode:\"fromParagraphs\" with target:{from:{...paragraph block address}, to:{...paragraph block address}} converts a range — ALL paragraphs between from and to become items, so make sure no other content sits between them. Pass a preset (\"disc\"|\"circle\"|\"square\"|\"dash\" for bullets; \"decimal\"|\"decimalParenthesis\"|\"lowerLetter\"|\"upperLetter\"|\"lowerRoman\"|\"upperRoman\" for ordered) or a custom style. Use \"create\" to start a fresh list — NOT to extend an existing one (use \"attach\" for that).\n• \"attach\" — add paragraphs to an EXISTING list, inheriting its numbering definition. Pass target:{paragraph block address} (or {from, to} range of paragraphs) + attachTo:{kind:\"block\", nodeType:\"listItem\", nodeId:\"<any item in destination list>\"} + optional level:0..8. Use this to extend a list or as the second half of a merge workflow (see \"join\" below).\n• \"set_type\" — convert an existing list between ordered and bullet. Pass target:{listItem} + kind:\"ordered\" or \"bullet\". Adjacent compatible sequences are merged automatically to preserve continuous numbering.\n• \"detach\" — convert a list item back to a plain paragraph. Pass target:{listItem}.\n\nITEMS & NESTING:\n• \"insert\" — add a new list item adjacent to an existing item in the same list. Pass target:{listItem} + position:\"before\"|\"after\" + optional text. Use this (NOT superdoc_create) to add items to an existing list.\n• \"indent\" / \"outdent\" — bump the target item's nesting level by one (0-8 range). Pass target:{listItem}.\n• \"set_level\" — jump the target item to an explicit level. Pass target:{listItem} + level:0..8.\n\nNUMBERING (ordered lists):\n• \"set_value\" — restart numbering at the target. Pass target:{listItem} + value:<number> (e.g. value:1 to start over) or value:null to clear a previous override. Mid-sequence targets are atomically split off into their own sequence.\n• \"continue_previous\" — make the target's sequence continue numbering from the nearest compatible previous sequence (same abstract definition). Pass target:{listItem of the sequence you want to renumber}. Fails with NO_COMPATIBLE_PREVIOUS or INCOMPATIBLE_DEFINITIONS if no matching prior sequence exists.\n\nSEQUENCE SHAPE (merge / split):\n• \"merge\" — merge the target's sequence with an adjacent one into one continuous list. Pass target:{listItem} + direction:\"withPrevious\" or \"withNext\". Absorbed items adopt the absorbing sequence's numbering definition, and empty paragraphs between the two sequences are removed so numbering flows continuously.\n• \"split\" — split the target's sequence at the target item into two independent lists. The target and everything after become a new sequence that restarts numbering at 1. Pass target:{listItem}; add restartNumbering:false to keep the count continuing instead of restarting.",
|
|
1272
1272
|
"inputSchema": {
|
|
1273
1273
|
"type": "object",
|
|
1274
1274
|
"properties": {
|
|
1275
1275
|
"action": {
|
|
1276
1276
|
"type": "string",
|
|
1277
1277
|
"enum": [
|
|
1278
|
+
"attach",
|
|
1279
|
+
"continue_previous",
|
|
1278
1280
|
"create",
|
|
1279
1281
|
"detach",
|
|
1280
1282
|
"indent",
|
|
1281
1283
|
"insert",
|
|
1284
|
+
"merge",
|
|
1282
1285
|
"outdent",
|
|
1283
1286
|
"set_level",
|
|
1284
|
-
"set_type"
|
|
1287
|
+
"set_type",
|
|
1288
|
+
"set_value",
|
|
1289
|
+
"split"
|
|
1285
1290
|
],
|
|
1286
|
-
"description": "The action to perform. One of: create, detach, indent, insert, outdent, set_level, set_type."
|
|
1291
|
+
"description": "The action to perform. One of: attach, continue_previous, create, detach, indent, insert, merge, outdent, set_level, set_type, set_value, split."
|
|
1287
1292
|
},
|
|
1288
1293
|
"force": {
|
|
1289
1294
|
"type": "boolean",
|
|
@@ -1321,7 +1326,7 @@
|
|
|
1321
1326
|
"nodeType",
|
|
1322
1327
|
"nodeId"
|
|
1323
1328
|
],
|
|
1324
|
-
"description": "The target list item. For 'insert': the item to insert relative to. For 'create' with mode 'fromParagraphs': use nodeType 'paragraph' instead. Format: {kind:'block', nodeType:'listItem', nodeId:'<id>'}. Required for actions 'insert', 'detach', 'indent', 'outdent', 'set_level', 'set_type'."
|
|
1329
|
+
"description": "The target list item. For 'insert': the item to insert relative to. For 'create' with mode 'fromParagraphs': use nodeType 'paragraph' instead. Format: {kind:'block', nodeType:'listItem', nodeId:'<id>'}. Required for actions 'insert', 'attach', 'detach', 'indent', 'outdent', 'merge', 'split', 'set_level', 'set_value', 'continue_previous', 'set_type'."
|
|
1325
1330
|
},
|
|
1326
1331
|
"position": {
|
|
1327
1332
|
"type": "string",
|
|
@@ -1505,6 +1510,44 @@
|
|
|
1505
1510
|
],
|
|
1506
1511
|
"description": "Only for action 'create'. Omit for other actions."
|
|
1507
1512
|
},
|
|
1513
|
+
"attachTo": {
|
|
1514
|
+
"type": "object",
|
|
1515
|
+
"properties": {
|
|
1516
|
+
"kind": {
|
|
1517
|
+
"const": "block",
|
|
1518
|
+
"type": "string"
|
|
1519
|
+
},
|
|
1520
|
+
"nodeType": {
|
|
1521
|
+
"const": "listItem",
|
|
1522
|
+
"type": "string"
|
|
1523
|
+
},
|
|
1524
|
+
"nodeId": {
|
|
1525
|
+
"type": "string"
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
"required": [
|
|
1529
|
+
"kind",
|
|
1530
|
+
"nodeType",
|
|
1531
|
+
"nodeId"
|
|
1532
|
+
],
|
|
1533
|
+
"description": "Required for action 'attach'."
|
|
1534
|
+
},
|
|
1535
|
+
"direction": {
|
|
1536
|
+
"type": "string",
|
|
1537
|
+
"enum": [
|
|
1538
|
+
"withPrevious",
|
|
1539
|
+
"withNext"
|
|
1540
|
+
],
|
|
1541
|
+
"description": "Required for action 'merge'."
|
|
1542
|
+
},
|
|
1543
|
+
"restartNumbering": {
|
|
1544
|
+
"type": "boolean",
|
|
1545
|
+
"description": "Only for action 'split'. Omit for other actions."
|
|
1546
|
+
},
|
|
1547
|
+
"value": {
|
|
1548
|
+
"type": "object",
|
|
1549
|
+
"description": "Required for action 'set_value'."
|
|
1550
|
+
},
|
|
1508
1551
|
"continuity": {
|
|
1509
1552
|
"type": "string",
|
|
1510
1553
|
"description": "Numbering continuity: 'preserve' keeps numbering; 'none' restarts. Only for action 'set_type'. Omit for other actions.",
|
|
@@ -1536,6 +1579,14 @@
|
|
|
1536
1579
|
"mode"
|
|
1537
1580
|
]
|
|
1538
1581
|
},
|
|
1582
|
+
{
|
|
1583
|
+
"operationId": "doc.lists.attach",
|
|
1584
|
+
"intentAction": "attach",
|
|
1585
|
+
"required": [
|
|
1586
|
+
"target",
|
|
1587
|
+
"attachTo"
|
|
1588
|
+
]
|
|
1589
|
+
},
|
|
1539
1590
|
{
|
|
1540
1591
|
"operationId": "doc.lists.detach",
|
|
1541
1592
|
"intentAction": "detach",
|
|
@@ -1557,6 +1608,21 @@
|
|
|
1557
1608
|
"target"
|
|
1558
1609
|
]
|
|
1559
1610
|
},
|
|
1611
|
+
{
|
|
1612
|
+
"operationId": "doc.lists.merge",
|
|
1613
|
+
"intentAction": "merge",
|
|
1614
|
+
"required": [
|
|
1615
|
+
"target",
|
|
1616
|
+
"direction"
|
|
1617
|
+
]
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
"operationId": "doc.lists.split",
|
|
1621
|
+
"intentAction": "split",
|
|
1622
|
+
"required": [
|
|
1623
|
+
"target"
|
|
1624
|
+
]
|
|
1625
|
+
},
|
|
1560
1626
|
{
|
|
1561
1627
|
"operationId": "doc.lists.setLevel",
|
|
1562
1628
|
"intentAction": "set_level",
|
|
@@ -1565,6 +1631,21 @@
|
|
|
1565
1631
|
"level"
|
|
1566
1632
|
]
|
|
1567
1633
|
},
|
|
1634
|
+
{
|
|
1635
|
+
"operationId": "doc.lists.setValue",
|
|
1636
|
+
"intentAction": "set_value",
|
|
1637
|
+
"required": [
|
|
1638
|
+
"target",
|
|
1639
|
+
"value"
|
|
1640
|
+
]
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
"operationId": "doc.lists.continuePrevious",
|
|
1644
|
+
"intentAction": "continue_previous",
|
|
1645
|
+
"required": [
|
|
1646
|
+
"target"
|
|
1647
|
+
]
|
|
1648
|
+
},
|
|
1568
1649
|
{
|
|
1569
1650
|
"operationId": "doc.lists.setType",
|
|
1570
1651
|
"intentAction": "set_type",
|
|
@@ -79,14 +79,24 @@ def dispatch_intent_tool(
|
|
|
79
79
|
return execute('doc.lists.insert', rest)
|
|
80
80
|
elif action == 'create':
|
|
81
81
|
return execute('doc.lists.create', rest)
|
|
82
|
+
elif action == 'attach':
|
|
83
|
+
return execute('doc.lists.attach', rest)
|
|
82
84
|
elif action == 'detach':
|
|
83
85
|
return execute('doc.lists.detach', rest)
|
|
84
86
|
elif action == 'indent':
|
|
85
87
|
return execute('doc.lists.indent', rest)
|
|
86
88
|
elif action == 'outdent':
|
|
87
89
|
return execute('doc.lists.outdent', rest)
|
|
90
|
+
elif action == 'merge':
|
|
91
|
+
return execute('doc.lists.merge', rest)
|
|
92
|
+
elif action == 'split':
|
|
93
|
+
return execute('doc.lists.split', rest)
|
|
88
94
|
elif action == 'set_level':
|
|
89
95
|
return execute('doc.lists.setLevel', rest)
|
|
96
|
+
elif action == 'set_value':
|
|
97
|
+
return execute('doc.lists.setValue', rest)
|
|
98
|
+
elif action == 'continue_previous':
|
|
99
|
+
return execute('doc.lists.continuePrevious', rest)
|
|
90
100
|
elif action == 'set_type':
|
|
91
101
|
return execute('doc.lists.setType', rest)
|
|
92
102
|
else:
|
|
@@ -160,6 +160,94 @@ Use preset "disc" for bullets, "decimal" for numbered. WARNING: the range conver
|
|
|
160
160
|
|
|
161
161
|
3. To change a bullet list to numbered: `superdoc_list({action: "set_type", target: {kind: "block", nodeType: "listItem", nodeId: "<anyItemId>"}, kind: "ordered"})`
|
|
162
162
|
|
|
163
|
+
### Add items to an existing list
|
|
164
|
+
|
|
165
|
+
To add a new item adjacent to an existing list item, use `superdoc_list({action: "insert"})`, NOT `superdoc_create({action: "paragraph"})` — the latter creates a standalone paragraph that is not part of the list:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
superdoc_get_content({action: "blocks"}) // find the listItem nodeId you want to insert next to
|
|
169
|
+
superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, position: "after", text: "New item text"})
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Level inheritance.** The new item inherits the target's nesting level. Insert after a level-0 item → new item is level 0. Insert after a level-2 item → new item is level 2. To change the level, chain `indent` / `outdent` / `set_level` on the nodeId returned in the insert response.
|
|
173
|
+
|
|
174
|
+
**Use the nodeId from the response directly.** `superdoc_list({action: "insert"})` returns `{item: {nodeId: "<id>"}}` — that id is ready for subsequent `indent`, `outdent`, `set_level`, or text edits. You do NOT need to re-fetch blocks between the insert and the follow-up operation.
|
|
175
|
+
|
|
176
|
+
### Add a sub-point under an existing item
|
|
177
|
+
|
|
178
|
+
Insert a peer, then indent it one level:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
// 1. Insert a peer item after the parent — new item is at the parent's level
|
|
182
|
+
const resp = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<parentItemId>"}, position: "after", text: "Sub-point"})
|
|
183
|
+
|
|
184
|
+
// 2. Indent using the nodeId from resp.item.nodeId
|
|
185
|
+
superdoc_list({action: "indent", target: {kind: "block", nodeType: "listItem", nodeId: "<resp.item.nodeId>"}})
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Build a nested list with mixed levels
|
|
189
|
+
|
|
190
|
+
`lists.create` produces a flat list. Add nesting by chaining `insert` + `indent` / `set_level`, using the nodeId returned by each insert to target the next step:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
// Starting point: a list item at level 0 ("Parent" with nodeId <parent>)
|
|
194
|
+
|
|
195
|
+
// Sibling at level 0
|
|
196
|
+
const r1 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<parent>"}, position: "after", text: "Sibling"})
|
|
197
|
+
|
|
198
|
+
// Child at level 1 (insert after r1, then indent)
|
|
199
|
+
const r2 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<r1.item.nodeId>"}, position: "after", text: "Child"})
|
|
200
|
+
superdoc_list({action: "indent", target: {kind: "block", nodeType: "listItem", nodeId: "<r2.item.nodeId>"}})
|
|
201
|
+
|
|
202
|
+
// Grandchild at level 3 (insert after r2, then jump to level 3 directly)
|
|
203
|
+
const r3 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<r2.item.nodeId>"}, position: "after", text: "Deep"})
|
|
204
|
+
superdoc_list({action: "set_level", target: {kind: "block", nodeType: "listItem", nodeId: "<r3.item.nodeId>"}, level: 3})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`indent` bumps the level by one (bounded 0–8). `set_level` jumps directly to any level 0–8. Markers update automatically based on the list's definition for each level (e.g. `1.` / `a.` / `i.` for an ordered list).
|
|
208
|
+
|
|
209
|
+
### Merge two adjacent lists into one
|
|
210
|
+
|
|
211
|
+
Use `merge` — it handles the common case where two ordered or bulleted lists sit next to each other and should become one continuous list. Absorbed items adopt the absorbing sequence's definition, and any empty paragraphs between the two lists are removed so numbering flows continuously.
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
superdoc_get_content({action: "blocks"}) // find a listItem in either sequence
|
|
215
|
+
// To merge with the previous sequence:
|
|
216
|
+
superdoc_list({action: "merge", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, direction: "withPrevious"})
|
|
217
|
+
// Or with the next sequence:
|
|
218
|
+
superdoc_list({action: "merge", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, direction: "withNext"})
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Split a list into two
|
|
222
|
+
|
|
223
|
+
Use `split` to break one list into two independent lists at a specific item. The target and everything after become a new sequence that restarts numbering at 1:
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
superdoc_list({action: "split", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}})
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Pass `restartNumbering: false` if you want the new half to keep counting from where the original left off.
|
|
230
|
+
|
|
231
|
+
### Restart numbering at a specific item
|
|
232
|
+
|
|
233
|
+
For ordered lists. To make item N restart from a chosen number (commonly 1):
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
superdoc_list({action: "set_value", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, value: 1})
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Pass `value: null` to clear a previously-set restart override and let the item resume natural numbering.
|
|
240
|
+
|
|
241
|
+
### Continue numbering across a break
|
|
242
|
+
|
|
243
|
+
For ordered lists. When two sibling sequences should be numbered as one (e.g. numbering jumps back to 1 and you want it to continue from where the previous list left off), target the FIRST item of the second sequence:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
superdoc_list({action: "continue_previous", target: {kind: "block", nodeType: "listItem", nodeId: "<firstItemOfSecondList>"}})
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Fails with `NO_COMPATIBLE_PREVIOUS` or `INCOMPATIBLE_DEFINITIONS` if no prior sequence shares the same abstract definition. In that case, use `merge` instead — it handles mismatched definitions, removes empty gap paragraphs, and produces one continuous list.
|
|
250
|
+
|
|
163
251
|
### Insert content into a document (new or existing)
|
|
164
252
|
|
|
165
253
|
Markdown insert creates block structure but uses default formatting. You MUST follow up with formatting so inserted content looks like it belongs in the document.
|
|
@@ -209,6 +209,94 @@ Use preset "disc" for bullets, "decimal" for numbered. WARNING: the range conver
|
|
|
209
209
|
|
|
210
210
|
3. To change a bullet list to numbered: `superdoc_list({action: "set_type", target: {kind: "block", nodeType: "listItem", nodeId: "<anyItemId>"}, kind: "ordered"})`
|
|
211
211
|
|
|
212
|
+
### Add items to an existing list
|
|
213
|
+
|
|
214
|
+
To add a new item adjacent to an existing list item, use `superdoc_list({action: "insert"})`, NOT `superdoc_create({action: "paragraph"})` — the latter creates a standalone paragraph that is not part of the list:
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
superdoc_get_content({action: "blocks"}) // find the listItem nodeId you want to insert next to
|
|
218
|
+
superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, position: "after", text: "New item text"})
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Level inheritance.** The new item inherits the target's nesting level. Insert after a level-0 item → new item is level 0. Insert after a level-2 item → new item is level 2. To change the level, chain `indent` / `outdent` / `set_level` on the nodeId returned in the insert response.
|
|
222
|
+
|
|
223
|
+
**Use the nodeId from the response directly.** `superdoc_list({action: "insert"})` returns `{item: {nodeId: "<id>"}}` — that id is ready for subsequent `indent`, `outdent`, `set_level`, or text edits. You do NOT need to re-fetch blocks between the insert and the follow-up operation.
|
|
224
|
+
|
|
225
|
+
### Add a sub-point under an existing item
|
|
226
|
+
|
|
227
|
+
Insert a peer, then indent it one level:
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
// 1. Insert a peer item after the parent — new item is at the parent's level
|
|
231
|
+
const resp = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<parentItemId>"}, position: "after", text: "Sub-point"})
|
|
232
|
+
|
|
233
|
+
// 2. Indent using the nodeId from resp.item.nodeId
|
|
234
|
+
superdoc_list({action: "indent", target: {kind: "block", nodeType: "listItem", nodeId: "<resp.item.nodeId>"}})
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Build a nested list with mixed levels
|
|
238
|
+
|
|
239
|
+
`lists.create` produces a flat list. Add nesting by chaining `insert` + `indent` / `set_level`, using the nodeId returned by each insert to target the next step:
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
// Starting point: a list item at level 0 ("Parent" with nodeId <parent>)
|
|
243
|
+
|
|
244
|
+
// Sibling at level 0
|
|
245
|
+
const r1 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<parent>"}, position: "after", text: "Sibling"})
|
|
246
|
+
|
|
247
|
+
// Child at level 1 (insert after r1, then indent)
|
|
248
|
+
const r2 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<r1.item.nodeId>"}, position: "after", text: "Child"})
|
|
249
|
+
superdoc_list({action: "indent", target: {kind: "block", nodeType: "listItem", nodeId: "<r2.item.nodeId>"}})
|
|
250
|
+
|
|
251
|
+
// Grandchild at level 3 (insert after r2, then jump to level 3 directly)
|
|
252
|
+
const r3 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<r2.item.nodeId>"}, position: "after", text: "Deep"})
|
|
253
|
+
superdoc_list({action: "set_level", target: {kind: "block", nodeType: "listItem", nodeId: "<r3.item.nodeId>"}, level: 3})
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`indent` bumps the level by one (bounded 0–8). `set_level` jumps directly to any level 0–8. Markers update automatically based on the list's definition for each level (e.g. `1.` / `a.` / `i.` for an ordered list).
|
|
257
|
+
|
|
258
|
+
### Merge two adjacent lists into one
|
|
259
|
+
|
|
260
|
+
Use `merge` — it handles the common case where two ordered or bulleted lists sit next to each other and should become one continuous list. Absorbed items adopt the absorbing sequence's definition, and any empty paragraphs between the two lists are removed so numbering flows continuously.
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
superdoc_get_content({action: "blocks"}) // find a listItem in either sequence
|
|
264
|
+
// To merge with the previous sequence:
|
|
265
|
+
superdoc_list({action: "merge", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, direction: "withPrevious"})
|
|
266
|
+
// Or with the next sequence:
|
|
267
|
+
superdoc_list({action: "merge", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, direction: "withNext"})
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Split a list into two
|
|
271
|
+
|
|
272
|
+
Use `split` to break one list into two independent lists at a specific item. The target and everything after become a new sequence that restarts numbering at 1:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
superdoc_list({action: "split", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Pass `restartNumbering: false` if you want the new half to keep counting from where the original left off.
|
|
279
|
+
|
|
280
|
+
### Restart numbering at a specific item
|
|
281
|
+
|
|
282
|
+
For ordered lists. To make item N restart from a chosen number (commonly 1):
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
superdoc_list({action: "set_value", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, value: 1})
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Pass `value: null` to clear a previously-set restart override and let the item resume natural numbering.
|
|
289
|
+
|
|
290
|
+
### Continue numbering across a break
|
|
291
|
+
|
|
292
|
+
For ordered lists. When two sibling sequences should be numbered as one (e.g. numbering jumps back to 1 and you want it to continue from where the previous list left off), target the FIRST item of the second sequence:
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
superdoc_list({action: "continue_previous", target: {kind: "block", nodeType: "listItem", nodeId: "<firstItemOfSecondList>"}})
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Fails with `NO_COMPATIBLE_PREVIOUS` or `INCOMPATIBLE_DEFINITIONS` if no prior sequence shares the same abstract definition. In that case, use `merge` instead — it handles mismatched definitions, removes empty gap paragraphs, and produces one continuous list.
|
|
299
|
+
|
|
212
300
|
### Insert content into a document (new or existing)
|
|
213
301
|
|
|
214
302
|
Markdown insert creates block structure but uses default formatting. You MUST follow up with formatting so inserted content looks like it belongs in the document.
|
package/tools/system-prompt.md
CHANGED
|
@@ -164,6 +164,94 @@ Use preset "disc" for bullets, "decimal" for numbered. WARNING: the range conver
|
|
|
164
164
|
|
|
165
165
|
3. To change a bullet list to numbered: `superdoc_list({action: "set_type", target: {kind: "block", nodeType: "listItem", nodeId: "<anyItemId>"}, kind: "ordered"})`
|
|
166
166
|
|
|
167
|
+
### Add items to an existing list
|
|
168
|
+
|
|
169
|
+
To add a new item adjacent to an existing list item, use `superdoc_list({action: "insert"})`, NOT `superdoc_create({action: "paragraph"})` — the latter creates a standalone paragraph that is not part of the list:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
superdoc_get_content({action: "blocks"}) // find the listItem nodeId you want to insert next to
|
|
173
|
+
superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, position: "after", text: "New item text"})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Level inheritance.** The new item inherits the target's nesting level. Insert after a level-0 item → new item is level 0. Insert after a level-2 item → new item is level 2. To change the level, chain `indent` / `outdent` / `set_level` on the nodeId returned in the insert response.
|
|
177
|
+
|
|
178
|
+
**Use the nodeId from the response directly.** `superdoc_list({action: "insert"})` returns `{item: {nodeId: "<id>"}}` — that id is ready for subsequent `indent`, `outdent`, `set_level`, or text edits. You do NOT need to re-fetch blocks between the insert and the follow-up operation.
|
|
179
|
+
|
|
180
|
+
### Add a sub-point under an existing item
|
|
181
|
+
|
|
182
|
+
Insert a peer, then indent it one level:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
// 1. Insert a peer item after the parent — new item is at the parent's level
|
|
186
|
+
const resp = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<parentItemId>"}, position: "after", text: "Sub-point"})
|
|
187
|
+
|
|
188
|
+
// 2. Indent using the nodeId from resp.item.nodeId
|
|
189
|
+
superdoc_list({action: "indent", target: {kind: "block", nodeType: "listItem", nodeId: "<resp.item.nodeId>"}})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Build a nested list with mixed levels
|
|
193
|
+
|
|
194
|
+
`lists.create` produces a flat list. Add nesting by chaining `insert` + `indent` / `set_level`, using the nodeId returned by each insert to target the next step:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
// Starting point: a list item at level 0 ("Parent" with nodeId <parent>)
|
|
198
|
+
|
|
199
|
+
// Sibling at level 0
|
|
200
|
+
const r1 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<parent>"}, position: "after", text: "Sibling"})
|
|
201
|
+
|
|
202
|
+
// Child at level 1 (insert after r1, then indent)
|
|
203
|
+
const r2 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<r1.item.nodeId>"}, position: "after", text: "Child"})
|
|
204
|
+
superdoc_list({action: "indent", target: {kind: "block", nodeType: "listItem", nodeId: "<r2.item.nodeId>"}})
|
|
205
|
+
|
|
206
|
+
// Grandchild at level 3 (insert after r2, then jump to level 3 directly)
|
|
207
|
+
const r3 = superdoc_list({action: "insert", target: {kind: "block", nodeType: "listItem", nodeId: "<r2.item.nodeId>"}, position: "after", text: "Deep"})
|
|
208
|
+
superdoc_list({action: "set_level", target: {kind: "block", nodeType: "listItem", nodeId: "<r3.item.nodeId>"}, level: 3})
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`indent` bumps the level by one (bounded 0–8). `set_level` jumps directly to any level 0–8. Markers update automatically based on the list's definition for each level (e.g. `1.` / `a.` / `i.` for an ordered list).
|
|
212
|
+
|
|
213
|
+
### Merge two adjacent lists into one
|
|
214
|
+
|
|
215
|
+
Use `merge` — it handles the common case where two ordered or bulleted lists sit next to each other and should become one continuous list. Absorbed items adopt the absorbing sequence's definition, and any empty paragraphs between the two lists are removed so numbering flows continuously.
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
superdoc_get_content({action: "blocks"}) // find a listItem in either sequence
|
|
219
|
+
// To merge with the previous sequence:
|
|
220
|
+
superdoc_list({action: "merge", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, direction: "withPrevious"})
|
|
221
|
+
// Or with the next sequence:
|
|
222
|
+
superdoc_list({action: "merge", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, direction: "withNext"})
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Split a list into two
|
|
226
|
+
|
|
227
|
+
Use `split` to break one list into two independent lists at a specific item. The target and everything after become a new sequence that restarts numbering at 1:
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
superdoc_list({action: "split", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}})
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Pass `restartNumbering: false` if you want the new half to keep counting from where the original left off.
|
|
234
|
+
|
|
235
|
+
### Restart numbering at a specific item
|
|
236
|
+
|
|
237
|
+
For ordered lists. To make item N restart from a chosen number (commonly 1):
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
superdoc_list({action: "set_value", target: {kind: "block", nodeType: "listItem", nodeId: "<itemId>"}, value: 1})
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Pass `value: null` to clear a previously-set restart override and let the item resume natural numbering.
|
|
244
|
+
|
|
245
|
+
### Continue numbering across a break
|
|
246
|
+
|
|
247
|
+
For ordered lists. When two sibling sequences should be numbered as one (e.g. numbering jumps back to 1 and you want it to continue from where the previous list left off), target the FIRST item of the second sequence:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
superdoc_list({action: "continue_previous", target: {kind: "block", nodeType: "listItem", nodeId: "<firstItemOfSecondList>"}})
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Fails with `NO_COMPATIBLE_PREVIOUS` or `INCOMPATIBLE_DEFINITIONS` if no prior sequence shares the same abstract definition. In that case, use `merge` instead — it handles mismatched definitions, removes empty gap paragraphs, and produces one continuous list.
|
|
254
|
+
|
|
167
255
|
### Insert content into a document (new or existing)
|
|
168
256
|
|
|
169
257
|
Markdown insert creates block structure but uses default formatting. You MUST follow up with formatting so inserted content looks like it belongs in the document.
|
package/tools/tools-policy.json
CHANGED