@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.js CHANGED
@@ -13686,6 +13686,15 @@ function selectTransport(profile, apiKey) {
13686
13686
  const ctx = { apiKey };
13687
13687
  return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13688
13688
  };
13689
+ const assertOAuthResolved = (t) => {
13690
+ if (apiKey !== "__oauth_lazy_token__") return;
13691
+ const auth = t.headers?.authorization ?? t.headers?.Authorization;
13692
+ if (t.fetch === void 0 && auth === void 0) {
13693
+ throw new ConfigurationError(
13694
+ `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".`
13695
+ );
13696
+ }
13697
+ };
13689
13698
  if (profile.apiMode === "chat_completions") {
13690
13699
  if (profile.name === "ollama") {
13691
13700
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13703,6 +13712,7 @@ function selectTransport(profile, apiKey) {
13703
13712
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13704
13713
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13705
13714
  const t = applyTransform();
13715
+ assertOAuthResolved(t);
13706
13716
  if (t.fetch !== void 0) opts.fetch = t.fetch;
13707
13717
  const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13708
13718
  if (merged !== void 0) opts.extraHeaders = merged;
@@ -13723,6 +13733,7 @@ function selectTransport(profile, apiKey) {
13723
13733
  }
13724
13734
  if (profile.apiMode === "responses_api") {
13725
13735
  const t = applyTransform();
13736
+ assertOAuthResolved(t);
13726
13737
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13727
13738
  return new ResponsesApiClient({
13728
13739
  apiKey,