@warmdrift/kgauto-compiler 2.0.0-alpha.65 → 2.0.0-alpha.66

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.65";
2
+ var LIBRARY_VERSION = "2.0.0-alpha.66";
3
3
 
4
4
  // src/key-health.ts
5
5
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -333,6 +333,10 @@ function readBrainReadEnv(envSource = defaultEnv()) {
333
333
  if (!anonKey) missingEnv.push("KGAUTO_V2_BRAIN_ANON_KEY");
334
334
  return { endpoint, jwt, anonKey, missingEnv };
335
335
  }
336
+ function isSameModelRetryEnabledFromEnv(envSource = defaultEnv()) {
337
+ const raw = (envSource.KGAUTO_SAME_MODEL_RETRY ?? "").trim().toLowerCase();
338
+ return raw === "1" || raw === "true";
339
+ }
336
340
 
337
341
  // src/fallback.ts
338
342
  var STARTER_CHAINS_GROUNDED = {
@@ -701,6 +705,7 @@ export {
701
705
  isModelReachable,
702
706
  getReachabilityDiagnostic,
703
707
  readBrainReadEnv,
708
+ isSameModelRetryEnabledFromEnv,
704
709
  loadChainsFromBrain,
705
710
  getDefaultFallbackChain,
706
711
  getStarterChain,
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-D-G7KXeI.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-D-G7KXeI.mjs';
3
- import '../ir-9rrfI3yB.mjs';
1
+ import { G as GlassboxEvent } from '../types-8pWRDbUg.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-8pWRDbUg.mjs';
3
+ import '../ir-BTvyl8-w.mjs';
4
4
  import '../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-DSknEy2B.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-DSknEy2B.js';
3
- import '../ir-Dx_UXPfP.js';
1
+ import { G as GlassboxEvent } from '../types-BdYlJz0Z.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-BdYlJz0Z.js';
3
+ import '../ir-Qnw6L265.js';
4
4
  import '../dialect.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-B4zlO58J.mjs';
2
- import '../ir-9rrfI3yB.mjs';
1
+ import { T as TraceHealth } from '../types-Cya0jPAF.mjs';
2
+ import '../ir-BTvyl8-w.mjs';
3
3
  import '../dialect.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-iwyFQHt3.js';
2
- import '../ir-Dx_UXPfP.js';
1
+ import { T as TraceHealth } from '../types-DxYXuFxj.js';
2
+ import '../ir-Qnw6L265.js';
3
3
  import '../dialect.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-D-G7KXeI.mjs';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-B4zlO58J.mjs';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-B4zlO58J.mjs';
4
- import '../ir-9rrfI3yB.mjs';
1
+ import { G as GlassboxEvent } from '../types-8pWRDbUg.mjs';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-Cya0jPAF.mjs';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-Cya0jPAF.mjs';
4
+ import '../ir-BTvyl8-w.mjs';
5
5
  import '../dialect.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-DSknEy2B.js';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-iwyFQHt3.js';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-iwyFQHt3.js';
4
- import '../ir-Dx_UXPfP.js';
1
+ import { G as GlassboxEvent } from '../types-BdYlJz0Z.js';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DxYXuFxj.js';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DxYXuFxj.js';
4
+ import '../ir-Qnw6L265.js';
5
5
  import '../dialect.js';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ARCHETYPE_FLOOR_DEFAULT,
3
3
  getDefaultFallbackChain
4
- } from "../chunk-DJVGJEJU.mjs";
4
+ } from "../chunk-SBFSYCQG.mjs";
5
5
  import {
6
6
  tryGetProfile
7
7
  } from "../chunk-4UO4CCSP.mjs";
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as TraceDetail } from '../../types-B4zlO58J.mjs';
3
- import '../../ir-9rrfI3yB.mjs';
2
+ import { a as TraceDetail } from '../../types-Cya0jPAF.mjs';
3
+ import '../../ir-BTvyl8-w.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-iwyFQHt3.js';
3
- import '../../ir-Dx_UXPfP.js';
2
+ import { a as TraceDetail } from '../../types-DxYXuFxj.js';
3
+ import '../../ir-Qnw6L265.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-9rrfI3yB.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-9rrfI3yB.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-BTvyl8-w.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-BTvyl8-w.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';
@@ -78,6 +78,19 @@ interface ExecuteErr {
78
78
  errorCode: string;
79
79
  message: string;
80
80
  raw: unknown;
81
+ /**
82
+ * alpha.66 — real token usage when the failure is a SYNTHESIZED
83
+ * structured-output contract violation (the provider returned 200 with
84
+ * usage; the response just violated the contract). Absent on transport-
85
+ * level failures (4xx/5xx/network) where no usage exists. Lets the
86
+ * brain's failure rows carry true `tokens_in` for the cliff class —
87
+ * PB's 2026-05-18 `chain-walk-on-structured-output-parse-failed` ask 4
88
+ * (tokens_in=0 on a 72s parse-fail made diagnosis ambiguous).
89
+ */
90
+ tokens?: {
91
+ input: number;
92
+ output: number;
93
+ };
81
94
  }
