computeFieldBudget
computeFieldBudget(
fallback,kind):number
Defined in: context.ts:312
Piecewise: identity at or below QUANTIZE_ABOVE, tapered and quantized
above it.
Below the frozen boundary this is exactly the historical function — ceil(max(len × 1.3, floor)) — so every schema hash computed by any shipped SDK is stable across releases. Above it, two properties for large fields:
- The multiplier tapers (1.05·len + 125, which equals 1.3·len exactly at len = 500, so the curve is continuous): ±30% of a paragraph is a line, ±30% of 5,000 chars is ~250px of layout shift.
- The result quantizes to steps of 64. The raw budget is in the schema hash, so un-quantized, EVERY character edit re-keys the cache and costs a fresh generation; stepped, a typo stays on the same copy while a new sentence is honestly new.
Server twin: mosaic/services/fragments/fragmentService.ts computeFieldBudget
— adopted in the fragments-0.3 release that lifted the caps, byte-identical,
held to the shared vectors (including quantized_vectors). The server
recomputes and never trusts the client’s number.
Parameters
Section titled “Parameters”fallback
Section titled “fallback”string
string
Returns
Section titled “Returns”number