dsh-model-switch 0.4.60 → 0.4.61

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,3 +1,16 @@
1
+ ## v0.4.61
2
+
3
+ 修复 DSH 0.2.1 上**子代理与团队通道全部不可用**的 P0:`spawn_teammate` / `subagent` 一律失败,报 `cannot get property "workingDirectory" without inject`。
4
+
5
+ - **根因**:`ModelSwitchSubagentRuntime` 继承官方 `@deepseek-ai/dsh-subagent` 的运行时并覆写路由;cordis 解析插件依赖时读的是**被挂载类自己的** `inject`,子类的 `static inject = ['modelSwitch']` 会**整体替换**而不是合并基类列表。DSH 0.2.1 起官方运行时声明并读取 `workingDirectory`(`ctx.workingDirectory.ensure(...)`),这一依赖被替换掉后,任何一次委派都在 cordis 的注入检查处抛出上述错误。这与 0.4.28 修过的自动审查门禁是同一类缺陷(覆写官方代码却手工镜像 `inject`)。
6
+ - **修复**:`src/subagent-runtime.ts` 新增 `subagentRuntimeInject()`,从**已安装的官方运行时**读取 `inject` 声明并与 `modelSwitch` 去重合并,子类改用该函数生成列表——官方新增依赖会被自动镜像,不再过时;基类在 0.1.7/0.2.0 没有该声明时退回 `['modelSwitch']`。`tests/subagent-runtime.spec.ts` 新增 4 条守卫(镜像基类列表、无声明时保留路由服务、去重、挂载列表与已安装运行时一致)。
7
+ - **验证(virtual / 零真实额度)**:DSH `0.2.1-rc.5` lab 的 headless profile(真实宿主 + 虚拟探针 4731,模型回放一次 `subagent` 工具调用)。发布版 **0.4.60** 复现:工具结果为 `Error: cannot get property "workingDirectory" without inject`(会话 `session-f783b457`);装本修复构建后同一回放得到 `started subagent 4b1d65b1-1b91-4b41-a144-41cc7617e039`(`isError:false`,会话 `session-8ea93988`,探针记录 `D:\dsh-artifacts\probe-subagent.jsonl`)。自动审查/命名/记忆等其它接管行未改动。
8
+ - **残余**:0.4.61 装到桌面 profile 后需实际点一次子代理/团队委派确认(桌面宿主无法在 lab 内复刻)。0.1.7 / 0.2.0 的 `start()` 线依赖列表照旧合并,语义不变。
9
+
10
+ ## Unreleased
11
+
12
+ - **兼容巡检(2026-11-02,仅文档)**:DSH `latest` 仍是 `0.2.1-rc.5`(未移动,10-30/31 的验收结论继续有效);`dsh-prime-memory` 从 **0.26.16 移到 0.26.24**,其 `engines.dsh` 含 rc.5,已在 rc.5 lab + 本插件 0.4.60 下跑完七项接入检查(行激活、适配推送落地、无 `llm:` 静态钉、`settings-set` 读回、`effectiveCfg` 单测 9/9、免重启改路由 `replays:1→2`、蒸馏走新路由)。`docs/compat-watch-state.json` 记录 0.26.24 为已验证版本。**无代码改动,不发版。**
13
+
1
14
  ## v0.4.60
2
15
 
3
16
  纯读免审查默认名单扩展到 **84 条**(2026-11-01,按桌面端实际安装的插件重新校准)。
@@ -219,9 +219,38 @@ async function mountProfileRuntime(ctx) {
219
219
  }
220
220
  /** Profile replacement that selects the routed runtime or the untouched official runtime. */
221
221
  const profileSubagentRuntime = Object.assign(async (ctx) => mountProfileRuntime(ctx), {});
