pmx-canvas 0.1.13 → 0.1.15

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/Readme.md +108 -1058
  3. package/dist/canvas/global.css +141 -0
  4. package/dist/canvas/index.js +137 -87
  5. package/dist/json-render/index.css +1 -1
  6. package/dist/types/client/nodes/ExtAppFrame.d.ts +2 -3
  7. package/dist/types/client/nodes/HtmlNode.d.ts +5 -0
  8. package/dist/types/client/nodes/McpAppNode.d.ts +2 -1
  9. package/dist/types/client/state/canvas-store.d.ts +5 -1
  10. package/dist/types/client/state/intent-bridge.d.ts +3 -1
  11. package/dist/types/client/types.d.ts +2 -2
  12. package/dist/types/json-render/catalog.d.ts +1 -1
  13. package/dist/types/mcp/canvas-access.d.ts +7 -1
  14. package/dist/types/server/agent-context.d.ts +1 -0
  15. package/dist/types/server/canvas-operations.d.ts +12 -2
  16. package/dist/types/server/canvas-provenance.d.ts +1 -1
  17. package/dist/types/server/canvas-serialization.d.ts +3 -0
  18. package/dist/types/server/canvas-state.d.ts +51 -4
  19. package/dist/types/server/demo.d.ts +5 -0
  20. package/dist/types/server/diagram-presets.d.ts +4 -0
  21. package/dist/types/server/index.d.ts +21 -3
  22. package/dist/types/server/mcp-app-runtime.d.ts +1 -0
  23. package/dist/types/server/web-artifacts.d.ts +18 -0
  24. package/dist/types/shared/canvas-node-kind.d.ts +5 -0
  25. package/package.json +1 -1
  26. package/skills/pmx-canvas/SKILL.md +43 -0
  27. package/skills/pmx-canvas-testing/SKILL.md +17 -0
  28. package/src/cli/agent.ts +66 -5
  29. package/src/cli/index.ts +2 -23
  30. package/src/client/canvas/AttentionHistory.tsx +14 -1
  31. package/src/client/canvas/CanvasNode.tsx +1 -1
  32. package/src/client/canvas/CanvasViewport.tsx +3 -0
  33. package/src/client/canvas/DockedNode.tsx +110 -12
  34. package/src/client/canvas/ExpandedNodeOverlay.tsx +8 -3
  35. package/src/client/canvas/Minimap.tsx +1 -0
  36. package/src/client/icons.tsx +1 -0
  37. package/src/client/nodes/ExtAppFrame.tsx +10 -35
  38. package/src/client/nodes/HtmlNode.tsx +151 -0
  39. package/src/client/nodes/McpAppNode.tsx +2 -2
  40. package/src/client/state/canvas-store.ts +24 -2
  41. package/src/client/state/intent-bridge.ts +4 -3
  42. package/src/client/state/sse-bridge.ts +2 -0
  43. package/src/client/theme/global.css +141 -0
  44. package/src/client/types.ts +3 -0
  45. package/src/mcp/canvas-access.ts +34 -7
  46. package/src/mcp/server.ts +199 -26
  47. package/src/server/agent-context.ts +50 -3
  48. package/src/server/canvas-operations.ts +55 -3
  49. package/src/server/canvas-provenance.ts +2 -1
  50. package/src/server/canvas-serialization.ts +38 -13
  51. package/src/server/canvas-state.ts +305 -34
  52. package/src/server/demo.ts +792 -0
  53. package/src/server/diagram-presets.ts +45 -25
  54. package/src/server/index.ts +64 -7
  55. package/src/server/mcp-app-runtime.ts +15 -5
  56. package/src/server/server.ts +169 -63
  57. package/src/server/web-artifacts.ts +116 -3
  58. package/src/shared/canvas-node-kind.ts +14 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,167 @@
3
3
  All notable changes to `pmx-canvas` are documented here. This project follows
