pmx-canvas 0.1.18 → 0.1.20

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 (70) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/Readme.md +19 -6
  3. package/dist/canvas/global.css +35 -2
  4. package/dist/canvas/index.js +70 -69
  5. package/dist/json-render/index.js +109 -109
  6. package/dist/types/client/canvas/CanvasViewport.d.ts +1 -1
  7. package/dist/types/client/icons.d.ts +2 -0
  8. package/dist/types/client/state/canvas-store.d.ts +2 -0
  9. package/dist/types/client/types.d.ts +2 -1
  10. package/dist/types/json-render/charts/components.d.ts +5 -1
  11. package/dist/types/json-render/renderer/index.d.ts +1 -0
  12. package/dist/types/json-render/server.d.ts +1 -0
  13. package/dist/types/mcp/canvas-access.d.ts +3 -0
  14. package/dist/types/server/canvas-operations.d.ts +4 -0
  15. package/dist/types/server/canvas-schema.d.ts +19 -3
  16. package/dist/types/server/canvas-serialization.d.ts +1 -0
  17. package/dist/types/server/canvas-state.d.ts +8 -2
  18. package/dist/types/server/html-primitives.d.ts +34 -0
  19. package/dist/types/server/index.d.ts +19 -0
  20. package/docs/RELEASE.md +153 -0
  21. package/docs/bun-webview-integration.md +296 -0
  22. package/docs/cli.md +143 -0
  23. package/docs/evals/e2e-cli-coverage.md +61 -0
  24. package/docs/http-api.md +201 -0
  25. package/docs/mcp.md +137 -0
  26. package/docs/node-types.md +272 -0
  27. package/docs/plans/.gitkeep +0 -0
  28. package/docs/plans/plan-001-semantic-watch-mvp.md +335 -0
  29. package/docs/plans/plan-002-human-attention-layer-design-spec.md +679 -0
  30. package/docs/plans/plan-003-human-attention-layer-implementation-plan.md +572 -0
  31. package/docs/reactive-canvas-proposal.md +578 -0
  32. package/docs/release-review-0.1.0.md +38 -0
  33. package/docs/screenshot.png +0 -0
  34. package/docs/screenshots/demo-workbench-dark.png +0 -0
  35. package/docs/screenshots/demo-workbench-light.png +0 -0
  36. package/docs/screenshots/welcome-dark.png +0 -0
  37. package/docs/screenshots/welcome-light.png +0 -0
  38. package/docs/sdk.md +103 -0
  39. package/package.json +2 -1
  40. package/skills/pmx-canvas/SKILL.md +8 -0
  41. package/src/cli/agent.ts +167 -5
  42. package/src/client/App.tsx +20 -1
  43. package/src/client/canvas/AnnotationLayer.tsx +33 -12
  44. package/src/client/canvas/CanvasViewport.tsx +88 -7
  45. package/src/client/canvas/CommandPalette.tsx +1 -1
  46. package/src/client/canvas/ContextMenu.tsx +2 -2
  47. package/src/client/canvas/ExpandedNodeOverlay.tsx +7 -1
  48. package/src/client/icons.tsx +13 -0
  49. package/src/client/nodes/McpAppNode.tsx +12 -4
  50. package/src/client/state/canvas-store.ts +15 -5
  51. package/src/client/state/sse-bridge.ts +4 -3
  52. package/src/client/theme/global.css +35 -2
  53. package/src/client/types.ts +2 -1
  54. package/src/json-render/charts/components.tsx +41 -7
  55. package/src/json-render/charts/extra-components.tsx +13 -12
  56. package/src/json-render/renderer/index.tsx +1 -0
  57. package/src/json-render/server.ts +3 -1
  58. package/src/mcp/canvas-access.ts +25 -0
  59. package/src/mcp/server.ts +85 -27
  60. package/src/server/agent-context.ts +17 -0
  61. package/src/server/canvas-operations.ts +91 -38
  62. package/src/server/canvas-schema.ts +83 -3
  63. package/src/server/canvas-serialization.ts +9 -2
  64. package/src/server/canvas-state.ts +27 -9
  65. package/src/server/demo-state.json +1143 -0
  66. package/src/server/demo.ts +25 -777
  67. package/src/server/html-primitives.ts +990 -0
  68. package/src/server/index.ts +43 -2
  69. package/src/server/server.ts +140 -14
  70. package/src/server/spatial-analysis.ts +3 -3