222
+ /**
223
+ * The services the official runtime declares for its own plugin.
224
+ *
225
+ * Subclassing keeps the official behavior, but cordis resolves a plugin's
226
+ * `inject` from the class it mounts — a static list on this subclass *replaces*
227
+ * the base class's list instead of adding to it. DSH 0.2.1's runtime declares
228
+ * `workingDirectory` and reads it on every activation
229
+ * (`ctx.workingDirectory.ensure(...)`); declaring only `modelSwitch` hid that
230
+ * dependency, so every delegation failed with
231
+ * `cannot get property "workingDirectory" without inject`. The list is read from
232
+ * the installed runtime instead of hard-coded so a future Host dependency is
233
+ * mirrored too.
234
+ */
235
+ const OFFICIAL_RUNTIME_INJECT = (() => {
236
+ const declared = OfficialSubagentRuntime.inject;
237
+ return Array.isArray(declared) ? [...declared] : [];
238
+ })();
239
+ /**
240
+ * The plugin dependency list for the mounted runtime.
241
+ *
242
+ * Static inheritance does not merge `inject`: cordis reads the static list off
243
+ * the class it mounts, so the subclass must repeat every service the official
244
+ * runtime's own code reads and add the route surface this adapter uses.
245
+ * @param officialInject - the installed runtime's declared dependencies (absent on 0.1.7/0.2.0).
246
+ * @returns The deduplicated list, official dependencies first.
247
+ */
248
+ function subagentRuntimeInject(officialInject) {
249
+ return [.../* @__PURE__ */ new Set([...officialInject ?? [], "modelSwitch"])];
250
+ }
222
251
  /** Official runtime with only a pre-descriptor route-selection adapter. */
223
252
  var ModelSwitchSubagentRuntime = class extends OfficialSubagentRuntime {
224
- static inject = ["modelSwitch"];
253
+ static inject = subagentRuntimeInject(OFFICIAL_RUNTIME_INJECT);
225
254
  routed(name, request) {
226
255
  const provider = this.ctx.subagents.getProvider(name);
227
256
  if (provider !== void 0 && provider.capabilities.agentOptions !== true) return request;
@@ -254,4 +283,4 @@ var ModelSwitchSubagentRuntime = class extends OfficialSubagentRuntime {
254
283
  }
255
284
  };
256
285
  //#endregion
257
- export { ModelSwitchSubagentRuntime, StartupIncompatibilityError, profileSubagentRuntime as default, profileSubagentRuntime, mountWithStartupFallback, routeSubagentRequest, routedRuntimeUnavailableNotice, subagentSurfaceOf };
286
+ export { ModelSwitchSubagentRuntime, StartupIncompatibilityError, profileSubagentRuntime as default, profileSubagentRuntime, mountWithStartupFallback, routeSubagentRequest, routedRuntimeUnavailableNotice, subagentRuntimeInject, subagentSurfaceOf };
@@ -86,6 +86,16 @@ export declare function mountWithStartupFallback<T>(candidate: (track: StartupCl
86
86
  export declare function routedRuntimeUnavailableNotice(error: StartupIncompatibilityError): string;
87
87
  /** Profile replacement that selects the routed runtime or the untouched official runtime. */
88
88
  export declare const profileSubagentRuntime: (ctx: Context) => Promise<() => Promise<void>>;
89
+ /**
90
+ * The plugin dependency list for the mounted runtime.
91
+ *
92
+ * Static inheritance does not merge `inject`: cordis reads the static list off
93
+ * the class it mounts, so the subclass must repeat every service the official
94
+ * runtime's own code reads and add the route surface this adapter uses.
95
+ * @param officialInject - the installed runtime's declared dependencies (absent on 0.1.7/0.2.0).
96
+ * @returns The deduplicated list, official dependencies first.
97
+ */
98
+ export declare function subagentRuntimeInject(officialInject: readonly string[] | undefined): string[];
89
99
  /** Official runtime with only a pre-descriptor route-selection adapter. */
90
100
  export declare class ModelSwitchSubagentRuntime extends OfficialSubagentRuntime {
91
101
  static inject: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model-switch",
3
- "version": "0.4.60",
3
+ "version": "0.4.61",
4
4
  "description": "Explicit model routing plus composer/Plan picker for DeepSeek Harness",
5
5
  "repository": {
6
6
  "type": "git",