dsh-model-switch 0.4.66 → 0.4.68
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 +24 -0
- package/README.en.md +243 -0
- package/README.md +108 -116
- package/cordis.patch.yml +3 -6
- package/docs/screenshots/composer-picker.png +0 -0
- package/docs/screenshots/plan-review.png +0 -0
- package/docs/screenshots/settings-subagent.png +0 -0
- package/lib/client.js +153 -289
- package/lib/index.js +5 -0
- package/lib/subagent-runtime-BgLqMl2z.js +424 -0
- package/lib/subagent-runtime-CluWLZio.js +412 -0
- package/lib/subagent-runtime.js +2 -289
- package/lib/types/client/ModelSwitchSettings.d.ts +0 -2
- package/lib/types/client/locales.d.ts +0 -10
- package/lib/types/client-contract.d.ts +0 -9
- package/lib/types/review-timeout.d.ts +4 -0
- package/lib/types/subagent-runtime.d.ts +34 -0
- package/package.json +2 -2
- package/README.zh.md +0 -247
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## v0.4.68
|
|
2
|
+
|
|
3
|
+
`list_subagent_models` 现在同时报出「未点名 spawn 的实际默认路由」(按用户 2026-11-19 要求)。
|
|
4
|
+
|
|
5
|
+
- **动机**:官方发现工具只列「显式点名」的授权路由(数据来自会话投影 `subagent/model-selection-policy`,无 policy 时回落父路由),按设计不含本插件在 Subagent 运行时注入的未命名路由(供应商组 pin → 固定卡片 → 官方继承)——排查时曾因此误判「无识图子代理路由可用」。
|
|
6
|
+
- **实现(`src/subagent-runtime.ts`,挂在 `model-switch-subagent-runtime` 行)**:在 `ctx.tools` 注册表上挂钩 `register` 本身——任何注册路径(宿主行,以及每个会话的 preset 层:Web 面按 agent preset 组装该工具,作用域层会 shadow 全局注册,扫描全局视图够不着)把 definition 存入层之前,发现 `list_subagent_models` 即原地包装其 `execute`:官方文本输出尾部追加一行 `Default route for spawns that name no provider/model (Model Switch, <provider group pin|fixed card>): <provider/model>[, effort <e>]`,无固定时明确写 official inherit。非字符串结果原样放行;包装幂等(符号标记)、行卸载时恢复官方 execute;另保留全局视图的迟到扫描与 `tools/change` 重挂。路由解析复用 `sessionSubagentRouteOf`(与委派注入同源同优先级)。
|
|
7
|
+
- **状态面**:capabilities RPC 的 `status` 新增 `subagentDiscoveryHint{installed, toolWrapped}`(与 automode / prime-memory / reviewTimeout 的适配器状态同构)。
|
|
8
|
+
- **测试**:`tests/subagent-runtime.spec.ts` 新增 10 条(footer 纯函数四种形态、安装追加、卸载恢复、重挂、非字符串放行、无注册表静默);`tests/subagent-discovery.integration.spec.ts` 新增 4 条真实 cordis + 真实 `ToolsService` 组合测试(根注册、行加载后注册、兄弟插件上下文注册、卸载恢复)。
|
|
9
|
+
- **验证(virtual / 零真实额度)**:DSH `0.2.2-rc.5` lab(`D:\dsh-artifacts\rc2-diff`,端口 3084/4719)+ 0.4.68 构建:`model-switch-subagent-runtime` 行 active;lab 临时启用 `tool-subagent` 行使工具注册(`provider: subagent-spawn-in-process` + `modelDiscovery: true`,运行后还原)。无头 UI 回合中模型(探针回放)调用 `list_subagent_models`,**回传给模型的工具结果**(探针 `--capture-last` 逐字捕获)为:`apigoto — apigoto\nDefault route for spawns that name no provider/model (Model Switch, provider group pin): apigoto/mimo-v2.6-flash, effort high`——授权清单与实际默认路由(组 pin + effort)并列,与 lab patch 的 apigoto 组配置一致。`status.subagentDiscoveryHint = {installed:true, toolWrapped:true}`。证据:`D:\dsh-artifacts\rc2-diff\report-hint-0468-2026-11-19T15-43-28-382Z.json`、`probe-hint-2026-11-19T15-43-28-382Z.jsonl`。
|
|
10
|
+
- 探针 `tools/route-probe.mjs` 新增 `--capture-last` 开关(记录每条 chat 请求末条消息的截断文本,默认关闭),本轮为取证引入,保留为 lab 工具能力。
|
|
11
|
+
- 文档:README 的「正式版安装」段不再链接本仓库 Release 页不存在的 tarball / sha256 附件(该页从未带附件,旧链接一直是 404)——本插件安装统一指向 npm 注册表,固定版本用 `npm pack dsh-model-switch@<版本>` 取归档后本地安装;Release 链接只指向发布页并注明 npm provenance。
|
|
12
|
+
- `pnpm run check` 全绿(tsc + tsdown + 693 测试 + pack 闸门)。
|
|
13
|
+
|
|
14
|
+
## v0.4.67
|
|
15
|
+
|
|
16
|
+
冻结审查超时功能(按用户 2026-11-19 要求)+ README 重构(中文升主)。
|
|
17
|
+
|
|
18
|
+
- **审查超时已移除**。`cordis.patch.yml` 里 `model-switch-review-timeout` 的 insert 行已删除,运行时不再挂载;`src/review-timeout.ts` 标注 `@deprecated`,源码保留一个版本用于回退,下个大版本删除。设置页「审查豁免」区只剩纯读名单卡,Provider 的流式空闲超时回归上游默认(300 秒)。此前写入过 `streamIdleTimeoutMs` 的 profile 不会被自动清理,需要时可自行删除该行(桌面 profile 已只读勘察:`cordis.yml` / `cordis.patch.yml` / `package.json` 均无残留)。
|
|
19
|
+
- **客户端面清理**:设置页超时卡、`saveReviewTimeout` 保存通道与全部 `reviewTimeout*` 文案(中英各 10 键)已删除;`client-contract` 不再暴露 `autoReviewTimeoutMs` 视图字段与死常量(`AUTO_REVIEW_TIMEOUT_FIELD` / `UPSTREAM_DEFAULT_IDLE_TIMEOUT_MS`,全仓无引用)。**保留面**(对齐 0.4.59 automode 冻结先例):host 侧 `autoReviewTimeoutMs` 设置键留在 schema(冻结模块仍读,存量值惰性留存,回退即恢复生效);capabilities RPC 的 `status.reviewTimeout` 休眠保留(`applied` / `hotApplied` 恒空);`package.json` 的 `./review-timeout` 导出与 tsdown 构建入口保留;`tests/review-timeout.spec.ts` 的纯函数测试保留全绿。
|
|
20
|
+
- **README 重构**:中文版升为主 `README.md`,英文版移至 `README.en.md`(npm 包页面随包内 README.md 显示中文);`package.json` files 与 pack 闸门归档断言同步。过时内容修正(两份同步):设置页卡片枚举补记忆蒸馏 / 审查豁免 / 供应商配置组并注明审查超时卡 0.4.67 移除;简介能力清单补记忆蒸馏;验证版本清单补 0.2.2-rc.1–rc.5(英文版原先停在 0.2.0-rc.2);安装 / 发布段 `NOirBRight/dsh-model-switch` 链接全部改 `vandoor7-droid/dsh-model-switch`(第三方 providers-ui / codex / grok 链接保留)、版本示例统一 0.4.67、删除「复制本 README 的最小 YAML/JSON 示例」(README 无此示例)与 `journalctl --user -u dsh-web.service`(Linux 模板残留)、回滚指向 v0.4.66、「验证了 Main」措辞修正(Main 卡 0.4.23 已移除);automode 冻结段后并列补「审查超时(0.4.67 起移除)」段。
|
|
21
|
+
- **截图重制**(原三张全部过时:settings 截图仍展示 0.4.25 已移除的「Compact on switch」卡且缺审查豁免 / 记忆蒸馏 / 供应商配置组卡;plan-review 截图为官方卡形态按钮;composer-picker 停留在 v0.4.1 时代):lab 内无头重拍,中文界面——composer picker 弹层(模型 / 推理等级)、设置页内容列整高拼接图(内层滚动容器分段截取后按滚动偏移拼接,九张卡全可见)、本插件的计划审核卡(四动作按钮)。三张均经识图子代理逐项核对通过:预期元素齐全、无「审查超时 / 保存超时设置」字样、拼接无错位。
|
|
22
|
+
- **验证(virtual / 零真实额度)**:`D:\dsh-artifacts\rc2-diff` 的 DSH `0.2.2-rc.5` lab(端口 3084,探针 4719)+ 0.4.67 构建产物:217 行全部激活、无 incompatible / did-not-activate;**`model-switch-review-timeout` 不在 loader 行列**;我方六行(model-switch / subagent-runtime / auto-review / compaction / session-title / prime-memory-compat)全部 active;`tools` RPC 正常且 `status.reviewTimeout` 休眠;设置命名空间在位;无头 Edge + CDP 驱动实测:设置页渲染**无「审查超时」卡**且含审查豁免 / 记忆蒸馏模型 / 供应商配置组(DOM 断言 + 截图复核双重确认)、composer picker 弹层与计划审核卡(标题 / 四按钮 / 模型选择)正常驱动。探针记录:会话模型 `gpt-6.1-sol`(含 `exit_plan_mode` 工具回放)与标题模型 `mimo-v2.6-flash`。证据:`D:\dsh-artifacts\rc2-diff\report-freeze-0467-2026-11-19T14-21-15-749Z.json`、`probe-freeze-2026-11-19T14-21-15-749Z.jsonl`。
|
|
23
|
+
- `pnpm run check` 全绿(tsc + tsdown + 679 测试 + pack 闸门,归档含 README.en.md 断言)。
|
|
24
|
+
|
|
1
25
|
## v0.4.66
|
|
2
26
|
|
|
3
27
|
DSH `0.2.2-rc.5` 兼容声明 + 双线上游巡检(无代码变更;含 2026-11-17 的 prime-memory 0.26.61 巡检记录)。
|
package/README.en.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Model Switch
|
|
2
|
+
|
|
3
|
+
English | [中文](README.md)
|
|
4
|
+
|
|
5
|
+
Choose one explicit route for the active session, Subagents, Web Search, image generation, Plan execution, automatic session naming, and memory distillation in DeepSeek Harness. Model Switch uses public DSH services and provider-owned adapters; it does not patch DSH Core or manage provider credentials.
|
|
6
|
+
|
|
7
|
+
<p align="center"><img src="docs/screenshots/composer-picker.png" alt="Composer Picker with Model and Reasoning effort controls" width="304"></p>
|
|
8
|
+
|
|
9
|
+
The picker retains keyboard focus when changing panes or closing search, without overriding search autofocus. Escape from the summary closes the picker and returns focus to its trigger.
|
|
10
|
+
|
|
11
|
+
## Routes
|
|
12
|
+
|
|
13
|
+
| Route | Behavior |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| Session model | The active conversation's provider/model/effort, changed by the Composer Picker or Plan Review only. The deployment default (new sessions) is DSH's own; the picker never writes it. |
|
|
16
|
+
| Subagent | When a spawn names no provider, model, or effort: the delegating session's derived route — its provider group's subagent pair, else the fixed card's pair; with neither, official inherit (parent live request, then creation snapshot). A spawn that names a route is never overridden; workflow overrides remain authoritative. |
|
|
17
|
+
| Composer Picker | Changes only the active session and submits the exact catalog model id. |
|
|
18
|
+
| Plan Review | Chooses the execution model before the Plan approval response is sent. |
|
|
19
|
+
| Web Search | Keeps official `web_search`; after deployment opt-in, routes through the selected, dynamically declared provider search adapter. |
|
|
20
|
+
| Image generation | Provides one stable `generate_image` tool routed through a selected Codex or Grok adapter. |
|
|
21
|
+
|
|
22
|
+
Invalid, unavailable, or unsupported routes fail explicitly. Model Switch never silently falls back to another provider or model. Composer icons identify the execution runtime: DSH-owned LLM routes use the theme-adaptive DSH whale; providers declaring the Agent role use their own mark. Sidebar quota icons remain provider-specific.
|
|
23
|
+
|
|
24
|
+
Idle blank sessions may pick an External Agent. Submission, pending-first-turn, and running state reserve the selected execution runtime even before a token or native binding exists: native Antigravity keeps its model/effort choices; DSH keeps LLM-provider choices but disables Agent providers. After the first accepted user message, Composer and Plan Review keep Agent-role rows visible but disabled unless the session is already native-bound. After the active session successfully opens a native Antigravity session, the pickers read its plugin-owned binding and disable other providers while keeping available Antigravity model and effort controls. The DSH global picker lock remains authoritative. Binding reads refresh on mount, input-phase, request-activity or catalog changes, and before selection; failed reads show a localized alert and preserve a known native lock. These reads do not start the native runtime or gate conversation history. Antigravity owns the separate execution-time guard; Model Switch does not create custom Core history events.
|
|
25
|
+
|
|
26
|
+
The existing 3082 lab replay probe is `node scripts/check-lab-runtime-lock.mjs [native|runtime-absent|plugin-absent]`. It checks the dedicated QA conversation under the already-established condition; it does not disable plugins, select a model, or send a turn. `node scripts/check-lab-native-execution.mjs` verifies the saved guard rejection, restored native continuation, DeepSeek-parent/Antigravity-child completion, and restoration of temporary subagent preferences through public history streams.
|
|
27
|
+
|
|
28
|
+
## Configure Subagents and capability routes
|
|
29
|
+
|
|
30
|
+
Open **Settings → Model Switch**. The page hosts route cards for Subagent, Web search, Image generation, Auto review, Compaction, Session naming, and Memory distillation, plus the "Review bypass" (pure-read allowlist) and Provider groups cards. Subagents may follow the delegating session's derived route or a fixed provider, model, and effort. The "Review timeout" card was removed and frozen in 0.4.67 (see Compatibility).
|
|
31
|
+
|
|
32
|
+
Since 0.4.23 this plugin no longer configures or protects the deployment default ("Main model"). That default is DSH's own: the Host persists the last session switch as the default (including switches made through this plugin's picker or the TUI), exactly like native switching — so a new session starts on whatever was last used. To pin a fixed default, use DSH's own **Settings → Models** page. Official DSH makes ConfigForms memory-only in non-loopback browsers, so the Settings page shows an unavailable message there; open Settings on the Host loopback URL instead. As a side effect of the removal, model switching is never blocked by settings state (previously the picker waited for a writable Main ConfigForm).
|
|
33
|
+
|
|
34
|
+
Changing the fixed Subagent provider/model replaces the previous model's effort with the target model's default. Models without reasoning support receive no effort.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
Official inherit resolves the active parent request first, then the Host's own session default. A derived or fixed route is injected before the official Subagent descriptor is created, and only when the spawn names no provider, model, or effort — a caller that names a route is never overridden, and a provider whose capability is not `agentOptions` (for example a one-shot process adapter) is never reinterpreted as an Agent-capable route. DSH 0.1.2-alpha.4 carries provider, model, and fixed reasoning effort in that descriptor.
|
|
39
|
+
|
|
40
|
+
### Saving settings
|
|
41
|
+
|
|
42
|
+
Every row save is one atomic, revision-fenced mutation through the official ConfigForm `mutate`: a refused write either commits the whole row or nothing, so it can no longer leave a half-written provider/model pair. A draft you edited survives external snapshot updates (another tab's save, the capability poll); a revision conflict is reported with a reload path instead of silently losing either side; and a write that never settles is reported after 30 seconds rather than freezing the page on "Saving…". The ⚠ marker next to a value means exactly one thing: this value is not in the current provider catalog.
|
|
43
|
+
|
|
44
|
+
## How custom models appear in the Picker
|
|
45
|
+
|
|
46
|
+
Model Switch does not turn an arbitrary string in its own settings into a model. A provider plugin must publish the model to the official DSH model catalog first:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
Provider configuration
|
|
50
|
+
→ provider publishes model rows to the DSH catalog
|
|
51
|
+
→ the active session Model Directory exposes provider/model metadata
|
|
52
|
+
→ Model Switch groups those catalog rows
|
|
53
|
+
→ the Picker submits the original provider id and model id
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The catalog supplies the provider name, model id/name, reasoning efforts, and default effort. A saved route that is no longer present remains visible as unavailable in Settings; the Picker does not pretend it is routable.
|
|
57
|
+
|
|
58
|
+
### Variant id grammar
|
|
59
|
+
|
|
60
|
+
Model Switch groups catalog rows by provider and by the model id after peeling these suffixes:
|
|
61
|
+
|
|
62
|
+
| Catalog model id | Picker variant |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `acme-v1` | Standard row |
|
|
65
|
+
| `acme-v1-fast` | Fast |
|
|
66
|
+
| `acme-v1-128k` | Context 128K |
|
|
67
|
+
| `acme-v1-1m` | Context 1M |
|
|
68
|
+
| `acme-v1-1m-fast` | Context 1M + Fast |
|
|
69
|
+
|
|
70
|
+
Rules:
|
|
71
|
+
|
|
72
|
+
- `-fast` creates the Fast axis.
|
|
73
|
+
- `-<n>k` and `-<n>m` create Context tiers; suffixes may be combined with `-fast` in either order.
|
|
74
|
+
- `reasoning.efforts` creates the Effort choices; `reasoning.defaultEffort` selects the initial value.
|
|
75
|
+
- Switching Fast, Context, or Thinking variants keeps the current effort only when the target catalog row supports it; otherwise the target row's default effort (or no effort) is used.
|
|
76
|
+
- Reasoning metadata marks a catalog row as Thinking-capable.
|
|
77
|
+
- Unrecognized ids remain independent model families; Model Switch never drops them.
|
|
78
|
+
|
|
79
|
+
To support a combined selection, the provider must publish the combined row. Publishing only `acme-v1-fast` and `acme-v1-1m` cannot represent Fast + 1M; publish `acme-v1-1m-fast` as well. The Picker never synthesizes a model id that the provider did not publish.
|
|
80
|
+
|
|
81
|
+
## Plan Review
|
|
82
|
+
|
|
83
|
+
Plan Review owns an execution-model draft separate from the session's current route. **Confirm** first commits that model to the active session, then answers the pending Plan review. A refused commit leaves the review pending and retryable. **Reject** and **Discuss in chat** do not execute the Plan.
|
|
84
|
+
|
|
85
|
+
**Reject** sends the option the asker offered, and any text typed in the card's feedback field as the answer's own `custom` text — plan mode reports that text back to the model as the reason to keep planning, so a rejection can carry what to change. **Discuss in chat** withdraws the takeover so the composer returns and the human speaks in their own words; it uses the Host's `dismiss()` where published and the older generation's `cancel()` otherwise, and names the Host when neither exists. Answering a settled review closes Confirm and Reject, while Discuss and the reload affordance stay reachable so the card always has a way back. Failures keep their wire code (`session/writer-held: …`) visible instead of a bare localized sentence.
|
|
86
|
+
|
|
87
|
+
**Set as goal and run** arms this Plan as the session's goal and only then answers it, so `dsh-goal-round-driver` keeps the Plan moving after plan mode exits. It calls the released `remote.goals.create`; when a non-complete goal already exists it clears that one first so the new Plan starts with a fresh round cap, and says so in the card. A refusal keeps the review pending with its wire code (`GOAL_AGENT_NOT_LIVE: …`), and a deployment that mounts no goal service disables the button with an explicit reason while the other three actions keep working. The objective is the Plan's full markdown, trimmed — the goal domain imposes no length limit, and the objective rides along as model-visible context every round, so a long Plan costs tokens on each continuation.
|
|
88
|
+
|
|
89
|
+
The card body shows only the Plan's first-line title and first-paragraph summary; the **full plan** opens automatically in the right sidebar through official ui-plan (the header's "View full plan" reopens it any time). The takeover entry cannot render the official `conversation.plan-review.actions` slot (a child slot allows exactly one declarer), so the card drives ui-plan's registered opener instead — the preview document's address and params stay ui-plan's own construction (see `docs/seam-gap.md`).
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
## Auto review model
|
|
94
|
+
|
|
95
|
+
The official `@deepseek-ai/dsh-experimental-auto-review` (the per-call reviewer for the Auto permission preset) hardwires its review requests onto the session's own route. This plugin takes that row over through a `cordis.patch.yml` row replacement: the official row is disabled and `dsh-model-switch/auto-review` mounts the **same official `apply`** under a scoped child context whose `llm.stream` `provider/model` are rewritten to the reviewer route resolved for that session (provider group → flat card → session model). Session correlation rides a `{ prepend: true }` `tools/pre-execute` listener registered on the review scope immediately after `official.apply(scope)`, binding `exec.agent.session` in an `AsyncLocalStorage` scope around `next()` so parallel sessions on different providers never interfere and mid-session provider switches take effect on the very next review. The "Auto review model" card defaults to off = reviews follow the session model; turning it on pins the catalog head as an editable starting point, and saved changes apply to the very next review. When the optional auto-review bundle never started with the profile the row stays unmounted and the Auto preset keeps its official off state.
|
|
96
|
+
|
|
97
|
+
Since 0.4.31 the row also owns the seam at runtime, not just in the patch file. The plugin manager writes its component toggles into a layer that applies after every bundle layer, so a manual re-enable of the official「自动审查」component used to bring the official, unguarded gate back — and, because `permissionPresets.registerAuto` is single-registration, two live rows on that seam eventually killed every tool call. The row now takes the seam over the way the session-title slot is taken over: when the official row is about to apply it releases the Auto registration **synchronously first** (so the official row applies cleanly instead of colliding), disables the official row through the public `Entry.update`, and re-claims the registration with a bounded retry — preserving live sessions' Auto selection across the displacement. Toggling the official component back on is therefore a logged, self-healing no-op; the settings card's「自动审查」section says so too.
|
|
98
|
+
|
|
99
|
+
## Compaction model
|
|
100
|
+
|
|
101
|
+
Official compaction — `/compact` and DSH's automatic compaction — summarizes history with the conversation's target model by default. The "Compaction model" card (default off) pins that summarization route instead: turning it on pins the catalog head as an editable starting point, and saved changes apply to the very next compaction. Leaving both fields empty returns to the official default. Saving while a compaction is running may interrupt it; it retries next time.
|
|
102
|
+
|
|
103
|
+
Each summarization call (`options.purpose === 'compaction'`) also resolves its route per session through `compactionScope`: the session's provider group's compaction pair → the flat card pair → the official row's `modelPolicies` / conversation-target default. When a route applies, the child context's `llm` wrapper updates `options.provider` and `options.model` in place before `ctx.llm.stream(options)`, so `summarizeWithLlm` returns and durably records the exact provider/model that wrote the summary in `compaction/summary`. Exact-target `modelPolicies` on the profile's `compaction-basic` row config are still forwarded verbatim:
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
- id: compaction-basic
|
|
107
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
108
|
+
config:
|
|
109
|
+
modelPolicies:
|
|
110
|
+
- provider: deepseek
|
|
111
|
+
model: deepseek-chat
|
|
112
|
+
summarizationProvider: deepseek
|
|
113
|
+
summarizationModel: deepseek-reasoner
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
How the route reaches the engine depends on where the deployment runs its agent plane. The Web surface moves compaction into each agent preset's isolated `compaction` group, and profile patches cannot address rows inside a preset's `plugins` list — so the Host bridges that nested row at startup (`src/preset-sync.ts`): it disables the group's official `compaction-basic` and inserts `model-switch-compaction` directly after it, which mounts the **same official `BasicCompactionEngine`** under `compactionScope`. Every other preset row is left exactly as the installed DSH (or a deployment's own Web-editor save) wrote it; the plugin ships no preset copies, so a DSH preset change needs no re-sync and a deployment's preset edits are preserved. Surfaces that compose the agent process-wide (the TUI) use the top-level row replacement instead.
|
|
117
|
+
|
|
118
|
+
Known issue (upstream; recorded in `docs/seam-gap.md`): while the working set stays above the official engine's pressure threshold, automatic compaction can fire on every step and keep re-attempting ranges whose summaries fail the engine's own "summary must be smaller" guard — a visible loop of automatic compactions that this plugin does not control (verified in a session A/B with the plugin enabled and disabled). Mitigations on the forwarded row config: `auto: false` (keeps `/compact`), a higher `thresholdRatio`, a smaller mounted tool schema, or a pinned compaction model whose summaries are leaner.
|
|
119
|
+
|
|
120
|
+
## Session naming model
|
|
121
|
+
|
|
122
|
+
DSH names new sessions automatically; the profile's official naming row decides the cadence (right after the first prompt, or on every prompt). The "Session naming model" card picks the model those naming requests use. **Off — both fields empty — is the official behavior: naming follows the session's own model.** On pins a provider/model as an editable starting point.
|
|
123
|
+
|
|
124
|
+
The route is read through on every naming request: a saved change applies to the very next title with no restart, and a naming request already in flight is never interrupted by a save. Each request resolves its route in order — the session's provider group's naming pair, then the card's flat pair, then the session's own model. The request runs through the official naming implementation, which records the exact provider/model in the session's own `session/title-llm-request` event, so the durable record and the real request always agree. The plugin replaces the official `session-title-llm` row instead of forking the naming logic (the seam allows one registered naming provider per context) and mirrors the cadence that row declared; a profile with no official naming row keeps DSH's deterministic fallback title.
|
|
125
|
+
|
|
126
|
+
Since 0.4.29 the row also coexists with the experimental "titles that update with the conversation" bundle (`dsh-experimental-session-titles-bundle`, which inserts an all-prompts naming row): enabling that bundle keeps this plugin owning the single naming-provider slot, mirrors the all-prompts cadence so titles refresh with every prompt, and keeps the naming-model and provider-group routes in force (the provider id recorded per title is `session-title-all-prompts-llm`, exactly what the official row would record). Disabling the bundle restores the first-prompt cadence with the same route override. The takeover only uses released loader seams — the `loader/patch-context` waterfall, `Entry.update`, and `sessionTitle.register` plus its disposer — letting the official row register successfully first and then disabling it, so enabling the bundle no longer raises the `already registered` activation-failure toast.
|
|
127
|
+
|
|
128
|
+
Since 0.4.30 the Auto review row also survives a degraded permission service. DSH's Auto gate reads `permissionPresets.current(session)` before every tool call, and when that service has gone inactive the read throws `cannot get required service "sessionProjections" in inactive context` outside the gate's own reviewer-error handling — so every tool call died before its body ran. The row shadows that service inside its review scope: a failed probe reports "not on Auto", the tool call runs normally, and one log line states that review was skipped. Since 0.4.31 the shadow is **always on** and resolves the service lazily per call (so it protects even while the service is still activating), and its one degradation line carries the exact fiber chain (`uid/state/name/inject` per fiber) that failed resolution — because the upstream cause is a loader lifecycle window: `internal/get` walks the whole caller fiber chain and twenty-four released rows declare `sessionProjections`, so any one of them mid-reload can break an unguarded probe (recorded in `docs/seam-gap.md` with the upstream proposal). The Auto registration itself is brokered — handed over and reclaimed around displacements without unmounting the gate, since unmounting is what flips live `auto` sessions to `danger-full-access` — and a gate re-mounted after a profile reload unloads its previous registration first, so the `auto` preset cannot disappear from the permission picker.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Provider groups
|
|
132
|
+
|
|
133
|
+
The "Provider groups" card stores one route group per provider — the compaction, auto-review, session-naming, and subagent routes saved together — and a group saved for provider X applies to the sessions whose own provider is X. Groups are **derived, not written**: switching a session's provider writes nothing, so two sessions on different providers can never overwrite or redirect each other's auxiliary routes.
|
|
134
|
+
|
|
135
|
+
Every request derives its own route from durable state: the session's provider (its model selection — a just-made pending selection counts — else its latest logged request route), then the group pair for that provider, then the flat deployment-wide pair, then the official default (the conversation target for compaction; the session's own model for auto review and naming; official inherit for subagents, where the fixed card applies only in `fixed` mode). Because nothing is written, this works for sessions this browser never opened and for switches made from the TUI or another client, with no watcher and no residual boundary; a session with no observable provider simply resolves to the deployment default. Mid-session provider switches take effect on the very next compaction, review, title, or subagent call. In the editor, a provider's draft seeds from the currently active routes the first time you configure it, each row's off state means "no pin — fall through to the card, then the official default", and **Delete group** removes the provider's entry entirely (clearing the stored field when the last group goes).
|
|
136
|
+
|
|
137
|
+
## What Model Switch does not change
|
|
138
|
+
|
|
139
|
+
- `web_fetch` and its configured provider
|
|
140
|
+
- Vision routing, `read_image`, and ordinary chat attachments
|
|
141
|
+
- Provider login, credentials, or provider settings cards
|
|
142
|
+
- Official Agent Presets
|
|
143
|
+
- Existing provider-specific image tools
|
|
144
|
+
- The deployment default model (DSH persists the last session switch itself, same as native TUI switching)
|
|
145
|
+
- Global compaction policy, naming cadence (only the naming model is configurable), or DSH Core
|
|
146
|
+
|
|
147
|
+
## Installation
|
|
148
|
+
|
|
149
|
+
Model Switch ships prebuilt code, so an install needs no build authorization. Install it from the npm registry:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
dsh plugin --profile web add --force dsh-model-switch
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
A packed tarball installs the same build without a registry:
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
dsh plugin --profile web add --force ./dsh-model-switch-0.4.67.tgz
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Then install only the provider adapters you use. This release was checked against official DeepSeek Harness `0.1.7-rc.2` and verified on `0.2.0-rc.2` through `0.2.2-rc.5` (0.2.1-rc.2/rc.3 and 0.2.2-rc.1/rc.2/rc.3/rc.5; rc lines ship on the `next` dist-tag):
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
dsh plugin --profile web add --force \
|
|
165
|
+
https://github.com/NOirBRight/dsh-llm-providers-ui/releases/latest/download/dsh-llm-providers-ui-0.2.14.tgz
|
|
166
|
+
dsh plugin --profile web add --force \
|
|
167
|
+
https://github.com/NOirBRight/dsh-llm-codex/releases/latest/download/dsh-llm-codex-0.3.23.tgz
|
|
168
|
+
dsh plugin --profile web add --force \
|
|
169
|
+
https://github.com/NOirBRight/dsh-llm-grok/releases/latest/download/dsh-llm-grok-0.3.19.tgz
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Search routing (0.4.7)
|
|
173
|
+
|
|
174
|
+
Providers declare independent search adapters and model metadata on the existing Host `ModelSwitchAdapterRegistry`. The browser receives only id/name/model metadata over authenticated Connection RPC, not adapters or credentials. Registration/unload updates subscribers; in-place catalog changes are picked up by the bounded 20-second heartbeat. `ProviderDirectory` remains the client role/usage owner, not a second Host execution registry. Published 0.2.8 `sortCatalogGroups` only ranks hardcoded LLM routes; Model Switch ranks live `catalogRoutes` itself so Agent catalog ids follow saved card order when the Owner publishes them. Native `catalogId` / `unknown` account styling still need a newer Owner than published 0.2.8.
|
|
175
|
+
|
|
176
|
+
DeepSeek uses the official public `DeepSeekSearchProvider`, the existing `web-search-deepseek` settings and credential service. Codex uses its existing ChatGPT credentials; Grok uses its existing subscription token and provider-owned Responses search. Native conversational networking alone does not create a search option. Missing credentials, invalid settings, unsupported models and unavailable adapters fail explicitly, without fallback.
|
|
177
|
+
|
|
178
|
+
**Registering an adapter does not select the global Web route.** Installation leaves the deployment's existing Web configuration untouched. To opt in, set the existing Web entry's `searchProvider` to `model-switch` while retaining **every other existing config field**, especially `fetchProvider`. DSH id-targeted patches replace the entire config rather than deep-merging it: copy the complete effective config from `dsh --profile web --dump-config`, then change only searchProvider in the deployment/user patch. Do not copy an assumed `fetchProvider: http` over a custom pin.
|
|
179
|
+
|
|
180
|
+
After opting in, configure the requested search provider/model in Model Switch Settings. No complete supported route means `WEB_PROVIDER_CONFIGURED_UNAVAILABLE` through the official selector; there is no automatic DeepSeek fallback. Without the global pin, the dropdown does not control `web_search`. An unpinned Web service can become ambiguous when multiple search providers are usable. Before uninstalling Model Switch, restore the deployment's prior search pin; otherwise the official selector correctly reports a missing configured provider. The official `web_search` and `web_fetch` tools are never replaced.
|
|
181
|
+
|
|
182
|
+
Release-aligned search regression: `DSH_RELEASE_ANCHOR=/path/to/official/install/package.json pnpm exec vitest run --config tests/vitest.release.config.ts`. See [search audit and acceptance](docs/search-provider-audit.md) for exact baselines, dependencies and live status.
|
|
183
|
+
|
|
184
|
+
If `dsh-composer-picker` is installed, remove it from the profile before enabling Model Switch. Model Switch already owns the Composer Picker and Plan Review seat; two owners produce duplicate or competing UI.
|
|
185
|
+
|
|
186
|
+
Production profiles must use a released registry version or GitHub tag rather than workspace-local dependencies. Restart the selected DSH profile after installation or route changes. **Restart once after installing, updating, enabling or disabling this plugin**: it owns Host rows and takes the official Auto-review row over at runtime (`permissionPresets.registerAuto` is a single registration slot); when a hot enable skips the restart, the official row may still be serving, so the takeover only shields the reviewer path — tools keep running, that call's review is skipped with one log line — and the seam converges on the next start.
|
|
187
|
+
|
|
188
|
+
## Compatibility
|
|
189
|
+
|
|
190
|
+
DSH Host peers and development dependencies accept `>=0.1.7-alpha.2`, including rc.1 and later releases. The development lockfile resolves to rc.2. Cordis accepts `>=4.0.4 <5.0.0`.
|
|
191
|
+
|
|
192
|
+
Verified releases: `0.1.7-alpha.2`, `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.2`, `0.2.1-rc.2`, `0.2.1-rc.3`, `0.2.2-rc.1`, `0.2.2-rc.2`, `0.2.2-rc.3`, `0.2.2-rc.5`. The 0.2.0 claim covers the Host's renamed question verbs, its unawaited `session.selectModel` default write, and its returned `ModelDirectory.select` refusal, each verified in the lab and on a live desktop session. The 0.2.1 claim covers the replaced session-title seam and the Auto gate's `workingDirectory` read (0.4.28); the 0.2.2 claim covers the flattened `SubagentActivationSpec` of rc.2, carried by the dual-shape compat of 0.4.64 — rc.4 was never published separately, its changes were verified with rc.5 (see CHANGELOG 0.4.63–0.4.66).
|
|
193
|
+
|
|
194
|
+
DSH compatibility is declared as an open-ended floor (`dsh.compatibility.dshRuntime: ">=0.2.0-rc.2"`): every runtime at or above it mounts without an unverified warning, a `blocklist` still wins, and loading stays fail-open. The releases in `package.json#dsh.compatibility.dshReleases` are evidence, not an allowlist. Review public API changes and test new Host releases before adding a verification claim.
|
|
195
|
+
|
|
196
|
+
**Third-party auto modes (dropped in 0.4.59).** This plugin used to inject its Auto-review route and pure-read list into the in-memory config of [`@log.li/dsh-automode`](https://github.com/log-li/dsh-automode). That adapter is frozen and removed from `cordis.patch.yml`; the source is marked `@deprecated` and will be deleted next major. Disabling or uninstalling that plugin is expected, and no `auto-mode` preset should be written in the profile. The `auto` preset comes from `@deepseek-ai/dsh-experimental-auto-review`, not from this plugin.
|
|
197
|
+
|
|
198
|
+
**Review timeout (removed in 0.4.67).** This plugin used to write the auto-reviewer's stream idle timeout into the reviewer provider's `streamIdleTimeoutMs`. That adapter is frozen and removed from `cordis.patch.yml`; the source is marked `@deprecated` and will be deleted next major. The settings card is gone and the provider idle timeout returns to the upstream default (300 s); a profile that carries a previously written key keeps it until the line is removed by hand.
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
Requires Node 22.19+ and pnpm.
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
pnpm install
|
|
206
|
+
pnpm run check
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`check` builds Host and Client artifacts, runs unit and Cordis/Settings composition tests, validates the extracted package, and verifies reproducible bundles. Product scope is defined in [PRODUCT.md](PRODUCT.md); implementation constraints live in [IMPLEMENTATION_PLAN.md](IMPLEMENTATION_PLAN.md).
|
|
210
|
+
|
|
211
|
+
## Release installation (Latest)
|
|
212
|
+
|
|
213
|
+
Explicit model routing for Subagents, Composer, Plan Review, and capability tools, checked on official DeepSeek Harness `0.1.7-rc.2` through `0.2.2-rc.5`. The release artifact contains built Host/Client files, not sibling source or local paths.
|
|
214
|
+
|
|
215
|
+
This plugin installs from the npm registry (this repository's releases carry no attachments, so an install never depends on release assets); to pin a version, fetch the archive with `npm pack dsh-model-switch@<version>` and install the local tarball as shown above:
|
|
216
|
+
|
|
217
|
+
~~~sh
|
|
218
|
+
dsh plugin --profile web add --force dsh-model-switch
|
|
219
|
+
~~~
|
|
220
|
+
|
|
221
|
+
Provider adapters install from their own releases:
|
|
222
|
+
|
|
223
|
+
~~~sh
|
|
224
|
+
dsh plugin --profile web add --force \
|
|
225
|
+
https://github.com/NOirBRight/dsh-llm-providers-ui/releases/latest/download/dsh-llm-providers-ui-0.2.14.tgz
|
|
226
|
+
~~~
|
|
227
|
+
|
|
228
|
+
Update, uninstall, and verify:
|
|
229
|
+
|
|
230
|
+
~~~sh
|
|
231
|
+
# Update to the latest release
|
|
232
|
+
dsh plugin --profile web add --force dsh-model-switch
|
|
233
|
+
# Verify the loaded version
|
|
234
|
+
dsh plugin --profile web list
|
|
235
|
+
# Uninstall only this plugin
|
|
236
|
+
dsh plugin --profile web remove dsh-model-switch
|
|
237
|
+
~~~
|
|
238
|
+
|
|
239
|
+
Configuration: use the plugin section in Settings for Web UI plugins, or the profile dsh.profile.bundles entry for Host-only plugins.
|
|
240
|
+
|
|
241
|
+
Rollback: reinstall the previous release (`npm pack dsh-model-switch@0.4.66`, then the local tarball) and restore the recorded profile; no Host downgrade is required. Inspect the DSH Host logs; never link a checkout into production.
|
|
242
|
+
|
|
243
|
+
Release record: [v0.4.67](https://github.com/vandoor7-droid/dsh-model-switch/releases/tag/v0.4.67) (the npm package carries a signed build-provenance statement).
|