@xi4z/dsh-utils 0.3.0 → 0.7.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/README.md +246 -86
- package/cordis.patch.yml +62 -25
- package/lib/index.d.ts +6 -4
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +17 -11
- package/src/index.ts +12 -0
- package/skills/dsh-approval-policy-config/SKILL.md +0 -96
package/README.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
# @xi4z/dsh-utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
官方实验性 bundle 形态:根包 `@xi4z/dsh-utils` 只做拼装(`cordis.patch.yml` + locale + icon),**本身不挂任何组件**;四个组件各自是独立发布的包,根包用同版本精确依赖把它们装起来。浏览器半侧单独成包 `@xi4z/dsh-utils-ui`(宿主 `apply()` 为空),客户端扫描器据此从 `utils-ui` 这个包根行加载 `client.js`。行 id 就是 settings 命名空间,保持稳定。
|
|
4
4
|
|
|
5
5
|
| 组件 | 挂载项 id | 包 | 作用 |
|
|
6
6
|
|---|---|---|---|
|
|
7
|
-
|
|
|
7
|
+
| utils-agents(宿主侧) | `utils-agents` | `@xi4z/dsh-utils-utils-agents` | 技能与预设的唯一宿主:嵌套 `SKILL.md` 发现、模型可见性开关,以及按预设管理 skills、技能仓库与 AGENTS.md |
|
|
8
8
|
| 无人值守审批门控 | `dsh-approval-policy` | `@xi4z/dsh-utils-approval-policy` | 给审批请求设应答窗口,超时 fail-closed |
|
|
9
9
|
| 会话通知 | `dsh-notify` | `@xi4z/dsh-utils-notify` | 会话结束/等授权/等回答时,经 Gotify 网关推送,带设备名 |
|
|
10
|
-
|
|
|
11
|
-
| 浏览器半侧 | `dsh-utils-ui` | `@xi4z/dsh-utils-ui` | 配置页 + 右侧栏技能/技能仓库面板;包根是 no-op host,只发布 `client.js` |
|
|
10
|
+
| 共享浏览器界面 | `utils-ui` | `@xi4z/dsh-utils-ui` | 上面三行的配置页 + 右侧栏 utils-agents 面板;宿主侧只有空的 `apply()` |
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
`utils-agents` 合并了原来的 `utils-main`(递归发现、旧全局仓库路由)与 `dsh-skill-panel`(技能可见性):递归发现、可见性开关、预设/仓库/AGENTS.md 管理现在是**一个组件、一个配置命名空间**。旧的 `/api/dsh-utils-ui/*` 路由随 `utils-main` 一起删掉;仓库配置与 Deploy Key 仍沿用 `$DSH_HOME/storages/dsh-utils-ui.*` 文件,由 utils-agents 读写,升级后不用重填。
|
|
13
|
+
|
|
14
|
+
根包 `locale/{en,zh}.json` 是 bundle 展示名;每个组件包用自己的 `locale/*.json` 提供行标题(utils-agents / 无人值守审批门控 / 会话通知 / 工具集界面)。`packages/*` 现在是**独立发布**的包,不再只是 tsc/测试的构建单元。
|
|
14
15
|
|
|
15
16
|
### 关于配置界面
|
|
16
17
|
|
|
17
|
-
DSH
|
|
18
|
+
DSH 只把一个包的浏览器半侧挂在「Loader 说明符恰为裸包名」的行上。`@xi4z/dsh-utils-ui` 自己声明 `dsh.client` 并导出 `./client`,patch 用 `utils-ui` 行挂它的裸包名,所以 `client.js` 落在这一行;三个宿主行不声明 `dsh.client`,不会出现 `multiple active Loader sources`。
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
UI 与宿主彻底解耦:停用 `utils-ui` 只失去配置页与侧边栏面板,宿主行照常工作;停用某个宿主行只让它自己的配置页消失(`whileServed` 按行 id 判定)。`utils-agents` 的配置页现在一页三块:递归技能发现、模型可见性开关、预设与技能仓库。
|
|
20
21
|
|
|
21
|
-
配置写 `cordis.patch.yml`:bundle 给默认值,profile 按 id 覆盖。覆盖行**不要写 `name
|
|
22
|
+
配置写 `cordis.patch.yml`:bundle 给默认值,profile 按 id 覆盖。覆盖行**不要写 `name`**。旧版的 `- id: utils-main` / `- id: dsh-skill-panel` 覆盖行不再生效,字段要搬进 `- id: utils-agents` 的 `config:`。
|
|
22
23
|
|
|
23
24
|
## 安装
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
cd /path/to/dsh-utils
|
|
29
|
-
pnpm install
|
|
30
|
-
pnpm build
|
|
31
|
-
```
|
|
26
|
+
一次装 bundle;四个组件由 pnpm 作为根包的精确版本依赖从 registry 装上。
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
| 想要的 | `target` |
|
|
29
|
+
|---|---|
|
|
30
|
+
| 最近一次发布 | `@xi4z/dsh-utils` |
|
|
31
|
+
| `main` 最新提交 | `https://github.com/xi4z/dsh-utils`(组件包仍需 registry 上有同版本) |
|
|
32
|
+
| 离线 | 五个 tarball(见下) |
|
|
33
|
+
| 改代码、即时生效 | 目录 `link:`,profile 里同时 link 四个组件 |
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
plugin_manager action=install_bundle target=@xi4z/dsh-utils
|
|
@@ -40,37 +40,66 @@ plugin_manager action=install_bundle target=@xi4z/dsh-utils
|
|
|
40
40
|
dsh plugin --profile <profile> add @xi4z/dsh-utils
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
发布版只需要这一个 spec:根包的 `dependencies` 固定到四个 `@xi4z/dsh-utils-*`,版本与 bundle 相同。GitHub 地址装的是 `main` 当前状态、不钉版本;要钉就用 npm 名或 `#<commit>`(组件仍从 registry 取同版本)。
|
|
44
|
+
|
|
45
|
+
根包 tarball 不再自包含(组件是独立包)。要离线搬运,就把五个包都 pack:
|
|
44
46
|
|
|
45
47
|
```sh
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
pnpm install && pnpm build
|
|
49
|
+
pnpm -r --filter "./packages/*" pack --pack-destination dist
|
|
50
|
+
pnpm pack --pack-destination dist
|
|
51
|
+
# 目标机器 profile 里五个 tarball 都加 file: 依赖,再装 bundle
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
本地开发直接装目录(`link:`,不复制文件,改完 `pnpm build` 重启宿主)。因为组件是精确版本依赖,profile 要把四个组件也 link 进来,pnpm 才会用本地目录而不是去 registry 解析:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@xi4z/dsh-utils": "link:/abs/path/dsh-utils",
|
|
60
|
+
"@xi4z/dsh-utils-approval-policy": "link:/abs/path/dsh-utils/packages/approval-policy",
|
|
61
|
+
"@xi4z/dsh-utils-notify": "link:/abs/path/dsh-utils/packages/notify",
|
|
62
|
+
"@xi4z/dsh-utils-utils-agents": "link:/abs/path/dsh-utils/packages/utils-agents",
|
|
63
|
+
"@xi4z/dsh-utils-ui": "link:/abs/path/dsh-utils/packages/ui"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
profile 的 `dsh.profile.bundles` 里是 `@xi4z/dsh-utils`。装后 bundle 的 patch 自动插四行,不手写挂载块;`config:` 只管配置。挂载项新增/改名要重启宿主。
|
|
53
69
|
|
|
54
|
-
|
|
70
|
+
从 0.5.0 单包版升级:
|
|
55
71
|
|
|
56
|
-
1. profile
|
|
57
|
-
2. `dsh.profile.bundles` 里的
|
|
58
|
-
3. profile `cordis.patch.yml`
|
|
72
|
+
1. 发布版:profile 依赖只留 `@xi4z/dsh-utils`(pnpm 会装上四个组件);本地开发:再按上表 link 四个 `packages/*`;
|
|
73
|
+
2. `dsh.profile.bundles` 里的 `@xi4z/dsh-utils` 不变;
|
|
74
|
+
3. profile `cordis.patch.yml` 的组件覆盖行只留 `id` + `config`;把 `id: utils-main` 与 `id: dsh-skill-panel` 下的字段搬进 `id: utils-agents`(旧 id 不再挂载),旧的 `id: dsh-utils-ui` 覆盖行删掉(新的 UI 行 id 是 `utils-ui`);
|
|
59
75
|
4. 重启宿主。技能仓库设置、Deploy Key、上次同步记录都不用重填。
|
|
60
76
|
|
|
61
77
|
## 发布
|
|
62
78
|
|
|
63
|
-
|
|
79
|
+
五个包同版本、按依赖顺序发布:四个组件在前,bundle 在后。`scripts/release.mjs` 先 `npm view` 探一遍,**版本已在 registry 上就跳过**,所以重复跑安全、失败后重跑能从断点续上;任一包版本与根包不一致会直接报错退出。
|
|
80
|
+
|
|
81
|
+
推 GitHub 与发 npm 可以合成一次操作——打 tag 触发 [`publish.yml`](.github/workflows/publish.yml):
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
git push # 先推代码
|
|
85
|
+
git tag v0.7.0 && git push origin v0.7.0 # 再推 tag,CI 里 build + 发布全部五个包
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
tag 必须等于根包 `package.json` 的版本,否则 job 直接失败(防止把 0.7.0 的代码发成 0.3.9)。CI 里 `pnpm release` 按依赖顺序发五个包,带 `--provenance`。
|
|
89
|
+
|
|
90
|
+
一次性准备:npm 建一个 Automation token,存成仓库 secret `NPM_TOKEN`。scope 是公开的 `@xi4z`,token 所属账号要能用这个 scope(scope 通常是 npm 用户名或已创建的组织)。
|
|
91
|
+
|
|
92
|
+
手动发(本机 `npm login` 后,脚本逻辑与 CI 相同):
|
|
64
93
|
|
|
65
94
|
```sh
|
|
66
95
|
pnpm build
|
|
67
|
-
pnpm
|
|
68
|
-
pnpm
|
|
96
|
+
pnpm release # 按顺序发组件与 bundle;已发布版本跳过
|
|
97
|
+
pnpm release --dry-run # 只看会不会发,不动 registry
|
|
69
98
|
```
|
|
70
99
|
|
|
71
|
-
|
|
100
|
+
版本只有一个:改了任何组件都要把五个 `package.json` 的版本一起提到同一个值,再打 tag。
|
|
72
101
|
|
|
73
|
-
##
|
|
102
|
+
## 组件一(`utils-agents`):技能目录 —— 递归发现与模型可见性
|
|
74
103
|
|
|
75
104
|
```
|
|
76
105
|
.dsh/skills/
|
|
@@ -97,6 +126,13 @@ pnpm publish:bundle
|
|
|
97
126
|
|
|
98
127
|
识别字段:`name`、`description`,可选 `whenToUse`、`disable-model-invocation`、`user-invocable`。非法文件记 warning,跳过。
|
|
99
128
|
|
|
129
|
+
|
|
130
|
+
### 模型可见性(同一组件)
|
|
131
|
+
|
|
132
|
+
配置页的「技能」开关列出当前会话能读到的 Skill:关掉 = 在 `ctx.skills.snapshot()` / `list()` 里把该技能标成 `modelInvocable: false`,模型下一轮拿到的 `<available_skills>` 里不再出现,**手动 `/名称` 仍可加载**。只能手动调用的技能显示「仅手动」,开关禁用。
|
|
133
|
+
|
|
134
|
+
数据来源:`GET /api/dsh-utils/skill-panel/list`(Connection owner 认证);带 `sessionId` 时用该会话的 cwd 与 preset skill 层,不带时用宿主默认工作目录。持久化在 `utils-agents` 命名空间的 `disabledSkills`(volatile,保存即生效);这里只影响模型可见性,不改预设目录里的 `SKILL.md`——按预设开关技能仍在同一面板的「技能」视图(重命名 `SKILL.md` / `SKILL.md.disabled`)。
|
|
135
|
+
|
|
100
136
|
## 组件二:无人值守审批门控
|
|
101
137
|
|
|
102
138
|
挂宿主 `'approval/request'` waterfall 链首(`prepend`)。判定无人值守的请求先 `next()` 给下游:窗口内有人答,用人的答案;窗口耗尽,按 fail-closed 默认值落定,turn 立即结束,不长期挂起。交互会话不改变。
|
|
@@ -291,63 +327,184 @@ template: |
|
|
|
291
327
|
3. 两个 id 不能同时挂,否则同一事件发两遍。旧命名空间 `qq-notify` 的存量值不读取。按第 2 步搬。
|
|
292
328
|
4. 环境变量(`DSH_QQ_NOTIFY_*`)不改。
|
|
293
329
|
|
|
294
|
-
##
|
|
330
|
+
## 组件四(`utils-agents` 面板):预设、技能仓库与 AGENTS.md
|
|
331
|
+
|
|
332
|
+
一个侧边栏面板,把原来的「技能」「技能仓库」「Markdown」三张卡片合在一起,并把 `~/.dsh/.agent-presets/<id>/` 注册成真正的 agent preset。顶部选择预设(或「全局 / 项目 AGENTS.md」),下面四个视图:
|
|
295
333
|
|
|
296
|
-
|
|
334
|
+
| 视图 | 作用 |
|
|
335
|
+
|---|---|
|
|
336
|
+
| 技能 | 列出 `<preset>/skills/` 下的 `SKILL.md` / `SKILL.md.disabled`,显示名称、描述、路径;开关直接重命名文件;「编辑 SKILL.md」跳到 Markdown 视图 |
|
|
337
|
+
| Markdown | 列出该预设的 `AGENTS.md`(缺失也列出,保存即创建)以及全部 `.md` / `.md.disabled`;带草稿、还原、重读、`Ctrl/Cmd+S` |
|
|
338
|
+
| 技能仓库 | 仓库地址、分支、`skills/` 下的目标子目录、密钥路径、Deploy Key、递归子模块;保存设置与「同步(拉取)」 |
|
|
339
|
+
| 预设同步 | 配置共享技能仓库(仓库地址、分支、检出目录、Deploy Key)并 clone/快进私有仓库;读取其 `.dsh/preset` 下的共享预设,逐条或全部复制到 `$DSH_HOME/.agent-presets/`;导入非内置原生预设,并发布目录预设到共享仓库、提交推送 |
|
|
297
340
|
|
|
298
|
-
|
|
341
|
+
目录预设注册:宿主启动、首次打开 utils-agents 面板或点“刷新”时,会把每个含 `agent.cordis.yml` 的目录注册成真正的 agent preset(声明一个 `cordis:include` 行)。注册成功后 DSH 的预设选择器就能选到它;加载失败会在面板列出 `broken` 诊断。
|
|
299
342
|
|
|
300
|
-
|
|
343
|
+
预设来自 `$DSH_HOME/.agent-presets/<id>/`(以及 `presetDirs`);顶部显示 `preset.yml` 的 name/description。全局视图保留 `$DSH_HOME/AGENTS.md`、`$DSH_AGENTS_HOME/AGENTS.md` 与项目根到当前目录的 AGENTS.md 链。
|
|
301
344
|
|
|
302
|
-
|
|
345
|
+
目录预设会被 utils-agents **注册成真正的 agent preset**:每个目录声明一个 `cordis:include` 行指向它的 `agent.cordis.yml`,由 Loader 用原来的 `!!js` 入口列表解析并持续监听。注册成功后,DSH 的预设选择器会出现 `code`、`a-ce` 等目录预设;加载失败会在面板显示 `broken` 诊断。宿主启动时就会注册;首次打开 utils-agents 面板或点“刷新”也会补注册新增目录,不必重启。全局/项目 AGENTS.md 仍由 `dsh-agent-instructions` 读取。
|
|
303
346
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
347
|
+
仓库同步只拉取:
|
|
348
|
+
|
|
349
|
+
- 目标 `<preset>/skills/<targetSubdir>` 不存在:`git clone --depth 1 --branch <branch> --single-branch`;
|
|
350
|
+
- 已存在:必须是同一仓库的 checkout、当前分支等于配置分支;`fetch` + `merge --ff-only`,浅克隆首次同步会 `--unshallow`,避免 unrelated histories;
|
|
351
|
+
- 子模块可选:`git submodule sync --recursive` + `update --init --recursive`,失败只记 warning;
|
|
352
|
+
- 不 reset、不 force、不推送。
|
|
353
|
+
|
|
354
|
+
Deploy Key 按预设保存到 `$DSH_HOME/storages/dsh-utils-agents/<preset>.key`(600),接口不回显;也可以填「密钥路径」指向已有私钥。公开 `https://` / `file://` 可免密钥。
|
|
355
|
+
|
|
356
|
+
#### 私有仓库与通用 Deploy Key
|
|
357
|
+
|
|
358
|
+
面板底部固定有一栏**通用 Deploy Key**:粘贴一个 OpenSSH 私钥并保存,之后所有由这个面板发起的 clone / fetch,在缺少更具体的密钥时都会使用它。查找顺序:
|
|
359
|
+
|
|
360
|
+
1. 该仓库自己配置的「密钥路径」;
|
|
361
|
+
2. 该仓库保存的 Deploy Key(技能仓库按预设、预设同步按共享仓库);
|
|
362
|
+
3. 面板底部的通用 Deploy Key。
|
|
363
|
+
|
|
364
|
+
私钥写入 `$DSH_HOME/storages/dsh-utils-agents/deploy-key`(600),接口只回 `source`,从不回显内容;清空输入再点「保存/清除」即删除。HTTPS 地址在存在密钥时改写为 `git@<host>:<path>.git`;SSH 地址(`git@host:path`)直接用它。拉取仍然只读:clone 或 `fetch` + `merge --ff-only`,不 reset、不 push。
|
|
365
|
+
|
|
366
|
+
#### 版本检查
|
|
367
|
+
|
|
368
|
+
面板顶部显示当前 bundle 版本(如 `v0.7.0`)、安装来源徽标(npm / GitHub / 本地)和「检查更新」按钮。宿主按 `updateCheckIntervalHours`(默认 6 小时)在后台检查,激活后约 15 秒先查一次;远端比当前版本新时,按钮旁出现「有新版本 x.y.z」。
|
|
369
|
+
|
|
370
|
+
查哪里取决于 profile 里 `@xi4z/dsh-utils` 的安装方式(读 profile 的 `package.json`):
|
|
371
|
+
|
|
372
|
+
| 安装方式 | 检查目标 |
|
|
373
|
+
|---|---|
|
|
374
|
+
| registry spec(`^0.4.0`、`latest` 等) | `<registry>/@xi4z%2Fdsh-utils/latest`(默认 `https://registry.npmjs.org`) |
|
|
375
|
+
| GitHub spec(`github:owner/repo`、`owner/repo`、`git+https://…#ref`、`git@github.com:owner/repo`) | `https://raw.githubusercontent.com/<owner>/<repo>/<ref>/package.json`;`ref` 取 `#` 后的分支/tag/sha(默认 `HEAD`),公开仓库免 token |
|
|
376
|
+
| `link:` / `file:` / 读不到 profile 清单 | 没有远端可比,标为「本地」,仍对比 npm `latest` 作参考 |
|
|
377
|
+
|
|
378
|
+
**自动安装**(`updateAutoInstall`,默认开):查到更新且安装方式可更新时,后台在 profile 目录执行:
|
|
379
|
+
|
|
380
|
+
- registry 安装 → `pnpm add @xi4z/dsh-utils@<version> --save-exact`;
|
|
381
|
+
- GitHub 安装 → `pnpm add <原来的 spec>`(分支/标签会重新解析到该 ref 的最新提交);
|
|
382
|
+
- 固定 40 位 commit 的 Git spec、`link:`、`file:` 一律跳过(没有可移动的远端)。
|
|
383
|
+
|
|
384
|
+
安装失败会回滚 `package.json` 与 `pnpm-lock.yaml` 并显示原因;同一版本只自动装一次。装完必须重启 `dsh web` 才生效——面板显示「已自动更新到 x.y.z(重启 dsh web 生效)」,安装中会每 3 秒刷新一次状态。重启前浏览器刷新可能加载到新 `client.js` 而宿主还是旧代码,所以装完尽快重启。
|
|
385
|
+
|
|
386
|
+
- 每次只请求一个 URL,8 秒超时;失败不重试、不弹窗,只把错误写进面板并保留上一次读到的版本。
|
|
387
|
+
- 结果缓存到 `$DSH_HOME/storages/dsh-utils-agents/update.json`(600):重启后先显示缓存,首次检查完成再覆盖。
|
|
388
|
+
- 「检查更新」按钮立即查询;与后台检查撞车时复用同一个请求。
|
|
389
|
+
- `updateCheck: false` 可完全关掉后台检查(按钮仍然可用)。
|
|
390
|
+
- 私有 GitHub 仓库读不到(HTTP 404)时会显示「检查失败」,需要手动更新。
|
|
391
|
+
- 不依赖 DSH 插件页的更新按钮:DSH 只把「固定 40 位 commit 的 Git spec」当作可更新(`update: 'git'`),分支/tag/`github:` 简写和 `link:`/`path:`/`tarball` 都不算,而且它不会去查远端有没有新 commit(需要你提供新的 pinned spec)。所以这里自己读远端 `package.json` 比版本。
|
|
392
|
+
|
|
393
|
+
#### 共享预设同步(`.dsh`)
|
|
394
|
+
|
|
395
|
+
跟踪技能的 Git 仓库可以顺带携带预设:仓库根下的 `.dsh/preset` 目录被当作只读来源,面板把其中的预设目录复制到本机 `$DSH_HOME/.agent-presets/<id>/`,同步完立即由 legacy 桥注册成真正的 agent preset。支持的布局:
|
|
396
|
+
|
|
397
|
+
```text
|
|
398
|
+
<repo>/.dsh/preset/<id>/ # 推荐:一个仓库携带多个预设
|
|
399
|
+
<repo>/.dsh/preset/ # 目录本身就是一个预设(preset.yml / agent.cordis.yml 直接放在这里)
|
|
400
|
+
<repo>/.dsh/presets/<id>/ # 兼容别名
|
|
401
|
+
<repo>/.dsh/.agent-presets/<id>/ # 兼容别名,镜像 $DSH_HOME 结构
|
|
402
|
+
<repo>/.dsh/<id>/ # 兼容:目录内需有 preset.yml 或 agent.cordis.yml
|
|
308
403
|
```
|
|
309
404
|
|
|
310
|
-
`
|
|
405
|
+
预设目录必须带 `preset.yml` 或 `agent.cordis.yml`;单个预设目录形式的 id 取 `preset.yml` 的 `id`,没有就取目录名。
|
|
406
|
+
|
|
407
|
+
扫描来源:当前选中预设同步出来的技能仓库 checkout(`<preset>/skills/<targetSubdir>`)、共享技能仓库的 checkout(`$DSH_HOME/storages/dsh-utils-ui.json` 的 `targetDir`,默认 `$DSH_HOME/skills/herskill`)、`$DSH_HOME/skills` 及其带 `.dsh` 的一级子目录,以及配置项 `presetSourceDirs` 里列出的额外仓库,按真实路径去重。仓库本身不会被修改。
|
|
311
408
|
|
|
312
|
-
|
|
409
|
+
**共享技能仓库与 Deploy Key**:面板里可直接配置被跟踪的技能仓库——仓库地址、分支、检出目录、可选密钥路径、Deploy Key 私钥,点「拉取」做 clone 或 `fetch` + `merge --ff-only`(浅克隆先 `--unshallow`,子模块可选),完成后 `.dsh/preset` 自动出现在下面的来源列表。私有仓库填 Deploy Key 即可,也可以只保存面板底部的通用 Deploy Key;密钥只在保存时写入、接口不回显。
|
|
313
410
|
|
|
314
|
-
|
|
411
|
+
检出目录就是**仓库根目录**,可以是任意绝对路径(如 `~/core/projects/skills`、`~/.dsh/skills-src/skills`),不必叫 `.dsh`,也不需要指向 `~/.dsh`;预设固定从 `<检出目录>/.dsh/preset` 读取。
|
|
315
412
|
|
|
316
|
-
|
|
413
|
+
存储与旧全局路由兼容,两处看到的是同一份配置:
|
|
317
414
|
|
|
318
|
-
|
|
415
|
+
- 设置:`$DSH_HOME/storages/dsh-utils-ui.json`(`repoUrl` / `branch` / `targetDir` / `keyPath` / `recurseSubmodules` / `lastSync`)
|
|
416
|
+
- Deploy Key:`$DSH_HOME/storages/dsh-utils-ui.deploy-key`(600,不返回浏览器)
|
|
417
|
+
- 通用 Deploy Key:`$DSH_HOME/storages/dsh-utils-agents/deploy-key`(600,不返回浏览器)
|
|
418
|
+
- 密钥优先级:`keyPath` 指向的私钥 > 该仓库保存的 Deploy Key > 通用 Deploy Key > 无;公开 `https://` / `file://` 可免密钥
|
|
319
419
|
|
|
320
|
-
|
|
420
|
+
同步规则:
|
|
321
421
|
|
|
322
|
-
-
|
|
323
|
-
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
422
|
+
- 逐文件写临时文件再 rename;内容相同则跳过,按源文件保留可执行位;跳过符号链接与 `.git` / `node_modules` 等忽略目录;单文件上限 8 MiB;
|
|
423
|
+
- 「删除源中已移除的文件」只删**上一次同步清单里记录过、这次源里已消失**的文件,本机自己加的文件和预设里的 `.dsh-utils/repo.json` 不会被删;
|
|
424
|
+
- 同步清单在 `$DSH_HOME/storages/dsh-utils-agents/shared-presets.json`(600),用于显示「已接管」与上次同步时间;
|
|
425
|
+
- 状态:`new`(本地没有)、`update`(文件内容不同)、`same`(已一致)、`invalid`(id 不合法,拒绝同步)。
|
|
326
426
|
|
|
327
|
-
|
|
427
|
+
#### 原生预设接管与发布
|
|
328
428
|
|
|
329
|
-
|
|
429
|
+
DSH 的预设除了目录版,还可能来自 Cordis 声明(随包内置的 `standard`/`ptc`,或 `dsh-butler-preset` 这类 bundle)。面板的「原生预设接管」会列出注册表里的全部声明:
|
|
330
430
|
|
|
331
|
-
-
|
|
332
|
-
-
|
|
333
|
-
-
|
|
431
|
+
- `builtinPresets`(默认 `standard`、`ptc`、`minimal`、`creator`)保留原生,不导入;
|
|
432
|
+
- 其余声明若是「可导入」,点「导入到本地预设」后调用注册表的 `readDocument(id)`,把组合 YAML 写成 `$DSH_HOME/.agent-presets/<id>/agent.cordis.yml`,并把 name/description 写进 `preset.yml`(已存在的目录默认跳过,避免覆盖本地修改);
|
|
433
|
+
- 导入后由 legacy 桥在下一次刷新时注册;不会删除/停用任何原生声明。
|
|
334
434
|
|
|
335
|
-
|
|
435
|
+
「发布非内置预设」把本机所有非内置目录预设复制到共享仓库的 `.dsh/preset/<id>/`,然后:
|
|
336
436
|
|
|
337
|
-
|
|
437
|
+
- 只 `git add` / `git commit` 路径 `.dsh/preset`,不碰仓库里的其他改动;
|
|
438
|
+
- 勾选推送时执行 `git push origin HEAD:<分支>`,分支必须等于共享仓库配置里的分支;
|
|
439
|
+
- 共享仓库必须是已拉取的 Git checkout;提交信息可自定义,默认 `presets: sync from dsh-utils`。
|
|
338
440
|
|
|
339
|
-
|
|
441
|
+
路由(Connection owner 认证):
|
|
442
|
+
|
|
443
|
+
| 方法 | 路径 | 作用 |
|
|
444
|
+
|---|---|---|
|
|
445
|
+
| `GET` | `/api/dsh-utils/utils-agents/list` | 预设列表、技能、AGENTS.md 元数据、全局文件;带 `sessionId` 时用该会话 cwd |
|
|
446
|
+
| `GET` | `/api/dsh-utils/utils-agents/files?presetId=…` | 一个预设或全局目标的 Markdown 文件 |
|
|
447
|
+
| `GET / POST` | `/api/dsh-utils/utils-agents/file` | 读文件;POST `{id, content, baseMtimeMs, sessionId?}` 原子写入 |
|
|
448
|
+
| `POST` | `/api/dsh-utils/utils-agents/skill` | `{presetId, path, enabled}`,重命名 SKILL.md |
|
|
449
|
+
| `GET / POST` | `/api/dsh-utils/utils-agents/repo` | 读/存每个预设的仓库设置 |
|
|
450
|
+
| `POST` | `/api/dsh-utils/utils-agents/key` | `{presetId, key}`,保存或清除 Deploy Key |
|
|
451
|
+
| `POST` | `/api/dsh-utils/utils-agents/sync` | `{presetId}`,clone 或快进 |
|
|
452
|
+
| `GET` | `/api/dsh-utils/utils-agents/shared?presetId=…` | 扫描技能仓库 `.dsh` 下的共享预设及同步状态 |
|
|
453
|
+
| `POST` | `/api/dsh-utils/utils-agents/shared-sync` | `{presetId, ids?, prune?}`,把共享预设复制到本机预设目录 |
|
|
454
|
+
| `GET / POST` | `/api/dsh-utils/utils-agents/shared-repo` | 读/存共享技能仓库设置(与旧全局路由同一份存储) |
|
|
455
|
+
| `POST` | `/api/dsh-utils/utils-agents/shared-key` | `{key}`,保存或清除共享仓库 Deploy Key |
|
|
456
|
+
| `POST` | `/api/dsh-utils/utils-agents/shared-pull` | 用配置的 Deploy Key(或通用 Deploy Key)clone 或快进共享技能仓库 |
|
|
457
|
+
| `GET / POST` | `/api/dsh-utils/utils-agents/deploy-key` | 读/存面板通用的 Deploy Key;只回 `source`,不回显内容 |
|
|
458
|
+
| `GET / POST` | `/api/dsh-utils/utils-agents/update` | 读缓存/立即检查远端版本(npm 或 GitHub,按安装方式) |
|
|
459
|
+
| `GET` | `/api/dsh-utils/utils-agents/native-presets` | 列出注册表里的预设及内置/已目录/可导入状态 |
|
|
460
|
+
| `POST` | `/api/dsh-utils/utils-agents/native-presets-import` | `{ids?, force?}`,把非内置声明导出为目录预设 |
|
|
461
|
+
| `POST` | `/api/dsh-utils/utils-agents/presets-publish` | `{ids?, message?, push?}`,发布到共享仓库并提交/推送 |
|
|
462
|
+
|
|
463
|
+
配置(全 volatile,保存即生效):
|
|
464
|
+
|
|
465
|
+
| 字段 | 默认 | 含义 |
|
|
466
|
+
|---|---|---|
|
|
467
|
+
| `maxBytes` | `524288` | 单文件读写上限(字节) |
|
|
468
|
+
| `presetDirs` | `[]` | 额外的预设根目录;每个子目录视为一个预设 |
|
|
469
|
+
| `presetSourceDirs` | `[]` | 额外的共享预设来源(技能仓库绝对路径);读取其 `.dsh` 下的预设 |
|
|
470
|
+
| `builtinPresets` | `['standard','ptc','minimal','creator']` | 保留为原生的预设 id;其余声明可导入为目录预设 |
|
|
471
|
+
| `extraAgentsFiles` | `[]` | 全局视图额外暴露的 AGENTS.md 类绝对路径 |
|
|
472
|
+
| `scanNestedAgents` | `false` | 全局视图递归寻找嵌套 AGENTS.md |
|
|
473
|
+
| `nestedDepth` | `3` | 全局视图递归深度 |
|
|
474
|
+
| `defaultRepoUrl` | `https://github.com/xi4z/skills` | 新预设的默认仓库地址 |
|
|
475
|
+
| `defaultBranch` | `Agent` | 新预设的默认分支 |
|
|
476
|
+
| `updateCheck` | `true` | 后台定时检查 npm 上的发布版本 |
|
|
477
|
+
| `updateCheckIntervalHours` | `6` | 两次自动检查之间的小时数(1–168) |
|
|
478
|
+
| `updateRegistry` | `https://registry.npmjs.org` | 查询发布版本用的 registry,可换镜像 |
|
|
479
|
+
| `updateAutoInstall` | `true` | 查到新版本就后台执行 `pnpm add` 自动安装(重启后生效) |
|
|
480
|
+
|
|
481
|
+
宿主半侧在 `packages/utils-agents/src/`(`index.ts` 路由、`presets.ts` 预设/技能/文件、`git.ts` 仓库同步、`update.ts` 发布版本检查),浏览器半侧在 `@xi4z/dsh-utils-ui` 的 `client.js`。停用 `utils-agents` 行后路由消失,侧边栏 utils-agents 面板显示 404 提示。
|
|
340
482
|
|
|
341
483
|
## 配置写法
|
|
342
484
|
|
|
343
485
|
覆盖行只写 `id` 与 `config`,`name` 交给 bundle:
|
|
344
486
|
|
|
345
487
|
```yaml
|
|
346
|
-
- id:
|
|
488
|
+
- id: utils-agents
|
|
347
489
|
config:
|
|
490
|
+
# 递归发现
|
|
348
491
|
maxDepth: 6
|
|
349
492
|
extraRoots:
|
|
350
493
|
- D:/Core/Projects/Skill
|
|
494
|
+
# 模型可见性
|
|
495
|
+
disabledSkills: []
|
|
496
|
+
# 预设 / 技能仓库 / AGENTS.md
|
|
497
|
+
maxBytes: 524288
|
|
498
|
+
presetDirs: []
|
|
499
|
+
extraAgentsFiles: []
|
|
500
|
+
scanNestedAgents: false
|
|
501
|
+
nestedDepth: 3
|
|
502
|
+
defaultRepoUrl: https://github.com/xi4z/skills
|
|
503
|
+
defaultBranch: Agent
|
|
504
|
+
updateCheck: true
|
|
505
|
+
updateCheckIntervalHours: 6
|
|
506
|
+
updateRegistry: https://registry.npmjs.org
|
|
507
|
+
updateAutoInstall: true
|
|
351
508
|
- id: dsh-approval-policy
|
|
352
509
|
config:
|
|
353
510
|
origins: [subagent, scheduled, cron]
|
|
@@ -360,52 +517,55 @@ Deploy Key:
|
|
|
360
517
|
gotifyToken: gtfya.该系列的token
|
|
361
518
|
deviceLabel: 办公本
|
|
362
519
|
dryRun: false
|
|
363
|
-
- id: dsh-skill-panel
|
|
364
|
-
config:
|
|
365
|
-
disabledSkills: []
|
|
366
520
|
```
|
|
367
521
|
|
|
368
|
-
|
|
522
|
+
三个宿主 id(`utils-agents`、`dsh-approval-policy`、`dsh-notify`)同时是 settings 命名空间;`utils-ui` 没有 config,只是浏览器半侧的挂载行。配置写 `cordis.patch.yml`:bundle 给默认,profile 按 id 覆盖。插件页每个挂载项都有配置页(由 `utils-ui` 的 `client.js` 注册:审批、通知各一页,utils-agents 一页三块),右侧栏只有一个 utils-agents 面板。组件启用/停用、运行状态照常显示。
|
|
523
|
+
|
|
524
|
+
`@xi4z/dsh-utils-ui` 的 `client.js` 用 `ctx.configForms.whileServed(['dsh-approval-policy','dsh-notify','utils-agents'], …)` 把三个宿主的配置页注册到 `plugins.row.config`(key = `@xi4z/dsh-utils#<挂载项 id>`,因为插入这些行的是 bundle 包),并注册 `sidebar.right.pane.tab` 的 utils-agents 面板。三个宿主的配置字段全 volatile,写入走宿主 settings 文档,保存即生效;utils-agents 的仓库设置存在各预设的 `.dsh-utils/repo.json`,Deploy Key 存在 storages,Markdown 直接落盘。
|
|
525
|
+
|
|
526
|
+
## 组件五(`utils-ui`):共享浏览器界面
|
|
527
|
+
|
|
528
|
+
宿主半侧只有一个空 `apply()`,价值全在 `client.js`:
|
|
529
|
+
|
|
530
|
+
- 三个宿主行的配置页:`plugins.row.config`,key 是 `@xi4z/dsh-utils#<挂载项 id>`;utils-agents 一页含「递归技能发现 / 模型可见性 / 预设与技能仓库」三块,审批与通知各一页。字段表在 `client.js` 顶部。
|
|
531
|
+
- 右侧栏 `utils-agents` 标签页:注册 tab 类型与 `sidebar.right.pane.tab` 面板体;面板里的路由由 `utils-agents` 宿主行提供。
|
|
532
|
+
- 两套 Deploy Key 的保存/清除、技能仓库配置、版本检查与自动安装都在这个面板里,宿主路由全部在 `@xi4z/dsh-utils-utils-agents`。
|
|
369
533
|
|
|
370
|
-
|
|
534
|
+
停用 `utils-ui` 只影响界面;宿主行继续工作。
|
|
371
535
|
|
|
372
536
|
## 包结构
|
|
373
537
|
|
|
374
538
|
```
|
|
375
|
-
@xi4z/dsh-utils/
|
|
376
|
-
├── package.json
|
|
377
|
-
├── pnpm-workspace.yaml
|
|
378
|
-
├── cordis.patch.yml
|
|
379
|
-
├── locale/{en,zh}.json
|
|
539
|
+
@xi4z/dsh-utils/ 只做拼装的 bundle:patch + locale + icon,无组件代码
|
|
540
|
+
├── package.json dsh.bundle.patch;dependencies = 四个同版本组件
|
|
541
|
+
├── pnpm-workspace.yaml 把 packages/* 串成一个 workspace,本地链接同版本组件
|
|
542
|
+
├── cordis.patch.yml 四行:按裸包名挂四个组件
|
|
543
|
+
├── locale/{en,zh}.json bundle 展示名
|
|
380
544
|
├── icon.svg
|
|
381
|
-
├──
|
|
382
|
-
├──
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
│
|
|
389
|
-
|
|
390
|
-
├── approval-policy/ @xi4z/dsh-utils-approval-policy
|
|
391
|
-
├── notify/ @xi4z/dsh-utils-notify
|
|
392
|
-
├── skill-panel/ @xi4z/dsh-utils-skill-panel
|
|
393
|
-
└── ui/ @xi4z/dsh-utils-ui(client.js + no-op host)
|
|
545
|
+
├── src/index.ts export {}(构建成 lib/index.js,仅有 main 入口)
|
|
546
|
+
├── scripts/release.mjs 按依赖顺序发五个包,已发布版本跳过
|
|
547
|
+
├── test/layout.test.mjs 布局守卫
|
|
548
|
+
└── packages/ 四个独立发布包
|
|
549
|
+
├── approval-policy/ @xi4z/dsh-utils-approval-policy
|
|
550
|
+
├── notify/ @xi4z/dsh-utils-notify
|
|
551
|
+
├── utils-agents/ @xi4z/dsh-utils-utils-agents 行 utils-agents
|
|
552
|
+
│ (嵌套发现 + 可见性 + 预设/仓库/AGENTS.md)
|
|
553
|
+
└── ui/ @xi4z/dsh-utils-ui 行 utils-ui + client.js
|
|
394
554
|
```
|
|
395
555
|
|
|
396
|
-
|
|
556
|
+
`packages/<名>/` 是标准插件包(`src/index.ts` + `locale/` + 自己的 `package.json`),各自 `publishConfig.access = public`、共享根包版本、由 `pnpm release` 单独发布。加组件=新建 `packages/<名>/`,在根 `package.json` 加一条依赖、在 `cordis.patch.yml` 加一行、在 `test/layout.test.mjs` 的 `COMPONENTS` 里登记;只带浏览器半侧的组件还要声明 `dsh.client` 并导出 `./client`。
|
|
397
557
|
|
|
398
558
|
## 开发
|
|
399
559
|
|
|
400
560
|
```sh
|
|
401
561
|
pnpm install
|
|
402
|
-
pnpm build #
|
|
403
|
-
pnpm test # 构建 + client.js 语法检查 +
|
|
562
|
+
pnpm build # 根包空入口 + packages/* 四个组件
|
|
563
|
+
pnpm test # 构建 + client.js 语法检查 + 布局守卫 + 五个包的 node --test
|
|
404
564
|
```
|
|
405
565
|
|
|
406
566
|
## 兼容性
|
|
407
567
|
|
|
408
|
-
DeepSeek Harness `0.2.2-rc.1` 及以上。Node.js 22.19
|
|
568
|
+
DeepSeek Harness `0.2.2-rc.1` 及以上。Node.js 22.19 及以上。宿主组件运行时依赖 `@deepseek-ai/schemastery`;`@xi4z/dsh-utils-ui` 的 `client.js` 只依赖宿主提供的 React 运行时。utils-agents 面板需要宿主带右侧栏(web 组合默认带)。
|
|
409
569
|
|
|
410
570
|
## License
|
|
411
571
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
# dsh-utils —
|
|
1
|
+
# dsh-utils — bundle layer for the utility components.
|
|
2
2
|
#
|
|
3
|
-
# This package
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# live in packages/ (published or linked separately), and their package names
|
|
7
|
-
# resolve from the profile's node_modules.
|
|
3
|
+
# This package mounts no component of its own: it is the same shape as the
|
|
4
|
+
# shipped experimental bundles. Every component is an independently published
|
|
5
|
+
# package (a real dependency of this bundle), and this patch assembles them:
|
|
8
6
|
#
|
|
9
|
-
# skill-recursive — recursive SKILL.md discovery in nested skill folders,
|
|
10
|
-
# plus the skill-repository sync host (panel routes,
|
|
11
|
-
# deploy key, pull-only Git sync).
|
|
12
7
|
# dsh-approval-policy — unattended approval gate: subagent/scheduled/cron
|
|
13
8
|
# approval requests wait a bounded window, then settle
|
|
14
9
|
# with a fail-closed default instead of hanging forever.
|
|
15
10
|
# dsh-notify — session notifications: a turn ending, a pending
|
|
16
11
|
# approval, or a pending question is pushed through a
|
|
17
12
|
# Gotify gateway, tagged with this device's name.
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
13
|
+
# utils-agents — the one host component for skills and presets. It
|
|
14
|
+
# registers each ~/.dsh/.agent-presets/<id>/ directory
|
|
15
|
+
# as a real agent preset through cordis:include, serves
|
|
16
|
+
# routes that list/toggle its skills, edit its
|
|
17
|
+
# Markdown, and clone/fast-forward a Git repository
|
|
18
|
+
# (public or private, via a Deploy Key) into it — and
|
|
19
|
+
# it also owns recursive nested SKILL.md discovery plus
|
|
20
|
+
# the model-facing skill visibility switches, merged
|
|
21
|
+
# from the former utils-main and dsh-skill-panel rows.
|
|
22
|
+
# utils-ui — the browser half shared by every row above: the
|
|
23
|
+
# configuration page for each row and the utils-agents
|
|
24
|
+
# sidebar panel. Its host half is an empty marker; the
|
|
25
|
+
# client module scanner serves its client.js because
|
|
26
|
+
# this row mounts the bare package name.
|
|
22
27
|
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
28
|
+
# Row ids double as settings namespaces and stay stable. The plugin page keeps
|
|
29
|
+
# addressing each row's configuration as `@xi4z/dsh-utils#<row id>`, because
|
|
30
|
+
# this bundle is the package that inserted the row.
|
|
26
31
|
|
|
27
32
|
- insert:
|
|
28
|
-
- id: skill-recursive
|
|
29
|
-
name: '@xi4z/dsh-utils-skill-recursive'
|
|
30
|
-
config: {}
|
|
31
33
|
- id: dsh-approval-policy
|
|
32
34
|
name: '@xi4z/dsh-utils-approval-policy'
|
|
33
35
|
config: {}
|
|
@@ -52,12 +54,47 @@
|
|
|
52
54
|
- aborted
|
|
53
55
|
notifyOnApproval: true
|
|
54
56
|
notifyOnQuestion: true
|
|
55
|
-
- id:
|
|
56
|
-
name: '@xi4z/dsh-utils-
|
|
57
|
+
- id: utils-agents
|
|
58
|
+
name: '@xi4z/dsh-utils-utils-agents'
|
|
57
59
|
config:
|
|
58
|
-
#
|
|
60
|
+
# 单文件读写上限(字节)。AGENTS.md 本质上也是提示词,别放太大。
|
|
61
|
+
maxBytes: 524288
|
|
62
|
+
# 额外的预设根目录;每个子目录是一个预设。
|
|
63
|
+
presetDirs: []
|
|
64
|
+
# 额外的共享预设来源(技能仓库);读取其 .dsh 下的预设,供面板同步。
|
|
65
|
+
presetSourceDirs: []
|
|
66
|
+
# 保留为原生的预设 id;其余原生声明可导入成目录预设并发布到共享仓库。
|
|
67
|
+
builtinPresets:
|
|
68
|
+
- standard
|
|
69
|
+
- ptc
|
|
70
|
+
- minimal
|
|
71
|
+
- creator
|
|
72
|
+
# 全局 / 项目 AGENTS.md 视图的额外文件与递归扫描。
|
|
73
|
+
extraAgentsFiles: []
|
|
74
|
+
scanNestedAgents: false
|
|
75
|
+
nestedDepth: 3
|
|
76
|
+
# 新预设技能仓库的默认值。
|
|
77
|
+
defaultRepoUrl: 'https://github.com/xi4z/skills'
|
|
78
|
+
defaultBranch: 'Agent'
|
|
79
|
+
# 嵌套 SKILL.md 递归发现(原 utils-main 行)。
|
|
80
|
+
minDepth: 2
|
|
81
|
+
maxDepth: 8
|
|
82
|
+
watch: true
|
|
83
|
+
includeProjectRoots: true
|
|
84
|
+
includeUserRoots: true
|
|
85
|
+
extraRoots: []
|
|
86
|
+
ignoreDirs:
|
|
87
|
+
- .system
|
|
88
|
+
- node_modules
|
|
89
|
+
- .git
|
|
90
|
+
# 模型技能目录里隐藏的技能名(原 dsh-skill-panel 行);仍可手动加载。
|
|
59
91
|
disabledSkills: []
|
|
60
|
-
|
|
61
|
-
|
|
92
|
+
# 面板顶部的版本检查:定时查询 npm 上 @xi4z/dsh-utils 的 latest。
|
|
93
|
+
# 手动「检查更新」按钮不受间隔限制;改镜像时把 updateRegistry 换掉。
|
|
94
|
+
updateCheck: true
|
|
95
|
+
updateCheckIntervalHours: 6
|
|
96
|
+
updateRegistry: 'https://registry.npmjs.org'
|
|
97
|
+
# 查到新版本就后台 pnpm add;装完要重启 dsh web。link:/file: 安装自动跳过。
|
|
98
|
+
updateAutoInstall: true
|
|
99
|
+
- id: utils-ui
|
|
62
100
|
name: '@xi4z/dsh-utils-ui'
|
|
63
|
-
config: {}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `dsh-utils` bundle
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* `dsh-utils` bundle layer: a patch-only package.
|
|
3
|
+
*
|
|
4
|
+
* The bundle itself mounts no component. `cordis.patch.yml` assembles the six
|
|
5
|
+
* independently published component packages, so this module stays empty: the
|
|
6
|
+
* build produces it so the package still exposes a valid `main`, exactly like
|
|
7
|
+
* the shipped experimental bundles.
|
|
6
8
|
*
|
|
7
9
|
* @module dsh-utils
|
|
8
10
|
*/
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `dsh-utils` bundle
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* `dsh-utils` bundle layer: a patch-only package.
|
|
3
|
+
*
|
|
4
|
+
* The bundle itself mounts no component. `cordis.patch.yml` assembles the six
|
|
5
|
+
* independently published component packages, so this module stays empty: the
|
|
6
|
+
* build produces it so the package still exposes a valid `main`, exactly like
|
|
7
|
+
* the shipped experimental bundles.
|
|
6
8
|
*
|
|
7
9
|
* @module dsh-utils
|
|
8
10
|
*/
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAA"}
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Harness Utilities",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "A patch-only bundle: utils-agents (nested SKILL.md discovery, model-facing skill visibility, presets / skill repositories / AGENTS.md), an unattended approval gate, session notifications, and one shared browser UI for every row. Each component is published as its own package; the root only carries the patch, locales and icon."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Harness 工具集",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "一个只做拼装的 bundle:utils-agents(嵌套 SKILL.md 发现、模型可见性、预设/技能仓库/AGENTS.md 面板)、无人值守审批门控、会话通知,以及统一承载全部配置页与侧边栏的浏览器界面。每个组件都是独立发布的包,根包只提供 patch、locale 与图标。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xi4z/dsh-utils",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DeepSeek Harness utility bundle: four independently
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "DeepSeek Harness utility bundle: a patch-only package that assembles four independently published components — the utils-agents preset/skill panel (nested SKILL.md discovery, model visibilities, skills, repositories and AGENTS.md), an unattended approval gate, session notifications, and the shared browser UI that configures every row.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
|
-
"dsh-plugin",
|
|
8
7
|
"dsh-bundle",
|
|
8
|
+
"dsh-plugin",
|
|
9
9
|
"deepseek-harness",
|
|
10
10
|
"skills",
|
|
11
11
|
"skill-panel",
|
|
12
|
+
"markdown",
|
|
13
|
+
"agents-md",
|
|
14
|
+
"utils-agents",
|
|
12
15
|
"skill-discovery",
|
|
13
16
|
"approval",
|
|
14
17
|
"unattended",
|
|
@@ -39,13 +42,14 @@
|
|
|
39
42
|
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
40
43
|
"./locale/*.json": "./locale/*.json",
|
|
41
44
|
"./icon": "./icon.svg",
|
|
45
|
+
"./src/*": "./src/*",
|
|
42
46
|
"./package.json": "./package.json"
|
|
43
47
|
},
|
|
44
48
|
"files": [
|
|
45
49
|
"lib",
|
|
50
|
+
"src",
|
|
46
51
|
"cordis.patch.yml",
|
|
47
52
|
"locale",
|
|
48
|
-
"skills",
|
|
49
53
|
"icon.svg",
|
|
50
54
|
"README.md",
|
|
51
55
|
"LICENSE"
|
|
@@ -54,13 +58,16 @@
|
|
|
54
58
|
"node": ">=22.19.0"
|
|
55
59
|
},
|
|
56
60
|
"dependencies": {
|
|
57
|
-
"@xi4z/dsh-utils-approval-policy": "
|
|
58
|
-
"@xi4z/dsh-utils-notify": "
|
|
59
|
-
"@xi4z/dsh-utils-
|
|
60
|
-
"@xi4z/dsh-utils-
|
|
61
|
-
|
|
61
|
+
"@xi4z/dsh-utils-approval-policy": "0.7.0",
|
|
62
|
+
"@xi4z/dsh-utils-notify": "0.7.0",
|
|
63
|
+
"@xi4z/dsh-utils-ui": "0.7.0",
|
|
64
|
+
"@xi4z/dsh-utils-utils-agents": "0.7.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"@deepseek-ai/cordis": "~4.1.0"
|
|
62
68
|
},
|
|
63
69
|
"devDependencies": {
|
|
70
|
+
"@deepseek-ai/cordis": "4.1.0",
|
|
64
71
|
"@types/node": "^24.0.0",
|
|
65
72
|
"typescript": "~5.9.0"
|
|
66
73
|
},
|
|
@@ -79,7 +86,6 @@
|
|
|
79
86
|
"build": "tsc -p tsconfig.json && pnpm -r --filter \"./packages/*\" run build",
|
|
80
87
|
"check": "tsc --noEmit -p tsconfig.json && pnpm -r --filter \"./packages/*\" run check",
|
|
81
88
|
"test": "pnpm build && node --check packages/ui/client.js && node --test test/*.test.mjs && pnpm -r --filter \"./packages/*\" run test",
|
|
82
|
-
"
|
|
83
|
-
"publish:bundle": "pnpm publish --access public --no-git-checks"
|
|
89
|
+
"release": "node scripts/release.mjs"
|
|
84
90
|
}
|
|
85
91
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dsh-utils` bundle layer: a patch-only package.
|
|
3
|
+
*
|
|
4
|
+
* The bundle itself mounts no component. `cordis.patch.yml` assembles the six
|
|
5
|
+
* independently published component packages, so this module stays empty: the
|
|
6
|
+
* build produces it so the package still exposes a valid `main`, exactly like
|
|
7
|
+
* the shipped experimental bundles.
|
|
8
|
+
*
|
|
9
|
+
* @module dsh-utils
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export {}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dsh-approval-policy-config
|
|
3
|
-
description: "dsh-utils bundle 里无人值守审批门控组件(挂载项 dsh-approval-policy)的使用与配置指南。审批挂起、approval 挂死、无人值守、超时拒绝、subagent 审批、定时任务审批、审批门控、默认自动审批、自动审批内容回传等场景,或要配置这个门控时先读本指南:六个键(origins/sessions/windowSeconds/defaultOutcome/defaultPermissionPreset/autoReviewContent)的默认值、cordis.patch.yml 挂载块 config: 段示例、ask_user_question 配置向导、行为边界速查。触发词:approval-policy、windowSeconds、defaultPermissionPreset、autoReviewContent、审批门控。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 无人值守审批门控使用指南(dsh-utils / dsh-approval-policy)
|
|
7
|
-
|
|
8
|
-
> dsh-utils bundle 的 approval-policy 组件:挂在宿主 `'approval/request'` waterfall 链首
|
|
9
|
-
> (prepend 注册)的竞速门控器。声明为无人值守的请求先 `next()` 交给下游交互面,
|
|
10
|
-
> **窗口内有人答就用人的答案**,窗口耗尽按 fail-closed 默认裁决落定,
|
|
11
|
-
> **turn 立即结束不再挂起**;交互会话默认不变。
|
|
12
|
-
>
|
|
13
|
-
> 这版另有两项配合实验性自动审批(`@deepseek-ai/dsh-experimental-auto-review` 的 `auto` 档)
|
|
14
|
-
> 的能力:`defaultPermissionPreset: auto` 让**新会话默认走自动审批**;
|
|
15
|
-
> `autoReviewContent: true` 让**窗口超时拒绝时把复核内容附进模型读到的工具结果**。
|
|
16
|
-
|
|
17
|
-
## 配置入口
|
|
18
|
-
|
|
19
|
-
持久化在 `cordis.patch.yml` 里审批门控挂载块(id = `dsh-approval-policy`,name =
|
|
20
|
-
`dsh-utils/approval-policy`)的 `config:` 段;entry id 同时就是 settings 命名空间。
|
|
21
|
-
六个键**全部 volatile**,也可以直接在 dsh 设置页热改;改 `cordis.patch.yml` 则需重启 dsh 生效。
|
|
22
|
-
bundle 方式(装好 `dsh-utils`)自动挂载,无需手写挂载块。
|
|
23
|
-
|
|
24
|
-
同一个 bundle 里的另一个组件是递归技能发现(id = `skill-recursive`),两者互不依赖,
|
|
25
|
-
可以单独禁用其中一个挂载项。
|
|
26
|
-
|
|
27
|
-
## 配置键
|
|
28
|
-
|
|
29
|
-
| 键 | 类型 | 默认 | 说明 |
|
|
30
|
-
|---|---|---|---|
|
|
31
|
-
| `origins` | `(subagent\|scheduled\|cron\|all)[]` | `[subagent, scheduled]` | 判定为无人值守的来源;`all` 是 opt-in 的全门控 |
|
|
32
|
-
| `sessions` | `string[]`(glob) | `[]` | 按 agent id glob 点名会话,命中即门控该会话**所有** turn(与 `origins` 取并集) |
|
|
33
|
-
| `windowSeconds` | `number` 0..86400 | `60` | 应答窗口(秒);`0` = 立即拒绝且**不**问下游 |
|
|
34
|
-
| `defaultOutcome` | `rejected \| unavailable` | `rejected` | 超时落定值;**配置层没有 allowed-once**(fail-closed 红线,schema 枚举就不含) |
|
|
35
|
-
| `defaultPermissionPreset` | `string` | `''` | 新会话写入的权限档;`''` = 不动宿主默认档,`auto` = 默认实验性自动审批(需自动审批 bundle),也可写其它已配置档名 |
|
|
36
|
-
| `autoReviewContent` | `boolean` | `true` | 窗口拒绝的是自动审批发起的请求时,把复核内容附进模型读到的工具结果 |
|
|
37
|
-
|
|
38
|
-
判定粒度:`sessions` 命中与 `all` 是会话级/全局;`subagent` 看 `session.header.origin ===
|
|
39
|
-
'subagent'`(会话级);`scheduled` / `cron` 看会话**最后一条溯源** user 消息的 `source.kind`
|
|
40
|
-
(`schedule` / `cron`,turn 级;`runtime-context` / `skill-catalog` 等合成注入会被跳过,
|
|
41
|
-
不污染判定)——人插过话就不门控("有没有人在看"语义;dsh 0.2.0 timed ask 的迟到回答
|
|
42
|
-
`user-question-reply` 同理算人在场)。
|
|
43
|
-
`cron` 需要 dsh-cron 自带 `source.kind: 'cron'` 的补丁版。
|
|
44
|
-
|
|
45
|
-
挂载块形状(`~/.dsh/cordis.patch.yml` 或某个 profile 的 cordis.patch.yml):
|
|
46
|
-
|
|
47
|
-
```yaml
|
|
48
|
-
- id: dsh-approval-policy
|
|
49
|
-
name: dsh-utils/approval-policy
|
|
50
|
-
config:
|
|
51
|
-
origins: [subagent, scheduled, cron] # cron 需 dsh-cron 的 source kind 补丁版
|
|
52
|
-
windowSeconds: 300
|
|
53
|
-
defaultOutcome: rejected
|
|
54
|
-
defaultPermissionPreset: auto # 新会话默认走实验性自动审批
|
|
55
|
-
autoReviewContent: true # 超时拒绝时把复核内容交给模型
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## 交互式配置向导(ask_user_question)
|
|
59
|
-
|
|
60
|
-
用户抱怨审批挂起时,不要甩配置表让对方自己读——先用 `ask_user_question` 问清期望,
|
|
61
|
-
再映射到键:
|
|
62
|
-
|
|
63
|
-
1. **要门控哪些来源** → `origins`:`subagent`(子代理会话专有)/`scheduled`(定时任务)/
|
|
64
|
-
`cron`(cron 任务)/`all`(全部审批都门控)。多选;先问清是不是只想治某一类。
|
|
65
|
-
2. **有没有要整会话点名的** → `sessions`:有的话问 agent id 或前缀,按 glob 写(如 `ops-*`);
|
|
66
|
-
命中即门控该会话**所有** turn,与 `origins` 取并集。没有就留空数组。
|
|
67
|
-
3. **窗口多长** → `windowSeconds`:问能接受挂多久(默认 60 秒);要"绝不等待、立刻拒"
|
|
68
|
-
填 `0`(立即拒绝且**不**问下游);想要"人还在就还能答"就给个几十秒到几分钟的数。
|
|
69
|
-
4. **超时落什么** → `defaultOutcome`:`rejected`(默认,拒)或 `unavailable`(下游不可用)。
|
|
70
|
-
**必须强调:没有 `allowed-once`(本次放行)这一档**——无人值守的默认裁决必须 fail-closed,
|
|
71
|
-
超时就是拒;想放行就让窗口内真的有人答。
|
|
72
|
-
5. **要不要新会话默认走自动审批** → `defaultPermissionPreset`:要就填 `auto`(前提:
|
|
73
|
-
profile 里装了 `@deepseek-ai/dsh-experimental-auto-review` bundle,否则 `agent/created`
|
|
74
|
-
直接报错点名缺哪个 bundle);只想修「挂起」不想改默认档就留 `''`。也可以填其它已配置
|
|
75
|
-
档名(如 `workspace-write`)。注意 `auto` 档是 `danger-full-access` + `ask` 的组合,
|
|
76
|
-
先确认用户接受这个力度。
|
|
77
|
-
6. **超时拒绝要不要把复核内容交给模型** → `autoReviewContent`:默认 `true`,即窗口拒绝的
|
|
78
|
-
请求若来自自动审批,模型会读到复核原文;不想回传就关掉。
|
|
79
|
-
7. **落盘** → 把结果写进 `cordis.patch.yml` 挂载块的 `config:` 段(只写用户实际确认过的键,
|
|
80
|
-
其余留默认),并提醒**重启 dsh 生效**(设置页热改则即时生效)。
|
|
81
|
-
|
|
82
|
-
## 行为边界速查
|
|
83
|
-
|
|
84
|
-
- **交互会话不门控**:未命中 `sessions` 名单、也未命中任何 origin 的 turn 立即 `next()` 透传,
|
|
85
|
-
交互默认一字不变。
|
|
86
|
-
- **宿主 policy 优先**:会话级 `approval/policy`(ask|never)短路在 waterfall 之前,
|
|
87
|
-
`never` 直接 auto-reject,与本组件零冲突;本组件是"先试 N 秒再拒"的时间窗形态。
|
|
88
|
-
- **审计宿主落**:`approval/asked` + `approval/decided` 由宿主写进会话日志,本组件不写日志,
|
|
89
|
-
超时拒绝同样在 transcript 里可追溯。
|
|
90
|
-
- **窗口内下游答了就用下游的答案**;空链瞬间 fail-closed `'unavailable'` 原样透传。
|
|
91
|
-
- **turn 中止**由宿主信号竞速收 `'cancelled'`,迟到的窗口到期被忽略。
|
|
92
|
-
- **新会话固定档只在新会话上生效**:恢复的、被 seed 的、用户手动切过档的会话保持原档。
|
|
93
|
-
- **复核内容只在「窗口拒绝」时附加**:窗口内被人或其它 answerer 拒的请求不会附加;记录按
|
|
94
|
-
`callId` 单次消费、120 秒过期。
|
|
95
|
-
- **零落盘状态**:组件不写数据文件,也不写会话日志;复核内容走的是宿主已经落定的工具结果
|
|
96
|
-
内容,审计仍由宿主的 `approval/asked` + `approval/decided` 负责。
|