@warmdrift/kgauto-compiler 2.0.0-alpha.81 → 2.0.0-alpha.82

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.
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var LIBRARY_VERSION = "2.0.0-alpha.81";
2
+ var LIBRARY_VERSION = "2.0.0-alpha.82";
3
3
 
4
4
  // src/key-health.ts
5
5
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-DpcAMmk-.mjs';
2
- export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-DpcAMmk-.mjs';
3
- import '../ir-BFwWhj2s.mjs';
1
+ import { G as GlassboxEvent } from '../types-CRXaR7nJ.mjs';
2
+ export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-CRXaR7nJ.mjs';
3
+ import '../ir-D4S9R816.mjs';
4
4
  import '../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-B4kz3Vs0.js';
2
- export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-B4kz3Vs0.js';
3
- import '../ir-DZKS1tI7.js';
1
+ import { G as GlassboxEvent } from '../types-CAs9-0S4.js';
2
+ export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-CAs9-0S4.js';
3
+ import '../ir-Cx9hJj0B.js';
4
4
  import '../dialect.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-hjzSWxtv.mjs';
2
- import '../ir-BFwWhj2s.mjs';
1
+ import { T as TraceHealth } from '../types-DHi4FcUu.mjs';
2
+ import '../ir-D4S9R816.mjs';
3
3
  import '../dialect.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-D_fLt_Xv.js';
2
- import '../ir-DZKS1tI7.js';
1
+ import { T as TraceHealth } from '../types-Cvd6kRNv.js';
2
+ import '../ir-Cx9hJj0B.js';
3
3
  import '../dialect.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-DpcAMmk-.mjs';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-hjzSWxtv.mjs';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-hjzSWxtv.mjs';
4
- import '../ir-BFwWhj2s.mjs';
1
+ import { G as GlassboxEvent } from '../types-CRXaR7nJ.mjs';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DHi4FcUu.mjs';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DHi4FcUu.mjs';
4
+ import '../ir-D4S9R816.mjs';
5
5
  import '../dialect.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-B4kz3Vs0.js';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-D_fLt_Xv.js';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-D_fLt_Xv.js';
4
- import '../ir-DZKS1tI7.js';
1
+ import { G as GlassboxEvent } from '../types-CAs9-0S4.js';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-Cvd6kRNv.js';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-Cvd6kRNv.js';
4
+ import '../ir-Cx9hJj0B.js';
5
5
  import '../dialect.js';
6
6
 
7
7
  /**
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as TraceDetail } from '../../types-hjzSWxtv.mjs';
3
- import '../../ir-BFwWhj2s.mjs';
2
+ import { a as TraceDetail } from '../../types-DHi4FcUu.mjs';
3
+ import '../../ir-D4S9R816.mjs';
4
4
  import '../../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as TraceDetail } from '../../types-D_fLt_Xv.js';
3
- import '../../ir-DZKS1tI7.js';
2
+ import { a as TraceDetail } from '../../types-Cvd6kRNv.js';
3
+ import '../../ir-Cx9hJj0B.js';
4
4
  import '../../dialect.js';
5
5
 
6
6
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, F as FallbackReason, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-BFwWhj2s.mjs';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U as shouldCaptureGolden } from './ir-BFwWhj2s.mjs';
1
+ import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, F as FallbackReason, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-D4S9R816.mjs';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U as shouldCaptureGolden } from './ir-D4S9R816.mjs';
3
3
  import { ModelProfile, ArchetypeConvention } from './profiles.mjs';
4
4
  export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.mjs';
5
5
  export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.mjs';
@@ -1146,7 +1146,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
1146
1146
  * guard in `tests/version.test.ts` fails the suite (and therefore
1147
1147
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
1148
1148
  */
1149
- declare const LIBRARY_VERSION = "2.0.0-alpha.81";
1149
+ declare const LIBRARY_VERSION = "2.0.0-alpha.82";
1150
1150
 
