@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/CHANGELOG.md +12 -0
- package/dist/cron.cjs +15 -4
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +15 -4
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +15 -4
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +15 -4
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +15 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/session/compact-session.d.ts +19 -0
- package/package.json +1 -1
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
|
|
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 (
|
|
6076
|
+
if (route.fullSlug) {
|
|
6066
6077
|
model = opts.agentModel;
|
|
6067
6078
|
} else {
|
|
6068
6079
|
try {
|