4
4
  [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [0.1.15] - 2026-05-03
7
+
8
+ A bigger release focused on right-sizing what flows through MCP and the
9
+ canvas state file. Adds an `html` node type, sidecar blob storage so
10
+ rich ext-app payloads stay out of the main `state.json`, compact-by-
11
+ default MCP responses with an opt-in `full` mode, `canvas_gc_snapshots`,
12
+ a shared `getCanvasNodeKind` classifier so pinned reads tell agents the
13
+ real kind of `mcp-app` subtypes, web-artifact source context for pinned
14
+ reads, an extracted demo module, and a five-file `docs/` reference set.
15
+ The README, AGENTS.md, and CLAUDE.md catch up to the new shape.
16
+
17
+ ### Added
18
+
19
+ - **`html` node type and `canvas_add_html_node` MCP tool.** Adds a
20
+ dedicated HTML node renderer that sandboxes user-authored markup in
21
+ an iframe and injects canvas theme tokens (`--c-*` plus
22
+ `--color-*` aliases) so embedded content inherits the theme. Token
23
+ values are sanitized before interpolation. `canvas_add_node` now
24
+ also accepts `type: 'html'` for parity, with `canvas_add_html_node`
25
+ the preferred entry point. MCP tool count is now 40 (was 39).
26
+ - **Snapshot list filtering and `canvas_gc_snapshots`.**
27
+ `canvas_list_snapshots` accepts options (`limit`, `before`,
28
+ `after`), and `canvas_gc_snapshots({keep, dryRun})` deletes older
29
+ snapshots while keeping the newest N. CLI `pmx-canvas snapshot
30
+ list` and `pmx-canvas snapshot gc` expose the same surface; HTTP
31
+ endpoints support both.
32
+ - **Sidecar blob storage for large ext-app payloads.** When an
33
+ ext-app field on a node would exceed the configured threshold
34
+ (default 2048 bytes; override via
35
+ `PMX_CANVAS_BLOB_THRESHOLD_BYTES`), the value is written to
36
+ `.pmx-canvas/blobs/<sha>.json` and replaced with a checksum
37
+ reference in the main `state.json`. Blob refs are reinflated
38
+ transparently on read, with a checksum-mismatch warning if the
39
+ sidecar file has been tampered with.
40
+ - **`getCanvasNodeKind()` shared classifier.** New
41
+ `src/shared/canvas-node-kind.ts` returns
42
+ `'web-artifact' | 'external-app' | 'mcp-app' | <type>` so pinned
43
+ reads, agent context, and CLI output report the real subtype of
44
+ `mcp-app` nodes (web-artifact viewers vs. external apps vs. plain
45
+ hosted content). `canvas://pinned-context` now includes `kind` for
46
+ every node.
47
+ - **Web-artifact source context on pinned reads.** When a pinned
48
+ node is a web-artifact, agent context now exposes a bounded source
49
+ summary (`buildWebArtifactSourceContext`): a capped list of source
50
+ filenames plus a truncated preview, instead of inlining the full
51
+ bundled HTML. Total file count is preserved even when the list is
52
+ truncated.
53
+ - **Standalone reference docs.** New `docs/cli.md`,
54
+ `docs/http-api.md`, `docs/mcp.md`, `docs/node-types.md`, and
55
+ `docs/sdk.md` document each surface in detail alongside the
56
+ README.
57
+ - **Extracted demo module (`src/server/demo.ts`).** The project-tour
58
+ demo seed is now its own module with `seedDemoCanvas()` exported
59
+ and unit-tested, so contributors can read and iterate on the
60
+ demo without spelunking through the server boot path.
61
+ - **DockedNode context dock with item-count badge.** The dock
62
+ surfaces a pill with the count of pinned cards plus aux tabs, and
63
+ the dock and the right-edge Updates panel are mutually exclusive
64
+ (one open at a time) so they no longer collide on the same anchor.
65
+ - **Trace field aliases on `node update`.** `node update` accepts
66
+ both camel (`--toolName`) and kebab (`--tool-name`) variants for
67
+ trace fields, matching the `node add` flag style.
68
+
69
+ ### Changed
70
+
71
+ - **MCP responses are compact by default.** `canvas_add_node`,
72
+ `canvas_get_node`, `canvas_get_layout`, and `canvas_batch` now
73
+ return compact node/layout payloads (id, type, position, size,
74
+ pinned, kind, plus a small data digest) by default. Pass
75
+ `full: true` (or `verbose: true`) to opt into the full payload.
76
+ This keeps response token counts stable for agents iterating over
77
+ large boards.
78
+ - **README reframed around "moldable canvas" + curation flow.** The
79
+ README opens with a moldable-canvas summary, calls out
80
+ curation-as-communication, and adds two top-level sections:
81
+ `01 / Curate` (drag, group, pin) and `02 / Mix any data source`.
82
+ - **AGENTS.md and CLAUDE.md updated for the new tool set.** Both
83
+ guidance files now list `canvas_add_html_node` and
84
+ `canvas_gc_snapshots` and the new `html` node type. Quick-start
85
+ shows `bun run dev:demo` for the project-tour board.
86
+
87
+ ### Internal
88
+
89
+ - Regression coverage for: snapshot list filtering and gc through
90
+ CLI / HTTP / MCP, blob-sidecar persistence for large ext-app
91
+ payloads with opt-in full reads, pinned-context `kind`
92
+ serialization for native, graph, and mcp-app subtype nodes,
93
+ web-artifact pinned context returning a bounded source-file
94
+ summary instead of bundled HTML, capped source file metadata
95
+ preserving total count, trace field camel/kebab alias forwarding
96
+ on update, demo seeding, and external-app kind serialization
97
+ for pinned context consumers.
98
+
99
+ ## [0.1.14] - 2026-05-02
100
+
101
+ External-MCP-app and trace-node ergonomics on top of 0.1.13. Trace node
102
+ fields land as top-level inputs across CLI / HTTP / MCP / SDK,
103
+ `canvas_open_mcp_app` and `canvas_add_diagram` gain `nodeId` for
104
+ update-in-place plus `timeoutMs` for cold external servers, expanded
105
+ mcp-app frames receive the matching host context, and ext-app result
106
+ streaming no longer pollutes undo/redo history.
107
+
108
+ ### Added
109
+
110
+ - **Trace node fields on the add/update surfaces.** `pmx-canvas node add
111
+ --type trace` now accepts `--toolName`, `--category`, `--status`,
112
+ `--duration`, `--resultSummary`, and `--error` flags. The same fields
113
+ are accepted top-level on `POST /api/canvas/node`, `PATCH
114
+ /api/canvas/node/<id>`, MCP `canvas_add_node`, and SDK
115
+ `PmxCanvas.addNode()`/`updateNode()`. Updates merge per-field through
116
+ `mergeTraceNodeDataFields` so partial patches keep the rest intact.
117
+ - **`canvas_open_mcp_app` and `canvas_add_diagram` accept `nodeId` for
118
+ update-in-place.** Passing an existing `mcp-app` ext-app node id
119
+ closes the previous session and reuses the node id, title, and
120
+ geometry instead of creating a new node. Available on MCP, HTTP
121
+ `POST /api/canvas/mcp-app` and `POST /api/canvas/diagram`, and CLI
122
+ `external-app add --node-id` (also `--nodeId` / `--id`).
123
+ - **`canvas_open_mcp_app` and `canvas_add_diagram` accept `timeoutMs`.**
124
+ The value is forwarded to the external MCP client's `connect()` and
125
+ `listTools()` calls so cold external app servers don't fail under
126
+ the default request timeout. CLI `external-app add` exposes the
127
+ same flag as `--timeout-ms`. The MCP error message for a
128
+ client-cancelled `canvas_add_diagram` now points users at this
129
+ knob.
130
+ - **`pmx-canvas external-app add --elements` alias.** `--elements`
131
+ is now accepted as an alias for `--elements-json`.
132
+
133
+ ### Changed
134
+
135
+ - **Excalidraw bound text is folded into container labels.** When a
136
+ text element references a container (`containerId`) that supports a
137
+ native label — `rectangle`, `ellipse`, or `diamond` — the diagram
138
+ preset now hoists the text into the container's `label` field
139
+ instead of leaving a separate text element behind. This restores
140
+ the native Excalidraw shape so the hosted app renders the label as
141
+ expected. Other container shapes still keep bidirectional
142
+ `boundElements` references.
143
+ - **Expanded mcp-app frames receive `fullscreen` host context.**
144
+ `ExpandedNodeOverlay` now passes `expanded={true}` to `McpAppNode`
145
+ for `mcp-app`, `json-render`, and `graph` nodes; `ExtAppFrame`
146
+ forwards it to the bridge as a `host-context-change` so external
147
+ apps know when they're rendered fullscreen versus inline.
148
+
149
+ ### Fixed
150
+
151
+ - **Ext-app runtime result streaming no longer pollutes undo/redo.**
152
+ Streaming HTML updates and result-handling for hosted external apps
153
+ now run through `canvasState.withSuppressedRecording()` so undo no
154
+ longer needs to walk through every intermediate ext-app html
155
+ patch. Opening an ext-app remains a user-visible history step.
156
+
157
+ ### Internal
158
+
159
+ - Regression coverage for: trace fields landing on add and patch
160
+ through CLI / HTTP / MCP, Excalidraw bound-text → container label
161
+ hoisting (including centered container text), `external-app add`
162
+ accepting the `--elements` alias and an existing node target,
163
+ `canvas_add_diagram` updating an existing Excalidraw node in
164
+ place, and ext-app result streaming preserving redo history after
165
+ an undo.
166
+
6
167
  ## [0.1.13] - 2026-05-02
7
168
 
8
169
  Live-collaboration polish on top of 0.1.12. Server-driven SSE updates no
@@ -444,6 +605,8 @@ otherwise have to discover by trial and error.
444
605
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
445
606
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
446
607
 
608
+ [0.1.15]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.15
609
+ [0.1.14]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.14
447
610
  [0.1.13]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.13
448
611
  [0.1.12]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.12
449
612
  [0.1.11]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.11