dsh-autotier 0.1.1 → 0.2.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.
Files changed (59) hide show
  1. package/AGENTS.md +28 -5
  2. package/CHANGELOG.md +45 -0
  3. package/README.es.md +5 -6
  4. package/README.hi.md +5 -5
  5. package/README.md +5 -6
  6. package/README.pt.md +5 -6
  7. package/README.zh.md +4 -5
  8. package/THIRD_PARTY_NOTICES.md +31 -0
  9. package/docs/roadmap-v0.2.md +114 -0
  10. package/lib/client.js +5956 -0
  11. package/lib/client.js.map +1 -0
  12. package/lib/index.js +193 -58
  13. package/lib/typert.host.js +26 -0
  14. package/lib/types/client/TierPill.d.ts +24 -0
  15. package/lib/types/client/TierPill.d.ts.map +1 -0
  16. package/lib/types/client/TierSettingsCard.d.ts +31 -0
  17. package/lib/types/client/TierSettingsCard.d.ts.map +1 -0
  18. package/lib/types/client/index.d.ts +30 -0
  19. package/lib/types/client/index.d.ts.map +1 -0
  20. package/lib/types/client/locales.d.ts +60 -0
  21. package/lib/types/client/locales.d.ts.map +1 -0
  22. package/lib/types/client/present.d.ts +61 -0
  23. package/lib/types/client/present.d.ts.map +1 -0
  24. package/lib/types/client/remote.d.ts +313 -0
  25. package/lib/types/client/remote.d.ts.map +1 -0
  26. package/lib/types/client/styles.d.ts +12 -0
  27. package/lib/types/client/styles.d.ts.map +1 -0
  28. package/lib/types/command.d.ts.map +1 -1
  29. package/lib/types/index.d.ts +4 -0
  30. package/lib/types/index.d.ts.map +1 -1
  31. package/lib/types/policy.d.ts +4 -0
  32. package/lib/types/policy.d.ts.map +1 -1
  33. package/lib/types/routing.d.ts +1 -0
  34. package/lib/types/routing.d.ts.map +1 -1
  35. package/lib/types/selection.d.ts +50 -0
  36. package/lib/types/selection.d.ts.map +1 -0
  37. package/lib/types/tier-remote.d.ts +79 -0
  38. package/lib/types/tier-remote.d.ts.map +1 -0
  39. package/lib/types/typert.host.d.ts +300 -0
  40. package/lib/types/typert.host.d.ts.map +1 -0
  41. package/lib/types/wire.d.ts +804 -0
  42. package/lib/types/wire.d.ts.map +1 -0
  43. package/lib/wire-BpKSOHgo.js +5193 -0
  44. package/package.json +73 -22
  45. package/src/client/TierPill.tsx +83 -0
  46. package/src/client/TierSettingsCard.tsx +175 -0
  47. package/src/client/index.ts +146 -0
  48. package/src/client/locales.ts +107 -0
  49. package/src/client/present.ts +124 -0
  50. package/src/client/remote.ts +39 -0
  51. package/src/client/styles.ts +174 -0
  52. package/src/command.ts +1 -0
  53. package/src/index.ts +43 -0
  54. package/src/policy.ts +6 -0
  55. package/src/routing.ts +17 -0
  56. package/src/selection.ts +124 -0
  57. package/src/tier-remote.ts +139 -0
  58. package/src/typert.host.ts +25 -0
  59. package/src/wire.ts +248 -0
package/AGENTS.md CHANGED
@@ -21,9 +21,28 @@ records repo-local decisions.
21
21
  - `src/service.ts` — `ctx.autotier` (`status()` and the live settings scope).
22
22
  - `src/types.ts` — shared vocabulary (tier ids, effort ids, routing modes,
23
23
  scenarios, route/status shapes).
