@warmdrift/kgauto-compiler 2.0.0-alpha.70 → 2.0.0-alpha.72

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,6 +1,6 @@
1
1
  import {
2
2
  tryGetProfile
3
- } from "./chunk-4UO4CCSP.mjs";
3
+ } from "./chunk-N36LE3MK.mjs";
4
4
 
5
5
  // src/brain-query.ts
6
6
  var FRESH_SNAPSHOT = {
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var LIBRARY_VERSION = "2.0.0-alpha.70";
2
+ var LIBRARY_VERSION = "2.0.0-alpha.72";
3
3
 
4
4
  // src/key-health.ts
5
5
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -47,7 +47,8 @@ var PROFILES_RAW = [
47
47
  id: "claude-fable-5",
48
48
  verifiedAgainstDocs: "2026-06-21",
49
49
  provider: "anthropic",
50
- status: "preview",
50
+ status: "current",
51
+ // s76 2026-07-25: GA since 2026-06-09 per docs; was preview.
51
52
  maxContextTokens: 1e6,
52
53
  maxOutputTokens: 128e3,
53
54
  maxTools: 64,
@@ -101,7 +102,8 @@ var PROFILES_RAW = [
101
102
  id: "claude-opus-4-8",
102
103
  verifiedAgainstDocs: "2026-06-21",
103
104
  provider: "anthropic",
104
- status: "current",
105
+ status: "legacy",
106
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 generation is current).
105
107
  maxContextTokens: 1e6,
106
108
  maxOutputTokens: 128e3,
107
109
  maxTools: 64,
@@ -141,11 +143,78 @@ var PROFILES_RAW = [
141
143
  classify: 8
142
144
  }
143
145
  },
146
+ {
147
+ // ── Claude Opus 5 — added s76 (2026-07-25, alpha.72) ──────────────────
148
+ // The model every seat in the portfolio actually runs, absent from the
149
+ // roster until now. Found by a catalog QA, not by the release watcher:
150
+ // the watcher detects unknown IDs on a provider's /models endpoint, but
151
+ // detection was never wired to ingestion, so the gap sat open. (That is
152
+ // what `scripts/catalog-sync.mjs` exists to close.)
153
+ //
154
+ // PROVENANCE — doc-verified 2026-07-25 against
155
+ // platform.claude.com/docs/en/docs/about-claude/models/overview:
156
+ // 1M context · 128k max output · $5/$25 per MTok · adaptive thinking YES
157
+ // · extended thinking NO · `effort` defaults to 'high' on the Claude API
158
+ // · reliable knowledge cutoff May 2026.
159
+ //
160
+ // FAMILY-INHERITED (not doc-read): maxTools, parallelToolCalls,
161
+ // structuredOutput, systemPromptMode, streaming. These are identical
162
+ // across opus-4-6 / 4-7 / 4-8 / sonnet-5 / fable-5 — five consecutive
163
+ // models — so they are a structural provider constant rather than a
164
+ // per-model value. Deliberately distinguished from the gemini-3.1-flash-lite
165
+ // failure, where a template-clone of PRICE (the field that actually varies,
166
+ // there by 2.5-3.75x) went unverified for 65 days.
167
+ id: "claude-opus-5",
168
+ verifiedAgainstDocs: "2026-07-25",
169
+ provider: "anthropic",
170
+ status: "current",
171
+ maxContextTokens: 1e6,
172
+ maxOutputTokens: 128e3,
173
+ maxTools: 64,
174
+ parallelToolCalls: true,
175
+ structuredOutput: "grammar",
176
+ systemPromptMode: "inline",
177
+ streaming: true,
178
+ cliffs: [],
179
+ costInputPer1m: 5,
180
+ costOutputPer1m: 25,
181
+ lowering: ANTHROPIC_LOWERING_BASE,
182
+ recovery: [
183
+ {
184
+ signal: "rate_limit",
185
+ action: "escalate",
186
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
187
+ },
188
+ {
189
+ signal: "model_not_found",
190
+ action: "escalate",
191
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
192
+ }
193
+ ],
194
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
195
+ weaknesses: ["cost", "latency"],
196
+ notes: "Anthropic frontier for complex agentic coding + enterprise work; the Opus-tier current default as of 2026-07-25, superseding 4.8/4.7/4.6 (all now legacy). Doc-verified 2026-07-25: 1M ctx, 128k out, $5/$25, adaptive thinking (extended thinking NOT supported \u2014 that is Haiku 4.5 only in this generation), `effort` defaults to high on the Claude API. Price is unchanged from 4.5 through 5 \u2014 the tier moved without a cost change.",
197
+ // COLD-START PRIOR cloned from claude-opus-4-8. Self-labelling: below
198
+ // MEASURED_GROUNDING_MIN_N (10) brain rows these resolve as
199
+ // grounding:'judgment', so nothing reads them as measured until they are.
200
+ archetypePerf: {
201
+ critique: 10,
202
+ plan: 10,
203
+ generate: 9,
204
+ ask: 9,
205
+ extract: 9,
206
+ transform: 9,
207
+ hunt: 8,
208
+ summarize: 8,
209
+ classify: 8
210
+ }
211
+ },
144
212
  {
145
213
  id: "claude-opus-4-7",
146
214
  verifiedAgainstDocs: "2026-05-08",
147
215
  provider: "anthropic",
148
- status: "current",
216
+ status: "legacy",
217
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 is current). Bundle said current while the brain already said legacy — the two disagreed.
149
218
  maxContextTokens: 1e6,
150
219
  maxOutputTokens: 128e3,
151
220
  maxTools: 64,
@@ -239,7 +308,8 @@ var PROFILES_RAW = [
239
308
  id: "claude-sonnet-4-6",
240
309
  verifiedAgainstDocs: "2026-05-08",
241
310
  provider: "anthropic",
242
- status: "current",
311
+ status: "legacy",
312
+ // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
243
313
  maxContextTokens: 1e6,
244
314
  maxOutputTokens: 64e3,
245
315
  maxTools: 64,
@@ -1378,7 +1448,8 @@ var PROFILES_RAW = [
1378
1448
  id: "claude-sonnet-5",
1379
1449
  verifiedAgainstDocs: "2026-07-02",
1380
1450
  provider: "anthropic",
1381
- status: "preview",
1451
+ status: "current",
1452
+ // s76 2026-07-25: GA per docs; was preview.
1382
1453
  maxContextTokens: 1e6,
1383
1454
  maxOutputTokens: 128e3,
1384
1455
  maxTools: 64,
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-DsEq35WY.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-DsEq35WY.mjs';
3
- import '../ir-Bqn1RVdV.mjs';
1
+ import { G as GlassboxEvent } from '../types-BDFrJkma.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-BDFrJkma.mjs';
3
+ import '../ir-CnnJST_N.mjs';
4
4
  import '../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-Bon96eyc.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-Bon96eyc.js';
3
- import '../ir-Bvlkw5ja.js';
1
+ import { G as GlassboxEvent } from '../types-B--CYzMo.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-B--CYzMo.js';
3
+ import '../ir-BEQ28muo.js';
4
4
  import '../dialect.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-CwGhacGT.mjs';
2
- import '../ir-Bqn1RVdV.mjs';
1
+ import { T as TraceHealth } from '../types-DeGRCTlJ.mjs';
2
+ import '../ir-CnnJST_N.mjs';
3
3
  import '../dialect.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-DIxRZ3Dj.js';
2
- import '../ir-Bvlkw5ja.js';
1
+ import { T as TraceHealth } from '../types-DSeJJ6tt.js';
2
+ import '../ir-BEQ28muo.js';
3
3
  import '../dialect.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-DsEq35WY.mjs';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-CwGhacGT.mjs';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-CwGhacGT.mjs';
4
- import '../ir-Bqn1RVdV.mjs';
1
+ import { G as GlassboxEvent } from '../types-BDFrJkma.mjs';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DeGRCTlJ.mjs';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DeGRCTlJ.mjs';
4
+ import '../ir-CnnJST_N.mjs';
5
5
  import '../dialect.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-Bon96eyc.js';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DIxRZ3Dj.js';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DIxRZ3Dj.js';
4
- import '../ir-Bvlkw5ja.js';
1
+ import { G as GlassboxEvent } from '../types-B--CYzMo.js';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DSeJJ6tt.js';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DSeJJ6tt.js';
4
+ import '../ir-BEQ28muo.js';
5
5
  import '../dialect.js';
6
6
 
7
7
  /**
@@ -101,7 +101,8 @@ var PROFILES_RAW = [
101
101
  id: "claude-fable-5",
102
102
  verifiedAgainstDocs: "2026-06-21",
103
103
  provider: "anthropic",
104
- status: "preview",
104
+ status: "current",
105
+ // s76 2026-07-25: GA since 2026-06-09 per docs; was preview.
105
106
  maxContextTokens: 1e6,
106
107
  maxOutputTokens: 128e3,
107
108
  maxTools: 64,
@@ -155,7 +156,8 @@ var PROFILES_RAW = [
155
156
  id: "claude-opus-4-8",
156
157
  verifiedAgainstDocs: "2026-06-21",
157
158
  provider: "anthropic",
158
- status: "current",
159
+ status: "legacy",
160
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 generation is current).
159
161
  maxContextTokens: 1e6,
160
162
  maxOutputTokens: 128e3,
161
163
  maxTools: 64,
@@ -195,11 +197,78 @@ var PROFILES_RAW = [
195
197
  classify: 8
196
198
  }
197
199
  },
200
+ {
201
+ // ── Claude Opus 5 — added s76 (2026-07-25, alpha.72) ──────────────────
202
+ // The model every seat in the portfolio actually runs, absent from the
203
+ // roster until now. Found by a catalog QA, not by the release watcher:
204
+ // the watcher detects unknown IDs on a provider's /models endpoint, but
205
+ // detection was never wired to ingestion, so the gap sat open. (That is
206
+ // what `scripts/catalog-sync.mjs` exists to close.)
207
+ //
208
+ // PROVENANCE — doc-verified 2026-07-25 against
209
+ // platform.claude.com/docs/en/docs/about-claude/models/overview:
210
+ // 1M context · 128k max output · $5/$25 per MTok · adaptive thinking YES
211
+ // · extended thinking NO · `effort` defaults to 'high' on the Claude API
212
+ // · reliable knowledge cutoff May 2026.
213
+ //
214
+ // FAMILY-INHERITED (not doc-read): maxTools, parallelToolCalls,
215
+ // structuredOutput, systemPromptMode, streaming. These are identical
216
+ // across opus-4-6 / 4-7 / 4-8 / sonnet-5 / fable-5 — five consecutive
217
+ // models — so they are a structural provider constant rather than a
218
+ // per-model value. Deliberately distinguished from the gemini-3.1-flash-lite
219
+ // failure, where a template-clone of PRICE (the field that actually varies,
220
+ // there by 2.5-3.75x) went unverified for 65 days.
221
+ id: "claude-opus-5",
222
+ verifiedAgainstDocs: "2026-07-25",
223
+ provider: "anthropic",
224
+ status: "current",
225
+ maxContextTokens: 1e6,
226
+ maxOutputTokens: 128e3,
227
+ maxTools: 64,
228
+ parallelToolCalls: true,
229
+ structuredOutput: "grammar",
230
+ systemPromptMode: "inline",
231
+ streaming: true,
232
+ cliffs: [],
233
+ costInputPer1m: 5,
234
+ costOutputPer1m: 25,
235
+ lowering: ANTHROPIC_LOWERING_BASE,
236
+ recovery: [
237
+ {
238
+ signal: "rate_limit",
239
+ action: "escalate",
240
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
241
+ },
242
+ {
243
+ signal: "model_not_found",
244
+ action: "escalate",
245
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
246
+ }
247
+ ],
248
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
249
+ weaknesses: ["cost", "latency"],
250
+ notes: "Anthropic frontier for complex agentic coding + enterprise work; the Opus-tier current default as of 2026-07-25, superseding 4.8/4.7/4.6 (all now legacy). Doc-verified 2026-07-25: 1M ctx, 128k out, $5/$25, adaptive thinking (extended thinking NOT supported \u2014 that is Haiku 4.5 only in this generation), `effort` defaults to high on the Claude API. Price is unchanged from 4.5 through 5 \u2014 the tier moved without a cost change.",
251
+ // COLD-START PRIOR cloned from claude-opus-4-8. Self-labelling: below
252
+ // MEASURED_GROUNDING_MIN_N (10) brain rows these resolve as
253
+ // grounding:'judgment', so nothing reads them as measured until they are.
254
+ archetypePerf: {
255
+ critique: 10,
256
+ plan: 10,
257
+ generate: 9,
258
+ ask: 9,
259
+ extract: 9,
260
+ transform: 9,
261
+ hunt: 8,
262
+ summarize: 8,
263
+ classify: 8
264
+ }
265
+ },
198
266
  {
199
267
  id: "claude-opus-4-7",
200
268
  verifiedAgainstDocs: "2026-05-08",
201
269
  provider: "anthropic",
202
- status: "current",
270
+ status: "legacy",
271
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 is current). Bundle said current while the brain already said legacy — the two disagreed.
203
272
  maxContextTokens: 1e6,
204
273
  maxOutputTokens: 128e3,
205
274
  maxTools: 64,
@@ -293,7 +362,8 @@ var PROFILES_RAW = [
293
362
  id: "claude-sonnet-4-6",
294
363
  verifiedAgainstDocs: "2026-05-08",
295
364
  provider: "anthropic",
296
- status: "current",
365
+ status: "legacy",
366
+ // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
297
367
  maxContextTokens: 1e6,
298
368
  maxOutputTokens: 64e3,
299
369
  maxTools: 64,
@@ -1432,7 +1502,8 @@ var PROFILES_RAW = [
1432
1502
  id: "claude-sonnet-5",
1433
1503
  verifiedAgainstDocs: "2026-07-02",
1434
1504
  provider: "anthropic",
1435
- status: "preview",
1505
+ status: "current",
1506
+ // s76 2026-07-25: GA per docs; was preview.
1436
1507
  maxContextTokens: 1e6,
1437
1508
  maxOutputTokens: 128e3,
1438
1509
  maxTools: 64,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ARCHETYPE_FLOOR_DEFAULT,
3
3
  getDefaultFallbackChain
4
- } from "../chunk-SBFSYCQG.mjs";
4
+ } from "../chunk-46U2NVOL.mjs";
5
5
  import {
6
6
  tryGetProfile
7
- } from "../chunk-4UO4CCSP.mjs";
7
+ } from "../chunk-N36LE3MK.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-CwGhacGT.mjs';
3
- import '../../ir-Bqn1RVdV.mjs';
2
+ import { a as TraceDetail } from '../../types-DeGRCTlJ.mjs';
3
+ import '../../ir-CnnJST_N.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-DIxRZ3Dj.js';
3
- import '../../ir-Bvlkw5ja.js';
2
+ import { a as TraceDetail } from '../../types-DSeJJ6tt.js';
3
+ import '../../ir-BEQ28muo.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 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-Bqn1RVdV.mjs';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, 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 parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-Bqn1RVdV.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 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-CnnJST_N.mjs';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, 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 parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-CnnJST_N.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';
@@ -649,6 +649,12 @@ interface OutcomePayload {
649
649
  system_prompt_chars?: number;
650
650
  fell_over_from?: string;
651
651
  fallback_reason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
652
+ /**
653
+ * alpha.71 (migration 044) — the precise `errorCode` behind
654
+ * `fallback_reason`. Key OMITTED when no fallback fired, so brains that
655
+ * haven't applied 044 never see it.
656
+ */
657
+ fell_over_error_code?: string;
652
658
  /**
653
659
  * True when the same-model retry (CallOptions.sameModelRetry) fired
654
660
  * during this call. Key OMITTED (not false) when no retry fired — safe
@@ -1003,7 +1009,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
1003
1009
  * guard in `tests/version.test.ts` fails the suite (and therefore
1004
1010
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
1005
1011
  */
1006
- declare const LIBRARY_VERSION = "2.0.0-alpha.70";
1012
+ declare const LIBRARY_VERSION = "2.0.0-alpha.72";
1007
1013
 
1008
1014
  /**
1009
1015
  * 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 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-Bvlkw5ja.js';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, 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 parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-Bvlkw5ja.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 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-BEQ28muo.js';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, 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 parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-BEQ28muo.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';
@@ -649,6 +649,12 @@ interface OutcomePayload {
649
649
  system_prompt_chars?: number;
650
650
  fell_over_from?: string;
651
651
  fallback_reason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
652
+ /**
653
+ * alpha.71 (migration 044) — the precise `errorCode` behind
654
+ * `fallback_reason`. Key OMITTED when no fallback fired, so brains that
655
+ * haven't applied 044 never see it.
656
+ */
657
+ fell_over_error_code?: string;
652
658
  /**
653
659
  * True when the same-model retry (CallOptions.sameModelRetry) fired
654
660
  * during this call. Key OMITTED (not false) when no retry fired — safe
@@ -1003,7 +1009,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
1003
1009
  * guard in `tests/version.test.ts` fails the suite (and therefore
1004
1010
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
1005
1011
  */
1006
- declare const LIBRARY_VERSION = "2.0.0-alpha.70";
1012
+ declare const LIBRARY_VERSION = "2.0.0-alpha.72";
1007
1013
 
1008
1014
  /**
1009
1015
  * Oracle contract — how an app tells the brain whether a response was good.
package/dist/index.js CHANGED
@@ -362,7 +362,8 @@ var PROFILES_RAW = [
362
362
  id: "claude-fable-5",
363
363
  verifiedAgainstDocs: "2026-06-21",
364
364
  provider: "anthropic",
365
- status: "preview",
365
+ status: "current",
366
+ // s76 2026-07-25: GA since 2026-06-09 per docs; was preview.
366
367
  maxContextTokens: 1e6,
367
368
  maxOutputTokens: 128e3,
368
369
  maxTools: 64,
@@ -416,7 +417,8 @@ var PROFILES_RAW = [
416
417
  id: "claude-opus-4-8",
417
418
  verifiedAgainstDocs: "2026-06-21",
418
419
  provider: "anthropic",
419
- status: "current",
420
+ status: "legacy",
421
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 generation is current).
420
422
  maxContextTokens: 1e6,
421
423
  maxOutputTokens: 128e3,
422
424
  maxTools: 64,
@@ -456,11 +458,78 @@ var PROFILES_RAW = [
456
458
  classify: 8
457
459
  }
458
460
  },
461
+ {
462
+ // ── Claude Opus 5 — added s76 (2026-07-25, alpha.72) ──────────────────
463
+ // The model every seat in the portfolio actually runs, absent from the
464
+ // roster until now. Found by a catalog QA, not by the release watcher:
465
+ // the watcher detects unknown IDs on a provider's /models endpoint, but
466
+ // detection was never wired to ingestion, so the gap sat open. (That is
467
+ // what `scripts/catalog-sync.mjs` exists to close.)
468
+ //
469
+ // PROVENANCE — doc-verified 2026-07-25 against
470
+ // platform.claude.com/docs/en/docs/about-claude/models/overview:
471
+ // 1M context · 128k max output · $5/$25 per MTok · adaptive thinking YES
472
+ // · extended thinking NO · `effort` defaults to 'high' on the Claude API
473
+ // · reliable knowledge cutoff May 2026.
474
+ //
475
+ // FAMILY-INHERITED (not doc-read): maxTools, parallelToolCalls,
476
+ // structuredOutput, systemPromptMode, streaming. These are identical
477
+ // across opus-4-6 / 4-7 / 4-8 / sonnet-5 / fable-5 — five consecutive
478
+ // models — so they are a structural provider constant rather than a
479
+ // per-model value. Deliberately distinguished from the gemini-3.1-flash-lite
480
+ // failure, where a template-clone of PRICE (the field that actually varies,
481
+ // there by 2.5-3.75x) went unverified for 65 days.
482
+ id: "claude-opus-5",
483
+ verifiedAgainstDocs: "2026-07-25",
484
+ provider: "anthropic",
485
+ status: "current",
486
+ maxContextTokens: 1e6,
487
+ maxOutputTokens: 128e3,
488
+ maxTools: 64,
489
+ parallelToolCalls: true,
490
+ structuredOutput: "grammar",
491
+ systemPromptMode: "inline",
492
+ streaming: true,
493
+ cliffs: [],
494
+ costInputPer1m: 5,
495
+ costOutputPer1m: 25,
496
+ lowering: ANTHROPIC_LOWERING_BASE,
497
+ recovery: [
498
+ {
499
+ signal: "rate_limit",
500
+ action: "escalate",
501
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
502
+ },
503
+ {
504
+ signal: "model_not_found",
505
+ action: "escalate",
506
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
507
+ }
508
+ ],
509
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
510
+ weaknesses: ["cost", "latency"],
511
+ notes: "Anthropic frontier for complex agentic coding + enterprise work; the Opus-tier current default as of 2026-07-25, superseding 4.8/4.7/4.6 (all now legacy). Doc-verified 2026-07-25: 1M ctx, 128k out, $5/$25, adaptive thinking (extended thinking NOT supported \u2014 that is Haiku 4.5 only in this generation), `effort` defaults to high on the Claude API. Price is unchanged from 4.5 through 5 \u2014 the tier moved without a cost change.",
512
+ // COLD-START PRIOR cloned from claude-opus-4-8. Self-labelling: below
513
+ // MEASURED_GROUNDING_MIN_N (10) brain rows these resolve as
514
+ // grounding:'judgment', so nothing reads them as measured until they are.
515
+ archetypePerf: {
516
+ critique: 10,
517
+ plan: 10,
518
+ generate: 9,
519
+ ask: 9,
520
+ extract: 9,
521
+ transform: 9,
522
+ hunt: 8,
523
+ summarize: 8,
524
+ classify: 8
525
+ }
526
+ },
459
527
  {
460
528
  id: "claude-opus-4-7",
461
529
  verifiedAgainstDocs: "2026-05-08",
462
530
  provider: "anthropic",
463
- status: "current",
531
+ status: "legacy",
532
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 is current). Bundle said current while the brain already said legacy — the two disagreed.
464
533
  maxContextTokens: 1e6,
465
534
  maxOutputTokens: 128e3,
466
535
  maxTools: 64,
@@ -554,7 +623,8 @@ var PROFILES_RAW = [
554
623
  id: "claude-sonnet-4-6",
555
624
  verifiedAgainstDocs: "2026-05-08",
556
625
  provider: "anthropic",
557
- status: "current",
626
+ status: "legacy",
627
+ // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
558
628
  maxContextTokens: 1e6,
559
629
  maxOutputTokens: 64e3,
560
630
  maxTools: 64,
@@ -1693,7 +1763,8 @@ var PROFILES_RAW = [
1693
1763
  id: "claude-sonnet-5",
1694
1764
  verifiedAgainstDocs: "2026-07-02",
1695
1765
  provider: "anthropic",
1696
- status: "preview",
1766
+ status: "current",
1767
+ // s76 2026-07-25: GA per docs; was preview.
1697
1768
  maxContextTokens: 1e6,
1698
1769
  maxOutputTokens: 128e3,
1699
1770
  maxTools: 64,
@@ -3171,6 +3242,12 @@ function lower(ir, profile, hints = {}) {
3171
3242
  }
3172
3243
  function lowerAnthropic(ir, profile, hints) {
3173
3244
  const systemBlocks = buildAnthropicSystemBlocks(ir.sections, profile);
3245
+ if (ir.constraints?.structuredOutput) {
3246
+ systemBlocks.push({
3247
+ type: "text",
3248
+ text: "Respond with a single valid JSON value and nothing else. Do not wrap it in a markdown code fence, and do not add any prose before or after it."
3249
+ });
3250
+ }
3174
3251
  const history = (ir.history ?? []).filter((m) => m.role !== "system");
3175
3252
  const policy = ir.historyCachePolicy;
3176
3253
  const markIndex = resolveHistoryMarkIndex(history.length, policy);
@@ -5548,6 +5625,10 @@ function buildPayload(input, reg) {
5548
5625
  system_prompt_chars: input.systemPromptChars ?? reg?.systemPromptChars,
5549
5626
  fell_over_from: fellOverFrom,
5550
5627
  fallback_reason: fallbackReason,
5628
+ // alpha.71 — migration 044. The PRECISE code behind `fallback_reason`,
5629
+ // which collapses two opposite-remedy failures into 'cliff'. Omitted
5630
+ // (not null) when no fallback fired, so pre-044 brains never see the key.
5631
+ fell_over_error_code: fellOverFrom ? input.fellOverErrorCode : void 0,
5551
5632
  // alpha.66 — omitted-undefined keeps the key out of the JSON body
5552
5633
  // entirely for non-retry rows (pre-migration-039 brain safety).
5553
5634
  retried_same_model: input.retriedSameModel,
@@ -5784,6 +5865,41 @@ async function recordGoldenIr(input) {
5784
5865
  }
5785
5866
  }
5786
5867
 
5868
+ // src/json-loose.ts
5869
+ function parseJsonLoose(raw) {
5870
+ const attempt = (s) => {
5871
+ try {
5872
+ return JSON.parse(s);
5873
+ } catch {
5874
+ return FAILED;
5875
+ }
5876
+ };
5877
+ const direct = attempt(raw);
5878
+ if (direct !== FAILED) return { ok: true, value: direct, recovered: false };
5879
+ const cleaned = raw.trim().replace(/^```(?:json|JSON)?\s*/, "").replace(/\s*```$/, "").trim();
5880
+ const fenced = attempt(cleaned);
5881
+ if (fenced !== FAILED) return { ok: true, value: fenced, recovered: true };
5882
+ const objStart = cleaned.indexOf("{");
5883
+ const arrStart = cleaned.indexOf("[");
5884
+ const start = objStart === -1 ? arrStart : arrStart === -1 ? objStart : Math.min(objStart, arrStart);
5885
+ if (start !== -1) {
5886
+ const openChar = cleaned[start];
5887
+ const closeChar = openChar === "{" ? "}" : "]";
5888
+ const end = cleaned.lastIndexOf(closeChar);
5889
+ if (end > start) {
5890
+ const span = attempt(cleaned.slice(start, end + 1));
5891
+ if (span !== FAILED) return { ok: true, value: span, recovered: true };
5892
+ }
5893
+ }
5894
+ try {
5895
+ JSON.parse(raw);
5896
+ return { ok: false, error: "unreachable" };
5897
+ } catch (err) {
5898
+ return { ok: false, error: err instanceof Error ? err.message : String(err) };
5899
+ }
5900
+ }
5901
+ var FAILED = /* @__PURE__ */ Symbol("parse-failed");
5902
+
5787
5903
  // src/ir.ts
5788
5904
  var CallError = class extends Error {
5789
5905
  attempts;
@@ -7353,6 +7469,7 @@ async function call(ir, opts = {}) {
7353
7469
  );
7354
7470
  const fellOver = targetModel !== initial.target;
7355
7471
  const fallbackReason = fellOver ? normalizeFallbackReason(attempts) : void 0;
7472
+ const fellOverErrorCode = fellOver ? firstFailureErrorCode(attempts) : void 0;
7356
7473
  const goldenRate = resolveGoldenCaptureRate(opts.goldenCapture?.sampleRate);
7357
7474
  const goldenShapeKey = goldenRate > 0 ? peekRegisteredShapeKey(initial.handle) : void 0;
7358
7475
  await record({
@@ -7379,6 +7496,9 @@ async function call(ir, opts = {}) {
7379
7496
  totalMs: latencyMs2,
7380
7497
  fellOverFrom: fellOver ? initial.target : void 0,
7381
7498
  fallbackReason,
7499
+ // alpha.71 — migration 044. Omitted when no fallback fired, so
7500
+ // pre-044 brains never see the key.
7501
+ fellOverErrorCode,
7382
7502
  // alpha.66 — migration 039. Omitted (not false) when no retry fired
7383
7503
  // so pre-039 brains never see the key.
7384
7504
  retriedSameModel: retriedSameModel || void 0
@@ -7439,6 +7559,7 @@ async function call(ir, opts = {}) {
7439
7559
  servedBy: targetModel,
7440
7560
  fellOverFrom: fellOver ? initial.target : void 0,
7441
7561
  fallbackReason,
7562
+ fellOverErrorCode,
7442
7563
  retriedSameModel: retriedSameModel || void 0,
7443
7564
  unreachableFiltered,
7444
7565
  policyBlockedFiltered,
@@ -7735,10 +7856,12 @@ function validateStructuredContract(exec, ir) {
7735
7856
  if (!exec.response.text) {
7736
7857
  return { ok: true, response: exec.response };
7737
7858
  }
7738
- try {
7739
- const parsed = JSON.parse(exec.response.text);
7740
- return { ok: true, response: { ...exec.response, structuredOutput: parsed } };
7741
- } catch (err) {
7859
+ const parsedResult = parseJsonLoose(exec.response.text);
7860
+ if (parsedResult.ok) {
7861
+ return { ok: true, response: { ...exec.response, structuredOutput: parsedResult.value } };
7862
+ }
7863
+ {
7864
+ const err = new Error(parsedResult.error);
7742
7865
  return {
7743
7866
  ok: false,
7744
7867
  status: exec.status,
@@ -7774,6 +7897,9 @@ function raiseOutputBudget(request, profile) {
7774
7897
  }
7775
7898
  return request;
7776
7899
  }
7900
+ function firstFailureErrorCode(attempts) {
7901
+ return attempts.find((a) => a.status !== "success")?.errorCode;
7902
+ }
7777
7903
  function normalizeFallbackReason(attempts) {
7778
7904
  const first = attempts.find((a) => a.status !== "success");
7779
7905
  if (!first) return void 0;
@@ -8159,7 +8285,20 @@ async function runGoldenEval(opts) {
8159
8285
  })
8160
8286
  },
8161
8287
  models: [judgeModel],
8162
- constraints: { forceModel: judgeModel }
8288
+ // alpha.70 declare the judge's output shape truthfully. The role
8289
+ // section says "You output only JSON" and `parseJudgeVerdict` parses
8290
+ // exactly that, but nothing in the IR SAID so: no `structuredOutput`,
8291
+ // no tools ⇒ `resolveOutputMode` inferred 'text'. That made the judge
8292
+ // eligible for the alpha.68 shape-altering discipline gates — inside
8293
+ // the very engine Release B would use to measure those gates, where a
8294
+ // gate-induced parse failure would be attributed to the gates.
8295
+ //
8296
+ // Deliberately `outputMode`, NOT `structuredOutput: true`: the latter
8297
+ // would switch on kgauto's structured-output validation and change the
8298
+ // lowered wire contract (response_format), altering judge behaviour.
8299
+ // This declares the shape for screening purposes only — which is the
8300
+ // exact reason the alpha.69 hatch is a separate field.
8301
+ constraints: { forceModel: judgeModel, outputMode: "json" }
8163
8302
  };
8164
8303
  try {
8165
8304
  const compiled = compile(judgeIr);
@@ -8602,7 +8741,7 @@ function createBrainForwardRoutes(config) {
8602
8741
  }
8603
8742
 
8604
8743
  // src/version.ts
8605
- var LIBRARY_VERSION = "2.0.0-alpha.70";
8744
+ var LIBRARY_VERSION = "2.0.0-alpha.72";
8606
8745
 
8607
8746
  // src/key-health.ts
8608
8747
  var JSON_HEADERS2 = { "Content-Type": "application/json" };
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  LIBRARY_VERSION,
18
18
  createKeyHealthRoute
19
- } from "./chunk-FR4DNGLW.mjs";
19
+ } from "./chunk-AI4NNR5T.mjs";
20
20
  import {
21
21
  ABSOLUTE_FLOOR,
22
22
  ARCHETYPE_FLOOR_DEFAULT,
@@ -42,7 +42,7 @@ import {
42
42
  loadChainsFromBrain,
43
43
  readBrainReadEnv,
44
44
  resolveProviderKey
45
- } from "./chunk-SBFSYCQG.mjs";
45
+ } from "./chunk-46U2NVOL.mjs";
46
46
  import {
47
47
  ALIASES,
48
48
  LATENCY_TIER_MS,
@@ -53,7 +53,7 @@ import {
53
53
  latencyTierOf,
54
54
  profilesByProvider,
55
55
  tryGetProfile
56
- } from "./chunk-4UO4CCSP.mjs";
56
+ } from "./chunk-N36LE3MK.mjs";
57
57
  import {
58
58
  emitAdvisoryFired,
59
59
  emitCompileDone,
@@ -1138,6 +1138,12 @@ function lower(ir, profile, hints = {}) {
1138
1138
  }
1139
1139
  function lowerAnthropic(ir, profile, hints) {
1140
1140
  const systemBlocks = buildAnthropicSystemBlocks(ir.sections, profile);
1141
+ if (ir.constraints?.structuredOutput) {
1142
+ systemBlocks.push({
1143
+ type: "text",
1144
+ text: "Respond with a single valid JSON value and nothing else. Do not wrap it in a markdown code fence, and do not add any prose before or after it."
1145
+ });
1146
+ }
1141
1147
  const history = (ir.history ?? []).filter((m) => m.role !== "system");
1142
1148
  const policy = ir.historyCachePolicy;
1143
1149
  const markIndex = resolveHistoryMarkIndex(history.length, policy);
@@ -3515,6 +3521,10 @@ function buildPayload(input, reg) {
3515
3521
  system_prompt_chars: input.systemPromptChars ?? reg?.systemPromptChars,
3516
3522
  fell_over_from: fellOverFrom,
3517
3523
  fallback_reason: fallbackReason,
3524
+ // alpha.71 — migration 044. The PRECISE code behind `fallback_reason`,
3525
+ // which collapses two opposite-remedy failures into 'cliff'. Omitted
3526
+ // (not null) when no fallback fired, so pre-044 brains never see the key.
3527
+ fell_over_error_code: fellOverFrom ? input.fellOverErrorCode : void 0,
3518
3528
  // alpha.66 — omitted-undefined keeps the key out of the JSON body
3519
3529
  // entirely for non-retry rows (pre-migration-039 brain safety).
3520
3530
  retried_same_model: input.retriedSameModel,
@@ -3751,6 +3761,41 @@ async function recordGoldenIr(input) {
3751
3761
  }
3752
3762
  }
3753
3763
 
3764
+ // src/json-loose.ts
3765
+ function parseJsonLoose(raw) {
3766
+ const attempt = (s) => {
3767
+ try {
3768
+ return JSON.parse(s);
3769
+ } catch {
3770
+ return FAILED;
3771
+ }
3772
+ };
3773
+ const direct = attempt(raw);
3774
+ if (direct !== FAILED) return { ok: true, value: direct, recovered: false };
3775
+ const cleaned = raw.trim().replace(/^```(?:json|JSON)?\s*/, "").replace(/\s*```$/, "").trim();
3776
+ const fenced = attempt(cleaned);
3777
+ if (fenced !== FAILED) return { ok: true, value: fenced, recovered: true };
3778
+ const objStart = cleaned.indexOf("{");
3779
+ const arrStart = cleaned.indexOf("[");
3780
+ const start = objStart === -1 ? arrStart : arrStart === -1 ? objStart : Math.min(objStart, arrStart);
3781
+ if (start !== -1) {
3782
+ const openChar = cleaned[start];
3783
+ const closeChar = openChar === "{" ? "}" : "]";
3784
+ const end = cleaned.lastIndexOf(closeChar);
3785
+ if (end > start) {
3786
+ const span = attempt(cleaned.slice(start, end + 1));
3787
+ if (span !== FAILED) return { ok: true, value: span, recovered: true };
3788
+ }
3789
+ }
3790
+ try {
3791
+ JSON.parse(raw);
3792
+ return { ok: false, error: "unreachable" };
3793
+ } catch (err) {
3794
+ return { ok: false, error: err instanceof Error ? err.message : String(err) };
3795
+ }
3796
+ }
3797
+ var FAILED = /* @__PURE__ */ Symbol("parse-failed");
3798
+
3754
3799
  // src/ir.ts
3755
3800
  var CallError = class extends Error {
3756
3801
  attempts;
@@ -4581,6 +4626,7 @@ async function call(ir, opts = {}) {
4581
4626
  );
4582
4627
  const fellOver = targetModel !== initial.target;
4583
4628
  const fallbackReason = fellOver ? normalizeFallbackReason(attempts) : void 0;
4629
+ const fellOverErrorCode = fellOver ? firstFailureErrorCode(attempts) : void 0;
4584
4630
  const goldenRate = resolveGoldenCaptureRate(opts.goldenCapture?.sampleRate);
4585
4631
  const goldenShapeKey = goldenRate > 0 ? peekRegisteredShapeKey(initial.handle) : void 0;
4586
4632
  await record({
@@ -4607,6 +4653,9 @@ async function call(ir, opts = {}) {
4607
4653
  totalMs: latencyMs2,
4608
4654
  fellOverFrom: fellOver ? initial.target : void 0,
4609
4655
  fallbackReason,
4656
+ // alpha.71 — migration 044. Omitted when no fallback fired, so
4657
+ // pre-044 brains never see the key.
4658
+ fellOverErrorCode,
4610
4659
  // alpha.66 — migration 039. Omitted (not false) when no retry fired
4611
4660
  // so pre-039 brains never see the key.
4612
4661
  retriedSameModel: retriedSameModel || void 0
@@ -4667,6 +4716,7 @@ async function call(ir, opts = {}) {
4667
4716
  servedBy: targetModel,
4668
4717
  fellOverFrom: fellOver ? initial.target : void 0,
4669
4718
  fallbackReason,
4719
+ fellOverErrorCode,
4670
4720
  retriedSameModel: retriedSameModel || void 0,
4671
4721
  unreachableFiltered,
4672
4722
  policyBlockedFiltered,
@@ -4963,10 +5013,12 @@ function validateStructuredContract(exec, ir) {
4963
5013
  if (!exec.response.text) {
4964
5014
  return { ok: true, response: exec.response };
4965
5015
  }
4966
- try {
4967
- const parsed = JSON.parse(exec.response.text);
4968
- return { ok: true, response: { ...exec.response, structuredOutput: parsed } };
4969
- } catch (err) {
5016
+ const parsedResult = parseJsonLoose(exec.response.text);
5017
+ if (parsedResult.ok) {
5018
+ return { ok: true, response: { ...exec.response, structuredOutput: parsedResult.value } };
5019
+ }
5020
+ {
5021
+ const err = new Error(parsedResult.error);
4970
5022
  return {
4971
5023
  ok: false,
4972
5024
  status: exec.status,
@@ -5002,6 +5054,9 @@ function raiseOutputBudget(request, profile) {
5002
5054
  }
5003
5055
  return request;
5004
5056
  }
5057
+ function firstFailureErrorCode(attempts) {
5058
+ return attempts.find((a) => a.status !== "success")?.errorCode;
5059
+ }
5005
5060
  function normalizeFallbackReason(attempts) {
5006
5061
  const first = attempts.find((a) => a.status !== "success");
5007
5062
  if (!first) return void 0;
@@ -5387,7 +5442,20 @@ async function runGoldenEval(opts) {
5387
5442
  })
5388
5443
  },
5389
5444
  models: [judgeModel],
5390
- constraints: { forceModel: judgeModel }
5445
+ // alpha.70 declare the judge's output shape truthfully. The role
5446
+ // section says "You output only JSON" and `parseJudgeVerdict` parses
5447
+ // exactly that, but nothing in the IR SAID so: no `structuredOutput`,
5448
+ // no tools ⇒ `resolveOutputMode` inferred 'text'. That made the judge
5449
+ // eligible for the alpha.68 shape-altering discipline gates — inside
5450
+ // the very engine Release B would use to measure those gates, where a
5451
+ // gate-induced parse failure would be attributed to the gates.
5452
+ //
5453
+ // Deliberately `outputMode`, NOT `structuredOutput: true`: the latter
5454
+ // would switch on kgauto's structured-output validation and change the
5455
+ // lowered wire contract (response_format), altering judge behaviour.
5456
+ // This declares the shape for screening purposes only — which is the
5457
+ // exact reason the alpha.69 hatch is a separate field.
5458
+ constraints: { forceModel: judgeModel, outputMode: "json" }
5391
5459
  };
5392
5460
  try {
5393
5461
  const compiled = compile(judgeIr);
@@ -1212,6 +1212,24 @@ interface CallResult {
1212
1212
  fellOverFrom?: string;
1213
1213
  /** Set only when fallback fired. Normalized cause. */
1214
1214
  fallbackReason?: FallbackReason;
1215
+ /**
1216
+ * alpha.71 — the PRECISE `errorCode` of the attempt that drove the chain,
1217
+ * unnormalized. `fallbackReason` is a six-value summary and one of its
1218
+ * values, `'cliff'`, absorbs two failures with OPPOSITE remedies:
1219
+ *
1220
+ * - `max_tokens_on_structured_output` — the output budget was too small
1221
+ * for the requested shape ⇒ raise the cap / add an output-budget cliff.
1222
+ * - `structured_output_parse_failed` — the model emitted non-JSON ⇒ its
1223
+ * declared `structuredOutput` capability is wrong for this shape.
1224
+ *
1225
+ * The code was already computed in `attempts[]` and thrown away at record
1226
+ * time, so a surface could accumulate a dozen identical `'cliff'` rows that
1227
+ * still could not tell an operator which fix applies. (Found diagnosing
1228
+ * claude-haiku-4-5's 12-of-12 failures on playbacksam/summarize, where the
1229
+ * measured-failure gate correctly stopped the bleeding but the evidence
1230
+ * could not name the cause.)
1231
+ */
1232
+ fellOverErrorCode?: string;
1215
1233
  /**
1216
1234
  * alpha.66 — true when the one-shot same-model retry
1217
1235
  * (CallOptions.sameModelRetry) fired during this call, regardless of
@@ -1424,6 +1442,13 @@ interface RecordInput {
1424
1442
  * how often the retry rescued the call vs the chain walking anyway.
1425
1443
  */
1426
1444
  retriedSameModel?: boolean;
1445
+ /**
1446
+ * alpha.71 — the precise `errorCode` of the attempt that drove the chain
1447
+ * (migration 044). Set automatically by `call()`; a consumer driving
1448
+ * `record()` by hand may pass it. See `CallResult.fellOverErrorCode` for
1449
+ * why the normalized `fallbackReason` is insufficient on its own.
1450
+ */
1451
+ fellOverErrorCode?: string;
1427
1452
  }
1428
1453
  /**
1429
1454
  * alpha.20 Entry 4: kinds of consumer-declared outcomes feeding the quality
@@ -1212,6 +1212,24 @@ interface CallResult {
1212
1212
  fellOverFrom?: string;
1213
1213
  /** Set only when fallback fired. Normalized cause. */
1214
1214
  fallbackReason?: FallbackReason;
1215
+ /**
1216
+ * alpha.71 — the PRECISE `errorCode` of the attempt that drove the chain,
1217
+ * unnormalized. `fallbackReason` is a six-value summary and one of its
1218
+ * values, `'cliff'`, absorbs two failures with OPPOSITE remedies:
1219
+ *
1220
+ * - `max_tokens_on_structured_output` — the output budget was too small
1221
+ * for the requested shape ⇒ raise the cap / add an output-budget cliff.
1222
+ * - `structured_output_parse_failed` — the model emitted non-JSON ⇒ its
1223
+ * declared `structuredOutput` capability is wrong for this shape.
1224
+ *
1225
+ * The code was already computed in `attempts[]` and thrown away at record
1226
+ * time, so a surface could accumulate a dozen identical `'cliff'` rows that
1227
+ * still could not tell an operator which fix applies. (Found diagnosing
1228
+ * claude-haiku-4-5's 12-of-12 failures on playbacksam/summarize, where the
1229
+ * measured-failure gate correctly stopped the bleeding but the evidence
1230
+ * could not name the cause.)
1231
+ */
1232
+ fellOverErrorCode?: string;
1215
1233
  /**
1216
1234
  * alpha.66 — true when the one-shot same-model retry
1217
1235
  * (CallOptions.sameModelRetry) fired during this call, regardless of
@@ -1424,6 +1442,13 @@ interface RecordInput {
1424
1442
  * how often the retry rescued the call vs the chain walking anyway.
1425
1443
  */
1426
1444
  retriedSameModel?: boolean;
1445
+ /**
1446
+ * alpha.71 — the precise `errorCode` of the attempt that drove the chain
1447
+ * (migration 044). Set automatically by `call()`; a consumer driving
1448
+ * `record()` by hand may pass it. See `CallResult.fellOverErrorCode` for
1449
+ * why the normalized `fallbackReason` is insufficient on its own.
1450
+ */
1451
+ fellOverErrorCode?: string;
1427
1452
  }
1428
1453
  /**
1429
1454
  * alpha.20 Entry 4: kinds of consumer-declared outcomes feeding the quality
@@ -25,7 +25,7 @@ __export(key_health_exports, {
25
25
  module.exports = __toCommonJS(key_health_exports);
26
26
 
27
27
  // src/version.ts
28
- var LIBRARY_VERSION = "2.0.0-alpha.70";
28
+ var LIBRARY_VERSION = "2.0.0-alpha.72";
29
29
 
30
30
  // src/key-health.ts
31
31
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createKeyHealthRoute
3
- } from "./chunk-FR4DNGLW.mjs";
3
+ } from "./chunk-AI4NNR5T.mjs";
4
4
  export {
5
5
  createKeyHealthRoute
6
6
  };
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-Bqn1RVdV.mjs';
1
+ import { k as Provider } from './ir-CnnJST_N.mjs';
2
2
  import { IntentArchetypeName } from './dialect.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-Bvlkw5ja.js';
1
+ import { k as Provider } from './ir-BEQ28muo.js';
2
2
  import { IntentArchetypeName } from './dialect.js';
3
3
 
4
4
  /**
package/dist/profiles.js CHANGED
@@ -79,7 +79,8 @@ var PROFILES_RAW = [
79
79
  id: "claude-fable-5",
80
80
  verifiedAgainstDocs: "2026-06-21",
81
81
  provider: "anthropic",
82
- status: "preview",
82
+ status: "current",
83
+ // s76 2026-07-25: GA since 2026-06-09 per docs; was preview.
83
84
  maxContextTokens: 1e6,
84
85
  maxOutputTokens: 128e3,
85
86
  maxTools: 64,
@@ -133,7 +134,8 @@ var PROFILES_RAW = [
133
134
  id: "claude-opus-4-8",
134
135
  verifiedAgainstDocs: "2026-06-21",
135
136
  provider: "anthropic",
136
- status: "current",
137
+ status: "legacy",
138
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 generation is current).
137
139
  maxContextTokens: 1e6,
138
140
  maxOutputTokens: 128e3,
139
141
  maxTools: 64,
@@ -173,11 +175,78 @@ var PROFILES_RAW = [
173
175
  classify: 8
174
176
  }
175
177
  },
178
+ {
179
+ // ── Claude Opus 5 — added s76 (2026-07-25, alpha.72) ──────────────────
180
+ // The model every seat in the portfolio actually runs, absent from the
181
+ // roster until now. Found by a catalog QA, not by the release watcher:
182
+ // the watcher detects unknown IDs on a provider's /models endpoint, but
183
+ // detection was never wired to ingestion, so the gap sat open. (That is
184
+ // what `scripts/catalog-sync.mjs` exists to close.)
185
+ //
186
+ // PROVENANCE — doc-verified 2026-07-25 against
187
+ // platform.claude.com/docs/en/docs/about-claude/models/overview:
188
+ // 1M context · 128k max output · $5/$25 per MTok · adaptive thinking YES
189
+ // · extended thinking NO · `effort` defaults to 'high' on the Claude API
190
+ // · reliable knowledge cutoff May 2026.
191
+ //
192
+ // FAMILY-INHERITED (not doc-read): maxTools, parallelToolCalls,
193
+ // structuredOutput, systemPromptMode, streaming. These are identical
194
+ // across opus-4-6 / 4-7 / 4-8 / sonnet-5 / fable-5 — five consecutive
195
+ // models — so they are a structural provider constant rather than a
196
+ // per-model value. Deliberately distinguished from the gemini-3.1-flash-lite
197
+ // failure, where a template-clone of PRICE (the field that actually varies,
198
+ // there by 2.5-3.75x) went unverified for 65 days.
199
+ id: "claude-opus-5",
200
+ verifiedAgainstDocs: "2026-07-25",
201
+ provider: "anthropic",
202
+ status: "current",
203
+ maxContextTokens: 1e6,
204
+ maxOutputTokens: 128e3,
205
+ maxTools: 64,
206
+ parallelToolCalls: true,
207
+ structuredOutput: "grammar",
208
+ systemPromptMode: "inline",
209
+ streaming: true,
210
+ cliffs: [],
211
+ costInputPer1m: 5,
212
+ costOutputPer1m: 25,
213
+ lowering: ANTHROPIC_LOWERING_BASE,
214
+ recovery: [
215
+ {
216
+ signal: "rate_limit",
217
+ action: "escalate",
218
+ reason: "429 from Anthropic \u2014 escalate to fallback chain"
219
+ },
220
+ {
221
+ signal: "model_not_found",
222
+ action: "escalate",
223
+ reason: "Model deprecated/renamed \u2014 escalate (L-061)"
224
+ }
225
+ ],
226
+ strengths: ["reasoning", "agentic_coding", "long_context", "reliable_tool_use", "structured_output"],
227
+ weaknesses: ["cost", "latency"],
228
+ notes: "Anthropic frontier for complex agentic coding + enterprise work; the Opus-tier current default as of 2026-07-25, superseding 4.8/4.7/4.6 (all now legacy). Doc-verified 2026-07-25: 1M ctx, 128k out, $5/$25, adaptive thinking (extended thinking NOT supported \u2014 that is Haiku 4.5 only in this generation), `effort` defaults to high on the Claude API. Price is unchanged from 4.5 through 5 \u2014 the tier moved without a cost change.",
229
+ // COLD-START PRIOR cloned from claude-opus-4-8. Self-labelling: below
230
+ // MEASURED_GROUNDING_MIN_N (10) brain rows these resolve as
231
+ // grounding:'judgment', so nothing reads them as measured until they are.
232
+ archetypePerf: {
233
+ critique: 10,
234
+ plan: 10,
235
+ generate: 9,
236
+ ask: 9,
237
+ extract: 9,
238
+ transform: 9,
239
+ hunt: 8,
240
+ summarize: 8,
241
+ classify: 8
242
+ }
243
+ },
176
244
  {
177
245
  id: "claude-opus-4-7",
178
246
  verifiedAgainstDocs: "2026-05-08",
179
247
  provider: "anthropic",
180
- status: "current",
248
+ status: "legacy",
249
+ // s76 2026-07-25: docs list as LEGACY (Opus 5 is current). Bundle said current while the brain already said legacy — the two disagreed.
181
250
  maxContextTokens: 1e6,
182
251
  maxOutputTokens: 128e3,
183
252
  maxTools: 64,
@@ -271,7 +340,8 @@ var PROFILES_RAW = [
271
340
  id: "claude-sonnet-4-6",
272
341
  verifiedAgainstDocs: "2026-05-08",
273
342
  provider: "anthropic",
274
- status: "current",
343
+ status: "legacy",
344
+ // s76 2026-07-25: docs list as LEGACY (Sonnet 5 is current).
275
345
  maxContextTokens: 1e6,
276
346
  maxOutputTokens: 64e3,
277
347
  maxTools: 64,
@@ -1410,7 +1480,8 @@ var PROFILES_RAW = [
1410
1480
  id: "claude-sonnet-5",
1411
1481
  verifiedAgainstDocs: "2026-07-02",
1412
1482
  provider: "anthropic",
1413
- status: "preview",
1483
+ status: "current",
1484
+ // s76 2026-07-25: GA per docs; was preview.
1414
1485
  maxContextTokens: 1e6,
1415
1486
  maxOutputTokens: 128e3,
1416
1487
  maxTools: 64,
package/dist/profiles.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  latencyTierOf,
9
9
  profilesByProvider,
10
10
  tryGetProfile
11
- } from "./chunk-4UO4CCSP.mjs";
11
+ } from "./chunk-N36LE3MK.mjs";
12
12
  export {
13
13
  ALIASES,
14
14
  LATENCY_TIER_MS,
@@ -1,4 +1,4 @@
1
- import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-Bvlkw5ja.js';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-BEQ28muo.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-Bqn1RVdV.mjs';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-CnnJST_N.mjs';
2
2
 
3
3
  /**
4
4
  * Glass-Box observability types (alpha.17).
@@ -1,4 +1,4 @@
1
- import { i as Adapter, x as SectionKind } from './ir-Bvlkw5ja.js';
1
+ import { i as Adapter, x as SectionKind } from './ir-BEQ28muo.js';
2
2
 
3
3
  /**
4
4
  * Internal config + hook types for createGlassboxRoutes().
@@ -1,4 +1,4 @@
1
- import { i as Adapter, x as SectionKind } from './ir-Bqn1RVdV.mjs';
1
+ import { i as Adapter, x as SectionKind } from './ir-CnnJST_N.mjs';
2
2
 
3
3
  /**
4
4
  * Internal config + hook types for createGlassboxRoutes().
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmdrift/kgauto-compiler",
3
- "version": "2.0.0-alpha.70",
3
+ "version": "2.0.0-alpha.72",
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",