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,68 +1,52 @@
1
1
  /**
2
- * Agent-preset injection reachability — the read-only answer to
3
- * "does what this plugin injects actually reach the model under the preset
4
- * this session runs?".
2
+ * 预设注入可达性:只读地回答「本插件注入的内容,在当前预设下是否真的到得了模型」。
5
3
  *
6
- * WHY THIS EXISTS
7
- * ---------------
8
- * The plugin TELLS the model four things (scene memories, the subagent roster,
9
- * the MCP server list with the user's notes, and the scene prompt) by injecting
10
- * a synthetic message at `agent/pre-step` (see `src/context-inject.ts`). A preset
11
- * can still decide it wants none of that: `@deepseek-ai/dsh-persona` with
12
- * `complete: true` declares its prompt the only one, and `includeRuntimeContext:
13
- * false` switches the official runtime-context snapshot off — the shipped
14
- * `minimal` preset sets both. The plugin then injects nothing by default (the
15
- * user can force it on the compat page), and no surface may claim otherwise.
4
+ * 为什么需要它
5
+ * ------------
6
+ * 插件在 `agent/pre-step` 注入一条合成消息,告诉模型四件事:场景记忆、子智能体目录、带用户
7
+ * 备注的 MCP 服务器清单、场景提示词(见 `src/context-inject.ts`)。预设仍可以拒绝这一切:
8
+ * `@deepseek-ai/dsh-persona` 的 `complete: true` 声明自己的提示词是唯一一份,
9
+ * `includeRuntimeContext: false` 关掉官方运行时快照 —— 出厂 `minimal` 预设两者都开。此时插件
10
+ * 默认不注入(用户可在兼容页强制打开),任何界面都不能声称注入到了。
16
11
  *
17
- * A second, different question is whether the OFFICIAL carriers are mounted at
18
- * all: `@deepseek-ai/dsh-agent-instructions` (AGENTS.md) and
19
- * `@deepseek-ai/dsh-tool-skill` (the skill catalog) are host rows that the Web
20
- * bundle disables in favour of per-preset rows — a preset that mounts neither
21
- * gives the model no AGENTS.md text and no skill catalog, whichever persona it
22
- * declares.
12
+ * 另一个不同的问题是官方载体在不在:`@deepseek-ai/dsh-agent-instructions`(AGENTS.md)与
13
+ * `@deepseek-ai/dsh-tool-skill`(技能目录)是 Web bundle 为按预设行让位而关掉的宿主行 ——
14
+ * 两者都不挂的预设,无论声明什么 persona,模型都拿不到 AGENTS.md 正文与技能目录。
23
15
  *
24
- * WHAT IS MEASURED, AND HOW
25
- * -------------------------
26
- * Answers come from each preset's own composition text, read through the
27
- * roster's public `read(id)` — evidence, not inference, and no mount:
16
+ * 量什么、怎么量
17
+ * --------------
18
+ * 答案来自每个预设自己的组合文本,经 roster 的公开 `read(id)` 读取 —— 是证据,不是推断,且
19
+ * 不触发挂载:
28
20
  *
29
- * - `personaComplete` / `includeRuntimeContext`: does the preset declare
30
- * "nothing but my prompt"? (both suppress plugin-injected text)
31
- * - `agentInstructions`: is `@deepseek-ai/dsh-agent-instructions` mounted?
32
- * (the row that carries `~/.dsh/AGENTS.md` into the conversation)
33
- * - `toolSkill`: is `@deepseek-ai/dsh-tool-skill` mounted?
34
- * (the row that gives the model the skill catalog)
35
- * - `mcpClient`: does the composition mount its own MCP client?
36
- * (the shipped presets mount none, so MCP *tools* come from the host plane
37
- * and are callable under every preset — see `ReachContext.mcpTools`)
21
+ * - `personaComplete` / `includeRuntimeContext`:预设是否声明「只要我自己的提示词」?
22
+ * (两者都会压掉插件注入的文本)
23
+ * - `agentInstructions`:`@deepseek-ai/dsh-agent-instructions` 挂了吗?
24
+ * (把 `~/.dsh/AGENTS.md` 送进对话的那一行)
25
+ * - `toolSkill`:`@deepseek-ai/dsh-tool-skill` 挂了吗?(把技能目录给模型的那一行)
26
+ * - `mcpClient`:组合是否挂了自己的 MCP 客户端?(出厂预设都不挂,所以 MCP 工具来自宿主
27
+ * 平面,在任何预设下都可调用 —— 见 `ReachContext.mcpTools`)
38
28
  *
39
- * TOOLS ARE NOT TEXT — the distinction is the whole point:
29
+ * 工具不是文本 —— 这个区分就是全部要点:
40
30
  *
41
- * - TOOL plane (host, preset-independent): the plugin's own model tools and
42
- * every `mcp__*` tool register in the HOST plane (this plugin's loader row in
43
- * the profile patch), so every preset's session resolves them.
44
- * - TEXT plane (preset-dependent): the runtime snapshot the plugin injects, the
45
- * AGENTS.md carrier, and the skill catalog. Callable is not the same as
46
- * known: under `minimal` the model can call every `mcp__*` tool while knowing
47
- * nothing about the servers behind them — no names, no tool counts, no
48
- * enablement, and none of the user's notes.
31
+ * - 工具平面(宿主,与预设无关):插件自己的模型工具与所有 `mcp__*` 工具注册在宿主平面
32
+ * (本插件在 profile patch 里的 loader 行),所以每个预设的会话都能解析到它们。
33
+ * - 文本平面(随预设变化):插件注入的运行时快照、AGENTS.md 载体、技能目录。「可调用」不等于
34
+ * 「知道」:`minimal` 下模型能调用每个 `mcp__*` 工具,却对背后的服务器一无所知 —— 没有名字、
35
+ * 没有工具数、没有启用状态,也没有用户的备注。
49
36
  *
50
- * Reading never mounts. `list()`/`read(id)`/`readDocument(id)` are roster reads, so building the
51
- * matrix cannot activate a preset early — the same guarantee
52
- * `compositionInventory()` gives the plugin-listing surfaces.
37
+ * 读取不触发挂载:`list()` / `read(id)` / `readDocument(id)` 都是 roster 读,构建矩阵不会提前
38
+ * 激活预设 —— 与 `compositionInventory()` 给插件列表界面的保证相同。
53
39
  *
54
- * This module is deliberately advisory: it never changes what is injected and
55
- * never refuses an operation. A preset that asks for no extra text is doing
56
- * exactly what its author asked for; the plugin's job is to say so out loud and
57
- * point at the switch that overrides it.
40
+ * 本模块刻意只做告知:从不改变注入内容,也从不拒绝操作。预设要求不加额外文本,正是其作者
41
+ * 想要的结果;插件的职责是把这件事说出来,并指向能覆盖它的开关。
58
42
  */
