pmx-canvas 0.4.5 → 0.4.6

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 (65) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/Readme.md +21 -4
  3. package/dist/canvas/global.css +68 -0
  4. package/dist/canvas/index.js +91 -70
  5. package/dist/canvas/mermaid-entry.js +3563 -0
  6. package/dist/json-render/index.css +1 -1
  7. package/dist/types/cli/agent.d.ts +1 -0
  8. package/dist/types/cli/commands/smoke.d.ts +1 -0
  9. package/dist/types/client/mermaid-entry.d.ts +11 -0
  10. package/dist/types/client/nodes/DiffNode.d.ts +20 -0
  11. package/dist/types/client/nodes/ExtAppFrame.d.ts +0 -2
  12. package/dist/types/client/nodes/MermaidNode.d.ts +12 -0
  13. package/dist/types/client/types.d.ts +2 -2
  14. package/dist/types/server/canvas-provenance.d.ts +1 -1
  15. package/dist/types/server/canvas-state.d.ts +10 -1
  16. package/dist/types/server/canvas-validation.d.ts +34 -1
  17. package/dist/types/server/html-surface.d.ts +8 -0
  18. package/dist/types/server/index.d.ts +5 -0
  19. package/dist/types/server/operations/ops/nodes.d.ts +1 -1
  20. package/dist/types/server/workboard.d.ts +46 -0
  21. package/dist/types/shared/ax-surface-protocol.d.ts +7 -0
  22. package/docs/cli.md +12 -0
  23. package/docs/http-api.md +12 -0
  24. package/docs/mcp.md +1 -1
  25. package/docs/node-types.md +2 -0
  26. package/docs/screenshot.png +0 -0
  27. package/package.json +4 -3
  28. package/skills/pmx-canvas/SKILL.md +56 -19
  29. package/skills/pmx-canvas-testing/SKILL.md +3 -0
  30. package/src/cli/agent.ts +2 -0
  31. package/src/cli/commands/ax.ts +28 -3
  32. package/src/cli/commands/smoke.ts +212 -0
  33. package/src/cli/index.ts +1 -0
  34. package/src/cli/shared.ts +1 -0
  35. package/src/client/canvas/CanvasViewport.tsx +6 -0
  36. package/src/client/canvas/ExpandedNodeOverlay.tsx +10 -0
  37. package/src/client/canvas/Minimap.tsx +2 -0
  38. package/src/client/canvas/auto-fit.ts +2 -0
  39. package/src/client/icons.tsx +4 -0
  40. package/src/client/mermaid-entry.ts +76 -0
  41. package/src/client/nodes/DiffNode.tsx +114 -0
  42. package/src/client/nodes/ExtAppFrame.tsx +259 -84
  43. package/src/client/nodes/MermaidNode.tsx +81 -0
  44. package/src/client/state/node-factory.ts +2 -0
  45. package/src/client/state/sse-bridge.ts +28 -0
  46. package/src/client/theme/global.css +68 -0
  47. package/src/client/types.ts +6 -0
  48. package/src/mcp/server.ts +19 -1
  49. package/src/server/ax-interaction.ts +6 -0
  50. package/src/server/canvas-operations.ts +39 -9
  51. package/src/server/canvas-provenance.ts +2 -0
  52. package/src/server/canvas-schema.ts +33 -0
  53. package/src/server/canvas-state.ts +26 -0
  54. package/src/server/canvas-validation.ts +79 -0
  55. package/src/server/html-surface.ts +11 -0
  56. package/src/server/index.ts +25 -6
  57. package/src/server/operations/composites.ts +3 -2
  58. package/src/server/operations/ops/batch.ts +8 -0
  59. package/src/server/operations/ops/json-render.ts +44 -0
  60. package/src/server/operations/ops/nodes.ts +9 -1
  61. package/src/server/operations/ops/viewport.ts +8 -1
  62. package/src/server/server.ts +48 -1
  63. package/src/server/workboard.ts +159 -0
  64. package/src/shared/ax-surface-protocol.ts +8 -0
  65. package/src/shared/surface.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,61 @@
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.6] - 2026-08-08
7
+
8
+ ### Added
9
+
10
+ - A `pmx-canvas smoke` command: one-command check that a running canvas works
11
+ in the current environment — server health + workspace, CLI/server version
12
+ skew, MCP initialize handshake, a temporary node create/search/remove
13
+ round-trip, and board validation. JSON report, exit 1 on failure.
14
+ - The `/health` endpoint now reports the server's package `version`, so tools
15
+ can detect version skew between a CLI and the daemon it targets.
16
+ - The CLI now accepts `--agent-id` on `ax work add/update` and `ax event add`,
17
+ and `--agent-id` / `--target` on `ax steer`; the SDK's work, event, and
18
+ steering methods accept the same identity fields.
19
+ - The skill now teaches in-view placement and content sizing: focus or fit
20
+ newly created user-facing nodes, use per-type default sizes, and keep AX
21
+ state reads lean.
22
+ - A new `diff` node type: unified diffs render with per-file headers, hunk
23
+ rows, and colored added/removed lines instead of a plain code fence.
24
+ - A new `mermaid` node type: flowcharts, sequence and state diagrams render
25
+ client-side from mermaid text — no hosted app needed; Excalidraw remains
26
+ for interactive drawing.
27
+ - A live work-item board: `canvas_render { action: "workboard" }` (HTTP
28
+ `POST /api/canvas/workboard`) materializes one board node showing all AX
29
+ work items by status, and it refreshes automatically whenever work items
30
+ change.
31
+
32
+ ### Changed
33
+
34
+ - **Nodes created with unreadably small explicit sizes are now clamped up to a
35
+ per-type minimum.** A request for e.g. 200x100 now yields a readable
36
+ default-ish size instead; pass `strictSize: true` to keep a genuinely small
37
+ fixed frame. `validate` reports any undersized nodes as advisory size
38
+ warnings. Agents doing their own layout arithmetic should read back the
39
+ created size (or set `strictSize`).
40
+ - The README's MCP and Amp orb setup guides now cover portable configs: pin
41
+ the package version in orb setup scripts and avoid hard-coding an absolute
42
+ `PMX_CANVAS_WORKSPACE_ROOT` in committed MCP configs.
43
+ - Focus margins are now screen-space and zoom-aware, so a focused node clears
44
+ the floating toolbar at any scale.
45
+
46
+ ### Fixed
47
+
48
+ - A browser panel left open across a `pmx-canvas` upgrade now reloads itself
49
+ once on reconnect instead of silently running the old client bundle (which
50
+ hid new client behavior such as the auto-ghost minimum dwell).
51
+ - A batch that pins nodes now updates the browser's pin state immediately —
52
+ the context menu no longer shows a stale "Pin as context" until reload.
53
+ - The MCP stdio server now exits when its client closes the connection instead
54
+ of remaining as an orphaned process.
55
+ - Black app tiles in WebKit host panels (e.g. the GitHub Copilot app): hosted
56
+ app frames now boot one at a time, confirm they actually painted via a paint
57
+ probe, and recover automatically when they did not — soft resize, then
58
+ remount, then an explicit Retry button instead of a silent black tile. The
59
+ loading overlay stays up until the paint is confirmed.
60
+
6
61
  ## [0.4.5] - 2026-08-07
