dsh-plugin-tool-management 0.21.9 → 0.22.1

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/client.js CHANGED
@@ -17,6 +17,15 @@ window.__ModuleLoader__.load({
17
17
  var exports = module.exports
18
18
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
19
19
  const React = require('react')
20
+ /**
21
+ * `react-dom`(只取 `createPortal`):浮窗要挂到 `document.body` 上 ——
22
+ * 挂在面板里会被祖先的 `overflow:hidden` 裁掉(用户 2026-11-05 实测的「穿模」:
23
+ * 浮窗被来源卡片裁掉一半,底下一张卡片的内容透上来)。
24
+ * 拿不到就退回「就地渲染」:功能在,观感差一点。
25
+ * @type {any}
26
+ */
27
+ var ReactDOM = null
28
+ try { ReactDOM = require('react-dom') } catch (e) { ReactDOM = null }
20
29
 
21
30
  // 本插件自己的设计变量(宿主那套是 `--dsw-*`)。告警色此前在 12 条规则里各写一遍
22
31
  // 十六进制字面量,换主题要改 12 次 —— 收敛成 `--dsm-warn`,字面量只留下面那一处。
@@ -209,6 +218,21 @@ button.dsm-qty:disabled{cursor:default}
209
218
  .dsm-source-body .dsm-source{border:0;border-radius:0;border-bottom:1px solid var(--dsw-alias-border-l1)}
210
219
  .dsm-source-body .dsm-source:last-child{border-bottom:0}
211
220
  .dsm-note{overflow:hidden;margin-top:4px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:17px;text-overflow:ellipsis;white-space:nowrap}.dsm-tags{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.dsm-tag{display:inline-flex;min-height:20px;align-items:center;padding:0 8px;border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsm-radius-s);color:var(--dsw-alias-label-secondary);font-size:12px;white-space:nowrap}.dsm-tag-on{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}.dsm-tag-off{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}.dsm-tag-warn{border-color:var(--dsm-warn);color:var(--dsm-warn)}.dsm-tag-lease{border-style:dashed;border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}
221
+ /* 中性标签:灰边框 + 主色字(用户 2026-11-06:MCP 的「未运行」不该是红的 —— 没跑起来不是故障)。 */
222
+ .dsm-tag-quiet{border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}
223
+ /* 租约浮窗(悬在「临时运行 · N 个对话」徽章上):按工作区分组列出是**哪几个对话**在用它。
224
+ 固定定位 + 视口坐标 —— 徽章所在的列表行是 overflow:hidden,绝对定位会被裁掉
225
+ (与 SourceSelect 的菜单同一条理由)。 */
226
+ .dsm-lease-pop{position:fixed;z-index:1200;box-sizing:border-box;width:max-content;max-width:min(92vw,720px);padding:10px 12px;overflow:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsm-radius-m);background:var(--dsw-alias-bg-layer-3);box-shadow:var(--dsw-shadow-lv2);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;white-space:normal;text-align:left}
227
+ /* 组头 = 工作区(白、稍重):它是"哪个项目在用它";组内每行一个对话(灰、缩进)。 */
228
+ .dsm-lease-pop-group+.dsm-lease-pop-group{margin-top:10px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l1)}
229
+ .dsm-lease-pop-ws{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:20px}
230
+ .dsm-lease-pop-item{display:flex;gap:10px;align-items:center;min-height:24px;padding-left:12px}
231
+ .dsm-lease-pop-title{min-width:0;overflow:hidden;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px;text-overflow:ellipsis;white-space:nowrap}
232
+ /* 每行末尾那颗「×」:只放开这一个对话的临时运行,其余对话照旧(认领是逐个对话记的)。 */
233
+ .dsm-lease-pop-x{flex:none;box-sizing:border-box;width:24px;height:24px;padding:0;border:0;border-radius:var(--dsm-radius-s);background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:16px;line-height:24px;cursor:pointer}
234
+ .dsm-lease-pop-x:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
235
+ .dsm-lease-pop-x:disabled{cursor:default;opacity:.5}
212
236
  /* 开关与官方同款(用户 2026-10-18:「switch 按键统一和官方一样的模板」→「改成完全一样」):
213
237
  36×20 外壳 + 16px 拇指、内边距 2px、滑块位移 16px、开态用 brand-primary,
214
238
  关态拇指用 switch-thumb —— 尺寸与配色照抄宿主设置面板那颗。
@@ -982,6 +1006,13 @@ html,body{scrollbar-gutter:stable}.dsm-settings-scroll-host{overflow-y:scroll!im
982
1006
  .dsm-rowselect-box{display:inline-flex;flex:none;width:14px;height:14px;align-items:center;justify-content:center;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsm-radius-s);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary-foreground)}
983
1007
  .dsm-rowselect-on .dsm-rowselect-box{border-color:var(--dsw-alias-button-primary-fill);background:var(--dsw-alias-button-primary-fill)}
984
1008
  .dsm-rowselect-main{display:flex;min-width:0;flex:1;flex-direction:column;gap:2px}
1009
+ /* 单行版(compact):名字与描述并排一行,描述吃掉余量并截断 —— 一屏多看一半条目
1010
+ (场景档案的四个集,user 2026-11-06)。 */
1011
+ .dsm-rowselect-compact .dsm-rowselect-main{flex-direction:row;align-items:baseline;gap:8px}
1012
+ /* 单行版里**名字不缩**(用户 2026-11-06:「标题名字要全部展示」)—— 挤掉的是描述,
1013
+ 不是名字。 */
1014
+ .dsm-rowselect-compact .dsm-rowselect-name{flex:none}
1015
+ .dsm-rowselect-compact .dsm-rowselect-desc{min-width:0;flex:1 1 auto}
985
1016
  .dsm-rowselect-name{overflow:hidden;font-size:13px;line-height:18px;text-overflow:ellipsis;white-space:nowrap}
