dsh-agent-team-presets 0.0.0-stage → 0.1.3
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 +21 -0
- package/README.md +300 -2
- package/README.zh.md +290 -0
- package/cordis.patch.yml +12 -0
- package/lib/client.js +7018 -0
- package/lib/index.js +1692 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +66 -0
- package/lib/typert.remote-client.d.ts +25 -0
- package/lib/typert.remote-client.js +60 -0
- package/lib/types/application.d.ts +72 -0
- package/lib/types/application.js +209 -0
- package/lib/types/client/ComposerTeamSelect.d.ts +15 -0
- package/lib/types/client/ComposerTeamSelect.js +31 -0
- package/lib/types/client/FieldPicker.d.ts +24 -0
- package/lib/types/client/FieldPicker.js +19 -0
- package/lib/types/client/TeamAgentView.d.ts +39 -0
- package/lib/types/client/TeamAgentView.js +62 -0
- package/lib/types/client/TeamEditorView.d.ts +32 -0
- package/lib/types/client/TeamEditorView.js +24 -0
- package/lib/types/client/TeamImportDialog.d.ts +27 -0
- package/lib/types/client/TeamImportDialog.js +59 -0
- package/lib/types/client/TeamListView.d.ts +32 -0
- package/lib/types/client/TeamListView.js +28 -0
- package/lib/types/client/TeamPresetsSection.d.ts +15 -0
- package/lib/types/client/TeamPresetsSection.js +179 -0
- package/lib/types/client/appearance.d.ts +20 -0
- package/lib/types/client/appearance.js +26 -0
- package/lib/types/client/index.d.ts +28 -0
- package/lib/types/client/index.js +84 -0
- package/lib/types/client/locales.d.ts +16 -0
- package/lib/types/client/locales.js +253 -0
- package/lib/types/client/preset-file.d.ts +25 -0
- package/lib/types/client/preset-file.js +46 -0
- package/lib/types/client/team-presets-controller.d.ts +424 -0
- package/lib/types/client/team-presets-controller.js +815 -0
- package/lib/types/config.d.ts +196 -0
- package/lib/types/config.js +86 -0
- package/lib/types/execution.d.ts +87 -0
- package/lib/types/execution.js +219 -0
- package/lib/types/index.d.ts +40 -0
- package/lib/types/index.js +247 -0
- package/lib/types/preset-editor.d.ts +76 -0
- package/lib/types/preset-editor.js +135 -0
- package/lib/types/preset-tools.d.ts +41 -0
- package/lib/types/preset-tools.js +453 -0
- package/lib/types/preset-transfer.d.ts +168 -0
- package/lib/types/preset-transfer.js +361 -0
- package/lib/types/presets.d.ts +111 -0
- package/lib/types/presets.js +213 -0
- package/lib/types/tool-catalog.d.ts +58 -0
- package/lib/types/tool-catalog.js +124 -0
- package/lib/types/types.d.ts +113 -0
- package/lib/types/types.js +9 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +115 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bloodarea
|
|
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
CHANGED
|
@@ -1,3 +1,301 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-agent-team-presets
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="banner.png" alt="Reusable Agent Team presets for DeepSeek Harness" width="100%">
|
|
4
|
+
|
|
5
|
+
English | [中文](README.zh.md)
|
|
6
|
+
|
|
7
|
+
> **Status: community plugin v0.1.3.** Install it with
|
|
8
|
+
> `dsh plugin --profile <profile> add github:bloodarea/dsh-agent-team-presets`.
|
|
9
|
+
> That floating form is the one the plugin market can offer updates for; to
|
|
10
|
+
> reproduce one exact release, pin the ref with `#v0.1.3` instead — a pinned
|
|
11
|
+
> install is compared only against that same ref, so the market never offers an
|
|
12
|
+
> update for it, by design.
|
|
13
|
+
> The supported Harness peer range is `>=0.2.0-rc.1 <0.3.0`, checked by the plugin
|
|
14
|
+
> manager; the Harness version is not this plugin's version. Plugin details for
|
|
15
|
+
> `dsh-agent-team-presets` should show `v0.1.3`. A card naming
|
|
16
|
+
> `@deepseek-ai/dsh-experimental-agent-team-presets` instead is the monorepo
|
|
17
|
+
> development package, whose version follows the Harness (for example,
|
|
18
|
+
> `0.2.0-rc.2`), not this community release. `lib/` ships prebuilt; rebuilding
|
|
19
|
+
> source needs a Harness checkout — see [DEVELOPMENT.md](DEVELOPMENT.md) and
|
|
20
|
+
> [CHANGELOG.md](CHANGELOG.md).
|
|
21
|
+
|
|
22
|
+
## Summary
|
|
23
|
+
|
|
24
|
+
`dsh-agent-team-presets` adds a Settings page that configures named Agent Teams and a composer control that applies one Team to a Session. A Team has a captain and any number of members: the captain carries its own prompt and tool policy, while each member also carries its own provider/model route and reasoning effort, read from the stored Team each time that member is summoned. Applying a Team installs the captain's prompt, restricts its tools, and registers `spawn_team_member`, which summons a member with that member's own persona, route, effort, and tools. A captain leads on the model the Session already selected.
|
|
25
|
+
|
|
26
|
+
<a id="project-introduction"></a>
|
|
27
|
+
## Project introduction
|
|
28
|
+
|
|
29
|
+
> Turn DeepSeek Harness Agent Teams from ad-hoc lineups into configurable, reusable professional AI teams.
|
|
30
|
+
|
|
31
|
+
**dsh-agent-team-presets** is a visual Agent Team preset manager for DeepSeek Harness. It configures roles, per-member models, reasoning effort, system prompts, and tool permissions, so a professional AI team is configured once and reused on demand.
|
|
32
|
+
|
|
33
|
+
<a id="why-this-plugin"></a>
|
|
34
|
+
## Why this plugin?
|
|
35
|
+
|
|
36
|
+
DeepSeek Harness already ships Agent Teams with multi-agent collaboration, but it leaves room in per-team configuration and reuse.
|
|
37
|
+
|
|
38
|
+
This plugin addresses five gaps:
|
|
39
|
+
|
|
40
|
+
- **Teams are hard to reuse.** Native teams focus on runtime creation and collaboration and offer no visual preset management; this plugin saves, duplicates, and reuses team configurations.
|
|
41
|
+
- **Role setup is repetitive.** Member responsibilities no longer have to be re-described every time: each role's name, description, and system prompt are configured in advance.
|
|
42
|
+
- **Splitting work across models is awkward.** Every member picks its own model and reasoning effort, so one team combines models by task; the captain keeps leading on the model the session already selected.
|
|
43
|
+
- **Tool permissions have no fine-grained entry point.** The captain and each member carry their own global tool allow-list, so roles differ in what they may use.
|
|
44
|
+
- **Switching teams is inconvenient.** Pick a preset team from the composer, with no repeated manual role setup.
|
|
45
|
+
|
|
46
|
+
**Design principle:** native Agent Teams owns collaboration at runtime; dsh-agent-team-presets owns configuring, managing, and reusing teams.
|
|
47
|
+
|
|
48
|
+
<a id="screenshots"></a>
|
|
49
|
+
## Screenshots
|
|
50
|
+
|
|
51
|
+
**The Team control in the composer** — apply one preset Team to this Session, or clear it.
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
**Settings → Agent team presets** — every configured Team, with create, duplicate, and delete.
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
**One Team** — its name and description, the captain, and the member roster.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
**One member** — its own provider, model, and reasoning effort. The captain leads on the Session model, so only a member carries a route.
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
**The model picker** — every provider and model the deployment currently advertises.
|
|
68
|
+
|
|
69
|
+

