dsh-autotier 0.1.0 → 0.2.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.
Files changed (62) hide show
  1. package/AGENTS.md +26 -3
  2. package/CHANGELOG.md +59 -0
  3. package/README.es.md +6 -2
  4. package/README.hi.md +7 -2
  5. package/README.md +7 -2
  6. package/README.pt.md +6 -2
  7. package/README.zh.md +6 -2
  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 +274 -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/preflight.d.ts +48 -0
  34. package/lib/types/preflight.d.ts.map +1 -0
  35. package/lib/types/routing.d.ts +2 -0
  36. package/lib/types/routing.d.ts.map +1 -1
  37. package/lib/types/selection.d.ts +50 -0
  38. package/lib/types/selection.d.ts.map +1 -0
  39. package/lib/types/tier-remote.d.ts +79 -0
  40. package/lib/types/tier-remote.d.ts.map +1 -0
  41. package/lib/types/typert.host.d.ts +300 -0
  42. package/lib/types/typert.host.d.ts.map +1 -0
  43. package/lib/types/wire.d.ts +804 -0
  44. package/lib/types/wire.d.ts.map +1 -0
  45. package/lib/wire-BpKSOHgo.js +5193 -0
  46. package/package.json +63 -11
  47. package/src/client/TierPill.tsx +83 -0
  48. package/src/client/TierSettingsCard.tsx +175 -0
  49. package/src/client/index.ts +146 -0
  50. package/src/client/locales.ts +107 -0
  51. package/src/client/present.ts +124 -0
  52. package/src/client/remote.ts +39 -0
  53. package/src/client/styles.ts +174 -0
  54. package/src/command.ts +1 -0
  55. package/src/index.ts +43 -0
  56. package/src/policy.ts +6 -0
  57. package/src/preflight.ts +105 -0
  58. package/src/routing.ts +28 -1
  59. package/src/selection.ts +124 -0
  60. package/src/tier-remote.ts +139 -0
  61. package/src/typert.host.ts +25 -0
  62. package/src/wire.ts +248 -0