@@ -0,0 +1,679 @@
1
+ ---
2
+ title: Human Attention Layer Design Spec
3
+ status: draft
4
+ date: 2026-04-18
5
+ ---
6
+
7
+ # Human Attention Layer Design Spec
8
+
9
+ ## Summary
10
+
11
+ This spec defines the **human-facing UX layer** that should sit on top of the
12
+ semantic watcher model already established for agents.
13
+
14
+ The goal is simple:
15
+
16
+ > The human side of PMX Canvas should feel as good as, and ideally better than,
17
+ > the agent side.
18
+
19
+ Today the product has the right semantic model for the agent:
20
+
21
+ - server-authoritative context pins
22
+ - spatial semantics
23
+ - semantic watch output
24
+
25
+ But the human UI still behaves mostly like a capable canvas editor with a few
26
+ agent-oriented affordances.
27
+
28
+ This spec changes that. It defines a visible, tastefully dramatic
29
+ **Agent Attention Layer** so the human can see:
30
+
31
+ - what they changed
32
+ - what the system understood
33
+ - how that changed the agent’s attention
34
+
35
+ ## Product Thesis
36
+
37
+ PMX Canvas should not feel like “a node editor with agent integrations.”
38
+
39
+ It should feel like:
40
+
41
+ > a human command surface for shaping agent attention through space.
42
+
43
+ That means the interface must do three things well:
44
+
45
+ 1. Show **human authorship**
46
+ 2. Show **system interpretation**
47
+ 3. Show **agent consequence**
48
+
49
+ The product is successful when the human can rearrange, pin, group, or connect
50
+ nodes and immediately feel:
51
+
52
+ > “The board understood me.”
53
+
54
+ ## Design Direction
55
+
56
+ ### Concept
57
+
58
+ **Editorial Mission Control**
59
+
60
+ This is the target mood and visual language.
61
+
62
+ Not cyberpunk.
63
+ Not terminal cosplay.
64
+ Not generic dark-glass developer tooling.
65
+
66
+ Instead:
67
+
68
+ - refined
69
+ - information-dense but calm
70
+ - high-contrast and intentional
71
+ - spatially expressive
72
+ - visibly interpretive
73
+
74
+ The canvas should feel like an operations desk for thought, where every gesture
75
+ has consequence and every consequence is made legible.
76
+
77
+ ### Human Role
78
+
79
+ The human is not “using a tool.”
80
+
81
+ The human is:
82
+
83
+ - curating focus
84
+ - staging evidence
85
+ - composing relationships
86
+ - steering the agent’s working memory
87
+
88
+ The interface should center that role at all times.
89
+
90
+ ### Agent Role
91
+
92
+ The agent is powerful, but visually secondary.
93
+
94
+ The UI should not feel like “the AI did something.” It should feel like:
95
+
96
+ > “The system reflected the meaning of my edit.”
97
+
98
+ ## Design Goals
99
+
100
+ - Make context curation visually primary
101
+ - Make semantic interpretation visible within one beat of the user action
102
+ - Suppress raw noise and show only meaningful changes
103
+ - Create trust by exposing what changed for the agent
104
+ - Preserve the canvas as the main stage; feedback must clarify the board, not
105
+ compete with it
106
+
107
+ ## Non-Goals
108
+
109
+ - Do not expose raw watcher output directly in the UI
110
+ - Do not show every drag or selection event
111
+ - Do not add “AI personality” chrome for its own sake
112
+ - Do not turn the canvas into a chat app or notification center
113
+ - Do not create a second state model separate from server-authoritative canvas
114
+ state
115
+
116
+ ## Core UX Model
117
+
118
+ Every meaningful human action should pass through this loop:
119
+
120
+ 1. The human changes the canvas
121
+ 2. The canvas interprets the semantic change
122
+ 3. The UI acknowledges the interpretation
123
+ 4. The updated agent attention state becomes visible
124
+
125
+ This loop must feel immediate, calm, and consequential.
126
+
127
+ ## Primary UI Addition: Agent Attention Layer
128
+
129
+ Add a thin but highly legible UI layer above the existing canvas.
130
+
131
+ This layer has three parts:
132
+
133
+ 1. Live Semantic Feedback
134
+ 2. Persistent Focus Field
135
+ 3. Recent Interpretation History
136
+
137
+ These three surfaces are enough for MVP-level human UX without redesigning the
138
+ entire product.
139
+
140
+ ---
141
+
142
+ ## 1. Live Semantic Feedback
143
+
144
+ ### Purpose
145
+
146
+ Provide immediate acknowledgment that a human action changed the system’s
147
+ understanding.
148
+
149
+ This is the “the board saw you” layer.
150
+
151
+ ### UI Form
152
+
153
+ A compact semantic feedback ribbon or toast that appears in the upper-right or
154
+ upper-center region, close to existing HUD chrome but visually distinct from
155
+ toolbar controls.
156
+
157
+ ### Content Rules
158
+
159
+ The feedback must be:
160
+
161
+ - short
162
+ - semantic
163
+ - plainspoken
164
+ - visually anchored to the affected canvas region when possible
165
+
166
+ It must not be:
167
+
168
+ - verbose
169
+ - technical
170
+ - log-like
171
+ - raw event vocabulary
172
+
173
+ ### Example Messages
174
+
175
+ - `Pinned context updated`
176
+ - `Bug report is now in focus`
177
+ - `Cluster formed around auth work`
178
+ - `auth.ts entered bug-report neighborhood`
179
+ - `Relationship added between incident note and auth.ts`
180
+ - `Pinned neighborhood expanded`
181
+
182
+ ### Message Structure
183
+
184
+ Each message should contain:
185
+
186
+ - a semantic label
187
+ - optional affected object names
188
+ - optional direction of change
189
+
190
+ Examples:
191
+
192
+ - `Context updated: Bug report, auth.ts`
193
+ - `Cluster formed: auth.ts, session.ts, incident note`
194
+ - `Neighborhood changed around Bug report`
195
+
196
+ ### Timing
197
+
198
+ - show within 150–250ms after the semantic change is known
199
+ - visible for 1.8s to 2.8s depending on message length
200
+ - fade out softly if not interacted with
201
+
202
+ ### Interaction
203
+
204
+ Optional for later:
205
+
206
+ - hover can freeze the message
207
+ - clicking a message can focus or frame the relevant nodes
208
+
209
+ ### Visual Style
210
+
211
+ - thin panel, not a chunky notification card
212
+ - high contrast against the background
213
+ - restrained glow
214
+ - typography stronger than body text but quieter than a headline
215
+ - should feel editorial, not OS-native
216
+
217
+ ### Motion
218
+
219
+ - slide in 8–12px
220
+ - slight opacity fade
221
+ - no bounce
222
+ - no springy overshoot
223
+ - affected nodes can receive a synchronized single pulse
224
+
225
+ ---
226
+
227
+ ## 2. Persistent Focus Field
228
+
229
+ ### Purpose
230
+
231
+ Show what is currently active in the agent’s working set.
232
+
233
+ This replaces the weak “count pill + bottom bar” experience with something that
234
+ feels spatial and meaningful.
235
+
236
+ ### UX Principle
237
+
238
+ Context is not just a set of pinned nodes.
239
+
240
+ Context is a **field**:
241
+
242
+ - explicit pinned nodes
243
+ - nearby inferred neighbors
244
+ - visible composition of the current working set
245
+
246
+ ### UI Form
247
+
248
+ A subtle but persistent spatial treatment applied directly on the canvas:
249
+
250
+ - pinned nodes get the strongest emphasis
251
+ - inferred neighbors get a secondary emphasis
252
+ - the region connecting them reads as one focus field
253
+
254
+ ### Behavior
255
+
256
+ When the pinned set changes:
257
+
258
+ - the field re-forms around the new working set
259
+ - affected nodes transition into or out of the field
260
+ - neighboring implied context becomes gently visible
261
+
262
+ ### Visual Treatment
263
+
264
+ Pinned nodes:
265
+
266
+ - strong but tasteful border/accent
267
+ - brighter titlebar or node badge state
268
+ - shallow halo or inner edge
269
+
270
+ Neighborhood nodes:
271
+
272
+ - softer edge treatment
273
+ - low-opacity background wash or region highlight
274
+ - clearly related, but visually subordinate to explicit pins
275
+
276
+ Field region:
277
+
278
+ - very low-opacity pooled wash
279
+ - no cartoon blob
280
+ - should feel like air pressure or magnetic attention, not paint
281
+
282
+ ### What It Solves
283
+
284
+ - answers “what matters right now?”
285
+ - makes the agent working set visible at a glance
286
+ - lets the human understand whether a rearrangement changed semantic proximity
287
+
288
+ ### What To Avoid
289
+
290
+ - giant glowing blobs
291
+ - constant pulsation
292
+ - ambiguous selection-like styling
293
+ - making context state look identical to regular UI focus or hover
294
+
295
+ ---
296
+
297
+ ## 3. Recent Interpretation History
298
+
299
+ ### Purpose
300
+
301
+ Give the human a compact “audit trail of meaning,” not a raw log.
302
+
303
+ This creates trust and recoverability.
304
+
305
+ ### UI Form
306
+
307
+ A docked, compact side panel or vertical strip:
308
+
309
+ - title: `What Changed`
310
+ - 3–8 recent semantic events
311
+ - newest first
312
+
313
+ This should be visually distinct from status/trace panels.
314
+
315
+ ### Content
316
+
317
+ Entries should be written as semantic summaries, for example:
318
+
319
+ - `Now in context: Bug report, auth.ts`
320
+ - `Cluster formed around auth work`
321
+ - `Connected incident note to auth.ts`
322
+ - `Pinned neighborhood expanded`
323
+
324
+ ### Entry Structure
325
+
326
+ Each entry may include:
327
+
328
+ - short semantic title
329
+ - optional one-line detail
330
+ - optional timestamp or “just now”
331
+
332
+ ### Interaction
333
+
334
+ Optional for later:
335
+
336
+ - click entry to frame affected nodes
337
+ - hover entry to highlight affected nodes on canvas
338
+
339
+ ### Visual Style
340
+
341
+ - slim editorial rail, not a developer console
342
+ - entries separated by rhythm and spacing, not heavy borders
343
+ - readable at a glance
344
+ - should feel like an annotated margin, not a log file
345
+
346
+ ### Suppression Rules
347
+
348
+ This panel must remain curated.
349
+
350
+ Do not include:
351
+
352
+ - duplicate events
353
+ - movement without semantic change
354
+ - raw pin count updates without object names when names are available
355
+
356
+ ---
357
+
358
+ ## Semantic Event Taxonomy For Human UI
359
+
360
+ The UI should render a small, human-readable vocabulary.
361
+
362
+ ### v1 Event Types
363
+
364
+ - `Context Updated`
365
+ - `Cluster Formed`
366
+ - `Cluster Changed`
367
+ - `Neighborhood Changed`
368
+ - `Relationship Added`
369
+ - `Group Created`
370
+ - `Items Removed`
371
+
372
+ ### Mapping Guidance
373
+
374
+ `context-pin`
375
+ - usually map to `Context Updated`
376
+
377
+ `connect`
378
+ - map to `Relationship Added`
379
+
380
+ `group`
381
+ - map to `Group Created` or `Group Updated`
382
+
383
+ `remove`
384
+ - map to `Items Removed`
385
+
386
+ `move-end`
387
+ - map to:
388
+ - `Cluster Formed`
389
+ - `Cluster Changed`
390
+ - `Neighborhood Changed`
391
+ depending on reason
392
+
393
+ ### Copy Rules
394
+
395
+ - use nouns the human recognizes from the board
396
+ - prefer titles over IDs
397
+ - never surface internal event names directly
398
+ - avoid “agent” in every sentence
399
+ - the copy should sound like the board speaking, not the transport layer
400
+
401
+ Good:
402
+
403
+ - `Cluster formed around auth.ts`
404
+ - `Context updated: Bug report, auth.ts`
405
+
406
+ Bad:
407
+
408
+ - `move-end event detected`
409
+ - `context-pin delta applied`
410
+ - `layout diff processed`
411
+
412
+ ---
413
+
414
+ ## Visual Hierarchy
415
+
416
+ ### Hierarchy Levels
417
+
418
+ 1. Canvas nodes and spatial composition
419
+ 2. Focus Field
420
+ 3. Live Semantic Feedback
421
+ 4. Interpretation History
422
+ 5. Utility chrome and toolbar controls
423
+
424
+ This is deliberate.
425
+
426
+ The semantic layer should outrank utility chrome, but not overpower the board.
427
+
428
+ ### Why
429
+
430
+ The human should read the board first, then the semantic interpretation, then
431
+ the controls.
432
+
433
+ Today the utility chrome is too prominent relative to the product’s real value.
434
+
435
+ ---
436
+
437
+ ## Motion System
438
+
439
+ ### Principle
440
+
441
+ Use motion to confirm interpretation, not decorate the interface.
442
+
443
+ ### v1 Motion Moments
444
+
445
+ #### Semantic acknowledgment
446
+
447
+ - feedback ribbon slides/fades in
448
+ - one clean transition, then settles
449
+
450
+ #### Affected node pulse
451
+
452
+ - one synchronized pulse on nodes affected by the semantic change
453
+ - duration: 500–900ms
454
+
455
+ #### Focus Field re-form
456
+
457
+ - soft transition of wash/halo around pinned region
458
+ - no hard cut unless removing many nodes at once
459
+
460
+ #### Relationship reveal
461
+
462
+ - a new edge can draw once or brighten briefly
463
+
464
+ ### Motion Characteristics
465
+
466
+ - confident
467
+ - low-frequency
468
+ - low-amplitude
469
+ - non-bouncy
470
+ - more “instrument panel” than “playful app”
471
+
472
+ ### Accessibility
473
+
474
+ Respect reduced motion:
475
+
476
+ - no travel animations
477
+ - replace with opacity changes or instant state shifts
478
+
479
+ ---
480
+
481
+ ## Typography Direction
482
+
483
+ ### Principle
484
+
485
+ The semantic layer needs stronger character than the current generic technical
486
+ chrome, but it should remain sober.
487
+
488
+ ### Recommendation
489
+
490
+ Use contrast between:
491
+
492
+ - utilitarian UI copy for controls
493
+ - more editorial, high-contrast typography for semantic acknowledgments
494
+
495
+ The result should feel like:
496
+
497
+ - controls are functional
498
+ - interpretation is authored
499
+
500
+ ### Tone
501
+
502
+ - concise
503
+ - formal but warm
504
+ - no robotic phrasing
505
+ - no marketing slogans
506
+
507
+ ---
508
+
509
+ ## Color Direction
510
+
511
+ ### Principle
512
+
513
+ Meaning states need a distinct palette from generic interaction states.
514
+
515
+ ### Proposed Semantic Palette Roles
516
+
517
+ Interaction:
518
+
519
+ - cool electric blue/cyan
520
+
521
+ Curated human context:
522
+
523
+ - warm amber/gold
524
+
525
+ Inferred neighborhood:
526
+
527
+ - pale mineral wash, lower saturation
528
+
529
+ Success/completion:
530
+
531
+ - green, reserved for actual outcome states
532
+
533
+ ### Why
534
+
535
+ This separates:
536
+
537
+ - “I clicked something”
538
+ from
539
+ - “the board understood something”
540
+
541
+ That distinction is crucial.
542
+
543
+ ---
544
+
545
+ ## Empty State Rewrite
546
+
547
+ ### Current Problem
548
+
549
+ The current empty state teaches mechanics:
550
+
551
+ - search
552
+ - create
553
+ - shortcuts
554
+ - pan/zoom
555
+
556
+ That is useful but insufficient.
557
+
558
+ ### New Empty State Goal
559
+
560
+ Teach the collaboration ritual.
561
+
562
+ ### New Empty State Message
563
+
564
+ The empty state should explain:
565
+
566
+ 1. Add or drop nodes
567
+ 2. Arrange related things near each other
568
+ 3. Pin what matters most
569
+ 4. Watch the board reflect the active context
570
+
571
+ ### Example Structure
572
+
573
+ Headline:
574
+
575
+ - `Shape What The Agent Sees`
576
+
577
+ Body:
578
+
579
+ - `Lay out notes, files, and evidence. Bring related nodes together. Pin what matters. The canvas will show the current focus and how your edits changed it.`
580
+
581
+ Action hints:
582
+
583
+ - `Create a note`
584
+ - `Drop files or URLs`
585
+ - `Pin important nodes`
586
+
587
+ The empty state should invite a workflow, not just describe controls.
588
+
589
+ ---
590
+
591
+ ## Suppression Rules
592
+
593
+ These rules are required to keep the human UX high quality.
594
+
595
+ ### Never Surface
596
+
597
+ - raw drag frames
598
+ - selection changes
599
+ - no-op movement
600
+ - repeated identical semantic updates
601
+ - transport-level or server-level terminology
602
+
603
+ ### Only Surface When Meaning Changed
604
+
605
+ - cluster membership changed
606
+ - pinned neighborhood changed
607
+ - context set changed
608
+ - relationship structure changed
609
+ - group meaning changed
610
+
611
+ ### Coalescing Rules
612
+
613
+ When multiple semantic changes happen in one short burst:
614
+
615
+ - combine them into one visible acknowledgment when possible
616
+ - prefer one good message over three mediocre ones
617
+
618
+ Example:
619
+
620
+ Bad:
621
+
622
+ - `Context updated`
623
+ - `Neighborhood changed`
624
+ - `Cluster changed`
625
+
626
+ Better:
627
+
628
+ - `Context updated: Bug report now anchors auth cluster`
629
+
630
+ ---
631
+
632
+ ## MVP Scope
633
+
634
+ ### Must Ship
635
+
636
+ - Live Semantic Feedback surface
637
+ - Persistent Focus Field for pinned context + neighborhood
638
+ - Recent Interpretation History panel
639
+ - copy and event mapping rules
640
+ - motion rules for semantic acknowledgment
641
+
642
+ ### Can Wait
643
+
644
+ - click-to-focus from history entries
645
+ - deeper event filtering preferences
646
+ - custom semantic themes
647
+ - replay mode or timeline scrubbing
648
+
649
+ ---
650
+
651
+ ## Success Criteria
652
+
653
+ The design is successful when a human can truthfully say:
654
+
655
+ - `I can tell what the agent is focused on.`
656
+ - `When I rearrange nodes, I can see whether it mattered.`
657
+ - `The board reflects my intent, not just my clicks.`
658
+ - `The collaboration loop feels immediate and trustworthy.`
659
+ - `The canvas feels like a shared thinking surface, not just an editor.`
660
+
661
+ ## Implementation Notes For Future Build
662
+
663
+ When implementation starts:
664
+
665
+ - reuse server-authoritative semantic events and layout semantics
666
+ - do not invent a second browser-only protocol
667
+ - prefer one reusable semantic feedback system over ad hoc toasts
668
+ - ensure all semantic UI states degrade cleanly under reduced motion
669
+ - build the semantic layer to be visually lightweight but semantically strong
670
+
671
+ ## Final Principle
672
+
673
+ If there is a tie between “more control chrome” and “clearer human semantic
674
+ feedback,” prefer the semantic feedback.
675
+
676
+ That is the differentiator.
677
+
678
+ PMX Canvas wins when the human can shape the agent’s attention with visible,
679
+ confident consequence.