Preview constraints
Payload limits, image handling and the security boundary of AI block previews and custom sketches.
For comparing layouts in the chat, start with Block previews. This page lists the limits and rules that matter to integrations and troubleshooting.
Block trees and references
The preview_blocks tool takes a title, an optional description, a main view, a mockup as reference and alternative views as variants. Each view carries a tree of DMS blocks, a sketch, or both.
A node of a tree is { type, options, children }. It names a registered block by its type, or by its componentName when the type is unknown, never an arbitrary component. An option whose key ends in Url, such as fetchUrl, or an option named location must be a same-origin path such as /api/orders.
| Limit | Value |
|---|---|
| Tree depth | 8 levels |
| Nodes, across the main view and its variants | 200 |
| JSON of every tree and sketch, together | 64 KB (65,536 bytes) |
| Variants | 4 |
| Top-level blocks in one tree | 12 |
| Title | 120 characters |
| Description | 2,000 characters |
| Tab label | 60 characters |
| Caption of a reference or a sketch | 200 characters |
| Reference URL | 2,048 characters |
The mockup in reference is one of these:
- An image attached in the conversation.
attachmentIdis its file name, orlatestfor the last one. - A same-origin path, which the dialog loads.
- An
httporhttpsURL, which the dialog shows as a link and never loads.
Attached images are not kept on the server. After a reload, the dialog asks you to attach the mockup again.
The preview is stored in the transcript and comes back with the conversation.
Custom sketches
A view can carry a sketch instead of a tree, or beside it. A sketch is the static HTML and CSS of a proposed custom component, as { html, css?, caption?, height? }.
heightis the frame height in pixels, from 80 to 1,200. The default is 320. The sketch scrolls past it.- Images must be inline
data:image/URLs, and links may only point to an#anchor. - The dialog labels a sketch as a custom sketch that is not a DMS block, and its card carries a Custom sketch badge.
A base stylesheet sets the font, the text colour and the background, so a sketch without CSS already follows the dashboard. Its CSS can use these variables, which follow the dashboard's light or dark theme:
| Variable | Dashboard source |
|---|---|
--sketch-canvas | --ui-bg-muted |
--sketch-surface | --dms-surface-card |
--sketch-surface-muted | --dms-bg-muted |
--sketch-border | --ui-border |
--sketch-text | --ui-text |
--sketch-text-strong | --ui-text-highlighted |
--sketch-text-muted | --ui-text-muted |
--sketch-accent | --ui-primary |
--sketch-accent-fill | --dms-accent-fill |
--sketch-success | --ui-success |
--sketch-error | --ui-error |
--sketch-radius | --dms-radius-card |
--sketch-font | --font-sans |
--sketch-font-mono | --font-mono |
--sketch-scheme | light or dark |
When a dashboard variable is unset, the variable takes the dashboard's default value.
Sketch isolation
The sketch is the agent's own HTML. The chat hands it to the DMS's DmsBlockPreview as a sketch node, which renders it in an <iframe sandbox=""> through srcdoc. The frame has:
- No scripts and an opaque origin.
- No forms, popups or top navigation.
- A Content-Security-Policy (
default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:) that blocks network loads.
Before the chat shows a sketch, the sidecar checks it with checkSketch from @antelopejs/dms/sketch, the sketch check the DMS's own mockups use. The check parses the HTML as the frame does and holds every element and attribute to an allowlist. It reads the CSS with its escapes decoded, and it accepts a URL only as an #anchor or a data:image/ URL. A refused sketch returns the check's reasons to the agent. An accepted sketch is shown as the check wrote it back from the parsed tree, with quotes normalized, comments dropped and unclosed elements closed. A sketch that holds nothing but comments and whitespace is refused, because it draws nothing.
The check turns a sketch that would break in the frame into a clear error. The frame is the security boundary.
A dashboard whose own CSP forbids inline styles applies it to the frame too, and the sketch then renders unstyled. Check the parent page's CSP when a sketch loses its styling.