dsh-plugin-subagent-bridge 0.15.2 → 0.17.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 +30 -3
- package/README.zh-CN.md +25 -0
- package/index.js +17 -2214
- package/package.json +2 -1
- package/src/api.js +398 -0
- package/src/constants.js +61 -0
- package/src/guards.js +97 -0
- package/src/http.js +358 -0
- package/src/policy.js +19 -0
- package/src/questions.js +130 -0
- package/src/registry.js +155 -0
- package/src/runners/claude.js +177 -0
- package/src/runners/codex.js +185 -0
- package/src/sessions.js +336 -0
- package/src/settings.js +121 -0
- package/src/tools.js +228 -0
- package/src/utils.js +55 -0
package/README.md
CHANGED
|
@@ -145,13 +145,22 @@ Two measured facts:
|
|
|
145
145
|
A worker that calls `ask_user_question` waits for a human. When the caller is another agent, nobody is there. So the bridge appends a standing instruction to every delegated task:
|
|
146
146
|
|
|
147
147
|
```
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
(If information is missing, or a choice between options is required, pick the most
|
|
149
|
+
reasonable default, finish the task, and state the assumption in one line. Do not
|
|
150
|
+
hand the decision back to the user and do not call ask_user_question.)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Set your own wording with `assumptionPolicy`:
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
config:
|
|
157
|
+
assumptionPolicy: "If information is missing, pick the most reasonable default, finish the task, and state the assumption in one line. Do not ask the user and do not call ask_user_question."
|
|
151
158
|
```
|
|
152
159
|
|
|
153
160
|
On by default (`assumeDefaults: false` disables it). It is skipped when the prompt already mentions `ask_user_question`.
|
|
154
161
|
|
|
162
|
+
> The built-in default text is Chinese (`如果缺少必要信息……`), which every model in this host reads; the block above is that instruction in English. Set `assumptionPolicy` to send English verbatim.
|
|
163
|
+
|
|
155
164
|
### Questions (`pendingQuestion`)
|
|
156
165
|
|
|
157
166
|
If a worker does ask, `dsh_wait` reports it:
|
|
@@ -215,6 +224,7 @@ Returns `{ ok, text, sessionId, durationMs }`. Runs `claude -p --output-format j
|
|
|
215
224
|
| `maxResultChars` | `20000` | Cap on a single result payload (the head is kept) |
|
|
216
225
|
| `taskTimeoutSeconds` | `300` | `dsh_task` wait cap (client may override, max 240) |
|
|
217
226
|
| `assumeDefaults` | `true` | Append the decide-and-continue instruction |
|
|
227
|
+
| `assumptionPolicy` | *(empty)* | Replacement text for the instruction; empty uses the built-in Chinese default |
|
|
218
228
|
| `workersFile` | `~/.dsh/bridge/workers.json` | Worker registry (`0600`) |
|
|
219
229
|
| `maxHops` | `1` | Delegation depth limit |
|
|
220
230
|
| `dispatchPerMinute` | `10` | Dispatches allowed per window |
|
|
@@ -297,6 +307,23 @@ Both are plain `SKILL.md` files: YAML frontmatter (`name` + `description`) plus
|
|
|
297
307
|
node --test "test/*.test.mjs"
|
|
298
308
|
```
|
|
299
309
|
|
|
310
|
+
```
|
|
311
|
+
index.js wiring: apply() + re-exports
|
|
312
|
+
src/constants.js versions, limits, binary candidates, policy text
|
|
313
|
+
src/utils.js JSON-RPC helpers, argument validation, sleep
|
|
314
|
+
src/settings.js defaults and config resolution
|
|
315
|
+
src/tools.js tool schemas
|
|
316
|
+
src/policy.js the standing instruction
|
|
317
|
+
src/questions.js ask_user_question takeover and reporting
|
|
318
|
+
src/sessions.js session reads, waits, model and workspace placement
|
|
319
|
+
src/guards.js depth and rate limits
|
|
320
|
+
src/registry.js worker registry persistence and capacity
|
|
321
|
+
src/http.js loopback server, JSON-RPC, tool dispatch
|
|
322
|
+
src/api.js the bridge API the tools call
|
|
323
|
+
src/runners/codex.js codex exec adapter
|
|
324
|
+
src/runners/claude.js claude -p adapter
|
|
325
|
+
```
|
|
326
|
+
|
|
300
327
|
83 tests: handshake and version negotiation, tool list and argument validation, dispatch call shape, result baselines, long polling, real HTTP round trips (404/405/202 and bearer), `codex exec` event parsing, binary resolution, success/failure/timeout runs, resume argument split, final-answer-only behaviour, `dsh_wait` terminal states, slot limits and release, followup rebaselining, registry persistence and restart recovery, `maxHops` and rate limiting, per-`cwd` budgets, workspace creation and reuse, `queue`/`steer` delivery and waiting, anchors for steered answers, Claude output parsing and resume arguments, `assumeDefaults` injection, `pendingQuestion` and `dsh_answer`.
|
|
301
328
|
|
|
302
329
|
## Related
|
package/README.zh-CN.md
CHANGED
|
@@ -152,6 +152,13 @@ dsh_followup({ worker: "w1", message: "接下来只改 src 下的文件", mode:
|
|
|
152
152
|
|
|
153
153
|
默认开启(`assumeDefaults: false` 可关闭)。prompt 里本来就提到 `ask_user_question` 时不追加。
|
|
154
154
|
|
|
155
|
+
想换成自己的措辞——比如英文——用 `assumptionPolicy`:
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
config:
|
|
159
|
+
assumptionPolicy: "If information is missing, pick the most reasonable default, finish the task, and state the assumption in one line. Do not ask the user or call ask_user_question."
|
|
160
|
+
```
|
|
161
|
+
|
|
155
162
|
### 问题上报
|
|
156
163
|
|
|
157
164
|
worker 真的提问时,`dsh_wait` 会把问题带出来:
|
|
@@ -215,6 +222,7 @@ worker 真的提问时,`dsh_wait` 会把问题带出来:
|
|
|
215
222
|
| `maxResultChars` | `20000` | 单次结果载荷上限(保留开头) |
|
|
216
223
|
| `taskTimeoutSeconds` | `300` | `dsh_task` 等待上限(客户端可覆盖,最大 240) |
|
|
217
224
|
| `assumeDefaults` | `true` | 追加「自行决策」指令 |
|
|
225
|
+
| `assumptionPolicy` | 空 | 替换指令正文;空表示用内置中文默认 |
|
|
218
226
|
| `workersFile` | `~/.dsh/bridge/workers.json` | worker 注册表(`0600`) |
|
|
219
227
|
| `maxHops` | `1` | 委派深度上限 |
|
|
220
228
|
| `dispatchPerMinute` | `10` | 每个窗口允许的派发次数 |
|
|
@@ -297,6 +305,23 @@ mkdir -p ~/.dsh/skills && cp -R skills/delegate-to-external-agent ~/.dsh/skills
|
|
|
297
305
|
node --test "test/*.test.mjs"
|
|
298
306
|
```
|
|
299
307
|
|
|
308
|
+
```
|
|
309
|
+
index.js wiring: apply() + re-exports
|
|
310
|
+
src/constants.js versions, limits, binary candidates, policy text
|
|
311
|
+
src/utils.js JSON-RPC helpers, argument validation, sleep
|
|
312
|
+
src/settings.js defaults and config resolution
|
|
313
|
+
src/tools.js tool schemas
|
|
314
|
+
src/policy.js the standing instruction
|
|
315
|
+
src/questions.js ask_user_question takeover and reporting
|
|
316
|
+
src/sessions.js session reads, waits, model and workspace placement
|
|
317
|
+
src/guards.js depth and rate limits
|
|
318
|
+
src/registry.js worker registry persistence and capacity
|
|
319
|
+
src/http.js loopback server, JSON-RPC, tool dispatch
|
|
320
|
+
src/api.js the bridge API the tools call
|
|
321
|
+
src/runners/codex.js codex exec adapter
|
|
322
|
+
src/runners/claude.js claude -p adapter
|
|
323
|
+
```
|
|
324
|
+
|
|
300
325
|
83 项测试:握手与版本协商、工具清单与参数校验、派发调用形状、结果基线、长轮询、真实 HTTP 往返(404/405/202 与 bearer)、`codex exec` 事件解析、二进制解析、成功/失败/超时、resume 参数分叉、只回最终回答、`dsh_wait` 终态、名额上限与释放、followup 重基线、注册表持久化与重启恢复、`maxHops` 与速率限制、按 `cwd` 的预算、项目创建与复用、`queue`/`steer` 投递与等待、插话回答的锚点、Claude 输出解析与 resume 参数、`assumeDefaults` 注入、`pendingQuestion` 与 `dsh_answer`。
|
|
301
326
|
|
|
302
327
|
## 相关插件
|