pmx-canvas 0.1.11 → 0.1.13

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 CHANGED
@@ -3,6 +3,134 @@
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.13] - 2026-05-02
7
+
8
+ Live-collaboration polish on top of 0.1.12. Server-driven SSE updates no
9
+ longer reset the user's viewport, the MCP server hot-promotes itself to
10
+ a daemon-backed access when one shows up later, agent-authored trace
11
+ nodes get first-class schema for the fields the renderer reads,
12
+ `canvas_batch` exposes partial-failure envelopes and bare-step refs,
13
+ `canvas_restore` returns a compact summary, and the web-artifact init
14
+ path stops leaking macOS `sed -i ''` backup files into Linux projects.
15
+
16
+ ### Added
17
+
18
+ - **First-class trace node fields in `canvas_describe_schema`.** The
19
+ trace `add` schema now lists `toolName`, `category`, `status`,
20
+ `duration`, `resultSummary`, and `error` as documented optional
21
+ fields, with the same defaults the renderer uses. Trace rendering was
22
+ also extracted to `src/client/nodes/trace-model.ts` so the
23
+ field-fallback contract is unit-testable.
24
+ - **MCP can hot-promote to a daemon.** `refreshCanvasAccess()` is
25
+ exported from the canvas-access module and called on every
26
+ `ensureCanvas()` after the first. If a workspace canvas daemon comes
27
+ online after the MCP server started in local mode, the MCP switches
28
+ to the remote backend without losing its tool registration. Resource
29
+ notifications now track local vs remote subscriptions independently
30
+ so a refresh does not double-subscribe.
31
+ - **Web-artifact build response carries a completion timestamp.**
32
+ `WebArtifactCanvasBuildResult` and the `/api/canvas/web-artifact`
33
+ HTTP response now include `completedAt` (ISO 8601) so agents that
34
+ trigger long builds can correlate their request with the response.
35
+ - **`canvas_build_web_artifact` schema documents `timeoutMs` and cold-
36
+ build behavior.** The schema lists `timeoutMs` as the subprocess
37
+ timeout (distinct from the MCP client request timeout) and adds a
38
+ note that cold builds can exceed the default 60s MCP client timeout.
39
+
40
+ ### Changed
41
+
42
+ - **Server SSE layout updates no longer clobber the user's pan/zoom.**
43
+ `applyServerCanvasLayout` only re-applies the server viewport when
44
+ the caller explicitly opts in via `{ applyViewport: true }`. The
45
+ `canvas-layout-update` SSE handler now only opts in on the very
46
+ first layout sync; later updates from agent or HTTP mutations leave
47
+ the user's current viewport alone.
48
+ - **`canvas_restore` returns a compact summary instead of the full
49
+ layout.** Restoring a snapshot now responds with `{ok, restored,
50
+ summary: { ... }}` containing node and edge counts, pinned ids, and
51
+ group counts. Use `canvas_get_layout` afterwards if the full layout
52
+ is needed.
53
+ - **`canvas_batch` exposes partial-failure envelopes.** When the batch
54
+ endpoint returns a structured failure body (HTTP non-2xx with an
55
+ object payload), the MCP tool surfaces that body to the caller
56
+ instead of throwing. Bare `$step` references in batch payloads now
57
+ resolve to that step's `id`, matching the ergonomic
58
+ `{from: '$step1', to: '$step2'}` pattern.
59
+ - **Diagram preset keeps Excalidraw text elements as text.** The
60
+ bound-text → container `label` conversion added in 0.1.10 has been
61
+ removed; text elements now stay as text elements while
62
+ `boundElements` references are kept bidirectional, restoring the
63
+ Excalidraw-native shape the MCP app expects.
64
+
65
+ ### Fixed
66
+
67
+ - **`init-artifact.sh` no longer leaks literal `''` backup files on
68
+ Linux.** The script now wraps `sed -i` in a `sed_in_place` function
69
+ that picks the right syntax per OS instead of relying on a
70
+ `$SED_INPLACE` variable that contained a literal empty argument on
71
+ macOS and broke under word-splitting on Linux.
72
+ - **Web-artifact build cleans up pre-existing literal `''` files.**
73
+ Reusable build projects scaffolded by older versions of the init
74
+ script may still carry `index.html''`-style stragglers. The bundle
75
+ step now removes any literal-`''`-suffixed files in the project
76
+ directory before delegating to Parcel.
77
+
78
+ ### Internal
79
+
80
+ - Regression coverage for: trace-model field fallbacks, applying server
81
+ layouts without auto-applying viewport plus the explicit
82
+ initial-sync path, MCP local→remote daemon promotion, `canvas_batch`
83
+ bare-ref resolution and partial-failure envelopes, `canvas_restore`
84
+ compact summary shape, Excalidraw bound-text repair without dropping
85
+ text elements, and the `init-artifact.sh` sed-backup cleanup.
86
+
87
+ ## [0.1.12] - 2026-05-02
88
+
89
+ MCP/canvas state-sharing pass on top of 0.1.11. The MCP server now
90
+ attaches to an already-running canvas daemon for the current workspace
91
+ instead of spinning up a parallel in-process state, so HTTP-created
92
+ nodes and browser pins show up immediately in MCP responses and emit
93
+ the matching resource notifications. The SDK's port binding is also
94
+ hardened so explicit `port:` requests no longer silently land on a
95
+ fallback port.
96
+
97
+ ### Added
98
+
99
+ - **`startCanvasServer({ allowPortFallback: false })` and SDK port
100
+ determinism.** The HTTP server option lets callers opt out of the
101
+ fallback-port walk. The Bun SDK's `PmxCanvas.start()` and
102
+ `PmxCanvas.startAutomationWebView()` now pass this flag, so when an
103
+ SDK consumer says `createCanvas({ port: 4313 })` they either bind to
104
+ 4313 or fail loudly — preventing two SDK instances or an SDK + a
105
+ daemon from racing onto silently different ports.
106
+ - **`CanvasAccess` abstraction with local + remote backends.** A new
107
+ `src/mcp/canvas-access.ts` module defines the interface the MCP
108
+ server uses to talk to canvas state. `LocalCanvasAccess` wraps an
109
+ in-process `PmxCanvas` (legacy behavior); `RemoteCanvasAccess` talks
110
+ to an existing daemon over HTTP and consumes its SSE stream. The
111
+ factory probes for an existing canvas server in the workspace before
112
+ starting a new one.
113
+
114
+ ### Changed
115
+
116
+ - **MCP server defers to an existing canvas daemon as the state
117
+ authority.** When `pmx-canvas --mcp` boots in a workspace that
118
+ already has a canvas server running on the agreed port, the MCP
119
+ process now reads and writes through that daemon's HTTP API instead
120
+ of starting its own canvas. Nodes created via the daemon's HTTP API
121
+ (or by a human in the browser) are visible to MCP queries
122
+ immediately, and SSE events from the daemon are translated into
123
+ MCP `notifications/resources/updated` calls for `canvas://layout`,
124
+ `canvas://summary`, `canvas://spatial-context`, `canvas://history`,
125
+ `canvas://code-graph`, and `canvas://pinned-context`.
126
+
127
+ ### Internal
128
+
129
+ - Regression coverage for: `canvas_add_node` strict-size persistence
130
+ through MCP, an MCP session using an existing daemon as the state
131
+ authority for HTTP-created nodes, and HTTP node creation broadcasting
132
+ a live `canvas-layout-update` SSE event.
133
+
6
134
  ## [0.1.11] - 2026-05-02
7
135
 
8
136
  Agent ergonomics + chart polish on top of 0.1.10. Adds a `--strict-size`
@@ -316,6 +444,8 @@ otherwise have to discover by trial and error.
316
444
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
317
445
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
318
446
 
447
+ [0.1.13]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.13
448
+ [0.1.12]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.12
319
449
  [0.1.11]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.11
320
450
  [0.1.10]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.10
321
451
  [0.1.9]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.9