24
- - `tests/` — vitest over the REAL published `0.1.2-rc.1` host packages
24
+ - `src/wire.ts` — the `tier` Remote wire vocabulary: `TierStatus` (the public
25
+ `AutotierStatus` plus an additive `session` view), `TierCatalog`, their zod v4
26
+ codecs, and the three invocation descriptors shared verbatim by the host
27
+ manifest and the client contribution.
28
+ - `src/typert.host.ts` — the hand-written host Typert manifest exported as
29
+ `./typert`; the harness's typert-loader registers the `tier` invocations from
30
+ it when the plugin mounts.
31
+ - `src/tier-remote.ts` — `TierRemoteService` (`TypertRemoteService`, namespace
32
+ `tier`): `status(agentId?)` / `catalog()` / `setMode(mode, agentId?)`. The
33
+ override it writes is the same per-agent `RouteState.override` the router and
34
+ `/tier` read; `agents` is read optionally through the injected resolver.
35
+ - `src/client/` — browser half: `$mount`s the Remote contribution, registers the
36
+ composer pill into `conversation.input.left` (id `tier-pill`) and the Settings
37
+ card into `settings.plugins.tab` (id `autotier`), with a pure presenter
38
+ (`present.ts`), inline scoped stylesheet (`styles.ts`), and en/zh dictionaries
39
+ (`locales.ts`). The slot registry is read through a local structural
40
+ `SlotsFace` (its owning package differs across host lines).
41
+ - `tests/` — vitest over the REAL published `0.1.5-rc.1` host packages
25
42
  (`Context`, `SessionStore`, `SystemPrompt`, `ToolRuntime`, `CommandRuntime`,
26
- in-memory `SettingsProvider`) plus one real Loader composition.
43
+ in-memory `SettingsProvider`) plus one real Loader composition. The browser
44
+ half is covered through its pure units (wire codecs, presenter, dictionaries)
45
+ and the `tier` service through a real mount with a scripted `agents` face.
27
46
 
28
47
  ## Hard rules applied here
29
48
 
@@ -63,8 +82,12 @@ table.
63
82
  `typescript` + `tsdown` are regular `dependencies` (the git channel's `prepare`
64
83
  builds with production dependencies alone). `scripts/prepare.mjs` wipes `lib/`,
65
84
  emits tsc declarations into `lib/types`, then runs tsdown (tsdown `clean` stays
66
- OFF so the declarations survive). `pnpm-workspace.yaml` declares
67
- `allowBuilds: { esbuild: true }`.
85
+ OFF so the declarations survive). Two build faces: the node half
86
+ (`lib/index.js` + `lib/typert.host.js`) and the browser half (`lib/client.js`),
87
+ whose CJS factory is wrapped in `window.__ModuleLoader__.load({ id, factory })`
88
+ with the shell's platform modules (`react`, `react/jsx-runtime`, the
89
+ `@deepseek-ai/dsh-client-*` singletons) left external and zod inlined.
90
+ `pnpm-workspace.yaml` declares `allowBuilds: { esbuild: true }`.
68
91
 
69
92
  ## Checks
70
93
 
