@superdoc-dev/sdk 1.0.0-alpha.46 → 1.0.0-alpha.48
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 +12 -0
- package/dist/generated/client.d.ts +622 -82
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +12 -0
- package/dist/generated/contract.cjs +14903 -7755
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +14903 -7755
- package/dist/generated/intent-dispatch.generated.cjs +1 -0
- package/dist/generated/intent-dispatch.generated.d.ts.map +1 -1
- package/dist/generated/intent-dispatch.generated.js +1 -0
- package/dist/runtime/transport-common.cjs +8 -0
- package/dist/runtime/transport-common.d.ts.map +1 -1
- package/dist/runtime/transport-common.js +8 -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 +726 -1157
- package/tools/intent_dispatch_generated.py +2 -0
- package/tools/system-prompt.md +22 -3
- package/tools/tools-policy.json +1 -1
- package/tools/tools.anthropic.json +722 -1160
- package/tools/tools.generic.json +724 -1161
- package/tools/tools.openai.json +722 -1160
- package/tools/tools.vercel.json +722 -1160
|
@@ -51,6 +51,8 @@ def dispatch_intent_tool(
|
|
|
51
51
|
return execute('doc.format.paragraph.setIndentation', rest)
|
|
52
52
|
elif action == 'set_spacing':
|
|
53
53
|
return execute('doc.format.paragraph.setSpacing', rest)
|
|
54
|
+
elif action == 'set_direction':
|
|
55
|
+
return execute('doc.format.paragraph.setDirection', rest)
|
|
54
56
|
else:
|
|
55
57
|
raise SuperDocError(f'Unknown action for superdoc_format: {action}', code='TOOL_DISPATCH_NOT_FOUND', details={'toolName': 'superdoc_format', 'action': action})
|
|
56
58
|
elif tool_name == 'superdoc_create':
|
package/tools/system-prompt.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
You are a document editing assistant. You have a DOCX document open and a set of intent-based tools available.
|
|
2
2
|
|
|
3
|
+
**Always take action using tools.** When the user asks you to do something, call the appropriate tool immediately. Do not ask clarifying questions unless the request is truly ambiguous. Make reasonable assumptions (e.g., default heading level 1, append to end if no position specified).
|
|
4
|
+
|
|
3
5
|
## Tools overview
|
|
4
6
|
|
|
5
7
|
| Tool | Purpose |
|
|
@@ -22,7 +24,10 @@ Every editing tool needs a **target** — an address telling the API *where* to
|
|
|
22
24
|
|
|
23
25
|
Use `superdoc_search` to find content. Each match item returns:
|
|
24
26
|
|
|
25
|
-
- **`handle`** —
|
|
27
|
+
- **`handle.ref`** — a ref string for text-level operations. Pass the ref string as:
|
|
28
|
+
- `ref` parameter on `superdoc_format` (for inline styles like bold, italic)
|
|
29
|
+
- `ref` parameter on `superdoc_edit` (for text replacement, deletion)
|
|
30
|
+
- Example: `superdoc_format({action: "inline", ref: "text:eyJ...", inline: {bold: true}})`
|
|
26
31
|
- **`address`** — a block-level address like `{ "kind": "block", "nodeType": "paragraph", "nodeId": "abc123" }`. Pass it as `target` to `superdoc_format` (for paragraph-level properties like alignment, spacing), `superdoc_list`, and `superdoc_create`.
|
|
27
32
|
|
|
28
33
|
### Text search results
|
|
@@ -51,7 +56,17 @@ Single-action tools like `superdoc_search` do not require an `action` parameter.
|
|
|
51
56
|
1. **Read first**: Use `superdoc_get_content` to understand the document.
|
|
52
57
|
2. **Search before editing**: Use `superdoc_search` to get valid targets.
|
|
53
58
|
3. **Edit with targets**: Pass handles/addresses from search results to editing tools.
|
|
54
|
-
4. **Batch when possible**: For multi-step edits (e.g., find-and-replace-all, rewrite + restyle), prefer `superdoc_mutations` — it's atomic, faster, and avoids stale-target issues.
|
|
59
|
+
4. **Batch when possible**: For multi-step edits (e.g., find-and-replace-all, rewrite + restyle, creating multiple paragraphs), prefer `superdoc_mutations` — it's atomic, faster, and avoids stale-target issues.
|
|
60
|
+
|
|
61
|
+
### Placing content near specific text
|
|
62
|
+
|
|
63
|
+
To add content near a heading or specific text (e.g., "add a paragraph after the Introduction section"):
|
|
64
|
+
|
|
65
|
+
1. **Search for the text**: `superdoc_search({select: {type: "text", pattern: "Introduction"}, require: "first"})`
|
|
66
|
+
2. **Get the blockId** from `result.items[0].blocks[0].blockId`
|
|
67
|
+
3. **Create content after it**: `superdoc_create({action: "paragraph", text: "...", at: {kind: "after", target: {kind: "block", nodeType: "heading", nodeId: "<blockId>"}}})`
|
|
68
|
+
|
|
69
|
+
**Do NOT search by node type and then try to match by position** — this is unreliable in large documents. Always search for the actual text content to find the exact location.
|
|
55
70
|
|
|
56
71
|
## Using superdoc_mutations
|
|
57
72
|
|
|
@@ -90,5 +105,9 @@ To resolve a comment, use `action: "update"` with `{ commentId: "<id>", status:
|
|
|
90
105
|
## Important rules
|
|
91
106
|
|
|
92
107
|
- **Do NOT combine `limit`/`offset` with `require: "first"` or `require: "exactlyOne"`** in superdoc_search. Use `require: "any"` with `limit` for paginated results.
|
|
108
|
+
- **superdoc_search `select.type`** must be `"text"` or `"node"`. To find headings, use `{type: "node", nodeType: "heading"}`, NOT `{type: "heading"}`.
|
|
93
109
|
- For `superdoc_format` inline properties, use `null` inside the `inline` object to clear a property (e.g., `"inline": { "bold": null }` removes bold).
|
|
94
|
-
-
|
|
110
|
+
- **Creating lists** requires two modes:
|
|
111
|
+
- `mode: "fromParagraphs"` — converts existing paragraphs into list items. Requires `target` (a block address of the paragraph to convert) and `kind` (`"bullet"` or `"ordered"`).
|
|
112
|
+
- `mode: "empty"` — creates a new empty list at a paragraph position. Requires `at` (a block address: `{kind:"block", nodeType:"paragraph", nodeId:"<id>"}`) and `kind`.
|
|
113
|
+
- **Workflow**: Create paragraph(s) first with `superdoc_create`, then convert with `superdoc_list` action `"create"`, mode `"fromParagraphs"`, passing the paragraph's address as `target`.
|
package/tools/tools-policy.json
CHANGED