@warmdrift/kgauto-compiler 2.0.0-alpha.75 → 2.0.0-alpha.77

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.
@@ -1209,12 +1209,21 @@ interface CallAttempt {
1209
1209
  * for alpha.10+ — e.g. mid-stream policy rejects)
1210
1210
  * - `provider_auth_failed` alpha.14 — initial provider returned 401/403
1211
1211
  * (upstream key revocation, malformed-but-truthy
1212
- * key, billing lapse). The chain walks to the
1213
- * next non-same-provider target instead of
1212
+ * key). The chain walks to the next
1213
+ * non-same-provider target instead of
1214
1214
  * short-circuiting; same-provider remaining
1215
1215
  * entries skip with errorCode='auth_inferred'.
1216
+ * - `provider_billing_exhausted` alpha.77 — the provider's ACCOUNT is out
1217
+ * of credits (Anthropic "credit balance is too
1218
+ * low" 400, OpenAI insufficient_quota 429,
1219
+ * Google billing-disabled, DeepSeek 402). Walks
1220
+ * like auth and skips same-provider siblings
1221
+ * (errorCode='billing_exhausted_inferred').
1222
+ * Distinct from auth AND from rate_limit because
1223
+ * its disposition is distinct: it never clears
1224
+ * on its own — a human funds the account.
1216
1225
  */