7
62
 
8
63
  ### Added
@@ -2989,6 +3044,7 @@ otherwise have to discover by trial and error.
2989
3044
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
2990
3045
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
2991
3046
 
3047
+ [0.4.6]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.4.6
2992
3048
  [0.4.5]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.4.5
2993
3049
  [0.4.4]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.4.4
2994
3050
  [0.4.3]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.4.3
package/Readme.md CHANGED
@@ -228,7 +228,21 @@ Add to your agent's MCP config:
228
228
  }
229
229
  ```
230
230
 
231
- The canvas auto-starts on first tool call.
231
+ The canvas auto-starts on first tool call. Keep the config portable: commit it
232
+ to the repo and let the workspace default to the launch directory — hard-coding
233
+ an absolute `PMX_CANVAS_WORKSPACE_ROOT` breaks other checkouts and machines.
234
+ Set that env var only when your host spawns the MCP server from an incidental
235
+ directory (e.g. `~/.copilot`) instead of the project root.
236
+
237
+ Verify any environment in one command against a running server:
238
+
239
+ ```bash
240
+ bunx pmx-canvas smoke
241
+ ```
242
+
243
+ It checks server health + workspace, CLI/server version skew, the MCP stdio
244
+ initialize handshake, a temp-node create/search/remove round-trip, and board
245
+ validation — JSON report, exit 1 on failure.
232
246
 
233
247
  ### Use inside the GitHub Copilot app
234
248
 
@@ -274,8 +288,9 @@ services:
274
288
  ```