@@ -72,7 +95,7 @@ OFF so the declarations survive). `pnpm-workspace.yaml` declares
72
95
  pnpm run verify:self-contained && pnpm run verify:artifacts && pnpm pack`. The
73
96
  plain `typecheck` resolves the local harness checkout's type faces through
74
97
  tsconfig `paths` (four levels up to `D:\deepseek-harness`); `typecheck:ci`
75
- resolves the npm-published `0.1.2-rc.1` faces (no paths) and is what CI runs —
98
+ resolves the npm-published `0.1.5-rc.1` faces (no paths) and is what CI runs —
76
99
  keep both green.
77
100
 
78
101
  ## Release
package/CHANGELOG.md CHANGED
@@ -5,6 +5,51 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.1] - 2026-09-10
11
+
12
+ ### Changed
13
+
14
+ - Pin the `@deepseek-ai/dsh-*` dev/test dependencies to the published `0.1.5-rc.1` line and record `0.1.5-rc.1` in `dshWorkshop.compatibility.dshVersions`; the monthly Compat workflow now runs against `0.1.5-rc.1`. The peer range `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0` is unchanged, so no supported host line is dropped.
15
+
16
+ ### Docs
17
+
18
+ - Refresh the five-language README compatibility baseline to `dsh-v0.1.5-rc.1` (verified 2026-09-10).
19
+
20
+ ## [0.2.0] - 2026-09-09
21
+
22
+ ### Added
23
+
24
+ - **Browser half: a Settings card and a composer tier pill.** The plugin now
25
+ ships a `tier` Typert Remote service (`tier/status`, `tier/catalog`,
26
+ `tier/setMode`) behind a hand-written `./typert` host manifest, and a client
27
+ bundle that registers the composer pill into `conversation.input.left`
28
+ (id `tier-pill`) and the autotier card into the Plugins settings section
29
+ (`settings.plugins.tab`, id `autotier`). The pill shows the session's effective
30
+ mode (`AUTO` / `STRONG` / `CHEAP` / `OFF`) with an escalation badge and cycles
31
+ the session override on click; the card offers the full
32
+ `auto | strong | cheap | delegated | off` selector, the read-only tier
33
+ landings, the live session state, and a model-catalog dropdown fed by the live
34
+ `ctx.llm` registry. Copy ships in English and Simplified Chinese.
35
+ - `TierStatus` extends the public `AutotierStatus` additively with a `session`
36
+ view (override, effective mode, applied tier and source, escalation, plan
37
+ mode, guard denials); the host still serves `ctx.autotier.status()` unchanged.
38
+ - `zod` is now a runtime dependency (the strict wire codecs on both faces) and
39
+ the client peers (`dsh-api-remotes`, `dsh-client-connection`,
40
+ `dsh-client-locale`, `dsh-client-ui-conversation`, `dsh-client-ui-settings`,
41
+ `dsh-client-ui-slots`, `dsh-typert-protocol`) are declared as optional peers.
42
+
43
+ ### Notes
44
+
45
+ - The session override stays runtime-only: `auto` clears it, and a plugin reload
46
+ restores the `cordis.yml` routing mode. Nothing is persisted.
47
+ - `pnpm run verify:artifacts` now asserts the two new shipped faces
48
+ (`lib/typert.host.js` with its manifest shape, `lib/client.js` with its
49
+ ModuleLoader handshake and external platform modules).
50
+ - The five-language READMEs are not updated in this change; the client copy is
51
+ English + Simplified Chinese only.
52
+
8
53
  ## [0.1.1] - 2026-09-09
9
54
 
10
55
  ### Added
package/README.es.md CHANGED
@@ -20,7 +20,7 @@ strong con un TTL de retorno.
20
20
  | Harness | Estado |
21
21
  |---|---|
22
22
  | `@deepseek-ai/dsh` `0.1.2-rc.1` | compatible; el flujo compat instala esta línea de extremo a extremo |
23
- | `@deepseek-ai/dsh` `0.1.5-alpha.1` | compatible; verificada de extremo a extremo (perfil real, fila en `--dump-config`, smoke keyless) y en la matriz compat |
23
+ | `@deepseek-ai/dsh` `0.1.5-rc.1` | compatible; verificada de extremo a extremo (perfil real, fila en `--dump-config`, smoke keyless) y en la matriz compat |
24
24
  | `@deepseek-ai/cordis` `^4.0.2`, `@deepseek-ai/schemastery` `^3.18.2` | base de peers |
25
25
 
26
26
  Los rangos de peers nombran ambas líneas publicadas (`>=0.1.2-rc.1 <0.2.0 ||
@@ -207,10 +207,9 @@ cruzado se rechaza al guardar y la última política válida sigue vigente.
207
207
  el nivel cheap si quieres el mismo perfil de coste (`docs/supporting-lanes.md`).
208
208
  - `followSession: true` en el nivel cheap significa que una elección explícita de
209
209
  modelo en la sesión gana; en ese caso el nivel cheap no puede imponer el suyo.
