dsh-subagent-library 0.3.5 → 0.4.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 +39 -1
- package/LICENSE +201 -19
- package/MIGRATION.md +22 -6
- package/README.en.md +101 -139
- package/README.md +97 -125
- package/THIRD_PARTY_NOTICES.md +18 -45
- package/assets/readme/group-dispatch.png +0 -0
- package/assets/readme/group-settings.png +0 -0
- package/assets/readme/hero.svg +3 -3
- package/lib/client.js +1570 -1366
- package/lib/index.js +1844 -5749
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +3 -3
package/README.en.md
CHANGED
|
@@ -8,190 +8,152 @@
|
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<img src="https://img.shields.io/github/actions/workflow/status/MaRi23333/dsh-subagent-library/ci.yml?style=flat-square&label=CI" alt="CI" />
|
|
11
|
-
<img src="https://img.shields.io/github/license/MaRi23333/dsh-subagent-library?style=flat-square" alt="License:
|
|
12
|
-
<img src="https://img.shields.io/badge/DeepSeek%20Harness-0.2.
|
|
11
|
+
<img src="https://img.shields.io/github/license/MaRi23333/dsh-subagent-library?style=flat-square" alt="License: Apache-2.0" />
|
|
12
|
+
<img src="https://img.shields.io/badge/DeepSeek%20Harness-0.2.2--rc.5-4d6bfe?style=flat-square" alt="DeepSeek Harness 0.2.2-rc.5" />
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Save a group for work you do often
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
When you review an announcement, you might want one assistant to spot missing details and another to suggest a rewrite. Save those roles, their assignments, and any shared instructions as a group. The next time you have an announcement, give it to the main agent and ask for that group by name.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
- `delegate` — dispatches work by `library_id`: foreground wait, background one-shot, or a continuable (resumable) subagent, per the entry's configuration.
|
|
19
|
+
> Ask the review group to look at “The meeting has moved to Friday afternoon.” Have `grok-reviewer` use its default model to flag missing information. For this task, have `glm-adversary` use DeepSeek Flash to suggest a one-sentence rewrite.
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+

