@daweifu/capability-menu 0.1.0 → 0.1.2
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.en.md +217 -0
- package/README.md +144 -135
- package/cordis.patch.yml +41 -33
- package/lib/client.d.ts +182 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +6508 -0
- package/lib/index.js +27 -13
- package/lib/index.js.map +1 -0
- package/lib/invoke.js +69 -97
- package/lib/invoke.js.map +1 -0
- package/lib/policy.js +228 -84
- package/lib/policy.js.map +1 -0
- package/lib/registry.js +184 -144
- package/lib/registry.js.map +1 -0
- package/lib/search.js +19 -10
- package/lib/search.js.map +1 -0
- package/lib/server/remote.js +194 -0
- package/lib/server/remote.js.map +1 -0
- package/lib/types/index.d.ts +25 -13
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/invoke.d.ts +7 -13
- package/lib/types/invoke.d.ts.map +1 -0
- package/lib/types/policy.d.ts +80 -57
- package/lib/types/policy.d.ts.map +1 -0
- package/lib/types/registry.d.ts +63 -26
- package/lib/types/registry.d.ts.map +1 -0
- package/lib/types/search.d.ts.map +1 -0
- package/lib/types/server/remote.d.ts +72 -0
- package/lib/types/server/remote.d.ts.map +1 -0
- package/package.json +55 -27
- package/lib/invariant.js +0 -22
- package/lib/types/invariant.d.ts +0 -16
package/lib/policy.js
CHANGED
|
@@ -1,28 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Resident / On-demand / Disabled capability projection policy for the DeepSeek
|
|
3
3
|
* Harness.
|
|
4
4
|
*
|
|
5
5
|
* @module @daweifu/capability-menu (policy plugin)
|
|
6
6
|
*/
|
|
7
7
|
import z from '@deepseek-ai/schemastery';
|
|
8
|
+
import { escapeText } from '@deepseek-ai/dsh-skill';
|
|
8
9
|
import { serverNameOf } from "./registry.js";
|
|
9
10
|
/** Validate and default the policy configuration. */
|
|
10
11
|
export const Config = z.object({
|
|
11
12
|
tools: z.object({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
resident: z.array(z.string()).default([]),
|
|
14
|
+
'on-demand': z.array(z.string()).default([]),
|
|
15
|
+
disabled: z.array(z.string()).default([]),
|
|
16
|
+
// Deprecated pre-rename aliases: kept in the schema so a config cast keeps
|
|
17
|
+
// them available for `normalizeSetConfig` instead of stripping them.
|
|
18
|
+
blocked: z.array(z.string()),
|
|
19
|
+
exposed: z.array(z.string()),
|
|
20
|
+
progressive: z.array(z.string()),
|
|
15
21
|
}),
|
|
16
22
|
skills: z.object({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
resident: z.array(z.string()).default([]),
|
|
24
|
+
'on-demand': z.array(z.string()).default([]),
|
|
25
|
+
disabled: z.array(z.string()).default([]),
|
|
26
|
+
blocked: z.array(z.string()),
|
|
27
|
+
exposed: z.array(z.string()),
|
|
28
|
+
progressive: z.array(z.string()),
|
|
20
29
|
}),
|
|
21
30
|
metaTools: z.array(z.string()).default(['meta_search', 'meta_invoke']),
|
|
22
31
|
// schemastery object properties are optional-by-default; no `.optional()` needed.
|
|
23
|
-
progressiveSkillCatalog: z.string(),
|
|
24
32
|
});
|
|
25
33
|
export const DEFAULT_META_TOOLS = ['meta_search', 'meta_invoke'];
|
|
34
|
+
/**
|
|
35
|
+
* Map a legacy rule set (old keys `exposed`/`progressive`/`blocked`) onto the
|
|
36
|
+
* current key names (`resident`/`on-demand`/`disabled`), so already-deployed
|
|
37
|
+
* `cordis.patch.yml` profiles keep working without an on-disk rewrite. New
|
|
38
|
+
* keys win when they carry rules; a legacy key fills in when the matching new
|
|
39
|
+
* list is empty.
|
|
40
|
+
*/
|
|
41
|
+
export function normalizeSetConfig(set) {
|
|
42
|
+
if (set === undefined)
|
|
43
|
+
return undefined;
|
|
44
|
+
const next = {};
|
|
45
|
+
const resident = set.resident !== undefined && set.resident.length > 0 ? set.resident : undefined;
|
|
46
|
+
if (resident !== undefined)
|
|
47
|
+
next.resident = resident;
|
|
48
|
+
else if (set.exposed !== undefined && set.exposed.length > 0)
|
|
49
|
+
next.resident = set.exposed;
|
|
50
|
+
const onDemand = set['on-demand'] !== undefined && set['on-demand'].length > 0 ? set['on-demand'] : undefined;
|
|
51
|
+
if (onDemand !== undefined)
|
|
52
|
+
next['on-demand'] = onDemand;
|
|
53
|
+
else if (set.progressive !== undefined && set.progressive.length > 0)
|
|
54
|
+
next['on-demand'] = set.progressive;
|
|
55
|
+
const disabled = set.disabled !== undefined && set.disabled.length > 0 ? set.disabled : undefined;
|
|
56
|
+
if (disabled !== undefined)
|
|
57
|
+
next.disabled = disabled;
|
|
58
|
+
else if (set.blocked !== undefined && set.blocked.length > 0)
|
|
59
|
+
next.disabled = set.blocked;
|
|
60
|
+
return next;
|
|
61
|
+
}
|
|
26
62
|
/**
|
|
27
63
|
* Convert a user-facing rule string into a normalized {@link PolicyRule}.
|
|
28
64
|
* - `server:<name>` → server-targeted rule (`target: 'server'`).
|
|
@@ -57,9 +93,9 @@ export function compileGlob(pattern) {
|
|
|
57
93
|
/** Compile a {@link CapabilitySetConfig} into fast-matchable rules. */
|
|
58
94
|
export function compileSet(set = {}) {
|
|
59
95
|
return {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
96
|
+
resident: (set.resident ?? []).map(parseRule),
|
|
97
|
+
onDemand: (set['on-demand'] ?? []).map(parseRule),
|
|
98
|
+
disabled: (set.disabled ?? []).map(parseRule),
|
|
63
99
|
};
|
|
64
100
|
}
|
|
65
101
|
function ruleMatches(rule, target) {
|
|
@@ -68,8 +104,8 @@ function ruleMatches(rule, target) {
|
|
|
68
104
|
if (rule.target === 'id') {
|
|
69
105
|
if (!rule.wildcard) {
|
|
70
106
|
// An exact rule matches the full id OR the bare name (e.g. `debugging`
|
|
71
|
-
// matches `
|
|
72
|
-
// `bash` whose public name is its bare name).
|
|
107
|
+
// matches a skill named `debugging`, `bash` matches the harness-native
|
|
108
|
+
// tool `bash` whose public name is its bare name).
|
|
73
109
|
return rule.pattern === target.id || rule.pattern === target.name;
|
|
74
110
|
}
|
|
75
111
|
return compileGlob(rule.pattern).test(target.id);
|
|
@@ -83,73 +119,88 @@ function ruleMatches(rule, target) {
|
|
|
83
119
|
}
|
|
84
120
|
/**
|
|
85
121
|
* Classify a capability against compiled rules. Priority (hit stops the walk):
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
122
|
+
* disabled-exact > disabled-wildcard > resident-exact > on-demand-exact >
|
|
123
|
+
* resident-wildcard > on-demand-wildcard > default (resident). `disabled` is a
|
|
124
|
+
* control decision, so it beats an explicit `resident` rule. Within
|
|
125
|
+
* resident/on-demand an exact name beats a wildcard, so the management UI can
|
|
126
|
+
* pin a single capability to a class even when a broader wildcard rule says
|
|
127
|
+
* otherwise (e.g. `tools.resident: ['mcp__gongfeng__*']` must not silently win
|
|
128
|
+
* over an explicit per-tool `on-demand` rule).
|
|
89
129
|
*/
|
|
90
130
|
export function classify(compiled, target, metaTools = DEFAULT_META_TOOLS) {
|
|
91
131
|
const meta = metaTools instanceof Set ? metaTools : new Set(metaTools);
|
|
92
132
|
const id = target.id;
|
|
93
|
-
// metaTools can never be
|
|
133
|
+
// metaTools can never be On-demand/Disabled for tools.
|
|
94
134
|
if (target.kind === 'tool' && meta.has(id))
|
|
95
|
-
return '
|
|
96
|
-
for (const rule of compiled.
|
|
135
|
+
return 'resident';
|
|
136
|
+
for (const rule of compiled.disabled) {
|
|
97
137
|
if (!rule.wildcard && ruleMatches(rule, target))
|
|
98
|
-
return '
|
|
138
|
+
return 'disabled';
|
|
99
139
|
}
|
|
100
|
-
for (const rule of compiled.
|
|
140
|
+
for (const rule of compiled.disabled) {
|
|
101
141
|
if (rule.wildcard && ruleMatches(rule, target))
|
|
102
|
-
return '
|
|
142
|
+
return 'disabled';
|
|
103
143
|
}
|
|
104
|
-
for (const rule of compiled.
|
|
144
|
+
for (const rule of compiled.resident) {
|
|
105
145
|
if (!rule.wildcard && ruleMatches(rule, target))
|
|
106
|
-
return '
|
|
107
|
-
}
|
|
108
|
-
for (const rule of compiled.exposed) {
|
|
109
|
-
if (rule.wildcard && ruleMatches(rule, target))
|
|
110
|
-
return 'exposed';
|
|
146
|
+
return 'resident';
|
|
111
147
|
}
|
|
112
|
-
for (const rule of compiled.
|
|
148
|
+
for (const rule of compiled.onDemand) {
|
|
113
149
|
if (!rule.wildcard && ruleMatches(rule, target))
|
|
114
|
-
return '
|
|
150
|
+
return 'on-demand';
|
|
115
151
|
}
|
|
116
|
-
for (const rule of compiled.
|
|
152
|
+
for (const rule of compiled.resident) {
|
|
117
153
|
if (rule.wildcard && ruleMatches(rule, target))
|
|
118
|
-
return '
|
|
154
|
+
return 'resident';
|
|
119
155
|
}
|
|
120
|
-
|
|
156
|
+
for (const rule of compiled.onDemand) {
|
|
157
|
+
if (rule.wildcard && ruleMatches(rule, target))
|
|
158
|
+
return 'on-demand';
|
|
159
|
+
}
|
|
160
|
+
return 'resident';
|
|
121
161
|
}
|
|
122
162
|
/** True when any rule in the list matches the target (used for fail-loud validation). */
|
|
123
163
|
function anyRuleMatches(rules, target) {
|
|
124
164
|
return rules.some(rule => ruleMatches(rule, target));
|
|
125
165
|
}
|
|
126
166
|
const CLASS_LABELS = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
167
|
+
resident: 'Resident · 常驻(直接调用)',
|
|
168
|
+
'on-demand': 'On-demand · 按需(目录渐进加载)',
|
|
169
|
+
disabled: 'Disabled · 禁用',
|
|
130
170
|
};
|
|
131
171
|
/**
|
|
132
|
-
* Build the projection listener for one assembly: keep only
|
|
172
|
+
* Build the projection listener for one assembly: keep only Resident tools plus
|
|
133
173
|
* the mandatory meta tools.
|
|
134
174
|
*/
|
|
135
175
|
export function projectAssemblyTools(assembly, service) {
|
|
136
|
-
const kept = assembly.tools.filter(tool => service.
|
|
176
|
+
const kept = assembly.tools.filter(tool => service.isResidentTool(tool.name));
|
|
137
177
|
if (kept.length === assembly.tools.length)
|
|
138
178
|
return assembly;
|
|
139
179
|
return { ...assembly, tools: kept };
|
|
140
180
|
}
|
|
141
181
|
/** Build the policy plugin. */
|
|
142
182
|
export const name = 'capability-menu-policy';
|
|
143
|
-
// The policy needs `
|
|
183
|
+
// The policy needs `capability` (the registry sibling) for classifyAll(); `tools` /
|
|
144
184
|
// `skills` are injected purely for startup ordering — projection itself runs on
|
|
145
185
|
// the `system-prompt/assemble` chain, not through the registries. The bundle
|
|
146
|
-
// mounts registry before policy, so `
|
|
147
|
-
export const inject = ['
|
|
148
|
-
export function apply(ctx, config = {}) {
|
|
149
|
-
//
|
|
186
|
+
// mounts registry before policy, so `capability` is always available in practice.
|
|
187
|
+
export const inject = ['capability', 'tools', 'skills'];
|
|
188
|
+
export async function apply(ctx, config = {}) {
|
|
189
|
+
// Accept legacy rule keys (`exposed`/`progressive`) with the same meaning as
|
|
190
|
+
// the current `resident`/`on-demand`, so pre-rename profiles keep working
|
|
191
|
+
// without a disk rewrite. The management UI always writes the new keys.
|
|
192
|
+
const normalized = { ...config };
|
|
193
|
+
const legacyTools = config.tools?.exposed !== undefined || config.tools?.progressive !== undefined || config.tools?.blocked !== undefined;
|
|
194
|
+
const legacySkills = config.skills?.exposed !== undefined || config.skills?.progressive !== undefined || config.skills?.blocked !== undefined;
|
|
195
|
+
normalized.tools = normalizeSetConfig(config.tools);
|
|
196
|
+
normalized.skills = normalizeSetConfig(config.skills);
|
|
197
|
+
if (legacyTools || legacySkills) {
|
|
198
|
+
ctx.logger.warn('capability-policy: legacy rule keys `exposed`/`progressive`/`blocked` were auto-mapped to `resident`/`on-demand`/`disabled`; edit the profile patch to persist the new keys');
|
|
199
|
+
}
|
|
200
|
+
// Mutable runtime state so the management surface (能力管理) can live-update
|
|
150
201
|
// the policy without a reload.
|
|
151
|
-
let current =
|
|
152
|
-
let metaTools = [...(
|
|
202
|
+
let current = normalized;
|
|
203
|
+
let metaTools = [...(normalized.metaTools ?? DEFAULT_META_TOOLS)];
|
|
153
204
|
let metaToolSet = new Set(metaTools);
|
|
154
205
|
let toolCompiled;
|
|
155
206
|
let skillCompiled;
|
|
@@ -158,21 +209,21 @@ export function apply(ctx, config = {}) {
|
|
|
158
209
|
const skillRules = compileSet(current.skills);
|
|
159
210
|
// Normalize tool/skill rule kinds for matching.
|
|
160
211
|
toolCompiled = {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
212
|
+
resident: toolRules.resident.map(rule => ({ ...rule, kind: 'tool' })),
|
|
213
|
+
onDemand: toolRules.onDemand.map(rule => ({ ...rule, kind: 'tool' })),
|
|
214
|
+
disabled: toolRules.disabled.map(rule => ({ ...rule, kind: 'tool' })),
|
|
164
215
|
};
|
|
165
216
|
skillCompiled = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
217
|
+
resident: skillRules.resident.map(rule => ({ ...rule, kind: 'skill' })),
|
|
218
|
+
onDemand: skillRules.onDemand.map(rule => ({ ...rule, kind: 'skill' })),
|
|
219
|
+
disabled: skillRules.disabled.map(rule => ({ ...rule, kind: 'skill' })),
|
|
169
220
|
};
|
|
170
221
|
// Meta tools are the control-plane escape hatch: blocking one is a
|
|
171
222
|
// misconfiguration that must fail loud, never silently disable the surface.
|
|
172
223
|
for (const name of metaTools) {
|
|
173
224
|
const target = { id: name, name, server: serverNameOf(name), kind: 'tool', ruleKind: 'tool' };
|
|
174
|
-
if (anyRuleMatches(toolCompiled.
|
|
175
|
-
throw new Error(`meta tool "${name}" cannot be
|
|
225
|
+
if (anyRuleMatches(toolCompiled.disabled, target)) {
|
|
226
|
+
throw new Error(`meta tool "${name}" cannot be disabled; remove it from tools.disabled`);
|
|
176
227
|
}
|
|
177
228
|
}
|
|
178
229
|
};
|
|
@@ -183,33 +234,26 @@ export function apply(ctx, config = {}) {
|
|
|
183
234
|
return classify(toolCompiled, { id: name, name, server, kind: 'tool', ruleKind: 'tool' }, metaToolSet);
|
|
184
235
|
},
|
|
185
236
|
classifySkill(name) {
|
|
186
|
-
return classify(skillCompiled, { id:
|
|
187
|
-
},
|
|
188
|
-
classifyCapability(id) {
|
|
189
|
-
if (id.startsWith('skill:'))
|
|
190
|
-
return service.classifySkill(id.slice('skill:'.length));
|
|
191
|
-
return service.classifyTool(id);
|
|
192
|
-
},
|
|
193
|
-
isExposedTool(name) {
|
|
194
|
-
return service.classifyTool(name) === 'exposed';
|
|
237
|
+
return classify(skillCompiled, { id: name, name, kind: 'skill', ruleKind: 'skill' }, new Set());
|
|
195
238
|
},
|
|
196
|
-
|
|
197
|
-
|
|
239
|
+
classifyCapability(id, kind) {
|
|
240
|
+
// `kind` disambiguates a bare name shared by a tool and a skill.
|
|
241
|
+
return kind === 'skill' ? service.classifySkill(id) : service.classifyTool(id);
|
|
198
242
|
},
|
|
199
|
-
|
|
200
|
-
return service.classifyTool(name) === '
|
|
243
|
+
isResidentTool(name) {
|
|
244
|
+
return service.classifyTool(name) === 'resident';
|
|
201
245
|
},
|
|
202
|
-
|
|
203
|
-
return service.classifySkill(name) === '
|
|
246
|
+
isResidentSkill(name) {
|
|
247
|
+
return service.classifySkill(name) === 'resident';
|
|
204
248
|
},
|
|
205
|
-
|
|
206
|
-
return service.classifyTool(name) === '
|
|
249
|
+
isDisabledTool(name) {
|
|
250
|
+
return service.classifyTool(name) === 'disabled';
|
|
207
251
|
},
|
|
208
|
-
|
|
209
|
-
return service.classifySkill(name) === '
|
|
252
|
+
isDisabledSkill(name) {
|
|
253
|
+
return service.classifySkill(name) === 'disabled';
|
|
210
254
|
},
|
|
211
|
-
|
|
212
|
-
return service.classifyCapability(id) === '
|
|
255
|
+
isDisabledCapability(id, kind) {
|
|
256
|
+
return service.classifyCapability(id, kind) === 'disabled';
|
|
213
257
|
},
|
|
214
258
|
metaTools() {
|
|
215
259
|
return metaTools;
|
|
@@ -223,25 +267,32 @@ export function apply(ctx, config = {}) {
|
|
|
223
267
|
getConfig() {
|
|
224
268
|
return { ...current };
|
|
225
269
|
},
|
|
226
|
-
updateConfig(partial) {
|
|
270
|
+
async updateConfig(partial) {
|
|
227
271
|
current = { ...current, ...partial };
|
|
228
272
|
if (partial.metaTools !== undefined) {
|
|
229
273
|
metaTools = [...(partial.metaTools ?? DEFAULT_META_TOOLS)];
|
|
230
274
|
metaToolSet = new Set(metaTools);
|
|
231
275
|
}
|
|
232
276
|
recompile();
|
|
277
|
+
// Classification changed → the on-demand catalog on disk is stale (a
|
|
278
|
+
// capability reclassified to disabled must disappear from the grep-able
|
|
279
|
+
// YAML). Await the registry refresh so callers get a completion signal:
|
|
280
|
+
// the disk catalog is rewritten before the call returns, closing the
|
|
281
|
+
// window where a disabled capability stayed visible on disk.
|
|
282
|
+
await ctx.capability.refresh();
|
|
233
283
|
},
|
|
234
284
|
classifyAll() {
|
|
235
285
|
// The registry default maxResults (20) would truncate the management
|
|
236
286
|
// surface: enumerate every indexed capability, not just the top-20.
|
|
237
|
-
return ctx.
|
|
238
|
-
const cls = service.classifyCapability(summary.id);
|
|
287
|
+
return ctx.capability.search({ maxResults: Number.MAX_SAFE_INTEGER }).map(summary => {
|
|
288
|
+
const cls = service.classifyCapability(summary.id, summary.kind);
|
|
239
289
|
const mandatory = summary.kind === 'tool' && metaToolSet.has(summary.id);
|
|
240
290
|
return {
|
|
241
291
|
id: summary.id,
|
|
242
292
|
kind: summary.kind,
|
|
243
293
|
name: summary.name,
|
|
244
294
|
...summary.server !== undefined ? { server: summary.server } : {},
|
|
295
|
+
...summary.source !== undefined ? { source: summary.source } : {},
|
|
245
296
|
class: cls,
|
|
246
297
|
classLabel: CLASS_LABELS[cls],
|
|
247
298
|
mandatory,
|
|
@@ -249,16 +300,109 @@ export function apply(ctx, config = {}) {
|
|
|
249
300
|
});
|
|
250
301
|
},
|
|
251
302
|
};
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
|
|
303
|
+
// Disabled capabilities are a hard deny at the execution surface, not just a
|
|
304
|
+
// projection concern: a hallucinated direct call to a disabled tool (or to the
|
|
305
|
+
// `skill` loader for a disabled skill) must never reach the underlying server.
|
|
306
|
+
// On-demand tools stay executable — meta_invoke forwards through this same
|
|
307
|
+
// pipeline, so only Disabled is rejected here.
|
|
308
|
+
ctx.on('tools/pre-execute', async (exec, next) => {
|
|
309
|
+
if (service.isDisabledTool(exec.name)) {
|
|
310
|
+
return { kind: 'deny', reason: `capability "${exec.name}" is disabled and cannot be executed` };
|
|
311
|
+
}
|
|
312
|
+
if (exec.name === 'skill') {
|
|
313
|
+
const args = exec.arguments;
|
|
314
|
+
const name = typeof args?.name === 'string' ? args.name : '';
|
|
315
|
+
if (name.length > 0 && service.isDisabledSkill(name)) {
|
|
316
|
+
return { kind: 'deny', reason: `skill "${name}" is disabled and cannot be loaded` };
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return next();
|
|
320
|
+
});
|
|
321
|
+
// On-demand/Disabled skills must not appear in the model-facing
|
|
322
|
+
// `<available_skills>` catalog injected by `dsh-tool-skill`. The catalog is a
|
|
323
|
+
// user-role message whose `source.kind === 'skill-catalog'`; rewrite it every
|
|
324
|
+
// pre-step to keep only Resident skills. dsh-tool-skill republishes the full
|
|
325
|
+
// catalog earlier on the same chain, so this filter is idempotent: whatever
|
|
326
|
+
// it publishes, only the Resident subset reaches the model.
|
|
327
|
+
ctx.on('agent/pre-step', async (_payload, next) => {
|
|
328
|
+
const decision = await next();
|
|
329
|
+
if (decision.kind !== 'enter')
|
|
330
|
+
return decision;
|
|
331
|
+
let changed = false;
|
|
332
|
+
const messages = decision.messages.map(message => {
|
|
333
|
+
const source = message.source;
|
|
334
|
+
if (source.kind !== 'skill-catalog')
|
|
335
|
+
return message;
|
|
336
|
+
const entries = Array.isArray(source.entries)
|
|
337
|
+
? source.entries.filter((entry) => typeof entry === 'object' && entry !== null && typeof entry.name === 'string')
|
|
338
|
+
: [];
|
|
339
|
+
const kept = entries
|
|
340
|
+
.filter(entry => service.isResidentSkill(entry.name))
|
|
341
|
+
.map(entry => ({ name: entry.name, description: entry.description ?? '' }));
|
|
342
|
+
if (kept.length === entries.length)
|
|
343
|
+
return message;
|
|
344
|
+
changed = true;
|
|
345
|
+
return {
|
|
346
|
+
...message,
|
|
347
|
+
content: [{ type: 'text', text: renderSkillCatalog(kept) }],
|
|
348
|
+
source: { ...message.source, entries: kept },
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
if (!changed)
|
|
352
|
+
return decision;
|
|
353
|
+
return { ...decision, messages };
|
|
354
|
+
});
|
|
355
|
+
// Project the model-visible tool list, then append a one-line pointer to the
|
|
356
|
+
// on-demand catalog so the model knows it exists without having to "think of"
|
|
357
|
+
// meta_search first. Skills keep the dsh-native catalog, but filtered to
|
|
358
|
+
// Resident by the `agent/pre-step` hook above.
|
|
258
359
|
ctx.on('system-prompt/assemble', async (_assembly, _context, next) => {
|
|
259
360
|
const resolved = await next();
|
|
260
|
-
|
|
361
|
+
const projected = projectAssemblyTools(resolved, service);
|
|
362
|
+
const catalogPath = ctx.capability.catalogPath?.();
|
|
363
|
+
// Skip the pointer when there is nothing On-demand to browse: an empty
|
|
364
|
+
// hint wastes ~77 tokens of context and points at an empty file.
|
|
365
|
+
if (catalogPath === undefined || (ctx.capability.onDemandCount?.() ?? 0) === 0)
|
|
366
|
+
return projected;
|
|
367
|
+
const pointer = {
|
|
368
|
+
name: 'capability-menu-catalog',
|
|
369
|
+
text: [
|
|
370
|
+
'On-demand capabilities are not in the resident tool list above. Their catalog is a YAML file you can browse with grep/read:',
|
|
371
|
+
` ${catalogPath}`,
|
|
372
|
+
'Search it (e.g. grep -n "name:" <path>) or call meta_search with an exact id for a schema, then meta_invoke to run/load the capability.',
|
|
373
|
+
].join('\n'),
|
|
374
|
+
};
|
|
375
|
+
return { ...projected, sections: [...projected.sections, pointer] };
|
|
261
376
|
});
|
|
262
377
|
ctx.provide('capabilityPolicy', service);
|
|
378
|
+
// Emit the on-demand catalog before the plugin finishes mounting. The
|
|
379
|
+
// registry's own startup path (rebuildTools + refreshSkills) bypasses
|
|
380
|
+
// refresh(), so without this the YAML would not exist until the first
|
|
381
|
+
// tools/skills change event. Awaiting here closes the cold-start window
|
|
382
|
+
// where the first assemble could point at a file that does not exist yet.
|
|
383
|
+
await ctx.capability.refresh();
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Rebuild the text body of a skill-catalog user message from a filtered entry
|
|
387
|
+
* list. Mirrors the `<available_skills>` format emitted by `dsh-tool-skill` so
|
|
388
|
+
* the model sees a consistent, complete replacement catalog.
|
|
389
|
+
*/
|
|
390
|
+
function renderSkillCatalog(entries) {
|
|
391
|
+
const guidance = entries.length === 0
|
|
392
|
+
? ['No skills are currently available through the `skill` tool. Do not use names from earlier skill catalogs.']
|
|
393
|
+
: [
|
|
394
|
+
'If the user names a skill, or the task clearly matches a skill\u2019s description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill\u2019s instructions until it has been loaded.',
|
|
395
|
+
];
|
|
396
|
+
return [
|
|
397
|
+
'<system-reminder>',
|
|
398
|
+
'A skill is a reusable set of task-specific instructions. The following skills are available in this session:',
|
|
399
|
+
'',
|
|
400
|
+
'<available_skills>',
|
|
401
|
+
...entries.map(entry => `- \`${escapeText(entry.name)}\`: ${escapeText(entry.description ?? '')}`),
|
|
402
|
+
'</available_skills>',
|
|
403
|
+
'',
|
|
404
|
+
...guidance,
|
|
405
|
+
'</system-reminder>',
|
|
406
|
+
].join('\n');
|
|
263
407
|
}
|
|
264
408
|
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAuB,MAAM,eAAe,CAAA;AA0EjE,qDAAqD;AACrD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