Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: an unset fresh-session handle does not hold the soft handle up; docs vale fixes

This commit is contained in:
iris 2026-11-16 11:04:04 +01:00
commit 0db9868eee

View file

@ -74,10 +74,15 @@ export function clampFresh(to: number, limits: Limits): number {
);
}
/** Where the soft handle may go: not below the fresh-session handle. */
/**
* Where the soft handle may go: not below the fresh-session handle when the
* swarm sets one. An unset fresh-session handle only follows the soft one down
* (`limitsOf`), so it does not hold it up.
*/
export function clampSoft(to: number, limits: Limits): number {
const floor = limits.freshSet ? limits.fresh : MIN_SOFT_CONTEXT_PERCENT;
return Math.min(
Math.max(Math.round(to), limits.fresh, MIN_SOFT_CONTEXT_PERCENT),
Math.max(Math.round(to), floor, MIN_SOFT_CONTEXT_PERCENT),
MAX_SOFT_CONTEXT_PERCENT,
);
}