986
1017
  .dsm-rowselect-desc{overflow:hidden;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
987
1018
  .dsm-rowselect-meta{display:flex;align-items:center;gap:4px;flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;white-space:nowrap}
@@ -1172,6 +1203,9 @@ html,body{scrollbar-gutter:stable}.dsm-settings-scroll-host{overflow-y:scroll!im
1172
1203
  4px 的 flex 间距对**文字**来说不够,两段会连成一句读不出边界;点由后一件的 ::before 提供,
1173
1204
  所以只有一段时不会多出孤点。 */
1174
1205
  .dsm-listrow-meta>*+*::before{content:"·";margin-right:4px;color:var(--dsw-alias-label-tertiary)}
1206
+ /* 租约徽章自带一圈虚线边框,前面再挂一个「·」就像坏掉的标点(用户 2026-11-05 报障):
1207
+ 徽章是**独立的一枚**,不是元信息里的一段文字,不需要分隔点。 */
1208
+ .dsm-listrow-meta>.dsm-tag-lease::before{content:none}
1175
1209
  .dsm-listrow-meta:empty{display:none}
1176
1210
  .dsm-listrow-meta-desc{min-width:0;overflow:hidden;text-overflow:ellipsis}
1177
1211
  .dsm-listrow-meta-info{flex:none;color:var(--dsw-alias-label-tertiary)}
@@ -1232,6 +1266,19 @@ html,body{scrollbar-gutter:stable}.dsm-settings-scroll-host{overflow-y:scroll!im
1232
1266
  .dsm-setrow-desc{overflow:hidden;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
1233
1267
  .dsm-setrow-control{display:flex;flex:none;align-items:center;gap:8px}
1234
1268
  .dsm-setrow .dsm-btn{min-width:92px}
1269
+ /* 场景档案的技能集:**按来源分组**(用户 2026-11-06:平铺按技能名排,一屏四十六条
1270
+ 混在一起很乱)。组头 = 一颗组勾选框(全选 / 全不选这一整个来源)+ 来源名(点它
1271
+ 展开 / 收起)+ "N/M";组内按技能名排。 */
1272
+ .dsm-skill-groups{display:flex;flex-direction:column;gap:2px}
1273
+ .dsm-skill-group{display:flex;flex-direction:column}
1274
+ .dsm-skill-group-head{display:flex;align-items:center;gap:8px;padding:4px 8px;border-radius:var(--dsm-radius-s)}
1275
+ .dsm-skill-group-head:hover{background:var(--dsw-alias-interactive-bg-hover)}
1276
+ .dsm-skill-group-name{display:flex;min-width:0;flex:1;align-items:center;gap:4px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;font-weight:600;text-align:left;cursor:pointer}
1277
+ .dsm-skill-group-caret{flex:none}
1278
+ .dsm-skill-group-count{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;font-variant-numeric:tabular-nums}
1279
+ .dsm-skill-group-items{padding-left:16px}
1280
+ /* 部分勾选:框里一根横杠(全选是主色实底 + 白勾,见 .dsm-rowselect-box-on)。 */
1281
+ .dsm-rowselect-dash{display:block;width:8px;height:2px;border-radius:1px;background:var(--dsw-alias-label-primary)}
1235
1282
  /* RowCheck:框本身是控制件(button)—— 去按钮默认内边距、给禁用态;选中态与
1236
1283
  RowSelect 的选中框同款主色实底(原规则钉在 .dsm-rowselect-on 父级上,独立框用这
1237
1284
  条直接落在框上)。 */
@@ -1636,13 +1683,16 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
1636
1683
  * 行才是可点目标;14px 的框是纯视觉(aria-hidden),给它挂 role 只会造出第二个
1637
1684
  * 不可聚焦的 checkbox。动作槽里的按钮自己 stopPropagation,点动作不翻勾。
1638
1685
  * props:checked / disabled / name / desc / descTitle / meta / actions / onChange / key。
1686
+ * `compact`:**单行版** —— 名字与描述并排一行(描述截断,全文在 descTitle 里)。场景
1687
+ * 档案的四个集用它:一屏能多看一半条目(用户 2026-11-06:「这样能展示更多条」)。
1639
1688
  * 2026-10-11 切片五从 42 片上移:快照导入预览(兼容页)也要用行选择。
1640
1689
  */
1641
1690
  function RowSelect(props) {
1642
1691
  var disabled = props.disabled === true
1643
1692
  var toggle = function () { if (!disabled && props.onChange) props.onChange() }
1644
1693
  return h('div', {
1645
- className: 'dsm-rowselect' + (props.checked ? ' dsm-rowselect-on' : '') + (disabled ? ' dsm-rowselect-disabled' : ''),
1694
+ className: 'dsm-rowselect' + (props.checked ? ' dsm-rowselect-on' : '') + (disabled ? ' dsm-rowselect-disabled' : '') + (props.compact ? ' dsm-rowselect-compact' : ''),
1695
+
1646
1696
  role: 'checkbox', 'aria-checked': props.checked === true, 'aria-disabled': disabled || undefined,
1647
1697
  tabIndex: disabled ? -1 : 0,
1648
1698
  onClick: toggle,
@@ -2399,10 +2449,26 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
2399
2449
  /** 这一格有几个会话在认领(租约)。全局层才读得到;会话层返回 0。 */
2400
2450
  function scopeLeaseCount(domain, key) {
2401
2451
  if (scopeIsSession()) return 0
2452
+ // 来源格算的是**并集**(来源自己 + 它底下那些技能):见 `scopeLeaseDetails`。
2453
+ if (domain === 'skillSources') return scopeLeaseDetails('skillSources', key).length
2402
2454
  var leases = scopeState.global && scopeState.global.leases ? scopeState.global.leases[domain] : null
2403
2455
  var n = leases && typeof leases === 'object' ? Number(leases[key]) : 0
2404
2456
  return Number.isFinite(n) && n > 0 ? Math.floor(n) : 0
2405
2457
  }
2458
+ /**
2459
+ * 这一格的租约认领者(`[{ id, title, cwd, keys }]`):徽章浮窗逐行列出"是哪几个对话"。
2460
+ *
2461
+ * 来源格(`skillSources`)那份是**并集**(来源自己 + 它底下那些技能)—— 服务端算好:
2462
+ * 默认来源(官方内置 / DSH 技能)全局开着、租约只落在底下的技能上,客户端自己再并一遍
2463
+ * 就会与计数对不上。
2464
+ */
2465
+ function scopeLeaseDetails(domain, key) {
2466
+ if (scopeIsSession()) return []
2467
+ var all = scopeState.global && scopeState.global.leaseDetails ? scopeState.global.leaseDetails : null
2468
+ var byKey = all && typeof all === 'object' ? all[domain] : null
2469
+ var list = byKey && typeof byKey === 'object' ? byKey[key] : null
2470
+ return Array.isArray(list) ? list : []
2471
+ }
2406
2472
  /** 这一域此刻有租约的键(全局层专用;会话层返回空)。「全部关闭」按它取目标集。 */
2407
2473
  function scopeLeaseKeys(domain) {
2408
2474
  if (scopeIsSession()) return []
@@ -2435,6 +2501,18 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
2435
2501
  nextLeases[domain] = domainLeases
2436
2502
  patch.leases = nextLeases
2437
2503
  }
2504
+ // 认领者名单跟计数同生共死:计数摘了还留着名单,浮窗会列出已经不认领的对话。
2505
+ var details = global.leaseDetails || {}
2506
+ var domainDetails = Object.assign({}, details[domain] || {})
2507
+ var detailsChanged = false
2508
+ list.forEach(function (key) {
2509
+ if (domainDetails[key] !== undefined) { delete domainDetails[key]; detailsChanged = true }
2510
+ })
2511
+ if (detailsChanged) {
2512
+ var nextDetails = Object.assign({}, details)
2513
+ nextDetails[domain] = domainDetails
2514
+ patch.leaseDetails = nextDetails
2515
+ }
2438
2516
  if (domain === 'mcp' || domain === 'skills' || domain === 'skillSources') {
2439
2517
  var intent = global.intent || {}
2440
2518
  var nextDomainIntent = Object.assign({}, intent[domain] || {})
@@ -2443,9 +2521,54 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
2443
2521
  nextIntent[domain] = nextDomainIntent
2444
2522
  patch.intent = nextIntent
2445
2523
  }
2446
- if (patch.leases === undefined && patch.intent === undefined) return
2524
+ if (patch.leases === undefined && patch.intent === undefined && patch.leaseDetails === undefined) return
2447
2525
  setScopeState({ global: Object.assign({}, global, patch) })
2448
2526
  }
2527
+ /**
2528
+ * 释放**一个**对话的认领之后,就地改本地快照(计数减一、名单摘掉一条)。
2529
+ *
2530
+ * 为什么不能等服务端重拉:全局快照有 150ms 的短 TTL,紧接着的 `scope-get` 可能还是
2531
+ * 写前那一份 —— 徽章会先留着又消失。摘干净之后由调用方补一次静默重拉对齐。
2532
+ *
2533
+ * 工作区粒度下认领是**按工作区**记的:放掉一个对话等于放掉整个工作区,这一格里
2534
+ * 同工作区的那些对话一起摘掉(与服务端写到的层一致)。
2535
+ */
2536
+ function scopeForgetLeaseSession(domain, key, sessionId) {
2537
+ if (scopeIsSession()) return
2538
+ var global = scopeState.global
2539
+ if (!global) return
2540
+ var id = String(sessionId || '')
2541
+ var leases = global.leases || {}
2542
+ var details = global.leaseDetails || {}
2543
+ var domainDetails = Object.assign({}, details[domain] || {})
2544
+ var list = Array.isArray(domainDetails[key]) ? domainDetails[key].slice() : []
2545
+ if (list.length === 0) return
2546
+ var found = false
2547
+ var cwd = ''
2548
+ list.forEach(function (d) {
2549
+ if (found) return
2550
+ if (String((d && d.id) || '') === id) { found = true; cwd = String((d && d.cwd) || '') }
2551
+ })
2552
+ if (!found) return
2553
+ var keep = list.filter(function (d) {
2554
+ if (String((d && d.id) || '') === id) return false
2555
+ if (scopeIsWorkspace() && cwd !== '' && String((d && d.cwd) || '') === cwd) return false
2556
+ return true
2557
+ })
2558
+ var domainLeases = Object.assign({}, leases[domain] || {})
2559
+ if (keep.length > 0) {
2560
+ domainDetails[key] = keep
2561
+ domainLeases[key] = keep.length
2562
+ } else {
2563
+ delete domainDetails[key]
2564
+ delete domainLeases[key]
2565
+ }
2566
+ var nextLeases = Object.assign({}, leases)
2567
+ nextLeases[domain] = domainLeases
2568
+ var nextDetails = Object.assign({}, details)
2569
+ nextDetails[domain] = domainDetails
2570
+ setScopeState({ global: Object.assign({}, global, { leases: nextLeases, leaseDetails: nextDetails }) })
2571
+ }
2449
2572
  /** 有多少个会话 / 工作区进入了场景(全局层专用;会话层返回 0)。传场景名只数那一个。 */
2450
2573
  function scopeSceneLeaseCount(sceneName) {
2451
2574
  if (scopeIsSession()) return 0
@@ -2457,6 +2580,17 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
2457
2580
  var n = Number(raw)
2458
2581
  return Number.isFinite(n) && n > 0 ? Math.floor(n) : 0
2459
2582
  }
2583
+ /**
2584
+ * 这一场有谁在用(场景层):徽章浮窗逐行列出是哪些对话 / 工作区进入了这个场景。
2585
+ *
2586
+ * 与 `scopeSceneLeaseCount` 同一份服务端数据(`global.sceneLeaseDetails`),全局层才读得到。
2587
+ */
2588
+ function scopeSceneLeaseDetails(sceneName) {
2589
+ if (scopeIsSession()) return []
2590
+ var all = scopeState.global && scopeState.global.sceneLeaseDetails ? scopeState.global.sceneLeaseDetails : null
2591
+ var list = all && typeof all === 'object' ? all[String(sceneName)] : null
2592
+ return Array.isArray(list) ? list : []
2593
+ }
2460
2594
  /** 统一关闭某个(或全部)场景后,就地改本地计数 —— 理由同 `scopeForgetLeases`。 */
2461
2595
  function scopeForgetSceneLeases(sceneName) {
2462
2596
  if (scopeIsSession()) return
@@ -5896,12 +6030,12 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
5896
6030
  "mcp.live.notLoaded": "未加载", "mcp.live.failed": "启动失败", "mcp.live.stopped": "未启用", "mcp.live.loading": "加载中", "mcp.live.noTools": "无可用工具", "mcp.live.running": "已启用",
5897
6031
  "mcp.live.failedHint": "启动失败,检查配置后重新尝试", "mcp.live.offlineHint": "启动失败,检查配置后重新尝试", "mcp.live.neverHint": "启动失败,检查配置后重新尝试", "mcp.live.allOffHint": "工具全部被停用:当前没有可调用的工具(取消停用即恢复)",
5898
6032
  "mcp.note.prefix": "备注:", "mcp.toggleServer": "启停服务", "mcp.toggleTool": "启停工具", "mcp.session.startGlobal": "全局关着:打开后仅为这个对话临时运行,全局设置不变。",
5899
- "mcp.intent.blockedHint": "全局已统一关闭这台服务器:会话层也不能打开它。先在全局重新打开。",
6033
+ "mcp.intent.blockedHint": "全局已全部关闭这台服务器:会话层也不能打开它。先在全局重新打开。",
5900
6034
  "mcp.intent.lease": "临时运行 · {count} 个对话", "mcp.intent.leaseHint": "全局是关的;{count} 个对话在用它,连接保持运行。",
5901
- "mcp.intent.keptRunning": "已全局关闭;还有 {count} 个对话在用,连接保持运行(要立即关闭用「统一关闭」)。",
5902
- "mcp.intent.onOk": "已全局启用「{name}」。", "mcp.intent.offOk": "已全局关闭「{name}」。", "mcp.intent.stopped": "已统一关闭「{name}」:正在使用它的对话 / 工作区也已关闭。",
5903
- "mcp.intent.stop": "统一关闭",
5904
- "mcp.intent.stopTitle": "统一关闭?",
6035
+ "mcp.intent.keptRunning": "已全局关闭;还有 {count} 个对话在用,连接保持运行(要立即关闭用「全部关闭」)。",
6036
+ "mcp.intent.onOk": "已全局启用「{name}」。", "mcp.intent.offOk": "已全局关闭「{name}」。", "mcp.intent.stopped": "已全部关闭「{name}」:正在使用它的对话 / 工作区也已关闭。",
6037
+ "mcp.intent.stop": "全部关闭",
6038
+ "mcp.intent.stopTitle": "全部关闭?",
5905
6039
  "mcp.intent.stopDesc": "「{name}」会立即关闭,正在使用它的对话 / 工作区也会一并关闭(它们的开关会变成关闭);之后可以重新打开。",
5906
6040
  "mcp.tools.serverOff": "这台服务器在本会话里看不到:先在上面打开它,再拨工具",
5907
6041
  "mcp.msg.ok": "操作成功", "mcp.msg.failed": "操作失败", "mcp.msg.loadFailed": "加载失败", "mcp.msg.warn": "操作完成,但加载器有提示:{warning}", "mcp.msg.toolsRefreshed": "已取到 {count} 个工具", "mcp.msg.restartWarn": "已重启,但有告警:{warning}", "mcp.msg.restarted": "已重启:{name}",
@@ -6420,9 +6554,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
6420
6554
  "scenes.archive.summary": "档案:MCP {mcp} 台 · 技能 {skills} 个 · 子智能体 {subagents} 个",
6421
6555
  "scenes.mcp.noServers": "还没有可选的 MCP 服务器", "scenes.mcp.toolCount": "{count} 个工具", "scenes.skills.empty": "还没有可选的技能",
6422
6556
  "scenes.mcp.allTools": "全部工具", "scenes.mcp.pickedCount": "指定 {count} 个工具", "scenes.mcp.notRunning": "未运行", "scenes.mcp.edit": "编辑", "scenes.mcp.done": "完成", "scenes.mcp.noteLabel": "场景备注", "scenes.mcp.notePlaceholder": "进入该场景时覆盖全局备注;退出后恢复", "scenes.mcp.hasNote": "有备注",
6423
- "scenes.mcp.toolsOf": "选择工具", "scenes.mcp.probeTools": "启动服务器读取工具", "scenes.mcp.unknownCount": "工具数未知 · 点「编辑」读取", "scenes.mcp.noteHint": "此备注随场景保存;仅在该场景本段**勾选**了这台服务器时,进入场景才会覆盖「MCP」页与系统提示词里的备注,退出后自动恢复。", "scenes.mcp.noTools": "该服务器当前没有可列出的工具(从未运行过,或已配置的工具尚未被记录)", "scenes.mcp.drillHint": "勾选 = 该场景下启用;不勾 = 停用。「全选」= 全部工具(再点一次成「取消全选」= 全部停用)。",
6557
+ "scenes.mcp.toolsOf": "选择工具", "scenes.mcp.probeTools": "启动服务器读取工具", "scenes.mcp.unknownCount": "工具数未知 · 点「编辑」读取", "scenes.mcp.noTools": "该服务器当前没有可列出的工具(从未运行过,或已配置的工具尚未被记录)",
6424
6558
  "scenes.skills.hint": "添加「技能集」后,勾选该场景下启用的技能。没勾的、以及整段没建的,进场景时一律停用(退出按进场景前的开关还原)。被同名技能覆盖的副本与结构不完整的技能不能勾——它们在这个场景里不可能生效。", "scenes.skills.hint.short": "添加后勾选这个场景要启用的技能", "scenes.subagents.hint": "勾选本场景要打开的人设;没勾的、以及整段没建的,进场景时一律关闭(退出按进场景前的开关还原)。", "scenes.subagents.hint.short": "添加后勾选这个场景要打开的人设", "scenes.subagents.empty": "还没有人设——到「子智能体」页创建。",
6425
6559
  "scenes.skills.shadowed.hint": "被同名技能覆盖,在这个场景里不可能生效,因此不能勾选。要改用这一份,请到「技能」页点它的「启用这个」。",
6560
+ "scenes.skills.groupCheck": "勾上这个来源的全部技能", "scenes.skills.groupUncheck": "取消这个来源的全部技能",
6426
6561
  "scenes.skills.invalid.hint": "技能结构不完整(缺 frontmatter / 名字非法 / 描述为空),无法启停,因此不能勾选。",
6427
6562
  "scenes.filter.skills": "筛选技能/目录名称", "scenes.filter.subagents": "筛选人设(名称或描述)", "scenes.filter.servers": "筛选服务器",
6428
6563
  "scenes.mem.title": "记忆", "scenes.mem.search": "在本场景内筛选记忆(名称或描述)",
@@ -6636,7 +6771,6 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
6636
6771
  "scope.toggle.session": "{layer}",
6637
6772
  "scope.currentWorkspace": "当前工作区",
6638
6773
  "scope.view.lease": "{count} 个对话单独设置",
6639
- "scope.view.leaseHint": "全局是关的,但还有 {count} 个对话单独把它拨开了 —— 这只影响它们各自看到的内容,全局设置没变。",
6640
6774
  "scope.warn.dismiss": "知道了",
6641
6775
  "scope.repair.action": "修复作用域文件", "scope.repair.confirm": "确认隔离损坏文件(设置回到默认)",
6642
6776
  "scope.repair.hint": "仅在作用域侧车损坏时使用:损坏的文件会改名留存,覆盖表与全局意图回到默认,下一次对账会从运行态反推。",
@@ -6644,13 +6778,22 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
6644
6778
  "scope.repair.none": "作用域侧车文件正常,无需修复。",
6645
6779
  "scope.repair.failed": "修复失败:{error}",
6646
6780
  "scope.intent.globalOnly": "全局意图只能在全局层修改",
6647
- "scope.intent.blocked": "已统一关闭", "scope.intent.blockedHint": "全局已「统一关闭」:任何会话都不能再用它(包括在会话层打开)。要恢复,先在全局改回启用。",
6648
- "scope.intent.lease": "临时运行 · {count} 个对话", "scope.intent.leaseHint": "全局是关的,但还有 {count} 个对话在用它 —— 它保持启用,只有这些对话看得到。",
6781
+ "scope.intent.blocked": "已全部关闭", "scope.intent.blockedHint": "全局已「全部关闭」:任何会话都不能再用它(包括在会话层打开)。要恢复,先在全局改回启用。",
6782
+ "scope.intent.lease": "临时运行 · {count} 个对话", "scope.intent.leaseWs": "临时运行 · {count} 个工作区",
6783
+ "scope.view.leaseWs": "{count} 个工作区单独设置",
6784
+
6649
6785
  "scope.intent.keptRunning": "全局已关闭;还有 {count} 个对话在用,来源保持启用(只有这些对话看得到)。",
6650
6786
  "scope.intent.onOk": "已全局启用「{name}」。", "scope.intent.offOk": "已全局关闭「{name}」。",
6651
6787
  "scope.intent.resume": "恢复启用",
6652
- "scope.unifiedClose": "统一关闭", "scope.unifiedClose.desc": "「{name}」会立即关闭,正在使用它的对话 / 工作区也会一并关闭;之后可以重新打开。", "scope.unifiedClose.done": "已统一关闭「{name}」。", "scope.unifiedClose.viewDesc": "会把各对话 / 工作区里单独打开的「{name}」一并关掉(全局设置不动);之后可以重新打开。", "scope.unifiedClose.viewDone": "已统一关闭「{name}」(各对话 / 工作区的单独设置已清除)。", "scope.unifiedClose.sceneDesc": "会退出所有进入「{name}」的对话 / 工作区,回到各自进入前的样子;全局正在用的场景不受影响。", "scope.unifiedClose.sceneDone": "已统一关闭场景「{name}」。",
6788
+ "scope.unifiedClose": "全部关闭", "scope.unifiedClose.desc": "「{name}」会立即关闭,正在使用它的对话 / 工作区也会一并关闭;之后可以重新打开。", "scope.unifiedClose.done": "已全部关闭「{name}」。", "scope.unifiedClose.viewDesc": "会把各对话 / 工作区里单独打开的「{name}」一并关掉(全局设置不动);之后可以重新打开。", "scope.unifiedClose.viewDone": "已全部关闭「{name}」(各对话 / 工作区的单独设置已清除)。", "scope.unifiedClose.sceneDesc": "会退出所有进入「{name}」的对话 / 工作区,回到各自进入前的样子;全局正在用的场景不受影响。", "scope.unifiedClose.sceneDone": "已全部关闭场景「{name}」。",
6653
6789
  "scope.stopAll": "全部关闭", "scope.stopAll.done": "已全部关闭({count} 项)。",
6790
+ "scope.lease.noWorkspace": "无工作区",
6791
+ "scope.lease.release": "不再让这个对话临时运行它(其它对话照旧)",
6792
+ "scope.lease.releaseWorkspace": "不再让这个工作区临时运行它(同工作区的对话一起不再用)",
6793
+ "scope.lease.released": "已让「{title}」不再临时运行",
6794
+ "scope.lease.releasedWs": "已让工作区「{title}」不再临时运行",
6795
+ "scope.lease.releaseFailed": "没能让「{title}」停止临时运行:{error}",
6796
+ "scope.lease.unknownError": "原因未说明",
6654
6797
  },
6655
6798
  en: {
6656
6799
  "title": "Skills", "desc": "Manage skills: enable, import, create, trash.", "link.project": "GitHub", "link.feedback": "Issues",
@@ -7318,10 +7461,11 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
7318
7461
  "scenes.archive.summary": "Profile: {mcp} MCP server(s) · {skills} skill(s) · {subagents} subagent(s)",
7319
7462
  "scenes.mcp.noServers": "No MCP servers to pick from yet", "scenes.mcp.toolCount": "{count} tool(s)", "scenes.skills.empty": "No skills to pick from yet",
7320
7463
  "scenes.mcp.allTools": "all tools", "scenes.mcp.pickedCount": "{count} tools picked", "scenes.mcp.notRunning": "not running", "scenes.mcp.edit": "Edit", "scenes.mcp.done": "Done", "scenes.mcp.noteLabel": "Scene note", "scenes.mcp.notePlaceholder": "Overrides the global note in this scene; restored on exit", "scenes.mcp.hasNote": "has note",
7321
- "scenes.mcp.toolsOf": "Pick tools", "scenes.mcp.probeTools": "Start the server to load tools", "scenes.mcp.unknownCount": "unknown tool count — open Edit to load", "scenes.mcp.noteHint": "Saved with the scene. It overrides the note shown on the MCP page and in the system prompt only while this scene is entered — and only for servers checked in this section. Restored on exit.", "scenes.mcp.noTools": "No tools listed for this server (it has never run, or its tools were never recorded)", "scenes.mcp.drillHint": "Checked = enabled in this scene; unchecked = disabled. “Select all” = every tool (click again for “Deselect all” = none).",
7464
+ "scenes.mcp.toolsOf": "Pick tools", "scenes.mcp.probeTools": "Start the server to load tools", "scenes.mcp.unknownCount": "unknown tool count — open Edit to load", "scenes.mcp.noTools": "No tools listed for this server (it has never run, or its tools were never recorded)",
7322
7465
  "scenes.skills.hint": "Add the skills section first, then check the skills enabled in this scene. Unchecked skills — and scenes with no section at all — are disabled on entry, and restored to their previous switch when you exit. Copies shadowed by a same-name skill and structurally broken skills cannot be checked — they can never take effect in this scene.",
7323
7466
  "scenes.skills.hint.short": "Add the section, then check the skills this scene enables",
7324
7467
  "scenes.skills.shadowed.hint": "Shadowed by a same-name skill, so it can never take effect in this scene and cannot be checked. To use this copy instead, click “Use this one” for it on the Skills page.",
7468
+ "scenes.skills.groupCheck": "Check every skill of this source", "scenes.skills.groupUncheck": "Uncheck every skill of this source",
7325
7469
  "scenes.skills.invalid.hint": "Incomplete skill (missing frontmatter / invalid name / empty description): it cannot be enabled or disabled, so it cannot be checked.", "scenes.subagents.hint": "Check the personas this scene should turn on; anything unchecked (or with no section at all) is turned off when you enter, and restored to its previous switch when you exit.", "scenes.subagents.hint.short": "Add the section, then check the personas to turn on", "scenes.subagents.empty": "No personas yet — create one on the Subagents page.",
7326
7470
  "scenes.filter.skills": "Filter skills / directories", "scenes.filter.subagents": "Filter personas (name or description)", "scenes.filter.servers": "Filter servers",
7327
7471
  "scenes.mem.title": "Memories", "scenes.mem.search": "Filter memories in this scene (name or description)",
@@ -7530,7 +7674,6 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
7530
7674
  "scope.toggle.session": "{layer}",
7531
7675
  "scope.currentWorkspace": "this workspace",
7532
7676
  "scope.view.lease": "set in {count} chats",
7533
- "scope.view.leaseHint": "Off globally, but {count} conversation(s) switched it on for themselves — that only changes what they see; the global setting is unchanged.",
7534
7677
  "scope.warn.dismiss": "Dismiss",
7535
7678
  "scope.repair.action": "Repair scope files", "scope.repair.confirm": "Quarantine the corrupt file (settings reset to defaults)",
7536
7679
  "scope.repair.hint": "Only for corrupt scope sidecars: the corrupt file is renamed and kept, per-conversation overrides and global intent reset to defaults, and the next reconcile adopts the running state.",
@@ -7539,7 +7682,16 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
7539
7682
  "scope.repair.failed": "Repair failed: {error}",
7540
7683
  "scope.intent.globalOnly": "Global intent can only be changed from the global layer",
7541
7684
  "scope.intent.blocked": "closed everywhere", "scope.intent.blockedHint": "Closed globally: no conversation can use it, even by switching it on locally. Set it back to on/off globally to allow it again.",
7542
- "scope.intent.lease": "temporary · {count} conversation(s)", "scope.intent.leaseHint": "Off globally, but {count} conversation(s) still use it — it stays enabled and only they see it.",
7685
+ "scope.intent.lease": "temporary · {count} conversation(s)", "scope.intent.leaseWs": "temporary · {count} workspace(s)",
7686
+ "scope.view.leaseWs": "set in {count} workspace(s)",
7687
+
7688
+ "scope.lease.noWorkspace": "no workspace",
7689
+ "scope.lease.release": "Stop it from running for this conversation (the others keep it)",
7690
+ "scope.lease.releaseWorkspace": "Stop it from running for this workspace (its conversations stop too)",
7691
+ "scope.lease.released": "“{title}” no longer runs it temporarily",
7692
+ "scope.lease.releasedWs": "Workspace “{title}” no longer runs it temporarily",
7693
+ "scope.lease.releaseFailed": "Could not stop the temporary run for “{title}”: {error}",
7694
+ "scope.lease.unknownError": "no reason given",
7543
7695
  "scope.intent.keptRunning": "Disabled globally; {count} conversation(s) still use it, so the source stays enabled for them.",
7544
7696
  "scope.intent.onOk": "Enabled “{name}” globally.", "scope.intent.offOk": "Disabled “{name}” globally.",
7545
7697
  "scope.intent.resume": "Turn back on",
@@ -8032,165 +8184,83 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
8032
8184
  // 「整串都是 `•`」,客户端再引入 `****` 会让那个判据失效。
8033
8185
 
8034
8186
  // 顶部栏右端:GitHub 链接(issues 在仓库)+ 版本号(全界面唯一显示处)。
8035
-
8036
- // ── 设置侧栏「工具管理」那一行的图标(2026-10-18)─────────────────────────
8037
- //
8038
- // 为什么需要它:宿主 ui-settings-general 的 SettingsPanel 用 `navIcon(row.id)`
8039
- // 挑侧栏字形,那是一张封闭名单 —— account / models / agent-presets /
8040
- // plugins / archived-sessions 各有专用图标,**其余 id 一律落到默认齿轮**。
8041
- // `settings.section` 这个 slot 只投影 id / order / label 三项(宿主 bundle 里
8042
- // SlotCore 的注册描述符与运行时 slot 清单都只有这三个字段),注册方没有图标可传,
8043
- // 所以每一个第三方分区都戴着那颗齿轮,本插件也是。
8044
- //
8045
- // 做法(dshmarket / dsh-better-sidebar / dsh-skill-mcp-panel 三家都是这么干的,
8046
- // 先例见 dshmarket 的 settings-nav-icon.ts):本插件的客户端 fiber 在场时,
8047
- // 认领设置面板里**可见文字等于本分区当前 label** 的那一行,给它打一个标记属性,
8048
- // 再用一条样式把宿主的齿轮 svg 藏起来、在 ::before 上画我们自己的图。
8049
- //
8050
- // 几条边界,逐条对应"会不会出事":
8051
- // · 认领判据只有**文案全等**(isOwnNavRow)。空 label 匹配不到任何行 ——
8052
- // 语言还没解析出来时不能把整条 nav 都标上。
8053
- // · 只给标记加属性、注入一条样式,**不碰宿主的 DOM 结构与 React 树**。
8054
- // · 样式与 observer 都长在 ctx.effect 里,fiber 卸载时一起撤(撤的时候顺手
8055
- // 把标记擦掉,不会留下污染给下一个打开的面板)。
8056
- // · 宿主重绘面板时 React 会把我们换掉的齿轮**改回来**,所以用 MutationObserver
8057
- // 盯着 document.body 重新贴;这一点不是锦上添花,是这条路能成立的唯一原因。
8058
- // · 宿主哪天给 settings.section 加了 icon 字段,这个模块(连同调用点)就可以删。
8059
- //
8060
- // 图形用 CSS `mask-image` 而不是 <img>:mask 只读 alpha,可见颜色取自元素的
8061
- // `background-color: currentColor`,于是侧栏选中/悬停/主题切换时图标自动跟着变,
8062
- // 与旁边那排宿主图标完全一致。<img> 做不到这一点(它是死颜色)。
8063
- // 代价是 SVG 必须**纯黑**绘制 —— mask 只认 alpha,任何非黑填充都会变成实心块。
8064
- //
8065
- // ⚠️ 本片整段都在 `apply()` 体内(40 片那个 `apply(ctx) {` 之后的所有分片都是),
8066
- // 所以 `installSettingsNavIcon(...)` 的调用必须写在**这些 const 之后** ——
8067
- // 写在 40 片那个位置会撞 const 的 TDZ(`Cannot access 'NAV_ICON_MARKER'
8068
- // before initialization`),宿主当场 boot 失败。2026-10-18 就是这么挂的。
8069
-
8070
- /** 标记本插件自己那一行的属性名(前缀跟着本插件,避免与别家插件的标记撞名)。 */
8071
- var NAV_ICON_MARKER = 'data-dsm-nav-icon'
8072
-
8073
- /**
8074
- * 设置面板的侧栏行。宿主把每个 settings.section 条目渲染成面板 <nav> 里的
8075
- * 一个 <button>(SettingsPanel 在 dsh-client-ui-settings-general)。
8076
- */
8077
- var NAV_ROW_SELECTOR = '[role="dialog"] nav button'
8078
-
8079
- /**
8080
- * 图标本体:三层叠放的方块(工具管理),取自 docs/images/icon.svg。
8081
- *
8082
- * 纯黑是刻意的(见上面说明):mask 只读 alpha。viewBox 与源文件一致(1024),
8083
- * 渲染尺寸由 CSS 的 mask-size 决定,所以这里不写宽高。
8084
- */
8085
- function navIconMaskSvg() {
8086
- return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="#000">'
8087
- + '<path d="M592 336h-416c-52.928 0-96 43.072-96 96v416c0 52.928 43.072 96 96 96h416c52.928 0 96-43.072 96-96v-416c0-52.928-43.072-96-96-96z m32 512a32 32 0 0 1-32 32h-416c-17.632 0-32-14.336-32-32v-416c0-17.632 14.368-32 32-32h416c17.664 0 32 14.368 32 32v416z"/>'
8088
- + '<path d="M720 208h-416a32 32 0 0 0 0 64h416c17.664 0 32 14.368 32 32v416a32 32 0 1 0 64 0v-416c0-52.928-43.072-96-96-96zM528 752h-288a32 32 0 1 0 0 64h288a32 32 0 1 0 0-64z"/>'
8089
- + '<path d="M848 80h-416a32 32 0 0 0 0 64h416c17.664 0 32 14.368 32 32v416a32 32 0 1 0 64 0v-416c0-52.928-43.072-96-96-96z"/>'
8090
- + '</svg>'
8091
- }
8092
-
8093
- /** mask 的 data URL(运行时编码,不手写转义)。 */
8094
- function navIconMaskUrl(svg) {
8095
- return 'data:image/svg+xml,' + encodeURIComponent(svg || navIconMaskSvg())
8096
- }
8097
-
8098
- /**
8099
- * 这一行是不是本插件的。
8100
- *
8101
- * 纯函数,也是这套逻辑**唯一**的判定:可见文字等于宿主此刻正在投影的本分区
8102
- * label。空 label 一律不匹配 —— 语言没解析出来时不能把整条 nav 都认下来。
8103
- */
8104
- function isOwnNavRow(rowText, wantedLabel) {
8105
- var wanted = String(wantedLabel == null ? '' : wantedLabel).trim()
8106
- if (wanted.length === 0) return false
8107
- return String(rowText == null ? '' : rowText).trim() === wanted
8108
- }
8109
-
8110
- /**
8111
- * 标记行的样式:藏掉宿主的齿轮,在 ::before 上画我们的图。
8112
- *
8113
- * 16px 与宿主那排字形同尺寸(它的 navIcon 走 size: 16),位置由 flex 排在
8114
- * 标签之前 —— 按钮本身是 flex 行,::before 作为第一个子元素天然就位。
8115
- */
8116
- function navIconCss(maskUrl) {
8117
- return [
8118
- '[' + NAV_ICON_MARKER + '] > svg { display: none; }',
8119
- '[' + NAV_ICON_MARKER + ']::before {',
8120
- " content: '';",
8121
- ' flex: none;',
8122
- ' width: 16px;',
8123
- ' height: 16px;',
8124
- ' background-color: currentColor;',
8125
- ' -webkit-mask-image: url("' + maskUrl + '");',
8126
- ' mask-image: url("' + maskUrl + '");',
8127
- ' -webkit-mask-repeat: no-repeat;',
8128
- ' mask-repeat: no-repeat;',
8129
- ' -webkit-mask-position: center;',
8130
- ' mask-position: center;',
8131
- ' -webkit-mask-size: 16px 16px;',
8132
- ' mask-size: 16px 16px;',
8133
- '}'
8134
- ].join('\n')
8135
- }
8136
-
8137
- /**
8138
- * 装上侧栏图标。
8139
- *
8140
- * @param ctx 客户端上下文(effect 的归属者)。
8141
- * @param resolveLabel 本分区当前 label —— 与 settings.section 注册时传的是
8142
- * 同一个 thunk,所以切语言时两边永远一致(label 变了,判据跟着变,不会认错行)。
8143
- */
8144
- function installSettingsNavIcon(ctx, resolveLabel) {
8145
- if (typeof document === 'undefined') return
8146
- ctx.effect(() => {
8147
- const tag = document.createElement('style')
8148
- tag.textContent = navIconCss(navIconMaskUrl())
8149
- document.head.appendChild(tag)
8150
- let disposed = false
8151
- let scheduled = false
8152
- const sync = () => {
8153
- scheduled = false
8154
- if (disposed) return
8155
- const wanted = resolveLabel()
8156
- const rows = document.querySelectorAll(NAV_ROW_SELECTOR)
8157
- for (let i = 0; i < rows.length; i += 1) {
8158
- const row = rows[i]
8159
- if (isOwnNavRow(row.textContent, wanted)) row.setAttribute(NAV_ICON_MARKER, '')
8160
- else row.removeAttribute(NAV_ICON_MARKER)
8161
- }
8162
- }
8163
- // 宿主每次重绘面板(打开/关闭、切语言、内容变化)都会重建那几行,
8164
- // 重建后我们换掉的齿轮会被 React 改回去 —— 所以必须能重新贴。
8165
- // queueMicrotask 合批:一次交互往往连触发多轮 mutation,不必每条都扫一遍。
8166
- const schedule = () => {
8167
- if (scheduled || disposed) return
8168
- scheduled = true
8169
- queueMicrotask(sync)
8170
- }
8171
- sync()
8172
- const observer = new MutationObserver(schedule)
8173
- observer.observe(document.body, { childList: true, subtree: true, characterData: true })
8174
- return () => {
8175
- disposed = true
8176
- observer.disconnect()
8177
- const marked = document.querySelectorAll('[' + NAV_ICON_MARKER + ']')
8178
- for (let i = 0; i < marked.length; i += 1) marked[i].removeAttribute(NAV_ICON_MARKER)
8179
- tag.remove()
8180
- }
8181
- }, 'dsh-plugin-tool-management: settings nav icon')
8182
- }
8183
-
8184
- // 调用点放在本片末尾(见上面 ⚠️ 那段):必须在这些 const 初始化之后。
8185
- //
8186
- // 整段包在 try 里:侧栏图标是**纯装饰**,取不到 DOM 或宿主换了面板结构时最坏
8187
- // 应该只是"还是那颗齿轮",绝不能把 apply 带崩 —— 2026-10-18 那次 TDZ 就是
8188
- // 一个装饰性功能让整个宿主 boot 失败("entry did not activate")。
8189
- try {
8190
- installSettingsNavIcon(ctx, function () { return t('nav.title') })
8191
- } catch (e) {
8192
- try { console.warn('[dsh-plugin-tool-management] 设置侧栏图标不可用,沿用宿主默认图标:' + errMsg(e)) } catch (e2) { /* 控制台不可用 */ }
8193
- }
8187
+
8188
+ // ── 设置侧栏「工具管理」那一行的图标(2026-10-18 起,2026-11-04 改走官方插槽)──
8189
+ //
8190
+ // 0.2.2-rc.1 起宿主提供了 `settings.section.icon` 这个 slot:
8191
+ // dsh-client-ui-settings-general 的 SettingsPanel 渲染每一行时调用
8192
+ // renderSlot('settings.section.icon', { size, active }, { only: row.id, fallback: navIcon(row.id) })
8193
+ // 只要注册 id 与 `settings.section` 的 id 相同,就能拿到自己的字形;没注册的 id
8194
+ // 仍旧回落到宿主那张封闭名单(account / models / agent-presets / plugins /
8195
+ // archived-sessions),其余一律是默认齿轮。
8196
+ //
8197
+ // 为什么改掉旧实现:0.2.1 及以前没有这个 slot,本插件用的是「CSS 藏掉宿主 svg、
8198
+ // 在 ::before 上画自己的图」的 DOM 接管法(dshmarket / dsh-better-sidebar 的先例)。
8199
+ // 0.2.2 把图标从 `button > svg` 改成了 `button > span.navIcon > svg`,那条
8200
+ // `> svg` 选择器随之失配 —— 宿主的齿轮没被藏住,于是同一行并排出现「叠方块 + 齿轮」
8201
+ // 两个图标(2026-11-04 用户截图:工具管理 / 插件市场 / 侧边卡片都是这个症状,
8202
+ // 后两家用的也是同一套接管法)。既然官方把插槽开出来了,MutationObserver 那套
8203
+ // 搬砖就该整段删掉,而不是再补一条更宽的选择器去猜宿主的 DOM。
8204
+ //
8205
+ // 图形与 docs/images/icon.svg 同源(三层叠放方块,1024 视图框),但这里内联 path:
8206
+ // 客户端 bundle 是单文件,没有加载外部资源的通道。`fill: currentColor` 让它在
8207
+ // 选中 / 悬停 / 切主题时跟旁边那排宿主图标一起变色(旧实现用 mask 绕的也是这件事)。
8208
+
8209
+ /**
8210
+ * 本插件设置分区的 id。
8211
+ *
8212
+ * `settings.section` 与 `settings.section.icon` 两个注册点**必须同值**:
8213
+ * 宿主按 `only: row.id` 取图标,对不上就永远不渲染。所以这里只留一份字面量,
8214
+ * 41 片注册分区时引用它 —— 两处各写一遍迟早会漂移成「图标消失但没人报错」。
8215
+ */
8216
+ var SETTINGS_SECTION_ID = 'dsm-tools'
8217
+
8218
+ /** 导航字形的三段 path(取自 docs/images/icon.svg,未改坐标)。 */
8219
+ var SETTINGS_NAV_ICON_PATHS = [
8220
+ 'M592 336h-416c-52.928 0-96 43.072-96 96v416c0 52.928 43.072 96 96 96h416c52.928 0 96-43.072 96-96v-416c0-52.928-43.072-96-96-96z m32 512a32 32 0 0 1-32 32h-416c-17.632 0-32-14.336-32-32v-416c0-17.632 14.368-32 32-32h416c17.664 0 32 14.368 32 32v416z',
8221
+ 'M720 208h-416a32 32 0 0 0 0 64h416c17.664 0 32 14.368 32 32v416a32 32 0 1 0 64 0v-416c0-52.928-43.072-96-96-96zM528 752h-288a32 32 0 1 0 0 64h288a32 32 0 1 0 0-64z',
8222
+ 'M848 80h-416a32 32 0 0 0 0 64h416c17.664 0 32 14.368 32 32v416a32 32 0 1 0 64 0v-416c0-52.928-43.072-96-96-96z'
8223
+ ]
8224
+
8225
+ /**
8226
+ * 侧栏字形组件。
8227
+ *
8228
+ * 宿主传 `size`(正整数,当前是 16)与 `active`(是否选中)。这里只吃 size:
8229
+ * 选中态的着色由宿主按钮的 color 决定,`currentColor` 自动跟随,不需要分支。
8230
+ * `display: block` 是给行内基线留的余量 —— span.navIcon 在 0.2.2 是 flex,
8231
+ * 但 flex 容器里的 inline svg 仍可能多出几像素行高。
8232
+ */
8233
+ function SettingsNavIcon(props) {
8234
+ var size = props && typeof props.size === 'number' && props.size > 0 ? props.size : 16
8235
+ return React.createElement('svg', {
8236
+ viewBox: '0 0 1024 1024',
8237
+ width: size,
8238
+ height: size,
8239
+ fill: 'currentColor',
8240
+ 'aria-hidden': 'true',
8241
+ focusable: 'false',
8242
+ style: { display: 'block' }
8243
+ }, SETTINGS_NAV_ICON_PATHS.map(function (d, i) {
8244
+ return React.createElement('path', { key: i, d: d })
8245
+ }))
8246
+ }
8247
+
8248
+ // 注册。放在 41 片注册 `settings.section` 之前也无妨:slot 是列表,宿主渲染时
8249
+ // 才按 id 配对,两边的注册顺序与面板打开顺序都不影响结果。
8250
+ //
8251
+ // 整段包在 try 里:图标是纯装饰。宿主若还没有这个 slot(0.2.1 及以前),最坏
8252
+ // 结果应该是「还是那颗默认齿轮」,绝不能把 apply 带崩 —— 2026-10-18 那次 TDZ
8253
+ // 就是一个装饰性功能让整个宿主 boot 失败("entry did not activate")。
8254
+ try {
8255
+ slots.inject('settings.section.icon', function () {
8256
+ return slots.register(
8257
+ { name: 'settings.section.icon', id: SETTINGS_SECTION_ID, order: 16 },
8258
+ function (props) { return SettingsNavIcon(props) }
8259
+ )
8260
+ })
8261
+ } catch (e) {
8262
+ try { console.warn('[dsh-plugin-tool-management] 设置侧栏图标不可用,沿用宿主默认图标:' + errMsg(e)) } catch (e2) { /* 控制台不可用 */ }
8263
+ }
8194
8264
 
8195
8265
  // 顶部栏右上角那一行(0.21.2):版本号 · 检查更新 · GitHub,横排贴住作用域行右端。
8196
8266
  //
@@ -9184,12 +9254,13 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
9184
9254
  key: 'menu',
9185
9255
  label: mt('row.menu', { name: row.serverName }),
9186
9256
  items: [
9187
- // 全局层的「统一关闭」:只在真有其他对话 / 工作区在临时用它时出现(没有租约时
9257
+ { key: 'edit', label: mt('mcp.btn.edit'), disabled: actDisabled, onClick: () => openEdit(row) },
9258
+ { key: 'remove', label: mt('mcp.btn.remove'), danger: true, disabled: actDisabled, onClick: () => setConfirmRow(row) },
9259
+ // 全局层的「全部关闭」:只在真有其他对话 / 工作区在临时用它时出现(没有租约时
9188
9260
  // 普通开关就能停,菜单不必多一项)。它是一次性动作,不在菜单里留「恢复启用」。
9189
9261
  // 会话层没有这一项 —— 会话只能"看不到它",停整台机器是全局动作。
9262
+ // 放在**最后**(删除下面):它是停机动作,不是这一行的日常操作(用户 2026-11-06)。
9190
9263
  ...(scopeIsSession() || scopeLeaseCount('mcp', String(row.serverName || row.id)) <= 0 ? [] : [{ key: 'intent-stop', label: mt('mcp.intent.stop'), danger: true, disabled: actDisabled, onClick: () => setStopConfirm(row) }]),
9191
- { key: 'edit', label: mt('mcp.btn.edit'), disabled: actDisabled, onClick: () => openEdit(row) },
9192
- { key: 'remove', label: mt('mcp.btn.remove'), danger: true, disabled: actDisabled, onClick: () => setConfirmRow(row) },
9193
9264
  ],
9194
9265
  }))
9195
9266
  return React.createElement(ListRow, {
@@ -10310,9 +10381,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
10310
10381
  key: 'menu',
10311
10382
  label: t('row.menu', { name: p.id }),
10312
10383
  items: [
10313
- ...(scopeLeaseCount('quickPrompts', p.id) > 0 ? [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy !== null || state.anyLocked === true, onClick: function () { setQuickStop({ id: p.id }) } }] : []),
10314
10384
  { key: 'edit', label: t('agm.btn.edit'), disabled: busy !== null || scopeIsSession(), title: scopeIsSession() ? promptBlockTitle : undefined, onClick: function () { openQuickEdit(p) } },
10315
10385
  { key: 'delete', label: t('agm.btn.delete'), danger: true, disabled: busy !== null || promptWriteBlocked, title: promptWriteBlocked ? promptBlockTitle : undefined, onClick: function () { setQuickConfirm({ id: p.id }) } },
10386
+ // 「全部关闭」放在最后(删除下面):它是停机动作(用户 2026-11-06)。
10387
+ ...(scopeLeaseCount('quickPrompts', p.id) > 0 ? [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy !== null || state.anyLocked === true, onClick: function () { setQuickStop({ id: p.id }) } }] : []),
10316
10388
  ],
10317
10389
  }),
10318
10390
  ],
@@ -10889,7 +10961,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
10889
10961
  ])
