dsh-plugin-tool-management 0.21.2 → 0.21.3

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.
Files changed (122) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/README.md +1 -1
  3. package/README_EN.md +1 -1
  4. package/docs/{update.md → UPDATE.md} +34 -33
  5. package/lib/approval-policy.js +2 -2
  6. package/lib/audit-log.js +1 -1
  7. package/lib/boot/reconcile.js +3 -3
  8. package/lib/client.js +12 -1
  9. package/lib/compat/capability-specs.js +13 -17
  10. package/lib/compat/host-contracts.js +2 -0
  11. package/lib/compat/host-probe.js +35 -38
  12. package/lib/compat/host-roots.js +86 -15
  13. package/lib/compat/preset-reach.js +75 -102
  14. package/lib/compat/probe.js +68 -117
  15. package/lib/compat/runtime-notes.js +1 -1
  16. package/lib/context-inject-contract.js +6 -5
  17. package/lib/context-inject-frame.js +113 -53
  18. package/lib/context-inject-select.js +13 -14
  19. package/lib/context-inject-surface.js +5 -3
  20. package/lib/context-inject.js +58 -44
  21. package/lib/desktop-cookie-prune.js +95 -0
  22. package/lib/diagnostics.js +3 -1
  23. package/lib/exports/transcript.js +4 -4
  24. package/lib/host-names.js +6 -6
  25. package/lib/http-api.js +35 -26
  26. package/lib/http-fence.js +6 -6
  27. package/lib/hub.js +12 -13
  28. package/lib/imports/parsers.js +25 -21
  29. package/lib/imports/upload.js +5 -1
  30. package/lib/index.js +238 -231
  31. package/lib/mcp/disabled-tools.js +1 -0
  32. package/lib/mcp/loader-token.js +4 -4
  33. package/lib/mcp/manager.js +93 -114
  34. package/lib/mcp/override-blocks.js +1 -1
  35. package/lib/mcp/patch-yaml.js +42 -31
  36. package/lib/mcp/restart-marker.js +1 -1
  37. package/lib/mcp/secret-guard.js +6 -6
  38. package/lib/mcp/state-section.js +110 -69
  39. package/lib/mcp/tool-visibility.js +21 -22
  40. package/lib/memories/archive-engine.js +29 -29
  41. package/lib/memories/archive.js +23 -3
  42. package/lib/memories/constants.js +40 -127
  43. package/lib/memories/discovery.js +11 -2
  44. package/lib/memories/index-io.js +26 -20
  45. package/lib/memories/projection.js +18 -19
  46. package/lib/memories/prompt-layer.js +3 -2
  47. package/lib/memories/service.js +41 -38
  48. package/lib/memories/snapshot.js +37 -29
  49. package/lib/op-registry.js +33 -17
  50. package/lib/ops/candidates.js +3 -2
  51. package/lib/ops/compat.js +10 -9
  52. package/lib/ops/ctx.js +1 -1
  53. package/lib/ops/memory.js +18 -18
  54. package/lib/ops/prompts.js +8 -8
  55. package/lib/ops/quick-prompts.js +1 -0
  56. package/lib/ops/scene-records.js +23 -24
  57. package/lib/ops/scene-sync.js +8 -7
  58. package/lib/ops/scope.js +31 -30
  59. package/lib/ops/sessions.js +10 -9
  60. package/lib/ops/snapshot.js +10 -9
  61. package/lib/ops/state-doctor.js +6 -6
  62. package/lib/ops/trash-retention.js +2 -1
  63. package/lib/ops/trash.js +6 -6
  64. package/lib/prompts/preset-id.js +1 -1
  65. package/lib/prompts/project-instructions.js +3 -3
  66. package/lib/prompts/quick-service.js +1 -0
  67. package/lib/prompts/service.js +13 -12
  68. package/lib/request-gate.js +26 -25
  69. package/lib/scene-linkage.js +6 -5
  70. package/lib/scene-prompt-sync.js +10 -9
  71. package/lib/scene-settings.js +1 -0
  72. package/lib/scenes/candidates.js +9 -10
  73. package/lib/scope/intent-store.js +1 -0
  74. package/lib/scope/intent.js +10 -10
  75. package/lib/scope/resolve.js +6 -6
  76. package/lib/scope/scope-overrides.js +17 -17
  77. package/lib/scope/store.js +1 -0
  78. package/lib/sessions/archive-schemas.js +9 -0
  79. package/lib/sessions/bridge.js +42 -56
  80. package/lib/sessions/history.js +6 -7
  81. package/lib/sessions/workspace.js +21 -23
  82. package/lib/settings-sidecars.js +1 -0
  83. package/lib/sidebar-settings.js +1 -0
  84. package/lib/skills/catalog.js +9 -10
  85. package/lib/skills/core-util.js +5 -0
  86. package/lib/skills/core.js +35 -22
  87. package/lib/skills/frontmatter.js +26 -14
  88. package/lib/skills/homes.js +2 -0
  89. package/lib/skills/import-pipeline.js +8 -1
  90. package/lib/skills/manager-state.js +30 -6
  91. package/lib/skills/official.js +14 -11
  92. package/lib/skills/readonly-discovery.js +1 -0
  93. package/lib/skills/service.js +19 -18
  94. package/lib/skills/skill-roots.js +25 -7
  95. package/lib/skills/skill-trash.js +14 -3
  96. package/lib/skills/system-trash.js +3 -1
  97. package/lib/skills/upload-pipeline.js +19 -3
  98. package/lib/slash-settings.js +1 -0
  99. package/lib/stale-write.js +9 -1
  100. package/lib/subagents/catalog.js +5 -5
  101. package/lib/subagents/child-preset.js +7 -10
  102. package/lib/subagents/persona-parse.js +9 -8
  103. package/lib/subagents/persona-write.js +1 -1
  104. package/lib/subagents/run-provider.js +13 -15
  105. package/lib/subagents/service.js +13 -12
  106. package/lib/subagents/tool-filter.js +1 -1
  107. package/lib/subagents/tools.js +41 -39
  108. package/lib/token-config.js +9 -9
  109. package/lib/tool-table-switch.js +3 -2
  110. package/lib/tools/deps.js +33 -13
  111. package/lib/tools/mcp.js +62 -35
  112. package/lib/tools/memory.js +51 -36
  113. package/lib/tools/prompt.js +32 -20
  114. package/lib/tools/remove.js +12 -11
  115. package/lib/tools/scene.js +39 -36
  116. package/lib/tools/skills.js +44 -45
  117. package/lib/tools/subagent.js +21 -22
  118. package/lib/tools/table.js +21 -20
  119. package/lib/trash-id.js +3 -2
  120. package/lib/trash-retention.js +4 -5
  121. package/lib/update-check.js +5 -1
  122. package/package.json +3 -2
