dsh-subagent-default-model 2.1.5 → 2.1.6
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 +40 -0
- package/README.en.md +31 -14
- package/README.md +32 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.6 (2026-10-17)
|
|
4
|
+
|
|
5
|
+
### 兼容性核查:DSH Desktop 0.2.1-rc.2
|
|
6
|
+
|
|
7
|
+
当前宿主由 `0.2.1-rc.1` 升到 **`0.2.1-rc.2`**。逐项对照宿主源码(从 `app.asar` 解出 `dsh-agent-loop` / `dsh-session` / `dsh-subagent` / `dsh-app-boot`)核查,**插件行为无需改动**,但核查暴露了两个**与本插件逻辑无关、却会让护栏形同虚设**的问题,已一并修复。
|
|
8
|
+
|
|
9
|
+
| 检查项 | 结论 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| 插件加载与注入 | ✅ 派发子代理实测注入正常 |
|
|
12
|
+
| 4 个事件钩子 | ✅ `agent/pre-step`、`agent/request`、`agent/request-error`、`agent/disposed` 全部仍在 |
|
|
13
|
+
| `preStep()` → `buildRequest()` 时序 | ✅ 未变(定义在 `:902` / `:1214`;`request/context` 仍在 `buildRequest` 内 `:1271` 才 append) |
|
|
14
|
+
| `inbox.claim()` 先抽干 | ✅ 未变(`preStep` 首行 `:906`) |
|
|
15
|
+
| `session.requestContext()` 语义 | ⚠️ 折叠逻辑未变,但 **`isSeeded` 的含义被放宽** —— 见下 |
|
|
16
|
+
| `agent/pre-step` 决策契约 | ✅ 未变:默认分支仍返回 `{kind:"enter", messages}`,`kind:"reject"` 仍短路 |
|
|
17
|
+
| 子代理提示词提交方式 | ✅ 仍以 `{kind:"user"}` 入队,`republish` 视为 `firstAttempt` 重新提交,注入行不会被跳过 |
|
|
18
|
+
| peer 区间覆盖 | ✅ 宿主 `unmetRequirements()` 对 `0.2.1-rc.2` 返回「无未满足要求」 |
|
|
19
|
+
|
|
20
|
+
宿主的 `{{provider}}` / `{{model}}` 系统提示词变量依旧读 `agent.options`(派发时值),不含实时路由 —— 本插件注入行的价值不受影响。
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **「直连宿主评估器」用例其实从未真正执行过(第二次)**。2.1.5 修掉了它的「静默 `return` 被记为 pass」,但漏了另一半:它用 `require.resolve("asar")` 读 `app.asar`,而本仓**根本没有 `asar` 依赖**,`MODULE_NOT_FOUND` 被 `catch` 吞掉 → **每台机器都走 `t.skip`**。结果是一个被报告为「已覆盖」、实际上从未断言过任何东西的用例。修法:改为**零依赖手写解析 asar**(16 字节前言 + JSON 目录树 + 载荷偏移),现在该用例在 `macOS` 上真实读取宿主源码并执行宿主的 `unmetRequirements`,测试统计为 `skip 0`。
|
|
25
|
+
|
|
26
|
+
> 手写解析时踩到一次真实陷阱:目录树 JSON 的长度是**第 4 个** uint32(未补零),第 3 个含尾部补零,直接喂给 `JSON.parse` 会抛 `Unexpected non-whitespace character after JSON`。
|
|
27
|
+
|
|
28
|
+
- **「应当通过」的宿主版本清单再次滞后**:清单停在 `0.2.1-rc.1`,而真实运行的宿主已是 `0.2.1-rc.2`。已补入清单(`semver` 护栏 + 宿主评估器护栏两处)。这正是 2.1.5 记录过的同一类回归,说明「宿主升级时必须补一行」需要按流程执行,而不是当次偶然发现。
|
|
29
|
+
|
|
30
|
+
### Tests
|
|
31
|
+
|
|
32
|
+
- **新增回归用例**:`isSeeded` 含义放宽后,恢复会话在**本轮尚未结算请求**时必须保持沉默,结算后只报告**本轮**路由、绝不出现上一轮的 provider。变异验证:去掉 `isStaleFold()` 判定 → 2 项失败(新用例 + 原恢复会话用例)。
|
|
33
|
+
- **`peer-range.test.mjs` 现在真的会跑**:`tests 149 / pass 149 / fail 0 / skip 0`。变异验证:把 `dsh-llm` 单独改成 `>=0.1.7-rc.1 <0.2.1-0` → 2 项失败(区间护栏 + 宿主评估器护栏)。
|
|
34
|
+
|
|
35
|
+
### Docs
|
|
36
|
+
|
|
37
|
+
`DEVELOPMENT.md`:
|
|
38
|
+
|
|
39
|
+
1. 记录 `isSeeded` 在 0.2.1-rc.2 中**语义放宽**(`fromRestore` 现在要求显式 seed),并说明 `isStaleFold()` 为何在该含义下依然正确。
|
|
40
|
+
2. 新增「这个『直连用例』曾经又空转了一次」一节:**「跳过」不是「通过」,也不是「验证过」**;并记录 asar 头部的字段顺序陷阱。
|
|
41
|
+
3. 流程时序图的行号更新到 0.2.1-rc.2,并明确标注**行号是快照、不是契约**,每次升级重新 `grep`。
|
|
42
|
+
|
|
3
43
|
## 2.1.5 (2026-10-17)
|
|
4
44
|
|
|
5
45
|
### 兼容性核查:DSH Desktop 0.2.1-rc.1
|
package/README.en.md
CHANGED
|
@@ -4,7 +4,7 @@ English | [中文](README.md)
|
|
|
4
4
|
|
|
5
5
|
Pick the default model for subagent delegations in [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness), configured through the plugin's own settings card (its Cordis `Config`), stored in the profile's `cordis.patch.yml`.
|
|
6
6
|
|
|
7
|
-
When a
|
|
7
|
+
When a delegation request carries **no `agentOptions` at all**, this plugin supplies a default route from your settings before the host creates the subagent — so every `subagent`, `subagent_fork`, and any tool that omits `agentOptions` routes through it. Explicit per-call overrides always win; an absent or incomplete settings section keeps the historical behaviour (children inherit the parent route).
|
|
8
8
|
|
|
9
9
|
## Three core capabilities
|
|
10
10
|
|
|
@@ -185,24 +185,29 @@ Use the Web settings card (**Settings → Plugins → dsh-subagent-default-model
|
|
|
185
185
|
You can also edit the profile patch `~/.dsh/profiles/<profile>/cordis.patch.yml` directly: since DSH 0.1.7 that is where settings live, keyed by this plugin's Loader entry id `dsh-subagent-default-model`:
|
|
186
186
|
|
|
187
187
|
```yaml
|
|
188
|
+
# Multiple models (recommended): Capability 1 (distribution) + Capability 2 (cross-provider failover)
|
|
188
189
|
- id: dsh-subagent-default-model
|
|
189
190
|
name: dsh-subagent-default-model
|
|
190
191
|
config:
|
|
191
|
-
#
|
|
192
|
-
provider: deepseek-official
|
|
193
|
-
model: deepseek-v4-pro
|
|
194
|
-
|
|
195
|
-
# Or multiple models: Capability 1 (distribution) + Capability 2 (cross-provider failover)
|
|
196
|
-
provider: deepseek-official
|
|
192
|
+
provider: deepseek-official # entries in models[] without a provider inherit this
|
|
197
193
|
models:
|
|
198
194
|
- model: deepseek-v4-pro
|
|
199
195
|
reasoningEffort: high
|
|
200
196
|
- provider: other-provider # a model from another vendor
|
|
201
197
|
model: gpt-5.6
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
strategy: round-robin # round-robin (sequential) | random
|
|
199
|
+
failoverEnabled: true # switch across providers on connection failures
|
|
200
|
+
injectRouteContext: true # write the live provider/model into each subagent's context
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
To pin a **single** model, use `model` instead of `models` (never both in the same `config:`):
|
|
204
|
+
|
|
205
|
+
```yaml
|
|
206
|
+
- id: dsh-subagent-default-model
|
|
207
|
+
name: dsh-subagent-default-model
|
|
208
|
+
config:
|
|
209
|
+
provider: deepseek-official
|
|
210
|
+
model: deepseek-v4-pro
|
|
206
211
|
```
|
|
207
212
|
|
|
208
213
|
> **Upgrading from 0.1.6 or earlier**: the old configuration lived in the `subagent-default-model` section of `~/.dsh/settings.yaml`. 0.1.7 imports that file **once** and renames it to `settings.yaml.imported`, never reading it again. The import uses each section name verbatim as an entry id, while this plugin's entry id is `dsh-subagent-default-model` — so the old section is **not** imported (the host logs `section subagent-default-model … was not imported into entry subagent-default-model`) and the old values survive only in the renamed file. Move them into the `config:` block above by hand.
|
|
@@ -272,14 +277,26 @@ See the full description and sample text above. Implementation:
|
|
|
272
277
|
| Setting | `injectRouteContext`, on by default |
|
|
273
278
|
| Message source | `plugin:dsh-subagent-default-model` + `form: "route-context"` (the v4 session format requires a producer-owned `source.kind`) |
|
|
274
279
|
|
|
280
|
+
> **The line only appears once the route is known.**
|
|
281
|
+
>
|
|
282
|
+
> | Situation | Behaviour | Why |
|
|
283
|
+
> | --- | --- | --- |
|
|
284
|
+
> | Step 1 (no request settled yet) | **silent, nothing injected** | `preStep()` runs before `buildRequest()`, so no settled route exists yet. Guessing from the dispatch-time seed produced labels that did not match reality — saying nothing is better |
|
|
285
|
+
> | A **single-step** subagent | **may receive no line at all** | The direct consequence above. This is deliberate, not a fault |
|
|
286
|
+
> | Only half the route is known (provider but no model) | not rendered | Avoids emitting `model=unknown`, which a model may repeat back as fact |
|
|
287
|
+
> | A **resumed** session, before this run requests | does not reuse the previous run's route | At that moment the session fold describes the **previous** run — older than the dispatch seed |
|
|
288
|
+
>
|
|
289
|
+
> From step 2 onward (once the route settles) the line appears normally and updates when the route changes.
|
|
290
|
+
|
|
275
291
|
> **The two channels do not replace each other**: UI rows never enter the model's context, and the prompt injection never appears in your UI.
|
|
276
292
|
|
|
277
293
|
## How it works
|
|
278
294
|
|
|
279
295
|
```text
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
→
|
|
296
|
+
request already carries agentOptions → passed through untouched (this plugin never reads its settings)
|
|
297
|
+
else models[] has >=1 valid entry → pick one from models[] by strategy (round-robin / random)
|
|
298
|
+
else model (+ provider) is non-empty → use that single route
|
|
299
|
+
else → no injection; the host inherits the parent-session route
|
|
283
300
|
```
|
|
284
301
|
|
|
285
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`.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 中的子代理(subagent)派发选择默认模型,可通过插件自己的设置卡片(其 Cordis `Config`)配置,存在 profile 的 `cordis.patch.yml`。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
当派发请求**完全没有 `agentOptions`** 时,本插件注入配置的默认路由 —— 因此所有 `subagent`、`subagent_fork` 以及任何省略 `agentOptions` 的工具调用都会经过它。显式传参的覆盖始终生效;配置段缺失或不完整时保持原有行为(子代理继承父会话路由)。
|
|
8
8
|
|
|
9
9
|
## 三个核心功能
|
|
10
10
|
|
|
@@ -185,24 +185,29 @@ semver.satisfies(runtimeVersion, range, { includePrerelease: true })
|
|
|
185
185
|
也可以直接编辑 profile 的 patch 文件 `~/.dsh/profiles/<profile>/cordis.patch.yml`:DSH 0.1.7 起设置就存在这里,段名是本插件的 Loader 条目 id `dsh-subagent-default-model`:
|
|
186
186
|
|
|
187
187
|
```yaml
|
|
188
|
+
# 多模型(推荐):功能一(分配策略)+ 功能二(跨供应商故障转移)
|
|
188
189
|
- id: dsh-subagent-default-model
|
|
189
190
|
name: dsh-subagent-default-model
|
|
190
191
|
config:
|
|
191
|
-
#
|
|
192
|
-
provider: deepseek-official
|
|
193
|
-
model: deepseek-v4-pro
|
|
194
|
-
|
|
195
|
-
# 或多模型:功能一(分配策略)+ 功能二(跨供应商故障转移)
|
|
196
|
-
provider: deepseek-official
|
|
192
|
+
provider: deepseek-official # models 里未写 provider 的条目沿用这个
|
|
197
193
|
models:
|
|
198
194
|
- model: deepseek-v4-pro
|
|
199
195
|
reasoningEffort: high
|
|
200
|
-
- provider: other-provider
|
|
196
|
+
- provider: other-provider # 换一个供应商的模型
|
|
201
197
|
model: gpt-5.6
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
strategy: round-robin # round-robin(顺序) | random(随机)
|
|
199
|
+
failoverEnabled: true # 连接类失败时跨供应商切换
|
|
200
|
+
injectRouteContext: true # 把当前 provider/model 写进子代理上下文
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
若只想固定**一个**模型,改用 `model` 而不是 `models`(二者不要同时写在同一个 `config:` 里):
|
|
204
|
+
|
|
205
|
+
```yaml
|
|
206
|
+
- id: dsh-subagent-default-model
|
|
207
|
+
name: dsh-subagent-default-model
|
|
208
|
+
config:
|
|
209
|
+
provider: deepseek-official
|
|
210
|
+
model: deepseek-v4-pro
|
|
206
211
|
```
|
|
207
212
|
|
|
208
213
|
> **从 0.1.6 及更早版本升级**:旧版把配置写在 `~/.dsh/settings.yaml` 的 `subagent-default-model` 段。0.1.7 会在启动时把该文件**一次性导入并改名**为 `settings.yaml.imported`,改名后不再回读。导入按段名直接当条目 id 用,而本插件的条目 id 是 `dsh-subagent-default-model`,因此旧段**不会被导入**(宿主日志留一条 `section subagent-default-model … was not imported into entry subagent-default-model`),旧值只留在改名后的文件里——需要手工搬到上面的 `config:` 里。
|
|
@@ -272,14 +277,26 @@ CI 在 `ubuntu-latest`、`windows-latest`、`macos-latest` 三个平台上同时
|
|
|
272
277
|
| 开关 | `injectRouteContext`,默认开启 |
|
|
273
278
|
| 消息来源 | `plugin:dsh-subagent-default-model` + `form: "route-context"`(v4 会话格式要求生产者自有 `source.kind`) |
|
|
274
279
|
|
|
280
|
+
> **注入是有前提的:路由已知才会注入。**
|
|
281
|
+
>
|
|
282
|
+
> | 情形 | 行为 | 为什么 |
|
|
283
|
+
> | --- | --- | --- |
|
|
284
|
+
> | 第 1 步(本轮还没结算任何请求) | **静默,不注入** | `preStep()` 早于 `buildRequest()`,此时没有任何已结算的真实路由。拿派发时的旧种子去猜,会造成「标注与实际不符」——宁可不说 |
|
|
285
|
+
> | **单步子代理** | **可能完全收不到这一行** | 上面那条的直接后果。这是**刻意**的设计,不是故障 |
|
|
286
|
+
> | 路由只知一半(如只有 provider 没有 model) | 不渲染 | 避免输出 `model=unknown` 之类的占位符,被模型当事实复述 |
|
|
287
|
+
> | 恢复(resume)的会话,本轮尚未请求 | 不沿用上一轮的路由 | 会话折叠值此刻描述的是**上一轮**,比派发种子更旧 |
|
|
288
|
+
>
|
|
289
|
+
> 从第 2 步起(路由结算后),注入行会正常出现并在路由变化时更新。
|
|
290
|
+
|
|
275
291
|
> **两条通路互不替代**:界面行不会进入模型上下文;提示词注入也不会显示在你的界面上。
|
|
276
292
|
|
|
277
293
|
## 工作原理
|
|
278
294
|
|
|
279
295
|
```text
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
296
|
+
派发请求已带 agentOptions → 原样放行,完全不碰(不读本插件设置)
|
|
297
|
+
否则 models[] 有 ≥1 条有效条目 → 按 strategy 从 models[] 里取一条(round-robin / random)
|
|
298
|
+
否则 model(+ provider)非空 → 就用这一条路由
|
|
299
|
+
否则 → 不注入;由宿主自行继承父会话路由
|
|
283
300
|
```
|
|
284
301
|
|
|
285
302
|
插件包装宿主 `ctx.subagents` 服务(`start` / `startContinuable`),覆盖所有派发路径 —— 内置的 `subagent` / `subagent_fork` 工具,以及任何调用该服务但未提供 `agentOptions` 的自定义工具。
|
package/package.json
CHANGED