@superdoc-dev/sdk 1.0.0-alpha.43 → 1.0.0-alpha.45

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/README.md CHANGED
@@ -91,29 +91,39 @@ client.doc.insert(params)
91
91
 
92
92
  ### AI Tool Integration
93
93
 
94
- The SDK includes built-in support for exposing document operations as AI tool definitions:
94
+ The SDK includes built-in support for exposing grouped intent tools as AI tool definitions:
95
95
 
96
96
  ```ts
97
- import { chooseTools, dispatchSuperDocTool } from '@superdoc-dev/sdk';
98
-
99
- // Get tool definitions for your AI provider, filtered by group
100
- const { tools, selected } = await chooseTools({
97
+ import {
98
+ chooseTools,
99
+ dispatchSuperDocTool,
100
+ getToolCatalog,
101
+ } from '@superdoc-dev/sdk';
102
+
103
+ // Get the full grouped tool set for your AI provider
104
+ const { tools, meta } = await chooseTools({
101
105
  provider: 'openai', // 'openai' | 'anthropic' | 'vercel' | 'generic'
102
- groups: ['core', 'format', 'comments'], // core is always auto-included
103
106
  });
104
107
 
108
+ // Optional: inspect the generated tool catalog
109
+ const catalog = await getToolCatalog();
110
+
105
111
  // Dispatch a tool call from the AI model
106
112
  const result = await dispatchSuperDocTool(client, toolName, args);
107
113
  ```
108
114
 
115
+ The current catalog contains 9 grouped tools:
116
+ `superdoc_get_content`, `superdoc_edit`, `superdoc_format`, `superdoc_create`, `superdoc_list`, `superdoc_comment`, `superdoc_track_changes`, `superdoc_search`, and `superdoc_mutations`.
117
+
118
+ Multi-action tools use an `action` field to select the underlying operation. Single-action tools like `superdoc_search` do not require `action`.
119
+
109
120
  | Function | Description |
110
121
  |----------|-------------|
111
- | `chooseTools(input)` | Select tools filtered by group for a provider |
122
+ | `chooseTools(input)` | Load grouped tool definitions for a provider |
112
123
  | `listTools(provider)` | List all tool definitions for a provider |
113
124
  | `dispatchSuperDocTool(client, toolName, args)` | Execute a tool call against a client |
114
- | `resolveToolOperation(toolName)` | Map a tool name to its operation ID |
115
- | `getToolCatalog()` | Load the full tool catalog |
116
- | `getAvailableGroups()` | List all available tool groups |
125
+ | `getToolCatalog()` | Load the grouped tool catalog with metadata |
126
+ | `getSystemPrompt()` | Read the bundled system prompt for intent tools |
117
127
 
118
128
  ## Part of SuperDoc
119
129
 
@@ -36,7 +36,9 @@ function createDocApi(runtime) {
36
36
  replace: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.replace"], params, options),
37
37
  delete: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.delete"], params, options),
38
38
  blocks: {
39
+ list: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.blocks.list"], params, options),
39
40
  delete: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.blocks.delete"], params, options),
41
+ deleteRange: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.blocks.deleteRange"], params, options),
40
42
  },
41
43
  format: {
42
44
  apply: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.format.apply"], params, options),
@@ -185,6 +187,9 @@ function createDocApi(runtime) {
185
187
  query: {
186
188
  match: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.query.match"], params, options),
187
189
  },
190
+ ranges: {
191
+ resolve: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.ranges.resolve"], params, options),
192
+ },
188
193
  mutations: {
189
194
  preview: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.mutations.preview"], params, options),
190
195
  apply: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.mutations.apply"], params, options),