dsh-plugin-subagent-bridge 0.16.0 → 0.18.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 +22 -7
- package/README.zh-CN.md +25 -6
- package/index.js +17 -2221
- 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 +21 -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
|
@@ -150,17 +150,15 @@ A worker that calls `ask_user_question` waits for a human. When the caller is an
|
|
|
150
150
|
hand the decision back to the user and do not call ask_user_question.)
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
On by default (`assumeDefaults: false` disables it). It is skipped when the prompt already mentions `ask_user_question`.
|
|
154
|
+
|
|
155
|
+
Replace the wording with `assumptionPolicy` — Chinese, for instance:
|
|
154
156
|
|
|
155
157
|
```yaml
|
|
156
158
|
config:
|
|
157
|
-
assumptionPolicy: "
|
|
159
|
+
assumptionPolicy: "如果缺少必要信息,直接采用最合理的默认做法做完,并在结果里用一行说明你的假设。"
|
|
158
160
|
```
|
|
159
161
|
|
|
160
|
-
On by default (`assumeDefaults: false` disables it). It is skipped when the prompt already mentions `ask_user_question`.
|
|
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
|
-
|
|
164
162
|
### Questions (`pendingQuestion`)
|
|
165
163
|
|
|
166
164
|
If a worker does ask, `dsh_wait` reports it:
|
|
@@ -224,7 +222,7 @@ Returns `{ ok, text, sessionId, durationMs }`. Runs `claude -p --output-format j
|
|
|
224
222
|
| `maxResultChars` | `20000` | Cap on a single result payload (the head is kept) |
|
|
225
223
|
| `taskTimeoutSeconds` | `300` | `dsh_task` wait cap (client may override, max 240) |
|
|
226
224
|
| `assumeDefaults` | `true` | Append the decide-and-continue instruction |
|
|
227
|
-
| `assumptionPolicy` | *(empty)* | Replacement text for the instruction; empty uses the built-in
|
|
225
|
+
| `assumptionPolicy` | *(empty)* | Replacement text for the instruction; empty uses the built-in English default |
|
|
228
226
|
| `workersFile` | `~/.dsh/bridge/workers.json` | Worker registry (`0600`) |
|
|
229
227
|
| `maxHops` | `1` | Delegation depth limit |
|
|
230
228
|
| `dispatchPerMinute` | `10` | Dispatches allowed per window |
|
|
@@ -307,6 +305,23 @@ Both are plain `SKILL.md` files: YAML frontmatter (`name` + `description`) plus
|
|
|
307
305
|
node --test "test/*.test.mjs"
|
|
308
306
|
```
|
|
309
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
|
+
|
|
310
325
|
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`.
|
|
311
326
|
|
|
312
327
|
## Related
|
package/README.zh-CN.md
CHANGED
|
@@ -145,20 +145,22 @@ dsh_followup({ worker: "w1", message: "接下来只改 src 下的文件", mode:
|
|
|
145
145
|
调用 `ask_user_question` 的 worker 会等人回答。调用方是另一个 agent 时,没有人在这。因此桥给每个派发的任务追加一条常驻指令:
|
|
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
151
|
```
|
|
152
152
|
|
|
153
153
|
默认开启(`assumeDefaults: false` 可关闭)。prompt 里本来就提到 `ask_user_question` 时不追加。
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
想换成中文——或者任何自己的措辞——用 `assumptionPolicy`:
|
|
156
156
|
|
|
157
157
|
```yaml
|
|
158
158
|
config:
|
|
159
|
-
assumptionPolicy: "
|
|
159
|
+
assumptionPolicy: "如果缺少必要信息,直接采用最合理的默认做法做完,并在结果里用一行说明你的假设。"
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
+
> 指令正文是中文时,桥用全角括号包裹;英文等其他语言用半角括号。
|
|
163
|
+
|
|
162
164
|
### 问题上报
|
|
163
165
|
|
|
164
166
|
worker 真的提问时,`dsh_wait` 会把问题带出来:
|
|
@@ -222,7 +224,7 @@ worker 真的提问时,`dsh_wait` 会把问题带出来:
|
|
|
222
224
|
| `maxResultChars` | `20000` | 单次结果载荷上限(保留开头) |
|
|
223
225
|
| `taskTimeoutSeconds` | `300` | `dsh_task` 等待上限(客户端可覆盖,最大 240) |
|
|
224
226
|
| `assumeDefaults` | `true` | 追加「自行决策」指令 |
|
|
225
|
-
| `assumptionPolicy` | 空 |
|
|
227
|
+
| `assumptionPolicy` | 空 | 替换指令正文;空表示用内置英文默认 |
|
|
226
228
|
| `workersFile` | `~/.dsh/bridge/workers.json` | worker 注册表(`0600`) |
|
|
227
229
|
| `maxHops` | `1` | 委派深度上限 |
|
|
228
230
|
| `dispatchPerMinute` | `10` | 每个窗口允许的派发次数 |
|
|
@@ -305,6 +307,23 @@ mkdir -p ~/.dsh/skills && cp -R skills/delegate-to-external-agent ~/.dsh/skills
|
|
|
305
307
|
node --test "test/*.test.mjs"
|
|
306
308
|
```
|
|
307
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
|
+
|
|
308
327
|
83 项测试:握手与版本协商、工具清单与参数校验、派发调用形状、结果基线、长轮询、真实 HTTP 往返(404/405/202 与 bearer)、`codex exec` 事件解析、二进制解析、成功/失败/超时、resume 参数分叉、只回最终回答、`dsh_wait` 终态、名额上限与释放、followup 重基线、注册表持久化与重启恢复、`maxHops` 与速率限制、按 `cwd` 的预算、项目创建与复用、`queue`/`steer` 投递与等待、插话回答的锚点、Claude 输出解析与 resume 参数、`assumeDefaults` 注入、`pendingQuestion` 与 `dsh_answer`。
|
|
309
328
|
|
|
310
329
|
## 相关插件
|