dsh-subagent-default-model 2.1.13 → 2.1.15

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,64 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.15 (2026-11-06)
4
+
5
+ ### Changed
6
+
7
+ **插件详情页改为一段短简介,不再整篇渲染 README。**
8
+
9
+ DSH 0.2.2 起,插件页在名称、简介、开关下方新增「详细介绍文档」区块。宿主的解析顺序是(`dsh-plugin-detail` 的 `readPackageDocument` / `localeDetail`):
10
+
11
+ 1. 按界面语言走语言链(`zh-CN` → `zh` → `en`),依次读 `locale/<language>.json`;
12
+ 2. 取**第一个声明了** `meta.detail` 的值(某个 locale 文件存在但没写 `detail` 不算命中,继续往下走);
13
+ 3. 渲染该路径指向的 Markdown;
14
+ 4. **一个都没找到,就回落到包根目录的 README**。
15
+
16
+ 本项目的 README 有数百行,于是整篇被塞进一个 560px 高的滚动框。现在补上三处:
17
+
18
+ - 新增 `docs/DETAIL.zh.md`(82 字符)与 `docs/DETAIL.md`(95 字符);
19
+ - 新增 `locale/zh.json`、`locale/en.json`,`meta` 里各有 `title` / `description` / `detail`;
20
+ - `package.json` 的 `files` 补入 `locale` 与两条 `docs/` 明确路径。
21
+
22
+ **`en.json` 必须写**:它是语言链的最终兜底,只写 `zh.json` 的话英文界面(以及所有未单独提供的语言)照样回落 README 全文。
23
+
24
+ ### Tests
25
+
26
+ `178/178`(173 → 178),`skip 0`。新增 5 条守卫(`test/detail-docs.test.mjs`),分别钉住:
27
+
28
+ - 每个 `locale/*.json` 都声明了 `meta.detail`,且 `en.json` 存在;
29
+ - `meta.detail` 指向的文件**真实存在**且非空(指向不存在的文件不会安静回落,而是显示错误信息加「重试」按钮,比长文更糟);
30
+ - 每份文档 ≤ 100 字符(按字符总数,非字数),且不低于 40 字符;
31
+ - 这些文件都在 `package.json#files` 白名单内(漏了只在发布包里缺,恰好是没人跑测试的地方);
32
+ - 路径为包根相对、已规范化、以 `.md` 结尾。
33
+
34
+ 变异验证 4/4 命中:删掉 `en.json` 的 `detail`、把 `detail` 指向不存在的文件、把文案改超长、从 `files` 移除 `locale`,各自触发对应用例失败。
35
+
36
+ **用宿主自己的代码验证**:把 asar 里 `dsh-plugin-detail` 的 `document.js` / `files.js` 取出来,直接调用 `localFiles` + `readPackageDocument` + `languageChain` 解析本包:
37
+
38
+ | 界面语言 | 结果 |
39
+ | --- | --- |
40
+ | `zh-CN` / `zh` | `docs/DETAIL.zh.md`,82 字符 |
41
+ | `en-US` | `docs/DETAIL.md`,95 字符 |
42
+ | `ja-JP` | 按语言链回落英文,95 字符 |
43
+
44
+ 四种语言都没有 `invalid` 错误。
45
+
46
+ ## 2.1.14 (2026-11-05)
47
+
48
+ ### Fixed
49
+
50
+ **`agent.model.select()` 被拒时仍记账**(自查发现,2.1.13 的 npm 构建早于该修复)。
51
+
52
+ 原实现先 `pending.set(...)` 再调 `agent.model.select()`。一旦 `select()` 抛出,会记录一次**并未发生**的切换:`count` 被计满、该 step 被标记为「已处理」,于是那个池内候选被白白消耗,同一步也不再尝试它。
53
+
54
+ 改为 `select()` 成功后才记账,并补回归用例(`select` 先拒后成功,断言同一步仍能选到该候选)。
55
+
56
+ > **2.1.13 与 2.1.14 的关系**:2.1.13 的 npm 包在等待 2FA 授权**之前**就已打包,本修复是在那段等待期间提交的,因此没有进入 2.1.13。npm 上的 2.1.13 内容等于提交 `57891f0`,而修复在 `63956a1`。npm 版本不可覆盖,故发 2.1.14 承载修复。**请使用 2.1.14。** 该缺陷只在宿主拒绝 `select()` 的罕见路径下触发,其余 0.2.2 适配 2.1.13 已具备。
57
+
58
+ ### Docs
59
+
60
+ `RELEASING.md` 新增两条纪律:按下 `npm publish` 后不再改动任何要发布的文件;发布后必须下载真实 tarball 与 git tag 逐字节比对(「版本号对」不等于「内容对」)。
61
+
3
62
  ## 2.1.13 (2026-11-05)
4
63
 
5
64
  适配宿主 **0.2.2-rc.1**。这次不是行号位移,而是**一条契约收紧了语义**。
