@lvy-jsd/dsh-tool-manager 0.0.0-stage → 0.4.0
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/LICENSE +21 -0
- package/README.md +302 -2
- package/cordis.patch.yml +29 -0
- package/lib/catalog.d.ts +35 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/catalog.js +311 -0
- package/lib/catalog.js.map +1 -0
- package/lib/exempt.d.ts +45 -0
- package/lib/exempt.d.ts.map +1 -0
- package/lib/exempt.js +122 -0
- package/lib/exempt.js.map +1 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +797 -0
- package/lib/index.js.map +1 -0
- package/lib/manifest.d.ts +21 -0
- package/lib/manifest.d.ts.map +1 -0
- package/lib/manifest.js +112 -0
- package/lib/manifest.js.map +1 -0
- package/lib/metadata.d.ts +38 -0
- package/lib/metadata.d.ts.map +1 -0
- package/lib/metadata.js +102 -0
- package/lib/metadata.js.map +1 -0
- package/lib/router/bm25.d.ts +21 -0
- package/lib/router/bm25.d.ts.map +1 -0
- package/lib/router/bm25.js +63 -0
- package/lib/router/bm25.js.map +1 -0
- package/lib/router/index.d.ts +9 -0
- package/lib/router/index.d.ts.map +1 -0
- package/lib/router/index.js +422 -0
- package/lib/router/index.js.map +1 -0
- package/lib/router/sidecar.d.ts +34 -0
- package/lib/router/sidecar.d.ts.map +1 -0
- package/lib/router/sidecar.js +156 -0
- package/lib/router/sidecar.js.map +1 -0
- package/lib/router/types.d.ts +164 -0
- package/lib/router/types.d.ts.map +1 -0
- package/lib/router/types.js +7 -0
- package/lib/router/types.js.map +1 -0
- package/lib/service.d.ts +51 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +199 -0
- package/lib/service.js.map +1 -0
- package/lib/settings.d.ts +32 -0
- package/lib/settings.d.ts.map +1 -0
- package/lib/settings.js +93 -0
- package/lib/settings.js.map +1 -0
- package/lib/types.d.ts +453 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/visibility.d.ts +33 -0
- package/lib/visibility.d.ts.map +1 -0
- package/lib/visibility.js +305 -0
- package/lib/visibility.js.map +1 -0
- package/package.json +54 -4
- package/sidecar/bin/tool-router-sidecar +0 -0
- package/src/catalog.ts +305 -0
- package/src/exempt.ts +148 -0
- package/src/index.ts +805 -0
- package/src/manifest.ts +116 -0
- package/src/metadata.ts +123 -0
- package/src/router/bm25.ts +68 -0
- package/src/router/index.ts +440 -0
- package/src/router/sidecar.ts +159 -0
- package/src/router/types.ts +149 -0
- package/src/service.ts +207 -0
- package/src/settings.ts +108 -0
- package/src/types.ts +450 -0
- package/src/visibility.ts +317 -0
package/lib/catalog.js
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// Builds the three-level tool directory: category -> group -> tool.
|
|
2
|
+
//
|
|
3
|
+
// The core knows no rules. Placement comes from, in order:
|
|
4
|
+
// 1. override classifiers (priority >= OVERRIDE_PRIORITY), e.g. user config
|
|
5
|
+
// 2. annotations declared by plugins (package.json `dsh.toolCatalog`, annotate())
|
|
6
|
+
// 3. ordinary classifiers, highest priority first
|
|
7
|
+
// 4. a structural fallback: group from the tool name, category `uncategorized`
|
|
8
|
+
//
|
|
9
|
+
// Grouping never decides visibility; a misplaced tool is only listed in the
|
|
10
|
+
// wrong place, never lost.
|
|
11
|
+
export const UNCATEGORIZED = 'uncategorized';
|
|
12
|
+
export const MISC_GROUP = 'misc';
|
|
13
|
+
export const OVERRIDE_PRIORITY = 1000;
|
|
14
|
+
// The fixed category vocabulary. Plugins may add more with defineCategory().
|
|
15
|
+
export const DEFAULT_CATEGORIES = {
|
|
16
|
+
device: 'Phones, Android, ADB and desktop control',
|
|
17
|
+
code: 'Source hosting, repositories and package tooling',
|
|
18
|
+
media: 'Video, image and audio services',
|
|
19
|
+
maps: 'Maps, geocoding and routing',
|
|
20
|
+
browser: 'Headless browser automation',
|
|
21
|
+
memory: 'Long-term memory and knowledge stores',
|
|
22
|
+
collaboration: 'Bots, group chats, teammates and other sessions',
|
|
23
|
+
automation: 'Schedules and automated runs',
|
|
24
|
+
connectors: 'MCP connector administration',
|
|
25
|
+
search: 'Web and social search',
|
|
26
|
+
system: 'Host, OS and secrets',
|
|
27
|
+
[UNCATEGORIZED]: 'Tools no classifier has placed yet',
|
|
28
|
+
};
|
|
29
|
+
// Leading words that describe an action rather than an owner; a shared verb
|
|
30
|
+
// prefix ("list_", "get_") is not a meaningful group.
|
|
31
|
+
const VERB_PREFIXES = new Set([
|
|
32
|
+
'add', 'ask', 'attach', 'create', 'delete', 'detach', 'edit', 'exit', 'get',
|
|
33
|
+
'interrupt', 'list', 'message', 'open', 'post', 'read', 'remove', 'request',
|
|
34
|
+
'run', 'save', 'send', 'set', 'spawn', 'stop', 'update', 'wait', 'write',
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* Structural group for a tool name, used when nothing else places it:
|
|
38
|
+
* `mcp__server__tool` -> server, `mcp__server__sub__tool` -> server-sub,
|
|
39
|
+
* `prefix_rest` -> prefix when at least two tools share a non-verb prefix, else misc.
|
|
40
|
+
*/
|
|
41
|
+
export function structuralGroup(name, prefixCounts) {
|
|
42
|
+
if (name.startsWith('mcp__')) {
|
|
43
|
+
const parts = name.slice(5).split('__');
|
|
44
|
+
if (parts.length >= 3)
|
|
45
|
+
return `${parts[0]}-${parts[1]}`;
|
|
46
|
+
return parts[0];
|
|
47
|
+
}
|
|
48
|
+
const prefix = name.split('_')[0];
|
|
49
|
+
if (prefix !== name && !VERB_PREFIXES.has(prefix) && (prefixCounts.get(prefix) ?? 0) >= 2)
|
|
50
|
+
return prefix;
|
|
51
|
+
return MISC_GROUP;
|
|
52
|
+
}
|
|
53
|
+
/** Short form of a tool name inside its group (drops the MCP routing prefix). */
|
|
54
|
+
export function shortName(name) {
|
|
55
|
+
if (!name.startsWith('mcp__'))
|
|
56
|
+
return name;
|
|
57
|
+
const parts = name.slice(5).split('__');
|
|
58
|
+
return parts[parts.length - 1] ?? name;
|
|
59
|
+
}
|
|
60
|
+
/** First sentence of a description, capped for one-line listings. */
|
|
61
|
+
export function summary(text, max = 80) {
|
|
62
|
+
const flat = String(text ?? '').replace(/\s+/g, ' ').trim();
|
|
63
|
+
const first = flat.split(/(?<=[.!?。!?])\s/)[0] ?? '';
|
|
64
|
+
return first.length > max ? `${first.slice(0, max - 1)}…` : first;
|
|
65
|
+
}
|
|
66
|
+
/** Rough token cost of one schema as the model receives it. */
|
|
67
|
+
export function estimateTokens(schema) {
|
|
68
|
+
const text = JSON.stringify(schema);
|
|
69
|
+
// CJK and other wide characters cost roughly one token each, not a quarter.
|
|
70
|
+
let wide = 0;
|
|
71
|
+
for (const ch of text)
|
|
72
|
+
if ((ch.codePointAt(0) ?? 0) > 0x2e7f)
|
|
73
|
+
wide += 1;
|
|
74
|
+
return Math.ceil((text.length - wide) / 4 + wide);
|
|
75
|
+
}
|
|
76
|
+
/** Merge every annotation that applies to `name`; later annotations win per field. */
|
|
77
|
+
function annotationFor(name, annotations) {
|
|
78
|
+
let merged;
|
|
79
|
+
for (const a of annotations) {
|
|
80
|
+
const hit = typeof a.match === 'string' ? a.match === name : a.match.test(name);
|
|
81
|
+
if (hit)
|
|
82
|
+
merged = { ...merged, ...a.meta };
|
|
83
|
+
}
|
|
84
|
+
return merged ?? {};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A group a classifier renamed (e.g. attribution-scan: `phone` -> `phone-control`)
|
|
88
|
+
* is unknown to category rules written for the old name. Ask the classifiers
|
|
89
|
+
* about the structural groups its tools came from instead; the category covering
|
|
90
|
+
* the most tools wins.
|
|
91
|
+
*/
|
|
92
|
+
function inheritedCategory(group, classifiers) {
|
|
93
|
+
const byFallback = new Map();
|
|
94
|
+
for (const tool of group.tools) {
|
|
95
|
+
if (tool.fallbackGroup === group.name)
|
|
96
|
+
continue;
|
|
97
|
+
let list = byFallback.get(tool.fallbackGroup);
|
|
98
|
+
if (!list)
|
|
99
|
+
byFallback.set(tool.fallbackGroup, (list = []));
|
|
100
|
+
list.push(tool);
|
|
101
|
+
}
|
|
102
|
+
const votes = new Map();
|
|
103
|
+
for (const [name, tools] of byFallback) {
|
|
104
|
+
const probe = { name, tools: tools.map(({ name: n, description, annotation }) => ({ name: n, description, annotation })) };
|
|
105
|
+
const category = firstResult(classifiers, 'categorize', probe);
|
|
106
|
+
if (category && category !== UNCATEGORIZED)
|
|
107
|
+
votes.set(category, (votes.get(category) ?? 0) + tools.length);
|
|
108
|
+
}
|
|
109
|
+
let best;
|
|
110
|
+
for (const [category, count] of votes)
|
|
111
|
+
if (!best || count > best[1])
|
|
112
|
+
best = [category, count];
|
|
113
|
+
return best?.[0];
|
|
114
|
+
}
|
|
115
|
+
function firstResult(classifiers, method, arg) {
|
|
116
|
+
for (const c of classifiers) {
|
|
117
|
+
const fn = c[method];
|
|
118
|
+
if (typeof fn !== 'function')
|
|
119
|
+
continue;
|
|
120
|
+
try {
|
|
121
|
+
const value = fn.call(c, arg);
|
|
122
|
+
if (typeof value === 'string' && value)
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// A failing classifier is skipped, never fatal.
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build the directory index.
|
|
133
|
+
* @param schemas - catalog tools (pinned already removed)
|
|
134
|
+
*/
|
|
135
|
+
export function buildCatalog(schemas, { classifiers = [], annotations = [], categories = DEFAULT_CATEGORIES, highRisk = [] } = {}) {
|
|
136
|
+
const sorted = [...classifiers].sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
137
|
+
const overrides = sorted.filter((c) => (c.priority ?? 0) >= OVERRIDE_PRIORITY);
|
|
138
|
+
const ordinary = sorted.filter((c) => (c.priority ?? 0) < OVERRIDE_PRIORITY);
|
|
139
|
+
const prefixCounts = new Map();
|
|
140
|
+
for (const { name } of schemas) {
|
|
141
|
+
const prefix = name.split('_')[0];
|
|
142
|
+
if (prefix !== name)
|
|
143
|
+
prefixCounts.set(prefix, (prefixCounts.get(prefix) ?? 0) + 1);
|
|
144
|
+
}
|
|
145
|
+
const risky = new Set(highRisk);
|
|
146
|
+
const tools = new Map();
|
|
147
|
+
const groups = new Map();
|
|
148
|
+
for (const schema of schemas) {
|
|
149
|
+
const meta = annotationFor(schema.name, annotations);
|
|
150
|
+
const probe = { name: schema.name, description: schema.description ?? '', annotation: meta };
|
|
151
|
+
const group = firstResult(overrides, 'group', probe)
|
|
152
|
+
?? meta.group
|
|
153
|
+
?? firstResult(ordinary, 'group', probe)
|
|
154
|
+
?? structuralGroup(schema.name, prefixCounts);
|
|
155
|
+
const entry = {
|
|
156
|
+
name: schema.name,
|
|
157
|
+
short: shortName(schema.name),
|
|
158
|
+
group,
|
|
159
|
+
// Where the structural fallback alone would have put it; a renamed group
|
|
160
|
+
// inherits that group's category (see below).
|
|
161
|
+
fallbackGroup: structuralGroup(schema.name, prefixCounts),
|
|
162
|
+
category: UNCATEGORIZED,
|
|
163
|
+
summary: meta.summary ? summary(meta.summary) : summary(schema.description),
|
|
164
|
+
description: schema.description ?? '',
|
|
165
|
+
tokens: estimateTokens(schema),
|
|
166
|
+
highRisk: risky.has(schema.name) || meta.risk === 'high',
|
|
167
|
+
annotation: meta,
|
|
168
|
+
};
|
|
169
|
+
tools.set(schema.name, entry);
|
|
170
|
+
let bucket = groups.get(group);
|
|
171
|
+
if (!bucket)
|
|
172
|
+
groups.set(group, (bucket = { name: group, category: UNCATEGORIZED, tools: [] }));
|
|
173
|
+
bucket.tools.push(entry);
|
|
174
|
+
}
|
|
175
|
+
for (const group of groups.values()) {
|
|
176
|
+
group.tools.sort((a, b) => a.short.localeCompare(b.short));
|
|
177
|
+
const probe = { name: group.name, tools: group.tools.map(({ name, description, annotation }) => ({ name, description, annotation })) };
|
|
178
|
+
const annotated = group.tools.map((t) => t.annotation.category).find(Boolean);
|
|
179
|
+
group.category = firstResult(overrides, 'categorize', probe)
|
|
180
|
+
?? annotated
|
|
181
|
+
?? firstResult(ordinary, 'categorize', probe)
|
|
182
|
+
?? inheritedCategory(group, [...overrides, ...ordinary])
|
|
183
|
+
?? UNCATEGORIZED;
|
|
184
|
+
for (const tool of group.tools)
|
|
185
|
+
tool.category = group.category;
|
|
186
|
+
}
|
|
187
|
+
const categoryIndex = new Map();
|
|
188
|
+
for (const [name, description] of Object.entries(categories))
|
|
189
|
+
categoryIndex.set(name, { name, description, groups: [] });
|
|
190
|
+
for (const group of groups.values()) {
|
|
191
|
+
let category = categoryIndex.get(group.category);
|
|
192
|
+
if (!category)
|
|
193
|
+
categoryIndex.set(group.category, (category = { name: group.category, description: '', groups: [] }));
|
|
194
|
+
category.groups.push(group);
|
|
195
|
+
}
|
|
196
|
+
for (const category of categoryIndex.values())
|
|
197
|
+
category.groups.sort((a, b) => a.name.localeCompare(b.name));
|
|
198
|
+
return { tools, groups, categories: categoryIndex };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Resolve a target into catalog nodes.
|
|
202
|
+
* Accepts "/", "/category", "/category/group", "/category/group/tool",
|
|
203
|
+
* a bare category or group name, a full tool name, or a unique short tool name.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* Resolve a target string to a node.
|
|
207
|
+
*
|
|
208
|
+
* `resolvers` lets a plugin own a prefix (`cap:`, say): each is consulted before
|
|
209
|
+
* the built-in rules and returns a list of target strings to resolve instead, or
|
|
210
|
+
* undefined to pass. A plugin can therefore add a target vocabulary without the
|
|
211
|
+
* core knowing anything about it.
|
|
212
|
+
*/
|
|
213
|
+
// Path segments are lowercased, but names keep their original case (an MCP
|
|
214
|
+
// server called "GitHub"), so lookups must not depend on it. The names stay as
|
|
215
|
+
// they are because persisted state stores them.
|
|
216
|
+
const findCI = (map, key) => map.get(key) ?? [...map.values()].find((v) => v.name.toLowerCase() === key);
|
|
217
|
+
export function resolveTarget(catalog, raw, resolvers = []) {
|
|
218
|
+
const target = String(raw ?? '').trim();
|
|
219
|
+
for (const { prefix, resolve } of resolvers) {
|
|
220
|
+
if (prefix && !target.startsWith(prefix))
|
|
221
|
+
continue;
|
|
222
|
+
let expanded;
|
|
223
|
+
try {
|
|
224
|
+
expanded = resolve(target);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (expanded === undefined || expanded === null)
|
|
230
|
+
continue;
|
|
231
|
+
const list = Array.isArray(expanded) ? expanded : [expanded];
|
|
232
|
+
const nodes = list.map((one) => resolveTarget(catalog, one, resolvers));
|
|
233
|
+
if (nodes.length === 0)
|
|
234
|
+
return { kind: 'missing', target };
|
|
235
|
+
if (nodes.length === 1)
|
|
236
|
+
return nodes[0];
|
|
237
|
+
// Several targets behind one alias: expose them as a synthetic category so
|
|
238
|
+
// loading, listing and unloading all work through the existing paths.
|
|
239
|
+
const tools = nodes.flatMap((node) => toolsUnder(catalog, node));
|
|
240
|
+
// `aliasTools` is the exact tool list. The node's groups are copies, so
|
|
241
|
+
// loading must use this list rather than subscribe to the group names —
|
|
242
|
+
// otherwise a shared group would drag in every sibling tool.
|
|
243
|
+
return {
|
|
244
|
+
kind: 'category',
|
|
245
|
+
category: { name: target, description: `Alias for ${list.join(', ')}`, groups: groupsOf(tools), alias: list, aliasTools: tools },
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (target === '' || target === '/')
|
|
249
|
+
return { kind: 'root' };
|
|
250
|
+
const exact = catalog.tools.get(target);
|
|
251
|
+
if (exact)
|
|
252
|
+
return { kind: 'tool', tool: exact };
|
|
253
|
+
const parts = target.replace(/^\/+|\/+$/g, '').split('/').filter(Boolean).map((p) => p.toLowerCase());
|
|
254
|
+
if (parts.length === 1) {
|
|
255
|
+
const only = parts[0];
|
|
256
|
+
const category = findCI(catalog.categories, only);
|
|
257
|
+
if (category)
|
|
258
|
+
return { kind: 'category', category };
|
|
259
|
+
const group = findCI(catalog.groups, only);
|
|
260
|
+
if (group)
|
|
261
|
+
return { kind: 'group', group };
|
|
262
|
+
const byShort = [...catalog.tools.values()].filter((t) => t.short.toLowerCase() === only);
|
|
263
|
+
if (byShort.length === 1)
|
|
264
|
+
return { kind: 'tool', tool: byShort[0] };
|
|
265
|
+
return { kind: 'missing', target };
|
|
266
|
+
}
|
|
267
|
+
const [cat = '', grp, tool] = parts;
|
|
268
|
+
const category = findCI(catalog.categories, cat);
|
|
269
|
+
if (!category)
|
|
270
|
+
return { kind: 'missing', target };
|
|
271
|
+
const group = category.groups.find((g) => g.name.toLowerCase() === grp);
|
|
272
|
+
if (!group)
|
|
273
|
+
return { kind: 'missing', target };
|
|
274
|
+
if (parts.length === 2)
|
|
275
|
+
return { kind: 'group', group };
|
|
276
|
+
const entry = group.tools.find((t) => t.short.toLowerCase() === tool || t.name.toLowerCase() === tool);
|
|
277
|
+
if (!entry || parts.length > 3)
|
|
278
|
+
return { kind: 'missing', target };
|
|
279
|
+
return { kind: 'tool', tool: entry };
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Regroup an exact tool list by its original group, for synthetic nodes.
|
|
283
|
+
*
|
|
284
|
+
* The groups are copies holding only the given tools: reusing the catalog's own
|
|
285
|
+
* group objects would drag in every sibling tool, so an alias would load far
|
|
286
|
+
* more than it declares.
|
|
287
|
+
*/
|
|
288
|
+
function groupsOf(tools) {
|
|
289
|
+
const byName = new Map();
|
|
290
|
+
for (const tool of tools) {
|
|
291
|
+
let group = byName.get(tool.group);
|
|
292
|
+
if (!group)
|
|
293
|
+
byName.set(tool.group, (group = { name: tool.group, category: tool.category, tools: [] }));
|
|
294
|
+
if (!group.tools.includes(tool))
|
|
295
|
+
group.tools.push(tool);
|
|
296
|
+
}
|
|
297
|
+
return [...byName.values()];
|
|
298
|
+
}
|
|
299
|
+
/** Tools under a node (whole tree for root). */
|
|
300
|
+
export function toolsUnder(catalog, node) {
|
|
301
|
+
if (node.kind === 'root')
|
|
302
|
+
return [...catalog.tools.values()];
|
|
303
|
+
if (node.kind === 'category')
|
|
304
|
+
return node.category.groups.flatMap((g) => g.tools);
|
|
305
|
+
if (node.kind === 'group')
|
|
306
|
+
return node.group.tools;
|
|
307
|
+
if (node.kind === 'tool')
|
|
308
|
+
return [node.tool];
|
|
309
|
+
return [];
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,2DAA2D;AAC3D,8EAA8E;AAC9E,oFAAoF;AACpF,oDAAoD;AACpD,iFAAiF;AACjF,EAAE;AACF,4EAA4E;AAC5E,2BAA2B;AAI3B,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAA;AAC5C,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAA;AAChC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAErC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,MAAM,EAAE,0CAA0C;IAClD,IAAI,EAAE,kDAAkD;IACxD,KAAK,EAAE,iCAAiC;IACxC,IAAI,EAAE,6BAA6B;IACnC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,uCAAuC;IAC/C,aAAa,EAAE,iDAAiD;IAChE,UAAU,EAAE,8BAA8B;IAC1C,UAAU,EAAE,8BAA8B;IAC1C,MAAM,EAAE,uBAAuB;IAC/B,MAAM,EAAE,sBAAsB;IAC9B,CAAC,aAAa,CAAC,EAAE,oCAAoC;CACtD,CAAA;AAED,4EAA4E;AAC5E,sDAAsD;AACtD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAA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C,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACtG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;AAC7B,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,IAAiB;IAC5D,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5D,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACjF,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;IAClD,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5C,OAAO,EAAE,CAAA;AACX,CAAC"}
|
package/lib/exempt.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Logger } from './types.js';
|
|
2
|
+
/** An exemption list: routes and sessions. Both may be empty. */
|
|
3
|
+
export interface ExemptConfig {
|
|
4
|
+
providers: string[];
|
|
5
|
+
sessions: string[];
|
|
6
|
+
}
|
|
7
|
+
/** Where the exemption file lives unless a deployment points elsewhere. */
|
|
8
|
+
export declare function defaultExemptFile(): string;
|
|
9
|
+
/** The whole file, with unknown keys dropped. */
|
|
10
|
+
export declare function pickExempt(raw: unknown): ExemptConfig;
|
|
11
|
+
/** Read the exemption file; missing or corrupt is "no opinion", never a crash. */
|
|
12
|
+
export declare function readExemptFile(file: string, logger?: Logger): ExemptConfig | undefined;
|
|
13
|
+
/** Write the file atomically, so a crash cannot leave a half-written list. */
|
|
14
|
+
export declare function writeExemptFile(file: string, config: ExemptConfig, logger?: Logger): void;
|
|
15
|
+
/** Why a session is exempt, for the panel to show. */
|
|
16
|
+
export interface ExemptReason {
|
|
17
|
+
exempt: boolean;
|
|
18
|
+
/** 'file:provider' | 'file:session' | 'config:provider' | '' */
|
|
19
|
+
source: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ExemptStore {
|
|
22
|
+
/** File the store reads and writes; the file itself is the override switch. */
|
|
23
|
+
file: string;
|
|
24
|
+
/** True when the file exists, so the config provider list is ignored. */
|
|
25
|
+
present(): boolean;
|
|
26
|
+
/** The lists in force: the file when it exists, else the plugin config. */
|
|
27
|
+
effective(): ExemptConfig;
|
|
28
|
+
/** Why one session is exempt, if it is. */
|
|
29
|
+
reasonFor(provider: string | undefined, sessionId: string | undefined): ExemptReason;
|
|
30
|
+
/** Add or remove one session, writing the file. Returns the lists in force. */
|
|
31
|
+
setSession(sessionId: string, exempt: boolean): ExemptConfig;
|
|
32
|
+
/** Re-read the file, for after an external edit. Returns the lists in force. */
|
|
33
|
+
reload(): ExemptConfig;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Exemption store over one file, with the plugin config as the fallback layer.
|
|
37
|
+
* The file wins as a whole rather than per key: an operator writing the file
|
|
38
|
+
* means it, and a partial merge would leave entries they cannot see.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createExemptStore({ file, configProviders, logger }: {
|
|
41
|
+
file: string;
|
|
42
|
+
configProviders?: readonly string[];
|
|
43
|
+
logger?: Logger;
|
|
44
|
+
}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AI,YAAY,CAAA;CACvB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,eAAoB,EAAE,MAAM,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CA+B7J"}
|
package/lib/exempt.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// File-based exemption list for dsh-tool-manager.
|
|
2
|
+
//
|
|
3
|
+
// An exempt session is never narrowed: a route whose tool list is handed to an
|
|
4
|
+
// external client once at session start (Claude Code, say) cannot load a tool
|
|
5
|
+
// that was hidden from the first request, so hiding anything there only loses
|
|
6
|
+
// tools. The provider list originally came from `exemptProviders` in
|
|
7
|
+
// cordis.patch.yml, which a user cannot edit from the browser and which is
|
|
8
|
+
// awkward to change per session.
|
|
9
|
+
//
|
|
10
|
+
// This file replaces it: when <DSH_HOME>/tool-manager/exempt.json exists it wins
|
|
11
|
+
// over the plugin config, the same way the settings file does. Two entry forms
|
|
12
|
+
// are supported, because they answer different questions:
|
|
13
|
+
//
|
|
14
|
+
// { "providers": ["claude-code"], "sessions": ["s_abc123"] }
|
|
15
|
+
//
|
|
16
|
+
// providers model routes never narrowed, for every session (durable)
|
|
17
|
+
// sessions one session exempted for its remaining lifetime, e.g. while the
|
|
18
|
+
// user checks whether a client handles lazy loading (temporary)
|
|
19
|
+
//
|
|
20
|
+
// Sessions are matched against the agent's session id and, as a fallback, the
|
|
21
|
+
// agent id, so an entry can be removed by hand without knowing which of the two
|
|
22
|
+
// the host populated.
|
|
23
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
24
|
+
import { homedir } from 'node:os';
|
|
25
|
+
import { dirname, join } from 'node:path';
|
|
26
|
+
/** Where the exemption file lives unless a deployment points elsewhere. */
|
|
27
|
+
export function defaultExemptFile() {
|
|
28
|
+
const dshHome = process.env.DSH_HOME || join(homedir(), '.config', 'deepseek-harness');
|
|
29
|
+
return join(dshHome, 'tool-manager', 'exempt.json');
|
|
30
|
+
}
|
|
31
|
+
/** Keep only non-empty strings; a number or object in the file is a typo, not a name. */
|
|
32
|
+
function pickNames(value) {
|
|
33
|
+
if (!Array.isArray(value))
|
|
34
|
+
return [];
|
|
35
|
+
return value.filter((name) => typeof name === 'string' && name.trim().length > 0).map((name) => name.trim());
|
|
36
|
+
}
|
|
37
|
+
/** The whole file, with unknown keys dropped. */
|
|
38
|
+
export function pickExempt(raw) {
|
|
39
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
40
|
+
return { providers: [], sessions: [] };
|
|
41
|
+
const record = raw;
|
|
42
|
+
// `providers` is required: a file that omits it says "no route is exempt",
|
|
43
|
+
// not "keep the old config list", because the file is the override.
|
|
44
|
+
return { providers: pickNames(record.providers), sessions: pickNames(record.sessions) };
|
|
45
|
+
}
|
|
46
|
+
/** Read the exemption file; missing or corrupt is "no opinion", never a crash. */
|
|
47
|
+
export function readExemptFile(file, logger) {
|
|
48
|
+
let text;
|
|
49
|
+
try {
|
|
50
|
+
text = readFileSync(file, 'utf8');
|
|
51
|
+
}
|
|
52
|
+
catch (caught) {
|
|
53
|
+
const error = caught;
|
|
54
|
+
// ENOENT is the normal first run: no file means the plugin config decides.
|
|
55
|
+
if (error.code !== 'ENOENT')
|
|
56
|
+
logger?.warn?.(`tool-manager: ignoring unreadable exemptions ${file}: ${error.message}`);
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
return pickExempt(JSON.parse(text));
|
|
61
|
+
}
|
|
62
|
+
catch (caught) {
|
|
63
|
+
// A corrupt file must not silently restore the config list: the user
|
|
64
|
+
// intended the file to be in charge, so report and treat it as "no exempt".
|
|
65
|
+
logger?.warn?.(`tool-manager: unreadable exemptions ${file}: ${caught.message}`);
|
|
66
|
+
return { providers: [], sessions: [] };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Write the file atomically, so a crash cannot leave a half-written list. */
|
|
70
|
+
export function writeExemptFile(file, config, logger) {
|
|
71
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
72
|
+
const tmp = `${file}.tmp`;
|
|
73
|
+
try {
|
|
74
|
+
writeFileSync(tmp, `${JSON.stringify({ providers: config.providers, sessions: config.sessions }, null, 2)}\n`);
|
|
75
|
+
renameSync(tmp, file);
|
|
76
|
+
}
|
|
77
|
+
catch (caught) {
|
|
78
|
+
logger?.warn?.(`tool-manager: writing exemptions ${file} failed: ${caught.message}`);
|
|
79
|
+
throw caught;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Exemption store over one file, with the plugin config as the fallback layer.
|
|
84
|
+
* The file wins as a whole rather than per key: an operator writing the file
|
|
85
|
+
* means it, and a partial merge would leave entries they cannot see.
|
|
86
|
+
*/
|
|
87
|
+
export function createExemptStore({ file, configProviders = [], logger }) {
|
|
88
|
+
let fromFile = readExemptFile(file, logger);
|
|
89
|
+
const effective = () => fromFile ?? { providers: [...configProviders], sessions: [] };
|
|
90
|
+
return {
|
|
91
|
+
file,
|
|
92
|
+
present: () => fromFile !== undefined,
|
|
93
|
+
effective,
|
|
94
|
+
reasonFor(provider, sessionId) {
|
|
95
|
+
const current = effective();
|
|
96
|
+
if (provider !== undefined && current.providers.includes(provider)) {
|
|
97
|
+
return { exempt: true, source: fromFile !== undefined ? 'file:provider' : 'config:provider' };
|
|
98
|
+
}
|
|
99
|
+
if (sessionId !== undefined && current.sessions.includes(sessionId))
|
|
100
|
+
return { exempt: true, source: 'file:session' };
|
|
101
|
+
return { exempt: false, source: '' };
|
|
102
|
+
},
|
|
103
|
+
setSession(sessionId, exempt) {
|
|
104
|
+
// Editing starts from what is in force, so the first panel click writes a
|
|
105
|
+
// file that keeps the exemptions the user could already see.
|
|
106
|
+
const current = effective();
|
|
107
|
+
const sessions = new Set(current.sessions);
|
|
108
|
+
if (exempt)
|
|
109
|
+
sessions.add(sessionId);
|
|
110
|
+
else
|
|
111
|
+
sessions.delete(sessionId);
|
|
112
|
+
fromFile = { providers: [...current.providers], sessions: [...sessions] };
|
|
113
|
+
writeExemptFile(file, fromFile, logger);
|
|
114
|
+
return effective();
|
|
115
|
+
},
|
|
116
|
+
reload() {
|
|
117
|
+
fromFile = readExemptFile(file, logger);
|
|
118
|
+
return effective();
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=exempt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exempt.js","sourceRoot":"","sources":["../src/exempt.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,qEAAqE;AACrE,2EAA2E;AAC3E,iCAAiC;AACjC,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,0DAA0D;AAC1D,EAAE;AACF,+DAA+D;AAC/D,EAAE;AACF,wEAAwE;AACxE,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,sBAAsB;AAEtB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AASzC,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAA;IACtF,OAAO,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,CAAC,CAAA;AACrD,CAAC;AAED,yFAAyF;AACzF,SAAS,SAAS,CAAC,KA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,SAAS,EAAE,CAAA;QACpB,CAAC;QACD,MAAM;YACJ,QAAQ,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YACvC,OAAO,SAAS,EAAE,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CoreConfig, HostContext } from './types.js';
|
|
2
|
+
export type * from './types.js';
|
|
3
|
+
export { buildCatalog, resolveTarget, toolsUnder, estimateTokens, summary, shortName, structuralGroup, DEFAULT_CATEGORIES, UNCATEGORIZED, MISC_GROUP, OVERRIDE_PRIORITY } from './catalog.js';
|
|
4
|
+
export type { BuildOptions } from './catalog.js';
|
|
5
|
+
export type { RegisteredClassifier, RegisteredFilter } from './service.js';
|
|
6
|
+
export type { VisibilityController, VisibilityOptions } from './visibility.js';
|
|
7
|
+
export declare const name = "tool-manager";
|
|
8
|
+
export declare const inject: string[];
|
|
9
|
+
export declare const ENTRY_TOOLS: string[];
|
|
10
|
+
export declare const HOST_RESERVED: string[];
|
|
11
|
+
export declare const DEFAULT_PINNED: string[];
|
|
12
|
+
export declare function apply(ctx: HostContext, config?: CoreConfig): void;
|
|
13
|
+
/** Options for toolCatalog.load / tools_load. */
|
|
14
|
+
export interface LoadOptions {
|
|
15
|
+
/** Also hand the targets to subagents started afterwards. */
|
|
16
|
+
forSubagents?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: {
|
|
19
|
+
name: string;
|
|
20
|
+
inject: string[];
|
|
21
|
+
apply: typeof apply;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA2C,UAAU,EAAY,WAAW,EAA0F,MAAM,YAAY,CAAA;AAEpM,mBAAmB,YAAY,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC7L,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1E,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAE9E,eAAO,MAAM,IAAI,iBAAiB,CAAA;AAClC,eAAO,MAAM,MAAM,UAAY,CAAA;AAE/B,eAAO,MAAM,WAAW,UAA6C,CAAA;AAMrE,eAAO,MAAM,aAAa,UAAe,CAAA;AAKzC,eAAO,MAAM,cAAc,UAY1B,CAAA;AAeD,wBAAgB,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,GAAE,UAAe,QAmtB9D;AAED,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;;;;;;AAOD,wBAAsC"}
|