dsh-subagent-default-model 2.0.8 → 2.1.0
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 +29 -0
- package/README.en.md +118 -21
- package/README.md +118 -23
- package/lib/client.js +28 -3
- package/lib/index.js +141 -0
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.0 (2026-10-01)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **子代理现在知道自己跑在哪个供应商/模型上(真实提示词注入,功能三通路二)**。此前功能三只有**界面行**——轨迹视图与对话视图会渲染「当前供应商/模型」,但那只是**画给用户看的**,**不进入模型上下文**,因此子代理**无法回答**「你现在用的什么模型」。本版新增一条**真正的提示词注入**:向子代理**自己的上下文**写入一行,内容形如
|
|
8
|
+
`[dsh-subagent-default-model] You are running as a subagent on workbuddy/deepseek-v4.1-flash (provider=workbuddy, model=deepseek-v4.1-flash). If asked which model or provider you are, answer with this route.`
|
|
9
|
+
实现要点:
|
|
10
|
+
- **取值来源是「结算后的真实路由」**:注入内容取自 `agent/request` 瀑布 **`await next()` 之后**返回的 `{provider, model}`,即**包含本插件自身故障转移改写结果在内**的最终值。这一点是可验证的关键差异——用「插件打算切到哪个模型」当来源会在切换后写出与实际不符的一行,回归用例(把来源替换成硬编码路由)当场失败 3 项。
|
|
11
|
+
- **注入时机是下一步的 `agent/pre-step`**:这是仍能修改「即将执行的那一步」消息列表的接缝(宿主自带的 `dsh-agent-instructions` 用的同一接缝)。`agent/request` 阶段消息已冻结,故采用「请求阶段缓存 → 下一步注入」两步式。
|
|
12
|
+
- **去重与替换**:路由未变则不重复注入;路由变化(故障转移切换 / 配置变更)则**移除旧行再写新行**,长时间运行不会堆积重复行。
|
|
13
|
+
- **仅对子代理生效**:与故障转移同一道 `agent.session.header.origin === "subagent"` 门禁,**主代理上下文永不被触碰**。该门禁在 `agent/request` 与 `agent/pre-step` **两条瀑布上都必须存在**,并新增静态护栏用例钉住(变异验证:仅删 pre-step 侧门禁会因缓存未被写入而「静默不注入」,单靠行为用例抓不到,故补静态断言)。
|
|
14
|
+
- **消息来源合规**:`source.kind` 使用生产者自有标识 `plugin:dsh-subagent-default-model` 并带 `form: "route-context"` 标记。会话格式 v4 通过 `assertV4MessageSources` 硬校验,裸 `{kind:"plugin"}` 包装会导致**整个会话拒绝加载**,故有专项用例断言该形状。
|
|
15
|
+
- **可关闭**:新增配置项 `injectRouteContext`(boolean,**默认 `true`**),设置卡片新增「把当前模型与供应商写进子代理上下文」勾选项及中英文案。默认开启的理由:不开则子代理仍无法回答自身路由,而这正是本功能的目的。
|
|
16
|
+
- **新增依赖声明**:注入需要 `createUserMessage`,故新增 peer `@deepseek-ai/dsh-llm`(`>=0.1.7-rc.1 <0.3.0-0`,与其余 8 个 peer 同区间)。已验证宿主侧(profile 目录)与该包一致解析同一实例。
|
|
17
|
+
|
|
18
|
+
- **`plugin/test/route-context.test.mjs`:注入行为的 12 项回归用例**。以 `dsh-agent-loop` 的真实 `Inbox` 语义驱动(`prepend(target,message)` / `remove(messageId)` / `nextStep` 为 getter),覆盖:注入到达子代理上下文、报告**结算后**的路由(被后续 listener 改写仍以最终值为准)、主代理不被注入(含多步)、路由变化**替换**而非堆积、路由不变不重复、开关关闭即停止注入、缺省即为开启、`source` 形状合规(生产者自有 + form 标记)、不干扰循环自身消息、未解析出路由时不写占位行、销毁后不再注入。
|
|
19
|
+
|
|
20
|
+
- **真实宿主对象的一次性集成验证**:以 `@deepseek-ai/cordis` 真实 `Context` + 真实 `createUserMessage` + 真实两条瀑布跑通,打印出子代理实际收到的那一行与 `source`,确认 `role: "user"`、`source.kind` 与 `form` 均符合预期。(该验证同时纠正了一处测试夹具错误:`inbox.nextStep` 在宿主中是 **getter**,早期夹具用普通属性写,导致夹具与真实契约不符。)
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **文档口径修正(中/英、README 四处 + 市场描述)**:功能三由「界面行,**不**注入提示词」改为**两条独立通路的准确描述**——通路一(界面行,给用户)与通路二(提示词注入,给子代理),并明确**两者互不替代**。此前的措辞会让读者(以及模型自己)误以为子代理知道自己的模型,与实际行为不符。
|
|
25
|
+
- **写明与宿主 `{{model}}` 变量的关系**:DSH 宿主 `system-prompt` 行的 persona 已能把 `{{model}}` 解析进提示词(`You are a coding agent powered by the {{model}} model.`,变量由 `dsh-agent-loop` 按 `context.agent.options` 注册),但**只覆盖 `model`、不含 `provider`**,且取派发时 `options` 的值。本插件注入**额外给出 provider**,并以请求级结算值为准(含故障转移),故两者互补而非重复。该结论已逐行核对宿主源码后写入文档。
|
|
26
|
+
- **`settings-install` / `settings-write-gate` 两处契约同步扩充**:字段数由六增至七(`injectRouteContext`),原子保存用例与描述符可见性断言同步更新——这两处是**刻意的契约钉子**,新增字段必须显式改它们,避免字段被静默丢弃。
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **CHANGELOG 2.0.8 条目中的锁文件同步说明**,本版同步 `package-lock.json` 根条目版本至 2.1.0 并纳入新增 peer `@deepseek-ai/dsh-llm`。
|
|
31
|
+
|
|
3
32
|
## 2.0.8 (2026-09-29)
|
|
4
33
|
|
|
5
34
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -6,12 +6,68 @@ Pick the default model for subagent delegations in [DeepSeek Harness (DSH)](http
|
|
|
6
6
|
|
|
7
7
|
When a subagent is created without an explicit `model`, this plugin injects the configured default — 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 behavior (children inherit the parent route).
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Three core capabilities
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
This plugin answers two questions: **when a delegation does not name a model, which route should the subagent run on — and once it is running, how do you see which route it actually used?** It provides three independent capabilities around that. Each is described below with what it does *and* what it does not do.
|
|
12
|
+
|
|
13
|
+
### Capability 1 — Multi-model distribution: `round-robin` (sequential) or `random`
|
|
14
|
+
|
|
15
|
+
Configure a `models` list (2+ entries) and pick a `strategy` to decide how parallel delegations are spread across those routes:
|
|
16
|
+
|
|
17
|
+
- **`round-robin` (sequential)** — take routes in list order: the 1st subagent gets route 1, the 2nd gets route 2, and so on, wrapping back to the start. **Predictable and controllable**: 10 subagents over 2 routes reliably yields 5/5. Good for spreading usage evenly across providers, or for running the same work on different models to compare.
|
|
18
|
+
- **`random`** — pick a random route per delegation. **Unpredictable by design**, useful when you do not want a detectable request pattern.
|
|
19
|
+
|
|
20
|
+
Note this decides **which route serves the next subagent**, chosen at **delegation time**. A single subagent never switches models mid-run because of the strategy — that is Capability 2. With only one route configured, the strategy is meaningless.
|
|
21
|
+
|
|
22
|
+
### Capability 2 — Cross-provider failover: if one provider is down, run on another provider's model
|
|
23
|
+
|
|
24
|
+
With `failoverEnabled` (on by default), when a subagent hits a **connection-class failure** mid-run, the plugin retries on another route from its own `models` list:
|
|
25
|
+
|
|
26
|
+
- **Provider-agnostic** — candidates come from the whole `models` list, so failover works **across providers**. If `deepseek-official/deepseek-v4-pro` dies, the subagent can fail over to a *different vendor's* model in the list — not merely another model ID from the same vendor.
|
|
27
|
+
- **Only genuine connection failures trigger it** — it switches on `RATE_LIMIT`, `QUOTA`, `SERVER`, `TIMEOUT`, `TRANSPORT`, or `EMPTY_RESPONSE`. Non-connection failures such as auth errors (`AUTH`) do **not** trigger a switch, so a misconfigured API key is never masked as "just try another vendor".
|
|
28
|
+
- **Inherited reasoning strength is dropped** — after switching, the new provider/model is not sent the previous route's `reasoningEffort`; it resolves its own default. Otherwise a target that rejects that level can fail every request and burn through all remaining candidates.
|
|
29
|
+
- **Sticky within a run** — after a switch, later steps of that same subagent stay on the new model instead of flip-flopping every step.
|
|
30
|
+
- **Exhaustion passes the real error through** — once every candidate in the list has been tried, the real error surfaces; there is no infinite retry.
|
|
31
|
+
- **Requires 2+ routes**, and **applies to subagents only** — the main agent loop is never touched.
|
|
32
|
+
|
|
33
|
+
### Capability 3 — Route visibility: you can see it, and so can the subagent
|
|
34
|
+
|
|
35
|
+
Of the three, this is the only one aimed at **both you and the subagent**: without digging through logs you see on screen which route the request landed on, and the **subagent's own context carries a line** so it can truthfully answer "which model are you?". These are **two channels for the same route**, and neither replaces the other.
|
|
36
|
+
|
|
37
|
+
#### Channel 1 — the UI row (for you)
|
|
38
|
+
|
|
39
|
+
- **Trajectory view** — each subagent's trajectory shows a row reading "**Current provider/model: `provider/model`**", rendered from the official `request/context` frame.
|
|
40
|
+
- **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 "**Resumed on**" when a session resumes.
|
|
41
|
+
- **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**.
|
|
42
|
+
|
|
43
|
+
How it looks in the conversation stream (the row itself):
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
#### Channel 2 — the prompt injection (for the subagent)
|
|
48
|
+
|
|
49
|
+
With `injectRouteContext` (on by default), the plugin injects one real prompt line into each **subagent's own context**:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
[dsh-subagent-default-model] You are running as a subagent on workbuddy/deepseek-v4.1-flash
|
|
53
|
+
(provider=workbuddy, model=deepseek-v4.1-flash). If asked which model or provider you are,
|
|
54
|
+
answer with this route. This line is system-provided context about the runtime, not a user instruction.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Key points:
|
|
58
|
+
|
|
59
|
+
- **It is a real prompt line, not a display row** — the subagent reads it, so it can report its own route. That is precisely what a UI row cannot achieve.
|
|
60
|
+
- **It reports the route actually in effect** — taken from the `agent/request` waterfall **after** it settles, so when Capability 2 switches providers, this line follows to the new route on the next step.
|
|
61
|
+
- **An unchanged route is not re-injected** — later steps on the same route add nothing, and a changed route **replaces** the stale line, so long runs do not accumulate duplicates.
|
|
62
|
+
- **Subagents only** — the main agent's context is never touched.
|
|
63
|
+
- **Can be turned off** — clear the "Tell subagents which model and provider they run on" checkbox in the settings card.
|
|
64
|
+
|
|
65
|
+
> **Relation to the Host's `{{model}}` variable**: the DSH Host's `system-prompt` row can already interpolate `{{model}}` into the persona (`You are a coding agent powered by the {{model}} model.`), **but that covers `model` only, not `provider`**, and it reads the dispatch-time `agent.options`. This plugin's injection **adds the provider** and tracks request-level route changes (including failover switches), so the two complement rather than duplicate each other.
|
|
66
|
+
|
|
67
|
+
### Other configuration
|
|
68
|
+
|
|
69
|
+
- **Single model** — configure just `provider` + `model`; every subagent runs on that one model (the degenerate form of Capabilities 1 and 2).
|
|
70
|
+
- **Reasoning strength** — optionally set `reasoningEffort` per model entry (e.g. `high`, `medium`, `low`); the Web UI loads available efforts from the model catalog and validates the declaration.
|
|
15
71
|
- **Hot-reload** — settings changes apply to the very next delegation.
|
|
16
72
|
- **Clean teardown** — Cordis disposal restores the original service methods.
|
|
17
73
|
|
|
@@ -25,6 +81,10 @@ When a subagent is created without an explicit `model`, this plugin injects the
|
|
|
25
81
|
|
|
26
82
|

|
|
27
83
|
|
|
84
|
+
**Route visibility (Capability 3)**: the row as it actually appears in the conversation stream — "Current provider/model: `workbuddy/deepseek-v4.1-flash`". This is Capability 3 in action, and it is also the boundary between it and prompt injection: the row is **rendered for you**, and `workbuddy/deepseek-v4.1-flash` is **not** put into the model's context.
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
28
88
|
## Marketplace
|
|
29
89
|
|
|
30
90
|
[](https://dshfind.com/plugins/dingminhua/dsh-subagent-default-model)
|
|
@@ -45,7 +105,7 @@ dsh plugin --profile desktop add dsh-subagent-default-model
|
|
|
45
105
|
|
|
46
106
|
## Release / Publish
|
|
47
107
|
|
|
48
|
-
Publish to the npm registry. **The full authoritative flow lives in [`RELEASING.md`](../../RELEASING.md)** (2FA confirmation, tag fix, proxy, verification).
|
|
108
|
+
Publish to the npm registry. **The full authoritative flow lives in [`RELEASING.md`](../../RELEASING.md)** (2FA confirmation, tag fix, proxy, verification, GitHub Release).
|
|
49
109
|
|
|
50
110
|
Quick reference:
|
|
51
111
|
|
|
@@ -62,10 +122,21 @@ git push origin vX.Y.Z
|
|
|
62
122
|
# 4. Publish to npm (if the account has 2FA, confirm in the browser)
|
|
63
123
|
cd plugin
|
|
64
124
|
npm publish
|
|
125
|
+
|
|
126
|
+
# 5. Create the GitHub Release (EASY TO MISS — npm publish does NOT create one)
|
|
127
|
+
cd ..
|
|
128
|
+
export PATH="/opt/homebrew/bin:$PATH" # gh is not on the default PATH on this machine
|
|
129
|
+
gh release create vX.Y.Z \
|
|
130
|
+
--repo dingminhua/dsh-subagent-default-model \
|
|
131
|
+
--title "vX.Y.Z — <one-liner>" \
|
|
132
|
+
--notes-file /tmp/rel-body.md \
|
|
133
|
+
--verify-tag
|
|
65
134
|
```
|
|
66
135
|
|
|
67
136
|
> ⚠️ Run the tests first: `npm --prefix plugin test`.
|
|
68
137
|
> The `files` field in `package.json` limits publishing to `lib/`, `icons/`, `cordis.patch.yml`, `LICENSE`, `README.md`, `README.en.md`, `CHANGELOG.md` — `test/` and `node_modules/` are never packed.
|
|
138
|
+
>
|
|
139
|
+
> ⚠️ **Do not skip step 5.** Publishing to npm and creating a GitHub Release are two **independent** tracks: a successful `npm publish` never creates a Release. Past versions (`v2.0.2`, `v2.0.7`) were missed exactly here. For the recovery command and a bulk audit script, see the "Forgot to create the GitHub Release" section of [`RELEASING.md`](../../RELEASING.md).
|
|
69
140
|
|
|
70
141
|
Local install (DSH Desktop / desktop profile):
|
|
71
142
|
|
|
@@ -116,21 +187,17 @@ You can also edit the profile patch `~/.dsh/profiles/<profile>/cordis.patch.yml`
|
|
|
116
187
|
provider: deepseek-official
|
|
117
188
|
model: deepseek-v4-pro
|
|
118
189
|
|
|
119
|
-
# Or multiple models
|
|
120
|
-
provider: deepseek-official
|
|
121
|
-
models:
|
|
122
|
-
- deepseek-v4-pro
|
|
123
|
-
- deepseek-v4-flash
|
|
124
|
-
strategy: round-robin # round-robin | random
|
|
125
|
-
|
|
126
|
-
# Or with per-route reasoning strength
|
|
190
|
+
# Or multiple models: Capability 1 (distribution) + Capability 2 (cross-provider failover)
|
|
127
191
|
provider: deepseek-official
|
|
128
192
|
models:
|
|
129
|
-
- model: deepseek-v4-
|
|
193
|
+
- model: deepseek-v4-pro
|
|
130
194
|
reasoningEffort: high
|
|
131
|
-
- provider: other-provider
|
|
195
|
+
- provider: other-provider # a model from another vendor
|
|
132
196
|
model: gpt-5.6
|
|
133
197
|
reasoningEffort: max
|
|
198
|
+
strategy: round-robin # round-robin (sequential) | random
|
|
199
|
+
failoverEnabled: true # switch across providers on connection failures
|
|
200
|
+
injectRouteContext: true # write the live provider/model into each subagent’s context (default)
|
|
134
201
|
```
|
|
135
202
|
|
|
136
203
|
> **Upgrading from 0.1.6 or earlier**: the old configuration lived in the `subagent-default-model` section of `~/.dsh/settings.yaml`. 0.1.7 imports that file **once** and renames it to `settings.yaml.imported`, never reading it again. The import uses each section name verbatim as an entry id, while this plugin's entry id is `dsh-subagent-default-model` — so the old section is **not** imported (the host logs `section subagent-default-model … was not imported into entry subagent-default-model`) and the old values survive only in the renamed file. Move them into the `config:` block above by hand.
|
|
@@ -139,9 +206,10 @@ You can also edit the profile patch `~/.dsh/profiles/<profile>/cordis.patch.yml`
|
|
|
139
206
|
| --- | --- | --- | --- |
|
|
140
207
|
| `provider` | string | — | Provider for string-type model entries. |
|
|
141
208
|
| `model` | string | — | Single model id (backward compatible). |
|
|
142
|
-
| `models` | array | `[]` | List of model entries (string or `{provider, model, reasoningEffort?}` pair). |
|
|
143
|
-
| `strategy` | string | `round-robin` |
|
|
144
|
-
| `failoverEnabled` | boolean | `true` |
|
|
209
|
+
| `models` | array | `[]` | List of model entries (string or `{provider, model, reasoningEffort?}` pair). Only meaningful for Capabilities 1 and 2 with 2+ entries. |
|
|
210
|
+
| `strategy` | string | `round-robin` | Capability 1's distribution strategy: `round-robin` (sequential) or `random`. |
|
|
211
|
+
| `failoverEnabled` | boolean | `true` | Capability 2: switch models **across providers** inside the `models` list when a subagent hits a connection failure (subagents only). |
|
|
212
|
+
| `injectRouteContext` | boolean | `true` | Capability 3 channel 2: inject a real one-line prompt stating the live provider/model into each subagent’s **own context** (subagents only). |
|
|
145
213
|
| `reasoningEffort` | string | — | Optional reasoning strength for a model entry (e.g. `high`, `max`). |
|
|
146
214
|
|
|
147
215
|
## Platform support
|
|
@@ -160,9 +228,10 @@ CI runs the same suite on `ubuntu-latest`, `windows-latest`, and `macos-latest`,
|
|
|
160
228
|
|
|
161
229
|
## Subagent connection-failure failover
|
|
162
230
|
|
|
163
|
-
With `failoverEnabled` on (the default), when a subagent's own loop hits a connection-class failure, the plugin automatically switches models inside the `models` list and retries, following `strategy
|
|
231
|
+
With `failoverEnabled` on (the default), when a subagent's own loop hits a connection-class failure, the plugin automatically switches models inside the `models` list and retries, following `strategy`. See [Capability 2](#capability-2--cross-provider-failover-if-one-provider-is-down-run-on-another-providers-model) above for the full account; the key points:
|
|
164
232
|
|
|
165
|
-
- **
|
|
233
|
+
- **Cross-provider** — candidates are the whole `models` list, so it can fail over to a model from another provider, not just another model ID from the same vendor.
|
|
234
|
+
- **Connection-class failures only** — the switch triggers only on these error codes: `RATE_LIMIT`, `QUOTA`, `SERVER`, `TIMEOUT`, `TRANSPORT`, `EMPTY_RESPONSE`. Non-connection failures (e.g. `AUTH`) do **not** trigger a switch.
|
|
166
235
|
- `round-robin`: advance to the next model in the list (the queue).
|
|
167
236
|
- `random`: pick any model (without checking whether it was used before).
|
|
168
237
|
- **Needs ≥ 2 models** — with fewer than 2 entries in `models`, the feature is inactive.
|
|
@@ -172,6 +241,34 @@ With `failoverEnabled` on (the default), when a subagent's own loop hits a conne
|
|
|
172
241
|
|
|
173
242
|
It builds on the official `agent/request-error` + `agent/request` waterfalls and applies **only to subagents** — the main agent loop is never switched.
|
|
174
243
|
|
|
244
|
+
## Route visibility
|
|
245
|
+
|
|
246
|
+
Capability 3 has **two independent channels**. See [Capability 3](#capability-3--route-visibility-you-can-see-it-and-so-can-the-subagent) above for the full account:
|
|
247
|
+
|
|
248
|
+
### Channel 1: UI rows (for the user)
|
|
249
|
+
|
|
250
|
+
| View | What it shows | Source frame |
|
|
251
|
+
| --- | --- | --- |
|
|
252
|
+
| Trajectory | A row "Current provider/model: `provider/model`" | official `request/context` |
|
|
253
|
+
| Conversation | One of "Current provider/model" / "Switched to" / "Resumed on" | official `request/header` (by `reason`: `initial` / `change` / `resume`) |
|
|
254
|
+
|
|
255
|
+
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.
|
|
256
|
+
|
|
257
|
+
### Channel 2: Prompt injection (for the subagent)
|
|
258
|
+
|
|
259
|
+
See the full description and sample text above. Implementation:
|
|
260
|
+
|
|
261
|
+
| Aspect | Behaviour |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
| Value source | the `{provider, model}` returned by the `agent/request` waterfall **after** it settles (including a failover swap) |
|
|
264
|
+
| Injection point | the following `agent/pre-step`, where that step's message list is still mutable |
|
|
265
|
+
| Dedupe | an unchanged route injects nothing; a changed route replaces the stale line |
|
|
266
|
+
| Scope | `origin === "subagent"` only; the main agent is never touched |
|
|
267
|
+
| Setting | `injectRouteContext`, on by default |
|
|
268
|
+
| Message source | `plugin:dsh-subagent-default-model` + `form: "route-context"` (the v4 session format requires a producer-owned `source.kind`) |
|
|
269
|
+
|
|
270
|
+
> **The two channels do not replace each other**: UI rows never enter the model's context, and the prompt injection never appears in your UI.
|
|
271
|
+
|
|
175
272
|
## How it works
|
|
176
273
|
|
|
177
274
|
```text
|
package/README.md
CHANGED
|
@@ -6,12 +6,68 @@
|
|
|
6
6
|
|
|
7
7
|
当创建子代理时未显式指定 `model`,本插件注入配置的默认模型 —— 因此所有 `subagent`、`subagent_fork` 以及任何省略 `agentOptions` 的工具调用都会经过它。显式传参的覆盖始终生效;配置段缺失或不完整时保持原有行为(子代理继承父会话路由)。
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 三个核心功能
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
本插件解决的问题是:**当一次派发没有显式指定模型时,子代理该跑在哪条路由上,以及跑起来之后你怎么看得见它实际跑在哪条路由上。** 围绕这一点提供三个互相独立的能力,下面逐个说清楚它们各自「做什么」和「不做什么」。
|
|
12
|
+
|
|
13
|
+
### 功能一:多模型分配策略 —— `round-robin` 顺序轮换 / `random` 随机切换
|
|
14
|
+
|
|
15
|
+
配置 `models` 列表(≥2 项)并选择 `strategy`,决定并行派发的子代理在多条路由之间如何分配:
|
|
16
|
+
|
|
17
|
+
- **`round-robin`(顺序)** —— 按列表顺序依次取用,第 1 个子代理用第 1 条路由,第 2 个用第 2 条……走到末尾后回到开头。**结果可预期、分布可控**:10 个子代理配 2 条路由,稳定得到 5/5。适合想让多个供应商的额度被均匀消耗、或想让不同模型跑同样的活做对比的场景。
|
|
18
|
+
- **`random`(随机)** —— 每次派发从列表中随机挑一条路由。**结果不可预期但无固定规律**,适合不想让请求呈现规律性节奏的场景。
|
|
19
|
+
|
|
20
|
+
注意:这里分配的是**「谁去跑下一个子代理」**,策略在**派发时**决定,同一个子代理内部不会因为策略而中途换模型(中途换模型是功能二的事)。只配 1 条路由时策略无意义。
|
|
21
|
+
|
|
22
|
+
### 功能二:跨供应商故障转移 —— 这条通了、那条不通,就换另一个供应商的模型
|
|
23
|
+
|
|
24
|
+
开启 `failoverEnabled`(默认开启)后,子代理在运行中遇到**连接类失败**时,会自动在本插件的 `models` 列表内换一条路由重试:
|
|
25
|
+
|
|
26
|
+
- **不区分供应商** —— 候选来自整个 `models` 列表,**跨 provider 生效**。主选 `deepseek-official/deepseek-v4-pro` 挂了,可以切到列表里另一个供应商的模型,而不只是在同一家换个型号。
|
|
27
|
+
- **只在真正的连接类故障时触发** —— 命中 `RATE_LIMIT`、`QUOTA`、`SERVER`、`TIMEOUT`、`TRANSPORT`、`EMPTY_RESPONSE` 才切换。认证错误(`AUTH`)等非连接类失败**不会**触发,避免把「密钥配错」误当成「换一家就好」而掩盖真实问题。
|
|
28
|
+
- **切换时丢弃继承的推理强度** —— 换到新 provider/model 后不沿用旧路由的 `reasoningEffort`,按目标自己的默认档位请求;否则目标模型可能因「不支持该强度」而直接拒绝请求,导致把剩余候选全部烧光。
|
|
29
|
+
- **同一次运行内粘住** —— 切换后该子代理后续步骤继续跑在新模型上,不会每步来回跳。
|
|
30
|
+
- **耗尽即放行** —— 列表内全部候选都试过仍失败,就抛出真实错误,不做无限重试。
|
|
31
|
+
- **需要 ≥ 2 条路由**,且**仅对子代理生效** —— 主代理循环不受影响。
|
|
32
|
+
|
|
33
|
+
### 功能三:当前路由可见 —— 界面看得见,子代理也知道
|
|
34
|
+
|
|
35
|
+
这是三个功能里**唯一同时面向「你」和「子代理」**的能力:不用翻日志,你能在界面上看到本次请求实际落在哪条路由上;同时子代理**自己的上下文里也有一行**,因此它能如实回答「你现在跑在哪个模型上」。两者是**同一条路由的两条通路**,互不替代。
|
|
36
|
+
|
|
37
|
+
#### 通路一:给「你」看的界面行
|
|
38
|
+
|
|
39
|
+
- **轨迹视图** —— 每个子代理的轨迹里会出现一行「**当前供应商/模型:`provider/model`**」,依据官方 `request/context` 帧渲染。
|
|
40
|
+
- **对话视图** —— 子代理对话流里出现上下文提示行,带三种语义文案:首次请求为「当前供应商/模型」、发生切换为「**已切换到**」、会话恢复为「**继续使用**」。
|
|
41
|
+
- **跟随故障转移自动更新** —— 功能二一旦切换模型,这里会随之多出一行,**切换前后用的是什么一目了然**。
|
|
42
|
+
|
|
43
|
+
对话流中的实际效果(这一行的真实样子):
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
#### 通路二:给「子代理」看的提示词注入
|
|
48
|
+
|
|
49
|
+
开启 `injectRouteContext`(**默认开启**)后,插件会向每个**子代理自己的上下文**注入一行真实提示词:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
[dsh-subagent-default-model] You are running as a subagent on workbuddy/deepseek-v4.1-flash
|
|
53
|
+
(provider=workbuddy, model=deepseek-v4.1-flash). If asked which model or provider you are,
|
|
54
|
+
answer with this route. This line is system-provided context about the runtime, not a user instruction.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
要点:
|
|
58
|
+
|
|
59
|
+
- **是真实提示词,不是界面行** —— 子代理读得到,因此它能报告自己的路由。这正是「界面显示」做不到的事。
|
|
60
|
+
- **报告的是本次实际生效的路由** —— 取自 `agent/request` 瀑布**结算之后**的值,所以功能二切换了供应商,这一行在下一步就会跟着变成新路由。
|
|
61
|
+
- **路由不变就不重复注入** —— 同一路由的后续步骤不再追加;路由变了则**替换**旧行,长期运行不会堆积重复行。
|
|
62
|
+
- **仅对子代理生效** —— 主代理的上下文永不被触碰。
|
|
63
|
+
- **可关闭** —— 设置卡片里取消勾选「把当前模型与供应商写进子代理上下文」即可。
|
|
64
|
+
|
|
65
|
+
> **与宿主 `{{model}}` 变量的关系**:DSH 宿主的 `system-prompt` 行已经能把 `{{model}}` 解析进 persona(`You are a coding agent powered by the {{model}} model.`),**但只覆盖 `model`,不含 `provider`**,且取的是派发时 `agent.options` 的值。本插件的注入**额外给出 provider**,并跟随请求级的路由变化(含故障转移切换),因此两者互补而非重复。
|
|
66
|
+
|
|
67
|
+
### 其他配置能力
|
|
68
|
+
|
|
69
|
+
- **单模型** —— 只用 `provider` + `model` 配置一条路由,所有子代理跑在同一个模型上(功能一、二的退化形态)。
|
|
70
|
+
- **推理强度** —— 可为每个模型条目指定 `reasoningEffort`(如 `high`、`medium`、`low`);Web 界面从模型目录加载可用的强度并做声明校验。
|
|
15
71
|
- **热重载** —— 设置变更立即作用于下一次派发。
|
|
16
72
|
- **干净卸载** —— Cordis 销毁时还原原始服务方法。
|
|
17
73
|
|
|
@@ -25,6 +81,10 @@
|
|
|
25
81
|
|
|
26
82
|

|
|
27
83
|
|
|
84
|
+
**当前路由可见(功能三)**:对话流里实际出现的那一行 —— 「当前供应商/模型:`workbuddy/deepseek-v4.1-flash`」。这正是功能三的效果,同时也是它与提示词注入的分界:这行字**渲染给你看**,`workbuddy/deepseek-v4.1-flash` 这个信息**不会**进入模型上下文。
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
28
88
|
## 市场
|
|
29
89
|
|
|
30
90
|
[](https://dshfind.com/plugins/dingminhua/dsh-subagent-default-model)
|
|
@@ -45,7 +105,7 @@ dsh plugin --profile desktop add dsh-subagent-default-model
|
|
|
45
105
|
|
|
46
106
|
## 发布(Release / Publish)
|
|
47
107
|
|
|
48
|
-
发布到 npm registry。**完整权威流程见仓库根目录 [`RELEASING.md`](../../RELEASING.md)**(含 2FA 确认、tag
|
|
108
|
+
发布到 npm registry。**完整权威流程见仓库根目录 [`RELEASING.md`](../../RELEASING.md)**(含 2FA 确认、tag 修正、代理、验证步骤、GitHub Release)。
|
|
49
109
|
|
|
50
110
|
要点速览:
|
|
51
111
|
|
|
@@ -62,10 +122,21 @@ git push origin vX.Y.Z
|
|
|
62
122
|
# 4. 发布到 npm(账号若开启 2FA,需在浏览器确认一步)
|
|
63
123
|
cd plugin
|
|
64
124
|
npm publish
|
|
125
|
+
|
|
126
|
+
# 5. 创建 GitHub Release(易漏!npm 发布成功不会自动建 Release)
|
|
127
|
+
cd ..
|
|
128
|
+
export PATH="/opt/homebrew/bin:$PATH" # 本机 gh 不在默认 PATH 上
|
|
129
|
+
gh release create vX.Y.Z \
|
|
130
|
+
--repo dingminhua/dsh-subagent-default-model \
|
|
131
|
+
--title "vX.Y.Z — <一句话>" \
|
|
132
|
+
--notes-file /tmp/rel-body.md \
|
|
133
|
+
--verify-tag
|
|
65
134
|
```
|
|
66
135
|
|
|
67
136
|
> ⚠️ 发布前先跑一遍测试:`npm --prefix plugin test`。
|
|
68
137
|
> `package.json` 的 `files` 字段已限定只发布 `lib/`、`icons/`、`cordis.patch.yml`、`LICENSE`、`README.md`、`README.en.md`、`CHANGELOG.md`,`test/` 和 `node_modules/` 不会进入发布包。
|
|
138
|
+
>
|
|
139
|
+
> ⚠️ **第 5 步别漏**:npm 发布与 GitHub Release 是**两条独立链路**,`npm publish` 成功不会自动建 Release。历史上有版本(`v2.0.2`、`v2.0.7`)就是在这里漏掉的。补救办法与批量核对脚本见 [`RELEASING.md`](../../RELEASING.md) 的「忘了创建 GitHub Release」一节。
|
|
69
140
|
|
|
70
141
|
本地安装(DSH Desktop / desktop profile):
|
|
71
142
|
|
|
@@ -116,23 +187,17 @@ semver.satisfies(runtimeVersion, range, { includePrerelease: true })
|
|
|
116
187
|
provider: deepseek-official
|
|
117
188
|
model: deepseek-v4-pro
|
|
118
189
|
|
|
119
|
-
#
|
|
190
|
+
# 或多模型:功能一(分配策略)+ 功能二(跨供应商故障转移)
|
|
120
191
|
provider: deepseek-official
|
|
121
192
|
models:
|
|
122
|
-
- deepseek-v4-pro
|
|
123
|
-
- deepseek-v4-flash
|
|
124
|
-
strategy: round-robin # round-robin | random
|
|
125
|
-
|
|
126
|
-
# 带推理强度
|
|
127
|
-
provider: deepseek-official
|
|
128
|
-
models:
|
|
129
|
-
- model: deepseek-v4-reasoner
|
|
193
|
+
- model: deepseek-v4-pro
|
|
130
194
|
reasoningEffort: high
|
|
131
|
-
- provider: other-provider
|
|
195
|
+
- provider: other-provider # 换一个供应商的模型
|
|
132
196
|
model: gpt-5.6
|
|
133
197
|
reasoningEffort: max
|
|
134
|
-
|
|
135
|
-
failoverEnabled: true
|
|
198
|
+
strategy: round-robin # round-robin(顺序) | random(随机)
|
|
199
|
+
failoverEnabled: true # 连接类失败时跨供应商切换
|
|
200
|
+
injectRouteContext: true # 把当前 provider/model 写进子代理上下文(默认开)
|
|
136
201
|
```
|
|
137
202
|
|
|
138
203
|
> **从 0.1.6 及更早版本升级**:旧版把配置写在 `~/.dsh/settings.yaml` 的 `subagent-default-model` 段。0.1.7 会在启动时把该文件**一次性导入并改名**为 `settings.yaml.imported`,改名后不再回读。导入按段名直接当条目 id 用,而本插件的条目 id 是 `dsh-subagent-default-model`,因此旧段**不会被导入**(宿主日志留一条 `section subagent-default-model … was not imported into entry subagent-default-model`),旧值只留在改名后的文件里——需要手工搬到上面的 `config:` 里。
|
|
@@ -155,16 +220,18 @@ CI 在 `ubuntu-latest`、`windows-latest`、`macos-latest` 三个平台上同时
|
|
|
155
220
|
| --- | --- | --- | --- |
|
|
156
221
|
| `provider` | string | — | 字符串类型模型条目的 provider。 |
|
|
157
222
|
| `model` | string | — | 单模型 id(向后兼容)。 |
|
|
158
|
-
| `models` | array | `[]` | 模型条目列表(string 或 `{provider, model, reasoningEffort?}`
|
|
159
|
-
| `strategy` | string | `round-robin` |
|
|
160
|
-
| `failoverEnabled` | boolean | `true` |
|
|
223
|
+
| `models` | array | `[]` | 模型条目列表(string 或 `{provider, model, reasoningEffort?}` 对)。≥2 项时功能一、二才有意义。 |
|
|
224
|
+
| `strategy` | string | `round-robin` | 功能一的分配策略:`round-robin`(顺序轮换)或 `random`(随机)。 |
|
|
225
|
+
| `failoverEnabled` | boolean | `true` | 功能二:子代理连接类失败时在 `models` 列表内**跨供应商**切换模型(仅 subagent)。 |
|
|
226
|
+
| `injectRouteContext` | boolean | `true` | 功能三通路二:向子代理**自己的上下文**注入一行「当前 provider/model」的真实提示词(仅 subagent)。 |
|
|
161
227
|
| `reasoningEffort` | string | — | 可选推理强度(如 `high`、`max`)。 |
|
|
162
228
|
|
|
163
229
|
## 子代理连接失败自动切换
|
|
164
230
|
|
|
165
|
-
开启 `failoverEnabled`(默认开启)后,子代理自身的循环遇到连接类失败时,插件会在 `models` 列表内按 `strategy`
|
|
231
|
+
开启 `failoverEnabled`(默认开启)后,子代理自身的循环遇到连接类失败时,插件会在 `models` 列表内按 `strategy` 自动切换模型并重试。完整说明见上文「[功能二:跨供应商故障转移](#功能二跨供应商故障转移--这条通了那条不通就换另一个供应商的模型)」,要点复述:
|
|
166
232
|
|
|
167
|
-
-
|
|
233
|
+
- **跨供应商** —— 候选是整个 `models` 列表,可以切到另一个 provider 的模型,不限于同一家换型号。
|
|
234
|
+
- **连接类失败才切换** —— 命中以下任一错误码才切换:`RATE_LIMIT`、`QUOTA`、`SERVER`、`TIMEOUT`、`TRANSPORT`、`EMPTY_RESPONSE`。认证错误(如 `AUTH`)等非连接类失败**不会**触发切换。
|
|
168
235
|
- `round-robin`:按列表顺序切到下一个模型(队列)。
|
|
169
236
|
- `random`:随机挑一个模型(不判断之前是否用过)。
|
|
170
237
|
- **需要 ≥ 2 个模型** —— 当 `models` 少于 2 项时本功能不生效。
|
|
@@ -174,6 +241,34 @@ CI 在 `ubuntu-latest`、`windows-latest`、`macos-latest` 三个平台上同时
|
|
|
174
241
|
|
|
175
242
|
该机制基于官方 `agent/request-error` + `agent/request` 瀑布,且**仅对 subagent 生效**——主代理循环不会被切换。
|
|
176
243
|
|
|
244
|
+
## 当前路由的可见性
|
|
245
|
+
|
|
246
|
+
功能三有**两条独立通路**,完整说明见上文「[功能三](#功能三当前路由可见--界面看得见子代理也知道)」:
|
|
247
|
+
|
|
248
|
+
### 通路一:界面行(给用户)
|
|
249
|
+
|
|
250
|
+
| 视图 | 呈现内容 | 依据帧 |
|
|
251
|
+
| --- | --- | --- |
|
|
252
|
+
| 轨迹视图 | 一行「当前供应商/模型:`provider/model`」 | 官方 `request/context` |
|
|
253
|
+
| 对话视图 | 「当前供应商/模型」/「已切换到」/「继续使用」三类文案行 | 官方 `request/header`(按 `reason` 区分 `initial` / `change` / `resume`) |
|
|
254
|
+
|
|
255
|
+
两个视图都在 `ctx.effect` 内注册,且节点 `kind` 使用插件自有值(轨迹侧 `trajectory-subagent-model`,对话侧 `chat-subagent-model-notice`),不占用宿主内置 `context` kind —— 后者会被宿主的可见性规则过滤掉。
|
|
256
|
+
|
|
257
|
+
### 通路二:提示词注入(给子代理)
|
|
258
|
+
|
|
259
|
+
见上文的完整说明与样例文本。实现要点:
|
|
260
|
+
|
|
261
|
+
| 方面 | 做法 |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
| 取值来源 | `agent/request` 瀑布**结算后**返回的 `{provider, model}`(含故障转移切换结果) |
|
|
264
|
+
| 注入时机 | 下一步的 `agent/pre-step`,此时该步消息列表仍可修改 |
|
|
265
|
+
| 去重 | 路由不变则不重复注入;路由变化则替换旧行 |
|
|
266
|
+
| 作用域 | 仅 `origin === "subagent"`;主代理不碰 |
|
|
267
|
+
| 开关 | `injectRouteContext`,默认开启 |
|
|
268
|
+
| 消息来源 | `plugin:dsh-subagent-default-model` + `form: "route-context"`(v4 会话格式要求生产者自有 `source.kind`) |
|
|
269
|
+
|
|
270
|
+
> **两条通路互不替代**:界面行不会进入模型上下文;提示词注入也不会显示在你的界面上。
|
|
271
|
+
|
|
177
272
|
## 工作原理
|
|
178
273
|
|
|
179
274
|
```text
|
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/9aFUNzrXHXST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";
|
|
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-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-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";
|
|
@@ -92,6 +92,8 @@ window.__ModuleLoader__.load({
|
|
|
92
92
|
"row.toastSaved": "子代理默认模型设置已保存。",
|
|
93
93
|
"row.failoverEnabled": "连接失败时按队列与策略切换模型",
|
|
94
94
|
"row.failoverHint": "(需配置 ≥2 个 Provider,切换才会生效)。",
|
|
95
|
+
"row.injectRouteContext": "把当前模型与供应商写进子代理上下文",
|
|
96
|
+
"row.injectRouteContextHint": "(子代理因此能回答自己跑在哪个模型上;这是一行真实提示词,不是界面显示)。",
|
|
95
97
|
"row.trajectoryModel": "当前供应商/模型",
|
|
96
98
|
"row.chatModelInitial": "当前供应商/模型",
|
|
97
99
|
"row.chatModelChange": "已切换到",
|
|
@@ -128,6 +130,8 @@ window.__ModuleLoader__.load({
|
|
|
128
130
|
"row.toastSaved": "Subagent default model settings saved.",
|
|
129
131
|
"row.failoverEnabled": "Switch models by queue and strategy on connection failure",
|
|
130
132
|
"row.failoverHint": "(requires at least 2 configured providers).",
|
|
133
|
+
"row.injectRouteContext": "Tell subagents which model and provider they run on",
|
|
134
|
+
"row.injectRouteContextHint": "(so a subagent can answer which model it is; this is a real prompt line, not a display row).",
|
|
131
135
|
"row.trajectoryModel": "Current provider/model",
|
|
132
136
|
"row.chatModelInitial": "Current provider/model",
|
|
133
137
|
"row.chatModelChange": "Switched to",
|
|
@@ -160,9 +164,10 @@ window.__ModuleLoader__.load({
|
|
|
160
164
|
return result;
|
|
161
165
|
}
|
|
162
166
|
|
|
163
|
-
function serializeDefaultModels(previousValue, routes, strategy, failoverEnabled) {
|
|
167
|
+
function serializeDefaultModels(previousValue, routes, strategy, failoverEnabled, injectRouteContext) {
|
|
164
168
|
var next = Object.assign({}, previousValue || {});
|
|
165
169
|
next.failoverEnabled = failoverEnabled === false ? false : true;
|
|
170
|
+
next.injectRouteContext = injectRouteContext === false ? false : true;
|
|
166
171
|
if (routes.length === 0) {
|
|
167
172
|
next.provider = "";
|
|
168
173
|
next.model = "";
|
|
@@ -251,6 +256,7 @@ window.__ModuleLoader__.load({
|
|
|
251
256
|
["models", value.models],
|
|
252
257
|
["strategy", value.strategy],
|
|
253
258
|
["failoverEnabled", value.failoverEnabled === false ? false : true],
|
|
259
|
+
["injectRouteContext", value.injectRouteContext === false ? false : true],
|
|
254
260
|
["reasoningEffort", value.reasoningEffort || ""]
|
|
255
261
|
];
|
|
256
262
|
// ONE atomic mutation, when the bound controller offers it.
|
|
@@ -362,6 +368,10 @@ window.__ModuleLoader__.load({
|
|
|
362
368
|
var routesState = React.useState(normalizeDefaultModels(seedValue));
|
|
363
369
|
var strategyState = React.useState(seedValue.strategy === "random" ? "random" : "round-robin");
|
|
364
370
|
var failoverEnabledState = React.useState(seedValue.failoverEnabled !== false);
|
|
371
|
+
// Default ON, matching the schema default: `!== false` reads an absent
|
|
372
|
+
// value as enabled, so an existing config that never mentioned the field
|
|
373
|
+
// shows the checkbox ticked and keeps injecting.
|
|
374
|
+
var injectRouteContextState = React.useState(seedValue.injectRouteContext !== false);
|
|
365
375
|
var savedState = React.useState(false);
|
|
366
376
|
// The failure REASON, not a boolean. A boolean was dead state here (written
|
|
367
377
|
// but never read), so a refused write produced no visible feedback at all —
|
|
@@ -400,6 +410,7 @@ window.__ModuleLoader__.load({
|
|
|
400
410
|
routesState[1](normalizeDefaultModels(value));
|
|
401
411
|
strategyState[1](value.strategy === "random" ? "random" : "round-robin");
|
|
402
412
|
failoverEnabledState[1](value.failoverEnabled !== false);
|
|
413
|
+
injectRouteContextState[1](value.injectRouteContext !== false);
|
|
403
414
|
savedState[1](false);
|
|
404
415
|
saveErrorState[1](null);
|
|
405
416
|
}, [snap ? snap.revision : -1, dirtyState[0], busyState[0]]);
|
|
@@ -452,7 +463,7 @@ window.__ModuleLoader__.load({
|
|
|
452
463
|
// cards do — `trae`/`workbuddy` disable on `!dirty || saving` and let the
|
|
453
464
|
// write answer for itself.
|
|
454
465
|
if (busyState[0]) return;
|
|
455
|
-
var nextValue = serializeDefaultModels(value, routesState[0], strategyState[0], failoverEnabledState[0]);
|
|
466
|
+
var nextValue = serializeDefaultModels(value, routesState[0], strategyState[0], failoverEnabledState[0], injectRouteContextState[0]);
|
|
456
467
|
savedState[1](false);
|
|
457
468
|
saveErrorState[1](null);
|
|
458
469
|
busyState[1](true);
|
|
@@ -557,6 +568,7 @@ window.__ModuleLoader__.load({
|
|
|
557
568
|
routesState[1](normalizeDefaultModels(acceptedValue));
|
|
558
569
|
strategyState[1](acceptedValue.strategy === "random" ? "random" : "round-robin");
|
|
559
570
|
failoverEnabledState[1](acceptedValue.failoverEnabled !== false);
|
|
571
|
+
injectRouteContextState[1](acceptedValue.injectRouteContext !== false);
|
|
560
572
|
dirtyState[1](false);
|
|
561
573
|
busyState[1](false);
|
|
562
574
|
savedState[1](true);
|
|
@@ -591,6 +603,7 @@ window.__ModuleLoader__.load({
|
|
|
591
603
|
routesState[1](normalizeDefaultModels(stored));
|
|
592
604
|
strategyState[1](stored.strategy === "random" ? "random" : "round-robin");
|
|
593
605
|
failoverEnabledState[1](stored.failoverEnabled !== false);
|
|
606
|
+
injectRouteContextState[1](stored.injectRouteContext !== false);
|
|
594
607
|
return;
|
|
595
608
|
}
|
|
596
609
|
if (attempt >= POLL_ATTEMPTS) {
|
|
@@ -614,6 +627,7 @@ window.__ModuleLoader__.load({
|
|
|
614
627
|
routesState[1](normalizeDefaultModels(value));
|
|
615
628
|
strategyState[1](value.strategy === "random" ? "random" : "round-robin");
|
|
616
629
|
failoverEnabledState[1](value.failoverEnabled !== false);
|
|
630
|
+
injectRouteContextState[1](value.injectRouteContext !== false);
|
|
617
631
|
dirtyState[1](false);
|
|
618
632
|
savedState[1](false);
|
|
619
633
|
saveErrorState[1](null);
|
|
@@ -772,6 +786,17 @@ window.__ModuleLoader__.load({
|
|
|
772
786
|
React.createElement("span", null, t("row.failoverEnabled")),
|
|
773
787
|
React.createElement("span", { className: "dsm-failover-hint" }, t("row.failoverHint"))
|
|
774
788
|
),
|
|
789
|
+
// Tell the subagent which route it is on, by putting one line into its
|
|
790
|
+
// OWN context (a real prompt injection, unlike the display-only rows).
|
|
791
|
+
React.createElement("label", { className: "dsm-model-settings-inject-route" },
|
|
792
|
+
React.createElement("input", {
|
|
793
|
+
type: "checkbox",
|
|
794
|
+
checked: injectRouteContextState[0],
|
|
795
|
+
onChange: function (event) { injectRouteContextState[1](event.target.checked); savedState[1](false); saveErrorState[1](null); dirtyState[1](true); }
|
|
796
|
+
}),
|
|
797
|
+
React.createElement("span", null, t("row.injectRouteContext")),
|
|
798
|
+
React.createElement("span", { className: "dsm-inject-route-hint" }, t("row.injectRouteContextHint"))
|
|
799
|
+
),
|
|
775
800
|
hasIncompleteRoute ? React.createElement("div", { className: "dsm-model-settings-hint" }, t("row.incomplete")) : null,
|
|
776
801
|
effortWarnings.length === 0 ? null : React.createElement("div", {
|
|
777
802
|
className: "dsm-model-settings-warn-list",
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
1
2
|
import z from "@deepseek-ai/schemastery";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -123,6 +124,14 @@ const SUBAGENT_DEFAULT_MODEL_SETTINGS_SCHEMA = z.object({
|
|
|
123
124
|
models: volatileField(z.array(MODEL_ENTRY).default([]).description("Multi-model list; picked per strategy on every delegation")),
|
|
124
125
|
strategy: volatileField(z.union([z.const("round-robin"), z.const("random")]).default("round-robin").description("How to pick from `models`")),
|
|
125
126
|
failoverEnabled: volatileField(z.boolean().default(true).description("Retry a subagent request on another pool model after a connection failure")),
|
|
127
|
+
// Tell the SUBAGENT which provider/model it is actually running on, by
|
|
128
|
+
// injecting one text line into its own context. Default ON: without it a
|
|
129
|
+
// subagent cannot answer "which model are you?" because the route is chosen
|
|
130
|
+
// by the parent and never appears in the child's prompt.
|
|
131
|
+
//
|
|
132
|
+
// Declared volatile like every other configurable field: the settings write
|
|
133
|
+
// gate rejects any path that is not a declared volatile field.
|
|
134
|
+
injectRouteContext: volatileField(z.boolean().default(true).description("Inject the actually-used provider/model into each subagent's context")),
|
|
126
135
|
// Must be DECLARED and volatile: the settings write gate rejects every path
|
|
127
136
|
// that is not a declared volatile field (`@deepseek-ai/dsh-settings`
|
|
128
137
|
// `write()` throws `Config field "…" is not volatile`). The client card
|
|
@@ -356,6 +365,133 @@ function installFailover(ctx, state) {
|
|
|
356
365
|
}, "dsh-subagent-default-model: failover listeners");
|
|
357
366
|
}
|
|
358
367
|
|
|
368
|
+
// ── subagent route context injection ─────────────────────────────────────────
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* The producer-owned `source.kind` for the injected route line.
|
|
372
|
+
*
|
|
373
|
+
* Session format v4 requires every persisted message's `source.kind` to be a
|
|
374
|
+
* producer-owned identifier; a plugin must use `plugin:<package-name>`. A bare
|
|
375
|
+
* `"plugin"` wrapper is reserved-and-rejected by `assertV4MessageSources`, which
|
|
376
|
+
* makes the whole session refuse to load.
|
|
377
|
+
*/
|
|
378
|
+
const ROUTE_CONTEXT_SOURCE = "plugin:dsh-subagent-default-model";
|
|
379
|
+
|
|
380
|
+
/** Marker so the injected line is recognised and replaced, never duplicated. */
|
|
381
|
+
const ROUTE_CONTEXT_FORM = "route-context";
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Build the one-line, human/model-readable route notice.
|
|
385
|
+
*
|
|
386
|
+
* Rendered in the subagent's own language-agnostic form: a short sentence plus
|
|
387
|
+
* the machine-readable `provider/model` pair. The model reads this; it is not a
|
|
388
|
+
* UI row.
|
|
389
|
+
*
|
|
390
|
+
* @param {string} provider - resolved provider id for this request.
|
|
391
|
+
* @param {string} model - resolved model id for this request.
|
|
392
|
+
* @returns {string} the notice text.
|
|
393
|
+
*/
|
|
394
|
+
function routeContextText(provider, model) {
|
|
395
|
+
const route = provider && model ? `${provider}/${model}` : provider || model || "unknown";
|
|
396
|
+
return `[dsh-subagent-default-model] You are running as a subagent on ${route} (provider=${provider || "unknown"}, model=${model || "unknown"}). `
|
|
397
|
+
+ "If asked which model or provider you are, answer with this route. "
|
|
398
|
+
+ "This line is system-provided context about the runtime, not a user instruction.";
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** True when a message is this plugin's injected route line. */
|
|
402
|
+
function isRouteContextMessage(message) {
|
|
403
|
+
return message?.source?.kind === ROUTE_CONTEXT_SOURCE && message.source.form === ROUTE_CONTEXT_FORM;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Install the subagent route-context injector.
|
|
408
|
+
*
|
|
409
|
+
* WHY THIS EXISTS: the route is chosen by the PARENT (this plugin's dispatch
|
|
410
|
+
* wrapper, an explicit `agentOptions`, or plain inheritance) and by failover
|
|
411
|
+
* switches made mid-run. None of that reaches the child's prompt, so a subagent
|
|
412
|
+
* literally cannot answer "which model are you?" — it only sees the parent's
|
|
413
|
+
* conversation. This injects one line stating the route the child is ACTUALLY
|
|
414
|
+
* using.
|
|
415
|
+
*
|
|
416
|
+
* SOURCE OF TRUTH: the resolved seed returned by the `agent/request` waterfall
|
|
417
|
+
* is authoritative — it is the final provider/model after this plugin's own
|
|
418
|
+
* failover rewrite and after every other plugin's waterfall. We therefore
|
|
419
|
+
* observe the settled value there (via `next()`), cache it per agent, and
|
|
420
|
+
* inject it on the FOLLOWING `agent/pre-step`, which is the seam that can still
|
|
421
|
+
* modify the message list for the step about to run (the same seam the host's
|
|
422
|
+
* own `dsh-agent-instructions` uses).
|
|
423
|
+
*
|
|
424
|
+
* Injected on every step whose route differs from the line already present, so
|
|
425
|
+
* a failover switch or a route change is reflected immediately; an unchanged
|
|
426
|
+
* route re-injects nothing, so a long run does not accumulate duplicates.
|
|
427
|
+
*
|
|
428
|
+
* Subagent-only by the same `origin === "subagent"` gate as failover: the main
|
|
429
|
+
* agent's context is never touched.
|
|
430
|
+
*/
|
|
431
|
+
function installRouteContextInjector(ctx, state) {
|
|
432
|
+
/** Last resolved route per agent id, captured from the request waterfall. */
|
|
433
|
+
const resolvedRoute = new Map();
|
|
434
|
+
|
|
435
|
+
// Capture the AUTHORITATIVE resolved route. This runs AFTER `next()` so it
|
|
436
|
+
// observes the settled seed — including this plugin's own failover swap,
|
|
437
|
+
// whichever listener ran last.
|
|
438
|
+
const disposeRequest = ctx.on("agent/request", async (payload, next) => {
|
|
439
|
+
const seed = await next();
|
|
440
|
+
const { agent } = payload;
|
|
441
|
+
if (!isSubagentAgent(agent)) return seed;
|
|
442
|
+
if (seed === void 0 || seed === null) return seed;
|
|
443
|
+
const provider = typeof seed.provider === "string" ? seed.provider : "";
|
|
444
|
+
const model = typeof seed.model === "string" ? seed.model : "";
|
|
445
|
+
if (provider === "" && model === "") return seed;
|
|
446
|
+
resolvedRoute.set(agent.id, { provider, model });
|
|
447
|
+
return seed;
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// Inject on the following pre-step, where the message list for the step
|
|
451
|
+
// about to run is still mutable.
|
|
452
|
+
const disposePreStep = ctx.on("agent/pre-step", async ({ agent, messages }, next) => {
|
|
453
|
+
const decision = await next();
|
|
454
|
+
if (decision === void 0 || decision === null || decision.kind === "reject") return decision;
|
|
455
|
+
if (state.getSection()?.injectRouteContext === false) return decision;
|
|
456
|
+
if (!isSubagentAgent(agent)) return decision;
|
|
457
|
+
|
|
458
|
+
const route = resolvedRoute.get(agent.id);
|
|
459
|
+
if (route === void 0) return decision;
|
|
460
|
+
// Defensive: only the loop's live Agent exposes an inbox. A test double
|
|
461
|
+
// or a future agent shape without one must not break the step.
|
|
462
|
+
if (agent.inbox === void 0 || !Array.isArray(agent.inbox.nextStep)) return decision;
|
|
463
|
+
|
|
464
|
+
// Reuse the pending message when the route is unchanged; replace it when
|
|
465
|
+
// the route moved (failover / config change). Without the remove step a
|
|
466
|
+
// stale line would linger alongside the fresh one.
|
|
467
|
+
const pending = agent.inbox.nextStep.filter(isRouteContextMessage);
|
|
468
|
+
const wanted = routeContextText(route.provider, route.model);
|
|
469
|
+
const existing = pending.find((message) => message.content?.[0]?.text === wanted);
|
|
470
|
+
for (const message of pending) {
|
|
471
|
+
if (message !== existing) agent.inbox.remove(message.id);
|
|
472
|
+
}
|
|
473
|
+
if (existing !== void 0) return decision;
|
|
474
|
+
|
|
475
|
+
const message = createUserMessage({
|
|
476
|
+
content: [{ type: "text", text: wanted }],
|
|
477
|
+
source: { kind: ROUTE_CONTEXT_SOURCE, form: ROUTE_CONTEXT_FORM }
|
|
478
|
+
});
|
|
479
|
+
agent.inbox.prepend("next-step", message);
|
|
480
|
+
return decision;
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
const disposeDisposed = ctx.on("agent/disposed", ({ agent }) => {
|
|
484
|
+
resolvedRoute.delete(agent.id);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
ctx.effect(() => () => {
|
|
488
|
+
disposeRequest();
|
|
489
|
+
disposePreStep();
|
|
490
|
+
disposeDisposed();
|
|
491
|
+
resolvedRoute.clear();
|
|
492
|
+
}, "dsh-subagent-default-model: route context injector");
|
|
493
|
+
}
|
|
494
|
+
|
|
359
495
|
function installSubagentWrapper(ctx, state) {
|
|
360
496
|
// `ctx.subagents` is a per-call Cordis traceable proxy, so reach the raw
|
|
361
497
|
// service object behind it for a stable handle and to install own methods.
|
|
@@ -413,6 +549,7 @@ export function apply(ctx, config) {
|
|
|
413
549
|
models: unwrap(raw.models),
|
|
414
550
|
strategy: unwrap(raw.strategy),
|
|
415
551
|
failoverEnabled: unwrap(raw.failoverEnabled),
|
|
552
|
+
injectRouteContext: unwrap(raw.injectRouteContext),
|
|
416
553
|
// Read back too: the single-model form stores its effort here, so
|
|
417
554
|
// dropping the key silently ignored the configured effort.
|
|
418
555
|
reasoningEffort: unwrap(raw.reasoningEffort)
|
|
@@ -430,6 +567,10 @@ export function apply(ctx, config) {
|
|
|
430
567
|
// section is absent/disabled or when the failing agent is the main loop.
|
|
431
568
|
installFailover(ctx, state);
|
|
432
569
|
|
|
570
|
+
// Tell each subagent which route it is actually running on. Same gate as
|
|
571
|
+
// failover (origin === "subagent"), so the main agent's context is untouched.
|
|
572
|
+
installRouteContextInjector(ctx, state);
|
|
573
|
+
|
|
433
574
|
// Attach the method wrapper only while the service exists. Cordis re-runs
|
|
434
575
|
// this child fiber if the provider is replaced, while settings stay served.
|
|
435
576
|
ctx.inject(["subagents"], (subagentCtx) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-subagent-default-model",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "为 DeepSeek Harness
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "为 DeepSeek Harness 子代理配置默认模型:多模型顺序/随机分配、跨供应商连接失败故障转移,并在轨迹/对话视图显示当前供应商与模型,同时以一行真实提示词把当前路由注入子代理上下文。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
7
7
|
"dsh",
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
"subagent",
|
|
10
10
|
"agent",
|
|
11
11
|
"model-routing",
|
|
12
|
-
"round-robin"
|
|
12
|
+
"round-robin",
|
|
13
|
+
"failover",
|
|
14
|
+
"provider-failover",
|
|
15
|
+
"route-visibility",
|
|
16
|
+
"prompt-injection"
|
|
13
17
|
],
|
|
14
18
|
"author": "dingminhua",
|
|
15
19
|
"license": "MIT",
|
|
@@ -70,6 +74,7 @@
|
|
|
70
74
|
"peerDependencies": {
|
|
71
75
|
"@deepseek-ai/dsh-settings": ">=0.1.7-rc.1 <0.3.0-0",
|
|
72
76
|
"@deepseek-ai/dsh-subagent": ">=0.1.7-rc.1 <0.3.0-0",
|
|
77
|
+
"@deepseek-ai/dsh-llm": ">=0.1.7-rc.1 <0.3.0-0",
|
|
73
78
|
"@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.3.0-0",
|
|
74
79
|
"@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.3.0-0",
|
|
75
80
|
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.3.0-0",
|