pmx-canvas 0.1.20 → 0.1.21

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 (37) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/canvas/global.css +88 -0
  3. package/dist/canvas/index.js +87 -53
  4. package/dist/types/client/nodes/HtmlNode.d.ts +12 -1
  5. package/dist/types/client/types.d.ts +1 -1
  6. package/dist/types/server/html-node-summary.d.ts +2 -0
  7. package/dist/types/server/html-primitives.d.ts +9 -1
  8. package/dist/types/server/index.d.ts +8 -1
  9. package/docs/http-api.md +1 -1
  10. package/docs/mcp.md +4 -0
  11. package/docs/node-types.md +27 -5
  12. package/docs/screenshot.png +0 -0
  13. package/docs/sdk.md +1 -0
  14. package/package.json +1 -1
  15. package/skills/pmx-canvas/SKILL.md +10 -4
  16. package/skills/pmx-canvas/references/html-primitives.md +132 -0
  17. package/src/cli/agent.ts +9 -0
  18. package/src/cli/index.ts +1 -1
  19. package/src/client/App.tsx +1 -1
  20. package/src/client/canvas/CommandPalette.tsx +1 -1
  21. package/src/client/canvas/ExpandedNodeOverlay.tsx +105 -2
  22. package/src/client/canvas/auto-fit.ts +5 -1
  23. package/src/client/nodes/HtmlNode.tsx +125 -13
  24. package/src/client/state/sse-bridge.ts +1 -1
  25. package/src/client/theme/global.css +88 -0
  26. package/src/mcp/canvas-access.ts +31 -1
  27. package/src/mcp/server.ts +17 -3
  28. package/src/server/agent-context.ts +23 -1
  29. package/src/server/canvas-operations.ts +10 -2
  30. package/src/server/canvas-provenance.ts +8 -6
  31. package/src/server/canvas-schema.ts +11 -0
  32. package/src/server/canvas-serialization.ts +10 -5
  33. package/src/server/html-node-summary.ts +141 -0
  34. package/src/server/html-primitives.ts +318 -8
  35. package/src/server/index.ts +22 -3
  36. package/src/server/server.ts +17 -4
  37. package/src/server/spatial-analysis.ts +4 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,90 @@
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.21] - 2026-05-09
7
+
8
+ HTML communication maturity pass on top of 0.1.20. Adds a
9
+ `presentation` primitive kind (PowerPoint-style decks with themes),
10
+ turns every html node into a first-class agent context surface with
11
+ semantic sidecars (summary, agent summary, description, slide
12
+ titles, embedded refs), wires a real Present-mode overlay with
13
+ iframe-focused keyboard navigation and a live theme bridge, and
14
+ routes the `pmx-canvas html` subcommand correctly through the agent
15
+ CLI.
16
+
17
+ ### Added
18
+
19
+ - **New `presentation` HTML primitive kind.** `canvas_add_html_primitive
20
+ --kind presentation` generates a PowerPoint-style fullscreen deck
21
+ inside the standard sandboxed `html` node and persists the deck
22
+ metadata (`presentation: true`, `slideCount`, `slideTitles`,
23
+ optional `presentationTheme`). Themes: `canvas`, `midnight`,
24
+ `paper`, `aurora`, or a custom color object with `bg`, `panel`,
25
+ `surface`, `border`, `text`, `textSecondary`, `textMuted`,
26
+ `accent`, and `colorScheme`. The MCP canvas now exposes 19 HTML
27
+ primitives (was 18).
28
+ - **HTML node semantic sidecars.** Every html node can now carry
29
+ agent-readable metadata that agents see without parsing the
30
+ iframe payload: `summary`, `agentSummary`, `description`,
31
+ `presentation`, `slideTitles`, `embeddedNodeIds`, `embeddedUrls`.
32
+ Same surface lands on CLI (`pmx-canvas node add --type html
33
+ --summary "..." --agent-summary "..." --description "..."
34
+ --presentation true --slide-title "..." --embedded-node-id ...`),
35
+ HTTP `POST /api/canvas/node`, MCP `canvas_add_html_node`, SDK
36
+ `PmxCanvas.addHtmlNode()`, and `canvas_describe_schema`.
37
+ `agent-context` and `canvas://pinned-context` now expose this
38
+ metadata for HTML nodes.
39
+ - **Auto-derived `contentSummary` for html nodes.** When the agent
40
+ doesn't supply an explicit summary, PMX runs the rendered HTML
41
+ through a new `summarizeHtmlText()` (in
42
+ `src/server/html-node-summary.ts`) to extract a bounded plain-
43
+ text summary that drives search, pinned context, and spatial
44
+ context. `normalizeHtmlNodeSemanticData()` keeps existing
45
+ provenance and semantic fields stable across edits.
46
+ - **Browser-side Present mode.** Presentation-marked html nodes
47
+ surface a Present button in `ExpandedNodeOverlay` that opens a
48
+ fullscreen overlay with the deck iframe focused. Arrow keys,
49
+ Page Up/Down, Space, Home, and End are forwarded into the iframe
50
+ via a token-scoped postMessage bridge, and pressing Escape inside
51
+ the iframe exits via the same bridge. A live theme bridge
52
+ re-injects the canvas theme tokens into the iframe whenever the
53
+ theme changes, so present mode reflects light/dark toggles
54
+ instantly.
55
+ - **`html-primitives.md` skill reference.** New 132-line authoring
56
+ guide under `skills/pmx-canvas/references/` covers when to use
57
+ primitives versus `canvas_add_html_node` versus
58
+ `canvas_build_web_artifact`, the catalog, and shared design
59
+ language.
60
+
61
+ ### Changed
62
+
63
+ - **`canvas_add_html_node` clarifies presentation is opt-in.** The
64
+ MCP tool description now states explicitly that presentation
65
+ mode is opt-in (pass `presentation: true` or use the
66
+ `presentation` primitive) — normal html nodes remain the default
67
+ for reports, widgets, and bespoke visualizations.
68
+ - **Auto-fit no longer shrinks presentation html nodes.** Like
69
+ graph and json-render frames, presentation-marked html nodes
70
+ keep their explicit width and height so decks aren't squeezed
71
+ by the content-fit pass.
72
+ - **`pmx-canvas html` subcommand routes through the agent CLI.**
73
+ Same fix as the earlier `fit` and `screenshot` routing issues —
74
+ `html` is now in the `AGENT_COMMANDS` set in `src/cli/index.ts`
75
+ so it doesn't get treated as a server-startup invocation.
76
+
77
+ ### Internal
78
+
79
+ - Regression coverage for: HTML node semantic sidecars persisting
80
+ through CLI/HTTP/MCP, presentation primitives storing slide
81
+ metadata and theme metadata (named + custom), agent context
82
+ exposing html sidecars and presentation metadata, auto-fit
83
+ excluding presentation html frames, the `html` CLI routing,
84
+ client-side present-mode behavior (only explicit presentation
85
+ html nodes can present; theme bridge injected; srcdoc marker
86
+ distinguishes review vs present mode), live theme update on
87
+ present-mode iframe (e2e), and present mode focusing iframe
88
+ keyboard navigation while hiding review hints (e2e).
89
+
6
90
  ## [0.1.20] - 2026-05-06
