Repository navigation
Add the diagram block to Whiteboard - #1531
Merged
Merged
Conversation
milanb17
force-pushed
the
mb/whiteboard-block-components-12ca8f
branch
30 times, most recently
from
November 11, 2026 20:55
d84585e to
40d0a5a
Compare
milanb17
force-pushed
the
mb/whiteboard-block-components-12ca8f
branch
12 times, most recently
from
November 12, 2026 22:41
d9251e0 to
3601975
Compare
A standalone Vite playground for a new whiteboard block: a sandboxed stage runs an agent's script against a wb SDK with nodes, nested groups, wires, ELK layout with an overlap check, steps and scenarios with request moves, code claims verified against the repository, and Observable Plot charts. PLAN.md lays out moving it into Whiteboard. Agent-Session: db53cef1-7052-40f4-80b7-97044c16c38b
milanb17
force-pushed
the
mb/whiteboard-block-components-12ca8f
branch
8 times, most recently
from
November 16, 2026 02:13
515d171 to
c72d8a1
Compare
A new `diagram` block draws a system in the existing sandboxed stage. Most diagrams are markup: `<wb-graph>` places `<wb-node>`, `<wb-group>` and `<wb-edge>` with a vendored copy of Pele's layout, fits the graph to the board (turning or folding one that is too wide), and can place a `<wb-panel>` of values beside it. The stage draws a legend when steps send more than one kind of token. A script can still draw with the `wb` SDK: C4 nodes, nested groups and wires laid out by ELK, played timelines, and Observable Plot charts. ELK, d3 and Plot reach the stage as text over its port on first use, so the stage keeps its no-network policy. Steps send tokens along the wires and fill markup from their data; scenarios give the reader paths to pick between, and parts a scenario never touches are dimmed. A diagram's steps hold for 1.8 seconds, and the player's keys are named in the play button's tooltip. Every node and wire can link to code with evidence: text that must sit in the linked lines. A publish whose evidence is elsewhere is refused with the line it moved to, and a board that moves to new commits marks such links stale. Readers toggle Verify to see each claim's state; stale links show as changed without hiding the diagram. Agents author diagrams as files (diagram.html, diagram.js, frames.json, scenarios.json, block.json) with the existing checkout, publish and render tools. Renders and session_get report script errors, findings (overlaps, moves without a wire, unknown code names) and claim counts; a render also returns notes, what the stage decided for the author, such as a graph it turned. Instructions, a wb.d.ts held to the runtime, and six reference diagrams ship with them. The setting is now Diagrams and Animations. With it on, agents can no longer insert animation, clip, flow_diagram, sequence or call_stack_diff blocks; existing ones still render and still take updates. The authoring guide points design and implementation diagrams at `diagram`. Agent-Session: db53cef1-7052-40f4-80b7-97044c16c38b
milanb17
force-pushed
the
mb/whiteboard-block-components-12ca8f
branch
from
November 16, 2026 02:19
c72d8a1 to
fdd3de2
Compare
…folder session_render sends Desktop the block alone on its board. Desktop mounts it on a page in a hidden window as tall as the block needs, captures it there, and reports what the stage found on each stop. The user's window is not scrolled or switched, the board need not be open, and a tall diagram is captured whole. With that, session_render takes fromFiles: a draft folder is drawn the same way before it is on the board, and nothing is saved. The diagram instructions render a draft first and publish once. Agent-Session: db53cef1-7052-40f4-80b7-97044c16c38b Agent-Session: cfa09165-90bc-452b-ae64-4d30f1b1b967
milanb17
force-pushed
the
mb/whiteboard-block-components-12ca8f
branch
from
November 16, 2026 02:34
3e69a6e to
6ea3595
Compare
thesiti92
approved these changes
Nov 16, 2026
milanb17
added a commit
that referenced
this pull request
Nov 16, 2026
## What With the Diagrams and Animations setting on, agents can insert a `call_stack_diff` again, and the authoring guide names it for the implementation section. - `call_stack_diff` is out of `RETIRED_BLOCK_TYPES`, so an insert no longer gets a 409. - The setting-on authoring topic keeps the `call_stack_diff` line for the old vs. new path, in place of "a `diagram` … as two scenarios (before, after)". - The Components list includes `call_stack_diff` and `frame` again. `animation`, `clip`, `flow_diagram` and `sequence` stay retired. Nothing changes with the setting off. ## Why #1531 retired `call_stack_diff` on the grounds that a diagram draws what it did. It does not: - A call stack marks each frame added, removed or modified from the real diff. A diagram's before and after scenarios are authored, and nothing checks them. - A frame must name a code range. A diagram node's `code` is optional. - A call stack is a tree with call sites. A diagram has no call depth. ## Testing `animation-authoring.test.ts`, `authoring-pitfalls.test.ts` and `animation-drafts.test.ts` pass. Not checked in Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three commits:
packages/animation-labplayground andPLAN.md.What it adds
diagramblock (whiteboard-document/src/blocks/diagram.ts). An agent's markup (html), JavaScript module (script) or both draw in the existing sandboxed stage, the script with a globalwb:movessend tokens along the wires:faileddraws one red, andloststops it halfway for a message that never arrives;diagram.htmlas the page, laid out as any web page is:<div data-wb-drawing>marks wherewbdraws and takes the drawing's size, so panels, tables and logs sit around it with flow, flex or grid. Without markup the page is that element alone. The page's styles are scoped to it with@scope, so they never reach whatwbdraws.data-wb-from,data-wb-untilanddata-wb-onlyshow an element by frame with no script.<wb-node>,<wb-group>and<wb-edge>are the parts, owners and wires. Groups take a hue each in turn, or one named withcolor.<wb-graph direction>places everything inside it and routes the edges, with a vendored copy of Pele's layout (app/vendor/pele-layout). The direction is a wish: a graph too wide for the board turns itself, and one too tall folds into columns.<wb-panel>with<wb-row label value="key">is a table of state the graph places beside the nodes or under them, filled from each frame'sdata.sideasks for one or the other.<wb-graph token="…">renames the plain one.app/src/diagram/wb-runtime.ts), ported from the lab onto the stage's MessagePort.width;diagram.htmlhas nodata-wb-drawing(an error), and page styles that namebody,:rootorwb's own elements.label.quotesof each range's first and last lines, so the agent can check they are the lines it meant.code: falsemarks a node or wire that is not code, such as a repository drawn as a database.animation/timeline-controls.tsx): a round play button, a track of steps or chapters with their names, and the current caption. Space plays and pauses; the arrow keys step, and the play button's tooltip says so. A diagram's step holds for 1.8 seconds (an animation's keeps 3).session_checkoutandfromFileswork with a folder holdingdiagram.html,diagram.jsor both.session_render(frame: "all"renders every frame of every scenario) andsession_getreport script errors, findings and claim counts (matches,changed,unlinked).notes: what the stage decided for the author, which needs no fix. A graph it turned (with the width keeping the direction would take), a reply that replaced its call on an edge, a panel that did not fit where it was asked.diagraminstructions topic, awb.d.tsheld to the runtime withsatisfies, and six reference diagrams: an architecture with groups, scenarios and a panel (graph-architecture), a state machine (graph-order-states), a sequence, a played request, a latency chart and a rolled die.animationsEnabled, so nobody's setting resets.session_rendersends Desktop the block alone on a copy of its board.render.html, built beside the canvas) in a window that is never shown, grows the window to the block's height (up to 8,000px), and captures it there. The window is sandboxed, cannot take focus, and closes after 15 seconds idle.renderHiddenPage(hiddenPageRenderer.ts).session_renderalso takesfromFiles: a draft folder is drawn the same way before it is on the board, through a newPOST /:id/render, and nothing is saved. The instructions render a draft first and publish once. Only a render bytargetIdreturnsclaims.animation,clip,flow_diagram,sequenceorcall_stack_diff.diagram.How the authoring experience was tuned
An agent (Fable) drew three new diagrams a round on a test board, using only what the whiteboard serves an author, and logged every point of friction. Each round's fixes went into the stage first, then the references, then the instructions. Round 10 came back satisfied with hand-placed drawings, which still took several renders each to fit. Later rounds moved the layout into the stage: the markup kit, the graph, the panel, the legend and the render notes. By round 16 a graph with a panel took one render. The rounds also produced the hand-placed routing, the findings with numbers,
lostmoves andcode: false.Where it differs from PLAN.md
{ source, label? }: a line range like every other block's, without the evidence text the plan's D6 suggested.session_renderhas noverifyinput. A render returns the claim counts and findings from the canvas's run report instead, so the Desktop render verb and the protocol are unchanged.wb.selectablefor ids and labels only.Tests
diagram.test.ts(schema rules);diagram-block.browser.test.tsx: layout and size, routing and labels, findings, claim counts, stale links,code: false, script and syntax errors, steps, timeline, markup without a script, the drawing placed wheredata-wb-drawingsits, page styles kept off the drawing, and a missing mount;references.browser.test.tsx: every reference runs clean through every scenario, with no findings;store-upgrade.test.tsnow pins its clock: a fixture board put in Trash on 2026-10-13 reached the 30-day purge, which failed it onmaintoo.pnpm lintandpnpm format:checkare clean; thedeslop-uipass has run. It moved the players' glyphs intoui/icons.tsxand put the player onIconButton,useTooltipandtextStyles.truncate.Checked in Desktop
The player in dark and light: play, pause and replay, Space and the arrow keys, Tab through the track and step names, and the captions on hover and focus. That check found step names cut off and running together at mid widths. Names under stops now show only when every one fits whole, as below the narrow breakpoint.
Not done
side, and the replaced-token note outside its test are unchecked.whiteboard-documentandcanvasversions that predate this block, so a shared board will not show a diagram until those are published and bumped there.