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

Function allocatorPass

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

Source from the content-addressed store, hash-verified

167 const INCIDENTAL = 'scripts/eval-harness.mjs';
168
169 const allocatorPass = (index: number, name: string) => `
170/** ${name}: one pass of the explore output split. */
171export function ${name}(
172 candidates: AllocationCandidate[],
173 budget: ExploreOutputBudget,
174): Map<string, number> {
175 const allowances = new Map<string, number>();
176 const pool = clampOutputBudget(budget.maxOutputChars - ${index} * 200);
177 const total = candidates.reduce((sum, candidate) => sum + candidate.score, 0);
178 if (total <= 0) {
179 return allowances;
180 }
181 const floors = Math.min(pool, 700 * candidates.length);
182 const remainder = budgetRemainderAfterFloors(pool, floors);
183 for (const candidate of candidates) {
184 const floor = Math.floor(floors / candidates.length);
185 const proportional = splitOutputEvenly(remainder, total, candidate.score);
186 const boosted = candidate.spine ? proportional * 2 : proportional;
187 const share = Math.min(floor + boosted, budget.maxCharsPerFile * 3);
188 if (share <= 0) {
189 continue;
190 }
191 allowances.set(candidate.path, share);
192 }
193 return allowances;
194}
195`;
196
197 /**
198 * 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