@crewhaus/ir 0.2.0 → 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 (2) hide show
  1. package/dist/index.d.ts +42 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -118,6 +118,42 @@ export type IrModelTiers = {
118
118
  readonly priorToolDensityThreshold?: number;
119
119
  };
120
120
  };
121
+ /** One declared candidate in a `model_pool`. */
122
+ export type IrModelPoolCandidate = {
123
+ readonly model: string;
124
+ readonly tags: readonly string[];
125
+ };
126
+ /**
127
+ * Adaptive model routing — the N-candidate `model_pool` with a per-turn
128
+ * selection `policy` (`static` | `heuristic` | `learned`). Carried on the
129
+ * agent blocks of the routing-capable shapes (cli, channel, managed), mutually
130
+ * exclusive with `modelTiers`/`modelFallbacks` (enforced in the spec). Absent
131
+ * when the spec omits `model_pool` — codegen gates on presence so an unset
132
+ * block leaves bundles byte-identical. `policy` and each candidate's `tags` are
133
+ * always present (spec defaults them); every other knob is carried verbatim.
134
+ */
135
+ export type IrModelPool = {
136
+ readonly candidates: readonly IrModelPoolCandidate[];
137
+ readonly policy: "static" | "heuristic" | "learned";
138
+ readonly objective?: {
139
+ readonly quality?: number;
140
+ readonly cost?: number;
141
+ readonly latency?: number;
142
+ };
143
+ readonly routing?: {
144
+ readonly contextTokenThreshold?: number;
145
+ readonly toolsToDefault?: boolean;
146
+ readonly firstTurnToDefault?: boolean;
147
+ readonly priorToolDensityThreshold?: number;
148
+ readonly strongTag?: string;
149
+ readonly cheapTag?: string;
150
+ };
151
+ readonly learning?: {
152
+ readonly minSamplesPerArm?: number;
153
+ readonly costRefUsd?: number;
154
+ readonly latencyRefMs?: number;
155
+ };
156
+ };
121
157
  /**
122
158
  * Section 55 (Track A) — named failure taxonomy. Cross-cutting; carried
123
159
  * through to runtime-core so `recovery-engine` can consult the user's
@@ -327,6 +363,8 @@ export type IrV0 = {
327
363
  readonly circuitBreaker?: IrCircuitBreaker;
328
364
  /** Item 26 — two-tier turn-difficulty router. Absent → single-model. */
329
365
  readonly modelTiers?: IrModelTiers;
366
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
367
+ readonly modelPool?: IrModelPool;
330
368
  };
331
369
  readonly tools: readonly string[];
332
370
  readonly toolConfigs: IrToolConfigs;
@@ -587,6 +625,8 @@ export type IrChannelV0 = {
587
625
  readonly circuitBreaker?: IrCircuitBreaker;
588
626
  /** Item 26 — two-tier turn-difficulty router. Absent → single-model. */
589
627
  readonly modelTiers?: IrModelTiers;
628
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
629
+ readonly modelPool?: IrModelPool;
590
630
  };
591
631
  readonly tools: readonly string[];
592
632
  readonly toolConfigs: IrToolConfigs;
@@ -642,6 +682,8 @@ export type IrManagedV0 = {
642
682
  readonly circuitBreaker?: IrCircuitBreaker;
643
683
  /** Item 26 — two-tier turn-difficulty router. Absent → single-model. */
644
684
  readonly modelTiers?: IrModelTiers;
685
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
686
+ readonly modelPool?: IrModelPool;
645
687
  };
646
688
  readonly tenants: readonly IrManagedTenant[];
647
689
  readonly permissions: IrPermissions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/ir",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Canonical typed intermediate representation",
6
6
  "main": "dist/index.js",