parseTokenBudget
parseTokenBudget(
raw):TokenBudget
Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/config/tokenBudget.ts:94
Parse a configured token budget into a TokenBudget.
Accepts a number (an absolute count) or a string in any of the documented forms. Throws a
TokenBudgetError naming the offending text for everything else — including the values
that would otherwise slip through as numbers: NaN, Infinity, zero, a negative, and a bare
fraction like 0.8.
A bare 0.8 is rejected on purpose, and this is the one rejection worth explaining. It is
the obvious way to write “80% of the window”, and it is also a perfectly well-formed token count
of under one token. Guessing which was meant would make the threshold depend on a rule the user
never read, so the error points at 80% instead — the form that cannot be misread. That is why
an absolute count must be a whole number of at least 1.
Parameters
Section titled “Parameters”unknown