@@ -1,15 +1,14 @@
1
- // 记忆(rules)域的 model 工具(2026-09-19 从 index.ts 的注册区抽出;2026-09-23 改名合并、
2
- // 同日把场景能力分出去;0.21.2 加 _search):memory_manager_list / _read / _search / _switch / _save。
1
+ // 记忆(rules)域的 model 工具:memory_manager_list / _read / _search / _switch / _save。
3
2
  //
4
- // 为什么族名在 0.14.0 里绕了一圈回到 `memory_manager_`:中途改成 `scene_memory_manager_`
5
- // 是为了跟注入段名(`scene-memory-manager-catalog`)对齐,但那个名字描述的是**域**,
3
+ // 为什么族名是 `memory_manager_` 而不是 `scene_memory_manager_`:后者是为了跟注入段名
4
+ // (`scene-memory-manager-catalog`)对齐才改的,但那个名字描述的是**域**,
6
5
  // 而这个族操作的全是记忆。加场景能力时这个错配就现形了 —— 场景是另一个对象(容器,
7
6
  // 进入时切换 mcp / 技能 / 人设),硬塞进 `save` 会让 `description` 变成双义参数(给
8
7
  // `memory` 时是记忆描述、给 `scene` 时是场景描述),门禁也得按参数分叉(记忆写入有开关
9
8
  // 可放行,场景写入是改运行时环境、不该有那条路)。所以拆成两族:这里管记忆内容,
10
9
  // `scene_manager_*`(tools/scene.ts)管场景本身。
11
10
  //
12
- // 场景清单也不挂在这条 list 的尾巴上(同日第四轮裁定:「记忆就管记忆,场景就管场景」)——
11
+ // 场景清单也不挂在这条 list 的尾巴上(「记忆就管记忆,场景就管场景」)——
13
12
  // 它在 `scene_manager_list`,理由记在 tools/scene.ts 头部,别当"少写了一段"再加回来。
14
13
  //
15
14
  // 为什么 write + update 并成 save:两者的判定(同名 = 改、无同名 = 建)本来就只有
@@ -17,18 +16,20 @@
17
16
  // 模型必须自己先查一次再决定调哪条,而它手里的清单可能已经过期。合并后由工具侧兜住。
18
17
  //
19
18
  // 活动场景的记忆正文会自动注入上下文(无需调用工具读取);这里的工具用于查询/编辑规则
20
- // 本身。memory_manager_save 受 tools/pre-execute 审批门禁(D2)。
19
+ // 本身。memory_manager_save 受 tools/pre-execute 审批门禁。
21
20
  // 路径锚点:$DSH_HOME/tool-management/memories/<场景>/…(场景 `global` = 界面「全局」)。
