@theokit/sdk 4.10.0 → 4.11.0

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
@@ -12608,6 +12608,7 @@ var OpenAIClient = class {
12608
12608
  if (this.options.organization !== void 0) {
12609
12609
  headers["openai-organization"] = this.options.organization;
12610
12610
  }
12611
+ if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
12611
12612
  const providerId = this.options.providerName ?? this.name;
12612
12613
  let response;
12613
12614
  try {
@@ -13650,6 +13651,9 @@ function sentinelForNoAuth(profile) {
13650
13651
  function sentinelForLazyAuth(profile) {
13651
13652
  if (profile.authType === "aws_bearer") return "__bedrock_lazy_token__";
13652
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
+ }
13653
13657
  return void 0;
13654
13658
  }
13655
13659
  function filterPoolKeys(keys) {
@@ -13680,9 +13684,11 @@ function resolveApiKey2(envVars) {
13680
13684
  return void 0;
13681
13685
  }
13682
13686
  function selectTransport(profile, apiKey) {
13683
- const transformCtx = { apiKey };
13684
- const transformFetch = profile.transform?.fetch?.(transformCtx);
13685
- const transformHeaders = profile.transform?.headers?.(transformCtx);
13687
+ const applyTransform = () => {
13688
+ if (profile.transform === void 0) return {};
13689
+ const ctx = { apiKey };
13690
+ return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
13691
+ };
13686
13692
  if (profile.apiMode === "chat_completions") {
13687
13693
  if (profile.name === "ollama") {
13688
13694
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13699,7 +13705,10 @@ function selectTransport(profile, apiKey) {
13699
13705
  }
13700
13706
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13701
13707
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13702
- if (transformFetch !== void 0) opts.fetch = transformFetch;
13708
+ const t = applyTransform();
13709
+ if (t.fetch !== void 0) opts.fetch = t.fetch;
13710
+ const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13711
+ if (merged !== void 0) opts.extraHeaders = merged;
13703
13712
  return new OpenAIClient(opts);
13704
13713
  }
13705
13714
  if (profile.apiMode === "anthropic_messages") {
@@ -13716,12 +13725,13 @@ function selectTransport(profile, apiKey) {
13716
13725
  return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
13717
13726
  }
13718
13727
  if (profile.apiMode === "responses_api") {
13719
- const mergedHeaders = profile.extraHeaders !== void 0 || transformHeaders !== void 0 ? { ...profile.extraHeaders, ...transformHeaders } : void 0;
13728
+ const t = applyTransform();
13729
+ const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
13720
13730
  return new ResponsesApiClient({
13721
13731
  apiKey,
13722
13732
  ...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
13723
13733
  ...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
13724
- ...transformFetch !== void 0 ? { fetch: transformFetch } : {},
13734
+ ...t.fetch !== void 0 ? { fetch: t.fetch } : {},
13725
13735
  providerName: profile.name
13726
13736
  });
13727
13737
  }