pmx-canvas 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -0
- package/Readme.md +2 -2
- package/dist/canvas/global.css +260 -0
- package/dist/canvas/index.js +76 -76
- package/dist/json-render/index.js +2 -2
- package/dist/types/client/canvas/IntentLayer.d.ts +1 -0
- package/dist/types/client/state/intent-bridge.d.ts +10 -0
- package/dist/types/client/state/intent-store.d.ts +25 -0
- package/dist/types/json-render/server.d.ts +1 -1
- package/dist/types/server/index.d.ts +34 -4
- package/dist/types/server/intent-registry.d.ts +45 -0
- package/dist/types/server/operations/ops/intent.d.ts +2 -0
- package/dist/types/shared/ax-intent.d.ts +58 -0
- package/docs/mcp.md +21 -2
- package/docs/screenshot.png +0 -0
- package/package.json +1 -1
- package/skills/pmx-canvas/SKILL.md +197 -1305
- package/skills/pmx-canvas/evals/evals.json +199 -0
- package/skills/pmx-canvas/references/full-reference.md +1441 -0
- package/src/cli/index.ts +21 -4
- package/src/client/canvas/CanvasNode.tsx +13 -13
- package/src/client/canvas/CanvasViewport.tsx +2 -0
- package/src/client/canvas/ContextMenu.tsx +25 -19
- package/src/client/canvas/IntentLayer.tsx +278 -0
- package/src/client/nodes/ExtAppFrame.tsx +31 -22
- package/src/client/state/intent-bridge.ts +31 -0
- package/src/client/state/intent-store.ts +107 -0
- package/src/client/state/sse-bridge.ts +31 -0
- package/src/client/theme/global.css +260 -0
- package/src/json-render/charts/components.tsx +18 -4
- package/src/json-render/renderer/index.tsx +11 -2
- package/src/json-render/server.ts +1 -1
- package/src/server/index.ts +240 -158
- package/src/server/intent-registry.ts +324 -0
- package/src/server/operations/composites.ts +11 -0
- package/src/server/operations/index.ts +2 -0
- package/src/server/operations/ops/edges.ts +1 -0
- package/src/server/operations/ops/groups.ts +3 -0
- package/src/server/operations/ops/intent.ts +132 -0
- package/src/server/operations/ops/json-render.ts +3 -0
- package/src/server/operations/ops/nodes.ts +3 -0
- package/src/server/operations/registry.ts +68 -3
- package/src/server/server.ts +40 -12
- package/src/shared/ax-intent.ts +64 -0
- package/src/shared/surface.ts +5 -1
|
@@ -0,0 +1,1441 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pmx-canvas
|
|
3
|
+
description: >
|
|
4
|
+
Spatial canvas workbench for visual thinking — nodes, edges, groups on an infinite 2D canvas
|
|
5
|
+
with pan/zoom, minimap, and real-time sync. Use this skill whenever you need to lay out
|
|
6
|
+
information spatially: investigation boards, architecture diagrams, dependency maps, task plans,
|
|
7
|
+
status dashboards, file relationship views, or any scenario where a flat list or text wall
|
|
8
|
+
isn't enough. Also use when the user mentions "canvas", "board", "diagram", "spatial layout",
|
|
9
|
+
"visual map", "node graph", or wants to see how things connect. The canvas is your extended
|
|
10
|
+
working memory — pin nodes to curate context, read spatial arrangement to understand intent.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# PMX Canvas — Full Reference
|
|
14
|
+
|
|
15
|
+
PMX Canvas is a spatial canvas workbench you control through MCP tools or HTTP API. It renders an
|
|
16
|
+
infinite 2D canvas in the browser with nodes, edges, groups, pan/zoom, and a minimap. State lives
|
|
17
|
+
on the server and survives browser refresh.
|
|
18
|
+
|
|
19
|
+
The canvas is your extended working memory. Humans pin nodes to curate context; you read that
|
|
20
|
+
curation through MCP resources. Spatial arrangement is communication — proximity means
|
|
21
|
+
relatedness, clusters imply grouping, reading order (top-left to bottom-right) implies sequence.
|
|
22
|
+
|
|
23
|
+
## When to Use
|
|
24
|
+
|
|
25
|
+
The canvas is **agnostic about what you do with it**. Reach for it whenever a
|
|
26
|
+
flat conversation, a list, or a single document hides the relationships
|
|
27
|
+
between pieces of information. The total reach of any session is the union
|
|
28
|
+
of pmx-canvas's own node types and whatever your harness already has access
|
|
29
|
+
to — MCP servers, MCP apps, shell commands and CLIs, files in the working
|
|
30
|
+
directory, web fetch, anything else in your toolbelt. The canvas does not
|
|
31
|
+
care where the data came from; it cares about getting it on the surface as
|
|
32
|
+
the right node type.
|
|
33
|
+
|
|
34
|
+
The README has a non-exhaustive list of example use cases (idea generation,
|
|
35
|
+
validation, research, analysis, mind mapping, investigation boards,
|
|
36
|
+
architecture diagrams, status dashboards, comparison views, plus whatever
|
|
37
|
+
your toolbelt unlocks). This skill stays focused on the operational
|
|
38
|
+
mechanics. If a flat list or text wall is not enough to hold the
|
|
39
|
+
relationships you're working with, the canvas is the right tool — the rest
|
|
40
|
+
of this document is how to drive it.
|
|
41
|
+
|
|
42
|
+
### When the connected tool is unfamiliar
|
|
43
|
+
|
|
44
|
+
When the human asks you to use a data source or tool you have not used
|
|
45
|
+
before — an MCP server, an MCP app, a CLI, a script, an arbitrary file
|
|
46
|
+
tree:
|
|
47
|
+
|
|
48
|
+
1. List the tools / commands available; sample one or two outputs to see
|
|
49
|
+
the actual shape.
|
|
50
|
+
2. Decide which canvas node type best matches each output:
|
|
51
|
+
- Long-form / narrative results → `markdown`
|
|
52
|
+
- Structured records, tables, dashboards → `json-render` or `graph`
|
|
53
|
+
- Rich reusable communication artifacts → `html-primitive`
|
|
54
|
+
- Interactive tool surfaces with their own UI → `mcp-app` (open with
|
|
55
|
+
`canvas_app { action: "open-mcp-app" }`)
|
|
56
|
+
- Local source files → `file` (live-watched)
|
|
57
|
+
- URLs that need cached fetches → `webpage`
|
|
58
|
+
- Stream of state events → `status` or `ledger`
|
|
59
|
+
3. Propose the mapping to the human before bulk-creating nodes; let them
|
|
60
|
+
confirm or adjust before you commit a layout.
|
|
61
|
+
|
|
62
|
+
## Quick Operating Path
|
|
63
|
+
|
|
64
|
+
The fast, current, safe sequence for a typical session. Each step links to the detailed
|
|
65
|
+
section below.
|
|
66
|
+
|
|
67
|
+
1. **Open/focus the workbench** — make the canvas visible *before* mutating (see "Open the
|
|
68
|
+
canvas first"). Reuse one surface for the session.
|
|
69
|
+
2. **Verify workspace identity** — read `GET /health` (or `pmx-canvas serve status`) and
|
|
70
|
+
confirm the returned `workspace` matches your intended workspace root. A healthy listener on port
|
|
71
|
+
4313 can belong to another project — never mutate the wrong board (see "Verify workspace
|
|
72
|
+
identity BEFORE mutating").
|
|
73
|
+
3. **Read before write** — `canvas_query { action: "search", query }` (or `pmx-canvas search`)
|
|
74
|
+
to find existing nodes; avoid duplicates. Use `canvas_query { action: "layout" }` only when
|
|
75
|
+
you need the full board.
|
|
76
|
+
4. **Snapshot before destructive work** — `canvas_snapshot { name }` before clear/major
|
|
77
|
+
reorg; restore if needed.
|
|
78
|
+
5. **Signal then mutate** — optionally `canvas_intent { action: "signal", … }` to telegraph the
|
|
79
|
+
move, then create with the right composite: `canvas_node` (markdown/status/file/webpage/html
|
|
80
|
+
incl. primitives), `canvas_render` (json-render/graph), `canvas_app` (mcp-app/diagram/
|
|
81
|
+
web-artifact). Prefer composites — the legacy single-purpose tools are deprecated (removed in
|
|
82
|
+
v0.3).
|
|
83
|
+
6. **Arrange + validate** — `canvas_view { action: "arrange" }` after batch adds, then
|
|
84
|
+
`canvas_query { action: "validate" }` to catch collisions / dangling edges before finishing.
|
|
85
|
+
7. **Pin through a verified path** — `canvas_pin_nodes` (or the browser "Pin as context" /
|
|
86
|
+
right-click "Pin as context"), then read `canvas://pinned-context` to confirm.
|
|
87
|
+
8. **Clean up** — remove retry/test fixtures (`canvas_node { action: "remove" }` — works for
|
|
88
|
+
every type, including `status`), and restore the baseline snapshot.
|
|
89
|
+
|
|
90
|
+
## Starting the Canvas
|
|
91
|
+
|
|
92
|
+
If this skill is installed before the `pmx-canvas` command exists, install the project first. See
|
|
93
|
+
`installing-pmx-canvas.md` for local development, npm/global install, and MCP config
|
|
94
|
+
options.
|
|
95
|
+
|
|
96
|
+
## Adapter References
|
|
97
|
+
|
|
98
|
+
PMX Canvas core is host-agnostic. When a host-specific adapter is available, read the matching
|
|
99
|
+
reference before using adapter-native features:
|
|
100
|
+
|
|
101
|
+
- `github-copilot-app-adapter.md` — GitHub Copilot app project extension, native canvas
|
|
102
|
+
panel, AX context injection, and live-test checklist.
|
|
103
|
+
- `codex-app-adapter.md` — Codex app native Browser + MCP adapter, AX context reading,
|
|
104
|
+
focus labeling, and live-test checklist.
|
|
105
|
+
|
|
106
|
+
Open the canvas first — always:
|
|
107
|
+
The canvas is the shared human↔agent surface. **Before you create or mutate any nodes, make the
|
|
108
|
+
workbench visible.** Do **not** assume the host opened it for you — some hosts (e.g. the Codex app)
|
|
109
|
+
do not open it on their own. Take the action to open it yourself, whatever the host:
|
|
110
|
+
- **Native adapter/panel available** (the GitHub Copilot app `pmx-canvas` canvas extension, or the
|
|
111
|
+
Codex in-app Browser): open/focus that panel to the server's `/workbench` route.
|
|
112
|
+
- **Any other browser** (Chrome, Safari, Arc, Edge, …) **or a generic/CLI agent** with no native
|
|
113
|
+
panel: open the server's `/workbench` URL in a browser.
|
|
114
|
+
|
|
115
|
+
Then reuse that **single** surface for the rest of the session — do **not** open a second panel to
|
|
116
|
+
the same workbench (it wastes space and confuses which surface is authoritative). If you genuinely
|
|
117
|
+
cannot open any browser (headless/CI), say so and proceed, but still print the `/workbench` URL so a
|
|
118
|
+
human can open it.
|
|
119
|
+
- External URLs in `mcp-app` nodes show the "Unverified domain" interstitial by design. Only
|
|
120
|
+
same-origin `/api/canvas/frame-documents/<id>` URLs are auto-trusted. For external tools, use a
|
|
121
|
+
bundled `web-artifact`, same-origin frame document, or set `data.trustedDomain: true` only when the
|
|
122
|
+
user accepts the risk.
|
|
123
|
+
|
|
124
|
+
The canvas auto-starts on first MCP tool call when running in MCP mode (`pmx-canvas --mcp`).
|
|
125
|
+
For manual start:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pmx-canvas # Start and open browser (port 4313)
|
|
129
|
+
pmx-canvas --no-open # Start without opening browser (for agents)
|
|
130
|
+
pmx-canvas --port=8080 # Custom port
|
|
131
|
+
pmx-canvas --demo # Start with sample content
|
|
132
|
+
pmx-canvas --theme=light # Light theme
|
|
133
|
+
pmx-canvas --version # Print installed version and exit
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`--theme` accepts `dark` (default), `light`, or `high-contrast`. Same value can be set via
|
|
137
|
+
the `PMX_CANVAS_THEME` environment variable, or toggled live in the browser toolbar.
|
|
138
|
+
|
|
139
|
+
Start the canvas once per session, then reuse it. Use `--no-open` when running as an agent — the
|
|
140
|
+
human can open the browser URL themselves.
|
|
141
|
+
|
|
142
|
+
### Daemon mode (long-running background server)
|
|
143
|
+
|
|
144
|
+
When you need the canvas to outlive the current shell or agent session — e.g. so a follow-up
|
|
145
|
+
agent run can attach to the same state — start it as a daemon:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pmx-canvas serve --daemon --no-open --wait-ms=20000 # Detach, wait for /health
|
|
149
|
+
pmx-canvas serve status # Print daemon health + pid state
|
|
150
|
+
pmx-canvas serve stop # Stop the daemon for this port
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`serve --daemon` writes a pid file (`.pmx-canvas/daemon-<port>.pid`) and a log file
|
|
154
|
+
(`.pmx-canvas/daemon-<port>.log`); the wait flag blocks until `/health` returns OK so a script
|
|
155
|
+
can rely on the server being responsive when the command returns. `serve stop` reads the pid
|
|
156
|
+
file, sends SIGTERM, and cleans up on exit.
|
|
157
|
+
|
|
158
|
+
### Verify workspace identity BEFORE mutating (required)
|
|
159
|
+
|
|
160
|
+
> **"Start once, reuse always" has one hard exception: never reuse a listener that belongs to
|
|
161
|
+
> another workspace.** A healthy, responsive server on the default port `4313` can be serving a
|
|
162
|
+
> *different project's* canvas (a leftover daemon, or another repo's session). Mutating it would
|
|
163
|
+
> corrupt the wrong board. Always preflight:
|
|
164
|
+
|
|
165
|
+
1. **Read `GET /health`** (or `pmx-canvas serve status`). Both return a top-level
|
|
166
|
+
`workspace` field. **`workspace` MUST equal your intended workspace root**
|
|
167
|
+
before any create/update/remove. If it doesn't match, do not mutate.
|
|
168
|
+
2. **Treat `responsive: true` + `pidRunning: false` as a stale-listener warning** — the pid file
|
|
169
|
+
is stale and the live listener may be a different process/workspace. Confirm the real owner with
|
|
170
|
+
`lsof -nP -iTCP:<port> -sTCP:LISTEN`.
|
|
171
|
+
3. **On mismatch, isolate**: start the intended workspace on an explicit free port —
|
|
172
|
+
`pmx-canvas serve --daemon --no-open --port=<free-port>` — and target that port. (`PMX_CANVAS_PORT`
|
|
173
|
+
alone may still attach to an existing `4313` listener; prefer an explicit `--port`.) Then
|
|
174
|
+
**re-read `/health`** to confirm the workspace now matches.
|
|
175
|
+
4. **After any version upgrade**, run a behavior canary (e.g. a batch `node.add` with no `type`
|
|
176
|
+
must return `400`) to confirm the listener is the version you expect, not a stale old daemon.
|
|
177
|
+
|
|
178
|
+
## Browser Workflows
|
|
179
|
+
|
|
180
|
+
The browser is not just a passive view. Human interactions on the canvas persist back to the
|
|
181
|
+
server and become part of the authoritative canvas state.
|
|
182
|
+
|
|
183
|
+
- Double-click empty canvas — create a markdown note at that position
|
|
184
|
+
- Shift+drag on empty canvas — lasso-select multiple nodes
|
|
185
|
+
- Selection bar actions — when nodes are selected, the browser exposes `Pin as context`,
|
|
186
|
+
`Group`, `Connect`, and `Clear`
|
|
187
|
+
- Right-click a node — open the node context menu. **`Pin as context`** adds the node to the
|
|
188
|
+
human-curated agent context set (updates the context count + the node's context-pin indicator);
|
|
189
|
+
`Lock position` is the separate arrange-lock. Plus focus, collapse, connect, refresh/open, close,
|
|
190
|
+
and type-specific actions. (Every node type, **including `status`, has a remove `×`** in its title
|
|
191
|
+
bar and a `Close` menu item.)
|
|
192
|
+
- Right-click a group node — recolor the group using preset swatches or a custom color picker,
|
|
193
|
+
and ungroup its children
|
|
194
|
+
- Drag-and-drop files or URLs — add file, image, markdown, or webpage nodes directly
|
|
195
|
+
- Paste URLs — create webpage nodes from the clipboard
|
|
196
|
+
|
|
197
|
+
Use browser interactions when the human is actively curating spatial layout. Use MCP or the CLI
|
|
198
|
+
when you need deterministic scripted changes or you are acting without a visible browser.
|
|
199
|
+
|
|
200
|
+
### Known limitations & host differences
|
|
201
|
+
|
|
202
|
+
- **Hosted MCP-app / Excalidraw nodes are not "open as site" targets.** A hosted ext-app is a
|
|
203
|
+
*live* MCP-app shell that only renders with the in-canvas host bridge — there is no standalone
|
|
204
|
+
page for it (the "Open as site" control is hidden for these nodes). View/edit them in the canvas,
|
|
205
|
+
or open them externally through their own app. `html`, `json-render`, `graph`, and bundled
|
|
206
|
+
`web-artifact` nodes DO open as a standalone site (and graph/json-render fill the full browser
|
|
207
|
+
viewport).
|
|
208
|
+
- **Sandboxed-iframe automation (host-dependent).** Some embedded hosts (notably the Codex in-app
|
|
209
|
+
Browser) cannot script *inside* PMX's sandboxed workbench iframes (`Frame target is not
|
|
210
|
+
available`). The surface renders and the server-side interaction path works; this is a host
|
|
211
|
+
automation limitation, not a PMX rendering bug. Verify embedded-iframe behavior in system Chrome
|
|
212
|
+
or via the server-side AX state, not by automating the iframe in such hosts.
|
|
213
|
+
- **`pmx-canvas screenshot` needs an active WebView** and defaults to the workbench camera; start
|
|
214
|
+
`canvas_webview { action:"start" }` first, and use `canvas_webview { action:"evaluate" }` (not
|
|
215
|
+
`eval`) to drive it.
|
|
216
|
+
|
|
217
|
+
## Agent CLI
|
|
218
|
+
|
|
219
|
+
PMX Canvas also ships an agent-native CLI that talks to the running HTTP server and returns JSON.
|
|
220
|
+
Use it when MCP is not available but you still want structured, scriptable canvas operations.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
pmx-canvas --help # Top-level help
|
|
224
|
+
pmx-canvas serve --daemon --no-open # Detached daemon with health output
|
|
225
|
+
pmx-canvas serve status # Daemon health + pid status
|
|
226
|
+
pmx-canvas serve stop # Stop the daemon for this port/pid file
|
|
227
|
+
pmx-canvas layout # Full canvas state
|
|
228
|
+
pmx-canvas status # Quick summary
|
|
229
|
+
pmx-canvas node add --type markdown --title "Plan"
|
|
230
|
+
pmx-canvas node add --type webpage --url https://example.com/docs
|
|
231
|
+
pmx-canvas node add --type graph --graph-type bar --data '[{"x":"a","y":1}]' --x-key x --y-key y
|
|
232
|
+
pmx-canvas node add --type graph --graphType bar --data '[{"x":"a","y":1}]' --xKey x --yKey y
|
|
233
|
+
pmx-canvas graph add --graph-type bar --data '[{"x":"a","y":1}]' --x-key x --y-key y
|
|
234
|
+
pmx-canvas external-app add --kind excalidraw --title "Diagram"
|
|
235
|
+
pmx-canvas node add --help --type webpage --json
|
|
236
|
+
pmx-canvas node schema --type json-render --component Table --summary
|
|
237
|
+
pmx-canvas node list --type file --ids
|
|
238
|
+
pmx-canvas edge add --from node-a --to node-b --type depends-on
|
|
239
|
+
pmx-canvas search "auth"
|
|
240
|
+
pmx-canvas open
|
|
241
|
+
pmx-canvas arrange --layout flow
|
|
242
|
+
pmx-canvas focus <node-id> --no-pan # Select/raise without moving the user's viewport
|
|
243
|
+
pmx-canvas fit --width 1440 --height 900 # Fit the whole board for screenshots/review
|
|
244
|
+
pmx-canvas screenshot --output ./canvas.png # Shorthand for `webview screenshot`
|
|
245
|
+
pmx-canvas json-render --schema --summary # Inspect json-render component catalog
|
|
246
|
+
pmx-canvas json-render --example --component Table
|
|
247
|
+
pmx-canvas node add --type markdown --title "Long doc" --strict-size # Scroll instead of auto-fit
|
|
248
|
+
pmx-canvas node add --type graph --graphType pie --data-file metrics.json --show-legend false --show-labels false
|
|
249
|
+
pmx-canvas node update <node-id> --spec-file ./dashboard.json
|
|
250
|
+
pmx-canvas validate spec --type json-render --spec-file ./dashboard.json --summary
|
|
251
|
+
pmx-canvas web-artifact build --title "Dashboard" --app-file ./App.tsx --deps recharts --include-logs
|
|
252
|
+
pmx-canvas node list --type web-artifact --summary
|
|
253
|
+
pmx-canvas node list --type external-app --summary
|
|
254
|
+
pmx-canvas pin --list
|
|
255
|
+
pmx-canvas ax context
|
|
256
|
+
pmx-canvas ax focus <node-id>
|
|
257
|
+
pmx-canvas ax work add --title "Wire up auth" --status in-progress <node-id>
|
|
258
|
+
pmx-canvas ax approval request --title "Deploy to prod"
|
|
259
|
+
pmx-canvas ax steer "focus on the failing test first"
|
|
260
|
+
pmx-canvas ax timeline --limit 50
|
|
261
|
+
pmx-canvas snapshot save --name "before-refactor"
|
|
262
|
+
pmx-canvas code-graph
|
|
263
|
+
pmx-canvas spatial
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### CLI command groups
|
|
267
|
+
|
|
268
|
+
- `node add|list|get|update|remove` — manage nodes
|
|
269
|
+
- `node schema` — inspect running-server create schemas and canonical examples, with `--summary`, `--field`, and `--component` filters
|
|
270
|
+
- `graph add` — convenience alias for graph nodes; `node add --type graph` remains the canonical form
|
|
271
|
+
- Graph CLI fields accept both kebab-case flags and camelCase schema names, e.g. `--graph-type`/`--graphType`, `--x-key`/`--xKey`, and `--bar-color`/`--barColor`.
|
|
272
|
+
- Graph CLI height flags are split: use `--node-height`/`--nodeHeight` for the
|
|
273
|
+
canvas frame and `--chart-height` for the chart content. CLI `--height`
|
|
274
|
+
remains a frame-height compatibility alias.
|
|
275
|
+
- `edge add|list|remove` — manage edges
|
|
276
|
+
- Search-based edge selectors must be specific enough to resolve exactly one node. Queries like
|
|
277
|
+
`"DVT O3"` can be ambiguous; prefer the full visible title such as `"DVT O3 — GitOps"`.
|
|
278
|
+
- `search`, `layout`, `status`, `arrange`, `focus` — inspect and navigate the canvas. Prefer
|
|
279
|
+
`focus --no-pan` when you only need to select/raise a node without hijacking the human's camera.
|
|
280
|
+
- `ax status|context|focus` — inspect the host-agnostic AX layer; `ax context`
|
|
281
|
+
combines pinned context and AX focus for adapter prompt injection.
|
|
282
|
+
- `ax event add`, `ax steer`, `ax evidence add`, `ax timeline` — the AX timeline
|
|
283
|
+
(agent-events, steering messages, evidence). Persisted for diagnostics,
|
|
284
|
+
retention-bounded, and excluded from snapshots.
|
|
285
|
+
- `ax work add|update|list`, `ax approval request|resolve|list`,
|
|
286
|
+
`ax review add|list` — canvas-bound AX state (work items, approval gates,
|
|
287
|
+
review annotations) that rides snapshots and restore and is cleared by `clear`.
|
|
288
|
+
- `ax host report|status` — report/read the host/session capability (own partition).
|
|
289
|
+
- `ax command list|invoke`, `ax policy get|set` — list/invoke registry commands
|
|
290
|
+
(`pmx.plan`, `pmx.execute`, `pmx.promote-context`, `pmx.summarize`, `pmx.review`)
|
|
291
|
+
and read/patch the canvas-bound tool/prompt policy.
|
|
292
|
+
- `copilot install-extension [--dry-run] [--yes]` — install the bundled GitHub
|
|
293
|
+
Copilot adapter into a repo; the core stays host-agnostic.
|
|
294
|
+
- `fit [id ...]` — set the server viewport to fit the whole canvas or selected nodes before screenshots or whole-board review
|
|
295
|
+
- `screenshot --output <path>` — top-level shortcut for `webview screenshot`; supports `--format png|jpeg|webp` and `--quality`
|
|
296
|
+
- `json-render --schema|--examples` — inspect the json-render component catalog with `--component`/`--field` filters; same data as `node schema --type json-render` in a more direct shape
|
|
297
|
+
- `--strict-size` (alias `--scroll-overflow`) on `node add`/`node update` — keep explicit width/height fixed and scroll overflowing content instead of letting the renderer auto-fit. Useful for long markdown, dense webpages, and dashboards that should fit a tile-sized frame.
|
|
298
|
+
- `--show-legend false` / `--show-labels false` on `node add --type graph` and `graph add` — hide chart legends and pie slice labels for compact graph nodes in tile-style boards.
|
|
299
|
+
- `open` — open the current workbench in the browser
|
|
300
|
+
- `pin --list|--clear|<ids...>` — manage context pins
|
|
301
|
+
- `undo`, `redo`, `history` — time travel
|
|
302
|
+
- `snapshot save|list|restore|delete` — manage snapshots
|
|
303
|
+
- `group create|add|remove` — manage groups
|
|
304
|
+
- `clear --yes` — destructive clear with explicit confirmation
|
|
305
|
+
- `validate spec` — validate json-render specs and graph payloads without creating nodes
|
|
306
|
+
- `web-artifact build` — build bundled React/Tailwind HTML artifacts; use `--deps` for extra packages and `--include-logs` only when raw logs are useful
|
|
307
|
+
- `external-app add --kind excalidraw` — create the hosted Excalidraw preset; response includes `id` and `nodeId` aliases for the same canvas node
|
|
308
|
+
- `serve status|stop` — inspect and stop daemonized servers started with `serve --daemon`
|
|
309
|
+
- `code-graph`, `spatial` — analysis commands
|
|
310
|
+
|
|
311
|
+
Current caveat:
|
|
312
|
+
- `mcp-app` grouping is not fully uniform yet. Web artifact app nodes have grouped reliably, but
|
|
313
|
+
Excalidraw app nodes have shown inconsistent `group add` behavior and weaker rediscoverability
|
|
314
|
+
through search later in the session. When you plan to curate an app-heavy comparison area,
|
|
315
|
+
capture node IDs immediately after creation and verify membership with `node get --summary`,
|
|
316
|
+
`layout --summary`, or the browser selection state instead of relying on search alone.
|
|
317
|
+
- App-like nodes persist as `type: "mcp-app"` internally but serialized results include `kind`:
|
|
318
|
+
`web-artifact`, `external-app`, or `mcp-app`. Prefer `node list --type web-artifact` or
|
|
319
|
+
`node list --type external-app` when you need the operational subtype.
|
|
320
|
+
- Generic `pmx-canvas node add --type mcp-app` is intentionally not supported because app nodes
|
|
321
|
+
need app/session metadata. Use `pmx-canvas web-artifact build` for bundled React artifacts or
|
|
322
|
+
`pmx-canvas external-app add --kind excalidraw` for the Excalidraw preset.
|
|
323
|
+
- For local `image` nodes on macOS, iCloud/OneDrive cloud-only placeholder files are rejected with
|
|
324
|
+
a download-first hint. Download the image locally before adding it to the canvas.
|
|
325
|
+
|
|
326
|
+
The CLI targets `http://localhost:4313` by default. Override with `PMX_CANVAS_URL` or
|
|
327
|
+
`PMX_CANVAS_PORT` when the canvas is running elsewhere.
|
|
328
|
+
|
|
329
|
+
## Core Concepts
|
|
330
|
+
|
|
331
|
+
### Node Types
|
|
332
|
+
|
|
333
|
+
| Type | Purpose | When to use |
|
|
334
|
+
|------|---------|-------------|
|
|
335
|
+
| `markdown` | Rich formatted content | Explanations, documentation, notes, findings |
|
|
336
|
+
| `status` | Compact color-coded indicator | Progress tracking, build/test results, task state |
|
|
337
|
+
| `file` | Live file viewer (auto-watches) | Show source code with live updates on file change |
|
|
338
|
+
| `image` | Image display | Screenshots, diagrams, charts |
|
|
339
|
+
| `context` | Context card | Key context the human should see |
|
|
340
|
+
| `ledger` | Log/ledger viewer | Structured log data, audit trails |
|
|
341
|
+
| `trace` | Trace/timeline viewer | Execution traces, timelines |
|
|
342
|
+
| `mcp-app` | Hosted app/embed frame | Tool-backed MCP apps or external app content; not generic CLI-created notes |
|
|
343
|
+
| `json-render` | Native structured UI panel | Dashboards, forms, tables, interactive layouts from json-render specs |
|
|
344
|
+
| `graph` | Native chart panel | Line, bar, pie, area, scatter, radar, stacked-bar, composed, plus Tufte primitives (sparkline, dot-plot, bullet, slopegraph) rendered inside the canvas |
|
|
345
|
+
| `html` | Sandboxed HTML+JS document | Self-contained HTML with optional inline `<script>` and CDN imports rendered in a sandbox-restricted iframe; canvas theme tokens are auto-injected |
|
|
346
|
+
| `group` | Spatial container/frame | Visually group related nodes together |
|
|
347
|
+
| `prompt` | Prompt thread root | Canvas-native prompt entry points for agent conversations. **Internal type — surfaces in `canvas://layout` for thread rendering but is not created via the public `canvas_node { action: "add" }` API. Don't try to add one directly.** |
|
|
348
|
+
| `response` | Prompt reply / streamed answer | Agent responses linked to prompt threads. **Same internal-only restriction as `prompt`.** |
|
|
349
|
+
|
|
350
|
+
### Edge Types
|
|
351
|
+
|
|
352
|
+
| Type | Purpose | Example label |
|
|
353
|
+
|------|---------|---------------|
|
|
354
|
+
| `flow` | Sequential/directional | "then", "calls", "triggers" |
|
|
355
|
+
| `depends-on` | Dependency | "requires", "blocks" |
|
|
356
|
+
| `relation` | General relationship | "related to", "similar to" |
|
|
357
|
+
| `references` | Cross-reference | "see also", "documented in" |
|
|
358
|
+
|
|
359
|
+
Edges support `style` (solid/dashed/dotted) and `animated` flag. Always use descriptive labels.
|
|
360
|
+
|
|
361
|
+
**Edge direction convention:** `from` is the source/dependent, `to` is the target/dependency.
|
|
362
|
+
So `from: A, to: B, type: "depends-on"` means "A depends on B." For `flow` edges, the arrow
|
|
363
|
+
points from `from` to `to`, indicating sequence or data flow direction.
|
|
364
|
+
|
|
365
|
+
**Style conventions:** Use `solid` for active/satisfied relationships, `dashed` for blocked or
|
|
366
|
+
pending dependencies, and `dotted` for weak/optional relationships. Use `animated: true` to
|
|
367
|
+
draw visual attention to critical paths.
|
|
368
|
+
|
|
369
|
+
### Layout: spacing and groups
|
|
370
|
+
|
|
371
|
+
Agents tend to pack boards too tightly. Give nodes room to breathe — readability beats density.
|
|
372
|
+
|
|
373
|
+
- **Default spacing:** leave a clear gap between neighbors — roughly half a node's width
|
|
374
|
+
horizontally and half its height vertically. A 280×180 node reads well with ~360px between
|
|
375
|
+
column origins and ~260px between row origins.
|
|
376
|
+
- **When nodes are connected by edges, space them further apart** so the edge line, its arrowhead,
|
|
377
|
+
and its label are clearly visible in the gap between nodes. Crowded nodes hide the flow — this is
|
|
378
|
+
the most common cause of an unreadable board.
|
|
379
|
+
- **Inside a group, keep the same breathing room** (groups no longer auto-pack children, so the
|
|
380
|
+
spacing you set is what the human sees). Edges between grouped children especially need the gap.
|
|
381
|
+
- **Size a group frame larger than its children's bounding box** so the group header — including the
|
|
382
|
+
node-count badge — stays visible and isn't hidden under the top-left child. For an explicit
|
|
383
|
+
(manual) group frame, add margin on every side (≈56px) plus room at the top for the header rather
|
|
384
|
+
than hugging the children. Auto-fit groups (created without an explicit width/height) already
|
|
385
|
+
reserve this margin.
|
|
386
|
+
|
|
387
|
+
### Colors (Semantic)
|
|
388
|
+
|
|
389
|
+
Use color consistently to convey meaning:
|
|
390
|
+
- **Green** (`#22c55e`) — success, done, healthy
|
|
391
|
+
- **Yellow** (`#eab308`) — in progress, warning, attention needed
|
|
392
|
+
- **Red** (`#ef4444`) — error, blocked, failing
|
|
393
|
+
- **Blue** (`#3b82f6`) — informational, neutral highlight
|
|
394
|
+
- **Gray** (`#6b7280`) — queued, pending, inactive, not yet started
|
|
395
|
+
- **Purple** (`#a855f7`) — special, notable, review needed
|
|
396
|
+
|
|
397
|
+
## MCP Tools Reference
|
|
398
|
+
|
|
399
|
+
PMX Canvas exposes **15 action-discriminated composites** (the recommended surface) plus a
|
|
400
|
+
set of first-class standalones. The composites fold the older
|
|
401
|
+
single-purpose tools behind an `action` (and, for `canvas_ax_gate`, a `kind`) discriminator —
|
|
402
|
+
**field names are unchanged**; only the tool name + the `action`/`kind` selector differ.
|
|
403
|
+
|
|
404
|
+
> **Legacy single-purpose tools are Deprecated.** The old names (`canvas_add_node`,
|
|
405
|
+
> `canvas_update_node`, `canvas_request_approval`, `canvas_add_work_item`, …) still work but are
|
|
406
|
+
> marked `Deprecated:` and are **removed in v0.3**. Prefer the composites. The authoritative
|
|
407
|
+
> legacy→composite mapping table lives in [`docs/mcp.md`](../../../docs/mcp.md) — this skill does not
|
|
408
|
+
> re-enumerate the deprecated names.
|
|
409
|
+
|
|
410
|
+
### The 15 composites
|
|
411
|
+
|
|
412
|
+
| Composite | `action` values | What it does |
|
|
413
|
+
|-----------|-----------------|--------------|
|
|
414
|
+
| `canvas_node` | `add` · `get` · `update` · `remove` | Create / read / mutate / delete a node. **`add` covers html + primitives too**: `{ action:"add", type:"html", html:"…" }` and `{ action:"add", type:"html", primitive:"choice-grid", data:{} }` — no separate add-html tool needed |
|
|
415
|
+
| `canvas_render` | `describe-schema` · `validate` · `add-json-render` · `stream-json-render` · `add-graph` | Schema introspection, spec dry-run validation, and native json-render / graph node creation |
|
|
416
|
+
| `canvas_edge` | `add` · `remove` | Connect / disconnect nodes |
|
|
417
|
+
| `canvas_group` | `create` · `add` · `ungroup` | Manage spatial group containers |
|
|
418
|
+
| `canvas_history` | `undo` · `redo` | Time travel through the mutation ring buffer |
|
|
419
|
+
| `canvas_view` | `arrange` · `focus` · `fit` · `clear` · `remove-annotation` | Auto-arrange, pan-to-node, fit viewport, clear the board, delete a human-drawn annotation by id |
|
|
420
|
+
| `canvas_query` | `search` · `layout` · `validate` | Find nodes by keyword, read full layout, or **`validate`** the board for node collisions / group-containment / dangling edges |
|
|
421
|
+
| `canvas_app` | `open-mcp-app` · `diagram` · `build-artifact` | Hosted MCP apps, the Excalidraw diagram preset, and bundled web artifacts (folds `canvas_open_mcp_app` / `canvas_add_diagram` / `canvas_build_web_artifact`) |
|
|
422
|
+
| `canvas_webview` | `status` · `start` · `stop` · `resize` · `evaluate` | Headless Bun.WebView automation for the workbench (folds the `canvas_webview_*` / `canvas_resize` / `canvas_evaluate` tools) |
|
|
423
|
+
| `canvas_ax_state` | `get` · `set-focus` · `set-policy` · `report-capability` | Read AX state; set AX focus; patch tool/prompt policy; report host capability |
|
|
424
|
+
| `canvas_ax_work` | `add` · `update` · `annotate` | Canvas-bound work items + review annotations |
|
|
425
|
+
| `canvas_ax_gate` | `request` · `resolve` · `await` × `kind` `approval` \| `elicitation` \| `mode` | The human-decision gate machine (request → await → resolve) |
|
|
426
|
+
| `canvas_ax_timeline` | `read` · `record-event` · `add-evidence` · `send-steering` | The bounded AX diagnostics timeline |
|
|
427
|
+
| `canvas_ax_delivery` | `claim` · `mark` | Adapterless steering delivery (claim → act → mark) |
|
|
428
|
+
| `canvas_intent` | `signal` · `update` · `clear` | Ghost Cursor of Intent — announce a move before making it |
|
|
429
|
+
|
|
430
|
+
Call shape examples: `canvas_node { action: "add", type, title }`,
|
|
431
|
+
`canvas_view { action: "focus", id }`, `canvas_group { action: "create", childIds }`,
|
|
432
|
+
`canvas_render { action: "add-graph", graphType, data }`,
|
|
433
|
+
`canvas_query { action: "search", query }`,
|
|
434
|
+
`canvas_ax_work { action: "update", id, status }`.
|
|
435
|
+
|
|
436
|
+
`canvas_ax_gate` takes **two** discriminators, `{ kind, action }` — e.g.
|
|
437
|
+
`{ kind: "approval", action: "request", title }`,
|
|
438
|
+
`{ kind: "elicitation", action: "resolve", id, response }`,
|
|
439
|
+
`{ kind: "mode", action: "await", id, timeoutMs }`. (The approval machine-readable action
|
|
440
|
+
identifier is passed as `approvalAction`, since `action` is the lifecycle discriminator.)
|
|
441
|
+
|
|
442
|
+
#### Narrate your next move with `canvas_intent` (Ghost Cursor of Intent)
|
|
443
|
+
|
|
444
|
+
Before you create/move/connect/edit/remove on the canvas, **signal the move** so a
|
|
445
|
+
faint placeholder forms where you're about to act — the human sees the next move
|
|
446
|
+
coming and can veto it mid-thought. Intents are ephemeral presence: never
|
|
447
|
+
persisted, auto-expiring (~8s), never in `canvas_query layout`.
|
|
448
|
+
|
|
449
|
+
Narrate → linked mutation → automatic settle:
|
|
450
|
+
1. `canvas_intent { action: "signal", kind: "create", position: { x, y }, nodeType: "markdown", label: "Add evidence", reason: "capturing the failing test", confidence: 0.8 }` → returns `intent.id`.
|
|
451
|
+
2. Make the real move and pass that id: `canvas_node { action: "add", intentId: <intent.id>, ... }`.
|
|
452
|
+
3. PMX rejects the mutation if the intent was vetoed or expired; otherwise the
|
|
453
|
+
successful mutation settles the ghost into the resulting node automatically.
|
|
454
|
+
|
|
455
|
+
Use `canvas_intent { action: "clear", id }` only when abandoning a plan without
|
|
456
|
+
performing the linked mutation.
|
|
457
|
+
|
|
458
|
+
Per kind, pass the anchor it renders against: `position` for `create`/`move`,
|
|
459
|
+
`nodeId` for `move`/`edit`/`remove`, `edge: { from, to, type }` for `connect`. The
|
|
460
|
+
payoff is **legibility** — `reason` is shown beneath the ghost. For a planned
|
|
461
|
+
batch, signal all intents up front (with `seq` for ordering), then commit them one
|
|
462
|
+
by one with the corresponding `intentId` so the human watches the layout wireframe
|
|
463
|
+
in before it fills.
|
|
464
|
+
|
|
465
|
+
### Standalones (first-class — not deprecated)
|
|
466
|
+
|
|
467
|
+
These stay separate by design (trust-boundary, firehose, execution-intent, or not-yet-consolidated
|
|
468
|
+
surfaces): `canvas_batch`, `canvas_pin_nodes`, `canvas_screenshot`,
|
|
469
|
+
`canvas_refresh_webpage_node`, `canvas_ax_interaction`,
|
|
470
|
+
`canvas_ingest_activity`, `canvas_invoke_command`, and the snapshot tools (`canvas_snapshot`,
|
|
471
|
+
`canvas_list_snapshots`, `canvas_restore`, `canvas_delete_snapshot`, `canvas_gc_snapshots`,
|
|
472
|
+
`canvas_diff` — a `canvas_snapshot` composite is deferred to v0.3).
|
|
473
|
+
|
|
474
|
+
> **Deprecated → use the composite instead** (legacy tools still work but are marked
|
|
475
|
+
> `Deprecated:` and are **removed in v0.3**): `canvas_open_mcp_app` / `canvas_add_diagram` /
|
|
476
|
+
> `canvas_build_web_artifact` → **`canvas_app`**; `canvas_webview_start` / `canvas_webview_status` /
|
|
477
|
+
> `canvas_webview_stop` / `canvas_resize` / `canvas_evaluate` → **`canvas_webview`**;
|
|
478
|
+
> `canvas_add_html_node` / `canvas_add_html_primitive` → **`canvas_node { action:"add", type:"html" }`**
|
|
479
|
+
> (pass `primitive` for a primitive); `canvas_add_node` / `canvas_update_node` / `canvas_remove_node`
|
|
480
|
+
> → **`canvas_node`**; `canvas_remove_annotation` → **`canvas_view { action:"remove-annotation" }`**;
|
|
481
|
+
> `canvas_validate` (board collisions / containment / dangling edges) → **`canvas_query` `validate`**;
|
|
482
|
+
> `canvas_validate_spec` (json-render / graph spec dry-run) → **`canvas_render` `validate`**.
|
|
483
|
+
|
|
484
|
+
### Node Operations
|
|
485
|
+
|
|
486
|
+
MCP node-type routing — which tool creates which node category:
|
|
487
|
+
|
|
488
|
+
| Node category | MCP creation call |
|
|
489
|
+
|---------------|-------------------|
|
|
490
|
+
| Basic nodes (`markdown`, `status`, `context`, `ledger`, `trace`, `file`, `image`, `webpage`) | `canvas_node { action: "add" }` |
|
|
491
|
+
| `json-render` | `canvas_render { action: "add-json-render" }` |
|
|
492
|
+
| `graph` | `canvas_render { action: "add-graph" }` |
|
|
493
|
+
| `html` | `canvas_node { action: "add", type: "html", html }` |
|
|
494
|
+
| `html-primitive` | `canvas_node { action: "add", type: "html", primitive: "<kind>", data }` |
|
|
495
|
+
| `web-artifact` | `canvas_app { action: "build-artifact" }` |
|
|
496
|
+
| `external-app` / tool-backed `mcp-app` | `canvas_app { action: "open-mcp-app" }` (Excalidraw preset: `canvas_app { action: "diagram" }`) |
|
|
497
|
+
| `group` | `canvas_group { action: "create" }` |
|
|
498
|
+
|
|
499
|
+
If a node type is rejected by `canvas_node { action: "add" }`, call
|
|
500
|
+
`canvas_render { action: "describe-schema" }` and read `mcp.nodeTypeRouting`; do not keep
|
|
501
|
+
retrying the generic add.
|
|
502
|
+
|
|
503
|
+
**`canvas_node { action: "add", … }`** — Add a node to the canvas
|
|
504
|
+
- `type` (required): basic node type only; structured/app/group nodes use the routing table above
|
|
505
|
+
- `title`: short, scannable title
|
|
506
|
+
- `content`: markdown text for most types. For `file`, pass the **file path** (e.g. `"src/auth/login.ts"`) —
|
|
507
|
+
the server auto-loads + watches it. For `image`, pass a file path, URL, or data URI.
|
|
508
|
+
- `path`: compatibility alias for image paths only; prefer `content` for new image calls
|
|
509
|
+
- `x`, `y`: position (prefer omitting for auto-layout); `width`, `height`: dimensions (sensible defaults); `color`: semantic color; `metadata`: arbitrary JSON
|
|
510
|
+
- Returns: `{ id: "<node-id>" }` — capture this ID for edges and groups
|
|
511
|
+
|
|
512
|
+
**`canvas_node { action: "update", id, … }`** — Update an existing node in place (preferred over
|
|
513
|
+
delete+recreate; preserves edges, pins, position)
|
|
514
|
+
- `id` (required), plus any of: `title`, `content`, `x`, `y`, `width`, `height`, `collapsed`, `arrangeLocked`, `data`
|
|
515
|
+
- For `json-render`, pass `spec` to update the rendered spec in place
|
|
516
|
+
- For `graph`, pass graph fields (`graphType`, `data`, `xKey`, `yKey`, `color`, `chartHeight`) to rebuild the chart; `height`/`nodeHeight` set frame geometry, `chartHeight` the chart content
|
|
517
|
+
|
|
518
|
+
**`canvas_node { action: "remove", id }`** — Remove a node and all its connected edges. Clean up nodes that are no longer relevant.
|
|
519
|
+
|
|
520
|
+
**`canvas_node { action: "get", id }`** — Get a single node's full data by `id`.
|
|
521
|
+
|
|
522
|
+
**`canvas_remove_annotation`** (deprecated → `canvas_view { action: "remove-annotation" }`; removed in v0.3) — Remove a human-drawn annotation by `id`. Use when
|
|
523
|
+
context gives you the annotation ID; use WebView first if you need to identify a mark by shape or location.
|
|
524
|
+
|
|
525
|
+
**`canvas_refresh_webpage_node`** (standalone) — Re-fetch the URL stored on a `webpage` node
|
|
526
|
+
- `id` (required): webpage node to refresh
|
|
527
|
+
- Optional `url`: replace the stored URL before refreshing (use when the human moved the page)
|
|
528
|
+
- Returns the refreshed node with updated `pageTitle` and cached extracted text
|
|
529
|
+
- Use this when a saved canvas is reopened and the agent needs fresh page content without
|
|
530
|
+
losing the node's identity, position, or pins. Example flow:
|
|
531
|
+
|
|
532
|
+
```typescript
|
|
533
|
+
// Add the page once
|
|
534
|
+
canvas_node({ action: 'add', type: 'webpage', url: 'https://example.com/docs' })
|
|
535
|
+
// → returns { id: 'node-abc' }
|
|
536
|
+
|
|
537
|
+
// …later, after the human reopens the canvas…
|
|
538
|
+
canvas_refresh_webpage_node({ id: 'node-abc' })
|
|
539
|
+
// → re-fetches the URL, updates pageTitle + extracted text, keeps the node ID and position
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**`canvas_render { action: "add-json-render", … }`** — Add a native json-render node
|
|
543
|
+
- Required: `spec`; `title` is optional and inferred from the root element when omitted
|
|
544
|
+
- Prefer a complete json-render object with `root`, `elements`, and optional `state`
|
|
545
|
+
- Legacy bare component specs like `{ type: "Badge", props: {...} }` are accepted and wrapped into a one-element document for compatibility
|
|
546
|
+
- Use this when you want a structured UI panel rendered directly inside PMX Canvas
|
|
547
|
+
- For shadcn `Badge`, prefer `props.text` with variants `default`, `secondary`, `destructive`, or
|
|
548
|
+
`outline`. Legacy `props.label` and status variants (`success`, `info`, `warning`, `error`,
|
|
549
|
+
`danger`) are normalized for saved-spec compatibility.
|
|
550
|
+
|
|
551
|
+
**`canvas_render { action: "stream-json-render", … }`** — Build a json-render node progressively (live)
|
|
552
|
+
- Omit `nodeId` on the first call to create a streaming node (returns its `id`); reuse that `nodeId`
|
|
553
|
+
on later calls to append `patches`; set `done: true` on the final call.
|
|
554
|
+
- `patches` are SpecStream JSON-Patch ops applied server-side (the canvas accumulates the spec), e.g.
|
|
555
|
+
`{ "op": "add", "path": "/elements/card", "value": { … } }`, `{ "op": "replace", "path": "/root", "value": "card" }`.
|
|
556
|
+
- Build incrementally: set `/root`, add container elements, then append child element ids/elements.
|
|
557
|
+
Each call re-renders; partial specs render what they can. Use for dashboards/reports that fill in
|
|
558
|
+
as you generate them rather than appearing all at once.
|
|
559
|
+
|
|
560
|
+
**`canvas_render { action: "add-graph", … }`** — Add a native graph/chart node
|
|
561
|
+
- Required: `graphType`, `data`
|
|
562
|
+
- Supports `line`, `bar`, `pie`, `area`, `scatter`, `radar`, `stacked-bar`, `composed`,
|
|
563
|
+
and the Tufte primitives `sparkline`, `dot-plot`, `bullet`, `slopegraph` (aliases accepted)
|
|
564
|
+
- Use `xKey`/`yKey` for line, bar, area, and scatter graphs
|
|
565
|
+
- Use `zKey` for scatter bubble size
|
|
566
|
+
- Use `nameKey`/`valueKey` for pie graphs
|
|
567
|
+
- Use `axisKey` plus `metrics` for radar graphs
|
|
568
|
+
- Use `series` for stacked-bar graphs
|
|
569
|
+
- Use `barKey`/`lineKey` plus optional `barColor`/`lineColor` for composed graphs
|
|
570
|
+
- Bar charts: `colorBy` (`series` default = one accent + a highlighted bar, `category`, `value`, `none`) and `highlight` (`max`/`min`/index)
|
|
571
|
+
- Use `valueKey` for `sparkline` (plus `fill`/`showEndDot`/`showMinMax`/`showValue`)
|
|
572
|
+
- Use `labelKey`/`valueKey` (plus `sort`) for `dot-plot`
|
|
573
|
+
- Use `labelKey`/`valueKey`/`targetKey`/`rangesKey` for `bullet`
|
|
574
|
+
- Use `labelKey`/`beforeKey`/`afterKey` (plus `beforeLabel`/`afterLabel`/`colorByDirection`) for `slopegraph`
|
|
575
|
+
- Use `nodeHeight` for the canvas frame height and `height` for chart content height
|
|
576
|
+
- Uses the native json-render chart catalog under the hood
|
|
577
|
+
|
|
578
|
+
**Tufte-aware charting** — color must encode data, not decorate. For chart design and critique, use
|
|
579
|
+
the `tufte-viz` skill (`skills/tufte-viz/SKILL.md`). Key rules:
|
|
580
|
+
- Single-series `bar` charts use `colorBy`: default `series` (one accent + one highlighted bar),
|
|
581
|
+
`category` (opt-in palette), `value` (sequential shade by magnitude), or `none` (flat). Do not
|
|
582
|
+
rainbow categorical bars by default.
|
|
583
|
+
- Prefer the Tufte primitives where they fit: `sparkline` (inline trend), `dot-plot` (ranked single
|
|
584
|
+
metric vs. a bar forest), `bullet` (measure vs. target, replaces a gauge), `slopegraph`
|
|
585
|
+
(before/after across many categories).
|
|
586
|
+
- Direct-label data (`showLegend: false`) instead of a legend when one or two series are identifiable.
|
|
587
|
+
- For more than ~4 overlapping series, build small multiples (several small graph nodes on a shared
|
|
588
|
+
scale, arranged in a grid/group) instead of one multi-color chart.
|
|
589
|
+
|
|
590
|
+
**`canvas_build_web_artifact`** (deprecated → `canvas_app { action: "build-artifact" }`; removed in v0.3) — Build and optionally open a bundled web artifact
|
|
591
|
+
- Required: `title`, `appTsx` (source string contents, not a file path)
|
|
592
|
+
- CLI `--app-file` reads a file before calling the same build path; MCP callers must pass the source contents
|
|
593
|
+
- Cold builds commonly take 45-60 seconds; use a long client timeout such as 300000 ms or more
|
|
594
|
+
- Returns both `id` and `nodeId` for the created artifact node when `openInCanvas` is true
|
|
595
|
+
|
|
596
|
+
ID extraction for mixed tool responses:
|
|
597
|
+
- Most add-style tools return a flat `id`; web artifacts return `id` plus `nodeId`; snapshots return `id` plus nested `snapshot.id`.
|
|
598
|
+
- Defensive extractor: `const getId = (r) => r.id ?? r.nodeId ?? r.snapshot?.id;`
|
|
599
|
+
|
|
600
|
+
**`canvas_open_mcp_app`** (deprecated → `canvas_app { action: "open-mcp-app" }`; removed in v0.3) — Open a tool-backed external MCP app node
|
|
601
|
+
- Required: `toolName`, `transport`
|
|
602
|
+
- `transport` is either `{ type: "stdio", command, args?, cwd?, env? }` or `{ type: "http", url, headers? }`
|
|
603
|
+
- This is lower-level than `pmx-canvas external-app add --kind excalidraw`; use `canvas_app { action: "diagram" }` for the built-in Excalidraw preset
|
|
604
|
+
|
|
605
|
+
**`canvas_pin_nodes`** (standalone) — Set, add, or remove pinned context nodes. Use `{ nodeIds: [...] }` — the field is `nodeIds`, not `ids`.
|
|
606
|
+
|
|
607
|
+
**`canvas_diff`** (standalone) — Compare current canvas state with a saved snapshot. Requires `{ snapshot: "<snapshot-id-or-name>" }`; there is no implicit previous-snapshot default.
|
|
608
|
+
|
|
609
|
+
**`canvas_render { action: "describe-schema" }`** — Inspect the running server's create schemas and
|
|
610
|
+
canonical examples. Use before generating structured payloads when you need the authoritative current
|
|
611
|
+
shape; read `mcp.nodeTypeRouting` to choose the right creation call for each node category.
|
|
612
|
+
|
|
613
|
+
**`canvas_render { action: "validate", … }`** — Dry-run a json-render spec or graph payload without
|
|
614
|
+
creating a node. Returns the normalized json-render spec the server would accept.
|
|
615
|
+
|
|
616
|
+
**`canvas_view { action: "fit", … }`** — Fit viewport to all nodes or selected nodes; optional
|
|
617
|
+
`width`, `height`, `padding`, `maxScale`, `nodeIds`. Use before screenshot/whole-board review so the
|
|
618
|
+
server viewport matches the intended camera.
|
|
619
|
+
|
|
620
|
+
**Batch graph creation** — Use the `graph.add` op inside `canvas_batch` / `pmx-canvas batch` for a
|
|
621
|
+
graph node in a larger one-shot build. It takes the same shape as `canvas_render { action: "add-graph" }`.
|
|
622
|
+
In batch/MCP/HTTP payloads, `height` is chart content height and `nodeHeight` is the canvas frame height.
|
|
623
|
+
|
|
624
|
+
### Edge Operations
|
|
625
|
+
|
|
626
|
+
**`canvas_edge { action: "add", … }`** — Connect two nodes
|
|
627
|
+
- `from`, `to` (required): source and target node IDs
|
|
628
|
+
- `fromSearch`, `toSearch`: optional search-based selectors when you do not have IDs. Each search
|
|
629
|
+
query must resolve to exactly one node or the edge creation fails with an ambiguity error.
|
|
630
|
+
- `type`: `flow`, `depends-on`, `relation`, or `references` (default: `relation`)
|
|
631
|
+
- `label`: descriptive relationship label; `style`: `solid`/`dashed`/`dotted`; `animated`: visual emphasis
|
|
632
|
+
- `canvas_edge { action: "remove", id }` removes a connection by edge `id`.
|
|
633
|
+
|
|
634
|
+
### Layout & Navigation
|
|
635
|
+
|
|
636
|
+
- **`canvas_query { action: "layout" }`** — full canvas state (nodes, edges, viewport). Read before mutating.
|
|
637
|
+
- **`canvas_view { action: "arrange", layout }`** — auto-arrange all nodes; `layout` is `grid` (default,
|
|
638
|
+
dashboards/overviews), `column` (vertical lists), or `flow` (horizontal sequences / dependency chains).
|
|
639
|
+
Call once after a batch of adds. For tiered/layered layouts, fine-tune with explicit `x`/`y` via
|
|
640
|
+
`canvas_node { action: "update" }` after arranging.
|
|
641
|
+
- **`canvas_view { action: "focus", id }`** — pan the viewport to a node. Don't focus every node in a
|
|
642
|
+
batch — focus only the final result, or use CLI `focus --no-pan` to select/raise without moving the camera.
|
|
643
|
+
|
|
644
|
+
### Groups
|
|
645
|
+
|
|
646
|
+
- **`canvas_group { action: "create", … }`** — visual container; `title`, `childIds` (node IDs), `color`. Auto-sizes to fit children.
|
|
647
|
+
- **`canvas_group { action: "add", groupId, childIds }`** — add nodes to an existing group.
|
|
648
|
+
- **`canvas_group { action: "ungroup", groupId }`** — release all children from a group.
|
|
649
|
+
|
|
650
|
+
### Group Layout Guidance
|
|
651
|
+
|
|
652
|
+
Use groups as spacious semantic regions, not as tight containers. (Group calls below use
|
|
653
|
+
`canvas_group { action: "create" | "add" | "ungroup" }`.)
|
|
654
|
+
|
|
655
|
+
- Size the child nodes first, especially `graph`, `json-render`, `mcp-app`, image, and webpage
|
|
656
|
+
nodes whose rendered content may need more height than their visible title suggests.
|
|
657
|
+
- Give every group generous interior padding. Reserve extra top padding for the group header, then
|
|
658
|
+
keep children clear of the frame edges so headers, glow, resize handles, and node chrome do not
|
|
659
|
+
visually collide.
|
|
660
|
+
- If creating a group manually, compute its frame from the final child bounds plus padding. If the
|
|
661
|
+
group exists first, expand it before adding large children rather than shrinking children to fit.
|
|
662
|
+
- Use groups to label major regions of a board. Avoid wrapping every small relationship; too many
|
|
663
|
+
tight groups make the canvas harder to read than no groups.
|
|
664
|
+
- Keep edges local to a group where possible. Long cross-board edges can look like they come from
|
|
665
|
+
nowhere; use a nearby bridge/context node or split the relationship into shorter labeled edges.
|
|
666
|
+
- After grouping, verify the result in `canvas_query { action: "layout" }` or the browser: child nodes should be
|
|
667
|
+
fully inside the group with padding, visible nodes should not overlap, and group headers should
|
|
668
|
+
not cover content.
|
|
669
|
+
- If a group makes important content less visible, enlarge the group, split it into clearer
|
|
670
|
+
regions, or remove the group. Visibility is more important than preserving a frame.
|
|
671
|
+
|
|
672
|
+
### Grouped Comparison Boards
|
|
673
|
+
|
|
674
|
+
Use groups as named comparison areas, not just visual boxes.
|
|
675
|
+
|
|
676
|
+
- Create the comparison frame first with `canvas_group { action: "create" }` or
|
|
677
|
+
`pmx-canvas group create`, then add charts, artifacts, and diagrams into that area deliberately.
|
|
678
|
+
- Prefer graph nodes for fast capability demos and side-by-side comparisons. They are lightweight,
|
|
679
|
+
validate quickly, and are easier to regenerate.
|
|
680
|
+
- Prefer web artifacts when the board needs a richer narrative UI, custom interaction, or a more
|
|
681
|
+
polished presentation layer than a graph or json-render node can provide.
|
|
682
|
+
- Use Excalidraw for sketching and flow diagrams, but treat it as less reliable than web-artifact
|
|
683
|
+
app nodes for grouping and rediscovery until `mcp-app` grouping parity is fixed.
|
|
684
|
+
- Native node types are still the most agent-friendly. Graph nodes are the strongest comparison
|
|
685
|
+
primitive today, web artifacts are good but heavier, and Excalidraw / other `mcp-app` nodes are
|
|
686
|
+
useful but still the weakest operationally for create, rediscover, group, and reconnect flows.
|
|
687
|
+
- Leave larger spacing between major regions than you think you need. The spatial analyzer still
|
|
688
|
+
tends to read dense boards as one giant cluster unless groups and gaps are both clear.
|
|
689
|
+
- If you are expanding a board incrementally, verify each add-to-group step instead of assuming
|
|
690
|
+
the node joined the area. Comparison workflows depend on reliable “add this thing to the region
|
|
691
|
+
I’m already building.”
|
|
692
|
+
|
|
693
|
+
Current product caveats for grouped comparison boards:
|
|
694
|
+
- `mcp-app` grouping parity is inconsistent. Web artifacts have grouped cleanly; Excalidraw has
|
|
695
|
+
not always behaved the same way.
|
|
696
|
+
- Search/discoverability for external app nodes can degrade over time in-session, so node IDs are
|
|
697
|
+
safer than title-based rediscovery for follow-up grouping or focus operations.
|
|
698
|
+
- `mcp-app` nodes are less inspectable than native nodes. For graph nodes you can reason from
|
|
699
|
+
structured config, but app nodes often only tell you that an app exists unless you also inspect
|
|
700
|
+
nearby markdown, file, or graph context.
|
|
701
|
+
- Long-running web artifact builds can exceed a short command timeout. When using them in an
|
|
702
|
+
agent workflow, prefer progress-aware handling and avoid assuming a timeout means failure.
|
|
703
|
+
|
|
704
|
+
### Search & Discovery
|
|
705
|
+
|
|
706
|
+
**`canvas_query { action: "search", query }`** — Find nodes by title or content keywords. Returns
|
|
707
|
+
ranked matches with content snippets. Use instead of parsing the full layout to locate specific nodes.
|
|
708
|
+
|
|
709
|
+
### Context Pinning
|
|
710
|
+
|
|
711
|
+
**`canvas_pin_nodes`** (standalone) — Manage pinned context: `nodeIds` (required) plus `mode`
|
|
712
|
+
(`set` replaces all pins, `add`, `remove`).
|
|
713
|
+
- Pinned nodes are the primary human-to-agent communication channel — when a human pins in the
|
|
714
|
+
browser, they're saying "pay attention to these."
|
|
715
|
+
- Best default pin set: one intent-setting markdown node plus 1-3 concrete output nodes.
|
|
716
|
+
- Graph, file, and markdown pins carry richer usable context than `mcp-app` pins. Artifact and
|
|
717
|
+
Excalidraw pins still matter as intent signals, but pair them with a markdown or graph pin so the
|
|
718
|
+
agent understands what is inside the app, not just that it matters.
|
|
719
|
+
|
|
720
|
+
### History & Snapshots
|
|
721
|
+
|
|
722
|
+
- **`canvas_history { action: "undo" }`** / **`canvas_history { action: "redo" }`** — step the mutation ring buffer.
|
|
723
|
+
- **`canvas_snapshot`** (standalone) — save a named snapshot; `name` required. Returns `{ ok, id, snapshot }` (flat `id` aliases `snapshot.id`).
|
|
724
|
+
- **`canvas_restore`** (standalone) — restore from a snapshot `id`.
|
|
725
|
+
- **`canvas_diff`** (standalone) — compare current canvas against a saved snapshot (added/removed/modified nodes & edges).
|
|
726
|
+
|
|
727
|
+
### Canvas Management
|
|
728
|
+
|
|
729
|
+
**`canvas_view { action: "clear" }`** — Remove all nodes and edges. **Always `canvas_snapshot` first** —
|
|
730
|
+
this is irreversible without a prior snapshot.
|
|
731
|
+
|
|
732
|
+
### Browser Automation (WebView)
|
|
733
|
+
|
|
734
|
+
The canvas exposes a headless browser session over MCP for self-inspection and
|
|
735
|
+
automated screenshotting. Use this when you want to (a) verify what the live
|
|
736
|
+
canvas actually looks like after a sequence of mutations, (b) capture an image
|
|
737
|
+
of a freshly-built artifact for the human to review, or (c) drive arbitrary
|
|
738
|
+
JavaScript inside the workbench page.
|
|
739
|
+
|
|
740
|
+
The WebView automation runs on Bun's WebKit-based WebView (macOS) or a headless
|
|
741
|
+
Chromium fallback (Linux). It does **not** open a visible window; it's an
|
|
742
|
+
additional headless renderer attached to the same canvas server, so all five
|
|
743
|
+
tools below operate on the live canvas state.
|
|
744
|
+
|
|
745
|
+
> **Deprecated → use the `canvas_webview` composite** (removed in v0.3): the five
|
|
746
|
+
> standalone tools below map to `canvas_webview { action: "status" | "start" | "stop" |
|
|
747
|
+
> "evaluate" | "resize" }` respectively. Field names are unchanged.
|
|
748
|
+
|
|
749
|
+
**`canvas_webview_status`** — Inspect the current automation session
|
|
750
|
+
- Returns `{ supported, active, backend, viewportWidth, viewportHeight, url, lastError }`
|
|
751
|
+
- Call before `start` to check whether a session is already alive
|
|
752
|
+
|
|
753
|
+
**`canvas_webview_start`** — Start (or replace) the automation session
|
|
754
|
+
- Optional: `backend` (`webkit` macOS-only, or `chrome`), `width`, `height`
|
|
755
|
+
- The session opens `/workbench` at the canvas URL, waits for the SPA to
|
|
756
|
+
hydrate, and reports back via `canvas_webview_status`
|
|
757
|
+
|
|
758
|
+
**`canvas_webview_stop`** — Tear down the automation session
|
|
759
|
+
|
|
760
|
+
**`canvas_evaluate`** — Run JavaScript inside the workbench page and return the result
|
|
761
|
+
- Required: exactly one of `expression` (single JS expression) or `script` (multi-statement body)
|
|
762
|
+
- `script` is wrapped in an async IIFE, so top-level `await` works inside script bodies
|
|
763
|
+
- Useful for asserting DOM state after a sequence of canvas mutations
|
|
764
|
+
- Do not use `fetch()` inside `canvas_evaluate` to call PMX HTTP APIs; WebView security/CORS
|
|
765
|
+
restrictions can block those requests. Use the matching MCP tools instead.
|
|
766
|
+
- Example: read the count of rendered `.canvas-node` elements:
|
|
767
|
+
|
|
768
|
+
```typescript
|
|
769
|
+
canvas_evaluate({ expression: 'document.querySelectorAll(".canvas-node").length' })
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
Useful workbench selectors:
|
|
773
|
+
- Nodes: `.canvas-node`, `.canvas-node.active`, `.canvas-node.context-pinned`, `.canvas-node.group-node`
|
|
774
|
+
- Node internals: `.node-title`, `.node-titlebar`, `.node-body`, `.node-type-badge`, `.node-controls`
|
|
775
|
+
- Annotations: `.annotation-layer path` renders human-drawn freehand ink. Use WebView
|
|
776
|
+
to inspect or screenshot annotation shapes; MCP/context resources only expose compact
|
|
777
|
+
annotation target summaries, not the raw visual shape. Humans can remove marks with
|
|
778
|
+
the eraser toolbar button; agents can remove a known annotation ID with
|
|
779
|
+
`canvas_remove_annotation`.
|
|
780
|
+
- Canvas chrome: `.hud-layer`, `.canvas-toolbar`, `.connection-dot`, `.canvas-bootstrap-card`
|
|
781
|
+
- Nodes do not expose stable `data-node-id` attributes. Use `canvas_query` (`layout` / `search`) or MCP resource data for exact node IDs.
|
|
782
|
+
|
|
783
|
+
Async script example:
|
|
784
|
+
|
|
785
|
+
```typescript
|
|
786
|
+
canvas_evaluate({
|
|
787
|
+
script: 'const title = await Promise.resolve(document.title); return title;',
|
|
788
|
+
})
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
**`canvas_resize`** — Change the WebView viewport
|
|
792
|
+
- Required: `width`, `height`
|
|
793
|
+
- Use before `canvas_screenshot` when the human needs a specific aspect ratio
|
|
794
|
+
|
|
795
|
+
**`canvas_screenshot`** — Capture a PNG of the current workbench
|
|
796
|
+
- Optional: `format` (`png` default), `fullPage` (boolean)
|
|
797
|
+
- Returns both an MCP image payload (renderable inline by capable agents) and
|
|
798
|
+
a path under `.pmx-canvas/screenshots/` so the human can view the file
|
|
799
|
+
- Pair with `canvas_resize` to control the framing
|
|
800
|
+
|
|
801
|
+
Typical flow when you want to show a result:
|
|
802
|
+
|
|
803
|
+
```typescript
|
|
804
|
+
canvas_webview_start({ width: 1440, height: 900 });
|
|
805
|
+
// …mutations…
|
|
806
|
+
canvas_screenshot({ fullPage: true });
|
|
807
|
+
canvas_webview_stop();
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
### Diagrams (Excalidraw MCP app preset)
|
|
811
|
+
|
|
812
|
+
**`canvas_add_diagram`** (deprecated → `canvas_app { action: "diagram" }`; removed in v0.3) — Draw a hand-drawn diagram on the canvas via the hosted
|
|
813
|
+
[Excalidraw MCP app](https://github.com/excalidraw/excalidraw-mcp)
|
|
814
|
+
- Required: `elements` — an array of Excalidraw elements (rectangles, ellipses, diamonds, arrows,
|
|
815
|
+
text). Can also be a JSON-array string.
|
|
816
|
+
- `elements` must be Excalidraw element objects, not Mermaid/DOT/source-text diagrams. Convert source diagrams to Excalidraw elements first or use a markdown/web-artifact node.
|
|
817
|
+
- Optional: `title`, `x`, `y`, `width`, `height`
|
|
818
|
+
- The diagram opens inside an `mcp-app` node with fullscreen editing and draw-on animations
|
|
819
|
+
- CLI equivalent: `pmx-canvas external-app add --kind excalidraw --title "Diagram"`
|
|
820
|
+
- Edits made in expanded/fullscreen mode are persisted back into the node model context and replayed
|
|
821
|
+
when the app iframe remounts.
|
|
822
|
+
- Use this when the human needs a quick sketch, architecture diagram, or flowchart and a
|
|
823
|
+
geometric `graph` node would feel too rigid
|
|
824
|
+
- Prefer labeled shapes (`"label": { "text": "..." }` on rectangle/ellipse/diamond) over
|
|
825
|
+
separate text elements — fewer tokens and auto-centered
|
|
826
|
+
- Do not use separate `text` elements with `containerId`/`boundElements` to place centered text
|
|
827
|
+
inside shapes. The hosted SVG preview does not auto-position those; PMX normalizes imported
|
|
828
|
+
canonical bound text back into shape labels for hosted app calls.
|
|
829
|
+
- For detailed sizing, camera, and label-fit rules, read `excalidraw-diagram-authoring.md`
|
|
830
|
+
before creating dense diagrams.
|
|
831
|
+
- Prefer the pastel fill palette in the Excalidraw `read_me` (light blue/green/orange/...) for
|
|
832
|
+
a consistent look across diagrams
|
|
833
|
+
|
|
834
|
+
### External MCP apps (bring your own)
|
|
835
|
+
|
|
836
|
+
**`canvas_open_mcp_app`** (deprecated → `canvas_app { action: "open-mcp-app" }`; removed in v0.3) — Open any external [MCP Apps](https://modelcontextprotocol.io/docs/extensions/apps)
|
|
837
|
+
server's `ui://` resource as an iframe node on the canvas
|
|
838
|
+
- Required: `toolName`, `transport` (`http` URL or `stdio` command)
|
|
839
|
+
- Optional: `serverName`, `toolArguments`, `title`, `x`, `y`, `width`, `height`
|
|
840
|
+
- Use when no dedicated preset exists yet. The Excalidraw preset (`canvas_app { action: "diagram" }`) is the
|
|
841
|
+
only one today
|
|
842
|
+
|
|
843
|
+
### Web Artifacts
|
|
844
|
+
|
|
845
|
+
**`canvas_build_web_artifact`** (deprecated → `canvas_app { action: "build-artifact" }`; removed in v0.3) — Build a single-file HTML artifact from React/Tailwind source
|
|
846
|
+
- Required: `title`, `appTsx`
|
|
847
|
+
- Optional: `indexCss`, `mainTsx`, `indexHtml`, extra `files`, `projectPath`, `outputPath`, `deps`, `includeLogs`
|
|
848
|
+
- By default it opens the result on the canvas as an embedded app node
|
|
849
|
+
- By default it returns compact log summaries; set `includeLogs: true` when you need raw stdout/stderr
|
|
850
|
+
- `recharts` is available in the scaffold. For additional libraries, pass CLI `--deps name,name2`
|
|
851
|
+
or MCP/API `deps: ["name"]` before bundling.
|
|
852
|
+
- Failed or empty CLI bundles print `ok: false`, exit non-zero, and do not create a canvas node.
|
|
853
|
+
- Use this when the output should be a richer interactive UI than a simple markdown/file/image node
|
|
854
|
+
- Prefer the dedicated `web-artifacts-builder` skill when you need the full React + shadcn workflow
|
|
855
|
+
- Use the `playwright-cli` skill when you need to validate the built artifact in a live browser
|
|
856
|
+
|
|
857
|
+
### HTML Nodes (Sandboxed iframe)
|
|
858
|
+
|
|
859
|
+
**`canvas_add_html_node`** (deprecated → `canvas_node { action: "add", type: "html", html }`; removed in v0.3) — Add a normal self-contained HTML document rendered in a sandboxed iframe
|
|
860
|
+
- Required: `html` (full document or fragment; inline `<script>` and CDN `<script src="...">` are allowed). If `html` is a bare path to an existing local `.html`/`.htm` file, the server reads that file's contents; otherwise it is treated as raw HTML.
|
|
861
|
+
- Optional: `title`, `summary`, `agentSummary`, `presentation`, `slideTitles`, `embeddedNodeIds`, `embeddedUrls`, `x`, `y`, `width` (default 720), `height` (default 640), `strictSize`
|
|
862
|
+
- Iframe sandbox is `allow-scripts` only — no same-origin access, no top-navigation, no forms
|
|
863
|
+
- Canvas theme tokens are auto-injected as CSS custom properties (both `--c-*` and common `--color-*` aliases such as `--color-text-primary`, `--color-bg`, `--color-accent`) and updated live when the canvas theme changes
|
|
864
|
+
- Use for moderate-complexity visualizations and interactive widgets that need real JS but do not warrant a full React build (Chart.js demos, D3 sketches, custom HTML report views)
|
|
865
|
+
- Normal HTML is the default. Only pass `presentation: true` when the user explicitly asks for a deck/fullscreen presentation; otherwise do not mark raw HTML as presentable.
|
|
866
|
+
- Only presentation-marked HTML nodes expose a browser `Present` button. Use it when the HTML is a deck, briefing, or fullscreen review surface; the PMX shell owns the fullscreen overlay and exits via `Esc` or `Exit presentation`.
|
|
867
|
+
- PMX stores a semantic sidecar (`agentSummary`, `contentSummary`, embedded references) so HTML nodes remain understandable in search, pinned context, and spatial context
|
|
868
|
+
|
|
869
|
+
**`canvas_add_html_primitive`** (deprecated → `canvas_node { action: "add", type: "html", primitive, data }`; removed in v0.3) — Generate a reusable HTML communication primitive as a sandboxed `html` node
|
|
870
|
+
- Required: `kind`; run `canvas_render { action: "describe-schema" }` and read `htmlPrimitives` for the current catalog
|
|
871
|
+
- Optional: `title`, `data`, `x`, `y`, `width`, `height`, `strictSize`
|
|
872
|
+
- Use when markdown would be too dense and a structured visual artifact is clearer: tradeoff grids, implementation plans, PR reviews, module maps, design sheets, explainers, reports, and lightweight human-editable boards/editors
|
|
873
|
+
- When the human asks for a PowerPoint-like output, pitch deck, briefing, or presentation, use `kind: "presentation"` unless a bespoke raw HTML deck is required. Include `slides` with short titles, one idea per slide, optional `metrics`, `note` fields for speaker notes, and optional `theme: "canvas" | "midnight" | "paper" | "aurora"` or a custom theme object.
|
|
874
|
+
- For payload patterns, export loops, and the primitive catalog, read `html-primitives.md` before creating dense or editable artifacts
|
|
875
|
+
|
|
876
|
+
### Open as Site (standalone surfaces)
|
|
877
|
+
|
|
878
|
+
Any renderable surface node can be opened full-page in its own browser tab — the same
|
|
879
|
+
document it shows in the canvas, just without the node chrome. In the workbench, use the
|
|
880
|
+
↗ **Open as site** button (new tab) or the ⤤ **Open in system browser** button in the
|
|
881
|
+
node title bar (or the expanded overlay). "Open in system browser" launches the real OS
|
|
882
|
+
browser via `POST /api/canvas/open-external` `{ nodeId }` (it opens only this server's own
|
|
883
|
+
surface URL; falls back to a normal new tab when the server can't launch) — use it when
|
|
884
|
+
the host's embedded browser (e.g. Codex) opens `_blank` tabs in-place.
|
|
885
|
+
|
|
886
|
+
- Works for `html` / `html-primitive`, bundled `web-artifact`, `json-render` / `graph`,
|
|
887
|
+
and `webpage` nodes. **Hosted ext-app `mcp-app` nodes (e.g. Excalidraw) are NOT
|
|
888
|
+
open-as-site targets** (the control is hidden; see the ext-app bullet below).
|
|
889
|
+
- The tab loads the node's stable surface URL, `/api/canvas/surface/<nodeId>`. The
|
|
890
|
+
in-canvas iframe loads the **exact same URL**, so there is one render path and no
|
|
891
|
+
separate "preview" version — what you see in the canvas is what opens. The URL reflects
|
|
892
|
+
current node state and survives a refresh.
|
|
893
|
+
- Agents can read this URL from any node payload (`canvas_node { action: "get" }` /
|
|
894
|
+
`canvas_query { action: "layout" }`) as `surfaceUrl` — a reliable way to tell a human
|
|
895
|
+
"open the artifact" without disturbing the canvas.
|
|
896
|
+
- Served HTML stays sandboxed (opaque origin via a `Content-Security-Policy: sandbox`
|
|
897
|
+
response header), so opening author code top-level cannot reach the canvas origin.
|
|
898
|
+
- Hosted ext-app `mcp-app` nodes (e.g. Excalidraw) are a live MCP-app shell that only
|
|
899
|
+
renders with the in-canvas host bridge — a bare tab has no peer, so the surface route
|
|
900
|
+
returns `404` ("This MCP app renders in the canvas and cannot be opened as a standalone
|
|
901
|
+
site"); view/edit them in the canvas, or open them externally through their own app
|
|
902
|
+
(report #61). Only bundled `web-artifact` apps (redirect to `/artifact`) and URL-backed
|
|
903
|
+
`mcp-app` / `webpage` viewers redirect to their external site.
|
|
904
|
+
- This is additive — opening a site never evicts or replaces canvas nodes.
|
|
905
|
+
|
|
906
|
+
### Choosing the Right Visual Tier
|
|
907
|
+
|
|
908
|
+
When the output is more than markdown, pick the lightest tier that fits:
|
|
909
|
+
|
|
910
|
+
| Tier | Tool | Build cost | When to pick it |
|
|
911
|
+
|------|------|------------|-----------------|
|
|
912
|
+
| Declarative UI | `canvas_render` (`add-json-render` / `add-graph`) | None | Schema-driven dashboards, forms, charts; agent-friendly to read back via `canvas_node { action: "get" }` |
|
|
913
|
+
| Generated HTML primitive | `canvas_node { action:"add", type:"html", primitive }` | None | Reusable communication artifacts such as choices, plans, reviews, maps, reports, presentations/decks, and lightweight editors |
|
|
914
|
+
| Sandboxed HTML+JS | `canvas_node { action:"add", type:"html", html }` | None | Self-contained HTML with inline JS or CDN scripts; one-off visualizations or report views |
|
|
915
|
+
| Hosted MCP app | `canvas_app { action:"open-mcp-app" }` / `canvas_app { action:"diagram" }` | None | Interactive editors backed by an external MCP server (e.g. Excalidraw) |
|
|
916
|
+
| Bundled React app | `canvas_app { action:"build-artifact" }` | Heavy (npm install + bundle) | Multi-component UIs needing React state, routing, shadcn/ui, or Tailwind class composition |
|
|
917
|
+
|
|
918
|
+
### Native Structured UI
|
|
919
|
+
|
|
920
|
+
Use native `json-render` and `graph` nodes when the output should stay fully inside PMX Canvas:
|
|
921
|
+
|
|
922
|
+
1. Use `canvas_render { action: "add-json-render" }` for dashboards, forms, summaries, and interactive UI panels
|
|
923
|
+
2. Use `canvas_render { action: "add-graph" }` for charts and trend visualizations
|
|
924
|
+
3. Use the repo-local `json-render-*` skills when you need help authoring or refining the spec itself
|
|
925
|
+
4. Use `canvas_build_web_artifact` instead when the result needs a full custom React app rather than a schema-driven UI
|
|
926
|
+
|
|
927
|
+
Spec elements support an `on` map (`on.press`, `on.change`, …) binding events to actions (`{ action, params }`) — built-in actions (`setState`, `pushState`, …) or, when named after an AX interaction type, a capability-gated AX emit. e.g. a Button with `on: { press: { action: 'ax.work.create', params: { title: '…' } } }` lets a human turn a panel control into a tracked work item; the viewer forwards it to the canvas, which validates and submits it server-side (clamped to the node's own id). See **Node AX Interactions** above.
|
|
928
|
+
|
|
929
|
+
## MCP Resources
|
|
930
|
+
|
|
931
|
+
These resources give you read access to canvas intelligence. Read them to understand
|
|
932
|
+
what the human has set up and what they're focusing on.
|
|
933
|
+
|
|
934
|
+
| Resource | What it provides |
|
|
935
|
+
|----------|-----------------|
|
|
936
|
+
| `canvas://pinned-context` | Content of pinned nodes + nearby unpinned neighbors |
|
|
937
|
+
| `canvas://schema` | Running-server create schemas and json-render catalog metadata |
|
|
938
|
+
| `canvas://layout` | Full canvas state (viewport, nodes, edges) |
|
|
939
|
+
| `canvas://summary` | Compact overview: node counts by type, pinned titles |
|
|
940
|
+
| `canvas://spatial-context` | Proximity clusters, reading order, pinned neighborhoods |
|
|
941
|
+
| `canvas://history` | Human-readable mutation timeline |
|
|
942
|
+
| `canvas://code-graph` | Auto-detected file import dependencies (JS/TS, Python, Go, Rust) |
|
|
943
|
+
| `canvas://ax` | Host-agnostic AX state: focus, work items, approval gates, review annotations, host capability |
|
|
944
|
+
| `canvas://ax-context` | Agent-ready AX context: pinned context + current focus |
|
|
945
|
+
| `canvas://ax-work` | Canvas-bound AX work: work items, approval gates, review annotations, elicitations, mode requests, and tool/prompt policy |
|
|
946
|
+
| `canvas://ax-timeline` | Bounded AX timeline: recent agent events, evidence, and steering messages |
|
|
947
|
+
| `canvas://ax-pending-steering` | Adapterless delivery: `pending` steering to claim + mark delivered, and `pendingActivity` (open work items / pending approvals / elicitations / mode requests awaiting the agent) |
|
|
948
|
+
| `canvas://ax-delivery` | Steering delivery state (delivered flag) for diagnostics |
|
|
949
|
+
| `canvas://skills` | Index of bundled agent skills shipped with the install. Each skill is also addressable as `canvas://skills/<name>` (e.g. `canvas://skills/web-artifacts-builder`) and returns the full SKILL.md. Read this resource first to discover companion workflows the canvas is built to support. |
|
|
950
|
+
|
|
951
|
+
### Node AX Interactions (capability-gated)
|
|
952
|
+
|
|
953
|
+
Eligible nodes can emit one normalized, validated AX interaction that maps onto an
|
|
954
|
+
AX operation — work item, evidence, approval, review, focus, steering, event,
|
|
955
|
+
elicitation, or mode request. One envelope, many transports:
|
|
956
|
+
|
|
957
|
+
This is the **agent-native nodes** model: existing canvas node types become
|
|
958
|
+
interactive agent controls when their AX capabilities allow it. Do not describe
|
|
959
|
+
this as a separate node type; it is a capability layer on top of markdown,
|
|
960
|
+
status, HTML, json-render, graph, web-artifact, MCP app, and other supported
|
|
961
|
+
nodes.
|
|
962
|
+
|
|
963
|
+
- **Endpoint:** `POST /api/canvas/ax/interaction` with
|
|
964
|
+
`{ type, sourceNodeId, payload }` (MCP: `canvas_ax_interaction`; CLI:
|
|
965
|
+
`pmx-canvas ax interaction`). Returns `{ ok, primitive }` or
|
|
966
|
+
`{ ok: false, code }` if the node type/metadata disallows the type.
|
|
967
|
+
- **Capabilities:** each node type has a default capability set (a ceiling). A
|
|
968
|
+
node may opt in or narrow via `data.axCapabilities` (`{ enabled, allowed }`),
|
|
969
|
+
clamped to the ceiling — a node can never escalate beyond its type's ceiling.
|
|
970
|
+
`html` / `html-primitive`, `mcp-app`, and internal `prompt` / `response` nodes
|
|
971
|
+
are **disabled by default** (opt-in).
|
|
972
|
+
- **Transports:** native node controls call the endpoint directly. Sandboxed
|
|
973
|
+
surfaces emit via a nonce-tagged `postMessage` the parent canvas validates
|
|
974
|
+
before submitting: `html` / `html-primitive` nodes (when opted in) call
|
|
975
|
+
`window.PMX_AX.emit(type, payload)`; **json-render / graph** viewers forward a
|
|
976
|
+
spec action named after an AX type (e.g. `on.press → { action:
|
|
977
|
+
"ax.work.create", params }`, `sourceSurface: 'json-render'`); web-artifact
|
|
978
|
+
**`mcp-app`** nodes use the same parent bridge; external MCP app frames
|
|
979
|
+
(`mode: "ext-app"`) can emit through an injected `window.PMX_AX.emit` with
|
|
980
|
+
Promise acknowledgements, but do not get the read-state bridge. The server
|
|
981
|
+
re-validates capabilities regardless of transport — bridges are convenience,
|
|
982
|
+
not a trust boundary.
|
|
983
|
+
- **Delivery (adapterless):** `canvas://ax-pending-steering` /
|
|
984
|
+
`canvas_ax_delivery { action: "claim" }` return two things, both loop-safe (a consumer never
|
|
985
|
+
receives items it originated):
|
|
986
|
+
- `pending` — undelivered **steering** (directives). Act, then acknowledge with
|
|
987
|
+
`canvas_ax_delivery { action: "mark" }`.
|
|
988
|
+
- `pendingActivity` — open canvas-bound items **awaiting the agent** (open work
|
|
989
|
+
items, pending approval gates / elicitations / mode requests), usually created
|
|
990
|
+
by the human in the browser. These are **state, not steering**: don't
|
|
991
|
+
`canvas_ax_delivery { action: "mark" }` them — resolve each via its gate/work call
|
|
992
|
+
(`canvas_ax_gate { kind: "approval", action: "resolve" }` /
|
|
993
|
+
`canvas_ax_gate { kind: "elicitation", action: "resolve" }` /
|
|
994
|
+
`canvas_ax_gate { kind: "mode", action: "resolve" }` /
|
|
995
|
+
`canvas_ax_work { action: "update" }`).
|
|
996
|
+
- **Contract:** every AX mutation fires `ax-state-changed`, so MCP clients that
|
|
997
|
+
**subscribe** to resources are pushed `canvas://ax-work` / `canvas://ax-context`
|
|
998
|
+
live. Clients that **poll** instead should poll `canvas_ax_delivery { action: "claim" }` —
|
|
999
|
+
`pendingActivity` is how non-steering browser changes reach them. Only steering
|
|
1000
|
+
flows through the claim/ack queue.
|
|
1001
|
+
- **Steering is gated, not pushed (and does NOT wake the agent).** A surface button
|
|
1002
|
+
that emits `ax.steer` *records/queues* a steer (the `ok:true` emit ack means
|
|
1003
|
+
"recorded", not "the agent woke") — it does NOT interrupt or notify the active
|
|
1004
|
+
session. With a prompt-injecting host adapter (e.g. Copilot), it reaches the next
|
|
1005
|
+
turn only when (1) the **pin/focus gate is open** (something pinned or focused — so
|
|
1006
|
+
keep a steering board pinned, or have its button also emit `ax.focus.set` on
|
|
1007
|
+
itself), (2) a **human message** fires the turn, and (3) the agent **acts then acks**
|
|
1008
|
+
(`canvas_ax_delivery { action: "mark" }`), or the steer re-injects every gated turn.
|
|
1009
|
+
Immediate wake (turning a queued steer into a visible turn) is **host-adapter-owned**
|
|
1010
|
+
— the adapter must drain `canvas_ax_delivery { action: "claim" }` and call its native
|
|
1011
|
+
send. So a steering button should label itself honestly ("queued for the agent's next
|
|
1012
|
+
turn"), never imply it steers the agent *now*. `GET /api/canvas/ax/context?consumer=<id>`
|
|
1013
|
+
adds a compact, loop-safe `delivery: { pendingSteering, totalPending, omittedPending,
|
|
1014
|
+
pendingActivity }` lead block an adapter injects un-truncated; `pendingSteering` is
|
|
1015
|
+
**newest-first** (most recent first), capped at 10, so a fresh steer is visible even
|
|
1016
|
+
behind a backlog, and the counts say how many more to drain from the FIFO
|
|
1017
|
+
`canvas_ax_delivery { action: "claim" }` queue (which stays oldest-first).
|
|
1018
|
+
- **Activity ingestion (bidirectional board):** a host adapter forwards the agent's
|
|
1019
|
+
tool/session events with `canvas_ingest_activity` (standalone; HTTP `POST /api/canvas/ax/activity`)
|
|
1020
|
+
and the board auto-reacts — `failure`/`error` (or `outcome:"failure"`) → a blocked
|
|
1021
|
+
work item + a review finding + `logs` evidence; `tool-result` + `outcome:"success"` →
|
|
1022
|
+
`tool-result` evidence; everything else records a timeline event only. Override or
|
|
1023
|
+
suppress per call via `reactions` (`{ workItem: false }`, `{ review: { severity } }`, …).
|
|
1024
|
+
- **Blocking gates (gates that actually gate):** `canvas_ax_gate` is the request →
|
|
1025
|
+
await → resolve machine. After `{ action: "request" }`, call
|
|
1026
|
+
`canvas_ax_gate { kind, action: "await", id, timeoutMs }` (HTTP
|
|
1027
|
+
`GET /api/canvas/ax/<kind>/<id>?waitMs=`) to BLOCK until the human resolves it in the
|
|
1028
|
+
browser or the timeout elapses (`timeoutMs` 0 = immediate read; ≤120000). Use this to
|
|
1029
|
+
pause real work on a human decision instead of polling.
|
|
1030
|
+
- **Elicitation / mode:** request structured human input
|
|
1031
|
+
(`canvas_ax_gate { kind: "elicitation", action: "request" }` →
|
|
1032
|
+
`canvas_ax_gate { kind: "elicitation", action: "resolve" }`) or a workflow
|
|
1033
|
+
mode transition (`canvas_ax_gate { kind: "mode", action: "request" }` →
|
|
1034
|
+
`canvas_ax_gate { kind: "mode", action: "resolve" }`); both are canvas-bound and snapshotted.
|
|
1035
|
+
- **Commands:** invoke a registry command — `pmx.plan`, `pmx.execute`,
|
|
1036
|
+
`pmx.promote-context`, `pmx.summarize`, `pmx.review` — via
|
|
1037
|
+
`canvas_invoke_command` (standalone; HTTP `POST /api/canvas/ax/command`; CLI
|
|
1038
|
+
`pmx-canvas ax command invoke`; envelope `ax.command.invoke`). Unknown names
|
|
1039
|
+
are rejected; an invocation records an `agent-event` of kind `command`.
|
|
1040
|
+
- **Policy:** a canvas-bound, snapshotted tool/prompt policy
|
|
1041
|
+
(`tools.allowed|excluded|approvalRequired`, `prompt.systemAppend|mode`) read
|
|
1042
|
+
into `canvas://ax-context`. Patch it with `canvas_ax_state { action: "set-policy" }`
|
|
1043
|
+
(HTTP `GET|POST /api/canvas/ax/policy`; CLI `pmx-canvas ax policy get|set`); patches
|
|
1044
|
+
merge and are normalized server-side.
|
|
1045
|
+
|
|
1046
|
+
Interactions request PMX-AX primitives only — never arbitrary shell, tool, MCP,
|
|
1047
|
+
or host execution.
|
|
1048
|
+
|
|
1049
|
+
#### Where AX can be used — node capability matrix
|
|
1050
|
+
|
|
1051
|
+
AX interactions are gated per node type. The lists below are each type's **ceiling**
|
|
1052
|
+
— `data.axCapabilities.allowed` can NARROW it, never escalate beyond it.
|
|
1053
|
+
|
|
1054
|
+
**Enabled by default** (no opt-in needed — an agent/native control can emit straight away):
|
|
1055
|
+
|
|
1056
|
+
| Node type | Allowed AX interaction types |
|
|
1057
|
+
|-----------|------------------------------|
|
|
1058
|
+
| `markdown` | `ax.steer`, `ax.work.create`, `ax.evidence.add`, `ax.command.invoke`, `ax.event.record` |
|
|
1059
|
+
| `context` | `ax.focus.set`, `ax.steer`, `ax.evidence.add`, `ax.command.invoke`, `ax.event.record` |
|
|
1060
|
+
| `status` | `ax.work.create`, `ax.work.update`, `ax.approval.request`, `ax.mode.request`, `ax.event.record` |
|
|
1061
|
+
| `file` | `ax.evidence.add`, `ax.review.add`, `ax.focus.set`, `ax.event.record` |
|
|
1062
|
+
| `json-render` | `ax.work.create`, `ax.work.update`, `ax.evidence.add`, `ax.elicitation.request`, `ax.event.record` |
|
|
1063
|
+
| `graph` | `ax.evidence.add`, `ax.focus.set`, `ax.event.record` |
|
|
1064
|
+
| `ledger` | `ax.evidence.add`, `ax.event.record` |
|
|
1065
|
+
| `trace` | `ax.evidence.add`, `ax.event.record` |
|
|
1066
|
+
| `image` | `ax.evidence.add`, `ax.review.add` |
|
|
1067
|
+
| `webpage` | `ax.evidence.add`, `ax.review.add`, `ax.focus.set`, `ax.event.record` |
|
|
1068
|
+
| `group` | `ax.focus.set`, `ax.work.create`, `ax.command.invoke`, `ax.event.record` |
|
|
1069
|
+
|
|
1070
|
+
**Opt-in** — set `axCapabilities.enabled = true` (MCP: pass `axCapabilities` to
|
|
1071
|
+
`canvas_add_html_node` / `canvas_node { action: "update" }`. HTTP: `axCapabilities` **and** the
|
|
1072
|
+
`html` body are accepted **top-level on both `POST /api/canvas/node` and
|
|
1073
|
+
`PATCH /api/canvas/node/<id>`**, or nested under `data` — both work, top-level wins):
|
|
1074
|
+
|
|
1075
|
+
| Node type | Allowed AX interaction types |
|
|
1076
|
+
|-----------|------------------------------|
|
|
1077
|
+
| `html` / `html-primitive` | the full set: `ax.work.create`, `ax.work.update`, `ax.steer`, `ax.approval.request`, `ax.review.add`, `ax.evidence.add`, `ax.focus.set`, `ax.elicitation.request`, `ax.mode.request`, `ax.command.invoke`, `ax.event.record` |
|
|
1078
|
+
| `mcp-app` (incl. **web-artifact**) | `ax.event.record`, `ax.evidence.add`, `ax.work.create`, `ax.work.update`, `ax.focus.set`, `ax.elicitation.request` |
|
|
1079
|
+
|
|
1080
|
+
**Never (anchor-only):** internal `prompt` / `response` thread nodes — `ax.event.record`
|
|
1081
|
+
only, no human-facing emit.
|
|
1082
|
+
|
|
1083
|
+
The 11 interaction types and what they create: `ax.work.create` / `ax.work.update`
|
|
1084
|
+
(work-queue items; status is exactly one of `todo`, `in-progress`, `blocked`, `done`,
|
|
1085
|
+
`cancelled` — **hyphens, not underscores**; `POST`/`PATCH /api/canvas/ax/work` reject an
|
|
1086
|
+
unknown token like `in_progress` with `400`), `ax.evidence.add`
|
|
1087
|
+
(timeline evidence), `ax.review.add` (review annotation), `ax.focus.set` (agent focus
|
|
1088
|
+
pointer), `ax.steer` (a steering message delivered to the agent), `ax.approval.request`
|
|
1089
|
+
(approval gate), `ax.elicitation.request` (structured human input), `ax.mode.request`
|
|
1090
|
+
(plan/execute/autonomous transition), `ax.command.invoke` (registry command), and
|
|
1091
|
+
`ax.event.record` (diagnostic agent-event).
|
|
1092
|
+
|
|
1093
|
+
#### Building an AX surface in the canvas (emit + reflect)
|
|
1094
|
+
|
|
1095
|
+
AX surfaces are **composable** — you can build a live work board, review board, or
|
|
1096
|
+
inbox as a canvas node that BOTH emits AX interactions AND renders the current AX
|
|
1097
|
+
state. The read side mirrors the write side:
|
|
1098
|
+
|
|
1099
|
+
- **Opt in** (html/mcp-app are off by default): create with
|
|
1100
|
+
`canvas_add_html_node({ html, axCapabilities: { enabled: true, allowed: ["ax.work.create","ax.work.update"] } })`,
|
|
1101
|
+
or flip an existing node on with
|
|
1102
|
+
`canvas_node({ action: "update", id, axCapabilities: { enabled: true, allowed: [...] } })`.
|
|
1103
|
+
json-render / graph nodes are enabled by default.
|
|
1104
|
+
- **Emit (write):** in `html`, call `window.PMX_AX.emit("ax.work.create", { title })`;
|
|
1105
|
+
in `json-render`, bind a control action named after the AX type
|
|
1106
|
+
(`on: { press: { action: "ax.work.create", params: { title } } }`).
|
|
1107
|
+
- **Confirm (#55):** for `html` / `html-primitive` and PMX_AX-enabled `mcp-app`
|
|
1108
|
+
surfaces, `emit` returns a Promise that resolves with the result once the
|
|
1109
|
+
canvas acks it, so a button can self-confirm: `const r = await
|
|
1110
|
+
window.PMX_AX.emit(...); if (r.ok) showQueued();`. You can also
|
|
1111
|
+
`window.PMX_AX.on('ack', cb)` or listen for the `pmx-ax-ack` event. (Falls back
|
|
1112
|
+
to an `ax-ack-timeout` result after 10s, so `await` never hangs.)
|
|
1113
|
+
- **Reflect (read):** the canvas seeds the surface with a compact AX snapshot at
|
|
1114
|
+
load (the same shape as `GET /api/canvas/ax/surface-snapshot`) and live-updates it
|
|
1115
|
+
as AX state changes. Works on all three authored surface types:
|
|
1116
|
+
- `html` / `html-primitive`: read `window.PMX_AX.state` (`{ focus, workItems,
|
|
1117
|
+
approvalGates, reviewAnnotations, elicitations, modeRequests, policy }`) and
|
|
1118
|
+
subscribe to the `pmx-ax-update` event:
|
|
1119
|
+
`window.addEventListener("pmx-ax-update", e => render(e.detail))`.
|
|
1120
|
+
- `json-render` / `graph`: the snapshot is bound under `/ax`, so a spec reads
|
|
1121
|
+
`{ "$state": "/ax/workItems" }` and it stays live as work items change.
|
|
1122
|
+
- `web-artifact` (mcp-app): the same `window.PMX_AX.state` + `pmx-ax-update` bridge
|
|
1123
|
+
is injected at the `/artifact` route once the node opts in — author the React app
|
|
1124
|
+
against `window.PMX_AX`, not direct `fetch()` (the artifact iframe is sandboxed
|
|
1125
|
+
opaque-origin, so it can't call the API directly).
|
|
1126
|
+
|
|
1127
|
+
Minimal html work board (drop-in via `canvas_add_html_node`, `axCapabilities.enabled: true`):
|
|
1128
|
+
|
|
1129
|
+
```html
|
|
1130
|
+
<button id="add">+ Task</button> <span id="ok"></span>
|
|
1131
|
+
<ul id="q"></ul>
|
|
1132
|
+
<script>
|
|
1133
|
+
function render(s){ document.getElementById('q').innerHTML =
|
|
1134
|
+
((s&&s.workItems)||[]).map(w => '<li>['+w.status+'] '+w.title+'</li>').join(''); }
|
|
1135
|
+
document.getElementById('add').onclick = async () => {
|
|
1136
|
+
const r = await window.PMX_AX.emit('ax.work.create',{title:'New task'});
|
|
1137
|
+
document.getElementById('ok').textContent = r && r.ok ? 'queued ✓' : 'failed'; // #55 self-confirm
|
|
1138
|
+
};
|
|
1139
|
+
render(window.PMX_AX && window.PMX_AX.state);
|
|
1140
|
+
window.addEventListener('pmx-ax-update', e => render(e.detail));
|
|
1141
|
+
</script>
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
This is the right home for a deliberate, interactive AX experience — not the
|
|
1145
|
+
native node buttons. Any agent (via MCP/SDK) can also create/update the same work
|
|
1146
|
+
items, and the board reflects them live.
|
|
1147
|
+
|
|
1148
|
+
> **Authoring an AX HTML node? Use the blessed, copy-paste-safe recipe in
|
|
1149
|
+
> [`ax-html-control-surface.md`](ax-html-control-surface.md)**
|
|
1150
|
+
> and avoid the common footguns:
|
|
1151
|
+
> - **The iframe is sandboxed opaque-origin** (no `allow-same-origin`): `localStorage`,
|
|
1152
|
+
> `sessionStorage`, and cookies **throw** and will halt your startup script, making the
|
|
1153
|
+
> node look inert. Keep state in plain JS variables / `window.PMX_AX.state`, or wrap any
|
|
1154
|
+
> storage access in `try/catch`.
|
|
1155
|
+
> - **`window.PMX_AX.emit` is async — `await` it** (or use `.then`/`window.PMX_AX.on('ack')`);
|
|
1156
|
+
> don't read a result synchronously. It's injected only when the node is opted in
|
|
1157
|
+
> (`axCapabilities.enabled = true`).
|
|
1158
|
+
> - **`ax.steer` is recorded, not delivered** — a successful emit means the steer is
|
|
1159
|
+
> *queued for the agent's next turn*, not that the agent woke (see "Steering is gated").
|
|
1160
|
+
> Label steering buttons accordingly.
|
|
1161
|
+
|
|
1162
|
+
> Security note: an AX-enabled surface can READ the whole canvas AX board (all
|
|
1163
|
+
> work items, focus, approval gates, etc. — human review comment text is redacted),
|
|
1164
|
+
> while its EMITS are clamped to its own node. Under the single-workspace
|
|
1165
|
+
> local-trust model this is fine, but don't embed untrusted third-party scripts in
|
|
1166
|
+
> an AX-enabled surface.
|
|
1167
|
+
|
|
1168
|
+
### Reading Spatial Intent
|
|
1169
|
+
|
|
1170
|
+
The `canvas://spatial-context` resource reveals how the human has organized information:
|
|
1171
|
+
|
|
1172
|
+
- **Proximity clusters** — Nodes placed near each other form implicit groups. If the human
|
|
1173
|
+
placed three files next to each other, those files are related in their mental model.
|
|
1174
|
+
- **Reading order** — Nodes sorted top-left to bottom-right, following natural reading flow.
|
|
1175
|
+
This implies sequence or priority.
|
|
1176
|
+
- **Pinned neighborhoods** — For each pinned node, nearby unpinned nodes are listed. These
|
|
1177
|
+
are the human's implicit context — things they consider related to what they pinned.
|
|
1178
|
+
- **Annotations** — Human-drawn markup is summarized by target/bounds only, e.g. an
|
|
1179
|
+
annotation over a node or empty canvas region. Use WebView (`canvas_webview_start` +
|
|
1180
|
+
`canvas_evaluate`/`canvas_screenshot`) when you need to see whether the mark is an
|
|
1181
|
+
arrow, line, circle, or other drawn shape. Remove known annotations with
|
|
1182
|
+
`canvas_remove_annotation`; otherwise use WebView to identify the mark first.
|
|
1183
|
+
- **Board density matters** — On a dense board, spatial context can still read like one large
|
|
1184
|
+
gallery unless groups and spacing separate the major regions clearly.
|
|
1185
|
+
|
|
1186
|
+
Use this spatial intelligence to understand what the human is thinking without them having to
|
|
1187
|
+
explain it explicitly.
|
|
1188
|
+
|
|
1189
|
+
## HTTP API Reference
|
|
1190
|
+
|
|
1191
|
+
All POST/PATCH endpoints accept `Content-Type: application/json`. Default base URL: `http://localhost:4313`
|
|
1192
|
+
|
|
1193
|
+
| Method | Endpoint | Purpose |
|
|
1194
|
+
|--------|----------|---------|
|
|
1195
|
+
| GET | `/api/canvas/state` | Full canvas state |
|
|
1196
|
+
| POST | `/api/canvas/node` | Add node |
|
|
1197
|
+
| PATCH | `/api/canvas/node/<id>` | Update node |
|
|
1198
|
+
| DELETE | `/api/canvas/node/<id>` | Remove node |
|
|
1199
|
+
| POST | `/api/canvas/edge` | Add edge |
|
|
1200
|
+
| DELETE | `/api/canvas/edge` | Remove edge (`{ "edge_id": "..." }`) |
|
|
1201
|
+
| GET | `/api/canvas/snapshots` | List snapshots |
|
|
1202
|
+
| POST | `/api/canvas/snapshots` | Save snapshot |
|
|
1203
|
+
| POST | `/api/canvas/snapshots/<id>` | Restore snapshot |
|
|
1204
|
+
| DELETE | `/api/canvas/snapshots/<id>` | Delete snapshot |
|
|
1205
|
+
| POST | `/api/canvas/context-pins` | Replace pinned nodes |
|
|
1206
|
+
| GET | `/api/canvas/pinned-context` | Get current pins with neighborhood context |
|
|
1207
|
+
| GET | `/api/canvas/search?q=...` | Search nodes |
|
|
1208
|
+
| POST | `/api/canvas/json-render` | Create a native json-render node |
|
|
1209
|
+
| POST | `/api/canvas/json-render/stream` | Create/append a streaming json-render node (SpecStream patches) |
|
|
1210
|
+
| POST | `/api/canvas/graph` | Create a native graph node |
|
|
1211
|
+
| GET | `/api/canvas/schema` | Get running-server create schemas, examples, and json-render catalog metadata |
|
|
1212
|
+
| POST | `/api/canvas/schema/validate` | Validate a json-render spec or graph payload without creating a node |
|
|
1213
|
+
| GET | `/api/canvas/json-render/view?nodeId=...` | View a native json-render or graph node |
|
|
1214
|
+
| POST | `/api/canvas/diagram` | Create an Excalidraw external app node |
|
|
1215
|
+
| POST | `/api/canvas/mcp-app/open` | Open a tool-backed MCP app node |
|
|
1216
|
+
| POST | `/api/canvas/web-artifact` | Build a bundled web artifact and optionally open it on canvas |
|
|
1217
|
+
| POST | `/api/canvas/group` | Create group |
|
|
1218
|
+
| POST | `/api/canvas/group/add` | Add nodes to group |
|
|
1219
|
+
| POST | `/api/canvas/group/ungroup` | Ungroup |
|
|
1220
|
+
| POST | `/api/canvas/arrange` | Auto-arrange |
|
|
1221
|
+
| POST | `/api/canvas/focus` | Center viewport on node |
|
|
1222
|
+
| POST | `/api/canvas/fit` | Fit viewport to canvas bounds or selected nodes |
|
|
1223
|
+
| POST | `/api/canvas/clear` | Clear canvas |
|
|
1224
|
+
| POST | `/api/canvas/update` | Batch update positions |
|
|
1225
|
+
| GET | `/api/canvas/spatial-context` | Spatial clusters and reading order |
|
|
1226
|
+
| POST | `/api/canvas/undo` | Undo |
|
|
1227
|
+
| POST | `/api/canvas/redo` | Redo |
|
|
1228
|
+
| GET | `/api/canvas/history` | Mutation history |
|
|
1229
|
+
| GET | `/api/canvas/code-graph` | File dependency graph |
|
|
1230
|
+
| GET | `/api/workbench/events` | SSE event stream |
|
|
1231
|
+
|
|
1232
|
+
## Workflow Patterns
|
|
1233
|
+
|
|
1234
|
+
These are **operational recipes** — how to sequence canvas calls for a few
|
|
1235
|
+
recurring shapes of work. They are not the project's use cases (those live
|
|
1236
|
+
in the README and are intentionally non-exhaustive). The patterns here exist
|
|
1237
|
+
to make the agent's tool-call sequencing concrete: which MCP tool fires
|
|
1238
|
+
when, what to pin, when to read `canvas://pinned-context`, when to snapshot.
|
|
1239
|
+
|
|
1240
|
+
### Responding to Pinned Context
|
|
1241
|
+
|
|
1242
|
+
When the human pins nodes, they're telling you what matters. This is the most important
|
|
1243
|
+
collaboration pattern:
|
|
1244
|
+
|
|
1245
|
+
1. Read `canvas://pinned-context` — get the content of pinned nodes and their neighborhoods
|
|
1246
|
+
2. Read `canvas://spatial-context` — understand how the whole canvas is organized
|
|
1247
|
+
3. Optionally read `canvas://summary` — see pinned nodes in the context of the full canvas
|
|
1248
|
+
4. Interpret what you find:
|
|
1249
|
+
- What types are the pinned nodes? (files = code focus, status = progress, markdown = concepts)
|
|
1250
|
+
- Are they clustered together (single focus) or spread across the canvas (multi-topic)?
|
|
1251
|
+
- What unpinned nodes are nearby? These are the human's implicit context
|
|
1252
|
+
- What's the reading order? Top-left to bottom-right suggests sequence or priority
|
|
1253
|
+
- If an `mcp-app` node is pinned, treat it as “important but partially opaque” and use nearby
|
|
1254
|
+
graph/file/markdown nodes to recover the missing semantic detail
|
|
1255
|
+
5. Respond by summarizing what you see, what you think the human is focusing on, and ask
|
|
1256
|
+
if they'd like you to act on it (add related nodes, investigate further, etc.)
|
|
1257
|
+
|
|
1258
|
+
**When to use `pinned-context` vs `spatial-context`:**
|
|
1259
|
+
- `canvas://pinned-context` — "what did the human explicitly pin, and what's near those pins?"
|
|
1260
|
+
- `canvas://spatial-context` — "how is the entire canvas organized spatially?"
|
|
1261
|
+
- Read both when you need the full picture; read just `pinned-context` for quick pin checks.
|
|
1262
|
+
|
|
1263
|
+
### Investigation Board
|
|
1264
|
+
|
|
1265
|
+
When debugging, lay out evidence spatially to see connections:
|
|
1266
|
+
|
|
1267
|
+
1. Create a root node describing the bug/issue
|
|
1268
|
+
2. Add evidence nodes: logs, stack traces, relevant code files (use `file` nodes for source)
|
|
1269
|
+
3. Connect evidence to root with `references` edges
|
|
1270
|
+
4. Add a hypothesis node, connect with `flow` edge
|
|
1271
|
+
5. As you investigate, add findings and update connections
|
|
1272
|
+
6. Use `status` nodes to track what you've checked
|
|
1273
|
+
7. Group evidence nodes together, and investigation tasks together
|
|
1274
|
+
8. Arrange with `flow` layout, then fine-tune positions if needed
|
|
1275
|
+
|
|
1276
|
+
```
|
|
1277
|
+
Bug Report ──references──> Error Logs
|
|
1278
|
+
│ │
|
|
1279
|
+
│ references
|
|
1280
|
+
│ ▼
|
|
1281
|
+
└──flow──> Hypothesis ──flow──> Fix
|
|
1282
|
+
│
|
|
1283
|
+
flow
|
|
1284
|
+
▼
|
|
1285
|
+
Verification
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
### Architecture Diagram
|
|
1289
|
+
|
|
1290
|
+
Show system components and how they interact:
|
|
1291
|
+
|
|
1292
|
+
1. Create `markdown` nodes for each service/component (include port, tech stack in content)
|
|
1293
|
+
2. Use `flow` edges for data flow, `depends-on` for dependencies — always label edges
|
|
1294
|
+
3. Group related services with `canvas_group { action: "create" }` (e.g., "Application Services", "Data Layer")
|
|
1295
|
+
4. Use colors: green for healthy, yellow for degraded, red for down
|
|
1296
|
+
5. Arrange with `grid` layout initially
|
|
1297
|
+
6. For tiered architectures, fine-tune with explicit `x`/`y` via `canvas_node { action: "update" }` to show
|
|
1298
|
+
layers (e.g., gateway at top, services in middle, data stores at bottom)
|
|
1299
|
+
7. Connect pipeline stages with `flow` edges where applicable
|
|
1300
|
+
|
|
1301
|
+
### Task Plan with Dependencies
|
|
1302
|
+
|
|
1303
|
+
Track work items and their relationships:
|
|
1304
|
+
|
|
1305
|
+
1. Create `status` nodes for each task
|
|
1306
|
+
2. Color-code: green=done, yellow=in-progress, red=blocked, gray=queued, blue=ready/available
|
|
1307
|
+
3. Connect with `depends-on` edges — use `dashed` style for blocked dependencies, `solid` for
|
|
1308
|
+
satisfied ones
|
|
1309
|
+
4. Update status nodes as work progresses using `canvas_node { action: "update" }`
|
|
1310
|
+
5. Arrange with `flow` layout to show the dependency chain left-to-right
|
|
1311
|
+
6. Group related tasks if the plan has distinct phases
|
|
1312
|
+
|
|
1313
|
+
### Code Exploration
|
|
1314
|
+
|
|
1315
|
+
Understand a codebase by visualizing file relationships:
|
|
1316
|
+
|
|
1317
|
+
1. Add `file` nodes for key source files (content auto-loads and live-updates)
|
|
1318
|
+
2. The code graph auto-detects imports and creates `depends-on` edges automatically — you
|
|
1319
|
+
don't need to manually add import-based edges. You can still add manual edges for
|
|
1320
|
+
conceptual relationships beyond imports (e.g., "middleware validates using jwt")
|
|
1321
|
+
3. Read `canvas://code-graph` for dependency analysis: central files, isolated files
|
|
1322
|
+
4. Group related files with `canvas_group { action: "create" }` (e.g., "Auth Module", "API Routes")
|
|
1323
|
+
5. Pin important files so the human sees them highlighted
|
|
1324
|
+
6. Arrange with `grid` layout after adding files
|
|
1325
|
+
|
|
1326
|
+
### Interactive Artifact Builds
|
|
1327
|
+
|
|
1328
|
+
When the user wants a real browser app instead of static notes:
|
|
1329
|
+
|
|
1330
|
+
1. Use the `web-artifacts-builder` skill if the UI needs React state, routing, or shadcn-style components
|
|
1331
|
+
2. Build with `canvas_build_web_artifact`
|
|
1332
|
+
3. Keep `openInCanvas` enabled unless the user explicitly wants only the output file
|
|
1333
|
+
4. Use the returned `projectPath` as the reusable source workspace for iterations
|
|
1334
|
+
5. Use the returned `path` for sharing or for opening the generated artifact outside the canvas
|
|
1335
|
+
6. Use the `playwright-cli` skill if you need to verify the artifact route or embedded app behavior in a browser
|
|
1336
|
+
|
|
1337
|
+
### Status Dashboard
|
|
1338
|
+
|
|
1339
|
+
Monitor ongoing processes:
|
|
1340
|
+
|
|
1341
|
+
1. Create `status` nodes for each metric/process
|
|
1342
|
+
2. Use semantic colors: green=passing, yellow=running, red=failing, gray=queued
|
|
1343
|
+
3. Connect sequential pipeline stages with `flow` edges (label: "then", "triggers")
|
|
1344
|
+
4. Update nodes in-place as state changes using `canvas_node { action: "update" }` — never delete
|
|
1345
|
+
and recreate, as that loses position and edges
|
|
1346
|
+
5. Arrange with `grid` layout
|
|
1347
|
+
6. The human sees real-time updates via SSE
|
|
1348
|
+
|
|
1349
|
+
### Before/After Comparison
|
|
1350
|
+
|
|
1351
|
+
Show two states side by side for the human to compare:
|
|
1352
|
+
|
|
1353
|
+
1. Take a snapshot before changes: `canvas_snapshot` with name "before-X"
|
|
1354
|
+
2. Make changes to the canvas
|
|
1355
|
+
3. Use `canvas_diff` to show what changed
|
|
1356
|
+
4. Or: create two groups ("Before" and "After") with corresponding nodes
|
|
1357
|
+
|
|
1358
|
+
### Save and Start Fresh
|
|
1359
|
+
|
|
1360
|
+
When the human wants to explore a different approach without losing current work:
|
|
1361
|
+
|
|
1362
|
+
1. **First**, save the current state: `canvas_snapshot` with a descriptive name
|
|
1363
|
+
2. **Then** clear: `canvas_view { action: "clear" }` (never clear without snapshotting first)
|
|
1364
|
+
3. Set up the new workspace with initial nodes
|
|
1365
|
+
4. Tell the human the snapshot name and that `canvas_restore` can bring everything back
|
|
1366
|
+
|
|
1367
|
+
## Best Practices
|
|
1368
|
+
|
|
1369
|
+
1. **Start once, reuse always.** Don't restart the canvas for each task. Build on the
|
|
1370
|
+
existing canvas state.
|
|
1371
|
+
|
|
1372
|
+
2. **Titles are scannable.** Keep titles short (3-6 words). Put details in content.
|
|
1373
|
+
|
|
1374
|
+
3. **Label every edge.** Unlabeled edges lose meaning. "depends on", "calls", "blocks"
|
|
1375
|
+
are all more useful than a bare arrow.
|
|
1376
|
+
|
|
1377
|
+
4. **Auto-arrange after batch adds.** When adding multiple nodes, call
|
|
1378
|
+
`canvas_view { action: "arrange" }` once at the end, not after each node.
|
|
1379
|
+
|
|
1380
|
+
5. **Update in place.** Use `canvas_node { action: "update" }` to change status, content, or
|
|
1381
|
+
color. Don't delete and recreate — that loses position and edges.
|
|
1382
|
+
|
|
1383
|
+
6. **Clean up.** Remove nodes that are no longer relevant. A cluttered canvas is worse
|
|
1384
|
+
than no canvas.
|
|
1385
|
+
|
|
1386
|
+
7. **Read before writing.** Check `canvas://layout` or `canvas_query { action: "layout" }` before
|
|
1387
|
+
adding nodes to avoid duplicates and understand the current state.
|
|
1388
|
+
|
|
1389
|
+
8. **Use pinning.** When you want the human to focus on specific nodes, pin them.
|
|
1390
|
+
When the human pins nodes, read `canvas://pinned-context` to see what they care about.
|
|
1391
|
+
Prefer one intent-setting markdown pin plus a small set of concrete output pins over pinning a
|
|
1392
|
+
whole gallery.
|
|
1393
|
+
|
|
1394
|
+
9. **Snapshot before destructive changes.** Before clearing or major reorganization,
|
|
1395
|
+
save a snapshot so you can restore if needed.
|
|
1396
|
+
|
|
1397
|
+
10. **Prefer MCP tools over HTTP.** When running as an MCP server, use the canvas tools
|
|
1398
|
+
directly rather than shelling out to curl. The tools handle all the details.
|
|
1399
|
+
|
|
1400
|
+
11. **Use groups for visual organization.** When 3+ nodes are related, wrap them in a
|
|
1401
|
+
group to make the relationship visible at a glance.
|
|
1402
|
+
|
|
1403
|
+
12. **Use file nodes for source code.** File nodes auto-watch for changes and update
|
|
1404
|
+
live. This is better than pasting code into markdown nodes.
|
|
1405
|
+
|
|
1406
|
+
13. **Comparison boards need structure, not just content.** For galleries and evaluations, use a
|
|
1407
|
+
named group, give the area breathing room, and keep related charts/artifacts inside that
|
|
1408
|
+
region instead of letting them drift into the main cluster.
|
|
1409
|
+
|
|
1410
|
+
14. **Capture external app IDs immediately.** For Excalidraw and other `mcp-app` nodes, store the
|
|
1411
|
+
returned node ID or pin the node right away. Search/title rediscovery is less reliable there
|
|
1412
|
+
than for markdown, graph, or file nodes.
|
|
1413
|
+
|
|
1414
|
+
15. **Pair app nodes with explainers.** If you create or pin a web artifact or Excalidraw node,
|
|
1415
|
+
add a nearby markdown, graph, or file node that explains what the app is for. This makes
|
|
1416
|
+
pinned context far more useful to later agents.
|
|
1417
|
+
|
|
1418
|
+
## Persistence
|
|
1419
|
+
|
|
1420
|
+
Canvas state auto-saves to `.pmx-canvas/canvas.db` on every mutation (debounced 500ms). State
|
|
1421
|
+
loads automatically on server start. The SQLite DB is git-committable — spatial knowledge
|
|
1422
|
+
persists across sessions.
|
|
1423
|
+
|
|
1424
|
+
Snapshots, context pins, and large node blobs are stored in the same DB. Web artifacts land in
|
|
1425
|
+
`.pmx-canvas/artifacts/`. Legacy JSON state, snapshot, and blob files are auto-imported into
|
|
1426
|
+
SQLite and renamed to `.bak` on first boot.
|
|
1427
|
+
|
|
1428
|
+
Stop the server or flush/close the SDK before committing `canvas.db`; shutdown checkpoints SQLite
|
|
1429
|
+
WAL data into the DB file.
|
|
1430
|
+
|
|
1431
|
+
## Real-Time Collaboration
|
|
1432
|
+
|
|
1433
|
+
The canvas supports real-time human-agent collaboration:
|
|
1434
|
+
|
|
1435
|
+
- **Human pins nodes in browser** → agent reads `canvas://pinned-context`
|
|
1436
|
+
- **Agent adds/updates nodes** → human sees changes instantly via SSE
|
|
1437
|
+
- **Human moves/groups nodes** → spatial arrangement communicates intent
|
|
1438
|
+
- **Agent reads spatial context** → understands implicit relationships
|
|
1439
|
+
|
|
1440
|
+
This bidirectional flow means the canvas is a shared workspace, not just an output display.
|
|
1441
|
+
Pay attention to what the human is doing on the canvas — their spatial choices are meaningful.
|