1151
1151
  /**
1152
1152
  * Oracle contract — how an app tells the brain whether a response was good.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, F as FallbackReason, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-DZKS1tI7.js';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U as shouldCaptureGolden } from './ir-DZKS1tI7.js';
1
+ import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, F as FallbackReason, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-Cx9hJj0B.js';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U as shouldCaptureGolden } from './ir-Cx9hJj0B.js';
3
3
  import { ModelProfile, ArchetypeConvention } from './profiles.js';
4
4
  export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.js';
5
5
  export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.js';
@@ -1146,7 +1146,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
1146
1146
  * guard in `tests/version.test.ts` fails the suite (and therefore
1147
1147
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
1148
1148
  */
1149
- declare const LIBRARY_VERSION = "2.0.0-alpha.81";
1149
+ declare const LIBRARY_VERSION = "2.0.0-alpha.82";
1150
1150
 
1151
1151
  /**
1152
1152
  * Oracle contract — how an app tells the brain whether a response was good.
package/dist/index.js CHANGED
@@ -5186,6 +5186,20 @@ function detectSingleModelArray(ir, policy) {
5186
5186
  }
5187
5187
  ];
5188
5188
  }
5189
+ function suppressedRecommendationReason(ir, archetype, altProfile) {
5190
+ if (getMeasuredFailureVerdict({ appId: ir.appId, archetype, model: altProfile.id })?.gated === true) {
5191
+ return "measured-failure-gate";
5192
+ }
5193
+ if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
5194
+ (c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
5195
+ )) {
5196
+ return "schema-weakness-convention";
5197
+ }
5198
+ if (getRecentRollback({ appId: ir.appId, archetype, model: altProfile.id }) !== void 0) {
5199
+ return "recent-rollback";
5200
+ }
5201
+ return void 0;
5202
+ }
5189
5203
  function openPostureRemedyClause(archetype, recommended, resolveProfile) {
5190
5204
  const openChain = getDefaultFallbackChain({ archetype, posture: "open" });
5191
5205
  const openPrimaryId = openChain[0];
@@ -5223,25 +5237,7 @@ function detectCostMismatchedArchetype(ir, profile, phase2) {
5223
5237
  if (altScore.score < QUALITY_FLOOR_FOR_RECOMMENDATION) continue;
5224
5238
  if (altScore.score < chosenScore.score) continue;
5225
5239
  if (altProfile.costInputPer1m >= profile.costInputPer1m) continue;
5226
- if (getMeasuredFailureVerdict({
5227
- appId: ir.appId,
5228
- archetype,
5229
- model: altProfile.id
5230
- })?.gated === true) {
5231
- continue;
5232
- }
5233
- if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
5234
- (c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
5235
- )) {
5236
- continue;
5237
- }
5238
- if (getRecentRollback({
5239
- appId: ir.appId,
5240
- archetype,
5241
- model: altProfile.id
5242
- }) !== void 0) {
5243
- continue;
5244
- }
5240
+ if (suppressedRecommendationReason(ir, archetype, altProfile)) continue;
5245
5241
  if (!bestAlt || altScore.score > bestAlt.score.score || altScore.score === bestAlt.score.score && altProfile.costInputPer1m < bestAlt.profile.costInputPer1m) {
5246
5242
  bestAlt = { id: altId, profile: altProfile, score: altScore };
5247
5243
  }
@@ -5299,6 +5295,7 @@ function detectTierDown(ir, profile, phase2) {
5299
5295
  if (altScore.score < QUALITY_FLOOR_FOR_RECOMMENDATION) continue;
5300
5296
  if (altScore.score < chosenScore.score) continue;
5301
5297
  if (altProfile.costInputPer1m > chosenCost * TIER_DOWN_COST_RATIO) continue;
5298
+ if (suppressedRecommendationReason(ir, archetype, altProfile)) continue;
5302
5299
  if (!bestAlt || altProfile.costInputPer1m < bestAlt.profile.costInputPer1m || altProfile.costInputPer1m === bestAlt.profile.costInputPer1m && altScore.score > bestAlt.score.score) {
5303
5300
  bestAlt = { id: altId, profile: altProfile, score: altScore };
5304
5301
  }
@@ -5345,7 +5342,18 @@ function detectArchetypePerfFloorBreach(ir, profile) {
5345
5342
  // library pick" endorsement could land on a materially pricier
5346
5343
  // primary. The floor recommendation stands; the axis is now named,
5347
5344
  // and the cost-ordered variant is offered alongside it.
5348
- suggestion: `Swap to a model whose archetypePerf for ${ir.intent.archetype} clears the floor. Use \`getModelCompatibility(candidateId, { archetype: '${ir.intent.archetype}' })\` to vet candidates, or \`getDefaultFallbackChain({ archetype: '${ir.intent.archetype}', posture: 'open' })\` for a library-picked chain that respects the floor by construction \u2014 note that chain is ordered by archetype performance, NOT cost, so it may select a pricier primary than you run today. Add \`optimizeFor: 'cost'\` for a chain that clears the same floor cheapest-first.`,
5345
+ //
5346
+ // alpha.82 (cc-Cairn 2026-07-29, follow-on 1): the suggestion read as
5347
+ // advice about the ARCHETYPE when it is a fact about ONE CALL. Model
5348
+ // selection is input-size dependent, so a rule that fires on the
5349
+ // small-payload tail of a path whose typical case clears the floor
5350
+ // reads as "your primary is wrong" when the accurate statement is
5351
+ // "this call landed here." Ground truth for the wording: tt-intel's
5352
+ // open critical is `gemini-2.5-flash-lite` (ask, 5/10) selected at
5353
+ // ~2.1K tokens_in, while `claude-opus-5` served the same archetype at
5354
+ // ~22K the same day — cc read the evidence set as self-contradictory
5355
+ // precisely because the text did not say which call it described.
5356
+ suggestion: `This fired for \`${profile.id}\`, the model selected for THIS call \u2014 selection is input-size dependent, so other calls on \`${ir.intent.archetype}\` may pick a different model that clears the floor. Swap to a model whose archetypePerf for ${ir.intent.archetype} clears the floor. Use \`getModelCompatibility(candidateId, { archetype: '${ir.intent.archetype}' })\` to vet candidates, or \`getDefaultFallbackChain({ archetype: '${ir.intent.archetype}', posture: 'open' })\` for a library-picked chain that respects the floor by construction \u2014 note that chain is ordered by archetype performance, NOT cost, so it may select a pricier primary than you run today. Add \`optimizeFor: 'cost'\` for a chain that clears the same floor cheapest-first. To stop this model being selected at all, pass \`policy.blockedModels: ['${profile.id}']\`.`,
5349
5357
  recommendationType: "model-swap",
5350
5358
  docsUrl: "https://github.com/stue/command-center/blob/main/interfaces/kgauto.md#best-practice-advisories"
5351
5359
  }
@@ -5845,7 +5853,7 @@ function validateFinalFit(ir, profile, tokens) {
5845
5853
  }
5846
5854
 
5847
5855
  // src/version.ts
5848
- var LIBRARY_VERSION = "2.0.0-alpha.81";
5856
+ var LIBRARY_VERSION = "2.0.0-alpha.82";
5849
5857
 
5850
5858
  // src/pricing-brain.ts
5851
5859
  function isPricingRow(x) {
@@ -6642,13 +6650,16 @@ var FAILED = /* @__PURE__ */ Symbol("parse-failed");
6642
6650
 
