Expand description
Pressure-driven tool row allocation ladder.
The ladder is the automatic layer that the live region uses to fit ever-taller blocks (tool calls with diffs, file reads with full previews, command outputs) into a finite viewport. It is pure: given a list of per-block natural heights and a row budget, it returns the rendered row count for each block. The renderer decides how to draw the quantized shapes (glyph / folded / full); this module decides how many rows each block gets.
§Allocation levels
0— block is hidden entirely (emergency truncation; the caller reserves a single banner row instead).1— glyph row (▸ tool · activity), animated wall-clock pulse on a shared period so the live region breathes.2— folded card (╭─ tool · activity/╰─ …), the static “something is here” affordance.natural— full block at its natural height.
Allocations are quantized to those four shapes: a block never
receives 3..natural-1 rows, because the live-region renderer
maps any allocation of 3 or more rows to the FULL natural
render — a “3 of 5” allocation would paint 5 rows and overflow
the budget.
User-set BlockDisplayMode overrides happen at the call site
(see render_transcript); the ladder applies only to blocks
without a manual override.
Structs§
- Block
Alloc - Row budget assigned to a single block by
allocate_rows.
Functions§
- allocate_
rows - Allocate a row budget across the given per-block natural heights.
Pure function: same
(block_heights, budget)always yields the sameVec<BlockAlloc>. See module docs for the algorithm.