dsh-plugin-tool-management 0.22.1 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/README.md +10 -9
- package/README_EN.md +10 -9
- package/docs/UPDATE.md +2 -0
- package/lib/catalog-caps.js +22 -0
- package/lib/client.js +848 -214
- package/lib/compat/capability-specs.js +400 -1
- package/lib/compat/host-contracts.js +349 -3
- package/lib/compat/host-probe.js +40 -0
- package/lib/compat/host-roots.js +23 -8
- package/lib/compat/manual-review.js +55 -0
- package/lib/compat/preset-reach.js +69 -12
- package/lib/compat/probe.js +448 -25
- package/lib/context-inject-contract.js +2 -1
- package/lib/context-inject-frame.js +100 -48
- package/lib/context-inject-select.js +28 -0
- package/lib/desktop-cookie-prune.js +19 -3
- package/lib/index.js +156 -20
- package/lib/mcp/manager.js +4 -1
- package/lib/mcp/prompt-shadow.js +128 -0
- package/lib/mcp/state-section.js +14 -9
- package/lib/mcp/tool-visibility.js +18 -6
- package/lib/memories/constants.js +9 -7
- package/lib/memories/service.js +18 -5
- package/lib/memories/snapshot.js +8 -8
- package/lib/op-registry.js +1 -1
- package/lib/ops/compat.js +44 -1
- package/lib/ops/scope.js +9 -9
- package/lib/scene-linkage.js +16 -1
- package/lib/scenes/candidates.js +17 -2
- package/lib/scope/intent.js +1 -1
- package/lib/settings-sidecars.js +9 -2
- package/lib/skills/catalog.js +36 -13
- package/lib/skills/provider-registration.js +41 -4
- package/lib/skills/service.js +4 -4
- package/lib/subagents/catalog.js +16 -8
- package/lib/tool-table-switch.js +2 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -220,19 +220,37 @@ button.dsm-qty:disabled{cursor:default}
|
|
|
220
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
221
|
/* 中性标签:灰边框 + 主色字(用户 2026-11-06:MCP 的「未运行」不该是红的 —— 没跑起来不是故障)。 */
|
|
222
222
|
.dsm-tag-quiet{border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}
|
|
223
|
-
/* 租约浮窗(悬在「临时运行 · N
|
|
223
|
+
/* 租约浮窗(悬在「临时运行 · N 个对话」徽章上):一行一个认领者,对话标题在左、
|
|
224
|
+
工作区弱化成行尾后缀、放行按钮贴右边。早先按工作区分组时,组头与缩进各占一行,
|
|
225
|
+
只有一两个对话时整块像张空卡片(用户反馈「太多空白」)——分组只保留排序意义,不再占行。
|
|
224
226
|
固定定位 + 视口坐标 —— 徽章所在的列表行是 overflow:hidden,绝对定位会被裁掉
|
|
225
|
-
(与 SourceSelect 的菜单同一条理由)。
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
(与 SourceSelect 的菜单同一条理由)。
|
|
228
|
+
宽度上限 280px:标题与工作区都长时两边一起省略,边框不会跟着内容无限拉长。 */
|
|
229
|
+
.dsm-lease-pop{position:fixed;z-index:1200;box-sizing:border-box;display:flex;width:max-content;min-width:180px;max-width:min(88vw,280px);flex-direction:column;padding:0;overflow:visible;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}
|
|
230
|
+
/* 徽章与浮窗之间留了 6px 空档:用不可见的桥接条补上,指针从徽章移进浮窗时
|
|
231
|
+
不会经过"两边都不在"的位置 —— 因此一离开两者就能立刻收起,不必等关闭延迟。
|
|
232
|
+
浮窗在上方时桥接条改到下方(dsm-lease-pop-up),始终朝着徽章那一侧。
|
|
233
|
+
滚动必须放在内层:外层一旦 overflow:auto,伸出去 8px 的桥接条会被裁掉。 */
|
|
234
|
+
.dsm-lease-pop:not(.dsm-lease-pop-up)::before,.dsm-lease-pop-up::after{position:absolute;right:0;left:0;height:8px;content:""}
|
|
235
|
+
.dsm-lease-pop:not(.dsm-lease-pop-up)::before{top:-8px}
|
|
236
|
+
.dsm-lease-pop-up::after{bottom:-8px}
|
|
237
|
+
.dsm-lease-pop-body{box-sizing:border-box;min-height:0;flex:1 1 auto;padding:6px;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--dsw-alias-border-l2) transparent}
|
|
238
|
+
.dsm-lease-pop-body::-webkit-scrollbar{width:8px;height:8px}
|
|
239
|
+
.dsm-lease-pop-body::-webkit-scrollbar-track{background:transparent}
|
|
240
|
+
.dsm-lease-pop-body::-webkit-scrollbar-thumb{border-radius:99px;background:var(--dsw-alias-border-l2)}
|
|
241
|
+
.dsm-lease-pop-item{box-sizing:border-box;display:flex;gap:8px;align-items:center;min-height:28px;padding:2px 6px;border-radius:var(--dsm-radius-s)}
|
|
242
|
+
.dsm-lease-pop-item:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
243
|
+
/* 标题吃满剩余宽度:行尾的「×」才会贴住右边缘,而不是跟在短标题后面留一截空白。 */
|
|
244
|
+
.dsm-lease-pop-title{min-width:0;overflow:hidden;flex:1;color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;text-overflow:ellipsis;white-space:nowrap}
|
|
245
|
+
/* 工作区后缀:弱化到辅助信息一档;上限 38% 是为了长路径不把标题挤没。 */
|
|
246
|
+
.dsm-lease-pop-ws{min-width:0;max-width:38%;overflow:hidden;flex:none;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
|
|
232
247
|
/* 每行末尾那颗「×」:只放开这一个对话的临时运行,其余对话照旧(认领是逐个对话记的)。 */
|
|
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:
|
|
248
|
+
.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:14px;line-height:24px;cursor:pointer}
|
|
249
|
+
.dsm-lease-pop-item:hover .dsm-lease-pop-x{color:var(--dsw-alias-label-secondary)}
|
|
234
250
|
.dsm-lease-pop-x:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
235
251
|
.dsm-lease-pop-x:disabled{cursor:default;opacity:.5}
|
|
252
|
+
/* 徽章与「×」都能用键盘操作(Enter/空格开合、Tab 进浮窗):焦点必须看得见。 */
|
|
253
|
+
.dsm-tag-lease:focus-visible,.dsm-lease-pop-x:focus-visible{outline-style:solid;outline-color:var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-width:var(--dsw-focus-ring-width,2px);outline-offset:1px}
|
|
236
254
|
/* 开关与官方同款(用户 2026-10-18:「switch 按键统一和官方一样的模板」→「改成完全一样」):
|
|
237
255
|
36×20 外壳 + 16px 拇指、内边距 2px、滑块位移 16px、开态用 brand-primary,
|
|
238
256
|
关态拇指用 switch-thumb —— 尺寸与配色照抄宿主设置面板那颗。
|
|
@@ -538,6 +556,18 @@ button.dsm-qty:disabled{cursor:default}
|
|
|
538
556
|
比上面的总开关还重,与它「细项」的层级不符。 */
|
|
539
557
|
.dsm-inject-chip-on{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-label-primary)}
|
|
540
558
|
.dsm-inject-chip-on .dsm-inject-chip-dot{background:var(--dsw-alias-state-success-primary);opacity:1}
|
|
559
|
+
/* 目录上限:三个域各占一行 —— 域名固定宽(三行的「条数」列因此左右对齐),右侧
|
|
560
|
+
「条数 [框] 描述 [框]」。框是窄数字框(右对齐、矮一行),placeholder 灰显当前生效值
|
|
561
|
+
(没配 = 出厂值);隐藏 number 输入的上下箭头 —— 小框里它们挤成两个点,还误导"可点击
|
|
562
|
+
步进",鼠标滚轮与键盘照样能改。 */
|
|
563
|
+
.dsm-caps-row{display:flex;flex-direction:column;gap:7px;padding:9px 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsm-radius-m);background:var(--dsw-alias-bg-layer-2)}
|
|
564
|
+
.dsm-cap-group{display:inline-flex;align-items:center;gap:8px}
|
|
565
|
+
.dsm-cap-name{flex:none;min-width:72px;color:var(--dsw-alias-label-primary);font-size:12px;line-height:18px;white-space:nowrap}
|
|
566
|
+
.dsm-cap-field{display:inline-flex;align-items:center;gap:4px}
|
|
567
|
+
.dsm-cap-label{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px;white-space:nowrap}
|
|
568
|
+
.dsm-cap-unit{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px;white-space:nowrap}
|
|
569
|
+
.dsm-cap-input{width:58px;height:24px;min-height:0;padding:0 4px;text-align:center;font-size:12px;appearance:textfield;-moz-appearance:textfield}
|
|
570
|
+
.dsm-cap-input::-webkit-inner-spin-button,.dsm-cap-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
|
|
541
571
|
/* 模型工具表:与「注入」同屏的第二种开关。**一行一个工具、四列固定宽度**(勾选框 / 名字 /
|
|
542
572
|
≈tok / 一句话介绍)—— 列宽不固定就竖着扫不出任何一列(用户 2026-09-23 指出挤成一排很难看)。
|
|
543
573
|
名字用等宽、数字用 tabular-nums 右对齐;介绍超长省略,完整那句在悬停里。
|
|
@@ -603,7 +633,12 @@ button.dsm-qty:disabled{cursor:default}
|
|
|
603
633
|
.dsm-compat-code{font-family:var(--ds-font-family-code,ui-monospace,SFMono-Regular,Consolas,monospace);font-size:11px}
|
|
604
634
|
.dsm-compat-list{margin:0;padding-left:16px}.dsm-compat-list li+li{margin-top:4px}
|
|
605
635
|
@container(max-width:640px){.dsm-compat-grid{grid-template-columns:1fr}}
|
|
606
|
-
|
|
636
|
+
/* 滚动条装订线只在面板挂载期间生效,两个落点各管一种布局:
|
|
637
|
+
· .dsm-settings-scroll-host —— 41 片按计算样式找出宿主真正的滚动容器,临时挂上这个类;
|
|
638
|
+
· html.dsm-scroll-stable —— 滚动落在视口上时(找不到祖先容器)由 41 片临时加类。
|
|
639
|
+
两段类名是为了压过宿主自己的选择器,替代原先的 !important —— 强制值会盖掉宿主的 overflow 语义。
|
|
640
|
+
以前这里是一条常驻的 html/body 规则:它改的是整个应用、卸载后也不会撤销,已删除。 */
|
|
641
|
+
.dsm-settings-scroll-host.dsm-settings-scroll-host{overflow-y:auto;scrollbar-gutter:stable}html.dsm-scroll-stable{scrollbar-gutter:stable}.dsm-panel-head{position:sticky;top:0;z-index:6;display:grid;grid-template-columns:minmax(0,1fr) max-content;grid-template-areas:"scope links" "tabs tabs";align-items:center;column-gap:8px;min-width:0;background:var(--dsm-surface,var(--dsw-alias-bg-layer-2))}.dsm-tabs-shell{display:flex;min-width:0;align-items:center;gap:4px;margin-bottom:0;padding-top:2px}.dsm-tabs{display:grid;min-width:0;flex:1;grid-template-columns:repeat(auto-fit,minmax(64px,1fr));gap:0;overflow:hidden;margin-bottom:0;border-bottom:1px solid var(--dsw-alias-border-l1)}.dsm-tab{box-sizing:border-box;width:100%;min-width:0;padding-right:4px;padding-left:4px;overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}.dsm-feedback-link{width:30px;height:30px;box-sizing:border-box;padding:0;justify-content:center}.dsm-feedback-link svg{width:16px;height:16px}@container(max-width:620px){.dsm-tab{padding-right:4px;padding-left:4px;font-size:12px}}
|
|
607
642
|
/* 顶部栏右上角那一行(版本号 · 检查更新 · GitHub):排在**作用域行**的右端,页签行独占一行。
|
|
608
643
|
位置由 .dsm-panel-head 的网格排(area links)—— 它要和 GitHub 图标并排(用户 2026-10-22),
|
|
609
644
|
塞进 .dsm-tabs-shell 就只能挤在页签那一行里。 */
|
|
@@ -1011,7 +1046,7 @@ html,body{scrollbar-gutter:stable}.dsm-settings-scroll-host{overflow-y:scroll!im
|
|
|
1011
1046
|
.dsm-rowselect-compact .dsm-rowselect-main{flex-direction:row;align-items:baseline;gap:8px}
|
|
1012
1047
|
/* 单行版里**名字不缩**(用户 2026-11-06:「标题名字要全部展示」)—— 挤掉的是描述,
|
|
1013
1048
|
不是名字。 */
|
|
1014
|
-
.dsm-rowselect-compact .dsm-rowselect-name{flex:none}
|
|
1049
|
+
.dsm-rowselect-compact .dsm-rowselect-name{flex:none;max-width:100%}
|
|
1015
1050
|
.dsm-rowselect-compact .dsm-rowselect-desc{min-width:0;flex:1 1 auto}
|
|
1016
1051
|
.dsm-rowselect-name{overflow:hidden;font-size:13px;line-height:18px;text-overflow:ellipsis;white-space:nowrap}
|
|
1017
1052
|
.dsm-rowselect-desc{overflow:hidden;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -1377,15 +1412,48 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
1377
1412
|
}).catch(function () { return ioDefaultDir })
|
|
1378
1413
|
}
|
|
1379
1414
|
|
|
1415
|
+
/**
|
|
1416
|
+
* 注入插件样式表(幂等,引用计数)。
|
|
1417
|
+
*
|
|
1418
|
+
* @returns 释放本次持有的那个 `<style>` 的清理函数(可重复调用)。
|
|
1419
|
+
*
|
|
1420
|
+
* 为什么要交出去:样式标签挂在 `document.head`,不随插件 fiber 销毁。热重载或停用之后
|
|
1421
|
+
* 规则仍然生效(`.dsm-*` 会命中残留 DOM,滚动条装订线也会留在宿主容器上),只能靠刷新
|
|
1422
|
+
* 页面才恢复。调用点(40 片)把它注册进 `ctx.effect`。
|
|
1423
|
+
*
|
|
1424
|
+
* 为什么按引用计数而不是"有就复用、没有就建":热重载时新旧实例可能同时持有一份样式
|
|
1425
|
+
* (新实例先 apply、旧 fiber 后 dispose)。直接删会让新实例当场失去样式;直接复用则
|
|
1426
|
+
* 旧实例一释放就把新实例的那份一起带走。计数只让**最后一个**持有者负责移除。
|
|
1427
|
+
*/
|
|
1380
1428
|
function ensureCss() {
|
|
1381
|
-
if (typeof document === 'undefined') return
|
|
1429
|
+
if (typeof document === 'undefined') return function () {}
|
|
1382
1430
|
const id = 'dsh-plugin-tool-management'
|
|
1383
|
-
|
|
1431
|
+
// 复用分支拿到的是 `Element`(没有 `dataset`),所以引用数走 attribute 读写,
|
|
1432
|
+
// 两个分支共用同一份实现。
|
|
1433
|
+
const REFS = 'data-plugin-css-refs'
|
|
1434
|
+
/** 把一个标签的引用数 +1,并返回只生效一次的释放函数。 */
|
|
1435
|
+
function retain(tag) {
|
|
1436
|
+
var released = false
|
|
1437
|
+
return function () {
|
|
1438
|
+
if (released) return
|
|
1439
|
+
released = true
|
|
1440
|
+
var left = Number(tag.getAttribute(REFS) || '1') - 1
|
|
1441
|
+
if (left > 0) { tag.setAttribute(REFS, String(left)); return }
|
|
1442
|
+
try { if (tag.parentNode) tag.parentNode.removeChild(tag) } catch (e) { /* 文档已卸载 */ }
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
const existing = document.querySelector('style[data-plugin-css="' + id + '"]')
|
|
1446
|
+
if (existing) {
|
|
1447
|
+
existing.setAttribute(REFS, String(Number(existing.getAttribute(REFS) || '1') + 1))
|
|
1448
|
+
return retain(existing)
|
|
1449
|
+
}
|
|
1384
1450
|
const tag = document.createElement('style')
|
|
1385
1451
|
tag.dataset.plugin = id
|
|
1386
1452
|
tag.dataset.pluginCss = id
|
|
1453
|
+
tag.setAttribute(REFS, '1')
|
|
1387
1454
|
tag.textContent = CSS
|
|
1388
1455
|
document.head.appendChild(tag)
|
|
1456
|
+
return retain(tag)
|
|
1389
1457
|
}
|
|
1390
1458
|
|
|
1391
1459
|
/**
|
|
@@ -2410,13 +2478,13 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2410
2478
|
* (颜色统一为绿/灰,这个标记只留给"来源点"与统计用)。全局层恒 `scoped: false`。
|
|
2411
2479
|
*/
|
|
2412
2480
|
function scopeFlag(domain, key, globalValue) {
|
|
2413
|
-
// 全局 blocked
|
|
2481
|
+
// 全局 blocked(旧版「全部关闭」留下的持久停机)压过一切会话层(与后端 `resolveResource` 同一条):会话里的覆盖、
|
|
2414
2482
|
// 场景勾选、逐工具 / 单条技能的推导都不能把它显成开着 —— 否则开关是绿的、模型调不到。
|
|
2415
2483
|
// 技能还要看所在来源:来源被 blocked 时,技能级开着也加载不到。
|
|
2416
2484
|
if (domain === 'mcp' || domain === 'skills' || domain === 'skillSources') {
|
|
2417
2485
|
var intentState = scopeIntentOf(domain, key)
|
|
2418
2486
|
if (intentState === 'blocked') return { value: false, scoped: false }
|
|
2419
|
-
// 意图比列表里那份 `globalOn`
|
|
2487
|
+
// 意图比列表里那份 `globalOn` 新:写完全部关闭后列表还没重读,全局开关也该立刻翻过去。
|
|
2420
2488
|
if (intentState === 'on') globalValue = true
|
|
2421
2489
|
else if (intentState === 'off') globalValue = false
|
|
2422
2490
|
}
|
|
@@ -2437,7 +2505,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2437
2505
|
//
|
|
2438
2506
|
// MCP 服务器与技能来源两格的全局开关**不是**补丁 / 来源状态,而是意图:
|
|
2439
2507
|
// on —— 全局启用;off —— 全局关闭(有会话还在用就保持运行,即租约);
|
|
2440
|
-
// blocked ——
|
|
2508
|
+
// blocked —— 持久停机(旧版全部关闭;压过租约与一切会话层)。
|
|
2441
2509
|
// 界面上的全局开关读意图;"临时运行 · N 个对话"来自 `leases`,它是全局 off 却能跑的
|
|
2442
2510
|
// 唯一解释。会话层不显示意图(那一层只回答"这个对话看不看得到")。
|
|
2443
2511
|
/** 某一格的全局意图:`'on' | 'off' | 'blocked' | null`(没记录 = 跟随运行态)。 */
|
|
@@ -2469,6 +2537,27 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2469
2537
|
var list = byKey && typeof byKey === 'object' ? byKey[key] : null
|
|
2470
2538
|
return Array.isArray(list) ? list : []
|
|
2471
2539
|
}
|
|
2540
|
+
/**
|
|
2541
|
+
* 这一格的认领**单位数**:工作区粒度按工作区计,会话粒度按对话计。
|
|
2542
|
+
*
|
|
2543
|
+
* 与徽章浮窗的分组同一口径(`leaseGroups`):有 cwd 的按归一化路径去重;没有 cwd 的
|
|
2544
|
+
* 会话各自算一个单位,不能并成一个「无工作区」。用于开关悬浮提示与操作回执,避免
|
|
2545
|
+
* 工作区粒度下文案说「N 个对话」而徽章说「N 个工作区」。
|
|
2546
|
+
*/
|
|
2547
|
+
function scopeLeaseUnitCount(domain, key) {
|
|
2548
|
+
var details = scopeLeaseDetails(domain, key)
|
|
2549
|
+
if (!scopeIsWorkspace()) return details.length
|
|
2550
|
+
var seen = Object.create(null)
|
|
2551
|
+
var n = 0
|
|
2552
|
+
details.forEach(function (d) {
|
|
2553
|
+
var cwd = String((d && d.cwd) || '')
|
|
2554
|
+
var unit = cwd === '' ? 'id:' + String((d && d.id) || '') : scopeWorkspacePathKey(cwd)
|
|
2555
|
+
if (seen[unit]) return
|
|
2556
|
+
seen[unit] = true
|
|
2557
|
+
n += 1
|
|
2558
|
+
})
|
|
2559
|
+
return n
|
|
2560
|
+
}
|
|
2472
2561
|
/** 这一域此刻有租约的键(全局层专用;会话层返回空)。「全部关闭」按它取目标集。 */
|
|
2473
2562
|
function scopeLeaseKeys(domain) {
|
|
2474
2563
|
if (scopeIsSession()) return []
|
|
@@ -2477,7 +2566,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2477
2566
|
return Object.keys(leases).filter(function (key) { return Number(leases[key]) > 0 })
|
|
2478
2567
|
}
|
|
2479
2568
|
/**
|
|
2480
|
-
*
|
|
2569
|
+
* 全部关闭成功后**就地**摘掉本地快照里的租约与意图,不等 `scope-get` 回来。
|
|
2481
2570
|
*
|
|
2482
2571
|
* 为什么不能改成再拉一次:服务端快照有短 TTL,紧接着的 `scope-get` 可能仍是写前的
|
|
2483
2572
|
* 那一份 —— 徽章会先消失又冒回来;而且整层重拉会让列表按新状态重新定序,用户刚打开的
|
|
@@ -2550,9 +2639,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2550
2639
|
if (String((d && d.id) || '') === id) { found = true; cwd = String((d && d.cwd) || '') }
|
|
2551
2640
|
})
|
|
2552
2641
|
if (!found) return
|
|
2642
|
+
var workspaceKey = scopeWorkspacePathKey(cwd)
|
|
2553
2643
|
var keep = list.filter(function (d) {
|
|
2554
2644
|
if (String((d && d.id) || '') === id) return false
|
|
2555
|
-
if (scopeIsWorkspace() &&
|
|
2645
|
+
if (scopeIsWorkspace() && workspaceKey !== '' && scopeWorkspacePathKey(d && d.cwd) === workspaceKey) return false
|
|
2556
2646
|
return true
|
|
2557
2647
|
})
|
|
2558
2648
|
var domainLeases = Object.assign({}, leases[domain] || {})
|
|
@@ -2591,7 +2681,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2591
2681
|
var list = all && typeof all === 'object' ? all[String(sceneName)] : null
|
|
2592
2682
|
return Array.isArray(list) ? list : []
|
|
2593
2683
|
}
|
|
2594
|
-
/**
|
|
2684
|
+
/** 全部关闭某个(或全部)场景后,就地改本地计数 —— 理由同 `scopeForgetLeases`。 */
|
|
2595
2685
|
function scopeForgetSceneLeases(sceneName) {
|
|
2596
2686
|
if (scopeIsSession()) return
|
|
2597
2687
|
var global = scopeState.global
|
|
@@ -2908,6 +2998,22 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
2908
2998
|
var parts = trimmed.split(/[\\/]/)
|
|
2909
2999
|
return parts.length ? parts[parts.length - 1] : trimmed
|
|
2910
3000
|
}
|
|
3001
|
+
/**
|
|
3002
|
+
* 工作区路径比较键:与服务端 `sessions/path-key.ts` 的 `workspacePathKey` 同一口径 ——
|
|
3003
|
+
* Windows 盘符 / UNC 路径统一分隔符并小写,其余平台大小写敏感;去掉尾分隔符。
|
|
3004
|
+
*
|
|
3005
|
+
* 为什么客户端也要这一份:浮窗按 cwd 给认领分组,分组键必须与服务端 `ws:<cwd>` 的
|
|
3006
|
+
* 归一化一致,否则同一个工作区会显示成两块、计数与释放范围也对不上。改这里时同步改
|
|
3007
|
+
* 服务端那一份(它是会话挂回与工作区作用域键的唯一真相)。
|
|
3008
|
+
*/
|
|
3009
|
+
function scopeWorkspacePathKey(cwd) {
|
|
3010
|
+
var raw = String(cwd == null ? '' : cwd).trim()
|
|
3011
|
+
if (!raw) return ''
|
|
3012
|
+
var windows = /^[A-Za-z]:[\\/]/.test(raw) || raw.indexOf('\\\\') === 0
|
|
3013
|
+
var out = windows ? raw.replace(/\//g, '\\') : raw
|
|
3014
|
+
while (out.length > 1 && (out.charAt(out.length - 1) === '\\' || out.charAt(out.length - 1) === '/')) out = out.slice(0, -1)
|
|
3015
|
+
return windows ? out.toLowerCase() : out
|
|
3016
|
+
}
|
|
2911
3017
|
/** 工作区键(`ws:<cwd>`)→ 显示名(键里带完整路径,去掉前缀再取末段)。 */
|
|
2912
3018
|
function scopeWorkspaceNameFromKey(key) {
|
|
2913
3019
|
var raw = String(key || '')
|
|
@@ -3230,18 +3336,23 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
3230
3336
|
batch: 'compat.op.batch', delete: 'compat.op.delete',
|
|
3231
3337
|
}
|
|
3232
3338
|
/**
|
|
3233
|
-
*
|
|
3339
|
+
* 本插件依赖的**必备**宿主契约能力 id(capability-specs.ts 里没有等价兜底、缺席即功能
|
|
3340
|
+
* 少一半的那些)。
|
|
3234
3341
|
*
|
|
3235
3342
|
* 与上面那排 action 的区别:action 是"这个操作走哪条路",这些是"某个契约还在不在"。
|
|
3236
3343
|
* 它们缺了都不抛错、只是功能少一半,所以单独一块而不是混进 action 表 —— 混进去会让
|
|
3237
3344
|
* "删除不可用"和"工具限制失效"看起来一样严重,实际后者不影响你删任何东西。
|
|
3238
3345
|
*
|
|
3239
|
-
*
|
|
3240
|
-
*
|
|
3241
|
-
*
|
|
3346
|
+
* 与服务端 `CONTRACT_CAPABILITY_IDS` 的关系:那边只映射 feature-overview 里**有独立行**
|
|
3347
|
+
* 的四条;这里还包含没有独立行、但同属必备契约的能力。两处都按能力 id 过滤 findings,
|
|
3348
|
+
* 任一处改名都会让对应条目在界面上静默消失,所以改了能力 id 就一起登记。
|
|
3242
3349
|
*/
|
|
3243
3350
|
var CONTRACT_CAPABILITY_IDS = [
|
|
3244
3351
|
'agentPreset.register', 'tools.restrict-method', 'agent.created-event', 'connection.admit',
|
|
3352
|
+
'tools.get-method', 'tools.guard-dispatch', 'tools.mcp-resource-args', 'systemPrompt.mcp-section',
|
|
3353
|
+
'mcp-client.config-schema', 'skills.register-provider', 'agents.list', 'pluginInventory.list',
|
|
3354
|
+
'webServer.register', 'sandboxPolicy.resolve', 'projection.cached-title',
|
|
3355
|
+
'official-skill-assets', 'official-sandbox-asset',
|
|
3245
3356
|
]
|
|
3246
3357
|
/**
|
|
3247
3358
|
* 「最近改动」流水里 op 的人类名(0.15.0 B2)。
|
|
@@ -3357,20 +3468,27 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
3357
3468
|
const findings = (data && data.findings) || []
|
|
3358
3469
|
const byId = {}
|
|
3359
3470
|
findings.forEach(function (f) { byId[f.id] = f })
|
|
3360
|
-
|
|
3471
|
+
// 缺席的 id 不能当成满足:那说明能力表被删 / 改名了,路由却仍会走一条已不再被探测的
|
|
3472
|
+
// 破坏性路径。与服务端 routeFor 同口径(fail-closed),否则页面说"可用"、点下去被拒。
|
|
3473
|
+
const ok = function (id) { return byId[id] !== undefined && byId[id].state === 'ok' }
|
|
3361
3474
|
const routes = {}
|
|
3362
|
-
routes.list = ok('workspace.read-state') && ok('workspace.read-table') && ok('workspace.index-shape')
|
|
3475
|
+
routes.list = ok('workspace.read-state') && ok('workspace.read-table') && ok('workspace.index-shape')
|
|
3476
|
+
&& ok('persistence.list') ? 'adapter' : 'none'
|
|
3363
3477
|
routes.archive = ok('workspace.archive-native') ? 'native' : (ok('workspace.enqueue') && ok('workspace.set-state') ? 'adapter' : 'none')
|
|
3364
3478
|
routes.unarchive = ok('workspace.unarchive-native') ? 'native' : (ok('workspace.enqueue') && ok('workspace.set-state') ? 'adapter' : 'none')
|
|
3365
3479
|
routes.batch = ok('workspace.batch-native') ? 'native' : (ok('workspace.enqueue') && ok('workspace.set-state') ? 'adapter' : 'none')
|
|
3366
|
-
// 与服务端 OPERATION_ROUTES 同源(src/compat/
|
|
3480
|
+
// 与服务端 OPERATION_ROUTES 同源(src/compat/host-roots.ts):
|
|
3367
3481
|
// · delete 不要求 `projection.delete-native` —— 宿主自带删除屏障是可选槽位,
|
|
3368
3482
|
// 要求它会把 rc.2 上的删除显示成不可用(服务端有意不要求);
|
|
3369
|
-
// · 但要求 `projection.table-delete` ——
|
|
3483
|
+
// · 但要求 `projection.table-delete` —— 那是运行时的硬前提(表不可删就没法安全删行);
|
|
3484
|
+
// · 还要求 `workspace.read-header` / `sessions.live-access` / `persistence.list` /
|
|
3485
|
+
// `persistence.transcript-locate` —— 删除入口在破坏性步骤之前会硬检查它们,
|
|
3486
|
+
// 不算进路由就会「页面说可用、点下去在链路中段报错」。
|
|
3370
3487
|
routes.delete = ok('workspace.delete-native') ? 'native'
|
|
3371
3488
|
: (ok('workspace.enqueue') && ok('workspace.set-state') && ok('workspace.index-header')
|
|
3372
|
-
&& ok('
|
|
3373
|
-
&& ok('
|
|
3489
|
+
&& ok('workspace.read-header') && ok('sessions.detach-live') && ok('sessions.cold-announce')
|
|
3490
|
+
&& ok('sessions.live-access') && ok('persistence.list') && ok('persistence.transcript-locate')
|
|
3491
|
+
&& ok('projection.write') && ok('projection.table-delete') ? 'adapter' : 'none')
|
|
3374
3492
|
return routes
|
|
3375
3493
|
}
|
|
3376
3494
|
|
|
@@ -3433,6 +3551,12 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
3433
3551
|
// 注入设置(本插件各注入域的开关,清单见 context-inject 的 INJECT_DOMAIN_KEYS)。它和可达性矩阵是一体两面:
|
|
3434
3552
|
// 矩阵说"到不到得了",这里决定"要不要"。读不到时这一节不显示。
|
|
3435
3553
|
const [inject, setInject] = React.useState(null)
|
|
3554
|
+
// 目录上限输入框的本地编辑态(`catalogCaps` 的键 → 未提交的字符串)。输入框不直接受
|
|
3555
|
+
// inject 控制:每键一次 apiCall 太吵,blur / 回车才提交。框里恒空(当前值在 placeholder
|
|
3556
|
+
// 灰显),所以编辑态只记"用户正在敲的那几个字符"。
|
|
3557
|
+
const [capEdits, setCapEdits] = React.useState({})
|
|
3558
|
+
// 目录上限的**出厂值**(服务端给的,src/catalog-caps.ts 是唯一真相):拿不到时显示 `—`。
|
|
3559
|
+
const [catalogDefaults, setCatalogDefaults] = React.useState(null)
|
|
3436
3560
|
// 斜杠命令入口(`/` 菜单里那个「工具」段)的开关。与 inject 同一类:读不到就不渲染这一节。
|
|
3437
3561
|
const [slash, setSlash] = React.useState(null)
|
|
3438
3562
|
// 注入 / 斜杠开关保存失败的原因。这两个开关是乐观更新(点一下立刻变),
|
|
@@ -3817,7 +3941,11 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
3817
3941
|
const enterToSubmit = function (ev) { if (ev.key === 'Enter') submitTokenModal() }
|
|
3818
3942
|
const loadInject = function (alive) {
|
|
3819
3943
|
apiCall('inject-settings', {})
|
|
3820
|
-
.then(function (r) {
|
|
3944
|
+
.then(function (r) {
|
|
3945
|
+
if (alive === false || !r || !r.ok || !r.settings) return
|
|
3946
|
+
setInject(r.settings)
|
|
3947
|
+
if (r.catalogDefaults) setCatalogDefaults(r.catalogDefaults)
|
|
3948
|
+
})
|
|
3821
3949
|
.catch(function () { /* 读不到 → 不渲染这一节 */ })
|
|
3822
3950
|
}
|
|
3823
3951
|
const loadSlash = function (alive) {
|
|
@@ -4019,6 +4147,22 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4019
4147
|
loadBackups(alive)
|
|
4020
4148
|
return function () { alive = false }
|
|
4021
4149
|
}, [])
|
|
4150
|
+
// 页头的「重新检测」:与首挂载同一组请求,显式带 refresh 绕过服务端 5 秒缓存。
|
|
4151
|
+
// 契约 / 版本在宿主原地升级后可能已经变了,而用户不该为此退页重进。
|
|
4152
|
+
const refreshAll = function () {
|
|
4153
|
+
setBusy(true)
|
|
4154
|
+
setError(null)
|
|
4155
|
+
apiCall('compat-status', { refresh: true })
|
|
4156
|
+
.then(function (r) { apply(r, true) })
|
|
4157
|
+
.catch(function (e) { setError(errMsg(e)); setBusy(false) })
|
|
4158
|
+
loadReach(true)
|
|
4159
|
+
loadInject(true)
|
|
4160
|
+
loadSlash(true)
|
|
4161
|
+
loadLive(true)
|
|
4162
|
+
loadFeatures(true)
|
|
4163
|
+
loadToken(true)
|
|
4164
|
+
loadBackups(true)
|
|
4165
|
+
}
|
|
4022
4166
|
// 保存注入设置:先乐观更新界面(点一下就该有反馈),服务端返回值到达后以其为准;
|
|
4023
4167
|
// 失败则重新拉一次。可达性矩阵跟着刷新 —— 芯片要反映新的开关状态。
|
|
4024
4168
|
// `{ok:false}` 与网络异常分开处理:前者是服务端明确拒绝(坏侧车 / 令牌失效),
|
|
@@ -4087,6 +4231,18 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4087
4231
|
+ blockers.length
|
|
4088
4232
|
+ unverified.length
|
|
4089
4233
|
+ Object.keys(sameAsHost).filter(function (name) { return sameAsHost[name] === false }).length
|
|
4234
|
+
// 契约漂移 / 缺失不一定让能力探测失败,但会让某项功能"看起来在跑、实际按旧契约跑"。
|
|
4235
|
+
// 页头必须把它算进结论,否则会出现「能力 18/18 全部可用」配一排黄色契约警告。
|
|
4236
|
+
// 可选包(宿主本就不提供)不算 —— 那条是部署形态,不是待复核。
|
|
4237
|
+
const contractReviewCount = [data && data.contracts && data.contracts.packages, data && data.behaviors && data.behaviors.packages, data && data.clientUi && data.clientUi.packages]
|
|
4238
|
+
.map(function (list) { return Array.isArray(list) ? list : [] })
|
|
4239
|
+
.reduce(function (sum, list) {
|
|
4240
|
+
return sum + list.filter(function (item) {
|
|
4241
|
+
return item && (item.resolved === null ? item.optional !== true : (item.missingMarkers || []).length > 0)
|
|
4242
|
+
}).length
|
|
4243
|
+
}, 0)
|
|
4244
|
+
// 三种结论:真问题(红) / 契约待复核(黄) / 全部可用(无标记)。
|
|
4245
|
+
const attention = blockedCount > 0 ? 'blocked' : contractReviewCount > 0 ? 'review' : 'ok'
|
|
4090
4246
|
const unavailableCount = Object.keys(OPERATION_LABELS).filter(function (op) { return routes[op] === 'none' }).length
|
|
4091
4247
|
|
|
4092
4248
|
const routeClass = function (via) {
|
|
@@ -4115,12 +4271,33 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4115
4271
|
case 'workspace.delete-native': return t('compat.cap.workspaceDeleteNative')
|
|
4116
4272
|
case 'sessions.detach-live': return t('compat.cap.sessionsDetachLive')
|
|
4117
4273
|
case 'sessions.cold-announce': return t('compat.cap.sessionsColdAnnounce')
|
|
4274
|
+
case 'sessions.live-access': return t('compat.cap.sessionsLiveAccess')
|
|
4275
|
+
case 'persistence.list': return t('compat.cap.persistenceList')
|
|
4276
|
+
case 'persistence.transcript-locate': return t('compat.cap.persistenceTranscriptLocate')
|
|
4277
|
+
case 'persistence.transcript-read': return t('compat.cap.persistenceTranscriptRead')
|
|
4118
4278
|
case 'projection.write': return t('compat.cap.projectionWrite')
|
|
4119
4279
|
case 'projection.table-delete': return t('compat.cap.projectionTableDelete')
|
|
4120
4280
|
case 'agentPreset.register': return t('compat.cap.agentPresetRegister')
|
|
4121
4281
|
case 'tools.restrict-method': return t('compat.cap.toolsRestrictMethod')
|
|
4282
|
+
case 'tools.schema-list': return t('compat.cap.toolsSchemaList')
|
|
4283
|
+
case 'tools.get-method': return t('compat.cap.toolsGetMethod')
|
|
4284
|
+
case 'tools.guard-dispatch': return t('compat.cap.toolsGuardDispatch')
|
|
4285
|
+
case 'tools.mcp-resource-args': return t('compat.cap.toolsMcpResourceArgs')
|
|
4286
|
+
case 'systemPrompt.mcp-section': return t('compat.cap.systemPromptMcpSection')
|
|
4287
|
+
case 'mcp-client.config-schema': return t('compat.cap.mcpClientConfigSchema')
|
|
4288
|
+
case 'skills.register-provider': return t('compat.cap.skillsRegisterProvider')
|
|
4289
|
+
case 'agents.list': return t('compat.cap.agentsList')
|
|
4290
|
+
case 'pluginInventory.list': return t('compat.cap.pluginInventoryList')
|
|
4291
|
+
case 'webServer.register': return t('compat.cap.webServerRegister')
|
|
4292
|
+
case 'sandboxPolicy.resolve': return t('compat.cap.sandboxPolicyResolve')
|
|
4293
|
+
case 'projection.cached-title': return t('compat.cap.projectionCachedTitle')
|
|
4294
|
+
case 'official-skill-assets': return t('compat.cap.officialSkillAssets')
|
|
4295
|
+
case 'official-sandbox-asset': return t('compat.cap.officialSandboxAsset')
|
|
4122
4296
|
case 'agent.created-event': return t('compat.cap.agentCreatedEvent')
|
|
4123
4297
|
case 'connection.admit': return t('compat.cap.connectionAdmit')
|
|
4298
|
+
case 'subagents.runtime': return t('compat.cap.subagentsRuntime')
|
|
4299
|
+
case 'llm.model-catalog': return t('compat.cap.llmModelCatalog')
|
|
4300
|
+
case 'approval.effective-policy': return t('compat.cap.approvalEffectivePolicy')
|
|
4124
4301
|
case 'archive': return t('compat.cap.opArchive')
|
|
4125
4302
|
case 'unarchive': return t('compat.cap.opUnarchive')
|
|
4126
4303
|
case 'batch': return t('compat.cap.opBatch')
|
|
@@ -4154,6 +4331,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4154
4331
|
case 'slash-commands': return t('compat.ov.slashCommands')
|
|
4155
4332
|
case 'native-delete': return t('compat.ov.nativeDelete')
|
|
4156
4333
|
case 'host-identity': return t('compat.ov.hostIdentity')
|
|
4334
|
+
case 'host-contracts': return t('compat.ov.hostContracts')
|
|
4157
4335
|
case 'memory': return t('compat.ov.memory')
|
|
4158
4336
|
case 'prompts': return t('compat.ov.prompts')
|
|
4159
4337
|
case 'subagents': return t('compat.ov.subagents')
|
|
@@ -4254,6 +4432,13 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4254
4432
|
if (row.slashTools && row.slashQuickPrompts) return t('compat.ov.slashCommands.on')
|
|
4255
4433
|
return t(row.slashTools ? 'compat.ov.slashCommands.onTools' : 'compat.ov.slashCommands.onQuick')
|
|
4256
4434
|
}
|
|
4435
|
+
if (row.key === 'host-contracts') {
|
|
4436
|
+
if (row.state === 'ok') return t('compat.ov.hostContracts.ok')
|
|
4437
|
+
const items = (row.contracts || []).map(function (item) {
|
|
4438
|
+
return t('compat.ov.hostContracts.item', { package: item.package, feature: item.feature })
|
|
4439
|
+
})
|
|
4440
|
+
return t('compat.ov.hostContracts.degraded', { count: items.length, list: list(items) })
|
|
4441
|
+
}
|
|
4257
4442
|
if (row.key === 'host-identity') {
|
|
4258
4443
|
if (row.state === 'unknown') return t('compat.ov.route.unknown')
|
|
4259
4444
|
if (row.state === 'degraded') return t('compat.ov.hostIdentity.degraded', { list: list(row.blockers) })
|
|
@@ -4726,6 +4911,75 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4726
4911
|
React.createElement('span', { className: 'dsm-inject-chip-dot' }),
|
|
4727
4912
|
React.createElement('span', { className: 'dsm-inject-chip-name' }, t('compat.inject.domain.' + key)))
|
|
4728
4913
|
})))
|
|
4914
|
+
const caps = inject.catalogCaps || {}
|
|
4915
|
+
// 键 = `catalogCaps` 里的字段名(skills / skillsDescription / mcp / subagents /
|
|
4916
|
+
// subagentsDescription),五域各一个,天然唯一 —— 编辑态直接用数据键,不做二次拼接。
|
|
4917
|
+
// 框**永远空着**:当前生效值只在 placeholder 里灰显(没配 = 出厂值),提交后即清空
|
|
4918
|
+
// —— 界面常态是"空框 + 灰字",不与真值打架,也看不出这是能编辑的既有值还是占位。
|
|
4919
|
+
// 清空发 `null`(回出厂值)而不是 `undefined`:后者会被 JSON 丢掉,服务端逐项合并
|
|
4920
|
+
// 时会把旧值留下来。
|
|
4921
|
+
const capValueShown = function (key) {
|
|
4922
|
+
return Object.prototype.hasOwnProperty.call(capEdits, key) ? capEdits[key] : ''
|
|
4923
|
+
}
|
|
4924
|
+
const capPlaceholder = function (key, fallback) {
|
|
4925
|
+
const v = caps[key]
|
|
4926
|
+
if (v !== undefined && v !== null) return String(v)
|
|
4927
|
+
// 没配 = 出厂值:只用服务端给的那份(src/catalog-caps.ts 是唯一真相,界面不写第二份
|
|
4928
|
+
// 字面量 —— 改一次默认值要改三四处,漏一处就显示陈旧值)。拿不到时显示 `—`。
|
|
4929
|
+
const d = catalogDefaults && catalogDefaults[key]
|
|
4930
|
+
return d === undefined || d === null ? fallback : String(d)
|
|
4931
|
+
}
|
|
4932
|
+
const capCommit = function (key) {
|
|
4933
|
+
const raw = capEdits[key]
|
|
4934
|
+
if (raw === undefined) return
|
|
4935
|
+
setCapEdits(function (prev) { const next = Object.assign({}, prev); delete next[key]; return next })
|
|
4936
|
+
const text = String(raw).trim()
|
|
4937
|
+
const parsed = text === '' ? null : Number(text)
|
|
4938
|
+
const value = parsed !== null && Number.isFinite(parsed) ? Math.floor(parsed) : null
|
|
4939
|
+
const current = caps[key] === undefined || caps[key] === null ? null : caps[key]
|
|
4940
|
+
if (value === current) return
|
|
4941
|
+
// 清空发 `null`(回出厂值)而不是 `undefined`:后者会被 JSON 丢掉,
|
|
4942
|
+
// 服务端逐项合并时会把旧值留下来。
|
|
4943
|
+
const patchCaps = Object.assign({}, caps)
|
|
4944
|
+
patchCaps[key] = value
|
|
4945
|
+
saveInject({ catalogCaps: patchCaps })
|
|
4946
|
+
}
|
|
4947
|
+
const capInput = function (key, label, unit, fallback) {
|
|
4948
|
+
return React.createElement('label', { key: key, className: 'dsm-cap-field' },
|
|
4949
|
+
React.createElement('span', { className: 'dsm-cap-label' }, label),
|
|
4950
|
+
React.createElement('input', {
|
|
4951
|
+
className: 'dsm-control dsm-cap-input', type: 'number', min: 1,
|
|
4952
|
+
value: capValueShown(key), placeholder: capPlaceholder(key, fallback),
|
|
4953
|
+
onChange: function (e) { setCapEdits(Object.assign({}, capEdits, (function () { const p = {}; p[key] = e.target.value; return p }()) )) },
|
|
4954
|
+
onBlur: function () { capCommit(key) },
|
|
4955
|
+
onKeyDown: function (e) { if (e.key === 'Enter') { e.preventDefault(); capCommit(key) } },
|
|
4956
|
+
}),
|
|
4957
|
+
React.createElement('span', { className: 'dsm-cap-unit' }, unit))
|
|
4958
|
+
}
|
|
4959
|
+
// 三个域各占一行(域名固定宽,三行的「最多注入」列左右对齐):域名 + 「最多注入 [框] 条
|
|
4960
|
+
// 描述最多显示 [框] 字符」。单位跟在框后(不塞进 placeholder):框里的数是当前生效值,
|
|
4961
|
+
// 单位是这一格的量纲,两者分开才读得出「最多注入 100 条」是一句话。
|
|
4962
|
+
const capGroup = function (domain, fields) {
|
|
4963
|
+
return React.createElement('span', { key: 'cap-' + domain, className: 'dsm-cap-group' },
|
|
4964
|
+
React.createElement('span', { className: 'dsm-cap-name' }, t('compat.inject.domain.' + domain)),
|
|
4965
|
+
fields.map(function (f) { return capInput(f.key, t(f.label), t(f.unit), f.ph) }))
|
|
4966
|
+
}
|
|
4967
|
+
injectParts.push(
|
|
4968
|
+
React.createElement('div', { key: 'caps-head', className: 'dsm-seg-group' },
|
|
4969
|
+
React.createElement('span', null, t('compat.inject.caps')),
|
|
4970
|
+
React.createElement('span', { className: 'dsm-seg-group-line' })),
|
|
4971
|
+
React.createElement('div', { key: 'caps', className: 'dsm-caps-row' },
|
|
4972
|
+
capGroup('skills', [
|
|
4973
|
+
{ key: 'skills', label: 'compat.inject.caps.entries', unit: 'compat.inject.caps.entriesUnit', ph: '—' },
|
|
4974
|
+
{ key: 'skillsDescription', label: 'compat.inject.caps.descLen', unit: 'compat.inject.caps.descLenUnit', ph: '—' },
|
|
4975
|
+
]),
|
|
4976
|
+
capGroup('mcp', [
|
|
4977
|
+
{ key: 'mcp', label: 'compat.inject.caps.entries', unit: 'compat.inject.caps.entriesUnit', ph: '—' },
|
|
4978
|
+
]),
|
|
4979
|
+
capGroup('subagents', [
|
|
4980
|
+
{ key: 'subagents', label: 'compat.inject.caps.entries', unit: 'compat.inject.caps.entriesUnit', ph: '—' },
|
|
4981
|
+
{ key: 'subagentsDescription', label: 'compat.inject.caps.descLen', unit: 'compat.inject.caps.descLenUnit', ph: '—' },
|
|
4982
|
+
])))
|
|
4729
4983
|
}
|
|
4730
4984
|
// 两块数据各自独立加载:inject 读不到时斜杠入口照样要出现,反之也一样,所以整块的条件是
|
|
4731
4985
|
// 「任一有值」—— 缺的那半只是不出现,不把另一半一起吞掉。
|
|
@@ -4837,6 +5091,53 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4837
5091
|
// 而且"出厂默认关掉"这件事用户不需要为此做什么 —— 要用就勾上,不用管它。
|
|
4838
5092
|
rows)))
|
|
4839
5093
|
}
|
|
5094
|
+
// 预设注入边界:五类内容(记忆 / 全局提示词 / 技能 / MCP / 子智能体)在**每个 Agent
|
|
5095
|
+
// 预设**下到不到得了模型。回答的是"面板标着已注入,模型真的看得到吗"——本插件的
|
|
5096
|
+
// 注入由它自己在每步发出(极简这类预设下默认不发,可用上面的「注入」块强制),
|
|
5097
|
+
// 而全局提示词与技能目录还要看官方那两条行挂没挂(极简都没挂)。紧挨模型工具表下方;
|
|
5098
|
+
// 取不到时这一节不显示,不影响上面的结论。
|
|
5099
|
+
//
|
|
5100
|
+
// 排版口径(用户裁定 2026-09-15):每格一枚描边标签,**绿框=能用、红框=不能用、
|
|
5101
|
+
// 灰框=判断不了**;不再出现 ✓/✗ 符号,也不再有任何整行的解释文字 —— 预设损坏与
|
|
5102
|
+
// 解析失败缩成预设名旁边的小标签。MCP 与子智能体两列由宿主侧的 preset-reach 给出。
|
|
5103
|
+
if (presetReach && Array.isArray(presetReach.rows) && presetReach.rows.length) {
|
|
5104
|
+
push(section(t('compat.reach'), null,
|
|
5105
|
+
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5106
|
+
presetReach.rows.map(function (row) {
|
|
5107
|
+
// ok → 绿框;absent / suppressed → 红框;其余(unknown,含宿主还没回传该字段)
|
|
5108
|
+
// 一律灰框,绝不把"读不到"画成"不能用"。
|
|
5109
|
+
const chip = function (label, state) {
|
|
5110
|
+
const kind = state === 'ok' ? 'ok' : (state === 'absent' || state === 'suppressed') ? 'bad' : 'unknown'
|
|
5111
|
+
return React.createElement('span', { className: 'dsm-reach-chip dsm-reach-' + kind, key: label }, label)
|
|
5112
|
+
}
|
|
5113
|
+
const tags = []
|
|
5114
|
+
if (row.suppressing) tags.push(React.createElement('span', { className: 'dsm-tag dsm-tag-off', key: 'suppressing' }, t('compat.reach.suppressing')))
|
|
5115
|
+
if (row.broken) tags.push(React.createElement('span', { className: 'dsm-tag dsm-tag-off', key: 'broken' }, t('compat.reach.broken')))
|
|
5116
|
+
else if (row.reason) tags.push(React.createElement('span', { className: 'dsm-tag', key: 'reason' }, t('compat.reach.whyUnknown')))
|
|
5117
|
+
return React.createElement('div', { className: 'dsm-compat-mod-row', key: row.presetId },
|
|
5118
|
+
React.createElement('span', { className: 'dsm-compat-name dsm-reach-name' },
|
|
5119
|
+
React.createElement('span', null, (PRESET_MODE_NAME_KEYS[row.presetId] ? t(PRESET_MODE_NAME_KEYS[row.presetId]) : (row.name || row.presetId)) + (row.isDefault ? ' · ' + t('compat.reach.default') : '')),
|
|
5120
|
+
tags.length ? React.createElement('span', { className: 'dsm-tags' }, tags) : null),
|
|
5121
|
+
// 芯片顺序与「注入」块的勾选顺序一致(用户裁定 2026-09-16;2026-09-23 起
|
|
5122
|
+
// 场景与记忆是两个域,各占一枚):场景 → 记忆 → MCP → 技能 → 子智能体 → 提示词。
|
|
5123
|
+
React.createElement('span', { className: 'dsm-compat-reach-marks' },
|
|
5124
|
+
chip(t('compat.reach.mark.scene'), row.scene),
|
|
5125
|
+
chip(t('compat.reach.mark.memory'), row.memory),
|
|
5126
|
+
chip(t('compat.reach.mark.mcp'), row.mcp),
|
|
5127
|
+
chip(t('compat.reach.mark.skill'), row.skillCatalog),
|
|
5128
|
+
chip(t('compat.reach.mark.subagent'), row.subagent),
|
|
5129
|
+
chip(t('compat.reach.mark.agentsMd'), row.agentsMd)))
|
|
5130
|
+
}))))
|
|
5131
|
+
|
|
5132
|
+
// 页脚用「标题 + 条目」清单,与导入弹窗的「文件要求」同款结构与样式(用户裁定
|
|
5133
|
+
// 2026-09-16 第二版:条目要短、不列路径与内部机制,使用者知道"有这回事"就够)。
|
|
5134
|
+
push(React.createElement('div', { className: 'dsm-upload-requirements' },
|
|
5135
|
+
React.createElement('div', { className: 'dsm-label' }, t('compat.reach.tools.title')),
|
|
5136
|
+
React.createElement('ul', null,
|
|
5137
|
+
[1, 2, 3, 4].map(function (n) {
|
|
5138
|
+
return React.createElement('li', { key: n }, t('compat.reach.tools.' + n))
|
|
5139
|
+
}))))
|
|
5140
|
+
}
|
|
4840
5141
|
// 注入实况:紧挨「注入」设置块下方。数据来自 `injection-live`(宿主读最近活跃会话的
|
|
4841
5142
|
// 可见表面),是"回放"不是"重算"—— 界面显示已注入而模型实际没收到时(场景接管、
|
|
4842
5143
|
// 压制型预设、开关被关、压缩后还没补发),这里一眼可见。
|
|
@@ -4988,27 +5289,34 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
4988
5289
|
// 它自带的 summary 是中文,直接渲染会让英文界面露出中文)。
|
|
4989
5290
|
const findingsN = Array.isArray(data.findings) ? data.findings.length : 0
|
|
4990
5291
|
const degradedN = Array.isArray(data.degraded) ? data.degraded.length : 0
|
|
4991
|
-
//
|
|
4992
|
-
// 「全部可用」——
|
|
4993
|
-
// (2026-09-30 桌面版实测)。
|
|
5292
|
+
// 摘要四形态:能力降级 / 仅身份待处理 / 契约待复核 / 全部可用。后两种都不能说
|
|
5293
|
+
// 「全部可用」—— 横幅已转黄或转红,摘要却报一切正常,两句自相矛盾。
|
|
4994
5294
|
const summaryKey = degradedN > 0 ? 'compat.summary.degraded'
|
|
4995
|
-
: blockedCount > 0 ? 'compat.summary.identity'
|
|
5295
|
+
: blockedCount > 0 ? 'compat.summary.identity'
|
|
5296
|
+
: contractReviewCount > 0 ? 'compat.summary.review' : 'compat.summary.ok'
|
|
5297
|
+
const summaryCount = degradedN > 0 ? degradedN : blockedCount > 0 ? blockedCount : contractReviewCount
|
|
4996
5298
|
const summaryText = findingsN === 0
|
|
4997
5299
|
? (data.summary || '')
|
|
4998
5300
|
: t(summaryKey)
|
|
4999
5301
|
.replace('{version}', String((data.host && data.host.version) || '?'))
|
|
5000
5302
|
.replace('{ok}', String(findingsN - degradedN))
|
|
5001
5303
|
.replace('{total}', String(findingsN))
|
|
5002
|
-
.replace('{count}', String(
|
|
5003
|
-
push(React.createElement('div', { className: 'dsm-compat-bar' + (
|
|
5004
|
-
React.createElement('span', { className: 'dsm-compat-dot' + (
|
|
5005
|
-
React.createElement('strong', null,
|
|
5304
|
+
.replace('{count}', String(summaryCount))
|
|
5305
|
+
push(React.createElement('div', { className: 'dsm-compat-bar' + (attention !== 'ok' ? ' dsm-compat-bar-warn' : '') },
|
|
5306
|
+
React.createElement('span', { className: 'dsm-compat-dot' + (attention !== 'ok' ? ' dsm-compat-dot-warn' : '') }),
|
|
5307
|
+
React.createElement('strong', null, attention === 'blocked' ? t('compat.state.blocked')
|
|
5308
|
+
: attention === 'review' ? t('compat.state.review') : t('compat.state.ok')),
|
|
5006
5309
|
React.createElement('span', { className: 'dsm-compat-sum' }, summaryText)))
|
|
5007
5310
|
// 诊断包:排障时用户能一键复制一份"环境 + 状态",不必逐项截图。
|
|
5008
5311
|
// 放在结论条下面而不是页脚:有阻塞项时它就在眼前。
|
|
5312
|
+
// 同时给出检测时间:compat-status 有 5s 短 TTL,用户得知道眼前这份结论有多旧。
|
|
5009
5313
|
push(React.createElement('div', { className: 'dsm-feedback-row' },
|
|
5010
5314
|
React.createElement('button', { type: 'button', className: 'dsm-btn dsm-btn-quiet', onClick: copyDiagnostics },
|
|
5011
|
-
diagCopied ? t('compat.diag.copied') : t('compat.diag.copy'))
|
|
5315
|
+
diagCopied ? t('compat.diag.copied') : t('compat.diag.copy')),
|
|
5316
|
+
data.generatedAt
|
|
5317
|
+
? React.createElement('span', { className: 'dsm-help' },
|
|
5318
|
+
t('compat.generatedAt').replace('{time}', new Date(Number(data.generatedAt)).toLocaleString()))
|
|
5319
|
+
: null))
|
|
5012
5320
|
|
|
5013
5321
|
// 指标卡:宿主 / 本插件适配版本 / 可用能力(含插件自补的 optional 槽位)。
|
|
5014
5322
|
// 三张卡都只在**有事要说**时带注脚:
|
|
@@ -5113,7 +5421,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
5113
5421
|
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5114
5422
|
degraded.map(function (item) {
|
|
5115
5423
|
return React.createElement('div', { className: 'dsm-compat-mod-row', key: item.id },
|
|
5116
|
-
React.createElement('span', { className: 'dsm-compat-name' }, item.label),
|
|
5424
|
+
React.createElement('span', { className: 'dsm-compat-name' }, capLabel(item.id, item.label)),
|
|
5117
5425
|
React.createElement('span', { className: 'dsm-compat-pill dsm-compat-pill-warn' },
|
|
5118
5426
|
item.fallback === 'native-entry' ? t('compat.fallback.native')
|
|
5119
5427
|
: item.fallback === 'refuse-operation' ? t('compat.fallback.refuse')
|
|
@@ -5138,8 +5446,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
5138
5446
|
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5139
5447
|
optionalAbsent.map(function (item) {
|
|
5140
5448
|
return React.createElement('div', { className: 'dsm-compat-mod-row', key: item.id },
|
|
5141
|
-
React.createElement('span', { className: 'dsm-compat-name' }, item.label),
|
|
5142
|
-
React.createElement('span', { className: 'dsm-compat-pill' },
|
|
5449
|
+
React.createElement('span', { className: 'dsm-compat-name' }, capLabel(item.id, item.label)),
|
|
5450
|
+
React.createElement('span', { className: 'dsm-compat-pill' }, item.fallback === 'inform-only'
|
|
5451
|
+
? t('compat.fallback.informOnly')
|
|
5452
|
+
: t('compat.fallback.substituted')),
|
|
5143
5453
|
React.createElement('span', { className: 'dsm-compat-mod dsm-compat-mod-self' },
|
|
5144
5454
|
React.createElement('span', { className: 'dsm-compat-label' }, t('compat.reason')),
|
|
5145
5455
|
item.detail))
|
|
@@ -5178,10 +5488,54 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
5178
5488
|
React.createElement('span', { className: 'dsm-compat-pill ' + cls }, text))
|
|
5179
5489
|
}))))
|
|
5180
5490
|
|
|
5491
|
+
// 逐包版本:回答「升级后哪个官方包先变了、还在不在适配范围」。
|
|
5492
|
+
// 与上面模块实体那一块分开的:那里比的是**物理文件是不是同一份**,
|
|
5493
|
+
// 这里比的是**版本号与 peer 范围** —— 路径相同也可能版本已经变了(宿主原地升级)。
|
|
5494
|
+
const hostPackages = (data && data.packages) || []
|
|
5495
|
+
if (hostPackages.length) {
|
|
5496
|
+
const driftedPackages = hostPackages.filter(function (item) { return item.versionDrift === true }).length
|
|
5497
|
+
push(section(t('compat.packages'), driftedPackages > 0
|
|
5498
|
+
? t('compat.packages.hint', { count: driftedPackages })
|
|
5499
|
+
: t('compat.packages.allOk'),
|
|
5500
|
+
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5501
|
+
hostPackages.map(function (item) {
|
|
5502
|
+
const known = Boolean(item.hostVersion)
|
|
5503
|
+
const optionalUnknown = !known && item.optional === true
|
|
5504
|
+
const outOfRange = item.inPeerRange === false
|
|
5505
|
+
const drifted = item.versionDrift === true
|
|
5506
|
+
const cls = optionalUnknown ? ''
|
|
5507
|
+
: outOfRange ? 'dsm-compat-pill-bad'
|
|
5508
|
+
: drifted ? 'dsm-compat-pill-warn'
|
|
5509
|
+
: known ? 'dsm-compat-pill-ok' : ''
|
|
5510
|
+
const pill = optionalUnknown ? t('compat.packages.optional')
|
|
5511
|
+
: outOfRange ? t('compat.packages.out')
|
|
5512
|
+
: drifted ? t('compat.packages.changed')
|
|
5513
|
+
: known ? t('compat.packages.baseline') : t('compat.packages.unknown')
|
|
5514
|
+
const detail = optionalUnknown
|
|
5515
|
+
? t('compat.packages.optionalDetail')
|
|
5516
|
+
: item.observed === true
|
|
5517
|
+
? t('compat.packages.detailObserved', {
|
|
5518
|
+
host: item.hostVersion || '—',
|
|
5519
|
+
baseline: item.baselineVersion || '—',
|
|
5520
|
+
})
|
|
5521
|
+
: t('compat.packages.detail', {
|
|
5522
|
+
host: item.hostVersion || '—',
|
|
5523
|
+
plugin: item.pluginVersion || '—',
|
|
5524
|
+
baseline: item.baselineVersion || '—',
|
|
5525
|
+
range: item.peerRange || '—',
|
|
5526
|
+
}) + (item.sameModule === false ? ' · ' + t('compat.packages.separate') : '')
|
|
5527
|
+
return React.createElement('div', { className: 'dsm-compat-mod-row', key: item.name },
|
|
5528
|
+
React.createElement('span', { className: 'dsm-compat-name dsm-compat-mod' }, item.name),
|
|
5529
|
+
React.createElement('span', { className: 'dsm-compat-pill ' + cls }, pill),
|
|
5530
|
+
React.createElement('span', { className: 'dsm-compat-mod dsm-compat-mod-self' },
|
|
5531
|
+
React.createElement('span', { className: 'dsm-compat-label' }, t('compat.reason')), detail))
|
|
5532
|
+
}))))
|
|
5533
|
+
}
|
|
5534
|
+
|
|
5181
5535
|
// 裸模块解析(与上面那一块的分工:上面比的是**同一份物理模块**,这里看的是**包还在不在**)。
|
|
5182
5536
|
//
|
|
5183
5537
|
// 为什么分开:上面那 6 个包是插件的 peerDependency,「两份不同拷贝」那种故障只可能发生在
|
|
5184
|
-
// 它们身上;而下面这
|
|
5538
|
+
// 它们身上;而下面这 5 个包是插件按**裸模块名**在运行时 require 的官方包,宿主不要求插件
|
|
5185
5539
|
// 依赖它们。官方撤掉其中一个,对应功能静默降级,而身份比对那一栏根本看不见它们 —— 所以
|
|
5186
5540
|
// 必须在这里列一行。canary 缺失不是「包坏了」,是「该人工复核这条契约」,显示成提示而非红色。
|
|
5187
5541
|
const contractPackages = (data && data.contracts && data.contracts.packages) || []
|
|
@@ -5203,7 +5557,77 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
5203
5557
|
}))))
|
|
5204
5558
|
}
|
|
5205
5559
|
|
|
5206
|
-
//
|
|
5560
|
+
// 宿主行为契约:插件没有 require 这些包,但把事件名 / 磁盘布局 / 配置键 / 补丁方言
|
|
5561
|
+
// 写死在自己代码里。官方改掉其中一个不抛错,对应功能只是悄悄失效 —— 所以单独一块
|
|
5562
|
+
// 列出「守着什么、缺了会怎样」,而不是混进能力降级里。
|
|
5563
|
+
const behaviorPackages = (data && data.behaviors && data.behaviors.packages) || []
|
|
5564
|
+
if (behaviorPackages.length) {
|
|
5565
|
+
push(section(t('compat.behaviors'), t('compat.behaviors.hint'),
|
|
5566
|
+
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5567
|
+
behaviorPackages.map(function (item) {
|
|
5568
|
+
const missing = item.resolved === null
|
|
5569
|
+
const optionalAbsent = missing && item.optional === true
|
|
5570
|
+
const drifted = !missing && (item.missingMarkers || []).length > 0
|
|
5571
|
+
const cls = optionalAbsent ? ''
|
|
5572
|
+
: missing ? 'dsm-compat-pill-bad'
|
|
5573
|
+
: drifted ? 'dsm-compat-pill-warn' : 'dsm-compat-pill-ok'
|
|
5574
|
+
const pill = optionalAbsent ? t('compat.behaviors.optional')
|
|
5575
|
+
: missing ? t('compat.behaviors.absent')
|
|
5576
|
+
: drifted ? t('compat.behaviors.drift') : t('compat.behaviors.present')
|
|
5577
|
+
const notes = item.missingMarkerNotes || []
|
|
5578
|
+
const markers = notes.length
|
|
5579
|
+
? notes.map(function (note) { return String(note.needle || '') + '(' + String(note.why || '') + ')' }).join(';')
|
|
5580
|
+
: (item.missingMarkers || []).join('、')
|
|
5581
|
+
const detail = optionalAbsent
|
|
5582
|
+
? t('compat.behaviors.optionalWhy', { feature: item.feature || '', impact: item.impact || '' })
|
|
5583
|
+
: missing
|
|
5584
|
+
? t('compat.behaviors.absentWhy', { feature: item.feature || '', impact: item.impact || '' })
|
|
5585
|
+
: drifted
|
|
5586
|
+
? t('compat.behaviors.driftWhy', { feature: item.feature || '', markers: markers, impact: item.impact || '' })
|
|
5587
|
+
: t('compat.behaviors.presentWhy', { feature: item.feature || '' })
|
|
5588
|
+
return React.createElement('div', { className: 'dsm-compat-mod-row', key: item.package },
|
|
5589
|
+
React.createElement('span', { className: 'dsm-compat-name dsm-compat-mod' }, item.package),
|
|
5590
|
+
React.createElement('span', { className: 'dsm-compat-pill ' + cls }, pill),
|
|
5591
|
+
React.createElement('span', { className: 'dsm-compat-mod dsm-compat-mod-self' },
|
|
5592
|
+
React.createElement('span', { className: 'dsm-compat-label' }, t('compat.reason')), detail))
|
|
5593
|
+
}))))
|
|
5594
|
+
}
|
|
5595
|
+
|
|
5596
|
+
// 宿主客户端 UI 契约:模块加载器 / 插槽名 / 客户端服务都在宿主客户端 bundle 里;
|
|
5597
|
+
// 服务端看不见浏览器,只能核对字符串标记。缺失只说明「该人工复核」,不是已坏。
|
|
5598
|
+
const clientUiPackages = (data && data.clientUi && data.clientUi.packages) || []
|
|
5599
|
+
if (clientUiPackages.length) {
|
|
5600
|
+
push(section(t('compat.clientUi'), t('compat.clientUi.hint'),
|
|
5601
|
+
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5602
|
+
clientUiPackages.map(function (item) {
|
|
5603
|
+
const missing = item.resolved === null
|
|
5604
|
+
const optionalAbsent = missing && item.optional === true
|
|
5605
|
+
const drifted = !missing && (item.missingMarkers || []).length > 0
|
|
5606
|
+
const cls = optionalAbsent ? ''
|
|
5607
|
+
: missing ? 'dsm-compat-pill-bad'
|
|
5608
|
+
: drifted ? 'dsm-compat-pill-warn' : 'dsm-compat-pill-ok'
|
|
5609
|
+
const pill = optionalAbsent ? t('compat.clientUi.optional')
|
|
5610
|
+
: missing ? t('compat.clientUi.absent')
|
|
5611
|
+
: drifted ? t('compat.clientUi.drift') : t('compat.clientUi.present')
|
|
5612
|
+
const notes = item.missingMarkerNotes || []
|
|
5613
|
+
const markers = notes.length
|
|
5614
|
+
? notes.map(function (note) { return String(note.needle || '') + '(' + String(note.why || '') + ')' }).join(';')
|
|
5615
|
+
: (item.missingMarkers || []).join('、')
|
|
5616
|
+
const detail = optionalAbsent
|
|
5617
|
+
? t('compat.clientUi.optionalWhy', { feature: item.feature || '', impact: item.impact || '' })
|
|
5618
|
+
: missing
|
|
5619
|
+
? t('compat.clientUi.absentWhy', { feature: item.feature || '', impact: item.impact || '' })
|
|
5620
|
+
: drifted
|
|
5621
|
+
? t('compat.clientUi.driftWhy', { feature: item.feature || '', markers: markers, impact: item.impact || '' })
|
|
5622
|
+
: t('compat.clientUi.presentWhy', { feature: item.feature || '' })
|
|
5623
|
+
return React.createElement('div', { className: 'dsm-compat-mod-row', key: item.package },
|
|
5624
|
+
React.createElement('span', { className: 'dsm-compat-name dsm-compat-mod' }, item.package),
|
|
5625
|
+
React.createElement('span', { className: 'dsm-compat-pill ' + cls }, pill),
|
|
5626
|
+
React.createElement('span', { className: 'dsm-compat-mod dsm-compat-mod-self' },
|
|
5627
|
+
React.createElement('span', { className: 'dsm-compat-label' }, t('compat.reason')), detail))
|
|
5628
|
+
}))))
|
|
5629
|
+
}
|
|
5630
|
+
|
|
5207
5631
|
// 归档宿主的说明排最前 —— 它解释的正是这一排「无法比较」的成因,而且必须讲明白
|
|
5208
5632
|
// **不要去跑 host-deps --fix**:那条命令会把插件的依赖指向 npx 缓存里另一个版本。
|
|
5209
5633
|
if (asarNote) {
|
|
@@ -5257,54 +5681,6 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
5257
5681
|
}
|
|
5258
5682
|
}
|
|
5259
5683
|
|
|
5260
|
-
// 预设注入边界:五类内容(记忆 / 全局提示词 / 技能 / MCP / 子智能体)在**每个 Agent
|
|
5261
|
-
// 预设**下到不到得了模型。回答的是"面板标着已注入,模型真的看得到吗"——本插件的
|
|
5262
|
-
// 注入由它自己在每步发出(极简这类预设下默认不发,可用上面的「注入」块强制),
|
|
5263
|
-
// 而全局提示词与技能目录还要看官方那两条行挂没挂(极简都没挂)。单独一块:取不到时
|
|
5264
|
-
// 这一节不显示,不影响上面的结论。
|
|
5265
|
-
//
|
|
5266
|
-
// 排版口径(用户裁定 2026-09-15):每格一枚描边标签,**绿框=能用、红框=不能用、
|
|
5267
|
-
// 灰框=判断不了**;不再出现 ✓/✗ 符号,也不再有任何整行的解释文字 —— 预设损坏与
|
|
5268
|
-
// 解析失败缩成预设名旁边的小标签。MCP 与子智能体两列由宿主侧的 preset-reach 给出。
|
|
5269
|
-
if (presetReach && Array.isArray(presetReach.rows) && presetReach.rows.length) {
|
|
5270
|
-
push(section(t('compat.reach'), null,
|
|
5271
|
-
React.createElement('div', { className: 'dsm-compat-mod-list dsm-compat-cards' },
|
|
5272
|
-
presetReach.rows.map(function (row) {
|
|
5273
|
-
// ok → 绿框;absent / suppressed → 红框;其余(unknown,含宿主还没回传该字段)
|
|
5274
|
-
// 一律灰框,绝不把"读不到"画成"不能用"。
|
|
5275
|
-
const chip = function (label, state) {
|
|
5276
|
-
const kind = state === 'ok' ? 'ok' : (state === 'absent' || state === 'suppressed') ? 'bad' : 'unknown'
|
|
5277
|
-
return React.createElement('span', { className: 'dsm-reach-chip dsm-reach-' + kind, key: label }, label)
|
|
5278
|
-
}
|
|
5279
|
-
const tags = []
|
|
5280
|
-
if (row.suppressing) tags.push(React.createElement('span', { className: 'dsm-tag dsm-tag-off', key: 'suppressing' }, t('compat.reach.suppressing')))
|
|
5281
|
-
if (row.broken) tags.push(React.createElement('span', { className: 'dsm-tag dsm-tag-off', key: 'broken' }, t('compat.reach.broken')))
|
|
5282
|
-
else if (row.reason) tags.push(React.createElement('span', { className: 'dsm-tag', key: 'reason' }, t('compat.reach.whyUnknown')))
|
|
5283
|
-
return React.createElement('div', { className: 'dsm-compat-mod-row', key: row.presetId },
|
|
5284
|
-
React.createElement('span', { className: 'dsm-compat-name dsm-reach-name' },
|
|
5285
|
-
React.createElement('span', null, (PRESET_MODE_NAME_KEYS[row.presetId] ? t(PRESET_MODE_NAME_KEYS[row.presetId]) : (row.name || row.presetId)) + (row.isDefault ? ' · ' + t('compat.reach.default') : '')),
|
|
5286
|
-
tags.length ? React.createElement('span', { className: 'dsm-tags' }, tags) : null),
|
|
5287
|
-
// 芯片顺序与「注入」块的勾选顺序一致(用户裁定 2026-09-16;2026-09-23 起
|
|
5288
|
-
// 场景与记忆是两个域,各占一枚):场景 → 记忆 → MCP → 技能 → 子智能体 → 提示词。
|
|
5289
|
-
React.createElement('span', { className: 'dsm-compat-reach-marks' },
|
|
5290
|
-
chip(t('compat.reach.mark.scene'), row.scene),
|
|
5291
|
-
chip(t('compat.reach.mark.memory'), row.memory),
|
|
5292
|
-
chip(t('compat.reach.mark.mcp'), row.mcp),
|
|
5293
|
-
chip(t('compat.reach.mark.skill'), row.skillCatalog),
|
|
5294
|
-
chip(t('compat.reach.mark.subagent'), row.subagent),
|
|
5295
|
-
chip(t('compat.reach.mark.agentsMd'), row.agentsMd)))
|
|
5296
|
-
}))))
|
|
5297
|
-
|
|
5298
|
-
// 页脚用「标题 + 条目」清单,与导入弹窗的「文件要求」同款结构与样式(用户裁定
|
|
5299
|
-
// 2026-09-16 第二版:条目要短、不列路径与内部机制,使用者知道"有这回事"就够)。
|
|
5300
|
-
push(React.createElement('div', { className: 'dsm-upload-requirements' },
|
|
5301
|
-
React.createElement('div', { className: 'dsm-label' }, t('compat.reach.tools.title')),
|
|
5302
|
-
React.createElement('ul', null,
|
|
5303
|
-
[1, 2, 3].map(function (n) {
|
|
5304
|
-
return React.createElement('li', { key: n }, t('compat.reach.tools.' + n))
|
|
5305
|
-
}))))
|
|
5306
|
-
}
|
|
5307
|
-
|
|
5308
5684
|
// ── 最近改动(0.15.0 B2)─────────────────────────────────────────────────
|
|
5309
5685
|
// 倒序列表 + 按域过滤 + 「同秒同来源」合并。落盘不去重(保真),合并只发生在展示层:
|
|
5310
5686
|
// 进一次场景会连写几条,逐条铺开会把「一次动作」读成「很多次改动」。
|
|
@@ -5821,6 +6197,14 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
5821
6197
|
title: t('compat.title'),
|
|
5822
6198
|
desc: t('compat.desc'),
|
|
5823
6199
|
actions: [
|
|
6200
|
+
React.createElement('button', {
|
|
6201
|
+
key: 'refresh',
|
|
6202
|
+
type: 'button',
|
|
6203
|
+
className: 'dsm-btn dsm-btn-quiet',
|
|
6204
|
+
disabled: busy,
|
|
6205
|
+
title: t('compat.refresh.title'),
|
|
6206
|
+
onClick: refreshAll,
|
|
6207
|
+
}, t('compat.refresh')),
|
|
5824
6208
|
compatDialogButton('audit', t('compat.audit')),
|
|
5825
6209
|
compatDialogButton('snapshot', t('snapshot.title')),
|
|
5826
6210
|
compatDialogButton('live', t('compat.live.title')),
|
|
@@ -6032,7 +6416,9 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6032
6416
|
"mcp.note.prefix": "备注:", "mcp.toggleServer": "启停服务", "mcp.toggleTool": "启停工具", "mcp.session.startGlobal": "全局关着:打开后仅为这个对话临时运行,全局设置不变。",
|
|
6033
6417
|
"mcp.intent.blockedHint": "全局已全部关闭这台服务器:会话层也不能打开它。先在全局重新打开。",
|
|
6034
6418
|
"mcp.intent.lease": "临时运行 · {count} 个对话", "mcp.intent.leaseHint": "全局是关的;{count} 个对话在用它,连接保持运行。",
|
|
6419
|
+
"mcp.intent.leaseWs": "临时运行 · {count} 个工作区", "mcp.intent.leaseHintWs": "全局是关的;{count} 个工作区在用它,连接保持运行。",
|
|
6035
6420
|
"mcp.intent.keptRunning": "已全局关闭;还有 {count} 个对话在用,连接保持运行(要立即关闭用「全部关闭」)。",
|
|
6421
|
+
"mcp.intent.keptRunningWs": "已全局关闭;还有 {count} 个工作区在用,连接保持运行(要立即关闭用「全部关闭」)。",
|
|
6036
6422
|
"mcp.intent.onOk": "已全局启用「{name}」。", "mcp.intent.offOk": "已全局关闭「{name}」。", "mcp.intent.stopped": "已全部关闭「{name}」:正在使用它的对话 / 工作区也已关闭。",
|
|
6037
6423
|
"mcp.intent.stop": "全部关闭",
|
|
6038
6424
|
"mcp.intent.stopTitle": "全部关闭?",
|
|
@@ -6107,6 +6493,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6107
6493
|
"memory.title": "记忆",
|
|
6108
6494
|
"tabs.scenes": "场景", "tabs.skills": "技能", "tabs.subagents": "子智能体", "tabs.prompts": "提示词", "tabs.memory": "记忆", "tabs.sessions": "会话", "tabs.compat": "兼容",
|
|
6109
6495
|
"compat.title": "宿主兼容", "compat.desc": "本插件与 DSH 的对接体检(只读)。",
|
|
6496
|
+
"compat.refresh": "重新检测", "compat.refresh.title": "重新探测宿主能力、版本与契约(忽略 5 秒缓存)",
|
|
6110
6497
|
"compat.backups.btn": "清理旧备份", "compat.backups.btnCount": "清理旧备份 · {count} 份", "compat.backups.btnHint": "删掉多余的配置备份副本(它们含明文密钥)", "compat.backups.btnTitle": "现有 {count} 份配置备份(共 {size},含明文密钥)", "compat.backups.title": "清理旧备份",
|
|
6111
6498
|
// 侧栏入口的开关(按钮文字说"点下去会发生什么":开着 → 「关闭侧栏」)。
|
|
6112
6499
|
"compat.sidebar.hide": "关闭侧栏", "compat.sidebar.show": "开启侧栏", "compat.sidebar.hideHint": "把本插件的入口从侧栏撤掉(「设置 → 工具管理」照旧可用)", "compat.sidebar.showHint": "在侧栏里挂出本插件的入口,点一下就在这里打开同一套页面", "compat.sidebar.failed": "侧栏开关没保存成功",
|
|
@@ -6152,11 +6539,12 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6152
6539
|
"compat.backups.confirm": "删除", "compat.backups.confirm.ask": "确认永久删除 {count} 个文件?不可恢复。", "compat.backups.confirm.yes": "确认永久删除",
|
|
6153
6540
|
"compat.backups.done": "已删除 {removed} 份,保留 {kept} 份。", "compat.backups.warnFailed": "{count} 份没能删除(可能被占用):{names}",
|
|
6154
6541
|
"compat.backups.loading": "正在读取备份清单…", "compat.backups.loadFailed": "读取备份清单失败", "compat.backups.cleanFailed": "清理失败",
|
|
6155
|
-
"compat.state.ok": "一切正常", "compat.state.blocked": "有需要处理的问题",
|
|
6542
|
+
"compat.state.ok": "一切正常", "compat.state.blocked": "有需要处理的问题", "compat.state.review": "有契约待复核",
|
|
6156
6543
|
"compat.checking": "检查中…", "compat.empty": "尚未检查", "compat.failed": "检查失败",
|
|
6157
6544
|
"compat.save.failed": "保存失败",
|
|
6158
6545
|
"compat.summary.ok": "宿主 {version} · 能力 {ok}/{total} · 全部可用", "compat.summary.degraded": "宿主 {version} · 能力 {ok}/{total} · 降级 {count} 项",
|
|
6159
6546
|
"compat.summary.identity": "宿主 {version} · 能力 {ok}/{total} · 身份 {count} 项待处理",
|
|
6547
|
+
"compat.summary.review": "宿主 {version} · 能力 {ok}/{total} · 契约 {count} 项待复核",
|
|
6160
6548
|
"compat.update.available": "插件有兼容更新:{current} → {best}", "compat.update.current": "插件已是最新兼容版本({current})",
|
|
6161
6549
|
"compat.update.localAhead": "本地版本 {current} 比 registry 上兼容的最高版 {best} 更新", "compat.update.none": "registry 上没有与宿主 {host} 兼容的版本",
|
|
6162
6550
|
"compat.update.incompatible": "当前插件版本 {current} 与本宿主 {host} 不兼容", "compat.update.hostUnknown": "取不到宿主版本,已跳过更新检查",
|
|
@@ -6176,7 +6564,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6176
6564
|
"update.install.copy": "复制命令", "update.install.copied": "已复制升级命令",
|
|
6177
6565
|
"update.install.copyFailed": "复制失败,请手动选中命令复制",
|
|
6178
6566
|
"update.install.noCommand": "这次检查没有给出可执行的命令,请重新点一次检查更新。",
|
|
6179
|
-
"compat.diag.copy": "复制诊断信息", "compat.diag.copied": "已复制诊断信息",
|
|
6567
|
+
"compat.diag.copy": "复制诊断信息", "compat.diag.copied": "已复制诊断信息", "compat.generatedAt": "检测时间:{time}",
|
|
6180
6568
|
"compat.host": "宿主版本", "compat.verified": "插件适配版本",
|
|
6181
6569
|
"compat.caps": "可用能力", "compat.caps.degraded": "{count} 项不可用",
|
|
6182
6570
|
"compat.caps.substituted": "缺口由插件自补",
|
|
@@ -6189,7 +6577,11 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6189
6577
|
"compat.others": "其它能力项",
|
|
6190
6578
|
"compat.contracts": "宿主契约", "compat.contracts.missing": "不在位", "compat.contracts.allOk": "本版依赖的宿主契约全部在位。",
|
|
6191
6579
|
"compat.bareModules": "裸模块解析", "compat.bareModules.present": "在位", "compat.bareModules.absent": "宿主未提供", "compat.bareModules.drift": "契约疑似漂移", "compat.bareModules.presentWhy": "影响:{feature}", "compat.bareModules.absentWhy": "宿主已不提供这个包:{feature}会降级", "compat.bareModules.driftWhy": "{feature}的契约标识有缺失({markers})—— 请人工核对该包的实现是否改过",
|
|
6580
|
+
"compat.packages": "宿主包版本(逐包)", "compat.packages.allOk": "全部官方包的版本与本插件适配基准一致。", "compat.packages.hint": "有 {count} 个官方包的版本与适配基准不同;超出 peer 范围的已在阻塞项中标出。", "compat.packages.baseline": "与基准一致", "compat.packages.changed": "版本与基准不同", "compat.packages.out": "超出适配范围", "compat.packages.unknown": "无法解析", "compat.packages.optional": "可选包未提供", "compat.packages.optionalDetail": "可选 peer:本机未安装,缺失按正常处理。", "compat.packages.detail": "宿主 {host} · 插件 {plugin} · 基准 {baseline} · peer {range}", "compat.packages.detailObserved": "宿主 {host} · 基准 {baseline} · 仅观测(非 peer)", "compat.packages.separate": "且插件加载的是另一份拷贝",
|
|
6581
|
+
"compat.behaviors": "宿主行为契约", "compat.behaviors.hint": "插件把这些宿主字符串契约写死在自己代码里;canary 缺失只说明「该人工复核」,不等于功能已经坏了。", "compat.behaviors.present": "契约标识在位", "compat.behaviors.drift": "契约疑似漂移", "compat.behaviors.absent": "宿主未提供", "compat.behaviors.optional": "本宿主未使用", "compat.behaviors.presentWhy": "影响:{feature}", "compat.behaviors.absentWhy": "宿主已不提供这个包:{feature}会失效({impact})", "compat.behaviors.optionalWhy": "该后端在本宿主未启用(正常形态);依赖它的功能:{feature}({impact})", "compat.behaviors.driftWhy": "{feature}的契约标识有缺失:{markers}。影响:{impact}。请人工核对该包的实现是否改过",
|
|
6582
|
+
"compat.clientUi": "客户端界面契约", "compat.clientUi.hint": "插件前端分片依赖宿主的模块加载器、插槽名与客户端服务;这里扫描的是宿主客户端 bundle 的字符串标记。", "compat.clientUi.present": "标记在位", "compat.clientUi.drift": "界面契约疑似漂移", "compat.clientUi.absent": "宿主未装配", "compat.clientUi.optional": "无客户端界面", "compat.clientUi.presentWhy": "影响:{feature}", "compat.clientUi.absentWhy": "宿主客户端里找不到这个包:{feature}不会加载({impact})", "compat.clientUi.optionalWhy": "该宿主没有客户端界面(正常形态);依赖它的功能:{feature}({impact})", "compat.clientUi.driftWhy": "{feature}的界面标记有缺失:{markers}。影响:{impact}。请人工核对宿主客户端是否改过名称",
|
|
6192
6583
|
"compat.fallback.substituted": "插件适配层(宿主无此入口)",
|
|
6584
|
+
"compat.fallback.informOnly": "仅提示(不影响使用)",
|
|
6193
6585
|
"compat.fallback.native": "改走原生入口", "compat.fallback.refuse": "该操作会被拒绝", "compat.fallback.blocked": "相关按钮已禁用", "compat.fallback.inform": "不影响写入",
|
|
6194
6586
|
"compat.modules": "模块实体(插件 vs 宿主)", "compat.module.same": "同一份模块", "compat.module.separate": "两份拷贝(需修复)", "compat.module.sameVersion": "同版本(分处归档内外)", "compat.module.unknown": "无法比较", "compat.module.realpath": "无法比较(路径取不到真实形态)", "compat.modules.realpath": "有 {count} 个包**比不了**:它们的路径取不到真实形态({names})—— 这不是「两份拷贝」,而是这项校验没做成。", "compat.modules.realpathSides": "宿主侧:{host};插件侧:{plugin}。修好路径(权限 / 路径长度 / 重新安装)后重新打开本页即重算。", "compat.modules.realpathNone": "无", "compat.modules.unverified": "有 {count} 个包没能比对(宿主的解析锚点里找不到:{names})—— 这不是「两份拷贝」,而是这项校验没做成。可运行 node scripts/doctor.mjs 查看。",
|
|
6195
6587
|
"compat.modules.asarHost": "宿主是桌面版:官方包装在 {name} 里,插件在归档外,两边不可能是同一份文件。下面 {count} 个包按版本核对:{version},一致。",
|
|
@@ -6223,6 +6615,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6223
6615
|
"compat.ov.toolTable.factory": "出厂默认关掉 {hidden}/{total} 个", "compat.ov.toolTable.mixed": "关掉 {hidden}/{total} 个(含出厂默认 {defaults} 个)",
|
|
6224
6616
|
"compat.ov.nativeDelete": "宿主原生删除入口", "compat.ov.nativeDelete.ok": "宿主未提供原生删除入口(本插件自有完整序列)",
|
|
6225
6617
|
"compat.ov.hostIdentity": "宿主身份与模块", "compat.ov.hostIdentity.ok": "模块与宿主同源(宿主 DSH {version})", "compat.ov.hostIdentity.asar": "官方包与宿主同版本(DSH {version}),但宿主跑在 {name} 里、插件在归档外", "compat.ov.hostIdentity.degraded": "存在阻塞项:{list}",
|
|
6618
|
+
"compat.ov.hostContracts": "宿主契约(事件 / 配置键 / 布局 / 界面)",
|
|
6619
|
+
"compat.ov.hostContracts.ok": "canary 齐全:事件名、配置键、磁盘布局与客户端界面标记仍与适配基准一致",
|
|
6620
|
+
"compat.ov.hostContracts.degraded": "需复核 {count} 个包:{list}",
|
|
6621
|
+
"compat.ov.hostContracts.item": "{package}({feature})",
|
|
6226
6622
|
"compat.ov.memory": "记忆", "compat.ov.prompts": "提示词", "compat.ov.subagents": "子智能体", "compat.ov.scenes": "场景档案",
|
|
6227
6623
|
"compat.ov.subagentPersona": "子智能体人设委派", "compat.ov.subagentToolRestrict": "子代理工具限制", "compat.ov.subagentCreatedEvent": "子代理创建时序", "compat.ov.webAdmission": "Web 连接准入",
|
|
6228
6624
|
"compat.ov.plain.ok": "无降级上报(装配失败会出现在这里)",
|
|
@@ -6317,13 +6713,19 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6317
6713
|
"compat.cap.workspaceReadHeader": "读取会话头部", "compat.cap.workspaceEnqueue": "串行写事务", "compat.cap.workspaceSetState": "写工作区状态",
|
|
6318
6714
|
"compat.cap.workspaceIndexHeader": "索引会话头部", "compat.cap.workspaceArchiveNative": "宿主原生归档入口", "compat.cap.workspaceUnarchiveNative": "宿主原生恢复入口",
|
|
6319
6715
|
"compat.cap.workspaceBatchNative": "宿主原生批量入口", "compat.cap.workspaceDeleteNative": "宿主原生删除入口", "compat.cap.sessionsDetachLive": "实时会话落盘与分离",
|
|
6320
|
-
"compat.cap.sessionsColdAnnounce": "冷会话移除广播", "compat.cap.
|
|
6321
|
-
"compat.cap.
|
|
6716
|
+
"compat.cap.sessionsColdAnnounce": "冷会话移除广播", "compat.cap.sessionsLiveAccess": "实时会话读取(get / list)",
|
|
6717
|
+
"compat.cap.persistenceList": "会话存储枚举", "compat.cap.persistenceTranscriptLocate": "会话转写工件定位", "compat.cap.persistenceTranscriptRead": "会话转写读取(投影修复)",
|
|
6718
|
+
"compat.cap.projectionWrite": "投影缓存写入路径", "compat.cap.projectionTableDelete": "投影缓存行删除",
|
|
6719
|
+
"compat.cap.agentPresetRegister": "临时子预设注册", "compat.cap.toolsRestrictMethod": "工具限制施加(restrict)", "compat.cap.toolsSchemaList": "工具清单读取(schemas)", "compat.cap.toolsGetMethod": "按名读取工具定义(get)", "compat.cap.toolsGuardDispatch": "工具执行守卫分发(guard / checkGuards)", "compat.cap.toolsMcpResourceArgs": "MCP 共享资源工具参数(server / uri)", "compat.cap.systemPromptMcpSection": "系统提示词 MCP 段(MCP_SERVERS)", "compat.cap.mcpClientConfigSchema": "MCP 客户端配置 schema", "compat.cap.skillsRegisterProvider": "技能 provider 注册(registerProvider)", "compat.cap.agentsList": "活动 agent 清单(agents.list)", "compat.cap.pluginInventoryList": "Loader 插件条目清单(pluginInventory.list)", "compat.cap.webServerRegister": "HTTP 路由注册(webServer.register)", "compat.cap.sandboxPolicyResolve": "沙箱策略解析(sandboxPolicy.resolve)", "compat.cap.projectionCachedTitle": "投影缓存标题读取(cachedSnapshot)", "compat.cap.officialSkillAssets": "官方 office 技能资产", "compat.cap.officialSandboxAsset": "官方沙盒诊断技能资产", "compat.cap.agentCreatedEvent": "子代理创建事件(agent/created)", "compat.cap.connectionAdmit": "连接准入(admit)",
|
|
6720
|
+
"compat.cap.subagentsRuntime": "子智能体运行时(startActivation)", "compat.cap.llmModelCatalog": "模型目录(场景模型候选)", "compat.cap.approvalEffectivePolicy": "审批策略读取(完全权限判定)",
|
|
6322
6721
|
"compat.cap.opArchive": "归档", "compat.cap.opUnarchive": "恢复", "compat.cap.opBatch": "批量操作", "compat.cap.opDelete": "删除", "compat.cap.opList": "历史列表",
|
|
6323
6722
|
"compat.reach": "预设注入边界",
|
|
6324
6723
|
"compat.reach.suppressing": "压制型",
|
|
6325
6724
|
"compat.inject": "注入", "compat.inject.hint": "注入给模型的内容",
|
|
6326
6725
|
"compat.inject.force": "极简模式开启注入功能",
|
|
6726
|
+
"compat.inject.caps": "目录上限",
|
|
6727
|
+
"compat.inject.caps.entries": "最多注入", "compat.inject.caps.entriesUnit": "条",
|
|
6728
|
+
"compat.inject.caps.descLen": "描述最多显示", "compat.inject.caps.descLenUnit": "字符",
|
|
6327
6729
|
"compat.token": "访问令牌",
|
|
6328
6730
|
"compat.token.manage.hint": "改配置后重启生效",
|
|
6329
6731
|
"compat.token.row.token": "令牌", "compat.token.row.protect": "保护开关",
|
|
@@ -6532,6 +6934,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6532
6934
|
"compat.reach.tools.1": "工具由本插件注册,任何预设下都能调用;怎么送到模型由预设决定。",
|
|
6533
6935
|
"compat.reach.tools.2": "场景 / 记忆 / MCP / 技能 / 子智能体 / 提示词 —— 由本插件按上面的「注入」块补齐。",
|
|
6534
6936
|
"compat.reach.tools.3": "提示词与技能官方自己也会送;官方有的不重复送,官方缺的(如极简)由本插件补上。",
|
|
6937
|
+
"compat.reach.tools.4": "官方载体行挂在 cordis.patch.yml 里的也算数;只有写在 include 展开的组合里才看不到。",
|
|
6535
6938
|
"compat.hint.doctor": "命令行体检:",
|
|
6536
6939
|
"scenes.title": "场景", "scenes.desc": "管理场景:预设 MCP、技能、子智能体与记忆的组合,一键切换。",
|
|
6537
6940
|
"scenes.stat.total": "场景", "scenes.stat.archives": "有档案", "scenes.stat.locked": "已锁定",
|
|
@@ -6783,6 +7186,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6783
7186
|
"scope.view.leaseWs": "{count} 个工作区单独设置",
|
|
6784
7187
|
|
|
6785
7188
|
"scope.intent.keptRunning": "全局已关闭;还有 {count} 个对话在用,来源保持启用(只有这些对话看得到)。",
|
|
7189
|
+
"scope.intent.keptRunningWs": "全局已关闭;还有 {count} 个工作区在用,来源保持启用(只有这些工作区看得到)。",
|
|
6786
7190
|
"scope.intent.onOk": "已全局启用「{name}」。", "scope.intent.offOk": "已全局关闭「{name}」。",
|
|
6787
7191
|
"scope.intent.resume": "恢复启用",
|
|
6788
7192
|
"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}」。",
|
|
@@ -6793,6 +7197,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6793
7197
|
"scope.lease.released": "已让「{title}」不再临时运行",
|
|
6794
7198
|
"scope.lease.releasedWs": "已让工作区「{title}」不再临时运行",
|
|
6795
7199
|
"scope.lease.releaseFailed": "没能让「{title}」停止临时运行:{error}",
|
|
7200
|
+
"scope.lease.releasePartial": "「{title}」只停了一部分({done}/{total} 项),剩下的没能关掉,请重试",
|
|
6796
7201
|
"scope.lease.unknownError": "原因未说明",
|
|
6797
7202
|
},
|
|
6798
7203
|
en: {
|
|
@@ -6958,7 +7363,9 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
6958
7363
|
"mcp.note.prefix": "Note: ", "mcp.toggleServer": "Toggle server", "mcp.toggleTool": "Toggle tool", "mcp.session.startGlobal": "Off globally: turning it on runs it temporarily for this conversation only; the global setting stays off.",
|
|
6959
7364
|
"mcp.intent.blockedHint": "Stopped machine-wide: even this conversation cannot switch it on. Turn it back on from the global layer first.",
|
|
6960
7365
|
"mcp.intent.lease": "temporary · {count} conversation(s)", "mcp.intent.leaseHint": "Off globally; {count} conversation(s) still use it, so the connection keeps running.",
|
|
7366
|
+
"mcp.intent.leaseWs": "temporary · {count} workspace(s)", "mcp.intent.leaseHintWs": "Off globally; {count} workspace(s) still use it, so the connection keeps running.",
|
|
6961
7367
|
"mcp.intent.keptRunning": "Disabled globally; {count} conversation(s) still use it, so the connection keeps running (use “Close everywhere” to close them now).",
|
|
7368
|
+
"mcp.intent.keptRunningWs": "Disabled globally; {count} workspace(s) still use it, so the connection keeps running (use “Close everywhere” to close them now).",
|
|
6962
7369
|
"mcp.intent.onOk": "Enabled “{name}” globally.", "mcp.intent.offOk": "Disabled “{name}” globally.", "mcp.intent.stopped": "Closed “{name}” everywhere; conversations and workspaces using it were switched off too.",
|
|
6963
7370
|
"mcp.intent.stop": "Close everywhere",
|
|
6964
7371
|
"mcp.intent.stopTitle": "Close everywhere?",
|
|
@@ -7033,6 +7440,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7033
7440
|
"memory.title": "Memories",
|
|
7034
7441
|
"tabs.scenes": "Scenes", "tabs.skills": "Skills", "tabs.subagents": "Subagents", "tabs.prompts": "Prompts", "tabs.memory": "Memories", "tabs.sessions": "Sessions", "tabs.compat": "Host",
|
|
7035
7442
|
"compat.title": "Host compatibility", "compat.desc": "How this plugin attaches to DSH (read-only).",
|
|
7443
|
+
"compat.refresh": "Re-check", "compat.refresh.title": "Re-probe host capabilities, versions and contracts (bypasses the 5-second cache)",
|
|
7036
7444
|
"compat.backups.btn": "Clean old backups", "compat.backups.btnCount": "Clean old backups · {count}", "compat.backups.btnHint": "Delete surplus config backup copies (they hold secrets in cleartext)", "compat.backups.btnTitle": "{count} config backups exist ({size}, secrets in cleartext)", "compat.backups.title": "Clean old backups",
|
|
7037
7445
|
"compat.sidebar.hide": "Hide from sidebar", "compat.sidebar.show": "Show in sidebar", "compat.sidebar.hideHint": "Remove this plugin's row from the sidebar (Settings → Tools Management still works)", "compat.sidebar.showHint": "Add this plugin's row to the sidebar; it opens the same pages right here", "compat.sidebar.failed": "Could not save the sidebar toggle",
|
|
7038
7446
|
"compat.backups.desc": "Every backup is a full copy of the config — MCP secrets and the access token included, in cleartext.",
|
|
@@ -7077,11 +7485,12 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7077
7485
|
"compat.backups.confirm": "Delete", "compat.backups.confirm.ask": "Permanently delete {count} files? This cannot be undone.", "compat.backups.confirm.yes": "Delete permanently",
|
|
7078
7486
|
"compat.backups.done": "Deleted {removed}; {kept} kept.", "compat.backups.warnFailed": "{count} could not be deleted (in use?): {names}",
|
|
7079
7487
|
"compat.backups.loading": "Reading the backup list…", "compat.backups.loadFailed": "Could not read the backup list", "compat.backups.cleanFailed": "Cleanup failed",
|
|
7080
|
-
"compat.state.ok": "All good", "compat.state.blocked": "Needs attention",
|
|
7488
|
+
"compat.state.ok": "All good", "compat.state.blocked": "Needs attention", "compat.state.review": "Contracts need review",
|
|
7081
7489
|
"compat.checking": "Checking…", "compat.empty": "Not checked yet", "compat.failed": "Check failed",
|
|
7082
7490
|
"compat.save.failed": "Save failed",
|
|
7083
7491
|
"compat.summary.ok": "host {version} · capabilities {ok}/{total} · all usable", "compat.summary.degraded": "host {version} · capabilities {ok}/{total} · {count} degraded",
|
|
7084
7492
|
"compat.summary.identity": "host {version} · capabilities {ok}/{total} · {count} identity issue(s) to resolve",
|
|
7493
|
+
"compat.summary.review": "host {version} · capabilities {ok}/{total} · {count} contract(s) to review",
|
|
7085
7494
|
"compat.update.available": "Compatible update available: {current} → {best}", "compat.update.current": "Already on the newest compatible version ({current})",
|
|
7086
7495
|
"compat.update.localAhead": "Local version {current} is newer than the newest compatible release ({best})", "compat.update.none": "No release on the registry is compatible with host {host}",
|
|
7087
7496
|
"compat.update.incompatible": "Plugin {current} is not compatible with this host ({host})", "compat.update.hostUnknown": "Host version unavailable — update check skipped",
|
|
@@ -7095,7 +7504,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7095
7504
|
"update.install.copy": "Copy command", "update.install.copied": "Upgrade command copied",
|
|
7096
7505
|
"update.install.copyFailed": "Copy failed; select the command and copy it manually",
|
|
7097
7506
|
"update.install.noCommand": "This check produced no runnable command; check for updates again.",
|
|
7098
|
-
"compat.diag.copy": "Copy diagnostics", "compat.diag.copied": "Diagnostics copied",
|
|
7507
|
+
"compat.diag.copy": "Copy diagnostics", "compat.diag.copied": "Diagnostics copied", "compat.generatedAt": "Last checked: {time}",
|
|
7099
7508
|
"compat.host": "Host version", "compat.verified": "Verified against",
|
|
7100
7509
|
"compat.caps": "Usable capabilities", "compat.caps.degraded": "{count} unavailable",
|
|
7101
7510
|
"compat.caps.substituted": "gaps covered by the plugin",
|
|
@@ -7108,7 +7517,11 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7108
7517
|
"compat.others": "Other capability slots",
|
|
7109
7518
|
"compat.contracts": "Host contracts", "compat.contracts.missing": "absent", "compat.contracts.allOk": "Every host contract this release depends on is present.",
|
|
7110
7519
|
"compat.bareModules": "Bare module resolution", "compat.bareModules.present": "present", "compat.bareModules.absent": "not shipped by host", "compat.bareModules.drift": "contract drift suspected", "compat.bareModules.presentWhy": "affects: {feature}", "compat.bareModules.absentWhy": "the host no longer ships this package: {feature} degrades", "compat.bareModules.driftWhy": "{feature} is missing contract markers ({markers}) — please re-check that package's implementation manually",
|
|
7520
|
+
"compat.packages": "Host package versions", "compat.packages.allOk": "Every official package matches the version this plugin was verified against.", "compat.packages.hint": "{count} official package(s) differ from the verified baseline; out-of-range ones are listed as blockers.", "compat.packages.baseline": "matches baseline", "compat.packages.changed": "version differs", "compat.packages.out": "out of range", "compat.packages.unknown": "not resolvable", "compat.packages.optional": "optional package absent", "compat.packages.optionalDetail": "Optional peer: not installed here; its absence is expected.", "compat.packages.detail": "host {host} · plugin {plugin} · baseline {baseline} · peer {range}", "compat.packages.detailObserved": "host {host} · baseline {baseline} · observed only (not a peer)", "compat.packages.separate": "and the plugin loads a separate copy",
|
|
7521
|
+
"compat.behaviors": "Host behavior contracts", "compat.behaviors.hint": "The plugin hard-codes these host strings (event names, disk layout, config keys, patch dialect). A missing canary means \"review manually\", not \"already broken\".", "compat.behaviors.present": "markers present", "compat.behaviors.drift": "contract drift suspected", "compat.behaviors.absent": "not shipped by host", "compat.behaviors.optional": "not used by this host", "compat.behaviors.presentWhy": "affects: {feature}", "compat.behaviors.absentWhy": "the host no longer ships this package: {feature} stops working ({impact})", "compat.behaviors.optionalWhy": "this backend is not in use here (normal); feature: {feature} ({impact})", "compat.behaviors.driftWhy": "{feature} is missing contract markers: {markers}. Impact: {impact}. Please re-check that package's implementation manually",
|
|
7522
|
+
"compat.clientUi": "Host client UI contracts", "compat.clientUi.hint": "The plugin's client fragments rely on the host's module loader, slot names and client services; this scans string markers in the host client bundles.", "compat.clientUi.present": "markers present", "compat.clientUi.drift": "UI contract drift suspected", "compat.clientUi.absent": "not assembled", "compat.clientUi.optional": "no client UI", "compat.clientUi.presentWhy": "affects: {feature}", "compat.clientUi.absentWhy": "the host client does not contain this package: {feature} will not load ({impact})", "compat.clientUi.optionalWhy": "this host has no client UI (normal); feature: {feature} ({impact})", "compat.clientUi.driftWhy": "{feature} is missing UI markers: {markers}. Impact: {impact}. Please re-check the host client names manually",
|
|
7111
7523
|
"compat.fallback.substituted": "Plugin adapter (no host entry)",
|
|
7524
|
+
"compat.fallback.informOnly": "Informational only (no functional impact)",
|
|
7112
7525
|
"compat.fallback.native": "Falls back to native entry", "compat.fallback.refuse": "Operation refused", "compat.fallback.blocked": "Affected buttons disabled", "compat.fallback.inform": "Writes unaffected",
|
|
7113
7526
|
"compat.modules": "Module identity (plugin vs host)", "compat.module.same": "same module", "compat.module.separate": "separate copy (repair needed)", "compat.module.sameVersion": "same version (inside/outside the archive)", "compat.module.unknown": "not comparable", "compat.module.realpath": "not comparable (real path unavailable)", "compat.modules.realpath": "{count} package(s) could **not be compared**: their real path could not be read ({names}) — that is not \"a separate copy\", it means the check could not run.", "compat.modules.realpathSides": "Host side: {host}; plugin side: {plugin}. Fix the path (permissions / path length / reinstall) and reopen this page to re-check.", "compat.modules.realpathNone": "none", "compat.modules.unverified": "{count} package(s) could not be compared (not resolvable from the host anchor: {names}) — that is not \"a separate copy\", it means the check could not run. Try node scripts/doctor.mjs.",
|
|
7114
7527
|
"compat.modules.asarHost": "The host is the desktop app: the official packages live inside {name} while the plugin sits outside the archive, so the two can never be the same file. The {count} package(s) below were checked by version: {version} on both sides.",
|
|
@@ -7142,6 +7555,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7142
7555
|
"compat.ov.toolTable.factory": "Factory defaults turn off {hidden}/{total}", "compat.ov.toolTable.mixed": "{hidden}/{total} are off (including {defaults} factory defaults)",
|
|
7143
7556
|
"compat.ov.nativeDelete": "Host native delete entry", "compat.ov.nativeDelete.ok": "The host offers no native delete entry (this plugin ships its own full sequence)",
|
|
7144
7557
|
"compat.ov.hostIdentity": "Host identity & modules", "compat.ov.hostIdentity.ok": "Modules are shared with the host (host DSH {version})", "compat.ov.hostIdentity.asar": "Official packages match the host version (DSH {version}), but the host runs inside {name} while the plugin sits outside it", "compat.ov.hostIdentity.degraded": "Blockers present: {list}",
|
|
7558
|
+
"compat.ov.hostContracts": "Host contracts (events / config keys / layout / UI)",
|
|
7559
|
+
"compat.ov.hostContracts.ok": "All canaries present: event names, config keys, on-disk layout and client UI markers still match the verified baseline",
|
|
7560
|
+
"compat.ov.hostContracts.degraded": "{count} package(s) need review: {list}",
|
|
7561
|
+
"compat.ov.hostContracts.item": "{package} ({feature})",
|
|
7145
7562
|
"compat.ov.memory": "Memory", "compat.ov.prompts": "Prompts", "compat.ov.subagents": "Subagents", "compat.ov.scenes": "Scene profiles",
|
|
7146
7563
|
"compat.ov.subagentPersona": "Subagent persona delegation", "compat.ov.subagentToolRestrict": "Subagent tool restriction", "compat.ov.subagentCreatedEvent": "Subagent creation ordering", "compat.ov.webAdmission": "Web connection admission",
|
|
7147
7564
|
"compat.ov.plain.ok": "No degradation reported (assembly failures would appear here)",
|
|
@@ -7235,8 +7652,11 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7235
7652
|
"compat.cap.workspaceReadHeader": "Read session header", "compat.cap.workspaceEnqueue": "Serialized write transaction", "compat.cap.workspaceSetState": "Write workspace state",
|
|
7236
7653
|
"compat.cap.workspaceIndexHeader": "Index session headers", "compat.cap.workspaceArchiveNative": "Host native archive entry", "compat.cap.workspaceUnarchiveNative": "Host native restore entry",
|
|
7237
7654
|
"compat.cap.workspaceBatchNative": "Host native batch entry", "compat.cap.workspaceDeleteNative": "Host native delete entry", "compat.cap.sessionsDetachLive": "Persist & detach live sessions",
|
|
7238
|
-
"compat.cap.sessionsColdAnnounce": "Cold session removal broadcast", "compat.cap.
|
|
7239
|
-
"compat.cap.
|
|
7655
|
+
"compat.cap.sessionsColdAnnounce": "Cold session removal broadcast", "compat.cap.sessionsLiveAccess": "Live session reads (get / list)",
|
|
7656
|
+
"compat.cap.persistenceList": "Session storage listing", "compat.cap.persistenceTranscriptLocate": "Transcript artifact lookup", "compat.cap.persistenceTranscriptRead": "Transcript reads (projection repair)",
|
|
7657
|
+
"compat.cap.projectionWrite": "Projection cache write path", "compat.cap.projectionTableDelete": "Projection cache row deletion",
|
|
7658
|
+
"compat.cap.agentPresetRegister": "Temporary child-preset registration", "compat.cap.toolsRestrictMethod": "Tool restriction (restrict)", "compat.cap.toolsSchemaList": "Tool schema listing (schemas)", "compat.cap.toolsGetMethod": "Tool definition by name (get)", "compat.cap.toolsGuardDispatch": "Tool guard dispatch (guard / checkGuards)", "compat.cap.toolsMcpResourceArgs": "Shared MCP resource tool arguments (server / uri)", "compat.cap.systemPromptMcpSection": "System-prompt MCP section (MCP_SERVERS)", "compat.cap.mcpClientConfigSchema": "MCP client config schema", "compat.cap.skillsRegisterProvider": "Skills provider registration (registerProvider)", "compat.cap.agentsList": "Live agent list (agents.list)", "compat.cap.pluginInventoryList": "Loader plugin entries (pluginInventory.list)", "compat.cap.webServerRegister": "HTTP route registration (webServer.register)", "compat.cap.sandboxPolicyResolve": "Sandbox policy resolution (sandboxPolicy.resolve)", "compat.cap.projectionCachedTitle": "Projection-cache title read (cachedSnapshot)", "compat.cap.officialSkillAssets": "Official office skill assets", "compat.cap.officialSandboxAsset": "Official sandbox diagnostic skill asset", "compat.cap.agentCreatedEvent": "Subagent creation event (agent/created)", "compat.cap.connectionAdmit": "Connection admission (admit)",
|
|
7659
|
+
"compat.cap.subagentsRuntime": "Subagent runtime (startActivation)", "compat.cap.llmModelCatalog": "Model catalog (scene model candidates)", "compat.cap.approvalEffectivePolicy": "Approval policy read (full-access detection)",
|
|
7240
7660
|
"compat.cap.opArchive": "Archive", "compat.cap.opUnarchive": "Restore", "compat.cap.opBatch": "Batch operations", "compat.cap.opDelete": "Delete", "compat.cap.opList": "History list",
|
|
7241
7661
|
"compat.reach": "Preset injection reach",
|
|
7242
7662
|
"compat.reach.suppressing": "suppressing",
|
|
@@ -7285,6 +7705,9 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7285
7705
|
"compat.token.mismatch": "Does not match the host-side token: enter the value that is in the config.",
|
|
7286
7706
|
"compat.token.failed": "Could not read the token status; refresh and retry.",
|
|
7287
7707
|
"compat.inject.force": "Enable injection in Minimal mode",
|
|
7708
|
+
"compat.inject.caps": "Catalog caps",
|
|
7709
|
+
"compat.inject.caps.entries": "Inject up to", "compat.inject.caps.entriesUnit": "items",
|
|
7710
|
+
"compat.inject.caps.descLen": "Description up to", "compat.inject.caps.descLenUnit": "chars",
|
|
7288
7711
|
"compat.inject.domains": "What to inject",
|
|
7289
7712
|
"compat.inject.domain.scene": "Scene", "compat.inject.domain.memory": "Memory", "compat.inject.domain.mcp": "MCP",
|
|
7290
7713
|
"compat.inject.domain.subagents": "Subagents", "compat.inject.domain.prompt": "Global prompts",
|
|
@@ -7439,6 +7862,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7439
7862
|
"compat.reach.tools.1": "The tools come from this plugin and are callable under any preset; how they reach the model is up to the preset.",
|
|
7440
7863
|
"compat.reach.tools.2": "Scene / memory / MCP / skills / subagents / prompt — filled in by this plugin according to the Injection block above.",
|
|
7441
7864
|
"compat.reach.tools.3": "The prompt and the skill catalog also come from the official rows; this plugin only fills in what they miss (e.g. under Minimal).",
|
|
7865
|
+
"compat.reach.tools.4": "Official carrier rows placed in cordis.patch.yml count too; only rows hidden behind included compositions are invisible here.",
|
|
7442
7866
|
"compat.hint.doctor": "Command-line check:",
|
|
7443
7867
|
"scenes.title": "Scenes", "scenes.desc": "Manage scenes: preset combinations of MCP, skills, subagents and memories, switch with one click.",
|
|
7444
7868
|
"scenes.stat.total": "Scenes", "scenes.stat.archives": "With profile", "scenes.stat.locked": "Locked",
|
|
@@ -7691,8 +8115,10 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7691
8115
|
"scope.lease.released": "“{title}” no longer runs it temporarily",
|
|
7692
8116
|
"scope.lease.releasedWs": "Workspace “{title}” no longer runs it temporarily",
|
|
7693
8117
|
"scope.lease.releaseFailed": "Could not stop the temporary run for “{title}”: {error}",
|
|
8118
|
+
"scope.lease.releasePartial": "Stopped only part of “{title}” ({done}/{total}): the rest could not be released; please retry",
|
|
7694
8119
|
"scope.lease.unknownError": "no reason given",
|
|
7695
8120
|
"scope.intent.keptRunning": "Disabled globally; {count} conversation(s) still use it, so the source stays enabled for them.",
|
|
8121
|
+
"scope.intent.keptRunningWs": "Disabled globally; {count} workspace(s) still use it, so the source stays enabled for them.",
|
|
7696
8122
|
"scope.intent.onOk": "Enabled “{name}” globally.", "scope.intent.offOk": "Disabled “{name}” globally.",
|
|
7697
8123
|
"scope.intent.resume": "Turn back on",
|
|
7698
8124
|
"scope.unifiedClose": "Close everywhere", "scope.unifiedClose.desc": "“{name}” closes immediately, and the conversations / workspaces using it are switched off too; you can turn it back on later.", "scope.unifiedClose.done": "Closed “{name}” everywhere.", "scope.unifiedClose.viewDesc": "Switches off “{name}” in every conversation / workspace that turned it on locally (global settings stay untouched); you can turn it back on later.", "scope.unifiedClose.viewDone": "Closed “{name}” everywhere (local overrides cleared).", "scope.unifiedClose.sceneDesc": "Exits “{name}” in every conversation / workspace using it, restoring each to its state before entering; the globally active scene is left alone.", "scope.unifiedClose.sceneDone": "Closed scene “{name}” everywhere.",
|
|
@@ -7717,7 +8143,14 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
7717
8143
|
// 写在 apply 方法体里的导出会随 apply 提前返回而静默消失(见下方注释)。
|
|
7718
8144
|
pages: _pages,
|
|
7719
8145
|
apply(ctx) {
|
|
7720
|
-
|
|
8146
|
+
// 样式表挂在 document.head 上,不随插件 fiber 销毁 —— 把移除函数交给宿主作用域,
|
|
8147
|
+
// 卸载 / 热重载后规则跟着走(判定与「为什么」见 20 片的 ensureCss)。
|
|
8148
|
+
var stopCss = ensureCss()
|
|
8149
|
+
try {
|
|
8150
|
+
if (ctx && typeof ctx.effect === 'function') {
|
|
8151
|
+
ctx.effect(function () { return stopCss }, 'dsh-plugin-tool-management: stylesheet')
|
|
8152
|
+
}
|
|
8153
|
+
} catch (e) { /* 旧宿主没有 effect:退化成"留到下次刷新",与改造前一致 */ }
|
|
7721
8154
|
// 导入 / 导出弹窗的默认目录:问一次宿主(桌面 → 主目录,跨平台跨用户),缓存起来供
|
|
7722
8155
|
// 各处输入框取用。放在 apply 开头是因为它**不依赖 ctx**(apiCall 直接走 fetch),
|
|
7723
8156
|
// 而用户打开那些弹窗要晚得多 —— 早一点发出去,打开时就已经到位(见 20 片的说明)。
|
|
@@ -8444,7 +8877,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8444
8877
|
// 详情弹窗的请求序号:见 openDetail / closeDetail(晚到响应不得复活弹窗)。
|
|
8445
8878
|
const detailSeqRef = React.useRef(0)
|
|
8446
8879
|
const [confirmRow, setConfirmRow] = React.useState(null)
|
|
8447
|
-
//
|
|
8880
|
+
// 「全部关闭」确认:与删除不同,它切断的是**正在用它的会话** —— 必须问一次。
|
|
8448
8881
|
const [stopConfirm, setStopConfirm] = React.useState(null)
|
|
8449
8882
|
const [reveal, setReveal] = React.useState(false)
|
|
8450
8883
|
const [settings, setSettings] = React.useState(null)
|
|
@@ -8609,7 +9042,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8609
9042
|
return
|
|
8610
9043
|
}
|
|
8611
9044
|
// 全局层 = 写**意图**(0.21.2):off 不再立刻停 —— 还在用它的会话按租约继续跑,
|
|
8612
|
-
//
|
|
9045
|
+
// 只有「全部关闭」才切断。撤销按操作前的意图值逐台写回。
|
|
8613
9046
|
setMsg(null)
|
|
8614
9047
|
setBusy('setall')
|
|
8615
9048
|
apiCall('scope-intent-set', { domain: 'mcp', keys: changed.map((item) => item.serverName), value: turnOn ? 'on' : 'off' })
|
|
@@ -8833,7 +9266,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8833
9266
|
return
|
|
8834
9267
|
}
|
|
8835
9268
|
// 全局层(0.21.2)= 写**意图**,不是补丁:off 之后仍被会话认领的服务器保持运行
|
|
8836
|
-
//
|
|
9269
|
+
// (租约),只有「全部关闭」才切断它们。开关读的也是意图(见 `serverGlobalOn`)。
|
|
8837
9270
|
const name = String(row.serverName || row.id)
|
|
8838
9271
|
const nextOn = !serverGlobalOn(row)
|
|
8839
9272
|
// 翻开 = 先按「启动中」显示(宿主拉起进程要几秒);关掉 = 销账。
|
|
@@ -8843,8 +9276,8 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8843
9276
|
.then((res) => {
|
|
8844
9277
|
if (res && res.ok === false) { setMsg({ kind: 'err', text: (res && res.error) || mt('mcp.msg.failed') }); return }
|
|
8845
9278
|
if (res && res.warnings && res.warnings.length) { setMsg({ kind: 'warn', text: res.warnings.join(';') }); return }
|
|
8846
|
-
const leases =
|
|
8847
|
-
if (!nextOn && leases > 0) setMsg({ kind: 'warn', text: mt('mcp.intent.keptRunning', { count: leases }) })
|
|
9279
|
+
const leases = scopeLeaseUnitCount('mcp', name)
|
|
9280
|
+
if (!nextOn && leases > 0) setMsg({ kind: 'warn', text: mt(scopeIsWorkspace() ? 'mcp.intent.keptRunningWs' : 'mcp.intent.keptRunning', { count: leases }) })
|
|
8848
9281
|
else setMsg({ kind: 'ok', text: mt(nextOn ? 'mcp.intent.onOk' : 'mcp.intent.offOk', { name: name }) })
|
|
8849
9282
|
refresh()
|
|
8850
9283
|
})
|
|
@@ -8872,7 +9305,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8872
9305
|
}
|
|
8873
9306
|
|
|
8874
9307
|
/**
|
|
8875
|
-
* MCP
|
|
9308
|
+
* MCP「全部关闭」是一次性动作:全局意图写 off,并把正在认领它的会话 / 工作区
|
|
8876
9309
|
* 一并写成显式关闭 —— 这样租约不会把它重新拉起来,也不会留下「恢复启用」状态。
|
|
8877
9310
|
* 走 op 而不是 `scope-intent-set`:后者只能写意图,写不到那些层的开关。
|
|
8878
9311
|
*/
|
|
@@ -8891,7 +9324,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8891
9324
|
}
|
|
8892
9325
|
|
|
8893
9326
|
/**
|
|
8894
|
-
* 页头「全部关闭」:逐台走同一个 op
|
|
9327
|
+
* 页头「全部关闭」:逐台走同一个 op,与行菜单里的「全部关闭」是一回事 ——
|
|
8895
9328
|
* 只改意图停不掉正在认领它的场景 / 工作区,那些层的开关也得写成显式关闭。
|
|
8896
9329
|
* 只在真有临时运行时出现(`scopeLeaseKeys` 非空),没东西可停就不占页头。
|
|
8897
9330
|
*/
|
|
@@ -9234,7 +9667,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
9234
9667
|
if (row.notes) meta.push(React.createElement('span', { key: 'note', className: 'dsm-listrow-meta-desc', title: row.notes }, mt('mcp.note.prefix') + row.notes))
|
|
9235
9668
|
// 全局层的意图状态只挂**临时运行 · N 个对话** —— 它是"全局 off 却仍在跑"的
|
|
9236
9669
|
// 唯一解释,不标出来,用户会以为全局开关坏了。
|
|
9237
|
-
//
|
|
9670
|
+
// 全部关闭不挂标签:开关本身就是关的,标签会长期占着这一行;状态由开关的
|
|
9238
9671
|
// 悬浮说明承担。
|
|
9239
9672
|
// 同名两层行只标在**第一行**上(两行说同一件事,标两遍只是噪声)。
|
|
9240
9673
|
if (!scopeIsSession()) {
|
|
@@ -9316,13 +9749,13 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
9316
9749
|
// 同名两行显示同一个意图值(意图按 serverName 键),不会一行开一行关。
|
|
9317
9750
|
const nameHere = String(row.serverName || row.id)
|
|
9318
9751
|
const intentHere = scopeIntentOf('mcp', nameHere)
|
|
9319
|
-
const leasesHere =
|
|
9752
|
+
const leasesHere = scopeLeaseUnitCount('mcp', nameHere)
|
|
9320
9753
|
return editable ? React.createElement(Switch, {
|
|
9321
9754
|
on: serverGlobalOn(row),
|
|
9322
9755
|
scoped: false,
|
|
9323
9756
|
disabled: actDisabled,
|
|
9324
9757
|
title: intentHere === 'blocked' ? mt('mcp.intent.blockedHint')
|
|
9325
|
-
: leasesHere > 0 ? mt('mcp.intent.leaseHint', { count: leasesHere })
|
|
9758
|
+
: leasesHere > 0 ? mt(scopeIsWorkspace() ? 'mcp.intent.leaseHintWs' : 'mcp.intent.leaseHint', { count: leasesHere })
|
|
9326
9759
|
: undefined,
|
|
9327
9760
|
label: mt('mcp.toggleServer') + ' ' + row.serverName,
|
|
9328
9761
|
onClick: () => toggleRow(row),
|
|
@@ -9583,7 +10016,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
9583
10016
|
React.createElement('div', { className: 'dsm-modal-actions' },
|
|
9584
10017
|
React.createElement('button', { type: 'button', className: 'dsm-btn dsm-btn-danger', onClick: confirmRemove }, mt('mcp.btn.remove'))))
|
|
9585
10018
|
|
|
9586
|
-
//
|
|
10019
|
+
// 「全部关闭」确认:它会**立即**停掉连接,还会把正在用它的会话 / 工作区的开关
|
|
9587
10020
|
// 一并关掉 —— 与普通关闭不是一回事,必须问一次,并把影响说清。
|
|
9588
10021
|
const stopNode = stopConfirm && React.createElement(Modal, {
|
|
9589
10022
|
key: 'mcp-stop',
|
|
@@ -9628,7 +10061,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
9628
10061
|
// 要把它们排除 —— 否则全部可见之后按钮仍写着「全部启用」,点了什么也不发生。
|
|
9629
10062
|
bulkAllOn ? mt('mcp.btn.disableAll') : mt('mcp.btn.enableAll')),
|
|
9630
10063
|
// 只在有临时运行时出现(会话 / 场景 / 工作区正在认领某几台);
|
|
9631
|
-
//
|
|
10064
|
+
// 与行菜单的「全部关闭」同一个 op,别在这里另写一条只改意图的路径。
|
|
9632
10065
|
scopeLeaseKeys('mcp').length > 0 ? React.createElement('button', { key: 'stopall', type: 'button', className: 'dsm-btn dsm-btn-danger-outline', disabled: busy !== null || state.loading || state.locked === true, onClick: stopAllServers }, mt('scope.stopAll')) : null,
|
|
9633
10066
|
],
|
|
9634
10067
|
}),
|
|
@@ -9710,7 +10143,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
9710
10143
|
var quick = qs[0], setQuick = qs[1]
|
|
9711
10144
|
var qk = React.useState(null), quickEdit = qk[0], setQuickEdit = qk[1]
|
|
9712
10145
|
var qf = React.useState(null), quickConfirm = qf[0], setQuickConfirm = qf[1]
|
|
9713
|
-
//
|
|
10146
|
+
// 单条快捷提示词的「全部关闭」确认(`{ id }`):切断的是各对话 / 工作区正在单独用它的那份。
|
|
9714
10147
|
var qz = React.useState(null), quickStop = qz[0], setQuickStop = qz[1]
|
|
9715
10148
|
// 三个弹窗(新增预设 / 编辑预设 / 编辑快捷提示词)各自一份关窗暂存(见 42-shared-ui.js:
|
|
9716
10149
|
// 关窗存、打开取,成功提交不走这条路,所以没有"成功后要记得清"那一步)。
|
|
@@ -10160,7 +10593,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
10160
10593
|
}).catch(function (e) { setBusy(null); setQuickConfirm(null); actionFailed(e) })
|
|
10161
10594
|
}
|
|
10162
10595
|
/**
|
|
10163
|
-
*
|
|
10596
|
+
* 单条快捷提示词的「全部关闭」:清掉各对话 / 工作区单独打开它的覆盖。
|
|
10164
10597
|
* 全局启停不动(页面那颗开关管的是它),这里只收临时的那一份。
|
|
10165
10598
|
*/
|
|
10166
10599
|
function doQuickStop(id) {
|
|
@@ -10304,7 +10737,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
10304
10737
|
var quickAllOn = visibleQuick.length > 0 && visibleQuick.every(function (p) { return scopeFlag('quickPrompts', p.id, p.enabled !== false).value })
|
|
10305
10738
|
/**
|
|
10306
10739
|
* 页头「全部关闭」:把各会话 / 工作区 / 场景里单独开着的快捷提示词一并停掉 ——
|
|
10307
|
-
*
|
|
10740
|
+
* 「本对话关掉、别的对话还开着」不算全部关闭,所以走全部关闭 op 清各层认领,
|
|
10308
10741
|
* 而不是只写全局 `meta.json`。全局那一档是单选基线,没有"临时运行"可言。
|
|
10309
10742
|
*/
|
|
10310
10743
|
function stopAllQuick() {
|
|
@@ -10845,6 +11278,9 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
10845
11278
|
// 指到非滚动容器(sticky 随之失效,页签被内容滚走)。
|
|
10846
11279
|
var section = sectionRef.current
|
|
10847
11280
|
if (!section) return undefined
|
|
11281
|
+
// 宿主把滚动放在视口上时(找不到祖先滚动容器),装订线只能挂在 html 上:
|
|
11282
|
+
// 加一个类、卸载时撤掉 —— 不是一条常驻的全局规则。
|
|
11283
|
+
document.documentElement.classList.add('dsm-scroll-stable')
|
|
10848
11284
|
var host = null
|
|
10849
11285
|
var node = section.parentElement
|
|
10850
11286
|
while (node && node !== document.body) {
|
|
@@ -10854,9 +11290,12 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
10854
11290
|
}
|
|
10855
11291
|
// 找不到(宿主换了实现)→ 退回原来的「上两级」,保持兼容。
|
|
10856
11292
|
if (!host) host = section.parentElement && section.parentElement.parentElement
|
|
10857
|
-
if (!host) return
|
|
11293
|
+
if (!host) return function () { document.documentElement.classList.remove('dsm-scroll-stable') }
|
|
10858
11294
|
host.classList.add('dsm-settings-scroll-host')
|
|
10859
|
-
return function () {
|
|
11295
|
+
return function () {
|
|
11296
|
+
host.classList.remove('dsm-settings-scroll-host')
|
|
11297
|
+
document.documentElement.classList.remove('dsm-scroll-stable')
|
|
11298
|
+
}
|
|
10860
11299
|
}, [])
|
|
10861
11300
|
var page = active === 'scenes' ? React.createElement(ScenesPage)
|
|
10862
11301
|
: active === 'mcp' ? React.createElement(MCPPage)
|
|
@@ -12871,7 +13310,7 @@ function enabledMemoryCount(rules) {
|
|
|
12871
13310
|
var tone = props.tone === 'ok' ? ' dsm-tag-on' : props.tone === 'bad' ? ' dsm-tag-off' : props.tone === 'warn' ? ' dsm-tag-warn' : ''
|
|
12872
13311
|
return h('span', { className: 'dsm-tag' + tone, title: props.title }, props.text)
|
|
12873
13312
|
}
|
|
12874
|
-
/**
|
|
13313
|
+
/** 租约浮窗的最大高度;`measure` 会按这一侧可用空间再夹一次(CSS 只负责滚动)。 */
|
|
12875
13314
|
var LEASE_POP_MAX_H = 320
|
|
12876
13315
|
/**
|
|
12877
13316
|
* 浮窗里的分组:按**工作区**归拢,同一个工作区的对话挨在一起。
|
|
@@ -12880,24 +13319,32 @@ function enabledMemoryCount(rules) {
|
|
|
12880
13319
|
* 在用它" —— 同一个工作区的那几个对话排成一块,才看得出"是这个项目在跑"。
|
|
12881
13320
|
* 组内按标题排;没有工作区的那些排在最后(它们不属于任何项目)。
|
|
12882
13321
|
*
|
|
12883
|
-
*
|
|
12884
|
-
* `C:\a\b` 与 `c:\a\b\`
|
|
13322
|
+
* 分组键取**与服务端同一口径**的路径键(`scopeWorkspacePathKey`):同一个目录在清单里
|
|
13323
|
+
* 可能写成 `C:\a\b`、`C:/a/b` 与 `c:\a\b\` 几种样子 —— 不归一就会分成两块,组头还同名。
|
|
13324
|
+
*
|
|
13325
|
+
* 工作区粒度下没有 cwd 的会话是**会话隔离**,不是同一个「无工作区」:它们各自算一组,
|
|
13326
|
+
* 否则徽章会把 N 个独立认领显示成 1 个、那颗「×」也只能放掉其中一个。
|
|
12885
13327
|
*/
|
|
12886
|
-
function leaseGroups(details) {
|
|
13328
|
+
function leaseGroups(details, workspaceMode) {
|
|
12887
13329
|
var byCwd = Object.create(null)
|
|
12888
13330
|
var order = []
|
|
12889
13331
|
var nameOf = Object.create(null)
|
|
12890
13332
|
details.forEach(function (d) {
|
|
12891
13333
|
var cwd = String((d && d.cwd) || '')
|
|
12892
|
-
var key = cwd
|
|
13334
|
+
var key = cwd === ''
|
|
13335
|
+
? (workspaceMode ? '\u0000' + String((d && d.id) || '') : '')
|
|
13336
|
+
: scopeWorkspacePathKey(cwd)
|
|
12893
13337
|
if (!byCwd[key]) { byCwd[key] = []; order.push(key) }
|
|
12894
13338
|
byCwd[key].push(d)
|
|
12895
13339
|
if (cwd !== '' && nameOf[key] === undefined) nameOf[key] = cwd
|
|
12896
13340
|
})
|
|
12897
13341
|
order.sort(function (a, b) {
|
|
12898
|
-
|
|
12899
|
-
|
|
12900
|
-
return a < b ? -1 : a > b ? 1 : 0
|
|
13342
|
+
var ac = nameOf[a] === undefined ? '' : nameOf[a]
|
|
13343
|
+
var bc = nameOf[b] === undefined ? '' : nameOf[b]
|
|
13344
|
+
if (ac === '' && bc === '') return a < b ? -1 : a > b ? 1 : 0
|
|
13345
|
+
if (ac === '') return 1
|
|
13346
|
+
if (bc === '') return -1
|
|
13347
|
+
return ac < bc ? -1 : ac > bc ? 1 : 0
|
|
12901
13348
|
})
|
|
12902
13349
|
return order.map(function (key) {
|
|
12903
13350
|
var rows = byCwd[key].slice().sort(function (x, y) {
|
|
@@ -12905,68 +13352,99 @@ function enabledMemoryCount(rules) {
|
|
|
12905
13352
|
var yt = String((y && y.title) || '')
|
|
12906
13353
|
return xt < yt ? -1 : xt > yt ? 1 : 0
|
|
12907
13354
|
})
|
|
12908
|
-
return { cwd: nameOf[key] === undefined ? '' : nameOf[key], rows: rows }
|
|
13355
|
+
return { key: key, cwd: nameOf[key] === undefined ? '' : nameOf[key], rows: rows }
|
|
12909
13356
|
})
|
|
12910
13357
|
}
|
|
12911
13358
|
/**
|
|
12912
13359
|
* 租约徽章 + 悬浮浮窗:**临时运行的是哪几个对话**。
|
|
12913
13360
|
*
|
|
12914
13361
|
* 徽章正文只说"几个对话"(`临时运行 · N 个对话`),用户真正要问的是"是哪几个"——
|
|
12915
|
-
*
|
|
13362
|
+
* 浮窗一行一个对话:标题在左,所属工作区作为弱化后缀,末尾一颗「×」只放开这一个。
|
|
13363
|
+
* 工作区粒度下每行就是一个工作区,那一行只显示工作区名。
|
|
12916
13364
|
*
|
|
12917
13365
|
* 浮窗用 `position:fixed` + **视口坐标**:徽章所在的列表行是 `overflow:hidden`
|
|
12918
13366
|
* (`.dsm-listrow-meta`),绝对定位的浮层会被裁掉(与 `SourceSelect` 的菜单同一条理由)。
|
|
12919
13367
|
*
|
|
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
|
|
13368
|
+
* @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, workspaceMode?: boolean }} props
|
|
12921
13369
|
*/
|
|
12922
13370
|
function LeaseTagBadge(props) {
|
|
12923
13371
|
var t = props.t
|
|
12924
13372
|
var runtime = props.runtime === true
|
|
12925
13373
|
var details = props.details || []
|
|
12926
|
-
var groups = leaseGroups(details)
|
|
12927
13374
|
// 工作区粒度:认领是**按工作区**记的 —— 徽章上的个数得跟浮窗里的行数同一个单位,
|
|
12928
|
-
// 否则会出现「2 个对话」配 1
|
|
12929
|
-
|
|
13375
|
+
// 否则会出现「2 个对话」配 1 行工作区(看着像漏了一条)。
|
|
13376
|
+
// 预览 / 测试可直接指定;正常渲染不传,读当前隔离粒度。
|
|
13377
|
+
var workspaceMode = typeof props.workspaceMode === 'boolean' ? props.workspaceMode : scopeIsWorkspace()
|
|
13378
|
+
var groups = leaseGroups(details, workspaceMode)
|
|
12930
13379
|
var count = workspaceMode ? groups.length : props.count
|
|
12931
13380
|
var openState = React.useState(false), open = openState[0], setOpen = openState[1]
|
|
12932
13381
|
var posState = React.useState(null), pos = posState[0], setPos = posState[1]
|
|
12933
13382
|
var busyState = React.useState(null), busyId = busyState[0], setBusyId = busyState[1]
|
|
12934
13383
|
var ref = React.useRef(null)
|
|
12935
13384
|
var popRef = React.useRef(null)
|
|
12936
|
-
|
|
13385
|
+
// 浮窗是给键盘用户打开的(Enter/空格)才把焦点送进去;鼠标悬停打开时抢焦点会打断输入。
|
|
13386
|
+
var keyboardOpen = React.useRef(false)
|
|
12937
13387
|
var label = workspaceMode
|
|
12938
13388
|
? (runtime ? t('scope.intent.leaseWs', { count: count }) : t('scope.view.leaseWs', { count: count }))
|
|
12939
13389
|
: (runtime ? t('scope.intent.lease', { count: count }) : t('scope.view.lease', { count: count }))
|
|
13390
|
+
/** 指针是否还在徽章或浮窗里:浮窗是 portal,不能只看徽章的 DOM 子树。 */
|
|
13391
|
+
function pointerWithin(target) {
|
|
13392
|
+
if (!target) return false
|
|
13393
|
+
return (ref.current && typeof ref.current.contains === 'function' && ref.current.contains(target))
|
|
13394
|
+
|| (popRef.current && typeof popRef.current.contains === 'function' && popRef.current.contains(target))
|
|
13395
|
+
}
|
|
13396
|
+
/** 立即收起。徽章与浮窗之间的空档由不可见的桥接条补上,不再需要关闭延迟。 */
|
|
13397
|
+
function closeNow() {
|
|
13398
|
+
keyboardOpen.current = false
|
|
13399
|
+
setOpen(false)
|
|
13400
|
+
setPos(null)
|
|
13401
|
+
}
|
|
12940
13402
|
/**
|
|
12941
|
-
*
|
|
12942
|
-
*
|
|
12943
|
-
* 进了浮窗本体就把这个计时撤掉 —— 那是"用户还在看它"的明确信号。
|
|
13403
|
+
* 指针离开徽章或浮窗。relatedTarget 还在两者之内时不动 —— 那只是从徽章跨进浮窗
|
|
13404
|
+
* (或反过来),桥接条让这段路始终落在浮窗的命中区里。
|
|
12944
13405
|
*/
|
|
12945
|
-
function
|
|
12946
|
-
if (
|
|
13406
|
+
function onLeave(e) {
|
|
13407
|
+
if (pointerWithin(e && e.relatedTarget)) return
|
|
13408
|
+
closeNow()
|
|
12947
13409
|
}
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
13410
|
+
/** 关掉浮窗并把焦点还给徽章:键盘用户按 Escape 或再按一次 Enter 时不能把焦点丢在 body 上。 */
|
|
13411
|
+
function closeAndFocus() {
|
|
13412
|
+
closeNow()
|
|
13413
|
+
var el = ref.current
|
|
13414
|
+
if (el && typeof el.focus === 'function') el.focus()
|
|
13415
|
+
}
|
|
13416
|
+
function onBadgeKeyDown(e) {
|
|
13417
|
+
if (e.key === 'Escape') {
|
|
13418
|
+
if (open) { e.preventDefault(); closeAndFocus() }
|
|
13419
|
+
return
|
|
13420
|
+
}
|
|
13421
|
+
// 浮窗里的按钮自己处理 Enter/空格,别让它们冒泡成「收起浮窗」。
|
|
13422
|
+
if (e.target !== ref.current) return
|
|
13423
|
+
if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') {
|
|
13424
|
+
e.preventDefault()
|
|
13425
|
+
if (open) { closeAndFocus(); return }
|
|
13426
|
+
keyboardOpen.current = true
|
|
13427
|
+
setOpen(true)
|
|
13428
|
+
}
|
|
12955
13429
|
}
|
|
12956
|
-
React.useEffect(function () {
|
|
12957
|
-
return function () { if (closeTimer.current !== null) clearTimeout(closeTimer.current) }
|
|
12958
|
-
}, [])
|
|
12959
13430
|
/**
|
|
12960
13431
|
* 放掉**一个**对话的认领:只让它不再临时运行,其它对话照旧。
|
|
12961
13432
|
*
|
|
12962
13433
|
* 认领是**逐个对话**记的(会话层那条覆盖),所以放掉一个就是在那条对话的会话层
|
|
12963
13434
|
* 写一次「关」—— 服务端随即重算租约:最后一个认领者走了,连接 / 来源就跟着停。
|
|
12964
|
-
*
|
|
13435
|
+
* 工作区粒度下这条覆盖落在工作区上,同工作区的对话一起不再用(标题里说清楚);
|
|
13436
|
+
* 没有 cwd 的会话在工作区粒度下仍是独立的会话覆盖,提示按「对话」说。
|
|
13437
|
+
*
|
|
13438
|
+
* @param {object} d 认领明细(含 `id` / `title` / `keys`)
|
|
13439
|
+
* @param {string} [label] 提示里用的名字
|
|
13440
|
+
* @param {boolean} [wholeWorkspace] 这条覆盖是否落在整个工作区上
|
|
12965
13441
|
*/
|
|
12966
|
-
function release(d, label) {
|
|
13442
|
+
function release(d, label, wholeWorkspace) {
|
|
12967
13443
|
if (busyId !== null) return
|
|
12968
13444
|
var id = String((d && d.id) || '')
|
|
12969
13445
|
var name = String(label || (d && d.title) || id)
|
|
13446
|
+
// 工作区粒度的默认口径:整条覆盖落在工作区上;单个会话(没有 cwd)传 false。
|
|
13447
|
+
var whole = wholeWorkspace === undefined ? workspaceMode : wholeWorkspace === true
|
|
12970
13448
|
// 调用方自带放掉动作时用它(场景层要的是"退出场景",不是"关掉某一格")。
|
|
12971
13449
|
if (typeof props.onRelease === 'function') {
|
|
12972
13450
|
props.onRelease(d)
|
|
@@ -12978,22 +13456,37 @@ function enabledMemoryCount(rules) {
|
|
|
12978
13456
|
? d.keys
|
|
12979
13457
|
: [{ domain: props.domain, key: props.key }]
|
|
12980
13458
|
setBusyId(id)
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
13459
|
+
// 逐格写、**一次一格**:中途失败就停在那一格 —— 后面的不再写,免得「前面失败、
|
|
13460
|
+
// 最后一条成功」被当成整体成功(提示会说反)。
|
|
13461
|
+
var applied = 0
|
|
13462
|
+
function writeNext(i) {
|
|
13463
|
+
if (i >= keys.length) return Promise.resolve()
|
|
13464
|
+
var k = keys[i]
|
|
13465
|
+
return Promise.resolve()
|
|
13466
|
+
.then(function () {
|
|
13467
|
+
return apiCall('scope-set', { sessionId: id, domain: String(k.domain), key: String(k.key), value: false })
|
|
13468
|
+
})
|
|
13469
|
+
.then(function (res) {
|
|
13470
|
+
if (!res || res.ok === false) throw new Error(scopeErrorText(res) || t('scope.lease.unknownError'))
|
|
13471
|
+
applied += 1
|
|
13472
|
+
return writeNext(i + 1)
|
|
13473
|
+
})
|
|
13474
|
+
}
|
|
13475
|
+
writeNext(0).then(function () {
|
|
12990
13476
|
// 本地先把这一条摘掉(全局快照有 150ms TTL,紧接着的重拉可能还是写前那一份)。
|
|
12991
13477
|
scopeForgetLeaseSession(props.domain, props.key, id)
|
|
12992
|
-
//
|
|
12993
|
-
//
|
|
12994
|
-
showPluginToast(
|
|
13478
|
+
// 整个工作区一起停时提示要说工作区,别让用户以为只关了一个对话;
|
|
13479
|
+
// 没有 cwd 的会话仍是单独的会话覆盖。
|
|
13480
|
+
showPluginToast(whole ? t('scope.lease.releasedWs', { title: name }) : t('scope.lease.released', { title: name }), 'ok')
|
|
12995
13481
|
setTimeout(function () { refreshScope({ silent: true }) }, 400)
|
|
12996
13482
|
}).catch(function (e) {
|
|
13483
|
+
if (applied > 0) {
|
|
13484
|
+
// 有格子已经放掉了:服务端状态变了,本地快照也得跟上;提示必须说明是**部分**完成。
|
|
13485
|
+
scopeForgetLeaseSession(props.domain, props.key, id)
|
|
13486
|
+
showPluginToast(t('scope.lease.releasePartial', { title: name, done: applied, total: keys.length }), 'warn')
|
|
13487
|
+
setTimeout(function () { refreshScope({ silent: true }) }, 400)
|
|
13488
|
+
return
|
|
13489
|
+
}
|
|
12997
13490
|
showPluginToast(t('scope.lease.releaseFailed', { title: name, error: scopeErrorText(e) || t('scope.lease.unknownError') }), 'err')
|
|
12998
13491
|
}).then(function () { setBusyId(null) })
|
|
12999
13492
|
}
|
|
@@ -13008,12 +13501,13 @@ function enabledMemoryCount(rules) {
|
|
|
13008
13501
|
if (!el) return
|
|
13009
13502
|
var box = el.getBoundingClientRect()
|
|
13010
13503
|
var gap = 6
|
|
13011
|
-
var
|
|
13504
|
+
var rowCount = workspaceMode ? groups.length : details.length
|
|
13505
|
+
var need = Math.min(rowCount * 28 + 16, LEASE_POP_MAX_H)
|
|
13012
13506
|
var below = window.innerHeight - box.bottom - gap - 8
|
|
13013
13507
|
var above = box.top - gap - 8
|
|
13014
13508
|
var nextUp = below < need && above > below
|
|
13015
13509
|
// 浮窗比徽章宽得多:按它自己的宽度靠右,别让它顶出窗口。
|
|
13016
|
-
var width = popRef.current ? popRef.current.offsetWidth :
|
|
13510
|
+
var width = popRef.current ? popRef.current.offsetWidth : 260
|
|
13017
13511
|
var next = {
|
|
13018
13512
|
left: Math.max(8, Math.min(box.left, window.innerWidth - width - 8)),
|
|
13019
13513
|
top: nextUp ? null : box.bottom + gap,
|
|
@@ -13027,13 +13521,22 @@ function enabledMemoryCount(rules) {
|
|
|
13027
13521
|
})
|
|
13028
13522
|
}
|
|
13029
13523
|
React.useEffect(function () {
|
|
13030
|
-
if (!open) return undefined
|
|
13524
|
+
if (!open) { keyboardOpen.current = false; return undefined }
|
|
13031
13525
|
measure()
|
|
13526
|
+
// 键盘打开时把焦点送到第一颗「×」:否则用户按了 Enter 之后还得再按 Tab 才够得着操作。
|
|
13527
|
+
var focusTimer = keyboardOpen.current
|
|
13528
|
+
? setTimeout(function () {
|
|
13529
|
+
var el = popRef.current
|
|
13530
|
+
var first = el && typeof el.querySelector === 'function' ? el.querySelector('button') : null
|
|
13531
|
+
if (first && typeof first.focus === 'function') first.focus()
|
|
13532
|
+
}, 0)
|
|
13533
|
+
: null
|
|
13032
13534
|
// 页面滚动 / 窗口尺寸变了,浮窗要跟着徽章走 —— 否则它会停在原地,指着空气。
|
|
13033
13535
|
var onMove = function () { measure() }
|
|
13034
13536
|
window.addEventListener('scroll', onMove, true)
|
|
13035
13537
|
window.addEventListener('resize', onMove)
|
|
13036
13538
|
return function () {
|
|
13539
|
+
if (focusTimer !== null) clearTimeout(focusTimer)
|
|
13037
13540
|
window.removeEventListener('scroll', onMove, true)
|
|
13038
13541
|
window.removeEventListener('resize', onMove)
|
|
13039
13542
|
}
|
|
@@ -13048,46 +13551,58 @@ function enabledMemoryCount(rules) {
|
|
|
13048
13551
|
style.top = pos.top === null || pos.top === undefined ? 'auto' : pos.top + 'px'
|
|
13049
13552
|
style.bottom = pos.bottom === null || pos.bottom === undefined ? 'auto' : pos.bottom + 'px'
|
|
13050
13553
|
}
|
|
13051
|
-
var releaseBtn = function (d, key, label) {
|
|
13554
|
+
var releaseBtn = function (d, key, label, wholeWorkspace) {
|
|
13555
|
+
var whole = wholeWorkspace === true
|
|
13556
|
+
var action = whole ? t('scope.lease.releaseWorkspace') : t('scope.lease.release')
|
|
13052
13557
|
return h('button', {
|
|
13053
13558
|
key: key,
|
|
13054
13559
|
type: 'button',
|
|
13055
13560
|
className: 'dsm-lease-pop-x',
|
|
13056
13561
|
disabled: busyId !== null,
|
|
13057
|
-
title:
|
|
13058
|
-
'aria-label':
|
|
13059
|
-
onClick: function (e) { if (e && e.stopPropagation) e.stopPropagation(); release(d, label) },
|
|
13562
|
+
title: action,
|
|
13563
|
+
'aria-label': action,
|
|
13564
|
+
onClick: function (e) { if (e && e.stopPropagation) e.stopPropagation(); release(d, label, whole) },
|
|
13060
13565
|
}, '×')
|
|
13061
13566
|
}
|
|
13062
13567
|
// 工作区粒度:认领是**按工作区**记的(同工作区的对话共用一份覆盖)—— 逐个列会话标题
|
|
13063
|
-
//
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13568
|
+
// 只是噪声,列出工作区就够了。没有 cwd 的会话各自是一份独立覆盖(见 `leaseGroups`),
|
|
13569
|
+
// 行名用会话标题,否则 N 条都会显示成「无工作区」,根本分不出该放哪一条。
|
|
13570
|
+
// 会话粒度:一行一个对话,工作区作为弱化后缀跟在标题后面 —— 不另起组头,
|
|
13571
|
+
// 一两个对话时浮窗也就只有一两行高。
|
|
13572
|
+
var body = []
|
|
13573
|
+
if (workspaceMode) {
|
|
13574
|
+
groups.forEach(function (g) {
|
|
13575
|
+
var d = g.rows[0]
|
|
13576
|
+
var wsName = g.cwd !== '' ? scopeWorkspaceName(g.cwd) : String((d && d.title) || (d && d.id) || t('scope.lease.noWorkspace'))
|
|
13577
|
+
body.push(h('div', { key: 'w:' + g.key, className: 'dsm-lease-pop-item' },
|
|
13578
|
+
h('span', { className: 'dsm-lease-pop-title', title: g.cwd !== '' ? g.cwd : wsName }, wsName),
|
|
13579
|
+
// 工作区行顺带说清「这个工作区里有几个对话在认领它」:那颗「×」放掉的是整片。
|
|
13580
|
+
g.cwd !== '' ? h('span', { className: 'dsm-lease-pop-ws' }, t('scope.sessions.count', { count: g.rows.length })) : null,
|
|
13581
|
+
d !== undefined ? releaseBtn(d, 'x:' + g.key, wsName, g.cwd !== '') : null))
|
|
13582
|
+
})
|
|
13583
|
+
} else {
|
|
13584
|
+
groups.forEach(function (g, gi) {
|
|
13585
|
+
var wsName = g.cwd !== '' ? scopeWorkspaceName(g.cwd) : t('scope.lease.noWorkspace')
|
|
13586
|
+
g.rows.forEach(function (d, ri) {
|
|
13587
|
+
var title = String((d && d.title) || (d && d.id) || '')
|
|
13588
|
+
body.push(h('div', { key: 'r:' + gi + ':' + ri, className: 'dsm-lease-pop-item' },
|
|
13589
|
+
h('span', { className: 'dsm-lease-pop-title', title: title }, title),
|
|
13590
|
+
h('span', { className: 'dsm-lease-pop-ws', title: g.cwd !== '' ? g.cwd : wsName }, wsName),
|
|
13591
|
+
releaseBtn(d, 'x:' + gi + ':' + ri)))
|
|
13080
13592
|
})
|
|
13593
|
+
})
|
|
13594
|
+
}
|
|
13595
|
+
var up = pos !== null && pos.bottom !== null && pos.bottom !== undefined
|
|
13081
13596
|
popup = h('div', {
|
|
13082
|
-
className: 'dsm-lease-pop',
|
|
13597
|
+
className: 'dsm-lease-pop' + (up ? ' dsm-lease-pop-up' : ''),
|
|
13083
13598
|
style: style,
|
|
13084
13599
|
ref: popRef,
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
onMouseLeave:
|
|
13600
|
+
role: 'dialog',
|
|
13601
|
+
'aria-label': label,
|
|
13602
|
+
onMouseLeave: onLeave,
|
|
13088
13603
|
// 浮窗在徽章里面:点它不该触发行上的动作。
|
|
13089
13604
|
onClick: function (e) { if (e && e.stopPropagation) e.stopPropagation() },
|
|
13090
|
-
}, body)
|
|
13605
|
+
}, h('div', { className: 'dsm-lease-pop-body' }, body))
|
|
13091
13606
|
// 浮窗挂到 `document.body` 上:留在面板里会被祖先的 `overflow:hidden` 裁掉
|
|
13092
13607
|
// (来源卡片就是 `overflow:hidden` —— 浮窗探出去的那截被裁掉,底下一张卡片的
|
|
13093
13608
|
// 内容透上来,就是用户看到的「穿模」,用户 2026-11-05 实测)。
|
|
@@ -13099,9 +13614,21 @@ function enabledMemoryCount(rules) {
|
|
|
13099
13614
|
return h('span', {
|
|
13100
13615
|
className: 'dsm-tag dsm-tag-lease',
|
|
13101
13616
|
ref: ref,
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13617
|
+
role: 'button',
|
|
13618
|
+
tabIndex: 0,
|
|
13619
|
+
'aria-haspopup': 'dialog',
|
|
13620
|
+
'aria-expanded': open ? 'true' : 'false',
|
|
13621
|
+
onKeyDown: onBadgeKeyDown,
|
|
13622
|
+
onBlur: function (e) {
|
|
13623
|
+
if (!open) return
|
|
13624
|
+
// 焦点还在徽章或浮窗里(浮窗是 portal,不在徽章的 DOM 子树里)。
|
|
13625
|
+
if (pointerWithin(e && e.relatedTarget)) return
|
|
13626
|
+
// Tab 走出去了:静默收起,不把焦点抢回来。
|
|
13627
|
+
closeNow()
|
|
13628
|
+
},
|
|
13629
|
+
onMouseEnter: function () { keyboardOpen.current = false; setOpen(true) },
|
|
13630
|
+
onMouseLeave: onLeave,
|
|
13631
|
+
}, label, popup)
|
|
13105
13632
|
}
|
|
13106
13633
|
/**
|
|
13107
13634
|
* 租约徽章(0.21.2):**六个域共用的唯一出口** —— 同一 HTML 结构、同一 class 族、同一浮窗。
|
|
@@ -13598,7 +14125,7 @@ function enabledMemoryCount(rules) {
|
|
|
13598
14125
|
}
|
|
13599
14126
|
/**
|
|
13600
14127
|
* 写来源的全局意图:`off` 只是"默认不要"—— 还有会话在用就保持启用(租约),
|
|
13601
|
-
*
|
|
14128
|
+
* 不切断正在用它的对话。技能来源没有逐条「全部关闭」这一档(页头「全部关闭」可一次收掉)。
|
|
13602
14129
|
*/
|
|
13603
14130
|
function setSourceIntent(root, value) {
|
|
13604
14131
|
var key = String(root.key || '')
|
|
@@ -13609,9 +14136,9 @@ function enabledMemoryCount(rules) {
|
|
|
13609
14136
|
.then(function (res) {
|
|
13610
14137
|
if (res && res.ok === false) { setResult({ ok: false, text: translateError(t, res) }); return }
|
|
13611
14138
|
var warnings = res && res.warnings && res.warnings.length ? res.warnings.join(';') : ''
|
|
13612
|
-
var leases =
|
|
14139
|
+
var leases = scopeLeaseUnitCount('skillSources', key)
|
|
13613
14140
|
var text = value === 'on' ? t('done.enabled', { name: name })
|
|
13614
|
-
: leases > 0 ? t('scope.intent.keptRunning', { count: leases }) : t('done.disabled', { name: name })
|
|
14141
|
+
: leases > 0 ? t(scopeIsWorkspace() ? 'scope.intent.keptRunningWs' : 'scope.intent.keptRunning', { count: leases }) : t('done.disabled', { name: name })
|
|
13615
14142
|
setResult({ ok: true, text: text + (warnings ? ' ' + warnings : '') })
|
|
13616
14143
|
refreshScope()
|
|
13617
14144
|
refresh(true)
|
|
@@ -13680,7 +14207,7 @@ function enabledMemoryCount(rules) {
|
|
|
13680
14207
|
.catch(function (error) { setResult({ ok: false, text: errMsg(error) }); })
|
|
13681
14208
|
.finally(function () { setBusy(false); });
|
|
13682
14209
|
}
|
|
13683
|
-
/**
|
|
14210
|
+
/** 全部关闭一条技能:一次性写 off + 清掉正在用它那几层的开关。 */
|
|
13684
14211
|
function stopSkillNow(target) {
|
|
13685
14212
|
setBusy(true); setResult(null);
|
|
13686
14213
|
apiCall("scope-stop-now", { domain: "skills", key: target.key })
|
|
@@ -14080,7 +14607,7 @@ function enabledMemoryCount(rules) {
|
|
|
14080
14607
|
root.mutable && !root.deletable ? h("span", { key: "notDeletable", className: "dsm-listrow-meta-info", title: t("status.notDeletable.hint") }, t("status.notDeletable")) : null,
|
|
14081
14608
|
];
|
|
14082
14609
|
// 行尾:详情常驻,其余动作收进 ⋯(与 MCP 页同一套口径):
|
|
14083
|
-
//
|
|
14610
|
+
// 全部关闭 —— 真有其他对话 / 工作区在临时用它时才出现;
|
|
14084
14611
|
// 编辑 / 删除 —— 官方内置与只读来源没有这两项(`mutable` / `deletable` 由服务端给)。
|
|
14085
14612
|
// 锁定期间只有「详情」还活着:其余都会改配置,一律置灰。
|
|
14086
14613
|
var actions = [];
|
|
@@ -14195,11 +14722,11 @@ function enabledMemoryCount(rules) {
|
|
|
14195
14722
|
return
|
|
14196
14723
|
}
|
|
14197
14724
|
// 全局层 = 写**意图**(0.21.2):off 之后仍被会话认领的来源保持启用(租约),
|
|
14198
|
-
//
|
|
14725
|
+
// 只有「全部关闭」才切断它们。
|
|
14199
14726
|
setSourceIntent(root, srcOn ? 'off' : 'on');
|
|
14200
14727
|
},
|
|
14201
14728
|
}));
|
|
14202
|
-
//
|
|
14729
|
+
// 技能来源没有逐条「全部关闭」:关闭只改默认,正在用它的会话 / 工作区照旧运行(租约),
|
|
14203
14730
|
// 页头「全部关闭」才把两格(技能 + 来源)的租约一起收掉。
|
|
14204
14731
|
// 旧版本留下的 blocked 仍要给出口 —— 那颗开关在 blocked 下是灰的,只能从这里恢复。
|
|
14205
14732
|
if (!scopeIsSession() && intentHere === 'blocked') {
|
|
@@ -15410,6 +15937,8 @@ function enabledMemoryCount(rules) {
|
|
|
15410
15937
|
var busy = bs[0], setBusy = bs[1]
|
|
15411
15938
|
var rs = React.useState(null)
|
|
15412
15939
|
var result = rs[0], setResult = rs[1]
|
|
15940
|
+
// 场景徽章那颗「×」的请求在途标记(`onRelease` 走这里,徽章内部的 busy 管不到)。
|
|
15941
|
+
var sceneReleaseBusy = React.useRef(null)
|
|
15413
15942
|
var ups = useUndoState()
|
|
15414
15943
|
var undo = ups[0], setUndo = ups[1], dismissUndo = ups[2]
|
|
15415
15944
|
var ms = React.useState(null)
|
|
@@ -16812,6 +17341,7 @@ function enabledMemoryCount(rules) {
|
|
|
16812
17341
|
name: item.name,
|
|
16813
17342
|
desc: item.description || null,
|
|
16814
17343
|
// 单行:描述截断排在名字右边(全文在悬浮里),一屏多看几条(用户 2026-11-06)。
|
|
17344
|
+
descTitle: item.description || null,
|
|
16815
17345
|
compact: true,
|
|
16816
17346
|
// 按模式配的工具限制摘要(没配就不显示):场景改不了会话的模式,
|
|
16817
17347
|
// 但要让用户看得见"这条人设在某些模式下是被限工具的"。
|
|
@@ -17273,7 +17803,7 @@ function enabledMemoryCount(rules) {
|
|
|
17273
17803
|
scopeForgetSceneLeases()
|
|
17274
17804
|
}).catch(function (e) { setBusy(false); setResult({ ok: false, text: errMsg(e) }) })
|
|
17275
17805
|
}
|
|
17276
|
-
/**
|
|
17806
|
+
/** 单张场景卡的「全部关闭」:只退出进入过这一场的对话 / 工作区。 */
|
|
17277
17807
|
function stopOneScene(name) {
|
|
17278
17808
|
setBusy(true); setResult(null)
|
|
17279
17809
|
apiCall('scope-stop-now', { domain: 'scene', key: name }).then(function (res) {
|
|
@@ -17293,7 +17823,12 @@ function enabledMemoryCount(rules) {
|
|
|
17293
17823
|
var id = String((d && d.id) || '')
|
|
17294
17824
|
var name = String((d && d.title) || id)
|
|
17295
17825
|
if (id === '') return
|
|
17826
|
+
// 徽章自带的 busy 只在它自己发请求时置位(`onRelease` 是立即返回的)——
|
|
17827
|
+
// 双击同一行会叠出两次 `scope-set`,第二次还会把已成功的提示再报一遍。
|
|
17828
|
+
if (sceneReleaseBusy.current !== null) return
|
|
17829
|
+
sceneReleaseBusy.current = id
|
|
17296
17830
|
apiCall('scope-set', { sessionId: id, domain: 'scene', value: null }).then(function (res) {
|
|
17831
|
+
sceneReleaseBusy.current = null
|
|
17297
17832
|
if (res && res.ok === false) {
|
|
17298
17833
|
showPluginToast(t('scope.lease.releaseFailed', { title: name, error: translateError(t, res) || t('scope.lease.unknownError') }), 'err')
|
|
17299
17834
|
return
|
|
@@ -17302,6 +17837,7 @@ function enabledMemoryCount(rules) {
|
|
|
17302
17837
|
// 全局快照有 150ms 的短 TTL:立刻重拉可能还是写前那一份。
|
|
17303
17838
|
setTimeout(function () { refreshScope({ silent: true }) }, 400)
|
|
17304
17839
|
}).catch(function (e) {
|
|
17840
|
+
sceneReleaseBusy.current = null
|
|
17305
17841
|
showPluginToast(t('scope.lease.releaseFailed', { title: name, error: errMsg(e) || t('scope.lease.unknownError') }), 'err')
|
|
17306
17842
|
})
|
|
17307
17843
|
}
|
|
@@ -17312,7 +17848,9 @@ function enabledMemoryCount(rules) {
|
|
|
17312
17848
|
* 哪几个,那颗「×」让其中一个退出这个场景。
|
|
17313
17849
|
*/
|
|
17314
17850
|
function sceneLeaseTag(name) {
|
|
17315
|
-
|
|
17851
|
+
// 全局粒度下会话层整层不读(`scope-set` 也直接拒写)—— 这里的「谁在临时运行」
|
|
17852
|
+
// 既不生效、那颗「×」也只会报错,整颗徽章都不该出现。
|
|
17853
|
+
if (scopeIsSession() || scopeIsGlobalMode()) return null
|
|
17316
17854
|
var count = scopeSceneLeaseCount(name)
|
|
17317
17855
|
if (!(count > 0)) return null
|
|
17318
17856
|
return React.createElement(LeaseTagBadge, {
|
|
@@ -17838,7 +18376,7 @@ function enabledMemoryCount(rules) {
|
|
|
17838
18376
|
}
|
|
17839
18377
|
/**
|
|
17840
18378
|
* 页头「全部关闭」:把各会话 / 工作区 / 场景里单独开着的人设一并停掉。
|
|
17841
|
-
*
|
|
18379
|
+
* 与快捷提示词同一条:只改全局启停名单停不到别的对话,得走全部关闭 op 清各层认领。
|
|
17842
18380
|
*/
|
|
17843
18381
|
function stopAllSubagents() {
|
|
17844
18382
|
var keys = scopeLeaseKeys('subagents')
|
|
@@ -17854,7 +18392,7 @@ function enabledMemoryCount(rules) {
|
|
|
17854
18392
|
scopeForgetLeases('subagents', keys)
|
|
17855
18393
|
}).catch(function (e) { setBusy(false); setResult({ ok: false, text: errMsg(e) }) })
|
|
17856
18394
|
}
|
|
17857
|
-
/**
|
|
18395
|
+
/** 单条人设的「全部关闭」:清掉各对话 / 工作区单独打开它的覆盖,全局启停不动。 */
|
|
17858
18396
|
function stopOnePersona(name) {
|
|
17859
18397
|
setResult(null)
|
|
17860
18398
|
setBusy(true)
|
|
@@ -19198,7 +19736,7 @@ function enabledMemoryCount(rules) {
|
|
|
19198
19736
|
}
|
|
19199
19737
|
/**
|
|
19200
19738
|
* 页头「全部关闭」:把各会话 / 工作区 / 场景里单独开着的记忆一并停掉。
|
|
19201
|
-
* 只改全局索引停不到别的对话 ——
|
|
19739
|
+
* 只改全局索引停不到别的对话 —— 那些是各层自己的认领,得走全部关闭 op 清掉。
|
|
19202
19740
|
*/
|
|
19203
19741
|
function stopAllMemories() {
|
|
19204
19742
|
var keys = scopeLeaseKeys('memory')
|
|
@@ -19213,7 +19751,7 @@ function enabledMemoryCount(rules) {
|
|
|
19213
19751
|
scopeForgetLeases('memory', keys)
|
|
19214
19752
|
}).catch(function (e) { setBusy(false); setResult({ ok: false, text: errMsg(e) }) })
|
|
19215
19753
|
}
|
|
19216
|
-
/**
|
|
19754
|
+
/** 单条记忆的「全部关闭」:清掉各对话 / 工作区单独打开它的覆盖,全局启停不动。 */
|
|
19217
19755
|
function stopOneMemory(rule) {
|
|
19218
19756
|
var id = String(rule.id)
|
|
19219
19757
|
setBusy(true); setResult(null)
|
|
@@ -20815,6 +21353,87 @@ function enabledMemoryCount(rules) {
|
|
|
20815
21353
|
} catch (e) { return undefined }
|
|
20816
21354
|
}
|
|
20817
21355
|
|
|
21356
|
+
// ── 菜单的滚动位置:点一条之后重开时按原位摆回去 ─────────────────────────────────
|
|
21357
|
+
//
|
|
21358
|
+
// 为什么需要:宿主对**非下钻**的选取一律先关菜单(input-trigger 的 `settle`),
|
|
21359
|
+
// 菜单一关,那一格滚动视口就整个卸掉 —— 滚动位置随之没了。我们再把它开回来时是
|
|
21360
|
+
// 一格新的视口,停在最上面:技能那一域动辄几十条,点完一条要重新滑回去找下一条。
|
|
21361
|
+
//
|
|
21362
|
+
// 宿主没有滚动接口(`InputTriggerController` 只管候选与高亮),只能从 DOM 反查:
|
|
21363
|
+
// 菜单壳带 `data-trigger-menu`,里面 `role="listbox"` 的那一格就是滚动视口。
|
|
21364
|
+
/** 记住的滚动位置(`-1` = 没什么要恢复的)。 */
|
|
21365
|
+
var slashScrollTop = -1
|
|
21366
|
+
/** 恢复滚动位置的那条帧循环(同时只留一条)。 */
|
|
21367
|
+
var slashScrollTimer = 0
|
|
21368
|
+
|
|
21369
|
+
/** 菜单的滚动视口;取不到(菜单没开 / 宿主改了结构)= null。 */
|
|
21370
|
+
function slashViewport() {
|
|
21371
|
+
try { return document.querySelector('[data-trigger-menu] [role="listbox"]') } catch (e) { return null }
|
|
21372
|
+
}
|
|
21373
|
+
|
|
21374
|
+
/**
|
|
21375
|
+
* 记住点选那一刻的滚动位置。
|
|
21376
|
+
*
|
|
21377
|
+
* 宿主的 `settle()` 拿到 `onPick` 的回执之后才关菜单,所以此刻还读得到那一格视口。
|
|
21378
|
+
* 只有**列表不变**的那次选取才记(下钻 / 回上层换的是另一份列表,旧位置没有意义)。
|
|
21379
|
+
*/
|
|
21380
|
+
function rememberSlashScroll() {
|
|
21381
|
+
const vp = slashViewport()
|
|
21382
|
+
slashScrollTop = vp && vp.scrollTop > 0 ? vp.scrollTop : 0
|
|
21383
|
+
// 上一轮恢复还在跑就收掉:这一次的位置才是要摆回去的(连着点两条时尤其重要)。
|
|
21384
|
+
stopSlashScrollRestore()
|
|
21385
|
+
}
|
|
21386
|
+
|
|
21387
|
+
/** 换了一份列表:旧位置作废。 */
|
|
21388
|
+
function forgetSlashScroll() {
|
|
21389
|
+
slashScrollTop = -1
|
|
21390
|
+
stopSlashScrollRestore()
|
|
21391
|
+
}
|
|
21392
|
+
|
|
21393
|
+
/** 收掉正在跑的那条恢复循环。 */
|
|
21394
|
+
function stopSlashScrollRestore() {
|
|
21395
|
+
if (!slashScrollTimer) return
|
|
21396
|
+
try { cancelAnimationFrame(slashScrollTimer) } catch (e) { /* 忽略 */ }
|
|
21397
|
+
slashScrollTimer = 0
|
|
21398
|
+
}
|
|
21399
|
+
|
|
21400
|
+
/**
|
|
21401
|
+
* 候选刚落定时把滚动位置摆回去。
|
|
21402
|
+
*
|
|
21403
|
+
* 为什么连着摆好几帧:重开时那一格视口里先是骨架行,真正的内容随后才到;内容到齐
|
|
21404
|
+
* 之后宿主自己会把高亮行滚进视野(`scrollIntoView`)—— 那一枪在渲染之后,我们得
|
|
21405
|
+
* 压过它,所以不止摆一次。用户自己滚过就不跟他抢(重开后视口从 0 起,滚过就不是 0)。
|
|
21406
|
+
*/
|
|
21407
|
+
function scheduleSlashScrollRestore() {
|
|
21408
|
+
if (slashScrollTop <= 0) return
|
|
21409
|
+
if (slashScrollTimer) return
|
|
21410
|
+
// 没有帧循环的环境(无头 / 非浏览器)→ 这一步直接不做:菜单照常,只是位置回不到原处。
|
|
21411
|
+
if (typeof requestAnimationFrame !== 'function') return
|
|
21412
|
+
let last = -1
|
|
21413
|
+
let applied = -1
|
|
21414
|
+
let frames = 0
|
|
21415
|
+
const step = function () {
|
|
21416
|
+
const vp = slashViewport()
|
|
21417
|
+
// 视口还没挂上(菜单还没开起来):再等几帧;一直等不到就收手。
|
|
21418
|
+
if (!vp) {
|
|
21419
|
+
if (frames++ < 40) { slashScrollTimer = requestAnimationFrame(step); return }
|
|
21420
|
+
slashScrollTimer = 0
|
|
21421
|
+
return
|
|
21422
|
+
}
|
|
21423
|
+
const top = slashScrollTop
|
|
21424
|
+
// 目标换了(用户又点了一条)→ 从头摆。
|
|
21425
|
+
if (top !== applied) { applied = top; last = -1 }
|
|
21426
|
+
const current = vp.scrollTop
|
|
21427
|
+
// 用户自己滚了(既不是 0,也不是我们上次摆的位置)→ 收手,别跟他抢。
|
|
21428
|
+
if (current !== 0 && current !== last) { slashScrollTimer = 0; return }
|
|
21429
|
+
vp.scrollTop = top
|
|
21430
|
+
last = vp.scrollTop
|
|
21431
|
+
if (frames++ < 40) { slashScrollTimer = requestAnimationFrame(step); return }
|
|
21432
|
+
slashScrollTimer = 0
|
|
21433
|
+
}
|
|
21434
|
+
slashScrollTimer = requestAnimationFrame(step)
|
|
21435
|
+
}
|
|
21436
|
+
|
|
20818
21437
|
/**
|
|
20819
21438
|
* 用官方口把菜单开在 `query` 那一层。
|
|
20820
21439
|
*
|
|
@@ -20987,11 +21606,19 @@ function enabledMemoryCount(rules) {
|
|
|
20987
21606
|
// 却不生效的旧覆盖当成现状(用户明明切了全局,菜单里还挂着几个对话的旧勾)。
|
|
20988
21607
|
const layerId = slashLayerIdOf(scope, sessionId)
|
|
20989
21608
|
const domains = domainsFor(scope)
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
21609
|
+
const rows = at < 0
|
|
21610
|
+
? domainRows(domains, query, layerId)
|
|
21611
|
+
: (function () {
|
|
21612
|
+
const token = query.slice(0, at)
|
|
21613
|
+
const domain = domains.filter(function (d) { return d.token === token })[0]
|
|
21614
|
+
if (!domain) return []
|
|
21615
|
+
return leafRows(domain, query.slice(at + 1), layerId)
|
|
21616
|
+
})()
|
|
21617
|
+
const items = await rows
|
|
21618
|
+
// 候选刚落定 —— 这正是重开时记住的滚动位置能摆回去的时候(那一刻视口里还是骨架行,
|
|
21619
|
+
// 真内容随后才渲染出来)。摆完这一轮,菜单就停在用户刚才那一屏。
|
|
21620
|
+
scheduleSlashScrollRestore()
|
|
21621
|
+
return items
|
|
20995
21622
|
},
|
|
20996
21623
|
header(session, req) {
|
|
20997
21624
|
const query = req.query || ''
|
|
@@ -21062,8 +21689,13 @@ function enabledMemoryCount(rules) {
|
|
|
21062
21689
|
* 就关菜单)—— 而每一域本来就全量列出、自己带滚动。
|
|
21063
21690
|
*
|
|
21064
21691
|
* `query` 是不带前导 `/` 的那一段:`''` = 域列表,`tool-skill/` = 技能那一层。
|
|
21692
|
+
*
|
|
21693
|
+
* `keepScroll` = 这一下**列表不变**(叶子行启停):菜单重开时按原位摆回滚动位置 ——
|
|
21694
|
+
* 宿主关菜单时那一格视口整个卸掉,滚动位置随之没了,不摆回去就得重新滑一遍。
|
|
21695
|
+
* 下钻 / 回上层换的是另一份列表,位置没有意义(`forgetSlashScroll`)。
|
|
21065
21696
|
*/
|
|
21066
|
-
const stayCleared = function (query) {
|
|
21697
|
+
const stayCleared = function (query, keepScroll) {
|
|
21698
|
+
if (keepScroll === true) rememberSlashScroll(); else forgetSlashScroll()
|
|
21067
21699
|
if (typeof spanStart === 'number') Promise.resolve().then(function () { keepOpenClean(sessionId, query, spanStart) })
|
|
21068
21700
|
return { text: '', continue: true }
|
|
21069
21701
|
}
|
|
@@ -21146,7 +21778,7 @@ function enabledMemoryCount(rules) {
|
|
|
21146
21778
|
}).catch(function (e) {
|
|
21147
21779
|
showPluginToast(errMsg(e), 'err')
|
|
21148
21780
|
})
|
|
21149
|
-
return stayCleared(domain.token + '/')
|
|
21781
|
+
return stayCleared(domain.token + '/', true)
|
|
21150
21782
|
},
|
|
21151
21783
|
async matchEnter(session, line) {
|
|
21152
21784
|
// 只认领"整行就是半个 token"这一种:`/tool-skill 帮我…` 后面还跟着正文时不拦,
|
|
@@ -21444,6 +22076,8 @@ function enabledMemoryCount(rules) {
|
|
|
21444
22076
|
// 只有真渲染才看得出挤不挤(同 `_pages.VersionBadge` 那条理由)。
|
|
21445
22077
|
_pages.TrashModal = TrashModal
|
|
21446
22078
|
_pages.RetentionSelect = RetentionSelect
|
|
22079
|
+
// 租约浮窗:行距与「×」贴边这类排版只有真渲染才看得出,预览脚本直接渲染它。
|
|
22080
|
+
_pages.LeaseTagBadge = LeaseTagBadge
|
|
21447
22081
|
},
|
|
21448
22082
|
}
|
|
21449
22083
|
return module.exports
|