6643
6651
  // src/ir.ts
6644
6652
  function mutationId(m) {
6645
- return typeof m === "string" ? m : m.id;
6653
+ if (m == null) return void 0;
6654
+ if (typeof m === "string") return m;
6655
+ return typeof m.id === "string" ? m.id : void 0;
6646
6656
  }
6647
6657
  function hasMutation(list, idOrPrefix) {
6648
6658
  if (!Array.isArray(list)) return false;
6649
6659
  const prefix = idOrPrefix.endsWith("*") ? idOrPrefix.slice(0, -1) : void 0;
6650
6660
  return list.some((m) => {
6651
6661
  const id = mutationId(m);
6662
+ if (id === void 0) return false;
6652
6663
  return prefix !== void 0 ? id.startsWith(prefix) : id === idOrPrefix;
6653
6664
  });
6654
6665
  }
package/dist/index.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  LIBRARY_VERSION,
20
20
  createKeyHealthRoute,
21
21
  keyFingerprint
22
- } from "./chunk-OZNAGO4U.mjs";
22
+ } from "./chunk-L246YOV7.mjs";
23
23
  import {
24
24
  ABSOLUTE_FLOOR,
25
25
  ARCHETYPE_FLOOR_DEFAULT,
@@ -2506,6 +2506,20 @@ function detectSingleModelArray(ir, policy) {
2506
2506
  }
2507
2507
  ];