10890
10962
  }
10891
10963
  slots.inject('settings.section', () => slots.register(
10892
- { name: 'settings.section', id: 'dsm-tools', order: 16, label: function () { return t('nav.title') }, locale: NS },
10964
+ { name: 'settings.section', id: SETTINGS_SECTION_ID, order: 16, label: function () { return t('nav.title') }, locale: NS },
10893
10965
  () => React.createElement(ToolsSection)
10894
10966
  ))
10895
10967
 
@@ -12799,8 +12871,240 @@ function enabledMemoryCount(rules) {
12799
12871
  var tone = props.tone === 'ok' ? ' dsm-tag-on' : props.tone === 'bad' ? ' dsm-tag-off' : props.tone === 'warn' ? ' dsm-tag-warn' : ''
12800
12872
  return h('span', { className: 'dsm-tag' + tone, title: props.title }, props.text)
12801
12873
  }
12874
+ /** 租约浮窗的最大高度(`measure` 与 CSS 共用同一个上限)。 */
12875
+ var LEASE_POP_MAX_H = 320
12802
12876
  /**
12803
- * 租约徽章(0.21.2):**六个域共用的唯一出口** —— 同一 HTML 结构、同一 class 族、同一 tooltip。
12877
+ * 浮窗里的分组:按**工作区**归拢,同一个工作区的对话挨在一起。
12878
+ *
12879
+ * 为什么按工作区分组(用户 2026-11-05):认领是逐个对话记的,但用户找的是"哪个项目
12880
+ * 在用它" —— 同一个工作区的那几个对话排成一块,才看得出"是这个项目在跑"。
12881
+ * 组内按标题排;没有工作区的那些排在最后(它们不属于任何项目)。
12882
+ *
12883
+ * 分组键取**归一化**过的路径(小写、去尾分隔符):同一个目录在清单里可能写成
12884
+ * `C:\a\b` 与 `c:\a\b\` 两种样子 —— 不归一就会分成两块,组头还同名(用户 2026-11-05 实测)。
12885
+ */
12886
+ function leaseGroups(details) {
12887
+ var byCwd = Object.create(null)
12888
+ var order = []
12889
+ var nameOf = Object.create(null)
12890
+ details.forEach(function (d) {
12891
+ var cwd = String((d && d.cwd) || '')
12892
+ var key = cwd.replace(/[\\/]+$/, '').toLowerCase()
12893
+ if (!byCwd[key]) { byCwd[key] = []; order.push(key) }
12894
+ byCwd[key].push(d)
12895
+ if (cwd !== '' && nameOf[key] === undefined) nameOf[key] = cwd
12896
+ })
12897
+ order.sort(function (a, b) {
12898
+ if (a === '') return 1
12899
+ if (b === '') return -1
12900
+ return a < b ? -1 : a > b ? 1 : 0
12901
+ })
12902
+ return order.map(function (key) {
12903
+ var rows = byCwd[key].slice().sort(function (x, y) {
12904
+ var xt = String((x && x.title) || '')
12905
+ var yt = String((y && y.title) || '')
12906
+ return xt < yt ? -1 : xt > yt ? 1 : 0
12907
+ })
12908
+ return { cwd: nameOf[key] === undefined ? '' : nameOf[key], rows: rows }
12909
+ })
12910
+ }
12911
+ /**
12912
+ * 租约徽章 + 悬浮浮窗:**临时运行的是哪几个对话**。
12913
+ *
12914
+ * 徽章正文只说"几个对话"(`临时运行 · N 个对话`),用户真正要问的是"是哪几个"——
12915
+ * 浮窗按工作区分组列出那些对话:组头是工作区(白),组内每行一个对话(灰)。
12916
+ *
12917
+ * 浮窗用 `position:fixed` + **视口坐标**:徽章所在的列表行是 `overflow:hidden`
12918
+ * (`.dsm-listrow-meta`),绝对定位的浮层会被裁掉(与 `SourceSelect` 的菜单同一条理由)。
12919
+ *
12920
+ * @param {{ t: Function, count: number, runtime: boolean, domain: string, key: string, details: Array<{id?: string, title?: string, cwd?: string, keys?: Array<{domain: string, key: string}>}>, onRelease?: Function }} props
12921
+ */
12922
+ function LeaseTagBadge(props) {
12923
+ var t = props.t
12924
+ var runtime = props.runtime === true
12925
+ var details = props.details || []
12926
+ var groups = leaseGroups(details)
12927
+ // 工作区粒度:认领是**按工作区**记的 —— 徽章上的个数得跟浮窗里的行数同一个单位,
12928
+ // 否则会出现「2 个对话」配 1 行工作区(看着像漏了一条)。用户 2026-11-06。
12929
+ var workspaceMode = scopeIsWorkspace()
12930
+ var count = workspaceMode ? groups.length : props.count
12931
+ var openState = React.useState(false), open = openState[0], setOpen = openState[1]
12932
+ var posState = React.useState(null), pos = posState[0], setPos = posState[1]
12933
+ var busyState = React.useState(null), busyId = busyState[0], setBusyId = busyState[1]
12934
+ var ref = React.useRef(null)
12935
+ var popRef = React.useRef(null)
12936
+ var closeTimer = React.useRef(null)
12937
+ var label = workspaceMode
12938
+ ? (runtime ? t('scope.intent.leaseWs', { count: count }) : t('scope.view.leaseWs', { count: count }))
12939
+ : (runtime ? t('scope.intent.lease', { count: count }) : t('scope.view.lease', { count: count }))
12940
+ /**
12941
+ * 关掉浮窗要**等一等**:指针从徽章移到浮窗的路上有一段空白(浮窗在徽章下方 6px),
12942
+ * 一移开就收的话,指针还没走到那颗「×」浮窗就没了(用户 2026-11-05 实测)。
12943
+ * 进了浮窗本体就把这个计时撤掉 —— 那是"用户还在看它"的明确信号。
12944
+ */
12945
+ function cancelClose() {
12946
+ if (closeTimer.current !== null) { clearTimeout(closeTimer.current); closeTimer.current = null }
12947
+ }
12948
+ function scheduleClose() {
12949
+ cancelClose()
12950
+ closeTimer.current = setTimeout(function () {
12951
+ closeTimer.current = null
12952
+ setOpen(false)
12953
+ setPos(null)
12954
+ }, 320)
12955
+ }
12956
+ React.useEffect(function () {
12957
+ return function () { if (closeTimer.current !== null) clearTimeout(closeTimer.current) }
12958
+ }, [])
12959
+ /**
12960
+ * 放掉**一个**对话的认领:只让它不再临时运行,其它对话照旧。
12961
+ *
12962
+ * 认领是**逐个对话**记的(会话层那条覆盖),所以放掉一个就是在那条对话的会话层
12963
+ * 写一次「关」—— 服务端随即重算租约:最后一个认领者走了,连接 / 来源就跟着停。
12964
+ * 工作区粒度下这条覆盖落在工作区上,同工作区的对话一起不再用(标题里说清楚)。
12965
+ */
12966
+ function release(d, label) {
12967
+ if (busyId !== null) return
12968
+ var id = String((d && d.id) || '')
12969
+ var name = String(label || (d && d.title) || id)
12970
+ // 调用方自带放掉动作时用它(场景层要的是"退出场景",不是"关掉某一格")。
12971
+ if (typeof props.onRelease === 'function') {
12972
+ props.onRelease(d)
12973
+ return
12974
+ }
12975
+ // 这一条认领落在哪几格,由**服务端**随名单一起给(`keys`)—— 来源格可能是"来源
12976
+ // 自己 + 底下那几条技能",客户端不必(也不该)自己再猜一遍。
12977
+ var keys = (d && Array.isArray(d.keys) && d.keys.length > 0)
12978
+ ? d.keys
12979
+ : [{ domain: props.domain, key: props.key }]
12980
+ setBusyId(id)
12981
+ keys.reduce(function (chain, k) {
12982
+ return chain.then(function () {
12983
+ return apiCall('scope-set', { sessionId: id, domain: String(k.domain), key: String(k.key), value: false })
12984
+ })
12985
+ }, Promise.resolve()).then(function (res) {
12986
+ if (!res || res.ok === false) {
12987
+ showPluginToast(t('scope.lease.releaseFailed', { title: name, error: scopeErrorText(res) || t('scope.lease.unknownError') }), 'err')
12988
+ return
12989
+ }
12990
+ // 本地先把这一条摘掉(全局快照有 150ms TTL,紧接着的重拉可能还是写前那一份)。
12991
+ scopeForgetLeaseSession(props.domain, props.key, id)
12992
+ // 工作区粒度放掉的是**整个工作区**(同工作区的对话共用那份覆盖)—— 提示要说工作区,
12993
+ // 别让用户以为只关了一个对话。
12994
+ showPluginToast(workspaceMode ? t('scope.lease.releasedWs', { title: name }) : t('scope.lease.released', { title: name }), 'ok')
12995
+ setTimeout(function () { refreshScope({ silent: true }) }, 400)
12996
+ }).catch(function (e) {
12997
+ showPluginToast(t('scope.lease.releaseFailed', { title: name, error: scopeErrorText(e) || t('scope.lease.unknownError') }), 'err')
12998
+ }).then(function () { setBusyId(null) })
12999
+ }
13000
+ /**
13001
+ * 量一次徽章的位置,算出浮窗放哪儿。
13002
+ *
13003
+ * 上下方向按"下方装不下且上方更宽裕才上翻"判;高度夹到那一侧的可用空间,
13004
+ * 夹住之后浮窗自己滚 —— 与 `SourceSelect` 的菜单同一条口径。
13005
+ */
13006
+ function measure() {
13007
+ var el = ref.current
13008
+ if (!el) return
13009
+ var box = el.getBoundingClientRect()
13010
+ var gap = 6
13011
+ var need = Math.min(details.length * 26 + 56, LEASE_POP_MAX_H)
13012
+ var below = window.innerHeight - box.bottom - gap - 8
13013
+ var above = box.top - gap - 8
13014
+ var nextUp = below < need && above > below
13015
+ // 浮窗比徽章宽得多:按它自己的宽度靠右,别让它顶出窗口。
13016
+ var width = popRef.current ? popRef.current.offsetWidth : 320
13017
+ var next = {
13018
+ left: Math.max(8, Math.min(box.left, window.innerWidth - width - 8)),
13019
+ top: nextUp ? null : box.bottom + gap,
13020
+ bottom: nextUp ? window.innerHeight - box.top + gap : null,
13021
+ maxHeight: Math.max(120, Math.min(need, nextUp ? above : below)),
13022
+ }
13023
+ // 位置没变就别换新对象(滚动时每次都换会让整个浮窗重渲染一遍)。
13024
+ setPos(function (prev) {
13025
+ if (prev === null) return next
13026
+ return prev.left === next.left && prev.top === next.top && prev.bottom === next.bottom && prev.maxHeight === next.maxHeight ? prev : next
13027
+ })
13028
+ }
13029
+ React.useEffect(function () {
13030
+ if (!open) return undefined
13031
+ measure()
13032
+ // 页面滚动 / 窗口尺寸变了,浮窗要跟着徽章走 —— 否则它会停在原地,指着空气。
13033
+ var onMove = function () { measure() }
13034
+ window.addEventListener('scroll', onMove, true)
13035
+ window.addEventListener('resize', onMove)
13036
+ return function () {
13037
+ window.removeEventListener('scroll', onMove, true)
13038
+ window.removeEventListener('resize', onMove)
13039
+ }
13040
+ }, [open])
13041
+ var popup = null
13042
+ if (open && details.length > 0) {
13043
+ var style = { left: '0px', top: '0px', bottom: 'auto', maxHeight: '240px', visibility: 'hidden' }
13044
+ if (pos !== null) {
13045
+ style.left = pos.left + 'px'
13046
+ style.visibility = 'visible'
13047
+ style.maxHeight = pos.maxHeight + 'px'
13048
+ style.top = pos.top === null || pos.top === undefined ? 'auto' : pos.top + 'px'
13049
+ style.bottom = pos.bottom === null || pos.bottom === undefined ? 'auto' : pos.bottom + 'px'
13050
+ }
13051
+ var releaseBtn = function (d, key, label) {
13052
+ return h('button', {
13053
+ key: key,
13054
+ type: 'button',
13055
+ className: 'dsm-lease-pop-x',
13056
+ disabled: busyId !== null,
13057
+ title: workspaceMode ? t('scope.lease.releaseWorkspace') : t('scope.lease.release'),
13058
+ 'aria-label': workspaceMode ? t('scope.lease.releaseWorkspace') : t('scope.lease.release'),
13059
+ onClick: function (e) { if (e && e.stopPropagation) e.stopPropagation(); release(d, label) },
13060
+ }, '×')
13061
+ }
13062
+ // 工作区粒度:认领是**按工作区**记的(同工作区的对话共用一份覆盖)—— 逐个列会话标题
13063
+ // 只是噪声,列出工作区就够了(用户 2026-11-05)。
13064
+ var body = workspaceMode
13065
+ ? groups.map(function (g) {
13066
+ var d = g.rows[0]
13067
+ var wsName = g.cwd !== '' ? scopeWorkspaceName(g.cwd) : t('scope.lease.noWorkspace')
13068
+ return h('div', { key: 'w:' + g.cwd, className: 'dsm-lease-pop-item' },
13069
+ h('span', { className: 'dsm-lease-pop-ws', title: g.cwd }, wsName),
13070
+ d !== undefined ? releaseBtn(d, 'x', wsName) : null)
13071
+ })
13072
+ : groups.map(function (g, gi) {
13073
+ return h('div', { key: 'g' + gi, className: 'dsm-lease-pop-group' },
13074
+ h('div', { className: 'dsm-lease-pop-ws', title: g.cwd }, g.cwd !== '' ? scopeWorkspaceName(g.cwd) : t('scope.lease.noWorkspace')),
13075
+ g.rows.map(function (d, ri) {
13076
+ return h('div', { key: 'r' + ri, className: 'dsm-lease-pop-item' },
13077
+ h('span', { className: 'dsm-lease-pop-title', title: String((d && d.title) || '') }, String((d && d.title) || (d && d.id) || '')),
13078
+ releaseBtn(d, 'x'))
13079
+ }))
13080
+ })
13081
+ popup = h('div', {
13082
+ className: 'dsm-lease-pop',
13083
+ style: style,
13084
+ ref: popRef,
13085
+ // 指针进了浮窗就别收:否则指不到那颗「×」。
13086
+ onMouseEnter: cancelClose,
13087
+ onMouseLeave: scheduleClose,
13088
+ // 浮窗在徽章里面:点它不该触发行上的动作。
13089
+ onClick: function (e) { if (e && e.stopPropagation) e.stopPropagation() },
13090
+ }, body)
13091
+ // 浮窗挂到 `document.body` 上:留在面板里会被祖先的 `overflow:hidden` 裁掉
13092
+ // (来源卡片就是 `overflow:hidden` —— 浮窗探出去的那截被裁掉,底下一张卡片的
13093
+ // 内容透上来,就是用户看到的「穿模」,用户 2026-11-05 实测)。
13094
+ // 拿不到 react-dom 就退回就地渲染:功能在,只是可能被裁。
13095
+ if (ReactDOM && typeof ReactDOM.createPortal === 'function' && typeof document !== 'undefined' && document.body) {
13096
+ popup = ReactDOM.createPortal(popup, document.body)
13097
+ }
13098
+ }
13099
+ return h('span', {
13100
+ className: 'dsm-tag dsm-tag-lease',
13101
+ ref: ref,
13102
+ onMouseEnter: function () { cancelClose(); setOpen(true) },
13103
+ onMouseLeave: scheduleClose,
13104
+ }, [label, popup])
13105
+ }
13106
+ /**
13107
+ * 租约徽章(0.21.2):**六个域共用的唯一出口** —— 同一 HTML 结构、同一 class 族、同一浮窗。
12804
13108
  *
12805
13109
  * 为什么必须共用一个函数:这六处的文案与判据曾经各写一份(技能来源用 `scope.intent.lease`,
12806
13110
  * 其余五处干脆没有),口径一分叉就会出现"同一件事在 MCP 页写着临时运行、在记忆页什么都不说"。
@@ -12822,11 +13126,13 @@ function enabledMemoryCount(rules) {
12822
13126
  if (!(count > 0)) return null
12823
13127
  if (scopeIsSession()) return null
12824
13128
  var runtime = props.runtime === true
12825
- return h('span', {
13129
+ return h(LeaseTagBadge, {
12826
13130
  key: props.tagKey || undefined,
12827
- className: 'dsm-tag dsm-tag-lease',
12828
- title: runtime ? t('scope.intent.leaseHint', { count: count }) : t('scope.view.leaseHint', { count: count }),
12829
- }, runtime ? t('scope.intent.lease', { count: count }) : t('scope.view.lease', { count: count }))
13131
+ t: t,
13132
+ count: count,
13133
+ runtime: runtime,
13134
+ details: scopeLeaseDetails(props.domain, props.key),
13135
+ })
12830
13136
  }
12831
13137
 
12832
13138
  // ---------- MCP 导入 / 导出(0.15.0 A1;0.20.x 起收 dsh 补丁片段)------------------
@@ -13780,9 +14086,10 @@ function enabledMemoryCount(rules) {
13780
14086
  var actions = [];
13781
14087
  var menuItems = [];
13782
14088
  var stopLease = scopeLeaseCount('skills', skillKey);
13783
- if (stopLease > 0) menuItems.push({ key: "stop", label: t("scope.unifiedClose"), danger: true, disabled: busy || scopeWriteLocked(anyLocked), onClick: function () { setModal({ type: "skill-stop-confirm", key: skillKey, name: skillName }); } });
13784
14089
  if (root.mutable === true && !skill.shadowedBy) menuItems.push({ key: "edit", label: t("btn.edit"), disabled: busy || anyLocked, onClick: function () { openSkillEdit(root, skill); } });
13785
14090
  if (root.deletable === true) menuItems.push({ key: "trash", label: t("btn.trash"), danger: true, disabled: busy || anyLocked, onClick: function () { setModal({ type: "trash-confirm", root: root.key, name: skill.name }); } });
14091
+ // 「全部关闭」放在最后(删除下面):它是停机动作(用户 2026-11-06)。
14092
+ if (stopLease > 0) menuItems.push({ key: "stop", label: t("scope.unifiedClose"), danger: true, disabled: busy || scopeWriteLocked(anyLocked), onClick: function () { setModal({ type: "skill-stop-confirm", key: skillKey, name: skillName }); } });
13786
14093
  /**
13787
14094
  * 「启用这个」写的是「同名技能该用哪个**来源**」的首选表(`/prefer` →
13788
14095
  * `preferredSkills[名] = 来源 key`,`shadowedBy.root === 本行来源` 即表示撞名发生在
@@ -13837,11 +14144,13 @@ function enabledMemoryCount(rules) {
13837
14144
  var rootCount = root.count == null ? root.skills.length : root.count;
13838
14145
  var srcOnHere = srcOnInLayer(root);
13839
14146
  // 全局意图 / 租约:来源关闭后还有会话在用时挂「临时运行 · N 个对话」;
13840
- // 旧版本留下的 blocked 仍显示「已统一关闭」,并给一个恢复入口。
14147
+ // 旧版本留下的 blocked 仍显示「已全部关闭」,并给一个恢复入口。
13841
14148
  // 会话层不显示(那一层只回答"这个对话看得到哪些技能")。
14149
+ // **默认来源(官方内置 / DSH 技能)也挂**:它们没有来源级开关,租约落在底下的
14150
+ // 技能上 —— 组头不标,用户只会在某一行技能上看到徽章(用户 2026-11-05 报障)。
13842
14151
  var rootKeyHere = String(root.key || "");
13843
14152
  var intentHere = scopeIntentOf('skillSources', rootKeyHere);
13844
- var intentTag = scopeIsSession() || root.defaultSource === true ? null
14153
+ var intentTag = scopeIsSession() ? null
13845
14154
  : intentHere === 'blocked' ? h("span", { key: "intent", className: "dsm-tag dsm-tag-off", title: t("scope.intent.blockedHint") }, t("scope.intent.blocked"))
13846
14155
  : h(react.Fragment, { key: "intent" }, leaseTag({ t: t, domain: 'skillSources', key: rootKeyHere, runtime: true }));
13847
14156
  var section = h("section", { key: root.key, className: "dsm-source" }, h("div", { className: "dsm-source-head dsm-source-head-pin" }, h("button", { type: "button", className: "dsm-source-head-main", "aria-expanded": open, onClick: function () { setExpanded(Object.assign({}, expanded, { [root.key]: !baseOpen })); } }, h("span", { className: "dsm-source-title", title: displayName }, displayName), h("span", { className: "dsm-count" }, String(rootCount)), h("span", { className: "dsm-tag " + (root.scope === "project" ? "dsm-tag-on" : root.defaultSource === true ? "" : srcOnHere ? "dsm-tag-on" : "") }, root.scope === "project" ? t("status.project") : root.defaultSource === true ? t("status.manageable") : t(srcOnHere ? "status.source.on" : "status.source.off")), intentTag, root.scope === "project" ? h("span", { className: "dsm-tag" }, t("status.rank", { rank: root.rank })) : null, h("span", { className: "dsm-path", title: root.path }, root.path)), (function () {
@@ -15786,6 +16095,8 @@ function enabledMemoryCount(rules) {
15786
16095
  name: m.name,
15787
16096
  desc: m.description ? clipText(m.description, MEM_DESC_MAX) : null,
15788
16097
  descTitle: m.description || null,
16098
+ // 单行:与下面的真记忆同一形状(用户 2026-11-06)。
16099
+ compact: true,
15789
16100
  meta: React.createElement(React.Fragment, null,
15790
16101
  React.createElement('span', { className: 'dsm-tag', title: t('scenes.mem.pendingTagTitle') }, t('scenes.mem.pendingTag')),
15791
16102
  attachMark((m.files || []).length, (m.files || []).reduce(function (sum, f) { return sum + Number(f.size || 0) }, 0))),
@@ -15813,6 +16124,8 @@ function enabledMemoryCount(rules) {
15813
16124
  // 记忆描述是自由正文的首行,可能很长:截断到 MEM_DESC_MAX,全文放 title。
15814
16125
  desc: m.description ? clipText(m.description, MEM_DESC_MAX) : null,
15815
16126
  descTitle: m.description || null,
16127
+ // 单行:描述排在名字右边(用户 2026-11-06)。
16128
+ compact: true,
15816
16129
  // 带附件的 bundle 记忆标一枚回形针 + 个数(见 attachMark)。
15817
16130
  meta: attachMark(m.attach && m.attach.count, m.attach && m.attach.bytes),
15818
16131
  onChange: function () { toggleMemory(String(m.id)) },
@@ -16181,8 +16494,10 @@ function enabledMemoryCount(rules) {
16181
16494
  checked: selected,
16182
16495
  name: server.name,
16183
16496
  desc: desc,
16497
+ // 单行:名字与工具数并排,标签与「编辑」在右边 —— 一屏多看几台(用户 2026-11-06)。
16498
+ compact: true,
16184
16499
  meta: [
16185
- server.live ? null : React.createElement('span', { key: 'nr', className: 'dsm-tag dsm-tag-off' }, t('scenes.mcp.notRunning')),
16500
+ server.live ? null : React.createElement('span', { key: 'nr', className: 'dsm-tag dsm-tag-quiet' }, t('scenes.mcp.notRunning')),
16186
16501
  specText ? React.createElement('span', { key: 'spec' }, specText) : null,
16187
16502
  hasNote ? React.createElement('span', { key: 'note', className: 'dsm-tag' }, t('scenes.mcp.hasNote')) : null,
16188
16503
  ],
@@ -16223,8 +16538,7 @@ function enabledMemoryCount(rules) {
16223
16538
  React.createElement('div', { className: 'dsm-budget-meta' },
16224
16539
  React.createElement('span', { className: 'dsm-label' }, t('scenes.mcp.noteLabel')),
16225
16540
  React.createElement('span', { className: 'dsm-char-count' + (String(noteVal || '').length > MCP_NOTE_MAX ? ' dsm-char-over' : '') }, String(noteVal || '').length + ' / ' + MCP_NOTE_MAX)),
16226
- React.createElement('input', { className: 'dsm-control', type: 'text', value: noteVal, maxLength: MCP_NOTE_MAX, placeholder: t('scenes.mcp.notePlaceholder'), onChange: function (e) { setMcpNote(server, e.target.value) } }),
16227
- React.createElement('p', { className: 'dsm-help' }, t('scenes.mcp.noteHint'))),
16541
+ React.createElement('input', { className: 'dsm-control', type: 'text', value: noteVal, maxLength: MCP_NOTE_MAX, placeholder: t('scenes.mcp.notePlaceholder'), onChange: function (e) { setMcpNote(server, e.target.value) } })),
16228
16542
  React.createElement('div', { className: 'dsm-field' },
16229
16543
  React.createElement('div', { className: 'dsm-mcp-edit-tools-head' },
16230
16544
  React.createElement('label', { className: 'dsm-label' }, t('scenes.mcp.toolsOf')),
@@ -16251,8 +16565,7 @@ function enabledMemoryCount(rules) {
16251
16565
  React.createElement('div', { className: 'dsm-pick-empty' }, t('scenes.mcp.noTools')),
16252
16566
  modal.drillError ? React.createElement('div', { className: 'dsm-seg-empty-error' }, modal.drillError) : null,
16253
16567
  React.createElement('div', { className: 'dsm-seg-empty-actions' },
16254
- React.createElement('button', { type: 'button', className: 'dsm-btn dsm-btn-secondary', disabled: drillTools === null, onClick: probeMcpTools }, t('scenes.mcp.probeTools')))),
16255
- React.createElement('div', { className: 'dsm-seg-foot' }, t('scenes.mcp.drillHint')))))
16568
+ React.createElement('button', { type: 'button', className: 'dsm-btn dsm-btn-secondary', disabled: drillTools === null, onClick: probeMcpTools }, t('scenes.mcp.probeTools')))))))
16256
16569
  }
16257
16570
  /** 段 2:技能集。 */
