dsh-subagent-library 0.2.7 → 0.3.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 +68 -0
- package/MIGRATION.md +152 -0
- package/README.en.md +51 -19
- package/README.md +49 -19
- package/lib/client.js +547 -302
- package/lib/index.js +591 -123
- package/package.json +7 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# 更新日志 / Changelog
|
|
2
|
+
|
|
3
|
+
本文件记录 dsh-subagent-library 的面向用户的重要变化。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
|
|
5
|
+
This file documents user-facing changes. Format loosely follows [Keep a Changelog]; versions follow [SemVer].
|
|
6
|
+
|
|
7
|
+
## [0.3.0] — 2026-09-24
|
|
8
|
+
|
|
9
|
+
### 变更 / Changed(重要:存储位置变化)
|
|
10
|
+
|
|
11
|
+
- **名册存储目录化**:具名子代理从 `settings.yaml` 的 `subagent-library.entries` 迁移为 **一个子代理一个 YAML 文件**,默认目录 `~/.dsh/subagents/`(可用 `subagent-library.entriesDir` 自定义,支持 `~` 与相对路径)。
|
|
12
|
+
- **The roster now lives as one YAML file per named subagent** (default `~/.dsh/subagents/`), replacing the inline `entries` map in settings.yaml.
|
|
13
|
+
- **旧条目自动迁移**:升级后首次使用名册时,settings 里的旧 `entries` 会被**逐条**导出为 `<id>.yaml`(已存在同名文件绝不覆盖;重复重启幂等)。settings 中的旧副本**保留**作回滚兜底,文件优先生效;0.3.x 内旧配置仍可读,**0.4 起停止读取**。
|
|
14
|
+
- On first use the legacy `entries` are exported entry-by-entry (never overwriting hand-written files); the legacy copies are kept as a rollback fallback and win nothing — files take precedence. Legacy reading is removed in 0.4.
|
|
15
|
+
- **一键清除旧条目**:设置页「子代理库」卡片新增迁移横幅与「清除旧条目」按钮(只清除已被文件覆盖的旧副本,不碰名册文件);也可手动删除 settings 中的旧 `entries` 段。详见 [MIGRATION.md](./MIGRATION.md)。
|
|
16
|
+
- The settings page gains a migration banner with a one-click "clear legacy copies" action. See [MIGRATION.md](./MIGRATION.md).
|
|
17
|
+
- 设置页 UI 重排:对齐个性化指令编辑器的视觉风格(主题中性 rgba 配色、8px 圆角卡片、蓝色主操作/红色危险按钮、tinted 横幅、chip 徽标),整卡加宽至 860px;**角色提示词编辑区按内容自适应高度**(110–440px 夹紧,短文本紧凑、长文本展开),描述/persona 等正文字段换回界面字体并加大字号,长文本可读性优先;描述字段为单行 textarea 可拖展;后台模式挪至思考强度行,固定宽度控件不再被挤压。
|
|
18
|
+
- Settings-page restyle: aligned with the personal-instruction editor (theme-neutral rgba palette, 8px rounded cards, blue primary / red danger buttons, tinted banners, chip badges), card widened to 860px; the persona textarea auto-sizes to its content (clamped 110-440px); description/persona body text is back to the UI face at a larger size; the description field is a one-line textarea you can drag taller; background mode moved next to reasoning effort so fixed-width controls stop getting squeezed.
|
|
19
|
+
|
|
20
|
+
### 新增 / Added
|
|
21
|
+
|
|
22
|
+
- **`reasoningEffort` 条目字段**:为单个具名子代理指定思考强度(adapter 自有值,如 `max` / `high` / `medium` / `low`;留空随父会话默认)。走官方 `agentOptions.reasoningEffort` 覆盖通道;子代理换了模型路由时,官方会自动丢弃继承来的思考强度,因此未显式设置不会跨模型泄漏。
|
|
23
|
+
- New per-entry `reasoningEffort` field (adapter-owned id, e.g. `max`), passed through the official `agentOptions.reasoningEffort` override; inherited efforts are auto-dropped by the harness when the child's route differs.
|
|
24
|
+
- **`enabled` 条目字段**:文件内写 `enabled: false` 停用条目——目录与设置页仍可见,`delegate` 明确拒绝;设置页提供启用开关。
|
|
25
|
+
- New `enabled` flag to disable an entry without deleting its file.
|
|
26
|
+
- **坏文件不炸名册**:解析/校验失败、`.yaml`/`.yml` 同 id 冲突、大写文件名等一律跳过并以 diagnostics 呈现在 `list_subagents`、`/subagent` 与设置页。
|
|
27
|
+
- Broken roster files are skipped and surfaced as diagnostics instead of breaking the roster.
|
|
28
|
+
- 设置页:迁移横幅、legacy 徽标、diagnostics 面板;409 冲突保留未保存草稿,仅切换到最新基线(响应带回新视图),再次保存即为覆盖。
|
|
29
|
+
- Settings page: migration banner, legacy badge, diagnostics panel; a 409 conflict keeps your unsaved draft and only switches to the latest baseline (the response carries the fresh view) — saving again overwrites.
|
|
30
|
+
- 名册目录新增 **`_backups/` 备份约定**:插件不做自动备份,按惯例 agent/人在改条目前把原文件复制进 `_backups/`;`_` 前缀的文件/目录(`_backups/`、`_draft.yaml`…)一律视为非名册内容,**静默忽略**(不再产生诊断噪音)。
|
|
31
|
+
- Roster-directory `_backups/` convention: the plugin never auto-backs up — by convention, agents (or humans) copy the original file into `_backups/` before editing; anything `_`-prefixed (files or directories) is treated as non-roster content and silently ignored (no more diagnostic noise).
|
|
32
|
+
|
|
33
|
+
### 修复 / Fixed
|
|
34
|
+
|
|
35
|
+
- **`.yml` 名册生命周期修复**:名册同时读取 `.yaml`/`.yml`;设置页保存有变化的条目统一收敛为 `<id>.yaml` 并移除同 id 的 `.yml`,删除条目同时清理两个后缀,避免删除 `.yaml` 后旧 `.yml` 复活。
|
|
36
|
+
- **`.yml` roster lifecycle fixed**: the roster reads both `.yaml` and `.yml`; saving changed content through the settings page converges to `<id>.yaml` and removes the same-id `.yml`; deleting an entry removes both suffixes, preventing an old `.yml` from resurrecting after `.yaml` is deleted.
|
|
37
|
+
- **修复设置页保存/删除的 HTTP 重复响应**:补齐分支返回,确保 delete/save 每次只发送一次 HTTP 响应,避免真实服务触发 `ERR_HTTP_HEADERS_SENT`。
|
|
38
|
+
- **Duplicate HTTP responses fixed**: delete/save handlers now return after sending their response, so each request is answered exactly once and the real server avoids `ERR_HTTP_HEADERS_SENT`.
|
|
39
|
+
- **双审加固(K3 实现复审 + GLM 红队)**:设置页保存**跳过内容未变的条目**——不再把未触碰的手写 YAML 文件重写为生成格式(手写注释得以保留);名册文件损坏且存在同名 legacy 副本时,升级为 **error 级诊断**并明确提示「delegate 使用的是旧配置」(不再静默回退);409 冲突**保留用户未保存的草稿**(只切换到最新基线,再次保存才会覆盖);迁移失败(整体或单条)**自动重试**而非进程内永久搁浅;`reasoningEffort` 保存时校验为 effort id 形态(字母数字与 `._-`);设置页只读时「清除旧条目」响亮 403 而非假成功;客户端补齐 wire 契约测试(parseView 此前丢失 legacyCount 导致迁移横幅不渲染的 bug 即在此层)。
|
|
40
|
+
- Dual-review hardening (K3 implementation review + GLM red team): settings-page saves **skip unchanged entries** (untouched hand-written YAML files are no longer rewritten into generated format, preserving comments); a broken roster file with a same-id legacy copy now surfaces an **error-level** diagnostic saying delegation is using the old config (no more silent fallback); a 409 conflict **keeps the unsaved draft** (only the baseline switches — saving again overwrites); failed migration (whole-batch or per-entry) **retries automatically** instead of latching for the process lifetime; `reasoningEffort` is validated as an effort id on save (alphanumerics and `._-`); the read-only settings page refuses "clear legacy" loudly with 403 instead of faking success; client wire-contract tests added (parseView previously dropped legacyCount, which was exactly where the migration banner failed to render).
|
|
41
|
+
|
|
42
|
+
### 内部 / Internal
|
|
43
|
+
|
|
44
|
+
- 每次操作实时读目录(无缓存、无 watcher);单条目写入原子化(临时文件 + rename 带重试);id 规则加长度 ≤64 与 Windows 保留设备名黑名单;BOM 兼容;未知字段大声拒绝。
|
|
45
|
+
- Fresh directory reads per operation; atomic per-file writes with rename retries; id length cap + Windows reserved-name blacklist; BOM tolerance; loud unknown-field rejection.
|
|
46
|
+
|
|
47
|
+
## [0.2.8] — 2026-09-09
|
|
48
|
+
|
|
49
|
+
- 设置页导航图标装饰(decorateSettingsNavIcon)。
|
|
50
|
+
|
|
51
|
+
## [0.2.7] — 2026-09-09
|
|
52
|
+
|
|
53
|
+
- 修复:`toolFilter` 改为按**调用方会话的可限制集合**解析(此前按可见性,`subagent` 等 scope-local 工具会让委派整单失败);忽略的名字带原因标注;`allow` 全不可应用时拒绝委派;`list_subagents` 目录同步展示生效后的过滤摘要。
|
|
54
|
+
|
|
55
|
+
## [0.2.6] — 2026-09-06
|
|
56
|
+
|
|
57
|
+
- DSH 0.1.2-rc.1 兼容性验证与声明(devDependencies 仍锁 rc.6)。
|
|
58
|
+
|
|
59
|
+
## [0.2.5] — 2026-09-05
|
|
60
|
+
|
|
61
|
+
- 修复设置页保存 400(移除保存期工具名预检,委派期 `tools.restrict` 为准);新条目卡补齐缺失字段。
|
|
62
|
+
|
|
63
|
+
[Unreleased]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.3.0...HEAD
|
|
64
|
+
[0.3.0]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.8...v0.3.0
|
|
65
|
+
[0.2.8]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.7...v0.2.8
|
|
66
|
+
[0.2.7]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.6...v0.2.7
|
|
67
|
+
[0.2.6]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.5...v0.2.6
|
|
68
|
+
[0.2.5]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.4...v0.2.5
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# 迁移指南:0.2.x → 0.3.x(名册目录化)
|
|
2
|
+
|
|
3
|
+
**中文指南(English guide below)**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## TL;DR(三步走)
|
|
8
|
+
|
|
9
|
+
1. **升级插件并重启 dsh web** —— 什么都不用改,你的旧配置会自动迁移;
|
|
10
|
+
2. **验证**:`/subagent` 或设置页能看到全部旧条目,且名册目录里多了一批 `<id>.yaml`;
|
|
11
|
+
3. **清理**(可选但推荐):设置页点「清除旧条目」,或手动删掉 settings.yaml 里的旧 `entries` 段。
|
|
12
|
+
|
|
13
|
+
旧配置在 0.3.x 全程兜底可读,不清除也不影响使用;**0.4 起才停止读取**。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 0.3 变了什么
|
|
18
|
+
|
|
19
|
+
0.2.x 把所有具名子代理塞在 `~/.dsh/settings.yaml` 的 `subagent-library.entries` 下面——一个文件里混着插件配置和一大坨角色定义,长、难注释、难版本管理。
|
|
20
|
+
|
|
21
|
+
0.3 起,**一个具名子代理一个 YAML 文件**:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
~/.dsh/subagents/ ← 默认名册目录(可用 entriesDir 改)
|
|
25
|
+
k3-reviewer.yaml ← id = 文件名
|
|
26
|
+
glm-reader.yaml
|
|
27
|
+
...
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
# k3-reviewer.yaml 示例(字段与旧 entries 内完全一致,注释随便写)
|
|
32
|
+
description: 独立只读审核,支持图片视觉走查
|
|
33
|
+
provider: kimi-coding
|
|
34
|
+
model: k3-256k
|
|
35
|
+
persona: |
|
|
36
|
+
你是独立审核 agent……
|
|
37
|
+
toolFilter:
|
|
38
|
+
deny: [write, edit]
|
|
39
|
+
maxDepth: 1
|
|
40
|
+
backgroundMode: continuable
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`settings.yaml` 里只保留插件级配置:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
subagent-library:
|
|
47
|
+
# 可选:自定义名册目录(默认 ~/.dsh/subagents,支持 ~ 与相对路径)
|
|
48
|
+
# entriesDir: ~/.dsh/subagents
|
|
49
|
+
# entries: ← 0.2.x 的旧段,0.3.x 只读兜底,确认迁移成功后可删
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
文件**热生效**:改完保存即可,无需重启。设置页与手编文件的数据**双向等价**,但要注意:通过设置页保存某个条目且内容有变化时,**该条目统一写为 `<id>.yaml`,并移除同 id 的 `<id>.yml`**(这个文件里的手写注释与自定义排版会丢失);**本次保存中内容未变化的条目一律跳过写入,原文件和注释原样保留**。想保留注释的手编文件,请直接手编,别在设置页里动它。
|
|
53
|
+
|
|
54
|
+
## 自动迁移是怎么工作的
|
|
55
|
+
|
|
56
|
+
升级到 0.3 并重启后,**首次使用名册时**(打开设置页、调用 `list_subagents`、或第一次 `delegate`)插件会:
|
|
57
|
+
|
|
58
|
+
1. 读取 settings.yaml 里的旧 `entries`;
|
|
59
|
+
2. 对每个条目:**如果名册目录里同名的 `<id>.yaml` 与 `<id>.yml` 均不存在,就导出一个**;
|
|
60
|
+
- 已存在同名任一后缀文件 → **跳过,绝不覆盖**(你手写的文件是安全的);
|
|
61
|
+
- id 非法(大写、超长、Windows 保留名)→ 跳过并在诊断里说明;
|
|
62
|
+
3. **settings 里的旧段在迁移阶段原样保留**——它是你的回滚备份:自动迁移后旧副本仍保留,只有清理才会移除。注意区分两种操作:设置页**删除条目**会清除该 id 的 `.yaml` 与 `.yml` 名册文件,并一并移除其旧副本;点**「清除旧条目」**只移除已被文件覆盖的旧副本,不动任何名册文件。
|
|
63
|
+
|
|
64
|
+
迁移是逐条幂等的:重启多少次都只会导出缺的那几条,重复内容不会翻倍。
|
|
65
|
+
|
|
66
|
+
## 你需要做的
|
|
67
|
+
|
|
68
|
+
### 第 1 步:升级 + 重启
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library@latest
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
然后重启 dsh web、刷新页面。
|
|
75
|
+
|
|
76
|
+
### 第 2 步:验证迁移
|
|
77
|
+
|
|
78
|
+
任选其一:
|
|
79
|
+
|
|
80
|
+
- 命令面板跑 `/subagent`,确认旧条目全部在列;
|
|
81
|
+
- 打开 设置 → 子代理库:条目卡片正常显示即已迁移(若某条带 `legacy` 徽标且名册目录没有对应文件,说明该条还是旧数据在兜底,看下方 FAQ);
|
|
82
|
+
- 看一眼名册目录(默认 `~/.dsh/subagents/`),确认 `<id>.yaml` 都在,随手打开一个核对字段。
|
|
83
|
+
|
|
84
|
+
### 第 3 步:清理旧段(可选,推荐)
|
|
85
|
+
|
|
86
|
+
确认名册工作正常后,把 settings.yaml 里的旧 `entries` 段清掉,两种方式:
|
|
87
|
+
|
|
88
|
+
- **设置页一键清除(推荐)**:子代理库卡片顶部会出现迁移横幅「N 个旧条目已导出为名册文件……」,点「清除旧条目」即可。该操作只删除**已被文件覆盖**的旧副本,名册文件不受影响;
|
|
89
|
+
- **手动删除**:编辑 `~/.dsh/settings.yaml`,删掉 `subagent-library.entries:` 整段(保留 `subagentProvider` / `entriesDir` 等插件级键)。
|
|
90
|
+
|
|
91
|
+
> 不清理会怎样?——什么都不会坏。文件优先生效,旧段只是躺着(设置页会持续显示提示信息)。0.4 起插件停止读取旧段,届时再删也行。
|
|
92
|
+
|
|
93
|
+
## 回滚(想退回 0.2.x)
|
|
94
|
+
|
|
95
|
+
直接安装旧版本即可:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library@0.2.8
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
0.2.x 只读 settings.yaml——只要你不曾删除旧 `entries` 段,回滚后名册原样可用(0.3 之后手编的名册文件它看不见;所以**清理旧段之前请想清楚是否还要回滚**)。旧副本就是回滚的数据源:手动编辑或删除旧副本(含删除条目、一键清除)会让回滚回到删除/编辑当时的旧快照——0.3 期间在名册文件里做的修改不会跟着回去。
|
|
102
|
+
|
|
103
|
+
## FAQ
|
|
104
|
+
|
|
105
|
+
**Q:我手写的 `<id>.yaml` 会被迁移覆盖吗?**
|
|
106
|
+
不会。迁移只导出名册目录里**不存在**的 id;已有文件一律跳过。
|
|
107
|
+
|
|
108
|
+
**Q:文件名有什么要求?**
|
|
109
|
+
`<id>.yaml` 或 `<id>.yml` 都会被读取;id 必须全小写、匹配 `[a-z0-9][a-z0-9-]*`、长度 ≤ 64,且不能是 Windows 保留设备名(`con`、`nul`、`aux`…)。同一 id 的两个后缀并存会报冲突诊断,先修好冲突(只保留一个)再在设置页操作。设置页只在内容确实变化时写入:统一保存为 `<id>.yaml` 并移除同 id 的 `<id>.yml`;内容未变的条目保留原文件及注释。删除条目会清除同 id 的两个后缀。
|
|
110
|
+
|
|
111
|
+
**Q:写入或删除失败时会怎样?**
|
|
112
|
+
这些操作按文件逐个进行,不是目录级多文件事务;失败会报错,且可能已经部分完成。遇到错误先检查名册目录和 diagnostics,再重试。
|
|
113
|
+
|
|
114
|
+
**Q:某个文件写坏了会怎样?**
|
|
115
|
+
只有那一个条目失效:它被跳过,并在 `list_subagents`、`/subagent`、设置页 diagnostics 里给出原因,其余条目照常。改好文件即恢复。**特别注意**:如果同名条目在 settings 里还有旧副本(自动迁移后旧副本仍保留;点「清除旧条目」或删除条目后才移除),插件会用**旧副本兜底继续服务**,并在 diagnostics 里以 error 标明「delegate 使用的是旧配置」——看到这条请先修文件。
|
|
116
|
+
|
|
117
|
+
**Q:怎么临时停用一个子代理(不删文件)?**
|
|
118
|
+
文件里加一行 `enabled: false`(或设置页关掉「启用」开关)。停用的条目仍可见,但 `delegate` 会拒绝并提示。注意:仍以 **legacy 兜底**方式服务的条目(见上一条)不支持停用——先在设置页保存一次让它晋升为文件,再停用。
|
|
119
|
+
|
|
120
|
+
**Q:想给某个子代理单独设置思考强度?**
|
|
121
|
+
0.3 新增 `reasoningEffort` 字段:填适配器自有值(如 `max` / `high` / `medium` / `low`),留空随父会话默认。子代理被路由到不同模型时,官方会自动丢弃继承来的思考强度,因此不设置也不会跨模型泄漏。取值由模型适配器解释(与官方 agent-default-model 的 reasoningEffort 同一通道):官方模型选择器启用时会覆盖/清空继承值;插件只接受 id 形态的值(字母数字与 `.` `_` `-`),写别的会在保存时被拒绝。
|
|
122
|
+
|
|
123
|
+
**Q:迁移会失败吗?失败了会怎样?**
|
|
124
|
+
单条导出失败只影响那一条(它继续以 legacy 兜底,diagnostics 会说明);整体故障(如目录不可写)时条目全部走 legacy 兜底且设置页有警告横幅——**下次使用名册时会自动重试,重启 dsh web 也可立即重试**,不需要手工干预。
|
|
125
|
+
|
|
126
|
+
**Q:名册目录能换地方吗?**
|
|
127
|
+
能。settings.yaml 里设 `subagent-library.entriesDir`(支持 `~` 与相对路径,相对路径锚定 `~/.dsh`)。
|
|
128
|
+
|
|
129
|
+
**Q:多台机器怎么同步名册?**
|
|
130
|
+
把名册目录纳入你的 dotfiles/git 即可——每条目一个文件,diff 友好。settings.yaml 里的旧段不建议同步。
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
# Migration Guide: 0.2.x → 0.3.x (directory-backed roster)
|
|
135
|
+
|
|
136
|
+
**TL;DR (3 steps)**
|
|
137
|
+
|
|
138
|
+
1. **Upgrade and restart dsh web** — nothing to change by hand; your legacy config migrates automatically.
|
|
139
|
+
2. **Verify**: run `/subagent` or open the settings page — all old entries are listed, and the roster directory now holds one `<id>.yaml` per entry.
|
|
140
|
+
3. **Clean up (optional but recommended)**: click “清除旧条目” on the settings card, or delete the legacy `entries` section from settings.yaml manually.
|
|
141
|
+
|
|
142
|
+
**What changed** — the roster moved from the inline `subagent-library.entries` map in `~/.dsh/settings.yaml` to **one YAML file per named subagent** under `~/.dsh/subagents/` (configurable via `subagent-library.entriesDir`). Files are hot-reloaded. Entry DATA is equivalent between the settings page and hand-edited files, but saving an entry from the settings page **when its content has changed** writes that entry as canonical `<id>.yaml` and removes the same-id `<id>.yml` (hand-written comments in that entry's file are lost); entries whose content is unchanged are skipped, so their original files and comments stay intact.
|
|
143
|
+
|
|
144
|
+
**File-name lifecycle** — Both `<id>.yaml` and `<id>.yml` are read. If both spellings already exist for one id, fix that conflict (keep one) before using the settings page. Deleting an entry removes both suffixes. Writes and deletes run per file, not as a directory-wide multi-file transaction: a failure is reported and may leave a partial result, so inspect the roster before retrying.
|
|
145
|
+
|
|
146
|
+
**Automatic migration** — on the first roster use after upgrading, each legacy entry is exported to `<id>.yaml` **only when neither `<id>.yaml` nor `<id>.yml` exists** (if either spelling exists, hand-written files are never overwritten; re-runs are idempotent). The legacy settings copies are **kept** as a rollback fallback; files take precedence. Legacy reading stays working throughout 0.3.x and is **removed in 0.4**. Deleting an entry from the settings page removes both its `<id>.yaml` and `<id>.yml` roster files **and** its legacy copy; the one-click cleanup only removes legacy copies that files already shadow and never touches roster files. Legacy copies persist after automatic migration until you clear them.
|
|
147
|
+
|
|
148
|
+
**Rollback** — install the old version (`dsh-subagent-library@0.2.8`); as long as you have not deleted the legacy `entries` section, 0.2.x keeps working exactly as before. The legacy copies are the rollback data source: editing or deleting them (including deleting entries or one-click cleanup) makes rollback return to the snapshot as of that moment — changes made in 0.3 roster files do not come back with the rollback.
|
|
149
|
+
|
|
150
|
+
**New in 0.3** — per-entry `enabled` (disable without deleting) and `reasoningEffort` (adapter-owned thinking-effort id such as `max`, passed through the official `agentOptions` override); broken roster files are skipped with visible diagnostics instead of breaking the roster.
|
|
151
|
+
|
|
152
|
+
See [CHANGELOG.md](./CHANGELOG.md) for the full list of changes.
|
package/README.en.md
CHANGED
|
@@ -21,10 +21,12 @@ A named subagent roster plugin for the [DeepSeek Harness](https://github.com/dee
|
|
|
21
21
|
|
|
22
22
|
Available in every conversation (any agent preset), **no slash command needed**; the `/subagent` command is only for humans to peek at the roster in the command palette.
|
|
23
23
|
|
|
24
|
-
Adding entries needs no hand-written
|
|
24
|
+
Adding entries needs no hand-written config either: ask the main agent to do it, or edit visually in the settings page. Since 0.3 the roster is stored as **one YAML file per named subagent** (default directory `~/.dsh/subagents/`), hot-reloaded, comment-friendly and versionable per file.
|
|
25
25
|
|
|
26
26
|
> Distinction from the official capabilities: the official `subagent` tool dispatches ad-hoc tasks (you describe the task each time), and the official `list_agents` lists *running* child instances; this plugin maintains a **persistent named roster** (edited visually in a settings page, hot-reloaded). The model picks an entry with `list_subagents` and dispatches by id with `delegate`.
|
|
27
27
|
|
|
28
|
+
> **Upgrading from 0.2.x?** Since 0.3 the roster is directory-backed (one YAML file per subagent). Your legacy config **migrates automatically**, and the old settings.yaml section can be cleared with one click — zero manual steps. See [MIGRATION.md](./MIGRATION.md) for the detailed guide and [CHANGELOG.md](./CHANGELOG.md) for all changes.
|
|
29
|
+
|
|
28
30
|
## Screenshots
|
|
29
31
|
|
|
30
32
|
<p align="center">
|
|
@@ -44,37 +46,63 @@ Adding entries needs no hand-written YAML either: ask the main agent to do it (i
|
|
|
44
46
|
|
|
45
47
|
## Configuration
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
Since 0.3 the roster is a directory with **one file per named subagent** (hot-reloaded, no restart needed):
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
~/.dsh/subagents/
|
|
53
|
+
k3-reviewer.yaml # id = file name
|
|
54
|
+
glm-reader.yaml
|
|
55
|
+
_backups/ # backup area: copy the original here before editing (ignored by the plugin)
|
|
56
|
+
README.md # optional: conventions for agents operating in this directory
|
|
57
|
+
...
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
> **Backup convention** — the plugin never auto-backs up. By convention, agents (or humans) copy the original file into `_backups/` before editing (suggested name `<id>.<yyyymmdd-hhmm>.yaml`). Anything `_`-prefixed is treated as non-roster content and silently ignored.
|
|
61
|
+
|
|
62
|
+
`~/.dsh/settings.yaml` only keeps the plugin-level options:
|
|
48
63
|
|
|
49
64
|
```yaml
|
|
50
65
|
subagent-library:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
# Roster directory; default ~/.dsh/subagents, supports ~ and paths relative to ~/.dsh
|
|
67
|
+
entriesDir: ~/.dsh/subagents
|
|
68
|
+
# entries: (optional, legacy) the 0.2.x inline roster is still read as a
|
|
69
|
+
# read-only fallback throughout 0.3.x — files win; removal planned for 0.4
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
One entry file (`k3-reviewer.yaml`):
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
description: Independent read-only review on Kimi K3-256K, with image walkthroughs
|
|
76
|
+
provider: kimi-coding
|
|
77
|
+
model: k3-256k
|
|
78
|
+
persona: |
|
|
79
|
+
You are an independent review agent running on Kimi K3-256K…
|
|
80
|
+
toolFilter:
|
|
81
|
+
deny: [write, edit, todo_write, create_goal, update_goal, subagent, subagent_fork, send_message, interrupt_agent, workflow, ralph, list_subagents, delegate]
|
|
82
|
+
maxDepth: 1
|
|
83
|
+
backgroundMode: continuable
|
|
62
84
|
```
|
|
63
85
|
|
|
64
86
|
Entry fields:
|
|
65
87
|
|
|
66
88
|
| Field | Required | Notes |
|
|
67
89
|
|---|---|---|
|
|
68
|
-
| `id` (
|
|
90
|
+
| `id` (= file name) | yes | `<id>.yaml`; the id must match `[a-z0-9][a-z0-9-]*`, length ≤ 64 (Windows reserved device names con/nul/aux… are rejected) |
|
|
69
91
|
| `description` | yes | Role description, shown to the model by `list_subagents` |
|
|
70
92
|
| `provider` | no | **LLM route** (e.g. `deepseek-official`, `kimi-coding`); defaults to the caller's default |
|
|
71
93
|
| `model` | no | LLM model id; defaults to the caller's session model |
|
|
94
|
+
| `reasoningEffort` | no | Thinking effort: adapter-owned id (e.g. `max` / `high` / `medium` / `low`); empty follows the parent session default. Rides the official `agentOptions.reasoningEffort` override; when the child model route differs, the harness auto-drops the inherited effort, so unset values never leak across models. Only id-shaped values (alphanumerics and `._-`) are accepted; anything else is rejected on save |
|
|
72
95
|
| `subagentProvider` | no | **Subagent transport** (a `ctx.subagents` provider such as `spawn`); defaults to the plugin-level default `spawn` |
|
|
73
96
|
| `maxTokens` | no | Subagent output cap |
|
|
74
97
|
| `persona` | no | Subagent system prompt. Personas go through strict `{{…}}` template interpolation (same semantics as deployment personas) — an unregistered variable (e.g. `{{user}}`) fails child activation |
|
|
75
98
|
| `toolFilter` | no | `allow`/`deny` tool-name lists (deny write-class tools for read-only roles). **Read-only/restricted roles should also deny `list_subagents`/`delegate`** so children are not taught by the global prompt to re-delegate in a chain. Names are resolved against the **calling session's restrictable set** at delegation (not "visibility"): names that session cannot apply are ignored and annotated with the reason (`本会话不存在` / `本会话专属工具`) in the delegate result and the `list_subagents` catalog — one shared entry never fails a whole delegation because a session lacks a tool. **An `allow` list that no name applies to refuses the delegation** (otherwise "keep only these" would silently become "keep nothing"). Registries without `view()` fall back to visibility, where scope-local names still make delegation fail loudly. Saves are not pre-validated |
|
|
76
99
|
| `maxDepth` | no | Delegation depth cap; **when unset, defaults to 3 when the transport supports depthLimit** (aligned with the official subagent tool to prevent chained recursive delegation; the harness itself has no global depth cap). Transports without depthLimit stay uncapped |
|
|
77
|
-
| `backgroundMode` | no | `one-shot` (default) / `continuable` (resumable) |
|
|
100
|
+
| `backgroundMode` | no | `one-shot` (default, omitted in files) / `continuable` (resumable) |
|
|
101
|
+
| `enabled` | no | Write `enabled: false` to disable an entry (it stays visible in the directory and the settings page; `delegate` refuses it); omit or set `true` to enable |
|
|
102
|
+
|
|
103
|
+
**Broken files never brick the roster**: files that fail to parse or validate are skipped, and the reason is surfaced as diagnostics in `list_subagents`, the `/subagent` command, and the settings page; `.yaml`/`.yml` duplicate ids and wrongly-cased file names are reported the same way.
|
|
104
|
+
|
|
105
|
+
**Migrating from 0.2.x**: on first roster use, the existing `entries` in settings.yaml are exported **entry by entry** to `<id>.yaml` (ids with an existing file are skipped — hand-written files are never overwritten); the legacy settings copies are KEPT as a rollback (downgrading the plugin keeps working), and files take precedence. Once confirmed, delete the legacy `entries` section from settings yourself (reading it is removed in 0.4).
|
|
78
106
|
|
|
79
107
|
> Mind the two provider concepts: `provider` is the LLM route (`agentOptions.provider`),
|
|
80
108
|
> while `subagentProvider` is the subagent transport (`ctx.subagents` registration name, e.g. `spawn`/`fork`/`acp`).
|
|
@@ -104,16 +132,20 @@ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-lib
|
|
|
104
132
|
|
|
105
133
|
> The repo commits `lib/` build artifacts, so git installs need no local build; after
|
|
106
134
|
> changing sources run `pnpm run build` and restart.
|
|
107
|
-
>
|
|
135
|
+
> Roster edits (files under `~/.dsh/subagents/`) are **hot-reloaded** — no restart.
|
|
136
|
+
>
|
|
137
|
+
> **Switching channels** — if you previously installed from GitHub or a local checkout and want npm-release upgrades, re-add with `npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library@latest` to force the latest npm version.
|
|
108
138
|
|
|
109
139
|
## Settings page
|
|
110
140
|
|
|
111
141
|
A **Subagent Library** card appears under Settings: visually add/edit/remove entries
|
|
112
142
|
(description / provider / model / subagentProvider transport / maxTokens / denied tools /
|
|
113
|
-
depth / background mode / persona), written back to
|
|
143
|
+
depth / background mode / persona / enable switch), written back to `<id>.yaml` in the
|
|
144
|
+
roster directory, hot-reloaded.
|
|
114
145
|
The add card offers the same fields as an entry card (ID / description / provider / model /
|
|
115
146
|
transport / output cap / denied tools / depth / background mode / persona), so a role is
|
|
116
|
-
fully configured in one step
|
|
147
|
+
fully configured in one step; legacy entries carry a `legacy` badge and are promoted to
|
|
148
|
+
files on save.
|
|
117
149
|
|
|
118
150
|
> **Security note:** the roster settings endpoint (`/subagent-library/api`) follows the
|
|
119
151
|
> DSH Web Host's local trust boundary — the plugin itself adds no separate authentication
|
|
@@ -125,7 +157,7 @@ fully configured in one step.
|
|
|
125
157
|
|
|
126
158
|
- Tools register on the **host plane**: no dependency on any agent preset, and switching presets never loses them;
|
|
127
159
|
- Dispatch goes through the standard `ctx.subagents` seam (providers such as `spawn`), so subagents keep harness semantics: approval pinned to never, sandbox inherited from the parent session, depth caps, continuable support;
|
|
128
|
-
- Entries are re-resolved from
|
|
160
|
+
- Entries are re-resolved from the roster directory on every operation (no cache, no watcher) — file edits take effect immediately; single-entry writes are atomic (temp file + rename with retries), concurrent writers are last-write-wins.
|
|
129
161
|
|
|
130
162
|
## Development
|
|
131
163
|
|
package/README.md
CHANGED
|
@@ -28,10 +28,12 @@ DeepSeek Harness 的具名子代理库插件:把常用角色(代码审查、
|
|
|
28
28
|
|
|
29
29
|
任何会话(任意 agent preset)直接可用,**不需要 slash 命令**;`/subagent` 命令只是给人类在命令面板里快速查看名册用的。
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
新增条目也不用手写配置:直接让主会话 agent 帮你配,或在设置页里可视化编辑;0.3 起 名册存储为**一个具名子代理一个 YAML 文件**(默认目录 `~/.dsh/subagents/`),热生效、可单独注释与版本管理。
|
|
32
32
|
|
|
33
33
|
> 与官方能力的区分:官方 `subagent` 工具是临时派活(每次现场描述任务),官方 `list_agents` 列的是正在运行的子代实例;本插件维护的是**持久化的具名角色名册**(设置页可视化编辑、热生效),模型用 `list_subagents` 选人、`delegate` 按 id 派活。
|
|
34
34
|
|
|
35
|
+
> **从 0.2.x 升级?** 0.3 起名册目录化(一个子代理一个 YAML 文件),旧配置**自动迁移**、settings.yaml 旧段可一键清除,零手工步骤——详细过渡指南见 [MIGRATION.md](./MIGRATION.md),完整变更见 [CHANGELOG.md](./CHANGELOG.md)。
|
|
36
|
+
|
|
35
37
|
## 界面
|
|
36
38
|
|
|
37
39
|
<p align="center">
|
|
@@ -51,37 +53,62 @@ DeepSeek Harness 的具名子代理库插件:把常用角色(代码审查、
|
|
|
51
53
|
|
|
52
54
|
## 配置
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
0.3 起,名册是一个目录,**一个具名子代理一个文件**(热生效,无需重启):
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
~/.dsh/subagents/
|
|
60
|
+
k3-reviewer.yaml # id = 文件名
|
|
61
|
+
glm-reader.yaml
|
|
62
|
+
_backups/ # 备份区:agent/人改条目前先把原文件复制到这里(`_` 前缀内容插件忽略)
|
|
63
|
+
README.md # 可选:给操作本目录的 agent 看的约定说明
|
|
64
|
+
...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
> **备份约定**:插件不做自动备份;按惯例,agent(或人)在修改条目前先把原文件复制进 `_backups/`(命名建议 `<id>.<yyyymmdd-hhmm>.yaml`)。`_` 前缀的文件/目录一律视为非名册内容,插件静默忽略。名册目录里可放一份 `README.md` 给操作该目录的 agent 立规矩。
|
|
68
|
+
|
|
69
|
+
`~/.dsh/settings.yaml` 里只保留插件级配置:
|
|
55
70
|
|
|
56
71
|
```yaml
|
|
57
72
|
subagent-library:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
# 名册目录;默认 ~/.dsh/subagents,支持 ~ 与相对路径(相对 ~/.dsh)
|
|
74
|
+
entriesDir: ~/.dsh/subagents
|
|
75
|
+
# entries:(可选,遗留)0.2.x 的内联名册在 0.3.x 仍只读兜底,文件优先生效;0.4 移除
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
单个条目文件(`k3-reviewer.yaml`):
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
description: Kimi K3-256K 独立只读审核,支持图片视觉走查
|
|
82
|
+
provider: kimi-coding
|
|
83
|
+
model: k3-256k
|
|
84
|
+
persona: |
|
|
85
|
+
你是运行在 Kimi K3-256K 上的独立审核 agent……
|
|
86
|
+
toolFilter:
|
|
87
|
+
deny: [write, edit, todo_write, create_goal, update_goal, subagent, subagent_fork, send_message, interrupt_agent, workflow, ralph, list_subagents, delegate]
|
|
88
|
+
maxDepth: 1
|
|
89
|
+
backgroundMode: continuable
|
|
69
90
|
```
|
|
70
91
|
|
|
71
92
|
条目字段:
|
|
72
93
|
|
|
73
94
|
| 字段 | 必填 | 说明 |
|
|
74
95
|
|---|---|---|
|
|
75
|
-
| `id
|
|
96
|
+
| `id`(= 文件名) | 是 | `<id>.yaml`,id 须匹配 `[a-z0-9][a-z0-9-]*`,长度 ≤ 64(Windows 保留设备名 con/nul/aux… 不可用) |
|
|
76
97
|
| `description` | 是 | 角色描述,`list_subagents` 展示给模型 |
|
|
77
98
|
| `provider` | 否 | **LLM 路由**(如 `deepseek-official`、`kimi-coding`);缺省用调用方默认 |
|
|
78
99
|
| `model` | 否 | LLM 模型 id;缺省用调用方的会话默认模型 |
|
|
100
|
+
| `reasoningEffort` | 否 | 思考强度:适配器自有值(如 `max` / `high` / `medium` / `low`),留空随父会话默认。走官方 `agentOptions.reasoningEffort` 覆盖通道;子代理换了模型路由时官方会自动丢弃继承值,未显式设置不会跨模型泄漏。只接受 id 形态(字母数字与 `._-`),其他值保存时被拒绝 |
|
|
79
101
|
| `subagentProvider` | 否 | **子代理传输层**(`spawn` 等 `ctx.subagents` provider);默认取插件级默认 `spawn` |
|
|
80
102
|
| `maxTokens` | 否 | 子代理输出上限 |
|
|
81
103
|
| `persona` | 否 | 子代理角色提示词。注意 persona 走严格的 `{{…}}` 模板插值(与部署 persona 同语义)——出现未注册的变量(如 `{{user}}`)会让子代理激活失败 |
|
|
82
104
|
| `toolFilter` | 否 | `allow`/`deny` 工具名单(只读角色用 deny 禁写类工具)。**只读/受限角色建议把 `list_subagents`/`delegate` 也列入 deny**,防止子代理被全局提示词教去链式再派活。名单在**委派时按调用方会话的可限制集合**解析(不是"可见"):不可应用的名字被忽略,并在派活结果与 `list_subagents` 目录里标注原因(`本会话不存在` / `本会话专属工具`)——共享条目不会因为某个会话缺该工具而整次派活失败。**`allow` 名单若在本会话全部不可应用则拒绝委派**(否则"只留这些"会变成"什么都不留")。旧注册表无 `view()` 时退回可见性判定,此时 scope-local 名仍会让委派明确报错。保存阶段不做校验 |
|
|
83
105
|
| `maxDepth` | 否 | 委派深度上限;**缺省 = 传输层支持 depthLimit 时默认 3**(与官方 subagent 工具对齐,防链式递归派活;harness 自身无全局深度上限),不支持 depthLimit 的传输层则不设上限 |
|
|
84
|
-
| `backgroundMode` | 否 | `one-shot
|
|
106
|
+
| `backgroundMode` | 否 | `one-shot`(默认,文件中省略)/ `continuable`(可续聊) |
|
|
107
|
+
| `enabled` | 否 | 文件内写 `enabled: false` 停用该条目(目录与设置页仍可见,`delegate` 拒绝派活);省略或 `true` 为启用 |
|
|
108
|
+
|
|
109
|
+
**坏文件不炸名册**:解析/校验失败的文件被跳过,错误进入 `list_subagents` 输出、`/subagent` 命令与设置页的 diagnostics;`.yaml`/`.yml` 同名冲突、大写文件名等也会以诊断形式报出。
|
|
110
|
+
|
|
111
|
+
**从 0.2.x 迁移**:首次使用名册时,settings.yaml 里已有的 `entries` 会**逐条**导出为 `<id>.yaml`(已存在同名文件的条目跳过,绝不覆盖手写文件);settings 里的旧条目保留作回滚副本(降级插件时仍可用),文件优先生效。确认无误后可自行删除 settings 中的旧 `entries` 段(0.4 将停止读取)。
|
|
85
112
|
|
|
86
113
|
> 注意区分两个 provider 概念:`provider` 指 LLM 路由(`agentOptions.provider`),
|
|
87
114
|
> `subagentProvider` 指子代理传输层(`ctx.subagents` 注册名,如 `spawn`/`fork`/`acp`)。
|
|
@@ -110,13 +137,16 @@ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-lib
|
|
|
110
137
|
```
|
|
111
138
|
|
|
112
139
|
> 仓库已提交 `lib/` 构建产物,git 安装无需本地构建;改源码后运行 `pnpm run build` 再重启即可。
|
|
113
|
-
>
|
|
140
|
+
> 名册(`~/.dsh/subagents/` 下的条目文件)**热生效**,无需重启。
|
|
141
|
+
>
|
|
142
|
+
> **渠道切换**:之前从 GitHub / 本地目录安装、现在想跟随 npm 发布升级时,用 `npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library@latest` 显式取 npm 最新版。
|
|
114
143
|
|
|
115
144
|
## 设置页
|
|
116
145
|
|
|
117
146
|
Settings → 设置 里新增「子代理库」卡片:可视化增删改条目(描述 / Provider / 模型 /
|
|
118
|
-
传输层 subagentProvider / 输出上限 maxTokens / 禁用工具 / 深度 / 后台模式 /
|
|
119
|
-
新增卡与条目卡字段一致(ID / 描述 / Provider / 模型 / 传输层 / 输出上限 / 禁用工具 / 深度 / 后台模式 /
|
|
147
|
+
传输层 subagentProvider / 输出上限 maxTokens / 禁用工具 / 深度 / 后台模式 / 角色提示词 / 启用开关),写回名册目录下的 `<id>.yaml`,热生效。
|
|
148
|
+
新增卡与条目卡字段一致(ID / 描述 / Provider / 模型 / 传输层 / 输出上限 / 禁用工具 / 深度 / 后台模式 / 角色提示词),一次配置完整角色;
|
|
149
|
+
legacy 条目带 `legacy` 徽标,保存时自动晋升为文件。
|
|
120
150
|
|
|
121
151
|
> **安全提示**:子代理库的设置接口(`/subagent-library/api`)遵循 DSH Web Host 的本地可信边界,插件自身不含独立身份验证层。若将 DSH Web 绑定到局域网 / 公网 / 反向代理,请在外层配置认证与访问控制,不要把该接口暴露给不可信客户端——子代理 persona 与配置可能包含内部工作规则。
|
|
122
152
|
|
|
@@ -124,7 +154,7 @@ Settings → 设置 里新增「子代理库」卡片:可视化增删改条目
|
|
|
124
154
|
|
|
125
155
|
- 工具注册在 **host 平面**:不依赖任何 agent preset,切 preset 不会丢;
|
|
126
156
|
- 派发走标准 `ctx.subagents` 缝(spawn 等 provider),子代理沿用 harness 语义:审批固定 never、沙箱继承父会话、深度上限、continuable 支持;
|
|
127
|
-
-
|
|
157
|
+
- 名册每次操作实时读目录(无缓存、无 watcher),改文件立即生效;单条目写入为原子操作(临时文件 + rename 重试),多写者后写赢。
|
|
128
158
|
|
|
129
159
|
## 开发
|
|
130
160
|
|