@sshirkit/dsh-orchestrator 0.8.7 → 0.9.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/README.md +13 -39
- package/README.zh.md +13 -39
- package/lib/delegate.js +12 -24
- package/lib/orchestrate.js +18 -27
- package/lib/rules.js +11 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
**A powerful model plans, low-cost models do the work — the dispatch mode plugin with hard tool isolation for DeepSeek Harness**
|
|
12
|
+
#### **A powerful model plans, low-cost models do the work — the dispatch mode plugin with hard tool isolation for DeepSeek Harness**
|
|
13
13
|
|
|
14
|
-
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
15
15
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
16
16
|
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
17
17
|
[](https://nodejs.org)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
[](https://github.com/SShiRkiT/dsh-orchestrator/stargazers)
|
|
21
21
|
[](https://www.npmjs.com/package/@sshirkit/dsh-orchestrator)
|
|
22
22
|
|
|
23
|
-
**English** | [简体中文](README.zh.md) · [Key differences](#why-do-you-need-this-plugin-alongside-native-subagent-and-agent-team) · [Core Features](#core-features) · [Installation](#installation) · [
|
|
23
|
+
**English** | [简体中文](README.zh.md) · [Key differences](#why-do-you-need-this-plugin-alongside-native-subagent-and-agent-team) · [Core Features](#core-features) · [Installation](#installation) · [Configuration](#configuration) · [Contributing & Community](#contributing--community)
|
|
24
24
|
|
|
25
25
|
</div>
|
|
26
26
|
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
In the dedicated **Dispatch mode panel** below the composer, the main-agent and subagent model routes are fully independent:
|
|
36
36
|
- **Main Agent**: choose your strongest flagship model to focus on clarifying requirements, splitting tasks, correcting course, and accepting final results.
|
|
37
37
|
- > For example, `gpt-astra-6` or `claude-opus-5.5`
|
|
38
|
-
- **Subagent**: choose a
|
|
38
|
+
- **Subagent**: choose a slightly less capable but very inexpensive model with high throughput. **Every Worker launched through `delegate` or `orchestrate` must share this low-cost route**
|
|
39
39
|
- > For example, `deepseek-v4.1-flash` or `gpt-luna-6`
|
|
40
|
-
- **
|
|
40
|
+
- **Anti-burn protection**: dispatch fails with an error if no subagent model is configured
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
## In your `prompt` or `AGENTS.md`, you can instruct the main agent in the current workspace to pass `provider` / `model` parameters when dispatching subagents, specifying which model to use for the current `session` \ `workspace`
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|

|
|
@@ -50,15 +50,15 @@ Instead of relying on prompts asking the main model to use subagents more often,
|
|
|
50
50
|
- **Main Agent stripped of all execution tools**:
|
|
51
51
|
<div align="center">
|
|
52
52
|
|
|
53
|
-
>
|
|
53
|
+
> ### DEFAULT_ALLOWED_TOOLS permits only 12 planning, delegation, and read-only session tools by default
|
|
54
54
|
>
|
|
55
55
|
> _`delegate`, `orchestrate`, `send_message`, `interrupt_agent`, `todo_write`, `ask_user_question`, `compress`, and five read-only session log tools._
|
|
56
56
|
>
|
|
57
|
-
>
|
|
57
|
+
> ### All file access, search, and terminal tools, plus any future MCP or third-party plugin tools, are automatically hidden and blocked at execution time
|
|
58
58
|
>
|
|
59
|
-
>
|
|
59
|
+
>_(`read` / `edit` / `write` / `apply_patch`), (`grep` / `glob`), (`bash` / `pwsh`), `subagent` / `workflow`_
|
|
60
60
|
>
|
|
61
|
-
>
|
|
61
|
+
> ### Even nested calls through run_code are blocked. To allow additional tools, check them under Allowed Tools on the right of the panel.
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
64
|
- **Subagents retain the full toolchain**: dispatched Workers are exempt from the gate and read or write files, run tests, and inspect errors in their own contexts. When finished, they return only a concise conclusion for the main agent to review.
|
|
@@ -93,9 +93,8 @@ Low-cost Subagents can occasionally get stuck on complex shell escaping or error
|
|
|
93
93
|
---
|
|
94
94
|
<div align="center">
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
### Why Do You Need This Plugin Alongside Native `subagent` and `Agent Team`?
|
|
97
97
|
</div>
|
|
98
|
-
|
|
99
98
|
DSH includes native `subagent` / `workflow` tools, and the official `@deepseek-ai/dsh-experimental-agent-team-profile` (Agent Team) is also available. However, intensive development still exposes three pain points — the problems at the heart of **DSH Orchestrator**'s distinctive design:
|
|
100
99
|
|
|
101
100
|
| Pain point | Native `subagent` / official `Agent Team` | DSH Orchestrator (unique to this plugin) |
|
|
@@ -114,7 +113,7 @@ DSH includes native `subagent` / `workflow` tools, and the official `@deepseek-a
|
|
|
114
113
|
|
|
115
114
|
| Item | Requirement |
|
|
116
115
|
| --- | --- |
|
|
117
|
-
| **Host environment** | DeepSeek Harness Desktop / Web GUI
|
|
116
|
+
| **Host environment** | DeepSeek Harness Desktop / Web GUI |
|
|
118
117
|
| **Node.js** | `>= 22` (bundled with the DSH Desktop runtime) |
|
|
119
118
|
| **Plugin form** | Cordis backend service patch (`cordis.patch.yml`) + Web GUI client extension (`lib/client.js`) |
|
|
120
119
|
| **UI language** | Adapts to Chinese / English (`zh-CN` / `en-US`) |
|
|
@@ -128,7 +127,7 @@ DSH includes native `subagent` / `workflow` tools, and the official `@deepseek-a
|
|
|
128
127
|
|
|
129
128
|
| Plugin version | Supported DSH host | Notes |
|
|
130
129
|
| --- | --- | --- |
|
|
131
|
-
| `@sshirkit/dsh-orchestrator >= 0.8.3` (current version: `0.8.
|
|
130
|
+
| `@sshirkit/dsh-orchestrator >= 0.8.3` (current version: `0.8.8`) | **DSH `>= 0.2.2-rc.2 < 0.2.3-0`** | Verified against `0.2.2-rc.2` / `0.2.2-rc.3`. Since `0.2.2-rc.2`, the host has flattened the subagent spec, removed the `Symbol.for('dsh.subagent.deliverPrompt')` delivery entry point and `agents.roots()`, and added the `wait_agent` tool. It is therefore **incompatible with `0.2.2-rc.1` and earlier**. Note: although the host adds `wait_agent`, the plugin **intentionally keeps its default whitelist at 12 tools and excludes `wait_agent`**. Blocking polling can leave the main agent idling and misjudging timeouts; supervision already replaces polling with one summary plus one decision. If needed, allow it manually in the panel's `allowedTools` list. |
|
|
132
131
|
| `dsh-orchestrator 0.8.0 – 0.8.2` | **DSH `<= 0.2.2-rc.1`** | Tested against `0.2.1-rc.3` and `0.2.2-rc.1`. Since `0.8.0`, the plugin has depended on `@deepseek-ai/dsh-tools`. |
|
|
133
132
|
| `dsh-orchestrator <= 0.7.3` | DSH releases predating plugin `0.8.0` | Early standalone tool-registration architecture, without a dependency on `@deepseek-ai/dsh-tools`. |
|
|
134
133
|
|
|
@@ -163,21 +162,6 @@ dsh plugin --profile desktop add @sshirkit/dsh-orchestrator
|
|
|
163
162
|
|
|
164
163
|
<div align="center">
|
|
165
164
|
|
|
166
|
-
## Quick Verification
|
|
167
|
-
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
After installing the plugin and restarting DSH, open the **Dispatch** settings panel below the message composer and make sure **Enable dispatch mode** is on.
|
|
171
|
-
|
|
172
|
-
1. Select a `Provider` and `Model` for subagents. Both are required for the default route. Delegation stops with an error if either is missing.
|
|
173
|
-
2. Start a new session and send a short read-only request.
|
|
174
|
-
|
|
175
|
-
> Delegate a read-only task to one subagent. Ask it to list the files in the current working directory and summarize what it finds for me.
|
|
176
|
-
|
|
177
|
-
3. Check the tool call history. The main agent should call only `delegate` and should leave file access and command execution to the subagent. The subagent should run independently on the selected low-cost model and return its summary to the main agent automatically.
|
|
178
|
-
|
|
179
|
-
<div align="center">
|
|
180
|
-
|
|
181
165
|
## Configuration
|
|
182
166
|
|
|
183
167
|
</div>
|
|
@@ -200,16 +184,6 @@ All configuration fields are volatile (dynamic configuration), with no DSH resta
|
|
|
200
184
|
> Note: the main agent's default model is stored in the host's `agent-default-model`, read and written directly by the same Dispatch mode panel, and applies to newly created sessions. Subagent model changes apply to the next delegation.
|
|
201
185
|
|
|
202
186
|
|
|
203
|
-
<div align="center">
|
|
204
|
-
|
|
205
|
-
## Troubleshooting
|
|
206
|
-
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
- **Delegation fails because the subagent model is missing (`workerProvider` / `workerModel` is empty).** The plugin never silently falls back to the more expensive main-agent model. Select the subagent's `Provider` and `Model` in the **Dispatch** panel. The change takes effect on the next delegation.
|
|
210
|
-
- **The plugin conflicts or does not load after upgrading from `dsh-orchestrator`.** The package moved to `@sshirkit/dsh-orchestrator` in `v0.8.4`. Uninstall the old plugin first, install the new one, then fully quit and restart DSH.
|
|
211
|
-
- **Changing the default main-agent model did not affect the current session.** The host stores the default in `agent-default-model` and uses it for new sessions. In an existing session, switch models using the selector at the top of the conversation.
|
|
212
|
-
|
|
213
187
|
<div align="center">
|
|
214
188
|
|
|
215
189
|
## Contributing & Community
|
package/README.zh.md
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
**强模型主脑规划 + 便宜模型统一打工 —— DeepSeek Harness 的「硬隔离调度模式」插件**
|
|
12
|
+
#### **强模型主脑规划 + 便宜模型统一打工 —— DeepSeek Harness 的「硬隔离调度模式」插件**
|
|
13
13
|
|
|
14
|
-
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
15
15
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
16
16
|
[](https://github.com/SShiRkiT/dsh-orchestrator)
|
|
17
17
|
[](https://nodejs.org)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
[](https://github.com/SShiRkiT/dsh-orchestrator/stargazers)
|
|
21
21
|
[](https://www.npmjs.com/package/@sshirkit/dsh-orchestrator)
|
|
22
22
|
|
|
23
|
-
**简体中文** | [English](README.md) · [核心差异](#为什么有了原生-subagent-和-agent-team还需要这个插件) · [核心特性](#核心特性) · [安装](#安装) · [
|
|
23
|
+
**简体中文** | [English](README.md) · [核心差异](#为什么有了原生-subagent-和-agent-team还需要这个插件) · [核心特性](#核心特性) · [安装](#安装) · [配置说明](#配置说明) · [参与贡献](#参与贡献)
|
|
24
24
|
|
|
25
25
|
</div>
|
|
26
26
|
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
在输入框下方的**「调度模式」专属面板**中,主代理与子代理的模型路由完全解耦:
|
|
36
36
|
- **主代理(Main Agent)**:配置为你最强的旗舰模型专门负责需求澄清、任务切分、途中纠偏与最终结果验收。
|
|
37
37
|
- > 例如 `gpt-astra-6`、`claude-opus-5.5` 等
|
|
38
|
-
- **子代理(Subagent
|
|
38
|
+
- **子代理(Subagent)**:配置为能力稍弱但极其便宜、高吞吐的模型**所有通过 `delegate` 和 `orchestrate` 派出的 Worker 强制共用这条便宜路由**
|
|
39
39
|
- > 例如 `deepseek-v4.1-flash`、`gpt-luna-6` 等
|
|
40
|
-
-
|
|
40
|
+
- **防烧钱保护**:如果未配置子代理模型,派发时会直接报错拦截
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
## 可以在`prompt` 或 `AGENTS.md`中要求当前工作区域的main agent派发子代理时传输 `provider` / `model` 参数来指定当前`会话` \ `工作区`使用你指定的模型进行
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|

|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
- **主代理被彻底收缴执行工具**:
|
|
51
51
|
<div align="center">
|
|
52
52
|
|
|
53
|
-
>
|
|
53
|
+
> ### DEFAULT_ALLOWED_TOOLS 默认只放行 12 项规划、委派与会话只读工具
|
|
54
54
|
>
|
|
55
55
|
> _`delegate`、`orchestrate`、`send_message`、`interrupt_agent`、`todo_write`、`ask_user_question`、`compress` 与 5 项只读会话日志工具。_
|
|
56
56
|
>
|
|
57
|
-
>
|
|
57
|
+
> ### 所有文件读写、搜索、终端,以及未来新增的任何 MCP / 第三方插件工具,一律自动隐藏并在执行层强制拦截
|
|
58
58
|
>
|
|
59
|
-
>
|
|
59
|
+
>_(`read` / `edit` / `write` / `apply_patch`)、(`grep` / `glob`)、(`bash` / `pwsh`)、 `subagent` / `workflow`_
|
|
60
60
|
>
|
|
61
|
-
>
|
|
61
|
+
> ### 连 run_code 嵌套偷调也拦。需要额外放行时,在面板右侧 Allowed Tools 勾选即可。
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
64
|
- **子代理独享完整工具链**:被派出的 Worker 不受闸门限制,在各自独立的上下文中读写文件、跑测试、看报错,完工后只把干净的结论交回主代理验收。
|
|
@@ -93,9 +93,8 @@
|
|
|
93
93
|
---
|
|
94
94
|
<div align="center">
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
### 为什么有了原生 `subagent` 和 `Agent Team`,还需要这个插件?
|
|
97
97
|
</div>
|
|
98
|
-
|
|
99
98
|
DSH 客户端自带了 `subagent` / `workflow`,官方也有 `@deepseek-ai/dsh-experimental-agent-team-profile`(Agent Team),但它们在实际高强度开发中仍有三个痛点——而这正是 **DSH Orchestrator** 独有的设计核心:
|
|
100
99
|
|
|
101
100
|
| 痛点场景 | 原生 `subagent` / 官方 `Agent Team` | DSH Orchestrator(本插件独有) |
|
|
@@ -114,7 +113,7 @@ DSH 客户端自带了 `subagent` / `workflow`,官方也有 `@deepseek-ai/dsh-
|
|
|
114
113
|
|
|
115
114
|
| 项目 | 要求 |
|
|
116
115
|
| --- | --- |
|
|
117
|
-
| **宿主环境** | DeepSeek Harness Desktop / Web GUI
|
|
116
|
+
| **宿主环境** | DeepSeek Harness Desktop / Web GUI |
|
|
118
117
|
| **Node.js** | `>= 22`(内置于 DSH Desktop 运行时) |
|
|
119
118
|
| **插件形态** | Cordis 后端服务补丁(`cordis.patch.yml`)+ Web GUI 客户端扩展(`lib/client.js`) |
|
|
120
119
|
| **界面语言** | 中 / 英双语自适应(`zh-CN` / `en-US`) |
|
|
@@ -128,7 +127,7 @@ DSH 客户端自带了 `subagent` / `workflow`,官方也有 `@deepseek-ai/dsh-
|
|
|
128
127
|
|
|
129
128
|
| 插件版本 | 适配的 DSH 宿主 | 说明 |
|
|
130
129
|
| --- | --- | --- |
|
|
131
|
-
| `@sshirkit/dsh-orchestrator >= 0.8.3`(当前版本 `0.8.
|
|
130
|
+
| `@sshirkit/dsh-orchestrator >= 0.8.3`(当前版本 `0.8.8`) | **DSH `>= 0.2.2-rc.2 < 0.2.3-0`** | 已验证 `0.2.2-rc.2` / `0.2.2-rc.3`。宿主自 `0.2.2-rc.2` 起扁平化了 subagent spec、移除了 `Symbol.for('dsh.subagent.deliverPrompt')` 投递入口与 `agents.roots()`,并新增 `wait_agent` 工具;因此**不兼容 `0.2.2-rc.1` 及更早版本**。注意:宿主虽新增了 `wait_agent`,但本插件默认白名单**有意维持 12 项、不予放行 `wait_agent`**——阻塞式轮询等待会让主代理陷入空转与超时误判,巡检机制已用「一条摘要 + 一次决策」替代轮询;确有需要时可在面板 `allowedTools` 中手动勾选放行。 |
|
|
132
131
|
| `dsh-orchestrator 0.8.0 – 0.8.2` | **DSH `<= 0.2.2-rc.1`** | 已实测支持 `0.2.1-rc.3`、`0.2.2-rc.1`。自 `0.8.0` 起引入 `@deepseek-ai/dsh-tools` 依赖。 |
|
|
133
132
|
| `dsh-orchestrator <= 0.7.3` | `0.8.0` 之前的旧版 DSH | 早期独立工具注册架构,未依赖 `@deepseek-ai/dsh-tools`。 |
|
|
134
133
|
|
|
@@ -163,21 +162,6 @@ dsh plugin --profile desktop add @sshirkit/dsh-orchestrator
|
|
|
163
162
|
|
|
164
163
|
<div align="center">
|
|
165
164
|
|
|
166
|
-
## 快速验证
|
|
167
|
-
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
安装并重启 DSH 后,在会话输入框下方打开「调度模式」设置面板,确认「启用调度模式」已打开。
|
|
171
|
-
|
|
172
|
-
1. 为子代理选择 `Provider` 与 `Model`。两项均为默认路由必填项,任一未配置时,使用默认路由的委派会报错并停止。
|
|
173
|
-
2. 新建会话,发送一条只读测试指令。
|
|
174
|
-
|
|
175
|
-
> 请委派一个子代理只读检查当前工作目录的文件列表并汇总给我。
|
|
176
|
-
|
|
177
|
-
3. 查看工具调用记录,确认主代理只调用了 `delegate`,没有直接调用文件读写或命令执行工具。子代理应按所选的低成本模型独立执行,结束后自动将总结交给主代理。
|
|
178
|
-
|
|
179
|
-
<div align="center">
|
|
180
|
-
|
|
181
165
|
## 配置说明
|
|
182
166
|
|
|
183
167
|
</div>
|
|
@@ -200,16 +184,6 @@ dsh plugin --profile desktop add @sshirkit/dsh-orchestrator
|
|
|
200
184
|
> 注:主代理的默认模型保存在宿主的 `agent-default-model` 中,由同一个「调度模式」面板直接读写,对新创建的会话生效;子代理模型改动从下一次委派起立即生效。
|
|
201
185
|
|
|
202
186
|
|
|
203
|
-
<div align="center">
|
|
204
|
-
|
|
205
|
-
## 常见排障
|
|
206
|
-
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
- **委派时报未配置子代理模型(`workerProvider` / `workerModel` 为空)**。插件不会静默回退到成本较高的主代理模型。请在「调度模式」面板选好子代理的 `Provider` 与 `Model`,下一次委派立即生效。
|
|
210
|
-
- **从旧版 `dsh-orchestrator` 升级后插件冲突或未生效**。自 `v0.8.4` 起,插件已迁移到 `@sshirkit/dsh-orchestrator`。请先卸载旧版,再安装新版,最后完全退出并重启 DSH。
|
|
211
|
-
- **修改主代理默认模型后,当前会话未变化**。默认模型写入宿主的 `agent-default-model`,对新建会话生效。已有会话可在顶部的模型选择器中切换。
|
|
212
|
-
|
|
213
187
|
<div align="center">
|
|
214
188
|
|
|
215
189
|
## 参与贡献
|
package/lib/delegate.js
CHANGED
|
@@ -61,18 +61,10 @@ export function createDelegateTool({
|
|
|
61
61
|
const enabled = () => isDispatchEnabled(config)
|
|
62
62
|
const rule = () => mainAgentRule(liveAllowed())
|
|
63
63
|
const body =
|
|
64
|
-
'把一个自包含任务交给子代理执行。子代理看不到本会话,prompt
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'严禁两个子代理修改同一文件;每次派发都必须用 writeScope 声明允许修改的文件或目录,' +
|
|
69
|
-
'省略该字段或声明为空数组都会被拒绝,插件会在派发前拒绝与其他写者重叠的声明。' +
|
|
70
|
-
'子代理仍在运行时可用 send_message 纠偏,已结束的可用 send_message ' +
|
|
71
|
-
'追加任务(它保留自己的上下文)。长时间运行的子代理会被插件每隔几分钟巡检:收到「【插件巡检…】」' +
|
|
72
|
-
'消息(来自插件,不是用户)时,所列子代理均仍在运行且尚未交付,巡检回合禁止修改 todo_write;' +
|
|
73
|
-
'巡检例外仅指不自动推进主任务与禁止调用 todo_write,巡检回合仍受当前工具白名单(allowedTools)制约;' +
|
|
74
|
-
'需干预时禁止回复「巡检:正常」,请用白名单允许的调研或 send_message 等工具纠偏;' +
|
|
75
|
-
'无需干预时严禁调用任何工具,只回复一行「巡检:正常」并立即结束回合。'
|
|
64
|
+
'把一个自包含任务交给子代理执行。子代理看不到本会话,prompt 须写清目标、允许修改的文件、验收命令与兜底方案,派发时必填 writeScope。' +
|
|
65
|
+
'调用立即返回子代理 id,结束时自动通知;严禁要求子代理用 send_message 汇报。' +
|
|
66
|
+
'运行中可用 send_message 纠偏,结束后可追加任务。' +
|
|
67
|
+
'多个独立任务在同一轮并发发起;同构批量请用 orchestrate。'
|
|
76
68
|
const descriptionOf = () => (enabled() ? rule() + body : body)
|
|
77
69
|
|
|
78
70
|
// A provisional id lets the lease be registered before the host names the child: the
|
|
@@ -101,7 +93,7 @@ export function createDelegateTool({
|
|
|
101
93
|
parameters: {
|
|
102
94
|
cwd: {
|
|
103
95
|
type: 'string',
|
|
104
|
-
description: '
|
|
96
|
+
description: '初始工作目录(相对路径基于当前目录);省略则继承。',
|
|
105
97
|
},
|
|
106
98
|
writeScope: {
|
|
107
99
|
type: 'array',
|
|
@@ -110,15 +102,14 @@ export function createDelegateTool({
|
|
|
110
102
|
// Required, with no default and no minItems: omitting the field is refused with
|
|
111
103
|
// `write-scope-missing`, while an empty array is refused as `write-scope-invalid`.
|
|
112
104
|
description:
|
|
113
|
-
'
|
|
114
|
-
'
|
|
115
|
-
'
|
|
116
|
-
'这是声明而非授权:它不扩大子代理的工具权限,也不阻止它在声明外写入。',
|
|
105
|
+
'必填:允许写入的文件/目录清单(至少一项)。' +
|
|
106
|
+
'派发前与在租作用域求交,冲突报 write-scope-conflict。' +
|
|
107
|
+
'相对路径基于 cwd;目录用 "/" 或 "/**";不推荐 "*"。仅声明,不扩大权限也不阻止越界写入。',
|
|
117
108
|
},
|
|
118
109
|
description: {
|
|
119
110
|
type: 'string',
|
|
120
111
|
required: true,
|
|
121
|
-
description: '任务简述(3-5
|
|
112
|
+
description: '任务简述(3-5 词),用于展示。',
|
|
122
113
|
},
|
|
123
114
|
prompt: {
|
|
124
115
|
type: 'string',
|
|
@@ -128,19 +119,16 @@ export function createDelegateTool({
|
|
|
128
119
|
provider: {
|
|
129
120
|
type: 'string',
|
|
130
121
|
description:
|
|
131
|
-
'
|
|
132
|
-
'两者都省略时使用调度面板的 worker 路由。严禁自行选择模型。仅限本次派发,禁止复用历史轮次或摘要中的模型。',
|
|
122
|
+
'可选路由覆盖:仅当用户显式点名(当前消息或 AGENTS.md 等工作区指令)时与 model 同传;省略走 worker 路由。',
|
|
133
123
|
},
|
|
134
124
|
model: {
|
|
135
125
|
type: 'string',
|
|
136
126
|
description:
|
|
137
|
-
'
|
|
138
|
-
'两者都省略时使用调度面板的 worker 路由。严禁自行选择模型。仅限本次派发,禁止复用历史轮次或摘要中的模型。',
|
|
127
|
+
'可选路由覆盖:仅当用户显式点名(当前消息或 AGENTS.md 等工作区指令)时与 provider 同传;省略走 worker 路由。',
|
|
139
128
|
},
|
|
140
129
|
reasoning_effort: {
|
|
141
130
|
type: 'string',
|
|
142
|
-
description:
|
|
143
|
-
'可选,仅与 provider 和 model 同时使用:该子代理的推理强度。省略则由所选模型决定默认值;仅当用户点名时才设置。',
|
|
131
|
+
description: '可选推理强度:仅当用户点名时才设置,须与 provider/model 同传。',
|
|
144
132
|
},
|
|
145
133
|
},
|
|
146
134
|
output: {
|
package/lib/orchestrate.js
CHANGED
|
@@ -515,16 +515,12 @@ export function createOrchestrateTool({ defineTool, subagents, config, leases })
|
|
|
515
515
|
// The plumbing still accepts the whitelist fields a shared factory passes down so a
|
|
516
516
|
// caller does not have to branch, but they are unused here.
|
|
517
517
|
const enabled = () => isDispatchEnabled(config)
|
|
518
|
-
const ruleLead = '主代理规则同 delegate
|
|
518
|
+
const ruleLead = '主代理规则同 delegate。'
|
|
519
519
|
const body =
|
|
520
|
-
'按 item
|
|
521
|
-
'
|
|
522
|
-
'
|
|
523
|
-
'
|
|
524
|
-
'单个 item 失败会置为 null 并记入 errors,不影响其余 item;maxConcurrency 限制同时运行的子代理数。' +
|
|
525
|
-
'每次调用都必须用顶层 writeScope 声明整批允许修改的文件或目录(至少一项,省略或空数组都会被拒绝):' +
|
|
526
|
-
'整批共享一个写租约,与其他写者重叠时整批失败、一个子代理都不启动(插件不排队,请改为串行或拆成不相交的批次)。' +
|
|
527
|
-
'多个互不相关的批次可在同一轮同时调用(orchestrate 可并发安全调用);单个简单任务请用 delegate。'
|
|
520
|
+
'按 item 派发子代理:单 stage 即批量扇出;多 stage 时各 item 独立走完阶段,无全局屏障,每阶段自动附带指令、原始 item 与上阶段输出。' +
|
|
521
|
+
'声明 schema 的阶段输出校验过的 JSON,否则为文本;单 item 失败置为 null 并记入 errors。' +
|
|
522
|
+
'maxConcurrency 限制并发数;调用必填 writeScope,整批共享一个写租约,冲突时整批失败不排队。' +
|
|
523
|
+
'无关批次可并发调用;单任务请用 delegate。'
|
|
528
524
|
const descriptionOf = () => (enabled() ? ruleLead + body : body)
|
|
529
525
|
|
|
530
526
|
const tool = defineTool({
|
|
@@ -533,7 +529,7 @@ export function createOrchestrateTool({ defineTool, subagents, config, leases })
|
|
|
533
529
|
parameters: {
|
|
534
530
|
cwd: {
|
|
535
531
|
type: 'string',
|
|
536
|
-
description: '
|
|
532
|
+
description: '初始工作目录(相对路径基于当前目录);省略则继承。',
|
|
537
533
|
},
|
|
538
534
|
writeScope: {
|
|
539
535
|
type: 'array',
|
|
@@ -542,22 +538,20 @@ export function createOrchestrateTool({ defineTool, subagents, config, leases })
|
|
|
542
538
|
// Required, with no default and no minItems — the same conventions as `delegate`:
|
|
543
539
|
// omitting the field is `write-scope-missing`, an empty array is invalid.
|
|
544
540
|
description:
|
|
545
|
-
'
|
|
546
|
-
'
|
|
547
|
-
'
|
|
548
|
-
'单个 "*" 表示认领整个工作区(不推荐,会让所有并发写互相冲突)。' +
|
|
549
|
-
'这是声明而非授权:它不扩大子代理的工具权限,也不阻止它在声明外写入。',
|
|
541
|
+
'必填:允许写入的文件/目录清单(至少一项),整批共享一个写租约。' +
|
|
542
|
+
'派发前与在租作用域求交,冲突则整批失败并报 write-scope-conflict。' +
|
|
543
|
+
'相对路径基于 cwd;目录用 "/" 或 "/**";不推荐 "*"。仅声明,不扩大权限也不阻止越界写入。',
|
|
550
544
|
},
|
|
551
545
|
items: {
|
|
552
546
|
type: 'array',
|
|
553
547
|
required: true,
|
|
554
|
-
description: `JSON
|
|
548
|
+
description: `JSON 条目数组(${LIMITS.items.min}..${LIMITS.items.max}),每项对应独立任务。`,
|
|
555
549
|
items: { type: 'json' },
|
|
556
550
|
},
|
|
557
551
|
stages: {
|
|
558
552
|
type: 'array',
|
|
559
553
|
required: true,
|
|
560
|
-
description:
|
|
554
|
+
description: `顺序执行的阶段(${LIMITS.stages.min}..${LIMITS.stages.max}),单阶段即扇出。`,
|
|
561
555
|
items: {
|
|
562
556
|
type: 'object',
|
|
563
557
|
additionalProperties: false,
|
|
@@ -565,42 +559,39 @@ export function createOrchestrateTool({ defineTool, subagents, config, leases })
|
|
|
565
559
|
name: {
|
|
566
560
|
type: 'string',
|
|
567
561
|
required: true,
|
|
568
|
-
description: '
|
|
562
|
+
description: '阶段名称,用于错误标识。',
|
|
569
563
|
},
|
|
570
564
|
prompt: {
|
|
571
565
|
type: 'string',
|
|
572
566
|
required: true,
|
|
573
|
-
description: '
|
|
567
|
+
description: '阶段指令,自动附带原始条目与上阶段输出。',
|
|
574
568
|
},
|
|
575
569
|
schema: {
|
|
576
570
|
type: 'object',
|
|
577
571
|
additionalProperties: true,
|
|
578
572
|
description:
|
|
579
|
-
'
|
|
573
|
+
'可选对象根 JSON Schema(支持 type/properties/required/additionalProperties/items/enum/const/oneOf)。',
|
|
580
574
|
},
|
|
581
575
|
},
|
|
582
576
|
},
|
|
583
577
|
},
|
|
584
578
|
maxConcurrency: {
|
|
585
579
|
type: 'integer',
|
|
586
|
-
description:
|
|
580
|
+
description: `并发子代理上限(${LIMITS.maxConcurrency.min}..${LIMITS.maxConcurrency.max},默认 ${LIMITS.maxConcurrency.default})。`,
|
|
587
581
|
},
|
|
588
582
|
provider: {
|
|
589
583
|
type: 'string',
|
|
590
584
|
description:
|
|
591
|
-
'
|
|
592
|
-
'两者都省略时使用调度面板的 worker 路由。严禁自行选择模型。仅限本次派发,禁止复用历史轮次或摘要中的模型。',
|
|
585
|
+
'可选路由覆盖:仅当用户显式点名(当前消息或 AGENTS.md 等工作区指令)时与 model 同传;省略走 worker 路由。',
|
|
593
586
|
},
|
|
594
587
|
model: {
|
|
595
588
|
type: 'string',
|
|
596
589
|
description:
|
|
597
|
-
'
|
|
598
|
-
'两者都省略时使用调度面板的 worker 路由。严禁自行选择模型。仅限本次派发,禁止复用历史轮次或摘要中的模型。',
|
|
590
|
+
'可选路由覆盖:仅当用户显式点名(当前消息或 AGENTS.md 等工作区指令)时与 provider 同传;省略走 worker 路由。',
|
|
599
591
|
},
|
|
600
592
|
reasoning_effort: {
|
|
601
593
|
type: 'string',
|
|
602
|
-
description:
|
|
603
|
-
'可选,仅与 provider 和 model 同时使用:本次调用每个子代理的推理强度。省略则由所选模型决定默认值;仅当用户点名时才设置。',
|
|
594
|
+
description: '可选推理强度:仅当用户点名时才设置,须与 provider/model 同传。',
|
|
604
595
|
},
|
|
605
596
|
},
|
|
606
597
|
output: {
|
package/lib/rules.js
CHANGED
|
@@ -10,44 +10,22 @@
|
|
|
10
10
|
* native `subagent` and `workflow`), so the rule can assume a main-agent reader.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { DELEGATE_TOOL, ORCHESTRATE_TOOL } from './api.js'
|
|
14
|
-
|
|
15
13
|
/**
|
|
16
|
-
* Build the rule text. `
|
|
17
|
-
* so
|
|
18
|
-
* `allowedTools` is the live whitelist the gate enforces, so the closing sentence
|
|
19
|
-
* names exactly what stays available.
|
|
14
|
+
* Build the rule text. `allowedTools` is the live whitelist the gate enforces,
|
|
15
|
+
* so the closing sentence names exactly what stays available.
|
|
20
16
|
*/
|
|
21
|
-
export function mainAgentRule(allowedTools
|
|
22
|
-
const order =
|
|
23
|
-
preferred === ORCHESTRATE_TOOL
|
|
24
|
-
? 'orchestrate(同构批量)或 delegate(单个任务)'
|
|
25
|
-
: 'delegate(单个任务)或 orchestrate(同构批量)'
|
|
17
|
+
export function mainAgentRule(allowedTools) {
|
|
26
18
|
const allowed = [...new Set(allowedTools ?? [])]
|
|
27
19
|
const allowedNames = allowed.join(', ')
|
|
28
20
|
return (
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'主代理可以直接调用 compress。' +
|
|
35
|
-
'子代理中断且没有收尾消息时,插件会在同一会话自动重试:等待重试,期间不要重派或另起子代理;' +
|
|
36
|
-
'结果为空时先确认插件状态,不要立即重派。' +
|
|
37
|
-
'若它在 2 分钟内连续 3 次快速断联(插件自动重试 2 次),插件停止重试并提示' +
|
|
38
|
-
'「【插件重试|子代理 <id>】它在 2 分钟内连续 3 次快速断联(failed before it finished / It left no closing message),插件已停止自动重试」:' +
|
|
39
|
-
'此时告知用户子代理模型可能不可用,只提供通知中的 A/B 选项(A 派生新子代理重做 / B 更换子代理模型后重试)并等待用户答复;' +
|
|
40
|
-
'不要建议继续唤醒旧子代理,未经用户选择 A 不要另派子代理重复工作,也不要私自换模型重发。' +
|
|
41
|
-
'严禁通过 run_code 触达宿主:禁用 import/require/process/fetch/eval,也禁用 ' +
|
|
42
|
-
'sandbox_permissions/justification;run_code 仅作为 PTC 传输层,只可通过 tools 调用当前 allowedTools 中已授权的工具;' +
|
|
43
|
-
'PTC 不扩大权限,巡检回合的 todo_write 禁令与「巡检:正常」声明后的工具锁继续生效。' +
|
|
44
|
-
'仅当当前用户消息显式点名时才传 provider/model/reasoning_effort,否则三者全部省略(用调度面板路由);' +
|
|
45
|
-
'点名的模型仅限本次派发,严禁复用历史轮次、历史派发或摘要中的模型,严禁假定未声明的默认模型,不确定先询问。' +
|
|
21
|
+
'主代理规则:主代理只负责规划,读/写/编辑/搜索/命令/抓取均通过 delegate 或 orchestrate 交子代理执行,勿试探调用被禁工具。' +
|
|
22
|
+
'新会话或压缩后直接委派,无需重新确认。' +
|
|
23
|
+
'独立任务在同一消息内并发派发,勿轮询状态或重复派发。' +
|
|
24
|
+
'子代理无收尾中断时插件会自动重试,期间勿重派;提示停止重试时按通知询问用户。' +
|
|
25
|
+
'provider/model/reasoning_effort 仅在用户当前消息或 AGENTS.md 等工作区指令中显式指定时才传,否则全部省略;当前消息点名仅限本次派发,工作区指令指定的按其持续生效,两者冲突以当前消息为准;严禁复用历史轮次或摘要中的模型。' +
|
|
46
26
|
(allowedNames === ''
|
|
47
|
-
? '
|
|
48
|
-
:
|
|
49
|
-
'
|
|
50
|
-
'巡检回合仍受当前工具白名单(allowedTools)制约,仅检查并按需干预在跑子代理,禁止修改 todo_write;' +
|
|
51
|
-
'确认无需干预时只回复一行「巡检:正常」并立即结束,禁止附加工具调用。) '
|
|
27
|
+
? '当前主代理无可用工具(白名单为空)。'
|
|
28
|
+
: `主代理可用工具(白名单驱动,其余全部禁用): ${allowedNames}。`) +
|
|
29
|
+
' '
|
|
52
30
|
)
|
|
53
31
|
}
|