@warmdrift/kgauto-compiler 2.0.0-alpha.73 → 2.0.0-alpha.74
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/{chunk-65KZE7AC.mjs → chunk-EB2YR7HL.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -2
- package/dist/index.mjs +26 -2
- package/dist/key-health.js +1 -1
- package/dist/key-health.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1017,7 +1017,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
|
|
|
1017
1017
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1018
1018
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1019
1019
|
*/
|
|
1020
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1020
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.74";
|
|
1021
1021
|
|
|
1022
1022
|
/**
|
|
1023
1023
|
* Oracle contract — how an app tells the brain whether a response was good.
|
package/dist/index.d.ts
CHANGED
|
@@ -1017,7 +1017,7 @@ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunRe
|
|
|
1017
1017
|
* guard in `tests/version.test.ts` fails the suite (and therefore
|
|
1018
1018
|
* `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
|
|
1019
1019
|
*/
|
|
1020
|
-
declare const LIBRARY_VERSION = "2.0.0-alpha.
|
|
1020
|
+
declare const LIBRARY_VERSION = "2.0.0-alpha.74";
|
|
1021
1021
|
|
|
1022
1022
|
/**
|
|
1023
1023
|
* Oracle contract — how an app tells the brain whether a response was good.
|
package/dist/index.js
CHANGED
|
@@ -6344,6 +6344,24 @@ function tryParseJson(s) {
|
|
|
6344
6344
|
return void 0;
|
|
6345
6345
|
}
|
|
6346
6346
|
}
|
|
6347
|
+
function isAuthSignatureBody(body, message) {
|
|
6348
|
+
if (body && typeof body === "object") {
|
|
6349
|
+
const err = body.error;
|
|
6350
|
+
if (err && typeof err === "object") {
|
|
6351
|
+
const e = err;
|
|
6352
|
+
if (Array.isArray(e.details)) {
|
|
6353
|
+
for (const d of e.details) {
|
|
6354
|
+
if (d && typeof d === "object" && d.reason === "API_KEY_INVALID") {
|
|
6355
|
+
return true;
|
|
6356
|
+
}
|
|
6357
|
+
}
|
|
6358
|
+
}
|
|
6359
|
+
if (e.code === "invalid_api_key") return true;
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
const m = message.toLowerCase();
|
|
6363
|
+
return m.includes("api key not valid") || m.includes("invalid api key") || m.includes("invalid x-api-key") || m.includes("incorrect api key");
|
|
6364
|
+
}
|
|
6347
6365
|
function classifyHttpError(status, body) {
|
|
6348
6366
|
const message = extractErrorMessage(body) ?? `HTTP ${status}`;
|
|
6349
6367
|
if (status === 429)
|
|
@@ -6356,8 +6374,11 @@ function classifyHttpError(status, body) {
|
|
|
6356
6374
|
return { ok: false, status, errorType: "retryable", errorCode: "model_not_found", message, raw: body };
|
|
6357
6375
|
if (status === 401 || status === 403)
|
|
6358
6376
|
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
6359
|
-
if (status === 400)
|
|
6377
|
+
if (status === 400) {
|
|
6378
|
+
if (isAuthSignatureBody(body, message))
|
|
6379
|
+
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
6360
6380
|
return { ok: false, status, errorType: "terminal", errorCode: "invalid_request", message, raw: body };
|
|
6381
|
+
}
|
|
6361
6382
|
return { ok: false, status, errorType: "terminal", errorCode: "unknown", message, raw: body };
|
|
6362
6383
|
}
|
|
6363
6384
|
function extractErrorMessage(body) {
|
|
@@ -6622,6 +6643,9 @@ function classifyHttpError2(status, body) {
|
|
|
6622
6643
|
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
6623
6644
|
}
|
|
6624
6645
|
if (status === 400) {
|
|
6646
|
+
if (isAuthSignatureBody(body, message)) {
|
|
6647
|
+
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
6648
|
+
}
|
|
6625
6649
|
return { ok: false, status, errorType: "terminal", errorCode: "invalid_request", message, raw: body };
|
|
6626
6650
|
}
|
|
6627
6651
|
return { ok: false, status, errorType: "terminal", errorCode: "unknown", message, raw: body };
|
|
@@ -8799,7 +8823,7 @@ function createBrainForwardRoutes(config) {
|
|
|
8799
8823
|
}
|
|
8800
8824
|
|
|
8801
8825
|
// src/version.ts
|
|
8802
|
-
var LIBRARY_VERSION = "2.0.0-alpha.
|
|
8826
|
+
var LIBRARY_VERSION = "2.0.0-alpha.74";
|
|
8803
8827
|
|
|
8804
8828
|
// src/key-health.ts
|
|
8805
8829
|
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-
|
|
19
|
+
} from "./chunk-EB2YR7HL.mjs";
|
|
20
20
|
import {
|
|
21
21
|
ABSOLUTE_FLOOR,
|
|
22
22
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
@@ -4153,6 +4153,24 @@ function tryParseJson(s) {
|
|
|
4153
4153
|
return void 0;
|
|
4154
4154
|
}
|
|
4155
4155
|
}
|
|
4156
|
+
function isAuthSignatureBody(body, message) {
|
|
4157
|
+
if (body && typeof body === "object") {
|
|
4158
|
+
const err = body.error;
|
|
4159
|
+
if (err && typeof err === "object") {
|
|
4160
|
+
const e = err;
|
|
4161
|
+
if (Array.isArray(e.details)) {
|
|
4162
|
+
for (const d of e.details) {
|
|
4163
|
+
if (d && typeof d === "object" && d.reason === "API_KEY_INVALID") {
|
|
4164
|
+
return true;
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
if (e.code === "invalid_api_key") return true;
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
const m = message.toLowerCase();
|
|
4172
|
+
return m.includes("api key not valid") || m.includes("invalid api key") || m.includes("invalid x-api-key") || m.includes("incorrect api key");
|
|
4173
|
+
}
|
|
4156
4174
|
function classifyHttpError(status, body) {
|
|
4157
4175
|
const message = extractErrorMessage(body) ?? `HTTP ${status}`;
|
|
4158
4176
|
if (status === 429)
|
|
@@ -4165,8 +4183,11 @@ function classifyHttpError(status, body) {
|
|
|
4165
4183
|
return { ok: false, status, errorType: "retryable", errorCode: "model_not_found", message, raw: body };
|
|
4166
4184
|
if (status === 401 || status === 403)
|
|
4167
4185
|
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
4168
|
-
if (status === 400)
|
|
4186
|
+
if (status === 400) {
|
|
4187
|
+
if (isAuthSignatureBody(body, message))
|
|
4188
|
+
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
4169
4189
|
return { ok: false, status, errorType: "terminal", errorCode: "invalid_request", message, raw: body };
|
|
4190
|
+
}
|
|
4170
4191
|
return { ok: false, status, errorType: "terminal", errorCode: "unknown", message, raw: body };
|
|
4171
4192
|
}
|
|
4172
4193
|
function extractErrorMessage(body) {
|
|
@@ -4431,6 +4452,9 @@ function classifyHttpError2(status, body) {
|
|
|
4431
4452
|
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
4432
4453
|
}
|
|
4433
4454
|
if (status === 400) {
|
|
4455
|
+
if (isAuthSignatureBody(body, message)) {
|
|
4456
|
+
return { ok: false, status, errorType: "terminal", errorCode: "auth", message, raw: body };
|
|
4457
|
+
}
|
|
4434
4458
|
return { ok: false, status, errorType: "terminal", errorCode: "invalid_request", message, raw: body };
|
|
4435
4459
|
}
|
|
4436
4460
|
return { ok: false, status, errorType: "terminal", errorCode: "unknown", message, raw: body };
|
package/dist/key-health.js
CHANGED
|
@@ -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.
|
|
28
|
+
var LIBRARY_VERSION = "2.0.0-alpha.74";
|
|
29
29
|
|
|
30
30
|
// src/key-health.ts
|
|
31
31
|
var JSON_HEADERS = { "Content-Type": "application/json" };
|
package/dist/key-health.mjs
CHANGED
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.74",
|
|
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",
|