mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:17:42 +00:00
fix: update compaction safeguard to respect context window tokens
This commit is contained in:
@@ -81,8 +81,16 @@ export function buildEmbeddedExtensionPaths(params: {
|
||||
const paths: string[] = [];
|
||||
if (resolveCompactionMode(params.cfg) === "safeguard") {
|
||||
const compactionCfg = params.cfg?.agents?.defaults?.compaction;
|
||||
const contextWindowInfo = resolveContextWindowInfo({
|
||||
cfg: params.cfg,
|
||||
provider: params.provider,
|
||||
modelId: params.modelId,
|
||||
modelContextWindow: params.model?.contextWindow,
|
||||
defaultTokens: DEFAULT_CONTEXT_TOKENS,
|
||||
});
|
||||
setCompactionSafeguardRuntime(params.sessionManager, {
|
||||
maxHistoryShare: compactionCfg?.maxHistoryShare,
|
||||
contextWindowTokens: contextWindowInfo.tokens,
|
||||
});
|
||||
paths.push(resolvePiExtensionPath("compaction-safeguard"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user