@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/eval.cjs CHANGED
@@ -13689,6 +13689,15 @@ function selectTransport(profile, apiKey) {
13689
13689
  const ctx = { apiKey };
13690
13690
  return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13691
13691
  };
13692
+ const assertOAuthResolved = (t) => {
13693
+ if (apiKey !== "__oauth_lazy_token__") return;
13694
+ const auth = t.headers?.authorization ?? t.headers?.Authorization;
13695
+ if (t.fetch === void 0 && auth === void 0) {
13696
+ throw new ConfigurationError(
13697
+ `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".`
13698
+ );
13699
+ }
13700
+ };
13692
13701
  if (profile.apiMode === "chat_completions") {
13693
13702
  if (profile.name === "ollama") {
13694
13703
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13706,6 +13715,7 @@ function selectTransport(profile, apiKey) {
13706
13715
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13707
13716
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13708
13717
  const t = applyTransform();
13718
+ assertOAuthResolved(t);
13709
13719
  if (t.fetch !== void 0) opts.fetch = t.fetch;
13710
13720
  const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13711
13721
  if (merged !== void 0) opts.extraHeaders = merged;
@@ -13726,6 +13736,7 @@ function selectTransport(profile, apiKey) {
13726
13736
  }
13727
13737
  if (profile.apiMode === "responses_api") {
13728
13738
  const t = applyTransform();
13739
+ assertOAuthResolved(t);
13729
13740
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13730
13741
  return new ResponsesApiClient({
13731
13742
  apiKey,