pmx-canvas 0.3.3 → 0.4.0

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 (87) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/Readme.md +13 -4
  3. package/dist/canvas/index.js +71 -71
  4. package/dist/json-render/index.js +47 -47
  5. package/dist/types/cli/agent.d.ts +13 -8
  6. package/dist/types/cli/commands/apps.d.ts +1 -0
  7. package/dist/types/cli/commands/ax.d.ts +1 -0
  8. package/dist/types/cli/commands/copilot.d.ts +1 -0
  9. package/dist/types/cli/commands/edges.d.ts +1 -0
  10. package/dist/types/cli/commands/groups.d.ts +1 -0
  11. package/dist/types/cli/commands/history.d.ts +1 -0
  12. package/dist/types/cli/commands/nodes.d.ts +1 -0
  13. package/dist/types/cli/commands/pins.d.ts +1 -0
  14. package/dist/types/cli/commands/query.d.ts +1 -0
  15. package/dist/types/cli/commands/view.d.ts +1 -0
  16. package/dist/types/cli/commands/webview.d.ts +1 -0
  17. package/dist/types/cli/shared.d.ts +73 -0
  18. package/dist/types/client/canvas/ExpandedNodeOverlay.d.ts +1 -1
  19. package/dist/types/client/index.d.ts +1 -1
  20. package/dist/types/client/nodes/ExtAppFrame.d.ts +10 -0
  21. package/dist/types/client/nodes/HtmlNode.d.ts +1 -1
  22. package/dist/types/client/nodes/McpAppNode.d.ts +1 -1
  23. package/dist/types/client/nodes/use-ax-surface-bridge.d.ts +20 -0
  24. package/dist/types/client/state/node-factory.d.ts +29 -0
  25. package/dist/types/client/uuid-polyfill.d.ts +0 -0
  26. package/dist/types/server/canvas-db.d.ts +0 -1
  27. package/dist/types/server/canvas-operations.d.ts +2 -0
  28. package/dist/types/server/canvas-state.d.ts +14 -15
  29. package/dist/types/server/diagram-presets.d.ts +8 -0
  30. package/dist/types/server/operations/composites.d.ts +6 -30
  31. package/dist/types/server/server.d.ts +1 -0
  32. package/dist/types/shared/ax-surface-protocol.d.ts +18 -0
  33. package/docs/bun-webview-integration.md +5 -0
  34. package/docs/cli.md +5 -0
  35. package/docs/environment.md +48 -0
  36. package/docs/http-api.md +25 -1
  37. package/docs/mcp.md +21 -30
  38. package/docs/node-types.md +5 -0
  39. package/docs/plans/plan-009-tech-debt-backlog.md +34 -15
  40. package/docs/screenshot.png +0 -0
  41. package/docs/tech-debt-assessment-2026-06.md +5 -5
  42. package/package.json +13 -10
  43. package/skills/pmx-canvas/SKILL.md +16 -6
  44. package/skills/pmx-canvas/evals/evals.json +7 -7
  45. package/skills/pmx-canvas/references/full-reference.md +25 -16
  46. package/src/cli/agent.ts +22 -3512
  47. package/src/cli/commands/apps.ts +165 -0
  48. package/src/cli/commands/ax.ts +604 -0
  49. package/src/cli/commands/copilot.ts +43 -0
  50. package/src/cli/commands/edges.ts +73 -0
  51. package/src/cli/commands/groups.ts +81 -0
  52. package/src/cli/commands/history.ts +220 -0
  53. package/src/cli/commands/nodes.ts +984 -0
  54. package/src/cli/commands/pins.ts +42 -0
  55. package/src/cli/commands/query.ts +223 -0
  56. package/src/cli/commands/view.ts +186 -0
  57. package/src/cli/commands/webview.ts +227 -0
  58. package/src/cli/index.ts +8 -2
  59. package/src/cli/shared.ts +861 -0
  60. package/src/client/canvas/ExpandedNodeOverlay.tsx +3 -2
  61. package/src/client/index.tsx +2 -0
  62. package/src/client/nodes/ExtAppFrame.tsx +70 -51
  63. package/src/client/nodes/HtmlNode.tsx +8 -51
  64. package/src/client/nodes/McpAppNode.tsx +12 -47
  65. package/src/client/nodes/use-ax-surface-bridge.ts +71 -0
  66. package/src/client/state/node-factory.ts +72 -0
  67. package/src/client/state/sse-bridge.ts +209 -86
  68. package/src/client/uuid-polyfill.ts +14 -0
  69. package/src/json-render/renderer/index.tsx +3 -2
  70. package/src/mcp/server.ts +0 -47
  71. package/src/server/canvas-db.ts +0 -8
  72. package/src/server/canvas-operations.ts +8 -0
  73. package/src/server/canvas-schema.ts +2 -8
  74. package/src/server/canvas-state.ts +51 -151
  75. package/src/server/diagram-presets.ts +15 -1
  76. package/src/server/html-surface.ts +11 -6
  77. package/src/server/index.ts +3 -9
  78. package/src/server/operations/composites.ts +25 -34
  79. package/src/server/operations/invoker.ts +10 -3
  80. package/src/server/operations/mcp.ts +51 -1
  81. package/src/server/operations/ops/app.ts +5 -0
  82. package/src/server/operations/ops/snapshots.ts +6 -7
  83. package/src/server/operations/registry.ts +4 -1
  84. package/src/server/server.ts +172 -74
  85. package/src/shared/ax-surface-protocol.ts +22 -0
  86. package/dist/types/client/canvas/ContextPinHud.d.ts +0 -1
  87. package/src/client/canvas/ContextPinHud.tsx +0 -17
