@theokit/sdk 4.10.0 → 4.11.0
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/CHANGELOG.md +36 -0
- package/dist/auth/index.cjs +552 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +19 -0
- package/dist/auth/index.d.ts +19 -0
- package/dist/auth/index.js +533 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/{cron-BF_AI5NP.d.ts → cron-C7catiH8.d.ts} +7 -2
- package/dist/{cron-DXEhagMa.d.cts → cron-DK1WVZnI.d.cts} +7 -2
- package/dist/cron.cjs +16 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +16 -6
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +16 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +16 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/auth/auth-types.d.ts +93 -0
- package/dist/internal/auth/credential-store.d.ts +19 -0
- package/dist/internal/auth/oauth-device.d.ts +55 -0
- package/dist/internal/auth/oauth-engine.d.ts +21 -0
- package/dist/internal/auth/resolve-credential.d.ts +16 -0
- package/dist/internal/providers/types.d.ts +1 -1
- package/dist/types/provider-profile.d.ts +6 -1
- package/package.json +12 -2
package/dist/index.cjs
CHANGED
|
@@ -15210,6 +15210,7 @@ var OpenAIClient = class {
|
|
|
15210
15210
|
if (this.options.organization !== void 0) {
|
|
15211
15211
|
headers["openai-organization"] = this.options.organization;
|
|
15212
15212
|
}
|
|
15213
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
15213
15214
|
const providerId = this.options.providerName ?? this.name;
|
|
15214
15215
|
let response;
|
|
15215
15216
|
try {
|
|
@@ -16252,6 +16253,9 @@ function sentinelForNoAuth(profile) {
|
|
|
16252
16253
|
function sentinelForLazyAuth(profile) {
|
|
16253
16254
|
if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
|
|
16254
16255
|
if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
|
|
16256
|
+
if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
|
|
16257
|
+
return "__oauth_lazy_token__";
|
|
16258
|
+
}
|
|
16255
16259
|
return void 0;
|
|
16256
16260
|
}
|
|
16257
16261
|
function filterPoolKeys(keys) {
|
|
@@ -16282,9 +16286,11 @@ function resolveApiKey2(envVars) {
|
|
|
16282
16286
|
return void 0;
|
|
16283
16287
|
}
|
|
16284
16288
|
function selectTransport(profile, apiKey) {
|
|
16285
|
-
const
|
|
16286
|
-
|
|
16287
|
-
|
|
16289
|
+
const applyTransform = () => {
|
|
16290
|
+
if (profile.transform === void 0) return {};
|
|
16291
|
+
const ctx = { apiKey };
|
|
16292
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
16293
|
+
};
|
|
16288
16294
|
if (profile.apiMode === "chat_completions") {
|
|
16289
16295
|
if (profile.name === "ollama") {
|
|
16290
16296
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -16301,7 +16307,10 @@ function selectTransport(profile, apiKey) {
|
|
|
16301
16307
|
}
|
|
16302
16308
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
16303
16309
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
16304
|
-
|
|
16310
|
+
const t = applyTransform();
|
|
16311
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
16312
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
16313
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
16305
16314
|
return new OpenAIClient(opts);
|
|
16306
16315
|
}
|
|
16307
16316
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -16318,12 +16327,13 @@ function selectTransport(profile, apiKey) {
|
|
|
16318
16327
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
16319
16328
|
}
|
|
16320
16329
|
if (profile.apiMode === "responses_api") {
|
|
16321
|
-
const
|
|
16330
|
+
const t = applyTransform();
|
|
16331
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
16322
16332
|
return new ResponsesApiClient({
|
|
16323
16333
|
apiKey,
|
|
16324
16334
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
16325
16335
|
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
16326
|
-
...
|
|
16336
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
16327
16337
|
providerName: profile.name
|
|
16328
16338
|
});
|
|
16329
16339
|
}
|