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