dsh-plugin-tool-management 0.21.9 → 0.22.0
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 +14 -0
- package/README.md +2 -2
- package/README_EN.md +2 -2
- package/docs/UPDATE.md +1 -0
- package/lib/boot/reconcile.js +6 -11
- package/lib/client.js +78 -160
- package/lib/compat/host-contracts.js +0 -2
- package/lib/compat/host-roots.js +1 -1
- package/lib/compat/probe.js +15 -30
- package/lib/http-fence.js +3 -5
- package/lib/index.js +3 -3
- package/lib/mcp/restart-marker.js +4 -10
- package/lib/memories/archive.js +0 -4
- package/lib/scope/resolve.js +0 -18
- package/lib/scope/scope-overrides.js +0 -6
- package/lib/subagents/run-provider.js +3 -1
- package/lib/update-check.js +0 -2
- package/package.json +152 -152
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## [0.22.0] - 2026-11-04
|
|
14
|
+
|
|
15
|
+
### 变更
|
|
16
|
+
|
|
17
|
+
- **适配宿主 0.2.2-rc.1**:兼容范围改为 `>=0.2.2-rc.1 <0.2.3`,`engines.dsh` 与 11 个 `@deepseek-ai/dsh-*` peer 同源;0.2.1 及更早的宿主请装 0.21.x。
|
|
18
|
+
- **宿主适配代码无需改动**:工作区登记表、会话、投影缓存、设置、预设名册、工具服务、连接准入的成员面与 0.2.1 一致,0.2.2 的新增项均为可选参数或新方法(`tools.register` 的准入选项、`executable` / `resolve`、文件服务的 `deleteFile` / `move` / `patch`)。
|
|
19
|
+
- **最低 Node 版本提到 24.9**:跟随宿主自身的最低运行时要求。
|
|
20
|
+
- **开发依赖跟进 Cordis 4.1.0**:`symbols.original` 与事件注册签名未变。
|
|
21
|
+
- **兼容矩阵按 0.2.2-rc.1 重生成**。
|
|
22
|
+
- **设置侧栏图标改走官方 `settings.section.icon` 插槽**:0.2.2 把导航图标包进 `span.navIcon`,旧的「CSS 藏宿主 svg + `::before` 画图」接管法失配,导致「工具管理」一行并排出现叠方块与齿轮两个图标;改用宿主插槽后整段 DOM 接管(样式 + MutationObserver)删除。
|
|
23
|
+
- **删除 12 个全仓零引用的导出**:boot 的两个测试钩子、`projectRootOf` 包装层、`SCOPE_MODES`、`isScopeDomain`、`SUBSTITUTED_CAPABILITIES`、`requireRoute`、`BARE_HOST_MODULE_NAMES`、`TOKEN_CODE_NO_HOST`、`hasSection`、`REGISTRY_URL`、`quarantineMcpRestartMarker`。
|
|
24
|
+
- **MCP 重启标记的 pid 判定改名 `pidLikelyAlive`**:与 hub 锁对非法 pid 的相反默认值区分开,避免被当成重复实现合并。
|
|
25
|
+
- **子智能体服务缺失的报错不再写死宿主版本**:改从兼容范围常量派生;README 徽章同步到 0.2.2。
|
|
26
|
+
|
|
13
27
|
## [0.21.9] - 2026-10-30
|
|
14
28
|
|
|
15
29
|
### 新增
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/dsh-plugin-tool-management"><img src="https://img.shields.io/npm/v/dsh-plugin-tool-management?logo=npm&color=cb3837&style=flat-square" alt="npm"></a>
|
|
7
7
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT"></a>
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-0.2.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-0.2.2-4f7cf7?style=flat-square" alt="DSH 0.2.2">
|
|
9
9
|
<a href="https://github.com/ouli-1242/dsh-plugin-tool-management"><img src="https://img.shields.io/badge/GitHub-ouli--1242-181717?logo=github&style=flat-square" alt="GitHub"></a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
@@ -144,7 +144,7 @@ dsh plugin --profile desktop add dsh-plugin-tool-management@latest # 桌面版
|
|
|
144
144
|
| 装完没有页面 | 硬刷新浏览器;还不行就重启 DSH。 |
|
|
145
145
|
| 模型调不到某条工具 | 兼容页 →「模型工具表」,先选对当前对话 / 工作区(出厂默认关着 20 条)。面板和脚本不受影响。 |
|
|
146
146
|
| 升级 DSH 后动作不可用 | 兼容页看降级原因;`node scripts/doctor.mjs`,再 `node scripts/host-deps.mjs --fix`。 |
|
|
147
|
-
| 版本对不上 | 只适配 DSH **0.2.
|
|
147
|
+
| 版本对不上 | 只适配 DSH **0.2.2**(`>=0.2.2-rc.1 <0.2.3`),跨代升级要等插件同步适配;旧宿主请装 0.21.x。 |
|
|
148
148
|
| 重复 MCP 页签 | 删掉 `cordis.patch.yml` 里的旧 loader 行,再重启。 |
|
|
149
149
|
| 改坏配置 DSH 起不来 | 从 `~/.dsh/tool-management/backups/` 取最近的 `cordis.patch.yml.*.bak-*` 覆盖回去。 |
|
|
150
150
|
|
package/README_EN.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/dsh-plugin-tool-management"><img src="https://img.shields.io/npm/v/dsh-plugin-tool-management?logo=npm&color=cb3837&style=flat-square" alt="npm"></a>
|
|
7
7
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT"></a>
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-0.2.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-0.2.2-4f7cf7?style=flat-square" alt="DSH 0.2.2">
|
|
9
9
|
<a href="https://github.com/ouli-1242/dsh-plugin-tool-management"><img src="https://img.shields.io/badge/GitHub-ouli--1242-181717?logo=github&style=flat-square" alt="GitHub"></a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
@@ -144,7 +144,7 @@ More than a version number:
|
|
|
144
144
|
| No panel after installing | Hard-refresh the browser; if that fails, restart DSH. |
|
|
145
145
|
| The model cannot call a tool | Host page → “Model tools”, make sure the right conversation / workspace is selected (20 tools are off by default). The panel and scripts are unaffected. |
|
|
146
146
|
| Actions unavailable after a DSH upgrade | Check the reason on the Host page; run `node scripts/doctor.mjs`, then `node scripts/host-deps.mjs --fix`. |
|
|
147
|
-
| Version mismatch | Supports DSH **0.2.
|
|
147
|
+
| Version mismatch | Supports DSH **0.2.2** only (`>=0.2.2-rc.1 <0.2.3`); cross-generation upgrades wait for the plugin to catch up. Install 0.21.x for older hosts. |
|
|
148
148
|
| Duplicate MCP tab | Remove the old loader line from `cordis.patch.yml` and restart. |
|
|
149
149
|
| DSH won't start after a bad edit | Restore the newest `cordis.patch.yml.*.bak-*` from `~/.dsh/tool-management/backups/`. |
|
|
150
150
|
|
package/docs/UPDATE.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| 版本 | 发布 | 主题 |
|
|
6
6
|
| ------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| [0.22.0](../CHANGELOG.md#0220---2026-11-04) | 2026-11-04 | 适配宿主 0.2.2-rc.1:兼容范围改为 `>=0.2.2-rc.1 <0.2.3`(`engines.dsh` 与 11 个 peer 同源),旧宿主请装 0.21.x;宿主适配代码无需改动(能力面与 0.2.1 一致,新增项均为可选参数或新方法);最低 Node 提到 24.9,开发依赖跟进 Cordis 4.1.0;兼容矩阵按新基准重生成;设置侧栏图标改走官方 `settings.section.icon` 插槽,修掉 0.2.2 下「工具管理」一行出现两个图标;另删除 12 个零引用导出、把 pid 判定与报错文案中的版本号改为常量派生 |
|
|
7
8
|
| [0.21.9](../CHANGELOG.md#0219---2026-10-30) | 2026-10-30 | 兼容页在全局 npm 等安装形态下不再误报「两份不同拷贝」:宿主发现支持嵌套布局与运行中宿主,`host-deps` 可用 `--host` 指定目录,`doctor` 打印宿主位置与版本;`@deepseek-ai/*` peer 改为可选;插件装配失败改为整体兜底、官方技能物化推迟到首次取用;官方内置技能改为在 agent 作用域按层接管(不再依赖 rank 数字),Kit 段改按正文判断、技能源按形态校验;对齐宿主 0.2.1-rc.5 的官方内置技能清单(新增 `office` 路由与三个操作技能),LibreOffice Kit 段改挂三个操作技能,`skill_manager_read` 同步补段 |
|
|
8
9
|
| [0.21.8](../CHANGELOG.md#0218---2026-10-28) | 2026-10-28 | 「检查更新」在发现兼容版本时给出可复制的固定版本升级命令(不使用 `@latest`,不在界面内安装);检查跟随宿主登记的下载源(含镜像回退),不再写死 npm 官方源;更新检查跳过 deprecated、限制响应体大小,档案同步不再复制演示视频;作用域侧车损坏可在作用域条一键隔离修复,技能 / 来源意图随资源删除清理;web / desktop 同时运行时 hub 写入加跨进程锁,不再互相覆盖 |
|
|
9
10
|
| [0.21.7](../CHANGELOG.md#0217---2026-10-27) | 2026-10-27 | 修好面板在对话进行中持续闪烁:会话清单变动不再触发顶栏 loading 与提示词 / 记忆页整份重取;MCP 注入域开启且无服务器时,状态段改为 60 秒确认一次,降低后台开销 |
|
package/lib/boot/reconcile.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// 3. 顺序执行:不并发。索引守卫要先于 MCP 恢复(后者要写补丁,前者要护索引)。
|
|
16
16
|
import { readdirSync } from 'node:fs';
|
|
17
17
|
import { join } from 'node:path';
|
|
18
|
-
import { clearMcpRestartMarker,
|
|
18
|
+
import { clearMcpRestartMarker, pidLikelyAlive, readMcpRestartMarker } from '../mcp/restart-marker.js';
|
|
19
19
|
const reconcilers = [];
|
|
20
20
|
/** 注册一个启动期 reconciler(插件 apply() 内调用,随后 runBootReconcilers())。 */
|
|
21
21
|
export function registerBootReconciler(reconciler) {
|
|
@@ -27,14 +27,6 @@ export function registerBootReconciler(reconciler) {
|
|
|
27
27
|
}
|
|
28
28
|
reconcilers.push(reconciler);
|
|
29
29
|
}
|
|
30
|
-
/** 已注册的 reconciler(顺序即执行顺序)。 */
|
|
31
|
-
export function registeredReconcilers() {
|
|
32
|
-
return reconcilers;
|
|
33
|
-
}
|
|
34
|
-
/** 清空注册表。仅测试用 —— 生产环境一次 apply 一份。 */
|
|
35
|
-
export function resetBootReconcilers() {
|
|
36
|
-
reconcilers.length = 0;
|
|
37
|
-
}
|
|
38
30
|
/**
|
|
39
31
|
* 跑一遍所有 reconciler。**永不抛错**。
|
|
40
32
|
*
|
|
@@ -53,7 +45,10 @@ export async function runBootReconcilers() {
|
|
|
53
45
|
}
|
|
54
46
|
/**
|
|
55
47
|
* 收集所有 reconciler 的探测结果(best-effort,单个失败只 warn)。
|
|
56
|
-
*
|
|
48
|
+
*
|
|
49
|
+
* 现状**无调用方**:它是四个 reconciler 的 `probe()` 的唯一入口,留着是因为删掉就把
|
|
50
|
+
* 「索引被隔离 / MCP 重启中断 / 作用域孤儿 / 悬空场景引用」四条诊断一起废了;
|
|
51
|
+
* 接进兼容页降级区前要先定「降级」与「仅提示」的界面口径,属功能变更,单独排期。
|
|
57
52
|
*/
|
|
58
53
|
export async function collectReconcilerFindings() {
|
|
59
54
|
const findings = [];
|
|
@@ -105,7 +100,7 @@ export async function reconcileMcpRestart(deps) {
|
|
|
105
100
|
if (marker === null)
|
|
106
101
|
return 'no-marker';
|
|
107
102
|
// ② pid 还活着 → 那次重启可能还在跑,别动它的补丁。
|
|
108
|
-
if (
|
|
103
|
+
if (pidLikelyAlive(marker.pid))
|
|
109
104
|
return 'pid-alive';
|
|
110
105
|
const level = marker.level;
|
|
111
106
|
let current;
|
package/lib/client.js
CHANGED
|
@@ -8032,165 +8032,83 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
8032
8032
|
// 「整串都是 `•`」,客户端再引入 `****` 会让那个判据失效。
|
|
8033
8033
|
|
|
8034
8034
|
// 顶部栏右端:GitHub 链接(issues 在仓库)+ 版本号(全界面唯一显示处)。
|
|
8035
|
-
|
|
8036
|
-
// ── 设置侧栏「工具管理」那一行的图标(2026-10-18
|
|
8037
|
-
//
|
|
8038
|
-
//
|
|
8039
|
-
//
|
|
8040
|
-
//
|
|
8041
|
-
// `settings.section`
|
|
8042
|
-
//
|
|
8043
|
-
//
|
|
8044
|
-
//
|
|
8045
|
-
//
|
|
8046
|
-
//
|
|
8047
|
-
//
|
|
8048
|
-
//
|
|
8049
|
-
//
|
|
8050
|
-
//
|
|
8051
|
-
//
|
|
8052
|
-
//
|
|
8053
|
-
//
|
|
8054
|
-
//
|
|
8055
|
-
//
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
/**
|
|
8074
|
-
*
|
|
8075
|
-
*
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
*
|
|
8113
|
-
* 16px 与宿主那排字形同尺寸(它的 navIcon 走 size: 16),位置由 flex 排在
|
|
8114
|
-
* 标签之前 —— 按钮本身是 flex 行,::before 作为第一个子元素天然就位。
|
|
8115
|
-
*/
|
|
8116
|
-
function navIconCss(maskUrl) {
|
|
8117
|
-
return [
|
|
8118
|
-
'[' + NAV_ICON_MARKER + '] > svg { display: none; }',
|
|
8119
|
-
'[' + NAV_ICON_MARKER + ']::before {',
|
|
8120
|
-
" content: '';",
|
|
8121
|
-
' flex: none;',
|
|
8122
|
-
' width: 16px;',
|
|
8123
|
-
' height: 16px;',
|
|
8124
|
-
' background-color: currentColor;',
|
|
8125
|
-
' -webkit-mask-image: url("' + maskUrl + '");',
|
|
8126
|
-
' mask-image: url("' + maskUrl + '");',
|
|
8127
|
-
' -webkit-mask-repeat: no-repeat;',
|
|
8128
|
-
' mask-repeat: no-repeat;',
|
|
8129
|
-
' -webkit-mask-position: center;',
|
|
8130
|
-
' mask-position: center;',
|
|
8131
|
-
' -webkit-mask-size: 16px 16px;',
|
|
8132
|
-
' mask-size: 16px 16px;',
|
|
8133
|
-
'}'
|
|
8134
|
-
].join('\n')
|
|
8135
|
-
}
|
|
8136
|
-
|
|
8137
|
-
/**
|
|
8138
|
-
* 装上侧栏图标。
|
|
8139
|
-
*
|
|
8140
|
-
* @param ctx 客户端上下文(effect 的归属者)。
|
|
8141
|
-
* @param resolveLabel 本分区当前 label —— 与 settings.section 注册时传的是
|
|
8142
|
-
* 同一个 thunk,所以切语言时两边永远一致(label 变了,判据跟着变,不会认错行)。
|
|
8143
|
-
*/
|
|
8144
|
-
function installSettingsNavIcon(ctx, resolveLabel) {
|
|
8145
|
-
if (typeof document === 'undefined') return
|
|
8146
|
-
ctx.effect(() => {
|
|
8147
|
-
const tag = document.createElement('style')
|
|
8148
|
-
tag.textContent = navIconCss(navIconMaskUrl())
|
|
8149
|
-
document.head.appendChild(tag)
|
|
8150
|
-
let disposed = false
|
|
8151
|
-
let scheduled = false
|
|
8152
|
-
const sync = () => {
|
|
8153
|
-
scheduled = false
|
|
8154
|
-
if (disposed) return
|
|
8155
|
-
const wanted = resolveLabel()
|
|
8156
|
-
const rows = document.querySelectorAll(NAV_ROW_SELECTOR)
|
|
8157
|
-
for (let i = 0; i < rows.length; i += 1) {
|
|
8158
|
-
const row = rows[i]
|
|
8159
|
-
if (isOwnNavRow(row.textContent, wanted)) row.setAttribute(NAV_ICON_MARKER, '')
|
|
8160
|
-
else row.removeAttribute(NAV_ICON_MARKER)
|
|
8161
|
-
}
|
|
8162
|
-
}
|
|
8163
|
-
// 宿主每次重绘面板(打开/关闭、切语言、内容变化)都会重建那几行,
|
|
8164
|
-
// 重建后我们换掉的齿轮会被 React 改回去 —— 所以必须能重新贴。
|
|
8165
|
-
// queueMicrotask 合批:一次交互往往连触发多轮 mutation,不必每条都扫一遍。
|
|
8166
|
-
const schedule = () => {
|
|
8167
|
-
if (scheduled || disposed) return
|
|
8168
|
-
scheduled = true
|
|
8169
|
-
queueMicrotask(sync)
|
|
8170
|
-
}
|
|
8171
|
-
sync()
|
|
8172
|
-
const observer = new MutationObserver(schedule)
|
|
8173
|
-
observer.observe(document.body, { childList: true, subtree: true, characterData: true })
|
|
8174
|
-
return () => {
|
|
8175
|
-
disposed = true
|
|
8176
|
-
observer.disconnect()
|
|
8177
|
-
const marked = document.querySelectorAll('[' + NAV_ICON_MARKER + ']')
|
|
8178
|
-
for (let i = 0; i < marked.length; i += 1) marked[i].removeAttribute(NAV_ICON_MARKER)
|
|
8179
|
-
tag.remove()
|
|
8180
|
-
}
|
|
8181
|
-
}, 'dsh-plugin-tool-management: settings nav icon')
|
|
8182
|
-
}
|
|
8183
|
-
|
|
8184
|
-
// 调用点放在本片末尾(见上面 ⚠️ 那段):必须在这些 const 初始化之后。
|
|
8185
|
-
//
|
|
8186
|
-
// 整段包在 try 里:侧栏图标是**纯装饰**,取不到 DOM 或宿主换了面板结构时最坏
|
|
8187
|
-
// 应该只是"还是那颗齿轮",绝不能把 apply 带崩 —— 2026-10-18 那次 TDZ 就是
|
|
8188
|
-
// 一个装饰性功能让整个宿主 boot 失败("entry did not activate")。
|
|
8189
|
-
try {
|
|
8190
|
-
installSettingsNavIcon(ctx, function () { return t('nav.title') })
|
|
8191
|
-
} catch (e) {
|
|
8192
|
-
try { console.warn('[dsh-plugin-tool-management] 设置侧栏图标不可用,沿用宿主默认图标:' + errMsg(e)) } catch (e2) { /* 控制台不可用 */ }
|
|
8193
|
-
}
|
|
8035
|
+
|
|
8036
|
+
// ── 设置侧栏「工具管理」那一行的图标(2026-10-18 起,2026-11-04 改走官方插槽)──
|
|
8037
|
+
//
|
|
8038
|
+
// 0.2.2-rc.1 起宿主提供了 `settings.section.icon` 这个 slot:
|
|
8039
|
+
// dsh-client-ui-settings-general 的 SettingsPanel 渲染每一行时调用
|
|
8040
|
+
// renderSlot('settings.section.icon', { size, active }, { only: row.id, fallback: navIcon(row.id) })
|
|
8041
|
+
// 只要注册 id 与 `settings.section` 的 id 相同,就能拿到自己的字形;没注册的 id
|
|
8042
|
+
// 仍旧回落到宿主那张封闭名单(account / models / agent-presets / plugins /
|
|
8043
|
+
// archived-sessions),其余一律是默认齿轮。
|
|
8044
|
+
//
|
|
8045
|
+
// 为什么改掉旧实现:0.2.1 及以前没有这个 slot,本插件用的是「CSS 藏掉宿主 svg、
|
|
8046
|
+
// 在 ::before 上画自己的图」的 DOM 接管法(dshmarket / dsh-better-sidebar 的先例)。
|
|
8047
|
+
// 0.2.2 把图标从 `button > svg` 改成了 `button > span.navIcon > svg`,那条
|
|
8048
|
+
// `> svg` 选择器随之失配 —— 宿主的齿轮没被藏住,于是同一行并排出现「叠方块 + 齿轮」
|
|
8049
|
+
// 两个图标(2026-11-04 用户截图:工具管理 / 插件市场 / 侧边卡片都是这个症状,
|
|
8050
|
+
// 后两家用的也是同一套接管法)。既然官方把插槽开出来了,MutationObserver 那套
|
|
8051
|
+
// 搬砖就该整段删掉,而不是再补一条更宽的选择器去猜宿主的 DOM。
|
|
8052
|
+
//
|
|
8053
|
+
// 图形与 docs/images/icon.svg 同源(三层叠放方块,1024 视图框),但这里内联 path:
|
|
8054
|
+
// 客户端 bundle 是单文件,没有加载外部资源的通道。`fill: currentColor` 让它在
|
|
8055
|
+
// 选中 / 悬停 / 切主题时跟旁边那排宿主图标一起变色(旧实现用 mask 绕的也是这件事)。
|
|
8056
|
+
|
|
8057
|
+
/**
|
|
8058
|
+
* 本插件设置分区的 id。
|
|
8059
|
+
*
|
|
8060
|
+
* `settings.section` 与 `settings.section.icon` 两个注册点**必须同值**:
|
|
8061
|
+
* 宿主按 `only: row.id` 取图标,对不上就永远不渲染。所以这里只留一份字面量,
|
|
8062
|
+
* 41 片注册分区时引用它 —— 两处各写一遍迟早会漂移成「图标消失但没人报错」。
|
|
8063
|
+
*/
|
|
8064
|
+
var SETTINGS_SECTION_ID = 'dsm-tools'
|
|
8065
|
+
|
|
8066
|
+
/** 导航字形的三段 path(取自 docs/images/icon.svg,未改坐标)。 */
|
|
8067
|
+
var SETTINGS_NAV_ICON_PATHS = [
|
|
8068
|
+
'M592 336h-416c-52.928 0-96 43.072-96 96v416c0 52.928 43.072 96 96 96h416c52.928 0 96-43.072 96-96v-416c0-52.928-43.072-96-96-96z m32 512a32 32 0 0 1-32 32h-416c-17.632 0-32-14.336-32-32v-416c0-17.632 14.368-32 32-32h416c17.664 0 32 14.368 32 32v416z',
|
|
8069
|
+
'M720 208h-416a32 32 0 0 0 0 64h416c17.664 0 32 14.368 32 32v416a32 32 0 1 0 64 0v-416c0-52.928-43.072-96-96-96zM528 752h-288a32 32 0 1 0 0 64h288a32 32 0 1 0 0-64z',
|
|
8070
|
+
'M848 80h-416a32 32 0 0 0 0 64h416c17.664 0 32 14.368 32 32v416a32 32 0 1 0 64 0v-416c0-52.928-43.072-96-96-96z'
|
|
8071
|
+
]
|
|
8072
|
+
|
|
8073
|
+
/**
|
|
8074
|
+
* 侧栏字形组件。
|
|
8075
|
+
*
|
|
8076
|
+
* 宿主传 `size`(正整数,当前是 16)与 `active`(是否选中)。这里只吃 size:
|
|
8077
|
+
* 选中态的着色由宿主按钮的 color 决定,`currentColor` 自动跟随,不需要分支。
|
|
8078
|
+
* `display: block` 是给行内基线留的余量 —— span.navIcon 在 0.2.2 是 flex,
|
|
8079
|
+
* 但 flex 容器里的 inline svg 仍可能多出几像素行高。
|
|
8080
|
+
*/
|
|
8081
|
+
function SettingsNavIcon(props) {
|
|
8082
|
+
var size = props && typeof props.size === 'number' && props.size > 0 ? props.size : 16
|
|
8083
|
+
return React.createElement('svg', {
|
|
8084
|
+
viewBox: '0 0 1024 1024',
|
|
8085
|
+
width: size,
|
|
8086
|
+
height: size,
|
|
8087
|
+
fill: 'currentColor',
|
|
8088
|
+
'aria-hidden': 'true',
|
|
8089
|
+
focusable: 'false',
|
|
8090
|
+
style: { display: 'block' }
|
|
8091
|
+
}, SETTINGS_NAV_ICON_PATHS.map(function (d, i) {
|
|
8092
|
+
return React.createElement('path', { key: i, d: d })
|
|
8093
|
+
}))
|
|
8094
|
+
}
|
|
8095
|
+
|
|
8096
|
+
// 注册。放在 41 片注册 `settings.section` 之前也无妨:slot 是列表,宿主渲染时
|
|
8097
|
+
// 才按 id 配对,两边的注册顺序与面板打开顺序都不影响结果。
|
|
8098
|
+
//
|
|
8099
|
+
// 整段包在 try 里:图标是纯装饰。宿主若还没有这个 slot(0.2.1 及以前),最坏
|
|
8100
|
+
// 结果应该是「还是那颗默认齿轮」,绝不能把 apply 带崩 —— 2026-10-18 那次 TDZ
|
|
8101
|
+
// 就是一个装饰性功能让整个宿主 boot 失败("entry did not activate")。
|
|
8102
|
+
try {
|
|
8103
|
+
slots.inject('settings.section.icon', function () {
|
|
8104
|
+
return slots.register(
|
|
8105
|
+
{ name: 'settings.section.icon', id: SETTINGS_SECTION_ID, order: 16 },
|
|
8106
|
+
function (props) { return SettingsNavIcon(props) }
|
|
8107
|
+
)
|
|
8108
|
+
})
|
|
8109
|
+
} catch (e) {
|
|
8110
|
+
try { console.warn('[dsh-plugin-tool-management] 设置侧栏图标不可用,沿用宿主默认图标:' + errMsg(e)) } catch (e2) { /* 控制台不可用 */ }
|
|
8111
|
+
}
|
|
8194
8112
|
|
|
8195
8113
|
// 顶部栏右上角那一行(0.21.2):版本号 · 检查更新 · GitHub,横排贴住作用域行右端。
|
|
8196
8114
|
//
|
|
@@ -10889,7 +10807,7 @@ button.dsm-rowselect-box:disabled{cursor:default;opacity:.45}
|
|
|
10889
10807
|
])
|
|
10890
10808
|
}
|
|
10891
10809
|
slots.inject('settings.section', () => slots.register(
|
|
10892
|
-
{ name: 'settings.section', id:
|
|
10810
|
+
{ name: 'settings.section', id: SETTINGS_SECTION_ID, order: 16, label: function () { return t('nav.title') }, locale: NS },
|
|
10893
10811
|
() => React.createElement(ToolsSection)
|
|
10894
10812
|
))
|
|
10895
10813
|
|
|
@@ -53,8 +53,6 @@ export const BARE_HOST_MODULE_CONTRACTS = [
|
|
|
53
53
|
markers: [],
|
|
54
54
|
},
|
|
55
55
|
];
|
|
56
|
-
/** doctor 的 CLI 用:裸模块名清单(顺序与上面一致)。 */
|
|
57
|
-
export const BARE_HOST_MODULE_NAMES = BARE_HOST_MODULE_CONTRACTS.map((item) => item.package);
|
|
58
56
|
/**
|
|
59
57
|
* 官方 JSONL 会话目录布局的 canary —— 历史适配器(`src/sessions/workspace.ts` →
|
|
60
58
|
* `jsonlSessionDirectory`)硬编码了它。
|
package/lib/compat/host-roots.js
CHANGED
|
@@ -26,7 +26,7 @@ export const IDENTITY_PACKAGES = [
|
|
|
26
26
|
'@deepseek-ai/dsh-spill-local',
|
|
27
27
|
];
|
|
28
28
|
/** 本插件适配器最后一次对着验证过的宿主版本 —— 改它等于宣布适配了新的一代。 */
|
|
29
|
-
export const VERIFIED_HOST_VERSION = '0.2.
|
|
29
|
+
export const VERIFIED_HOST_VERSION = '0.2.2-rc.1';
|
|
30
30
|
/**
|
|
31
31
|
* 每个操作依赖的能力集合,按「缺成员时插件怎么达到同样结果」分组。
|
|
32
32
|
*
|
package/lib/compat/probe.js
CHANGED
|
@@ -57,38 +57,40 @@ export function isSourceInstall() {
|
|
|
57
57
|
* `>=0.2.1-rc.5` 匹配不了 `0.2.2-rc.1`,`^0.2.1-rc.5` 也匹配不了它 —— 范围只能**逐段写**,
|
|
58
58
|
* 一代一段。
|
|
59
59
|
*
|
|
60
|
-
* 但「逐段写」不等于「把历史各代累积起来」。累积成 `0.
|
|
61
|
-
* 等于向 npm 声明「支持 0.
|
|
62
|
-
*
|
|
63
|
-
* 在 0.2.
|
|
60
|
+
* 但「逐段写」不等于「把历史各代累积起来」。累积成 `0.2.0 || 0.2.1 || 0.2.2` 三代并集,
|
|
61
|
+
* 等于向 npm 声明「支持 0.2.0 起的每一代」。而本插件的代码只按 0.2.2 的契约写过
|
|
62
|
+
* (工具准入、Session Projection 注册、子代理创建语义这几处都动过会静默改行为的语义),
|
|
63
|
+
* 在 0.2.1 及更早的宿主上从未验证。那种声明最坏的后果不是"装不上",而是"装上了、大部分能用、
|
|
64
64
|
* 某几个动作悄悄失效"—— 用户无法判断是插件问题还是版本问题。
|
|
65
65
|
*
|
|
66
66
|
* 所以现在**只声明当前适配的这一代**。旧宿主不是没人管:插件的老版本自己带着老范围,用户装
|
|
67
67
|
* 对应版本即可(`dsh plugin add dsh-plugin-tool-management@<老版本号>`)。装上被拒 + 一版新适配,
|
|
68
68
|
* 优于装上然后部分功能悄悄失效。
|
|
69
69
|
*
|
|
70
|
-
* 上界**必须写**(`<0.2.
|
|
71
|
-
* 版本自己都满足不了 `^0.2.
|
|
70
|
+
* 上界**必须写**(`<0.2.3`):`^` 不能用,它的隐含上界是 `<0.3.0`,而 `0.2.2-rc.1` 这个已适配
|
|
71
|
+
* 版本自己都满足不了 `^0.2.2-rc.1`(prerelease 只在同元组比较器带 prerelease 时才匹配)。
|
|
72
72
|
*
|
|
73
|
-
*
|
|
73
|
+
* 两处(本文件的常量与 `package.json` 的 `engines.dsh` / 11 个 peer)是**同一个字符串**,
|
|
74
74
|
* 并由 `test/contracts.test.mjs` 的断言钉住 —— 漂移会让"界面/doctor 报的范围"与"安装期实际
|
|
75
75
|
* 校验的范围"各说各话,而两者都自称是插件的兼容范围。同一条断言现在还钉住「只有一段」,
|
|
76
76
|
* 防止范围再被追加成多代并集。
|
|
77
77
|
*
|
|
78
|
-
* 已知且**无法**用 range 消除的缺口(如实标注):尚未枚举的新 rc 元组(如 0.2.
|
|
78
|
+
* 已知且**无法**用 range 消除的缺口(如实标注):尚未枚举的新 rc 元组(如 0.2.2-rc.2)
|
|
79
79
|
* 在 npm7+ 下会触发 ERESOLVE 告警。这不是写法问题 —— semver 规则决定了不存在能匹配
|
|
80
80
|
* "任意未来 prerelease"的 range。缓解方式:官方每发一代新 rc,同步改这一段(同时改
|
|
81
81
|
* `VERIFIED_HOST_VERSION`),以及 `--legacy-peer-deps` 这条逃生门。
|
|
82
82
|
*
|
|
83
|
-
* 0.2.1-rc.5
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* 0.2.2-rc.1 的验证依据:把官方 0.2.1-rc.5 → 0.2.2-rc.1 的包逐份对拍(工作区登记表、会话、
|
|
84
|
+
* 投影缓存、设置、文件服务、预设名册、工具服务、连接准入、子代理 provider),本插件伸手要的
|
|
85
|
+
* 成员一个没少;新增项都是可选参数或新方法(`tools.register` 的准入选项、`executable` /
|
|
86
|
+
* `resolve`、文件服务的 `deleteFile` / `move` / `patch`)。`agent/pre-step` 只增
|
|
87
|
+
* `modelSelection` 字段;`dsh-skill-office` 的七个内置技能名与 LibreOffice Kit 注入名单未变。
|
|
86
88
|
*/
|
|
87
|
-
export const EXPECTED_PEER_RANGE = '>=0.2.
|
|
89
|
+
export const EXPECTED_PEER_RANGE = '>=0.2.2-rc.1 <0.2.3';
|
|
88
90
|
/**
|
|
89
91
|
* peer range 的下界。仍从 EXPECTED_PEER_RANGE 派生,避免两处手写漂移。
|
|
90
92
|
*
|
|
91
|
-
* 范围收窄到一代之后它**与 VERIFIED_HOST_VERSION 重合**(都是 0.2.
|
|
93
|
+
* 范围收窄到一代之后它**与 VERIFIED_HOST_VERSION 重合**(都是 0.2.2-rc.1)—— 这是正确的:
|
|
92
94
|
* 适配的那一代就是唯一允许安装的那一代。保留这个导出是因为它进了 `compat-status` 的载荷,
|
|
93
95
|
* doctor 与外部脚本可能仍在读;语义仍是"最早支持哪一代",只是现在只有一代。
|
|
94
96
|
*/
|
|
@@ -188,16 +190,6 @@ function inspectCapability(spec, target, reference) {
|
|
|
188
190
|
...(textMatch === undefined ? {} : { textMatch }),
|
|
189
191
|
};
|
|
190
192
|
}
|
|
191
|
-
/**
|
|
192
|
-
* 「缺失只影响走哪条路、不算故障」的能力 id:插件自己有一份实现顶上。它们既不出现在降级
|
|
193
|
-
* 清单里,也不挡任何路。
|
|
194
|
-
*
|
|
195
|
-
* 同一个事实在 {@link CapabilityFinding.optional} 上也有(界面与 doctor 都读那个标记);
|
|
196
|
-
* 这里保留导出是为了让调用方问「哪些槽位是插件自己顶的」而不必复制整张表。
|
|
197
|
-
*/
|
|
198
|
-
export const SUBSTITUTED_CAPABILITIES = CAPABILITY_SPECS
|
|
199
|
-
.filter((spec) => spec.optional === true)
|
|
200
|
-
.map((spec) => spec.id);
|
|
201
193
|
/**
|
|
202
194
|
* 能力表的**静态**视图:每一项给出"必须由哪个官方类的原型承载这些成员"。存在的理由是没有
|
|
203
195
|
* 活宿主的 CLI(doctor)也要能回答「这一份构建能不能归档 / 删除 / 列出」。
|
|
@@ -537,10 +529,3 @@ export class CapabilityRefusalError extends Error {
|
|
|
537
529
|
this.refusals = refusals;
|
|
538
530
|
}
|
|
539
531
|
}
|
|
540
|
-
/** 评估结果不给路就抛错;给了就返回那条路由决策。 */
|
|
541
|
-
export function requireRoute(assessment, operation) {
|
|
542
|
-
const decision = routeFor(assessment, operation);
|
|
543
|
-
if (decision.via === 'none')
|
|
544
|
-
throw new CapabilityRefusalError(operation, decision.refusals);
|
|
545
|
-
return decision;
|
|
546
|
-
}
|
package/lib/http-fence.js
CHANGED
|
@@ -148,13 +148,11 @@ export function fenceRejection(req, connection) {
|
|
|
148
148
|
/** 令牌缺失 / 不匹配时给界面的那句话(两种情况合并,不告诉调用方是哪一种)。 */
|
|
149
149
|
export const TOKEN_MSG = '缺少访问令牌,或令牌不对';
|
|
150
150
|
/**
|
|
151
|
-
*
|
|
151
|
+
* 令牌错误码:界面按它认出「要填令牌」,而不是按文案匹配。
|
|
152
152
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
153
|
+
* 旧宿主没重启时响应里还可能出现 `error.secret.noToken`,界面同时按 code 与**文本相等**
|
|
154
|
+
* 两条路识别这一族(见 client.js 的 isTokenGateText)。
|
|
155
155
|
*/
|
|
156
|
-
export const TOKEN_CODE_NO_HOST = 'error.secret.noToken';
|
|
157
|
-
/** 上面那句话的错误码:界面按它认出「要填令牌」,而不是按文案匹配。 */
|
|
158
156
|
export const TOKEN_CODE_BAD = 'error.token.required';
|
|
159
157
|
/**
|
|
160
158
|
* 判定敏感 op 是否应被拒(返回 null = 放行)。
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import { readIndexSync } from './memories/index-io.js';
|
|
|
26
26
|
import { hasQuarantineMarker, readQuarantineMarker, writeFileAtomically } from './memories/index-io.js';
|
|
27
27
|
import { registerBootReconciler, reconcileMcpRestart, runBootReconcilers } from './boot/reconcile.js';
|
|
28
28
|
import { pruneDesktopAuthCookies } from './desktop-cookie-prune.js';
|
|
29
|
-
import { hasMcpRestartMarker,
|
|
29
|
+
import { hasMcpRestartMarker, pidLikelyAlive, readMcpRestartMarker } from './mcp/restart-marker.js';
|
|
30
30
|
import { runStateDoctor } from './ops/state-doctor.js';
|
|
31
31
|
import { createSubagentService, decideToolFilter, defaultPersonasDir } from './subagents/service.js';
|
|
32
32
|
import { createSubagentCatalog } from './subagents/catalog.js';
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
179
179
|
if (!marker)
|
|
180
180
|
return [];
|
|
181
181
|
// pid 还活着 = 那次重启可能还在跑,那不是「没干完」。如实分开两种措辞。
|
|
182
|
-
const alive =
|
|
182
|
+
const alive = pidLikelyAlive(marker.pid);
|
|
183
183
|
return [{
|
|
184
184
|
id: 'mcp-restart-pending',
|
|
185
185
|
label: 'MCP 重启未完成',
|
|
@@ -4213,7 +4213,7 @@ export default {
|
|
|
4213
4213
|
return null;
|
|
4214
4214
|
return {
|
|
4215
4215
|
server: marker.server, level: marker.level, phase: marker.phase,
|
|
4216
|
-
pid: marker.pid, alive:
|
|
4216
|
+
pid: marker.pid, alive: pidLikelyAlive(marker.pid),
|
|
4217
4217
|
};
|
|
4218
4218
|
}
|
|
4219
4219
|
catch {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// 刻意**不存**重启前的完整有效状态:那要求在阶段 1 之前把两张补丁全读一遍并存档,而恢复时
|
|
17
17
|
// 一样要重新读一遍才敢写(磁盘上可能已经变了)。存快照只会多一处会过期的真相源 ——
|
|
18
18
|
// 所以恢复走「重新算」(见 boot/reconcile.ts 的 reconcileMcpRestart)。
|
|
19
|
-
import { readFileSync
|
|
19
|
+
import { readFileSync } from 'node:fs';
|
|
20
20
|
import { mkdir, readFile, rm } from 'node:fs/promises';
|
|
21
21
|
import { dirname } from 'node:path';
|
|
22
22
|
import { writeFileAtomically } from '../memories/index-io.js';
|
|
@@ -82,13 +82,14 @@ export async function clearMcpRestartMarker() {
|
|
|
82
82
|
await rm(mcpRestartMarkerPath(), { force: true }).catch(() => undefined);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* 进程是否**可能**还活着(同机)。与 `hub-lock.ts` 里那把锁的判定方向相反(那边把非法
|
|
86
|
+
* pid 当没活,因为要允许抢锁),两处不能合并成一份实现。
|
|
86
87
|
*
|
|
87
88
|
* `pid <= 0`(老标记 / 读不出来)按**活着**处理 —— 那种情况下自动恢复才是最危险的分支
|
|
88
89
|
* (可能在一次正常的重启中途插进去改补丁)。宁可漏一次自动恢复(用户手动重启即可),
|
|
89
90
|
* 也不要在一个未知进程可能正持有写锁时动它的文件。
|
|
90
91
|
*/
|
|
91
|
-
export function
|
|
92
|
+
export function pidLikelyAlive(pid) {
|
|
92
93
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
93
94
|
return true;
|
|
94
95
|
try {
|
|
@@ -101,10 +102,3 @@ export function processAlive(pid) {
|
|
|
101
102
|
return code === 'EPERM';
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
/** 留一份坏标记便于事后核对(与索引隔离同思路)。 */
|
|
105
|
-
export function quarantineMcpRestartMarker() {
|
|
106
|
-
try {
|
|
107
|
-
renameSync(mcpRestartMarkerPath(), `${mcpRestartMarkerPath()}.corrupt-${Date.now()}`);
|
|
108
|
-
}
|
|
109
|
-
catch { /* 没有就算了 */ }
|
|
110
|
-
}
|
package/lib/memories/archive.js
CHANGED
|
@@ -76,10 +76,6 @@ export function normalizeArchive(raw) {
|
|
|
76
76
|
out.toolTablePreset = toolTablePreset;
|
|
77
77
|
return out;
|
|
78
78
|
}
|
|
79
|
-
/** 档案里有没有写过这一段 —— 「没写过」与「写过但为空」语义不同。 */
|
|
80
|
-
export function hasSection(archive, section) {
|
|
81
|
-
return archive[section] !== undefined;
|
|
82
|
-
}
|
|
83
79
|
/**
|
|
84
80
|
* MCP 段应用计划:段已定义 → 对并集里每台服务器产出**精确停用名单(勾选集的补集)**。
|
|
85
81
|
* 服务器未勾(键缺失)→ ['*'] 整台停用(guard/restrict 原生支持通配,服务器后加载也会被拦);
|
package/lib/scope/resolve.js
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
// 会话头里没有它。要拿得走 `ctx.workspaceRegistry` 线性查一遍(每个 step 一次)。
|
|
19
19
|
// 「工作区隔离」因此以**会话头的 cwd** 为准(与下拉分组、工作区挂回同一口径),
|
|
20
20
|
// 派生出的作用域键见 `scope/workspace-key.ts`;仍然不需要 workspaceId。
|
|
21
|
-
import { nearestProjectRoot } from '../skills/skill-roots.js';
|
|
22
21
|
import { isWorkspaceScopeKey, workspaceScopeKeyOf } from './workspace-key.js';
|
|
23
22
|
/**
|
|
24
23
|
* 见过的会话 cwd(工作区模式用)。
|
|
@@ -124,23 +123,6 @@ export function sessionScopeIdOf(agent) {
|
|
|
124
123
|
current = up;
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
|
-
/**
|
|
128
|
-
* 会话的项目根(判据与官方一致:向上找最近的 `.git`,找不到就没有项目根)。
|
|
129
|
-
*
|
|
130
|
-
* 与 `skills/skill-roots.ts` 的 `nearestProjectRoot` 是**同一个函数**,不另写一份 ——
|
|
131
|
-
* 项目技能根与项目 AGENTS.md 必须认同一个目录,否则"技能按 A 项目隔离、指令按 B 项目读"。
|
|
132
|
-
*/
|
|
133
|
-
export async function projectRootOf(cwd) {
|
|
134
|
-
if (cwd === undefined)
|
|
135
|
-
return null;
|
|
136
|
-
try {
|
|
137
|
-
const found = await nearestProjectRoot(cwd);
|
|
138
|
-
return found && found.root ? found.root : null;
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
126
|
// ── 工作区模式:把一个会话折叠到工作区作用域键 ──────────────────────
|
|
145
127
|
/**
|
|
146
128
|
* 一个**已知 cwd 的会话 id** → 当前模式下的作用域键(同步)。
|
|
@@ -69,8 +69,6 @@ export function clampPromptBaseline(text) {
|
|
|
69
69
|
end -= 1;
|
|
70
70
|
return bytes.subarray(0, end).toString('utf8');
|
|
71
71
|
}
|
|
72
|
-
/** 三种隔离粒度(界面与校验共用,顺序即界面顺序:从最粗到最细)。 */
|
|
73
|
-
export const SCOPE_MODES = Object.freeze(['global', 'session', 'workspace']);
|
|
74
72
|
/** 夹一个模式;不认识的按会话粒度。 */
|
|
75
73
|
export function normalizeScopeMode(raw) {
|
|
76
74
|
if (raw === 'global' || raw === 'workspace')
|
|
@@ -90,10 +88,6 @@ const MAX_RECORD_KEY_LENGTH = 1024;
|
|
|
90
88
|
export function isFlagDomain(domain) {
|
|
91
89
|
return typeof domain === 'string' && SCOPE_FLAG_DOMAINS.includes(domain);
|
|
92
90
|
}
|
|
93
|
-
/** 是不是覆盖域(含 `scene`)。 */
|
|
94
|
-
export function isScopeDomain(domain) {
|
|
95
|
-
return domain === 'scene' || isFlagDomain(domain);
|
|
96
|
-
}
|
|
97
91
|
/** 一个键能不能进覆盖表:非空、不超长、不含控制字符(键最终会进 JSON,不参与路径拼接)。 */
|
|
98
92
|
function validKey(key) {
|
|
99
93
|
// `__proto__` 会在普通对象上改原型而不是落一个自有属性 —— 侧车里出现它时按非法键丢弃。
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// 运行侧不碰人设清单的那份缓存(`cache` / `enabledCache` 都在 service.ts 那一层),
|
|
10
10
|
// 所以它只需要 ctx / req / message 三件。
|
|
11
11
|
import { randomUUID } from 'node:crypto';
|
|
12
|
+
import { EXPECTED_MIN_HOST_VERSION } from '../compat/probe.js';
|
|
12
13
|
import { emptyResultNote, renderPersonaPrompt, RESULT_MAX, textOfBlocks, } from './persona-parse.js';
|
|
13
14
|
import { childPresetDefinition } from './child-preset.js';
|
|
14
15
|
// 拆出四层后 subagents/service.js 的公开面照旧(index.ts、ops/sessions.ts、scenes/candidates.ts、
|
|
@@ -37,7 +38,8 @@ export function createRunProvider(deps) {
|
|
|
37
38
|
async function ensureProvider(kind) {
|
|
38
39
|
const runtime = deps.ctx.get?.('subagents');
|
|
39
40
|
if (!runtime || typeof runtime.startActivation !== 'function') {
|
|
40
|
-
throw new Error('the subagent service is not mounted or lacks startActivation
|
|
41
|
+
throw new Error('the subagent service is not mounted or lacks startActivation '
|
|
42
|
+
+ `(ctx.subagents is missing; check that DSH is >= ${EXPECTED_MIN_HOST_VERSION})`);
|
|
41
43
|
}
|
|
42
44
|
if (hasProvider(runtime, kind))
|
|
43
45
|
return runtime;
|
package/lib/update-check.js
CHANGED
|
@@ -24,8 +24,6 @@ export const UPDATE_CHECK_FILE = 'update-check.json';
|
|
|
24
24
|
export const PACKAGE_NAME = 'dsh-plugin-tool-management';
|
|
25
25
|
/** npm 官方 registry:没有宿主登记时的唯一来源,也是单源回退的默认值。 */
|
|
26
26
|
const DEFAULT_REGISTRY = 'https://registry.npmjs.org/';
|
|
27
|
-
/** npm registry 的元数据地址(单源回退时使用)。 */
|
|
28
|
-
export const REGISTRY_URL = DEFAULT_REGISTRY + PACKAGE_NAME;
|
|
29
27
|
/** 公网源集合:宿主测速只覆盖这两个,只有它们能被测速结果提到最前。 */
|
|
30
28
|
const PUBLIC_REGISTRIES = new Set([DEFAULT_REGISTRY, 'https://registry.npmmirror.com/']);
|
|
31
29
|
/**
|
package/package.json
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-plugin-tool-management",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "一个设置面板,统一管理 MCP、技能、记忆、子智能体、提示词和归档会话;可自定义搭配场景,一个场景即可切换整个环境;Agent也能帮你操作这个插件。",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://github.com/ouli-1242/dsh-plugin-tool-management"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
10
|
-
"main": "lib/index.js",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": "./lib/index.js",
|
|
13
|
-
"./client": "./lib/client.js",
|
|
14
|
-
"./workspace": "./lib/sessions/workspace.js",
|
|
15
|
-
"./locale/*.json": "./locale/*.json",
|
|
16
|
-
"./package.json": "./package.json"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"lib",
|
|
20
|
-
"locale",
|
|
21
|
-
"cordis.patch.yml",
|
|
22
|
-
"README.md",
|
|
23
|
-
"README_EN.md",
|
|
24
|
-
"CHANGELOG.md",
|
|
25
|
-
"LICENSE",
|
|
26
|
-
"screenshots.json",
|
|
27
|
-
"docs/images",
|
|
28
|
-
"docs/UPDATE.md"
|
|
29
|
-
],
|
|
30
|
-
"engines": {
|
|
31
|
-
"dsh": ">=0.2.
|
|
32
|
-
"node": ">=
|
|
33
|
-
},
|
|
34
|
-
"publishConfig": {
|
|
35
|
-
"registry": "https://registry.npmjs.org",
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsc -p tsconfig.json && node scripts/sync-client.mjs && node scripts/sync-profile.mjs",
|
|
40
|
-
"prepublishOnly": "npm run build && npm run lint && npm run typecheck:client && node --test test/client-exports.test.mjs",
|
|
41
|
-
"lint": "node --check lib/client.js && node --check lib/index.js",
|
|
42
|
-
"typecheck:client": "node scripts/sync-client.mjs && tsc -p tsconfig.client.json",
|
|
43
|
-
"check:i18n": "node scripts/check-i18n.mjs lib/client.js",
|
|
44
|
-
"check:host": "node scripts/host-deps.mjs && node scripts/doctor.mjs",
|
|
45
|
-
"check:strict": "node scripts/check-strict.mjs",
|
|
46
|
-
"host-deps": "node scripts/host-deps.mjs --fix",
|
|
47
|
-
"doctor": "node scripts/doctor.mjs",
|
|
48
|
-
"test": "npm run build && npm run check:i18n && npm run typecheck:client && node --test test/contracts.test.mjs test/client-exports.test.mjs",
|
|
49
|
-
"sync:profile": "node scripts/sync-profile.mjs"
|
|
50
|
-
},
|
|
51
|
-
"keywords": [
|
|
52
|
-
"dsh",
|
|
53
|
-
"deepseek-harness",
|
|
54
|
-
"skill",
|
|
55
|
-
"skills",
|
|
56
|
-
"mcp",
|
|
57
|
-
"mcp-server",
|
|
58
|
-
"plugin",
|
|
59
|
-
"cordis"
|
|
60
|
-
],
|
|
61
|
-
"dsh": {
|
|
62
|
-
"bundle": {
|
|
63
|
-
"patch": "./cordis.patch.yml"
|
|
64
|
-
},
|
|
65
|
-
"client": {
|
|
66
|
-
"platform": "web",
|
|
67
|
-
"inject": [
|
|
68
|
-
"@deepseek-ai/dsh-client-locale",
|
|
69
|
-
"@deepseek-ai/dsh-client-ui-input-trigger"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"icon": "./docs/images/logo.png",
|
|
74
|
-
"peerDependencies": {
|
|
75
|
-
"@deepseek-ai/cordis": "^4.0.2",
|
|
76
|
-
"@deepseek-ai/dsh-agent-preset-registry": ">=0.2.
|
|
77
|
-
"@deepseek-ai/dsh-llm": ">=0.2.
|
|
78
|
-
"@deepseek-ai/dsh-session": ">=0.2.
|
|
79
|
-
"@deepseek-ai/dsh-session-projection-cache": ">=0.2.
|
|
80
|
-
"@deepseek-ai/dsh-settings": ">=0.2.
|
|
81
|
-
"@deepseek-ai/dsh-spill-local": ">=0.2.
|
|
82
|
-
"@deepseek-ai/dsh-storage-domain": ">=0.2.
|
|
83
|
-
"@deepseek-ai/dsh-subagent-fork-in-process": ">=0.2.
|
|
84
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": ">=0.2.
|
|
85
|
-
"@deepseek-ai/dsh-tools": ">=0.2.
|
|
86
|
-
"@deepseek-ai/dsh-workspace": ">=0.2.
|
|
87
|
-
"react": "^18.2.0"
|
|
88
|
-
},
|
|
89
|
-
"peerDependenciesMeta": {
|
|
90
|
-
"@deepseek-ai/cordis": {
|
|
91
|
-
"optional": true
|
|
92
|
-
},
|
|
93
|
-
"@deepseek-ai/dsh-agent-preset-registry": {
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
|
-
"@deepseek-ai/dsh-llm": {
|
|
97
|
-
"optional": true
|
|
98
|
-
},
|
|
99
|
-
"@deepseek-ai/dsh-session": {
|
|
100
|
-
"optional": true
|
|
101
|
-
},
|
|
102
|
-
"@deepseek-ai/dsh-session-projection-cache": {
|
|
103
|
-
"optional": true
|
|
104
|
-
},
|
|
105
|
-
"@deepseek-ai/dsh-settings": {
|
|
106
|
-
"optional": true
|
|
107
|
-
},
|
|
108
|
-
"@deepseek-ai/dsh-spill-local": {
|
|
109
|
-
"optional": true
|
|
110
|
-
},
|
|
111
|
-
"@deepseek-ai/dsh-storage-domain": {
|
|
112
|
-
"optional": true
|
|
113
|
-
},
|
|
114
|
-
"@deepseek-ai/dsh-subagent-fork-in-process": {
|
|
115
|
-
"optional": true
|
|
116
|
-
},
|
|
117
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": {
|
|
118
|
-
"optional": true
|
|
119
|
-
},
|
|
120
|
-
"@deepseek-ai/dsh-tools": {
|
|
121
|
-
"optional": true
|
|
122
|
-
},
|
|
123
|
-
"@deepseek-ai/dsh-workspace": {
|
|
124
|
-
"optional": true
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"devDependencies": {
|
|
128
|
-
"@deepseek-ai/cordis": "^4.0
|
|
129
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.
|
|
130
|
-
"@deepseek-ai/dsh-llm": "^0.2.
|
|
131
|
-
"@deepseek-ai/dsh-session": "^0.2.
|
|
132
|
-
"@deepseek-ai/dsh-session-projection-cache": "^0.2.
|
|
133
|
-
"@deepseek-ai/dsh-settings": "^0.2.
|
|
134
|
-
"@deepseek-ai/dsh-spill-local": "^0.2.
|
|
135
|
-
"@deepseek-ai/dsh-storage-domain": "^0.2.
|
|
136
|
-
"@deepseek-ai/dsh-subagent-fork-in-process": "^0.2.
|
|
137
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "^0.2.
|
|
138
|
-
"@deepseek-ai/dsh-tools": "^0.2.
|
|
139
|
-
"@deepseek-ai/dsh-workspace": "^0.2.
|
|
140
|
-
"@types/js-yaml": "^4.0.9",
|
|
141
|
-
"@types/node": "^24.0.0",
|
|
142
|
-
"@types/semver": "^7.7.0",
|
|
143
|
-
"react": "^18.2.0",
|
|
144
|
-
"typescript": "^6.0.0"
|
|
145
|
-
},
|
|
146
|
-
"license": "MIT",
|
|
147
|
-
"dependencies": {
|
|
148
|
-
"fflate": "^0.8.3",
|
|
149
|
-
"js-yaml": "^4.3.2",
|
|
150
|
-
"semver": "^7.7.2"
|
|
151
|
-
}
|
|
152
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-plugin-tool-management",
|
|
3
|
+
"version": "0.22.0",
|
|
4
|
+
"description": "一个设置面板,统一管理 MCP、技能、记忆、子智能体、提示词和归档会话;可自定义搭配场景,一个场景即可切换整个环境;Agent也能帮你操作这个插件。",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/ouli-1242/dsh-plugin-tool-management"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "lib/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./lib/index.js",
|
|
13
|
+
"./client": "./lib/client.js",
|
|
14
|
+
"./workspace": "./lib/sessions/workspace.js",
|
|
15
|
+
"./locale/*.json": "./locale/*.json",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib",
|
|
20
|
+
"locale",
|
|
21
|
+
"cordis.patch.yml",
|
|
22
|
+
"README.md",
|
|
23
|
+
"README_EN.md",
|
|
24
|
+
"CHANGELOG.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"screenshots.json",
|
|
27
|
+
"docs/images",
|
|
28
|
+
"docs/UPDATE.md"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"dsh": ">=0.2.2-rc.1 <0.2.3",
|
|
32
|
+
"node": ">=24.9"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"registry": "https://registry.npmjs.org",
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p tsconfig.json && node scripts/sync-client.mjs && node scripts/sync-profile.mjs",
|
|
40
|
+
"prepublishOnly": "npm run build && npm run lint && npm run typecheck:client && node --test test/client-exports.test.mjs",
|
|
41
|
+
"lint": "node --check lib/client.js && node --check lib/index.js",
|
|
42
|
+
"typecheck:client": "node scripts/sync-client.mjs && tsc -p tsconfig.client.json",
|
|
43
|
+
"check:i18n": "node scripts/check-i18n.mjs lib/client.js",
|
|
44
|
+
"check:host": "node scripts/host-deps.mjs && node scripts/doctor.mjs",
|
|
45
|
+
"check:strict": "node scripts/check-strict.mjs",
|
|
46
|
+
"host-deps": "node scripts/host-deps.mjs --fix",
|
|
47
|
+
"doctor": "node scripts/doctor.mjs",
|
|
48
|
+
"test": "npm run build && npm run check:i18n && npm run typecheck:client && node --test test/contracts.test.mjs test/client-exports.test.mjs",
|
|
49
|
+
"sync:profile": "node scripts/sync-profile.mjs"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"dsh",
|
|
53
|
+
"deepseek-harness",
|
|
54
|
+
"skill",
|
|
55
|
+
"skills",
|
|
56
|
+
"mcp",
|
|
57
|
+
"mcp-server",
|
|
58
|
+
"plugin",
|
|
59
|
+
"cordis"
|
|
60
|
+
],
|
|
61
|
+
"dsh": {
|
|
62
|
+
"bundle": {
|
|
63
|
+
"patch": "./cordis.patch.yml"
|
|
64
|
+
},
|
|
65
|
+
"client": {
|
|
66
|
+
"platform": "web",
|
|
67
|
+
"inject": [
|
|
68
|
+
"@deepseek-ai/dsh-client-locale",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-input-trigger"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"icon": "./docs/images/logo.png",
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
76
|
+
"@deepseek-ai/dsh-agent-preset-registry": ">=0.2.2-rc.1 <0.2.3",
|
|
77
|
+
"@deepseek-ai/dsh-llm": ">=0.2.2-rc.1 <0.2.3",
|
|
78
|
+
"@deepseek-ai/dsh-session": ">=0.2.2-rc.1 <0.2.3",
|
|
79
|
+
"@deepseek-ai/dsh-session-projection-cache": ">=0.2.2-rc.1 <0.2.3",
|
|
80
|
+
"@deepseek-ai/dsh-settings": ">=0.2.2-rc.1 <0.2.3",
|
|
81
|
+
"@deepseek-ai/dsh-spill-local": ">=0.2.2-rc.1 <0.2.3",
|
|
82
|
+
"@deepseek-ai/dsh-storage-domain": ">=0.2.2-rc.1 <0.2.3",
|
|
83
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": ">=0.2.2-rc.1 <0.2.3",
|
|
84
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": ">=0.2.2-rc.1 <0.2.3",
|
|
85
|
+
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.1 <0.2.3",
|
|
86
|
+
"@deepseek-ai/dsh-workspace": ">=0.2.2-rc.1 <0.2.3",
|
|
87
|
+
"react": "^18.2.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependenciesMeta": {
|
|
90
|
+
"@deepseek-ai/cordis": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"@deepseek-ai/dsh-agent-preset-registry": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"@deepseek-ai/dsh-llm": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"@deepseek-ai/dsh-session": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"@deepseek-ai/dsh-session-projection-cache": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"@deepseek-ai/dsh-settings": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"@deepseek-ai/dsh-spill-local": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"@deepseek-ai/dsh-storage-domain": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
117
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
120
|
+
"@deepseek-ai/dsh-tools": {
|
|
121
|
+
"optional": true
|
|
122
|
+
},
|
|
123
|
+
"@deepseek-ai/dsh-workspace": {
|
|
124
|
+
"optional": true
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"devDependencies": {
|
|
128
|
+
"@deepseek-ai/cordis": "^4.1.0",
|
|
129
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.2-rc.1",
|
|
130
|
+
"@deepseek-ai/dsh-llm": "^0.2.2-rc.1",
|
|
131
|
+
"@deepseek-ai/dsh-session": "^0.2.2-rc.1",
|
|
132
|
+
"@deepseek-ai/dsh-session-projection-cache": "^0.2.2-rc.1",
|
|
133
|
+
"@deepseek-ai/dsh-settings": "^0.2.2-rc.1",
|
|
134
|
+
"@deepseek-ai/dsh-spill-local": "^0.2.2-rc.1",
|
|
135
|
+
"@deepseek-ai/dsh-storage-domain": "^0.2.2-rc.1",
|
|
136
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": "^0.2.2-rc.1",
|
|
137
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "^0.2.2-rc.1",
|
|
138
|
+
"@deepseek-ai/dsh-tools": "^0.2.2-rc.1",
|
|
139
|
+
"@deepseek-ai/dsh-workspace": "^0.2.2-rc.1",
|
|
140
|
+
"@types/js-yaml": "^4.0.9",
|
|
141
|
+
"@types/node": "^24.0.0",
|
|
142
|
+
"@types/semver": "^7.7.0",
|
|
143
|
+
"react": "^18.2.0",
|
|
144
|
+
"typescript": "^6.0.0"
|
|
145
|
+
},
|
|
146
|
+
"license": "MIT",
|
|
147
|
+
"dependencies": {
|
|
148
|
+
"fflate": "^0.8.3",
|
|
149
|
+
"js-yaml": "^4.3.2",
|
|
150
|
+
"semver": "^7.7.2"
|
|
151
|
+
}
|
|
152
|
+
}
|