@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/dist/cron.cjs CHANGED
@@ -13656,6 +13656,9 @@ function sentinelForNoAuth(profile) {
13656
13656
  function sentinelForLazyAuth(profile) {
13657
13657
  if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
13658
13658
  if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
13659
+ if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
13660
+ return "__oauth_lazy_token__";
13661
+ }
13659
13662
  return void 0;
13660
13663
  }
13661
13664
  function filterPoolKeys(keys) {
@@ -13691,6 +13694,15 @@ function selectTransport(profile, apiKey) {
13691
13694
  const ctx = { apiKey };
13692
13695
  return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13693
13696
  };
13697
+ const assertOAuthResolved = (t) => {
13698
+ if (apiKey !== "__oauth_lazy_token__") return;
13699
+ const auth = t.headers?.authorization ?? t.headers?.Authorization;
13700
+ if (t.fetch === void 0 && auth === void 0) {
13701
+ throw new ConfigurationError(
13702
+ `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".`
13703
+ );
13704
+ }
13705
+ };
13694
13706
  if (profile.apiMode === "chat_completions") {
13695
13707
  if (profile.name === "ollama") {
13696
13708
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13708,6 +13720,7 @@ function selectTransport(profile, apiKey) {
13708
13720
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13709
13721
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13710
13722
  const t = applyTransform();
13723
+ assertOAuthResolved(t);
13711
13724
  if (t.fetch !== void 0) opts.fetch = t.fetch;
13712
13725
  const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13713
13726
  if (merged !== void 0) opts.extraHeaders = merged;
@@ -13728,6 +13741,7 @@ function selectTransport(profile, apiKey) {
13728
13741
  }
13729
13742
  if (profile.apiMode === "responses_api") {
13730
13743
  const t = applyTransform();
13744
+ assertOAuthResolved(t);
13731
13745
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13732
13746
  return new ResponsesApiClient({
13733
13747
  apiKey,