16258
16571
  /**
@@ -16293,17 +16606,74 @@ function enabledMemoryCount(rules) {
16293
16606
  */
16294
16607
  var pickable = function (x) { return !x.shadowed && x.loadable !== false }
16295
16608
  var pickableItems = allItems.filter(pickable)
16296
- var items = checkedFirst('skills', (function () {
16297
- var q = String(modal.skillQuery || '').trim().toLowerCase()
16298
- if (!q) return allItems
16609
+ var q = String(modal.skillQuery || '').trim().toLowerCase()
16610
+ var matches = function (x) {
16611
+ if (!q) return true
16299
16612
  // 搜索同时匹配技能名与来源名(用户按"来源"找技能是常见动作)。
16300
- return allItems.filter(function (x) {
16301
- var d = skillDisplay(x)
16302
- return (d.name + ' ' + d.source + ' ' + d.key).toLowerCase().indexOf(q) >= 0
16613
+ var d = skillDisplay(x)
16614
+ return (d.name + ' ' + d.source + ' ' + d.key).toLowerCase().indexOf(q) >= 0
16615
+ }
16616
+ /**
16617
+ * **按来源分组**(用户 2026-11-06):平铺按技能名排,一屏四十六条混在一起很乱。
16618
+ * 组的次序 = 技能页里的次序(服务端给的 `rootIndex`);组内按技能名排。
16619
+ */
16620
+ var groups = []
16621
+ var groupOf = {}
16622
+ allItems.forEach(function (x) {
16623
+ var d = skillDisplay(x)
16624
+ var rootKey = String((x && x.rootKey) || '')
16625
+ var g = groupOf[rootKey]
16626
+ if (!g) {
16627
+ g = { key: rootKey, label: d.source, rootIndex: Number(x.rootIndex) || 0, all: [], rows: [] }
16628
+ groupOf[rootKey] = g
16629
+ groups.push(g)
16630
+ }
16631
+ g.all.push(x)
16632
+ if (matches(x)) g.rows.push(x)
16633
+ })
16634
+ groups.sort(function (a, b) {
16635
+ if (a.rootIndex !== b.rootIndex) return a.rootIndex - b.rootIndex
16636
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0
16637
+ })
16638
+ // 没有(匹配到的)技能的目录不显示(用户 2026-11-06)。
16639
+ groups = groups.filter(function (g) { return g.rows.length > 0 })
16640
+ groups.forEach(function (g) {
16641
+ g.rows.sort(function (x, y) {
16642
+ var xn = String((x && x.name) || '')
16643
+ var yn = String((y && y.name) || '')
16644
+ return xn.localeCompare(yn)
16303
16645
  })
16304
- })(), function (x) { return String(x.key) },
16305
- function (x) { return !!sections.skills && sections.skills.indexOf(x.key) >= 0 })
16646
+ })
16306
16647
  var pickedCount = pickableItems.filter(function (x) { return sections.skills && sections.skills.indexOf(x.key) >= 0 }).length
16648
+ /** 展开状态:默认"这一组有勾选的就展开"(编辑时一眼看见自己选了什么)。 */
16649
+ function expandedOf(g, picked) {
16650
+ if (q) return true
16651
+ var saved = modal.skillExpanded
16652
+ if (saved && saved[g.key] !== undefined) return saved[g.key] === true
16653
+ return picked > 0
16654
+ }
16655
+ function setExpanded(key, open) {
16656
+ var next = Object.assign({}, modal.skillExpanded || {})
16657
+ next[key] = open === true
16658
+ setModal(Object.assign({}, modal, { skillExpanded: next }))
16659
+ }
16660
+ /** 组勾选框:全选 / 全不选这一整个来源。 */
16661
+ function toggleGroup(g, allChecked) {
16662
+ var list = sections.skills.slice()
16663
+ g.all.filter(pickable).forEach(function (x) {
16664
+ var i = list.indexOf(x.key)
16665
+ if (allChecked) { if (i >= 0) list.splice(i, 1) } else if (i < 0) list.push(x.key)
16666
+ })
16667
+ // 全不选就把这一组收起来(全选则展开)——「关闭后不显示里面的技能」。
16668
+ var nextExpanded = Object.assign({}, modal.skillExpanded || {})
16669
+ nextExpanded[g.key] = !allChecked
16670
+ // **一次写回**:两次 setModal 都拿同一份旧 modal,后一次会把前一次盖掉(勾选与
16671
+ // 展开会互相抵消)。
16672
+ setModal(Object.assign({}, modal, {
16673
+ sections: Object.assign({}, modalSections(), { skills: list }),
16674
+ skillExpanded: nextExpanded,
16675
+ }))
16676
+ }
16307
16677
  return editorGroupNode({
16308
16678
  title: t('memory.archive.skills'),
16309
16679
  count: defined ? t('scenes.seg.checked', { checked: pickedCount, total: pickableItems.length }) : t('scenes.archive.sectionOff'),
@@ -16319,28 +16689,60 @@ function enabledMemoryCount(rules) {
16319
16689
  hideFilter: !defined,
16320
16690
  body: !defined
16321
16691
  ? React.createElement('div', { className: 'dsm-pick-empty', title: t('scenes.skills.hint') }, t('scenes.skills.hint.short'))
16322
- : items.length
16323
- ? React.createElement('div', null, items.map(function (item) {
16324
- var d = skillDisplay(item)
16325
- var offered = pickable(item)
16326
- return RowSelect({
16327
- disabled: busy || !offered,
16328
- key: item.key,
16329
- checked: offered && sections.skills.indexOf(item.key) >= 0,
16330
- name: d.name,
16331
- desc: d.source || null,
16332
- descTitle: d.key,
16333
- meta: item.shadowed
16334
- ? React.createElement('span', { className: 'dsm-tag dsm-tag-off', title: t('scenes.skills.shadowed.hint') }, t('status.shadowed'))
16335
- : (item.loadable === false
16336
- ? React.createElement('span', { className: 'dsm-tag', title: t('scenes.skills.invalid.hint') }, t('status.invalid'))
16337
- : (item.enabled === false ? React.createElement('span', { className: 'dsm-tag' }, t('memory.scene.off')) : null)),
16338
- onChange: function () {
16339
- var list = sections.skills.slice(); var i = list.indexOf(item.key)
16340
- if (i >= 0) list.splice(i, 1); else list.push(item.key)
16341
- setSections(Object.assign({}, modalSections(), { skills: list }))
16342
- },
16343
- })
16692
+ : groups.length
16693
+ ? React.createElement('div', { className: 'dsm-skill-groups' }, groups.map(function (g) {
16694
+ var pickableInGroup = g.all.filter(pickable)
16695
+ var picked = pickableInGroup.filter(function (x) { return sections.skills.indexOf(x.key) >= 0 }).length
16696
+ var allChecked = pickableInGroup.length > 0 && picked === pickableInGroup.length
16697
+ var some = picked > 0 && !allChecked
16698
+ var expanded = expandedOf(g, picked)
16699
+ return React.createElement('div', { key: 'g:' + g.key, className: 'dsm-skill-group' },
16700
+ React.createElement('div', { className: 'dsm-skill-group-head' },
16701
+ // 组勾选框:全选 / 全不选这一整个来源(部分勾上是横杠)。
16702
+ React.createElement('button', {
16703
+ key: 'box',
16704
+ type: 'button',
16705
+ className: 'dsm-rowselect-box' + (allChecked ? ' dsm-rowselect-box-on' : ''),
16706
+ disabled: busy || pickableInGroup.length === 0,
16707
+ title: allChecked ? t('scenes.skills.groupUncheck') : t('scenes.skills.groupCheck'),
16708
+ 'aria-label': (allChecked ? t('scenes.skills.groupUncheck') : t('scenes.skills.groupCheck')) + ' · ' + g.label,
16709
+ onClick: function (e) { e.stopPropagation(); toggleGroup(g, allChecked) },
16710
+ }, allChecked
16711
+ ? React.createElement('svg', { viewBox: '0 0 12 12', width: 10, height: 10, focusable: 'false' },
16712
+ React.createElement('path', { d: 'M2.5 6.5L5 9L9.5 3.5', fill: 'none', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round' }))
16713
+ : some ? React.createElement('span', { className: 'dsm-rowselect-dash' }) : null),
16714
+ // 来源名 = 展开 / 收起(点勾选框才是全选 / 全不选)。
16715
+ React.createElement('button', {
16716
+ key: 'name',
16717
+ type: 'button',
16718
+ className: 'dsm-skill-group-name',
16719
+ title: g.label,
16720
+ onClick: function () { setExpanded(g.key, !expanded) },
16721
+ }, React.createElement(CaretIcon, { open: expanded, className: 'dsm-skill-group-caret' }), g.label),
16722
+ React.createElement('span', { key: 'count', className: 'dsm-skill-group-count' }, picked + '/' + pickableInGroup.length)),
16723
+ expanded
16724
+ ? React.createElement('div', { className: 'dsm-skill-group-items' }, g.rows.map(function (item) {
16725
+ var offered = pickable(item)
16726
+ return RowSelect({
16727
+ disabled: busy || !offered,
16728
+ key: item.key,
16729
+ checked: offered && sections.skills.indexOf(item.key) >= 0,
16730
+ name: String((item && item.name) || ''),
16731
+ desc: null,
16732
+ descTitle: item.key,
16733
+ meta: item.shadowed
16734
+ ? React.createElement('span', { className: 'dsm-tag dsm-tag-off', title: t('scenes.skills.shadowed.hint') }, t('status.shadowed'))
16735
+ : (item.loadable === false
16736
+ ? React.createElement('span', { className: 'dsm-tag', title: t('scenes.skills.invalid.hint') }, t('status.invalid'))
16737
+ : (item.enabled === false ? React.createElement('span', { className: 'dsm-tag' }, t('memory.scene.off')) : null)),
16738
+ onChange: function () {
16739
+ var list = sections.skills.slice(); var i = list.indexOf(item.key)
16740
+ if (i >= 0) list.splice(i, 1); else list.push(item.key)
16741
+ setSections(Object.assign({}, modalSections(), { skills: list }))
16742
+ },
16743
+ })
16744
+ }))
16745
+ : null)
16344
16746
  }))
16345
16747
  : React.createElement('div', { className: 'dsm-pick-empty' }, modal.skillQuery ? t('scenes.mem.noMatch') : t('scenes.skills.empty')),
16346
16748
  })
@@ -16409,6 +16811,8 @@ function enabledMemoryCount(rules) {
16409
16811
  checked: sections.subagents.indexOf(item.name) >= 0,
16410
16812
  name: item.name,
16411
16813
  desc: item.description || null,
16814
+ // 单行:描述截断排在名字右边(全文在悬浮里),一屏多看几条(用户 2026-11-06)。
16815
+ compact: true,
16412
16816
  // 按模式配的工具限制摘要(没配就不显示):场景改不了会话的模式,
16413
16817
  // 但要让用户看得见"这条人设在某些模式下是被限工具的"。
16414
16818
  meta: personaRuleSummary(item),
@@ -16879,6 +17283,48 @@ function enabledMemoryCount(rules) {
16879
17283
  scopeForgetSceneLeases(name)
16880
17284
  }).catch(function (e) { setBusy(false); setResult({ ok: false, text: errMsg(e) }) })
16881
17285
  }
17286
+ /**
17287
+ * 放掉**一个**对话的场景进入:让那个对话退出这个场景(其余对话照旧)。
17288
+ *
17289
+ * 写的是会话层的 scene = null(退出场景模式,回到它进入前的样子)—— 不是全局:
17290
+ * 全局正在用的那个场景不受影响。
17291
+ */
17292
+ function exitSceneLease(d) {
17293
+ var id = String((d && d.id) || '')
17294
+ var name = String((d && d.title) || id)
17295
+ if (id === '') return
17296
+ apiCall('scope-set', { sessionId: id, domain: 'scene', value: null }).then(function (res) {
17297
+ if (res && res.ok === false) {
17298
+ showPluginToast(t('scope.lease.releaseFailed', { title: name, error: translateError(t, res) || t('scope.lease.unknownError') }), 'err')
17299
+ return
17300
+ }
17301
+ showPluginToast(t('scope.lease.released', { title: name }), 'ok')
17302
+ // 全局快照有 150ms 的短 TTL:立刻重拉可能还是写前那一份。
17303
+ setTimeout(function () { refreshScope({ silent: true }) }, 400)
17304
+ }).catch(function (e) {
17305
+ showPluginToast(t('scope.lease.releaseFailed', { title: name, error: errMsg(e) || t('scope.lease.unknownError') }), 'err')
17306
+ })
17307
+ }
17308
+ /**
17309
+ * 场景行的租约徽章:几个对话 / 工作区在用这个场景(进入过)。
17310
+ *
17311
+ * 与其它域同一颗徽章(用户 2026-11-05:「场景缺少临时运行」):浮窗里逐行列出是
17312
+ * 哪几个,那颗「×」让其中一个退出这个场景。
17313
+ */
17314
+ function sceneLeaseTag(name) {
17315
+ if (scopeIsSession()) return null
17316
+ var count = scopeSceneLeaseCount(name)
17317
+ if (!(count > 0)) return null
17318
+ return React.createElement(LeaseTagBadge, {
17319
+ key: 'lease',
17320
+ t: t,
17321
+ count: count,
17322
+ runtime: true,
17323
+ domain: 'scene',
17324
+ details: scopeSceneLeaseDetails(name),
17325
+ onRelease: exitSceneLease,
17326
+ })
17327
+ }
16882
17328
  /** 锁 / 解锁本会话的覆盖(0.21.2,决策 12):只冻结这一层,与场景锁互不干扰。 */
16883
17329
  function toggleSessionLock() {
16884
17330
  if (busy) return
@@ -17156,7 +17602,10 @@ function enabledMemoryCount(rules) {
17156
17602
  // 编辑器里一眼可改,挂在卡片上只是每行多一枚药丸。只留**出问题时**的两枚
17157
17603
  //(预设不见了 / 文件里不是它)—— 那才是需要人动手的信号。
17158
17604
  promptMissing ? React.createElement('span', { className: 'dsm-tag dsm-tag-off', title: t('scenes.prompt.tag.hint') }, t('scenes.prompt.missing', { id: boundPrompt })) : null,
17159
- promptMismatch ? React.createElement('span', { className: 'dsm-tag dsm-tag-off', title: t('scenes.prompt.mismatch.hint', { id: boundPrompt }) }, t('agm.file.mismatch')) : null),
17605
+ promptMismatch ? React.createElement('span', { className: 'dsm-tag dsm-tag-off', title: t('scenes.prompt.mismatch.hint', { id: boundPrompt }) }, t('agm.file.mismatch')) : null,
17606
+ // 「临时运行 · N 个对话」:有几个对话 / 工作区进入了这一场(用户 2026-11-05:
17607
+ // 场景此前不挂这颗,别的域都挂 —— 同一件事两种长相)。
17608
+ sceneLeaseTag(name)),
17160
17609
  // 描述固定第二行(用户 2026-10-18:「场景页的备注在设置页没显示,应该显示在第二行」):
17161
17610
  // 在编辑器里填的描述就是这一句,它不在卡头那一行跟名字抢宽度。没有描述也渲染,
17162
17611
  // 保持每张卡同样两行高,行与行之间对得齐。
@@ -17192,11 +17641,13 @@ function enabledMemoryCount(rules) {
17192
17641
  key: 'menu',
17193
17642
  label: t('row.menu', { name: label }),
17194
17643
  items: [
17195
- ...(scopeIsSession() || scopeSceneLeaseCount(name) <= 0 ? [] : [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy || sceneStats.locked > 0, title: sceneStats.locked > 0 ? t('scenes.lock.blockedEdit') : undefined, onClick: function () { setModal({ type: 'scene-stop', name: name }) } }]),
17196
17644
  { key: 'edit', label: t('scenes.row.edit'), disabled: busy || sceneLocked, title: sceneLocked ? t('scenes.lock.blockedEdit') : undefined, onClick: function () { openEditor(scene) } },
17197
17645
  ].concat(locked ? [] : [
17198
17646
  { key: 'delete', label: t('scenes.row.delete'), danger: true, disabled: busy || sceneLocked, title: sceneLocked ? t('scenes.lock.blockedEdit') : undefined, onClick: function () { setModal({ type: 'scene-delete', name: name }) } },
17199
- ]),
17647
+ ]).concat(
17648
+ // 「全部关闭」放在最后(删除下面):它是停机动作(用户 2026-11-06)。
17649
+ scopeIsSession() || scopeSceneLeaseCount(name) <= 0 ? [] : [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy || sceneStats.locked > 0, title: sceneStats.locked > 0 ? t('scenes.lock.blockedEdit') : undefined, onClick: function () { setModal({ type: 'scene-stop', name: name }) } }],
17650
+ ),
17200
17651
  })))
17201
17652
  })),
