canvas
canvas
The canvas worker stores diagrams as editable source. A canvas is a named
record — mermaid text, or an excalidraw scene JSON for a freeform whiteboard —
kept under a stable 8-character id. The worker never renders anything; the
console does the drawing, so a canvas::* call appears in chat as the live
diagram and the canvas page lists and edits everything stored. The source is
the artifact, which is what keeps a diagram editable instead of frozen into
pixels.
Ids are stable across updates on purpose: revise a diagram as the
conversation evolves and every earlier reference to it keeps working. Records
persist in the state worker, so nothing is lost across a restart.
Mermaid should not be written from memory. canvas::syntax returns the
families the renderer actually supports with a working example each, and
canvas::validate parses source without storing it — together they mean a
broken diagram never lands in the store or renders as an error card.