@theokit/sdk 4.10.1 → 4.11.1
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 +12 -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.cjs +14 -0
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +14 -0
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +14 -0
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +14 -0
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -0
- 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/package.json +11 -1
package/dist/cron.js
CHANGED
|
@@ -13653,6 +13653,9 @@ function sentinelForNoAuth(profile) {
|
|
|
13653
13653
|
function sentinelForLazyAuth(profile) {
|
|
13654
13654
|
if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
|
|
13655
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
|
+
}
|
|
13656
13659
|
return void 0;
|
|
13657
13660
|
}
|
|
13658
13661
|
function filterPoolKeys(keys) {
|
|
@@ -13688,6 +13691,15 @@ function selectTransport(profile, apiKey) {
|
|
|
13688
13691
|
const ctx = { apiKey };
|
|
13689
13692
|
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
13690
13693
|
};
|
|
13694
|
+
const assertOAuthResolved = (t) => {
|
|
13695
|
+
if (apiKey !== "__oauth_lazy_token__") return;
|
|
13696
|
+
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
13697
|
+
if (t.fetch === void 0 && auth === void 0) {
|
|
13698
|
+
throw new ConfigurationError(
|
|
13699
|
+
`provider "${profile.name}" uses OAuth (authType: ${profile.authType}) but no credential was resolved. Register a ProviderProfile.transform whose fetch (or headers.authorization) supplies the bearer \u2014 typically via resolveCredential() from "@theokit/sdk/auth".`
|
|
13700
|
+
);
|
|
13701
|
+
}
|
|
13702
|
+
};
|
|
13691
13703
|
if (profile.apiMode === "chat_completions") {
|
|
13692
13704
|
if (profile.name === "ollama") {
|
|
13693
13705
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -13705,6 +13717,7 @@ function selectTransport(profile, apiKey) {
|
|
|
13705
13717
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
13706
13718
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
13707
13719
|
const t = applyTransform();
|
|
13720
|
+
assertOAuthResolved(t);
|
|
13708
13721
|
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
13709
13722
|
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13710
13723
|
if (merged !== void 0) opts.extraHeaders = merged;
|
|
@@ -13725,6 +13738,7 @@ function selectTransport(profile, apiKey) {
|
|
|
13725
13738
|
}
|
|
13726
13739
|
if (profile.apiMode === "responses_api") {
|
|
13727
13740
|
const t = applyTransform();
|
|
13741
|
+
assertOAuthResolved(t);
|
|
13728
13742
|
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13729
13743
|
return new ResponsesApiClient({
|
|
13730
13744
|
apiKey,
|