/** * Whole-payload token-budget fitting (change: refine-orient-context-budgeting). * * A budget that trims one section over a fixed candidate cap can both overshoot a small budget (the * other sections still render in full) and waste a large one (the cap binds first). This fits the * RENDERED payload instead: list sections are trimmed from their lowest-ranked end, whole entries only, * in a fixed peripheral-first order, keeping the fewest removals that fit. * Deterministic — same payload, budget, and order give the same result — and costed with the same * character-based estimator every other budget in the server uses. */ export interface BudgetFit { /** The fitted payload, including whatever `decorate` added. */ payload: Record; /** Entries dropped per section (only sections that lost entries). */ omitted: Record; /** Estimated tokens of the fitted payload. */ estimatedTokens: number; /** False when even the fullest trimming allowed by `minimum` does not fit. */ fits: boolean; } /** * Fit `payload` to `budget` tokens by dropping whole trailing entries from the list sections named in * `order` (most peripheral first; each section is drained before the next is touched), keeping at least * `minimum[section]` entries in each. `decorate` renders the trimmed payload with its receipts, so the * receipts are costed too, and `measure` costs the rendering the caller actually sends (compact JSON by * default). Sections not named, and non-array values, are never trimmed. */ export declare function fitPayloadToBudget>(payload: T, budget: number, order: readonly string[], minimum: Readonly>, decorate: (trimmed: T, omitted: Record) => Record, measure?: (rendered: Record) => number): BudgetFit; //# sourceMappingURL=budget-fit.d.ts.map