dsh-plugin-tool-management 0.22.3 → 0.22.4
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/CHANGELOG.md +1395 -1363
- package/README.md +177 -176
- package/README_EN.md +177 -176
- package/docs/UPDATE.md +49 -48
- package/lib/client.js +4684 -4624
- package/lib/confirm-gate.js +49 -18
- package/lib/index.js +202 -72
- package/lib/legacy-tool-names.js +46 -0
- package/lib/mcp/manager.js +11 -1
- package/lib/mcp/secret-guard.js +27 -0
- package/lib/mcp/state-section.js +17 -8
- package/lib/memories/archive.js +44 -0
- package/lib/memories/index-io.js +4 -1
- package/lib/op-registry.js +5 -1
- package/lib/ops/scene-capture.js +72 -0
- package/lib/scope/scope-overrides.js +9 -2
- package/lib/skills/catalog.js +18 -9
- package/lib/subagents/catalog.js +13 -7
- package/lib/subagents/run-provider.js +41 -10
- package/lib/subagents/tools.js +63 -7
- package/lib/tool-table-switch.js +41 -4
- package/lib/tools/control.js +158 -0
- package/lib/tools/deps.js +88 -0
- package/lib/tools/mcp.js +35 -10
- package/lib/tools/memory.js +9 -5
- package/lib/tools/prompt.js +7 -8
- package/lib/tools/remove.js +84 -65
- package/lib/tools/scene.js +179 -76
- package/lib/tools/skills.js +13 -8
- package/lib/tools/subagent.js +19 -10
- package/lib/tools/table.js +92 -57
- package/lib/trash-id.js +3 -2
- package/package.json +152 -152
package/lib/tools/scene.js
CHANGED
|
@@ -24,11 +24,20 @@
|
|
|
24
24
|
// 理由是"那是改运行时环境的动作";补上 `_switch` 的取舍记在 CHANGELOG 里 —— 要点是
|
|
25
25
|
// **场景段的动作句仍然不加回来**:「上下文注入只给现在是什么」是同一天定下的原则,
|
|
26
26
|
// 不因为多了一条工具就破例(工具描述本来就是写"什么时候该用它"的地方)。
|
|
27
|
-
import { candidateNote, effectiveScope, globalUnchangedNote, isolationOffNote, requireGlobalScope, scopeGlobalOnlyDesc, scopeOnlyNote, scopeSessionDesc, sessionLayerOn, sessionScopeOf, text, toolNameList } from './deps.js';
|
|
27
|
+
import { candidateNote, effectiveScope, globalUnchangedNote, isolationOffNote, requireGlobalScope, scopeGlobalOnlyDesc, scopeOnlyNote, scopeSessionDesc, sessionLayerOn, sessionScopeOf, text, toolAccessSentence, toolNameList } from './deps.js';
|
|
28
28
|
import { FACTORY_TOOL_TABLE_PRESET } from './table.js';
|
|
29
29
|
/** 档案里由模型设置的段(`memories` 段在 P5 已废弃,不再是档案的一部分)。
|
|
30
30
|
* `mcpNotes`与其余三段同族:整段替换、段缺席 = 不碰这一域。 */
|
|
31
31
|
const ARCHIVE_SECTIONS = ['mcp', 'mcpNotes', 'skills', 'subagents'];
|
|
32
|
+
/**
|
|
33
|
+
* 档案侧的**全部**入参(`scene_manager_archive` 那条工具的参数表)。
|
|
34
|
+
*
|
|
35
|
+
* 为什么要单独列一张:`scene_manager_save` 只管场景记录(名字 / 标签 / 说明 / 绑的预设),
|
|
36
|
+
* 档案段搬到了另一条工具。而宿主对**多出来的**参数不报错(schema 默认放行额外属性)——
|
|
37
|
+
* 模型照旧给 `_save` 传一个 `mcp` 时,不挡就是一次**静默失效**:回执说「已保存」,
|
|
38
|
+
* 而档案根本没写。所以 `_save` 见到这里任何一条都要当场说清它搬到了哪里。
|
|
39
|
+
*/
|
|
40
|
+
const ARCHIVE_PARAMS = ['mcp', 'mcpNotes', 'skills', 'subagents', 'quickPrompts', 'toolTablePreset'];
|
|
32
41
|
/** 段里的名单:数组段是名字列表,`mcp` 段是 serverName → `'*'` | 工具名数组。段缺席 = 空。 */
|
|
33
42
|
function segmentNames(value) {
|
|
34
43
|
if (Array.isArray(value))
|
|
@@ -260,7 +269,7 @@ export function buildSceneTools(deps) {
|
|
|
260
269
|
// 为什么 `action` 是必填枚举而不是一个布尔:与 `mcp_manager_switch` 同一条理由 ——
|
|
261
270
|
// 让模型在 enter / exit 两个动词里选一个,比让它猜"scene 传 null 是什么意思"省一次往返。
|
|
262
271
|
// 参数里刻意不出现 `null`:那是 op(`scene-mode-set`)的形态,模型照着填只会填错。
|
|
263
|
-
description: 'Enter a scene, or leave the one currently entered. Entering switches on its archive and everything else off, narrows injection to its memories, and applies its bound prompt preset to AGENTS.md. Leaving restores the runtime snapshot taken on entry. Only when the user asks or approves.',
|
|
272
|
+
description: 'Enter a scene, or leave the one currently entered. Entering switches on its archive and everything else off, narrows injection to its memories, and applies its bound prompt preset to AGENTS.md. Leaving restores the runtime snapshot taken on entry. Asks the user to confirm before it runs. Only when the user asks or approves.',
|
|
264
273
|
parameters: {
|
|
265
274
|
action: { type: 'string', required: true, enum: ['enter', 'exit'], description: 'enter = switch to the scene named in `scene`; exit = leave the current one (no scene needed).' },
|
|
266
275
|
scene: { type: 'string', description: 'Scene name (one path segment), required for enter — the exact name, not the display label.' },
|
|
@@ -395,9 +404,11 @@ export function buildSceneTools(deps) {
|
|
|
395
404
|
// 「写入指引」保留("写成指令而不是备注"—— 这是场景说明质量的杠杆),但不再声称
|
|
396
405
|
// "注入后模型会被要求照办":定稿把场景段的授权语删了(注入只陈述现状),
|
|
397
406
|
// 参数说明与注入侧各说各话时,模型信的那份是错的。改为如实说明去向。
|
|
398
|
-
//
|
|
399
|
-
// 这里只留参数表**答不了**的三件事 ——
|
|
400
|
-
|
|
407
|
+
// 描述不再逐项列举档案里有哪些段(档案段已经搬去 `scene_manager_archive`):
|
|
408
|
+
// 这里只留参数表**答不了**的三件事 —— 场景是什么、保存不等于进入、档案另有一条工具。
|
|
409
|
+
// 那条工具的名字**不点**(它在出厂默认名单里是关着的):静态文案点名一条模型手里
|
|
410
|
+
// 没有的工具只会让它白跑一趟(插件的既定纪律,见 `toolAccessSentence`)。
|
|
411
|
+
description: 'Save a scene — a named bundle the user enters: entering switches on exactly what its archive lists and everything else off. Creates it if absent. Sets the name, the display name, the description and the bound prompt preset; omitted fields keep their values. The archive (which MCP servers, skills and personas entering it switches on) is set by a separate tool — capture: true fills it from what is currently switched on. Saving does not enter it. Asks the user to confirm before it runs. Only on the user\'s instruction.',
|
|
401
412
|
parameters: {
|
|
402
413
|
scene: { type: 'string', required: true, description: 'Scene name (one path segment, ≤64 chars, no / \\ or < > : " | ? *, not `_shared`). Created if absent.' },
|
|
403
414
|
label: { type: 'string', description: 'Display name for this scene.' },
|
|
@@ -406,39 +417,13 @@ export function buildSceneTools(deps) {
|
|
|
406
417
|
// 界面 补了「无」这个选项,工具侧的空串语义要跟着说清,否则模型只知道
|
|
407
418
|
// 「省略 = 保持」,不知道还有一条「解绑」的路。
|
|
408
419
|
prompt: { type: 'string', description: 'Prompt preset id to bind; while this scene is on it is the global baseline. \'\' = bind none (this scene leaves AGENTS.md alone).' },
|
|
409
|
-
// 模型工具表方案绑定:界面早就能绑、档案里一直有这一栏,`_list` / `_switch` 也读它,
|
|
410
|
-
// 唯独 `_save` 写不了。'' = 解绑只能走
|
|
411
|
-
// `rules-update-scene` —— `scene-archive-save` 对载荷里**不带的栏**一律保留现值
|
|
412
|
-
// (archive-engine 的「不带 ≠ 解绑」),所以解绑与设置分成两条路,见 execute 的 ②。
|
|
413
|
-
// 哨兵 `factory-default` 与界面下拉同值(tools/table.ts 的 FACTORY_TOOL_TABLE_PRESET);
|
|
414
|
-
// 不存在的方案名由引擎按 stale 丢弃并在进入时报告,op 不硬拒(与悬空绑定同口径)。
|
|
415
|
-
toolTablePreset: { type: 'string', description: "Model tool-table scheme to bind while this scene is on. '' = unbind; 'factory-default' = the factory default; otherwise a saved scheme name. An unknown name is dropped and reported." },
|
|
416
|
-
// 快捷提示词绑定。段语义与上面三个档案段相反:**空数组是合法值**
|
|
417
|
-
// (进入后全部停用),不是"清除这一段"。本工具不提供解绑(界面可解)—— 与
|
|
418
|
-
// mcp / skills / subagents 三段没有解绑参数同一条口径。id 从场景清单里别的场景的
|
|
419
|
-
// 绑定、或用户口述里来;不存在的 id 被引擎丢弃并在回执报出来。
|
|
420
|
-
quickPrompts: { type: 'array', items: { type: 'string' }, description: 'Quick-prompt ids to switch on when this scene is entered; every other one goes off, and the pre-entry state is restored on exit. [] = all off on entry. Unknown ids are dropped and reported — copy them from the listing.' },
|
|
421
|
-
mcp: {
|
|
422
|
-
type: 'object',
|
|
423
|
-
// 官方要求对象类型**显式声明开放性**(`additionalProperties` 是必需字段,且只能是
|
|
424
|
-
// boolean)—— 嵌套对象不允许带 schema,所以值的形状(`'*'` 还是工具名数组)只能在
|
|
425
|
-
// 描述里说清。这不是偷懒:键是服务器名,本身是动态的。
|
|
426
|
-
additionalProperties: true,
|
|
427
|
-
description: "Archive: serverName -> '*' (whole server) or a list of tool names to leave on. {} = switch none on.",
|
|
428
|
-
},
|
|
429
|
-
// 场景级 MCP 备注覆盖:进入这个场景时用这份盖掉全局备注,退出时还原。
|
|
430
|
-
// 与 mcp 段同一句式(省略 = 保持;{} = 一个都不覆盖)—— 界面存档编辑器早就能改,
|
|
431
|
-
// `_list` 也显示它,`_save` 此前不接这一段。
|
|
432
|
-
mcpNotes: {
|
|
433
|
-
type: 'object',
|
|
434
|
-
additionalProperties: true,
|
|
435
|
-
description: "Archive: serverName -> note overriding that server's global note while this scene is on (back on exit). {} = drop all scene-level overrides.",
|
|
436
|
-
},
|
|
437
|
-
skills: { type: 'array', items: { type: 'string' }, description: 'Archive: skill keys `<root>/<name>` to switch on. [] = switch none on.' },
|
|
438
|
-
subagents: { type: 'array', items: { type: 'string' }, description: 'Archive: persona names to switch on. [] = switch none on.' },
|
|
439
420
|
// 场景记录与档案是**机器级**的,没有「本会话的一份」。这个参数只为一件事:
|
|
440
421
|
// 模型以为自己在改会话时,当场纠回来(见 deps.ts 的 requireGlobalScope)。
|
|
441
422
|
scope: { type: 'string', enum: ['session', 'global'], description: scopeGlobalOnlyDesc('the scene record and archive are machine-wide', 'entering a scene for one conversation is a switch action') },
|
|
423
|
+
// 「照现在的样子存」:档案的勾选集由当前生效状态算出来,不由模型逐项填。
|
|
424
|
+
// 模型填错一个键的后果是「进场景时把某个服务器 / 某条技能关掉了」—— 而那一段
|
|
425
|
+
// 本来就是机器能自己读出来的,用户说「存一下刚才那套」时也不该由模型转述现状。
|
|
426
|
+
capture: { type: 'boolean', description: 'Fill the archive from what is currently switched on (MCP servers and their tools, skills, personas, quick prompts) — the archive is otherwise set by a separate tool. Use it when the user says "save the current setup as a scene".' },
|
|
442
427
|
},
|
|
443
428
|
output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
|
|
444
429
|
async execute(args, exec) {
|
|
@@ -455,10 +440,41 @@ export function buildSceneTools(deps) {
|
|
|
455
440
|
if (scene.indexOf('/') >= 0 || scene.indexOf('\\') >= 0) {
|
|
456
441
|
throw new Error('a scene name is a single path segment (no / or \\): ' + scene);
|
|
457
442
|
}
|
|
443
|
+
// 档案段搬走了,而宿主**不拦多出来的参数**(schema 默认放行额外属性):不挡就是
|
|
444
|
+
// 一次静默失效 —— 回执说「已保存」,档案根本没写。
|
|
445
|
+
const moved = ARCHIVE_PARAMS.filter((k) => args && args[k] !== undefined);
|
|
446
|
+
if (moved.length > 0) {
|
|
447
|
+
// 那条工具在出厂默认里是关着的,所以不点名、只给「怎么弄到它」—— 模型手里有
|
|
448
|
+
// 控制面工具时自己就能开(`toolAccessSentence` 的第二档),没有才让用户去面板。
|
|
449
|
+
throw new Error('this tool no longer takes ' + moved.join(' / ')
|
|
450
|
+
+ ' — the archive of a scene is set by a separate tool: '
|
|
451
|
+
+ toolAccessSentence(deps, 'scene_manager_archive', exec && exec.agent, 'the user has to open it in the panel') + '.');
|
|
452
|
+
}
|
|
453
|
+
// 「照现在的样子存」:档案的勾选集由**当前生效状态**算出来,不由模型逐项填。
|
|
454
|
+
// 这一支走 `scene-capture`(建场景 + 存档案同一件事),不走下面的 ① ——
|
|
455
|
+
// 档案由这条工具写,模型手填的那几段这里一概不接。
|
|
456
|
+
if (args && args.capture === true) {
|
|
457
|
+
if (deps.sceneCapture === undefined)
|
|
458
|
+
throw new Error('capturing the current setup is unavailable in this host');
|
|
459
|
+
const captured = await deps.sceneCapture({
|
|
460
|
+
name: scene,
|
|
461
|
+
...(args.label !== undefined ? { label: String(args.label) } : {}),
|
|
462
|
+
...(args.description !== undefined ? { description: String(args.description) } : {}),
|
|
463
|
+
});
|
|
464
|
+
if (!captured || captured.ok === false)
|
|
465
|
+
throw new Error((captured && captured.error) || 'failed to capture the current setup');
|
|
466
|
+
const summary = captured.summary || {};
|
|
467
|
+
const stale = Array.isArray(captured.stale) ? captured.stale : [];
|
|
468
|
+
return 'OK: scene "' + scene + '" saved from the current setup ('
|
|
469
|
+
+ (summary.mcp || 0) + ' MCP server(s), ' + (summary.skills || 0) + ' skill(s), '
|
|
470
|
+
+ (summary.subagents || 0) + ' persona(s), ' + (summary.quickPrompts || 0) + ' quick prompt(s)). '
|
|
471
|
+
+ 'Entering it will switch exactly those on and everything else off.'
|
|
472
|
+
+ (stale.length ? '\nWARN: dropped entries that no longer exist: ' + stale.join(', ') : '')
|
|
473
|
+
+ ' Saving does not enter it.';
|
|
474
|
+
}
|
|
458
475
|
// ① 场景记录:`rules-create-scene` 本身是**幂等 upsert**(已存在则更新描述/标签/绑定的
|
|
459
476
|
// 预设,不报错),所以不必先查再分建/改 —— 与记忆 save 的"有则改、无则建"同一口径。
|
|
460
|
-
// 总是调它:模型给 scene
|
|
461
|
-
// `scene-archive-save` 会以"场景不存在"拒绝。
|
|
477
|
+
// 总是调它:模型给 scene 而场景还不存在时,这一步把场景建出来。
|
|
462
478
|
const payload = { name: scene };
|
|
463
479
|
const touchedRecord = [];
|
|
464
480
|
if (args.label !== undefined) {
|
|
@@ -476,22 +492,119 @@ export function buildSceneTools(deps) {
|
|
|
476
492
|
const created = await deps.rulesOps['rules-create-scene'](payload);
|
|
477
493
|
if (!created || created.ok === false)
|
|
478
494
|
throw new Error((created && created.error) || 'failed to save the scene');
|
|
479
|
-
// ②
|
|
480
|
-
//
|
|
481
|
-
// 刚解掉的绑定又写回去 —— 所以解绑与设置分成两条路,合并前还要先摘掉刚解掉的键。
|
|
482
|
-
// · `prompt` 的 '' 此前也走不到实处 —— `rules-create-scene` 的 upsert 分支把空串
|
|
483
|
-
// 当"没给"(ops/scene-records.ts),旧绑定原样保留而回执报"已更新"。
|
|
484
|
-
// · `toolTablePreset` 的 '' 同解(那个 op 的更新分支认空串 = 解绑)。
|
|
495
|
+
// ② `prompt` 的解绑只能走 `rules-update-scene`:`rules-create-scene` 的 upsert 分支把
|
|
496
|
+
// 空串当"没给"(ops/scene-records.ts),旧绑定原样保留而回执报"已更新"。
|
|
485
497
|
const clearPrompt = args.prompt !== undefined && String(args.prompt).trim() === '';
|
|
498
|
+
let clearWarn = '';
|
|
499
|
+
if (clearPrompt) {
|
|
500
|
+
const u = await deps.rulesOps['rules-update-scene']({ name: scene, prompt: '' });
|
|
501
|
+
if (!u || u.ok === false) {
|
|
502
|
+
// 主路径已成功、解绑没写上:如实报,别让回执假装绑定已经没了。
|
|
503
|
+
clearWarn = '\nWARN: the unbind was not written (' + ((u && u.error) || 'unknown error') + '); the old binding still applies';
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
// 收敛提示:`rules-create-scene` 在"历史默认(全部启用)"状态下会把启用集合收窄成
|
|
507
|
+
// 单选(`collapseActiveForNewScene`)—— 那是一次**会改变运行时**的动作,必须说出来。
|
|
508
|
+
// 界面上同样如实报(`scenes.result.created.collapsed`)。
|
|
509
|
+
const collapsed = created.collapsedActive === true;
|
|
510
|
+
const parts = [touchedRecord.length ? 'scene record updated (' + touchedRecord.join(', ') + ')' : 'scene existence ensured'];
|
|
511
|
+
// 点名 scene_manager_switch 的那句按 toolAccessSentence 三档分叉(它在出厂默认
|
|
512
|
+
// 名单里就是关着的):部分启用(开 save 不开 switch)时落在中间档 ——
|
|
513
|
+
// 先用控制面工具把 switch 打开,两头都关才轮到"用户手动进"。与 mcp/skill 同一条纪律。
|
|
514
|
+
const enterHint = 'To take effect: '
|
|
515
|
+
+ toolAccessSentence(deps, 'scene_manager_switch', exec && exec.agent, 'the user has to enter this scene manually (scene_manager_switch is not available in this session)') + '.';
|
|
516
|
+
// 会话层:场景记录与档案是**机器级**的(一份索引 + 一份档案),本会话能改的
|
|
517
|
+
// 只有「这个对话用哪个场景」。不说清的话,模型会把「存好了」读成「只在这个对话里生效」。
|
|
518
|
+
const pinned = sessionScopeOf(deps, exec && exec.agent)?.scope?.scene;
|
|
519
|
+
const globalNote = pinned === undefined
|
|
520
|
+
? ''
|
|
521
|
+
: '\nnote: scenes are global (one record and one archive for the whole machine). The pin here only decides which scene this scope uses' +
|
|
522
|
+
' (currently "' + pinned + '"); ' + globalUnchangedNote(deps);
|
|
523
|
+
// 档案没动这句话**必须说**:模型是照着「建一个进场景时开 A 服务器的场景」来的,
|
|
524
|
+
// 而档案已经搬去另一条工具 —— 不说,它会以为整件事做完了。
|
|
525
|
+
// 给「怎么弄到那条工具」而不是只报错名:它在出厂默认里是关着的,但模型手里有控制面
|
|
526
|
+
// 工具(自己就能开),别把它推回面板。
|
|
527
|
+
const archiveNote = '\nThe archive (what entering this scene switches on) was not touched by this call — to set it: '
|
|
528
|
+
+ toolAccessSentence(deps, 'scene_manager_archive', exec && exec.agent, 'the user has to open it in the panel') + '.';
|
|
529
|
+
return 'OK: scene "' + scene + '" — ' + parts.join('; ') + clearWarn + globalNote + archiveNote +
|
|
530
|
+
(collapsed
|
|
531
|
+
? '\nnote: every scene was enabled until now (the historical all-enabled default); this call narrowed the enabled set to one scene, and the new one is not it — the user should confirm the enabled state.'
|
|
532
|
+
: '') +
|
|
533
|
+
'\nSaving does not change the runtime: ' + enterHint;
|
|
534
|
+
},
|
|
535
|
+
}));
|
|
536
|
+
register(defineTool({
|
|
537
|
+
name: 'scene_manager_archive',
|
|
538
|
+
// 档案 = 「进入这个场景时开什么」。它与场景记录(名字 / 标签 / 说明 / 绑的预设)是**两个
|
|
539
|
+
// 对象**,所以分成两条工具:只想改一句场景说明的模型不必面对五段档案参数,而要改档案的
|
|
540
|
+
// 那条路径参数表本身很宽 —— 拆开之后,**只想写场景**的那条工具窄了一半。
|
|
541
|
+
//
|
|
542
|
+
// 整段替换的语义写在这里(`_save` 那条已经不接档案段了):给的段整段替换,没给的段保持。
|
|
543
|
+
description: 'Set the archive of a scene — what entering it switches on: MCP servers (and which of their tools), skills, personas, quick prompts and the model tool-table scheme. A section you give replaces that section whole (include what should stay — the receipt reports what got displaced); sections you omit keep their values. Creates the scene if it does not exist yet. Saving the archive does not enter the scene. Asks the user to confirm before it runs. Only on the user\'s instruction.',
|
|
544
|
+
parameters: {
|
|
545
|
+
scene: { type: 'string', required: true, description: 'Scene name (one path segment, ≤64 chars, no / \\ or < > : " | ? *, not `_shared`).' },
|
|
546
|
+
mcp: {
|
|
547
|
+
type: 'object',
|
|
548
|
+
// 官方要求对象类型**显式声明开放性**(`additionalProperties` 是必需字段,且只能是
|
|
549
|
+
// boolean)—— 嵌套对象不允许带 schema,所以值的形状(`'*'` 还是工具名数组)只能在
|
|
550
|
+
// 描述里说清。这不是偷懒:键是服务器名,本身是动态的。
|
|
551
|
+
additionalProperties: true,
|
|
552
|
+
description: "Archive: serverName -> '*' (whole server) or a list of tool names to leave on. {} = switch none on.",
|
|
553
|
+
},
|
|
554
|
+
// 场景级 MCP 备注覆盖:进入这个场景时用这份盖掉全局备注,退出时还原。
|
|
555
|
+
// 与 mcp 段同一句式(省略 = 保持;{} = 一个都不覆盖)。
|
|
556
|
+
mcpNotes: {
|
|
557
|
+
type: 'object',
|
|
558
|
+
additionalProperties: true,
|
|
559
|
+
description: "Archive: serverName -> note overriding that server's global note while this scene is on (back on exit). {} = drop all scene-level overrides.",
|
|
560
|
+
},
|
|
561
|
+
skills: { type: 'array', items: { type: 'string' }, description: 'Archive: skill keys `<root>/<name>` to switch on. [] = switch none on.' },
|
|
562
|
+
subagents: { type: 'array', items: { type: 'string' }, description: 'Archive: persona names to switch on. [] = switch none on.' },
|
|
563
|
+
// 快捷提示词绑定。段语义与上面三个档案段相反:**空数组是合法值**
|
|
564
|
+
// (进入后全部停用),不是"清除这一段"。本工具不提供解绑(界面可解)—— 与
|
|
565
|
+
// mcp / skills / subagents 三段没有解绑参数同一条口径。id 从场景清单里别的场景的
|
|
566
|
+
// 绑定、或用户口述里来;不存在的 id 被引擎丢弃并在回执报出来。
|
|
567
|
+
quickPrompts: { type: 'array', items: { type: 'string' }, description: 'Quick-prompt ids to switch on when this scene is entered; every other one goes off, and the pre-entry state is restored on exit. [] = all off on entry. Unknown ids are dropped and reported — copy them from the listing.' },
|
|
568
|
+
// 模型工具表方案绑定:界面早就能绑、档案里一直有这一栏,`_list` / `_switch` 也读它。
|
|
569
|
+
// 哨兵 `factory-default` 与界面下拉同值(tools/table.ts 的 FACTORY_TOOL_TABLE_PRESET);
|
|
570
|
+
// 不存在的方案名由引擎按 stale 丢弃并在进入时报告,op 不硬拒(与悬空绑定同口径)。
|
|
571
|
+
toolTablePreset: { type: 'string', description: "Model tool-table scheme to bind while this scene is on. '' = unbind; 'factory-default' = the factory default; otherwise a saved scheme name. An unknown name is dropped and reported." },
|
|
572
|
+
// 档案与场景记录一样是**机器级**的(一份索引 + 一份档案),没有「本会话的一份」。
|
|
573
|
+
scope: { type: 'string', enum: ['session', 'global'], description: scopeGlobalOnlyDesc('the scene record and archive are machine-wide', 'entering a scene for one conversation is a switch action') },
|
|
574
|
+
},
|
|
575
|
+
output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
|
|
576
|
+
async execute(args, exec) {
|
|
577
|
+
const blocked = await deps.lockedSceneGuard();
|
|
578
|
+
if (blocked)
|
|
579
|
+
throw new Error(blocked);
|
|
580
|
+
requireGlobalScope(args, 'scenes', !sessionLayerOn(deps));
|
|
581
|
+
const scene = String((args && args.scene) || '').trim();
|
|
582
|
+
if (scene === '')
|
|
583
|
+
throw new Error('missing argument: scene (the scene name)');
|
|
584
|
+
if (scene.indexOf('/') >= 0 || scene.indexOf('\\') >= 0) {
|
|
585
|
+
throw new Error('a scene name is a single path segment (no / or \\): ' + scene);
|
|
586
|
+
}
|
|
587
|
+
// 场景得先在(档案挂在场景上)。用 upsert 建出来:模型为了写档案先建一次场景是
|
|
588
|
+
// 一次白跑,而档案那条路自己建不出场景记录。
|
|
589
|
+
const ensured = await deps.rulesOps['rules-create-scene']({ name: scene });
|
|
590
|
+
if (!ensured || ensured.ok === false)
|
|
591
|
+
throw new Error((ensured && ensured.error) || 'failed to save the scene');
|
|
592
|
+
// 三种「设置」方向 + 一种「解绑」:
|
|
486
593
|
const unbindToolTable = args.toolTablePreset !== undefined && String(args.toolTablePreset).trim() === '';
|
|
487
594
|
const setToolTable = args.toolTablePreset !== undefined && String(args.toolTablePreset).trim() !== '';
|
|
488
595
|
const setQuickPrompts = args.quickPrompts !== undefined;
|
|
489
596
|
if (setQuickPrompts && !Array.isArray(args.quickPrompts)) {
|
|
490
|
-
|
|
597
|
+
// 档案里 quickPrompts 是一份**完整清单**(在里面的开着,不在里面的关着),
|
|
598
|
+
// 所以「改绑」是改这一份清单 —— 模型自己就能做,原先那句「解绑是面板里的人工步骤」
|
|
599
|
+
// 是错的(模型能存一份新清单)。
|
|
600
|
+
throw new Error('quickPrompts must be an array of ids ([] = turn them all off on entry; the binding is one full list, so to change which prompts are on, save this scene again with the new list)');
|
|
491
601
|
}
|
|
492
602
|
const touched = ARCHIVE_SECTIONS.filter((k) => args[k] !== undefined);
|
|
493
603
|
const mustWriteArchive = touched.length > 0 || setToolTable || setQuickPrompts;
|
|
494
|
-
|
|
604
|
+
if (!mustWriteArchive && !unbindToolTable) {
|
|
605
|
+
throw new Error('nothing to change: give at least one archive section (mcp / mcpNotes / skills / subagents / quickPrompts / toolTablePreset)');
|
|
606
|
+
}
|
|
607
|
+
// 档案现状在读的时候就取一次,且必须在解绑**之前** —— 解绑落盘后这一栏已经没了,
|
|
495
608
|
// 回执的「X → 解绑」要的是解绑前的那个 X。只为看回执的 diff 而读时(解绑且不写档案)
|
|
496
609
|
// 容忍读失败:那一步已经写成功了,别为一句对比话把整次调用判失败。
|
|
497
610
|
let before = {};
|
|
@@ -508,26 +621,20 @@ export function buildSceneTools(deps) {
|
|
|
508
621
|
}
|
|
509
622
|
}
|
|
510
623
|
let clearWarn = '';
|
|
511
|
-
if (
|
|
512
|
-
const
|
|
513
|
-
if (clearPrompt)
|
|
514
|
-
upd.prompt = '';
|
|
515
|
-
if (unbindToolTable)
|
|
516
|
-
upd.toolTablePreset = '';
|
|
517
|
-
const u = await deps.rulesOps['rules-update-scene'](upd);
|
|
624
|
+
if (unbindToolTable) {
|
|
625
|
+
const u = await deps.rulesOps['rules-update-scene']({ name: scene, toolTablePreset: '' });
|
|
518
626
|
if (!u || u.ok === false) {
|
|
519
|
-
// 主路径已成功、解绑没写上:如实报,别让回执假装绑定已经没了。
|
|
520
627
|
clearWarn = '\nWARN: the unbind was not written (' + ((u && u.error) || 'unknown error') + '); the old binding still applies';
|
|
521
628
|
}
|
|
522
629
|
}
|
|
523
|
-
//
|
|
524
|
-
//
|
|
525
|
-
//
|
|
526
|
-
//
|
|
527
|
-
//
|
|
528
|
-
//
|
|
529
|
-
//
|
|
530
|
-
//
|
|
630
|
+
// 档案 read-modify-write:段(mcp / mcpNotes / skills / subagents)与两个绑定栏的
|
|
631
|
+
// 「设置」方向合并成一份,只经 `scene-archive-save` 一条路落盘。
|
|
632
|
+
// **必须 read-modify-write**:`scene-archive-save` 是**整份替换**,只把模型给的段
|
|
633
|
+
// 传过去,没给的段会被静默清掉 —— 与 `subagent_manager_save` 省略字段被
|
|
634
|
+
// 清空同一形状,只是这次清掉的是"这个场景进入时要开哪些东西"。
|
|
635
|
+
// 注意段语义:**段不存在 = 不限制(全部照常)**,段存在但为空 = 全部停用。所以模型给
|
|
636
|
+
// `mcp: {}` 得到的是"全不勾",不是"清除该段" —— 后者只能靠不给。
|
|
637
|
+
// `quickPrompts` 与三段都不同:段缺席 = 这一域不碰,空数组 = 进入后全部停用。
|
|
531
638
|
let archiveNote = '';
|
|
532
639
|
let toolTableNote = '';
|
|
533
640
|
let quickNote = '';
|
|
@@ -564,7 +671,7 @@ export function buildSceneTools(deps) {
|
|
|
564
671
|
if (r.applyError)
|
|
565
672
|
warnTail += '\n(saved, but applying it to the runtime failed: ' + r.applyError + ')';
|
|
566
673
|
}
|
|
567
|
-
// 解绑写失败了就别输出「X → 解绑」—— 上面那句 WARN
|
|
674
|
+
// 解绑写失败了就别输出「X → 解绑」—— 上面那句 WARN 才是事实;设置方向不受影响。
|
|
568
675
|
if (args.toolTablePreset !== undefined && !(unbindToolTable && clearWarn !== '')) {
|
|
569
676
|
toolTableNote = beforeKnown
|
|
570
677
|
? 'tool-table preset: ' + (toolTableLabel(before.toolTablePreset) || 'unbound') + ' -> ' +
|
|
@@ -585,31 +692,27 @@ export function buildSceneTools(deps) {
|
|
|
585
692
|
(afterIds.length === 0 ? ' (all off after entering)' : '') +
|
|
586
693
|
(marks.length ? ' (' + marks.join(' ') + ')' : '');
|
|
587
694
|
}
|
|
588
|
-
|
|
589
|
-
// 单选(`collapseActiveForNewScene`)—— 那是一次**会改变运行时**的动作,必须说出来。
|
|
590
|
-
// 界面上同样如实报(`scenes.result.created.collapsed`)。
|
|
591
|
-
const collapsed = created.collapsedActive === true;
|
|
592
|
-
const parts = [touchedRecord.length ? 'scene record updated (' + touchedRecord.join(', ') + ')' : 'scene existence ensured'];
|
|
695
|
+
const parts = [];
|
|
593
696
|
if (archiveNote)
|
|
594
697
|
parts.push(archiveNote);
|
|
595
698
|
if (toolTableNote)
|
|
596
699
|
parts.push(toolTableNote);
|
|
597
700
|
if (quickNote)
|
|
598
701
|
parts.push(quickNote);
|
|
599
|
-
// 点名 scene_manager_switch
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
? 'To take effect, enter it with scene_manager_switch.'
|
|
604
|
-
: 'To take effect, the user has to enter this scene manually (scene_manager_switch is not available in this session).';
|
|
605
|
-
// 会话层:场景记录与档案是**机器级**的(一份索引 + 一份档案),本会话能改的
|
|
606
|
-
// 只有「这个对话用哪个场景」。不说清的话,模型会把「存好了」读成「只在这个对话里生效」。
|
|
702
|
+
// 点名 scene_manager_switch 的那句按 toolAccessSentence 三档分叉(与 _save 回执同款)。
|
|
703
|
+
const enterHint = 'To take effect: '
|
|
704
|
+
+ toolAccessSentence(deps, 'scene_manager_switch', exec && exec.agent, 'the user has to enter this scene manually (scene_manager_switch is not available in this session)') + '.';
|
|
705
|
+
// 会话层:档案是**机器级**的,本会话能改的只有「这个对话用哪个场景」。
|
|
607
706
|
const pinned = sessionScopeOf(deps, exec && exec.agent)?.scope?.scene;
|
|
608
707
|
const globalNote = pinned === undefined
|
|
609
708
|
? ''
|
|
610
709
|
: '\nnote: scenes are global (one record and one archive for the whole machine). The pin here only decides which scene this scope uses' +
|
|
611
710
|
' (currently "' + pinned + '"); ' + globalUnchangedNote(deps);
|
|
612
|
-
|
|
711
|
+
// 建场景时把启用集合收窄成单选(`collapseActiveForNewScene`)是一次**会改变运行时**
|
|
712
|
+
// 的动作,必须说出来 —— 那是 `rules-create-scene` 干的,与档案无关。
|
|
713
|
+
const collapsed = ensured.collapsedActive === true;
|
|
714
|
+
return 'OK: archive of scene "' + scene + '"' + (parts.length ? ' — ' + parts.join('; ') : '') +
|
|
715
|
+
warnTail + clearWarn + globalNote +
|
|
613
716
|
(collapsed
|
|
614
717
|
? '\nnote: every scene was enabled until now (the historical all-enabled default); this call narrowed the enabled set to one scene, and the new one is not it — the user should confirm the enabled state.'
|
|
615
718
|
: '') +
|
package/lib/tools/skills.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// (hub = 导入落点 / dsh = 新建默认落点)里的胜出者。
|
|
7
7
|
import { toKebab } from '../skills/core.js';
|
|
8
8
|
import { OFFICIAL_SOURCE_KEY, officeKitApplies, officialOfficeRuntimeSection } from '../skills/official.js';
|
|
9
|
-
import { effectiveScope, existingNote, globalActionNote, globalUnchangedNote, isolationOffNote, locateSkillRoot, requireGlobalScope, scopeGlobalOnlyDesc, scopeOnlyNote, scopeSessionDesc, sessionLayerOn, sessionScopeOf, text } from './deps.js';
|
|
9
|
+
import { effectiveScope, existingNote, globalActionNote, globalUnchangedNote, isolationOffNote, listLimit, locateSkillRoot, moreNotShown, requireGlobalScope, scopeGlobalOnlyDesc, scopeOnlyNote, scopeSessionDesc, sessionLayerOn, sessionScopeOf, text, toolAccessSentence } from './deps.js';
|
|
10
10
|
/** 注册技能域的 model 工具(列表 / 启停 / 新建或更新)。 */
|
|
11
11
|
export function buildSkillTools(deps) {
|
|
12
12
|
const { defineTool, register } = deps;
|
|
@@ -21,6 +21,7 @@ export function buildSkillTools(deps) {
|
|
|
21
21
|
description: 'List skills with enabled state, effective/shadowed status and source file path. The "Current skills" reminder carries callable skills and summaries only; use this for entries that are off, for source paths, and to see which source wins a name collision — a copy marked "shadowed-by:<root>" stays inactive even if enabled, "preferred" marks the winner. Defaults to enabled only; all=true for every entry.',
|
|
22
22
|
parameters: {
|
|
23
23
|
all: { type: 'boolean', description: 'Include disabled and shadowed entries (default false).' },
|
|
24
|
+
limit: { type: 'number', description: 'Max entries (default 50, max 100).' },
|
|
24
25
|
},
|
|
25
26
|
output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
|
|
26
27
|
async execute(args, exec) {
|
|
@@ -115,6 +116,9 @@ export function buildSkillTools(deps) {
|
|
|
115
116
|
: ' (this scope\'s view: project roots come from its own cwd' +
|
|
116
117
|
(scoped.scope?.scene === undefined ? '' : ', scene "' + scoped.scope.scene + '"') +
|
|
117
118
|
(overrides === undefined ? '' : ', ' + Object.keys(overrides).length + ' switch(es) overridden here') + ')';
|
|
119
|
+
// 返回体也要有上限:返回值进上下文,工具表只管 schema —— 这一笔它管不着。
|
|
120
|
+
const limit = listLimit(args && args.limit);
|
|
121
|
+
const visible = shown.slice(0, limit);
|
|
118
122
|
const header = 'Skills: ' + (showAll
|
|
119
123
|
? rows.length + ' entries'
|
|
120
124
|
: shown.length + ' enabled of ' + rows.length + ' entries') +
|
|
@@ -125,7 +129,8 @@ export function buildSkillTools(deps) {
|
|
|
125
129
|
// 「技能目录」注入域会在开关打开时兜底(见上面的注入通道);两者都没有时模型看到的
|
|
126
130
|
// 只是这份名单 —— 说清边界,别让它以为上下文里已经有技能正文(正文用路径读)。
|
|
127
131
|
const notice = await deps.reachNoticeForAgent(deps.presetRoster(), exec && exec.agent && exec.agent.ctx, deps.injectNoticeOptions());
|
|
128
|
-
return header + (
|
|
132
|
+
return header + (visible.map((row) => row.text).join('\n') || '(none)')
|
|
133
|
+
+ moreNotShown(shown.length, visible.length) + notice;
|
|
129
134
|
},
|
|
130
135
|
}));
|
|
131
136
|
// 一次拿到技能正文。此前读正文要两步:`skill_manager_list` 拿路径 → 自己再去读那个文件。
|
|
@@ -495,7 +500,7 @@ export function buildSkillTools(deps) {
|
|
|
495
500
|
//
|
|
496
501
|
// 描述里不写落点路径:模型不按路径行动,而写死路径还会与 `remove.ts` 头注释里的落点
|
|
497
502
|
// 口径打架。真正要它知道的是"建在哪一侧",而"只认本插件写的技能"那半句已经说清了。
|
|
498
|
-
description: 'Create a DSH skill, or update the one that already has this name — the receipt says which. Only skills this plugin wrote can be updated. Only on the user\'s instruction.',
|
|
503
|
+
description: 'Create a DSH skill, or update the one that already has this name — the receipt says which. Only skills this plugin wrote can be updated. Asks the user to confirm before it runs. Only on the user\'s instruction.',
|
|
499
504
|
parameters: {
|
|
500
505
|
name: { type: 'string', required: true, description: 'Skill name; normalized to kebab-case (≤128 chars, [a-z0-9-]).' },
|
|
501
506
|
description: { type: 'string', description: 'A concise routing description (≤500 chars). Required when creating; omit = keep.' },
|
|
@@ -547,11 +552,11 @@ export function buildSkillTools(deps) {
|
|
|
547
552
|
const data = r.data || {};
|
|
548
553
|
// 新建的技能默认停用(与 MCP / 人设同口径)。这句必须留 —— 不说的话模型会直接去用,
|
|
549
554
|
// 然后发现技能不生效,而它不知道自己少拨了一个开关(三个 save
|
|
550
|
-
//
|
|
551
|
-
//
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
// 里只有这一条不报启用状态)。点名按 toolAccessSentence 三档分叉:
|
|
556
|
+
// skill_manager_switch 在出厂默认名单里就是关着的,多数时候落在中间档
|
|
557
|
+
// (先用控制面工具把 switch 打开),两头都关才轮到"用户启用"。
|
|
558
|
+
const enableHint = ' (created disabled; '
|
|
559
|
+
+ toolAccessSentence(deps, 'skill_manager_switch', exec && exec.agent, 'the user has to enable it first') + ')';
|
|
555
560
|
// 会话层:技能文件是**机器级**的,本会话的开关只决定这里看不看得到它。
|
|
556
561
|
return 'Created DSH skill ' + (data.name || kebab) + ' at ' + (data.path || '(unknown)') + enableHint +
|
|
557
562
|
globalActionNote(deps, exec && exec.agent, 'skills', 'skill');
|
package/lib/tools/subagent.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// 两个工具**各自** try/catch:一个注册失败不该把另一个也带走,而且失败必须说得出
|
|
7
7
|
// 「是哪一个没注册上」——只打一行日志时,模型侧只会「查无此工具」、界面毫无痕迹。
|
|
8
8
|
import { defineSubagentManagerListTool, defineSubagentManagerRunTool } from '../subagents/tools.js';
|
|
9
|
-
import { effectiveScope, globalActionNote, globalUnchangedNote, isolationOffNote, requireGlobalScope, scopeGlobalOnlyDesc, scopeOnlyNote, scopeSessionDesc, sessionLayerOn, text } from './deps.js';
|
|
9
|
+
import { effectiveScope, globalActionNote, globalUnchangedNote, isolationOffNote, requireGlobalScope, scopeGlobalOnlyDesc, scopeOnlyNote, scopeSessionDesc, sessionLayerOn, text, toolAccessSentence } from './deps.js';
|
|
10
10
|
/**
|
|
11
11
|
* 高频高级字段:`subagent_manager_save` 与 op 之间原样透传的那几个(省略 = 不出现 = op 侧保持)。
|
|
12
12
|
*
|
|
@@ -35,7 +35,7 @@ export function buildSubagentTools(deps) {
|
|
|
35
35
|
console.error('[dsh-plugin-tool-management] subagent tool registration failed:', name, deps.message(e));
|
|
36
36
|
};
|
|
37
37
|
try {
|
|
38
|
-
// 与其余
|
|
38
|
+
// 与其余 23 个工具同一条注册通道:defineTool 负责编译 parameters(object root + required),
|
|
39
39
|
// 裸 register 会把未编译的参数声明直接发给模型 API。
|
|
40
40
|
register(defineTool(defineSubagentManagerListTool({
|
|
41
41
|
list: () => deps.subagentService.list(),
|
|
@@ -45,6 +45,9 @@ export function buildSubagentTools(deps) {
|
|
|
45
45
|
flagFor: deps.subagentFlagFor,
|
|
46
46
|
overridesFor: deps.subagentOverridesFor,
|
|
47
47
|
noticeFor: (exec) => deps.reachNoticeForAgent(deps.presetRoster(), exec && exec.agent && exec.agent.ctx, deps.injectNoticeOptions()),
|
|
48
|
+
// 逐条点明「这个人设勾的工具里,有几条被这个对话关着」—— 子代理的实际工具集是
|
|
49
|
+
// 「人设的限制 ∩ 本对话看得见的」,不说的话用户看到人设勾着它却用不了。
|
|
50
|
+
toolVisibleFor: deps.toolVisibleFor,
|
|
48
51
|
})));
|
|
49
52
|
}
|
|
50
53
|
catch (e) {
|
|
@@ -61,7 +64,13 @@ export function buildSubagentTools(deps) {
|
|
|
61
64
|
// 谈不上委派;测「允许追问」时才被暴露出来,因为那条通道同样要过这一步)。
|
|
62
65
|
// `Object.create` 保持同一条原型链:`ops` 仍是审计过的那份,`list` / `runSerial` 回真实服务。
|
|
63
66
|
// 与 index.ts 造这个包装层时用的是同一个写法(那边注释写的是「原型链回真实服务,其余读法一字不动」)。
|
|
64
|
-
register(defineTool(defineSubagentManagerRunTool(Object.assign(Object.create(deps.subagentService), {
|
|
67
|
+
register(defineTool(defineSubagentManagerRunTool(Object.assign(Object.create(deps.subagentService), {
|
|
68
|
+
sceneLists: deps.sceneLists,
|
|
69
|
+
toolFilterFor: deps.toolFilterFor,
|
|
70
|
+
flagFor: deps.subagentFlagFor,
|
|
71
|
+
// 「这个人设关掉了」那条回执要判断模型自己能不能开它(见 subagents/tools.ts)。
|
|
72
|
+
toolVisibleFor: deps.toolVisibleFor,
|
|
73
|
+
}))));
|
|
65
74
|
}
|
|
66
75
|
catch (e) {
|
|
67
76
|
recordFailure('subagent_manager_run', e);
|
|
@@ -141,7 +150,7 @@ export function buildSubagentTools(deps) {
|
|
|
141
150
|
//
|
|
142
151
|
// 描述里不写落点路径:模型不按路径行动,这条工具也没有"给我路径"的用法(要读正文有
|
|
143
152
|
// `list` + 宿主的文件工具,而人设正文本来就是给它自己当系统提示词用的)。
|
|
144
|
-
description: 'Create a persona, or update the one with this name — the receipt says which; omitted fields keep their values. Write `body` as who this is and how it judges its own work, not steps or paths (those belong to the task); put hard output requirements in `output`, one per line. Also settable: `model` (\'\' = inherit), `continuable`, `tools`/`toolsDeny` ([] = clear) — other routing/limit fields aren\'t. Blocked while the active scene is locked. Only on the user\'s instruction.',
|
|
153
|
+
description: 'Create a persona, or update the one with this name — the receipt says which; omitted fields keep their values. Write `body` as who this is and how it judges its own work, not steps or paths (those belong to the task); put hard output requirements in `output`, one per line. Also settable: `model` (\'\' = inherit), `continuable`, `tools`/`toolsDeny` ([] = clear) — other routing/limit fields aren\'t. Blocked while the active scene is locked. Asks the user to confirm before it runs. Only on the user\'s instruction.',
|
|
145
154
|
parameters: {
|
|
146
155
|
name: { type: 'string', required: true, description: 'Persona name (= file name); ≤64 chars, one path segment — no / \\ or < > : " | ? *, no leading dot, no reserved device name, no trailing dot or space.' },
|
|
147
156
|
description: { type: 'string', description: 'One-line routing description (what the delegation catalog shows). Required when creating.' },
|
|
@@ -189,12 +198,12 @@ export function buildSubagentTools(deps) {
|
|
|
189
198
|
if (!r || r.ok === false)
|
|
190
199
|
throw new Error((r && r.error) || 'failed to create the persona');
|
|
191
200
|
// 新建的人设默认停用(与 MCP / 技能同口径)。这句必须留:不说的话模型会直接去委派,
|
|
192
|
-
// 然后收到"人设不可用"
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
// 然后收到"人设不可用",而它并不知道自己少拨了一个开关。点名按 toolAccessSentence
|
|
202
|
+
// 三档分叉:subagent_manager_switch 在出厂默认名单里就是关着的,多数时候落在
|
|
203
|
+
// 中间档(先用控制面工具把 switch 打开),两头都关才轮到"用户启用"
|
|
204
|
+
// (与 mcp/skill 的 listHint 同一条纪律)。
|
|
205
|
+
const enableHint = ' (created disabled; '
|
|
206
|
+
+ toolAccessSentence(deps, 'subagent_manager_switch', exec && exec.agent, 'the user has to enable it before you can delegate') + ')';
|
|
198
207
|
// 会话层:人设文件是**机器级**的,本会话的开关只决定这里看不看得到它。
|
|
199
208
|
return 'OK: persona ' + String(r.name || name) + ' created' + enableHint +
|
|
200
209
|
globalActionNote(deps, exec && exec.agent, 'subagents', 'persona');
|