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