210
- - **Aún no hay tarjeta de Settings ni píldora del compositor.** El enrutamiento es
211
- totalmente automático y la superficie host (`ctx.autotier.status()` /
212
- `catalog()`, `/tier`, `tier_status`, `tier_route`) está completa; la mitad de
213
- navegador está prevista para v0.2.
210
+ - **La tarjeta de Settings y la píldora del compositor llegaron en 0.2.0.** La
211
+ tarjeta (modo de enrutamiento, aterrizajes de nivel, catálogo de modelos) vive en
212
+ la sección Plugins y la píldora cicla el modo de la sesión desde el compositor.
214
213
  - **Un modelo elegido en la GUI no se detecta automáticamente.** Usa
215
214
  `routingMode: delegated` o `/tier off` para detener el enrutamiento.
216
215
  - **Las posteriores por huella viven en memoria** y se reinician al reiniciar.
@@ -222,7 +221,7 @@ cruzado se rechaza al guardar y la última política válida sigue vigente.
222
221
  ```bash
223
222
  pnpm install
224
223
  pnpm run typecheck # contra las caras de tipo del checkout local del harness
225
- pnpm run typecheck:ci # contra las caras publicadas 0.1.2-rc.1 (lo que ejecuta CI)
224
+ pnpm run typecheck:ci # contra las caras publicadas 0.1.5-rc.1 (lo que ejecuta CI)
226
225
  pnpm test
227
226
  pnpm run build
228
227
  pnpm run verify:self-contained
package/README.hi.md CHANGED
@@ -18,7 +18,7 @@ DeepSeek Harness के लिए स्वचालित मॉडल-स्
18
18
  | Harness | स्थिति |
19
19
  |---|---|
20
20
  | `@deepseek-ai/dsh` `0.1.2-rc.1` | संगत; compat वर्कफ़्लो इस लाइन को end-to-end इंस्टॉल करता है |
21
- | `@deepseek-ai/dsh` `0.1.5-alpha.1` | संगत; end-to-end सत्यापित (वास्तविक profile, `--dump-config` पंक्ति, keyless smoke) और compat मैट्रिक्स में |
21
+ | `@deepseek-ai/dsh` `0.1.5-rc.1` | संगत; end-to-end सत्यापित (वास्तविक profile, `--dump-config` पंक्ति, keyless smoke) और compat मैट्रिक्स में |
22
22
  | `@deepseek-ai/cordis` `^4.0.2`, `@deepseek-ai/schemastery` `^3.18.2` | peer आधार |
23
23
 
24
24
  peer ranges दोनों प्रकाशित लाइनें स्पष्ट रूप से लिखती हैं (`>=0.1.2-rc.1 <0.2.0
@@ -203,9 +203,9 @@ dsh plugin --profile web remove dsh-autotier
203
203
  संरेखित करें (`docs/supporting-lanes.md`)।
204
204
  - cheap स्तर पर `followSession: true` का अर्थ है कि सत्र का स्पष्ट मॉडल चयन
205
205
  जीतता है; उस स्थिति में cheap स्तर अपना मॉडल नहीं थोप सकता।
206
- - **अभी Settings कार्ड या composer पिल नहीं है।** रूटिंग पूरी तरह स्वचालित है और
207
- host सतह (`ctx.autotier.status()` / `catalog()`, `/tier`, `tier_status`,
208
- `tier_route`) पूरी है; ब्राउज़र आधा v0.2 में नियोजित है।
206
+ - **Settings कार्ड और composer पिल 0.2.0 में आ गए हैं।** कार्ड (रूटिंग मोड, लाइव
207
+ स्तर लैंडिंग, मॉडल कैटलॉग) Plugins सेटिंग्स अनुभाग में है और पिल composer से सत्र
208
+ मोड बदलता है।
209
209
  - **GUI में चुना गया मॉडल स्वचालित रूप से नहीं पहचाना जाता।** रूटिंग रोकने के लिए
210
210
  `routingMode: delegated` या `/tier off` इस्तेमाल करें।
211
211
  - **फिंगरप्रिंट posteriors केवल स्मृति में रहते हैं** और पुनः आरंभ पर रीसेट होते हैं।