1217
- type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation' | 'provider_auth_failed';
1226
+ type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation' | 'provider_auth_failed' | 'provider_billing_exhausted';
1218
1227
  interface CallResult {
1219
1228
  /** Compile handle (still valid for record() if consumer wants to add oracle scores later). */
1220
1229
  handle: string;
@@ -1470,10 +1479,11 @@ interface RecordInput {
1470
1479
  /** Model originally targeted when a fallback fired. */
1471
1480
  fellOverFrom?: string;
1472
1481
  /**
1473
- * Why the fallback fired. Closed set mirroring CallResult.fallbackReason
1474
- * keep in sync with the wire-contract enum (TraceDetail.fallbackReason).
1482
+ * Why the fallback fired the SAME closed set as CallResult.fallbackReason
1483
+ * (one derivation; the alpha.77 DTS break caught this field's inline copy
1484
+ * drifting when the canonical union grew a member).
1475
1485
  */
1476
- fallbackReason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
1486
+ fallbackReason?: FallbackReason;
1477
1487
  /**
1478
1488
  * alpha.66 — true when the one-shot same-model retry fired during this
1479
1489
  * call (migration 039 `retried_same_model`). Powers the offline rollup:
@@ -1209,12 +1209,21 @@ interface CallAttempt {
1209
1209
  * for alpha.10+ — e.g. mid-stream policy rejects)
1210
1210
  * - `provider_auth_failed` alpha.14 — initial provider returned 401/403
1211
1211
  * (upstream key revocation, malformed-but-truthy
1212
- * key, billing lapse). The chain walks to the
1213
- * next non-same-provider target instead of
1212
+ * key). The chain walks to the next
1213
+ * non-same-provider target instead of
1214
1214
  * short-circuiting; same-provider remaining
1215
1215
  * entries skip with errorCode='auth_inferred'.
1216
+ * - `provider_billing_exhausted` alpha.77 — the provider's ACCOUNT is out
1217
+ * of credits (Anthropic "credit balance is too
1218
+ * low" 400, OpenAI insufficient_quota 429,
1219
+ * Google billing-disabled, DeepSeek 402). Walks
1220
+ * like auth and skips same-provider siblings
1221
+ * (errorCode='billing_exhausted_inferred').
1222
+ * Distinct from auth AND from rate_limit because
1223
+ * its disposition is distinct: it never clears
1224
+ * on its own — a human funds the account.
1216
1225
  */
1217
- type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation' | 'provider_auth_failed';
1226
+ type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation' | 'provider_auth_failed' | 'provider_billing_exhausted';
1218
1227
  interface CallResult {
1219
1228
  /** Compile handle (still valid for record() if consumer wants to add oracle scores later). */
1220
1229
  handle: string;
@@ -1470,10 +1479,11 @@ interface RecordInput {
1470
1479
  /** Model originally targeted when a fallback fired. */
1471
1480
  fellOverFrom?: string;
1472
1481
  /**
1473
- * Why the fallback fired. Closed set mirroring CallResult.fallbackReason
1474
- * keep in sync with the wire-contract enum (TraceDetail.fallbackReason).
1482
+ * Why the fallback fired the SAME closed set as CallResult.fallbackReason
1483
+ * (one derivation; the alpha.77 DTS break caught this field's inline copy
1484
+ * drifting when the canonical union grew a member).
1475
1485
  */
1476
- fallbackReason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
1486
+ fallbackReason?: FallbackReason;
1477
1487
  /**
1478
1488
  * alpha.66 — true when the one-shot same-model retry fired during this
1479
1489
  * call (migration 039 `retried_same_model`). Powers the offline rollup:
@@ -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.75";
28
+ var LIBRARY_VERSION = "2.0.0-alpha.77";
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-WP22F3CX.mjs";
3
+ } from "./chunk-GB7VJQ6C.mjs";
4
4
  export {
5
5
  createKeyHealthRoute
6
6
  };
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-CZukZvDn.mjs';
1
+ import { k as Provider } from './ir-CRV1_taF.mjs';
2
2
  import { IntentArchetypeName } from './dialect.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { k as Provider } from './ir-B0v2f9NY.js';
1
+ import { k as Provider } from './ir-C02EIElQ.js';
2
2
  import { IntentArchetypeName } from './dialect.js';
3
3
 
4
4
  /**
@@ -1,11 +1,4 @@
1
- import { i as Adapter, x as SectionKind } from './ir-B0v2f9NY.js';
2
-
3
- /**
4
- * Internal config + hook types for createGlassboxRoutes().
5
- *
6
- * The public contract lives on `GlassboxRoutesConfig` in ./index.ts; these
7
- * are the narrower per-handler shapes consumed by proxy.ts and stream.ts.
8
- */
1
+ import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-CRV1_taF.mjs';
9
2
 
10
3
  /**
11
4
  * Wire contract for the Glass-Box Chrome extension's brain-poll endpoint.
@@ -131,7 +124,7 @@ interface TraceDetail extends TraceSummary {
131
124
  /** Derived: cacheReadInputTokens / max(tokensIn, 1). 0-1. */
132
125
  inputCacheHitRatio: number;
133
126
  fellOverFrom?: string;
134
- fallbackReason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
127
+ fallbackReason?: FallbackReason;
135
128
  /** Up to 2 alternatives. Empty array (not undefined) when none qualify. */
136
129
  counterfactuals?: TraceCounterfactual[];
137
130
  /** Undefined when 7d volume < 5/day (insufficient data). */
@@ -1,4 +1,4 @@
1
- import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-B0v2f9NY.js';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-C02EIElQ.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-CZukZvDn.mjs';
1
+ import { s as MutationApplied, B as BestPracticeAdvisory, F as FallbackReason, m as CallAttempt } from './ir-CRV1_taF.mjs';
2
2
 
3
3
  /**
4
4
  * Glass-Box observability types (alpha.17).
@@ -1,11 +1,4 @@
1
- import { i as Adapter, x as SectionKind } from './ir-CZukZvDn.mjs';
2
-
3
- /**
4
- * Internal config + hook types for createGlassboxRoutes().
5
- *
6
- * The public contract lives on `GlassboxRoutesConfig` in ./index.ts; these
7
- * are the narrower per-handler shapes consumed by proxy.ts and stream.ts.
8
- */
1
+ import { i as Adapter, F as FallbackReason, x as SectionKind } from './ir-C02EIElQ.js';
9
2
 
10
3
  /**
11
4
  * Wire contract for the Glass-Box Chrome extension's brain-poll endpoint.
@@ -131,7 +124,7 @@ interface TraceDetail extends TraceSummary {
131
124
  /** Derived: cacheReadInputTokens / max(tokensIn, 1). 0-1. */
132
125
  inputCacheHitRatio: number;
133
126
  fellOverFrom?: string;
134
- fallbackReason?: 'rate_limit' | 'provider_auth_failed' | 'provider_error' | 'cliff' | 'cost_cap' | 'contract_violation';
127
+ fallbackReason?: FallbackReason;
135
128
  /** Up to 2 alternatives. Empty array (not undefined) when none qualify. */
136
129
  counterfactuals?: TraceCounterfactual[];
137
130
  /** Undefined when 7d volume < 5/day (insufficient data). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmdrift/kgauto-compiler",
3
- "version": "2.0.0-alpha.75",
3
+ "version": "2.0.0-alpha.77",
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",