@@ -50,7 +109,7 @@
50
109
 
51
110
  ### Tests
52
111
 
53
- `172/172`(164 → 172),`skip 0`。新增 8 个用例覆盖新宿主路径:
112
+ `173/173`(164 → 173),`skip 0`。`integration.mjs` 16/16、`prove.mjs` 1/1。新增 9 个用例覆盖新宿主路径:
54
113
 
55
114
  - 下游重试成功时**不得**换路(否则重试成功后仍会留下一次无辜切换)
56
115
  - 无人重试时选中下一条池内路由,并**放行原始错误**(而非宿主 guard 错误)
@@ -58,10 +117,11 @@
58
117
  - 同一 step 最多选一次;下一个 step 可再选
59
118
  - 池耗尽不再选新候选、不再伪造 retry
60
119
  - `select()` 被拒时打 warn 且不吞原始错误
120
+ - `select()` 被拒时**不得**记账:候选不能被白白消耗,同一步仍须能再选它
61
121
  - AUTH 仍切换,且仍打「密钥可能无效」告警
62
122
  - 主代理循环仍不受影响
63
123
 
64
- 变异验证 4/4 命中:①新宿主仍走旧的 `agent/request` 覆盖路径 → 5 个用例失败;②`agent/request` 不提前 return → 原样返回用例失败;③忽略下游 retry → 不换路用例失败;④去掉「每 step 一次」限制 → 该用例失败。
124
+ 变异验证 5/5 命中:①新宿主仍走旧的 `agent/request` 覆盖路径 → 5 个用例失败;②`agent/request` 不提前 return → 原样返回用例失败;③忽略下游 retry → 不换路用例失败;④去掉「每 step 一次」限制 → 该用例失败;⑤把记账移回 `select()` 之前 → 候选被消耗用例失败。
65
125
 
66
126
  > 夹具也被修了:原来它只驱动 `agent/request` 并断言返回值变了,模拟的是**旧宿主契约**,所以在会抛错的新宿主上依然全绿。当宿主给契约加硬校验时,夹具必须把校验也加进去,否则它只是在自证清白。
67
127
 
package/docs/DETAIL.md ADDED
@@ -0,0 +1 @@
1
+ Default models for DSH subagents: pooled ordering, cross-provider failover, live route display.
@@ -0,0 +1 @@
1
+ 为 DSH 子代理指定默认模型:池内多个模型按顺序或随机分配,连接失败时自动切换到其他供应商的模型,并在轨迹与对话视图显示当前路由,同时把真实路由注入子代理上下文。
package/lib/index.js CHANGED
@@ -444,12 +444,6 @@ async function switchForNextStep(ctx, state, pending, payload, next) {
444
444
  if (target === void 0) return downstream;
445
445
  const tried = new Set(current?.tried ?? []);
446
446
  tried.add(index);
447
- pending.set(agent.id, {
448
- index,
449
- tried,
450
- count: (current?.count ?? 0) + 1,
451
- step
452
- });
453
447
  try {
454
448
  agent.model.select({
455
449
  provider: target.provider,
@@ -469,6 +463,15 @@ async function switchForNextStep(ctx, state, pending, payload, next) {
469
463
  );
470
464
  return downstream;
471
465
  }
466
+ // Record ONLY a selection that actually landed: an incremented `count` for a
467
+ // switch the host refused would retire a pool entry that was never used and
468
+ // stop the next step from retrying it.
469
+ pending.set(agent.id, {
470
+ index,
471
+ tried,
472
+ count: (current?.count ?? 0) + 1,
473
+ step
474
+ });
472
475
  ctx.logger.warn(
473
476
  `[dsh-subagent-default-model] subagent %s failed with %s on turn %d step %d; %s/%s is selected for its NEXT step (this host fixes the route of the failed step, so the current turn cannot continue on it)`,
474
477
  agent.id,
package/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-subagent-default-model",
4
+ "description": "Default models for DSH subagents, with pooled assignment and cross-provider failover.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-subagent-default-model",
4
+ "description": "为 DSH 子代理指定默认模型:多模型分配、跨供应商故障转移,并显示当前路由。",
5
+ "detail": "docs/DETAIL.zh.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-subagent-default-model",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "description": "为 DeepSeek Harness 子代理配置默认模型:多模型顺序/随机分配、跨供应商连接失败故障转移,并在轨迹/对话视图显示当前供应商与模型,同时以一行真实提示词把当前路由注入子代理上下文。",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -41,11 +41,14 @@
41
41
  "files": [
42
42
  "lib",
43
43
  "icons",
44
+ "locale",
44
45
  "cordis.patch.yml",
45
46
  "LICENSE",
46
47
  "README.md",
47
48
  "README.en.md",
48
- "CHANGELOG.md"
49
+ "CHANGELOG.md",
50
+ "docs/DETAIL.zh.md",
51
+ "docs/DETAIL.md"
49
52
  ],
50
53
  "scripts": {
51
54
  "test": "node --test",