dsh-subagent-default-model 1.2.1 → 1.2.3
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 +30 -0
- package/lib/index.js +41 -6
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.3 (2026-09-16)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- **故障转移切换到目标模型时,补上目标条目自己声明的 `reasoningEffort`**:`agent/request` 缝合处原本把继承来的 `reasoningEffort` 丢弃后**不再补值**,于是切换过去的请求仍带着上一条路由的 thinking 模式。对于「thinking 档位必须与 effort 一致」的 provider(pi-ai / anthropic-messages 一类),这会直接返回 `400 invalid thinking type, only be disabled when reasoning effort is none and enabled when reasoning effort is not none`。实测中该错误码为 `INVALID_REQUEST`、**不在**触发列表内,因此**不可重试**:故障转移把池子里所有候选逐个消耗在这个永远不可能成功的请求上,子代理最终失败——**尽管池中配置了健康模型**。现在目标条目声明了 effort 就用它;未声明时保持 `undefined`,由 adapter 解析该模型自身的 `defaultEffort`(或整个省略 reasoning 选项),不再继承目标可能不支持的上游档位。
|
|
8
|
+
- **故障转移不再重复选中本次运行已经切换过的池条目**:原 `nextFailoverIndex` 仅按 `count` 计数前进,不记录已尝试项;当无法从 `agent.session.requestContext()` 定位当前路由时(`found < 0`)直接回到 index 0,可能切回刚失败的模型或重复选同一个坏候选,白白消耗配额。现在按 `agent.id` 记录本次运行已切换到的索引集合并跳过它们;仅当全部条目都已尝试(或每次切换都失败)时才回落到普通轮询前进。
|
|
9
|
+
|
|
10
|
+
### Testing
|
|
11
|
+
|
|
12
|
+
- `plugin/test/failover.test.mjs` 新增两个回归用例:`applies the target entry's own reasoning effort when switching models`(断言切换产物为 `{ provider: "zzztoken", model: "deepseek-v4-pro", reasoningEffort: "max" }`)与 `does not re-select a pool entry this run already switched to`(三条目池,断言第二次切换落到未尝试过的条目)。前者已用回退验证确认可捕获原缺陷(回退实现即失败),不可静默回退。
|
|
13
|
+
- 为已有用例 `drops inherited reasoning effort when switching models` 补充注释,说明其断言仅适用于目标条目**未声明** effort 的情形,避免与新增用例的语义混淆。
|
|
14
|
+
- 全部 48 项测试通过(原 46 项 + 新增 2 项)。
|
|
15
|
+
|
|
16
|
+
## 1.2.2 (2026-09-10)
|
|
17
|
+
|
|
18
|
+
### Fixes
|
|
19
|
+
|
|
20
|
+
- **修复 peer 区间不接纳 DSH 0.1.5-rc.1(桌面 2.0.9 捆绑内核)**:原区间 `^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0` 在语义化版本预发布规则下**不匹配 `0.1.5-rc.1`**——一个预发布版本只有在同一比较器集合中存在**相同 `major.minor.patch` 元组**且带预发布标识的比较器时才可能被接纳;`>=0.1.2-alpha.1` 的元组是 `0.1.2`,无法为 `0.1.5` 承载预发布。实测在宿主已装 `0.1.5-rc.1`(即 DSH Desktop 2.0.9 的实际运行环境)时,npm 抛 `ERESOLVE overriding peer dependency` 并不满足警告,pnpm/严格模式与依赖审计同样判定不符。新增 `>=0.1.5-alpha.1 <0.2.0` 子句为 0.1.5 线提供同元组承载后,0.1.5-alpha.1 / alpha.2 / rc.1 / rc.2 全部被接纳,同时仍排除 `0.2.x`。
|
|
21
|
+
- **devDependencies 基线推进到 0.1.5 线**:`@deepseek-ai/dsh-settings` `0.1.2-rc.1` → `^0.1.5-rc.1`。此处**必须用范围而非精确锁定**:`dsh-settings@0.1.5-rc.1` 自身 peer 依赖 `@deepseek-ai/dsh-brand@^0.1.5-rc.1`,而该包当前只发布了 `0.1.5-rc.2`(`next` 通道),精确锁定 rc.1 会直接 ERESOLVE 装不上。这也印证了内核 0.1.5 线已进入 rc.2 迭代、不宜写死补丁版本。
|
|
22
|
+
|
|
23
|
+
### Testing
|
|
24
|
+
|
|
25
|
+
- 新增 `plugin/test/peer-range.test.mjs`:从 `package.json` 读取真实 peer 区间做契约回归,自带预发布感知的 semver 判定(已与官方 `semver` 对 12 个版本逐一比对一致)。断言覆盖:所有 peer 均带 0.1.5 元组承载子句;0.1.0-rc.6 起的全部受支持版本可被接纳(含 `0.1.5-rc.1` 这一回归点);`0.2.x` 仍被排除;并显式复现原区间拒绝 `0.1.5-rc.1` 的缺陷,使该问题不可静默回退。
|
|
26
|
+
- 全部 46 项测试在真实 `0.1.5` 线依赖上通过(含 default-model / failover / settings-install / client-trajectory 集成用例)。
|
|
27
|
+
|
|
28
|
+
### Compatibility
|
|
29
|
+
|
|
30
|
+
- 保留对旧宿主的支持:`^0.1.0-rc.6`、`^0.1.1-rc.2`、`>=0.1.2-alpha.1 <0.2.0` 三个原有子句逐字保留,未收窄任何既有可装区间。
|
|
31
|
+
- 生成器路径自动选择(`installSettingsSection` 在场则委托、否则走 `settings.installSection` 官方缝)未改动;`0.1.5-rc.1` 捆绑包中两种导出与官方缝均在场,两条路径均可用。
|
|
32
|
+
|
|
3
33
|
## 1.2.1 (2026-09-06)
|
|
4
34
|
|
|
5
35
|
### Fixes
|
package/lib/index.js
CHANGED
|
@@ -186,7 +186,8 @@ function isSubagentAgent(agent) {
|
|
|
186
186
|
* Pick the next pool index for one failed subagent request.
|
|
187
187
|
*
|
|
188
188
|
* - round-robin: the next entry after the currently-served model, wrapping
|
|
189
|
-
* around the list (the "queue")
|
|
189
|
+
* around the list (the "queue"), skipping entries this run already tried so a
|
|
190
|
+
* single bad candidate is not re-selected while an untried one remains.
|
|
190
191
|
* - random: any entry, without checking whether it was used before — a random
|
|
191
192
|
* pick may repeat the failing model, which is fine by design (simplest).
|
|
192
193
|
*/
|
|
@@ -195,13 +196,27 @@ function nextFailoverIndex(view, agent, current) {
|
|
|
195
196
|
if (strategy === "random") {
|
|
196
197
|
return Math.floor(Math.random() * entries.length);
|
|
197
198
|
}
|
|
198
|
-
|
|
199
|
+
const tried = current?.tried;
|
|
200
|
+
if (current !== void 0) {
|
|
201
|
+
// Advance from the last pick, taking the first entry this run has not used.
|
|
202
|
+
for (let step = 1; step <= entries.length; step += 1) {
|
|
203
|
+
const candidate = (current.index + step) % entries.length;
|
|
204
|
+
if (tried === void 0 || !tried.has(candidate)) return candidate;
|
|
205
|
+
}
|
|
206
|
+
return (current.index + 1) % entries.length;
|
|
207
|
+
}
|
|
199
208
|
// First failure: locate the served route in the pool and move to the next.
|
|
200
209
|
const served = agent.session?.requestContext?.();
|
|
201
210
|
const found = served === void 0 ? -1 : entries.findIndex((entry) =>
|
|
202
211
|
entry.provider === served.provider && entry.model === served.model
|
|
203
212
|
);
|
|
204
|
-
|
|
213
|
+
if (found < 0) return 0;
|
|
214
|
+
// Start after the served entry, preferring one this run has not used.
|
|
215
|
+
for (let step = 1; step <= entries.length; step += 1) {
|
|
216
|
+
const candidate = (found + step) % entries.length;
|
|
217
|
+
if (tried === void 0 || !tried.has(candidate)) return candidate;
|
|
218
|
+
}
|
|
219
|
+
return (found + 1) % entries.length;
|
|
205
220
|
}
|
|
206
221
|
|
|
207
222
|
/**
|
|
@@ -231,8 +246,13 @@ function installFailover(ctx, state) {
|
|
|
231
246
|
// `entries.length - 1` switches, then let the real error surface.
|
|
232
247
|
if (current !== void 0 && current.count >= view.entries.length - 1) return next(); // pool exhausted
|
|
233
248
|
const index = nextFailoverIndex(view, agent, current);
|
|
249
|
+
// Remember every pool entry this run has already been switched to, so a
|
|
250
|
+
// candidate that fails again is not selected a second time.
|
|
251
|
+
const tried = new Set(current?.tried ?? []);
|
|
252
|
+
tried.add(index);
|
|
234
253
|
pending.set(agent.id, {
|
|
235
254
|
index,
|
|
255
|
+
tried,
|
|
236
256
|
count: (current?.count ?? 0) + 1
|
|
237
257
|
});
|
|
238
258
|
ctx.logger.warn(
|
|
@@ -251,8 +271,21 @@ function installFailover(ctx, state) {
|
|
|
251
271
|
});
|
|
252
272
|
|
|
253
273
|
// On the rebuilt request for that subagent: swap the seed route for the
|
|
254
|
-
// pending pool entry
|
|
255
|
-
//
|
|
274
|
+
// pending pool entry, carrying the target's OWN request controls.
|
|
275
|
+
//
|
|
276
|
+
// The inherited `reasoningEffort` is dropped because it belongs to the route
|
|
277
|
+
// that just failed. The failure this fixes: without re-applying the target's
|
|
278
|
+
// declared effort, the fallback is dispatched with the previous route's
|
|
279
|
+
// thinking mode, and a provider whose thinking level must agree with the
|
|
280
|
+
// effort rejects it with e.g. "invalid thinking type, only be disabled when
|
|
281
|
+
// reasoning effort is none ...". That error is NOT retryable, so the
|
|
282
|
+
// failover burns every remaining candidate on a request that can never
|
|
283
|
+
// succeed — the subagent dies even though a healthy model was available.
|
|
284
|
+
//
|
|
285
|
+
// When the target declares no effort, sending the key as `undefined` is the
|
|
286
|
+
// correct dispatch: the adapter then resolves the model's own
|
|
287
|
+
// `defaultEffort` (or omits the reasoning option entirely), instead of
|
|
288
|
+
// inheriting a level the target may not support.
|
|
256
289
|
const disposeRequest = ctx.on("agent/request", async (payload, next) => {
|
|
257
290
|
const view = failoverView(state);
|
|
258
291
|
if (view === void 0) return next();
|
|
@@ -265,7 +298,9 @@ function installFailover(ctx, state) {
|
|
|
265
298
|
const seed = await next();
|
|
266
299
|
if (seed === void 0 || seed === null) return seed;
|
|
267
300
|
const { reasoningEffort: _inherited, ...rest } = seed;
|
|
268
|
-
|
|
301
|
+
const switched = { ...rest, provider: target.provider, model: target.model };
|
|
302
|
+
if (target.reasoningEffort !== void 0) switched.reasoningEffort = target.reasoningEffort;
|
|
303
|
+
return switched;
|
|
269
304
|
});
|
|
270
305
|
|
|
271
306
|
// Drop per-agent state once the subagent is disposed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-subagent-default-model",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Configure default model routes for DeepSeek Harness subagents, with single-model, round-robin, random, and per-route reasoning-effort options.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
72
|
-
"@deepseek-ai/dsh-subagent": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
73
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
74
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
75
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0",
|
|
78
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0"
|
|
71
|
+
"@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
72
|
+
"@deepseek-ai/dsh-subagent": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
73
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
74
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0",
|
|
78
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6 || ^0.1.1-rc.2 || >=0.1.2-alpha.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"@deepseek-ai/dsh-client-connection": {
|
|
@@ -99,6 +99,6 @@
|
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
102
|
-
"@deepseek-ai/dsh-settings": "0.1.
|
|
102
|
+
"@deepseek-ai/dsh-settings": "^0.1.5-rc.1"
|
|
103
103
|
}
|
|
104
104
|
}
|