@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/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
|
@@ -12610,6 +12610,7 @@ var OpenAIClient = class {
|
|
|
12610
12610
|
if (this.options.organization !== void 0) {
|
|
12611
12611
|
headers["openai-organization"] = this.options.organization;
|
|
12612
12612
|
}
|
|
12613
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
12613
12614
|
const providerId = this.options.providerName ?? this.name;
|
|
12614
12615
|
let response;
|
|
12615
12616
|
try {
|
|
@@ -13652,6 +13653,9 @@ function sentinelForNoAuth(profile) {
|
|
|
13652
13653
|
function sentinelForLazyAuth(profile) {
|
|
13653
13654
|
if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
|
|
13654
13655
|
if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
|
|
13656
|
+
if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
|
|
13657
|
+
return "__oauth_lazy_token__";
|
|
13658
|
+
}
|
|
13655
13659
|
return void 0;
|
|
13656
13660
|
}
|
|
13657
13661
|
function filterPoolKeys(keys) {
|
|
@@ -13682,9 +13686,11 @@ function resolveApiKey2(envVars) {
|
|
|
13682
13686
|
return void 0;
|
|
13683
13687
|
}
|
|
13684
13688
|
function selectTransport(profile, apiKey) {
|
|
13685
|
-
const
|
|
13686
|
-
|
|
13687
|
-
|
|
13689
|
+
const applyTransform = () => {
|
|
13690
|
+
if (profile.transform === void 0) return {};
|
|
13691
|
+
const ctx = { apiKey };
|
|
13692
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
13693
|
+
};
|
|
13688
13694
|
if (profile.apiMode === "chat_completions") {
|
|
13689
13695
|
if (profile.name === "ollama") {
|
|
13690
13696
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -13701,7 +13707,10 @@ function selectTransport(profile, apiKey) {
|
|
|
13701
13707
|
}
|
|
13702
13708
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
13703
13709
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
13704
|
-
|
|
13710
|
+
const t = applyTransform();
|
|
13711
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
13712
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13713
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
13705
13714
|
return new OpenAIClient(opts);
|
|
13706
13715
|
}
|
|
13707
13716
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -13718,12 +13727,13 @@ function selectTransport(profile, apiKey) {
|
|
|
13718
13727
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
13719
13728
|
}
|
|
13720
13729
|
if (profile.apiMode === "responses_api") {
|
|
13721
|
-
const
|
|
13730
|
+
const t = applyTransform();
|
|
13731
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13722
13732
|
return new ResponsesApiClient({
|
|
13723
13733
|
apiKey,
|
|
13724
13734
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
13725
13735
|
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
13726
|
-
...
|
|
13736
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
13727
13737
|
providerName: profile.name
|
|
13728
13738
|
});
|
|
13729
13739
|
}
|