dsh-auto-model-routing 0.3.0 → 0.4.1
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 +15 -0
- package/README.md +82 -24
- package/README.zh.md +82 -24
- package/docs/architecture-v2.en.json +26 -0
- package/docs/architecture-v2.en.svg +637 -0
- package/docs/architecture-v2.zh.json +281 -0
- package/docs/architecture-v2.zh.svg +637 -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/lib/client/control.d.ts +9 -1
- package/lib/client/control.js +16 -1
- package/lib/client/index.d.ts +2 -0
- package/lib/client/index.js +2 -2
- package/lib/client/label.d.ts +4 -0
- package/lib/client/label.js +24 -8
- package/lib/client/settings-section.js +53 -3
- package/lib/client/settings-ui.d.ts +1 -1
- package/lib/client/strategy-details.d.ts +4 -0
- package/lib/client/strategy-details.js +8 -0
- package/lib/client.js +332 -47
- package/lib/decision-service.d.ts +39 -0
- package/lib/decision-service.js +28 -0
- package/lib/endpoints.d.ts +2 -1
- package/lib/endpoints.js +22 -1
- package/lib/feedback.d.ts +95 -0
- package/lib/feedback.js +67 -0
- package/lib/hints.js +1 -1
- package/lib/index.js +29 -7
- package/lib/jev.d.ts +27 -1
- package/lib/jev.js +51 -23
- 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/settings-contract.d.ts +4 -1
- package/lib/settings-contract.js +1 -1
- package/lib/settings-host.d.ts +2 -2
- package/lib/settings-host.js +26 -14
- package/lib/settings.js +14 -1
- package/lib/subagent-tool.js +32 -5
- package/lib/usage-report.d.ts +59 -0
- package/lib/usage-report.js +332 -0
- package/package.json +3 -3
- package/skills/auto-model-routing-report/SKILL.md +50 -0
- package/skills/subagent-model-routing/SKILL.md +15 -0
- package/lib/selection-projection.d.ts +0 -8
- package/lib/selection-projection.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- Add the on-demand `auto-model-routing-report` skill and read-only `lib/usage-report.js`: joins policy-v2 decisions to actual per-call usage by message ID, grouped by version × model × depth, with coverage gaps, sample thresholds and fixed caveats. Observational only; never writes, spawns or uses the network, and never prints message text, paths or session IDs.
|
|
6
|
+
|
|
7
|
+
## 0.4.0
|
|
8
|
+
|
|
9
|
+
- 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.
|
|
10
|
+
- Add TypeSafe, Concentrate and custom System One decision services with separate credentials, preset model menus and explicit public-sample connection testing.
|
|
11
|
+
- Expose executable strategy details, candidate distributions, normalized Choice certainty and actual application status; no task-quality or savings claims.
|
|
12
|
+
- Restore per-reply allocation feedback with immutable evaluation snapshots, request-event correlation, timestamped change/cancel events and legacy-record compatibility.
|
|
13
|
+
- Refresh bilingual user documentation; label earlier GIFs as legacy mock-host demonstrations. Fork and real-provider teammate acceptance remain unsupported/unverified as documented.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
- 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.
|
|
17
|
+
|
|
3
18
|
## 0.3.0
|
|
4
19
|
|
|
5
20
|
- Publish as a standalone DSH bundle with the companion `subagent-model-routing` skill included.
|
package/README.md
CHANGED
|
@@ -2,12 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
English · [简体中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+
|
|
7
|
+
*Interaction recording from the earlier four-tier UI (isolated mock Host); current decisions use independent capability and depth as described below.*
|
|
8
|
+
|
|
9
|
+
[Repository](https://github.com/prgrmrwy/dsh-auto-model-routing) · [Releases](https://github.com/prgrmrwy/dsh-auto-model-routing/releases) · [npm](https://www.npmjs.com/package/dsh-auto-model-routing)
|
|
6
10
|
|
|
7
11
|
<!-- problem -->
|
|
8
|
-
|
|
12
|
+
**Add AUTO mode to DSH: automatic effort for the main agent, automatic model + effort for sub-agents.** Stop adjusting reasoning investment every turn or choosing a model for every delegated task.
|
|
13
|
+
|
|
14
|
+
- **Main agent: keep your selected model and adjust reasoning effort per user turn.**
|
|
15
|
+
- **Sub-agents: judge capability needs and reasoning investment independently, then select model + effort.** A stronger model does not automatically mean deeper reasoning.
|
|
16
|
+
- **Visible decisions, local feedback:** inspect candidate distributions and actual application status, then rate the allocation below a reply.
|
|
17
|
+
|
|
18
|
+
### Which DSH scenarios does AUTO cover?
|
|
19
|
+
|
|
20
|
+
| Scenario | AUTO behavior | Current boundary |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Main-agent user turn | Judge effort for each new user turn; keep the main model | Not rejudged at every tool step; model must support the effort |
|
|
23
|
+
| Official fresh `subagent` | Select and bind child model + effort before its first request | Real Magpie Claude/GPT ordinary child calls verified; catalog and allowlist apply |
|
|
24
|
+
| Official fresh `spawn_teammate` | Bind the new teammate's model + effort using the same policy | Mock-host coverage; real-provider teammate acceptance remains unverified |
|
|
25
|
+
| Resume or continue a bound child | Replay its initial allocation without rejudging | Requires the plugin enabled and intact route records |
|
|
26
|
+
| Explicit model / effort | Preserve the specified dimension; judge only the other | Both specified: validate without calling Jev |
|
|
27
|
+
| Fork, third-party or unbound creation paths | No automatic-allocation guarantee | Fork and unbound AUTO child paths are explicitly rejected, not silently replaced |
|
|
28
|
+
|
|
29
|
+
This describes official integration paths—not acceptance of every DSH entry point, CLI/TUI interface or third-party plugin. The Web UI is the currently verified interface. MANUAL makes no new judgments. `route_subagent` is a preview, not a required step before dispatch.
|
|
9
30
|
|
|
10
|
-
|
|
31
|
+
### Local feedback → future learning and adjustment
|
|
32
|
+
|
|
33
|
+
**Available now:** rate a decision-bound reply as appropriate, too high, too low or unknown; change or clear the rating. Feedback and decision snapshots stay on your machine. Submitting feedback does not upload it to the decision service or immediately change routing; AUTO task judgments themselves still use your selected external service.
|
|
34
|
+
|
|
35
|
+
**Planned direction:** add learning, evaluation and policy adjustment based on local feedback and execution outcomes, so AUTO can better fit your tasks. **Automatic learning and feedback-driven tuning are not implemented yet.** Today's records support later evaluation; they are not evidence of measured quality gains or cost savings.
|
|
36
|
+
|
|
37
|
+
**Install.** Tested with DSH `0.2.0-rc.2`, Web UI, Node.js `>=22.19`.
|
|
11
38
|
|
|
12
39
|
```sh
|
|
13
40
|
dsh plugin --profile web add dsh-auto-model-routing
|
|
@@ -15,40 +42,65 @@ dsh plugin --profile web add dsh-auto-model-routing
|
|
|
15
42
|
dsh plugin --profile web add prgrmrwy/dsh-auto-model-routing
|
|
16
43
|
```
|
|
17
44
|
|
|
18
|
-
Restart DSH
|
|
19
|
-
|
|
20
|
-
In [ohmydsh](https://github.com/prgrmrwy/ohmydsh), enable only the local `auto-model-routing` entry and run `dsh build`; no separate skill customization is needed.
|
|
45
|
+
Restart DSH and refresh the Web page. In **Settings → Auto model routing**, choose a decision service, save its API key, and use **Test connection** with a fixed public sample. These are English descriptions of the controls; the plugin's interface labels are currently in Chinese. New chats default to **MANUAL**; click the chip to use AUTO. The companion delegation skill is included—no separate skill installation is needed.
|
|
21
46
|
|
|
22
47
|
## Use
|
|
23
48
|
|
|
24
49
|
| Where | What you do |
|
|
25
50
|
|---|---|
|
|
26
|
-
| **AUTO / MANUAL chip
|
|
27
|
-
| **Decision hint** |
|
|
28
|
-
| **Gauge button**
|
|
29
|
-
| **Settings →
|
|
51
|
+
| **AUTO / MANUAL chip**, left of the model picker | Click to switch. Hover for the decision, candidate distribution, certainty, model/effort and application status. |
|
|
52
|
+
| **Decision hint** | Shows new decisions briefly; its Settings switch does not hide the hover panel. |
|
|
53
|
+
| **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. |
|
|
54
|
+
| **Settings → Auto model routing** | Choose service/model, manage its separate key, test the connection, set defaults/cap/deadline, or expand **View decision strategy** to inspect the actual rubric and model slots. |
|
|
55
|
+
|
|
56
|
+
### Main model stays fixed; children are selected separately
|
|
30
57
|
|
|
31
|
-
|
|
58
|
+
- **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.
|
|
59
|
+
- **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.
|
|
60
|
+
- **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.
|
|
61
|
+
- **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.
|
|
62
|
+
- **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.
|
|
32
63
|
|
|
33
|
-
|
|
64
|
+
### Choose the decision service
|
|
34
65
|
|
|
35
|
-
|
|
66
|
+
| Service | Endpoint | Default model | Credential reference |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| OpenRouter (default, preserves existing installations) | `https://openrouter.ai/api/alpha/decisions` | `typesafe/jev-1.13` | `OPENROUTER_API_KEY` |
|
|
69
|
+
| TypeSafe | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `TYPESAFE_API_KEY` |
|
|
70
|
+
| Concentrate | `https://api.concentrate.ai/v1/systemone` | `jev-1.13.0` | `CONCENTRATE_API_KEY` |
|
|
71
|
+
| Custom System One | Your full endpoint | Editable | `AUTO_DECISION_CUSTOM_API_KEY` |
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
**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.
|
|
36
76
|
|
|
37
77
|
## Good to know
|
|
38
78
|
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
79
|
+
- **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.
|
|
80
|
+
- **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.
|
|
81
|
+
- **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.
|
|
82
|
+
- **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.
|
|
83
|
+
- **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).
|
|
84
|
+
- **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.
|
|
85
|
+
- **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.
|
|
45
86
|
|
|
46
87
|
## Architecture
|
|
47
88
|
<!-- section: architecture -->
|
|
48
89
|
|
|
49
|
-

|
|
91
|
+
|
|
92
|
+
Main failures disable AUTO; child failures stop dispatch. Explicit model/effort constraints are preserved. The diagram shows the AUTO paths; MANUAL makes no new judgments and fork is unsupported. Feedback does not automatically alter routing.
|
|
93
|
+
|
|
94
|
+
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).
|
|
95
|
+
|
|
96
|
+
<details>
|
|
97
|
+
<summary>Earlier four-tier UI demos (legacy rollback only)</summary>
|
|
98
|
+
|
|
99
|
+
These isolated-host recordings use mock Jev/model responses and show the previous UI, not the current default policy.
|
|
50
100
|
|
|
51
|
-
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
</details>
|
|
52
104
|
|
|
53
105
|
## Development
|
|
54
106
|
|
|
@@ -58,11 +110,17 @@ npm run typecheck
|
|
|
58
110
|
npm run build
|
|
59
111
|
```
|
|
60
112
|
|
|
61
|
-
Tests use the
|
|
113
|
+
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**. To observe AUTO decisions and their actual token usage, ask the agent to use the `auto-model-routing-report` skill (on demand only; it runs the read-only `lib/usage-report.js`). It is observational, not a savings measurement. Evaluation schema and deduplication rules are in [feedback-evaluation.md](docs/feedback-evaluation.md).
|
|
114
|
+
|
|
115
|
+
Development stays in the source monorepo; this repository is its release mirror. The package builds and loads independently using its declared dependencies, bundled skill and official DSH services; no monorepo checkout or monorepo instruction file is required. External design references are optional background, not runtime inputs.
|
|
62
116
|
|
|
63
|
-
|
|
117
|
+
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.
|
|
64
118
|
|
|
65
119
|
## Removal
|
|
66
120
|
<!-- section: removal -->
|
|
67
121
|
|
|
68
|
-
|
|
122
|
+
```sh
|
|
123
|
+
dsh plugin --profile web remove dsh-auto-model-routing
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
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
CHANGED
|
@@ -2,12 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) · 简体中文
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+
|
|
7
|
+
*此交互录屏来自早期四档界面(隔离 mock 宿主);当前策略按下文独立判断能力与投入。*
|
|
8
|
+
|
|
9
|
+
[插件仓库](https://github.com/prgrmrwy/dsh-auto-model-routing) · [版本发布](https://github.com/prgrmrwy/dsh-auto-model-routing/releases) · [npm](https://www.npmjs.com/package/dsh-auto-model-routing)
|
|
6
10
|
|
|
7
11
|
<!-- problem -->
|
|
8
|
-
|
|
12
|
+
**为 DSH 增加 AUTO 模式:主 Agent 自动调 effort,子 Agent 自动选 model + effort。** 不必每轮手动选择推理投入,也不必为每个子任务手动挑模型。
|
|
13
|
+
|
|
14
|
+
- **主 Agent:保留你选择的模型,按回合调整推理投入(effort)。**
|
|
15
|
+
- **子 Agent:按任务独立判断能力需求与推理投入,选择模型与 effort。** 不是把“更强模型”和“更深推理”捆成一个档位。
|
|
16
|
+
- **看得见、能反馈:** 展示决策分布与实际生效状态,在回复下方提交本机分配反馈。
|
|
17
|
+
|
|
18
|
+
### AUTO 覆盖哪些 DSH 场景?
|
|
19
|
+
|
|
20
|
+
| 场景 | AUTO 的作用 | 当前边界 |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| 主 Agent 用户回合 | 每个新用户回合判断 effort,主模型不换 | 不逐工具步骤重判;模型必须支持相应 effort |
|
|
23
|
+
| 官方 fresh `subagent` | 首次请求前选择并绑定子 model + effort | 真实 Magpie Claude/GPT 普通子调用已验证;受目录和允许列表约束 |
|
|
24
|
+
| 官方 fresh `spawn_teammate` | 按同一策略绑定新 teammate 的 model + effort | 已有 mock 宿主覆盖,尚未完成真实模型 teammate 验收 |
|
|
25
|
+
| 已绑定子实例恢复或继续执行 | 重用初始路线,不重新分配 | 依赖插件保持启用及路由记录完整 |
|
|
26
|
+
| 显式指定 model / effort | 保留已指定维度,仅判断未指定维度 | 两者都指定则只校验,不调用 Jev |
|
|
27
|
+
| fork、第三方或未绑定创建路径 | 不承诺自动选配 | fork 与未绑定 AUTO 子路径会明确拒绝,不静默替代 |
|
|
28
|
+
|
|
29
|
+
这里是官方接入路径的覆盖说明,不代表所有 DSH 入口、CLI/TUI 界面或第三方插件都已验收。Web UI 是当前验证入口;MANUAL 不做新判断。`route_subagent` 仅预览,不是必须先调用的派发步骤。
|
|
9
30
|
|
|
10
|
-
|
|
31
|
+
### 本机反馈 → 未来的学习调整
|
|
32
|
+
|
|
33
|
+
**现在:** 在已绑定决策的回复下评价“合适 / 投入偏高 / 投入不足 / 无法判断”,可修改、撤销。反馈与决策快照保存在本机,不会因点击反馈而上传到决策服务,也不会立即改变路由;AUTO 任务判断本身仍按所选服务外发。
|
|
34
|
+
|
|
35
|
+
**未来方向:** 增加基于本机反馈与执行结果的学习、评估和策略调整,让 AUTO 更贴合你的任务。**尚未实现自动学习或反馈驱动调参**,目前记录用于后续评估,不承诺已证明的质量提升或成本节省。
|
|
36
|
+
|
|
37
|
+
**安装**:已验证 DSH `0.2.0-rc.2`、Web UI,Node.js `>=22.19`。
|
|
11
38
|
|
|
12
39
|
```sh
|
|
13
40
|
dsh plugin --profile web add dsh-auto-model-routing
|
|
@@ -15,40 +42,65 @@ dsh plugin --profile web add dsh-auto-model-routing
|
|
|
15
42
|
dsh plugin --profile web add prgrmrwy/dsh-auto-model-routing
|
|
16
43
|
```
|
|
17
44
|
|
|
18
|
-
重启 DSH
|
|
19
|
-
|
|
20
|
-
在 [ohmydsh](https://github.com/prgrmrwy/ohmydsh) 中只需启用 local `auto-model-routing` 条目并运行 `dsh build`,不再单独启用 skill 条目。
|
|
45
|
+
重启 DSH 并刷新页面,到**设置 → 自动模型路由**选择决策服务、保存对应 API key,点击**测试连接**发送固定公开样例。新会话缺省 **MANUAL**,点击芯片切换 AUTO。配套委派 skill 已包含,无需单独安装。
|
|
21
46
|
|
|
22
47
|
## 使用
|
|
23
48
|
|
|
24
49
|
| 位置 | 操作 |
|
|
25
50
|
|---|---|
|
|
26
|
-
| **AUTO / MANUAL 芯片**(模型选择器左侧) |
|
|
27
|
-
| **判档提示** |
|
|
28
|
-
| 回复下方的**仪表按钮** |
|
|
29
|
-
| **设置 → 自动模型路由** |
|
|
51
|
+
| **AUTO / MANUAL 芯片**(模型选择器左侧) | 点击切换;悬停查看判断、候选分布、确定度、模型与投入、生效状态 |
|
|
52
|
+
| **判档提示** | 短暂显示新决策;关闭设置中的提示开关不会隐藏悬浮面板 |
|
|
53
|
+
| 回复下方的**仪表按钮** | 评价分配合适、投入偏高、投入不足或无法判断,支持修改和撤销;仅对绑定已应用主决策的回复显示 |
|
|
54
|
+
| **设置 → 自动模型路由** | 选择服务与模型、管理独立 key、测试连接、设置模式/强度上限/等待时间;展开**查看决策策略**查看实际判据与模型槽 |
|
|
55
|
+
|
|
56
|
+
### 主模型不换,子任务独立选配
|
|
30
57
|
|
|
31
|
-
|
|
58
|
+
- **主会话**:`lower / baseline / higher` 相对于具体模型已验证的推荐起点,在受支持序列降低一档、保持或提高一档。缺省上限 `xhigh`,自动不选 `max`;不修改主 provider/model,也不改写全局模型默认值。
|
|
59
|
+
- **fresh 子任务**:能力需求为 `bounded / analytical / frontier`,推理投入独立判断。Claude 能力槽为 Haiku / Sonnet / Opus 5.5;GPT 为 Luna / Sol / Sol。实际路由必须同时满足当前目录、支持的 effort 和官方子智能体允许列表。Magpie 保留真实 provider 与家族前缀完整模型 ID,不回退到本地入口。
|
|
60
|
+
- **尊重显式选择**:只指定模型或投入时,仅判断另一维;两者都指定则不请求 Jev,只校验路由。缺少任务目标或范围时停止委派,不猜。
|
|
61
|
+
- **官方创建绑定路由**:fresh `subagent` 和 fresh `spawn_teammate` 在子任务首次请求前绑定精确身份。`route_subagent` 只是可选预览,不代表已应用,也不能把推荐复制成用户约束。fork 和未绑定创建路径暂不支持,不静默替换。
|
|
62
|
+
- **恢复保持初始路线**:根会话改为 MANUAL 后停止新判断,已有绑定子实例维持原路线。`applied` 只证明实际请求配置匹配,**不代表任务成功**。真实 Magpie Claude/GPT ordinary 调用已验证;fresh teammate 路由及冷恢复有 mock 宿主覆盖,不等于真实模型 teammate 已验收。
|
|
32
63
|
|
|
33
|
-
|
|
64
|
+
### 选择决策服务
|
|
34
65
|
|
|
35
|
-
|
|
66
|
+
| 服务 | 接口 | 缺省模型 | 凭据引用 |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| OpenRouter(默认,兼容已有安装) | `https://openrouter.ai/api/alpha/decisions` | `typesafe/jev-1.13` | `OPENROUTER_API_KEY` |
|
|
69
|
+
| TypeSafe 官方 | `https://api.typesafe.ai/v1/systemone` | `jev-1.13.0` | `TYPESAFE_API_KEY` |
|
|
70
|
+
| Concentrate | `https://api.concentrate.ai/v1/systemone` | `jev-1.13.0` | `CONCENTRATE_API_KEY` |
|
|
71
|
+
| 自定义 System One | 完整接口地址 | 可编辑 | `AUTO_DECISION_CUSTOM_API_KEY` |
|
|
72
|
+
|
|
73
|
+
预置模型菜单列出文档确认的版本,不保证实时可用。自定义服务可填写自己的模型 ID,但必须兼容 `state + questions → answers`;只有 OpenAI chat-completions 接口并不兼容。自定义端点限 HTTPS(回环可 HTTP),禁止 URL 凭据、查询参数、片段及重定向。只配置你信任且适合使用该专用 key 的地址。TypeSafe、Concentrate 目前有协议/mock 覆盖,未在本次验证其真实凭据与地区可用性。失败不自动切换服务。
|
|
74
|
+
|
|
75
|
+
**判定确定度不等于选中概率**:Choice 公式为 `(pmax − 1/n) / (1 − 1/n)`,三个候选中最高概率 70% 对应确定度 55%。面板分别显示服务返回的确定度和完整分布,保留返回的 0%,缺值标未提供。两者都不是任务成功率。
|
|
36
76
|
|
|
37
77
|
## 须知
|
|
38
78
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
79
|
+
- **失败可见**:主判断失败会停用 AUTO 并显示原因,子判断或路由失败则停止派发。没有本地分类器、自动重试、自动升级或跨服务降级。
|
|
80
|
+
- **MANUAL 停止调整,不复原历史值**:使用官方当前选择;只要插件启用,已绑定子任务仍保留原路线。
|
|
81
|
+
- **任务会外发**:AUTO 将按形态脱敏的任务文本(最多 8000 字符)及上一轮少量片段发送给所选服务。脱敏尽力而为,不保证去除全部秘密。测试连接只发送固定公开样例,可能产生少量费用。
|
|
82
|
+
- **key 经官方 DSH 凭据服务保存**,不写入插件配置。启动环境 key 优先且只读;切换服务清空 key 草稿,先保存服务再管理新 key。修改自定义端点不会产生新凭据空间,换地址前请确认专用 key 的信任边界。
|
|
83
|
+
- **本地状态**:配置在 `$DSH_HOME/plugins/dsh-auto-model-routing/`,模式、子路由及反馈在 `$DSH_HOME/state/auto-model-routing/`。反馈只保存资源元数据、身份、版本、返回分布及时间,不保存任务或回复正文。请求事件序号供后续关联用量,缺失成本不会编造。见[反馈评估说明](docs/feedback-evaluation.md)。
|
|
84
|
+
- **不自动学习**:人工反馈仅作观察,不改变路由,也不能直接证明质量提升或节省。无决策绑定的旧消息不回填,旧记录缺少的评估字段保持未知。
|
|
85
|
+
- **升级兼容**:已有 AUTO 会话直接使用新策略,无需版本开关,也不重写会话模式。新会话缺省仍为 MANUAL,除非你改过设置。旧四档映射仅供配置中显式 `policy: "legacy"` 回滚,不是当前策略或反馈菜单。
|
|
45
86
|
|
|
46
87
|
## 架构
|
|
47
88
|
<!-- section: architecture -->
|
|
48
89
|
|
|
49
|
-

|
|
91
|
+
|
|
92
|
+
主判断失败停用 AUTO,子失败停止派发;保留显式 model/effort。图示为 AUTO 路径,MANUAL 不做新判断,fork 暂不支持。反馈不会自动改变路由。
|
|
93
|
+
|
|
94
|
+
入口:[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)。
|
|
95
|
+
|
|
96
|
+
<details>
|
|
97
|
+
<summary>旧四档界面演示(仅供 legacy 回滚参考)</summary>
|
|
98
|
+
|
|
99
|
+
下列隔离宿主录屏使用模拟 Jev/模型响应,展示旧界面,不代表当前默认策略。
|
|
50
100
|
|
|
51
|
-
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
</details>
|
|
52
104
|
|
|
53
105
|
## 开发验证
|
|
54
106
|
|
|
@@ -58,11 +110,17 @@ npm run typecheck
|
|
|
58
110
|
npm run build
|
|
59
111
|
```
|
|
60
112
|
|
|
61
|
-
|
|
113
|
+
测试使用官方 AgentLoop、假 LLM 流和 mock/回环 Jev,不产生真实模型费用。`scripts/label-report.mjs` **仅汇总旧四档标注**。如需观察 AUTO 决策及实际 token 用量,请明确让 agent 使用 `auto-model-routing-report` skill(仅按需调用,运行只读的 `lib/usage-report.js`);它是观察统计,不衡量节省;新数据结构与去重口径见[feedback-evaluation.md](docs/feedback-evaluation.md)。
|
|
114
|
+
|
|
115
|
+
继续在主仓开发,本仓库仅作发布镜像。插件使用自身声明的依赖、包内 skill 和官方 DSH 服务即可独立构建与加载,不要求检出主仓,也不要求安装主仓环境指令。外部设计链接仅供背景阅读,不是运行输入。
|
|
62
116
|
|
|
63
|
-
|
|
117
|
+
[当前规范](https://github.com/prgrmrwy/ohmydsh/blob/main/openspec/specs/auto-model-routing/spec.md)在源码 monorepo 中维护。包内[委派 skill](skills/subagent-model-routing/SKILL.md)提供指引,执行保障来自官方宿主钩子,而不是提示词。暂无完整任务质量或 token 节省的量化结论。
|
|
64
118
|
|
|
65
119
|
## 移除
|
|
66
120
|
<!-- section: removal -->
|
|
67
121
|
|
|
68
|
-
|
|
122
|
+
```sh
|
|
123
|
+
dsh plugin --profile web remove dsh-auto-model-routing
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
重启 DSH 并刷新页面。插件的 skill、工具和请求钩子撤销,配置与日志保留。关闭插件后不再执行子路由恢复,宿主使用原始创建配置。在 [ohmydsh](https://github.com/prgrmrwy/ohmydsh) 中则禁用 local 条目并重新构建。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version":1,"diagram_type":"architecture",
|
|
3
|
+
"meta":{"title":"AUTO resource allocation","output":".archify/architecture-auto-routing-20261026-014646/auto-routing.html","locale":"en","quality_profile":"showcase","repository":{"url":"git@github.com:prgrmrwy/ohmydsh.git","revision":"79f9eab467047e054a2d66f8bce060834a261a2a","link_mode":"local-only"}},
|
|
4
|
+
"components":[
|
|
5
|
+
{"id":"turn","type":"frontend","label":"AUTO user turn","sublabel":"Main model stays fixed","pos":[40,80],"size":[190,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":68,"end_line":88}]},
|
|
6
|
+
{"id":"judge","type":"cloud","label":"Selected Jev service","sublabel":"Depth / capability independently","pos":[360,80],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/decision-service.ts","line":1,"end_line":23},{"path":"packages/auto-model-routing/src/policy-host.ts","line":81,"end_line":88}]},
|
|
7
|
+
{"id":"route","type":"backend","label":"Validated allocation","sublabel":"Catalog / allowlist / effort cap","pos":[710,80],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":122,"end_line":150}]},
|
|
8
|
+
{"id":"child","type":"backend","label":"Fresh child binding","sublabel":"Exact child identity; explicit wins","pos":[360,270],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":94,"end_line":132}]},
|
|
9
|
+
{"id":"request","type":"backend","label":"Official model request","sublabel":"Main effort / child full route","pos":[710,270],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":138,"end_line":160}]},
|
|
10
|
+
{"id":"persist","type":"database","label":"Persisted child route","sublabel":"Resume keeps initial allocation","pos":[40,270],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":132,"end_line":160}]},
|
|
11
|
+
{"id":"evidence","type":"backend","label":"Request match evidence","sublabel":"Applied only when config matches","pos":[710,460],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":178,"end_line":201}]},
|
|
12
|
+
{"id":"feedback","type":"frontend","label":"Decision and reply feedback","sublabel":"Observe allocation; never auto-train","pos":[360,460],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":162,"end_line":174}]},
|
|
13
|
+
{"id":"snapshot","type":"database","label":"Bound decision snapshot","sublabel":"Metadata / IDs; no task text","pos":[40,460],"size":[220,68],"sources":[{"path":"packages/auto-model-routing/src/policy-host.ts","line":167,"end_line":172}]}
|
|
14
|
+
],
|
|
15
|
+
"connections":[
|
|
16
|
+
{"id":"main-judge","from":"turn","to":"judge","label":"depth"},
|
|
17
|
+
{"id":"judge-route","from":"judge","to":"route","label":"decision"},
|
|
18
|
+
{"id":"child-judge","from":"child","to":"judge","label":"task","fromSide":"top","toSide":"bottom"},
|
|
19
|
+
{"id":"child-store","from":"child","to":"persist","label":"bind"},
|
|
20
|
+
{"id":"route-request","from":"route","to":"request","label":"apply"},
|
|
21
|
+
{"id":"request-match","from":"request","to":"evidence","label":"header"},
|
|
22
|
+
{"id":"match-feedback","from":"evidence","to":"feedback","label":"matched"},
|
|
23
|
+
{"id":"feedback-snapshot","from":"feedback","to":"snapshot","label":"bind reply"}
|
|
24
|
+
],
|
|
25
|
+
"cards":[{"dot":"cyan","title":"Decision services","items":["OpenRouter / TypeSafe / Concentrate / custom System One","No automatic service fallback or retry"]},{"dot":"amber","title":"Boundaries","items":["MANUAL: no new judgments; explicit constraints preserved","Fork unsupported; applied is not task success"]}]
|
|
26
|
+
}
|