dsh-subagent-default-model 2.1.9 → 2.1.12

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,138 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.12 (2026-10-30)
4
+
5
+ ### Fixed
6
+
7
+ **issue #2:「保存」按钮永久灰着**。三条独立缺陷互相叠加,任一条都能单独锁死保存。
8
+
9
+ 1. **保存门禁包含非单调谓词**。`saveDisabled = busy || !dirty || hasIncompleteRoute`:点「添加模型」会在同一次点击里既让 `dirty=true`(启用保存)又让 `hasIncompleteRoute=true`(禁用保存),两个条件互相抵消,按钮永远不亮。并且这个谓词**无法通过 UI 满足**——模型目录为空时新行的 provider 只能是 `""`,Model 下拉又 `disabled: !route.provider`,于是 `!route.provider` 永远成立。
10
+
11
+ 改为 `busy || !(dirty || draftDiffers)`,与同作者三个插件(`trae` / `workbuddy` / `qoder`)的既有范式一致:**先把校验放在点击之后**,失败时用 `saveErrorState` 说清哪里不对。一个点不动的按钮无法告诉用户哪里错了,这正是缺陷本身。
12
+
13
+ 2. **空行被持久化成裸空串,死锁会跨重启存活**。`serializeDefaultModels` 对「provider 与首行相同且无 effort」的行只写 `route.model`,空行于是落盘为 `""`;`normalizeDefaultModels` 再把 `""` 还原成 `{ provider: <section provider>, model: "" }` —— 一个看上去可填、实际填不完的行。**只要带着空行保存过一次,下次启动就永久灰着**,用户完全不知道是自己那次保存写进去的。
14
+
15
+ 三处同时修:`save()` 丢弃全空行;`serializeDefaultModels` 自身兜底过滤;裸串优化加 `route.model` 前置条件(`{provider, model:""}` 这种「刚选好 provider 还没选模型」的行保持显式对象,不再退化成空串);`normalizeDefaultModels` 丢弃空条目,使旧版本写坏的历史文档也不会复活死锁。
16
+
17
+ 3. **空模型目录下 `addRoute()` 造出无法填完的行**。`groupsState` 为空时它写 `provider: ""`,而该值在 UI 上无法改变(provider 列表只有 `""`,model 下拉恒禁用)。改为**拒绝新增**并复用已有的 `row.catalogEmpty` 文案;目录可用时直接选中该 provider 的首个模型,让新行一出现就是合法的。
18
+
19
+ 4. **`dirty` 是纯组件内 state,卡片重挂载即丢**。卡片在离开 Plugins 页时卸载,重挂载时草稿从 scope 重新 seed,于是表单显示着用户刚才的值、`dirty` 却回到 false,保存按钮灰着且无任何解释。改为**派生**:比较草稿与已保存值(路由列表 + 三个开关),让「有没有改动」成为关于数据的事实,而不是一次被记住的交互。
20
+
21
+ ### Tests
22
+
23
+ 164/164(159 → 164),`skip 0`。新增 5 个回归用例,每条缺陷一个方向:
24
+
25
+ - 目录可用时点「添加模型」→ Save **变为可点**(旧门禁下恒为 disabled)
26
+ - 目录为空时点「添加模型」→ **不产生**路由行,并给出目录为空提示
27
+ - 全空行经保存链路 → **永不落盘为裸 `""`**
28
+ - **半填行**(选了 provider 未选 model)存在时 Save **仍可点** —— 缺陷核心的最小子集
29
+ - 未改动的重挂载 **不得**误报为有未保存改动
30
+
31
+ 变异验证(每条都确认相关用例失败后恢复):①门禁加回 `hasIncompleteRoute` → 半填用例失败;②`serializeDefaultModels` 裸串优化去掉 `route.model` 判空 → 空行落盘用例失败;③`addRoute` 恢复写 `provider: ""` → 目录为空用例失败。
32
+
33
+ ## 2.1.11 (2026-10-30)
34
+
35
+ > **发布说明**:本节的改动与下一节 2.1.10 的宿主兼容性核查**同批发布**,npm 上直接从 2.1.9 升到 2.1.11,2.1.10 没有单独发布过。保留两个条目是因为「换了宿主版本」和「改了行为」是两件独立的事,事后查证时分开更好读;`npm install` 请直接用 `2.1.11`。
36
+
37
+ ### Added
38
+
39
+ - **`applyToForkChildren` 开关(默认 `false`)**:控制 `subagent_fork` 子代理是否也使用本插件设定的模型。设置卡片里有对应复选框,双语文案说明代价。
40
+
41
+ **为什么默认关闭**:`fork` 通道(`inheritsParentContext === true`)是**用父会话日志的前缀播种**出来的,宿主的 `dsh-base` 刻意不给它模型选择权:
42
+
43
+ > Fork omits model selection so provider/model stay equal to the parent and the inherited history remains eligible for KV Cache reuse.
44
+
45
+ 插件此前对**所有**缺 `agentOptions` 的派发注入路由,包括 fork,于是这段刻意保留的前缀缓存直接失效。实测一个真实 fork 子代理的首个请求:`inputTokens: 144185` / `cacheReadTokens: 186` —— 14.4 万 token 的继承前缀在另一个供应商上被**全量重算**,命中率 0.13%。后续步骤会由新供应商自建缓存,所以损失是一次性的首请求惩罚,但金额很大。
46
+
47
+ **判定方式**:注入前查 `ctx.subagents.getProvider(spec.provider)?.inheritsParentContext`。为 `true` 时跳过(当前只有 `fork` 通道这样声明),并在**每个 provider 每个 fiber 只记一次** info 日志 —— 「配置了却没生效」必须可见(2.1.7 的教训),但不能按每次派发刷屏。
48
+
49
+ **显式传参优先**:fork 子代理若自带 `agentOptions`,照旧覆盖一切,开关不影响。
50
+
51
+ **未知 provider 照旧注入**:`getProvider` 返回 `undefined` 时按「不继承上下文」处理。把「读不到能力」当成「继承」会让所有自定义 provider 静默失去注入,方向反了。
52
+
53
+ ### Changed
54
+
55
+ - **破坏性变更(行为)**:`subagent_fork` 子代理默认**不再**使用配置的模型,改为继承父路由。这是 2.1.7 起一直存在的行为,本次修正。依赖旧行为的用户请显式设置 `applyToForkChildren: true`。
56
+ - 双语文档(`README.md` / `README.en.md` / `plugin/README.md` / `plugin/README.en.md`)中「覆盖 `subagent_fork`」的说法全部改为「覆盖,但默认让位」,并在配置表补 `applyToForkChildren` 一行。
57
+
58
+ ### Tests
59
+
60
+ 新增 6 个用例(153 → 159):
61
+
62
+ - fork 子代理默认不注入、且**保持请求对象同一性**(宿主比较 identity,无谓克隆是隐式行为变化)
63
+ - 同一份配置下 spawn 仍然注入(证明门禁只针对 fork,没有误伤)
64
+ - `applyToForkChildren: true` 时 fork 跟随配置路由
65
+ - fork 上**显式** `agentOptions` 优先级不受开关影响
66
+ - 未知 provider 仍被注入(能力读取失败不得静默关闭功能)
67
+ - `applyToForkChildren` 默认值必须是 `false`(默认值是承重的,不是装饰)
68
+
69
+ 配套修正两个**会误伤新增字段**的旧用例:`settings-install` 里「all seven fields」把断言写死成 7 个键,`settings-write-gate` 的原子保存字段表也没包含新键 —— 前者改成与 `Config` 自身声明键比对(守住「字段不被丢弃」的真实语义,不再钉住数量),后者补上新字段并用**真实宿主写入门**验证它能被接受。
70
+
71
+ 变异验证:①去掉 fork 门禁 → 默认用例失败;②默认值改 `true` → 两个用例失败。恢复后 159/159。
72
+
73
+ 真实 `apply()` 端到端复核(非夹具):fork → `agentOptions = undefined`,spawn → `{provider:"pool",model:"M1"}`。
74
+
75
+ ## 2.1.10 (2026-10-30)
76
+
77
+ ### 兼容性核查:DSH Desktop 0.2.1-rc.5
78
+
79
+ 当前宿主由 `0.2.1-rc.3` 升到 **`0.2.1-rc.5`**(nightly 渠道,2026-10-30 安装)。**插件运行逻辑零改动**(`plugin/lib/index.js` / `plugin/lib/client.js` 未动一行)——本版只做核查与清单维护。
80
+
81
+ 这次核查比 2.1.8 更彻底:把宿主 `desktop-runtime.json` 列出的**全部 305 个随包**都按 rc.3 / rc.5 各拉一份做逐文件比对(而非只挑几个包看)。
82
+
83
+ **305 个包里只有 10 个有真实代码改动**,且全部落在插件未触碰的面上:
84
+
85
+ | 包 | 改动 | 与本插件的关系 |
86
+ | --- | --- | --- |
87
+ | `dsh-client-ui-chat` | **推理文本展示**:新增 `reasoningText()`,把模型输出里 `<signature>…</signature>` 包裹的签名段剥离后再展示;`ReasoningBodyOwnerProps` 增加 `rawText`,`ReasoningContentInput` 不再继承 owner props(改为显式 `text` + `running`) | 插件只注册**自有 kind** 的 chat 渲染器(`chat-subagent-model-notice`)与本地的 `conversation.chat.node` 槽位,从不渲染 reasoning 行;`isVisibleChatNode()` 的白名单/黑名单规则未变 |
88
+ | `dsh-client-ui-conversation` | View 标签页 tooltip 改为**按估算宽度按需出现**(`labelNeedsTooltip`)、移除 `session.moreViewsCurrent` 文案 | 插件用的 `conversation.chat.node` 槽位与 `request/header` 帧语义完全未变 |
89
+ | `dsh-client-ui-settings-account` / `-general` / `dsh-client-ui-sidebar` | 版本号字符串(`0.2.1-rc.3` → `0.2.1-rc.5`、构建标记 `rc.5-d4db512`) | 纯版本串 |
90
+ | `dsh-llm-deepseek-account` | 一行日志级别 `console.info` → `console.error` | 与插件的故障转移无关 |
91
+ | `dsh-mcp-client` | `resources/list` 前先查 `getServerCapabilities()?.resources`,不支持时返回空列表而非报错 | 与本插件无关 |
92
+ | `dsh-experimental-client-ui-cot-translation` | 跟随 chat 的 reasoning 改动(仅注释 + 契约描述) | 与本插件无关 |
93
+ | `dsh-cordis-client-runner` | 内嵌 Slots 契约的**源码行号引用**(`slots.ts:441` → `:447` 等) | 纯文档字符串 |
94
+ | `dsh-client-modules` | 内嵌构建 commit 号 | 纯字符串 |
95
+
96
+ 插件依赖的 `dsh-agent-loop`、`dsh-subagent`、`dsh-tool-subagent`、`dsh-llm`、`dsh-settings`、`dsh-app-boot`、`dsh-agent`、`dsh-agent-preset`、`dsh-experimental-agent-team`、`dsh-tool-subagent-control`、`dsh-session`、`dsh-llm-retry`、`dsh-llm-deepseek`、`dsh-llm-pi-ai`、`dsh-plugin-manager`、`dsh-host-plugin-inventory`:**逐文件比对为零改动**(仅 `package.json` 版本号)。
97
+
98
+ **从运行中的 `app.asar` 直接读源码复核的契约(行号均为 rc.5 实测)**:
99
+
100
+ | 检查项 | 结论 |
101
+ | --- | --- |
102
+ | 插件加载与注入 | ✅ 运行中的宿主已挂载本插件行(`include:dsh-subagent-default-model`),`Config` 投影出全部 7 个 volatile 字段 |
103
+ | 4 个事件钩子 | ✅ `agent/pre-step`(`:909`)、`agent/request`(`:1191`)、`agent/request-error`(`:1136`)、`agent/disposed`(`:1663`)全部仍在 |
104
+ | `preStep()` → `buildRequest()` 时序 | ✅ 未变(`:902` / `:1214`;`request/context` 仍在 `:1271` 才 append) |
105
+ | `inbox.claim()` 先抽干 | ✅ 未变(`preStep` 首行 `:906`,仍在 `agent/pre-step` 瀑布之前) |
106
+ | `session.requestContext()` 语义 | ✅ 未变(`dsh-session` `:1627`) |
107
+ | 派发入口 | ✅ 仍只有 `startActivation(spec)`(`dsh-subagent` `:3036`),插件的包装点有效 |
108
+ | `agentOptions` 组装语义 | ✅ 未变:宿主仅在**显式**选择路由时才带上 `agentOptions`(`dsh-tool-subagent` `:470`),「无显式路由 → 插件注入」这条前提依然成立 |
109
+ | `request/header` 帧 | ✅ `initial` / `resume` / `change` / `series` 四种 `reason` 未变(`:1226`–`:1240`) |
110
+ | 失败码词表 | ✅ 未变(`RATE_LIMIT` / `QUOTA` / `ACCOUNT_QUOTA` / `SERVER` / `TIMEOUT` / `TRANSPORT` / `EMPTY_RESPONSE` / `INVALID_CREDENTIAL` / `CONTEXT_WINDOW_EXCEEDED` 等) |
111
+ | 客户端槽位 | ✅ `conversation.chat.node` 与 `plugins.bundle.config` / `plugins.row.config` 全部存在;本插件的 `chat-subagent-model-notice` 渲染器在运行中**处于 active** |
112
+ | `cordis.original` 符号 | ✅ 仍在(插件据此拿到 `ctx.subagents` 背后的原始服务对象) |
113
+ | peer 区间覆盖 | ✅ 宿主 `unmetRequirements()` 对 `0.2.1-rc.5` 返回「无未满足要求」 |
114
+
115
+ **端到端实测**(不是静态推断):在本机派发一个真实子代理,其 `subagent/descriptor` 固化了 `agentProvider: "dsh-opencode-go"` / `agentModel: "deepseek-v4.1-flash"` / `agentReasoningEffort: "high"` —— 与配置池一致,说明 `startActivation` 注入确实发生;子代理会话日志里也能读到插件写入的 `route-context` 行(`source.kind = plugin:dsh-subagent-default-model`)。
116
+
117
+ ### Fixed
118
+
119
+ - **「应当通过」的宿主版本清单第四次滞后**:清单停在 `0.2.1-rc.3`,而真实运行的宿主已是 `0.2.1-rc.5`。2.1.8 新增的自检用例「the RUNNING host version must be admitted」**按预期直接失败**(`the running host 0.2.1-rc.5 must be listed in ADMITTED_HOST_VERSIONS`),没有靠人记得补——这次护栏真的起了作用。
120
+
121
+ 清单补上 `0.2.1-rc.4` **与** `0.2.1-rc.5`:升级路径跨过了 rc.4,而该用例只断言**本机装的那一个**版本;若只补 rc.5,一台仍停在 rc.4 的机器上跑同一份已评审清单就会失败。判据已写进 `DEVELOPMENT.md`:清单描述的是「已评审过的宿主版本集合」,不是「我这台机器上的那一个」。
122
+
123
+ - 变异验证:把 `0.2.1-rc.5` 从清单里去掉 → 该用例失败;放回去 → 通过。
124
+
125
+ ### Docs
126
+
127
+ `DEVELOPMENT.md`:
128
+
129
+ 1. 「宿主升级流程」补两节:**跨多个 rc 升级要把跳过的版本也补进清单**;**逐包比对的正确姿势**(用 `desktop-runtime.json` 的全量包清单做 `diff -rq`,把「真有改动」与「只是版本号变了」分开)。
130
+ 2. 契约行号表增补 rc.5 一列,并加 `agent/request-error` / `agent/request` 两行。
131
+
132
+ ### Tests
133
+
134
+ 全量:`tests 153 / pass 153 / fail 0 / skip 0`(用例数与 2.1.9 相同,本版未新增用例)。
135
+
3
136
  ## 2.1.9 (2026-10-26)