7
91
 
8
92
  A bigger feature release. Adds 18 reusable HTML communication
@@ -897,6 +981,7 @@ otherwise have to discover by trial and error.
897
981
  - Regression coverage for snapshot flat-`id` aliases on both MCP and
898
982
  HTTP surfaces, plus async / top-level-`await` WebView script bodies.
899
983
 
984
+ [0.1.21]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.21
900
985
  [0.1.20]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.20
901
986
  [0.1.19]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.19
902
987
  [0.1.18]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.18
@@ -2438,6 +2438,18 @@ body,
2438
2438
  border-color: var(--c-muted);
2439
2439
  }
2440
2440
 
2441
+ .expanded-action-btn.expanded-action-primary {
2442
+ background: var(--c-accent-12);
2443
+ border-color: var(--c-accent-30);
2444
+ color: var(--c-accent);
2445
+ }
2446
+
2447
+ .expanded-action-btn.expanded-action-primary:hover {
2448
+ background: var(--c-accent-25);
2449
+ border-color: var(--c-accent);
2450
+ color: var(--c-text);
2451
+ }
2452
+
2441
2453
  .expanded-action-btn.expanded-action-active {
2442
2454
  background: var(--c-warn-12);
2443
2455
  border-color: var(--c-warn-30);
@@ -2455,6 +2467,82 @@ body,
2455
2467
  padding: 0 4px;
2456
2468
  }
2457
2469
 
2470
+ .html-presentation-overlay {
2471
+ position: fixed;
2472
+ inset: 0;
2473
+ z-index: 10050;
2474
+ display: flex;
2475
+ flex-direction: column;
2476
+ gap: 14px;
2477
+ padding: clamp(12px, 2vw, 28px);
2478
+ background:
2479
+ radial-gradient(circle at top left, var(--c-accent-25), transparent 36rem),
2480
+ rgba(3, 7, 18, 0.96);
2481
+ color: var(--c-text);
2482
+ }
2483
+
2484
+ .html-presentation-toolbar {
2485
+ display: flex;
2486
+ align-items: center;
2487
+ justify-content: space-between;
2488
+ gap: 16px;
2489
+ flex-shrink: 0;
2490
+ padding: 10px 12px;
2491
+ border: 1px solid var(--c-line);
2492
+ border-radius: 16px;
2493
+ background: var(--c-panel-glass);
2494
+ box-shadow: 0 18px 50px var(--c-shadow-heavy);
2495
+ }
2496
+
2497
+ .html-presentation-kicker {
2498
+ color: var(--c-accent);
2499
+ font-size: 10px;
2500
+ font-weight: 800;
2501
+ letter-spacing: 0.14em;
2502
+ text-transform: uppercase;
2503
+ }
2504
+
2505
+ .html-presentation-title {
2506
+ max-width: min(72vw, 900px);
2507
+ overflow: hidden;
2508
+ color: var(--c-text);
2509
+ font-size: 14px;
2510
+ font-weight: 700;
2511
+ text-overflow: ellipsis;
2512
+ white-space: nowrap;
2513
+ }
2514
+
2515
+ .html-presentation-exit {
2516
+ flex-shrink: 0;
2517
+ padding: 8px 12px;
2518
+ border: 1px solid var(--c-line);
2519
+ border-radius: 999px;
2520
+ background: var(--c-panel-soft);
2521
+ color: var(--c-text-soft);
2522
+ cursor: pointer;
2523
+ font: 600 12px/1 var(--font);
2524
+ }
2525
+
2526
+ .html-presentation-exit:hover {
2527
+ border-color: var(--c-accent);
2528
+ color: var(--c-text);
2529
+ }
2530
+
2531
+ .html-presentation-stage {
2532
+ flex: 1;
2533
+ min-height: 0;
2534
+ display: flex;
2535
+ border-radius: 22px;
2536
+ background: var(--c-bg);
2537
+ box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55);
2538
+ overflow: hidden;
2539
+ }
2540
+
2541
+ .html-node-frame-presentation {
2542
+ flex: 1;
2543
+ min-height: 0;
2544
+ }
2545
+
2458
2546
  /* ── Context pin button on node title bar ────────────────────── */
2459
2547
  .node-controls .ctx-pin-btn {
2460
2548
  color: var(--c-muted);