@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
19 lines • 1.02 kB
JavaScript
import { resolveCompactionGeometry } from "./orchestration.js";
import { projectCompactedContextTokens } from "./rejected-recovery.js";
/**
* Whether a finished warm summary is still worth applying as-is (senpi#5481): applied to the
* current branch, the summary plus everything after its anchor must land below the point where
* speculation starts (`threshold - lead`), so applying it does not leave the session one turn
* away from compacting again.
*/
export function assessWarmCandidateFit(input) {
const geometry = resolveCompactionGeometry({
contextWindow: input.contextWindow,
settings: input.settings,
lastYield: input.lastYield,
});
const budgetTokens = Math.max(0, Math.floor(geometry.thresholdTokens - geometry.leadTokens));
const projectedTokens = projectCompactedContextTokens(input.branchEntries, input.compaction, true, input.model);
return { fits: projectedTokens <= budgetTokens, projectedTokens, budgetTokens };
}
//# sourceMappingURL=warm-candidate.js.map