@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.js CHANGED
@@ -13648,6 +13648,9 @@ function sentinelForNoAuth(profile) {
13648
13648
  function sentinelForLazyAuth(profile) {
13649
13649
  if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
13650
13650
  if (profile.authType === "gcp_oauth") return "__vertex_lazy_token__";
13651
+ if (profile.authType === "oauth_device_code" || profile.authType === "oauth_external") {
13652
+ return "__oauth_lazy_token__";
13653
+ }
13651
13654
  return void 0;
13652
13655
  }
13653
13656
  function filterPoolKeys(keys) {
@@ -13683,6 +13686,15 @@ function selectTransport(profile, apiKey) {
13683
13686
  const ctx = { apiKey };
13684
13687
  return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13685
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
+ };
13686
13698
  if (profile.apiMode === "chat_completions") {
13687
13699
  if (profile.name === "ollama") {
13688
13700
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13700,6 +13712,7 @@ function selectTransport(profile, apiKey) {
13700
13712
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13701
13713
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13702
13714
  const t = applyTransform();
13715
+ assertOAuthResolved(t);
13703
13716
  if (t.fetch !== void 0) opts.fetch = t.fetch;
13704
13717
  const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13705
13718
  if (merged !== void 0) opts.extraHeaders = merged;
@@ -13720,6 +13733,7 @@ function selectTransport(profile, apiKey) {
13720
13733
  }
13721
13734
  if (profile.apiMode === "responses_api") {
13722
13735
  const t = applyTransform();
13736
+ assertOAuthResolved(t);
13723
13737
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13724
13738
  return new ResponsesApiClient({
13725
13739
  apiKey,