@warmdrift/kgauto-compiler 2.0.0-alpha.13 → 2.0.0-alpha.14
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.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -0
- package/dist/index.mjs +16 -0
- package/dist/{profiles-B_sMA2eU.d.ts → profiles-D0y6aLk0.d.ts} +14 -8
- package/dist/{profiles-B5MCp_0L.d.mts → profiles-DTnIzGsA.d.mts} +14 -8
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as ModelProfile, C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, R as RecordInput, O as OracleScore, e as CompileResult, B as BestPracticeAdvisory, f as Provider } from './profiles-
|
|
2
|
-
export { g as ALIASES, h as CacheStrategy, i as CallAttempt, j as CallError, k as CliffRule, l as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, L as LoweringSpec, m as Message, n as MutationApplied, o as NormalizedTokens, p as PromptSection, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, T as ToolCall, s as ToolDefinition, t as allProfiles, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-
|
|
1
|
+
import { M as ModelProfile, C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, R as RecordInput, O as OracleScore, e as CompileResult, B as BestPracticeAdvisory, f as Provider } from './profiles-DTnIzGsA.mjs';
|
|
2
|
+
export { g as ALIASES, h as CacheStrategy, i as CallAttempt, j as CallError, k as CliffRule, l as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, L as LoweringSpec, m as Message, n as MutationApplied, o as NormalizedTokens, p as PromptSection, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, T as ToolCall, s as ToolDefinition, t as allProfiles, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-DTnIzGsA.mjs';
|
|
3
3
|
import { IntentArchetypeName } from './dialect.mjs';
|
|
4
4
|
export { ALL_ARCHETYPES, ContextBucket, DIALECT_VERSION, HistoryDepth, INTENT_ARCHETYPES, OutputMode, ShapeSignature, ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey } from './dialect.mjs';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as ModelProfile, C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, R as RecordInput, O as OracleScore, e as CompileResult, B as BestPracticeAdvisory, f as Provider } from './profiles-
|
|
2
|
-
export { g as ALIASES, h as CacheStrategy, i as CallAttempt, j as CallError, k as CliffRule, l as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, L as LoweringSpec, m as Message, n as MutationApplied, o as NormalizedTokens, p as PromptSection, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, T as ToolCall, s as ToolDefinition, t as allProfiles, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-
|
|
1
|
+
import { M as ModelProfile, C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, R as RecordInput, O as OracleScore, e as CompileResult, B as BestPracticeAdvisory, f as Provider } from './profiles-D0y6aLk0.js';
|
|
2
|
+
export { g as ALIASES, h as CacheStrategy, i as CallAttempt, j as CallError, k as CliffRule, l as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, L as LoweringSpec, m as Message, n as MutationApplied, o as NormalizedTokens, p as PromptSection, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, T as ToolCall, s as ToolDefinition, t as allProfiles, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-D0y6aLk0.js';
|
|
3
3
|
import { IntentArchetypeName } from './dialect.js';
|
|
4
4
|
export { ALL_ARCHETYPES, ContextBucket, DIALECT_VERSION, HistoryDepth, INTENT_ARCHETYPES, OutputMode, ShapeSignature, ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey } from './dialect.js';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -2336,8 +2336,19 @@ async function call(ir, opts = {}) {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
let activeCompile = initial;
|
|
2338
2338
|
let lastErr;
|
|
2339
|
+
const failedProviders = /* @__PURE__ */ new Set();
|
|
2339
2340
|
for (let i = 0; i < targetsToTry.length; i++) {
|
|
2340
2341
|
const targetModel = targetsToTry[i];
|
|
2342
|
+
const targetProfile = tryGetProfile(targetModel);
|
|
2343
|
+
if (targetProfile && failedProviders.has(targetProfile.provider) && !opts.noFallback) {
|
|
2344
|
+
attempts.push({
|
|
2345
|
+
model: targetModel,
|
|
2346
|
+
status: "terminal",
|
|
2347
|
+
errorCode: "auth_inferred",
|
|
2348
|
+
message: `Skipped \u2014 provider ${targetProfile.provider} returned 401/403 earlier in this call; same key inferred to fail`
|
|
2349
|
+
});
|
|
2350
|
+
continue;
|
|
2351
|
+
}
|
|
2341
2352
|
if (targetModel !== initial.target) {
|
|
2342
2353
|
try {
|
|
2343
2354
|
activeCompile = compileAndRegister(
|
|
@@ -2406,6 +2417,10 @@ async function call(ir, opts = {}) {
|
|
|
2406
2417
|
});
|
|
2407
2418
|
lastErr = validated;
|
|
2408
2419
|
if (validated.errorType === "terminal" || opts.noFallback) {
|
|
2420
|
+
if (validated.errorCode === "auth" && !opts.noFallback && activeCompile.provider) {
|
|
2421
|
+
failedProviders.add(activeCompile.provider);
|
|
2422
|
+
continue;
|
|
2423
|
+
}
|
|
2409
2424
|
break;
|
|
2410
2425
|
}
|
|
2411
2426
|
}
|
|
@@ -2484,6 +2499,7 @@ function normalizeFallbackReason(attempts) {
|
|
|
2484
2499
|
return "cliff";
|
|
2485
2500
|
}
|
|
2486
2501
|
if (code === "cost_cap_exceeded") return "cost_cap";
|
|
2502
|
+
if (code === "auth" || code === "auth_inferred") return "provider_auth_failed";
|
|
2487
2503
|
return "provider_error";
|
|
2488
2504
|
}
|
|
2489
2505
|
|
package/dist/index.mjs
CHANGED
|
@@ -1546,8 +1546,19 @@ async function call(ir, opts = {}) {
|
|
|
1546
1546
|
}
|
|
1547
1547
|
let activeCompile = initial;
|
|
1548
1548
|
let lastErr;
|
|
1549
|
+
const failedProviders = /* @__PURE__ */ new Set();
|
|
1549
1550
|
for (let i = 0; i < targetsToTry.length; i++) {
|
|
1550
1551
|
const targetModel = targetsToTry[i];
|
|
1552
|
+
const targetProfile = tryGetProfile(targetModel);
|
|
1553
|
+
if (targetProfile && failedProviders.has(targetProfile.provider) && !opts.noFallback) {
|
|
1554
|
+
attempts.push({
|
|
1555
|
+
model: targetModel,
|
|
1556
|
+
status: "terminal",
|
|
1557
|
+
errorCode: "auth_inferred",
|
|
1558
|
+
message: `Skipped \u2014 provider ${targetProfile.provider} returned 401/403 earlier in this call; same key inferred to fail`
|
|
1559
|
+
});
|
|
1560
|
+
continue;
|
|
1561
|
+
}
|
|
1551
1562
|
if (targetModel !== initial.target) {
|
|
1552
1563
|
try {
|
|
1553
1564
|
activeCompile = compileAndRegister(
|
|
@@ -1616,6 +1627,10 @@ async function call(ir, opts = {}) {
|
|
|
1616
1627
|
});
|
|
1617
1628
|
lastErr = validated;
|
|
1618
1629
|
if (validated.errorType === "terminal" || opts.noFallback) {
|
|
1630
|
+
if (validated.errorCode === "auth" && !opts.noFallback && activeCompile.provider) {
|
|
1631
|
+
failedProviders.add(activeCompile.provider);
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1619
1634
|
break;
|
|
1620
1635
|
}
|
|
1621
1636
|
}
|
|
@@ -1694,6 +1709,7 @@ function normalizeFallbackReason(attempts) {
|
|
|
1694
1709
|
return "cliff";
|
|
1695
1710
|
}
|
|
1696
1711
|
if (code === "cost_cap_exceeded") return "cost_cap";
|
|
1712
|
+
if (code === "auth" || code === "auth_inferred") return "provider_auth_failed";
|
|
1697
1713
|
return "provider_error";
|
|
1698
1714
|
}
|
|
1699
1715
|
|
|
@@ -458,15 +458,21 @@ interface CallAttempt {
|
|
|
458
458
|
/**
|
|
459
459
|
* Why fallback fired. Normalized for `CallResult.fallbackReason` (alpha.9).
|
|
460
460
|
*
|
|
461
|
-
* - `rate_limit`
|
|
462
|
-
* - `provider_error`
|
|
463
|
-
* - `cost_cap`
|
|
464
|
-
* - `cliff`
|
|
465
|
-
*
|
|
466
|
-
* - `contract_violation`
|
|
467
|
-
*
|
|
461
|
+
* - `rate_limit` provider returned 429
|
|
462
|
+
* - `provider_error` 5xx, network, or other retryable upstream issue
|
|
463
|
+
* - `cost_cap` preflight policy.maxCostPerCallUsd rejected target
|
|
464
|
+
* - `cliff` alpha.8 contract violation (MAX_TOKENS on
|
|
465
|
+
* structured output, parse-failed JSON)
|
|
466
|
+
* - `contract_violation` other compile-time-contract failures (reserved
|
|
467
|
+
* for alpha.10+ — e.g. mid-stream policy rejects)
|
|
468
|
+
* - `provider_auth_failed` alpha.14 — initial provider returned 401/403
|
|
469
|
+
* (upstream key revocation, malformed-but-truthy
|
|
470
|
+
* key, billing lapse). The chain walks to the
|
|
471
|
+
* next non-same-provider target instead of
|
|
472
|
+
* short-circuiting; same-provider remaining
|
|
473
|
+
* entries skip with errorCode='auth_inferred'.
|
|
468
474
|
*/
|
|
469
|
-
type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation';
|
|
475
|
+
type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation' | 'provider_auth_failed';
|
|
470
476
|
interface CallResult {
|
|
471
477
|
/** Compile handle (still valid for record() if consumer wants to add oracle scores later). */
|
|
472
478
|
handle: string;
|
|
@@ -458,15 +458,21 @@ interface CallAttempt {
|
|
|
458
458
|
/**
|
|
459
459
|
* Why fallback fired. Normalized for `CallResult.fallbackReason` (alpha.9).
|
|
460
460
|
*
|
|
461
|
-
* - `rate_limit`
|
|
462
|
-
* - `provider_error`
|
|
463
|
-
* - `cost_cap`
|
|
464
|
-
* - `cliff`
|
|
465
|
-
*
|
|
466
|
-
* - `contract_violation`
|
|
467
|
-
*
|
|
461
|
+
* - `rate_limit` provider returned 429
|
|
462
|
+
* - `provider_error` 5xx, network, or other retryable upstream issue
|
|
463
|
+
* - `cost_cap` preflight policy.maxCostPerCallUsd rejected target
|
|
464
|
+
* - `cliff` alpha.8 contract violation (MAX_TOKENS on
|
|
465
|
+
* structured output, parse-failed JSON)
|
|
466
|
+
* - `contract_violation` other compile-time-contract failures (reserved
|
|
467
|
+
* for alpha.10+ — e.g. mid-stream policy rejects)
|
|
468
|
+
* - `provider_auth_failed` alpha.14 — initial provider returned 401/403
|
|
469
|
+
* (upstream key revocation, malformed-but-truthy
|
|
470
|
+
* key, billing lapse). The chain walks to the
|
|
471
|
+
* next non-same-provider target instead of
|
|
472
|
+
* short-circuiting; same-provider remaining
|
|
473
|
+
* entries skip with errorCode='auth_inferred'.
|
|
468
474
|
*/
|
|
469
|
-
type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation';
|
|
475
|
+
type FallbackReason = 'rate_limit' | 'provider_error' | 'cost_cap' | 'cliff' | 'contract_violation' | 'provider_auth_failed';
|
|
470
476
|
interface CallResult {
|
|
471
477
|
/** Compile handle (still valid for record() if consumer wants to add oracle scores later). */
|
|
472
478
|
handle: string;
|
package/dist/profiles.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { g as ALIASES, h as CacheStrategy, k as CliffRule, L as LoweringSpec, M as ModelProfile, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, _ as _setProfileBrainHook, t as allProfiles, x as allProfilesRaw, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-
|
|
1
|
+
export { g as ALIASES, h as CacheStrategy, k as CliffRule, L as LoweringSpec, M as ModelProfile, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, _ as _setProfileBrainHook, t as allProfiles, x as allProfilesRaw, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-DTnIzGsA.mjs';
|
|
2
2
|
import './dialect.mjs';
|
package/dist/profiles.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { g as ALIASES, h as CacheStrategy, k as CliffRule, L as LoweringSpec, M as ModelProfile, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, _ as _setProfileBrainHook, t as allProfiles, x as allProfilesRaw, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-
|
|
1
|
+
export { g as ALIASES, h as CacheStrategy, k as CliffRule, L as LoweringSpec, M as ModelProfile, q as RecoveryRule, S as StructuredOutputCapability, r as SystemPromptMode, _ as _setProfileBrainHook, t as allProfiles, x as allProfilesRaw, u as getProfile, v as profilesByProvider, w as tryGetProfile } from './profiles-D0y6aLk0.js';
|
|
2
2
|
import './dialect.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warmdrift/kgauto-compiler",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"description": "Prompt compiler + central learning brain for multi-model AI apps. Swap models without rewriting prompts.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|