22
- import { effectiveScope, globalActionNote, isolationOffNote, scopeOnlyNote, scopeSessionDesc, sessionScopeOf, text } from './deps.js';
21
+ import { GLOBAL_SCENE, SHARED_GROUP } from '../memories/constants.js';
22
+ import { effectiveScope, globalActionNote, globalUnchangedNote, isolationOffNote, scopeOnlyNote, scopeSessionDesc, sessionScopeOf, text } from './deps.js';
23
+ /** 注册记忆域的 model 工具(列表 / 读取 / 检索 / 切换 / 保存)。 */
23
24
  export function buildMemoryTools(deps) {
24
25
  const { defineTool, register } = deps;
25
26
  register(defineTool({
26
27
  name: 'memory_manager_list',
27
28
  // 末尾**不点名** `scene_manager_list`:场景一族在出厂默认里就是关着的,指向一条模型没有的
28
- // 工具只会让它去猜名字(用户 2026-09-23 把默认名单扩到十五条时去掉的这句)。
29
+ // 工具只会让它去猜名字(用户 把默认名单扩到十五条时去掉的这句)。
29
30
  description: 'List memories (id, scene, enabled, form flat|bundle, description) plus the scene the injection follows. What is injected each turn is in the "Current memories" reminder; use this for ids and for entries that are off. Pass `scene` to filter; all=true lists everything.',
30
31
  parameters: {
31
- // 参数名与其余五个域同词(2026-10-14 对抗性审查 P1-3):同一个概念在工具面只该有一个名字,
32
+ // 参数名与其余五个域同词:同一个概念在工具面只该有一个名字
32
33
  // 而 `scene` 是它在 `scene_manager_*`、`<scene>/<name>` 与注入段标题里的叫法。
33
34
  // op 的内部契约字段仍是 `group`(`rules-list` 与界面侧调用方都读它),所以 execute 里
34
35
  // 显式映射一次 —— 改 op 的字段名要动界面,那不是这一条能顺手做的事。
@@ -42,7 +43,7 @@ export function buildMemoryTools(deps) {
42
43
  const opArgs = {};
43
44
  if (args && args.scene !== undefined)
44
45
  opArgs.group = args.scene;
45
- // 会话层(0.21.2,计划 §8.2「memory_manager_list 只列本会话场景」):带上 sessionId,
46
+ // 会话层(`memory_manager_list` 只列本会话场景):带上 sessionId,
46
47
  // op 就按本会话钉住的场景与逐条开关投影 —— 「会注入」这一栏与模型真实看到的一致。
47
48
  // 取不到会话 = 不给,op 退回全局口径(不报错)。
48
49
  const scoped = sessionScopeOf(deps, exec && exec.agent);
@@ -53,8 +54,16 @@ export function buildMemoryTools(deps) {
53
54
  throw new Error((r && r.error) || 'failed to read memories');
54
55
  // 「会注入」的判定与记忆段同源(renderSceneMemory):global 场景恒常注入,其余场景要
55
56
  // 在 index.active 里,再叠加单条 enabled 与同名 bundle 的 shadowed。默认只列这些,
56
- // 全列一次会把没启用的条目也算进上下文(用户裁定 2026-09-16,与技能列表同口径)。
57
- const sceneOn = (group) => group === 'global' ||
57
+ // 全列一次会把没启用的条目也算进上下文(与技能列表同口径)。
58
+ //
59
+ // **两个**保留桶恒常注入,不是一个:`global`(界面「全局」)之外还有 `_shared`
60
+ // (公共基线)。注入侧 `resolveActiveScenes` 无条件把两者都放进 active
61
+ // (见 memories/projection.ts),这里只认 `global` 就会把 `_shared` 标成
62
+ // "scene off" 并默认藏起来 —— 而它每轮都在上下文里。模型照这份名单回答
63
+ // 「没有这条记忆」,实际它正躺在自己眼前。`activeScene` 永远报不到 `_shared`
64
+ // (`enabledSceneOf` 只回非保留场景),所以只能在这一层显式认。
65
+ const alwaysInjects = (group) => group === GLOBAL_SCENE || group === SHARED_GROUP;
66
+ const sceneOn = (group) => alwaysInjects(group) ||
58
67
  (group !== '' && (r.activeMode === 'all' || String(r.activeScene || '') === group));
59
68
  const stateOf = (x) => {
60
69
  if (x.shadowed === true)
@@ -68,7 +77,7 @@ export function buildMemoryTools(deps) {
68
77
  const rows = (r.rules || []).map((x) => ({ x, ...stateOf(x) }));
69
78
  const shown = showAll ? rows : rows.filter((row) => row.injects);
70
79
  const lines = shown.map(({ x, label }) => ('- ' + x.id + ' [' + (x.group || 'no scene') + '] ' + label +
71
- // 形态与附件(2026-10-15):此前不报,模型分不清哪条是 bundle、更不知道它带了几个附件
80
+ // 形态与附件:此前不报,模型分不清哪条是 bundle、更不知道它带了几个附件
72
81
  // (`rules-list` 早就把 `form` 与 bundle 的附件摘要给了出来,只是这里没渲染)。
73
82
  (x.form === 'bundle'
74
83
  ? ' · bundle' + (x.attach && x.attach.count ? ' (' + x.attach.count + ' attachment(s))' : '')
@@ -76,22 +85,26 @@ export function buildMemoryTools(deps) {
76
85
  (x.description ? ' — ' + x.description : '')));
77
86
  // 注入按哪个场景走 —— 上面那句「场景未启用」只有配上它才可解读:少了这一行,
78
87
  // 模型看到一片"未启用"会以为是条目自己的问题。(场景本身的清单在 `scene_manager_list`,
79
- // 2026-09-23 拆过去了;这里只留"记忆按哪一集注入",因为那是记忆域自己的现状。)
80
88
  const scope = r.activeMode === 'all'
81
89
  ? 'every scene (historical default, not narrowed)'
82
90
  : (r.activeScene ? '"' + String(r.activeScene) + '"' : 'no scene is on');
83
- // 会话层(0.21.2):本会话钉了场景 / 改了个别开关时,上面那行报的是**本会话**的投影,
91
+ // 会话层:本会话钉了场景 / 改了个别开关时,上面那行报的是**本会话**的投影
84
92
  // 与全局可能不同。不说清的话,模型会拿这份名单去回答"全局现在是什么" —— 那是错的答案。
93
+ // 粒度决定这句话的主语:工作区粒度下那一格是同工作区共享的,"本对话"是假话。
94
+ const viewNoun = deps.scopeMode?.() === 'workspace' ? 'this workspace' : 'this conversation';
85
95
  const sessionNote = scoped === null || scoped.scope === undefined
86
96
  ? ''
87
- : '\nthis is the view here (this conversation, or its whole workspace under per-workspace isolation)' +
97
+ : '\nthis is ' + viewNoun + "'s view" +
88
98
  (scoped.scope.scene !== undefined ? ' — scene pinned to "' + scoped.scope.scene + '"; the machine-wide scene may differ' : '') +
89
99
  (scoped.scope.memory !== undefined ? '; ' + Object.keys(scoped.scope.memory).length + ' switch(es) applied here' : '');
100
+ // `_shared` 只在真有这类条目时点名:没有就不付这几个字,而有了不说的话,
101
+ // 上面那句「只列会注入的」会让人以为名单里全是 global + 当前场景。
102
+ const sharedHere = rows.some(({ x }) => String(x.group || '') === SHARED_GROUP);
90
103
  const header = 'memories: ' + (showAll
91
104
  ? rows.length + ' total'
92
105
  : shown.length + ' injecting / ' + rows.length + ' total' +
93
106
  (shown.length === rows.length ? '' : ' (pass all=true for all)')) +
94
- '\ninjects from: ' + scope + ' + global (global always injects)' + sessionNote + '\n';
107
+ '\ninjects from: ' + scope + ' + global' + (sharedHere ? ' + _shared' : '') + ' (always on)' + sessionNote + '\n';
95
108
  // 注入边界:压制型预设(persona complete / 关闭运行时上下文)下本插件默认不注入,
96
109
  // 此时列出的记忆**不在**模型上下文里。必须说出来,否则模型会假设自己已经看到正文。
97
110
  const notice = await deps.reachNoticeForAgent(deps.presetRoster(), exec && exec.agent && exec.agent.ctx, deps.injectNoticeOptions());
@@ -100,7 +113,7 @@ export function buildMemoryTools(deps) {
100
113
  }));
101
114
  register(defineTool({
102
115
  name: 'memory_manager_read',
103
- // "dropped by the byte budget" 改成"left out of it"(2026-10-15 注入文本审查):byte budget
116
+ // "dropped by the byte budget" 改成"left out of it":byte budget
104
117
  // 是本插件内部术语,模型没有这个概念 —— 它只知道"这条在不在我上下文里"。说内部机制
105
118
  // 等于让它去猜一个它观测不到的量。
106
119
  description: 'Read one memory\'s full body, its form (flat|bundle) and its attachment names. Only for ones not already in your context (disabled, in an inactive scene, or left out). Attachment contents are not returned — use your file tools.',
@@ -114,7 +127,7 @@ export function buildMemoryTools(deps) {
114
127
  if (!r || r.ok === false)
115
128
  throw new Error((r && r.error) || 'failed to read memories');
116
129
  const rule = r.rule || {};
117
- // 形态与附件名(2026-10-15):op 一直把 `attachments` 给了出来,这里此前**整个丢掉**,
130
+ // 形态与附件名:op 一直把 `attachments` 给了出来,这里此前**整个丢掉**,
118
131
  // 于是模型连"这条记忆是 bundle、带了 3 个附件"都看不到。只给名字不给内容 ——
119
132
  // 附件可能是图片或大 md,全文塞回来会吃光这一轮的上下文(与注入段附件行同口径)。
120
133
  const attach = Array.isArray(rule.attachments) ? rule.attachments : [];
@@ -122,7 +135,7 @@ export function buildMemoryTools(deps) {
122
135
  const attLine = attach.length
123
136
  ? '\nattachments (' + attach.length + '): ' + attach.map((a) => String((a && a.name) || a)).join(', ')
124
137
  : '';
125
- // 会话层(0.21.2):这条记忆在本会话是关着的(或不在本会话钉住的场景里)时,读得到
138
+ // 会话层:这条记忆在本会话是关着的(或不在本会话钉住的场景里)时,读得到
126
139
  // 正文 ≠ 它会进上下文。不说清的话,模型会以为自己已经掌握了它、下一轮却看不到。
127
140
  const scoped = sessionScopeOf(deps, exec && exec.agent);
128
141
  const over = scoped?.scope?.memory?.[String(rule.id)];
@@ -169,11 +182,11 @@ export function buildMemoryTools(deps) {
169
182
  }));
170
183
  register(defineTool({
171
184
  name: 'memory_manager_switch',
172
- // 为什么叫 `_switch` 而不是 `_set_enabled`(2026-09-23 用户裁定):六个域里"拨一个开关"
185
+ // 为什么叫 `_switch` 而不是 `_set_enabled`:六个域里"拨一个开关"
173
186
  // 是同一件事,名字该同形 —— `mcp_manager_switch` 早就是这个名字,`_set_enabled` 只剩
174
187
  // 记忆 / 技能 / 人设三族在叫。**参数保留 `enabled` 布尔**:这里没有 `restart` 那第三个
175
188
  // 动词,`action: 'on' | 'off'` 只会在 `true`/`false` 之上多一层映射、多付一段 schema。
176
- // 旧名不注册别名(同 0.14.0 的口径:注册就进工具表、就要付 token);用户的旧设置由
189
+ // 旧名不注册别名(同一口径:注册就进工具表、就要付 token);用户的旧设置由
177
190
  // `tools/table.ts` 的 `LEGACY_TOOL_NAME_MAP` 翻译。
178
191
  //
179
192
  // 为什么单独一个工具:注入实况里「这个域注入了几次 / 模型调了几次」都看得到,但模型此前
@@ -182,14 +195,14 @@ export function buildMemoryTools(deps) {
182
195
  // 三个写侧工具共用一句 consent(`Only when the user asks or approves.` / `Only on the
183
196
  // user's instruction.`):这些动的都是"以后每一轮都会带上"的东西,模型不该顺手做。
184
197
  // 描述同时按"省 token"重写了一遍 —— 这几段文字每次请求都要发出去,废话是常驻成本。
185
- // 后半句"freeing the byte budget"删掉(2026-10-15 注入文本审查):byte budget 是本插件
198
+ // 后半句"freeing the byte budget"删掉:byte budget 是本插件
186
199
  // 内部术语,模型据此做不了任何判断 —— "不再被注入"已经是它需要的全部因果。
187
200
  description: 'Enable or disable one memory. Disabled memories stop being injected. Reversible. Only when the user asks or approves.',
188
201
  parameters: {
189
202
  memory: { type: 'string', required: true, description: 'Memory id like <scene>/<name>.' },
190
203
  enabled: { type: 'boolean', required: true, description: 'true = enable, false = disable.' },
191
- // 决策 10(2026-10-19):默认只改**这个对话**。写全局要显式说明。
192
- scope: { type: 'string', enum: ['session', 'global'], description: scopeSessionDesc('global = every conversation (the memory index).') },
204
+ // 默认只改**这个对话**。写全局要显式说明。
205
+ scope: { type: 'string', enum: ['session', 'global'], description: scopeSessionDesc('global = every conversation.') },
193
206
  },
194
207
  output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
195
208
  async execute(args, exec) {
@@ -198,7 +211,7 @@ export function buildMemoryTools(deps) {
198
211
  // 中文 op 错;这里先挡一句说清"这条工具要什么"。
199
212
  if (typeof (args && args.enabled) !== 'boolean')
200
213
  throw new Error('missing argument: enabled must be true or false');
201
- // 场景锁冻结的是**全局**写入(决策 11):会话覆盖写的是侧车,与锁无关 ——
214
+ // 场景锁冻结的是**全局**写入:会话覆盖写的是侧车,与锁无关 ——
202
215
  // 与面板的 `scopeWriteLocked()` 同一口径。只有全局那条路才过守卫。
203
216
  // 全局粒度下 `effectiveScope` 一律返回 global:那一档没有会话层,写的就是索引本身。
204
217
  const scope = effectiveScope(deps, args);
@@ -208,7 +221,7 @@ export function buildMemoryTools(deps) {
208
221
  if (blocked)
209
222
  throw new Error(blocked);
210
223
  }
211
- // 决策 10:默认写**本会话**(别的对话不受影响),`scope: "global"` 才改索引。
224
+ // 默认写**本会话**(别的对话不受影响),`scope: "global"` 才改索引。
212
225
  // 会话层只改"注入不注入",不碰索引里那条记录 —— 所以不需要场景档案同步。
213
226
  if (sessionOnly) {
214
227
  if (!deps.sessionScopeSet)
@@ -216,9 +229,9 @@ export function buildMemoryTools(deps) {
216
229
  const sc = await deps.sessionScopeSet(exec && exec.agent, 'memory', memory, args.enabled === true);
217
230
  if (!sc || sc.ok === false)
218
231
  throw new Error((sc && sc.error) || 'failed to switch this memory here');
219
- return 'OK: ' + memory + ' now ' + (args.enabled ? 'enabled' : 'disabled') + scopeOnlyNote() +
220
- (sc.cleared === true ? ' (that matches the global setting, so the per-conversation override was removed)' : '') +
221
- '. The global setting is unchanged; other conversations keep theirs. Pass scope="global" to change it for every conversation.';
232
+ return 'OK: ' + memory + ' now ' + (args.enabled ? 'enabled' : 'disabled') + scopeOnlyNote(deps) +
233
+ (sc.cleared === true ? ' (that matches what this scope would see anyway, so the override was removed)' : '') +
234
+ '. ' + globalUnchangedNote(deps) + ' Pass scope="global" to change it for every conversation.';
222
235
  }
223
236
  const r = await deps.rulesOps['rules-toggle']({ id: memory, enabled: args.enabled });
224
237
  if (!r || r.ok === false)
@@ -244,7 +257,7 @@ export function buildMemoryTools(deps) {
244
257
  }));
245
258
  register(defineTool({
246
259
  name: 'memory_manager_save',
247
- // 「能推导的别记」「先查重」这两句是 0.13.0 加的:记忆是唯一直接吃注入预算的域
260
+ // 「能推导的别记」「先查重」这两句必须有:记忆是唯一直接吃注入预算的域
248
261
  // (场景段 128 KiB),而模型很乐意把「这个项目用 pnpm」记一条 —— 那看一眼 `package.json`
249
262
  // 就知道,记下来却永久占着每一轮请求。合并 write/update 后这两句更要留:upsert 降低了
250
263
  // "再记一条"的摩擦,而摩擦正是这里唯一拦得住它的东西。
@@ -253,7 +266,7 @@ export function buildMemoryTools(deps) {
253
266
  memory: { type: 'string', required: true, description: 'Memory id like <scene>/<name> — copy it from the list. `global` is the always-on scene.' },
254
267
  description: { type: 'string', description: 'One-sentence description (<=500 chars). Required when creating. Empty string = drop it and re-derive from the body; omit = keep.' },
255
268
  body: { type: 'string', description: 'Markdown body (<=256 KiB). Required when creating. Omit to keep the current body.' },
256
- // 不再承诺「旧文件进回收站」(2026-10-14 对抗性审查 P0-3):bundle 记忆改名走的是
269
+ // 不再承诺「旧文件进回收站」:bundle 记忆改名走的是
257
270
  // 「只重写正文、目录不动」那条路,一个字都不进回收站 —— 对 bundle 说进回收站是假话。
258
271
  // 与上一轮 P1-1 同口径:**只说可逆,不说实现细节**。
259
272
  nextName: { type: 'string', description: 'New memory name (= file name); omit to keep it.' },
@@ -266,7 +279,7 @@ export function buildMemoryTools(deps) {
266
279
  const memory = String((args && args.memory) || '').trim();
267
280
  // 拆成 `<场景>/<名字>`:要求两段都非空。**不做"没有斜杠就落 global"的兜底** —— 那会把
268
281
  // 一次拼错的 id 变成一条"每轮都注入"的全局记忆,而清单上看起来完全正常。
269
- // 清单里打印的就是 `<场景>/<名字>`,照抄比拼装准(§2 规则一)。
282
+ // 清单里打印的就是 `<场景>/<名字>`,照抄比拼装准。
270
283
  const slash = memory.indexOf('/');
271
284
  if (slash <= 0 || slash === memory.length - 1) {
272
285
  throw new Error('memory must be <scene>/<name> (copy that from the listing; the always-on scene is written global/<name>): ' + (memory || '(empty)'));
@@ -338,11 +351,11 @@ export function buildMemoryTools(deps) {
338
351
  const warn = dup.length
339
352
  ? `\nnote: ${dup.length} existing memories have a similar name or description (${dup.join(', ')}) — if it is the same thing, update that one instead of keeping two.`
340
353
  : '';
341
- // 回执必须同时说清**两个**条件(2026-10-15 smoke-test P1-3):新建的记忆在 op 层是
354
+ // 回执必须同时说清**两个**条件:新建的记忆在 op 层是
342
355
  // `enabled: false`(ops/memory.ts 的 rulesCreate),而原先这句只提场景 —— 读起来像
343
356
  // "场景一开它就自动生效",模型据此以为已经生效,实际还差一次开关。与 skill_manager_save
344
357
  // 的 enableHint 同一形状:点名的工具在出厂默认名单里是关着的,关着就改说"用户开启后"。
345
- // 「会不会注入」按**本会话**的投影判(0.21.2):会话钉了别的场景时,这条记忆落进的
358
+ // 「会不会注入」按**本会话**的投影判:会话钉了别的场景时,这条记忆落进的
346
359
  // 那个场景在这个对话里根本没开着 —— 照全局口径回一句"打开就能用"是错的答案。
347
360
  const scoped = sessionScopeOf(deps, exec && exec.agent);
348
361
  const effScene = scoped?.scope?.scene;
@@ -351,7 +364,9 @@ export function buildMemoryTools(deps) {
351
364
  const sceneActive = group === 'global' ||
352
365
  (group !== '' && (activeMode === 'all' || String(activeNow || '') === group));
353
366
  const sceneTail = sceneActive ? '' : ', and turn scene "' + group + '" on';
354
- const enableHint = deps.toolVisible('memory_manager_switch')
367
+ // 判据按 **agent**:工具表是每个作用域一份,本作用域把它关掉(或人设 toolsDeny 砍掉)
368
+ // 之后,点名它就是让模型白跑一趟 —— 与 mcp/skill 的 listHint 同一条。
369
+ const enableHint = deps.toolVisibleFor('memory_manager_switch', exec && exec.agent)
355
370
  ? ' (created disabled — turn it on first with memory_manager_switch' + sceneTail + ')'
356
371
  : ' (created disabled — the user has to turn it on first' + sceneTail + ')';
357
372
  // 会话层:这条记忆写的是**磁盘上的那一份**(所有对话共用),本会话的开关只决定
@@ -1,10 +1,10 @@
1
- // AGENTS.md 预设域的 model 工具(2026-09-19 从 index.ts 的注册区抽出):
1
+ // AGENTS.md 预设域的 model 工具(从 index.ts 的注册区抽出):
2
2
  // prompt_manager_list / prompt_manager_apply。
3
3
  //
4
4
  // 模型可查、可切;**不能造** —— 预设正文是用户自己写的一份长文(`AGENTS.md`),
5
5
  // 模型没有创建入口,要新建只能由用户在面板里写。
6
6
  //
7
- // 删除在 `tools/remove.ts` 的 `prompt_manager_remove`(2026-10-15 加)。此前这里写的是
7
+ // 删除在 `tools/remove.ts` 的 `prompt_manager_remove`(加)。此前这里写的是
8
8
  // 「不能造 / **不能删** —— 避免模型乱删用户预设」,那条理由针对的是**不可恢复**的删除:
9
9
  // 预设正文是用户手写的、删了就得重写。回收站把它的前提消掉了 —— 五条 `*_manager_remove`
10
10
  // 一律「进回收站、可恢复、需用户指令、过场景冻结守卫」,永久删除仍只留在面板。
@@ -13,12 +13,13 @@ import { join } from 'node:path';
13
13
  import { normalizePresetDescription } from '../prompts/service.js';
14
14
  import { hasPromptOverride } from '../scope/scope-overrides.js';
15
15
  import { sessionScopeOf, text } from './deps.js';
16
+ /** 注册提示词域的 model 工具(列表 / 读取 / 应用)。 */
16
17
  export function buildPromptTools(deps) {
17
18
  const { defineTool, register } = deps;
18
19
  register(defineTool({
19
20
  name: 'prompt_manager_list',
20
21
  // 那句 `(that reminder is absent when the preset carries the official instructions line)`
21
- // 删掉(2026-10-15 注入文本审查):模型**观测不到**"official instructions line"这个条件,
22
+ // 删掉:模型**观测不到**"official instructions line"这个条件
22
23
  // 拿它做不了任何决定 —— reminder 在不在,它抬头就能看见,不必由描述来预告。
23
24
  description: 'List AGENTS.md presets (id, description, active state, file path); read that file for a body. The one in effect is in the "Current prompt" reminder. Defaults to the one in effect; all=true for the whole library.',
24
25
  parameters: {
@@ -31,7 +32,7 @@ export function buildPromptTools(deps) {
31
32
  if (!r || r.ok === false)
32
33
  throw new Error((r && r.error) || 'failed to read the AGENTS.md presets');
33
34
  const all = r.presets || [];
34
- // 默认只列「这份 AGENTS.md 来自哪个预设」(用户裁定 2026-09-16)。
35
+ // 默认只列「这份 AGENTS.md 来自哪个预设」。
35
36
  // 判定分两级:`active`(场景驱动时 = 场景绑的那份;否则 = 内容逐字节相同)优先,
36
37
  // 否则看服务层记下的「最近一次应用」—— 用户手改过全局文件时,第二级仍能给出答案,
37
38
  // 不必退化成全列(那会白烧上下文)。
@@ -41,11 +42,11 @@ export function buildPromptTools(deps) {
41
42
  // 三列各有用途:
42
43
  // · 路径 —— 「名单 → 全文」的闭环。预设正文既不进提示词、也没有读取工具,给出文件
43
44
  // 路径让模型用宿主的文件工具读,比再造一个 read 工具省一条常驻 schema。
44
- // · 描述 —— 0.14.0 加的。模型要能在预设之间做选择,而 id 本身不说明用途。描述在
45
+ // · 描述 —— 模型要能在预设之间做选择,而 id 本身不说明用途。描述在
45
46
  // 这里按 `DEFAULT_PRESET_DESC_MAX_LENGTH` 压行截断(与 MCP 备注同一条口径),
46
47
  // 因为它从这一版起是**常驻成本**而不是"只给使用者看"。
47
48
  // · mark —— `activeVia` 必须打出来:`fileApplied` 但场景绑着别的,说明文件里那份
48
- // 已经**不生效**了。0.14.0 之前这里会错报成 [active](那正是被修掉的那句假话)。
49
+ // 已经**不生效**了。原先这里会错报成 [active](那正是被修掉的那句假话)。
49
50
  const summary = shown.map((p) => {
50
51
  const mark = p.active
51
52
  ? (p.activeVia === 'scene' ? ' [active via scene]' : ' [active via file]')
@@ -55,7 +56,7 @@ export function buildPromptTools(deps) {
55
56
  const desc = normalizePresetDescription(p.description);
56
57
  return p.id + mark + ' | ' + (desc || '(no description)') + ' | ' + join(deps.promptsDir, p.id, 'AGENTS.md');
57
58
  });
58
- // 会话层(0.21.2,决策 5):提示词**不进**会话域 —— 预设写的是全局基线 ~/.dsh/AGENTS.md,
59
+ // 会话层:提示词**不进**会话域 —— 预设写的是全局基线 ~/.dsh/AGENTS.md,
59
60
  // 宿主每轮只读一份。会话能改的是生效场景,而场景绑哪个预设是场景自己的事。
60
61
  // 这句只在模型真会读错时才值钱:它会拿这份清单回答「本会话现在用哪份提示词」,
61
62
  // 而本会话钉住场景时,答案来自那个场景的绑定,不是这份 active 标记。
@@ -79,7 +80,7 @@ export function buildPromptTools(deps) {
79
80
  name: 'prompt_manager_apply',
80
81
  description: 'Apply one AGENTS.md preset by id; effective next turn. When a scene drives the baseline this does not refuse — it rebinds that scene, so tell the user which one. A locked scene blocks the call. apply=false cancels instead: AGENTS.md goes back to what it was before this run of applies (removed if there was none), which a scene-driven baseline refuses — rebind the scene instead. Only on the user\'s instruction.',
81
82
  parameters: {
82
- // `id` 从 required 摘掉(2026-10-15 smoke-test P1-5):描述一直写着 "Ignored when
83
+ // `id` 从 required 摘掉:描述一直写着 "Ignored when
83
84
  // apply=false",schema 却把它标成必填 —— 模型照描述「取消不用给 id」操作,先被 schema
84
85
  // 拒掉(missing required property "id"),只能编一个 dummy id 才过得去。条件必填由
85
86
  // execute 里那句守卫表达,与 `skill_manager_switch` 的 enabled / prefer 同一形状。
@@ -91,11 +92,11 @@ export function buildPromptTools(deps) {
91
92
  const blocked = await deps.lockedSceneGuard();
92
93
  if (blocked)
93
94
  throw new Error(blocked);
94
- // 会话层(0.21.2,决策 5):提示词永远全局。本会话钉了场景时,这里改的是**那个场景**
95
+ // 会话层:提示词永远全局。本会话钉了场景时,这里改的是**那个场景**
95
96
  // 的绑定(`applyPresetGuarded` 的 viaScene 分支)—— 别的对话只要没钉同一个场景就不受影响,
96
97
  // 但这不是「本会话的提示词」,回执必须按那条路说清。
97
- // 提示词**不进**会话域(决策 5),所以这里没有 scope 参数,也**不做**
98
- // `requireGlobalScope` 守卫(2026-10-21 审查 P2-2):守卫读 `args.scope`,而参数表里
98
+ // 提示词**不进**会话域,所以这里没有 scope 参数,也**不做**
99
+ // `requireGlobalScope` 守卫:守卫读 `args.scope`,而参数表里
99
100
  // 没有这个字段 —— 模型按 schema 不可能传它,守卫只在「模型自己编了一个未声明参数」时
100
101
  // 才触发,等于靠运气。留着这行还让 deps.ts 的清单以为这条被守住了。
101
102
  // 提示词确实只有全局一层,参数表已经把这件事说完了。
@@ -104,7 +105,7 @@ export function buildPromptTools(deps) {
104
105
  if (args.apply === false) {
105
106
  // 取消方向:`agentsmd-unapply` 自带两条护栏(场景驱动时拒绝、没有链起点时给确定
106
107
  // 错误码),原样透传。回执要说清恢复成哪种 —— 起点没有文件时是**删文件**,
107
- // 不说的话用户以为 AGENTS.md 还在(0.19.1 界面弹窗报的就是这两种)。
108
+ // 不说的话用户以为 AGENTS.md 还在(界面弹窗报的就是这两种)。
108
109
  const r = await deps.unapplyPreset();
109
110
  if (!r.ok)
110
111
  throw new Error(r.error || 'failed to cancel the application');
@@ -122,18 +123,29 @@ export function buildPromptTools(deps) {
122
123
  // 场景驱动时写的是「场景绑定」,回执必须说清改的是哪个场景 —— 只说「已应用到
123
124
  // AGENTS.md」会让模型对用户谎报(用户不知道自己的场景绑定被换掉了)。
124
125
  if (r.viaScene) {
125
- return 'OK: preset ' + id + ' is now the prompt binding of scene "' + (r.scene || '') + '" and the scene was re-synced (effective next turn; ~/.dsh/AGENTS.md now carries that scene\'s binding).' +
126
- // 会话层:这个场景可能只是**本会话**钉住的那个(别的对话钉别的场景),所以「绑到了场景」
127
- // 与「所有对话都变成这份提示词」不是一回事。
128
- (pinned === undefined || pinned !== String(r.scene || '')
129
- ? ''
130
- : '\nnote: that is this scope\'s pinned scene. Other conversations only pick this up if they pin the same scene; the machine-wide baseline is whatever the global scene binds.');
126
+ // `scene` 是场景名(`scene_manager_*` 认的那个),`label` 是界面显示名 ——
127
+ // 只报 label 时模型会把「全局」当场景名转述,而那个名字其实是 `global`。
128
+ const target = String(r.scene || '');
129
+ const shown = target + (r.label && String(r.label) !== target ? ' (' + String(r.label) + ')' : '');
130
+ // 会话层两种情形必须分开说:`applyPresetGuarded` 走的是**全局** driver,
131
+ // 永远只改机器级那个场景的绑定,而本作用域可能钉着**另一个**场景。
132
+ // 只报「绑定换成了 X」时,agent 会把它转述成「这个对话的提示词换了」——
133
+ // 而这里一个字都没变(原先那句只在两个名字相同时才出,恰好是最不需要它的情形)。
134
+ const scopeNote = pinned === undefined
135
+ ? ''
136
+ : pinned === target
137
+ ? '\nnote: that is the scene pinned here, so this scope follows it.'
138
+ : '\nnote: this scope pins scene "' + pinned + '", so what it gets here is unchanged — this call rebound the machine-wide scene "' + shown + '". '
139
+ + (deps.toolVisibleFor('scene_manager_save', exec && exec.agent)
140
+ ? 'To change the binding that applies here, save scene "' + pinned + '" with that preset (scene_manager_save).'
141
+ : 'To change the binding that applies here, the user has to rebind scene "' + pinned + '" in the panel.');
142
+ return 'OK: preset ' + id + ' is now the prompt binding of scene "' + shown + '" and the scene was re-synced (effective next turn; ~/.dsh/AGENTS.md now carries that scene\'s binding).' + scopeNote;
131
143
  }
132
144
  // 生效时机与宿主行为对齐(index.ts 提示词服务一节考证过):dsh-agent-instructions
133
145
  // 每个 pre-step 都 stat 比对版本,写文件即下一轮重读 —— 不是"下个会话"。说错了
134
146
  // 模型会劝用户重开会话,而其实下一句话就已经在新基线下跑。
135
147
  return 'OK: preset ' + id + ' applied to ~/.dsh/AGENTS.md — effective next turn' + (r.backedUp ? ' (previous backed up to __last-applied__)' : '') +
136
- // 成功分支也要带尾注(2026-10-21 审查 P0-2):`applyPresetGuarded` 走的是**全局**
148
+ // 成功分支也要带尾注:`applyPresetGuarded` 走的是**全局**
137
149
  // driver,本会话钉着的场景/会话级覆盖都不在其中 —— 不带的话,模型会照回执说
138
150
  // 「提示词已换」,而用户在这个对话里看到的是原来那份。
139
151
  promptScopeTail(scoped?.scope);
@@ -141,7 +153,7 @@ export function buildPromptTools(deps) {
141
153
  }));
142
154
  }
143
155
  /**
144
- * 提示词回执的会话尾注(0.21.2,决策 5;2026-10-21 审查 P0-2 由「钉场景」扩成三路)。
156
+ * 提示词回执的会话尾注(三路:会话覆盖 / 钉住场景 / 无覆盖)。
145
157
  *
146
158
  * 提示词**不进**会话域:预设写的是全局基线 `~/.dsh/AGENTS.md`,宿主每轮只读一份。
147
159
  * 但**生效来源**按会话走 —— 本会话可能钉了场景(`scene-preset`),也可能带会话级
@@ -1,4 +1,4 @@
1
- // 删除 / 回收站族的 model 工具(2026-10-15):五个域各一条 `*_manager_remove`。
1
+ // 删除 / 回收站族的 model 工具:五个域各一条 `*_manager_remove`。
2
2
  //
3
3
  // 为什么单开一族:此前模型**只能停用、不能删除** —— "把这条过时的记忆删掉"这类要求手里
4
4
  // 没有出口,模型会去调 `*_switch(enabled:false)` 然后回一句"已停用",用户以为删了。面板上
@@ -6,7 +6,7 @@
6
6
  //
7
7
  // 三条纪律:
8
8
  // · **删除一律进回收站**(可恢复),与面板同一条路 —— 回执如实说"可恢复"。
9
- // · **不做 purge**(永久删除):低频且不可恢复,用户裁定"使用频率低的可以不要,
9
+ // · **不做 purge**(永久删除):低频且不可恢复,用户要求"使用频率低的可以不要,
10
10
  // 太多功能反而冗余" —— 清空回收站留给面板。
11
11
  // · `list` 是只读(不进场景冻结守卫,与 `trash-preview` 只读口径一致);`trash` /
12
12
  // `restore` 是写,过 `lockedSceneGuard()`。
@@ -25,7 +25,7 @@ const ACTION_DESC = 'trash = delete the item named by `id`; restore = put back a
25
25
  /** 删除只有全局一份(会话层没有可删的东西),四个域同一句话。 */
26
26
  const REMOVE_SCOPE_DESC = scopeGlobalOnlyDesc('one machine-wide copy', 'switch it off here instead');
27
27
  /**
28
- * 场景的变体(2026-10-21 审查 P2-1):`REMOVE_SCOPE_DESC` 让模型「在本会话里把它关掉」,
28
+ * 场景的变体:`REMOVE_SCOPE_DESC` 让模型「在本会话里把它关掉」,
29
29
  * 而场景根本没有「关掉」这个动作 —— `scene_manager_switch` 只有 enter / exit。照抄那一句
30
30
  * 会让模型去找一个不存在的开关,或者干脆回一句「做不到」。
31
31
  */
@@ -36,7 +36,7 @@ const REMOVE_SCOPE_DESC_SCENE = scopeGlobalOnlyDesc('the scene record and archiv
36
36
  * · 提示词预设 → `id`(预设的 id 就是它的名字)
37
37
  * 记忆还会把投影对象放在 `rule.id` 上,作为第三顺位兜底。
38
38
  *
39
- * 还要解一层 `data`(2026-10-15 复核 P1-6 时漏掉的那半):技能的 op 表外面包了
39
+ * 还要解一层 `data`(漏掉的那半):技能的 op 表外面包了
40
40
  * `wrap`(`skills/service.ts:239` —— `{ ok: true, data: result }`),名字在 `r.data.name`,
41
41
  * 不在 `r.name` 上。其余四个域的 op 是扁平返回。两边都要看,否则技能域的回执仍会退回 trashId。
42
42
  */
@@ -57,8 +57,8 @@ function restoredName(r) {
57
57
  /**
58
58
  * 一条删除工具的 execute:三个动词的分派与回执。
59
59
  *
60
- * 会话层(0.21.2):删除是**全局**动作 —— 技能正文、人设 `.md`、场景档案、MCP 补丁、
61
- * 提示词预设都只有一份,没有「本会话的副本」。计划 §8.2 对这一格的口径是「全局动作」,
60
+ * 会话层:删除是**全局**动作 —— 技能正文、人设 `.md`、场景档案、MCP 补丁
61
+ * 提示词预设都只有一份,没有「本会话的副本」,所以这一格的口径就是「全局动作」。
62
62
  * 所以这里不写会话层,只在**这个对话真有该域覆盖**时补一句尾注:
63
63
  * 删完之后那条会话覆盖还在(读时忽略,对账才清),不说明的话用户会以为它跟着没了。
64
64
  */
@@ -77,9 +77,9 @@ async function runRemove(deps, cfg, args, agent) {
77
77
  const blocked = await deps.lockedSceneGuard();
78
78
  if (blocked)
79
79
  throw new Error(blocked);
80
- // 会话层(0.21.2):`scope: "session"` 是模型**以为**自己能删本会话那一份时的错误,
81
- // 当场纠回来。省略 / "global" 照旧(0.21.2 的行为不变)。五条删除都是全局动作 ——
82
- // 连提示词那一族也一样(决策 5:提示词根本不进会话域,更没有「本会话的预设」可删)。
80
+ // 会话层:`scope: "session"` 是模型**以为**自己能删本会话那一份时的错误
81
+ // 当场纠回来。省略 / "global" 照旧走全局。五条删除都是全局动作 ——
82
+ // 连提示词那一族也一样(提示词根本不进会话域,更没有「本会话的预设」可删)。
83
83
  requireGlobalScope(args, cfg.noun + 's', !sessionLayerOn(deps));
84
84
  const id = String((args && args.id) || '').trim();
85
85
  if (id === '')
@@ -91,13 +91,14 @@ async function runRemove(deps, cfg, args, agent) {
91
91
  return 'OK: ' + cfg.label + ' "' + id + '" moved to the trash (recoverable; permanent deletion lives in the panel trash)' +
92
92
  (cfg.domain === undefined ? '' : globalActionNote(deps, agent, cfg.domain, cfg.label));
93
93
  }
94
- // 恢复的回执要说**恢复成了什么**,而不是回收站条目 id(2026-10-15 smoke-test P1-6):
94
+ // 恢复的回执要说**恢复成了什么**,而不是回收站条目 id:
95
95
  // `id` 是 `action=list` 给的那一串(记忆 `mv…`、技能 `<时间戳>-<uuid>`),模型看到它
96
96
  // 认不出恢复了哪一条;退号恢复时最终落盘的名字还与回收站里的原名不同,更要说准。
97
97
  const name = restoredName(r) || id;
98
98
  return 'OK: restored ' + cfg.label + ' "' + name + '" from the trash' +
99
99
  (name === id ? '' : ' (trash entry ' + id + ')');
100
100
  }
101
+ /** 注册删除类工具:技能 / 人设 / 场景三种对象各一个动词。 */
101
102
  export function buildRemoveTools(deps) {
102
103
  const { defineTool, register } = deps;
103
104
  const mem = deps.memoryOps;
@@ -118,7 +119,7 @@ export function buildRemoveTools(deps) {
118
119
  };
119
120
  const skillCfg = {
120
121
  noun: 'skill', label: 'skill', domain: 'skills',
121
- // 与 `skill_manager_switch` 同一条(smoke-test P0-1):不给 root 就按名字在全部来源里
122
+ // 与 `skill_manager_switch` 同一条:不给 root 就按名字在全部来源里
122
123
  // 找胜出的那一份。默认值原本是 dsh,而 `skill_manager_save` 落 hub —— 「建完就删」
123
124
  // 必然报「技能不存在」。删一个真的不存在的技能时退回 dsh,交给 op 报它自己的错。
124
125
  trash: async (a) => {