dsh-subagent-library 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-subagent-library contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # dsh-subagent-library
2
+
3
+ DeepSeek Harness 的具名子代理库插件:在 `settings.yaml` 里维护一份"角色子代理"清单(模型 + persona + 工具过滤),所有会话(任意 agent preset)都能通过两个模型可见工具使用它:
4
+
5
+ - `list_subagents` — 列出库内条目(id / 角色描述 / 模型),模型据此挑选合适条目;
6
+ - `delegate` — 按 `library_id` 派活:前台等待、后台 one-shot 任务、或 continuable 可续聊子代理(按条目配置)。
7
+
8
+ 另有 `/subagent` 命令在命令面板里列出库内容。
9
+
10
+ > 与官方能力的区分:官方 `subagent` 工具是临时派活(每次现场描述任务),官方 `list_agents` 列的是正在运行的子代实例;本插件维护的是**持久化的具名角色名册**(设置页可视化编辑、热生效),模型用 `list_subagents` 选人、`delegate` 按 id 派活。
11
+
12
+ ## 配置
13
+
14
+ `$DSH_HOME/settings.yaml`(热生效,无需重启):
15
+
16
+ ```yaml
17
+ subagent-library:
18
+ entries:
19
+ k3-reviewer:
20
+ description: Kimi K3-256K 独立只读审核,支持图片视觉走查
21
+ provider: kimi-coding
22
+ model: k3-256k
23
+ persona: |
24
+ 你是运行在 Kimi K3-256K 上的独立审核 agent……
25
+ toolFilter:
26
+ deny: [write, edit, todo_write, create_goal, update_goal, subagent, subagent_fork, send_message, interrupt_agent, workflow, ralph, list_subagents, delegate]
27
+ maxDepth: 1
28
+ backgroundMode: continuable
29
+ ```
30
+
31
+ 条目字段:
32
+
33
+ | 字段 | 必填 | 说明 |
34
+ |---|---|---|
35
+ | `id`(dict 键) | 是 | `[a-z0-9][a-z0-9-]*`,如 `k3-reviewer` |
36
+ | `description` | 是 | 角色描述,`list_subagents` 展示给模型 |
37
+ | `provider` | 否 | **LLM 路由**(如 `deepseek-official`、`kimi-coding`);缺省用调用方默认 |
38
+ | `model` | 否 | LLM 模型 id;缺省用调用方的会话默认模型 |
39
+ | `subagentProvider` | 否 | **子代理传输层**(`spawn` 等 `ctx.subagents` provider);默认取插件级默认 `spawn` |
40
+ | `maxTokens` | 否 | 子代理输出上限 |
41
+ | `persona` | 否 | 子代理角色提示词。注意 persona 走严格的 `{{…}}` 模板插值(与部署 persona 同语义)——出现未注册的变量(如 `{{user}}`)会让子代理激活失败 |
42
+ | `toolFilter` | 否 | `allow`/`deny` 工具名单(只读角色用 deny 禁写类工具;名单必须都是已注册的工具名,否则保存被拒)。**只读/受限角色建议把 `list_subagents`/`delegate` 也列入 deny**,防止子代理被全局提示词教去链式再派活 |
43
+ | `maxDepth` | 否 | 委派深度上限;**缺省 = 传输层支持 depthLimit 时默认 3**(与官方 subagent 工具对齐,防链式递归派活;harness 自身无全局深度上限),不支持 depthLimit 的传输层则不设上限 |
44
+ | `backgroundMode` | 否 | `one-shot`(默认)/ `continuable`(可续聊) |
45
+
46
+ > 注意区分两个 provider 概念:`provider` 指 LLM 路由(`agentOptions.provider`),
47
+ > `subagentProvider` 指子代理传输层(`ctx.subagents` 注册名,如 `spawn`/`fork`/`acp`)。
48
+
49
+ ## 安装
50
+
51
+ 一条命令,从 npm 安装(推荐):
52
+
53
+ ```sh
54
+ npx @deepseek-ai/dsh plugin --profile web add dsh-subagent-library
55
+ ```
56
+
57
+ 然后**重启 dsh web**(关掉终端重新运行 `dsh web`)并刷新页面。
58
+
59
+ 其他安装方式:
60
+
61
+ ```sh
62
+ # 从 GitHub 安装(git-hosted 插件;仓库已提交 lib/ 构建产物,安装无需本地构建)
63
+ npx @deepseek-ai/dsh plugin --profile web add github:MaRi23333/dsh-subagent-library
64
+
65
+ # 从本地目录安装
66
+ git clone https://github.com/MaRi23333/dsh-subagent-library.git
67
+ cd dsh-subagent-library
68
+ pnpm install && pnpm run build
69
+ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-library
70
+ ```
71
+
72
+ > 仓库已提交 `lib/` 构建产物,git 安装无需本地构建;改源码后运行 `pnpm run build` 再重启即可。
73
+ > 库内条目的增删改(`$DSH_HOME/settings.yaml`)**热生效**,无需重启。
74
+
75
+ ## 设置页
76
+
77
+ Settings → 设置 里新增「子代理库」卡片:可视化增删改条目(描述 / Provider / 模型 /
78
+ 传输层 subagentProvider / 输出上限 maxTokens / 禁用工具 / 深度 / 后台模式 / 角色提示词),写回 `$DSH_HOME/settings.yaml`,热生效。
79
+ 新增卡只收常用字段(ID / 描述 / Provider / 模型 / 传输层 / 输出上限),其余字段(禁用工具 / 深度 / 后台模式 / 角色提示词)在条目卡内编辑。
80
+
81
+ ## 设计说明
82
+
83
+ - 工具注册在 **host 平面**:不依赖任何 agent preset,切 preset 不会丢;
84
+ - 派发走标准 `ctx.subagents` 缝(spawn 等 provider),子代理沿用 harness 语义:审批固定 never、沙箱继承父会话、深度上限、continuable 支持;
85
+ - 条目解析每次操作实时读取 settings,热编辑立即生效。
86
+
87
+ ## 开发
88
+
89
+ ```sh
90
+ pnpm install
91
+ pnpm run typecheck
92
+ pnpm run build # host: lib/index.js;client: lib/client.js
93
+ ```
94
+
95
+ - 依赖 DSH `0.1.0-rc.6` 的运行时 API;其他版本如接口漂移请对照 [deepseek-harness 仓库](https://github.com/deepseek-ai/deepseek-harness) 相应 tag 调整。
96
+
97
+ ## License
98
+
99
+ [MIT](./LICENSE)
@@ -0,0 +1,7 @@
1
+ # dsh-subagent-library bundle patch: insert the host row into the
2
+ # composition. The row id must be unique; `name` must equal the package name.
3
+ # The row lives on the HOST plane, so its list_subagents / delegate tools are
4
+ # visible to every session regardless of agent preset.
5
+ - insert:
6
+ - id: subagent-library
7
+ name: dsh-subagent-library