@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/eval.js
CHANGED
|
@@ -12605,6 +12605,7 @@ var OpenAIClient = class {
|
|
|
12605
12605
|
if (this.options.organization !== void 0) {
|
|
12606
12606
|
headers["openai-organization"] = this.options.organization;
|
|
12607
12607
|
}
|
|
12608
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
12608
12609
|
const providerId = this.options.providerName ?? this.name;
|
|
12609
12610
|
let response;
|
|
12610
12611
|
try {
|
|
@@ -13647,6 +13648,9 @@ function sentinelForNoAuth(profile) {
|
|
|
13647
13648
|
function sentinelForLazyAuth(profile) {
|
|
13648
13649
|
if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
|
|
13649
13650
|
if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
|
|
13651
|
+
if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
|
|
13652
|
+
return "__oauth_lazy_token__";
|
|
13653
|
+
}
|
|
13650
13654
|
return void 0;
|
|
13651
13655
|
}
|
|
13652
13656
|
function filterPoolKeys(keys) {
|
|
@@ -13677,9 +13681,11 @@ function resolveApiKey2(envVars) {
|
|
|
13677
13681
|
return void 0;
|
|
13678
13682
|
}
|
|
13679
13683
|
function selectTransport(profile, apiKey) {
|
|
13680
|
-
const
|
|
13681
|
-
|
|
13682
|
-
|
|
13684
|
+
const applyTransform = () => {
|
|
13685
|
+
if (profile.transform === void 0) return {};
|
|
13686
|
+
const ctx = { apiKey };
|
|
13687
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
13688
|
+
};
|
|
13683
13689
|
if (profile.apiMode === "chat_completions") {
|
|
13684
13690
|
if (profile.name === "ollama") {
|
|
13685
13691
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -13696,7 +13702,10 @@ function selectTransport(profile, apiKey) {
|
|
|
13696
13702
|
}
|
|
13697
13703
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
13698
13704
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
13699
|
-
|
|
13705
|
+
const t = applyTransform();
|
|
13706
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
13707
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13708
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
13700
13709
|
return new OpenAIClient(opts);
|
|
13701
13710
|
}
|
|
13702
13711
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -13713,12 +13722,13 @@ function selectTransport(profile, apiKey) {
|
|
|
13713
13722
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
13714
13723
|
}
|
|
13715
13724
|
if (profile.apiMode === "responses_api") {
|
|
13716
|
-
const
|
|
13725
|
+
const t = applyTransform();
|
|
13726
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13717
13727
|
return new ResponsesApiClient({
|
|
13718
13728
|
apiKey,
|
|
13719
13729
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
13720
13730
|
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
13721
|
-
...
|
|
13731
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
13722
13732
|
providerName: profile.name
|
|
13723
13733
|
});
|
|
13724
13734
|
}
|