59
43
  import { MCP_CLIENT_MODULE } from '../host-names.js';
60
44
  import { noteRuntime } from './runtime-notes.js';
61
- /** Whether a preset declares "no extra text": persona `complete: true` or runtime context off. */
45
+ /** 预设是否声明「不要额外文本」:persona `complete: true` 或运行时上下文关闭。 */
62
46
  export function isSuppressingPreset(facts) {
63
47
  return facts.personaComplete === true || facts.includeRuntimeContext === false;
64
48
  }
65
- /** Map composition facts onto the injection decision's facts (parse failure → not suppressing). */
49
+ /** 把组合事实映射成注入决策要的形状(解析失败 = 不算压制)。 */
66
50
  export function injectionFactsOf(facts) {
67
51
  if (facts === undefined)
68
52
  return undefined;
@@ -72,7 +56,7 @@ export function injectionFactsOf(facts) {
72
56
  carriesSkillCatalog: facts.toolSkill === 'mounted',
73
57
  };
74
58
  }
75
- /** Module specifiers whose mounting decides reachability. */
59
+ /** 这几个模块挂没挂,直接决定可达性。 */
76
60
  const PERSONA_MODULE = '@deepseek-ai/dsh-persona';
77
61
  const AGENT_INSTRUCTIONS_MODULE = '@deepseek-ai/dsh-agent-instructions';
