dsh-plugin-subagent-bridge 0.11.0 → 0.11.1

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.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/index.js +4 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -72,7 +72,9 @@ dsh_followup({ worker: "w1", message: "别改了,先把现在的结果汇报
72
72
  dsh_task({ sessionId: "session-…", prompt: "停一下,改成只跑单测", mode: "steer" })
73
73
  ```
74
74
 
75
- 和 `dsh_dispatch` 的关系:`dsh_dispatch` 一直有 `mode`,但它只投递、不等待;`dsh_task` 会阻塞到回合结束,所以以前对正在运行的会话直接拒绝。现在传 `mode: "steer"` 就允许插进运行中的会话——**它会先打断当前回合**,然后这个新回合跑完才返回。
75
+ 和 `dsh_dispatch` 的关系:`dsh_dispatch` 一直有 `mode`,但它只投递、不等待;`dsh_task` 会阻塞到回合结束,所以以前对正在运行的会话直接拒绝。现在传 `mode: "steer"` 就允许插进运行中的会话——**它会先打断当前回合**,然后等这一轮结束才返回。
76
+
77
+ 一个容易踩的细节:`steer` 的消息会被**当前回合直接吸收**(不会新开一轮),所以等待条件不能是"下一个回合结束"。早期实现就是这么写的,结果答案已经回来了、调用却一直等到 120 秒超时才知道。现在 steer 等的是「当前回合结束」。
76
78
 
77
79
  返回里带 `mode` 字段,方便确认这次是排队还是打断。
78
80
 
package/index.js CHANGED
@@ -878,8 +878,11 @@ export function createApi(ctx, state, settings) {
878
878
  const appliedModel = await applyModelSpec(ctx, targetId, model, reasoningEffort)
879
879
  const deliveryMode = mode === 'steer' ? 'steer' : 'queue'
880
880
  const turnBefore = lastTurn(ctx, targetId)
881
+ /* A steered message is absorbed by the turn that is already running, so waiting for
882
+ * a strictly newer turn would hang until the timeout even after the answer landed. */
883
+ const waitAfter = deliveryMode === 'steer' ? Math.max(0, turnBefore - 1) : turnBefore
881
884
  const before = Number(sessions()?.get?.(targetId)?.seq ?? 0)
882
- const finished = waitForTurnEnd(ctx, targetId, turnBefore, seconds * 1000)
885
+ const finished = waitForTurnEnd(ctx, targetId, waitAfter, seconds * 1000)
883
886
  const requestId = randomUUID()
884
887
  const accepted = await service.prompt(
885
888
  { sessionId: targetId, requestId, mode: deliveryMode, content: [{ type: 'text', text: prompt }] },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-subagent-bridge",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "type": "module",
5
5
  "description": "Subagent bridge: lets Codex delegate a task to DeepSeek Harness the way it would spawn a subagent (one call, waits for the answer), plus a codex_dispatch tool for the reverse direction.",
6
6
  "keywords": [