@@ -0,0 +1,313 @@
1
+ /**
2
+ * The client-side Remote face of the `tier` namespace: the hand-written
3
+ * `TypertRemoteContribution` mounted through `ctx.remote.$mount`, plus the
4
+ * declaration merging that types `ctx.remote.tier`. The descriptor list is
5
+ * shared with the host `./typert` manifest (`../wire.ts`), so the two faces can
6
+ * never drift.
7
+ *
8
+ * @module dsh-autotier/client/remote
9
+ */
10
+ import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
11
+ import type { RoutingMode } from '../types.js';
12
+ import type { TierCatalog, TierStatus } from '../wire.js';
13
+ declare module '@deepseek-ai/dsh-typert-protocol' {
14
+ interface TypertRemoteNamespace$tier {
15
+ /** Read the status snapshot for one session (the slot identity). */
16
+ status: (agentId?: string) => Promise<RemoteResult<TierStatus>>;
17
+ /** Read the live registered provider/model catalog. */
18
+ catalog: () => Promise<RemoteResult<TierCatalog>>;
19
+ /** Pin or clear this session's routing mode override. */
20
+ setMode: (mode: RoutingMode, agentId?: string) => Promise<RemoteResult<TierStatus>>;
21
+ }
22
+ interface TypertRemoteMap {
23
+ 'tier/status': (agentId?: string) => Promise<RemoteResult<TierStatus>>;
24
+ 'tier/catalog': () => Promise<RemoteResult<TierCatalog>>;
25
+ 'tier/setMode': (mode: RoutingMode, agentId?: string) => Promise<RemoteResult<TierStatus>>;
26
+ }
27
+ interface TypertRemoteNamespaceMap {
28
+ tier: TypertRemoteNamespace$tier;
29
+ }
30
+ }
31
+ /** The client Remote contribution for the `tier` namespace. */
32
+ export declare const AUTOTIER_REMOTE: Readonly<{
33
+ package: string;
34
+ descriptors: readonly (Readonly<{
35
+ readonly id: "dsh-autotier#tier/status";
36
+ readonly service: "tier";
37
+ readonly namespace: "tier";
38
+ readonly method: "status";
39
+ readonly invocation: Readonly<{
40
+ kind: "direct";
41
+ }>;
42
+ readonly parameters: readonly Readonly<{
43
+ name: string;
44
+ wire: string;
45
+ source: "json";
46
+ codec: Readonly<{
47
+ mode: "strict";
48
+ typeSymbol: "dsh-autotier/wire#TierAgentId";
49
+ schema: import("zod").ZodOptional<import("zod").ZodString>;
50
+ }>;
51
+ acceptsUndefined: true;
52
+ }>[];
53
+ readonly result: Readonly<{
54
+ mode: "strict";
55
+ typeSymbol: string;
56
+ schema: import("zod").ZodObject<{
57
+ mode: import("zod").ZodEnum<{
58
+ strong: "strong";
59
+ cheap: "cheap";
60
+ off: "off";
61
+ auto: "auto";
62
+ delegated: "delegated";
63
+ }>;
64
+ tiers: import("zod").ZodObject<{
65
+ strong: import("zod").ZodObject<{
66
+ provider: import("zod").ZodString;
67
+ model: import("zod").ZodString;
68
+ effort: import("zod").ZodOptional<import("zod").ZodEnum<{
69
+ off: "off";
70
+ low: "low";
71
+ high: "high";
72
+ max: "max";
73
+ }>>;
74
+ }, import("zod/v4/core").$strip>;
75
+ cheap: import("zod").ZodObject<{
76
+ provider: import("zod").ZodString;
77
+ model: import("zod").ZodString;
78
+ effort: import("zod").ZodOptional<import("zod").ZodEnum<{
79
+ off: "off";
80
+ low: "low";
81
+ high: "high";
82
+ max: "max";
83
+ }>>;
84
+ }, import("zod/v4/core").$strip>;
85
+ vision: import("zod").ZodObject<{
86
+ provider: import("zod").ZodString;
87
+ model: import("zod").ZodString;
88
+ effort: import("zod").ZodOptional<import("zod").ZodEnum<{
89
+ off: "off";
90
+ low: "low";
91
+ high: "high";
92
+ max: "max";
93
+ }>>;
94
+ }, import("zod/v4/core").$strip>;
95
+ }, import("zod/v4/core").$strip>;
96
+ guard: import("zod").ZodObject<{
97
+ enabled: import("zod").ZodBoolean;
98
+ tiers: import("zod").ZodArray<import("zod").ZodEnum<{
99
+ strong: "strong";
100
+ cheap: "cheap";
101
+ }>>;
102
+ }, import("zod/v4/core").$strip>;
103
+ escalation: import("zod").ZodObject<{
104
+ threshold: import("zod").ZodNumber;
105
+ windowMs: import("zod").ZodNumber;
106
+ ttlMs: import("zod").ZodNumber;
107
+ fallbackTtlMs: import("zod").ZodNumber;
108
+ signature: import("zod").ZodBoolean;
109
+ }, import("zod/v4/core").$strip>;
110
+ session: import("zod").ZodObject<{
111
+ agentId: import("zod").ZodNullable<import("zod").ZodString>;
112
+ override: import("zod").ZodNullable<import("zod").ZodEnum<{
113
+ strong: "strong";
114
+ cheap: "cheap";
115
+ off: "off";
116
+ auto: "auto";
117
+ delegated: "delegated";
118
+ }>>;
119
+ mode: import("zod").ZodEnum<{
120
+ strong: "strong";
121
+ cheap: "cheap";
122
+ off: "off";
123
+ auto: "auto";
124
+ delegated: "delegated";
125
+ }>;
126
+ appliedTier: import("zod").ZodNullable<import("zod").ZodEnum<{
127
+ strong: "strong";
128
+ cheap: "cheap";
129
+ }>>;
130
+ appliedSource: import("zod").ZodNullable<import("zod").ZodEnum<{
131
+ manual: "manual";
132
+ rule: "rule";
133
+ judge: "judge";
134
+ posterior: "posterior";
135
+ "plan-mode": "plan-mode";
136
+ guard: "guard";
137
+ escalation: "escalation";
138
+ fallback: "fallback";
139
+ default: "default";
140
+ }>>;
141
+ escalation: import("zod").ZodBoolean;
142
+ plan: import("zod").ZodBoolean;
143
+ denials: import("zod").ZodNumber;
144
+ }, import("zod/v4/core").$strip>;
145
+ }, import("zod/v4/core").$strip>;
146
+ }>;
147
+ readonly sourceLocation: Readonly<{
148
+ file: "src/wire.ts";
149
+ line: 1;
150
+ column: 1;
151
+ }>;
152
+ }> | Readonly<{
153
+ readonly id: "dsh-autotier#tier/catalog";
154
+ readonly service: "tier";
155
+ readonly namespace: "tier";
156
+ readonly method: "catalog";
157
+ readonly invocation: Readonly<{
158
+ kind: "direct";
159
+ }>;
160
+ readonly parameters: readonly never[];
161
+ readonly result: Readonly<{
162
+ mode: "strict";
163
+ typeSymbol: "dsh-autotier/wire#TierCatalog";
164
+ schema: import("zod").ZodArray<import("zod").ZodObject<{
165
+ provider: import("zod").ZodString;
166
+ models: import("zod").ZodArray<import("zod").ZodObject<{
167
+ id: import("zod").ZodString;
168
+ name: import("zod").ZodString;
169
+ inputModalities: import("zod").ZodArray<import("zod").ZodString>;
170
+ }, import("zod/v4/core").$strip>>;
171
+ }, import("zod/v4/core").$strip>>;
172
+ }>;
173
+ readonly sourceLocation: Readonly<{
174
+ file: "src/wire.ts";
175
+ line: 1;
176
+ column: 1;
177
+ }>;
178
+ }> | Readonly<{
179
+ readonly id: "dsh-autotier#tier/setMode";
180
+ readonly service: "tier";
181
+ readonly namespace: "tier";
182
+ readonly method: "setMode";
183
+ readonly invocation: Readonly<{
184
+ kind: "direct";
185
+ }>;
186
+ readonly parameters: readonly (Readonly<{
187
+ name: string;
188
+ wire: string;
189
+ source: "json";
190
+ codec: Readonly<{
191
+ mode: "strict";
192
+ typeSymbol: "dsh-autotier/wire#TierAgentId";
193
+ schema: import("zod").ZodOptional<import("zod").ZodString>;
194
+ }>;
195
+ acceptsUndefined: true;
196
+ }> | Readonly<{
197
+ name: string;
198
+ wire: string;
199
+ source: "json";
200
+ codec: Readonly<{
201
+ mode: "strict";
202
+ typeSymbol: "dsh-autotier/types#RoutingMode";
203
+ schema: import("zod").ZodEnum<{
204
+ strong: "strong";
205
+ cheap: "cheap";
206
+ off: "off";
207
+ auto: "auto";
208
+ delegated: "delegated";
209
+ }>;
210
+ }>;
211
+ }>)[];
212
+ readonly result: Readonly<{
213
+ mode: "strict";
214
+ typeSymbol: string;
215
+ schema: import("zod").ZodObject<{
216
+ mode: import("zod").ZodEnum<{
217
+ strong: "strong";
218
+ cheap: "cheap";
219
+ off: "off";
220
+ auto: "auto";
221
+ delegated: "delegated";
222
+ }>;
223
+ tiers: import("zod").ZodObject<{
224
+ strong: import("zod").ZodObject<{
225
+ provider: import("zod").ZodString;
226
+ model: import("zod").ZodString;
227
+ effort: import("zod").ZodOptional<import("zod").ZodEnum<{
228
+ off: "off";
229
+ low: "low";
230
+ high: "high";
231
+ max: "max";
232
+ }>>;
233
+ }, import("zod/v4/core").$strip>;
234
+ cheap: import("zod").ZodObject<{
235
+ provider: import("zod").ZodString;
236
+ model: import("zod").ZodString;
237
+ effort: import("zod").ZodOptional<import("zod").ZodEnum<{
238
+ off: "off";
239
+ low: "low";
240
+ high: "high";
241
+ max: "max";
242
+ }>>;
243
+ }, import("zod/v4/core").$strip>;
244
+ vision: import("zod").ZodObject<{
245
+ provider: import("zod").ZodString;
246
+ model: import("zod").ZodString;
247
+ effort: import("zod").ZodOptional<import("zod").ZodEnum<{
248
+ off: "off";
249
+ low: "low";
250
+ high: "high";
251
+ max: "max";
252
+ }>>;
253
+ }, import("zod/v4/core").$strip>;
254
+ }, import("zod/v4/core").$strip>;
255
+ guard: import("zod").ZodObject<{
256
+ enabled: import("zod").ZodBoolean;
257
+ tiers: import("zod").ZodArray<import("zod").ZodEnum<{
258
+ strong: "strong";
259
+ cheap: "cheap";
260
+ }>>;
261
+ }, import("zod/v4/core").$strip>;
262
+ escalation: import("zod").ZodObject<{
263
+ threshold: import("zod").ZodNumber;
264
+ windowMs: import("zod").ZodNumber;
265
+ ttlMs: import("zod").ZodNumber;
266
+ fallbackTtlMs: import("zod").ZodNumber;
267
+ signature: import("zod").ZodBoolean;
268
+ }, import("zod/v4/core").$strip>;
269
+ session: import("zod").ZodObject<{
270
+ agentId: import("zod").ZodNullable<import("zod").ZodString>;
271
+ override: import("zod").ZodNullable<import("zod").ZodEnum<{
272
+ strong: "strong";
273
+ cheap: "cheap";
274
+ off: "off";
275
+ auto: "auto";
276
+ delegated: "delegated";
277
+ }>>;
278
+ mode: import("zod").ZodEnum<{
279
+ strong: "strong";
280
+ cheap: "cheap";
281
+ off: "off";
282
+ auto: "auto";
283
+ delegated: "delegated";
284
+ }>;
285
+ appliedTier: import("zod").ZodNullable<import("zod").ZodEnum<{
286
+ strong: "strong";
287
+ cheap: "cheap";
288
+ }>>;
289
+ appliedSource: import("zod").ZodNullable<import("zod").ZodEnum<{
290
+ manual: "manual";
291
+ rule: "rule";
292
+ judge: "judge";
293
+ posterior: "posterior";
294
+ "plan-mode": "plan-mode";
295
+ guard: "guard";
296
+ escalation: "escalation";
297
+ fallback: "fallback";
298
+ default: "default";
299
+ }>>;
300
+ escalation: import("zod").ZodBoolean;
301
+ plan: import("zod").ZodBoolean;
302
+ denials: import("zod").ZodNumber;
303
+ }, import("zod/v4/core").$strip>;
304
+ }, import("zod/v4/core").$strip>;
305
+ }>;
306
+ readonly sourceLocation: Readonly<{
307
+ file: "src/wire.ts";
308
+ line: 1;
309
+ column: 1;
310
+ }>;
311
+ }>)[];
312
+ }>;
313
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../src/client/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA4B,MAAM,kCAAkC,CAAA;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEzD,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,0BAA0B;QAClC,oEAAoE;QACpE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAA;QAC/D,uDAAuD;QACvD,OAAO,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAA;QACjD,yDAAyD;QACzD,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAA;KACpF;IACD,UAAU,eAAe;QACvB,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAA;QACtE,cAAc,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAA;QACxD,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAA;KAC3F;IACD,UAAU,wBAAwB;QAChC,IAAI,EAAE,0BAA0B,CAAA;KACjC;CACF;AAED,+DAA+D;AAC/D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGS,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Scoped stylesheet for the autotier client surfaces. Standalone client bundles
3
+ * cannot use the in-repo CSS-module pipeline, so the sheet ships as a string and
4
+ * is installed effect-scoped into a `<style data-dsh-autotier>` element. Every
5
+ * selector is scoped under `[data-dsh-autotier]` and uses theme design tokens
6
+ * only, so it follows both color schemes.
7
+ *
8
+ * @module dsh-autotier/client/styles
9
+ */
10
+ /** One `<style>` installation; returns the exact disposer that removes it. */
11
+ export declare function installAutotierStyles(): () => void;
12
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8EAA8E;AAC9E,wBAAgB,qBAAqB,IAAI,MAAM,IAAI,CAQlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA8BjD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAwBzG"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA+BjD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAwBzG"}
@@ -24,6 +24,10 @@ export { AutotierService } from './service.js';
24
24
  export { AutotierRouter } from './routing.js';
