@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/index.cjs CHANGED
@@ -6172,6 +6172,7 @@ __export(compact_session_exports, {
6172
6172
  buildDefaultSummarizer: () => buildDefaultSummarizer,
6173
6173
  compactSessionTranscript: () => compactSessionTranscript,
6174
6174
  isCompactSummary: () => isCompactSummary,
6175
+ resolveSummarizerRoute: () => resolveSummarizerRoute,
6175
6176
  shouldAutoCompact: () => shouldAutoCompact
6176
6177
  });
6177
6178
  function isCompactSummary(content) {
@@ -6228,15 +6229,25 @@ ${summaryBody}`;
6228
6229
  const postTokens = estimateTokens([...preserved, summary].join("\n"));
6229
6230
  return { preTokens, postTokens };
6230
6231
  }
6232
+ function resolveSummarizerRoute(opts) {
6233
+ const provider = opts.keyProvider ?? (opts.prefixHasProfile && opts.modelPrefix !== void 0 ? opts.modelPrefix : opts.envProvider);
6234
+ return { provider, fullSlug: provider !== opts.modelPrefix };
6235
+ }
6231
6236
  function buildDefaultSummarizer(opts) {
6232
6237
  return async (messages) => {
6233
- const keyProvider = inferProviderFromApiKey(opts.apiKey);
6234
- const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
6235
6238
  registerBuiltins();
6239
+ const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
6236
6240
  const prefixProfile = modelPrefix !== void 0 ? getProviderProfile(modelPrefix) : void 0;
6237
- const provider = prefixProfile !== void 0 ? modelPrefix : keyProvider ?? detectPrimaryProvider();
6241
+ const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
6242
+ const route = resolveSummarizerRoute({
6243
+ keyProvider: inferProviderFromApiKey(opts.apiKey),
6244
+ modelPrefix,
6245
+ prefixHasProfile: prefixUsable,
6246
+ envProvider: detectPrimaryProvider()
6247
+ });
6248
+ const provider = route.provider;
6238
6249
  let model;
6239
- if (provider !== modelPrefix) {
6250
+ if (route.fullSlug) {
6240
6251
  model = opts.agentModel;
6241
6252
  } else {
6242
6253
  try {