pmx-canvas 0.1.8 → 0.1.9

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,70 @@
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.9] - 2026-05-01
7
+
8
+ Workflow ergonomics pass for agent-authored boards. This release tightens
9
+ geometry contracts, adds in-place structured-node updates, and gives agents a
10
+ first-class viewport fit operation for screenshot/review flows.
11
+
12
+ ### Added
13
+
14
+ - **`pmx-canvas fit`, `POST /api/canvas/fit`, and `canvas_fit_view`.** Agents
15
+ can fit the server viewport to the whole canvas or selected node IDs using
16
+ consistent width/height/padding/max-scale options before screenshots or
17
+ whole-board review.
18
+ - **In-place json-render and graph updates.** `node update --spec-file`, HTTP
19
+ `PATCH /api/canvas/node/<id>`, and MCP `canvas_update_node` can update
20
+ json-render specs and graph datasets/configuration without replacing the
21
+ node, preserving IDs, edges, pins, and placement.
22
+ - **Nested `node` payloads on node create/update responses.** Node responses now
23
+ include `node: { ...serializedNode }` while retaining the existing flat
24
+ `id`, `position`, `size`, and data fields for compatibility.
25
+ - **README adds reference sections for image nodes and `pmx-canvas watch`.**
26
+ The README now lists all four control surfaces (CLI, MCP, HTTP, Bun SDK)
27
+ side-by-side, documents the image node payload with provenance and
28
+ validation metadata, documents `pmx-canvas watch` semantic deltas, and
29
+ notes that bundled skills are readable as MCP resources at
30
+ `canvas://skills/<name>`.
31
+
32
+ ### Changed
33
+
34
+ - **HTTP node geometry accepts flat and nested shapes.** Create/update paths now
35
+ accept both `{ x, y, width, height }` and `{ position, size }`, with invalid
36
+ sizes still rejected instead of silently ignored.
37
+ - **Graph/json-render explicit heights are preserved in the canvas renderer.**
38
+ The client no longer auto-shrinks large explicit structured-node frames to the
39
+ generic 600px auto-fit cap.
40
+ - **MCP schema metadata advertises update and fit tools.** `canvas_describe_schema`
41
+ and `canvas://schema` include `canvas_update_node` and `canvas_fit_view` in
42
+ the tool list.
43
+ - **Agent-facing `skills/pmx-canvas/SKILL.md` documents the new operations.**
44
+ The skill now covers `canvas_fit_view`, the `node update --spec-file` flag for
45
+ in-place json-render updates, the per-graph-field flags for in-place graph
46
+ rebuilds, the `chartHeight` vs `height`/`nodeHeight` distinction, and a
47
+ caveat that `canvas_evaluate` scripts should not call PMX HTTP APIs via
48
+ `fetch()` (use the matching MCP tools instead).
49
+
50
+ ### Fixed
51
+
52
+ - **Embedded Excalidraw previews receive unscaled host dimensions.** The ext-app
53
+ host now reports layout dimensions instead of canvas-zoomed bounding boxes, so
54
+ text inside diagram boxes remains visible in inline previews instead of only
55
+ appearing after expansion.
56
+
57
+ ### Internal
58
+
59
+ - Regression coverage for HTTP/CLI/MCP fit-view parity, nested geometry inputs,
60
+ json-render and graph in-place updates, richer node response payloads, and the
61
+ structured-node auto-fit height guard. Ext-app host sizing now also covers the
62
+ zoomed-canvas case that affected embedded Excalidraw previews.
63
+ - Published-consumer e2e harness swaps the Bun stdin parser for `python3` for
64
+ portability across hosts.
65
+ - Web-artifact reusable build project no longer commits its Parcel cache.
66
+ `.parcel-cache` is now gitignored and the previously committed copy was
67
+ removed; CI no longer inherits a stale cache that prevented Parcel from
68
+ producing `dist/index.html` for the SDLC Control Room showcase build.
69
+
6
70
  ## [0.1.8] - 2026-04-25
7
71
 
8
72
  Retest-driven follow-up to 0.1.7. This next release restores compatibility
@@ -100,6 +164,7 @@ otherwise have to discover by trial and error.
100
164
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
101
165
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
102
166
 
167
+ [0.1.9]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.9
103
168
  [0.1.8]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.8
104
169
  [0.1.7]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.7
105
170
 
package/Readme.md CHANGED
@@ -27,7 +27,7 @@ pmx-canvas drives any work that benefits from making **context, relations, and p
27
27
 
28
28
  **The canvas is agnostic about what you do with it.** The reach of the workspace is the union of pmx-canvas's own node types and **whatever your agent's harness already has access to** — MCP servers, MCP apps, shell commands and CLIs, files in the working directory, web-fetch tools, anything else its toolbelt exposes. The canvas itself doesn't care where the data came from; it just needs the agent (or you) to drop it on the surface as the right node type. To make that concrete:
29
29
 