2508
2508
  }
2509
+ function suppressedRecommendationReason(ir, archetype, altProfile) {
2510
+ if (getMeasuredFailureVerdict({ appId: ir.appId, archetype, model: altProfile.id })?.gated === true) {
2511
+ return "measured-failure-gate";
2512
+ }
2513
+ if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
2514
+ (c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
2515
+ )) {
2516
+ return "schema-weakness-convention";
2517
+ }
2518
+ if (getRecentRollback({ appId: ir.appId, archetype, model: altProfile.id }) !== void 0) {
2519
+ return "recent-rollback";
2520
+ }
2521
+ return void 0;
2522
+ }
2509
2523
  function openPostureRemedyClause(archetype, recommended, resolveProfile) {
2510
2524
  const openChain = getDefaultFallbackChain({ archetype, posture: "open" });
2511
2525
  const openPrimaryId = openChain[0];
@@ -2543,25 +2557,7 @@ function detectCostMismatchedArchetype(ir, profile, phase2) {
2543
2557
  if (altScore.score < QUALITY_FLOOR_FOR_RECOMMENDATION) continue;
2544
2558
  if (altScore.score < chosenScore.score) continue;
2545
2559
  if (altProfile.costInputPer1m >= profile.costInputPer1m) continue;
2546
- if (getMeasuredFailureVerdict({
2547
- appId: ir.appId,
2548
- archetype,
2549
- model: altProfile.id
2550
- })?.gated === true) {
2551
- continue;
2552
- }
2553
- if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
2554
- (c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
2555
- )) {
2556
- continue;
2557
- }
2558
- if (getRecentRollback({
2559
- appId: ir.appId,
2560
- archetype,
2561
- model: altProfile.id
2562
- }) !== void 0) {
2563
- continue;
2564
- }
2560
+ if (suppressedRecommendationReason(ir, archetype, altProfile)) continue;
2565
2561
  if (!bestAlt || altScore.score > bestAlt.score.score || altScore.score === bestAlt.score.score && altProfile.costInputPer1m < bestAlt.profile.costInputPer1m) {
2566
2562
  bestAlt = { id: altId, profile: altProfile, score: altScore };
2567
2563
  }
@@ -2619,6 +2615,7 @@ function detectTierDown(ir, profile, phase2) {
2619
2615
  if (altScore.score < QUALITY_FLOOR_FOR_RECOMMENDATION) continue;
2620
2616
  if (altScore.score < chosenScore.score) continue;
2621
2617
  if (altProfile.costInputPer1m > chosenCost * TIER_DOWN_COST_RATIO) continue;
2618
+ if (suppressedRecommendationReason(ir, archetype, altProfile)) continue;
2622
2619
  if (!bestAlt || altProfile.costInputPer1m < bestAlt.profile.costInputPer1m || altProfile.costInputPer1m === bestAlt.profile.costInputPer1m && altScore.score > bestAlt.score.score) {
2623
2620
  bestAlt = { id: altId, profile: altProfile, score: altScore };
2624
2621
  }
@@ -2665,7 +2662,18 @@ function detectArchetypePerfFloorBreach(ir, profile) {
2665
2662
  // library pick" endorsement could land on a materially pricier
2666
2663
  // primary. The floor recommendation stands; the axis is now named,
2667
2664
  // and the cost-ordered variant is offered alongside it.
2668
- suggestion: `Swap to a model whose archetypePerf for ${ir.intent.archetype} clears the floor. Use \`getModelCompatibility(candidateId, { archetype: '${ir.intent.archetype}' })\` to vet candidates, or \`getDefaultFallbackChain({ archetype: '${ir.intent.archetype}', posture: 'open' })\` for a library-picked chain that respects the floor by construction \u2014 note that chain is ordered by archetype performance, NOT cost, so it may select a pricier primary than you run today. Add \`optimizeFor: 'cost'\` for a chain that clears the same floor cheapest-first.`,
2665
+ //
2666
+ // alpha.82 (cc-Cairn 2026-07-29, follow-on 1): the suggestion read as
2667
+ // advice about the ARCHETYPE when it is a fact about ONE CALL. Model
2668
+ // selection is input-size dependent, so a rule that fires on the
2669
+ // small-payload tail of a path whose typical case clears the floor
2670
+ // reads as "your primary is wrong" when the accurate statement is
2671
+ // "this call landed here." Ground truth for the wording: tt-intel's
2672
+ // open critical is `gemini-2.5-flash-lite` (ask, 5/10) selected at
2673
+ // ~2.1K tokens_in, while `claude-opus-5` served the same archetype at
2674
+ // ~22K the same day — cc read the evidence set as self-contradictory
2675
+ // precisely because the text did not say which call it described.
2676
+ suggestion: `This fired for \`${profile.id}\`, the model selected for THIS call \u2014 selection is input-size dependent, so other calls on \`${ir.intent.archetype}\` may pick a different model that clears the floor. Swap to a model whose archetypePerf for ${ir.intent.archetype} clears the floor. Use \`getModelCompatibility(candidateId, { archetype: '${ir.intent.archetype}' })\` to vet candidates, or \`getDefaultFallbackChain({ archetype: '${ir.intent.archetype}', posture: 'open' })\` for a library-picked chain that respects the floor by construction \u2014 note that chain is ordered by archetype performance, NOT cost, so it may select a pricier primary than you run today. Add \`optimizeFor: 'cost'\` for a chain that clears the same floor cheapest-first. To stop this model being selected at all, pass \`policy.blockedModels: ['${profile.id}']\`.`,
2669
2677
  recommendationType: "model-swap",
2670
2678
  docsUrl: "https://github.com/stue/command-center/blob/main/interfaces/kgauto.md#best-practice-advisories"
2671
2679
  }
@@ -3959,13 +3967,16 @@ var FAILED = /* @__PURE__ */ Symbol("parse-failed");
3959
3967
 
3960
3968
  // src/ir.ts
3961
3969
  function mutationId(m) {
3962
- return typeof m === "string" ? m : m.id;
3970
+ if (m == null) return void 0;
3971
+ if (typeof m === "string") return m;
3972
+ return typeof m.id === "string" ? m.id : void 0;
3963
3973
  }
3964
3974
  function hasMutation(list, idOrPrefix) {
3965
3975
  if (!Array.isArray(list)) return false;
3966
3976
  const prefix = idOrPrefix.endsWith("*") ? idOrPrefix.slice(0, -1) : void 0;
3967
3977
  return list.some((m) => {
3968
3978
  const id = mutationId(m);
3979
+ if (id === void 0) return false;
3969
3980
  return prefix !== void 0 ? id.startsWith(prefix) : id === idOrPrefix;
3970
3981
  });
3971
3982
  }
@@ -454,7 +454,7 @@ type MutationApplied = {
454
454
  * type can change without breaking a live consumer, so the fix is an
455
455
  * accessor that is correct on both.
456
456
  */
457
- declare function mutationId(m: string | MutationApplied): string;
457
+ declare function mutationId(m: string | MutationApplied | null | undefined): string | undefined;
458
458
  /**
459
459
  * alpha.78 — does any mutation in the list match `idOrPrefix` (exact id, or
460
460
  * prefix when it ends with `*`)? Works on both `mutationsApplied` element
@@ -454,7 +454,7 @@ type MutationApplied = {
454
454
  * type can change without breaking a live consumer, so the fix is an
455
455
  * accessor that is correct on both.
456
456
  */
457
- declare function mutationId(m: string | MutationApplied): string;
457
+ declare function mutationId(m: string | MutationApplied | null | undefined): string | undefined;
458
458
  /**
459
459
  * alpha.78 — does any mutation in the list match `idOrPrefix` (exact id, or
460
460
  * prefix when it ends with `*`)? Works on both `mutationsApplied` element
@@ -28,7 +28,7 @@ __export(key_health_exports, {
28
28
  module.exports = __toCommonJS(key_health_exports);
29
29
 
30
30
  // src/version.ts
31
- var LIBRARY_VERSION = "2.0.0-alpha.81";
31
+ var LIBRARY_VERSION = "2.0.0-alpha.82";
32
32
 
33
33
  // src/key-health.ts
34
34
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -3,7 +3,7 @@ import {
3
3
  KEY_FINGERPRINT_LENGTH,
4
4
  createKeyHealthRoute,
5
5
  keyFingerprint
6
- } from "./chunk-OZNAGO4U.mjs";
6
+ } from "./chunk-L246YOV7.mjs";
7
7
  export {
8
8
  KEY_FINGERPRINT_DOMAIN,
9
9
  KEY_FINGERPRINT_LENGTH,
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-BFwWhj2s.mjs';
1
+ import { k as Provider } from './ir-D4S9R816.mjs';
2
2
  import { IntentArchetypeName } from './dialect.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-DZKS1tI7.js';
1
+ import { k as Provider } from './ir-Cx9hJj0B.js';
2
2
  import { IntentArchetypeName } from './dialect.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-DZKS1tI7.js';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-Cx9hJj0B.js';
2
2
 
3
3
  /**
4
4
  * Glass-Box observability types (alpha.17).
@@ -1,4 +1,4 @@
1
- import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-BFwWhj2s.mjs';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-D4S9R816.mjs';
2
2
 
3
3
  /**
4
4
  * Glass-Box observability types (alpha.17).
@@ -1,4 +1,4 @@
1
- import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-DZKS1tI7.js';
1
+ import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-Cx9hJj0B.js';
2
2
 
3
3
  /**
4
4
  * Wire contract for the Glass-Box Chrome extension's brain-poll endpoint.
@@ -1,4 +1,4 @@
1
- import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-BFwWhj2s.mjs';
1
+ import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-D4S9R816.mjs';
2
2
 
3
3
  /**
4
4
  * Wire contract for the Glass-Box Chrome extension's brain-poll endpoint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmdrift/kgauto-compiler",
3
- "version": "2.0.0-alpha.81",
3
+ "version": "2.0.0-alpha.82",
4
4
  "description": "Prompt compiler with executable provider knowledge for multi-model AI apps: normalized multi-provider transport with fallback chains, compile-time cliff guards, a curated model registry, and a telemetry flight recorder. Swap models without rewriting prompts.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -60,6 +60,7 @@
60
60
  "build": "tsup src/index.ts src/dialect.ts src/profiles.ts src/brain-proxy.ts src/key-health.ts src/glassbox/index.ts src/glassbox-routes/index.ts src/glassbox-routes/format.ts src/glassbox-routes/react/index.ts --format cjs,esm --dts --clean --external react --external react-dom",
61
61
  "test": "vitest run",
62
62
  "test:watch": "vitest",
63
+ "test:stress": "node scripts/stress-test.mjs",
63
64
  "typecheck": "tsc --noEmit",
64
65
  "prepublishOnly": "npm run typecheck && npm run test && npm run build"
65
66
  },