4
137
 
5
138
  ### Changed
package/README.en.md CHANGED
@@ -4,7 +4,9 @@ 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 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).
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 `subagent`, `spawn_teammate`, 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
+
9
+ **Exception: `subagent_fork` does not go through this by default.** A `fork` child inherits the parent's whole conversation, and the host deliberately keeps it on the parent's route so that prefix stays eligible for KV-cache reuse — so this plugin stands aside (`applyToForkChildren: false`). Opt in from the settings card to reroute it.
8
10
 
9
11
  ## Three core capabilities
10
12
 
@@ -299,7 +301,9 @@ else model (+ provider) is non-empty → use that single route
299
301
  else → no injection; the host inherits the parent-session route
300
302
  ```
301
303
 
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`.
304
+ 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 — the built-in `subagent` tool, the agent-team `spawn_teammate` path, and any custom tool that calls the service without providing `agentOptions`.
305
+
306
+ `subagent_fork` is inside that wrapping too, but it is **not** injected by default: before injecting, the plugin reads the delegated provider's `inheritsParentContext`, and a channel advertising `true` (currently only `fork`) keeps the parent route unless `applyToForkChildren: true` is configured.
303
307
 
304
308
  ## License
305
309
 
package/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  为 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 中的子代理(subagent)派发选择默认模型,可通过插件自己的设置卡片(其 Cordis `Config`)配置,存在 profile 的 `cordis.patch.yml`。
6
6
 