@@ -217,7 +217,7 @@ dsh plugin --profile web remove dsh-autotier
217
217
  ```bash
218
218
  pnpm install
219
219
  pnpm run typecheck # स्थानीय harness checkout के type faces के विरुद्ध
220
- pnpm run typecheck:ci # प्रकाशित 0.1.2-rc.1 faces के विरुद्ध (CI यही चलाता है)
220
+ pnpm run typecheck:ci # प्रकाशित 0.1.5-rc.1 faces के विरुद्ध (CI यही चलाता है)
221
221
  pnpm test
222
222
  pnpm run build
223
223
  pnpm run verify:self-contained
package/README.md CHANGED
@@ -18,7 +18,7 @@ escalate to the strong tier with a TTL fallback.
18
18
  | Harness | Status |
19
19
  |---|---|
20
20
  | `@deepseek-ai/dsh` `0.1.2-rc.1` | compatible; the compat workflow installs this line end-to-end |
21
- | `@deepseek-ai/dsh` `0.1.5-alpha.1` | compatible; verified end-to-end (real profile install, `--dump-config` row, keyless headless smoke) and in the compat matrix |
21
+ | `@deepseek-ai/dsh` `0.1.5-rc.1` | compatible; verified end-to-end (real profile install, `--dump-config` row, keyless headless smoke) and in the compat matrix |
22
22
  | `@deepseek-ai/cordis` `^4.0.2`, `@deepseek-ai/schemastery` `^3.18.2` | peer baseline |
23
23
 
24
24
  Peer ranges name both published lines explicitly (`>=0.1.2-rc.1 <0.2.0 ||
@@ -203,10 +203,9 @@ refused at save time and the last good policy stays in effect.
203
203
  want the same cost profile (`docs/supporting-lanes.md`).
204
204
  - `followSession: true` on the cheap tier means an explicit session model choice
205
205
  wins; in that case the cheap tier cannot force its own model.
206
- - **No Settings card or composer pill yet.** Routing is fully automatic and the
207
- host surface (`ctx.autotier.status()` / `catalog()`, `/tier`, `tier_status`,
208
- `tier_route`) is complete; the browser half that renders a Settings tab and a
209
- composer tier pill is planned for v0.2.
206
+ - **The Settings card and composer tier pill shipped in 0.2.0.** The card
207
+ (routing mode, live tier landings, model catalog) lives in the Plugins settings
208
+ section and the pill cycles the session mode from the composer.
210
209
  - **A model picked in the GUI is not detected automatically.** The router does
211
210
  not watch the `agent-default-model` document, so switching models there does
212
211
  not by itself stop routing — use `routingMode: delegated` or `/tier off`.
@@ -221,7 +220,7 @@ refused at save time and the last good policy stays in effect.
221
220
  ```bash
222
221
  pnpm install
223
222
  pnpm run typecheck # against the local harness checkout type faces
224
- pnpm run typecheck:ci # against the published 0.1.2-rc.1 faces (what CI runs)
223
+ pnpm run typecheck:ci # against the published 0.1.5-rc.1 faces (what CI runs)
225
224
  pnpm test
226
225
  pnpm run build
227
226
  pnpm run verify:self-contained
package/README.pt.md CHANGED
@@ -19,7 +19,7 @@ retorno.
19
19
  | Harness | Estado |
20
20
  |---|---|
21
21
  | `@deepseek-ai/dsh` `0.1.2-rc.1` | compatível; o fluxo compat instala esta linha ponta a ponta |
22
- | `@deepseek-ai/dsh` `0.1.5-alpha.1` | compatível; verificada ponta a ponta (perfil real, linha no `--dump-config`, smoke keyless) e na matriz compat |
22
+ | `@deepseek-ai/dsh` `0.1.5-rc.1` | compatível; verificada ponta a ponta (perfil real, linha no `--dump-config`, smoke keyless) e na matriz compat |
23
23
  | `@deepseek-ai/cordis` `^4.0.2`, `@deepseek-ai/schemastery` `^3.18.2` | base de peers |
24
24
 
25
25
  Os ranges de peers nomeiam as duas linhas publicadas (`>=0.1.2-rc.1 <0.2.0 ||