78
62
  const TOOL_SKILL_MODULE = '@deepseek-ai/dsh-tool-skill';
@@ -81,17 +65,16 @@ const ENTRY_LINE = /^(\s*)-\s/;
81
65
  const DISABLED_LINE = /^\s*disabled:\s*(.+?)\s*(?:#.*)?$/;
82
66
  const COMPLETE_LINE = /^\s*complete:\s*(true|false)\s*(?:#.*)?$/;
83
67
  const RUNTIME_CONTEXT_LINE = /^\s*includeRuntimeContext:\s*(true|false)\s*(?:#.*)?$/;
84
- /** Leading whitespace width of a line, used as its nesting level. */
68
+ /** 行首空白宽度,当嵌套层级用。 */
85
69
  function indentOf(line) {
86
70
  const match = /^(\s*)/.exec(line);
87
71
  return match === null ? 0 : match[1].length;
88
72
  }
89
73
  /**
90
- * The lines belonging to the composition row that owns `nameIndex`.
74
+ * 拥有 `nameIndex` 的那一行所辖的文本行。
91
75
  *
92
- * The row starts at the nearest entry bullet above the `name:` line that is
93
- * less indented than it (a nested row inside a `cordis:group` still gets its
94
- * own block) and ends at the next bullet at or above that bullet's indent.
76
+ * 行从 `name:` 上方最近、缩进更浅的条目 bullet 开始(`cordis:group` 里的嵌套行仍拿到自己的
77
+ * 块),到下一个缩进不深于该 bullet 的条目为止。
95
78
  */
96
79
  function rowBlockAround(lines, nameIndex) {
97
80
  const nameIndent = indentOf(lines[nameIndex]);
@@ -115,11 +98,10 @@ function rowBlockAround(lines, nameIndex) {
115
98
  return lines.slice(start, end);
116
99
  }
117
100
  /**
118
- * How the row owning `nameIndex` decides enablement.
101
+ * 拥有 `nameIndex` 的那一行如何决定启用状态。
119
102
  *
120
- * `!!js` expressions are only answerable inside a mount, so they stay
121
- * `'conditional'` rather than being guessed — the same rule
122
- * `compositionInventory()` applies to its disabled gates.
103
+ * `!!js` 表达式只有挂载后才有答案,所以保持 `'conditional'` 而不猜 —— 与
104
+ * `compositionInventory()` 对其 disabled 门采用同一规则。
123
105
  */
124
106
  function presenceForRow(lines, nameIndex) {
125
107
  for (const line of rowBlockAround(lines, nameIndex)) {
@@ -135,7 +117,7 @@ function presenceForRow(lines, nameIndex) {
135
117
  }
136
118
  return 'mounted';
137
119
  }
138
- /** Whether ANY row naming `specifier` survives into the composition. */
120
+ /** 点名 `specifier` 的任意一行是否留在了组合里。 */
139
121
  function presenceOf(lines, specifier) {
140
122
  let best = 'absent';
141
123
  for (let i = 0; i < lines.length; i += 1) {
@@ -151,15 +133,12 @@ function presenceOf(lines, specifier) {
151
133
  return best;
152
134
  }
153
135
  /**
154
- * Parse the facts that decide reachability out of one composition's text.
136
+ * 从一份组合文本里解析决定可达性的事实。
155
137
  *
156
- * Deliberately a text scan rather than a YAML load: this module must not add
157
- * a parser dependency, and every question it asks is answered by a row's own
158
- * key/value lines. A `complete: true` nested inside a multi-line scalar cannot
159
- * produce a false positive because the match is anchored to a whole line.
138
+ * 刻意用文本扫描而不是 YAML 加载:本模块不能新增解析器依赖,而它问的每个问题都能由行内的
139
+ * key/value 回答。匹配锚定整行,所以多行标量里嵌套的 `complete: true` 不会造成误报。
160
140
  *
161
- * Never throws: unparsable input degrades to `unknown`, which the caller
162
- * renders as "could not tell" instead of "fine".
141
+ * 从不抛错:解析不了就降级为 `unknown`,调用方据此渲染成「判断不了」而不是「没问题」。
163
142
  */
164
143
  export function readCompositionFacts(text) {
165
144
  try {
@@ -176,15 +155,15 @@ export function readCompositionFacts(text) {
176
155
  };
177
156
  }
178
157
  let personaComplete = false;
179
- // Schema default is `true`: a mounted persona row that does not state the flag keeps
180
- // the official runtime context (only `false` suppresses it).
158
+ // schema 默认 `true`:挂载的 persona 行没写这个标志时保留官方运行时上下文
159
+ // (只有 `false` 才压制)。
181
160
  let includeRuntimeContext = true;
182
161
  let personaMounted = false;
183
162
  for (let i = 0; i < lines.length; i += 1) {
184
163
  const named = NAME_LINE.exec(lines[i]);
185
164
  if (named === null || named[3] !== PERSONA_MODULE)
186
165
  continue;
187
- // A disabled persona row does not shadow the deployment persona.
166
+ // 停用的人设行不会遮蔽部署的人设。
188
167
  if (presenceForRow(lines, i) === 'absent')
189
168
  continue;
190
169
  personaMounted = true;
@@ -219,7 +198,7 @@ export function readCompositionFacts(text) {
219
198
  };
220
199
  }
221
200
  }
222
- /** Map parsed facts onto the five user-visible capability columns. */
201
+ /** 把解析出的事实映射成用户可见的那五列能力。 */
223
202
  export function deriveReach(facts, ctx) {
224
203
  const suppressed = isSuppressingPreset(facts);
225
204
  const personaUnknown = facts.personaComplete === 'unknown';
@@ -248,7 +227,7 @@ export function deriveReach(facts, ctx) {
248
227
  */
249
228
  const officialOrFallback = (domainKey, carrier) => {
250
229
  // 官方那条行挂着 = **官方自己送到**,与本插件的域开关无关(开关只管本插件的兜底):
251
- // 用户实测(2026-09-16)—— 把注入域全关掉后,标准 / ptc / 创造三行的技能与提示词
230
+ // 用户实测—— 把注入域全关掉后,标准 / ptc / 创造三行的技能与提示词
252
231
  // 依然应该是绿的(模型确实拿得到,官方 `dsh-tool-skill` / `dsh-agent-instructions` 送),
253
232
  // 只有极简那行是红的(两条行都没挂 + 兜底也关着)。
254
233
  if (carrier === 'mounted')
@@ -269,7 +248,7 @@ export function deriveReach(facts, ctx) {
269
248
  };
270
249
  const agentsMd = officialOrFallback('prompt', facts.agentInstructions);
271
250
  const skillCatalog = officialOrFallback('skills', facts.toolSkill);
272
- // 子智能体列(用户裁定 2026-09-16 第二版):与记忆 / MCP 两列**同口径** —— 答"人设目录
251
+ // 子智能体列:与记忆 / MCP 两列**同口径** —— 答"人设目录
273
252
  // 到不到得了模型"。内容由本插件的注入域送达,跑起来用本插件自己的 `subagent_manager_run`
274
253
  // (宿主平面工具,任何预设下都在),所以可达性只看域开关与压制。此前这一列只答"官方
275
254
  // `dsh-tool-subagent` 挂没挂"——于是极简下就算开了「极简模式也注入」也永远红着,而那条官方
@@ -284,10 +263,9 @@ export function deriveReach(facts, ctx) {
284
263
  * `read(id)`(0.1.5 直返文本)或 `readDocument(id).content`(0.1.7 文档对象)。
285
264
  * 两者都不可用时抛错,由调用方决定降级口径 —— reason 文案由此保持单一来源。
286
265
  *
287
- * 兜底路径的可见性(0.15.0):兜底成功**不留运行时上报** —— 上报一律渲染成问题行,
288
- * 而「read 改名 readDocument 后走兜底」是 0.1.7 的正常形态,不是降级(琥珀只留给故障,
289
- * 2026-09-28 用户反馈)。走的哪条路由探测表 `preset.roster-surface` 的健康行说明承担;
290
- * 这里只在**真异常**(readDocument 在场但文档缺 `.content`)时留痕。同 id 覆盖,不堆积。
266
+ * 兜底路径的可见性:兜底成功不留运行时上报 —— 上报一律渲染成问题行,而「read 改名
267
+ * readDocument 后走兜底」是 0.1.7 的正常形态,不是降级(琥珀只留给故障)。这里只在真异常
268
+ * (readDocument 在场但文档缺 `.content`)时留痕。同 id 覆盖,不堆积。
291
269
  */
292
270
  export async function readCompositionText(roster, presetId) {
293
271
  if (typeof roster.read === 'function') {
@@ -309,7 +287,7 @@ export async function readCompositionText(roster, presetId) {
309
287
  }
310
288
  throw new Error('预设名单未提供 read()/readDocument():无法读取组合文件');
311
289
  }
312
- /** Narrow the roster off a cordis context without throwing. */
290
+ /** 从 cordis 上下文里取出预设名单;取不到就返回 undefined,不抛错。 */
313
291
  export function presetRosterOf(ctx) {
314
292
  try {
315
293
  const value = typeof ctx.get === 'function' ? ctx.get('agentPresets') : undefined;
@@ -384,10 +362,9 @@ async function composeRow(roster, meta, ctx) {
384
362
  };
385
363
  }
386
364
  /**
387
- * Build the whole preset × capability matrix.
365
+ * 算出整张「预设 × 能力」矩阵。
388
366
  *
389
- * Read-only end to end; a preset whose text cannot be read yields a named
390
- * `reason` on its own row rather than failing the report.
367
+ * 全程只读:某个预设的文本读不出来,只在它自己那行给出 `reason`,不让整份报告失败。
391
368
  */
392
369
  export async function assessPresetReach(roster, ctx) {
393
370
  const generatedAt = Date.now();
@@ -441,37 +418,34 @@ export async function assessPresetReach(roster, ctx) {
441
418
  };
442
419
  }
443
420
  /**
444
- * The one-line boundary notice a model tool appends to its result.
421
+ * 模型工具在结果后面追加的一行边界提示。
445
422
  *
446
- * This is the load-bearing half of the fix: a model that lists memories while
447
- * running under a suppressing preset would otherwise assume those memories are
448
- * already in its context. The same reasoning covers MCP and the subagent roster:
449
- * none of them reach the model while the preset keeps the plugin's runtime
450
- * snapshot out of the conversation, so the notice says which tool to call
451
- * instead — and where the user can flip that off.
423
+ * 这一句是整套修正里承重的那一半:模型在压制型预设下列出记忆,会默认这些记忆已经在
424
+ * 上下文里。MCP 与子智能体目录同理 —— 预设把插件的运行时快照挡在对话之外时,这三者都
425
+ * 到不了模型,所以提示要说清「改调哪个工具」,以及用户在哪里能把这个开关打开。
452
426
  *
453
- * Pure and synchronous so a contract test can pin the wording to the facts.
427
+ * 纯函数、同步,便于契约测试把措辞钉在事实上。
454
428
  *
455
- * 写法纪律(2026-09-16 第三版):
429
+ * 写法纪律:
456
430
  * - **不点名任何工具**。这条提示挂在 5 个发现型工具上,点名就必然出现循环
457
431
  * (`mcp_manager_list` 的结果里写着「用 mcp_manager_list 查询」——
458
432
  * 用户实测发现)。按域名过滤只是把循环换成残缺列表;干脆不枚举:**域 → 工具**的
459
433
  * 映射属于工具描述(常驻层),提示只负责说清「什么不在你上下文里」。
460
434
  * - 全域一句话说完,不逐域展开;不复述工具 schema 的细节。
461
- * - 第二版把"被 persona complete 压制"当成不可改变的事实;现在本插件改走 pre-step
462
- * 注入消息(src/context-inject.ts),压制型预设下**默认不注入但可以打开**,
463
- * 提示里如实给出这个开关的位置。
435
+ * - 不把「被 persona complete 压制」当成不可改变的事实:本插件走 pre-step 注入消息
436
+ * (src/context-inject.ts),压制型预设下**默认不注入但可以打开**,提示里如实给出
437
+ * 这个开关的位置。
464
438
  *
465
- * @returns the notice, or `''` when nothing is out of context.
439
+ * @returns 提示文本;没有内容落在上下文外时返回空串
466
440
  */
467
441
  export function reachNoticeFor(presetId, facts, inject) {
468
442
  const parts = [];
469
443
  const domainOff = (key) => inject?.domains?.[key] === false;
470
444
  if (isSuppressingPreset(facts) && inject?.underSuppressingPresets !== true) {
471
- // 末尾那句「(想让它在这类预设下也注入:插件的「兼容」页 → 注入。)」已删(2026-10-15 用户裁定):
472
- // 它是**给人看的操作路径**(界面怎么点),而这段文字进的是**工具回执** —— 回执留在 transcript 里,
473
- // 比工具 schema 还贵(每次调用都会带一份)。判据与上一轮 P1-5 从场景锁定守卫里清掉
474
- // 「去界面解锁」逐字同一条:守卫/提示只**陈述事实**,"怎么改"由模型自己向用户解释。
445
+ // 不写「(想让它在这类预设下也注入:插件的「兼容」页 → 注入。)」:那是给人看的操作路径
446
+ // (界面怎么点),而这段文字进的是工具回执 —— 回执留在 transcript 里,比工具 schema 还贵
447
+ // (每次调用都会带一份)。判据与场景锁定守卫一致:守卫 / 提示只陈述事实,「怎么改」由模型
448
+ // 自己向用户解释。
475
449
  parts.push(`预设「${presetId}」声明只要它自己的文本(persona complete / 关闭运行时上下文):` +
476
450
  '本插件注入的 —— 场景、记忆、MCP、技能、子智能体、提示词 —— 默认不注入,' +
477
451
  '需要时用对应的 list / read 工具按需读取;不要假设你已经看到它们。');
@@ -489,10 +463,9 @@ export function reachNoticeFor(presetId, facts, inject) {
489
463
  return '\n\n⚠ 当前预设的注入边界:' + parts.join(' ');
490
464
  }
491
465
  /**
492
- * Resolve the notice for the agent a tool call runs as.
466
+ * 为一次工具调用所属的 agent 求边界提示。
493
467
  *
494
- * Every failure path answers `''` — a boundary notice must never turn a
495
- * successful read into an error.
468
+ * 所有失败路径都返回空串 —— 边界提示绝不能把一次成功读取变成错误。
496
469
  */
497
470
  export async function reachNoticeForAgent(roster, agentCtx, inject) {
498
471
  if (roster === undefined || typeof roster.composedPreset !== 'function' || agentCtx === undefined || agentCtx === null)