82
95
  type ExecuteResult = ExecuteOk | ExecuteErr;
83
96
  declare function execute(request: CompiledRequest, opts?: ExecuteOptions): Promise<ExecuteResult>;
@@ -597,6 +610,12 @@ interface OutcomePayload {
597
610
  system_prompt_chars?: number;
598
611
  fell_over_from?: string;
599
612
  fallback_reason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
613
+ /**
614
+ * True when the same-model retry (CallOptions.sameModelRetry) fired
615
+ * during this call. Key OMITTED (not false) when no retry fired — safe
616
+ * against brains that haven't applied migration 039 yet.
617
+ */
618
+ retried_same_model?: boolean;
600
619
  /**
601
620
  * Per-call SectionRewrite[] captured at compile time. Omitted (sent as
602
621
  * undefined → stored NULL) when no rewrites fired. Powers cross-app
@@ -923,7 +942,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
923
942
  * guard in `tests/version.test.ts` fails the suite (and therefore
924
943
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
925
944
  */
926
- declare const LIBRARY_VERSION = "2.0.0-alpha.65";
945
+ declare const LIBRARY_VERSION = "2.0.0-alpha.66";
927
946
 
928
947
  /**
929
948
  * 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-Dx_UXPfP.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-Dx_UXPfP.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-Qnw6L265.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-Qnw6L265.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';
@@ -78,6 +78,19 @@ interface ExecuteErr {
78
78
  errorCode: string;
79
79
  message: string;
80
80
  raw: unknown;
81
+ /**
82
+ * alpha.66 — real token usage when the failure is a SYNTHESIZED
83
+ * structured-output contract violation (the provider returned 200 with
84
+ * usage; the response just violated the contract). Absent on transport-
85
+ * level failures (4xx/5xx/network) where no usage exists. Lets the
86
+ * brain's failure rows carry true `tokens_in` for the cliff class —
87
+ * PB's 2026-05-18 `chain-walk-on-structured-output-parse-failed` ask 4
88
+ * (tokens_in=0 on a 72s parse-fail made diagnosis ambiguous).
89
+ */
90
+ tokens?: {
91
+ input: number;
92
+ output: number;
93
+ };
81
94
  }
82
95
  type ExecuteResult = ExecuteOk | ExecuteErr;
83
96
  declare function execute(request: CompiledRequest, opts?: ExecuteOptions): Promise<ExecuteResult>;