@@ -205,10 +205,9 @@ cruzado é recusada ao salvar e a última política válida continua em vigor.
205
205
  cheap para o mesmo perfil de custo (`docs/supporting-lanes.md`).
206
206
  - `followSession: true` no nível cheap significa que uma escolha explícita de
207
207
  modelo na sessão vence; nesse caso o nível cheap não pode impor o seu.
208
- - **Ainda não há cartão de Settings nem pílula do compositor.** O roteamento é
209
- totalmente automático e a superfície host (`ctx.autotier.status()` /
210
- `catalog()`, `/tier`, `tier_status`, `tier_route`) está completa; a metade do
211
- navegador está planejada para v0.2.
208
+ - **O cartão de Settings e a pílula do compositor chegaram na 0.2.0.** O cartão
209
+ (modo de roteamento, aterrissagens de nível, catálogo de modelos) fica na seção
210
+ Plugins e a pílula cicla o modo da sessão pelo compositor.
212
211
  - **Um modelo escolhido na GUI não é detectado automaticamente.** Use
213
212
  `routingMode: delegated` ou `/tier off` para interromper o roteamento.
214
213
  - **As posteriores por impressão digital ficam em memória** e reiniciam a cada
@@ -221,7 +220,7 @@ cruzado é recusada ao salvar e a última política válida continua em vigor.
221
220
  ```bash
222
221
  pnpm install
223
222
  pnpm run typecheck # contra as faces de tipo do checkout local do harness
224
- pnpm run typecheck:ci # contra as faces publicadas 0.1.2-rc.1 (o que a CI executa)
223
+ pnpm run typecheck:ci # contra as faces publicadas 0.1.5-rc.1 (o que a CI executa)
225
224
  pnpm test
226
225
  pnpm run build
227
226
  pnpm run verify:self-contained
package/README.zh.md CHANGED
@@ -15,7 +15,7 @@ DeepSeek Harness 的自动模型分档路由:一条用户指令进来,一个
15
15
  | Harness | 状态 |
16
16
  |---|---|
17
17
  | `@deepseek-ai/dsh` `0.1.2-rc.1` | 兼容;compat 工作流对该线做端到端安装验证 |
18
- | `@deepseek-ai/dsh` `0.1.5-alpha.1` | 兼容;已端到端实测(真实 profile 安装、`--dump-config` 行、keyless headless 冒烟)并纳入 compat 矩阵 |
18
+ | `@deepseek-ai/dsh` `0.1.5-rc.1` | 兼容;已端到端实测(真实 profile 安装、`--dump-config` 行、keyless headless 冒烟)并纳入 compat 矩阵 |
19
19
  | `@deepseek-ai/cordis` `^4.0.2`、`@deepseek-ai/schemastery` `^3.18.2` | peer 基线 |
20
20
 
21
21
  peer 范围显式列出两条已发布线(`>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1
@@ -184,9 +184,8 @@ dsh plugin --profile web remove dsh-autotier
184
184
  画像,请把它们各自的模型设置对齐到弱档(`docs/supporting-lanes.md`)。
185
185
  - 弱档 `followSession: true` 意味着会话中显式选择的模型优先;此时弱档无法强制
186
186
  使用自己的模型。
187
- - **暂无 Settings 卡片与 composer 胶囊**。路由已完全自动,host 面
188
- (`ctx.autotier.status()` / `catalog()`、`/tier`、`tier_status`、
189
- `tier_route`)已完整;浏览器半计划于 v0.2。
187
+ - **Settings 卡片与 composer 胶囊已于 0.2.0 交付**。卡片(路由模式、实时档位落点、
188
+ 模型目录)位于 Plugins 设置区,胶囊在输入区循环切换会话档位。
190
189
  - **GUI 里改选模型不会被自动识别**。请用 `routingMode: delegated` 或
