RenderLimits

data class RenderLimits(val maxInstances: Int, val maxDepth: Int = 24, val templateFanout: Int = 2)

The bounds a renderer draws within.

Separate from dev.ynagai.a2ui.core.validation.ValidationLimits and from DEFAULT_MAX_DEPTH because they bound different quantities. Those are about what can be checked: how far a schema evaluator may recurse, how deep walk may nest before its own stack and cycle check stop being cheap. These are about what can be drawn, and drawing gives way far earlier than checking does -- measured on Chrome, a chain of plain containers stops composing at all somewhere between 216 and 220 levels, and it does not raise when it does: setContent hangs. A bound that a renderer could catch after the fact would therefore not be a bound at all, which is why the numbers here are set to be consulted before descending.

Parameters

maxInstances

how many component instances one surface may draw. The adjacency list is a graph rather than a tree, so this is not bounded by the number of components an agent sends: n layers that each name the same two children expand to 2^n instances from 2n components, and neither a depth bound nor a cycle check stops that -- no path repeats an id and none of them is deep. The default is the largest breadth measured to compose to completion (about 500ms on Chrome, 212ms on the JVM at 5,000 plain widgets). A surface that must show more than this wants the host's lazy layout, which a library cannot impose on a renderer it did not write.

maxDepth

how deeply a surface may nest before drawing stops. The default is derived from two measurements: the official example corpus needs 7 levels at most (median 5), and the point where composition breaks moves with how many frames a widget nests per level -- 216 for a plain container, about 36 for a widget stacking six. 24 is 3.4x what real content needs and two thirds of the break for a heavy widget. Both sides have room because the break is neither catchable nor recoverable.

templateFanout

how many instances a ChildReference.Template counts as when the cost of a surface is being estimated from its components alone. Counting a template as one is unsound: nested templates and templates reached along many structural paths multiply, and a count that summed them would report a surface as cheap and then draw the product. The default is the smallest value that still multiplies -- how many items a template actually yields is the agent's data model talking rather than its component graph, and that is bounded where it arises, when the reference is expanded.

Constructors

Link copied to clipboard
constructor(maxInstances: Int, maxDepth: Int = 24, templateFanout: Int = 2)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard