Skip to main content

GENERATION_GUIDELINES

Constant GENERATION_GUIDELINES 

Source
pub const GENERATION_GUIDELINES: &str = "\
The generated response MUST follow these rules:
- Reply with a flat list of A2UI messages as raw JSON. No prose inside the JSON.
- Every component object is `{\"id\": <unique id>, \"component\": <type>, ...props}`.
- Components are NEVER nested inline. A parent names its children by id.
- Exactly one component must have `\"id\": \"root\"`; it is the top of the tree.
- Order components top-down: `root` first, every parent before its children.
- Reference only ids that exist in the same payload.
- Never create a reference loop: a component must not be its own ancestor.
- Static text goes in the component; only bind to the data model when the value \
is dynamic.
- Data bindings are `{\"path\": \"/pointer\"}` (JSON Pointer, absolute) and must \
point at data you also send.
- Relative paths (no leading `/`) are only valid inside a list template.
- Use only component types and properties from the catalog below.";
Expand description

The rules that keep generated A2UI parseable and renderable.

Ordering is not cosmetic: a streaming renderer paints as components arrive, so root first and parents before children is what makes progressive rendering work.