@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/eval.cjs CHANGED
@@ -13651,6 +13651,9 @@ function sentinelForNoAuth(profile) {
13651
13651
  function sentinelForLazyAuth(profile) {
13652
13652
  if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
13653
13653
  if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
13654
+ if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
13655
+ return "__oauth_lazy_token__";
13656
+ }
13654
13657
  return void 0;
13655
13658
  }
13656
13659
  function filterPoolKeys(keys) {
@@ -13686,6 +13689,15 @@ function selectTransport(profile, apiKey) {
13686
13689
  const ctx = { apiKey };
13687
13690
  return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13688
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
+ };
13689
13701
  if (profile.apiMode === "chat_completions") {
13690
13702
  if (profile.name === "ollama") {
13691
13703
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13703,6 +13715,7 @@ function selectTransport(profile, apiKey) {
13703
13715
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13704
13716
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13705
13717
  const t = applyTransform();
13718
+ assertOAuthResolved(t);
13706
13719
  if (t.fetch !== void 0) opts.fetch = t.fetch;
13707
13720
  const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13708
13721
  if (merged !== void 0) opts.extraHeaders = merged;
@@ -13723,6 +13736,7 @@ function selectTransport(profile, apiKey) {
13723
13736
  }
13724
13737
  if (profile.apiMode === "responses_api") {
13725
13738
  const t = applyTransform();
13739
+ assertOAuthResolved(t);
13726
13740
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13727
13741
  return new ResponsesApiClient({
13728
13742
  apiKey,