dsh-subagent-default-model 2.1.8 → 2.1.11
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 +115 -0
- package/README.en.md +8 -4
- package/README.md +8 -4
- package/lib/client.js +32 -6
- package/lib/index.js +93 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.11 (2026-10-30)
|
|
4
|
+
|
|
5
|
+
> **发布说明**:本节的改动与下一节 2.1.10 的宿主兼容性核查**同批发布**,npm 上直接从 2.1.9 升到 2.1.11,2.1.10 没有单独发布过。保留两个条目是因为「换了宿主版本」和「改了行为」是两件独立的事,事后查证时分开更好读;`npm install` 请直接用 `2.1.11`。
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`applyToForkChildren` 开关(默认 `false`)**:控制 `subagent_fork` 子代理是否也使用本插件设定的模型。设置卡片里有对应复选框,双语文案说明代价。
|
|
10
|
+
|
|
11
|
+
**为什么默认关闭**:`fork` 通道(`inheritsParentContext === true`)是**用父会话日志的前缀播种**出来的,宿主的 `dsh-base` 刻意不给它模型选择权:
|
|
12
|
+
|
|
13
|
+
> Fork omits model selection so provider/model stay equal to the parent and the inherited history remains eligible for KV Cache reuse.
|
|
14
|
+
|
|
15
|
+
插件此前对**所有**缺 `agentOptions` 的派发注入路由,包括 fork,于是这段刻意保留的前缀缓存直接失效。实测一个真实 fork 子代理的首个请求:`inputTokens: 144185` / `cacheReadTokens: 186` —— 14.4 万 token 的继承前缀在另一个供应商上被**全量重算**,命中率 0.13%。后续步骤会由新供应商自建缓存,所以损失是一次性的首请求惩罚,但金额很大。
|
|
16
|
+
|
|
17
|
+
**判定方式**:注入前查 `ctx.subagents.getProvider(spec.provider)?.inheritsParentContext`。为 `true` 时跳过(当前只有 `fork` 通道这样声明),并在**每个 provider 每个 fiber 只记一次** info 日志 —— 「配置了却没生效」必须可见(2.1.7 的教训),但不能按每次派发刷屏。
|
|
18
|
+
|
|
19
|
+
**显式传参优先**:fork 子代理若自带 `agentOptions`,照旧覆盖一切,开关不影响。
|
|
20
|
+
|
|
21
|
+
**未知 provider 照旧注入**:`getProvider` 返回 `undefined` 时按「不继承上下文」处理。把「读不到能力」当成「继承」会让所有自定义 provider 静默失去注入,方向反了。
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **破坏性变更(行为)**:`subagent_fork` 子代理默认**不再**使用配置的模型,改为继承父路由。这是 2.1.7 起一直存在的行为,本次修正。依赖旧行为的用户请显式设置 `applyToForkChildren: true`。
|
|
26
|
+
- 双语文档(`README.md` / `README.en.md` / `plugin/README.md` / `plugin/README.en.md`)中「覆盖 `subagent_fork`」的说法全部改为「覆盖,但默认让位」,并在配置表补 `applyToForkChildren` 一行。
|
|
27
|
+
|
|
28
|
+
### Tests
|
|
29
|
+
|
|
30
|
+
新增 6 个用例(153 → 159):
|
|
31
|
+
|
|
32
|
+
- fork 子代理默认不注入、且**保持请求对象同一性**(宿主比较 identity,无谓克隆是隐式行为变化)
|
|
33
|
+
- 同一份配置下 spawn 仍然注入(证明门禁只针对 fork,没有误伤)
|
|
34
|
+
- `applyToForkChildren: true` 时 fork 跟随配置路由
|
|
35
|
+
- fork 上**显式** `agentOptions` 优先级不受开关影响
|
|
36
|
+
- 未知 provider 仍被注入(能力读取失败不得静默关闭功能)
|
|
37
|
+
- `applyToForkChildren` 默认值必须是 `false`(默认值是承重的,不是装饰)
|
|
38
|
+
|
|
39
|
+
配套修正两个**会误伤新增字段**的旧用例:`settings-install` 里「all seven fields」把断言写死成 7 个键,`settings-write-gate` 的原子保存字段表也没包含新键 —— 前者改成与 `Config` 自身声明键比对(守住「字段不被丢弃」的真实语义,不再钉住数量),后者补上新字段并用**真实宿主写入门**验证它能被接受。
|
|
40
|
+
|
|
41
|
+
变异验证:①去掉 fork 门禁 → 默认用例失败;②默认值改 `true` → 两个用例失败。恢复后 159/159。
|
|
42
|
+
|
|
43
|
+
真实 `apply()` 端到端复核(非夹具):fork → `agentOptions = undefined`,spawn → `{provider:"pool",model:"M1"}`。
|
|
44
|
+
|
|
45
|
+
## 2.1.10 (2026-10-30)
|
|
46
|
+
|
|
47
|
+
### 兼容性核查:DSH Desktop 0.2.1-rc.5
|
|
48
|
+
|
|
49
|
+
当前宿主由 `0.2.1-rc.3` 升到 **`0.2.1-rc.5`**(nightly 渠道,2026-10-30 安装)。**插件运行逻辑零改动**(`plugin/lib/index.js` / `plugin/lib/client.js` 未动一行)——本版只做核查与清单维护。
|
|
50
|
+
|
|
51
|
+
这次核查比 2.1.8 更彻底:把宿主 `desktop-runtime.json` 列出的**全部 305 个随包**都按 rc.3 / rc.5 各拉一份做逐文件比对(而非只挑几个包看)。
|
|
52
|
+
|
|
53
|
+
**305 个包里只有 10 个有真实代码改动**,且全部落在插件未触碰的面上:
|
|
54
|
+
|
|
55
|
+
| 包 | 改动 | 与本插件的关系 |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `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()` 的白名单/黑名单规则未变 |
|
|
58
|
+
| `dsh-client-ui-conversation` | View 标签页 tooltip 改为**按估算宽度按需出现**(`labelNeedsTooltip`)、移除 `session.moreViewsCurrent` 文案 | 插件用的 `conversation.chat.node` 槽位与 `request/header` 帧语义完全未变 |
|
|
59
|
+
| `dsh-client-ui-settings-account` / `-general` / `dsh-client-ui-sidebar` | 版本号字符串(`0.2.1-rc.3` → `0.2.1-rc.5`、构建标记 `rc.5-d4db512`) | 纯版本串 |
|
|
60
|
+
| `dsh-llm-deepseek-account` | 一行日志级别 `console.info` → `console.error` | 与插件的故障转移无关 |
|
|
61
|
+
| `dsh-mcp-client` | `resources/list` 前先查 `getServerCapabilities()?.resources`,不支持时返回空列表而非报错 | 与本插件无关 |
|
|
62
|
+
| `dsh-experimental-client-ui-cot-translation` | 跟随 chat 的 reasoning 改动(仅注释 + 契约描述) | 与本插件无关 |
|
|
63
|
+
| `dsh-cordis-client-runner` | 内嵌 Slots 契约的**源码行号引用**(`slots.ts:441` → `:447` 等) | 纯文档字符串 |
|
|
64
|
+
| `dsh-client-modules` | 内嵌构建 commit 号 | 纯字符串 |
|
|
65
|
+
|
|
66
|
+
插件依赖的 `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` 版本号)。
|
|
67
|
+
|
|
68
|
+
**从运行中的 `app.asar` 直接读源码复核的契约(行号均为 rc.5 实测)**:
|
|
69
|
+
|
|
70
|
+
| 检查项 | 结论 |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| 插件加载与注入 | ✅ 运行中的宿主已挂载本插件行(`include:dsh-subagent-default-model`),`Config` 投影出全部 7 个 volatile 字段 |
|
|
73
|
+
| 4 个事件钩子 | ✅ `agent/pre-step`(`:909`)、`agent/request`(`:1191`)、`agent/request-error`(`:1136`)、`agent/disposed`(`:1663`)全部仍在 |
|
|
74
|
+
| `preStep()` → `buildRequest()` 时序 | ✅ 未变(`:902` / `:1214`;`request/context` 仍在 `:1271` 才 append) |
|
|
75
|
+
| `inbox.claim()` 先抽干 | ✅ 未变(`preStep` 首行 `:906`,仍在 `agent/pre-step` 瀑布之前) |
|
|
76
|
+
| `session.requestContext()` 语义 | ✅ 未变(`dsh-session` `:1627`) |
|
|
77
|
+
| 派发入口 | ✅ 仍只有 `startActivation(spec)`(`dsh-subagent` `:3036`),插件的包装点有效 |
|
|
78
|
+
| `agentOptions` 组装语义 | ✅ 未变:宿主仅在**显式**选择路由时才带上 `agentOptions`(`dsh-tool-subagent` `:470`),「无显式路由 → 插件注入」这条前提依然成立 |
|
|
79
|
+
| `request/header` 帧 | ✅ `initial` / `resume` / `change` / `series` 四种 `reason` 未变(`:1226`–`:1240`) |
|
|
80
|
+
| 失败码词表 | ✅ 未变(`RATE_LIMIT` / `QUOTA` / `ACCOUNT_QUOTA` / `SERVER` / `TIMEOUT` / `TRANSPORT` / `EMPTY_RESPONSE` / `INVALID_CREDENTIAL` / `CONTEXT_WINDOW_EXCEEDED` 等) |
|
|
81
|
+
| 客户端槽位 | ✅ `conversation.chat.node` 与 `plugins.bundle.config` / `plugins.row.config` 全部存在;本插件的 `chat-subagent-model-notice` 渲染器在运行中**处于 active** |
|
|
82
|
+
| `cordis.original` 符号 | ✅ 仍在(插件据此拿到 `ctx.subagents` 背后的原始服务对象) |
|
|
83
|
+
| peer 区间覆盖 | ✅ 宿主 `unmetRequirements()` 对 `0.2.1-rc.5` 返回「无未满足要求」 |
|
|
84
|
+
|
|
85
|
+
**端到端实测**(不是静态推断):在本机派发一个真实子代理,其 `subagent/descriptor` 固化了 `agentProvider: "dsh-opencode-go"` / `agentModel: "deepseek-v4.1-flash"` / `agentReasoningEffort: "high"` —— 与配置池一致,说明 `startActivation` 注入确实发生;子代理会话日志里也能读到插件写入的 `route-context` 行(`source.kind = plugin:dsh-subagent-default-model`)。
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- **「应当通过」的宿主版本清单第四次滞后**:清单停在 `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`),没有靠人记得补——这次护栏真的起了作用。
|
|
90
|
+
|
|
91
|
+
清单补上 `0.2.1-rc.4` **与** `0.2.1-rc.5`:升级路径跨过了 rc.4,而该用例只断言**本机装的那一个**版本;若只补 rc.5,一台仍停在 rc.4 的机器上跑同一份已评审清单就会失败。判据已写进 `DEVELOPMENT.md`:清单描述的是「已评审过的宿主版本集合」,不是「我这台机器上的那一个」。
|
|
92
|
+
|
|
93
|
+
- 变异验证:把 `0.2.1-rc.5` 从清单里去掉 → 该用例失败;放回去 → 通过。
|
|
94
|
+
|
|
95
|
+
### Docs
|
|
96
|
+
|
|
97
|
+
`DEVELOPMENT.md`:
|
|
98
|
+
|
|
99
|
+
1. 「宿主升级流程」补两节:**跨多个 rc 升级要把跳过的版本也补进清单**;**逐包比对的正确姿势**(用 `desktop-runtime.json` 的全量包清单做 `diff -rq`,把「真有改动」与「只是版本号变了」分开)。
|
|
100
|
+
2. 契约行号表增补 rc.5 一列,并加 `agent/request-error` / `agent/request` 两行。
|
|
101
|
+
|
|
102
|
+
### Tests
|
|
103
|
+
|
|
104
|
+
全量:`tests 153 / pass 153 / fail 0 / skip 0`(用例数与 2.1.9 相同,本版未新增用例)。
|
|
105
|
+
|
|
106
|
+
## 2.1.9 (2026-10-26)
|
|
107
|
+
|
|
108
|
+
### Changed
|
|
109
|
+
|
|
110
|
+
- **会话恢复文案「继续使用」改为「当前使用」**:对话视图的上下文注入行在 `reason: "resume"`(会话恢复后发起的请求)时显示的前缀,从「继续使用:`provider/model`」改为「当前使用:`provider/model`」(英文 `Resumed on` → `Currently using`)。
|
|
111
|
+
|
|
112
|
+
理由:「继续使用」读起来像一句动作说明("接着用这个模型"),而这一行和首次请求那一行一样,描述的是**此刻这条请求实际落在哪条路由上**;改成「当前使用」后与时态一致,也不会让人误以为模型是被"续"上去的。同步更新测试断言、simulate 脚本与双语文档示例。
|
|
113
|
+
|
|
114
|
+
### Fixed
|
|
115
|
+
|
|
116
|
+
- **客户端构建标记递增**(`DSM_CLIENT_BUILD` → `2026-10-26.1`):本次改的是 client 半边文案,排查时若页面仍显示旧文案,这个标记能直接区分「页面持有旧 bundle」与「改动没生效」。
|
|
117
|
+
|
|
3
118
|
## 2.1.8 (2026-10-24)
|
|
4
119
|
|
|
5
120
|
### 兼容性核查:DSH Desktop 0.2.1-rc.3
|
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
|
|
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
|
|
|
@@ -42,7 +44,7 @@ Of the three, this is the only one aimed at **both you and the subagent**: witho
|
|
|
42
44
|
#### Channel 1 — the UI row (for you)
|
|
43
45
|
|
|
44
46
|
- **Trajectory view** — each subagent's trajectory shows a row reading "**Current provider/model: `provider/model`**", rendered from the official `request/context` frame.
|
|
45
|
-
- **Conversation view** — the subagent's conversation stream shows a context row with three distinct wordings: "Current provider/model" on the first request, "**Switched to**" when the route changes, and "**
|
|
47
|
+
- **Conversation view** — the subagent's conversation stream shows a context row with three distinct wordings: "Current provider/model" on the first request, "**Switched to**" when the route changes, and "**Currently using**" when a session resumes.
|
|
46
48
|
- **Follows failover automatically** — when Capability 2 switches models, a new row appears here, so **what it ran on before and after the switch is unmistakable**.
|
|
47
49
|
|
|
48
50
|
How it looks in the conversation stream (the row itself):
|
|
@@ -260,7 +262,7 @@ Capability 3 has **two independent channels**. See [Capability 3](#capability-3-
|
|
|
260
262
|
| View | What it shows | Source frame |
|
|
261
263
|
| --- | --- | --- |
|
|
262
264
|
| Trajectory | A row "Current provider/model: `provider/model`" | official `request/context` |
|
|
263
|
-
| Conversation | One of "Current provider/model" / "Switched to" / "
|
|
265
|
+
| Conversation | One of "Current provider/model" / "Switched to" / "Currently using" | official `request/header` (by `reason`: `initial` / `change` / `resume`) |
|
|
264
266
|
|
|
265
267
|
Both registrations live inside `ctx.effect`, and the node `kind` values are plugin-owned (`trajectory-subagent-model` for the trajectory, `chat-subagent-model-notice` for the conversation) rather than reusing the Host's built-in `context` kind — the latter is filtered out by the Host's visibility rules.
|
|
266
268
|
|
|
@@ -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`
|
|
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`** 时,本插件注入配置的默认路由 ——
|
|
7
|
+
当派发请求**完全没有 `agentOptions`** 时,本插件注入配置的默认路由 —— 因此 `subagent`、`spawn_teammate` 以及任何省略 `agentOptions` 的工具调用都会经过它。显式传参的覆盖始终生效;配置段缺失或不完整时保持原有行为(子代理继承父会话路由)。
|
|
8
|
+
|
|
9
|
+
**例外:`subagent_fork` 默认不走这里。** `fork` 通道会继承父会话的完整对话,宿主刻意让它留在父路由上以复用该前缀的 KV 缓存,所以本插件默认让它让位(`applyToForkChildren: false`)。要让它也用这里的模型,在设置卡片里显式打开。
|
|
8
10
|
|
|
9
11
|
## 三个核心功能
|
|
10
12
|
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
#### 通路一:给「你」看的界面行
|
|
43
45
|
|
|
44
46
|
- **轨迹视图** —— 每个子代理的轨迹里会出现一行「**当前供应商/模型:`provider/model`**」,依据官方 `request/context` 帧渲染。
|
|
45
|
-
- **对话视图** ——
|
|
47
|
+
- **对话视图** —— 子代理对话流里出现上下文提示行,带三种语义文案:首次请求为「当前供应商/模型」、发生切换为「**已切换到**」、会话恢复为「**当前使用**」。
|
|
46
48
|
- **跟随故障转移自动更新** —— 功能二一旦切换模型,这里会随之多出一行,**切换前后用的是什么一目了然**。
|
|
47
49
|
|
|
48
50
|
对话流中的实际效果(这一行的真实样子):
|
|
@@ -260,7 +262,7 @@ CI 在 `ubuntu-latest`、`windows-latest`、`macos-latest` 三个平台上同时
|
|
|
260
262
|
| 视图 | 呈现内容 | 依据帧 |
|
|
261
263
|
| --- | --- | --- |
|
|
262
264
|
| 轨迹视图 | 一行「当前供应商/模型:`provider/model`」 | 官方 `request/context` |
|
|
263
|
-
| 对话视图 |
|
|
265
|
+
| 对话视图 | 「当前供应商/模型」/「已切换到」/「当前使用」三类文案行 | 官方 `request/header`(按 `reason` 区分 `initial` / `change` / `resume`) |
|
|
264
266
|
|
|
265
267
|
两个视图都在 `ctx.effect` 内注册,且节点 `kind` 使用插件自有值(轨迹侧 `trajectory-subagent-model`,对话侧 `chat-subagent-model-notice`),不占用宿主内置 `context` kind —— 后者会被宿主的可见性规则过滤掉。
|
|
266
268
|
|
|
@@ -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`
|
|
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
|
@@ -26,11 +26,11 @@ window.__ModuleLoader__.load({
|
|
|
26
26
|
// 跑的是哪一个 client bundle」——宿主在启动时快照 bundle,页面可能仍
|
|
27
27
|
// 持有旧版本;一眼对出构建号即可排除/坐实这一点。每次改 client.js
|
|
28
28
|
// 排查时必须递增它。
|
|
29
|
-
var DSM_CLIENT_BUILD = "2026-
|
|
29
|
+
var DSM_CLIENT_BUILD = "2026-10-26.1";
|
|
30
30
|
|
|
31
31
|
// ── plugin icon (LD brand logo, 64px) ────────────────────────────────
|
|
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zHpu0tvL63uNj8bykdeoCkt8QHL+SqAkRxz60wJcQ9BFh6p7CX8CYEQLtShKocTfmbpRLHs3d1LT7u+9dA99tNZ+yHxBTcNztz0mr9x74I/hnZXhD7F/PCAn6bJz+U0vrPr7K5VJUJZf5/v040NDcG02LGGJVmfOsuxdifg03U9vUZHrPz0fl7p5caGjNkiEmTFUXBooUDbjWGs5TE+Pdyy6vjqijO+MPYACb+efjwdiYsqIewMk+d8tbro1b1uXXehPrYahmn+hZmGgtefqsalNFvU1BpAhM8QXhUlCmgCmihAUnBUQixk6J2eSYqwvM9Iz5sfrApM7LDF7W651oILbef3Tky0Nk2vcfeed0dxp3Nu7h6EYr2sgOL/Aa5OuMdnE5sWAAAAAElFTkSuQmCC";
|
|
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-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,10 +94,12 @@ 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": "已切换到",
|
|
100
|
-
"row.chatModelResume": "
|
|
102
|
+
"row.chatModelResume": "当前使用",
|
|
101
103
|
"row.noticeLabel": "上下文注入 · dsh-subagent-default-model"
|
|
102
104
|
};
|
|
103
105
|
var SUBAGENT_ROW_EN = {
|
|
@@ -132,10 +134,12 @@ 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",
|
|
138
|
-
"row.chatModelResume": "
|
|
142
|
+
"row.chatModelResume": "Currently using",
|
|
139
143
|
"row.noticeLabel": "Context injection · dsh-subagent-default-model"
|
|
140
144
|
};
|
|
141
145
|
|
|
@@ -164,10 +168,11 @@ window.__ModuleLoader__.load({
|
|
|
164
168
|
return result;
|
|
165
169
|
}
|
|
166
170
|
|
|
167
|
-
function serializeDefaultModels(previousValue, routes, strategy, failoverEnabled, injectRouteContext) {
|
|
171
|
+
function serializeDefaultModels(previousValue, routes, strategy, failoverEnabled, injectRouteContext, applyToForkChildren) {
|
|
168
172
|
var next = Object.assign({}, previousValue || {});
|
|
169
173
|
next.failoverEnabled = failoverEnabled === false ? false : true;
|
|
170
174
|
next.injectRouteContext = injectRouteContext === false ? false : true;
|
|
175
|
+
next.applyToForkChildren = applyToForkChildren === true;
|
|
171
176
|
if (routes.length === 0) {
|
|
172
177
|
next.provider = "";
|
|
173
178
|
next.model = "";
|
|
@@ -257,6 +262,7 @@ window.__ModuleLoader__.load({
|
|
|
257
262
|
["strategy", value.strategy],
|
|
258
263
|
["failoverEnabled", value.failoverEnabled === false ? false : true],
|
|
259
264
|
["injectRouteContext", value.injectRouteContext === false ? false : true],
|
|
265
|
+
["applyToForkChildren", value.applyToForkChildren === true],
|
|
260
266
|
["reasoningEffort", value.reasoningEffort || ""]
|
|
261
267
|
];
|
|
262
268
|
// ONE atomic mutation, when the bound controller offers it.
|
|
@@ -372,6 +378,11 @@ window.__ModuleLoader__.load({
|
|
|
372
378
|
// value as enabled, so an existing config that never mentioned the field
|
|
373
379
|
// shows the checkbox ticked and keeps injecting.
|
|
374
380
|
var injectRouteContextState = React.useState(seedValue.injectRouteContext !== false);
|
|
381
|
+
// Default OFF, matching the schema default: fork children keep the parent
|
|
382
|
+
// route so the host's KV-cache reuse of the inherited prefix survives.
|
|
383
|
+
// `=== true` (not `!== false`) reads an absent value as disabled, which is
|
|
384
|
+
// the safe direction for THIS switch — the opposite of injectRouteContext.
|
|
385
|
+
var applyToForkChildrenState = React.useState(seedValue.applyToForkChildren === true);
|
|
375
386
|
var savedState = React.useState(false);
|
|
376
387
|
// The failure REASON, not a boolean. A boolean was dead state here (written
|
|
377
388
|
// but never read), so a refused write produced no visible feedback at all —
|
|
@@ -411,6 +422,7 @@ window.__ModuleLoader__.load({
|
|
|
411
422
|
strategyState[1](value.strategy === "random" ? "random" : "round-robin");
|
|
412
423
|
failoverEnabledState[1](value.failoverEnabled !== false);
|
|
413
424
|
injectRouteContextState[1](value.injectRouteContext !== false);
|
|
425
|
+
applyToForkChildrenState[1](value.applyToForkChildren === true);
|
|
414
426
|
savedState[1](false);
|
|
415
427
|
saveErrorState[1](null);
|
|
416
428
|
}, [snap ? snap.revision : -1, dirtyState[0], busyState[0]]);
|
|
@@ -463,7 +475,7 @@ window.__ModuleLoader__.load({
|
|
|
463
475
|
// cards do — `trae`/`workbuddy` disable on `!dirty || saving` and let the
|
|
464
476
|
// write answer for itself.
|
|
465
477
|
if (busyState[0]) return;
|
|
466
|
-
var nextValue = serializeDefaultModels(value, routesState[0], strategyState[0], failoverEnabledState[0], injectRouteContextState[0]);
|
|
478
|
+
var nextValue = serializeDefaultModels(value, routesState[0], strategyState[0], failoverEnabledState[0], injectRouteContextState[0], applyToForkChildrenState[0]);
|
|
467
479
|
savedState[1](false);
|
|
468
480
|
saveErrorState[1](null);
|
|
469
481
|
busyState[1](true);
|
|
@@ -797,6 +809,20 @@ window.__ModuleLoader__.load({
|
|
|
797
809
|
React.createElement("span", null, t("row.injectRouteContext")),
|
|
798
810
|
React.createElement("span", { className: "dsm-inject-route-hint" }, t("row.injectRouteContextHint"))
|
|
799
811
|
),
|
|
812
|
+
// Whether the same-context channel (`subagent_fork`) follows this route.
|
|
813
|
+
// Default OFF: a fork child is seeded with the parent conversation and
|
|
814
|
+
// the host keeps its route equal to the parent's so that prefix stays
|
|
815
|
+
// eligible for KV-cache reuse. Turning this on is a deliberate trade,
|
|
816
|
+
// so the hint states the cost rather than just naming the switch.
|
|
817
|
+
React.createElement("label", { className: "dsm-model-settings-apply-fork" },
|
|
818
|
+
React.createElement("input", {
|
|
819
|
+
type: "checkbox",
|
|
820
|
+
checked: applyToForkChildrenState[0],
|
|
821
|
+
onChange: function (event) { applyToForkChildrenState[1](event.target.checked); savedState[1](false); saveErrorState[1](null); dirtyState[1](true); }
|
|
822
|
+
}),
|
|
823
|
+
React.createElement("span", null, t("row.applyToForkChildren")),
|
|
824
|
+
React.createElement("span", { className: "dsm-apply-fork-hint" }, t("row.applyToForkChildrenHint"))
|
|
825
|
+
),
|
|
800
826
|
hasIncompleteRoute ? React.createElement("div", { className: "dsm-model-settings-hint" }, t("row.incomplete")) : null,
|
|
801
827
|
effortWarnings.length === 0 ? null : React.createElement("div", {
|
|
802
828
|
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,
|
|
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:
|
|
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
|
-
|
|
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