dsh-auto-model-routing 0.0.0-stage → 0.4.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 +19 -0
- package/LICENSE +21 -0
- package/README.md +98 -2
- package/README.zh.md +99 -0
- package/cordis.patch.yml +9 -0
- package/docs/SCREENSHOTS.md +6 -0
- package/docs/architecture.dual.svg +853 -0
- package/docs/architecture.json +486 -0
- package/docs/auto-routing.gif +0 -0
- package/docs/feedback-evaluation.md +18 -0
- package/docs/host-capability-report.md +91 -0
- package/docs/jev-policy-v2-validation.md +37 -0
- package/docs/magpie-live-acceptance.md +27 -0
- package/docs/policy-v2-development.md +68 -0
- package/docs/policy-v2-real-evaluation-plan.md +32 -0
- package/docs/routing-community-research-2026-10-24.md +98 -0
- package/docs/routing-intent-and-gaps.md +56 -0
- package/docs/routing-strategy-plan.md +101 -0
- package/docs/settings.gif +0 -0
- package/lib/client/control.d.ts +42 -0
- package/lib/client/control.js +43 -0
- package/lib/client/index.d.ts +36 -0
- package/lib/client/index.js +150 -0
- package/lib/client/label.d.ts +49 -0
- package/lib/client/label.js +62 -0
- package/lib/client/nav-icon.d.ts +2 -0
- package/lib/client/nav-icon.js +23 -0
- package/lib/client/route-picker.d.ts +21 -0
- package/lib/client/route-picker.js +75 -0
- package/lib/client/settings-section.d.ts +24 -0
- package/lib/client/settings-section.js +199 -0
- package/lib/client/settings-ui.d.ts +3 -0
- package/lib/client/settings-ui.js +1 -0
- package/lib/client/strategy-details.d.ts +4 -0
- package/lib/client/strategy-details.js +8 -0
- package/lib/client.js +1301 -0
- package/lib/context.d.ts +25 -0
- package/lib/context.js +34 -0
- package/lib/decision-service.d.ts +39 -0
- package/lib/decision-service.js +28 -0
- package/lib/effort.d.ts +11 -0
- package/lib/effort.js +31 -0
- package/lib/endpoints.d.ts +12 -0
- package/lib/endpoints.js +62 -0
- package/lib/feedback.d.ts +69 -0
- package/lib/feedback.js +65 -0
- package/lib/hints.d.ts +3 -0
- package/lib/hints.js +12 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +171 -0
- package/lib/input.d.ts +13 -0
- package/lib/input.js +8 -0
- package/lib/jev.d.ts +75 -0
- package/lib/jev.js +166 -0
- package/lib/judgements.d.ts +41 -0
- package/lib/judgements.js +55 -0
- package/lib/policy-host.d.ts +68 -0
- package/lib/policy-host.js +274 -0
- package/lib/policy-store.d.ts +96 -0
- package/lib/policy-store.js +60 -0
- package/lib/policy-v2-rubric.json +21 -0
- package/lib/policy-v2.d.ts +20 -0
- package/lib/policy-v2.js +53 -0
- package/lib/router.d.ts +68 -0
- package/lib/router.js +153 -0
- package/lib/rubric.json +12 -0
- package/lib/settings-contract.d.ts +58 -0
- package/lib/settings-contract.js +3 -0
- package/lib/settings-host.d.ts +35 -0
- package/lib/settings-host.js +109 -0
- package/lib/settings-validation.d.ts +10 -0
- package/lib/settings-validation.js +56 -0
- package/lib/settings.d.ts +18 -0
- package/lib/settings.js +277 -0
- package/lib/state.d.ts +39 -0
- package/lib/state.js +69 -0
- package/lib/subagent-tool.d.ts +26 -0
- package/lib/subagent-tool.js +121 -0
- package/package.json +111 -4
- package/screenshots.json +4 -0
- package/scripts/label-report.mjs +50 -0
- package/skills/subagent-model-routing/SKILL.md +45 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
- Upgrade AUTO by default: keep the main model fixed, independently judge child capability and reasoning investment, and enforce exact fresh-child bindings with persisted replay. Preserve explicit legacy rollback and MANUAL behavior.
|
|
6
|
+
- Add TypeSafe, Concentrate and custom System One decision services with separate credentials, preset model menus and explicit public-sample connection testing.
|
|
7
|
+
- Expose executable strategy details, candidate distributions, normalized Choice certainty and actual application status; no task-quality or savings claims.
|
|
8
|
+
- Restore per-reply allocation feedback with immutable evaluation snapshots, request-event correlation, timestamped change/cancel events and legacy-record compatibility.
|
|
9
|
+
- Refresh bilingual user documentation; label earlier GIFs as legacy mock-host demonstrations. Fork and real-provider teammate acceptance remain unsupported/unverified as documented.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- Accept the DSH 0.2 host's React 18.3.1 as well as React 19 in the runtime peer declaration; client builds continue to use the host's shared React instance.
|
|
13
|
+
|
|
14
|
+
## 0.3.0
|
|
15
|
+
|
|
16
|
+
- Publish as a standalone DSH bundle with the companion `subagent-model-routing` skill included.
|
|
17
|
+
- Replace the separate ohmydsh skill customization with a package-owned filesystem skill provider. Skill and tools now enable/disable together.
|
|
18
|
+
- Add npm/Git installation instructions, demo GIFs, licensing and OIDC release automation.
|
|
19
|
+
- Keep the existing tier rubric, effort mappings, default MANUAL mode, credentials and stored state unchanged.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 prgrmrwy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,99 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-auto-model-routing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English · [简体中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
<!-- problem -->
|
|
6
|
+
Keep the main model you chose; let AUTO select reasoning investment for each turn and suitable resources for fresh sub-agents. Jev judges **capability and effort independently**. DSH applies the route, and the UI distinguishes a decision from a configuration that actually reached a request.
|
|
7
|
+
|
|
8
|
+
**Install.** Tested with DSH `0.2.0-rc.2`, Web UI, Node.js `>=22.19`.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
dsh plugin --profile web add dsh-auto-model-routing
|
|
12
|
+
# Or install source (approve the local build when prompted):
|
|
13
|
+
dsh plugin --profile web add prgrmrwy/dsh-auto-model-routing
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Restart DSH and refresh the Web page. In **Settings → 自动模型路由**, choose a decision service, save its API key, and use **测试连接** with a fixed public sample. New chats default to **MANUAL**; click the chip to use AUTO. The companion delegation skill is included—no separate skill installation is needed.
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
| Where | What you do |
|
|
21
|
+
|---|---|
|
|
22
|
+
| **AUTO / MANUAL chip**, left of the model picker | Click to switch. Hover for the decision, candidate distribution, certainty, model/effort and application status. |
|
|
23
|
+
| **Decision hint** | Shows new decisions briefly; its Settings switch does not hide the hover panel. |
|
|
24
|
+
| **Gauge button** below an eligible reply | Mark the allocation appropriate, too high, too low or unknown; change or clear your feedback later. Only replies bound to an applied main decision qualify. |
|
|
25
|
+
| **Settings → 自动模型路由** | Choose service/model, manage its separate key, test the connection, set defaults/cap/deadline, or expand **查看决策策略** to inspect the actual rubric and model slots. |
|
|
26
|
+
|
|
27
|
+
### Main model stays fixed; children are selected separately
|
|
28
|
+
|
|
29
|
+
- **Main chat:** `lower / baseline / higher` moves at most one supported effort step below/at/above the model's verified recommended starting point. The cap defaults to `xhigh`; AUTO never selects `max`. It does not change the main provider/model or write global model defaults.
|
|
30
|
+
- **Fresh children:** capability is `bounded / analytical / frontier`; effort is judged separately. Claude slots are Haiku / Sonnet / Opus 5.5; GPT slots are Luna / Sol / Sol. The current catalog, supported efforts and official child allowlist must all permit the route. Magpie uses its exact provider and full family-prefixed model IDs, not a fallback to local transports.
|
|
31
|
+
- **Explicit choices win:** specifying a model or effort leaves only the other dimension to judge. Specifying both skips Jev and validates the route. Missing task scope stops delegation rather than guessing.
|
|
32
|
+
- **Official creation binds the route:** fresh `subagent` and fresh `spawn_teammate` paths bind an exact child identity before its first request. `route_subagent` is an optional preview—not proof of application and not a user constraint to copy into a subsequent call. Fork and unbound creation paths are unsupported; there is no silent substitution.
|
|
33
|
+
- **Resume keeps the initial route.** Switching the root to MANUAL stops new judgments; already bound children retain their initial route. `applied` means the actual request configuration matched, **not** that the task succeeded. Real Magpie Claude/GPT ordinary calls were tested; fresh teammate routing and cold resume have mock-host coverage, not real-provider teammate acceptance.
|
|
34
|
+
|
|
35
|
+
### Choose the decision service
|
|
36
|
+
|
|
37
|
+
| Service | Endpoint | Default model | Credential reference |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| OpenRouter (default, preserves existing installations) | `https://openrouter.ai/api/alpha/decisions` | `typesafe/jev-1.13` | `OPENROUTER_API_KEY` |
|
|
40
|
+
| TypeSafe | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `TYPESAFE_API_KEY` |
|
|
41
|
+
| Concentrate | `https://api.concentrate.ai/v1/systemone` | `jev-1.13.0` | `CONCENTRATE_API_KEY` |
|
|
42
|
+
| Custom System One | Your full endpoint | Editable | `AUTO_DECISION_CUSTOM_API_KEY` |
|
|
43
|
+
|
|
44
|
+
Preset model menus expose documented versions, not live availability guarantees. Custom services keep an editable model ID and must support `state + questions → answers`; an OpenAI chat-completions endpoint alone is not compatible. Custom endpoints require HTTPS (loopback HTTP is allowed), reject URL credentials/query/fragment and redirects. Only configure endpoints you trust with the dedicated key. TypeSafe and Concentrate have contract/mock coverage; their live authentication and regional availability were not verified here. No service failover occurs automatically.
|
|
45
|
+
|
|
46
|
+
**Certainty is not the selected probability.** Choice certainty is `(pmax − 1/n) / (1 − 1/n)`: with three candidates, a 70% top probability gives 55% certainty. The panel shows the service's returned certainty and full candidate distribution separately, including returned zeroes; missing values are marked unavailable. Neither number is task success rate.
|
|
47
|
+
|
|
48
|
+
## Good to know
|
|
49
|
+
|
|
50
|
+
- **Failures are visible.** Main judgment failure disables AUTO with a reason; child judgment/route failure stops dispatch. No local classifier, automatic retry, upgrade or cross-service fallback.
|
|
51
|
+
- **MANUAL stops adjustments, not history.** It does not restore an earlier effort. The official current selection remains in control; existing bound children keep their route while the plugin is enabled.
|
|
52
|
+
- **Data leaves the machine.** AUTO sends shape-redacted task text (up to 8000 characters) and short previous-turn excerpts to your chosen service. Redaction is best effort, not a guarantee that all secrets are removed. Test Connection sends only a fixed public sample and can incur a small charge.
|
|
53
|
+
- **Keys use official DSH credentials**, never plugin configuration. Launch-environment keys take precedence and are read-only. Service changes clear key drafts; save the service before managing its separate key. Changing a custom endpoint does not create a new credential namespace—review the key before trusting a new host.
|
|
54
|
+
- **Local state:** configuration is under `$DSH_HOME/plugins/dsh-auto-model-routing/`; mode, child routes and feedback are under `$DSH_HOME/state/auto-model-routing/`. Feedback stores resource metadata, IDs, versions, returned distributions and timestamps—not task/reply text. Request event IDs allow later usage correlation; costs are not fabricated when unavailable. See [feedback and evaluation](docs/feedback-evaluation.md).
|
|
55
|
+
- **No automatic learning.** Human allocation feedback is observational. It does not change routing or prove quality/cost benefits. Old messages without decision bindings are not backfilled; old records with missing evaluation fields remain unknown.
|
|
56
|
+
- **Upgrade:** existing AUTO sessions use the new policy without a version switch or rewriting their stored mode. New chats still default to MANUAL unless configured otherwise. Historical four-tier mappings remain only for explicit `policy: "legacy"` rollback in plugin configuration; they are not the current policy or feedback menu.
|
|
57
|
+
|
|
58
|
+
## Architecture
|
|
59
|
+
<!-- section: architecture -->
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
user turn → pre-step → selected Jev service → depth → main request effort
|
|
63
|
+
fresh child creation → exact child binding → capability + depth → validated route
|
|
64
|
+
request/header → configuration match → applied evidence
|
|
65
|
+
assistant message → immutable decision snapshot → human feedback events
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Entry: [index.ts](src/index.ts). Enforcement: [policy-host.ts](src/policy-host.ts). Actual rubric: [policy-v2-rubric.json](src/policy-v2-rubric.json). Model slots: [policy-v2.ts](src/policy-v2.ts). UI: [client](src/client/index.ts). Coverage and limitations: [development verification](docs/policy-v2-development.md), [real Magpie acceptance](docs/magpie-live-acceptance.md).
|
|
69
|
+
|
|
70
|
+
<details>
|
|
71
|
+
<summary>Earlier four-tier UI demos (legacy rollback only)</summary>
|
|
72
|
+
|
|
73
|
+
These isolated-host recordings use mock Jev/model responses and show the previous UI, not the current default policy.
|
|
74
|
+
|
|
75
|
+

|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
</details>
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npm test
|
|
84
|
+
npm run typecheck
|
|
85
|
+
npm run build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Tests use the official AgentLoop with fake LLM streams and mock/loopback Jev responses, not paid model calls. `scripts/label-report.mjs` reports **legacy tier labels only**; it is not a report for new allocation feedback. Evaluation schema and deduplication rules are in [feedback-evaluation.md](docs/feedback-evaluation.md).
|
|
89
|
+
|
|
90
|
+
The [current specification](https://github.com/prgrmrwy/ohmydsh/blob/main/openspec/specs/auto-model-routing/spec.md) lives in the source monorepo. The bundled [delegation skill](skills/subagent-model-routing/SKILL.md) supplies guidance; enforcement belongs to the official host hooks, not the prompt. No measured task-quality or token-savings claim is made.
|
|
91
|
+
|
|
92
|
+
## Removal
|
|
93
|
+
<!-- section: removal -->
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
dsh plugin --profile web remove dsh-auto-model-routing
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Restart DSH and refresh the page. The plugin's skill/tools and request hooks disappear; settings and logs remain. Without the plugin, child replay is no longer enforced and host restoration uses the original creation configuration. In [ohmydsh](https://github.com/prgrmrwy/ohmydsh), disable the local entry and rebuild instead.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# dsh-auto-model-routing
|
|
2
|
+
|
|
3
|
+
[English](README.md) · 简体中文
|
|
4
|
+
|
|
5
|
+
<!-- problem -->
|
|
6
|
+
主模型由你选,AUTO 为每轮选择推理投入,并为 fresh 子任务选配资源。Jev **独立判断能力需求和投入**,DSH 验证并应用配置;界面区分“做出了判断”和“实际请求已生效”。
|
|
7
|
+
|
|
8
|
+
**安装**:已验证 DSH `0.2.0-rc.2`、Web UI,Node.js `>=22.19`。
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
dsh plugin --profile web add dsh-auto-model-routing
|
|
12
|
+
# 或从源码安装(出现提示时批准本地构建):
|
|
13
|
+
dsh plugin --profile web add prgrmrwy/dsh-auto-model-routing
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
重启 DSH 并刷新页面,到**设置 → 自动模型路由**选择决策服务、保存对应 API key,点击**测试连接**发送固定公开样例。新会话缺省 **MANUAL**,点击芯片切换 AUTO。配套委派 skill 已包含,无需单独安装。
|
|
17
|
+
|
|
18
|
+
## 使用
|
|
19
|
+
|
|
20
|
+
| 位置 | 操作 |
|
|
21
|
+
|---|---|
|
|
22
|
+
| **AUTO / MANUAL 芯片**(模型选择器左侧) | 点击切换;悬停查看判断、候选分布、确定度、模型与投入、生效状态 |
|
|
23
|
+
| **判档提示** | 短暂显示新决策;关闭设置中的提示开关不会隐藏悬浮面板 |
|
|
24
|
+
| 回复下方的**仪表按钮** | 评价分配合适、投入偏高、投入不足或无法判断,支持修改和撤销;仅对绑定已应用主决策的回复显示 |
|
|
25
|
+
| **设置 → 自动模型路由** | 选择服务与模型、管理独立 key、测试连接、设置模式/强度上限/等待时间;展开**查看决策策略**查看实际判据与模型槽 |
|
|
26
|
+
|
|
27
|
+
### 主模型不换,子任务独立选配
|
|
28
|
+
|
|
29
|
+
- **主会话**:`lower / baseline / higher` 相对于具体模型已验证的推荐起点,在受支持序列降低一档、保持或提高一档。缺省上限 `xhigh`,自动不选 `max`;不修改主 provider/model,也不改写全局模型默认值。
|
|
30
|
+
- **fresh 子任务**:能力需求为 `bounded / analytical / frontier`,推理投入独立判断。Claude 能力槽为 Haiku / Sonnet / Opus 5.5;GPT 为 Luna / Sol / Sol。实际路由必须同时满足当前目录、支持的 effort 和官方子智能体允许列表。Magpie 保留真实 provider 与家族前缀完整模型 ID,不回退到本地入口。
|
|
31
|
+
- **尊重显式选择**:只指定模型或投入时,仅判断另一维;两者都指定则不请求 Jev,只校验路由。缺少任务目标或范围时停止委派,不猜。
|
|
32
|
+
- **官方创建绑定路由**:fresh `subagent` 和 fresh `spawn_teammate` 在子任务首次请求前绑定精确身份。`route_subagent` 只是可选预览,不代表已应用,也不能把推荐复制成用户约束。fork 和未绑定创建路径暂不支持,不静默替换。
|
|
33
|
+
- **恢复保持初始路线**:根会话改为 MANUAL 后停止新判断,已有绑定子实例维持原路线。`applied` 只证明实际请求配置匹配,**不代表任务成功**。真实 Magpie Claude/GPT ordinary 调用已验证;fresh teammate 路由及冷恢复有 mock 宿主覆盖,不等于真实模型 teammate 已验收。
|
|
34
|
+
|
|
35
|
+
### 选择决策服务
|
|
36
|
+
|
|
37
|
+
| 服务 | 接口 | 缺省模型 | 凭据引用 |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| OpenRouter(默认,兼容已有安装) | `https://openrouter.ai/api/alpha/decisions` | `typesafe/jev-1.13` | `OPENROUTER_API_KEY` |
|
|
40
|
+
| TypeSafe 官方 | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `TYPESAFE_API_KEY` |
|
|
41
|
+
| Concentrate | `https://api.concentrate.ai/v1/systemone` | `jev-1.13.0` | `CONCENTRATE_API_KEY` |
|
|
42
|
+
| 自定义 System One | 完整接口地址 | 可编辑 | `AUTO_DECISION_CUSTOM_API_KEY` |
|
|
43
|
+
|
|
44
|
+
预置模型菜单列出文档确认的版本,不保证实时可用。自定义服务可填写自己的模型 ID,但必须兼容 `state + questions → answers`;只有 OpenAI chat-completions 接口并不兼容。自定义端点限 HTTPS(回环可 HTTP),禁止 URL 凭据、查询参数、片段及重定向。只配置你信任且适合使用该专用 key 的地址。TypeSafe、Concentrate 目前有协议/mock 覆盖,未在本次验证其真实凭据与地区可用性。失败不自动切换服务。
|
|
45
|
+
|
|
46
|
+
**判定确定度不等于选中概率**:Choice 公式为 `(pmax − 1/n) / (1 − 1/n)`,三个候选中最高概率 70% 对应确定度 55%。面板分别显示服务返回的确定度和完整分布,保留返回的 0%,缺值标未提供。两者都不是任务成功率。
|
|
47
|
+
|
|
48
|
+
## 须知
|
|
49
|
+
|
|
50
|
+
- **失败可见**:主判断失败会停用 AUTO 并显示原因,子判断或路由失败则停止派发。没有本地分类器、自动重试、自动升级或跨服务降级。
|
|
51
|
+
- **MANUAL 停止调整,不复原历史值**:使用官方当前选择;只要插件启用,已绑定子任务仍保留原路线。
|
|
52
|
+
- **任务会外发**:AUTO 将按形态脱敏的任务文本(最多 8000 字符)及上一轮少量片段发送给所选服务。脱敏尽力而为,不保证去除全部秘密。测试连接只发送固定公开样例,可能产生少量费用。
|
|
53
|
+
- **key 经官方 DSH 凭据服务保存**,不写入插件配置。启动环境 key 优先且只读;切换服务清空 key 草稿,先保存服务再管理新 key。修改自定义端点不会产生新凭据空间,换地址前请确认专用 key 的信任边界。
|
|
54
|
+
- **本地状态**:配置在 `$DSH_HOME/plugins/dsh-auto-model-routing/`,模式、子路由及反馈在 `$DSH_HOME/state/auto-model-routing/`。反馈只保存资源元数据、身份、版本、返回分布及时间,不保存任务或回复正文。请求事件序号供后续关联用量,缺失成本不会编造。见[反馈评估说明](docs/feedback-evaluation.md)。
|
|
55
|
+
- **不自动学习**:人工反馈仅作观察,不改变路由,也不能直接证明质量提升或节省。无决策绑定的旧消息不回填,旧记录缺少的评估字段保持未知。
|
|
56
|
+
- **升级兼容**:已有 AUTO 会话直接使用新策略,无需版本开关,也不重写会话模式。新会话缺省仍为 MANUAL,除非你改过设置。旧四档映射仅供配置中显式 `policy: "legacy"` 回滚,不是当前策略或反馈菜单。
|
|
57
|
+
|
|
58
|
+
## 架构
|
|
59
|
+
<!-- section: architecture -->
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
用户回合 → pre-step → 所选 Jev 服务 → depth → 主请求 effort
|
|
63
|
+
fresh 子创建 → 精确身份绑定 → capability + depth → 校验路由
|
|
64
|
+
request/header → 配置匹配 → applied 证据
|
|
65
|
+
assistant 消息 → 不可变决策快照 → 人工反馈事件
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
入口:[index.ts](src/index.ts)。执行接入:[policy-host.ts](src/policy-host.ts)。实际判据:[policy-v2-rubric.json](src/policy-v2-rubric.json)。模型槽:[policy-v2.ts](src/policy-v2.ts)。界面:[client](src/client/index.ts)。覆盖边界:[开发验证](docs/policy-v2-development.md)、[真实 Magpie 验收](docs/magpie-live-acceptance.md)。
|
|
69
|
+
|
|
70
|
+
<details>
|
|
71
|
+
<summary>旧四档界面演示(仅供 legacy 回滚参考)</summary>
|
|
72
|
+
|
|
73
|
+
下列隔离宿主录屏使用模拟 Jev/模型响应,展示旧界面,不代表当前默认策略。
|
|
74
|
+
|
|
75
|
+

|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
</details>
|
|
79
|
+
|
|
80
|
+
## 开发验证
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npm test
|
|
84
|
+
npm run typecheck
|
|
85
|
+
npm run build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
测试使用官方 AgentLoop、假 LLM 流和 mock/回环 Jev,不产生真实模型费用。`scripts/label-report.mjs` **仅汇总旧四档标注**,不是新分配反馈报表;新数据结构与去重口径见[feedback-evaluation.md](docs/feedback-evaluation.md)。
|
|
89
|
+
|
|
90
|
+
[当前规范](https://github.com/prgrmrwy/ohmydsh/blob/main/openspec/specs/auto-model-routing/spec.md)在源码 monorepo 中维护。包内[委派 skill](skills/subagent-model-routing/SKILL.md)提供指引,执行保障来自官方宿主钩子,而不是提示词。暂无完整任务质量或 token 节省的量化结论。
|
|
91
|
+
|
|
92
|
+
## 移除
|
|
93
|
+
<!-- section: removal -->
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
dsh plugin --profile web remove dsh-auto-model-routing
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
重启 DSH 并刷新页面。插件的 skill、工具和请求钩子撤销,配置与日志保留。关闭插件后不再执行子路由恢复,宿主使用原始创建配置。在 [ohmydsh](https://github.com/prgrmrwy/ohmydsh) 中则禁用 local 条目并重新构建。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
- insert:
|
|
2
|
+
- id: dsh-auto-model-routing
|
|
3
|
+
name: dsh-auto-model-routing
|
|
4
|
+
- id: auto-model-routing-skills
|
|
5
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
6
|
+
config:
|
|
7
|
+
providerName: auto-model-routing-plugin
|
|
8
|
+
includeDefaultRoots: false
|
|
9
|
+
bundledSkillDir: !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('dsh-auto-model-routing/package.json')), 'skills')
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Screenshots
|
|
2
|
+
|
|
3
|
+
| file | kind | source | date | reviewer | verdict | note |
|
|
4
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
5
|
+
| auto-routing.gif | screenshot | isolated DSH_HOME instance (temp HOME/XDG/DSH_HOME under /tmp, port 3199), synthetic data: local mock model and mock Jev on loopback, demo prompts; recorded with agent-browser, converted with ffmpeg | 2026-10-23 | lead | pass (viewed frames: demo prompts and mock replies only; no hostname, user, path, token or real session) | AUTO chip, decision hint, hover panel, switch to MANUAL |
|
|
6
|
+
| settings.gif | screenshot | same isolated instance and recording run as auto-routing.gif | 2026-10-23 | lead | pass (viewed frames: settings section only; key field empty, source shown as launch environment of the isolated process) | Settings → 自动模型路由, Claude/GPT routing maps |
|