pmx-canvas 0.1.12 → 0.1.14

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 (32) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/dist/canvas/index.js +42 -42
  3. package/dist/types/client/nodes/ExtAppFrame.d.ts +2 -3
  4. package/dist/types/client/nodes/McpAppNode.d.ts +2 -1
  5. package/dist/types/client/nodes/trace-model.d.ts +9 -0
  6. package/dist/types/client/state/canvas-store.d.ts +2 -0
  7. package/dist/types/mcp/canvas-access.d.ts +1 -0
  8. package/dist/types/server/canvas-operations.d.ts +8 -0
  9. package/dist/types/server/diagram-presets.d.ts +4 -0
  10. package/dist/types/server/index.d.ts +8 -0
  11. package/dist/types/server/mcp-app-runtime.d.ts +1 -0
  12. package/dist/types/server/web-artifacts.d.ts +1 -0
  13. package/package.json +1 -1
  14. package/skills/web-artifacts-builder/scripts/init-artifact.sh +9 -8
  15. package/src/cli/agent.ts +15 -1
  16. package/src/client/canvas/ExpandedNodeOverlay.tsx +3 -3
  17. package/src/client/nodes/ExtAppFrame.tsx +10 -35
  18. package/src/client/nodes/McpAppNode.tsx +2 -2
  19. package/src/client/nodes/TraceNode.tsx +2 -6
  20. package/src/client/nodes/trace-model.ts +19 -0
  21. package/src/client/state/canvas-store.ts +5 -2
  22. package/src/client/state/sse-bridge.ts +3 -1
  23. package/src/mcp/canvas-access.ts +28 -3
  24. package/src/mcp/server.ts +51 -9
  25. package/src/server/canvas-operations.ts +36 -0
  26. package/src/server/canvas-schema.ts +11 -0
  27. package/src/server/diagram-presets.ts +44 -46
  28. package/src/server/index.ts +31 -4
  29. package/src/server/mcp-app-runtime.ts +15 -5
  30. package/src/server/server.ts +96 -50
  31. package/src/server/web-artifacts/scripts/init-artifact.sh +9 -8
  32. package/src/server/web-artifacts.ts +14 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,155 @@
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.14] - 2026-05-02
7
+
8
+ External-MCP-app and trace-node ergonomics on top of 0.1.13. Trace node
9
+ fields land as top-level inputs across CLI / HTTP / MCP / SDK,
10
+ `canvas_open_mcp_app` and `canvas_add_diagram` gain `nodeId` for
11
+ update-in-place plus `timeoutMs` for cold external servers, expanded
12
+ mcp-app frames receive the matching host context, and ext-app result
13
+ streaming no longer pollutes undo/redo history.
14
+
15
+ ### Added
16
+
17
+ - **Trace node fields on the add/update surfaces.** `pmx-canvas node add
18
+ --type trace` now accepts `--toolName`, `--category`, `--status`,
19
+ `--duration`, `--resultSummary`, and `--error` flags. The same fields
20
+ are accepted top-level on `POST /api/canvas/node`, `PATCH
21
+ /api/canvas/node/<id>`, MCP `canvas_add_node`, and SDK
22
+ `PmxCanvas.addNode()`/`updateNode()`. Updates merge per-field through
23
+ `mergeTraceNodeDataFields` so partial patches keep the rest intact.
24
+ - **`canvas_open_mcp_app` and `canvas_add_diagram` accept `nodeId` for
25
+ update-in-place.** Passing an existing `mcp-app` ext-app node id
26
+ closes the previous session and reuses the node id, title, and
27
+ geometry instead of creating a new node. Available on MCP, HTTP
28
+ `POST /api/canvas/mcp-app` and `POST /api/canvas/diagram`, and CLI
29
+ `external-app add --node-id` (also `--nodeId` / `--id`).
30
+ - **`canvas_open_mcp_app` and `canvas_add_diagram` accept `timeoutMs`.**
31
+ The value is forwarded to the external MCP client's `connect()` and
32
+ `listTools()` calls so cold external app servers don't fail under
33
+ the default request timeout. CLI `external-app add` exposes the
34
+ same flag as `--timeout-ms`. The MCP error message for a
35
+ client-cancelled `canvas_add_diagram` now points users at this
36
+ knob.
37
+ - **`pmx-canvas external-app add --elements` alias.** `--elements`
38
+ is now accepted as an alias for `--elements-json`.
39
+
40
+ ### Changed
41
+
42
+ - **Excalidraw bound text is folded into container labels.** When a
43
+ text element references a container (`containerId`) that supports a
44
+ native label — `rectangle`, `ellipse`, or `diamond` — the diagram
45
+ preset now hoists the text into the container's `label` field
46
+ instead of leaving a separate text element behind. This restores
47
+ the native Excalidraw shape so the hosted app renders the label as
48
+ expected. Other container shapes still keep bidirectional
49
+ `boundElements` references.
50
+ - **Expanded mcp-app frames receive `fullscreen` host context.**
51
+ `ExpandedNodeOverlay` now passes `expanded={true}` to `McpAppNode`
52
+ for `mcp-app`, `json-render`, and `graph` nodes; `ExtAppFrame`
53
+ forwards it to the bridge as a `host-context-change` so external
54
+ apps know when they're rendered fullscreen versus inline.
55
+
56
+ ### Fixed
57
+
58
+ - **Ext-app runtime result streaming no longer pollutes undo/redo.**
59
+ Streaming HTML updates and result-handling for hosted external apps
60
+ now run through `canvasState.withSuppressedRecording()` so undo no
61
+ longer needs to walk through every intermediate ext-app html
62
+ patch. Opening an ext-app remains a user-visible history step.
63
+
64
+ ### Internal
65
+
66
+ - Regression coverage for: trace fields landing on add and patch
67
+ through CLI / HTTP / MCP, Excalidraw bound-text → container label
68
+ hoisting (including centered container text), `external-app add`
69
+ accepting the `--elements` alias and an existing node target,
70
+ `canvas_add_diagram` updating an existing Excalidraw node in
71
+ place, and ext-app result streaming preserving redo history after
72
+ an undo.
73
+
74
+ ## [0.1.13] - 2026-05-02
75
+
76
+ Live-collaboration polish on top of 0.1.12. Server-driven SSE updates no
77
+ longer reset the user's viewport, the MCP server hot-promotes itself to
78
+ a daemon-backed access when one shows up later, agent-authored trace
79
+ nodes get first-class schema for the fields the renderer reads,
80
+ `canvas_batch` exposes partial-failure envelopes and bare-step refs,
81
+ `canvas_restore` returns a compact summary, and the web-artifact init
82
+ path stops leaking macOS `sed -i ''` backup files into Linux projects.
83
+
84
+ ### Added
85
+
86
+ - **First-class trace node fields in `canvas_describe_schema`.** The
87
+ trace `add` schema now lists `toolName`, `category`, `status`,
88
+ `duration`, `resultSummary`, and `error` as documented optional
89
+ fields, with the same defaults the renderer uses. Trace rendering was
90
+ also extracted to `src/client/nodes/trace-model.ts` so the
91
+ field-fallback contract is unit-testable.
92
+ - **MCP can hot-promote to a daemon.** `refreshCanvasAccess()` is
93
+ exported from the canvas-access module and called on every
94
+ `ensureCanvas()` after the first. If a workspace canvas daemon comes
95
+ online after the MCP server started in local mode, the MCP switches
96
+ to the remote backend without losing its tool registration. Resource
97
+ notifications now track local vs remote subscriptions independently
98
+ so a refresh does not double-subscribe.
99
+ - **Web-artifact build response carries a completion timestamp.**
100
+ `WebArtifactCanvasBuildResult` and the `/api/canvas/web-artifact`
101
+ HTTP response now include `completedAt` (ISO 8601) so agents that
102
+ trigger long builds can correlate their request with the response.
103
+ - **`canvas_build_web_artifact` schema documents `timeoutMs` and cold-
104
+ build behavior.** The schema lists `timeoutMs` as the subprocess
105
+ timeout (distinct from the MCP client request timeout) and adds a
106
+ note that cold builds can exceed the default 60s MCP client timeout.
107
+
108
+ ### Changed
109
+
110
+ - **Server SSE layout updates no longer clobber the user's pan/zoom.**
111
+ `applyServerCanvasLayout` only re-applies the server viewport when
112
+ the caller explicitly opts in via `{ applyViewport: true }`. The
113
+ `canvas-layout-update` SSE handler now only opts in on the very
114
+ first layout sync; later updates from agent or HTTP mutations leave
115
+ the user's current viewport alone.
116
+ - **`canvas_restore` returns a compact summary instead of the full
117
+ layout.** Restoring a snapshot now responds with `{ok, restored,
118
+ summary: { ... }}` containing node and edge counts, pinned ids, and
119
+ group counts. Use `canvas_get_layout` afterwards if the full layout
120
+ is needed.
121
+ - **`canvas_batch` exposes partial-failure envelopes.** When the batch
122
+ endpoint returns a structured failure body (HTTP non-2xx with an
123
+ object payload), the MCP tool surfaces that body to the caller
124
+ instead of throwing. Bare `$step` references in batch payloads now
125
+ resolve to that step's `id`, matching the ergonomic
126
+ `{from: '$step1', to: '$step2'}` pattern.
127
+ - **Diagram preset keeps Excalidraw text elements as text.** The
128
+ bound-text → container `label` conversion added in 0.1.10 has been
129
+ removed; text elements now stay as text elements while
130
+ `boundElements` references are kept bidirectional, restoring the
131
+ Excalidraw-native shape the MCP app expects.
132
+
133
+ ### Fixed
134
+
135
+ - **`init-artifact.sh` no longer leaks literal `''` backup files on
136
+ Linux.** The script now wraps `sed -i` in a `sed_in_place` function
137
+ that picks the right syntax per OS instead of relying on a
138
+ `$SED_INPLACE` variable that contained a literal empty argument on
139
+ macOS and broke under word-splitting on Linux.
140
+ - **Web-artifact build cleans up pre-existing literal `''` files.**
141
+ Reusable build projects scaffolded by older versions of the init
142
+ script may still carry `index.html''`-style stragglers. The bundle
143
+ step now removes any literal-`''`-suffixed files in the project
144
+ directory before delegating to Parcel.
145
+
146
+ ### Internal
147
+
148
+ - Regression coverage for: trace-model field fallbacks, applying server
149
+ layouts without auto-applying viewport plus the explicit
150
+ initial-sync path, MCP local→remote daemon promotion, `canvas_batch`
151
+ bare-ref resolution and partial-failure envelopes, `canvas_restore`
152
+ compact summary shape, Excalidraw bound-text repair without dropping
153
+ text elements, and the `init-artifact.sh` sed-backup cleanup.
154
+
6
155
  ## [0.1.12] - 2026-05-02
7
156
 
8
157
  MCP/canvas state-sharing pass on top of 0.1.11. The MCP server now
@@ -363,6 +512,8 @@ otherwise have to discover by trial and error.
363
512
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
364
513
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
365
514
 
515
+ [0.1.14]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.14
516
+ [0.1.13]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.13
366
517
  [0.1.12]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.12
367
518
  [0.1.11]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.11
368
519
  [0.1.10]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.10