25
25
  export type { RouteProposal, RouteVeto, TierChange } from './routing.js';
26
26
  export { AgentStateStore, registerTierProjection, TIER_PROJECTION_KEY } from './state.js';
27
+ export { TierRemoteService } from './tier-remote.js';
28
+ export type { TierRemoteBindings } from './tier-remote.js';
29
+ export { ROUTE_SOURCES, TIER_AGENT_ID_SCHEMA, TIER_CATALOG_DESCRIPTOR, TIER_CATALOG_SCHEMA, TIER_INVOCATIONS, TIER_MODE_SCHEMA, TIER_NAMESPACE, TIER_SESSION_VIEW_SCHEMA, TIER_SET_MODE_DESCRIPTOR, TIER_STATUS_DESCRIPTOR, TIER_STATUS_SCHEMA, } from './wire.js';
30
+ export type { TierAgentId, TierCatalog, TierCatalogProvider, TierModelInfo, TierSessionView, TierStatus, } from './wire.js';
27
31
  export { classifyIntent, compileRules, computeSignals, evaluateRules, fingerprintOf, PosteriorTable, wilsonLowerBound, } from './intent.js';
28
32
  export type { IntentInput, IntentResult, IntentSignals, Posterior, RuleHit } from './intent.js';
29
33
  export { attemptBandApplies, createRouteState, decideTier, escalationActive, judgeNeeded, noteFailure, noteFallback, noteJudgeCall, } from './policy.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAAyC,KAAK,MAAM,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AAOlG,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACnE,YAAY,EAAE,MAAM,IAAI,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC3E,YAAY,EACV,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,SAAS,GACV,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,UAAU,EAAE,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AE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,SAAS,GACV,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE7D,4DAA4D;AAC5D,eAAO,MAAM,IAAI,iBAAiB,CAAA;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,UAAuD,CAAA;AAE1E;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,cAAmB,GAAG,IAAI,CAuDrE"}
