@theokit/sdk 4.11.0 → 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.js CHANGED
@@ -13691,6 +13691,15 @@ function selectTransport(profile, apiKey) {
13691
13691
  const ctx = { apiKey };
13692
13692
  return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13693
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
+ };
13694
13703
  if (profile.apiMode === "chat_completions") {
13695
13704
  if (profile.name === "ollama") {
13696
13705
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13708,6 +13717,7 @@ function selectTransport(profile, apiKey) {
13708
13717
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13709
13718
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13710
13719
  const t = applyTransform();
13720
+ assertOAuthResolved(t);
13711
13721
  if (t.fetch !== void 0) opts.fetch = t.fetch;
13712
13722
  const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13713
13723
  if (merged !== void 0) opts.extraHeaders = merged;
@@ -13728,6 +13738,7 @@ function selectTransport(profile, apiKey) {
13728
13738
  }
13729
13739
  if (profile.apiMode === "responses_api") {
13730
13740
  const t = applyTransform();
13741
+ assertOAuthResolved(t);
13731
13742
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13732
13743
  return new ResponsesApiClient({
13733
13744
  apiKey,