dsh-subagent-default-model 2.1.6 → 2.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.7 (2026-10-18)
4
+
5
+ ### Fixed
6
+
7
+ - **DSH 0.2.x 上「多模型分配」整体空转**。宿主把派发入口从 `ctx.subagents.start(name, request)` / `startContinuable(spec)` 改成了 **`startActivation(spec)`**,而 `subagent` / `subagent_fork` 工具与 agent-team 的 `spawn_teammate` **都只调 `startActivation`**——旧的两个方法在服务上已无任何调用方。插件仍只包装旧方法,于是 `applyDefaultModel()` 从未执行,子代理静默继承父会话路由:配置 `workbuddy/space-bunny`,实际却跑在父会话的 `deepseek-flash` 上。
8
+
9
+ 这就是「设置看起来生效、行为却是父路由」的隐蔽失败:面板显示正确、日志无异常、子代理照常工作,只是没走配置的路由。
10
+
11
+ 修法:`installSubagentWrapper` 同时包装 `startActivation(spec)`,在 `spec.request` 上注入默认模型;`start` / `startContinuable` 继续包装以兼容旧宿主。未注入时**保持原 spec 引用**(不克隆),避免宿主侧的身份比较出现无意义差异。
12
+
13
+ > 现场取证方式:子代理会话首事件 `subagent/descriptor` 里固化了 `agentProvider` / `agentModel` / `agentReasoningEffort`,与插件配置对比即可判定注入是否发生——比读设置面板可靠。
14
+
15
+ ### Notes
16
+
17
+ - **预检错误不触发故障转移**。像 `MISSING_CREDENTIAL`(provider 的路由凭据缺失)这类错误发生在请求发出之前,不在切换名单内,插件会原样放行。名单仍然只包含运行期的连接类与认证类错误码。
18
+
19
+ ### Tests
20
+
21
+ - 新增 3 个用例:`legacy: false` 的主机(只有 `startActivation`)必须注入、显式 `agentOptions` 不被覆盖且 spec 引用不变、无配置时保持继承。
22
+ - 变异验证:把 `startActivation` 的包装赋值去掉 → 2 项失败(注入用例 + 卸载恢复用例)。
23
+ - 全量:`tests 152 / pass 152 / fail 0 / skip 0`。
24
+
3
25
  ## 2.1.6 (2026-10-17)
4
26
 
5
27
  ### 兼容性核查:DSH Desktop 0.2.1-rc.2
package/README.en.md CHANGED
@@ -299,7 +299,7 @@ else model (+ provider) is non-empty → use that single route
299
299
  else → no injection; the host inherits the parent-session route
300
300
  ```
301
301
 
302
- The plugin wraps the host `ctx.subagents` service (`start` / `startContinuable`), so it covers every delegation path — built-in `subagent` / `subagent_fork` tools and any custom tool that calls the service without providing `agentOptions`.
302
+ The plugin wraps the host `ctx.subagents` service (`startActivation` on DSH 0.2.x, plus the legacy `start` / `startContinuable`), so it covers every delegation path — built-in `subagent` / `subagent_fork` tools, the agent-team `spawn_teammate` path, and any custom tool that calls the service without providing `agentOptions`.
303
303
 
304
304
  ## License
305
305
 
package/README.md CHANGED
@@ -299,7 +299,7 @@ CI 在 `ubuntu-latest`、`windows-latest`、`macos-latest` 三个平台上同时
299
299
  否则 → 不注入;由宿主自行继承父会话路由
300
300
  ```
301
301
 
302
- 插件包装宿主 `ctx.subagents` 服务(`start` / `startContinuable`),覆盖所有派发路径 —— 内置的 `subagent` / `subagent_fork` 工具,以及任何调用该服务但未提供 `agentOptions` 的自定义工具。
302
+ 插件包装宿主 `ctx.subagents` 服务(DSH 0.2.x 的 `startActivation`,以及旧版 `start` / `startContinuable`),覆盖所有派发路径 —— 内置的 `subagent` / `subagent_fork` 工具、agent-team 的 `spawn_teammate`,以及任何调用该服务但未提供 `agentOptions` 的自定义工具。
303
303
 
304
304
  ## 许可证
305
305
 
package/lib/index.js CHANGED
@@ -628,6 +628,12 @@ function installSubagentWrapper(ctx, state) {
628
628
 
629
629
  const originalStart = raw.start;
630
630
  const originalStartContinuable = raw.startContinuable;
631
+ // DSH 0.2.x unified every delegation entry point on `startActivation(spec)`:
632
+ // `subagent` / `subagent_fork` and the agent-team `spawn_teammate` path all
633
+ // call it directly, and the old `start` / `startContinuable` service methods
634
+ // no longer have any caller. Wrapping only those two therefore selected no
635
+ // route at all on 0.2.x (children silently inherited the parent route).
636
+ const originalStartActivation = raw.startActivation;
631
637
  const wrappedStart = typeof originalStart === "function"
632
638
  ? async (name, request) => originalStart.call(raw, name, applyDefaultModel(state, request))
633
639
  : void 0;
@@ -640,10 +646,23 @@ function installSubagentWrapper(ctx, state) {
640
646
  });
641
647
  }
642
648
  : void 0;
649
+ const wrappedStartActivation = typeof originalStartActivation === "function"
650
+ ? async (spec) => {
651
+ if (spec === void 0 || spec === null) return originalStartActivation.call(raw, spec);
652
+ const request = applyDefaultModel(state, spec.request);
653
+ // Keep the spec reference when nothing was injected: host code compares
654
+ // identity and a needless clone would be a silent behaviour change.
655
+ return originalStartActivation.call(raw, request === spec.request ? spec : {
656
+ ...spec,
657
+ request
658
+ });
659
+ }
660
+ : void 0;
643
661
 
644
- if (wrappedStart === void 0 && wrappedStartContinuable === void 0) return;
662
+ if (wrappedStart === void 0 && wrappedStartContinuable === void 0 && wrappedStartActivation === void 0) return;
645
663
  if (wrappedStart !== void 0) raw.start = wrappedStart;
646
664
  if (wrappedStartContinuable !== void 0) raw.startContinuable = wrappedStartContinuable;
665
+ if (wrappedStartActivation !== void 0) raw.startActivation = wrappedStartActivation;
647
666
  raw[WRAPPED] = state;
648
667
 
649
668
  // Service method replacement is not a Cordis-managed contribution by itself.
@@ -651,6 +670,7 @@ function installSubagentWrapper(ctx, state) {
651
670
  ctx.effect(() => () => {
652
671
  if (wrappedStart !== void 0 && raw.start === wrappedStart) raw.start = originalStart;
653
672
  if (wrappedStartContinuable !== void 0 && raw.startContinuable === wrappedStartContinuable) raw.startContinuable = originalStartContinuable;
673
+ if (wrappedStartActivation !== void 0 && raw.startActivation === wrappedStartActivation) raw.startActivation = originalStartActivation;
654
674
  if (raw[WRAPPED] === state) delete raw[WRAPPED];
655
675
  });
656
676
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-subagent-default-model",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "为 DeepSeek Harness 子代理配置默认模型:多模型顺序/随机分配、跨供应商连接失败故障转移,并在轨迹/对话视图显示当前供应商与模型,同时以一行真实提示词把当前路由注入子代理上下文。",
5
5
  "keywords": [
6
6
  "deepseek-harness",