|
|
70
|
+
|
|
71
|
+
## Table of Contents
|
|
72
|
+
|
|
73
|
+
- [Project introduction](#project-introduction)
|
|
74
|
+
- [Why this plugin?](#why-this-plugin)
|
|
75
|
+
- [Screenshots](#screenshots)
|
|
76
|
+
- [Use this package](#use-this-package)
|
|
77
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
78
|
+
- [Further Exploration](#further-exploration)
|
|
79
|
+
- [Model Experience](#model-experience)
|
|
80
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
81
|
+
- [Dev Note](#dev-note)
|
|
82
|
+
|
|
83
|
+
-----
|
|
84
|
+
|
|
85
|
+
<a id="use-this-package"></a>
|
|
86
|
+
## Use this package
|
|
87
|
+
|
|
88
|
+
Install the bundle into a profile that already composes `@deepseek-ai/dsh-experimental-agent-team-profile` (the Team service, the Team tools, and the Web roster), then open Settings → Agent team presets.
|
|
89
|
+
|
|
90
|
+
### Install, upgrade, and verify the version
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
dsh plugin --profile <profile> add github:bloodarea/dsh-agent-team-presets
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Replace `<profile>` with the profile the GUI actually runs (for example, `web`).
|
|
97
|
+
This floating form is the one the plugin market can offer updates for: the market
|
|
98
|
+
compares the repository's `package.json` version against the installed one, so a
|
|
99
|
+
release is advertised when that version moves — a commit that does not bump it is
|
|
100
|
+
not offered. To reproduce one exact release instead, pin the ref:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
dsh plugin --profile <profile> add github:bloodarea/dsh-agent-team-presets#v0.1.3
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
A pinned install is compared only against that same ref, so the market never offers
|
|
107
|
+
an update for it, by design. To move a profile from the development link to this
|
|
108
|
+
release by hand, back up the profile and its Team configuration, remove the
|
|
109
|
+
installed package, then install this one into the same profile. If the old package
|
|
110
|
+
is the development link, remove `@deepseek-ai/dsh-experimental-agent-team-presets`,
|
|
111
|
+
not `dsh-agent-team-presets`.
|
|
112
|
+
Do not enable both packages: they own the same `agent-team-presets` settings and
|
|
113
|
+
client registrations. When migrating a development profile, keep the Team
|
|
114
|
+
configuration and selections under that entry id, but replace its module name
|
|
115
|
+
and the selected bundle with `dsh-agent-team-presets`.
|
|
116
|
+
|
|
117
|
+
After switching package identities, restart the running Harness and refresh the
|
|
118
|
+
GUI; a page refresh alone can leave the old client entry in the Host's module
|
|
119
|
+
table and produce duplicate-plugin boot failures. Verify the plugin details show
|
|
120
|
+
both `dsh-agent-team-presets` and `v0.1.3`, with its component running. The
|
|
121
|
+
Harness's own `0.2.0-rc.*` version is a separate compatibility requirement.
|
|
122
|
+
|
|
123
|
+
### Configure a Team
|
|
124
|
+
|
|
125
|
+
Settings → Agent team presets is three stacked pages, so a narrow Settings panel never crowds:
|
|
126
|
+
|
|
127
|
+
1. **Teams** — every configured Team as one row (name, member count, session model). Create, duplicate, or delete from here.
|
|
128
|
+
2. **One Team** — its name and description, the captain row, and the member roster. Adding a member opens that member's page.
|
|
129
|
+
3. **One agent** (captain or member) — identity, tools, and system prompt, each in its own card; a member page adds the model card and deletes that member.
|
|
130
|
+
|
|
131
|
+
Every edit is staged and written by the **Save** control in the shared footer; the stored value lives in the profile's user settings document. Settings accepts saves during a Team task without interrupting it. A Session is busy while its captain is `running` or any teammate is `running` or `provisioning`; its captain persona, briefing, member preset prompts and role descriptions, member tool description and roster, and tool permissions keep the applied definition, and members summoned during that task use that definition. A member's **model route** and each slot's **color** are deliberately outside the frozen definition, because both are read from the stored Team when they are needed: saving a corrected provider, model, or reasoning effort reaches the next member the running task summons without restarting it, and a color change redraws right away. Once the Session is fully idle, it adopts the latest saved definition before its next Team task; successive saves converge to the latest value. Sessions sharing a preset adopt it independently.
|
|
132
|
+
|
|
133
|
+
The footer reports the selected Team's execution state across online Sessions:
|
|
134
|
+
|
|
135
|
+
- **`idle`** — no Session is executing that Team's task; a save takes effect immediately.
|
|
136
|
+
- **`busy`** — at least one Session is executing; idle Sessions adopt a definition change immediately, while busy Sessions adopt it before their next task. A member's route saved meanwhile applies to the next member summoned, in a task already running as well. A teammate finishing does not release the definition while the captain is still running.
|
|
137
|
+
- **`unknown`** — execution cannot be confirmed, including before the stream is ready, after it ends or fails, during a connection loss, or when the Host lacks the method or a Team's state. The page does not treat a previous idle frame as current fact. A definition change still cannot affect a task already in progress, while a member's route saved meanwhile applies to the next member summoned.
|
|
138
|
+
|
|
139
|
+
| Field | Meaning |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Team name | Display name shown in Settings and in the composer control. |
|
|
142
|
+
| Captain | The agent that leads the Session: its system prompt becomes the Session prompt and its tool scope scopes the session tools. It leads on the model the Session already selected, so it has no route of its own. |
|
|
143
|
+
| Members | Role templates the captain summons by name. |
|
|
144
|
+
| Name | Display name; the teammate target is derived from it (lower-kebab-case, falling back to `member-<n>`). |
|
|
145
|
+
| Color | Accent mark shown in Settings. |
|
|
146
|
+
| Description | The role hint the models act on: the captain reads its own description, the Team description, and every member's description, so it can pick the member whose description fits the work; a summoned member reads the Team description and its own description as its role. |
|
|
147
|
+
| Provider / Model | **Members only.** Route chosen from every provider and model the deployment currently advertises. Empty runs the member on the Session route. |
|
|
148
|
+
| Reasoning effort | **Members only.** Adapter-owned effort for the selected route; empty uses the model default. |
|
|
149
|
+
| Allowed tools | Choose **Default: all tools** or **Custom allowed tools** separately for the captain and each member. Custom mode displays the deployment's global tools as an expanded checkbox grid, with select-all and clear controls. No checks in custom mode denies all configurable tools; default mode adds no restriction and preserves the saved checks. Captain and member policies apply independently, so a member can have tools the captain cannot use. Unavailable saved names remain removable; invalid names reject application instead of granting unrestricted access. Scoped coordination tools remain available. |
|
|
150
|
+
| System prompt | Registered as a prompt section template; complete `{{variable}}` groups interpolate against registered prompt variables. A summoned member reads it after its Team briefing. |
|
|
151
|
+
|
|
152
|
+
### Select a Team
|
|
153
|
+
|
|
154
|
+
The composer's team control sits in the tool row after the permission control. Picking a Team writes this Session's selection; an idle Session applies its captain prompt and tool scope immediately, while a busy Session keeps its current application until it is fully idle. Picking "No team" removes the Team application at the same boundary, restoring the Session's other prompt and tool contributions. The model stays the one the composer already shows, because no Team writes a model selection.
|
|
155
|
+
|
|
156
|
+
### Share one Team
|
|
157
|
+
|
|
158
|
+
**Export** on a Team row writes that Team as one fixed JSON document, and **Import preset** reads such a document. A shared document carries only what keeps working across deployments: the Team's name and purpose, and the name, description, system prompt, and color of its captain and each member. Model routes and tool permissions stay local, because they name this deployment's providers and tools; a document that carries them is refused instead of being silently trimmed.
|
|
159
|
+
|
|
160
|
+
An import matches by name. When the document's Team name is already configured, the dialog asks whether to **replace that team** or **add it under a new name**. When the captain name or a member name is already used by the Team being replaced, the same dialog asks, per name, whether to **replace that agent** or **add the imported one renamed**. A replacement writes only the fields the document carries, so the target Team keeps its model routes and tool permissions and keeps every member the document does not mention.
|
|
161
|
+
|
|
162
|
+
An import lands in the draft first, so it reaches the settings document only when you press **Save**; an export writes what the page currently shows, including an unsaved draft.
|
|
163
|
+
|
|
164
|
+
### Let the captain adjust a Team preset
|
|
165
|
+
|
|
166
|
+
The captain of a Session also holds two tools for the case this plugin exists for: a Team ran once, and the descriptions or prompts it ran with do not yet match the work.
|
|
167
|
+
|
|
168
|
+
- **`get_team_preset`** reads every editable field of this Session's Team (or of the Team a `team_id` names) with the current settings revision. When the Session selected no Team it reports `no-selection` and lists the configured Teams, so the captain asks the user which one to change instead of guessing.
|
|
169
|
+
- **`update_team_preset`** replaces `team_description`, `captain_description`, `captain_system_prompt`, and per-member `description` / `system_prompt`, fenced by the revision `get_team_preset` returned.
|
|
170
|
+
|
|
171
|
+
A successful tool write saves to the same settings document as the Settings page and follows the same per-Session adoption timing described above. A captain still running its current task keeps the old definition through its subsequent model steps. **An existing teammate keeps its creation-time description, persona, and tool filter**, including when resumed by a message; the updated preset supplies future new members after that Session adopts it. Send an existing teammate a new requirement to adjust its work without replacing its stored composition.
|
|
172
|
+
|
|
173
|
+
Both tools register in the Session-root Agent scope only, so a teammate never sees them, and the write additionally requires a turn the user started: an automatic continuation or a teammate's report cannot rewrite the shared preset. Names, member routes, and tool permissions are outside their reach — renaming changes a teammate target and collides with Agent Teams' permanent-name rule, so the Settings page owns it.
|
|
174
|
+
|
|
175
|
+
The tool's write policy differs from the Settings page: if any online Session that selected or still has that Team applied has a teammate `running` or `provisioning`, `update_team_preset` returns `team-busy` without saving. This conservative model-initiated write check counts teammates only, not the captain executing the tool; counting that captain would block every call. Wait for those teammates to finish, or interrupt them with `interrupt_agent`, then call `get_team_preset` again and retry with its revision. The running task keeps its original definition; the Settings page can still save changes for later adoption, and a member route saved there applies to the next member that task summons. `get_team_preset` reports the executing teammate count.
|
|
176
|
+
|
|
177
|
+
The tool also refuses a revision another writer advanced (re-read, retry) and a supplied standing prompt whose `{{variable}}` group cannot resolve. An unknown variable fails the request when the template is used rather than degrading it. Only prompts supplied by the call are checked, so an unrelated edit still succeeds on top of text the Settings page wrote.
|
|
178
|
+
|
|
179
|
+
<a id="understand-the-implementation"></a>
|
|
180
|
+
## Understand the implementation
|
|
181
|
+
|
|
182
|
+
### Host composition
|
|
183
|
+
|
|
184
|
+
The Host half owns the live configuration and the per-Session applications:
|
|
185
|
+
|
|
186
|
+
| File | Role |
|
|
187
|
+
|---|---|
|
|
188
|
+
| [`src/index.ts`](src/index.ts) | Plugin entry: live Config, per-Session definition freezing and adoption on Agent lifecycle, settings commits, and `team/member` settlements. |
|
|
189
|
+
| [`src/execution.ts`](src/execution.ts) | Event-driven execution monitor: captain and teammate status, applied-versus-stored definitions, and aggregate whole-set frames. |
|
|
190
|
+
| [`src/config.ts`](src/config.ts) | Volatile `teams` and `selections` fields, the continuable-provider names, and the captain-route cleanup of stored Teams. |
|
|
191
|
+
| [`src/application.ts`](src/application.ts) | Applies one Team to one live Agent: prompt sections, tool scope, and the `spawn_team_member` tool. |
|
|
192
|
+
| [`src/preset-editor.ts`](src/preset-editor.ts) | Pure preset edits behind the preset tools: the editable-field whitelist, member resolution, and the roster's description limit. |
|
|
193
|
+
| [`src/preset-tools.ts`](src/preset-tools.ts) | The captain's `get_team_preset` and `update_team_preset`, their authority checks, and the settings write. |
|
|
194
|
+
| [`src/presets.ts`](src/presets.ts) | Pure helpers shared with the browser half: teammate targets, member lookup, selection rewriting, roster text. |
|
|
195
|
+
| [`src/tool-catalog.ts`](src/tool-catalog.ts) | Host Remote service `teamPresetsToolCatalog`: restrictable global tools and the `teamPresets.execution` stream for the Settings page. |
|
|
196
|
+
| [`src/client/*`](src/client) | Browser half: the Settings page, the composer control, and the shared form controller. |
|
|
197
|
+
|
|
198
|
+
Applying a Team installs the captain's prompt as `deployment:persona-prefix` on the Agent's scope, so it shadows the deployment persona for that Session alone. The captain and each member resolve their own tool mode. A custom captain allow-list filters its global tools; a summoned member receives its own custom allow-list, independent of the captain's selection. A captain leads on the model the Session already selected, so this plugin writes no model selection at all: the composer's model control stays the only owner of that reference, and the rendered captain prompt is recorded as a `system/message` surface event before the request, so the model-visible input stays reconstructable from the Session log. The Host half also provides the `teamPresetsToolCatalog` Remote service, which lists exactly the global tools `ctx.tools.restrict()` validates against, so the Settings page cannot offer a name the summon path would refuse.
|
|
199
|
+
|
|
200
|
+
`teamPresets.execution` is a Remote stream of full snapshots: `{ teams: [{ teamId, state, busySessions, executingMembers, pendingSessions }] }`. Counts cover online Sessions that selected or still have the preset applied; `pendingSessions` counts Sessions with no application or an application that differs from the stored selection or frozen definition, leaving out a member route or a color the Session reads live. Frames carry Team identities and aggregate counts, not personas, Session names, or Session content. Lifecycle and settings events refresh the stream without polling; an unreadable roster reports `unknown` unless known activity already establishes `busy`.
|
|
201
|
+
|
|
202
|
+
### Selecting and storing
|
|
203
|
+
|
|
204
|
+
Teams and per-Session selections live in the plugin's volatile Config fields, which the settings service projects into the profile's user settings document and commits back into the running references with a `loader/volatile-update`. The browser half edits them through `ctx.configForms.get('agent-team-presets')`, so the Settings page and the composer control share one revision-fenced write queue. Each agent stores `toolMode` independently of `tools`. Records without `toolMode` retain their list-only behavior: an empty list means default-all and a nonempty list means custom. A stored captain that still carries `provider`, `model`, or `reasoningEffort` from a document written before captains stopped owning a route is rewritten once without them when the plugin loads.
|
|
205
|
+
|
|
206
|
+
### Per-teammate settings
|
|
207
|
+
|
|
208
|
+
`@deepseek-ai/dsh-experimental-agent-team` gained three optional `SpawnTeammateRequest` fields — `agentOptions` (provider, model, reasoning effort), `persona`, and `toolFilter` — and now records the requested member model in the durable member snapshot so a roster row names the model of a teammate that is not live. `spawn_team_member` passes them to `ctx.agentTeams.spawnTeammate`, so members stay inside the Team roster, mailbox, and shared task board.
|
|
209
|
+
|
|
210
|
+
### Runtime invariant
|
|
211
|
+
|
|
212
|
+
**Runtime invariant:** No companion is published. Every contribution is an ordinary Cordis registration on the Agent's scope, so disposing that scope already removes the prompt sections, the tool restriction, and the member tool; the assembled captain and member policies are covered by the production Loader composition test instead.
|
|
213
|
+
|
|
214
|
+
-----
|
|
215
|
+
|
|
216
|
+
<a id="further-exploration"></a>
|
|
217
|
+
## Further Exploration
|
|
218
|
+
|
|
219
|
+
- [Agent Teams subsystem](../../../docs/subsystems/agent-team.md) — the `ctx.agentTeams` service, roster, mailbox, and shared task board this package composes.
|
|
220
|
+
- [agent-team package](../agent-team/README.md) — the service, its durable types, and the `agentOptions`, `persona`, and `toolFilter` delegation fields.
|
|
221
|
+
- [tool-agent-team package](../tool-agent-team/README.md) — the tools the model uses to create, message, and coordinate teammates.
|
|
222
|
+
|
|
223
|
+
-----
|
|
224
|
+
|
|
225
|
+
<a id="model-experience"></a>
|
|
226
|
+
## Model Experience
|
|
227
|
+
|
|
228
|
+
### Captain and member prompts
|
|
229
|
+
|
|
230
|
+
#### What the model sees
|
|
231
|
+
|
|
232
|
+
The captain's system prompt replaces the deployment persona prefix for the Session, and one `agent-team-presets:briefing` section states the Team's purpose, the captain's own role, and one line per summonable member target with that member's description, so the captain can pick the member whose description fits the work. A summoned member receives its own persona prefix instead: the Team it joined, its own role, and its configured system prompt. All of it renders into the Session's `system/message`, so a resumed Session rebuilds it from the log.
|
|
233
|
+
|
|
234
|
+
##### Briefing section for a Team with one member
|
|
235
|
+
|
|
236
|
+
```markdown
|
|
237
|
+
Team preset "Review team" is active for this Session: Reviews changes before they land
|
|
238
|
+
|
|
239
|
+
You are its captain "team-lead": Keeps the review queue moving
|
|
240
|
+
|
|
241
|
+
Summon a member with spawn_team_member(member, task). The targets below are fixed; use them verbatim.
|
|
242
|
+
|
|
243
|
+
- member-1 (审查者): checks diffs
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
##### Persona prefix of the summoned member
|
|
247
|
+
|
|
248
|
+
```markdown
|
|
249
|
+
You are "member-1" (审查者) on the Agent Team "Review team": Reviews changes before they land
|
|
250
|
+
|
|
251
|
+
Your role: checks diffs
|
|
252
|
+
|
|
253
|
+
You review one diff at a time and report findings.
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### Token effect
|
|
257
|
+
|
|
258
|
+
Both sections add their own text to every request's system prompt for the Session. A Team whose captain states no name or description and which has no members adds nothing.
|
|
259
|
+
|
|
260
|
+
#### KV Cache effect
|
|
261
|
+
|
|
262
|
+
The applied Team's section templates stay unchanged during a running task, even when a newer preset is saved. Adopting a changed Team between tasks can rewrite the captain's prompt and briefing; actual cache reuse also depends on prompt variables and provider capabilities.
|
|
263
|
+
|
|
264
|
+
### `spawn_team_member`
|
|
265
|
+
|
|
266
|
+
#### What the model sees
|
|
267
|
+
|
|
268
|
+
One tool with `member`, `task`, `description`, and `context` parameters. The result is a compact JSON record naming the teammate target, its status, and its model.
|
|
269
|
+
|
|
270
|
+
#### Token effect
|
|
271
|
+
|
|
272
|
+
The tool schema and description join the Session's tool surface while a Team is applied.
|
|
273
|
+
|
|
274
|
+
#### KV Cache effect
|
|
275
|
+
|
|
276
|
+
The applied member roster and tool schema stay unchanged during a running task. Adopting a changed roster or tool policy between tasks can change the request's tools and affect cache reuse.
|
|
277
|
+
|
|
278
|
+
## Known Limitations and Deferred Work
|
|
279
|
+
|
|
280
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
281
|
+
|
|
282
|
+
- **Profile-global Team definitions with a per-Session selection record.** The selection is stored in the user settings document rather than in the Session log, so a forked or copied Session does not inherit it, and a Session re-applied on another machine needs the same settings document.
|
|
283
|
+
- **No Session-log record of the selection itself.** The captain's rendered prompt is logged; the Team identity is not, so a reader cannot tell which Team a Session used without the settings document.
|
|
284
|
+
- **Member system prompts are persona templates.** A member prompt containing an unknown `{{variable}}` fails that member's first request; the field warns before saving.
|
|
285
|
+
- **The allow-list masks global tools only.** A scoped registration such as the Team coordination tools (`send_message`, `team_task_*`) stays visible to a restricted agent, because `ctx.tools.restrict()` intersects global names and leaves scoped registrations in place. A member therefore keeps the tools it needs to answer its Lead.
|
|
286
|
+
- **The Session model is no part of a Team.** The captain leads on whatever model the composer selected, and only members carry a route, so editing a Team never changes your model.
|
|
287
|
+
- **Captains stored before this version lose their route once.** The plugin rewrites such a Team on load through the ordinary settings write, so the profile patch stops naming `provider`, `model`, and `reasoningEffort` on a captain.
|
|
288
|
+
- **Existing teammates retain their creation-time composition.** Applying a saved preset updates the captain and future new members, not existing teammates' description, persona, or tool filter; sending a new requirement adjusts work without replacing that composition.
|
|
289
|
+
- **Shared presets adopt per Session, and a route does not wait for that.** Settings saves do not change a running task's definition; the captain adopts the latest one when fully idle, before the next task. A member's route is read when that member is summoned, so a route corrected in Settings reaches the next member a running task summons without a restart. The captain's tool additionally refuses saves while any affected Session has a running or provisioning teammate, and requires a user-started turn.
|
|
290
|
+
|
|
291
|
+
-----
|
|
292
|
+
|
|
293
|
+
<a id="dev-note"></a>
|
|
294
|
+
### Dev Note
|
|
295
|
+
|
|
296
|
+
<details>
|
|
297
|
+
<summary>Maintainer details — click to expand</summary>
|
|
298
|
+
|
|
299
|
+
None.
|
|
300
|
+
|
|
301
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# dsh-agent-team-presets
|
|
2
|
+
|
|
3
|
+
<img src="banner_zh.png" alt="为 DeepSeek Harness 配置可复用的智能体团队预设" width="100%">
|
|
4
|
+
|
|
5
|
+
[English](README.md) | 中文
|
|
6
|
+
|
|
7
|
+
> **状态:社区插件 v0.1.3。** 安装:
|
|
8
|
+
> `dsh plugin --profile <profile> add github:bloodarea/dsh-agent-team-presets`。
|
|
9
|
+
> 只有这种浮动安装,插件市场才能提示更新;要复现某个确切版本,才用 `#v0.1.3` 固定 ref ——
|
|
10
|
+
> 带 ref 的安装只与同一个 ref 比对,市场因此永远不会为它提示更新(设计如此)。
|
|
11
|
+
> 支持的 Harness peer 范围为 `>=0.2.0-rc.1 <0.3.0`,由插件管理器校验;Harness 版本不是本插件版本。
|
|
12
|
+
> 包名为 `dsh-agent-team-presets` 的插件详情应显示 `v0.1.3`。
|
|
13
|
+
> 若卡片显示 `@deepseek-ai/dsh-experimental-agent-team-presets`,加载的是 monorepo 开发包,
|
|
14
|
+
> 其版本跟随 Harness(例如 `0.2.0-rc.2`),不是本社区发布版。
|
|
15
|
+
> `lib/` 已预构建,安装无需构建;重建源码需要 Harness 检出目录 —— 见
|
|
16
|
+
> [DEVELOPMENT.md](DEVELOPMENT.md) 与 [CHANGELOG.md](CHANGELOG.md)。
|
|
17
|
+
|
|
18
|
+
## 概述
|
|
19
|
+
|
|
20
|
+
`dsh-agent-team-presets` 增加一个 Settings 页面来配置具名 Agent Team,并增加一个 composer 控件把某个 Team 应用到会话。一个 Team 有一个 captain 和任意数量的成员:captain 携带自己的提示词与工具策略,而每个成员在此之外还携带自己的 provider/model 路由与推理强度,每次召唤该成员时都从存储的 Team 读取。应用一个 Team 会安装 captain 的提示词、限制其工具,并注册 `spawn_team_member`,它用该成员自己的 persona、路由、强度与工具召唤成员。captain 以会话已经选好的模型工作。
|
|
21
|
+
|
|
22
|
+
<a id="project-introduction"></a>
|
|
23
|
+
## 项目介绍
|
|
24
|
+
|
|
25
|
+
> 让 DeepSeek Harness 的 Agent Teams 从临时组队,升级为可配置、可复用的专业 AI 团队。
|
|
26
|
+
|
|
27
|
+
**dsh-agent-team-presets** 是一款面向 DeepSeek Harness 的可视化智能体团队预设管理插件,支持自定义角色、独立模型、推理等级、系统提示词与工具权限,让专业 AI 团队一次配置、随时复用。
|
|
28
|
+
|
|
29
|
+
<a id="why-this-plugin"></a>
|
|
30
|
+
## 为什么需要这个插件?
|
|
31
|
+
|
|
32
|
+
DeepSeek Harness 原生 Agent Teams 已经具备多智能体协作能力,但在团队的个性化配置与重复使用方面仍有提升空间。
|
|
33
|
+
|
|
34
|
+
本插件主要解决以下痛点:
|
|
35
|
+
|
|
36
|
+
- **团队难以复用**:原生团队侧重运行时创建与协作,缺少便捷的可视化团队预设管理;本插件支持保存、复制和复用团队配置。
|
|
37
|
+
- **角色配置繁琐**:无需每次重新描述成员职责,可提前设置每个角色的名称、描述和系统提示词。
|
|
38
|
+
- **多模型分工不便**:不同成员可独立指定模型与推理等级,按任务需求组合不同 AI 模型;队长继续使用当前会话选择的模型。
|
|
39
|
+
- **工具权限缺乏细粒度配置入口**:为队长和成员分别设置全局工具白名单,让不同角色拥有不同的工具使用范围。
|
|
40
|
+
- **团队切换不够便捷**:通过会话输入区快速选择预设团队,无需反复手动配置角色。
|
|
41
|
+
|
|
42
|
+
**核心理念:** 原生 Agent Teams 负责协作运行,dsh-agent-team-presets 负责团队的配置、管理与复用。
|
|
43
|
+
|
|
44
|
+
<a id="screenshots"></a>
|
|
45
|
+
## 界面预览
|
|
46
|
+
|
|
47
|
+
**对话框里的团队控件** —— 为本会话启用一个预设团队,或清除选择。
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
**设置 → 智能体团队预设** —— 列出全部已配置团队,可新建、复制、删除。
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
**单个团队** —— 团队名称与用途、队长,以及队员名单。
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
**单个队员** —— 自带提供商、模型与思考强度。队长使用会话当前模型,因此只有队员携带路由。
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
**模型选择器** —— 列出当前部署实际提供的全部提供商与模型。
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
## 目录
|
|
68
|
+
|
|
69
|
+
- [项目介绍](#project-introduction)
|
|
70
|
+
- [为什么需要这个插件?](#why-this-plugin)
|
|
71
|
+
- [界面预览](#screenshots)
|
|
72
|
+
- [使用本包](#use-this-package)
|
|
73
|
+
- [理解实现](#understand-the-implementation)
|
|
74
|
+
- [进一步探索](#further-exploration)
|
|
75
|
+
- [模型体验](#model-experience)
|
|
76
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
77
|
+
- [开发备注](#dev-note)
|
|
78
|
+
|
|
79
|
+
-----
|
|
80
|
+
|
|
81
|
+
<a id="use-this-package"></a>
|
|
82
|
+
## 使用本包
|
|
83
|
+
|
|
84
|
+
把该 bundle 安装到已组合 `@deepseek-ai/dsh-experimental-agent-team-profile`(Team 服务、Team 工具与 Web roster)的 profile 中,然后打开 Settings → Agent team presets。
|
|
85
|
+
|
|
86
|
+
### 安装、升级与版本确认
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
dsh plugin --profile <profile> add github:bloodarea/dsh-agent-team-presets
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
把 `<profile>` 替换为 GUI 实际运行的 profile(例如 `web`)。只有这种浮动安装,插件市场才能
|
|
93
|
+
提示更新:它把仓库 `package.json` 的版本号与已安装版本比较,所以只有版本号变动才会被提示
|
|
94
|
+
(只推 commit、不 bump 版本不会被提示)。要复现某个确切版本,才固定 ref:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
dsh plugin --profile <profile> add github:bloodarea/dsh-agent-team-presets#v0.1.3
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
带 ref 的安装只与同一个 ref 比对,市场因此永远不会为它提示更新(设计如此)。
|
|
101
|
+
手工把 profile 从开发链接迁移到本发布版:先备份 profile 与团队配置,再移除已安装包,
|
|
102
|
+
然后在同一 profile 安装本包。若旧包是开发链接,应移除
|
|
103
|
+
`@deepseek-ai/dsh-experimental-agent-team-presets`,而不是 `dsh-agent-team-presets`。
|
|
104
|
+
不要同时启用两个包:它们共享 `agent-team-presets`
|
|
105
|
+
设置入口与客户端注册。迁移开发 profile 时,保留该入口 id 下的团队配置和会话选择记录,
|
|
106
|
+
将模块名与启用的 bundle 改为 `dsh-agent-team-presets`。
|
|
107
|
+
|
|
108
|
+
切换包身份后,重启正在运行的 Harness 并刷新 GUI;仅刷新页面可能仍保留 Host 模块表中的旧
|
|
109
|
+
客户端入口,造成重复插件启动失败。确认插件详情同时显示 `dsh-agent-team-presets` 和
|
|
110
|
+
`v0.1.3`,且组件处于运行中。Harness 自身的 `0.2.0-rc.*` 是另一套兼容版本要求。
|
|
111
|
+
|
|
112
|
+
### 配置一个 Team
|
|
113
|
+
|
|
114
|
+
Settings → Agent team presets 是三个层叠页面,因此狭窄的 Settings 面板不会拥挤:
|
|
115
|
+
|
|
116
|
+
1. **Teams** —— 每个已配置的 Team 占一行(名称、成员数、会话模型)。在此创建、复制或删除。
|
|
117
|
+
2. **One Team** —— 它的名称与描述、captain 行以及成员 roster。添加成员会打开该成员的页面。
|
|
118
|
+
3. **One agent**(captain 或成员)—— 身份、工具与系统提示词各占一张卡片;成员页面额外有模型卡片,并可删除该成员。
|
|
119
|
+
|
|
120
|
+
每次编辑都先在共享页脚中暂存,再由 **Save** 控件写入;存储值保存在 profile 的用户设置文档中。Settings 在团队任务进行中仍接受保存,不会中断任务。只要会话的 captain 为 `running`,或任一 teammate 为 `running` / `provisioning`,该会话就处于执行中;队长 persona、briefing、成员预设提示词与角色描述、成员工具描述与名单、工具权限均保持已应用的定义,任务期间新召唤的成员也使用该定义。成员的**模型路由**与每个槽位的**颜色**被有意排除在这份冻结定义之外,因为二者在需要时才从存储的 Team 读取:修正后的 provider、模型或推理强度会被进行中的任务在下次召唤成员时直接采用,无需重启任务;颜色改动也会立即重绘。会话整体空闲后,在下一次团队任务开始前采用最新保存的定义;连续保存以最新值为准。共享同一预设的会话分别采用。
|
|
121
|
+
|
|
122
|
+
页脚汇总在线会话,报告所选 Team 的执行状态:
|
|
123
|
+
|
|
124
|
+
- **`idle`** —— 当前没有会话在执行该团队任务,保存后立即生效。
|
|
125
|
+
- **`busy`** —— 至少一个会话正在执行;空闲会话立即采用定义修改,执行中的会话在下一次任务前采用。执行期间保存的成员路由会在下次召唤该成员时生效,进行中的任务同样适用。只要队长仍在运行,队员结束就不会解除定义冻结。
|
|
126
|
+
- **`unknown`** —— 无法确认是否执行中,包括流尚未就绪、结束或失败、连接中断,或 Host 缺少该方法或某个 Team 的状态。页面不会把先前的空闲帧当成当前事实。定义修改仍不会改变进行中的任务,而执行期间保存的成员路由会在下次召唤时生效。
|
|
127
|
+
|
|
128
|
+
| 字段 | 含义 |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Team 名称 | 在 Settings 与 composer 控件中显示的名称。 |
|
|
131
|
+
| Captain | 主持该会话的 agent:它的系统提示词成为会话提示词,它的工具作用域作用于会话工具。它以会话已经选好的模型工作,因此没有自己的路由。 |
|
|
132
|
+
| Members | captain 按名称召唤的角色模板。 |
|
|
133
|
+
| 名称 | 显示名;teammate target 由它派生(lower-kebab-case,回退为 `member-<n>`)。 |
|
|
134
|
+
| 颜色 | 在 Settings 中显示的强调色标记。 |
|
|
135
|
+
| 描述 | 模型据此行动的角色提示:队长会读到队长自己的描述、团队描述以及每个成员的描述,从而挑选描述最合适的成员;被召唤的成员会读到团队描述与自己的描述作为角色。 |
|
|
136
|
+
| Provider / Model | **仅成员。** 从部署当前公布的所有 provider 与模型中选出的路由。留空则让该成员沿用会话路由。 |
|
|
137
|
+
| 推理强度 | **仅成员。** 所选路由的适配器自有强度;留空则使用模型默认值。 |
|
|
138
|
+
| 允许的工具 | 为 captain 和每个成员分别选择 **Default: all tools** 或 **Custom allowed tools**。自定义模式把部署的全局工具显示为展开的复选框网格,并提供全选与清空控件。自定义模式下不勾选任何工具会拒绝所有可配置工具;默认模式不增加任何限制,并保留已保存的勾选。captain 与成员策略相互独立,因此成员可以拥有 captain 无法使用的工具。已保存但不可用的名称仍可移除;无效名称会拒绝应用,而不是放开为不受限访问。作用域内的协调工具仍然可用。 |
|
|
139
|
+
| 系统提示词 | 注册为提示词区段模板;完整的 `{{variable}}` 组会按已注册的提示词变量插值。被召唤的成员会在其团队 briefing 之后读到它。 |
|
|
140
|
+
|
|
141
|
+
### 选择一个 Team
|
|
142
|
+
|
|
143
|
+
composer 的 team 控件位于工具行中、权限控件之后。选择某个 Team 会写入该会话的选择记录;空闲会话立即应用其 captain 提示词与工具作用域,执行中的会话保留当前应用,直到整体空闲。选择 "No team" 也在同一时机移除 Team 应用,恢复会话的其他提示词与工具贡献。模型仍是 composer 已经显示的那一个,因为没有任何 Team 会写入模型选择。
|
|
144
|
+
|
|
145
|
+
### 分享单个 Team
|
|
146
|
+
|
|
147
|
+
团队行上的 **导出** 把该 Team 写成一份固定的 JSON 文档,**导入预设** 读取这样一份文档。共享文档只携带可跨部署复用的内容:团队名称与用途,以及队长和每个队员的名称、描述、系统提示词与颜色标记。模型路由与工具权限留在本地,因为它们指向本部署的提供商与工具;携带这些字段的文档会被拒绝,而不是被静默裁剪。
|
|
148
|
+
|
|
149
|
+
导入按名称匹配。文档的团队名已经配置过时,对话框询问是**替换该团队**还是**改名后新增**。队长名或队员名与目标团队重复时,同一个对话框逐个询问:**替换该队员**,或把导入的成员**改名后新增**。替换只写入文档携带的字段,因此目标团队保留自己的模型路由与工具权限,也保留文档未提到的每个队员。
|
|
150
|
+
|
|
151
|
+
导入结果先进入草稿,只有点击 **Save** 才会写入设置文档;导出写的是当前页面显示的内容,包括尚未保存的草稿。
|
|
152
|
+
|
|
153
|
+
### 让队长调整 Team 预设
|
|
154
|
+
|
|
155
|
+
会话的 captain 另外持有两个工具,用于本插件真正要解决的情形:Team 已经跑过一次,而它当时的描述或提示词还不对得上实际工作。
|
|
156
|
+
|
|
157
|
+
- **`get_team_preset`** —— 读出本会话 Team(或 `team_id` 指定的 Team)的全部可编辑字段,以及设置文档当前的修订号。会话尚未选择 Team 时,它报告 `no-selection` 并列出所有已配置 Team,因此 captain 会向用户询问要改哪一个,而不是自行猜测。
|
|
158
|
+
- **`update_team_preset`** —— 替换 `team_description`、`captain_description`、`captain_system_prompt`,以及每个成员的 `description` / `system_prompt`,并以 `get_team_preset` 返回的修订号作为写入围栏。
|
|
159
|
+
|
|
160
|
+
工具成功写入时,保存的是 Settings 页面编辑的同一份设置文档,并遵循上文按会话采用的时机。captain 若仍在执行当前任务,后续模型步骤继续使用旧定义。**已有 teammate 保留创建时的描述、persona 与工具过滤器**,即使通过消息唤醒也不变;会话采用新预设后,未来新建的成员才使用新定义。要调整已有 teammate 的工作,可发送新要求,而不替换其已存储的组合。
|
|
161
|
+
|
|
162
|
+
两个工具只注册在会话根 Agent(captain)的作用域内,teammate 看不到它们;写入还要求当前回合带有用户直接发起的输入,因此自动续跑或 teammate 汇报的回合无法改写这份共享预设。名称、成员路由与工具权限不在它们的编辑范围内 —— 改名会改变 teammate target 并撞上 Agent Teams 的名称永久占用规则,因此这件事仍由 Settings 页面负责。
|
|
163
|
+
|
|
164
|
+
工具的写入策略与 Settings 页面不同:只要选中或仍应用该 Team 的任一在线会话还有 `running` / `provisioning` 的 teammate,`update_team_preset` 就返回 `team-busy`,不保存。这项保守的模型发起写入检查只统计 teammate,不统计正在执行工具的 captain;否则每次调用都会自我阻塞。等待这些队员结束,或用 `interrupt_agent` 中断它们,然后再次调用 `get_team_preset`,用其修订号重试。进行中的任务保持原定义;Settings 页面仍可保存供之后采用的修改,且在那里保存的成员路由会在该任务下次召唤成员时生效。`get_team_preset` 会报告正在执行的队员数。
|
|
165
|
+
|
|
166
|
+
工具还会拒绝被其他写入者推进的修订号(重新读取后重试),以及本次提交的常驻提示词中无法解析的 `{{variable}}` 组。未知变量会在模板被使用时使请求失败,而不是降级。校验只针对本次调用提交的提示词,因此对 Settings 页面写入的既有文本不会造成无关编辑被拒。
|
|
167
|
+
|
|
168
|
+
<a id="understand-the-implementation"></a>
|
|
169
|
+
## 理解实现
|
|
170
|
+
|
|
171
|
+
### Host 组合
|
|
172
|
+
|
|
173
|
+
Host 半边拥有实时配置与按会话的应用:
|
|
174
|
+
|
|
175
|
+
| 文件 | 作用 |
|
|
176
|
+
|---|---|
|
|
177
|
+
| [`src/index.ts`](src/index.ts) | 插件入口:实时 Config,依据 Agent 生命周期、设置提交与 `team/member` 结算,按会话冻结与采用定义。 |
|
|
178
|
+
| [`src/execution.ts`](src/execution.ts) | 事件驱动的执行状态监控:队长与队员状态、已应用与已存储定义的比较,以及聚合全量帧。 |
|
|
179
|
+
| [`src/config.ts`](src/config.ts) | 易变的 `teams` 与 `selections` 字段、continuable provider 名称,以及存储 Team 的 captain 路由清理。 |
|
|
180
|
+
| [`src/application.ts`](src/application.ts) | 把一个 Team 应用到一个活动 Agent:提示词区段、工具作用域与 `spawn_team_member` 工具。 |
|
|
181
|
+
| [`src/preset-editor.ts`](src/preset-editor.ts) | 预设工具背后的纯编辑逻辑:可编辑字段白名单、成员解析与 roster 的描述长度上限。 |
|
|
182
|
+
| [`src/preset-tools.ts`](src/preset-tools.ts) | captain 的 `get_team_preset` 与 `update_team_preset`、它们的授权检查,以及设置写入。 |
|
|
183
|
+
| [`src/presets.ts`](src/presets.ts) | 与浏览器半边共享的纯函数:teammate target、成员查找、选择记录改写、roster 文本。 |
|
|
184
|
+
| [`src/tool-catalog.ts`](src/tool-catalog.ts) | Host Remote 服务 `teamPresetsToolCatalog`:可限制的全局工具,以及供 Settings 页面使用的 `teamPresets.execution` 流。 |
|
|
185
|
+
| [`src/client/*`](src/client) | 浏览器半边:Settings 页面、composer 控件与共享表单控制器。 |
|
|
186
|
+
|
|
187
|
+
应用一个 Team 会把 captain 的提示词作为 `deployment:persona-prefix` 安装到该 Agent 的作用域上,因此它只遮蔽该会话的部署 persona。captain 与每个成员各自解析自己的工具模式。自定义的 captain 允许列表会过滤其全局工具;被召唤的成员收到自己的自定义允许列表,与 captain 的选择无关。captain 以会话已经选好的模型工作,因此本插件完全不写入模型选择:该引用始终只由 composer 的模型控件拥有,而渲染后的 captain 提示词会在请求之前记录为 `system/message` 表层事件,因此模型可见输入始终可以从会话日志重建。 Host 半边还提供 `teamPresetsToolCatalog` Remote 服务,它列出的正是 `ctx.tools.restrict()` 校验所依据的全局工具,因此 Settings 页面不会给出 summon 路径会拒绝的名字。
|
|
188
|
+
|
|
189
|
+
`teamPresets.execution` 是发送全量快照的 Remote 流:`{ teams: [{ teamId, state, busySessions, executingMembers, pendingSessions }] }`。计数覆盖选中或仍应用该预设的在线会话;`pendingSessions` 统计尚无应用,或已应用内容与已存储选择或冻结定义不同的会话,会话实时读取的成员路由与颜色不计入。帧仅携带 Team 身份与聚合计数,不传 persona、会话名称或会话内容。生命周期与设置事件刷新流,无需轮询;无法读取 roster 时报告 `unknown`,但已有确定的执行活动时报告 `busy`。
|
|
190
|
+
|
|
191
|
+
### 选择与存储
|
|
192
|
+
|
|
193
|
+
Team 与按会话的选择记录保存在插件的易变 Config 字段中;settings 服务把它们投射到 profile 的用户设置文档,并通过 `loader/volatile-update` 提交回运行中的引用。浏览器半边通过 `ctx.configForms.get('agent-team-presets')` 编辑它们,因此 Settings 页面与 composer 控件共享同一个按修订号围栏的写入队列。每个 agent 独立于 `tools` 存储 `toolMode`。缺少 `toolMode` 的记录保留其仅列表的行为:空列表表示 default-all,非空列表表示 custom。若存储的 captain 仍带着 captain 不再拥有的 `provider`、`model` 或 `reasoningEffort`(来自更早的文档),插件会在加载时把它们清掉并回写一次。
|
|
194
|
+
|
|
195
|
+
### 按 teammate 的设置
|
|
196
|
+
|
|
197
|
+
`@deepseek-ai/dsh-experimental-agent-team` 增加了三个可选的 `SpawnTeammateRequest` 字段 —— `agentOptions`(provider、model、推理强度)、`persona` 与 `toolFilter` —— 并且现在把请求的成员模型记录到持久成员快照中,因此 roster 行可以为一个不在线的 teammate 命名其模型。`spawn_team_member` 把它们传给 `ctx.agentTeams.spawnTeammate`,因此成员始终留在 Team roster、mailbox 与共享任务板之内。
|
|
198
|
+
|
|
199
|
+
### 运行时不变式
|
|
200
|
+
|
|
201
|
+
**运行时不变式:** 不发布 companion。每一项贡献都是 Agent 作用域上的普通 Cordis 注册,因此销毁该作用域就已经移除提示词区段、工具限制与成员工具;组装后的 captain 与成员策略改由生产 Loader 组合测试覆盖。
|
|
202
|
+
|
|
203
|
+
-----
|
|
204
|
+
|
|
205
|
+
<a id="further-exploration"></a>
|
|
206
|
+
## 进一步探索
|
|
207
|
+
|
|
208
|
+
- [Agent Teams 子系统](../../../docs/subsystems/agent-team.zh.md) —— 本包所组合的 `ctx.agentTeams` 服务、roster、mailbox 与共享任务板。
|
|
209
|
+
- [agent-team 包](../agent-team/README.zh.md) —— 该服务、其持久类型,以及 `agentOptions`、`persona` 与 `toolFilter` 委派字段。
|
|
210
|
+
- [tool-agent-team 包](../tool-agent-team/README.zh.md) —— 模型用来创建、发消息并协调 teammate 的工具。
|
|
211
|
+
|
|
212
|
+
-----
|
|
213
|
+
|
|
214
|
+
<a id="model-experience"></a>
|
|
215
|
+
## 模型体验
|
|
216
|
+
|
|
217
|
+
### Captain 与成员的提示词
|
|
218
|
+
|
|
219
|
+
#### 模型看到什么
|
|
220
|
+
|
|
221
|
+
captain 的系统提示词取代该会话的部署 persona 前缀,而一个 `agent-team-presets:briefing` 区段陈述团队用途、captain 自己的角色,以及每个可召唤成员 target 及其描述 —— 队长据此挑选描述最合适的成员。被召唤的成员则收到自己的 persona 前缀:它加入的团队、它自己的角色,以及它配置的系统提示词。全部渲染进会话的 `system/message`,因此恢复的会话会从日志重建它们。
|
|
222
|
+
|
|
223
|
+
##### 含一个成员的 Team 的 briefing 区段
|
|
224
|
+
|
|
225
|
+
```markdown
|
|
226
|
+
Team preset "Review team" is active for this Session: Reviews changes before they land
|
|
227
|
+
|
|
228
|
+
You are its captain "team-lead": Keeps the review queue moving
|
|
229
|
+
|
|
230
|
+
Summon a member with spawn_team_member(member, task). The targets below are fixed; use them verbatim.
|
|
231
|
+
|
|
232
|
+
- member-1 (审查者): checks diffs
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
##### 被召唤成员的 persona 前缀
|
|
236
|
+
|
|
237
|
+
```markdown
|
|
238
|
+
You are "member-1" (审查者) on the Agent Team "Review team": Reviews changes before they land
|
|
239
|
+
|
|
240
|
+
Your role: checks diffs
|
|
241
|
+
|
|
242
|
+
You review one diff at a time and report findings.
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Token 影响
|
|
246
|
+
|
|
247
|
+
两个区段都会把各自的文本加入该会话每次请求的系统提示词。空的 captain 提示词与没有成员的 Team 不增加任何内容。
|
|
248
|
+
|
|
249
|
+
#### KV Cache 影响
|
|
250
|
+
|
|
251
|
+
即使保存了更新的预设,执行中任务所应用的 Team 区段模板也保持不变。在任务之间采用变更后的 Team 时,队长提示词与 briefing 可能被重写;实际缓存复用还取决于提示词变量与提供商能力。
|
|
252
|
+
|
|
253
|
+
### `spawn_team_member`
|
|
254
|
+
|
|
255
|
+
#### 模型看到什么
|
|
256
|
+
|
|
257
|
+
一个带有 `member`、`task`、`description` 与 `context` 参数的工具。结果是紧凑的 JSON 记录,命名 teammate target、其状态与模型。
|
|
258
|
+
|
|
259
|
+
#### Token 影响
|
|
260
|
+
|
|
261
|
+
在应用 Team 期间,该工具 schema 与描述加入会话的工具表。
|
|
262
|
+
|
|
263
|
+
#### KV Cache 影响
|
|
264
|
+
|
|
265
|
+
执行中的任务所应用的成员名单与工具 schema 保持不变。在任务之间采用变更后的名单或工具策略时,请求中的工具可能变化,并影响缓存复用。
|
|
266
|
+
|
|
267
|
+
## 已知限制与延期工作
|
|
268
|
+
|
|
269
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
270
|
+
|
|
271
|
+
- **Team 定义是 profile 全局的,而选择记录是按会话的。** 该选择保存在用户设置文档而不是会话日志中,因此 fork 或复制的会话不会继承它,而在另一台机器上重新应用某个会话需要同一份设置文档。
|
|
272
|
+
- **选择本身没有会话日志记录。** captain 的渲染提示词会被记录;Team 身份不会,因此读者无法在没有设置文档的情况下判断某个会话用过哪个 Team。
|
|
273
|
+
- **成员系统提示词是 persona 模板。** 成员的提示词若包含未知 `{{variable}}`,该成员的首次请求会失败;字段会在保存前给出警告。
|
|
274
|
+
- **允许列表只遮蔽全局工具。** 诸如 Team 协调工具(`send_message`、`team_task_*`)这样的作用域注册对受限 agent 仍然可见,因为 `ctx.tools.restrict()` 只对全局名称取交集,而保留作用域注册。因此成员仍保留其答复 Lead 所需的工具。
|
|
275
|
+
- **会话模型不属于 Team。** captain 以 composer 选定的那个模型工作,只有成员带路由,因此编辑 Team 永远不会改动你的模型。
|
|
276
|
+
- **本版本之前保存的 captain 会一次性失去其路由。** 插件在加载时通过常规设置写入重写这样的 Team,因此 profile 补丁不再在 captain 上写出 `provider`、`model` 与 `reasoningEffort`。
|
|
277
|
+
- **已有 teammate 保留创建时的组合。** 应用保存的预设会更新 captain 与未来新建的成员,不会更新已有 teammate 的描述、persona 或工具过滤器;发送新要求可调整工作,但不会替换该组合。
|
|
278
|
+
- **共享预设按会话采用,成员路由无需等待。** Settings 保存不改变进行中任务的定义;captain 在会话整体空闲后、下次任务前采用最新定义。成员路由在该成员被召唤时读取,因此在 Settings 修正路由后,进行中的任务下次召唤成员即可使用,无需重启。队长工具还会在任一受影响会话有 running / provisioning 的 teammate 时拒绝保存,并要求用户直接发起的轮次。
|
|
279
|
+
|
|
280
|
+
-----
|
|
281
|
+
|
|
282
|
+
<a id="dev-note"></a>
|
|
283
|
+
### 开发备注
|
|
284
|
+
|
|
285
|
+
<details>
|
|
286
|
+
<summary>维护者细节——点击展开</summary>
|
|
287
|
+
|
|
288
|
+
无。
|
|
289
|
+
|
|
290
|
+
</details>
|