@superdoc-dev/sdk 1.0.0-alpha.30 → 1.0.0-alpha.32
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 +8 -10
- package/dist/generated/client.cjs +8 -0
- package/dist/generated/client.d.ts +1010 -4
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +8 -0
- package/dist/generated/contract.cjs +15950 -5410
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +15950 -5410
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime/transport-common.cjs +1 -1
- package/dist/runtime/transport-common.js +1 -1
- package/dist/tools.cjs +69 -140
- package/dist/tools.d.ts +42 -65
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +68 -139
- package/package.json +6 -6
- package/tools/catalog.json +34590 -71420
- package/tools/tool-name-map.json +7 -264
- package/tools/tools-policy.json +79 -82
- package/tools/tools.anthropic.json +16805 -30495
- package/tools/tools.generic.json +35821 -71008
- package/tools/tools.openai.json +17263 -31721
- package/tools/tools.vercel.json +17263 -31721
package/dist/index.cjs
CHANGED
|
@@ -36,8 +36,8 @@ exports.installSkill = skills.installSkill;
|
|
|
36
36
|
exports.listSkills = skills.listSkills;
|
|
37
37
|
exports.chooseTools = tools.chooseTools;
|
|
38
38
|
exports.dispatchSuperDocTool = tools.dispatchSuperDocTool;
|
|
39
|
+
exports.getAvailableGroups = tools.getAvailableGroups;
|
|
39
40
|
exports.getToolCatalog = tools.getToolCatalog;
|
|
40
|
-
exports.inferDocumentFeatures = tools.inferDocumentFeatures;
|
|
41
41
|
exports.listTools = tools.listTools;
|
|
42
42
|
exports.resolveToolOperation = tools.resolveToolOperation;
|
|
43
43
|
exports.SuperDocCliError = errors.SuperDocCliError;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export declare class SuperDocClient {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function createSuperDocClient(options?: SuperDocClientOptions): SuperDocClient;
|
|
18
18
|
export { getSkill, installSkill, listSkills } from './skills.js';
|
|
19
|
-
export { chooseTools, dispatchSuperDocTool,
|
|
19
|
+
export { chooseTools, dispatchSuperDocTool, getAvailableGroups, getToolCatalog, listTools, resolveToolOperation, } from './tools.js';
|
|
20
20
|
export { SuperDocCliError } from './runtime/errors.js';
|
|
21
21
|
export type { InvokeOptions, OperationSpec, OperationParamSpec, SuperDocClientOptions } from './runtime/process.js';
|
|
22
|
-
export type {
|
|
22
|
+
export type { ToolChooserInput, ToolChooserMode, ToolGroup, ToolProvider } from './tools.js';
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEnF;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;gBAElC,OAAO,GAAE,qBAA0B;IAKzC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAExF;AAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEnF;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;gBAElC,OAAO,GAAE,qBAA0B;IAKzC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAExF;AAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpH,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,5 +25,5 @@ export function createSuperDocClient(options = {}) {
|
|
|
25
25
|
return new SuperDocClient(options);
|
|
26
26
|
}
|
|
27
27
|
export { getSkill, installSkill, listSkills } from './skills.js';
|
|
28
|
-
export { chooseTools, dispatchSuperDocTool,
|
|
28
|
+
export { chooseTools, dispatchSuperDocTool, getAvailableGroups, getToolCatalog, listTools, resolveToolOperation, } from './tools.js';
|
|
29
29
|
export { SuperDocCliError } from './runtime/errors.js';
|
package/dist/tools.cjs
CHANGED
|
@@ -84,24 +84,10 @@ async function loadToolNameMap() {
|
|
|
84
84
|
async function loadCatalog() {
|
|
85
85
|
return readJson('catalog.json');
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
hasComments: Boolean(features?.hasComments),
|
|
92
|
-
hasTrackedChanges: Boolean(features?.hasTrackedChanges),
|
|
93
|
-
isEmptyDocument: Boolean(features?.isEmptyDocument),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function stableSortByPhasePriority(entries, priorityOrder) {
|
|
97
|
-
const priority = new Map(priorityOrder.map((category, index) => [category, index]));
|
|
98
|
-
return [...entries].sort((a, b) => {
|
|
99
|
-
const aPriority = priority.get(a.category) ?? Number.MAX_SAFE_INTEGER;
|
|
100
|
-
const bPriority = priority.get(b.category) ?? Number.MAX_SAFE_INTEGER;
|
|
101
|
-
if (aPriority !== bPriority)
|
|
102
|
-
return aPriority - bPriority;
|
|
103
|
-
return a.toolName.localeCompare(b.toolName);
|
|
104
|
-
});
|
|
87
|
+
/** All available tool groups from the policy. */
|
|
88
|
+
function getAvailableGroups() {
|
|
89
|
+
const policy = loadPolicy();
|
|
90
|
+
return policy.groups;
|
|
105
91
|
}
|
|
106
92
|
const OPERATION_INDEX = Object.fromEntries(Object.entries(contract.CONTRACT.operations).map(([id, op]) => [id, op]));
|
|
107
93
|
function validateDispatchArgs(operationId, args) {
|
|
@@ -194,26 +180,16 @@ function resolveDocApiMethod(client, operationId) {
|
|
|
194
180
|
}
|
|
195
181
|
return cursor;
|
|
196
182
|
}
|
|
197
|
-
async function getToolCatalog(
|
|
198
|
-
|
|
199
|
-
if (!options.profile)
|
|
200
|
-
return catalog;
|
|
201
|
-
return {
|
|
202
|
-
...catalog,
|
|
203
|
-
profiles: {
|
|
204
|
-
intent: options.profile === 'intent' ? catalog.profiles.intent : { name: 'intent', tools: [] },
|
|
205
|
-
operation: options.profile === 'operation' ? catalog.profiles.operation : { name: 'operation', tools: [] },
|
|
206
|
-
},
|
|
207
|
-
};
|
|
183
|
+
async function getToolCatalog() {
|
|
184
|
+
return loadCatalog();
|
|
208
185
|
}
|
|
209
|
-
async function listTools(provider
|
|
210
|
-
const profile = options.profile ?? 'intent';
|
|
186
|
+
async function listTools(provider) {
|
|
211
187
|
const bundle = await loadProviderBundle(provider);
|
|
212
|
-
const tools = bundle.
|
|
188
|
+
const tools = bundle.tools;
|
|
213
189
|
if (!Array.isArray(tools)) {
|
|
214
|
-
throw new errors.SuperDocCliError('Tool provider bundle is missing
|
|
190
|
+
throw new errors.SuperDocCliError('Tool provider bundle is missing tools array.', {
|
|
215
191
|
code: 'TOOLS_ASSET_INVALID',
|
|
216
|
-
details: { provider
|
|
192
|
+
details: { provider },
|
|
217
193
|
});
|
|
218
194
|
}
|
|
219
195
|
return tools;
|
|
@@ -222,110 +198,60 @@ async function resolveToolOperation(toolName) {
|
|
|
222
198
|
const map = await loadToolNameMap();
|
|
223
199
|
return typeof map[toolName] === 'string' ? map[toolName] : null;
|
|
224
200
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return {
|
|
247
|
-
hasTables: tables > 0,
|
|
248
|
-
hasLists: lists > 0,
|
|
249
|
-
hasComments: comments > 0,
|
|
250
|
-
hasTrackedChanges: trackedChanges > 0,
|
|
251
|
-
isEmptyDocument: words === 0 && paragraphs <= 1,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
201
|
+
/**
|
|
202
|
+
* Select tools for a specific provider.
|
|
203
|
+
*
|
|
204
|
+
* **mode='essential'** (default): Returns only essential tools + discover_tools.
|
|
205
|
+
* Pass `groups` to additionally load all tools from those categories.
|
|
206
|
+
*
|
|
207
|
+
* **mode='all'**: Returns all tools from requested groups (or all groups if
|
|
208
|
+
* `groups` is omitted). No discover_tools included by default.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* // Default: 5 essential tools + discover_tools
|
|
213
|
+
* const { tools } = await chooseTools({ provider: 'openai' });
|
|
214
|
+
*
|
|
215
|
+
* // Essential + all comment tools
|
|
216
|
+
* const { tools } = await chooseTools({ provider: 'openai', groups: ['comments'] });
|
|
217
|
+
*
|
|
218
|
+
* // All tools (old behavior)
|
|
219
|
+
* const { tools } = await chooseTools({ provider: 'openai', mode: 'all' });
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
254
222
|
async function chooseTools(input) {
|
|
255
223
|
const catalog = await loadCatalog();
|
|
256
224
|
const policy = loadPolicy();
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
let candidates = profileTools.filter((tool) => {
|
|
270
|
-
if (tool.requiredCapabilities.some((capability) => !featureMap[capability])) {
|
|
271
|
-
excluded.push({ toolName: tool.toolName, reason: 'missing-required-capability' });
|
|
225
|
+
const mode = input.mode ?? policy.defaults.mode ?? 'essential';
|
|
226
|
+
const includeDiscover = input.includeDiscoverTool ?? mode === 'essential';
|
|
227
|
+
let selected;
|
|
228
|
+
if (mode === 'essential') {
|
|
229
|
+
// Essential tools + any explicitly requested groups
|
|
230
|
+
const essentialNames = new Set(policy.essentialTools ?? []);
|
|
231
|
+
const requestedGroups = input.groups ? new Set(input.groups) : null;
|
|
232
|
+
selected = catalog.tools.filter((tool) => {
|
|
233
|
+
if (essentialNames.has(tool.toolName))
|
|
234
|
+
return true;
|
|
235
|
+
if (requestedGroups && requestedGroups.has(tool.category))
|
|
236
|
+
return true;
|
|
272
237
|
return false;
|
|
273
|
-
}
|
|
274
|
-
if (!allowMutatingTools && tool.mutates) {
|
|
275
|
-
excluded.push({ toolName: tool.toolName, reason: 'mutations-disabled' });
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
if (includeCategories.size > 0 && !includeCategories.has(tool.category)) {
|
|
279
|
-
excluded.push({ toolName: tool.toolName, reason: 'category-not-included' });
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
if (excludeCategories.has(tool.category)) {
|
|
283
|
-
excluded.push({ toolName: tool.toolName, reason: 'phase-category-excluded' });
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
return true;
|
|
287
|
-
});
|
|
288
|
-
const forceExclude = new Set(input.policy?.forceExclude ?? []);
|
|
289
|
-
candidates = candidates.filter((tool) => {
|
|
290
|
-
if (!forceExclude.has(tool.toolName))
|
|
291
|
-
return true;
|
|
292
|
-
excluded.push({ toolName: tool.toolName, reason: 'force-excluded' });
|
|
293
|
-
return false;
|
|
294
|
-
});
|
|
295
|
-
// Resolve forceInclude tools — these are guaranteed slots exempt from budget trimming.
|
|
296
|
-
const forcedToolNames = new Set(input.policy?.forceInclude ?? []);
|
|
297
|
-
const forcedTools = [];
|
|
298
|
-
for (const forcedToolName of forcedToolNames) {
|
|
299
|
-
const forced = indexByToolName.get(forcedToolName);
|
|
300
|
-
if (!forced) {
|
|
301
|
-
excluded.push({ toolName: forcedToolName, reason: 'not-in-profile' });
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
304
|
-
candidates.push(forced);
|
|
305
|
-
forcedTools.push(forced);
|
|
306
|
-
}
|
|
307
|
-
candidates = [...new Map(candidates.map((tool) => [tool.toolName, tool])).values()];
|
|
308
|
-
// Start with forceInclude tools — they always occupy a slot.
|
|
309
|
-
const selected = [...forcedTools];
|
|
310
|
-
const selectedNames = new Set(selected.map((tool) => tool.toolName));
|
|
311
|
-
const foundationalIds = new Set(policy.defaults.foundationalOperationIds);
|
|
312
|
-
const foundational = candidates.filter((tool) => foundationalIds.has(tool.operationId) && !selectedNames.has(tool.toolName));
|
|
313
|
-
for (const tool of foundational) {
|
|
314
|
-
if (selected.length >= minReadTools || selected.length >= maxTools)
|
|
315
|
-
break;
|
|
316
|
-
selected.push(tool);
|
|
317
|
-
selectedNames.add(tool.toolName);
|
|
238
|
+
});
|
|
318
239
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
240
|
+
else {
|
|
241
|
+
// mode='all': original behavior — filter by groups
|
|
242
|
+
const alwaysInclude = new Set(policy.defaults.alwaysInclude ?? ['core']);
|
|
243
|
+
let groups;
|
|
244
|
+
if (input.groups) {
|
|
245
|
+
groups = new Set([...input.groups, ...alwaysInclude]);
|
|
324
246
|
}
|
|
325
|
-
|
|
247
|
+
else {
|
|
248
|
+
groups = new Set(policy.groups);
|
|
249
|
+
}
|
|
250
|
+
selected = catalog.tools.filter((tool) => groups.has(tool.category));
|
|
326
251
|
}
|
|
252
|
+
// Build provider-formatted tools from the provider bundle
|
|
327
253
|
const bundle = await loadProviderBundle(input.provider);
|
|
328
|
-
const providerTools = Array.isArray(bundle.
|
|
254
|
+
const providerTools = Array.isArray(bundle.tools) ? bundle.tools : [];
|
|
329
255
|
const providerIndex = new Map(providerTools
|
|
330
256
|
.filter((tool) => isRecord(tool))
|
|
331
257
|
.map((tool) => [extractProviderToolName(tool), tool])
|
|
@@ -333,6 +259,14 @@ async function chooseTools(input) {
|
|
|
333
259
|
const selectedProviderTools = selected
|
|
334
260
|
.map((tool) => providerIndex.get(tool.toolName))
|
|
335
261
|
.filter((tool) => Boolean(tool));
|
|
262
|
+
// Append discover_tools if requested
|
|
263
|
+
if (includeDiscover) {
|
|
264
|
+
const discoverTool = providerIndex.get('discover_tools');
|
|
265
|
+
if (discoverTool) {
|
|
266
|
+
selectedProviderTools.push(discoverTool);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const resolvedGroups = mode === 'essential' ? (input.groups ?? []) : (input.groups ?? policy.groups);
|
|
336
270
|
return {
|
|
337
271
|
tools: selectedProviderTools,
|
|
338
272
|
selected: selected.map((tool) => ({
|
|
@@ -340,17 +274,12 @@ async function chooseTools(input) {
|
|
|
340
274
|
toolName: tool.toolName,
|
|
341
275
|
category: tool.category,
|
|
342
276
|
mutates: tool.mutates,
|
|
343
|
-
profile: tool.profile,
|
|
344
277
|
})),
|
|
345
|
-
|
|
346
|
-
selectionMeta: {
|
|
347
|
-
profile,
|
|
348
|
-
phase,
|
|
349
|
-
maxTools,
|
|
350
|
-
minReadTools,
|
|
351
|
-
selectedCount: selected.length,
|
|
352
|
-
decisionVersion: policy.defaults.chooserDecisionVersion,
|
|
278
|
+
meta: {
|
|
353
279
|
provider: input.provider,
|
|
280
|
+
mode,
|
|
281
|
+
groups: [...resolvedGroups],
|
|
282
|
+
selectedCount: selectedProviderTools.length,
|
|
354
283
|
},
|
|
355
284
|
};
|
|
356
285
|
}
|
|
@@ -372,7 +301,7 @@ async function dispatchSuperDocTool(client, toolName, args = {}, invokeOptions)
|
|
|
372
301
|
|
|
373
302
|
exports.chooseTools = chooseTools;
|
|
374
303
|
exports.dispatchSuperDocTool = dispatchSuperDocTool;
|
|
304
|
+
exports.getAvailableGroups = getAvailableGroups;
|
|
375
305
|
exports.getToolCatalog = getToolCatalog;
|
|
376
|
-
exports.inferDocumentFeatures = inferDocumentFeatures;
|
|
377
306
|
exports.listTools = listTools;
|
|
378
307
|
exports.resolveToolOperation = resolveToolOperation;
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,36 +1,14 @@
|
|
|
1
1
|
import type { InvokeOptions } from './runtime/process.js';
|
|
2
2
|
export type ToolProvider = 'openai' | 'anthropic' | 'vercel' | 'generic';
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type DocumentFeatures = {
|
|
6
|
-
hasTables: boolean;
|
|
7
|
-
hasLists: boolean;
|
|
8
|
-
hasComments: boolean;
|
|
9
|
-
hasTrackedChanges: boolean;
|
|
10
|
-
isEmptyDocument: boolean;
|
|
11
|
-
};
|
|
3
|
+
export type ToolGroup = 'core' | 'format' | 'create' | 'tables' | 'sections' | 'lists' | 'comments' | 'trackChanges' | 'toc' | 'images' | 'history' | 'session';
|
|
4
|
+
export type ToolChooserMode = 'essential' | 'all';
|
|
12
5
|
export type ToolChooserInput = {
|
|
13
6
|
provider: ToolProvider;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
toolName: string;
|
|
20
|
-
ok: boolean;
|
|
21
|
-
}>;
|
|
22
|
-
};
|
|
23
|
-
budget?: {
|
|
24
|
-
maxTools?: number;
|
|
25
|
-
minReadTools?: number;
|
|
26
|
-
};
|
|
27
|
-
policy?: {
|
|
28
|
-
includeCategories?: string[];
|
|
29
|
-
excludeCategories?: string[];
|
|
30
|
-
allowMutatingTools?: boolean;
|
|
31
|
-
forceInclude?: string[];
|
|
32
|
-
forceExclude?: string[];
|
|
33
|
-
};
|
|
7
|
+
groups?: ToolGroup[];
|
|
8
|
+
/** Default: 'essential'. When 'essential', only essential tools are returned (plus any from `groups`). */
|
|
9
|
+
mode?: ToolChooserMode;
|
|
10
|
+
/** Whether to include the discover_tools meta-tool. Default: true when mode='essential', false when mode='all'. */
|
|
11
|
+
includeDiscoverTool?: boolean;
|
|
34
12
|
};
|
|
35
13
|
export type ToolCatalog = {
|
|
36
14
|
contractVersion: string;
|
|
@@ -38,51 +16,58 @@ export type ToolCatalog = {
|
|
|
38
16
|
namePolicyVersion: string;
|
|
39
17
|
exposureVersion: string;
|
|
40
18
|
toolCount: number;
|
|
41
|
-
|
|
42
|
-
intent: {
|
|
43
|
-
name: 'intent';
|
|
44
|
-
tools: ToolCatalogEntry[];
|
|
45
|
-
};
|
|
46
|
-
operation: {
|
|
47
|
-
name: 'operation';
|
|
48
|
-
tools: ToolCatalogEntry[];
|
|
49
|
-
};
|
|
50
|
-
};
|
|
19
|
+
tools: ToolCatalogEntry[];
|
|
51
20
|
};
|
|
52
21
|
type ToolCatalogEntry = {
|
|
53
22
|
operationId: string;
|
|
54
23
|
toolName: string;
|
|
55
|
-
profile:
|
|
56
|
-
source:
|
|
24
|
+
profile: string;
|
|
25
|
+
source: string;
|
|
57
26
|
description: string;
|
|
58
27
|
inputSchema: Record<string, unknown>;
|
|
59
28
|
outputSchema: Record<string, unknown>;
|
|
60
29
|
mutates: boolean;
|
|
61
30
|
category: string;
|
|
31
|
+
essential?: boolean;
|
|
62
32
|
capabilities: string[];
|
|
63
33
|
constraints?: Record<string, unknown>;
|
|
64
34
|
errors: string[];
|
|
65
|
-
examples:
|
|
66
|
-
description: string;
|
|
67
|
-
args: Record<string, unknown>;
|
|
68
|
-
}>;
|
|
35
|
+
examples: unknown[];
|
|
69
36
|
commandTokens: string[];
|
|
70
37
|
profileTags: string[];
|
|
71
|
-
requiredCapabilities:
|
|
38
|
+
requiredCapabilities: string[];
|
|
72
39
|
sessionRequirements: {
|
|
73
40
|
requiresOpenContext: boolean;
|
|
74
41
|
supportsSessionTargeting: boolean;
|
|
75
42
|
};
|
|
76
43
|
intentId?: string;
|
|
77
44
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
export declare function listTools(provider: ToolProvider
|
|
82
|
-
profile?: ToolProfile;
|
|
83
|
-
}): Promise<unknown[]>;
|
|
45
|
+
/** All available tool groups from the policy. */
|
|
46
|
+
export declare function getAvailableGroups(): ToolGroup[];
|
|
47
|
+
export declare function getToolCatalog(): Promise<ToolCatalog>;
|
|
48
|
+
export declare function listTools(provider: ToolProvider): Promise<unknown[]>;
|
|
84
49
|
export declare function resolveToolOperation(toolName: string): Promise<string | null>;
|
|
85
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Select tools for a specific provider.
|
|
52
|
+
*
|
|
53
|
+
* **mode='essential'** (default): Returns only essential tools + discover_tools.
|
|
54
|
+
* Pass `groups` to additionally load all tools from those categories.
|
|
55
|
+
*
|
|
56
|
+
* **mode='all'**: Returns all tools from requested groups (or all groups if
|
|
57
|
+
* `groups` is omitted). No discover_tools included by default.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* // Default: 5 essential tools + discover_tools
|
|
62
|
+
* const { tools } = await chooseTools({ provider: 'openai' });
|
|
63
|
+
*
|
|
64
|
+
* // Essential + all comment tools
|
|
65
|
+
* const { tools } = await chooseTools({ provider: 'openai', groups: ['comments'] });
|
|
66
|
+
*
|
|
67
|
+
* // All tools (old behavior)
|
|
68
|
+
* const { tools } = await chooseTools({ provider: 'openai', mode: 'all' });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
86
71
|
export declare function chooseTools(input: ToolChooserInput): Promise<{
|
|
87
72
|
tools: unknown[];
|
|
88
73
|
selected: Array<{
|
|
@@ -90,20 +75,12 @@ export declare function chooseTools(input: ToolChooserInput): Promise<{
|
|
|
90
75
|
toolName: string;
|
|
91
76
|
category: string;
|
|
92
77
|
mutates: boolean;
|
|
93
|
-
profile: ToolProfile;
|
|
94
|
-
}>;
|
|
95
|
-
excluded: Array<{
|
|
96
|
-
toolName: string;
|
|
97
|
-
reason: string;
|
|
98
78
|
}>;
|
|
99
|
-
|
|
100
|
-
profile: ToolProfile;
|
|
101
|
-
phase: ToolPhase;
|
|
102
|
-
maxTools: number;
|
|
103
|
-
minReadTools: number;
|
|
104
|
-
selectedCount: number;
|
|
105
|
-
decisionVersion: string;
|
|
79
|
+
meta: {
|
|
106
80
|
provider: ToolProvider;
|
|
81
|
+
mode: string;
|
|
82
|
+
groups: string[];
|
|
83
|
+
selectedCount: number;
|
|
107
84
|
};
|
|
108
85
|
}>;
|
|
109
86
|
export declare function dispatchSuperDocTool(client: {
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,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