275
289
 
276
290
  ```bash
277
- # .agents/setup — install the CLI (pin the version for reproducible starts)
278
- npm install -g pmx-canvas@latest
291
+ # .agents/setup — install the CLI (pin the exact version: a fresh orb running
292
+ # @latest can silently pick up a newer release than the one you validated)
293
+ npm install -g pmx-canvas@0.4.5
279
294
  ```
280
295
 
281
296
  The server binds the portal-assigned `$PORT` automatically (gated on the
@@ -291,7 +306,9 @@ inline via `srcdoc` with their theme styling included. Cross-origin hosted
291
306
  apps (e.g. the hosted Excalidraw MCP app) cannot be inlined and may stay
292
307
  blocked by the portal embed — everything served from the canvas itself works.
293
308
  Debug overrides: `/workbench?transport=poll|sse` and
294
- `?iframe-mode=srcdoc|src`.
309
+ `?iframe-mode=srcdoc|src`. Once the service is up, `pmx-canvas smoke` verifies
310
+ the whole stack (health, versions, MCP handshake, node lifecycle, validation)
311
+ in one command.
295
312
 
296
313
  ### Install the agent skill (recommended)
297
314
 
@@ -1895,6 +1895,74 @@ html.is-node-resizing .ext-app-preview-catcher {
1895
1895
  }
1896
1896
  }
1897
1897
 
1898
+ /* Diff nodes — unified diff viewer with per-file sections */
1899
+ .diff-node {
1900
+ display: flex;
1901
+ flex-direction: column;
1902
+ gap: 10px;
1903
+ height: 100%;
1904
+ overflow: auto;
1905
+ font-family: var(--mono);
1906
+ font-size: 12px;
1907
+ color: var(--c-text);
1908
+ }
1909
+
1910
+ .diff-node.diff-node-empty {
1911
+ align-items: center;
1912
+ justify-content: center;
1913
+ color: var(--c-muted);
1914
+ }
1915
+
1916
+ .diff-node .diff-file {
1917
+ border: 1px solid var(--c-line);
1918
+ border-radius: 6px;
1919
+ overflow: hidden;
1920
+ flex-shrink: 0;
1921
+ }
1922
+
1923
+ .diff-node .diff-file-header {
1924
+ padding: 4px 8px;
1925
+ background: var(--c-panel-overlay);
1926
+ border-bottom: 1px solid var(--c-line);
1927
+ color: var(--c-text-soft);
1928
+ font-weight: 600;
1929
+ white-space: nowrap;
1930
+ overflow: hidden;
1931
+ text-overflow: ellipsis;
1932
+ }
1933
+
1934
+ .diff-node .diff-lines {
1935
+ margin: 0;
1936
+ padding: 4px 0;
1937
+ overflow-x: auto;
1938
+ font-family: inherit;
1939
+ font-size: inherit;
1940
+ line-height: 1.5;
1941
+ }
1942
+
1943
+ .diff-node .diff-lines > div {
1944
+ padding: 0 8px;
1945
+ white-space: pre;
1946
+ }
1947
+
1948
+ .diff-node .diff-hunk {
1949
+ color: var(--c-muted);
1950
+ }
1951
+
1952
+ .diff-node .diff-line-add {
1953
+ color: var(--c-ok);
1954
+ background: var(--c-ok-10);
1955
+ }
1956
+
1957
+ .diff-node .diff-line-remove {
1958
+ color: var(--c-danger);
1959
+ background: var(--c-danger-12);
1960
+ }
1961
+
1962
+ .diff-node .diff-line-context {
1963
+ color: var(--c-text-soft);
1964
+ }
1965
+
1898
1966
  /* Docked node — compact toolbar-flanking panel */
1899
1967
  .docked-node {
1900
1968
  min-width: 200px;