17202
17653
  modal && modal.type === 'scene-delete' ? React.createElement(Modal, { key: 'sdel', className: 'dsm-modal-sm', title: t('memory.deleteScene.title'), closeLabel: t('btn.close'), onClose: function () { setModal(null) } },
@@ -17288,6 +17739,7 @@ function enabledMemoryCount(rules) {
17288
17739
  }) : null,
17289
17740
  )
17290
17741
  }
17742
+
17291
17743
  // ---------- 子智能体页:人设文件(~/.dsh/subagents/*.md)管理 ----------
17292
17744
  /**
17293
17745
  * 「思考强度」档位的按 (provider, model) 缓存。
@@ -18112,9 +18564,10 @@ function enabledMemoryCount(rules) {
18112
18564
  key: 'menu',
18113
18565
  label: t('row.menu', { name: p.name }),
18114
18566
  items: [
18115
- ...(scopeLeaseCount('subagents', String(p.name)) > 0 ? [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy || anyLocked, onClick: function () { setModal({ type: 'stop', name: p.name }) } }] : []),
18116
18567
  { key: 'edit', label: t('memory.edit'), disabled: busy, onClick: function () { openEditor(p.name) } },
18117
18568
  { key: 'delete', label: t('memory.delete'), danger: true, disabled: busy || anyLocked, onClick: function () { setModal({ type: 'delete', name: p.name }) } },
18569
+ // 「全部关闭」放在最后(删除下面):它是停机动作(用户 2026-11-06)。
18570
+ ...(scopeLeaseCount('subagents', String(p.name)) > 0 ? [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy || anyLocked, onClick: function () { setModal({ type: 'stop', name: p.name }) } }] : []),
18118
18571
  ],
18119
18572
  }),
18120
18573
  ],
@@ -19044,9 +19497,10 @@ function enabledMemoryCount(rules) {
19044
19497
  // 「编辑」在锁定态**照常可点**(用户 2026-10-12:「场景锁定下改成子智能体、
19045
19498
  // 提示词、记忆可以打开编辑页面,但是不能保存」):只读地看一眼内容不该被锁挡住,
19046
19499
  // 真正写盘的那一步(弹窗里的保存键)才置灰。其余会写盘的动作照旧置灰。
19047
- ...(scopeLeaseCount('memory', String(r.id)) > 0 ? [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy || scopeWriteLocked(anyLocked), onClick: function () { setModal({ type: 'stop', rule: r }) } }] : []),
19048
19500
  { key: 'edit', label: t('memory.edit'), disabled: busy || shadowed, onClick: function () { openEditor(r) } },
19049
19501
  { key: 'delete', label: t('memory.delete'), danger: true, disabled: busy || shadowed || anyLocked, onClick: function () { setModal({ type: 'delete', rule: r }) } },
19502
+ // 「全部关闭」放在最后(删除下面):它是停机动作(用户 2026-11-06)。
19503
+ ...(scopeLeaseCount('memory', String(r.id)) > 0 ? [{ key: 'stop', label: t('scope.unifiedClose'), danger: true, disabled: busy || scopeWriteLocked(anyLocked), onClick: function () { setModal({ type: 'stop', rule: r }) } }] : []),
19050
19504
  ],
19051
19505
  })],
19052
19506
  })