/**
 * Reserve is the amount of remaining context budget to preserve before
 * threshold compaction starts. The default reserve is capped by context window:
 */
export const DEFAULT_COMPACTION_RESERVE_TOKENS = 500_000;
export const DEFAULT_COMPACTION_KEEP_RECENT_TOKENS = 20_000;
export const MAX_COMPACTION_RESERVE_FRACTION = 0.5;
export function getEffectiveCompactionReserveTokens(contextWindow) {
    if (contextWindow <= 0)
        return 0;
    const maxReserveTokens = Math.floor(contextWindow * MAX_COMPACTION_RESERVE_FRACTION);
    return Math.min(DEFAULT_COMPACTION_RESERVE_TOKENS, maxReserveTokens);
}
export function getCompactionThresholdTokens(contextWindow) {
    return contextWindow - getEffectiveCompactionReserveTokens(contextWindow);
}
//# sourceMappingURL=constants.js.map