@superdoc-dev/sdk 1.0.0-next.73 → 1.0.0-next.74

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/tools.js CHANGED
@@ -83,9 +83,9 @@ export async function chooseTools(input) {
83
83
  },
84
84
  };
85
85
  }
86
- function resolveDocApiMethod(client, operationId) {
86
+ function resolveDocApiMethod(documentHandle, operationId) {
87
87
  const tokens = operationId.split('.').slice(1);
88
- let cursor = client.doc;
88
+ let cursor = documentHandle;
89
89
  for (const token of tokens) {
90
90
  if (!isRecord(cursor) || !(token in cursor)) {
91
91
  throw new SuperDocCliError(`No SDK doc method found for operation ${operationId}.`, {
@@ -185,7 +185,13 @@ function validateOperationRequired(toolName, action, args, op) {
185
185
  }
186
186
  }
187
187
  }
188
- export async function dispatchSuperDocTool(client, toolName, args = {}, invokeOptions) {
188
+ /**
189
+ * Dispatch a tool call against a bound document handle.
190
+ *
191
+ * The document handle injects session targeting automatically.
192
+ * Tool arguments should not contain `doc` or `sessionId`.
193
+ */
194
+ export async function dispatchSuperDocTool(documentHandle, toolName, args = {}, invokeOptions) {
189
195
  if (!isRecord(args)) {
190
196
  throw new SuperDocCliError(`Tool arguments for ${toolName} must be an object.`, {
191
197
  code: 'INVALID_ARGUMENT',
@@ -202,10 +208,8 @@ export async function dispatchSuperDocTool(client, toolName, args = {}, invokeOp
202
208
  });
203
209
  }
204
210
  validateToolArgs(toolName, args, tool);
205
- // Strip doc/sessionId — the SDK client manages session targeting after doc.open().
206
- const { doc: _doc, sessionId: _sid, ...cleanArgs } = args;
207
- return dispatchIntentTool(toolName, cleanArgs, (operationId, input) => {
208
- const method = resolveDocApiMethod(client, operationId);
211
+ return dispatchIntentTool(toolName, args, (operationId, input) => {
212
+ const method = resolveDocApiMethod(documentHandle, operationId);
209
213
  return method(input, invokeOptions);
210
214
  });
211
215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/sdk",
3
- "version": "1.0.0-next.73",
3
+ "version": "1.0.0-next.74",
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-arm64": "1.0.0-next.73",
30
- "@superdoc-dev/sdk-linux-arm64": "1.0.0-next.73",
31
- "@superdoc-dev/sdk-darwin-x64": "1.0.0-next.73",
32
- "@superdoc-dev/sdk-linux-x64": "1.0.0-next.73",
33
- "@superdoc-dev/sdk-windows-x64": "1.0.0-next.73"
29
+ "@superdoc-dev/sdk-darwin-arm64": "1.0.0-next.74",
30
+ "@superdoc-dev/sdk-linux-x64": "1.0.0-next.74",
31
+ "@superdoc-dev/sdk-linux-arm64": "1.0.0-next.74",
32
+ "@superdoc-dev/sdk-darwin-x64": "1.0.0-next.74",
33
+ "@superdoc-dev/sdk-windows-x64": "1.0.0-next.74"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -19,14 +19,6 @@
19
19
  ],
20
20
  "description": "The action to perform. One of: html, info, markdown, text."
21
21
  },
22
- "doc": {
23
- "type": "string",
24
- "description": "Document path. Optional when a session is already open."
25
- },
26
- "sessionId": {
27
- "type": "string",
28
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
29
- },
30
22
  "in": {
31
23
  "oneOf": [
32
24
  {
@@ -220,14 +212,6 @@
220
212
  ],
221
213
  "description": "The action to perform. One of: delete, insert, redo, replace, undo."
222
214
  },
223
- "doc": {
224
- "type": "string",
225
- "description": "Document path. Optional when a session is already open."
226
- },
227
- "sessionId": {
228
- "type": "string",
229
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
230
- },
231
215
  "force": {
232
216
  "type": "boolean",
233
217
  "description": "Bypass confirmation checks."
@@ -756,14 +740,6 @@
756
740
  ],
757
741
  "description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
758
742
  },
759
- "doc": {
760
- "type": "string",
761
- "description": "Document path. Optional when a session is already open."
762
- },
763
- "sessionId": {
764
- "type": "string",
765
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
766
- },
767
743
  "force": {
768
744
  "type": "boolean",
769
745
  "description": "Bypass confirmation checks."
@@ -1504,14 +1480,6 @@
1504
1480
  ],
1505
1481
  "description": "The action to perform. One of: heading, paragraph."
1506
1482
  },
1507
- "doc": {
1508
- "type": "string",
1509
- "description": "Document path. Optional when a session is already open."
1510
- },
1511
- "sessionId": {
1512
- "type": "string",
1513
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1514
- },
1515
1483
  "force": {
1516
1484
  "type": "boolean",
1517
1485
  "description": "Bypass confirmation checks."
@@ -1841,14 +1809,6 @@
1841
1809
  ],
1842
1810
  "description": "The action to perform. One of: create, detach, indent, insert, outdent, set_level, set_type."
1843
1811
  },
1844
- "doc": {
1845
- "type": "string",
1846
- "description": "Document path. Optional when a session is already open."
1847
- },
1848
- "sessionId": {
1849
- "type": "string",
1850
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1851
- },
1852
1812
  "force": {
1853
1813
  "type": "boolean",
1854
1814
  "description": "Bypass confirmation checks."
@@ -2154,14 +2114,6 @@
2154
2114
  ],
2155
2115
  "description": "The action to perform. One of: create, delete, get, list, update."
2156
2116
  },
2157
- "doc": {
2158
- "type": "string",
2159
- "description": "Document path. Optional when a session is already open."
2160
- },
2161
- "sessionId": {
2162
- "type": "string",
2163
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2164
- },
2165
2117
  "force": {
2166
2118
  "type": "boolean",
2167
2119
  "description": "Bypass confirmation checks."
@@ -2307,14 +2259,6 @@
2307
2259
  ],
2308
2260
  "description": "The action to perform. One of: decide, list."
2309
2261
  },
2310
- "doc": {
2311
- "type": "string",
2312
- "description": "Document path. Optional when a session is already open."
2313
- },
2314
- "sessionId": {
2315
- "type": "string",
2316
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2317
- },
2318
2262
  "limit": {
2319
2263
  "type": "number",
2320
2264
  "description": "Maximum number of tracked changes to return."
@@ -2409,14 +2353,6 @@
2409
2353
  "inputSchema": {
2410
2354
  "type": "object",
2411
2355
  "properties": {
2412
- "doc": {
2413
- "type": "string",
2414
- "description": "Document path. Optional when a session is already open."
2415
- },
2416
- "sessionId": {
2417
- "type": "string",
2418
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2419
- },
2420
2356
  "in": {
2421
2357
  "oneOf": [
2422
2358
  {
@@ -2736,14 +2672,6 @@
2736
2672
  ],
2737
2673
  "description": "The action to perform. One of: apply, preview."
2738
2674
  },
2739
- "doc": {
2740
- "type": "string",
2741
- "description": "Document path. Optional when a session is already open."
2742
- },
2743
- "sessionId": {
2744
- "type": "string",
2745
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2746
- },
2747
2675
  "in": {
2748
2676
  "oneOf": [
2749
2677
  {
@@ -39,5 +39,5 @@
39
39
  "mutates": true
40
40
  }
41
41
  ],
42
- "contractHash": "20a5c483c698af85"
42
+ "contractHash": "53a4b0e0f230cbd9"
43
43
  }
@@ -17,14 +17,6 @@
17
17
  ],
18
18
  "description": "The action to perform. One of: html, info, markdown, text."
19
19
  },
20
- "doc": {
21
- "type": "string",
22
- "description": "Document path. Optional when a session is already open."
23
- },
24
- "sessionId": {
25
- "type": "string",
26
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
27
- },
28
20
  "in": {
29
21
  "oneOf": [
30
22
  {
@@ -199,14 +191,6 @@
199
191
  ],
200
192
  "description": "The action to perform. One of: delete, insert, redo, replace, undo."
201
193
  },
202
- "doc": {
203
- "type": "string",
204
- "description": "Document path. Optional when a session is already open."
205
- },
206
- "sessionId": {
207
- "type": "string",
208
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
209
- },
210
194
  "force": {
211
195
  "type": "boolean",
212
196
  "description": "Bypass confirmation checks."
@@ -670,14 +654,6 @@
670
654
  ],
671
655
  "description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
672
656
  },
673
- "doc": {
674
- "type": "string",
675
- "description": "Document path. Optional when a session is already open."
676
- },
677
- "sessionId": {
678
- "type": "string",
679
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
680
- },
681
657
  "force": {
682
658
  "type": "boolean",
683
659
  "description": "Bypass confirmation checks."
@@ -1363,14 +1339,6 @@
1363
1339
  ],
1364
1340
  "description": "The action to perform. One of: heading, paragraph."
1365
1341
  },
1366
- "doc": {
1367
- "type": "string",
1368
- "description": "Document path. Optional when a session is already open."
1369
- },
1370
- "sessionId": {
1371
- "type": "string",
1372
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1373
- },
1374
1342
  "force": {
1375
1343
  "type": "boolean",
1376
1344
  "description": "Bypass confirmation checks."
@@ -1686,14 +1654,6 @@
1686
1654
  ],
1687
1655
  "description": "The action to perform. One of: create, detach, indent, insert, outdent, set_level, set_type."
1688
1656
  },
1689
- "doc": {
1690
- "type": "string",
1691
- "description": "Document path. Optional when a session is already open."
1692
- },
1693
- "sessionId": {
1694
- "type": "string",
1695
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1696
- },
1697
1657
  "force": {
1698
1658
  "type": "boolean",
1699
1659
  "description": "Bypass confirmation checks."
@@ -1944,14 +1904,6 @@
1944
1904
  ],
1945
1905
  "description": "The action to perform. One of: create, delete, get, list, update."
1946
1906
  },
1947
- "doc": {
1948
- "type": "string",
1949
- "description": "Document path. Optional when a session is already open."
1950
- },
1951
- "sessionId": {
1952
- "type": "string",
1953
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1954
- },
1955
1907
  "force": {
1956
1908
  "type": "boolean",
1957
1909
  "description": "Bypass confirmation checks."
@@ -2065,14 +2017,6 @@
2065
2017
  ],
2066
2018
  "description": "The action to perform. One of: decide, list."
2067
2019
  },
2068
- "doc": {
2069
- "type": "string",
2070
- "description": "Document path. Optional when a session is already open."
2071
- },
2072
- "sessionId": {
2073
- "type": "string",
2074
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2075
- },
2076
2020
  "limit": {
2077
2021
  "type": "number",
2078
2022
  "description": "Maximum number of tracked changes to return."
@@ -2152,14 +2096,6 @@
2152
2096
  "input_schema": {
2153
2097
  "type": "object",
2154
2098
  "properties": {
2155
- "doc": {
2156
- "type": "string",
2157
- "description": "Document path. Optional when a session is already open."
2158
- },
2159
- "sessionId": {
2160
- "type": "string",
2161
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2162
- },
2163
2099
  "in": {
2164
2100
  "oneOf": [
2165
2101
  {
@@ -2469,14 +2405,6 @@
2469
2405
  ],
2470
2406
  "description": "The action to perform. One of: apply, preview."
2471
2407
  },
2472
- "doc": {
2473
- "type": "string",
2474
- "description": "Document path. Optional when a session is already open."
2475
- },
2476
- "sessionId": {
2477
- "type": "string",
2478
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2479
- },
2480
2408
  "in": {
2481
2409
  "oneOf": [
2482
2410
  {
@@ -17,14 +17,6 @@
17
17
  ],
18
18
  "description": "The action to perform. One of: html, info, markdown, text."
19
19
  },
20
- "doc": {
21
- "type": "string",
22
- "description": "Document path. Optional when a session is already open."
23
- },
24
- "sessionId": {
25
- "type": "string",
26
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
27
- },
28
20
  "in": {
29
21
  "oneOf": [
30
22
  {
@@ -209,14 +201,6 @@
209
201
  ],
210
202
  "description": "The action to perform. One of: delete, insert, redo, replace, undo."
211
203
  },
212
- "doc": {
213
- "type": "string",
214
- "description": "Document path. Optional when a session is already open."
215
- },
216
- "sessionId": {
217
- "type": "string",
218
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
219
- },
220
204
  "force": {
221
205
  "type": "boolean",
222
206
  "description": "Bypass confirmation checks."
@@ -691,14 +675,6 @@
691
675
  ],
692
676
  "description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
693
677
  },
694
- "doc": {
695
- "type": "string",
696
- "description": "Document path. Optional when a session is already open."
697
- },
698
- "sessionId": {
699
- "type": "string",
700
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
701
- },
702
678
  "force": {
703
679
  "type": "boolean",
704
680
  "description": "Bypass confirmation checks."
@@ -1396,14 +1372,6 @@
1396
1372
  ],
1397
1373
  "description": "The action to perform. One of: heading, paragraph."
1398
1374
  },
1399
- "doc": {
1400
- "type": "string",
1401
- "description": "Document path. Optional when a session is already open."
1402
- },
1403
- "sessionId": {
1404
- "type": "string",
1405
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1406
- },
1407
1375
  "force": {
1408
1376
  "type": "boolean",
1409
1377
  "description": "Bypass confirmation checks."
@@ -1727,14 +1695,6 @@
1727
1695
  ],
1728
1696
  "description": "The action to perform. One of: create, detach, indent, insert, outdent, set_level, set_type."
1729
1697
  },
1730
- "doc": {
1731
- "type": "string",
1732
- "description": "Document path. Optional when a session is already open."
1733
- },
1734
- "sessionId": {
1735
- "type": "string",
1736
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1737
- },
1738
1698
  "force": {
1739
1699
  "type": "boolean",
1740
1700
  "description": "Bypass confirmation checks."
@@ -1998,14 +1958,6 @@
1998
1958
  ],
1999
1959
  "description": "The action to perform. One of: create, delete, get, list, update."
2000
1960
  },
2001
- "doc": {
2002
- "type": "string",
2003
- "description": "Document path. Optional when a session is already open."
2004
- },
2005
- "sessionId": {
2006
- "type": "string",
2007
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2008
- },
2009
1961
  "force": {
2010
1962
  "type": "boolean",
2011
1963
  "description": "Bypass confirmation checks."
@@ -2130,14 +2082,6 @@
2130
2082
  ],
2131
2083
  "description": "The action to perform. One of: decide, list."
2132
2084
  },
2133
- "doc": {
2134
- "type": "string",
2135
- "description": "Document path. Optional when a session is already open."
2136
- },
2137
- "sessionId": {
2138
- "type": "string",
2139
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2140
- },
2141
2085
  "limit": {
2142
2086
  "type": "number",
2143
2087
  "description": "Maximum number of tracked changes to return."
@@ -2225,14 +2169,6 @@
2225
2169
  "parameters": {
2226
2170
  "type": "object",
2227
2171
  "properties": {
2228
- "doc": {
2229
- "type": "string",
2230
- "description": "Document path. Optional when a session is already open."
2231
- },
2232
- "sessionId": {
2233
- "type": "string",
2234
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2235
- },
2236
2172
  "in": {
2237
2173
  "oneOf": [
2238
2174
  {
@@ -2549,14 +2485,6 @@
2549
2485
  ],
2550
2486
  "description": "The action to perform. One of: apply, preview."
2551
2487
  },
2552
- "doc": {
2553
- "type": "string",
2554
- "description": "Document path. Optional when a session is already open."
2555
- },
2556
- "sessionId": {
2557
- "type": "string",
2558
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2559
- },
2560
2488
  "in": {
2561
2489
  "oneOf": [
2562
2490
  {
@@ -19,14 +19,6 @@
19
19
  ],
20
20
  "description": "The action to perform. One of: html, info, markdown, text."
21
21
  },
22
- "doc": {
23
- "type": "string",
24
- "description": "Document path. Optional when a session is already open."
25
- },
26
- "sessionId": {
27
- "type": "string",
28
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
29
- },
30
22
  "in": {
31
23
  "oneOf": [
32
24
  {
@@ -204,14 +196,6 @@
204
196
  ],
205
197
  "description": "The action to perform. One of: delete, insert, redo, replace, undo."
206
198
  },
207
- "doc": {
208
- "type": "string",
209
- "description": "Document path. Optional when a session is already open."
210
- },
211
- "sessionId": {
212
- "type": "string",
213
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
214
- },
215
199
  "force": {
216
200
  "type": "boolean",
217
201
  "description": "Bypass confirmation checks."
@@ -678,14 +662,6 @@
678
662
  ],
679
663
  "description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
680
664
  },
681
- "doc": {
682
- "type": "string",
683
- "description": "Document path. Optional when a session is already open."
684
- },
685
- "sessionId": {
686
- "type": "string",
687
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
688
- },
689
665
  "force": {
690
666
  "type": "boolean",
691
667
  "description": "Bypass confirmation checks."
@@ -1374,14 +1350,6 @@
1374
1350
  ],
1375
1351
  "description": "The action to perform. One of: heading, paragraph."
1376
1352
  },
1377
- "doc": {
1378
- "type": "string",
1379
- "description": "Document path. Optional when a session is already open."
1380
- },
1381
- "sessionId": {
1382
- "type": "string",
1383
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1384
- },
1385
1353
  "force": {
1386
1354
  "type": "boolean",
1387
1355
  "description": "Bypass confirmation checks."
@@ -1700,14 +1668,6 @@
1700
1668
  ],
1701
1669
  "description": "The action to perform. One of: create, detach, indent, insert, outdent, set_level, set_type."
1702
1670
  },
1703
- "doc": {
1704
- "type": "string",
1705
- "description": "Document path. Optional when a session is already open."
1706
- },
1707
- "sessionId": {
1708
- "type": "string",
1709
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1710
- },
1711
1671
  "force": {
1712
1672
  "type": "boolean",
1713
1673
  "description": "Bypass confirmation checks."
@@ -1961,14 +1921,6 @@
1961
1921
  ],
1962
1922
  "description": "The action to perform. One of: create, delete, get, list, update."
1963
1923
  },
1964
- "doc": {
1965
- "type": "string",
1966
- "description": "Document path. Optional when a session is already open."
1967
- },
1968
- "sessionId": {
1969
- "type": "string",
1970
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
1971
- },
1972
1924
  "force": {
1973
1925
  "type": "boolean",
1974
1926
  "description": "Bypass confirmation checks."
@@ -2085,14 +2037,6 @@
2085
2037
  ],
2086
2038
  "description": "The action to perform. One of: decide, list."
2087
2039
  },
2088
- "doc": {
2089
- "type": "string",
2090
- "description": "Document path. Optional when a session is already open."
2091
- },
2092
- "sessionId": {
2093
- "type": "string",
2094
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2095
- },
2096
2040
  "limit": {
2097
2041
  "type": "number",
2098
2042
  "description": "Maximum number of tracked changes to return."
@@ -2175,14 +2119,6 @@
2175
2119
  "parameters": {
2176
2120
  "type": "object",
2177
2121
  "properties": {
2178
- "doc": {
2179
- "type": "string",
2180
- "description": "Document path. Optional when a session is already open."
2181
- },
2182
- "sessionId": {
2183
- "type": "string",
2184
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2185
- },
2186
2122
  "in": {
2187
2123
  "oneOf": [
2188
2124
  {
@@ -2495,14 +2431,6 @@
2495
2431
  ],
2496
2432
  "description": "The action to perform. One of: apply, preview."
2497
2433
  },
2498
- "doc": {
2499
- "type": "string",
2500
- "description": "Document path. Optional when a session is already open."
2501
- },
2502
- "sessionId": {
2503
- "type": "string",
2504
- "description": "Session ID for multi-session workflows. Optional when only one session is open."
2505
- },
2506
2434
  "in": {
2507
2435
  "oneOf": [
2508
2436
  {