feat: add pre-compaction memory flush
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
|
||||
export const DEFAULT_PI_COMPACTION_RESERVE_TOKENS_FLOOR = 20_000;
|
||||
|
||||
type PiSettingsManagerLike = {
|
||||
@@ -25,3 +27,13 @@ export function ensurePiCompactionReserveTokens(params: {
|
||||
|
||||
return { didOverride: true, reserveTokens: minReserveTokens };
|
||||
}
|
||||
|
||||
export function resolveCompactionReserveTokensFloor(
|
||||
cfg?: ClawdbotConfig,
|
||||
): number {
|
||||
const raw = cfg?.agents?.defaults?.compaction?.reserveTokensFloor;
|
||||
if (typeof raw === "number" && Number.isFinite(raw) && raw >= 0) {
|
||||
return Math.floor(raw);
|
||||
}
|
||||
return DEFAULT_PI_COMPACTION_RESERVE_TOKENS_FLOOR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user