|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
**Choose a model for one assignment.** Whether you name a role directly or pick a member from a group, you can ask for a model authorized in the current session. The role keeps its usual model for future dispatches.
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
Groups work with Agent Teams switched off. The main agent dispatches one member per call. It can start independent assignments in the same turn or wait for one member’s findings and pass them to the next. Enabling Agent Teams also gives members access to the host’s shared task board.
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
Version 0.4.0 targets DSH `0.2.2-rc.5` and requires native subagents that can be addressed by name for follow-up messages. To upgrade from an earlier version, see the [migration guide](./MIGRATION.md) and [changelog](./CHANGELOG.md).
|
|
29
28
|
|
|
30
|
-
##
|
|
29
|
+
## Install
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
<img src="./assets/readme/screenshot-settings.png" width="75%" alt="Subagent Library settings: layered, collapsible cards and roster filtering" /><br>
|
|
34
|
-
<em>Cards start collapsed for a quick view of roles, models and execution settings. Filter and expand to edit; enable-state changes take effect after saving.</em>
|
|
35
|
-
</p>
|
|
31
|
+
### Desktop client (recommended)
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
<img src="./assets/readme/screenshot-command-palette.png" alt="The /subagent command in the command palette" /><br>
|
|
39
|
-
<em>The <code>/subagent</code> command (quick roster viewer)</em>
|
|
40
|
-
</p>
|
|
33
|
+
Desktop and Web have separate plugin installations and activation states; installing for Web does not enable the desktop plugin. The desktop GUI route needs no PATH setup.
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
1. In the desktop sidebar, open **Plugins** → **Add plugin**.
|
|
36
|
+
2. Enter the npm package name `dsh-subagent-library@latest` and install it.
|
|
37
|
+
3. Click **Enable now** when installation finishes. Closing the completed-install dialog leaves the plugin disabled.
|
|
38
|
+
4. Restart only if the UI asks you to: fully exit with **Quit** in the application menu, then reopen the app. Closing a window may only hide it.
|
|
46
39
|
|
|
47
|
-
|
|
40
|
+
Once enabled, open **子代理库 (Subagent Library)** in Settings and choose the role roster or groups tab. The storage and backup section shows the roster directory.
|
|
48
41
|
|
|
49
|
-
|
|
42
|
+
<details>
|
|
43
|
+
<summary>Alternative: use the desktop-bundled CLI (Windows / macOS)</summary>
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
Start the desktop client once to initialize it. In the application menu, open **Manage dsh Command…** → **Install** to register its bundled `dsh` command, then open a new terminal. If the UI reports a PATH conflict, follow its instructions first.
|
|
46
|
+
|
|
47
|
+
Fully exit the desktop client with **Quit**, then use the newly registered desktop-bundled CLI:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
dsh plugin --profile desktop add dsh-subagent-library@latest
|
|
51
|
+
dsh plugin --profile desktop list
|
|
58
52
|
```
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
Reopen the desktop client afterwards. An npm-installed `dsh` or `npx` cannot manage the `desktop` profile. See the [official desktop command documentation](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.1-rc.2/apps/desktop/README.md#bundled-command-runtime).
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
</details>
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
### Web
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
60
|
+
These commands manage Web plugins only. Use the same `dsh` CLI that starts your Web instance, matching that host's version, to install the stable release from npm:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
dsh plugin --profile web add dsh-subagent-library@latest
|
|
72
64
|
```
|
|
73
65
|
|
|
74
|
-
|
|
66
|
+
After installation, stop the running `dsh web` process, start `dsh web` again with the same CLI, and refresh the page.
|
|
75
67
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
Other install sources:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
# From GitHub (lib/ build artifacts are committed; no local build needed)
|
|
72
|
+
dsh plugin --profile web add github:MaRi23333/dsh-subagent-library
|
|
73
|
+
|
|
74
|
+
# From a local checkout
|
|
75
|
+
git clone https://github.com/MaRi23333/dsh-subagent-library.git
|
|
76
|
+
cd dsh-subagent-library
|
|
77
|
+
pnpm install && pnpm run build
|
|
78
|
+
dsh plugin --profile web add /absolute/path/to/dsh-subagent-library
|
|
83
79
|
```
|
|
84
80
|
|
|
85
|
-
|
|
81
|
+
> The repo commits `lib/` build artifacts, so git installs need no local build; after
|
|
82
|
+
> changing sources run `pnpm run build` and restart Web.
|
|
83
|
+
> Roster edits (files under `~/.dsh/subagents/`) are **hot-reloaded** — no restart.
|
|
84
|
+
>
|
|
85
|
+
> **Switching channels** — if you previously installed from GitHub or a local checkout and want npm-release upgrades, re-add with `dsh plugin --profile web add dsh-subagent-library@latest` to force the latest npm version.
|
|
86
|
+
|
|
87
|
+
## Your first delegation
|
|
88
|
+
|
|
89
|
+
Open the Subagent Library in Settings, switch to the role roster, and create a role with ID `text-helper` and a description. Leave the route empty to use the session model. You can also create the equivalent `text-helper.yaml` in the roster directory (default `~/.dsh/subagents/`).
|
|
86
90
|
|
|
87
91
|
```yaml
|
|
88
|
-
description:
|
|
89
|
-
|
|
90
|
-
model: k3-256k
|
|
91
|
-
persona: |
|
|
92
|
-
You are an independent review agent running on Kimi K3-256K…
|
|
93
|
-
maxDepth: 1
|
|
94
|
-
backgroundMode: continuable
|
|
92
|
+
description: Organize text supplied by the parent.
|
|
93
|
+
persona: Preserve proper names from the source.
|
|
95
94
|
```
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
Ask the main agent to call `list_subagents()`, then `delegate({library_id:"text-helper", prompt:"Number apple, banana and pear in their original order."})`. The receipt's `name` addresses the native member. The parent receives the result separately. You can also manage roles in Settings.
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
## Groups and slots
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|---|---|---|
|
|
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) |
|
|
104
|
-
| `description` | yes | Role description, shown to the model by `list_subagents` |
|
|
105
|
-
| `provider` | no | **LLM route** (e.g. `deepseek-official`, `kimi-coding`); defaults to the caller's default |
|
|
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 |
|
|
108
|
-
| `subagentProvider` | no | **Subagent transport** (a `ctx.subagents` provider such as `spawn`); defaults to the plugin-level default `spawn` |
|
|
109
|
-
| `maxTokens` | no | Subagent output cap |
|
|
110
|
-
| `persona` | no | Subagent role prompt. **DSH ≤0.2.0 hosts**: deployed as a system persona with strict `{{…}}` template interpolation (same semantics as deployment personas) — an unregistered variable (e.g. `{{user}}`) fails child activation. **DSH ≥0.2.1 hosts**: the start request has no persona field; the role is folded into the first task message under a `Role persona:` prefix — effective for the first turn, does NOT shadow a deployment persona, is not guaranteed to survive continuation turns or context compaction, and `{{…}}` is no longer interpolated (raw concatenation). A standalone `agentPreset` is deliberately not used to carry the role: an independent preset replaces the parent preset composition and drops the parent session's tools |
|
|
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. **DSH ≥0.2.1 hosts cannot enforce per-entry tool filters**: entries carrying `toolFilter` are refused at delegate time (marked undelegable in the catalog, warned at save time); such entries only work on ≤0.2.0 hosts |
|
|
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 |
|
|
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 |
|
|
100
|
+
Open the Groups tab, create a group with an ID and description, then select a role and give each member a unique code. A role can appear more than once, with a different assignment for each member. Save the group to make it available for dispatch.
|
|
115
101
|
|
|
116
|
-
|
|
102
|
+

|
|
117
103
|
|
|
118
|
-
|
|
104
|
+
To define the `facts` and `questions` example in YAML, use `_groups/text-review.yaml` under the roster directory. The YAML field `slot` holds the member code.
|
|
119
105
|
|
|
120
|
-
|
|
106
|
+
```yaml
|
|
107
|
+
description: Extract facts and open questions from supplied material.
|
|
108
|
+
instructions: Include the source for each finding.
|
|
109
|
+
members:
|
|
110
|
+
- slot: facts
|
|
111
|
+
role: text-helper
|
|
112
|
+
assignment: Extract facts supported by the source.
|
|
113
|
+
- slot: questions
|
|
114
|
+
role: text-helper
|
|
115
|
+
assignment: Identify missing information.
|
|
116
|
+
```
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
| Action | Tool call |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| Browse groups | `list_subagents({kind:"groups"})` |
|
|
121
|
+
| Inspect member keys, model settings and assignments | `list_subagents({group_id:"text-review"})` |
|
|
122
|
+
| Dispatch one member | `delegate({group_id:"text-review", slot:"facts", prompt:"Check the paragraph above."})` |
|
|
124
123
|
|
|
125
|
-
|
|
124
|
+
Browsing starts zero agents. The `questions` slot starts only on a separate call selecting it. A direct dispatch sends the role persona and task. A group dispatch also includes group instructions and the selected slot's assignment in the child's first message. Each start resolves the current role and profile route. Existing children keep their own sessions. Use `/subagent` to inspect the roster and groups from the command palette.
|
|
126
125
|
|
|
127
|
-
|
|
126
|
+
Use `/subagent groups text-review` to see which members have a configured model and which inherit the parent model. A role can inherit the model and set its own reasoning effort. After dispatch, the native subagent menu and `list_agents` show the launch model and known effort in the member description, for example `text-review/facts [model-a · high]`. Expand the `delegate` receipt for the full `provider`, `model` and `reasoningEffort` values when available.
|
|
128
127
|
|
|
129
|
-
|
|
128
|
+
To change the model for one dispatch, open Plugins in the DSH sidebar, open the built-in Subagent configuration and enable Model selection. Select the allowed models, save, and start a new parent session. Ask the parent to use the role default for one member and an authorized model for the other. It can discover choices with the native `list_subagent_models` tool and pass both `provider` and `model` to `delegate`. The optional `reasoning_effort` selects an effort for that model. Omitting it uses the selected model's default. Subsequent dispatches use the saved role settings again.
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
In a session without a recorded allowlist, an explicit selection is limited to the current parent provider and model. On a host that cannot read authorization, dispatch with the saved role settings remains available. Agent Teams is optional.
|
|
132
131
|
|
|
133
|
-
|
|
132
|
+
## Configuration and migration
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
| Location or field | Behavior |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `<entriesDir>/<role-id>.yaml` | Shared role with required `description`. Optional fields include `persona`, `enabled`, model route, `maxTokens`, `maxDepth` and `subagentProvider`. |
|
|
137
|
+
| `_profiles/<profile>/<role-id>.yaml` | Profile route with `provider`, `model`, `reasoningEffort` or explicit inheritance. A shared provider missing from the current profile falls back to the session model. An invalid explicit profile route blocks the affected role. |
|
|
138
|
+
| `_groups/<group-id>.yaml` | Required description and ordered nonempty `members`. Optional `name`, `enabled` and `instructions`. A member has a `slot`, a `role` and an optional `assignment`. |
|
|
139
|
+
| `maxDepth` | Defaults to the host limit. An explicit value can tighten it. Zero blocks delegation. |
|
|
140
|
+
| `subagentProvider` | Defaults to the `spawn` transport. `fork` can inherit completed turns from the parent. The LLM provider is configured separately. |
|
|
141
|
+
| Legacy `backgroundMode` and `toolFilter` | Both former execution modes now start a resumable child asynchronously. Roles carrying a tool filter remain blocked until its removal is explicit. Set any required permission boundaries in the host. |
|
|
138
142
|
|
|
139
|
-
|
|
143
|
+
On hosts with profiles, Settings saves model edits in the current profile. On hosts without profiles, the same editor changes the shared default route. Clear it to follow the session model. Profile overrides bound to the old shared route need to be set again after the default changes.
|
|
140
144
|
|
|
141
|
-
|
|
145
|
+
IDs and slot keys use lowercase letters, digits and hyphens, start with a letter or digit, and are at most 64 characters. Windows reserved device names are excluded. Disabling a group leaves its enabled roles available for direct use. Remove all group references before deleting a role. Settings detect stale writes. Hand-edited YAML is read on the next operation.
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
# From GitHub (git-hosted plugin; lib/ build artifacts are committed, no local build needed)
|
|
145
|
-
npx @deepseek-ai/dsh plugin --profile web add github:MaRi23333/dsh-subagent-library
|
|
147
|
+
Configure the base directory and default transport on the plugin row of the current profile's `cordis.patch.yml`:
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
```yaml
|
|
150
|
+
- id: subagent-library
|
|
151
|
+
config:
|
|
152
|
+
entriesDir: ~/.dsh/subagents
|
|
153
|
+
subagentProvider: spawn
|
|
152
154
|
```
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
> changing sources run `pnpm run build` and restart.
|
|
156
|
-
> Roster edits (files under `~/.dsh/subagents/`) are **hot-reloaded** — no restart.
|
|
157
|
-
>
|
|
158
|
-
> **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.
|
|
159
|
-
|
|
160
|
-
## Settings page
|
|
161
|
-
|
|
162
|
-
A **Subagent Library** page appears under Settings. **Each entry is a card, closed by
|
|
163
|
-
default**; click its name to open the editor.
|
|
164
|
-
|
|
165
|
-
- **Layered cards** separate the name and enable switch, a description of up to two lines,
|
|
166
|
-
the model and provider, and a wrapping group of execution settings. Long names and model
|
|
167
|
-
routes wrap without squeezing the description or hiding the switch.
|
|
168
|
-
- A **summary band** stays at the top of the page: entry / enabled / disabled / unsaved counts
|
|
169
|
-
plus the roster directory.
|
|
170
|
-
- A **filter box** matches id, description, model and more; Expand/collapse all helps in a long
|
|
171
|
-
roster.
|
|
172
|
-
- **Expanded**, fields are grouped as Overview (description) / Routing & execution (provider,
|
|
173
|
-
model, transport, background mode, reasoning effort, depth, output cap) / Tools & prompt
|
|
174
|
-
(denied tools, persona), with Revert / Delete / Save at the bottom. Fields use two columns
|
|
175
|
-
in wider panels and one in narrow panels, with host light/dark themes and keyboard support.
|
|
176
|
-
- Toggling enable state creates a draft. The collapsed card exposes an unsaved badge and
|
|
177
|
-
Revert / Save changes; the setting takes effect only after saving. Saving one entry does
|
|
178
|
-
not submit other drafts, and Revert restores the entire saved entry.
|
|
179
|
-
- Disabled entries appear last; entries marked as legacy are promoted to files on save.
|
|
180
|
-
Storage and backup details are available in a disclosure at the bottom of the page.
|
|
181
|
-
|
|
182
|
-
Saved changes are written back to `<id>.yaml` in the roster directory and hot-reloaded.
|
|
183
|
-
|
|
184
|
-
> **Security note:** the roster settings endpoint (`/subagent-library/api`) follows the
|
|
185
|
-
> DSH Web Host's local trust boundary — the plugin itself adds no separate authentication
|
|
186
|
-
> layer. If you bind DSH Web to a LAN, the public internet, or a reverse proxy, put proper
|
|
187
|
-
> authentication and access control in front of it; do not expose this endpoint to
|
|
188
|
-
> untrusted clients — subagent personas and configuration may contain internal working rules.
|
|
189
|
-
|
|
190
|
-
## Design notes
|
|
191
|
-
|
|
192
|
-
- Tools register on the **host plane**: no dependency on any agent preset, and switching presets never loses them;
|
|
193
|
-
- 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;
|
|
194
|
-
- 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.
|
|
156
|
+
Include the role files, `_profiles/` and `_groups/` in backups. The Settings endpoint `/subagent-library/api` shares the DSH Web Host access boundary. Configure host or reverse-proxy authentication when exposing it to other devices.
|
|
195
157
|
|
|
196
158
|
## Development
|
|
197
159
|
|
|
@@ -201,10 +163,10 @@ pnpm run typecheck
|
|
|
201
163
|
pnpm run build # host: lib/index.js; client: lib/client.js
|
|
202
164
|
```
|
|
203
165
|
|
|
204
|
-
- Dev dependencies remain pinned to DSH `0.1.0-rc.6` (see package.json devDependencies); this is not the current runtime host version.
|
|
166
|
+
- Dev dependencies remain pinned to DSH `0.1.0-rc.6` (see package.json devDependencies); this is not the current runtime host version. If the interfaces drift on other versions, adjust against the corresponding tag of the [deepseek-harness repo](https://github.com/deepseek-ai/deepseek-harness).
|
|
205
167
|
|
|
206
168
|
## License
|
|
207
169
|
|
|
208
|
-
[
|
|
170
|
+
[Apache-2.0](./LICENSE). Third-party license notices for code inlined into the build artifacts are in [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).
|
|
209
171
|
|
|
210
172
|
This is an independent community project, not affiliated with or endorsed by DeepSeek; the `DeepSeek Harness` name is used only to identify the compatible platform.
|