dsh-subagent-library 0.2.8 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/MIGRATION.md +192 -0
- package/README.en.md +66 -19
- package/README.md +63 -19
- package/lib/client.js +506 -302
- package/lib/index.js +710 -717
- package/package.json +7 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
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.1] — 2026-09-29(DSH 0.1.7-rc.2 适配)
|
|
8
|
+
|
|
9
|
+
### 修复 / Fixed
|
|
10
|
+
|
|
11
|
+
- **适配 DSH 0.1.7-rc.2**:0.3.0 的旧设置 seam 在新宿主上调用不存在的 `register()`,因此插件启动失败并返回整体 503;这不是由 bundle 中的 `settingsNamespace` 命名导入直接造成的。插件现在**运行时结构探测两代宿主**:≤0.1.6 走原 `register()` 通道;≥0.1.7 直接使用 Loader 活配置,旧条目兜底的清除改经官方 `ctx.configEditor` 通道。名册文件(`~/.dsh/subagents/*.yaml`)在两代宿主上行为一致。
|
|
12
|
+
- Adapts to DSH 0.1.7-rc.2: 0.3.0's legacy settings seam called `register()`, which the new host does not provide, so startup failed with an overall 503; the direct cause was not a named `settingsNamespace` import from the bundle. The plugin now detects the host generation at runtime: ≤0.1.6 keeps the `register()` channel; ≥0.1.7 uses the Loader live config plus the official `ctx.configEditor` for legacy cleanup. Roster files behave identically on both.
|
|
13
|
+
- `.yml` 条目收敛死锁修复:内容未变的 `.yml` 条目此前会因跳过写入而永远保持双文件冲突;现在非规范后缀行即使内容未变也会收敛为 `.yaml`,原 `.yml` 的手写注释会丢失。
|
|
14
|
+
- Fixed a convergence deadlock for unchanged `.yml` rows: they now converge to generated `.yaml` even when their content is unchanged, losing hand-written comments from the `.yml` file.
|
|
15
|
+
- 收敛写入失败现在明确返回 HTTP 500(可能已经部分完成);规范 `.yaml` 的跳过路径若残留 `.yml` 清扫失败,则返回 200 并带 warning,故障解除后可重试收敛。
|
|
16
|
+
- Convergence failures now return HTTP 500 and may be partial; a failed `.yml` sweep on the canonical `.yaml` skip path returns 200 with a warning and can be retried after the fault clears.
|
|
17
|
+
- 修复本次未发布适配候选引入的旧宿主(≤0.1.6)回归:`describe()` 恢复方法调用形态(detached 调用会因 `this` 丢失被吞错,导致 legacyCount 误报 0、清除假成功)。
|
|
18
|
+
- Fixed a legacy-host regression introduced in this unreleased compatibility candidate: `describe()` retains its receiver, preventing swallowed errors, a false zero legacy count, and cleanup that reports success without removing legacy copies.
|
|
19
|
+
- 修复本次未发布适配候选中暴露的 SUB-COMPAT-017-004:ConfigEditor 的 raw 配置不含 schema 默认值,整表 reconcile 会丢掉默认 provider(如 `spawn`),清除旧条目后委派报 "provider not registered";现在 reconcile 按配置定义的字段恢复默认值(默认值只进活配置实例,绝不写回 raw patch),并在编辑完成后立即反射到当前实例。
|
|
20
|
+
- Fixed SUB-COMPAT-017-004 exposed by this unreleased compatibility candidate: the raw ConfigEditor layer carries no schema defaults, so a wholesale reconcile dropped the default provider (delegation then failed with "provider not registered"); reconcile now restores defaults for the fields defined by the configuration into the live instance only (never the raw patch) and reflects the result immediately after the edit.
|
|
21
|
+
|
|
22
|
+
### 文档 / Docs
|
|
23
|
+
|
|
24
|
+
- 配置位置与回滚说明按宿主版本分述(≥0.1.7 的插件级配置在 profile `cordis.patch.yml`;0.2.8 仅适用于旧宿主,宿主降级及 `settings.yaml.imported` 恢复路径未经验证,不提供降级操作步骤)。
|
|
25
|
+
- Config-location and rollback docs now distinguish host versions: 0.2.8 requires an older host; host downgrade and `settings.yaml.imported` restoration are unverified, so no downgrade sequence is prescribed.
|
|
26
|
+
|
|
27
|
+
## [0.3.0] — 2026-09-24
|
|
28
|
+
|
|
29
|
+
### 变更 / Changed(重要:存储位置变化)
|
|
30
|
+
|
|
31
|
+
- **名册存储目录化**:具名子代理从 `settings.yaml` 的 `subagent-library.entries` 迁移为 **一个子代理一个 YAML 文件**,默认目录 `~/.dsh/subagents/`(可用 `subagent-library.entriesDir` 自定义,支持 `~` 与相对路径)。
|
|
32
|
+
- **The roster now lives as one YAML file per named subagent** (default `~/.dsh/subagents/`), replacing the inline `entries` map in settings.yaml.
|
|
33
|
+
- **旧条目自动迁移**:升级后首次使用名册时,settings 里的旧 `entries` 会被**逐条**导出为 `<id>.yaml`(已存在同名文件绝不覆盖;重复重启幂等)。settings 中的旧副本**保留**作回滚兜底,文件优先生效;0.3.x 内旧配置仍可读,**0.4 起停止读取**。
|
|
34
|
+
- 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.
|
|
35
|
+
- **一键清除旧条目**:设置页「子代理库」卡片新增迁移横幅与「清除旧条目」按钮(只清除已被文件覆盖的旧副本,不碰名册文件);也可手动删除 settings 中的旧 `entries` 段。详见 [MIGRATION.md](./MIGRATION.md)。
|
|
36
|
+
- The settings page gains a migration banner with a one-click "clear legacy copies" action. See [MIGRATION.md](./MIGRATION.md).
|
|
37
|
+
- 设置页 UI 重排:对齐个性化指令编辑器的视觉风格(主题中性 rgba 配色、8px 圆角卡片、蓝色主操作/红色危险按钮、tinted 横幅、chip 徽标),整卡加宽至 860px;**角色提示词编辑区按内容自适应高度**(110–440px 夹紧,短文本紧凑、长文本展开),描述/persona 等正文字段换回界面字体并加大字号,长文本可读性优先;描述字段为单行 textarea 可拖展;后台模式挪至思考强度行,固定宽度控件不再被挤压。
|
|
38
|
+
- 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.
|
|
39
|
+
|
|
40
|
+
### 新增 / Added
|
|
41
|
+
|
|
42
|
+
- **`reasoningEffort` 条目字段**:为单个具名子代理指定思考强度(adapter 自有值,如 `max` / `high` / `medium` / `low`;留空随父会话默认)。走官方 `agentOptions.reasoningEffort` 覆盖通道;子代理换了模型路由时,官方会自动丢弃继承来的思考强度,因此未显式设置不会跨模型泄漏。
|
|
43
|
+
- 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.
|
|
44
|
+
- **`enabled` 条目字段**:文件内写 `enabled: false` 停用条目——目录与设置页仍可见,`delegate` 明确拒绝;设置页提供启用开关。
|
|
45
|
+
- New `enabled` flag to disable an entry without deleting its file.
|
|
46
|
+
- **坏文件不炸名册**:解析/校验失败、`.yaml`/`.yml` 同 id 冲突、大写文件名等一律跳过并以 diagnostics 呈现在 `list_subagents`、`/subagent` 与设置页。
|
|
47
|
+
- Broken roster files are skipped and surfaced as diagnostics instead of breaking the roster.
|
|
48
|
+
- 设置页:迁移横幅、legacy 徽标、diagnostics 面板;409 冲突保留未保存草稿,仅切换到最新基线(响应带回新视图),再次保存即为覆盖。
|
|
49
|
+
- 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.
|
|
50
|
+
- 名册目录新增 **`_backups/` 备份约定**:插件不做自动备份,按惯例 agent/人在改条目前把原文件复制进 `_backups/`;`_` 前缀的文件/目录(`_backups/`、`_draft.yaml`…)一律视为非名册内容,**静默忽略**(不再产生诊断噪音)。
|
|
51
|
+
- 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).
|
|
52
|
+
|
|
53
|
+
### 修复 / Fixed
|
|
54
|
+
|
|
55
|
+
- **`.yml` 名册生命周期修复**:名册同时读取 `.yaml`/`.yml`;设置页保存有变化的条目统一收敛为 `<id>.yaml` 并移除同 id 的 `.yml`,删除条目同时清理两个后缀,避免删除 `.yaml` 后旧 `.yml` 复活。
|
|
56
|
+
- **`.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.
|
|
57
|
+
- **修复设置页保存/删除的 HTTP 重复响应**:补齐分支返回,确保 delete/save 每次只发送一次 HTTP 响应,避免真实服务触发 `ERR_HTTP_HEADERS_SENT`。
|
|
58
|
+
- **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`.
|
|
59
|
+
- **双审加固(K3 实现复审 + GLM 红队)**:设置页保存**跳过内容未变的条目**——不再把未触碰的手写 YAML 文件重写为生成格式(手写注释得以保留);名册文件损坏且存在同名 legacy 副本时,升级为 **error 级诊断**并明确提示「delegate 使用的是旧配置」(不再静默回退);409 冲突**保留用户未保存的草稿**(只切换到最新基线,再次保存才会覆盖);迁移失败(整体或单条)**自动重试**而非进程内永久搁浅;`reasoningEffort` 保存时校验为 effort id 形态(字母数字与 `._-`);设置页只读时「清除旧条目」响亮 403 而非假成功;客户端补齐 wire 契约测试(parseView 此前丢失 legacyCount 导致迁移横幅不渲染的 bug 即在此层)。
|
|
60
|
+
- 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).
|
|
61
|
+
|
|
62
|
+
### 内部 / Internal
|
|
63
|
+
|
|
64
|
+
- 每次操作实时读目录(无缓存、无 watcher);单条目写入原子化(临时文件 + rename 带重试);id 规则加长度 ≤64 与 Windows 保留设备名黑名单;BOM 兼容;未知字段大声拒绝。
|
|
65
|
+
- 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.
|
|
66
|
+
|
|
67
|
+
## [0.2.8] — 2026-09-09
|
|
68
|
+
|
|
69
|
+
- 设置页导航图标装饰(decorateSettingsNavIcon)。
|
|
70
|
+
|
|
71
|
+
## [0.2.7] — 2026-09-09
|
|
72
|
+
|
|
73
|
+
- 修复:`toolFilter` 改为按**调用方会话的可限制集合**解析(此前按可见性,`subagent` 等 scope-local 工具会让委派整单失败);忽略的名字带原因标注;`allow` 全不可应用时拒绝委派;`list_subagents` 目录同步展示生效后的过滤摘要。
|
|
74
|
+
|
|
75
|
+
## [0.2.6] — 2026-09-06
|
|
76
|
+
|
|
77
|
+
- DSH 0.1.2-rc.1 兼容性验证与声明(devDependencies 仍锁 rc.6)。
|
|
78
|
+
|
|
79
|
+
## [0.2.5] — 2026-09-05
|
|
80
|
+
|
|
81
|
+
- 修复设置页保存 400(移除保存期工具名预检,委派期 `tools.restrict` 为准);新条目卡补齐缺失字段。
|
|
82
|
+
|
|
83
|
+
[Unreleased]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.3.0...HEAD
|
|
84
|
+
[0.3.0]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.8...v0.3.0
|
|
85
|
+
[0.2.8]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.7...v0.2.8
|
|
86
|
+
[0.2.7]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.6...v0.2.7
|
|
87
|
+
[0.2.6]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.5...v0.2.6
|
|
88
|
+
[0.2.5]: https://github.com/MaRi23333/dsh-subagent-library/compare/v0.2.4...v0.2.5
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
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. **清理**(可选但推荐):设置页点「清除旧条目」,或按宿主版本手动删掉配置行/`config` 下的旧 `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
|
+
插件配置只保留插件级键。两代宿主的正确 YAML 形状如下:
|
|
44
|
+
|
|
45
|
+
**DSH ≤0.1.6:** `~/.dsh/settings.yaml`
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
subagent-library:
|
|
49
|
+
entriesDir: ~/.dsh/subagents
|
|
50
|
+
subagentProvider: spawn
|
|
51
|
+
# entries: ← 0.2.x 的旧段,0.3.x 只读兜底,确认迁移成功后可删
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**DSH ≥0.1.7:** web profile 的 `cordis.patch.yml`,`- id: subagent-library` 的 `config` 下
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
- id: subagent-library
|
|
58
|
+
config:
|
|
59
|
+
entriesDir: ~/.dsh/subagents
|
|
60
|
+
subagentProvider: spawn
|
|
61
|
+
# entries: ← 0.2.x 的旧段,0.3.x 只读兜底,确认迁移成功后可删
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **配置位置随宿主版本不同**:
|
|
65
|
+
> - **DSH ≤0.1.6**:上面这段写在 `~/.dsh/settings.yaml`;
|
|
66
|
+
> - **DSH ≥0.1.7**:`settings.yaml.imported` 是宿主迁移留下的备份,活配置写在 **web profile 的 `cordis.patch.yml`**(`- id: subagent-library` 条目的 `config` 下)。不要把 `settings.yaml.imported` 当作已验证的活配置恢复路径。
|
|
67
|
+
|
|
68
|
+
文件**热生效**:改完保存即可,无需重启。设置页与手编文件的数据**双向等价**,但要注意:通过设置页保存某个条目且内容有变化时,**该条目统一写为 `<id>.yaml`,并移除同 id 的 `<id>.yml`**(这个文件里的手写注释与自定义排版会丢失);**本次保存中内容未变化的规范 `.yaml` 条目一律跳过写入,原文件和注释原样保留;`.yml` 条目即使内容未变也会收敛重写为生成格式 `.yaml`(其注释丢失)**。想保留注释的手编文件,请直接手编,别在设置页里动它。
|
|
69
|
+
|
|
70
|
+
## 自动迁移是怎么工作的
|
|
71
|
+
|
|
72
|
+
升级到 0.3 并重启后,**首次使用名册时**(打开设置页、调用 `list_subagents`、或第一次 `delegate`)插件会:
|
|
73
|
+
|
|
74
|
+
1. 读取当前宿主配置位置里的旧 `entries`(旧宿主为 `~/.dsh/settings.yaml`;新宿主为 profile `cordis.patch.yml` 的 `- id: subagent-library` → `config`);
|
|
75
|
+
2. 对每个条目:**如果名册目录里同名的 `<id>.yaml` 与 `<id>.yml` 均不存在,就导出一个**;
|
|
76
|
+
- 已存在同名任一后缀文件 → **跳过,绝不覆盖**(你手写的文件是安全的);
|
|
77
|
+
- id 非法(大写、超长、Windows 保留名)→ 跳过并在诊断里说明;
|
|
78
|
+
3. **当前配置里的旧段在迁移阶段原样保留**——它是你的回滚备份:自动迁移后旧副本仍保留,只有清理才会移除。注意区分两种操作:设置页**删除条目**会清除该 id 的 `.yaml` 与 `.yml` 名册文件,并一并移除其旧副本;点**「清除旧条目」**只移除已被文件覆盖的旧副本,不动任何名册文件。
|
|
79
|
+
|
|
80
|
+
迁移是逐条幂等的:重启多少次都只会导出缺的那几条,重复内容不会翻倍。
|
|
81
|
+
|
|
82
|
+
## 你需要做的
|
|
83
|
+
|
|
84
|
+
### 第 1 步:升级 + 重启
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library@latest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
然后重启 dsh web、刷新页面。
|
|
91
|
+
|
|
92
|
+
### 第 2 步:验证迁移
|
|
93
|
+
|
|
94
|
+
任选其一:
|
|
95
|
+
|
|
96
|
+
- 命令面板跑 `/subagent`,确认旧条目全部在列;
|
|
97
|
+
- 打开 设置 → 子代理库:条目卡片正常显示即已迁移(若某条带 `legacy` 徽标且名册目录没有对应文件,说明该条还是旧数据在兜底,看下方 FAQ);
|
|
98
|
+
- 看一眼名册目录(默认 `~/.dsh/subagents/`),确认 `<id>.yaml` 都在,随手打开一个核对字段。
|
|
99
|
+
|
|
100
|
+
### 第 3 步:清理旧段(可选,推荐)
|
|
101
|
+
|
|
102
|
+
确认名册工作正常后,把当前宿主配置里的旧 `entries` 段清掉,两种方式:
|
|
103
|
+
|
|
104
|
+
- **设置页一键清除(推荐)**:子代理库卡片顶部会出现迁移横幅「N 个旧条目已导出为名册文件……」,点「清除旧条目」即可。该操作只删除**已被文件覆盖**的旧副本,名册文件不受影响;
|
|
105
|
+
- **手动删除(按宿主版本)**:
|
|
106
|
+
- **DSH ≤0.1.6**:编辑 `~/.dsh/settings.yaml`,删掉 `subagent-library.entries:` 整段(保留 `subagentProvider` / `entriesDir` 等插件级键);
|
|
107
|
+
- **DSH ≥0.1.7**:旧段已被宿主导入 web profile 的 `cordis.patch.yml`——删掉其中 `id: subagent-library` 条目 `config` 下的 `entries:` 键即可;**保留同一 `config` 行里的 `entriesDir` / `subagentProvider` 等其他键**,不要删除整个条目,也可以用宿主自带配置编辑器操作。
|
|
108
|
+
|
|
109
|
+
> 不清理会怎样?——什么都不会坏。文件优先生效,旧段只是躺着(设置页会持续显示提示信息)。0.4 起插件停止读取旧段,届时再删也行。
|
|
110
|
+
|
|
111
|
+
## 回滚(想退回 0.2.x)
|
|
112
|
+
|
|
113
|
+
**前提:插件降级必须与宿主版本匹配。** 0.2.8 的旧 `entries` 回滚副本只适用于 DSH ≤0.1.6;在 DSH ≥0.1.7 上不能单独降级插件,旧设置 seam 可能导致整体 503。宿主降级和 `settings.yaml.imported` 数据恢复均未验证,因此这里不提供「先降宿主再恢复 imported」的操作步骤。
|
|
114
|
+
|
|
115
|
+
自动迁移后仍保留的旧 `entries` 是回滚数据源;一旦删除或编辑旧副本(包括删除条目或一键清除),回滚只能回到当时的快照,0.3 名册文件中的后续修改不会自动回写。若只是恢复名册内容,请从你自己建立的 `~/.dsh/subagents/_backups/` 备份恢复并自行核对;无需为此降级插件或宿主。
|
|
116
|
+
|
|
117
|
+
## FAQ
|
|
118
|
+
|
|
119
|
+
**Q:我手写的 `<id>.yaml` 会被迁移覆盖吗?**
|
|
120
|
+
不会。迁移只导出名册目录里**不存在**的 id;已有文件一律跳过。
|
|
121
|
+
|
|
122
|
+
**Q:文件名有什么要求?**
|
|
123
|
+
`<id>.yaml` 或 `<id>.yml` 都会被读取;id 必须全小写、匹配 `[a-z0-9][a-z0-9-]*`、长度 ≤ 64,且不能是 Windows 保留设备名(`con`、`nul`、`aux`…)。同一 id 的两个后缀并存会报冲突诊断,先修好冲突(只保留一个)再在设置页操作。规范 `.yaml` 内容未变时会跳过写入并保留原文件及注释;`.yml` 内容即使未变也会统一重写为生成的 `<id>.yaml` 并移除同 id 的 `<id>.yml`,原注释会丢失。删除条目会清除同 id 的两个后缀。
|
|
124
|
+
|
|
125
|
+
**Q:写入或删除失败时会怎样?**
|
|
126
|
+
这些操作按文件逐个进行,不是目录级多文件事务;写入或收敛失败返回 HTTP 500,且可能已经部分完成。规范 `.yaml` 内容未变时会跳过写入并保留原文件和注释;`.yml` 内容即使未变也会收敛重写为生成的 `.yaml`,原 `.yml` 注释会丢失。若跳过路径的同名 `.yml` 清扫失败,保存仍返回 200 但带 warning,冲突诊断会持续到清扫成功;解除占用后重试保存。遇到错误先检查名册目录和 diagnostics,再重试。
|
|
127
|
+
|
|
128
|
+
**Q:某个文件写坏了会怎样?**
|
|
129
|
+
只有那一个条目失效:它被跳过,并在 `list_subagents`、`/subagent`、设置页 diagnostics 里给出原因,其余条目照常。改好文件即恢复。**特别注意**:如果同名条目在当前宿主配置里还有旧副本(自动迁移后旧副本仍保留;点「清除旧条目」或删除条目后才移除),插件会用**旧副本兜底继续服务**,并在 diagnostics 里以 error 标明「delegate 使用的是旧配置」——看到这条请先修文件。
|
|
130
|
+
|
|
131
|
+
**Q:`.yml` 文件会一直保持 `.yml` 吗?**
|
|
132
|
+
会正常读取;但设置页保存触达该条目时,即使内容未变也会收敛为生成格式的 `.yaml`(原 `.yml` 移除,避免同 id 双文件),因此原手写注释会丢失。内容未变的规范 `.yaml` 则会跳过写入并保留注释。
|
|
133
|
+
|
|
134
|
+
**Q:怎么临时停用一个子代理(不删文件)?**
|
|
135
|
+
文件里加一行 `enabled: false`(或设置页关掉「启用」开关)。停用的条目仍可见,但 `delegate` 会拒绝并提示。注意:仍以 **legacy 兜底**方式服务的条目(见上一条)不支持停用——先在设置页保存一次让它晋升为文件,再停用。
|
|
136
|
+
|
|
137
|
+
**Q:想给某个子代理单独设置思考强度?**
|
|
138
|
+
0.3 新增 `reasoningEffort` 字段:填适配器自有值(如 `max` / `high` / `medium` / `low`),留空随父会话默认。子代理被路由到不同模型时,官方会自动丢弃继承来的思考强度,因此不设置也不会跨模型泄漏。取值由模型适配器解释(与官方 agent-default-model 的 reasoningEffort 同一通道):官方模型选择器启用时会覆盖/清空继承值;插件只接受 id 形态的值(字母数字与 `.` `_` `-`),写别的会在保存时被拒绝。
|
|
139
|
+
|
|
140
|
+
**Q:迁移会失败吗?失败了会怎样?**
|
|
141
|
+
单条导出失败只影响那一条(它继续以 legacy 兜底,diagnostics 会说明);整体故障(如目录不可写)时条目全部走 legacy 兜底且设置页有警告横幅——**下次使用名册时会自动重试,重启 dsh web 也可立即重试**,不需要手工干预。
|
|
142
|
+
|
|
143
|
+
**Q:名册目录能换地方吗?**
|
|
144
|
+
能。DSH ≤0.1.6 在 `~/.dsh/settings.yaml` 的 `subagent-library.entriesDir` 设置;DSH ≥0.1.7 在 web profile `cordis.patch.yml` 的 `- id: subagent-library` → `config` 下设置(支持 `~` 与相对路径,相对路径锚定 `~/.dsh`)。
|
|
145
|
+
|
|
146
|
+
**Q:多台机器怎么同步名册?**
|
|
147
|
+
把名册目录纳入你的 dotfiles/git 即可——每条目一个文件,diff 友好。旧配置里的 `entries` 段不建议同步。
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
# Migration Guide: 0.2.x → 0.3.x (directory-backed roster)
|
|
152
|
+
|
|
153
|
+
**TL;DR (3 steps)**
|
|
154
|
+
|
|
155
|
+
1. **Upgrade and restart dsh web** — nothing to change by hand; your legacy config migrates automatically.
|
|
156
|
+
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.
|
|
157
|
+
3. **Clean up (optional but recommended)**: click “清除旧条目” on the settings card, or delete only the legacy `entries` key from the host-specific config shape, keeping the other keys on the same config row.
|
|
158
|
+
|
|
159
|
+
**Config location depends on the host version.** Use the matching shape:
|
|
160
|
+
|
|
161
|
+
**DSH ≤0.1.6:** `~/.dsh/settings.yaml`
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
subagent-library:
|
|
165
|
+
entriesDir: ~/.dsh/subagents
|
|
166
|
+
subagentProvider: spawn
|
|
167
|
+
# entries: optional legacy 0.2.x map; remove only this key after verification
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**DSH ≥0.1.7:** the web profile's `cordis.patch.yml`, under `config` on `- id: subagent-library`
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
- id: subagent-library
|
|
174
|
+
config:
|
|
175
|
+
entriesDir: ~/.dsh/subagents
|
|
176
|
+
subagentProvider: spawn
|
|
177
|
+
# entries: optional legacy 0.2.x map; remove only this key after verification
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
On the newer host, `settings.yaml.imported` is a migration backup, not a verified active configuration or rollback procedure.
|
|
181
|
+
|
|
182
|
+
**What changed** — on the old host the roster was the inline `subagent-library.entries` map in `~/.dsh/settings.yaml`; on the newer host that legacy map is under the profile patch row shown above. It now lives as **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 file are lost); an unchanged canonical `.yaml` row is skipped, so its original file and comments stay intact, while an unchanged `.yml` row is still rewritten as generated `.yaml` and loses its comments.
|
|
183
|
+
|
|
184
|
+
**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 write or convergence failure returns HTTP 500 and may leave a partial result. If the unchanged canonical `.yaml` skip path cannot sweep a same-id `.yml`, the save returns 200 with a warning and the duplicate diagnostic remains until a retry succeeds; inspect the roster before retrying.
|
|
185
|
+
|
|
186
|
+
**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.
|
|
187
|
+
|
|
188
|
+
**Rollback** — the 0.2.8 legacy `entries` fallback is for DSH ≤0.1.6 only; on DSH ≥0.1.7 the plugin cannot be downgraded by itself, and the old settings seam may return 503. Host downgrade and restoration of `settings.yaml.imported` data are unverified, so no downgrade sequence is prescribed. 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. To restore roster content, use your own `_backups/` copies and verify them manually.
|
|
189
|
+
|
|
190
|
+
**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.
|
|
191
|
+
|
|
192
|
+
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**; after verifying it, clear the old `entries` section for your host generation. [MIGRATION.md](./MIGRATION.md) documents the config locations, failure/retry behavior, and rollback limits; [CHANGELOG.md](./CHANGELOG.md) lists all changes.
|
|
29
|
+
|
|
28
30
|
## Screenshots
|
|
29
31
|
|
|
30
32
|
<p align="center">
|
|
@@ -44,37 +46,78 @@ 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
|
+
Where the plugin-level options live **depends on the host version**. Use one of these two shapes:
|
|
63
|
+
|
|
64
|
+
**DSH ≤0.1.6:** edit `~/.dsh/settings.yaml`.
|
|
48
65
|
|
|
49
66
|
```yaml
|
|
50
67
|
subagent-library:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
entriesDir: ~/.dsh/subagents
|
|
69
|
+
subagentProvider: spawn
|
|
70
|
+
# entries: (optional, legacy) the 0.2.x inline roster remains a read-only
|
|
71
|
+
# fallback throughout 0.3.x — files win; removal planned for 0.4
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**DSH ≥0.1.7:** edit the web profile's `cordis.patch.yml`, under `config` on its `- id: subagent-library` entry.
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
- id: subagent-library
|
|
78
|
+
config:
|
|
79
|
+
entriesDir: ~/.dsh/subagents
|
|
80
|
+
subagentProvider: spawn
|
|
81
|
+
# entries: (optional, legacy) the 0.2.x inline roster remains a read-only
|
|
82
|
+
# fallback throughout 0.3.x — files win; removal planned for 0.4
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
One entry file (`k3-reviewer.yaml`):
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
description: Independent read-only review on Kimi K3-256K, with image walkthroughs
|
|
89
|
+
provider: kimi-coding
|
|
90
|
+
model: k3-256k
|
|
91
|
+
persona: |
|
|
92
|
+
You are an independent review agent running on Kimi K3-256K…
|
|
93
|
+
toolFilter:
|
|
94
|
+
deny: [write, edit, todo_write, create_goal, update_goal, subagent, subagent_fork, send_message, interrupt_agent, workflow, ralph, list_subagents, delegate]
|
|
95
|
+
maxDepth: 1
|
|
96
|
+
backgroundMode: continuable
|
|
62
97
|
```
|
|
63
98
|
|
|
64
99
|
Entry fields:
|
|
65
100
|
|
|
66
101
|
| Field | Required | Notes |
|
|
67
102
|
|---|---|---|
|
|
68
|
-
| `id` (
|
|
103
|
+
| `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
104
|
| `description` | yes | Role description, shown to the model by `list_subagents` |
|
|
70
105
|
| `provider` | no | **LLM route** (e.g. `deepseek-official`, `kimi-coding`); defaults to the caller's default |
|
|
71
106
|
| `model` | no | LLM model id; defaults to the caller's session model |
|
|
107
|
+
| `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
108
|
| `subagentProvider` | no | **Subagent transport** (a `ctx.subagents` provider such as `spawn`); defaults to the plugin-level default `spawn` |
|
|
73
109
|
| `maxTokens` | no | Subagent output cap |
|
|
74
110
|
| `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
111
|
| `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
112
|
| `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) |
|
|
113
|
+
| `backgroundMode` | no | `one-shot` (default, omitted in files) / `continuable` (resumable) |
|
|
114
|
+
| `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 |
|
|
115
|
+
|
|
116
|
+
**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.
|
|
117
|
+
|
|
118
|
+
**Migrating from 0.2.x**: on first roster use, the old `entries` section is exported **entry by entry** to `<id>.yaml` (ids with an existing file are skipped — hand-written files are never overwritten); legacy copies are KEPT as a rollback, and files take precedence. When saving through the settings page, an unchanged canonical `.yaml` row is skipped so its hand-written comments stay intact; an unchanged `.yml` row is still rewritten as generated `.yaml` and loses its comments. A write/convergence failure returns HTTP 500 and may leave a partial result. If the canonical `.yaml` skip path cannot sweep a same-id `.yml`, the save returns 200 with a warning and the duplicate diagnostic remains until a retry succeeds. Once confirmed, clear only the legacy `entries` key and keep the other keys on that same config row (reading is removed in 0.4).
|
|
119
|
+
|
|
120
|
+
The 0.2.8 legacy `entries` fallback is for DSH ≤0.1.6 only; on DSH ≥0.1.7 the plugin cannot be downgraded by itself. Host downgrade and restoration of `settings.yaml.imported` data are unverified, so no downgrade sequence is prescribed. To restore roster content, use your own `_backups/` copies and verify them manually.
|
|
78
121
|
|
|
79
122
|
> Mind the two provider concepts: `provider` is the LLM route (`agentOptions.provider`),
|
|
80
123
|
> while `subagentProvider` is the subagent transport (`ctx.subagents` registration name, e.g. `spawn`/`fork`/`acp`).
|
|
@@ -104,16 +147,20 @@ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-lib
|
|
|
104
147
|
|
|
105
148
|
> The repo commits `lib/` build artifacts, so git installs need no local build; after
|
|
106
149
|
> changing sources run `pnpm run build` and restart.
|
|
107
|
-
>
|
|
150
|
+
> Roster edits (files under `~/.dsh/subagents/`) are **hot-reloaded** — no restart.
|
|
151
|
+
>
|
|
152
|
+
> **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
153
|
|
|
109
154
|
## Settings page
|
|
110
155
|
|
|
111
156
|
A **Subagent Library** card appears under Settings: visually add/edit/remove entries
|
|
112
157
|
(description / provider / model / subagentProvider transport / maxTokens / denied tools /
|
|
113
|
-
depth / background mode / persona), written back to
|
|
158
|
+
depth / background mode / persona / enable switch), written back to `<id>.yaml` in the
|
|
159
|
+
roster directory, hot-reloaded.
|
|
114
160
|
The add card offers the same fields as an entry card (ID / description / provider / model /
|
|
115
161
|
transport / output cap / denied tools / depth / background mode / persona), so a role is
|
|
116
|
-
fully configured in one step
|
|
162
|
+
fully configured in one step; legacy entries carry a `legacy` badge and are promoted to
|
|
163
|
+
files on save.
|
|
117
164
|
|
|
118
165
|
> **Security note:** the roster settings endpoint (`/subagent-library/api`) follows the
|
|
119
166
|
> DSH Web Host's local trust boundary — the plugin itself adds no separate authentication
|
|
@@ -125,7 +172,7 @@ fully configured in one step.
|
|
|
125
172
|
|
|
126
173
|
- Tools register on the **host plane**: no dependency on any agent preset, and switching presets never loses them;
|
|
127
174
|
- 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
|
|
175
|
+
- 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
176
|
|
|
130
177
|
## Development
|
|
131
178
|
|
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 文件),旧配置**自动迁移**;确认无误后可按宿主版本清除旧 `entries` 段。配置位置、失败重试和回滚边界见 [MIGRATION.md](./MIGRATION.md),完整变更见 [CHANGELOG.md](./CHANGELOG.md)。
|
|
36
|
+
|
|
35
37
|
## 界面
|
|
36
38
|
|
|
37
39
|
<p align="center">
|
|
@@ -51,37 +53,76 @@ 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
|
+
上面的插件级配置存放位置**随宿主版本不同**。两种正确的配置形状如下:
|
|
70
|
+
|
|
71
|
+
**DSH ≤0.1.6:**编辑 `~/.dsh/settings.yaml`。
|
|
55
72
|
|
|
56
73
|
```yaml
|
|
57
74
|
subagent-library:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
entriesDir: ~/.dsh/subagents
|
|
76
|
+
subagentProvider: spawn
|
|
77
|
+
# entries:(可选,遗留)0.2.x 的内联名册在 0.3.x 仍只读兜底,文件优先生效;0.4 移除
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**DSH ≥0.1.7:**编辑 web profile 的 `cordis.patch.yml`,在 `- id: subagent-library` 的 `config` 下配置。
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
- id: subagent-library
|
|
84
|
+
config:
|
|
85
|
+
entriesDir: ~/.dsh/subagents
|
|
86
|
+
subagentProvider: spawn
|
|
87
|
+
# entries:(可选,遗留)0.2.x 的内联名册在 0.3.x 仍只读兜底,文件优先生效;0.4 移除
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
单个条目文件(`k3-reviewer.yaml`):
|
|
91
|
+
|
|
92
|
+
```yaml
|
|
93
|
+
description: Kimi K3-256K 独立只读审核,支持图片视觉走查
|
|
94
|
+
provider: kimi-coding
|
|
95
|
+
model: k3-256k
|
|
96
|
+
persona: |
|
|
97
|
+
你是运行在 Kimi K3-256K 上的独立审核 agent……
|
|
98
|
+
toolFilter:
|
|
99
|
+
deny: [write, edit, todo_write, create_goal, update_goal, subagent, subagent_fork, send_message, interrupt_agent, workflow, ralph, list_subagents, delegate]
|
|
100
|
+
maxDepth: 1
|
|
101
|
+
backgroundMode: continuable
|
|
69
102
|
```
|
|
70
103
|
|
|
71
104
|
条目字段:
|
|
72
105
|
|
|
73
106
|
| 字段 | 必填 | 说明 |
|
|
74
107
|
|---|---|---|
|
|
75
|
-
| `id
|
|
108
|
+
| `id`(= 文件名) | 是 | `<id>.yaml`,id 须匹配 `[a-z0-9][a-z0-9-]*`,长度 ≤ 64(Windows 保留设备名 con/nul/aux… 不可用) |
|
|
76
109
|
| `description` | 是 | 角色描述,`list_subagents` 展示给模型 |
|
|
77
110
|
| `provider` | 否 | **LLM 路由**(如 `deepseek-official`、`kimi-coding`);缺省用调用方默认 |
|
|
78
111
|
| `model` | 否 | LLM 模型 id;缺省用调用方的会话默认模型 |
|
|
112
|
+
| `reasoningEffort` | 否 | 思考强度:适配器自有值(如 `max` / `high` / `medium` / `low`),留空随父会话默认。走官方 `agentOptions.reasoningEffort` 覆盖通道;子代理换了模型路由时官方会自动丢弃继承值,未显式设置不会跨模型泄漏。只接受 id 形态(字母数字与 `._-`),其他值保存时被拒绝 |
|
|
79
113
|
| `subagentProvider` | 否 | **子代理传输层**(`spawn` 等 `ctx.subagents` provider);默认取插件级默认 `spawn` |
|
|
80
114
|
| `maxTokens` | 否 | 子代理输出上限 |
|
|
81
115
|
| `persona` | 否 | 子代理角色提示词。注意 persona 走严格的 `{{…}}` 模板插值(与部署 persona 同语义)——出现未注册的变量(如 `{{user}}`)会让子代理激活失败 |
|
|
82
116
|
| `toolFilter` | 否 | `allow`/`deny` 工具名单(只读角色用 deny 禁写类工具)。**只读/受限角色建议把 `list_subagents`/`delegate` 也列入 deny**,防止子代理被全局提示词教去链式再派活。名单在**委派时按调用方会话的可限制集合**解析(不是"可见"):不可应用的名字被忽略,并在派活结果与 `list_subagents` 目录里标注原因(`本会话不存在` / `本会话专属工具`)——共享条目不会因为某个会话缺该工具而整次派活失败。**`allow` 名单若在本会话全部不可应用则拒绝委派**(否则"只留这些"会变成"什么都不留")。旧注册表无 `view()` 时退回可见性判定,此时 scope-local 名仍会让委派明确报错。保存阶段不做校验 |
|
|
83
117
|
| `maxDepth` | 否 | 委派深度上限;**缺省 = 传输层支持 depthLimit 时默认 3**(与官方 subagent 工具对齐,防链式递归派活;harness 自身无全局深度上限),不支持 depthLimit 的传输层则不设上限 |
|
|
84
|
-
| `backgroundMode` | 否 | `one-shot
|
|
118
|
+
| `backgroundMode` | 否 | `one-shot`(默认,文件中省略)/ `continuable`(可续聊) |
|
|
119
|
+
| `enabled` | 否 | 文件内写 `enabled: false` 停用该条目(目录与设置页仍可见,`delegate` 拒绝派活);省略或 `true` 为启用 |
|
|
120
|
+
|
|
121
|
+
**坏文件不炸名册**:解析/校验失败的文件被跳过,错误进入 `list_subagents` 输出、`/subagent` 命令与设置页的 diagnostics;`.yaml`/`.yml` 同名冲突、大写文件名等也会以诊断形式报出。
|
|
122
|
+
|
|
123
|
+
**从 0.2.x 迁移**:首次使用名册时,旧配置里的 `entries` 会**逐条**导出为 `<id>.yaml`(已存在同名文件的条目跳过,绝不覆盖手写文件);旧条目保留作回滚副本,文件优先生效。通过设置页保存时,规范 `.yaml` 内容未变时会跳过写入并保留手写注释;`.yml` 内容即使未变也会重写为生成的 `.yaml` 并移除 `.yml`,原注释会丢失。写入或收敛失败返回 HTTP 500,可能已有部分文件完成;规范 `.yaml` 的跳过路径若清扫同名 `.yml` 失败则返回 200 并带 warning,冲突诊断会持续到下次重试成功。确认无误后按宿主版本清除旧 `entries` 段(0.4 将停止读取)。
|
|
124
|
+
|
|
125
|
+
清理时只删除 `entries` 键:旧宿主保留同一 `subagent-library` 行的 `subagentProvider` / `entriesDir` 等其他键;新宿主保留同一 `config` 行的这些键,不要删除整个配置条目。0.2.8 的旧 `entries` 回滚副本只适用于 DSH ≤0.1.6;在 DSH ≥0.1.7 上不能单独降级插件。宿主降级和 `settings.yaml.imported` 数据恢复均未验证;如果需要恢复 0.3 名册内容,请从你自己建立的名册 `_backups/` 备份恢复并自行核对。
|
|
85
126
|
|
|
86
127
|
> 注意区分两个 provider 概念:`provider` 指 LLM 路由(`agentOptions.provider`),
|
|
87
128
|
> `subagentProvider` 指子代理传输层(`ctx.subagents` 注册名,如 `spawn`/`fork`/`acp`)。
|
|
@@ -110,13 +151,16 @@ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-lib
|
|
|
110
151
|
```
|
|
111
152
|
|
|
112
153
|
> 仓库已提交 `lib/` 构建产物,git 安装无需本地构建;改源码后运行 `pnpm run build` 再重启即可。
|
|
113
|
-
>
|
|
154
|
+
> 名册(`~/.dsh/subagents/` 下的条目文件)**热生效**,无需重启。
|
|
155
|
+
>
|
|
156
|
+
> **渠道切换**:之前从 GitHub / 本地目录安装、现在想跟随 npm 发布升级时,用 `npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library@latest` 显式取 npm 最新版。
|
|
114
157
|
|
|
115
158
|
## 设置页
|
|
116
159
|
|
|
117
160
|
Settings → 设置 里新增「子代理库」卡片:可视化增删改条目(描述 / Provider / 模型 /
|
|
118
|
-
传输层 subagentProvider / 输出上限 maxTokens / 禁用工具 / 深度 / 后台模式 /
|
|
119
|
-
新增卡与条目卡字段一致(ID / 描述 / Provider / 模型 / 传输层 / 输出上限 / 禁用工具 / 深度 / 后台模式 /
|
|
161
|
+
传输层 subagentProvider / 输出上限 maxTokens / 禁用工具 / 深度 / 后台模式 / 角色提示词 / 启用开关),写回名册目录下的 `<id>.yaml`,热生效。
|
|
162
|
+
新增卡与条目卡字段一致(ID / 描述 / Provider / 模型 / 传输层 / 输出上限 / 禁用工具 / 深度 / 后台模式 / 角色提示词),一次配置完整角色;
|
|
163
|
+
legacy 条目带 `legacy` 徽标,保存时自动晋升为文件。
|
|
120
164
|
|
|
121
165
|
> **安全提示**:子代理库的设置接口(`/subagent-library/api`)遵循 DSH Web Host 的本地可信边界,插件自身不含独立身份验证层。若将 DSH Web 绑定到局域网 / 公网 / 反向代理,请在外层配置认证与访问控制,不要把该接口暴露给不可信客户端——子代理 persona 与配置可能包含内部工作规则。
|
|
122
166
|
|
|
@@ -124,7 +168,7 @@ Settings → 设置 里新增「子代理库」卡片:可视化增删改条目
|
|
|
124
168
|
|
|
125
169
|
- 工具注册在 **host 平面**:不依赖任何 agent preset,切 preset 不会丢;
|
|
126
170
|
- 派发走标准 `ctx.subagents` 缝(spawn 等 provider),子代理沿用 harness 语义:审批固定 never、沙箱继承父会话、深度上限、continuable 支持;
|
|
127
|
-
-
|
|
171
|
+
- 名册每次操作实时读目录(无缓存、无 watcher),改文件立即生效;单条目写入为原子操作(临时文件 + rename 重试),多写者后写赢。
|
|
128
172
|
|
|
129
173
|
## 开发
|
|
130
174
|
|