@theokit/sdk 4.16.5 → 4.16.7

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
@@ -5995,6 +5995,7 @@ __export(compact_session_exports, {
5995
5995
  buildDefaultSummarizer: () => buildDefaultSummarizer,
5996
5996
  compactSessionTranscript: () => compactSessionTranscript,
5997
5997
  isCompactSummary: () => isCompactSummary,
5998
+ resolveSummarizerRoute: () => resolveSummarizerRoute,
5998
5999
  shouldAutoCompact: () => shouldAutoCompact
5999
6000
  });
6000
6001
  function isCompactSummary(content) {
@@ -6051,15 +6052,25 @@ ${summaryBody}`;
6051
6052
  const postTokens = estimateTokens([...preserved, summary].join("\n"));
6052
6053
  return { preTokens, postTokens };
6053
6054
  }
6055
+ function resolveSummarizerRoute(opts) {
6056
+ const provider = opts.keyProvider ?? (opts.prefixHasProfile && opts.modelPrefix !== void 0 ? opts.modelPrefix : opts.envProvider);
6057
+ return { provider, fullSlug: provider !== opts.modelPrefix };
6058
+ }
6054
6059
  function buildDefaultSummarizer(opts) {
6055
6060
  return async (messages) => {
6056
- const keyProvider = inferProviderFromApiKey(opts.apiKey);
6057
- const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
6058
6061
  registerBuiltins();
6062
+ const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
6059
6063
  const prefixProfile = modelPrefix !== void 0 ? getProviderProfile(modelPrefix) : void 0;
6060
- const provider = prefixProfile !== void 0 ? modelPrefix : keyProvider ?? detectPrimaryProvider();
6064
+ const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
6065
+ const route = resolveSummarizerRoute({
6066
+ keyProvider: inferProviderFromApiKey(opts.apiKey),
6067
+ modelPrefix,
6068
+ prefixHasProfile: prefixUsable,
6069
+ envProvider: detectPrimaryProvider()
6070
+ });
6071
+ const provider = route.provider;
6061
6072
  let model;
6062
- if (provider !== modelPrefix) {
6073
+ if (route.fullSlug) {
6063
6074
  model = opts.agentModel;
6064
6075
  } else {
6065
6076
  try {