dsh-plugin-tool-management 0.21.3 → 0.21.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/lib/index.js CHANGED
@@ -1252,9 +1252,9 @@ export default {
1252
1252
  }
1253
1253
  }
1254
1254
  /**
1255
- * 场景应用写全局意图:`blocked`(彻底停止)是比场景更强的用户要求,场景不得覆盖它
1255
+ * 场景应用写全局意图:`blocked`(统一关闭)是比场景更强的用户要求,场景不得覆盖它
1256
1256
  * —— 只有全局意图开关(`scope-intent-set`)能解除。不挡的话,进一次包含这台服务器 /
1257
- * 这条技能的场景,就会把「彻底停止」悄悄降级成 off,之后任何会话的租约都能把它拉起来。
1257
+ * 这条技能的场景,就会把「统一关闭」悄悄降级成 off,之后任何会话的租约都能把它拉起来。
1258
1258
  */
1259
1259
  function withSceneIntent(current, domain, key, state) {
1260
1260
  if (intentOf(current, domain, key) === 'blocked')
@@ -1341,7 +1341,7 @@ export default {
1341
1341
  // 场景模式进出一次就会改写 state.json。意图那一格同口径。
1342
1342
  const { states, shadowed, unloadable, entryNames } = await skillScan();
1343
1343
  const intentSnap = intentStore.snapshot();
1344
- /** 全局「彻底停止」的技能:场景不得覆盖(见 `withSceneIntent`),物理启停也一并跳过。 */
1344
+ /** 全局「统一关闭」的技能:场景不得覆盖(见 `withSceneIntent`),物理启停也一并跳过。 */
1345
1345
  const blocked = new Set();
1346
1346
  const planned = [];
1347
1347
  const skipped = [];
@@ -1361,13 +1361,13 @@ export default {
1361
1361
  skipped.push(`${key}(已不存在)`);
1362
1362
  continue;
1363
1363
  }
1364
- // 全局彻底停止压过场景(与 `scope-set` 拒写「开」同一条):既不改意图也不动策略表。
1365
- // 技能还要看所在来源:来源被彻底停止时,技能级开关开着也加载不到(来源闸恒生效)。
1364
+ // 全局统一关闭压过场景(与 `scope-set` 拒写「开」同一条):既不改意图也不动策略表。
1365
+ // 技能还要看所在来源:来源被统一关闭时,技能级开关开着也加载不到(来源闸恒生效)。
1366
1366
  if (intentOf(intentSnap, 'skills', key) === 'blocked' ||
1367
1367
  intentOf(intentSnap, 'skillSources', key.slice(0, i)) === 'blocked') {
1368
1368
  blocked.add(key);
1369
1369
  if (on)
1370
- skipped.push(`${key}(已在全局「彻底停止」)`);
1370
+ skipped.push(`${key}(已在全局「统一关闭」)`);
1371
1371
  continue;
1372
1372
  }
1373
1373
  const wanted = on ? 'on' : 'off';
@@ -1456,7 +1456,7 @@ export default {
1456
1456
  const prev = wanted.get(name);
1457
1457
  wanted.set(name, prev === undefined ? s.enabled : prev || s.enabled);
1458
1458
  }
1459
- // 全局「彻底停止」压过场景:不改意图、不动补丁(见 `withSceneIntent`)。
1459
+ // 全局「统一关闭」压过场景:不改意图、不动补丁(见 `withSceneIntent`)。
1460
1460
  const blocked = new Set();
1461
1461
  for (const [name, enabled] of [...wanted]) {
1462
1462
  if (intentOf(intentSnap, 'mcp', name) !== 'blocked')
@@ -1464,7 +1464,7 @@ export default {
1464
1464
  wanted.delete(name);
1465
1465
  blocked.add(name);
1466
1466
  if (enabled)
1467
- ctx.logger?.warn?.(`场景要启用 MCP 服务器「${name}」,但它已在全局「彻底停止」:已跳过`);
1467
+ ctx.logger?.warn?.(`场景要启用 MCP 服务器「${name}」,但它已在全局「统一关闭」:已跳过`);
1468
1468
  }
1469
1469
  if (wanted.size > 0) {
1470
1470
  await intentStore.mutate((current) => {
@@ -1547,14 +1547,14 @@ export default {
1547
1547
  // 与 MCP 同一条:场景引擎改的是全局定义 → 先写意图,再改来源状态(见
1548
1548
  // applyMcpServerSwitches 的注释;运行态 = 意图 ∪ 租约)。
1549
1549
  const intentSnap = intentStore.snapshot();
1550
- // 全局「彻底停止」压过场景:不改意图、不动来源状态(见 `withSceneIntent`)。
1550
+ // 全局「统一关闭」压过场景:不改意图、不动来源状态(见 `withSceneIntent`)。
1551
1551
  const blocked = new Set();
1552
1552
  for (const s of switches) {
1553
1553
  if (intentOf(intentSnap, 'skillSources', s.root) !== 'blocked')
1554
1554
  continue;
1555
1555
  blocked.add(s.root);
1556
1556
  if (s.enabled)
1557
- ctx.logger?.warn?.(`场景要启用技能来源「${s.root}」,但它已在全局「彻底停止」:已跳过`);
1557
+ ctx.logger?.warn?.(`场景要启用技能来源「${s.root}」,但它已在全局「统一关闭」:已跳过`);
1558
1558
  }
1559
1559
  if (switches.length > 0) {
1560
1560
  await intentStore.mutate((current) => {
@@ -2994,7 +2994,7 @@ export default {
2994
2994
  //
2995
2995
  // 只问**全局关着**的那些格:开着的那些本来就该显示成开着,数它没有意义,而记忆这类域
2996
2996
  // 可能有几百条键 —— 每次读面板都全扫一遍是不必要的成本。
2997
- // 键集合的口径:**意图域**只数「意图不是 on」的键(全局开着不是租约,彻底停止没有
2997
+ // 键集合的口径:**意图域**只数「意图不是 on」的键(全局开着不是租约,统一关闭没有
2998
2998
  // 租约这回事);**纯视图域**只数「全局关着」的键。两句话都只回答"这一格该不该挂徽章"。
2999
2999
  const leaseKeys = {};
3000
3000
  for (const domain of SCOPE_FLAG_DOMAINS) {
@@ -3016,12 +3016,34 @@ export default {
3016
3016
  out[key] = list.length;
3017
3017
  return out;
3018
3018
  };
3019
+ // 场景页的「全部关闭」:只数**会话层进入过场景**的未归档会话 / 工作区。全局正在用的
3020
+ // 那个场景是全局设置,不算临时运行;没有场景覆盖时连会话清单都不读。
3021
+ let sceneLeases = 0;
3022
+ const sceneLeaseCounts = Object.create(null);
3023
+ try {
3024
+ const overrides = await scopeStore.read();
3025
+ const sceneIds = Object.entries(overrides.sessions)
3026
+ .filter(([, scope]) => typeof scope.scene === 'string' && scope.scene !== '')
3027
+ .map(([id]) => id);
3028
+ if (sceneIds.length > 0) {
3029
+ const rows = await scopeSessionRows();
3030
+ const archived = new Set(rows.filter((row) => row.archived === true).map((row) => row.id));
3031
+ for (const id of sceneIds) {
3032
+ if (archived.has(id))
3033
+ continue;
3034
+ const name = String(overrides.sessions[id].scene);
3035
+ sceneLeaseCounts[name] = (sceneLeaseCounts[name] || 0) + 1;
3036
+ sceneLeases += 1;
3037
+ }
3038
+ }
3039
+ }
3040
+ catch { /* 读不到 = 没有临时场景 */ }
3019
3041
  return {
3020
3042
  scene,
3021
3043
  flags,
3022
3044
  unavailable,
3023
3045
  // 三态意图与租约计数(界面用):`flags` 把 blocked 投影成 false,分不出「关着」与
3024
- // 「彻底停止」;租约计数则是全局 off 却仍在跑的唯一解释。
3046
+ // 「统一关闭」;租约计数则是全局 off 却仍在跑的唯一解释。
3025
3047
  intent: { mcp: intentSnapshot.mcp, skillSources: intentSnapshot.skillSources, skills: intentSnapshot.skills },
3026
3048
  leases: {
3027
3049
  mcp: leaseCounts('mcp'),
@@ -3032,6 +3054,8 @@ export default {
3032
3054
  subagents: leaseCounts('subagents'),
3033
3055
  quickPrompts: leaseCounts('quickPrompts'),
3034
3056
  },
3057
+ sceneLeases,
3058
+ sceneLeaseCounts,
3035
3059
  };
3036
3060
  }
3037
3061
  /**
@@ -3425,7 +3449,7 @@ export default {
3425
3449
  const rows = rowsIn.map((row) => {
3426
3450
  const name = String((row && (row.serverName || row.id)) || '');
3427
3451
  const state = intentOf(intent, 'mcp', name);
3428
- // 全局开着(`on`)不是租约;彻底停止(`blocked`)压过一切会话层 —— 两种都不挂徽章。
3452
+ // 全局开着(`on`)不是租约;统一关闭(`blocked`)压过一切会话层 —— 两种都不挂徽章。
3429
3453
  const leaseCount = state === 'on' || state === 'blocked' || scan === null ? 0 : (scan.claims.mcp.get(name) || []).length;
3430
3454
  return {
3431
3455
  ...row,
@@ -81,7 +81,7 @@ export function createArchiveEngine(deps) {
81
81
  * 还原到快照(退出模式与失败回滚共用同一条路径):
82
82
  * MCP 停用表**按快照原文整体回写**——模式自己写进去的键(未勾服务器的 ['*'])必须随之消失,
83
83
  * 否则退出后用户环境仍被静默停用(比"多留一个键"严重得多);模式期间的手动改动不保留
84
- * (「退出 = 恢复 mode.snapshot」,手动改动只在「保存到场景」时回写)。
84
+ * (「退出 = 恢复 mode.snapshot」,手动改动只在「保存」时回写)。
85
85
  * 技能只写快照列出的键(这是既有批量通道的语义):模式期间新增的技能保持现状。
86
86
  * 上层两行(服务器级 / 来源级)按**全量**快照还原 —— 只回写与现状不同的行,见
87
87
  * mcpServerRowsToRestore / skillSourceRowsToRestore。
@@ -274,10 +274,14 @@ export const OP_REGISTRY = Object.freeze({
274
274
  'scope-clear': { write: true },
275
275
  // 锁开关自己不能被自己挡住,否则锁上了解不开(与 `rules-scene-lock` 同一条)。
276
276
  'scope-lock': { write: true },
277
- // 全局意图(`hub/scope-intent.json`):MCP 服务器 / 技能来源两格的**全局开关**。
277
+ // 全局意图(`hub/scope-intent.json`):MCP 服务器 / 技能 / 技能来源三格的**全局开关**。
278
278
  // 与 `mcpm-set-enabled` / `skill-source-enable` 同档:写全局定义、场景锁要冻结它。
279
279
  // 会话层的 scope-set 仍不冻结(它只写租约,不改全局)。
280
280
  'scope-intent-set': { write: true, frozen: true, syncsArchive: true },
281
+ // 「统一关闭」/「全部停止」:一次性动作(关会话 / 工作区的开关 + 写 off),不是持久意图。
282
+ // 写全局意图之外还改会话侧车,所以照全局写入口同一档冻结;不同步场景档案 ——
283
+ // 它是一次性的,不该把场景里的勾选永久改掉。
284
+ 'scope-stop-now': { write: true, frozen: true },
281
285
  // 清理 patch 备份:删磁盘文件(备份里含明文凭据副本),按写操作门禁。
282
286
  'backups-clean': { write: true },
283
287
  // ── 场景候选源(4)与内联(1)──────────────────────────────────────────────
package/lib/ops/scope.js CHANGED
@@ -31,7 +31,7 @@
31
31
  // 收进一条 op 就是第五份实现。面板改全局时照旧调各域自己的 op;模型工具要改全局也走
32
32
  // 各域自己的工具(`skill_manager_switch` 等),由那边按 `scope: "global"` 分派。
33
33
  import { PROMPT_CONTENT_MAX_BYTES, SCOPE_FLAG_DOMAINS, applyFlag, effectiveDiff, enterSceneInScope, exitSceneInScope, isFlagDomain, isEmptyScope, isKeepableScope, layerParentSnapshot, layeredFlag, normalizeSessionScope, overrideCountOf, promptOverrideOf, pruneScope, scopeForLayerSeed, withBaseline, } from '../scope/scope-overrides.js';
34
- import { isIntentDomain, normalizeIntentState } from '../scope/intent.js';
34
+ import { effectiveLayerOf, isIntentDomain, normalizeIntentState } from '../scope/intent.js';
35
35
  import { normalizePresetId } from '../prompts/preset-id.js';
36
36
  import { isWorkspaceScopeKey, scopeKeyLabel, scopeKeyOfRow, workspaceScopeKeyOf } from '../scope/workspace-key.js';
37
37
  import { workspaceBaseName } from '../sessions/path-key.js';
@@ -123,8 +123,8 @@ export function buildScopeOps(deps) {
123
123
  /**
124
124
  * 这一格落到哪些**意图**域/键上(逐工具 → 服务器;单条技能 → 自己 + 所在来源)。
125
125
  *
126
- * 用途只有两个:判断全局是不是「彻底停止」,以及回执里点名"仅为这个对话临时运行"的那一格。
127
- * 技能要**两个**都查:来源被彻底停止时,技能级策略表开着也加载不到 —— 只查自己会给出
126
+ * 用途只有两个:判断全局是不是「统一关闭」,以及回执里点名"仅为这个对话临时运行"的那一格。
127
+ * 技能要**两个**都查:来源被统一关闭时,技能级策略表开着也加载不到 —— 只查自己会给出
128
128
  * 一条"能开"的假承诺。
129
129
  */
130
130
  function intentTargetsOf(domain, key) {
@@ -420,10 +420,10 @@ export function buildScopeOps(deps) {
420
420
  entries.push({ domain: 'skillSources', key: root });
421
421
  }
422
422
  warnings = warnings.concat(reconcileWarnings(report, entries));
423
- // 全局「彻底停止」压过场景:勾中它也不会运行。不说的话用户会以为场景坏了。
423
+ // 全局「统一关闭」压过场景:勾中它也不会运行。不说的话用户会以为场景坏了。
424
424
  for (const entry of entries) {
425
425
  if (global.intent?.[entry.domain]?.[entry.key] === 'blocked') {
426
- warnings.unshift(`${intentLabel(entry.domain)}「${entry.key}」已在全局「彻底停止」:这个场景里它不会运行`);
426
+ warnings.unshift(`${intentLabel(entry.domain)}「${entry.key}」已在全局「统一关闭」:这个场景里它不会运行`);
427
427
  }
428
428
  }
429
429
  }
@@ -447,13 +447,13 @@ export function buildScopeOps(deps) {
447
447
  if (typeof (args && args.value) !== 'boolean')
448
448
  return { ok: false, error: 'value 必须是布尔值(只按传入值写入,不做"翻转"推断)' };
449
449
  const value = args.value === true;
450
- // 全局「彻底停止」压过一切会话层(显式拒绝的语义):写一条"开"只会看起来生效、
450
+ // 全局「统一关闭」压过一切会话层(显式拒绝的语义):写一条"开"只会看起来生效、
451
451
  // 实际调不到 —— 当场拒掉并给出出口(先把全局改成关闭或启用)。
452
452
  // 技能要连**所在来源**一起查:来源停了,技能级策略开着也加载不到。
453
453
  const blockedTarget = intentTargetsOf(domain, key)
454
454
  .find((target) => global.intent?.[target.domain]?.[target.key] === 'blocked');
455
455
  if (value && blockedTarget !== undefined) {
456
- return { ok: false, error: `「${blockedTarget.key}」已在全局「彻底停止」:先把全局改回关闭或启用,它才可能再运行` };
456
+ return { ok: false, error: `「${blockedTarget.key}」已在全局「统一关闭」:先把全局改回关闭或启用,它才可能再运行` };
457
457
  }
458
458
  // 下层值的**预检**(锁外、读缓存):只为快速拒绝,不是权威判定 —— 权威那一份在
459
459
  // `store.mutate` 的锁内按**重读出来的** `cur` 再算一次(见下面 `effectiveParent`)。
@@ -1028,13 +1028,14 @@ export function buildScopeOps(deps) {
1028
1028
  return { ok: false, error: '切换失败: ' + deps.message(e) };
1029
1029
  }
1030
1030
  },
1031
- // 全局意图:MCP 服务器 / 技能来源两格的**全局开关**写这里,不再直接改补丁 /
1032
- // 来源状态 —— 后者是运行态,由对账器维持成 `意图 ∪ 租约`。三态里只有 `blocked`(界面的
1033
- // 「彻底停止」)会连租约一起停;`off` 在有租约时保持连接运行,只是别的会话看不到。
1031
+ // 全局意图:MCP 服务器 / 技能(含来源)三格的**全局开关**写这里,不再直接改补丁 /
1032
+ // 来源状态 —— 后者是运行态,由对账器维持成 `意图 ∪ 租约`。
1033
+ // `blocked` 仍可读(旧版本留下的 MCP 值),新界面不再写它:「统一关闭」是一次性
1034
+ // 动作,走下面的 `scope-stop-now`。
1034
1035
  'scope-intent-set': async (args) => {
1035
1036
  const domain = String((args && args.domain) || '').trim();
1036
1037
  if (!isIntentDomain(domain))
1037
- return { ok: false, error: `未知 domain: ${domain}(可用:mcp / skillSources)` };
1038
+ return { ok: false, error: `未知 domain: ${domain}(可用:mcp / skillSources / skills)` };
1038
1039
  const raw = args && args.value;
1039
1040
  const state = normalizeIntentState(raw) ?? (raw === true ? 'on' : raw === false ? 'off' : undefined);
1040
1041
  if (state === undefined)
@@ -1064,6 +1065,108 @@ export function buildScopeOps(deps) {
1064
1065
  .map((item) => `「${item.key}」的全局意图已记下,但运行态没跟上(${item.error}):下一次对账会再试`);
1065
1066
  return { ok: true, domain, value: state, keys, ...(warnings.length > 0 ? { warnings } : {}) };
1066
1067
  },
1068
+ /**
1069
+ * 「统一关闭」/「全部关闭」:一次性停机,不留下持久的 `blocked`。
1070
+ *
1071
+ * 对布尔域:先把全局意图写成 `off`(只有 mcp / skills / skillSources 有意图),再把
1072
+ * **所有层里开着它的**会话 / 工作区写成显式关闭 —— 只写 off 不够:那些层里的 `true`
1073
+ * (或场景勾选)会在下一轮对账里成为租约,把它重新拉起来。显式 `false` 同时压过场景层,
1074
+ * 所以场景里的会话也会一起停下。memory / subagents / quickPrompts 没有运行态,清掉
1075
+ * 认领就够了。
1076
+ *
1077
+ * `scene` 没有布尔键:把每个进入过场景的会话 / 工作区退回基线(`exitSceneInScope`);
1078
+ * 带 `key` / `keys` 时只退这些场景,不带 = 页头「全部关闭」退全部。
1079
+ * 全局正在用的那个场景不动 —— 它是全局设置,不是"临时运行"。
1080
+ *
1081
+ * 归档会话不写:它已经不占资源,改它的设置只是噪音。被锁的层照写 —— 这是用户显式
1082
+ * 触发的全局停机,层锁保护的是误触,不是拒绝停机。
1083
+ */
1084
+ 'scope-stop-now': async (args) => {
1085
+ const domain = String((args && args.domain) || 'mcp').trim();
1086
+ const isFlagDomainArg = (value) => value === 'mcp' || value === 'skills' || value === 'skillSources' || value === 'memory' || value === 'subagents' || value === 'quickPrompts';
1087
+ if (domain !== 'scene' && !isFlagDomainArg(domain)) {
1088
+ return { ok: false, error: `不支持的 domain: ${domain}(可用:mcp / skills / skillSources / memory / subagents / quickPrompts / scene)` };
1089
+ }
1090
+ let archived = new Set();
1091
+ try {
1092
+ archived = new Set((await deps.sessions()).filter((row) => row.archived === true).map((row) => row.id));
1093
+ }
1094
+ catch { /* 清单读不到:不按归档过滤,宁可多关几格 */ }
1095
+ if (domain === 'scene') {
1096
+ // 不带 key = 页头的「全部关闭」;带 key = 某一张场景卡菜单里的「统一关闭」。
1097
+ const rawScenes = Array.isArray(args && args.keys)
1098
+ ? args.keys
1099
+ : (args && args.key !== undefined ? [args.key] : []);
1100
+ const sceneNames = new Set(rawScenes.map((key) => String(key)).filter((key) => key !== ''));
1101
+ for (const key of sceneNames) {
1102
+ if (key === '__proto__' || key.length > 256 || /[\u0000-\u001f\u007f]/.test(key))
1103
+ return { ok: false, error: '非法 key: ' + key };
1104
+ }
1105
+ const res = await deps.store.mutateAll((scope, sessionId) => {
1106
+ if (archived.has(sessionId) || typeof scope.scene !== 'string' || scope.scene === '')
1107
+ return scope;
1108
+ if (sceneNames.size > 0 && !sceneNames.has(scope.scene))
1109
+ return scope;
1110
+ return exitSceneInScope(scope).scope;
1111
+ });
1112
+ if (!res.ok)
1113
+ return { ok: false, error: '退出场景失败: ' + res.error };
1114
+ if (res.changed > 0)
1115
+ deps.onChanged?.('', 'scene');
1116
+ if (deps.reconcile !== undefined)
1117
+ await deps.reconcile().catch(() => undefined);
1118
+ return { ok: true, domain, cleared: res.changed, ...(sceneNames.size > 0 ? { keys: [...sceneNames] } : {}) };
1119
+ }
1120
+ const rawList = Array.isArray(args && args.keys)
1121
+ ? args.keys
1122
+ : (args && args.key !== undefined ? [args.key] : []);
1123
+ const keys = [...new Set(rawList.map((key) => String(key)).filter((key) => key !== ''))];
1124
+ if (keys.length === 0)
1125
+ return { ok: false, error: '缺少 key(或 keys)' };
1126
+ if (keys.length > 512)
1127
+ return { ok: false, error: '一次最多改 512 项' };
1128
+ for (const key of keys) {
1129
+ if (key === '__proto__' || key.length > 256 || /[\u0000-\u001f\u007f]/.test(key))
1130
+ return { ok: false, error: '非法 key: ' + key };
1131
+ }
1132
+ const runtime = domain === 'mcp' || domain === 'skills' || domain === 'skillSources';
1133
+ if (runtime) {
1134
+ if (deps.writeIntent === undefined)
1135
+ return { ok: false, error: '当前环境不支持全局意图写入' };
1136
+ const error = await deps.writeIntent(domain, keys, 'off');
1137
+ if (error !== null)
1138
+ return { ok: false, error: '写入失败: ' + error };
1139
+ }
1140
+ const cleared = Object.create(null);
1141
+ const res = await deps.store.mutateAll((scope, sessionId) => {
1142
+ if (archived.has(sessionId))
1143
+ return scope;
1144
+ const archive = scope.scene !== undefined ? deps.sceneArchiveOf?.(scope.scene) : undefined;
1145
+ const table = scope[domain];
1146
+ let next = table;
1147
+ for (const key of keys) {
1148
+ if (effectiveLayerOf(scope, archive, domain, key) !== true)
1149
+ continue;
1150
+ if (next === undefined)
1151
+ next = {};
1152
+ else if (next === table)
1153
+ next = Object.assign({}, next);
1154
+ next[key] = false;
1155
+ cleared[key] = (cleared[key] || 0) + 1;
1156
+ }
1157
+ return next === table ? scope : Object.assign({}, scope, { [domain]: next });
1158
+ });
1159
+ if (!res.ok)
1160
+ return { ok: false, error: '关闭会话开关失败: ' + res.error };
1161
+ if (res.changed > 0)
1162
+ deps.onChanged?.('', domain);
1163
+ const report = runtime && deps.reconcile !== undefined ? await deps.reconcile().catch(() => undefined) : undefined;
1164
+ const keySet = new Set(keys);
1165
+ const warnings = (report === undefined ? [] : report.failed)
1166
+ .filter((item) => item.domain === domain && keySet.has(item.key))
1167
+ .map((item) => `「${item.key}」已记录为关闭,但运行态没跟上(${item.error}):下一次对账会再试`);
1168
+ return { ok: true, domain, keys, cleared, ...(warnings.length > 0 ? { warnings } : {}) };
1169
+ },
1067
1170
  // 锁 / 解锁:与 `rules-scene-lock` 同一条 —— 它自己不能被锁挡住,否则锁上就解不开。
1068
1171
  'scope-lock': async (args) => {
1069
1172
  const rawId = String((args && args.sessionId) || '').trim();
@@ -16,8 +16,9 @@
16
16
  // 删除 / 归档 / 场景改档案这几条路径分叉。
17
17
  //
18
18
  // 用户要求「仍按租约运行」:全局 off + 有租约 → 连接保持运行,但只有认领的
19
- // 会话看得到它;未认领的会话(含新会话)一律按 off。`blocked`(界面上的「彻底停止」)是
20
- // 唯一的立即停机路径:显式拒绝,压过租约与一切会话层。
19
+ // 会话看得到它;未认领的会话(含新会话)一律按 off。`blocked` 是显式拒绝,压过租约与
20
+ // 一切会话层;新界面不再写它 —— MCP 的「统一关闭」已改为一次性动作(先写 off 再清掉
21
+ // 各层认领),读侧仍认这个值,保证升级前留下的记录照旧生效。
21
22
  //
22
23
  // ## 为什么只有这三格有意图
23
24
  //
@@ -95,9 +96,9 @@ export function withIntent(intent, domain, keys, state) {
95
96
  * 一台服务器 / 一个来源在某个会话里的可见性。`lower` 是会话的那三层
96
97
  * (覆盖 → 场景层 → 基线)的并值,`undefined` = 三层都没话说。
97
98
  *
98
- * 优先级:`blocked`(全局彻底停止)> 会话层 > `on` / `off` > 运行态。
99
- * blocked 压过会话层是"彻底停止"的定义:否则一个还留着 `mcp[x]=true` 的会话就能把它复活,
100
- * 用户点了「彻底停止」却还看得见工具,那一步就没有出口了。
99
+ * 优先级:`blocked`(显式拒绝)> 会话层 > `on` / `off` > 运行态。
100
+ * blocked 压过会话层是它的定义:否则一个还留着 `mcp[x]=true` 的会话就能把它复活,
101
+ * 那一步就没有出口了。
101
102
  */
102
103
  export function resolveResource(intent, lower) {
103
104
  if (intent === 'blocked')
package/lib/tools/mcp.js CHANGED
@@ -265,7 +265,7 @@ export function buildMcpTools(deps) {
265
265
  // 调用方是否**以为**自己在改会话层(省略 scope 也算)。全局粒度下这个以为会落空,
266
266
  // 回执必须点出来 —— 否则 agent 会把"机器级改动"转述成"只影响这个对话"。
267
267
  const askedForSession = (args && args.scope) !== 'global';
268
- // restart 与 stop 都是机器级动作(重启要真停一次;彻底停止定义上就压过所有会话),
268
+ // restart 与 stop 都是机器级动作(重启要真停一次;blocked 定义上就压过所有会话),
269
269
  // 没有会话版本 —— 与 restart 同一条,忽略 scope 并如实点出来。
270
270
  const sessionOnly = scope !== 'global' && action !== 'restart' && action !== 'stop';
271
271
  // on|off 会写补丁(`mcpm-set-enabled` / `mcpm-tool-enabled` 在登记表里是 frozen),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-tool-management",
3
- "version": "0.21.3",
3
+ "version": "0.21.4",
4
4
  "description": "一个设置面板,统一管理 MCP、技能、记忆、子智能体、提示词和归档会话;可自定义搭配场景,一个场景即可切换整个环境;Agent也能帮你操作这个插件。",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,7 +70,7 @@
70
70
  ]
71
71
  }
72
72
  },
73
- "icon": "./docs/images/icon.png",
73
+ "icon": "./docs/images/logo.png",
74
74
  "peerDependencies": {
75
75
  "@deepseek-ai/cordis": "^4.0.2",
76
76
  "@deepseek-ai/dsh-agent-preset-registry": ">=0.2.1-rc.2 <0.2.2",