@@ -49,6 +49,10 @@ export interface RouteState {
49
49
  denials: number;
50
50
  /** The last rule the guard fired, for `/tier status`. */
51
51
  lastDenial: string;
52
+ /** `provider/model` this plugin last applied, for multi-router detection. */
53
+ lastProviderModel: string | undefined;
54
+ /** Whether another layer was already reported for this agent. */
55
+ coexistenceWarned: boolean;
52
56
  }
53
57
  /** A fresh per-agent state. */
54
58
  export declare function createRouteState(): RouteState;
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAmC,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAElE,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,gFAAgF;IAChF,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAA;IAClC,2DAA2D;IAC3D,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B,qFAAqF;IACrF,QAAQ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,GAAG,IAAI,EACpB,GAAG,EAAE,MAAM,GACV,OAAO,CAOT;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAIxF;AAED,qCAAqC;AACrC,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAG/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAc9G;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAI3E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAQT"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Request-time route pre-flight: before a tier landing is written into the
3
+ * request configuration, check the two facts that would make the request fail
4
+ * outright — is the provider route registered, and does the target model accept
5
+ * the configured reasoning effort?
6
+ *
7
+ * Both answers come from the live `ctx.llm` registry and are cached per
8
+ * `provider/model`, so the common case costs one Map lookup. A route that fails
9
+ * pre-flight degrades instead of failing the turn: an unregistered provider
10
+ * falls back to a registered chain entry, and an unsupported effort is omitted
11
+ * (the adapter default then applies). Each degradation is logged once per key.
12
+ *
13
+ * @module dsh-autotier/preflight
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ import type { ResolvedTierConfig } from './config.js';
17
+ import type { TierRoute } from './types.js';
18
+ /** Options for {@link RoutePreflight}. */
19
+ export interface RoutePreflightOptions {
20
+ readonly ctx: Context;
21
+ /** Called once per degraded route key; the caller owns the log level. */
22
+ readonly onDegrade: (key: string, note: string) => void;
23
+ }
24
+ /**
25
+ * Pre-flight cache and checker for one plugin instance. The cache is per
26
+ * process and never invalidated: adapter registrations are composition-level
27
+ * facts, and a reload rebuilds the plugin (and this cache) with them.
28
+ */
29
+ export declare class RoutePreflight {
30
+ private readonly ctx;
31
+ private readonly onDegrade;
32
+ private readonly capabilities;
33
+ private readonly degraded;
34
+ /** @param options - the plugin context and the degrade reporter. */
35
+ constructor(options: RoutePreflightOptions);
36
+ /** One cached capability lookup; a failing adapter is treated as lenient. */
37
+ private capability;
38
+ /** Report one degradation at most once per key. */
39
+ private degrade;
40
+ /**
41
+ * Make one tier landing safe to apply.
42
+ * @param route - the landing the policy produced.
43
+ * @param tier - the tier configuration, for its fallback chain.
44
+ * @returns a landing that will not fail the request on provider/effort facts.
45
+ */
46
+ sanitize(route: TierRoute, tier: ResolvedTierConfig): Promise<TierRoute>;
47
+ }
48
+ //# sourceMappingURL=preflight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAK3C,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IACrB,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACxD;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAC/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;IACtE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAE7C,oEAAoE;gBACxD,OAAO,EAAE,qBAAqB;IAK1C,6EAA6E;IAC7E,OAAO,CAAC,UAAU;IAiBlB,mDAAmD;IACnD,OAAO,CAAC,OAAO;IAMf;;;;;OAKG;IACG,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;CA2B/E"}
@@ -71,6 +71,8 @@ export declare class AutotierRouter {
71
71
  private readonly counters;
72
72
  /** Router-owned lifetime signal: aborts in-flight judge calls on unload. */
73
73
  private readonly lifetime;
74
+ private readonly preflight;
75
+ private readonly selection;
74
76
  private disposed;
75
77
  /**
76
78
  * Register every listener on the plugin fiber.
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/routing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAoBnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEhE,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,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,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;IACzD,wFAAwF;IACxF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwE;IACjG,4EAA4E;IAC5E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAQ;IAExB;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAoBlC,mDAAmD;IACnD,IAAI,kBAAkB,IAAI,MAAM,CAE/B;IAED,0CAA0C;IAC1C,OAAO,CAAC,QAAQ;IAWhB,iEAAiE;IACjE,OAAO,CAAC,UAAU;IASlB,+CAA+C;IAC/C,OAAO,CAAC,OAAO;IAIf,mFAAmF;IACnF,OAAO,CAAC,eAAe;IAyBvB,yDAAyD;IACzD,OAAO,CAAC,UAAU;IAoClB,gFAAgF;IAChF,OAAO,CAAC,aAAa;IAuBrB;;;;;OAKG;YACW,UAAU;IAcxB;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ;IAgDhB;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAWjB,iFAAiF;YACnE,SAAS;IAiBvB,0EAA0E;YAC5D,YAAY;IA8F1B,0EAA0E;IAC1E,OAAO,CAAC,YAAY;IA0CpB;;;;OAIG;YACW,cAAc;IAmC5B,wEAAwE;IACxE,OAAO,CAAC,cAAc;IA2BtB,+EAA+E;IAC/E,OAAO,CAAC,OAAO;CAShB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Session-selection synchronisation and multi-router detection.
3
+ *
4
+ * Two harness facts drive this module:
5
+ *
6
+ * 1. The GUI's model picker reads and writes the `agent-default-model`
7
+ * settings document, so a router that changes the tier must mirror the
8
+ * change there — otherwise the picker shows a model nobody is using. The
9
+ * mirror is best-effort: without `agentDefaultModel` it degrades to a
10
+ * no-op.
11
+ * 2. A user's explicit choice must win. When the document changes to a value
12
+ * this module did not write, every live session switches to `delegated`
13
+ * (routing stops) until `/tier auto`.
14
+ *
15
+ * @module dsh-autotier/selection
16
+ */
17
+ import type { Context } from '@deepseek-ai/cordis';
18
+ import type { AgentStateStore } from './state.js';
19
+ import type { TierRoute } from './types.js';
20
+ /** Options for {@link SelectionSync}. */
21
+ export interface SelectionSyncOptions {
22
+ readonly ctx: Context;
23
+ readonly states: AgentStateStore;
24
+ }
25
+ /**
26
+ * Mirrors the applied tier into the default-model document and honours an
27
+ * external change by delegating every live session.
28
+ */
29
+ export declare class SelectionSync {
30
+ private readonly ctx;
31
+ private readonly states;
32
+ /** The selection this plugin last wrote; used to tell our write from a user's. */
33
+ private selfWrite;
34
+ /** @param options - the plugin context and the per-agent state store. */
35
+ constructor(options: SelectionSyncOptions);
36
+ /** The optional default-model service. */
37
+ private get defaultModel();
38
+ /**
39
+ * Mirror one applied landing into the default-model document. Repeated
40
+ * landings with the same value are skipped, so a long cheap run writes once.
41
+ * @param route - the landing actually applied.
42
+ */
43
+ noteRoute(route: TierRoute): void;
44
+ /**
45
+ * An external change to the default model wins: stop routing for every live
46
+ * session until the user asks for `auto` again.
47
+ */
48
+ private delegateLiveSessions;
49
+ }
50
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAsB3C,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CACjC;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,kFAAkF;IAClF,OAAO,CAAC,SAAS,CAAoB;IAErC,yEAAyE;gBAC7D,OAAO,EAAE,oBAAoB;IAczC,0CAA0C;IAC1C,OAAO,KAAK,YAAY,GAEvB;IAED;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAiBjC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;CAkB7B"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The `tier` Typert Remote service: the browser half's only host entry point.
3
+ * It exposes three methods over the shared wire vocabulary — `status` (the
4
+ * host's public {@link AutotierStatus} plus the session view), `catalog` (the
5
+ * live `ctx.llm` provider/model registry) and `setMode` (the session override).
6
+ *
7
+ * The override it writes is the very `RouteState.override` the router and the
8
+ * `/tier` command already read, so the composer pill, the Settings card and the
9
+ * command can never disagree; nothing here is persisted, and a reload restores
10
+ * the composition mode.
11
+ *
12
+ * @module dsh-autotier/tier-remote
13
+ */
14
+ import type { Context } from '@deepseek-ai/cordis';
15
+ import type { Agent } from '@deepseek-ai/dsh-agent';
16
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
17
+ import type { AutotierService } from './service.js';
18
+ import type { AgentStateStore } from './state.js';
19
+ import { type RoutingMode } from './types.js';
20
+ import { type TierCatalog, type TierStatus } from './wire.js';
21
+ declare module '@deepseek-ai/cordis' {
22
+ interface Context {
23
+ /** The autotier Remote service (absent when the plugin is not composed). */
24
+ tier: TierRemoteService;
25
+ }
26
+ }
27
+ /** The live bindings the Remote service reads; all owned by the plugin fiber. */
28
+ export interface TierRemoteBindings {
29
+ /** The public read surface (`status`, `catalog`) this service fronts. */
30
+ readonly service: AutotierService;
31
+ /** The per-agent runtime state store the router and `/tier` share. */
32
+ readonly states: AgentStateStore;
33
+ /**
34
+ * Resolve one live agent by its session id. Supplied by the plugin's `apply`
35
+ * through the optional `agents` service, so this module never hard-depends on
36
+ * it; an unresolvable id degrades the read and refuses the write.
37
+ */
38
+ readonly resolveAgent: (agentId: string) => Agent | undefined;
39
+ }
40
+ /**
41
+ * The `tier` Typert Remote service. Constructed by `src/index.ts` on the plugin
42
+ * fiber; registering it removes it again on unload.
43
+ */
44
+ export declare class TierRemoteService extends TypertRemoteService {
45
+ private readonly bindings;
46
+ /** No service dependencies: a pure surface over the injected bindings. */
47
+ static inject: never[];
48
+ /**
49
+ * @param ctx - the owning plugin context.
50
+ * @param bindings - the read surface, the shared state store and the agent resolver.
51
+ */
52
+ constructor(ctx: Context, bindings: TierRemoteBindings);
53
+ /**
54
+ * The status snapshot for one session.
55
+ * @param agentId - the calling session/agent id; omitted reads the composition mode only.
56
+ * @returns the host status plus the session view (empty when the id is absent or unknown).
57
+ */
58
+ status(agentId?: string): TierStatus;
59
+ /**
60
+ * The registered provider/model catalog, straight from the live `ctx.llm`
61
+ * registry — never hardcoded, so a model the adapter does not advertise
62
+ * cannot appear.
63
+ * @returns one entry per registered provider with its models.
64
+ */
65
+ catalog(): Promise<TierCatalog>;
66
+ /**
67
+ * Set the session override for one agent and return the refreshed status.
68
+ * `auto` clears the override; every other mode pins the session. Runtime only.
69
+ * @param mode - the routing mode to pin, or `auto` to follow the composition mode.
70
+ * @param agentId - the calling session/agent id (required: the override is per agent).
71
+ * @returns the refreshed status for that agent.
72
+ * @throws {TypeError} when the mode is outside the routing vocabulary.
73
+ * @throws {Error} when no agent id is supplied or the id names no live agent.
74
+ */
75
+ setMode(mode: RoutingMode, agentId?: string): TierStatus;
76
+ /** Project the shared per-agent runtime state onto the wire view. */
77
+ private viewFor;
78
+ }
79
+ //# sourceMappingURL=tier-remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tier-remote.d.ts","sourceRoot":"","sources":["../../src/tier-remote.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