@@ -597,6 +610,12 @@ interface OutcomePayload {
597
610
  system_prompt_chars?: number;
598
611
  fell_over_from?: string;
599
612
  fallback_reason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
613
+ /**
614
+ * True when the same-model retry (CallOptions.sameModelRetry) fired
615
+ * during this call. Key OMITTED (not false) when no retry fired — safe
616
+ * against brains that haven't applied migration 039 yet.
617
+ */
618
+ retried_same_model?: boolean;
600
619
  /**
601
620
  * Per-call SectionRewrite[] captured at compile time. Omitted (sent as
602
621
  * undefined → stored NULL) when no rewrites fired. Powers cross-app
@@ -923,7 +942,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
923
942
  * guard in `tests/version.test.ts` fails the suite (and therefore
924
943
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
925
944
  */
926
- declare const LIBRARY_VERSION = "2.0.0-alpha.65";
945
+ declare const LIBRARY_VERSION = "2.0.0-alpha.66";
927
946
 
928
947
  /**
929
948
  * Oracle contract — how an app tells the brain whether a response was good.
package/dist/index.js CHANGED
@@ -5251,6 +5251,9 @@ function buildPayload(input, reg) {
5251
5251
  system_prompt_chars: input.systemPromptChars ?? reg?.systemPromptChars,
5252
5252
  fell_over_from: fellOverFrom,
5253
5253
  fallback_reason: fallbackReason,
5254
+ // alpha.66 — omitted-undefined keeps the key out of the JSON body
5255
+ // entirely for non-retry rows (pre-migration-039 brain safety).
5256
+ retried_same_model: input.retriedSameModel,
5254
5257
  // alpha.29 — translator activity (migration 019). Send NULL when no
5255
5258
  // rewrites fired so the brain's "did the translator do anything?"
5256
5259
  // queries can use `IS NOT NULL` cleanly.
@@ -5607,6 +5610,10 @@ function readBrainReadEnv(envSource = defaultEnv()) {
5607
5610
  if (!anonKey) missingEnv.push("KGAUTO_V2_BRAIN_ANON_KEY");
5608
5611
  return { endpoint, jwt, anonKey, missingEnv };
5609
5612
  }
5613
+ function isSameModelRetryEnabledFromEnv(envSource = defaultEnv()) {
5614
+ const raw = (envSource.KGAUTO_SAME_MODEL_RETRY ?? "").trim().toLowerCase();
5615
+ return raw === "1" || raw === "true";
5616
+ }
5610
5617
 
5611
5618
  // src/streaming.ts
5612
5619
  var ANTHROPIC_URL = "https://api.anthropic.com/v1/messages";
@@ -6958,6 +6965,8 @@ async function call(ir, opts = {}) {
6958
6965
  let activeCompile = initial;
6959
6966
  let lastErr;
6960
6967
  const failedProviders = /* @__PURE__ */ new Set();
6968
+ const sameModelRetryEnabled = opts.sameModelRetry ?? isSameModelRetryEnabledFromEnv();
6969
+ let retriedSameModel = false;
6961
6970
  for (let i = 0; i < targetsToTry.length; i++) {
6962
6971
  const targetModel = targetsToTry[i];
6963
6972
  const targetProfile = tryGetProfile(targetModel);
@@ -6995,15 +7004,37 @@ async function call(ir, opts = {}) {
6995
7004
  );
6996
7005
  const targetSupportsStreaming = targetProfile?.streaming === true;
6997
7006
  const streamingOnChunk = opts.onChunk && !opts.noStream && targetSupportsStreaming ? opts.onChunk : void 0;
6998
- const exec = await execute(activeCompile.request, {
7007
+ const execOpts = {
6999
7008
  apiKeys: opts.apiKeys,
7000
7009
  fetchImpl: opts.fetchImpl,
7001
7010
  providerOverrides: opts.providerOverrides,
7002
7011
  onChunk: streamingOnChunk
7003
- });
7004
- const validated = exec.ok ? validateStructuredContract(exec, ir) : exec;
7012
+ };
7013
+ const exec = await execute(activeCompile.request, execOpts);
7014
+ let validated = exec.ok ? validateStructuredContract(exec, ir) : exec;
7015
+ let servedByRetry = false;
7016
+ if (!validated.ok && isStructuredContractViolation(validated.errorCode) && sameModelRetryEnabled && !retriedSameModel) {
7017
+ retriedSameModel = true;
7018
+ attempts.push({
7019
+ model: targetModel,
7020
+ status: validated.errorType,
7021
+ errorCode: validated.errorCode,
7022
+ message: validated.message
7023
+ });
7024
+ const retryRequest = validated.errorCode === "max_tokens_on_structured_output" ? raiseOutputBudget(activeCompile.request, targetProfile) : activeCompile.request;
7025
+ safeEmit(
7026
+ () => emitExecuteAttempt(traceId, ir.appId, { model: targetModel, attemptIndex: i })
7027
+ );
7028
+ const retryExec = await execute(retryRequest, execOpts);
7029
+ validated = retryExec.ok ? validateStructuredContract(retryExec, ir) : retryExec;
7030
+ servedByRetry = true;
7031
+ }
7005
7032
  if (validated.ok) {
7006
- attempts.push({ model: targetModel, status: "success" });
7033
+ attempts.push({
7034
+ model: targetModel,
7035
+ status: "success",
7036
+ ...servedByRetry ? { sameModelRetry: true } : {}
7037
+ });
7007
7038
  const latencyMs2 = Date.now() - start;
7008
7039
  safeEmit(
7009
7040
  () => emitExecuteSuccess(traceId, ir.appId, {
@@ -7040,7 +7071,10 @@ async function call(ir, opts = {}) {
7040
7071
  finishReason: validated.response.finishReason,
7041
7072
  totalMs: latencyMs2,
7042
7073
  fellOverFrom: fellOver ? initial.target : void 0,
7043
- fallbackReason
7074
+ fallbackReason,
7075
+ // alpha.66 — migration 039. Omitted (not false) when no retry fired
7076
+ // so pre-039 brains never see the key.
7077
+ retriedSameModel: retriedSameModel || void 0
7044
7078
  });
7045
7079
  if (fellOver) {
7046
7080
  const firstFailed = attempts.find((a) => a.status !== "success");
@@ -7098,6 +7132,7 @@ async function call(ir, opts = {}) {
7098
7132
  servedBy: targetModel,
7099
7133
  fellOverFrom: fellOver ? initial.target : void 0,
7100
7134
  fallbackReason,
7135
+ retriedSameModel: retriedSameModel || void 0,
7101
7136
  unreachableFiltered,
7102
7137
  policyBlockedFiltered,
7103
7138
  traceId,
@@ -7112,7 +7147,8 @@ async function call(ir, opts = {}) {
7112
7147
  model: targetModel,
7113
7148
  status: validated.errorType,
7114
7149
  errorCode: validated.errorCode,
7115
- message: validated.message
7150
+ message: validated.message,
7151
+ ...servedByRetry ? { sameModelRetry: true } : {}
7116
7152
  });
7117
7153
  lastErr = validated;
7118
7154
  if (validated.errorType === "terminal" || opts.noFallback) {
@@ -7123,15 +7159,20 @@ async function call(ir, opts = {}) {
7123
7159
  break;
7124
7160
  }
7125
7161
  }
7162
+ const lastAttempted = [...attempts].reverse().find(
7163
+ (a) => a.status !== "success" && a.errorCode !== "auth_inferred" && a.errorCode !== "compile_error"
7164
+ );
7126
7165
  const latencyMs = Date.now() - start;
7127
7166
  await record({
7128
7167
  handle: initial.handle,
7129
- tokensIn: 0,
7130
- tokensOut: 0,
7168
+ tokensIn: lastErr?.tokens?.input ?? 0,
7169
+ tokensOut: lastErr?.tokens?.output ?? 0,
7131
7170
  latencyMs,
7132
7171
  success: false,
7133
7172
  errorType: lastErr?.errorCode,
7134
- promptPreview: extractPromptPreview(ir)
7173
+ promptPreview: extractPromptPreview(ir),
7174
+ actualModel: lastAttempted?.model,
7175
+ retriedSameModel: retriedSameModel || void 0
7135
7176
  });
7136
7177
  const filteredNote = unreachableFiltered && unreachableFiltered.length > 0 ? ` (also auto-filtered: [${unreachableFiltered.join(", ")}] \u2014 no API key)` : "";
7137
7178
  const blockedNote = policyBlockedFiltered && policyBlockedFiltered.length > 0 ? ` (also policy-blocked: [${policyBlockedFiltered.join(", ")}])` : "";
@@ -7376,7 +7417,10 @@ function validateStructuredContract(exec, ir) {
7376
7417
  errorType: "retryable",
7377
7418
  errorCode: "max_tokens_on_structured_output",
7378
7419
  message: `Provider returned finishReason="${exec.response.finishReason}" on a structured-output call \u2014 output truncated mid-token, JSON cannot be valid`,
7379
- raw: exec.response.raw
7420
+ raw: exec.response.raw,
7421
+ // alpha.66 — the provider DID serve this call; carry the real usage so
7422
+ // exhausted-chain failure rows aren't stamped tokens_in=0 (PB 05-18 ask 4).
7423
+ tokens: { input: exec.response.tokens.input, output: exec.response.tokens.output }
7380
7424
  };
7381
7425
  }
7382
7426
  if (!exec.response.text) {
@@ -7392,10 +7436,35 @@ function validateStructuredContract(exec, ir) {
7392
7436
  errorType: "retryable",
7393
7437
  errorCode: "structured_output_parse_failed",
7394
7438
  message: err instanceof Error ? err.message : String(err),
7395
- raw: exec.response.raw
7439
+ raw: exec.response.raw,
7440
+ tokens: { input: exec.response.tokens.input, output: exec.response.tokens.output }
7396
7441
  };
7397
7442
  }
7398
7443
  }
7444
+ function isStructuredContractViolation(code) {
7445
+ return code === "max_tokens_on_structured_output" || code === "structured_output_parse_failed";
7446
+ }
7447
+ function raiseOutputBudget(request, profile) {
7448
+ if (!profile) return request;
7449
+ if (request.provider === "anthropic") {
7450
+ if (typeof request.max_tokens === "number" && request.max_tokens < profile.maxOutputTokens) {
7451
+ return { ...request, max_tokens: profile.maxOutputTokens };
7452
+ }
7453
+ return request;
7454
+ }
7455
+ if (request.provider === "google") {
7456
+ const gc = request.generationConfig;
7457
+ const cap = gc?.maxOutputTokens;
7458
+ if (typeof cap === "number" && cap < profile.maxOutputTokens) {
7459
+ return {
7460
+ ...request,
7461
+ generationConfig: { ...gc, maxOutputTokens: profile.maxOutputTokens }
7462
+ };
7463
+ }
7464
+ return request;
7465
+ }
7466
+ return request;
7467
+ }
7399
7468
  function normalizeFallbackReason(attempts) {
7400
7469
  const first = attempts.find((a) => a.status !== "success");
7401
7470
  if (!first) return void 0;
@@ -7428,6 +7497,8 @@ function safeEmit(fn) {
7428
7497
  var _internal = {
7429
7498
  compileAndRegister,
7430
7499
  validateStructuredContract,
7500
+ isStructuredContractViolation,
7501
+ raiseOutputBudget,
7431
7502
  extractPromptPreview,
7432
7503
  normalizeFallbackReason,
7433
7504
  generateTraceId,
@@ -8216,7 +8287,7 @@ function createBrainForwardRoutes(config) {
8216
8287
  }
8217
8288
 
8218
8289
  // src/version.ts
8219
- var LIBRARY_VERSION = "2.0.0-alpha.65";
8290
+ var LIBRARY_VERSION = "2.0.0-alpha.66";
8220
8291
 
8221
8292
  // src/key-health.ts
8222
8293
  var JSON_HEADERS2 = { "Content-Type": "application/json" };
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  LIBRARY_VERSION,
17
17
  createKeyHealthRoute
18
- } from "./chunk-XTZ2ZQJQ.mjs";
18
+ } from "./chunk-CMB6PZWS.mjs";
19
19
  import {
20
20
  ABSOLUTE_FLOOR,
21
21
  ARCHETYPE_FLOOR_DEFAULT,
@@ -37,10 +37,11 @@ import {
37
37
  isBrainQueryActiveFor,
38
38
  isModelReachable,
39
39
  isProviderReachable,
40
+ isSameModelRetryEnabledFromEnv,
40
41
  loadChainsFromBrain,
41
42
  readBrainReadEnv,
42
43
  resolveProviderKey
43
- } from "./chunk-DJVGJEJU.mjs";
44
+ } from "./chunk-SBFSYCQG.mjs";
44
45
  import {
45
46
  ALIASES,
46
47
  LATENCY_TIER_MS,
@@ -3231,6 +3232,9 @@ function buildPayload(input, reg) {
3231
3232
  system_prompt_chars: input.systemPromptChars ?? reg?.systemPromptChars,
3232
3233
  fell_over_from: fellOverFrom,
3233
3234
  fallback_reason: fallbackReason,
3235
+ // alpha.66 — omitted-undefined keeps the key out of the JSON body
3236
+ // entirely for non-retry rows (pre-migration-039 brain safety).
3237
+ retried_same_model: input.retriedSameModel,
3234
3238
  // alpha.29 — translator activity (migration 019). Send NULL when no
3235
3239
  // rewrites fired so the brain's "did the translator do anything?"
3236
3240
  // queries can use `IS NOT NULL` cleanly.
@@ -4203,6 +4207,8 @@ async function call(ir, opts = {}) {
4203
4207
  let activeCompile = initial;
4204
4208
  let lastErr;
4205
4209
  const failedProviders = /* @__PURE__ */ new Set();
4210
+ const sameModelRetryEnabled = opts.sameModelRetry ?? isSameModelRetryEnabledFromEnv();
4211
+ let retriedSameModel = false;
4206
4212
  for (let i = 0; i < targetsToTry.length; i++) {
4207
4213
  const targetModel = targetsToTry[i];
4208
4214
  const targetProfile = tryGetProfile(targetModel);
@@ -4240,15 +4246,37 @@ async function call(ir, opts = {}) {
4240
4246
  );
4241
4247
  const targetSupportsStreaming = targetProfile?.streaming === true;
4242
4248
  const streamingOnChunk = opts.onChunk && !opts.noStream && targetSupportsStreaming ? opts.onChunk : void 0;
4243
- const exec = await execute(activeCompile.request, {
4249
+ const execOpts = {
4244
4250
  apiKeys: opts.apiKeys,
4245
4251
  fetchImpl: opts.fetchImpl,
4246
4252
  providerOverrides: opts.providerOverrides,
4247
4253
  onChunk: streamingOnChunk
4248
- });
4249
- const validated = exec.ok ? validateStructuredContract(exec, ir) : exec;
4254
+ };
4255
+ const exec = await execute(activeCompile.request, execOpts);
4256
+ let validated = exec.ok ? validateStructuredContract(exec, ir) : exec;
4257
+ let servedByRetry = false;
4258
+ if (!validated.ok && isStructuredContractViolation(validated.errorCode) && sameModelRetryEnabled && !retriedSameModel) {
4259
+ retriedSameModel = true;
4260
+ attempts.push({
4261
+ model: targetModel,
4262
+ status: validated.errorType,
4263
+ errorCode: validated.errorCode,
4264
+ message: validated.message
4265
+ });
4266
+ const retryRequest = validated.errorCode === "max_tokens_on_structured_output" ? raiseOutputBudget(activeCompile.request, targetProfile) : activeCompile.request;
4267
+ safeEmit(
4268
+ () => emitExecuteAttempt(traceId, ir.appId, { model: targetModel, attemptIndex: i })
4269
+ );
4270
+ const retryExec = await execute(retryRequest, execOpts);
4271
+ validated = retryExec.ok ? validateStructuredContract(retryExec, ir) : retryExec;
4272
+ servedByRetry = true;
4273
+ }
4250
4274
  if (validated.ok) {
4251
- attempts.push({ model: targetModel, status: "success" });
4275
+ attempts.push({
4276
+ model: targetModel,
4277
+ status: "success",
4278
+ ...servedByRetry ? { sameModelRetry: true } : {}
4279
+ });
4252
4280
  const latencyMs2 = Date.now() - start;
4253
4281
  safeEmit(
4254
4282
  () => emitExecuteSuccess(traceId, ir.appId, {
@@ -4285,7 +4313,10 @@ async function call(ir, opts = {}) {
4285
4313
  finishReason: validated.response.finishReason,
4286
4314
  totalMs: latencyMs2,
4287
4315
  fellOverFrom: fellOver ? initial.target : void 0,
4288
- fallbackReason
4316
+ fallbackReason,
4317
+ // alpha.66 — migration 039. Omitted (not false) when no retry fired
4318
+ // so pre-039 brains never see the key.
4319
+ retriedSameModel: retriedSameModel || void 0
4289
4320
  });
4290
4321
  if (fellOver) {
4291
4322
  const firstFailed = attempts.find((a) => a.status !== "success");
@@ -4343,6 +4374,7 @@ async function call(ir, opts = {}) {
4343
4374
  servedBy: targetModel,
4344
4375
  fellOverFrom: fellOver ? initial.target : void 0,
4345
4376
  fallbackReason,
4377
+ retriedSameModel: retriedSameModel || void 0,
4346
4378
  unreachableFiltered,
4347
4379
  policyBlockedFiltered,
4348
4380
  traceId,
@@ -4357,7 +4389,8 @@ async function call(ir, opts = {}) {
4357
4389
  model: targetModel,
4358
4390
  status: validated.errorType,
4359
4391
  errorCode: validated.errorCode,
4360
- message: validated.message
4392
+ message: validated.message,
4393
+ ...servedByRetry ? { sameModelRetry: true } : {}
4361
4394
  });
4362
4395
  lastErr = validated;
4363
4396
  if (validated.errorType === "terminal" || opts.noFallback) {
@@ -4368,15 +4401,20 @@ async function call(ir, opts = {}) {
4368
4401
  break;
4369
4402
  }
4370
4403
  }
4404
+ const lastAttempted = [...attempts].reverse().find(
4405
+ (a) => a.status !== "success" && a.errorCode !== "auth_inferred" && a.errorCode !== "compile_error"
4406
+ );
4371
4407
  const latencyMs = Date.now() - start;
4372
4408
  await record({
4373
4409
  handle: initial.handle,
4374
- tokensIn: 0,
4375
- tokensOut: 0,
4410
+ tokensIn: lastErr?.tokens?.input ?? 0,
4411
+ tokensOut: lastErr?.tokens?.output ?? 0,
4376
4412
  latencyMs,
4377
4413
  success: false,
4378
4414
  errorType: lastErr?.errorCode,
4379
- promptPreview: extractPromptPreview(ir)
4415
+ promptPreview: extractPromptPreview(ir),
4416
+ actualModel: lastAttempted?.model,
4417
+ retriedSameModel: retriedSameModel || void 0
4380
4418
  });
4381
4419
  const filteredNote = unreachableFiltered && unreachableFiltered.length > 0 ? ` (also auto-filtered: [${unreachableFiltered.join(", ")}] \u2014 no API key)` : "";
4382
4420
  const blockedNote = policyBlockedFiltered && policyBlockedFiltered.length > 0 ? ` (also policy-blocked: [${policyBlockedFiltered.join(", ")}])` : "";
@@ -4621,7 +4659,10 @@ function validateStructuredContract(exec, ir) {
4621
4659
  errorType: "retryable",
4622
4660
  errorCode: "max_tokens_on_structured_output",
4623
4661
  message: `Provider returned finishReason="${exec.response.finishReason}" on a structured-output call \u2014 output truncated mid-token, JSON cannot be valid`,
4624
- raw: exec.response.raw
4662
+ raw: exec.response.raw,
4663
+ // alpha.66 — the provider DID serve this call; carry the real usage so
4664
+ // exhausted-chain failure rows aren't stamped tokens_in=0 (PB 05-18 ask 4).
4665
+ tokens: { input: exec.response.tokens.input, output: exec.response.tokens.output }
4625
4666
  };
4626
4667
  }
4627
4668
  if (!exec.response.text) {
@@ -4637,10 +4678,35 @@ function validateStructuredContract(exec, ir) {
4637
4678
  errorType: "retryable",
4638
4679
  errorCode: "structured_output_parse_failed",
4639
4680
  message: err instanceof Error ? err.message : String(err),
4640
- raw: exec.response.raw
4681
+ raw: exec.response.raw,
4682
+ tokens: { input: exec.response.tokens.input, output: exec.response.tokens.output }
4641
4683
  };
4642
4684
  }
4643
4685
  }
4686
+ function isStructuredContractViolation(code) {
4687
+ return code === "max_tokens_on_structured_output" || code === "structured_output_parse_failed";
4688
+ }
4689
+ function raiseOutputBudget(request, profile) {
4690
+ if (!profile) return request;
4691
+ if (request.provider === "anthropic") {
4692
+ if (typeof request.max_tokens === "number" && request.max_tokens < profile.maxOutputTokens) {
4693
+ return { ...request, max_tokens: profile.maxOutputTokens };
4694
+ }
4695
+ return request;
4696
+ }
4697
+ if (request.provider === "google") {
4698
+ const gc = request.generationConfig;
4699
+ const cap = gc?.maxOutputTokens;
4700
+ if (typeof cap === "number" && cap < profile.maxOutputTokens) {
4701
+ return {
4702
+ ...request,
4703
+ generationConfig: { ...gc, maxOutputTokens: profile.maxOutputTokens }
4704
+ };
4705
+ }
4706
+ return request;
4707
+ }
4708
+ return request;
4709
+ }
4644
4710
  function normalizeFallbackReason(attempts) {
4645
4711
  const first = attempts.find((a) => a.status !== "success");
4646
4712
  if (!first) return void 0;
@@ -4673,6 +4739,8 @@ function safeEmit(fn) {
4673
4739
  var _internal = {
4674
4740
  compileAndRegister,
4675
4741
  validateStructuredContract,
4742
+ isStructuredContractViolation,
4743
+ raiseOutputBudget,
4676
4744
  extractPromptPreview,
4677
4745
  normalizeFallbackReason,
4678
4746
  generateTraceId,
@@ -1065,12 +1065,40 @@ interface CallOptions {
1065
1065
  * capture never fires.
1066
1066
  */
1067
1067
  goldenCapture?: GoldenCaptureOptions;
1068
+ /**
1069
+ * alpha.66 — one same-model retry on a structured-output contract violation
1070
+ * (`max_tokens_on_structured_output` / `structured_output_parse_failed`)
1071
+ * BEFORE chain-walking to a lower-ranked tier. Filed by playbacksam
1072
+ * 2026-07-18 (`structured-output-truncation-retry-same-model`): on PB's
1073
+ * summarize surface the walk destination is measured quality-inferior
1074
+ * (golden eval run #3), so one more attempt at the leader beats walking.
1075
+ *
1076
+ * Consent posture (matches KGAUTO_AUTO_PROMOTE / KGAUTO_GOLDEN_CAPTURE):
1077
+ * default OFF; `true` wins, explicit `false` beats the env, undefined
1078
+ * falls through to the `KGAUTO_SAME_MODEL_RETRY` env var ('1'/'true').
1079
+ * Default-off because the retry adds one full model round-trip of latency
1080
+ * in the failure class — the consumer decides whether their fallback tier
1081
+ * is bad enough to pay that.
1082
+ *
1083
+ * Bounds: at most ONE retry per call(), on whichever target hits the
1084
+ * contract violation first. Truncation-class retries additionally raise
1085
+ * any explicit wire output cap sitting below the profile's
1086
+ * `maxOutputTokens` (e.g. a terse-clamp or providerOverrides cap);
1087
+ * requests already at the profile ceiling re-roll unchanged.
1088
+ */
1089
+ sameModelRetry?: boolean;
1068
1090
  }
1069
1091
  interface CallAttempt {
1070
1092
  model: string;
1071
1093
  status: 'success' | 'retryable' | 'terminal';
1072
1094
  errorCode?: string;
1073
1095
  message?: string;
1096
+ /**
1097
+ * alpha.66 — true on the attempt row that was the one-shot same-model
1098
+ * retry (CallOptions.sameModelRetry). The preceding row for the same model
1099
+ * carries the contract violation that triggered it.
1100
+ */
1101
+ sameModelRetry?: boolean;
1074
1102
  }
1075
1103
  /**
1076
1104
  * Why fallback fired. Normalized for `CallResult.fallbackReason` (alpha.9).
@@ -1126,6 +1154,14 @@ interface CallResult {
1126
1154
  fellOverFrom?: string;
1127
1155
  /** Set only when fallback fired. Normalized cause. */
1128
1156
  fallbackReason?: FallbackReason;
1157
+ /**
1158
+ * alpha.66 — true when the one-shot same-model retry
1159
+ * (CallOptions.sameModelRetry) fired during this call, regardless of
1160
+ * whether the retry rescued the call or the chain walked afterwards.
1161
+ * Cross-check `attempts[]` (the `sameModelRetry: true` row) and
1162
+ * `fellOverFrom` to distinguish rescued-by-retry from retried-then-walked.
1163
+ */
1164
+ retriedSameModel?: boolean;
1129
1165
  /**
1130
1166
  * alpha.10. Models that auto-filter dropped from the fallback walk because
1131
1167
  * their provider had no reachable API key. Empty when nothing was filtered
@@ -1323,6 +1359,13 @@ interface RecordInput {
1323
1359
  * keep in sync with the wire-contract enum (TraceDetail.fallbackReason).
1324
1360
  */
1325
1361
  fallbackReason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
1362
+ /**
1363
+ * alpha.66 — true when the one-shot same-model retry fired during this
1364
+ * call (migration 039 `retried_same_model`). Powers the offline rollup:
1365
+ * retry rate on the cliff class, and — joined with `fell_over_from` —
1366
+ * how often the retry rescued the call vs the chain walking anyway.
1367
+ */
1368
+ retriedSameModel?: boolean;
1326
1369
  }
1327
1370
  /**
1328
1371
  * alpha.20 Entry 4: kinds of consumer-declared outcomes feeding the quality
@@ -1065,12 +1065,40 @@ interface CallOptions {
1065
1065
  * capture never fires.
1066
1066
  */
1067
1067
  goldenCapture?: GoldenCaptureOptions;
1068
+ /**
1069
+ * alpha.66 — one same-model retry on a structured-output contract violation
1070
+ * (`max_tokens_on_structured_output` / `structured_output_parse_failed`)
1071
+ * BEFORE chain-walking to a lower-ranked tier. Filed by playbacksam
1072
+ * 2026-07-18 (`structured-output-truncation-retry-same-model`): on PB's
1073
+ * summarize surface the walk destination is measured quality-inferior
1074
+ * (golden eval run #3), so one more attempt at the leader beats walking.
1075
+ *
1076
+ * Consent posture (matches KGAUTO_AUTO_PROMOTE / KGAUTO_GOLDEN_CAPTURE):
1077
+ * default OFF; `true` wins, explicit `false` beats the env, undefined
1078
+ * falls through to the `KGAUTO_SAME_MODEL_RETRY` env var ('1'/'true').
1079
+ * Default-off because the retry adds one full model round-trip of latency
1080
+ * in the failure class — the consumer decides whether their fallback tier
1081
+ * is bad enough to pay that.
1082
+ *
1083
+ * Bounds: at most ONE retry per call(), on whichever target hits the
1084
+ * contract violation first. Truncation-class retries additionally raise
1085
+ * any explicit wire output cap sitting below the profile's
1086
+ * `maxOutputTokens` (e.g. a terse-clamp or providerOverrides cap);
1087
+ * requests already at the profile ceiling re-roll unchanged.
1088
+ */
1089
+ sameModelRetry?: boolean;
1068
1090
  }
1069
1091
  interface CallAttempt {
1070
1092
  model: string;
1071
1093
  status: 'success' | 'retryable' | 'terminal';
1072
1094
  errorCode?: string;
1073
1095
  message?: string;
1096
+ /**
1097
+ * alpha.66 — true on the attempt row that was the one-shot same-model
1098
+ * retry (CallOptions.sameModelRetry). The preceding row for the same model
1099
+ * carries the contract violation that triggered it.
1100
+ */
1101
+ sameModelRetry?: boolean;
1074
1102
  }
1075
1103
  /**
1076
1104
  * Why fallback fired. Normalized for `CallResult.fallbackReason` (alpha.9).
@@ -1126,6 +1154,14 @@ interface CallResult {
1126
1154
  fellOverFrom?: string;
1127
1155
  /** Set only when fallback fired. Normalized cause. */
1128
1156
  fallbackReason?: FallbackReason;
1157
+ /**
1158
+ * alpha.66 — true when the one-shot same-model retry
1159
+ * (CallOptions.sameModelRetry) fired during this call, regardless of
1160
+ * whether the retry rescued the call or the chain walked afterwards.
1161
+ * Cross-check `attempts[]` (the `sameModelRetry: true` row) and
1162
+ * `fellOverFrom` to distinguish rescued-by-retry from retried-then-walked.
1163
+ */
1164
+ retriedSameModel?: boolean;
1129
1165
  /**
1130
1166
  * alpha.10. Models that auto-filter dropped from the fallback walk because
1131
1167
  * their provider had no reachable API key. Empty when nothing was filtered
@@ -1323,6 +1359,13 @@ interface RecordInput {
1323
1359
  * keep in sync with the wire-contract enum (TraceDetail.fallbackReason).
1324
1360
  */
1325
1361
  fallbackReason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
1362
+ /**
1363
+ * alpha.66 — true when the one-shot same-model retry fired during this
1364
+ * call (migration 039 `retried_same_model`). Powers the offline rollup:
1365
+ * retry rate on the cliff class, and — joined with `fell_over_from` —
1366
+ * how often the retry rescued the call vs the chain walking anyway.
1367
+ */
1368
+ retriedSameModel?: boolean;
1326
1369
  }
1327
1370
  /**
1328
1371
  * 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.65";
28
+ var LIBRARY_VERSION = "2.0.0-alpha.66";
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-XTZ2ZQJQ.mjs";
3
+ } from "./chunk-CMB6PZWS.mjs";
4
4
  export {
5
5
  createKeyHealthRoute
6
6
  };
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-9rrfI3yB.mjs';
1
+ import { k as Provider } from './ir-BTvyl8-w.mjs';
2
2
  import { IntentArchetypeName } from './dialect.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-Dx_UXPfP.js';
1
+ import { k as Provider } from './ir-Qnw6L265.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-9rrfI3yB.mjs';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-BTvyl8-w.mjs';
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-Dx_UXPfP.js';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-Qnw6L265.js';
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-9rrfI3yB.mjs';
1
+ import { i as Adapter, x as SectionKind } from './ir-BTvyl8-w.mjs';
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-Dx_UXPfP.js';
1
+ import { i as Adapter, x as SectionKind } from './ir-Qnw6L265.js';
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.65",
3
+ "version": "2.0.0-alpha.66",
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",