@warmdrift/kgauto-compiler 2.0.0-alpha.12 → 2.0.0-alpha.13
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.js +9 -4
- package/dist/index.mjs +9 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2032,13 +2032,18 @@ var PROVIDER_ENV_KEYS = Object.freeze({
|
|
|
2032
2032
|
function defaultEnv() {
|
|
2033
2033
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
2034
2034
|
}
|
|
2035
|
+
function readKeyValue(raw) {
|
|
2036
|
+
if (raw === void 0) return void 0;
|
|
2037
|
+
const trimmed = raw.trim();
|
|
2038
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
2039
|
+
}
|
|
2035
2040
|
function resolveProviderKey(provider, opts = {}) {
|
|
2036
2041
|
if (!isSupportedProvider(provider)) return void 0;
|
|
2037
|
-
const explicit = opts.apiKeys?.[provider];
|
|
2042
|
+
const explicit = readKeyValue(opts.apiKeys?.[provider]);
|
|
2038
2043
|
if (explicit) return explicit;
|
|
2039
2044
|
const env = opts.envSource ?? defaultEnv();
|
|
2040
2045
|
for (const name of PROVIDER_ENV_KEYS[provider]) {
|
|
2041
|
-
const v = env[name];
|
|
2046
|
+
const v = readKeyValue(env[name]);
|
|
2042
2047
|
if (v) return v;
|
|
2043
2048
|
}
|
|
2044
2049
|
return void 0;
|
|
@@ -2055,11 +2060,11 @@ function getReachabilityDiagnostic(opts = {}) {
|
|
|
2055
2060
|
const env = opts.envSource ?? defaultEnv();
|
|
2056
2061
|
const out = {};
|
|
2057
2062
|
for (const provider of SUPPORTED_PROVIDERS) {
|
|
2058
|
-
if (opts.apiKeys?.[provider]) {
|
|
2063
|
+
if (readKeyValue(opts.apiKeys?.[provider])) {
|
|
2059
2064
|
out[provider] = { reachable: true, via: "apiKeys" };
|
|
2060
2065
|
continue;
|
|
2061
2066
|
}
|
|
2062
|
-
const envKeyFound = PROVIDER_ENV_KEYS[provider].find((name) => env[name]);
|
|
2067
|
+
const envKeyFound = PROVIDER_ENV_KEYS[provider].find((name) => readKeyValue(env[name]));
|
|
2063
2068
|
out[provider] = envKeyFound ? { reachable: true, via: "env", envKeyFound } : { reachable: false, via: null };
|
|
2064
2069
|
}
|
|
2065
2070
|
return out;
|
package/dist/index.mjs
CHANGED
|
@@ -1242,13 +1242,18 @@ var PROVIDER_ENV_KEYS = Object.freeze({
|
|
|
1242
1242
|
function defaultEnv() {
|
|
1243
1243
|
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
1244
1244
|
}
|
|
1245
|
+
function readKeyValue(raw) {
|
|
1246
|
+
if (raw === void 0) return void 0;
|
|
1247
|
+
const trimmed = raw.trim();
|
|
1248
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
1249
|
+
}
|
|
1245
1250
|
function resolveProviderKey(provider, opts = {}) {
|
|
1246
1251
|
if (!isSupportedProvider(provider)) return void 0;
|
|
1247
|
-
const explicit = opts.apiKeys?.[provider];
|
|
1252
|
+
const explicit = readKeyValue(opts.apiKeys?.[provider]);
|
|
1248
1253
|
if (explicit) return explicit;
|
|
1249
1254
|
const env = opts.envSource ?? defaultEnv();
|
|
1250
1255
|
for (const name of PROVIDER_ENV_KEYS[provider]) {
|
|
1251
|
-
const v = env[name];
|
|
1256
|
+
const v = readKeyValue(env[name]);
|
|
1252
1257
|
if (v) return v;
|
|
1253
1258
|
}
|
|
1254
1259
|
return void 0;
|
|
@@ -1265,11 +1270,11 @@ function getReachabilityDiagnostic(opts = {}) {
|
|
|
1265
1270
|
const env = opts.envSource ?? defaultEnv();
|
|
1266
1271
|
const out = {};
|
|
1267
1272
|
for (const provider of SUPPORTED_PROVIDERS) {
|
|
1268
|
-
if (opts.apiKeys?.[provider]) {
|
|
1273
|
+
if (readKeyValue(opts.apiKeys?.[provider])) {
|
|
1269
1274
|
out[provider] = { reachable: true, via: "apiKeys" };
|
|
1270
1275
|
continue;
|
|
1271
1276
|
}
|
|
1272
|
-
const envKeyFound = PROVIDER_ENV_KEYS[provider].find((name) => env[name]);
|
|
1277
|
+
const envKeyFound = PROVIDER_ENV_KEYS[provider].find((name) => readKeyValue(env[name]));
|
|
1273
1278
|
out[provider] = envKeyFound ? { reachable: true, via: "env", envKeyFound } : { reachable: false, via: null };
|
|
1274
1279
|
}
|
|
1275
1280
|
return out;
|
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.13",
|
|
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",
|