191
190
  `/tier off` 关闭路由。
192
191
  - **指纹后验仅存于内存**,重启后重新学习。
@@ -197,7 +196,7 @@ dsh plugin --profile web remove dsh-autotier
197
196
  ```bash
198
197
  pnpm install
199
198
  pnpm run typecheck # 对照本地 harness checkout 的类型面
200
- pnpm run typecheck:ci # 对照已发布的 0.1.2-rc.1 类型面(CI 实际执行)
199
+ pnpm run typecheck:ci # 对照已发布的 0.1.5-rc.1 类型面(CI 实际执行)
201
200
  pnpm test
202
201
  pnpm run build
203
202
  pnpm run verify:self-contained
@@ -1,5 +1,36 @@
1
1
  # Third-party notices
2
2
 
3
+ ## zod (https://github.com/colinhacks/zod)
4
+
5
+ The `tier` Remote wire codecs (`src/wire.ts`) are zod v4 schemas. `zod` is a
6
+ declared runtime dependency (MIT) and its library code is inlined into the built
7
+ `lib/index.js`, `lib/typert.host.js` and `lib/client.js` bundles; no zod source
8
+ is modified.
9
+
10
+ ```
11
+ MIT License
12
+
13
+ Copyright (c) 2020 Colin McDonnell
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+ ```
33
+
3
34
  ## dsh-tier-router (`lib/pure.js`)
4
35
 
5
36
  The high-risk command guard in `src/guard-rules.ts` is a port of the rule table
@@ -0,0 +1,114 @@
1
+ # v0.2 roadmap: concrete designs for the deferred items
2
+
3
+ This file records the researched, decision-ready design for every capability
4
+ that is deliberately **not** in 0.1.x. Each entry states the goal, the exact
5
+ mechanism, the acceptance criteria, and why it is not enabled yet. Nothing here
6
+ is speculation: the seams named below were read in the harness checkout
7
+ (`dsh-v0.1.5-alpha.1-13`).
8
+
9
+ ## 1. Browser half (Settings card + composer pill)
10
+
11
+ **Status:** implemented on the `v0.2.0` line (client bundle + Typert Remote
12
+ `tier/status|setMode|catalog`); see `src/client/`, `src/wire.ts`,
13
+ `src/typert.host.ts`.
14
+
15
+ **Why it was deferred:** the host surface was complete first (`ctx.autotier`),
16
+ and the client half needs the browser bundle pipeline (tsdown CJS face wrapped
17
+ in `window.__ModuleLoader__.load`), which is a packaging change rather than a
18
+ routing change.
19
+
20
+ ## 2. Fingerprint posterior persistence
21
+
22
+ **Goal:** a restarted harness keeps the per-shape cheap/strong win rates instead
23
+ of re-learning from the judge's cold start.
24
+
25
+ **Mechanism (chosen):** a dedicated settings namespace, not the user-facing
26
+ `autotier` one:
27
+
28
+ ```ts
29
+ ctx.settings.register('autotier-fingerprints', FingerprintSchema, { applies: 'live' })
30
+ ```
31
+
32
+ - `FingerprintSchema` = `{ version: 1, entries: [{ key, cheapOK, cheapN, strongOK, strongN, observations, lastSeen }] }`, capped at the same LRU 2000.
33
+ - Writes are **debounced** (≥30 s between flushes and one final flush on
34
+ `ctx.effect` disposal) and use `replace()` on the whole section, so a user
35
+ editing the document cannot produce a partial merge.
36
+ - On mount, `PosteriorTable.hydrate(section)` validates and loads; a
37
+ `stateVersion`/`version` mismatch discards the section (the same rule the
38
+ session-projection cache uses).
39
+ - A namespace that is absent (a deployment without settings) degrades to the
40
+ current in-memory behaviour — the plugin never depends on persistence.
41
+
42
+ **Why not the `autotier` namespace:** it is user-facing; writing a large learned
43
+ table into it would surface in the Settings card and collide with the user's
44
+ revision on every flush. A separate namespace keeps the two concerns apart.
45
+
46
+ **Acceptance:** a unit test proving hydrate → record → flush → hydrate is
47
+ idempotent; an integration test proving a refused settings write leaves the
48
+ in-memory table intact.
49
+
50
+ **Why not enabled yet:** it adds a write path to a plugin whose current promise
51
+ is "writes only the `autotier` namespace", and the benefit only appears after a
52
+ long enough session history that the cold-start fallback has already paid for
53
+ itself. Ship it behind `persistence.fingerprints: false` default.
54
+
55
+ ## 3. Attempt-first middle band (default on)
56
+
57
+ **Goal:** start ambiguous turns on the cheap tier and escalate on a signal,
58
+ which the cascade literature shows is cheaper *and* faster than deciding up
59
+ front.
60
+
61
+ **What is missing is calibration, not code:** the band, its `tauLow`, the
62
+ verify-once review, and the effort-first ladder are implemented and tested; the
63
+ shipped default is `intent.attemptBand.enabled: false` because the thresholds
64
+ have never been measured on real traffic.
65
+
66
+ **Mechanism:** `scripts/calibrate.mjs` + a 90-case labelled corpus:
67
+
68
+ - Corpus: `fixtures/intent-corpus.jsonl`, one `{ text, expectedTier, hard }` per
69
+ line, balanced across the eight scenarios (11–12 each) plus 10 adversarial
70
+ "looks simple, is complex" cases.
71
+ - The script replays the corpus through the *shipped* classifier (no LLM), then
72
+ sweeps `ruleThreshold`/`tauLow` and prints a table of PGR, APGR, CPT(50 %),
73
+ CPT(80 %), strong-call % and rule-layer hit rate — the same metrics RouteLLM's
74
+ `calibrate_threshold` reports.
75
+ - CI gate (a vitest suite over the same corpus): **CPT(80 %) ≤ 40 %**,
76
+ **APGR ≥ 0.7**, routing quality ≥ 95 % of an always-strong oracle, rule-layer
77
+ zero-token hit ≥ 60 %.
78
+ - Only when the gate is green does the shipped default flip to
79
+ `attemptBand.enabled: true`.
80
+
81
+ **Why not enabled yet:** enabling an uncalibrated band would spend strong calls
82
+ on turns the rules already classify correctly, which is exactly the cost the
83
+ plugin exists to avoid.
84
+
85
+ ## 4. Long-context lane
86
+
87
+ **Goal:** route very long sessions (est. tokens ≥ 30 k) to a model whose context
88
+ window actually fits, instead of failing or compacting mid-turn.
89
+
90
+ **Mechanism:** the same pre-flight module already answers "does this route
91
+ exist"; extend it with `ctx.llm.resolveModelInfo(...).context?.contextWindow`:
92
+
93
+ - When the assembled request's estimated tokens exceed the target route's
94
+ `contextWindow`, pick the first fallback entry (or the other tier) whose
95
+ window fits, and log the substitution once.
96
+ - If nothing fits, leave the route alone — compaction owns that case, and a
97
+ router must not silently drop the user's context.
98
+
99
+ **Why not yet:** `LlmCallConfig` carries no message payload at the request
100
+ waterfall, so the estimate must come from the session's derived history; the
101
+ read is cheap but it is a new dependency on `session.deriveMessages()`, and the
102
+ harness's own compaction is the primary owner of this problem.
103
+
104
+ ## 5. Multi-router coexistence
105
+
106
+ **Status:** implemented in 0.1.2 — a foreign `provider/model` at the request
107
+ waterfall is detected, logged once per session, and surfaced by `/tier status`
108
+ and `tier_status`.
109
+
110
+ ## 6. Explicit user selection
111
+
112
+ **Status:** implemented in 0.1.2 — the applied tier is mirrored into the
113
+ `agent-default-model` document, and an external change to that document moves
114
+ every live session to `delegated` until `/tier auto`.