package/CHANGELOG.md CHANGED
@@ -3,6 +3,103 @@
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.4.0] - 2026-08-04
7
+
8
+ ### Breaking
9
+
10
+ - **The `canvas_snapshot` MCP tool is now a composite** with actions `save`,
11
+ `list`, `restore`, `delete`, `gc`, and `diff`, and the 6 deprecated snapshot
12
+ standalones (`canvas_snapshot` save tool, `canvas_list_snapshots`,
13
+ `canvas_restore`, `canvas_delete_snapshot`, `canvas_gc_snapshots`,
14
+ `canvas_diff`) are removed after their deprecated 0.3.x window. The MCP
15
+ surface is now 22 tools: 16 composites + 6 standalones. Arguments are
16
+ unchanged apart from adding the `action` field; the CLI and HTTP snapshot
17
+ surfaces are unaffected.
18
+ - Pre-0.2 legacy layouts (`.pmx-canvas/state.json`, `.pmx-canvas.json`, legacy
19
+ snapshot dirs and blob files) are no longer imported on boot. Upgrade
20
+ through a 0.3.x install first if you still have one. `PMX_CANVAS_STATE_FILE`
21
+ remains only as a `.db`-path alias; other values are ignored with a warning.
22
+ - HTTP error responses are now JSON envelopes (`{ ok: false, error }`) with
23
+ unchanged status codes, instead of plain text — one error shape across every
24
+ endpoint.
25
+
26
+ ### Added
27
+
28
+ - The canvas now works behind proxies that buffer streaming responses (e.g.
29
+ Amp orb portals): if the live event stream delivers nothing shortly after
30
+ connecting, the browser switches to a polling transport
31
+ (`GET /api/workbench/poll`) that carries the same events as ordinary JSON
32
+ responses. Force a mode with `/workbench?transport=poll` or `?transport=sse`.
33
+ - `crypto.randomUUID` is polyfilled in the browser client, so the canvas also
34
+ boots in embedded pages served outside a secure context.
35
+ - `/health` reports persistence health: `persistence.ok` turns false after a
36
+ failed state save (the canvas keeps serving from memory) and true again
37
+ after the next successful save.
38
+
39
+ ### Changed
40
+
41
+ - The server now falls back to `PMX_CANVAS_PORT` when `--port` and
42
+ `PMX_WEB_CANVAS_PORT` are unset, so one variable can point the client and
43
+ server at the same port.
44
+
45
+ - `pmx-canvas node update` returns a compact `{ ok, id, position, size,
46
+ updatedFields }` envelope by default; pass `--full` for the complete node
47
+ payload (a no-op ext-app resize previously echoed ~940 KB — 0.3.4 report
48
+ Finding R).
49
+
50
+ ### Fixed
51
+
52
+ - App documents are made background-transparent so tiles that letterbox at the
53
+ document level show the theme background instead of black. Narrow or tall
54
+ Excalidraw tiles can still show the app's own dark fill below the diagram —
55
+ that part lives inside the hosted app bundle (0.3.4 report Finding Q,
56
+ documented with a sizing workaround in the skill).
57
+
58
+ ## [0.3.4] - 2026-08-03
59
+
60
+ ### Added
61
+
62
+ - A client component test harness (happy-dom + Testing Library) with the
63
+ first 20 render tests, plus dedicated suites for the semantic watch
64
+ reducer and the canvas schema (46 new tests). Test files are now
65
+ typechecked, and CI fails when total coverage drops below the recorded
66
+ floor.
67
+
68
+ ### Fixed
69
+
70
+ - App tiles now show a spinner and a "Connecting to <app>..." overlay while an
71
+ app frame boots or recovers, instead of a dark tile body (0.3.3 report: the
72
+ transient black window during automatic recovery).
73
+ - Composite tools now name the missing field when a required argument for the
74
+ chosen action is absent, instead of failing deep in the handler or silently
75
+ doing nothing.
76
+ - A pending code-graph recompute timer no longer outlives its server across
77
+ start/stop cycles.
78
+
79
+ ### Changed
80
+
81
+ - The sandboxed-surface AX bridge (the listener that validates and submits
82
+ iframe interactions) is now one shared implementation across html, app, and
83
+ viewer nodes, with the protocol tags defined in a single module. No behavior
84
+ change — this hardens a security boundary that was previously copy-pasted.
85
+ - The CLI dispatches every canvas command through the operation registry's
86
+ HTTP invoker instead of hand-written request paths; success output is
87
+ unchanged. One failure-path improvement: a failed `pmx-canvas batch` now
88
+ prints the full result envelope (`ok:false`, `failedIndex`, partial
89
+ `results`, `refs`) on stdout and exits 1, instead of a bare stderr error.
90
+
91
+ ### Docs
92
+
93
+ - WebView backend preflight: prefer webkit on macOS; the chrome backend can
94
+ show an "Allow remote debugging?" dialog that must be approved promptly, and
95
+ `PMX_CANVAS_WEBVIEW_TIMEOUT_MS` can be raised for slow starts.
96
+ - Skill evals: the two file-node eval prompts now reference the bundled
97
+ fixture paths, so a literal eval run works in any workspace.
98
+ - Web-artifact builds are documented as POSIX-only (the build pipeline runs
99
+ bash scripts); already-built artifacts render on every platform.
100
+ - All `PMX_*` environment variables are documented in
101
+ [`docs/environment.md`](docs/environment.md).
102
+
6
103
  ## [0.3.3] - 2026-07-08