7
- 当派发请求**完全没有 `agentOptions`** 时,本插件注入配置的默认路由 —— 因此所有 `subagent`、`subagent_fork` 以及任何省略 `agentOptions` 的工具调用都会经过它。显式传参的覆盖始终生效;配置段缺失或不完整时保持原有行为(子代理继承父会话路由)。
7
+ 当派发请求**完全没有 `agentOptions`** 时,本插件注入配置的默认路由 —— 因此 `subagent`、`spawn_teammate` 以及任何省略 `agentOptions` 的工具调用都会经过它。显式传参的覆盖始终生效;配置段缺失或不完整时保持原有行为(子代理继承父会话路由)。
8
+
9
+ **例外:`subagent_fork` 默认不走这里。** `fork` 通道会继承父会话的完整对话,宿主刻意让它留在父路由上以复用该前缀的 KV 缓存,所以本插件默认让它让位(`applyToForkChildren: false`)。要让它也用这里的模型,在设置卡片里显式打开。
8
10
 
9
11
  ## 三个核心功能
10
12
 
@@ -299,7 +301,9 @@ CI 在 `ubuntu-latest`、`windows-latest`、`macos-latest` 三个平台上同时
299
301
  否则 → 不注入;由宿主自行继承父会话路由
300
302
  ```
301
303
 
302
- 插件包装宿主 `ctx.subagents` 服务(DSH 0.2.x 的 `startActivation`,以及旧版 `start` / `startContinuable`),覆盖所有派发路径 —— 内置的 `subagent` / `subagent_fork` 工具、agent-team 的 `spawn_teammate`,以及任何调用该服务但未提供 `agentOptions` 的自定义工具。
304
+ 插件包装宿主 `ctx.subagents` 服务(DSH 0.2.x 的 `startActivation`,以及旧版 `start` / `startContinuable`),覆盖所有派发路径 —— 内置的 `subagent` 工具、agent-team 的 `spawn_teammate`,以及任何调用该服务但未提供 `agentOptions` 的自定义工具。
305
+
306
+ `subagent_fork` 也在包装范围内,但默认**不注入**:注入前会查被委派 provider 的 `inheritsParentContext`,该值为 `true` 的通道(目前只有 `fork`)默认保持父路由,除非配置 `applyToForkChildren: true`。
303
307
 
304
308
  ## 许可证
305
309
 
package/lib/client.js CHANGED
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
30
30
 
31
31
  // ── plugin icon (LD brand logo, 64px) ────────────────────────────────
32
32
  var DSM_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAXGUlEQVR4nH1bC7BdVXn+1tr7nHPvzb3JvUloSAQp0JHWoAMttKOCFrWU8irQSbCTQYG21IahnTJUUTsM0FJhZCzCSIcKImOpDkhrhQ5YC7ROB3lUBU3EyCuBFBIIedzcx3ntvTr/a621TwIns3PO3mfvddf/+v7v/9c6DvYKoYBz1cZNYfJpVBcNBm7dcIhj3TBM15VzqAE6XAWEGggVADroOl0byDW+PtRr9E732rl9r2PxOMNsrCogVE7PA0Kge4Lcz5/TGI6v00UaK+h98u4QUA9quIDg4Pe2i2LTsknc++mzZu9cv37VHNaFAveSJICj/9aFUNzrXHXSTwdnznl/Y+X9MaE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SS = ".dsm-model-settings{display:flex;flex-direction:column;gap:14px;margin:0;padding:0}.dsm-model-settings-list{display:flex;flex-direction:column;gap:10px}.dsm-model-settings-route{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto;gap:8px;align-items:end;padding:10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:10px;background:var(--dsw-alias-bg-layer-3,#202126)}.dsm-model-settings-field{display:flex;flex-direction:column;gap:4px;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-select{width:100%;max-width:220px;height:32px;padding:0 28px 0 10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:var(--dsw-alias-bg-layer-2,#232529);color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;font-size:13px;line-height:1.5}.dsm-model-settings-select:focus{outline:2px solid var(--dsw-alias-state-business-primary,#5686fe);outline-offset:1px}.dsm-model-settings-select:disabled{color:var(--dsw-alias-label-tertiary,#999);cursor:default}.dsm-model-settings-remove{height:32px;min-width:32px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer;font-size:16px;line-height:1}.dsm-model-settings-remove:hover{color:var(--dsw-alias-state-error-primary,#ef4444);background:var(--dsw-alias-interactive-bg-hover-danger,rgba(242,90,90,.15))}.dsm-model-settings-options{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dsm-model-settings-strategy{display:flex;align-items:center;gap:8px;white-space:nowrap;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-strategy .dsm-model-settings-select{max-width:150px}.dsm-model-settings-failover{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-failover input[type=checkbox]{cursor:pointer}.dsm-failover-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999);white-space:nowrap}.dsm-model-settings-inject-route{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-inject-route input[type=checkbox]{cursor:pointer}.dsm-inject-route-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999)}.dsm-model-settings-footer{border-top:1px solid var(--dsw-alias-border-l2,#36373b);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 0 4px}.dsm-model-settings-footer-left{display:flex;align-items:center;gap:10px;flex:1;min-width:0}.dsm-model-settings-footer-status{flex:1;min-width:0;color:var(--dsw-alias-label-secondary,#b8b8b8);font-size:12px;line-height:1.5}.dsm-model-settings-footer-error{flex:1;min-width:0;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:1.5}.dsm-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid transparent;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.dsm-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px}.dsm-btn:disabled{opacity:.4;cursor:default}.dsm-btn-outline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:transparent;font-weight:500}.dsm-btn-outline:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed);background:rgba(255,255,255,.04)}.dsm-btn-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.dsm-btn-primary:hover:not(:disabled){opacity:.9}.dsm-model-settings-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-plugin-card{border:1px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-3,#202126);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dsm-plugin-card:hover{border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-open{background:var(--dsw-alias-bg-layer-2,#25262b);border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:transparent;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dsm-plugin-card-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:-2px}.dsm-plugin-card-head{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dsm-plugin-card-title{color:var(--dsw-alias-label-primary,#e6e6e6);font-size:15px;font-weight:600;line-height:1.4}.dsm-plugin-card-description{color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5}.dsm-plugin-card-chevron{color:var(--dsw-alias-label-tertiary,#999);flex:none;display:inline-flex;transition:transform .16s}.dsm-plugin-card-chevron-open{transform:rotate(180deg)}.dsm-plugin-card-caret{color:inherit;font-size:12px;line-height:1;display:inline-flex}.dsm-plugin-card-body{border-top:1px solid var(--dsw-alias-border-l2,#36373b);margin:0 16px;padding:0 0 8px}.dsm-plugin-card-body .dsm-model-settings{margin:0;padding:12px 0 0;background:transparent;border:0;border-radius:0}.dsm-plugin-card-body .dsm-model-settings-head{display:none}.dsm-plugin-card-icon{width:32px;height:32px;flex:none;border-radius:7px}.dsm-model-settings-cheer{display:inline-flex;align-items:center;gap:4px;flex:none;text-decoration:underline;text-underline-offset:2px;color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5;transition:color .16s}.dsm-model-settings-cheer-star{font-size:12px;line-height:1;display:inline-flex}.dsm-model-settings-cheer:hover{color:var(--dsw-alias-label-primary,#e6e6e6)}.dsm-model-settings-cheer:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:2px}.dsm-model-settings-warn{grid-column:1/-1;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}.dsm-model-settings-warn-list{display:flex;flex-direction:column;gap:4px;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}.dsm-notice-row{display:flex;flex-direction:column;gap:4px;margin:6px 0;font-size:12px}.dsm-notice-toggle{appearance:none;font:inherit;cursor:pointer;background:transparent;border:0;padding:2px 0;display:flex;align-items:center;gap:6px;color:var(--dsw-alias-label-tertiary,#9a9a9a);text-align:left;min-width:0}.dsm-notice-toggle:hover{color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-notice-toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px;border-radius:3px}.dsm-notice-dot{flex:none;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-label-caption,#777)}.dsm-notice-label{flex:none;font-weight:500}.dsm-notice-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-notice-summary:before{content:'·';margin-right:6px;color:var(--dsw-alias-label-caption,#777)}.dsm-notice-body{margin:0;padding:8px 10px;border-left:2px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-1,#1b1b1d);color:var(--dsw-alias-label-secondary,#b8b8b8);font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere;max-height:420px;overflow:auto}";
33
+ var SETTINGS_CSS = ".dsm-model-settings{display:flex;flex-direction:column;gap:14px;margin:0;padding:0}.dsm-model-settings-list{display:flex;flex-direction:column;gap:10px}.dsm-model-settings-route{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto;gap:8px;align-items:end;padding:10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:10px;background:var(--dsw-alias-bg-layer-3,#202126)}.dsm-model-settings-field{display:flex;flex-direction:column;gap:4px;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-select{width:100%;max-width:220px;height:32px;padding:0 28px 0 10px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:var(--dsw-alias-bg-layer-2,#232529);color:var(--dsw-alias-label-primary,#e6e6e6);font:inherit;font-size:13px;line-height:1.5}.dsm-model-settings-select:focus{outline:2px solid var(--dsw-alias-state-business-primary,#5686fe);outline-offset:1px}.dsm-model-settings-select:disabled{color:var(--dsw-alias-label-tertiary,#999);cursor:default}.dsm-model-settings-remove{height:32px;min-width:32px;border:1px solid var(--dsw-alias-border-l2,#36373b);border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer;font-size:16px;line-height:1}.dsm-model-settings-remove:hover{color:var(--dsw-alias-state-error-primary,#ef4444);background:var(--dsw-alias-interactive-bg-hover-danger,rgba(242,90,90,.15))}.dsm-model-settings-options{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dsm-model-settings-strategy{display:flex;align-items:center;gap:8px;white-space:nowrap;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-model-settings-strategy .dsm-model-settings-select{max-width:150px}.dsm-model-settings-failover{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-failover input[type=checkbox]{cursor:pointer}.dsm-failover-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999);white-space:nowrap}.dsm-model-settings-inject-route{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-inject-route input[type=checkbox]{cursor:pointer}.dsm-inject-route-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999)}.dsm-model-settings-apply-fork{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer}.dsm-model-settings-apply-fork input[type=checkbox]{cursor:pointer}.dsm-apply-fork-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#999)}.dsm-model-settings-footer{border-top:1px solid var(--dsw-alias-border-l2,#36373b);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 0 4px}.dsm-model-settings-footer-left{display:flex;align-items:center;gap:10px;flex:1;min-width:0}.dsm-model-settings-footer-status{flex:1;min-width:0;color:var(--dsw-alias-label-secondary,#b8b8b8);font-size:12px;line-height:1.5}.dsm-model-settings-footer-error{flex:1;min-width:0;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:1.5}.dsm-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid transparent;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}.dsm-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px}.dsm-btn:disabled{opacity:.4;cursor:default}.dsm-btn-outline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:transparent;font-weight:500}.dsm-btn-outline:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed);background:rgba(255,255,255,.04)}.dsm-btn-primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}.dsm-btn-primary:hover:not(:disabled){opacity:.9}.dsm-model-settings-hint{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-plugin-card{border:1px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-3,#202126);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dsm-plugin-card:hover{border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-open{background:var(--dsw-alias-bg-layer-2,#25262b);border-color:var(--dsw-alias-label-dimmed,#777)}.dsm-plugin-card-header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:transparent;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dsm-plugin-card-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:-2px}.dsm-plugin-card-head{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dsm-plugin-card-title{color:var(--dsw-alias-label-primary,#e6e6e6);font-size:15px;font-weight:600;line-height:1.4}.dsm-plugin-card-description{color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5}.dsm-plugin-card-chevron{color:var(--dsw-alias-label-tertiary,#999);flex:none;display:inline-flex;transition:transform .16s}.dsm-plugin-card-chevron-open{transform:rotate(180deg)}.dsm-plugin-card-caret{color:inherit;font-size:12px;line-height:1;display:inline-flex}.dsm-plugin-card-body{border-top:1px solid var(--dsw-alias-border-l2,#36373b);margin:0 16px;padding:0 0 8px}.dsm-plugin-card-body .dsm-model-settings{margin:0;padding:12px 0 0;background:transparent;border:0;border-radius:0}.dsm-plugin-card-body .dsm-model-settings-head{display:none}.dsm-plugin-card-icon{width:32px;height:32px;flex:none;border-radius:7px}.dsm-model-settings-cheer{display:inline-flex;align-items:center;gap:4px;flex:none;text-decoration:underline;text-underline-offset:2px;color:var(--dsw-alias-label-tertiary,#999);font-size:13px;line-height:1.5;transition:color .16s}.dsm-model-settings-cheer-star{font-size:12px;line-height:1;display:inline-flex}.dsm-model-settings-cheer:hover{color:var(--dsw-alias-label-primary,#e6e6e6)}.dsm-model-settings-cheer:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:2px}.dsm-model-settings-warn{grid-column:1/-1;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}.dsm-model-settings-warn-list{display:flex;flex-direction:column;gap:4px;color:var(--dsw-alias-label-error,#ef4444);font-size:12px;line-height:18px}.dsm-notice-row{display:flex;flex-direction:column;gap:4px;margin:6px 0;font-size:12px}.dsm-notice-toggle{appearance:none;font:inherit;cursor:pointer;background:transparent;border:0;padding:2px 0;display:flex;align-items:center;gap:6px;color:var(--dsw-alias-label-tertiary,#9a9a9a);text-align:left;min-width:0}.dsm-notice-toggle:hover{color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-notice-toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#5686fe);outline-offset:1px;border-radius:3px}.dsm-notice-dot{flex:none;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-label-caption,#777)}.dsm-notice-label{flex:none;font-weight:500}.dsm-notice-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary,#b8b8b8)}.dsm-notice-summary:before{content:'·';margin-right:6px;color:var(--dsw-alias-label-caption,#777)}.dsm-notice-body{margin:0;padding:8px 10px;border-left:2px solid var(--dsw-alias-border-l2,#36373b);background:var(--dsw-alias-bg-layer-1,#1b1b1d);color:var(--dsw-alias-label-secondary,#b8b8b8);font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere;max-height:420px;overflow:auto}";
34
34
 
35
35
  if (typeof document !== "undefined") {
36
36
  var cssId = "dsh-subagent-default-model/client.css";
@@ -94,6 +94,8 @@ window.__ModuleLoader__.load({
94
94
  "row.failoverHint": "(需配置 ≥2 个 Provider,切换才会生效)。",
95
95
  "row.injectRouteContext": "把当前模型与供应商写进子代理上下文",
96
96
  "row.injectRouteContextHint": "(子代理因此能回答自己跑在哪个模型上;这是一行真实提示词,不是界面显示)。",
97
+ "row.applyToForkChildren": "让 subagent_fork 子代理也使用这里设定的模型",
98
+ "row.applyToForkChildrenHint": "(默认关闭。fork 子代理会继承父会话的完整对话,宿主因此让它留在父路由上,好让这段前缀能复用缓存;开启后它会改用这里的模型,代价是那段继承的上下文要在新模型上重新算一次)。",
97
99
  "row.trajectoryModel": "当前供应商/模型",
98
100
  "row.chatModelInitial": "当前供应商/模型",
99
101
  "row.chatModelChange": "已切换到",
@@ -132,6 +134,8 @@ window.__ModuleLoader__.load({
132
134
  "row.failoverHint": "(requires at least 2 configured providers).",
133
135
  "row.injectRouteContext": "Tell subagents which model and provider they run on",
134
136
  "row.injectRouteContextHint": "(so a subagent can answer which model it is; this is a real prompt line, not a display row).",
137
+ "row.applyToForkChildren": "Also apply these models to subagent_fork children",
138
+ "row.applyToForkChildrenHint": "(off by default. A fork child inherits the parent's full conversation, so the host keeps it on the parent's route to preserve cache reuse of that prefix; turning this on moves it to the configured model and re-runs the inherited context once on the new model).",
135
139
  "row.trajectoryModel": "Current provider/model",
136
140
  "row.chatModelInitial": "Current provider/model",
137
141
  "row.chatModelChange": "Switched to",
@@ -150,13 +154,28 @@ window.__ModuleLoader__.load({
150
154
  // (see `servedNamespaceNow` in the `configForms` block).
151
155
  var SUBAGENT_MODEL_SETTINGS_NS = "dsh-subagent-default-model";
152
156
 
157
+ // Decode a stored section into the card's route list.
158
+ //
159
+ // An EMPTY entry is dropped rather than decoded (issue #2). A bare `""` in
160
+ // `models`, or an object with neither provider nor model, carries no route;
161
+ // decoding it (the old behaviour) produced `{ provider: <section provider>,
162
+ // model: "" }` — identical in the UI to a genuine half-filled row, so the
163
+ // user saw a mysterious unfillable row after a restart, with no way to tell
164
+ // it apart from their own draft. `serializeDefaultModels` no longer writes
165
+ // such entries, and this keeps a document written by an older version from
166
+ // resurrecting one.
153
167
  function normalizeDefaultModels(value) {
154
168
  var result = [];
155
169
  if (Array.isArray(value.models) && value.models.length > 0) {
156
170
  for (var i = 0; i < value.models.length; i++) {
157
171
  var entry = value.models[i];
158
- if (typeof entry === "string") result.push({ provider: value.provider || "", model: entry, reasoningEffort: "" });
159
- else if (entry && typeof entry === "object") result.push({ provider: entry.provider || value.provider || "", model: entry.model || "", reasoningEffort: entry.reasoningEffort || "" });
172
+ if (typeof entry === "string") {
173
+ if (entry === "") continue;
174
+ result.push({ provider: value.provider || "", model: entry, reasoningEffort: "" });
175
+ } else if (entry && typeof entry === "object") {
176
+ if (!entry.provider && !entry.model) continue;
177
+ result.push({ provider: entry.provider || value.provider || "", model: entry.model || "", reasoningEffort: entry.reasoningEffort || "" });
178
+ }
160
179
  }
161
180
  } else if (value.provider || value.model) {
162
181
  result.push({ provider: value.provider || "", model: value.model || "", reasoningEffort: value.reasoningEffort || "" });
@@ -164,10 +183,22 @@ window.__ModuleLoader__.load({
164
183
  return result;
165
184
  }
166
185
 
167
- function serializeDefaultModels(previousValue, routes, strategy, failoverEnabled, injectRouteContext) {
186
+ function serializeDefaultModels(previousValue, routes, strategy, failoverEnabled, injectRouteContext, applyToForkChildren) {
187
+ // Drop rows with neither a provider nor a model BEFORE anything else
188
+ // (issue #2). `save()` already filters, and this is the second line of
189
+ // defence: an all-empty row used to serialize as a bare `""` (its
190
+ // provider matched the section, so only `route.model` — the empty string
191
+ // — was written), which `normalizeDefaultModels` decoded back into
192
+ // `{ provider: <section provider>, model: "" }` — a row the UI can never
193
+ // complete, re-locking Save on the NEXT start. Filtering here makes that
194
+ // loss impossible regardless of which caller reaches this function.
195
+ routes = (routes || []).filter(function (route) {
196
+ return route && (Boolean(route.provider) || Boolean(route.model));
197
+ });
168
198
  var next = Object.assign({}, previousValue || {});
169
199
  next.failoverEnabled = failoverEnabled === false ? false : true;
170
200
  next.injectRouteContext = injectRouteContext === false ? false : true;
201
+ next.applyToForkChildren = applyToForkChildren === true;
171
202
  if (routes.length === 0) {
172
203
  next.provider = "";
173
204
  next.model = "";
@@ -182,7 +213,13 @@ window.__ModuleLoader__.load({
182
213
  next.provider = provider;
183
214
  next.model = "";
184
215
  next.models = routes.map(function (route) {
185
- if (route.provider === provider && !route.reasoningEffort) {
216
+ // The bare-string (same-provider) form is an OPTIMIZATION, and it is
217
+ // only lossless when the row actually names a model. A row with a
218
+ // provider but no model yet — the normal state right after picking a
219
+ // provider — must stay an explicit object, because the bare form would
220
+ // be `""` and `normalizeDefaultModels` would read that back as a
221
+ // fillable-looking row (issue #2's persistence loop).
222
+ if (route.provider === provider && !route.reasoningEffort && route.model) {
186
223
  return route.model;
187
224
  }
188
225
  var base = { provider: route.provider, model: route.model };
@@ -257,6 +294,7 @@ window.__ModuleLoader__.load({
257
294
  ["strategy", value.strategy],
258
295
  ["failoverEnabled", value.failoverEnabled === false ? false : true],
259
296
  ["injectRouteContext", value.injectRouteContext === false ? false : true],
297
+ ["applyToForkChildren", value.applyToForkChildren === true],
260
298
  ["reasoningEffort", value.reasoningEffort || ""]
261
299
  ];
262
300
  // ONE atomic mutation, when the bound controller offers it.
@@ -372,6 +410,11 @@ window.__ModuleLoader__.load({
372
410
  // value as enabled, so an existing config that never mentioned the field
373
411
  // shows the checkbox ticked and keeps injecting.
374
412
  var injectRouteContextState = React.useState(seedValue.injectRouteContext !== false);
413
+ // Default OFF, matching the schema default: fork children keep the parent
414
+ // route so the host's KV-cache reuse of the inherited prefix survives.
415
+ // `=== true` (not `!== false`) reads an absent value as disabled, which is
416
+ // the safe direction for THIS switch — the opposite of injectRouteContext.
417
+ var applyToForkChildrenState = React.useState(seedValue.applyToForkChildren === true);
375
418
  var savedState = React.useState(false);
376
419
  // The failure REASON, not a boolean. A boolean was dead state here (written
377
420
  // but never read), so a refused write produced no visible feedback at all —
@@ -380,6 +423,8 @@ window.__ModuleLoader__.load({
380
423
  var saveErrorState = React.useState(null);
381
424
  var toastState = React.useState(null);
382
425
  var toastSeq = React.useRef(0);
426
+ // `dirtyState` records "the user has interacted", but it is NOT what
427
+ // decides whether Save can be pressed — see `draftDiffers` below.
383
428
  var dirtyState = React.useState(false);
384
429
  var busyState = React.useState(false);
385
430
  React.useEffect(function () {
@@ -411,6 +456,7 @@ window.__ModuleLoader__.load({
411
456
  strategyState[1](value.strategy === "random" ? "random" : "round-robin");
412
457
  failoverEnabledState[1](value.failoverEnabled !== false);
413
458
  injectRouteContextState[1](value.injectRouteContext !== false);
459
+ applyToForkChildrenState[1](value.applyToForkChildren === true);
414
460
  savedState[1](false);
415
461
  saveErrorState[1](null);
416
462
  }, [snap ? snap.revision : -1, dirtyState[0], busyState[0]]);
@@ -432,9 +478,27 @@ window.__ModuleLoader__.load({
432
478
  dirtyState[1](true);
433
479
  }
434
480
  function addRoute() {
481
+ // A new row needs a REAL provider to be fillable: the model dropdown is
482
+ // disabled until a provider is chosen, and the provider list is empty
483
+ // when the catalog never loaded. Writing `provider: ""` in that state
484
+ // produced a row the UI could not complete — and, before the gate fix in
485
+ // this release, that row locked Save shut permanently (issue #2).
486
+ //
487
+ // So: refuse the add and say why, using the catalog-empty copy the card
488
+ // already owns. Refusing is recoverable (the user retries once the
489
+ // catalog arrives); a dead row is not.
435
490
  var firstGroup = groupsState[0][0];
491
+ if (!firstGroup) {
492
+ saveErrorState[1](t("row.catalogEmpty"));
493
+ return;
494
+ }
495
+ // Pick the first model the group actually advertises, so the row is
496
+ // valid the moment it appears rather than one interaction short of
497
+ // complete. An empty model list still yields `model: ""`, which the
498
+ // save-time filter drops instead of persisting.
499
+ var firstModel = firstGroup.models && firstGroup.models[0] ? firstGroup.models[0].id : "";
436
500
  routesState[1](function (routes) {
437
- return routes.concat({ provider: firstGroup ? firstGroup.id : "", model: "", reasoningEffort: "" });
501
+ return routes.concat({ provider: firstGroup.id, model: firstModel, reasoningEffort: "" });
438
502
  });
439
503
  savedState[1](false);
440
504
  saveErrorState[1](null);
@@ -463,7 +527,23 @@ window.__ModuleLoader__.load({
463
527
  // cards do — `trae`/`workbuddy` disable on `!dirty || saving` and let the
464
528
  // write answer for itself.
465
529
  if (busyState[0]) return;
466
- var nextValue = serializeDefaultModels(value, routesState[0], strategyState[0], failoverEnabledState[0], injectRouteContextState[0]);
530
+ // Validate HERE, not on the button (issue #2).
531
+ //
532
+ // An EMPTY row — both fields blank — is not an error: it is a row the
533
+ // user added and has not reached yet. Drop it rather than refusing the
534
+ // whole save, which also stops the empty string from being persisted
535
+ // (the round-trip loss that turned one stray row into a permanent
536
+ // `model: ""` row and re-locked Save on the next start).
537
+ //
538
+ // A HALF-filled row is still saved, not refused: only the sides the user
539
+ // actually set are meaningful, and `serializeDefaultModels` already
540
+ // handles a model-less entry. Refusing here would reproduce the very
541
+ // defect being fixed — a click that does nothing — just with a message.
542
+ var filledRoutes = routesState[0].filter(function (route) {
543
+ return Boolean(route.provider) || Boolean(route.model);
544
+ });
545
+ var nextValue = serializeDefaultModels(value, filledRoutes, strategyState[0], failoverEnabledState[0], injectRouteContextState[0], applyToForkChildrenState[0]);
546
+
467
547
  savedState[1](false);
468
548
  saveErrorState[1](null);
469
549
  busyState[1](true);
@@ -639,18 +719,50 @@ window.__ModuleLoader__.load({
639
719
  var warning = checkEffortSupport(route, groupsState[0]);
640
720
  if (warning !== null) effortWarnings.push({ index: index, key: warning.key, warning: warning });
641
721
  });
642
- // Save gate, aligned with the family cards (`trae` / `workbuddy` disable on
643
- // `!dirty || saving` plus one content rule). Two scope gates used to sit
644
- // here — `snap.status !== "ready"` and `snap.writable === false` — and they
645
- // are exactly what made Save permanently unclickable: the settings scope is
646
- // bound asynchronously from the describe mirror, so while the mirror has not
647
- // answered (or the Host never serves this namespace) both conditions stay
648
- // true forever, the button stays grey, and no message ever explains why.
649
- // The family does not pre-gate on scope state: it lets the write happen and
650
- // reports the refusal. `hasIncompleteRoute` stays, because a half-filled
651
- // route genuinely has nothing valid to save — the family's equivalent of
652
- // "no models enabled".
653
- var saveDisabled = busyState[0] || !dirtyState[0] || hasIncompleteRoute;
722
+ // Save gate: `busy || !dirty` — NOTHING else.
723
+ //
724
+ // Two scope gates used to sit here (`snap.status !== "ready"` and
725
+ // `snap.writable === false`) and made Save permanently unclickable while
726
+ // the describe mirror was still answering. `hasIncompleteRoute` was the
727
+ // third, and it produced the same class of deadlock (issue #2): the
728
+ // predicate is NON-MONOTONIC — "add a model row" sets `dirty` (enabling
729
+ // Save) and simultaneously makes `hasIncompleteRoute` true (disabling it),
730
+ // so the two conditions cancel out and the button never lights up. With an
731
+ // empty model catalog the new row's provider cannot even be filled in, so
732
+ // the deadlock is unrecoverable through the UI.
733
+ //
734
+ // The family cards (`trae` / `workbuddy` / `qoder`) never pre-gate on row
735
+ // completeness; they let the click happen and report the refusal. This does
736
+ // the same: `save()` filters empty rows and `saveErrorState` explains any
737
+ // row that is half-filled. A button that refuses to be pressed carries no
738
+ // information about WHAT is wrong — that is the whole defect.
739
+ // Whether the draft differs from what is SAVED (issue #2, defect 4).
740
+ //
741
+ // `dirty` used to be a component-local boolean that only the six input
742
+ // handlers set. The card unmounts when the user leaves the Plugins page,
743
+ // and on remount the draft is re-seeded from `savedForm` — so the form
744
+ // showed the user's values while Save stayed grey, with nothing on screen
745
+ // explaining it. Deriving "has anything changed?" from the DATA makes a
746
+ // remount unable to disagree with what is displayed.
747
+ //
748
+ // The comparison is over the normalized route list plus the three scalar
749
+ // toggles, i.e. exactly what a save would write.
750
+ var draftSignature = JSON.stringify({
751
+ routes: routesState[0].filter(function (route) { return Boolean(route.provider) || Boolean(route.model); }),
752
+ strategy: strategyState[0],
753
+ failoverEnabled: failoverEnabledState[0] !== false,
754
+ injectRouteContext: injectRouteContextState[0] !== false,
755
+ applyToForkChildren: applyToForkChildrenState[0] === true
756
+ });
757
+ var savedSignature = JSON.stringify({
758
+ routes: normalizeDefaultModels(value),
759
+ strategy: value.strategy === "random" ? "random" : "round-robin",
760
+ failoverEnabled: value.failoverEnabled !== false,
761
+ injectRouteContext: value.injectRouteContext !== false,
762
+ applyToForkChildren: value.applyToForkChildren === true
763
+ });
764
+ var draftDiffers = draftSignature !== savedSignature;
765
+ var saveDisabled = busyState[0] || !(dirtyState[0] || draftDiffers);
654
766
  var discardDisabled = !dirtyState[0] || busyState[0];
655
767
  var routes = routesState[0].map(function (route, index) {
656
768
  var group = null;
@@ -797,6 +909,20 @@ window.__ModuleLoader__.load({
797
909
  React.createElement("span", null, t("row.injectRouteContext")),
798
910
  React.createElement("span", { className: "dsm-inject-route-hint" }, t("row.injectRouteContextHint"))
799
911
  ),
912
+ // Whether the same-context channel (`subagent_fork`) follows this route.
913
+ // Default OFF: a fork child is seeded with the parent conversation and
914
+ // the host keeps its route equal to the parent's so that prefix stays
915
+ // eligible for KV-cache reuse. Turning this on is a deliberate trade,
916
+ // so the hint states the cost rather than just naming the switch.
917
+ React.createElement("label", { className: "dsm-model-settings-apply-fork" },
918
+ React.createElement("input", {
919
+ type: "checkbox",
920
+ checked: applyToForkChildrenState[0],
921
+ onChange: function (event) { applyToForkChildrenState[1](event.target.checked); savedState[1](false); saveErrorState[1](null); dirtyState[1](true); }
922
+ }),
923
+ React.createElement("span", null, t("row.applyToForkChildren")),
924
+ React.createElement("span", { className: "dsm-apply-fork-hint" }, t("row.applyToForkChildrenHint"))
925
+ ),
800
926
  hasIncompleteRoute ? React.createElement("div", { className: "dsm-model-settings-hint" }, t("row.incomplete")) : null,
801
927
  effortWarnings.length === 0 ? null : React.createElement("div", {
802
928
  className: "dsm-model-settings-warn-list",
package/lib/index.js CHANGED
@@ -138,7 +138,27 @@ const SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA = z.object({
138
138
  // writes this key as part of EVERY save, so omitting it made every save
139
139
  // fail — not just the reasoning-effort field. It also carries the
140
140
  // single-model form's effort, which `defaultModel()` reads back.
141
- reasoningEffort: volatileField(z.string().default("").description("Reasoning effort for the single-model form (`model`)"))
141
+ reasoningEffort: volatileField(z.string().default("").description("Reasoning effort for the single-model form (`model`)")),
142
+ // Whether the same-context delegation channels (`subagent_fork`) follow this
143
+ // plugin's configured route instead of inheriting the parent's.
144
+ //
145
+ // Default FALSE, i.e. fork children keep the parent route. The host's `fork`
146
+ // backend sets `inheritsParentContext = true` and is SEEDED with a prefix of
147
+ // the parent's session log, so its whole point is provider-side reuse of that
148
+ // prefix (KV cache). `dsh-base` spells the intent out where the fork tool is
149
+ // wired: "Fork omits model selection so provider/model stay equal to the
150
+ // parent and the inherited history remains eligible for KV Cache reuse."
151
+ //
152
+ // Measured cost of ignoring that: one real fork child sent its first request
153
+ // with `inputTokens: 144185, cacheReadTokens: 186` — i.e. the inherited
154
+ // 141-message prefix was re-billed in full on the other provider instead of
155
+ // being served from cache. Later steps are fine (the new provider builds its
156
+ // own cache), so the loss is a one-off first-request penalty, but it is a
157
+ // large one.
158
+ //
159
+ // Opting IN is a deliberate trade: you want fork children on the pool route
160
+ // and accept paying to re-run the inherited prefix once.
161
+ applyToForkChildren: volatileField(z.boolean().default(false).description("Let same-context channels (subagent_fork) follow the configured route instead of inheriting the parent's; off keeps the host's KV-cache reuse"))
142
162
  }).default({});
143
163
 
144
164
  /** The plugin's Cordis Config — on DSH 0.1.7+ this IS the settings section. */
@@ -231,6 +251,32 @@ function defaultModel(state) {
231
251
  return void 0;
232
252
  }
233
253
 
254
+ /**
255
+ * Whether one delegation's provider reuses the parent's conversation prefix.
256
+ *
257
+ * `inheritsParentContext === true` is the host's own statement that this backend
258
+ * is seeded with the parent's session log (currently only the `fork` backend).
259
+ * Route changes on such a child invalidate the KV cache the host preserved on
260
+ * purpose, so they are treated differently from a fresh-context spawn.
261
+ *
262
+ * @param ctx - the plugin context (reads `subagents`).
263
+ * @param provider - the provider name from the delegation spec.
264
+ * @returns {boolean} true when children on this provider inherit the prefix.
265
+ */
266
+ function inheritsParentContext(ctx, provider) {
267
+ if (typeof provider !== "string" || provider.length === 0) return false;
268
+ try {
269
+ const subagents = ctx.subagents ?? ctx.get?.("subagents");
270
+ const entry = subagents?.getProvider?.(provider);
271
+ return entry?.inheritsParentContext === true;
272
+ } catch {
273
+ // An unreadable registry must not turn into "skip every delegation": fall
274
+ // back to the fresh-context behaviour (inject), which is the long-standing
275
+ // default and never silently disables the feature.
276
+ return false;
277
+ }
278
+ }
279
+
234
280
  /** Inject the default model into one delegation request unless it already names one. */
235
281
  function applyDefaultModel(state, request) {
236
282
  if (request === void 0 || request === null) return request;
@@ -240,6 +286,43 @@ function applyDefaultModel(state, request) {
240
286
  return { ...request, agentOptions: model };
241
287
  }
242
288
 
289
+ /**
290
+ * The provider-aware form of {@link applyDefaultModel}: also honours
291
+ * `applyToForkChildren` for same-context (`fork`) delegations.
292
+ *
293
+ * A fork child that is left alone keeps the parent route, exactly as the host
294
+ * intends; when the user opts in, the pool route is injected as for any other
295
+ * child. A skip is logged ONCE per provider so "configured but not applied" is
296
+ * never silent — the 2.1.7 failure mode was exactly that.
297
+ *
298
+ * @param ctx - the plugin context, used to read provider capabilities.
299
+ * @param state - the plugin state.
300
+ * @param request - the delegation request.
301
+ * @param provider - the provider name the spec targets.
302
+ * @returns the request, possibly with `agentOptions` injected.
303
+ */
304
+ function applyDefaultModelFor(ctx, state, request, provider) {
305
+ if (request === void 0 || request === null) return request;
306
+ // An explicit route always wins, regardless of the fork policy.
307
+ if (request.agentOptions !== void 0) return request;
308
+ if (inheritsParentContext(ctx, provider) && state.getSection()?.applyToForkChildren !== true) {
309
+ // Logged once per provider per fiber: this fires on EVERY fork delegation,
310
+ // and a line per delegation would be the same log spam this plugin
311
+ // already fixed for context injection. It is still logged at all because
312
+ // "configured but silently not applied" is the exact failure mode that
313
+ // took a release to diagnose (2.1.7).
314
+ if (state.forkSkipNoticed?.has(provider) !== true) {
315
+ (state.forkSkipNoticed ??= new Set()).add(provider);
316
+ ctx.logger?.info?.(
317
+ "[dsh-subagent-default-model] %s children inherit the parent conversation, so the configured route is NOT applied to them (set applyToForkChildren: true to override). They stay on the parent route so that prefix keeps its KV-cache reuse.",
318
+ provider
319
+ );
320
+ }
321
+ return request;
322
+ }
323
+ return applyDefaultModel(state, request);
324
+ }
325
+
243
326
  // ── subagent-only error failover ─────────────────────────────────────────────
244
327
 
245
328
  /** Read the live failover view: the `models` list as the switch pool and the strategy. */
@@ -635,21 +718,23 @@ function installSubagentWrapper(ctx, state) {
635
718
  // route at all on 0.2.x (children silently inherited the parent route).
636
719
  const originalStartActivation = raw.startActivation;
637
720
  const wrappedStart = typeof originalStart === "function"
638
- ? async (name, request) => originalStart.call(raw, name, applyDefaultModel(state, request))
721
+ ? async (name, request) => originalStart.call(raw, name, applyDefaultModelFor(ctx, state, request, name))
639
722
  : void 0;
640
723
  const wrappedStartContinuable = typeof originalStartContinuable === "function"
641
724
  ? async (spec) => {
642
725
  if (spec === void 0 || spec === null) return originalStartContinuable.call(raw, spec);
643
726
  return originalStartContinuable.call(raw, {
644
727
  ...spec,
645
- request: applyDefaultModel(state, spec.request)
728
+ request: applyDefaultModelFor(ctx, state, spec.request, spec.name ?? spec.provider)
646
729
  });
647
730
  }
648
731
  : void 0;
649
732
  const wrappedStartActivation = typeof originalStartActivation === "function"
650
733
  ? async (spec) => {
651
734
  if (spec === void 0 || spec === null) return originalStartActivation.call(raw, spec);
652
- const request = applyDefaultModel(state, spec.request);
735
+ // `spec.provider` names the delegation backend (`spawn` / `fork`), which
736
+ // is what decides whether this child inherits the parent conversation.
737
+ const request = applyDefaultModelFor(ctx, state, spec.request, spec.provider);
653
738
  // Keep the spec reference when nothing was injected: host code compares
654
739
  // identity and a needless clone would be a silent behaviour change.
655
740
  return originalStartActivation.call(raw, request === spec.request ? spec : {
@@ -700,7 +785,10 @@ export function apply(ctx, config) {
700
785
  injectRouteContext: unwrap(raw.injectRouteContext),
701
786
  // Read back too: the single-model form stores its effort here, so
702
787
  // dropping the key silently ignored the configured effort.
703
- reasoningEffort: unwrap(raw.reasoningEffort)
788
+ reasoningEffort: unwrap(raw.reasoningEffort),
789
+ // Fork/same-context policy. Absent resolves to the schema default
790
+ // (`false`), so an old config patch keeps the host's fork behaviour.
791
+ applyToForkChildren: unwrap(raw.applyToForkChildren)
704
792
  };
705
793
  // Drop any field that resolved to undefined so downstream defaults apply.
706
794
  for (const key of Object.keys(section)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-subagent-default-model",
3
- "version": "2.1.9",
3
+ "version": "2.1.12",
4
4
  "description": "为 DeepSeek Harness 子代理配置默认模型:多模型顺序/随机分配、跨供应商连接失败故障转移,并在轨迹/对话视图显示当前供应商与模型,同时以一行真实提示词把当前路由注入子代理上下文。",
5
5
  "keywords": [
6
6
  "deepseek-harness",