MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / allocatorPass

Function allocatorPass

__tests__/explore-allocation-e2e.test.ts:176–202  ·  view source on GitHub ↗
(index: number, name: string)

Source from the content-addressed store, hash-verified

174 const INCIDENTAL = 'scripts/eval-harness.mjs';
175
176 const allocatorPass = (index: number, name: string) => `
177/** ${name}: one pass of the explore output split. */
178export function ${name}(
179 candidates: AllocationCandidate[],
180 budget: ExploreOutputBudget,
181): Map<string, number> {
182 const allowances = new Map<string, number>();
183 const pool = clampOutputBudget(budget.maxOutputChars - ${index} * 200);
184 const total = candidates.reduce((sum, candidate) => sum + candidate.score, 0);
185 if (total <= 0) {
186 return allowances;
187 }
188 const floors = Math.min(pool, 700 * candidates.length);
189 const remainder = budgetRemainderAfterFloors(pool, floors);
190 for (const candidate of candidates) {
191 const floor = Math.floor(floors / candidates.length);
192 const proportional = splitOutputEvenly(remainder, total, candidate.score);
193 const boosted = candidate.spine ? proportional * 2 : proportional;
194 const share = Math.min(floor + boosted, budget.maxCharsPerFile * 3);
195 if (share <= 0) {
196 continue;
197 }
198 allowances.set(candidate.path, share);
199 }
200 return allowances;
201}
202`;
203
204 /**
205 * Neutral bulk for the helper file: real symbols that match NOTHING in the

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected