@warmdrift/kgauto-compiler 2.0.0-alpha.97 → 2.0.0-alpha.99

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 (37) hide show
  1. package/dist/{chunk-77AHSX6Y.mjs → chunk-2YCTWV4S.mjs} +1 -1
  2. package/dist/{chunk-AFYBZRQV.mjs → chunk-G33BUB43.mjs} +96 -20
  3. package/dist/{chunk-IEEROFZW.mjs → chunk-L3VBUB4I.mjs} +1 -1
  4. package/dist/{chunk-HHIXHL4O.mjs → chunk-PY4CBZFF.mjs} +12 -2
  5. package/dist/{compile-C2IfAGV1.d.mts → compile-hh_l7COL.d.mts} +1 -1
  6. package/dist/{compile-BlMXv6QT.d.ts → compile-nNpq-6yu.d.ts} +1 -1
  7. package/dist/glassbox/index.d.mts +3 -3
  8. package/dist/glassbox/index.d.ts +3 -3
  9. package/dist/glassbox-routes/format.d.mts +2 -2
  10. package/dist/glassbox-routes/format.d.ts +2 -2
  11. package/dist/glassbox-routes/index.d.mts +4 -4
  12. package/dist/glassbox-routes/index.d.ts +4 -4
  13. package/dist/glassbox-routes/index.js +12 -2
  14. package/dist/glassbox-routes/index.mjs +2 -2
  15. package/dist/glassbox-routes/react/index.d.mts +2 -2
  16. package/dist/glassbox-routes/react/index.d.ts +2 -2
  17. package/dist/index.d.mts +74 -9
  18. package/dist/index.d.ts +74 -9
  19. package/dist/index.js +109 -23
  20. package/dist/index.mjs +6 -6
  21. package/dist/{ir-DyMJ84je.d.mts → ir-BZ2qOPMp.d.mts} +13 -0
  22. package/dist/{ir-DbvOFKF-.d.ts → ir-CpkidtAd.d.ts} +13 -0
  23. package/dist/key-health.js +1 -1
  24. package/dist/key-health.mjs +1 -1
  25. package/dist/probe.d.mts +2 -2
  26. package/dist/probe.d.ts +2 -2
  27. package/dist/probe.js +106 -20
  28. package/dist/probe.mjs +3 -3
  29. package/dist/profiles.d.mts +1 -1
  30. package/dist/profiles.d.ts +1 -1
  31. package/dist/profiles.js +12 -2
  32. package/dist/profiles.mjs +1 -1
  33. package/dist/{types-D441T-KC.d.mts → types-BkdfoONZ.d.mts} +1 -1
  34. package/dist/{types-5TqjBeZD.d.ts → types-Bn-zF0S4.d.ts} +1 -1
  35. package/dist/{types-_myk4bxn.d.mts → types-DJFlO7ux.d.mts} +1 -1
  36. package/dist/{types-BlrbNQfj.d.ts → types-uWypgaAU.d.ts} +1 -1
  37. package/package.json +1 -1
@@ -2,7 +2,7 @@ import {
2
2
  allProfiles,
3
3
  resolveModelAlias,
4
4
  tryGetProfile
5
- } from "./chunk-HHIXHL4O.mjs";
5
+ } from "./chunk-PY4CBZFF.mjs";
6
6
 
7
7
  // src/brain-query.ts
8
8
  var FRESH_SNAPSHOT = {
@@ -9,7 +9,7 @@ import {
9
9
  getModelCompatibility,
10
10
  isBrainQueryActiveFor,
11
11
  policySetHas
12
- } from "./chunk-77AHSX6Y.mjs";
12
+ } from "./chunk-2YCTWV4S.mjs";
13
13
  import {
14
14
  bucketContext,
15
15
  bucketHistory,
@@ -30,7 +30,7 @@ import {
30
30
  latencyTierOf,
31
31
  resolveModelAlias,
32
32
  tryGetProfile
33
- } from "./chunk-HHIXHL4O.mjs";
33
+ } from "./chunk-PY4CBZFF.mjs";
34
34
 