7
104
 
8
105
  ### Fixed
@@ -2734,6 +2831,8 @@ otherwise have to discover by trial and error.
2734
2831
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
2735
2832
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
2736
2833
 
2834
+ [0.4.0]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.4.0
2835
+ [0.3.4]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.3.4
2737
2836
  [0.3.3]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.3.3
2738
2837
  [0.3.2]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.3.2
2739
2838
  [0.3.1]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.3.1
package/Readme.md CHANGED
@@ -98,16 +98,17 @@ vendor-specific.
98
98
 
99
99
  Spatial state auto-saves to `.pmx-canvas/canvas.db` (debounced ~500 ms) —
100
100
  git-committable, shareable across machines, and survives both browser
101
- refresh and server restart. Named [snapshots](docs/mcp.md#standalone-tools), full
101
+ refresh and server restart. Named [snapshots](docs/mcp.md), full
102
102
  undo/redo, and an auto-detected code graph (JS/TS, Python, Go, Rust) make
103
103
  the canvas durable rather than throwaway. Stop the server before committing
104
104
  the DB so SQLite WAL data is checkpointed into the file.
105
105
 
106
106
  ### 06 / Any agent
107
107
 
108
- Harness-agnostic. Drive the canvas from [MCP](docs/mcp.md) (27 tools,
108
+ Harness-agnostic. Drive the canvas from [MCP](docs/mcp.md) (22 tools,
109
109
  14 resources, change notifications), the [CLI](docs/cli.md), the
110
- [HTTP API](docs/http-api.md), or the [Bun SDK](docs/sdk.md). Works with
110
+ [HTTP API](docs/http-api.md), or the [Bun SDK](docs/sdk.md) — all
111
+ [environment variables documented here](docs/environment.md). Works with
111
112
  Claude Code, GitHub Copilot CLI, Codex, Cursor, Windsurf, or any agent
112
113
  that can spawn an MCP stdio server, call a CLI, or hit an HTTP endpoint.
113
114
 
@@ -139,6 +140,14 @@ surfaces (the core never imports a host SDK).
139
140
  `canvas_ax_state { action: "get" }` and label Codex-originated focus with
140
141
  `source: "codex"`. No extension API needed — Codex's two native surfaces
141
142
  (MCP + in-app Browser) are exactly what the canvas requires.
143
+ - **Claude Code desktop app** — the workbench runs in the desktop app's
144
+ built-in browser pane alongside the PMX MCP server, same zero-adapter recipe
145
+ as Codex: open `http://localhost:4313/workbench` in the app's browser and the
146
+ live board, pins, and Ghost Cursor all work in-panel.
147
+ - **Amp orb portals** (and other buffering proxies) — the canvas detects when
148
+ the live event stream is being buffered by the proxy and automatically
149
+ switches to a polling transport, so the board boots and stays live through
150
+ the portal with no proxy shims (`/workbench?transport=poll` forces it).
142
151
 
143
152
  The contract is host-agnostic, so a new host plugs in the same way: map its
144
153
  hooks, canvas, and session APIs onto PMX's AX primitives — no core changes.
@@ -256,7 +265,7 @@ the agent can read `canvas://skills` and pull in companion skills
256
265
  the three-tier visual matrix (json-render → html → web-artifact)
257
266
  - **[CLI reference](docs/cli.md)** — full command surface, daemon mode,
258
267
  watch streams, WebView automation
259
- - **[MCP reference](docs/mcp.md)** — 27 tools, 14 resources, change
268
+ - **[MCP reference](docs/mcp.md)** — 22 tools, 14 resources, change
260
269
  notifications, node-type routing
261
270
  - **[HTTP API](docs/http-api.md)** — REST endpoints, SSE, batch operations
262
271
  - **[AX host-adapter contract](docs/ax-host-adapter-contract.md)** — how native