dsh-plugin-tool-management 0.22.0 → 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/CHANGELOG.md +33 -0
- package/docs/UPDATE.md +1 -0
- package/lib/client.js +603 -67
- package/lib/compat/host-contracts.js +16 -3
- package/lib/host-names.js +18 -0
- package/lib/index.js +203 -11
- package/lib/mcp/manager.js +21 -2
- package/lib/scenes/candidates.js +4 -1
- package/lib/scope/intent.js +76 -0
- package/lib/subagents/tool-filter.js +2 -2
- package/package.json +1 -1
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": "
|
|
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.
|
|
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": "
|
|
6648
|
-
"scope.intent.lease": "临时运行 · {count} 个对话", "scope.intent.
|
|
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": "
|
|
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.
|
|
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.
|
|
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",
|
|
@@ -9102,12 +9254,13 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
9102
9254
|
key: 'menu',
|
|
9103
9255
|
label: mt('row.menu', { name: row.serverName }),
|
|
9104
9256
|
items: [
|
|
9105
|
-
|
|
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
|
+
// 全局层的「全部关闭」:只在真有其他对话 / 工作区在临时用它时出现(没有租约时
|
|
9106
9260
|
// 普通开关就能停,菜单不必多一项)。它是一次性动作,不在菜单里留「恢复启用」。
|
|
9107
9261
|
// 会话层没有这一项 —— 会话只能"看不到它",停整台机器是全局动作。
|
|
9262
|
+
// 放在**最后**(删除下面):它是停机动作,不是这一行的日常操作(用户 2026-11-06)。
|
|
9108
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) }]),
|
|
9109
|
-
{ key: 'edit', label: mt('mcp.btn.edit'), disabled: actDisabled, onClick: () => openEdit(row) },
|
|
9110
|
-
{ key: 'remove', label: mt('mcp.btn.remove'), danger: true, disabled: actDisabled, onClick: () => setConfirmRow(row) },
|
|
9111
9264
|
],
|
|
9112
9265
|
}))
|
|
9113
9266
|
return React.createElement(ListRow, {
|
|
@@ -10228,9 +10381,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
10228
10381
|
key: 'menu',
|
|
10229
10382
|
label: t('row.menu', { name: p.id }),
|
|
10230
10383
|
items: [
|
|
10231
|
-
...(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 }) } }] : []),
|
|
10232
10384
|
{ key: 'edit', label: t('agm.btn.edit'), disabled: busy !== null || scopeIsSession(), title: scopeIsSession() ? promptBlockTitle : undefined, onClick: function () { openQuickEdit(p) } },
|
|
10233
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 }) } }] : []),
|
|
10234
10388
|
],
|
|
10235
10389
|
}),
|
|
10236
10390
|
],
|
|
@@ -12717,8 +12871,240 @@ function enabledMemoryCount(rules) {
|
|
|
12717
12871
|
var tone = props.tone === 'ok' ? ' dsm-tag-on' : props.tone === 'bad' ? ' dsm-tag-off' : props.tone === 'warn' ? ' dsm-tag-warn' : ''
|
|
12718
12872
|
return h('span', { className: 'dsm-tag' + tone, title: props.title }, props.text)
|
|
12719
12873
|
}
|
|
12874
|
+
/** 租约浮窗的最大高度(`measure` 与 CSS 共用同一个上限)。 */
|
|
12875
|
+
var LEASE_POP_MAX_H = 320
|
|
12720
12876
|
/**
|
|
12721
|
-
*
|
|
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 族、同一浮窗。
|
|
12722
13108
|
*
|
|
12723
13109
|
* 为什么必须共用一个函数:这六处的文案与判据曾经各写一份(技能来源用 `scope.intent.lease`,
|
|
12724
13110
|
* 其余五处干脆没有),口径一分叉就会出现"同一件事在 MCP 页写着临时运行、在记忆页什么都不说"。
|
|
@@ -12740,11 +13126,13 @@ function enabledMemoryCount(rules) {
|
|
|
12740
13126
|
if (!(count > 0)) return null
|
|
12741
13127
|
if (scopeIsSession()) return null
|
|
12742
13128
|
var runtime = props.runtime === true
|
|
12743
|
-
return h(
|
|
13129
|
+
return h(LeaseTagBadge, {
|
|
12744
13130
|
key: props.tagKey || undefined,
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
13131
|
+
t: t,
|
|
13132
|
+
count: count,
|
|
13133
|
+
runtime: runtime,
|
|
13134
|
+
details: scopeLeaseDetails(props.domain, props.key),
|
|
13135
|
+
})
|
|
12748
13136
|
}
|
|
12749
13137
|
|
|
12750
13138
|
// ---------- MCP 导入 / 导出(0.15.0 A1;0.20.x 起收 dsh 补丁片段)------------------
|
|
@@ -13698,9 +14086,10 @@ function enabledMemoryCount(rules) {
|
|
|
13698
14086
|
var actions = [];
|
|
13699
14087
|
var menuItems = [];
|
|
13700
14088
|
var stopLease = scopeLeaseCount('skills', skillKey);
|
|
13701
|
-
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 }); } });
|
|
13702
14089
|
if (root.mutable === true && !skill.shadowedBy) menuItems.push({ key: "edit", label: t("btn.edit"), disabled: busy || anyLocked, onClick: function () { openSkillEdit(root, skill); } });
|
|
13703
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 }); } });
|
|
13704
14093
|
/**
|
|
13705
14094
|
* 「启用这个」写的是「同名技能该用哪个**来源**」的首选表(`/prefer` →
|
|
13706
14095
|
* `preferredSkills[名] = 来源 key`,`shadowedBy.root === 本行来源` 即表示撞名发生在
|
|
@@ -13755,11 +14144,13 @@ function enabledMemoryCount(rules) {
|
|
|
13755
14144
|
var rootCount = root.count == null ? root.skills.length : root.count;
|
|
13756
14145
|
var srcOnHere = srcOnInLayer(root);
|
|
13757
14146
|
// 全局意图 / 租约:来源关闭后还有会话在用时挂「临时运行 · N 个对话」;
|
|
13758
|
-
// 旧版本留下的 blocked
|
|
14147
|
+
// 旧版本留下的 blocked 仍显示「已全部关闭」,并给一个恢复入口。
|
|
13759
14148
|
// 会话层不显示(那一层只回答"这个对话看得到哪些技能")。
|
|
14149
|
+
// **默认来源(官方内置 / DSH 技能)也挂**:它们没有来源级开关,租约落在底下的
|
|
14150
|
+
// 技能上 —— 组头不标,用户只会在某一行技能上看到徽章(用户 2026-11-05 报障)。
|
|
13760
14151
|
var rootKeyHere = String(root.key || "");
|
|
13761
14152
|
var intentHere = scopeIntentOf('skillSources', rootKeyHere);
|
|
13762
|
-
var intentTag = scopeIsSession()
|
|
14153
|
+
var intentTag = scopeIsSession() ? null
|
|
13763
14154
|
: intentHere === 'blocked' ? h("span", { key: "intent", className: "dsm-tag dsm-tag-off", title: t("scope.intent.blockedHint") }, t("scope.intent.blocked"))
|
|
13764
14155
|
: h(react.Fragment, { key: "intent" }, leaseTag({ t: t, domain: 'skillSources', key: rootKeyHere, runtime: true }));
|
|
13765
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 () {
|
|
@@ -15704,6 +16095,8 @@ function enabledMemoryCount(rules) {
|
|
|
15704
16095
|
name: m.name,
|
|
15705
16096
|
desc: m.description ? clipText(m.description, MEM_DESC_MAX) : null,
|
|
15706
16097
|
descTitle: m.description || null,
|
|
16098
|
+
// 单行:与下面的真记忆同一形状(用户 2026-11-06)。
|
|
16099
|
+
compact: true,
|
|
15707
16100
|
meta: React.createElement(React.Fragment, null,
|
|
15708
16101
|
React.createElement('span', { className: 'dsm-tag', title: t('scenes.mem.pendingTagTitle') }, t('scenes.mem.pendingTag')),
|
|
15709
16102
|
attachMark((m.files || []).length, (m.files || []).reduce(function (sum, f) { return sum + Number(f.size || 0) }, 0))),
|
|
@@ -15731,6 +16124,8 @@ function enabledMemoryCount(rules) {
|
|
|
15731
16124
|
// 记忆描述是自由正文的首行,可能很长:截断到 MEM_DESC_MAX,全文放 title。
|
|
15732
16125
|
desc: m.description ? clipText(m.description, MEM_DESC_MAX) : null,
|
|
15733
16126
|
descTitle: m.description || null,
|
|
16127
|
+
// 单行:描述排在名字右边(用户 2026-11-06)。
|
|
16128
|
+
compact: true,
|
|
15734
16129
|
// 带附件的 bundle 记忆标一枚回形针 + 个数(见 attachMark)。
|
|
15735
16130
|
meta: attachMark(m.attach && m.attach.count, m.attach && m.attach.bytes),
|
|
15736
16131
|
onChange: function () { toggleMemory(String(m.id)) },
|
|
@@ -16099,8 +16494,10 @@ function enabledMemoryCount(rules) {
|
|
|
16099
16494
|
checked: selected,
|
|
16100
16495
|
name: server.name,
|
|
16101
16496
|
desc: desc,
|
|
16497
|
+
// 单行:名字与工具数并排,标签与「编辑」在右边 —— 一屏多看几台(用户 2026-11-06)。
|
|
16498
|
+
compact: true,
|
|
16102
16499
|
meta: [
|
|
16103
|
-
server.live ? null : React.createElement('span', { key: 'nr', className: 'dsm-tag dsm-tag-
|
|
16500
|
+
server.live ? null : React.createElement('span', { key: 'nr', className: 'dsm-tag dsm-tag-quiet' }, t('scenes.mcp.notRunning')),
|
|
16104
16501
|
specText ? React.createElement('span', { key: 'spec' }, specText) : null,
|
|
16105
16502
|
hasNote ? React.createElement('span', { key: 'note', className: 'dsm-tag' }, t('scenes.mcp.hasNote')) : null,
|
|
16106
16503
|
],
|
|
@@ -16141,8 +16538,7 @@ function enabledMemoryCount(rules) {
|
|
|
16141
16538
|
React.createElement('div', { className: 'dsm-budget-meta' },
|
|
16142
16539
|
React.createElement('span', { className: 'dsm-label' }, t('scenes.mcp.noteLabel')),
|
|
16143
16540
|
React.createElement('span', { className: 'dsm-char-count' + (String(noteVal || '').length > MCP_NOTE_MAX ? ' dsm-char-over' : '') }, String(noteVal || '').length + ' / ' + MCP_NOTE_MAX)),
|
|
16144
|
-
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) } }),
|
|
16145
|
-
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) } })),
|
|
16146
16542
|
React.createElement('div', { className: 'dsm-field' },
|
|
16147
16543
|
React.createElement('div', { className: 'dsm-mcp-edit-tools-head' },
|
|
16148
16544
|
React.createElement('label', { className: 'dsm-label' }, t('scenes.mcp.toolsOf')),
|
|
@@ -16169,8 +16565,7 @@ function enabledMemoryCount(rules) {
|
|
|
16169
16565
|
React.createElement('div', { className: 'dsm-pick-empty' }, t('scenes.mcp.noTools')),
|
|
16170
16566
|
modal.drillError ? React.createElement('div', { className: 'dsm-seg-empty-error' }, modal.drillError) : null,
|
|
16171
16567
|
React.createElement('div', { className: 'dsm-seg-empty-actions' },
|
|
16172
|
-
React.createElement('button', { type: 'button', className: 'dsm-btn dsm-btn-secondary', disabled: drillTools === null, onClick: probeMcpTools }, t('scenes.mcp.probeTools'))))
|
|
16173
|
-
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')))))))
|
|
16174
16569
|
}
|
|
16175
16570
|
/** 段 2:技能集。 */
|
|
16176
16571
|
/**
|
|
@@ -16211,17 +16606,74 @@ function enabledMemoryCount(rules) {
|
|
|
16211
16606
|
*/
|
|
16212
16607
|
var pickable = function (x) { return !x.shadowed && x.loadable !== false }
|
|
16213
16608
|
var pickableItems = allItems.filter(pickable)
|
|
16214
|
-
var
|
|
16215
|
-
|
|
16216
|
-
if (!q) return
|
|
16609
|
+
var q = String(modal.skillQuery || '').trim().toLowerCase()
|
|
16610
|
+
var matches = function (x) {
|
|
16611
|
+
if (!q) return true
|
|
16217
16612
|
// 搜索同时匹配技能名与来源名(用户按"来源"找技能是常见动作)。
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
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)
|
|
16221
16645
|
})
|
|
16222
|
-
})
|
|
16223
|
-
function (x) { return !!sections.skills && sections.skills.indexOf(x.key) >= 0 })
|
|
16646
|
+
})
|
|
16224
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
|
+
}
|
|
16225
16677
|
return editorGroupNode({
|
|
16226
16678
|
title: t('memory.archive.skills'),
|
|
16227
16679
|
count: defined ? t('scenes.seg.checked', { checked: pickedCount, total: pickableItems.length }) : t('scenes.archive.sectionOff'),
|
|
@@ -16237,28 +16689,60 @@ function enabledMemoryCount(rules) {
|
|
|
16237
16689
|
hideFilter: !defined,
|
|
16238
16690
|
body: !defined
|
|
16239
16691
|
? React.createElement('div', { className: 'dsm-pick-empty', title: t('scenes.skills.hint') }, t('scenes.skills.hint.short'))
|
|
16240
|
-
:
|
|
16241
|
-
? React.createElement('div',
|
|
16242
|
-
var
|
|
16243
|
-
var
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
:
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
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)
|
|
16262
16746
|
}))
|
|
16263
16747
|
: React.createElement('div', { className: 'dsm-pick-empty' }, modal.skillQuery ? t('scenes.mem.noMatch') : t('scenes.skills.empty')),
|
|
16264
16748
|
})
|
|
@@ -16327,6 +16811,8 @@ function enabledMemoryCount(rules) {
|
|
|
16327
16811
|
checked: sections.subagents.indexOf(item.name) >= 0,
|
|
16328
16812
|
name: item.name,
|
|
16329
16813
|
desc: item.description || null,
|
|
16814
|
+
// 单行:描述截断排在名字右边(全文在悬浮里),一屏多看几条(用户 2026-11-06)。
|
|
16815
|
+
compact: true,
|
|
16330
16816
|
// 按模式配的工具限制摘要(没配就不显示):场景改不了会话的模式,
|
|
16331
16817
|
// 但要让用户看得见"这条人设在某些模式下是被限工具的"。
|
|
16332
16818
|
meta: personaRuleSummary(item),
|
|
@@ -16797,6 +17283,48 @@ function enabledMemoryCount(rules) {
|
|
|
16797
17283
|
scopeForgetSceneLeases(name)
|
|
16798
17284
|
}).catch(function (e) { setBusy(false); setResult({ ok: false, text: errMsg(e) }) })
|
|
16799
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
|
+
}
|
|
16800
17328
|
/** 锁 / 解锁本会话的覆盖(0.21.2,决策 12):只冻结这一层,与场景锁互不干扰。 */
|
|
16801
17329
|
function toggleSessionLock() {
|
|
16802
17330
|
if (busy) return
|
|
@@ -17074,7 +17602,10 @@ function enabledMemoryCount(rules) {
|
|
|
17074
17602
|
// 编辑器里一眼可改,挂在卡片上只是每行多一枚药丸。只留**出问题时**的两枚
|
|
17075
17603
|
//(预设不见了 / 文件里不是它)—— 那才是需要人动手的信号。
|
|
17076
17604
|
promptMissing ? React.createElement('span', { className: 'dsm-tag dsm-tag-off', title: t('scenes.prompt.tag.hint') }, t('scenes.prompt.missing', { id: boundPrompt })) : null,
|
|
17077
|
-
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)),
|
|
17078
17609
|
// 描述固定第二行(用户 2026-10-18:「场景页的备注在设置页没显示,应该显示在第二行」):
|
|
17079
17610
|
// 在编辑器里填的描述就是这一句,它不在卡头那一行跟名字抢宽度。没有描述也渲染,
|
|
17080
17611
|
// 保持每张卡同样两行高,行与行之间对得齐。
|
|
@@ -17110,11 +17641,13 @@ function enabledMemoryCount(rules) {
|
|
|
17110
17641
|
key: 'menu',
|
|
17111
17642
|
label: t('row.menu', { name: label }),
|
|
17112
17643
|
items: [
|
|
17113
|
-
...(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 }) } }]),
|
|
17114
17644
|
{ key: 'edit', label: t('scenes.row.edit'), disabled: busy || sceneLocked, title: sceneLocked ? t('scenes.lock.blockedEdit') : undefined, onClick: function () { openEditor(scene) } },
|
|
17115
17645
|
].concat(locked ? [] : [
|
|
17116
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 }) } },
|
|
17117
|
-
])
|
|
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
|
+
),
|
|
17118
17651
|
})))
|
|
17119
17652
|
})),
|
|
17120
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) } },
|
|
@@ -17206,6 +17739,7 @@ function enabledMemoryCount(rules) {
|
|
|
17206
17739
|
}) : null,
|
|
17207
17740
|
)
|
|
17208
17741
|
}
|
|
17742
|
+
|
|
17209
17743
|
// ---------- 子智能体页:人设文件(~/.dsh/subagents/*.md)管理 ----------
|
|
17210
17744
|
/**
|
|
17211
17745
|
* 「思考强度」档位的按 (provider, model) 缓存。
|
|
@@ -18030,9 +18564,10 @@ function enabledMemoryCount(rules) {
|
|
|
18030
18564
|
key: 'menu',
|
|
18031
18565
|
label: t('row.menu', { name: p.name }),
|
|
18032
18566
|
items: [
|
|
18033
|
-
...(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 }) } }] : []),
|
|
18034
18567
|
{ key: 'edit', label: t('memory.edit'), disabled: busy, onClick: function () { openEditor(p.name) } },
|
|
18035
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 }) } }] : []),
|
|
18036
18571
|
],
|
|
18037
18572
|
}),
|
|
18038
18573
|
],
|
|
@@ -18962,9 +19497,10 @@ function enabledMemoryCount(rules) {
|
|
|
18962
19497
|
// 「编辑」在锁定态**照常可点**(用户 2026-10-12:「场景锁定下改成子智能体、
|
|
18963
19498
|
// 提示词、记忆可以打开编辑页面,但是不能保存」):只读地看一眼内容不该被锁挡住,
|
|
18964
19499
|
// 真正写盘的那一步(弹窗里的保存键)才置灰。其余会写盘的动作照旧置灰。
|
|
18965
|
-
...(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 }) } }] : []),
|
|
18966
19500
|
{ key: 'edit', label: t('memory.edit'), disabled: busy || shadowed, onClick: function () { openEditor(r) } },
|
|
18967
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 }) } }] : []),
|
|
18968
19504
|
],
|
|
18969
19505
|
})],
|
|
18970
19506
|
})
|