35
35
  // src/models-brain.ts
36
36
  function isModelRow(x) {
@@ -1146,12 +1146,19 @@ function mapRows(rows) {
1146
1146
  if (!isRawFailureRow(row)) continue;
1147
1147
  const n = coerceCount(row.n);
1148
1148
  const nFail = coerceCount(row.n_fail) ?? 0;
1149
- if (n === null || n <= 0) continue;
1149
+ const nAttempted = coerceCount(row.n_attempted);
1150
+ const nUnavailable = coerceCount(row.n_unavailable) ?? 0;
1151
+ const nUnclassified = coerceCount(row.n_unclassified) ?? 0;
1152
+ if (n === null) continue;
1153
+ if (n <= 0 && nUnavailable <= 0) continue;
1150
1154
  out.push({
1151
1155
  archetype: row.intent_archetype,
1152
1156
  model: row.model,
1153
1157
  n,
1154
- nFail
1158
+ nFail,
1159
+ nAttempted: nAttempted ?? n,
1160
+ nUnavailable,
1161
+ nUnclassified
1155
1162
  });
1156
1163
  }
1157
1164
  return out;
@@ -1175,7 +1182,24 @@ var MEASURED_FAILURE_CFG = {
1175
1182
  /** 95% one-sided-ish confidence (standard two-sided z at α=0.05). */
1176
1183
  z: 1.96,
1177
1184
  /** Must match the view's window. Documented here for the advisory text. */
1178
- windowDays: 28
1185
+ windowDays: 28,
1186
+ /**
1187
+ * alpha.98 — the AVAILABILITY axis. Same statistic, separate vocabulary,
1188
+ * separate verdict, because a 429 and a parse-failure send an operator in
1189
+ * opposite directions (fund or throttle the account vs. distrust the
1190
+ * model's declared structuredOutput). Merging them into one "failure rate"
1191
+ * is the s75 normalization defect.
1192
+ *
1193
+ * Thresholds match the quality axis deliberately: "we are 95% confident
1194
+ * this model is unreachable more often than not" is the same unarguable
1195
+ * bar, and a de-rank is the same remedy. Kept as a distinct config block
1196
+ * so the two can be tuned apart when evidence says they should be.
1197
+ */
1198
+ availability: {
1199
+ minSample: 5,
1200
+ lowerBoundThreshold: 0.5,
1201
+ z: 1.96
1202
+ }
1179
1203
  };
1180
1204
  function wilsonLowerBound(failures, n, z = MEASURED_FAILURE_CFG.z) {
1181
1205
  if (n <= 0) return 0;
@@ -1192,15 +1216,53 @@ function mapMeasuredFailureRows(rows) {
1192
1216
  }
1193
1217
  function judgeMeasuredFailure(row, cfg = MEASURED_FAILURE_CFG) {
1194
1218
  if (!row) return void 0;
1195
- const normalized = "nFail" in row && typeof row.n === "number" ? row : mapRows([row])[0];
1196
- if (!normalized || normalized.n < cfg.minSample) return void 0;
1197
- const lowerBound = wilsonLowerBound(normalized.nFail, normalized.n, cfg.z);
1219
+ const raw = "nFail" in row && typeof row.n === "number" ? row : mapRows([row])[0];
1220
+ if (!raw) return void 0;
1221
+ const normalized = {
1222
+ ...raw,
1223
+ nAttempted: typeof raw.nAttempted === "number" ? raw.nAttempted : raw.n,
1224
+ nUnavailable: typeof raw.nUnavailable === "number" ? raw.nUnavailable : 0,
1225
+ nUnclassified: typeof raw.nUnclassified === "number" ? raw.nUnclassified : 0
1226
+ };
1227
+ const quality = judgeAxis(
1228
+ normalized.nFail,
1229
+ normalized.n,
1230
+ cfg.minSample,
1231
+ cfg.lowerBoundThreshold,
1232
+ cfg.z
1233
+ );
1234
+ const availability = judgeAxis(
1235
+ normalized.nUnavailable,
1236
+ normalized.nAttempted,
1237
+ cfg.availability.minSample,
1238
+ cfg.availability.lowerBoundThreshold,
1239
+ cfg.availability.z
1240
+ );
1241
+ if (normalized.n < cfg.minSample && normalized.nAttempted < cfg.availability.minSample) {
1242
+ return void 0;
1243
+ }
1244
+ const axis = quality.gated ? "quality" : availability.gated ? "availability" : void 0;
1245
+ const lead = axis === "availability" ? availability : quality;
1246
+ return {
1247
+ gated: quality.gated || availability.gated,
1248
+ axis,
1249
+ rate: lead.rate,
1250
+ lowerBound: lead.lowerBound,
1251
+ n: lead.n,
1252
+ nFail: lead.nFail,
1253
+ quality,
1254
+ availability,
1255
+ nUnclassified: normalized.nUnclassified
1256
+ };
1257
+ }
1258
+ function judgeAxis(failures, n, minSample, threshold, z) {
1259
+ const lowerBound = wilsonLowerBound(failures, n, z);
1198
1260
  return {
1199
- gated: lowerBound > cfg.lowerBoundThreshold,
1200
- rate: normalized.nFail / normalized.n,
1261
+ rate: n > 0 ? failures / n : 0,
1201
1262
  lowerBound,
1202
- n: normalized.n,
1203
- nFail: normalized.nFail
1263
+ n,
1264
+ nFail: failures,
1265
+ gated: n >= minSample && lowerBound > threshold
1204
1266
  };
1205
1267
  }
1206
1268
  var snapshots2 = /* @__PURE__ */ new Map();
@@ -2242,9 +2304,13 @@ function detectSingleModelArray(ir, policy) {
2242
2304
  ];
2243
2305
  }
2244
2306
  function suppressedRecommendationReason(ir, archetype, altProfile) {
2245
- if (getMeasuredFailureVerdict({ appId: ir.appId, archetype, model: altProfile.id })?.gated === true) {
2246
- return "measured-failure-gate";
2247
- }
2307
+ const measured = getMeasuredFailureVerdict({
2308
+ appId: ir.appId,
2309
+ archetype,
2310
+ model: altProfile.id
2311
+ });
2312
+ if (measured?.quality.gated === true) return "measured-failure-gate";
2313
+ if (measured?.availability.gated === true) return "measured-unavailable-gate";
2248
2314
  if (ir.constraints?.structuredOutput && effectiveConventions(altProfile).some(
2249
2315
  (c) => c.archetype === archetype && c.structuredOutputHint === "avoid"
2250
2316
  )) {
@@ -2755,7 +2821,7 @@ function lowerGoogle(ir, profile, hints) {
2755
2821
  if (hints.forceTerseOutput) {
2756
2822
  generationConfig.maxOutputTokens = 200;
2757
2823
  }
2758
- if (ir.constraints?.structuredOutput && profile.structuredOutput === "native") {
2824
+ if (ir.constraints?.structuredOutput && profile.structuredOutput !== "none") {
2759
2825
  generationConfig.responseMimeType = "application/json";
2760
2826
  }
2761
2827
  const contents = buildGoogleContents(ir.history ?? [], ir.currentTurn);
@@ -2814,7 +2880,9 @@ function toGoogleTools(tools) {
2814
2880
  }
2815
2881
  function lowerOpenAI(ir, profile, hints) {
2816
2882
  const ordered = sortSections(ir.sections);
2817
- const systemText = ordered.map((s) => s.text).join("\n\n");
2883
+ const sectionText = ordered.map((s) => s.text).join("\n\n");
2884
+ const jsonInstruction = ir.constraints?.structuredOutput ? "Respond with a single valid JSON value and nothing else. Do not wrap the JSON in a markdown code fence, and do not add any prose before or after it." : "";
2885
+ const systemText = [sectionText, jsonInstruction].filter(Boolean).join("\n\n");
2818
2886
  const systemRole = profile.systemPromptMode === "as_developer" ? "developer" : "system";
2819
2887
  const messages = systemText ? [{ role: systemRole, content: systemText }] : [];
2820
2888
  for (const m of ir.history ?? []) {
@@ -2860,7 +2928,9 @@ function toOpenAITools(tools) {
2860
2928
  }
2861
2929
  function lowerDeepSeek(ir, profile, hints) {
2862
2930
  const ordered = sortSections(ir.sections);
2863
- const systemText = ordered.map((s) => s.text).join("\n\n");
2931
+ const sectionText = ordered.map((s) => s.text).join("\n\n");
2932
+ const jsonInstruction = ir.constraints?.structuredOutput ? "Respond with a single valid JSON value and nothing else. Do not wrap the JSON in a markdown code fence, and do not add any prose before or after it." : "";
2933
+ const systemText = [sectionText, jsonInstruction].filter(Boolean).join("\n\n");
2864
2934
  const messages = systemText ? [{ role: "system", content: systemText }] : [];
2865
2935
  for (const m of ir.history ?? []) {
2866
2936
  if (m.role === "system") continue;
@@ -2880,6 +2950,9 @@ function lowerDeepSeek(ir, profile, hints) {
2880
2950
  provider: "deepseek",
2881
2951
  model: profile.id,
2882
2952
  messages,
2953
+ // Safe only because `jsonInstruction` above guarantees the literal word
2954
+ // "json" reaches the prompt — DeepSeek 400s otherwise (measurement C).
2955
+ response_format: ir.constraints?.structuredOutput ? { type: "json_object" } : void 0,
2883
2956
  // Every tool the IR carries. Never fewer — see the note above.
2884
2957
  tools: ir.tools && ir.tools.length > 0 ? ir.tools.map((t) => ({
2885
2958
  type: "function",
@@ -2899,7 +2972,9 @@ function lowerDeepSeek(ir, profile, hints) {
2899
2972
  }
2900
2973
  function buildOpenAICompatibleParts(ir) {
2901
2974
  const ordered = sortSections(ir.sections);
2902
- const systemText = ordered.map((s) => s.text).join("\n\n");
2975
+ const sectionText = ordered.map((s) => s.text).join("\n\n");
2976
+ const jsonInstruction = ir.constraints?.structuredOutput ? "Respond with a single valid JSON value and nothing else. Do not wrap the JSON in a markdown code fence, and do not add any prose before or after it." : "";
2977
+ const systemText = [sectionText, jsonInstruction].filter(Boolean).join("\n\n");
2903
2978
  const messages = systemText ? [{ role: "system", content: systemText }] : [];
2904
2979
  for (const m of ir.history ?? []) {
2905
2980
  if (m.role === "system") continue;
@@ -3057,7 +3132,8 @@ function compile(ir, opts = {}) {
3057
3132
  rate: verdict.rate,
3058
3133
  lowerBound: verdict.lowerBound,
3059
3134
  n: verdict.n,
3060
- nFail: verdict.nFail
3135
+ nFail: verdict.nFail,
3136
+ axis: verdict.axis ?? "quality"
3061
3137
  });
3062
3138
  }
3063
3139
  }
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var LIBRARY_VERSION = "2.0.0-alpha.97";
2
+ var LIBRARY_VERSION = "2.0.0-alpha.99";
3
3
 
4
4
  // src/key-health.ts
5
5
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -805,7 +805,12 @@ var PROFILES_RAW = [
805
805
  // "7-8 calls per step" — which was never a claim that only one tool may be
806
806
  // offered. See the note in lower.ts:lowerDeepSeek.
807
807
  parallelToolCalls: true,
808
- structuredOutput: "native",
808
+ structuredOutput: "grammar",
809
+ // alpha.99 — MEASURED 2026-08-29: DeepSeek rejects
810
+ // `response_format: {type:'json_schema'}` outright ("This response_format type is
811
+ // unavailable now"), so there is no schema-enforced mode for `'native'` to name.
812
+ // It supports `json_object` only, and only when the prompt contains the literal
813
+ // word "json" — the lowering emits the instruction that guarantees it.
809
814
  systemPromptMode: "inline",
810
815
  streaming: true,
811
816
  // alpha.96 — the `tool_count@1 -> drop_to_top_relevant` cliff was DELETED.
@@ -899,7 +904,12 @@ var PROFILES_RAW = [
899
904
  // "7-8 calls per step" — which was never a claim that only one tool may be
900
905
  // offered. See the note in lower.ts:lowerDeepSeek.
901
906
  parallelToolCalls: true,
902
- structuredOutput: "native",
907
+ structuredOutput: "grammar",
908
+ // alpha.99 — MEASURED 2026-08-29: DeepSeek rejects
909
+ // `response_format: {type:'json_schema'}` outright ("This response_format type is
910
+ // unavailable now"), so there is no schema-enforced mode for `'native'` to name.
911
+ // It supports `json_object` only, and only when the prompt contains the literal
912
+ // word "json" — the lowering emits the instruction that guarantees it.
903
913
  systemPromptMode: "inline",
904
914
  streaming: true,
905
915
  // alpha.96 — the `tool_count@1 -> drop_to_top_relevant` cliff was DELETED.
@@ -1,4 +1,4 @@
1
- import { a as CompilePolicy } from './ir-DyMJ84je.mjs';
1
+ import { a as CompilePolicy } from './ir-BZ2qOPMp.mjs';
2
2
  import { ModelProfile } from './profiles.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as CompilePolicy } from './ir-DbvOFKF-.js';
1
+ import { a as CompilePolicy } from './ir-CpkidtAd.js';
2
2
  import { ModelProfile } from './profiles.js';
3
3
 
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-_myk4bxn.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-_myk4bxn.mjs';
3
- import '../ir-DyMJ84je.mjs';
1
+ import { G as GlassboxEvent } from '../types-DJFlO7ux.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-DJFlO7ux.mjs';
3
+ import '../ir-BZ2qOPMp.mjs';
4
4
  import '../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-BlrbNQfj.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-BlrbNQfj.js';
3
- import '../ir-DbvOFKF-.js';
1
+ import { G as GlassboxEvent } from '../types-uWypgaAU.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-uWypgaAU.js';
3
+ import '../ir-CpkidtAd.js';
4
4
  import '../dialect.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-D441T-KC.mjs';
2
- import '../ir-DyMJ84je.mjs';
1
+ import { T as TraceHealth } from '../types-BkdfoONZ.mjs';
2
+ import '../ir-BZ2qOPMp.mjs';
3
3
  import '../dialect.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-5TqjBeZD.js';
2
- import '../ir-DbvOFKF-.js';
1
+ import { T as TraceHealth } from '../types-Bn-zF0S4.js';
2
+ import '../ir-CpkidtAd.js';
3
3
  import '../dialect.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-_myk4bxn.mjs';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-D441T-KC.mjs';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-D441T-KC.mjs';
4
- import '../ir-DyMJ84je.mjs';
1
+ import { G as GlassboxEvent } from '../types-DJFlO7ux.mjs';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-BkdfoONZ.mjs';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-BkdfoONZ.mjs';
4
+ import '../ir-BZ2qOPMp.mjs';
5
5
  import '../dialect.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-BlrbNQfj.js';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-5TqjBeZD.js';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-5TqjBeZD.js';
4
- import '../ir-DbvOFKF-.js';
1
+ import { G as GlassboxEvent } from '../types-uWypgaAU.js';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-Bn-zF0S4.js';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-Bn-zF0S4.js';
4
+ import '../ir-CpkidtAd.js';
5
5
  import '../dialect.js';
6
6
 
7
7
  /**
@@ -850,7 +850,12 @@ var PROFILES_RAW = [
850
850
  // "7-8 calls per step" — which was never a claim that only one tool may be
851
851
  // offered. See the note in lower.ts:lowerDeepSeek.
852
852
  parallelToolCalls: true,
853
- structuredOutput: "native",
853
+ structuredOutput: "grammar",
854
+ // alpha.99 — MEASURED 2026-08-29: DeepSeek rejects
855
+ // `response_format: {type:'json_schema'}` outright ("This response_format type is
856
+ // unavailable now"), so there is no schema-enforced mode for `'native'` to name.
857
+ // It supports `json_object` only, and only when the prompt contains the literal
858
+ // word "json" — the lowering emits the instruction that guarantees it.
854
859
  systemPromptMode: "inline",
855
860
  streaming: true,
856
861
  // alpha.96 — the `tool_count@1 -> drop_to_top_relevant` cliff was DELETED.
@@ -944,7 +949,12 @@ var PROFILES_RAW = [
944
949
  // "7-8 calls per step" — which was never a claim that only one tool may be
945
950
  // offered. See the note in lower.ts:lowerDeepSeek.
946
951
  parallelToolCalls: true,
947
- structuredOutput: "native",
952
+ structuredOutput: "grammar",
953
+ // alpha.99 — MEASURED 2026-08-29: DeepSeek rejects
954
+ // `response_format: {type:'json_schema'}` outright ("This response_format type is
955
+ // unavailable now"), so there is no schema-enforced mode for `'native'` to name.
956
+ // It supports `json_object` only, and only when the prompt contains the literal
957
+ // word "json" — the lowering emits the instruction that guarantees it.
948
958
  systemPromptMode: "inline",
949
959
  streaming: true,
950
960
  // alpha.96 — the `tool_count@1 -> drop_to_top_relevant` cliff was DELETED.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ARCHETYPE_FLOOR_DEFAULT,
3
3
  getDefaultFallbackChain
4
- } from "../chunk-77AHSX6Y.mjs";
4
+ } from "../chunk-2YCTWV4S.mjs";
5
5
  import {
6
6
  tryGetProfile
7
- } from "../chunk-HHIXHL4O.mjs";
7
+ } from "../chunk-PY4CBZFF.mjs";
8
8
  import {
9
9
  subscribe,
10
10
  subscribeApp
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as TraceDetail } from '../../types-D441T-KC.mjs';
3
- import '../../ir-DyMJ84je.mjs';
2
+ import { a as TraceDetail } from '../../types-BkdfoONZ.mjs';
3
+ import '../../ir-BZ2qOPMp.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-5TqjBeZD.js';
3
- import '../../ir-DbvOFKF-.js';
2
+ import { a as TraceDetail } from '../../types-Bn-zF0S4.js';
3
+ import '../../ir-CpkidtAd.js';
4
4
  import '../../dialect.js';
5
5
 
6
6
  /**
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as CompileOptions } from './compile-C2IfAGV1.mjs';
2
- import { N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, C as CompiledRequest, a as CompilePolicy, 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 OutcomeSource, i as OracleScore, j as Adapter, k as PerAxisMetrics, l as Provider, m as ChainEntry, G as Grounding } from './ir-DyMJ84je.mjs';
3
- export { n as CallAttempt, o as CallError, p as ChainModelEntry, q as ChainWithGrounding, r as Constraints, E as EffortLevel, s as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, t as MutationApplied, u as NormalizedTokens, v as OutcomeKind, w as PerAxisMetricsByModel, x as PromptSection, y as SectionKind, z as ShadowProbeConfig, T as ToolCall, D as ToolDefinition, J as captureGoldenIr, K as hasMutation, L as mutationId, Q as parseGoldenCaptureRate, U as resolveGoldenCaptureRate, V as shouldCaptureGolden } from './ir-DyMJ84je.mjs';
1
+ import { C as CompileOptions } from './compile-hh_l7COL.mjs';
2
+ import { N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, C as CompiledRequest, a as CompilePolicy, 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 OutcomeSource, i as OracleScore, j as Adapter, k as PerAxisMetrics, l as Provider, m as ChainEntry, G as Grounding } from './ir-BZ2qOPMp.mjs';
3
+ export { n as CallAttempt, o as CallError, p as ChainModelEntry, q as ChainWithGrounding, r as Constraints, E as EffortLevel, s as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, t as MutationApplied, u as NormalizedTokens, v as OutcomeKind, w as PerAxisMetricsByModel, x as PromptSection, y as SectionKind, z as ShadowProbeConfig, T as ToolCall, D as ToolDefinition, J as captureGoldenIr, K as hasMutation, L as mutationId, Q as parseGoldenCaptureRate, U as resolveGoldenCaptureRate, V as shouldCaptureGolden } from './ir-BZ2qOPMp.mjs';
4
4
  export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.mjs';
5
5
  export { KEY_FINGERPRINT_DOMAIN, KEY_FINGERPRINT_LENGTH, KeyHealthConfig, KeyHealthProvider, KeyHealthResponseBody, KeyHealthResult, KeyHealthRoute, createKeyHealthRoute, keyFingerprint } from './key-health.mjs';
6
6
  import { ModelProfile, ArchetypeConvention, ProbedLimit } from './profiles.mjs';
@@ -1241,7 +1241,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
1241
1241
  * guard in `tests/version.test.ts` fails the suite (and therefore
1242
1242
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
1243
1243
  */
1244
- declare const LIBRARY_VERSION = "2.0.0-alpha.97";
1244
+ declare const LIBRARY_VERSION = "2.0.0-alpha.99";
1245
1245
 
1246
1246
  /**
1247
1247
  * Oracle contract — how an app tells the brain whether a response was good.
@@ -3735,10 +3735,26 @@ declare function _testWaitForPromotionsRefresh(): Promise<void>;
3735
3735
  interface SurfaceFailureRow {
3736
3736
  archetype: string;
3737
3737
  model: string;
3738
- /** Total attempts in-window (served + quality walkaways). */
3738
+ /**
3739
+ * QUALITY-axis denominator: attempts that produced something judgeable
3740
+ * (served + quality walkaways). Excludes calls that never reached an
3741
+ * answer — a 429 is not a trial of the model's quality. See migration 071.
3742
+ */
3739
3743
  n: number;
3740
3744
  /** Attempts that failed on the quality axis. */
3741
3745
  nFail: number;
3746
+ /**
3747
+ * alpha.98 — AVAILABILITY-axis denominator: every served attempt is a
3748
+ * trial of whether the model can be reached at all.
3749
+ */
3750
+ nAttempted: number;
3751
+ /** Attempts that never reached an answer — 429, auth, timeout, transport. */
3752
+ nUnavailable: number;
3753
+ /**
3754
+ * Failures in NEITHER vocabulary. Carried so the taxonomy's blind spot is
3755
+ * a number rather than silence; not gated on.
3756
+ */
3757
+ nUnclassified: number;
3742
3758
  }
3743
3759
  declare const MEASURED_FAILURE_CFG: {
3744
3760
  /**
@@ -3760,6 +3776,23 @@ declare const MEASURED_FAILURE_CFG: {
3760
3776
  readonly z: 1.96;
3761
3777
  /** Must match the view's window. Documented here for the advisory text. */
3762
3778
  readonly windowDays: 28;
3779
+ /**
3780
+ * alpha.98 — the AVAILABILITY axis. Same statistic, separate vocabulary,
3781
+ * separate verdict, because a 429 and a parse-failure send an operator in
3782
+ * opposite directions (fund or throttle the account vs. distrust the
3783
+ * model's declared structuredOutput). Merging them into one "failure rate"
3784
+ * is the s75 normalization defect.
3785
+ *
3786
+ * Thresholds match the quality axis deliberately: "we are 95% confident
3787
+ * this model is unreachable more often than not" is the same unarguable
3788
+ * bar, and a de-rank is the same remedy. Kept as a distinct config block
3789
+ * so the two can be tuned apart when evidence says they should be.
3790
+ */
3791
+ readonly availability: {
3792
+ readonly minSample: 5;
3793
+ readonly lowerBoundThreshold: 0.5;
3794
+ readonly z: 1.96;
3795
+ };
3763
3796
  };
3764
3797
  /**
3765
3798
  * Wilson score interval, lower bound. Preferred over the normal
@@ -3771,16 +3804,45 @@ declare const MEASURED_FAILURE_CFG: {
3771
3804
  * Returns 0 for n <= 0.
3772
3805
  */
3773
3806
  declare function wilsonLowerBound(failures: number, n: number, z?: number): number;
3807
+ /** One axis's numbers. Same statistic, different vocabulary. */
3808
+ interface FailureAxisVerdict {
3809
+ /** Observed failure rate in-window on this axis. */
3810
+ rate: number;
3811
+ /** 95% lower confidence bound on that rate — what the gate tests. */
3812
+ lowerBound: number;
3813
+ /** Attempts backing this axis. */
3814
+ n: number;
3815
+ /** Failures on this axis. */
3816
+ nFail: number;
3817
+ /** Whether this axis on its own clears the bar. */
3818
+ gated: boolean;
3819
+ }
3774
3820
  interface MeasuredFailureVerdict {
3775
- /** Whether the measured-failure quality gate fires for this tuple. */
3821
+ /** Whether a measured-failure gate fires for this tuple, on EITHER axis. */
3776
3822
  gated: boolean;
3777
- /** Observed failure rate in-window. */
3823
+ /**
3824
+ * alpha.98 — which axis fired. Undefined when `gated` is false. Read this
3825
+ * before rendering `rate`/`n`: the same number means "answered badly" on
3826
+ * one axis and "could not be reached" on the other, and the fixes differ.
3827
+ * When both axes fire, `'quality'` wins the label — the model is reachable
3828
+ * enough to have been judged, so its answers are the actionable half.
3829
+ */
3830
+ axis?: 'quality' | 'availability';
3831
+ /**
3832
+ * The numbers that JUSTIFY the gate — i.e. drawn from `axis` when gated,
3833
+ * and from the quality axis otherwise. Deliberately not always-quality:
3834
+ * a consumer printing "gated: 0% over 16" for a model that 429'd 42 times
3835
+ * would be reporting a true number as an explanation of the wrong thing.
3836
+ */
3778
3837
  rate: number;
3779
- /** 95% lower confidence bound on that rate — what the gate tests. */
3780
3838
  lowerBound: number;
3781
- /** Attempts backing the verdict. */
3782
3839
  n: number;
3783
3840
  nFail: number;
3841
+ /** Both axes, always present, so a caller never has to infer one. */
3842
+ quality: FailureAxisVerdict;
3843
+ availability: FailureAxisVerdict;
3844
+ /** Failures in neither vocabulary. Not gated on; surfaced for visibility. */
3845
+ nUnclassified: number;
3784
3846
  }
3785
3847
  /**
3786
3848
  * alpha.78 — public row normalizer (PB 2026-07-25 trap): the counts
@@ -3805,6 +3867,9 @@ declare function judgeMeasuredFailure(row: SurfaceFailureRow | {
3805
3867
  model: string;
3806
3868
  n: number | string;
3807
3869
  n_fail: number | string;
3870
+ n_attempted?: number | string;
3871
+ n_unavailable?: number | string;
3872
+ n_unclassified?: number | string;
3808
3873
  } | undefined, cfg?: typeof MEASURED_FAILURE_CFG): MeasuredFailureVerdict | undefined;
3809
3874
  interface MeasuredFailureRuntime {
3810
3875
  /** Endpoint base URL. The library appends `?app_id=<id>`. */