@crewhaus/ir 0.2.0 → 0.2.2

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 +53 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -118,6 +118,45 @@ 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
+ readonly explorationRate?: number;
156
+ readonly seed?: string;
157
+ readonly bandit?: "epsilon-greedy" | "thompson";
158
+ };
159
+ };
121
160
  /**
122
161
  * Section 55 (Track A) — named failure taxonomy. Cross-cutting; carried
123
162
  * through to runtime-core so `recovery-engine` can consult the user's
@@ -327,6 +366,8 @@ export type IrV0 = {
327
366
  readonly circuitBreaker?: IrCircuitBreaker;
328
367
  /** Item 26 — two-tier turn-difficulty router. Absent → single-model. */
329
368
  readonly modelTiers?: IrModelTiers;
369
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
370
+ readonly modelPool?: IrModelPool;
330
371
  };
331
372
  readonly tools: readonly string[];
332
373
  readonly toolConfigs: IrToolConfigs;
@@ -587,6 +628,8 @@ export type IrChannelV0 = {
587
628
  readonly circuitBreaker?: IrCircuitBreaker;
588
629
  /** Item 26 — two-tier turn-difficulty router. Absent → single-model. */
589
630
  readonly modelTiers?: IrModelTiers;
631
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
632
+ readonly modelPool?: IrModelPool;
590
633
  };
591
634
  readonly tools: readonly string[];
592
635
  readonly toolConfigs: IrToolConfigs;
@@ -642,6 +685,8 @@ export type IrManagedV0 = {
642
685
  readonly circuitBreaker?: IrCircuitBreaker;
643
686
  /** Item 26 — two-tier turn-difficulty router. Absent → single-model. */
644
687
  readonly modelTiers?: IrModelTiers;
688
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
689
+ readonly modelPool?: IrModelPool;
645
690
  };
646
691
  readonly tenants: readonly IrManagedTenant[];
647
692
  readonly permissions: IrPermissions;
@@ -728,6 +773,8 @@ export type IrPipelineV0 = {
728
773
  readonly agent: {
729
774
  readonly model: string;
730
775
  readonly instructions: string;
776
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
777
+ readonly modelPool?: IrModelPool;
731
778
  };
732
779
  readonly retrieve: {
733
780
  readonly embedderModel: string;
@@ -823,6 +870,8 @@ export type IrResearchV0 = {
823
870
  readonly agent: {
824
871
  readonly model: string;
825
872
  readonly instructions: string;
873
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
874
+ readonly modelPool?: IrModelPool;
826
875
  };
827
876
  /** Default research goal. The daemon's `--goal "..."` flag overrides. */
828
877
  readonly goal: string;
@@ -868,6 +917,8 @@ export type IrBatchV0 = {
868
917
  readonly agent: {
869
918
  readonly model: string;
870
919
  readonly instructions: string;
920
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
921
+ readonly modelPool?: IrModelPool;
871
922
  };
872
923
  readonly queue: {
873
924
  readonly adapter: IrBatchQueueAdapter;
@@ -948,6 +999,8 @@ export type IrBrowserV0 = {
948
999
  readonly agent: {
949
1000
  readonly model: string;
950
1001
  readonly instructions: string;
1002
+ /** Adaptive model routing — N-candidate pool. Absent → single-model. */
1003
+ readonly modelPool?: IrModelPool;
951
1004
  };
952
1005
  readonly driver: {
953
1006
  readonly backend: IrBrowserBackend;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/ir",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Canonical typed intermediate representation",
6
6
  "main": "dist/index.js",