dsh-auto-model-routing 0.4.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 +4 -0
- package/README.md +38 -11
- package/README.zh.md +36 -9
- 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 +1 -1
- package/docs/host-capability-report.md +9 -9
- package/docs/routing-intent-and-gaps.md +2 -2
- package/docs/routing-strategy-plan.md +1 -1
- package/lib/feedback.d.ts +26 -0
- package/lib/feedback.js +2 -0
- package/lib/usage-report.d.ts +59 -0
- package/lib/usage-report.js +332 -0
- package/package.json +1 -1
- package/skills/auto-model-routing-report/SKILL.md +50 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
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
|
+
|
|
3
7
|
## 0.4.0
|
|
4
8
|
|
|
5
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.
|
package/README.md
CHANGED
|
@@ -2,8 +2,37 @@
|
|
|
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)
|
|
10
|
+
|
|
5
11
|
<!-- problem -->
|
|
6
|
-
|
|
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.
|
|
30
|
+
|
|
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.
|
|
7
36
|
|
|
8
37
|
**Install.** Tested with DSH `0.2.0-rc.2`, Web UI, Node.js `>=22.19`.
|
|
9
38
|
|
|
@@ -13,7 +42,7 @@ dsh plugin --profile web add dsh-auto-model-routing
|
|
|
13
42
|
dsh plugin --profile web add prgrmrwy/dsh-auto-model-routing
|
|
14
43
|
```
|
|
15
44
|
|
|
16
|
-
Restart DSH and refresh the Web page. In **Settings →
|
|
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.
|
|
17
46
|
|
|
18
47
|
## Use
|
|
19
48
|
|
|
@@ -22,7 +51,7 @@ Restart DSH and refresh the Web page. In **Settings → 自动模型路由**, ch
|
|
|
22
51
|
| **AUTO / MANUAL chip**, left of the model picker | Click to switch. Hover for the decision, candidate distribution, certainty, model/effort and application status. |
|
|
23
52
|
| **Decision hint** | Shows new decisions briefly; its Settings switch does not hide the hover panel. |
|
|
24
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. |
|
|
25
|
-
| **Settings →
|
|
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. |
|
|
26
55
|
|
|
27
56
|
### Main model stays fixed; children are selected separately
|
|
28
57
|
|
|
@@ -58,12 +87,9 @@ Preset model menus expose documented versions, not live availability guarantees.
|
|
|
58
87
|
## Architecture
|
|
59
88
|
<!-- section: architecture -->
|
|
60
89
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
request/header → configuration match → applied evidence
|
|
65
|
-
assistant message → immutable decision snapshot → human feedback events
|
|
66
|
-
```
|
|
90
|
+

|
|
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.
|
|
67
93
|
|
|
68
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).
|
|
69
95
|
|
|
@@ -72,7 +98,6 @@ Entry: [index.ts](src/index.ts). Enforcement: [policy-host.ts](src/policy-host.t
|
|
|
72
98
|
|
|
73
99
|
These isolated-host recordings use mock Jev/model responses and show the previous UI, not the current default policy.
|
|
74
100
|
|
|
75
|
-

|
|
76
101
|

|
|
77
102
|
|
|
78
103
|
</details>
|
|
@@ -85,7 +110,9 @@ npm run typecheck
|
|
|
85
110
|
npm run build
|
|
86
111
|
```
|
|
87
112
|
|
|
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
|
|
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.
|
|
89
116
|
|
|
90
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.
|
|
91
118
|
|
package/README.zh.md
CHANGED
|
@@ -2,8 +2,37 @@
|
|
|
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)
|
|
10
|
+
|
|
5
11
|
<!-- problem -->
|
|
6
|
-
|
|
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` 仅预览,不是必须先调用的派发步骤。
|
|
30
|
+
|
|
31
|
+
### 本机反馈 → 未来的学习调整
|
|
32
|
+
|
|
33
|
+
**现在:** 在已绑定决策的回复下评价“合适 / 投入偏高 / 投入不足 / 无法判断”,可修改、撤销。反馈与决策快照保存在本机,不会因点击反馈而上传到决策服务,也不会立即改变路由;AUTO 任务判断本身仍按所选服务外发。
|
|
34
|
+
|
|
35
|
+
**未来方向:** 增加基于本机反馈与执行结果的学习、评估和策略调整,让 AUTO 更贴合你的任务。**尚未实现自动学习或反馈驱动调参**,目前记录用于后续评估,不承诺已证明的质量提升或成本节省。
|
|
7
36
|
|
|
8
37
|
**安装**:已验证 DSH `0.2.0-rc.2`、Web UI,Node.js `>=22.19`。
|
|
9
38
|
|
|
@@ -58,12 +87,9 @@ dsh plugin --profile web add prgrmrwy/dsh-auto-model-routing
|
|
|
58
87
|
## 架构
|
|
59
88
|
<!-- section: architecture -->
|
|
60
89
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
request/header → 配置匹配 → applied 证据
|
|
65
|
-
assistant 消息 → 不可变决策快照 → 人工反馈事件
|
|
66
|
-
```
|
|
90
|
+

|
|
91
|
+
|
|
92
|
+
主判断失败停用 AUTO,子失败停止派发;保留显式 model/effort。图示为 AUTO 路径,MANUAL 不做新判断,fork 暂不支持。反馈不会自动改变路由。
|
|
67
93
|
|
|
68
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)。
|
|
69
95
|
|
|
@@ -72,7 +98,6 @@ assistant 消息 → 不可变决策快照 → 人工反馈事件
|
|
|
72
98
|
|
|
73
99
|
下列隔离宿主录屏使用模拟 Jev/模型响应,展示旧界面,不代表当前默认策略。
|
|
74
100
|
|
|
75
|
-

|
|
76
101
|

|
|
77
102
|
|
|
78
103
|
</details>
|
|
@@ -85,7 +110,9 @@ npm run typecheck
|
|
|
85
110
|
npm run build
|
|
86
111
|
```
|
|
87
112
|
|
|
88
|
-
测试使用官方 AgentLoop、假 LLM 流和 mock/回环 Jev,不产生真实模型费用。`scripts/label-report.mjs`
|
|
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 服务即可独立构建与加载,不要求检出主仓,也不要求安装主仓环境指令。外部设计链接仅供背景阅读,不是运行输入。
|
|
89
116
|
|
|
90
117
|
[当前规范](https://github.com/prgrmrwy/ohmydsh/blob/main/openspec/specs/auto-model-routing/spec.md)在源码 monorepo 中维护。包内[委派 skill](skills/subagent-model-routing/SKILL.md)提供指引,执行保障来自官方宿主钩子,而不是提示词。暂无完整任务质量或 token 节省的量化结论。
|
|
91
118
|
|
|
@@ -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
|
+
}
|