preview
Lets an agent see and drive the app running in the user's Preview pane. Use it after a build, when the user says something is broken, or to walk a UI flow end to end.
Which "preview" is which?
"Preview" names five unrelated things in Digitorn. They each have their own
"type/kind" values, and the same words (html, web, snapshot) mean different
things in each — this table is the one place that pins them down. Pick by what
you are doing, never by the word alone:
| You want to… | Use | Its type/kind values |
|---|---|---|
| Show a template's gallery thumbnail | preview_path in templates.yaml — Templates | none — chosen by file extension: raster image (<img>) or .html (<iframe>) |
| Have an app's build auto-appear in the native Preview tab (no SDK) | enable ui.workspace preview + build dist/index.html — Auto-served Preview pane | daemon auto-detects the build (static; also dev-server, local only) |
| Render the workspace panel for an app | ui.workspace.render_mode — Client manifest | react | html | markdown | slides | code | latex | builder | auto |
| Show the agent's live build inside a custom view | usePreviewAttach() — SDK | static | devserver | web |
| See / drive the running Preview pane (this module) | preview.inspect / preview.snapshot | — |
| Screenshot a built preview URL to a thumbnail | previewshot (internal) | kind: html | pdf | embed, format: jpeg | png |
If a task ever makes you reach for a "preview type," find your row here first: a
template thumbnail is an image or .html file (no field), the workspace panel is
a render_mode, the SDK live build is a usePreviewAttach kind — they are never
interchangeable.
| Property | Value |
|---|---|
| Module id | preview |
| Version | 2.0.0 |
| Tools | inspect, snapshot (LLM-visible) |
Built preview assets are served by the daemon over HTTP under the session preview surface in the Digitorn UI. This module talks to the live iframe directly (agent shim + runtime endpoint).
Tools
preview.inspect
Look at the running preview and optionally run UI actions first.
Useful returns: whether the page rendered or came up blank, the
route on screen, runtime failures (crashes, rejected promises,
console errors with file/line), failed network calls, console
logs, viewport size, visible text, and actionable elements with
refs.
| Param | Notes |
|---|---|
actions | Optional ordered interactions (navigate, click, type, press, hover, check, select, scroll, viewport, wait_for, detail, wait). Prefer match (visible label) over stale refs inside a sequence. |
full | Return everything (default false). |
text | Include visible text (default true). |
Requires an open Preview pane for the session. If the pane is still loading after a build, inspect waits briefly for it to come live.
preview.snapshot
Pixel / layout capture for visual checks (positions, overlaps,
polish). Use together with inspect when console/DOM alone is
not enough.
Related
- Gallery thumbs:
previewshot - External / headless browser (not the app preview pane):
browser