30
- - A **Jira MCP** turns the canvas into a triage board — tickets land as `markdown` nodes you can group by status and pin the in-flight ones.
30
+ - An **Atlassian MCP** or **GitHub MCP/CLI** turns the canvas into a triage board — tickets or issues land as `markdown` nodes you can group by status and pin the in-flight ones.
31
31
  - A **database MCP** turns it into an exploratory query workbench — each query result becomes a `json-render` table or `graph` node next to the `markdown` node holding the SQL.
32
32
  - An **Excalidraw MCP app** turns it into a sketch surface — diagrams open as `mcp-app` nodes you can resize and annotate.
33
33
  - A **shell-driven agent** with `gh` + `kubectl` in its harness turns it into an ops board — open issues become markdown, pod statuses become `status` nodes, the relationships you care about become edges.
@@ -200,15 +200,16 @@ For one-off local runs without linking, `bun run src/cli/index.ts ...` works too
200
200
 
201
201
  ### Recommended ways to drive the canvas
202
202
 
203
- Once the canvas is up, two control surfaces are first-class:
203
+ Once the canvas is up, pick the control surface that fits your agent or script:
204
204
 
205
205
  - **CLI** for local use, scripting, automation, and terminal-native agents.
206
206
  - **MCP** for agents that already speak the Model Context Protocol — 38 tools +
207
- 8 resources, including the bundled-skill index at `canvas://skills`.
207
+ 8 core resources, including the bundled-skill index at `canvas://skills`.
208
+ - **HTTP API** for REST/SSE clients in any language.
209
+ - **Bun SDK** for TypeScript code running on Bun.
208
210
 
209
- Both paths cover core canvas work. A few advanced capabilities (live resource
210
- subscriptions, `canvas_diff`) remain MCP-only. The HTTP API and the
211
- [Bun SDK](#javascripttypescript-sdk-bun-runtime) are also available for programmatic use.
211
+ The CLI and MCP cover normal canvas work; the reference sections below show
212
+ the exact commands, tools, and payloads.
212
213
 
213
214
  #### Connect your agent (MCP)
214
215
 
@@ -379,6 +380,24 @@ File nodes display project files with line numbers and language detection. When
379
380
  canvas_add_node({ type: 'file', content: 'src/server/index.ts' })
380
381
  ```
381
382
 
383
+ ### Image nodes
384
+
385
+ Image nodes display local paths, remote URLs, and data URIs. File-backed and
386
+ HTTP(S)-backed images preserve provenance so agents can tell where evidence
387
+ came from, and nodes can carry validation status or warnings when an agent is
388
+ using screenshots as proof.
389
+
390
+ ```typescript
391
+ canvas_add_node({
392
+ type: 'image',
393
+ content: 'artifacts/dashboard.png',
394
+ data: {
395
+ validationStatus: 'passed',
396
+ validationMessage: 'Screenshot matches the requested dashboard state.',
397
+ },
398
+ })
399
+ ```
400
+
382
401
  ### Webpage nodes
383
402
 
384
403
  Webpage nodes store the source URL on the node, fetch the page server-side, and cache extracted text for search, pins, and agent context. Saved canvases keep enough information for an agent to come back later and refresh the node from the original URL.
@@ -645,6 +664,19 @@ File nodes automatically detect import dependencies between each other. Add file
645
664
  - Auto-reconnect with exponential backoff
646
665
  - MCP resource change notifications close the human-to-agent loop
647
666
 
667
+ ### Semantic watch
668
+
669
+ `pmx-canvas watch` consumes the SSE stream and emits compact semantic deltas
670
+ for agents that need low-token updates instead of full layout snapshots. It
671
+ filters noise from harmless moves and reports meaningful events such as pins,
672
+ node additions/removals, group changes, edge connections, and moves that
673
+ change spatial clustering.
674
+
675
+ ```bash
676
+ pmx-canvas watch --events context-pin,move-end
677
+ pmx-canvas watch --json --events context-pin --max-events 1
678
+ ```
679
+
648
680
  ### WebView automation
649
681
 
650
682
  Agents can drive a headless Bun.WebView (Chromium or WebKit) pointed at their own workbench,
@@ -709,21 +741,19 @@ tool.
709
741
 
710
742
  ## Integration
711
743
 
712
- ### CLI and MCP (recommended)
713
-
714
- Use either of the two primary control surfaces depending on how your agent runs:
744
+ ### CLI and MCP alignment
715
745
 
716
- - **CLI** if your workflow is shell-native, scriptable, or driven by terminal commands
717
- - **MCP** if your agent already uses tool/resource calls over stdio
718
-
719
- Both paths are first-class for core canvas work. A few advanced capabilities, such as `canvas_diff` and MCP resource subscriptions, remain MCP-only.
720
-
721
- CLI and MCP are intentionally kept aligned for the main canvas operations, including batch builds,
722
- layout validation, graph/json-render nodes, group control, snapshots, and search-based edge creation.
746
+ CLI and MCP are kept aligned for the main canvas operations: node and edge
747
+ creation, graph/json-render nodes, web artifacts, external apps, groups,
748
+ batch builds, layout validation, snapshots, search, focus, pins, undo/redo,
749
+ semantic watch streams, WebView automation, and daemon/server control where
750
+ it applies. A few agent-native capabilities, such as resource subscriptions
751
+ and `canvas_diff`, remain MCP-only.
723
752
 
724
753
  ### MCP server
725
754
 
726
- 38 tools + 8 resources. Zero config for any MCP-capable agent.
755
+ 38 tools + 8 core resources, plus per-skill resources under `canvas://skills/<name>`.
756
+ Zero config for any MCP-capable agent.
727
757
 
728
758
  <details>
729
759
  <summary>MCP tools</summary>
@@ -774,6 +804,9 @@ layout validation, graph/json-render nodes, group control, snapshots, and search
774
804
  <details>
775
805
  <summary>MCP resources</summary>
776
806
 
807
+ The table lists the core resources. Individual bundled skills are also readable
808
+ at `canvas://skills/<name>`.
809
+
777
810
  | Resource | Description |
778
811
  |----------|-------------|
779
812
  | `canvas://pinned-context` | Content of pinned nodes + nearby unpinned neighbors |
@@ -976,6 +1009,7 @@ pmx-canvas node schema --type json-render --component Table --summary
976
1009
  pmx-canvas edge add --from-search "DVT O3 — GitOps" --to-search "deep work trend" --type relation
977
1010
  pmx-canvas batch --file ./canvas-ops.json
978
1011
  pmx-canvas validate
1012
+ pmx-canvas watch --events context-pin,move-end
979
1013
  pmx-canvas focus <node-id> --no-pan
980
1014
  pmx-canvas validate spec --type json-render --spec-file ./dashboard.json --summary
981
1015
  pmx-canvas web-artifact build --title "Dashboard" --app-file ./App.tsx --deps recharts --include-logs
@@ -1018,48 +1052,12 @@ make HTTP requests, or invoke a CLI can drive the canvas.
1018
1052
  | HTTP-only environment | REST + SSE | `fetch()` / `curl` at `http://localhost:4313/api/canvas/...` |
1019
1053
  | Bun runtime | TypeScript SDK | `import { createCanvas } from 'pmx-canvas'` |
1020
1054
 
1021
- ## Known limitations
1022
-
1023
- These are real things you'll hit and they aren't your fault — work around
1024
- them rather than chase them as bugs.
1025
-
1026
- - **Single-machine, no built-in multi-user auth.** See
1027
- [Scope](#scope) above. Sharing a canvas
1028
- across machines today means committing `.pmx-canvas/state.json`.
1029
- - **Excalidraw / external `mcp-app` flakes:** grouped Excalidraw element IDs
1030
- can change after edits, so an agent that builds a diagram in two passes
1031
- should capture every element ID immediately after `canvas_add_diagram`
1032
- returns. Editing while another tool call is in flight occasionally drops
1033
- the in-progress edit.
1034
- - **External MCP apps are transport-based over MCP.** `canvas_open_mcp_app`
1035
- requires `toolName` plus a `transport` object for the external MCP server.
1036
- For the built-in Excalidraw preset, use `canvas_add_diagram`; the CLI's
1037
- `external-app add --kind excalidraw` is a higher-level convenience wrapper.
1038
- - **Web-artifact build timeouts on cold installs.** The first
1039
- `canvas_build_web_artifact` call in a fresh workspace runs `pnpm install`
1040
- for ~30 dependencies. On constrained machines or slow networks, the
1041
- default timeout can fire before the install completes — bump
1042
- `--timeout-ms` (CLI) or `timeoutMs` (MCP/SDK) on first use, or
1043
- pre-warm with `bunx pmx-canvas web-artifact build --title warmup
1044
- --app-tsx 'export default () => null'`.
1045
- - **Webpage-fetch failure modes.** Sites that require auth, render purely
1046
- client-side without server HTML, or block headless fetches will store
1047
- with empty extracted text. The node still works as a URL bookmark; the
1048
- agent's view of the content will be the URL only.
1049
- - **Image cloud-on-demand stalls (macOS).** Images stored in iCloud Drive
1050
- / OneDrive that aren't downloaded locally are detected up-front and
1051
- rejected with a clear error rather than freezing the server. Download
1052
- the file locally first.
1053
- - **`prompt` and `response` node types are internal.** They surface in
1054
- `canvas://layout` for thread rendering but aren't created via the public
1055
- `canvas_add_node` API.
1056
-
1057
1055
  ## Architecture
1058
1056
 
1059
1057
  ```
1060
1058
  Agent harness (any MCP-capable client, CLI consumer, or HTTP caller)
1061
1059
  |
1062
- |-- MCP Server ---- 38 tools + 8 resources + change notifications
1060
+ |-- MCP Server ---- 38 tools + 8 core resources + per-skill resources + change notifications
1063
1061
  |-- Bun SDK ------- createCanvas()
1064
1062
  |-- HTTP API ------ REST + SSE at localhost:4313
1065
1063
  |