pmx-canvas 0.10.0 → 0.12.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 (343) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +3 -1
  2. package/.github/extensions/pmx-canvas/runtime.json +1 -1
  3. package/.github/extensions/pmx-canvas/tools.json +688 -128
  4. package/CHANGELOG.md +69 -0
  5. package/dist/amp-plugin/pmx-canvas/LICENSE +21 -0
  6. package/dist/amp-plugin/pmx-canvas/THIRD_PARTY_LICENSES.txt +331 -0
  7. package/dist/amp-plugin/pmx-canvas/index.js +5445 -0
  8. package/dist/amp-plugin/pmx-canvas/runtime.json +3 -0
  9. package/dist/amp-plugin/pmx-canvas/shared-runtime.mjs +194 -0
  10. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/SKILL.md +251 -0
  11. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/evals.json +1086 -0
  12. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/auth/jwt.ts +17 -0
  13. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/auth/login.ts +12 -0
  14. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/auth/middleware.ts +13 -0
  15. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/code-exploration/src/routes/auth.ts +13 -0
  16. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/evals/fixtures/investigation-board/src/handlers/users.ts +27 -0
  17. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/mcp.json +36 -0
  18. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/ax-html-control-surface.md +101 -0
  19. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/codex-app-adapter.md +151 -0
  20. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/excalidraw-diagram-authoring.md +150 -0
  21. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/full-reference.md +1785 -0
  22. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/github-copilot-app-adapter.md +223 -0
  23. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/html-primitives.md +139 -0
  24. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/importing-context.md +132 -0
  25. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/installing-pmx-canvas.md +251 -0
  26. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/tours-and-recording.md +111 -0
  27. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas/references/workbench-workflows.md +900 -0
  28. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas-orchestration/SKILL.md +141 -0
  29. package/dist/amp-plugin/pmx-canvas/skills/pmx-canvas-testing/SKILL.md +266 -0
  30. package/dist/amp-plugin/pmx-canvas/start-mcp.mjs +14857 -0
  31. package/dist/amp-plugin/pmx-canvas/tools.json +10963 -0
  32. package/dist/canvas/chunks/abnfDiagram-N423BO3Z-cwtsds5d.js +1 -0
  33. package/dist/canvas/chunks/architecture-TIHT7OUA-x63cwejs.js +1 -0
  34. package/dist/canvas/chunks/architectureDiagram-T3A2C74G-b4xc9tpz.js +36 -0
  35. package/dist/canvas/chunks/blockDiagram-VBNYF7ZC-ahp3yxxs.js +132 -0
  36. package/dist/canvas/chunks/c4Diagram-5PPSVZJV-nappnay7.js +10 -0
  37. package/dist/canvas/chunks/classDiagram-JCYQIIEL-k1j2xc1t.js +1 -0
  38. package/dist/canvas/chunks/classDiagram-v2-OCEON4UE-33x08xf2.js +1 -0
  39. package/dist/canvas/chunks/cose-bilkent-JH36ORCC-a428syda.js +1 -0
  40. package/dist/canvas/chunks/cynefin-VYW2F7L2-8v6jxfz8.js +1 -0
  41. package/dist/canvas/chunks/cynefinDiagram-MW4NZA55-nspsqebj.js +62 -0
  42. package/dist/canvas/chunks/dagre-VZM6K2ZE-8y6177fh.js +4 -0
  43. package/dist/canvas/chunks/diagram-7IWD3JNH-vym028wn.js +30 -0
  44. package/dist/canvas/chunks/diagram-B4RE2ZJO-jddqb8sy.js +3 -0
  45. package/dist/canvas/chunks/diagram-LBJQPF4R-bjwbpkrn.js +24 -0
  46. package/dist/canvas/chunks/diagram-Q27KOJAE-j6ph6hcx.js +24 -0
  47. package/dist/canvas/chunks/diagram-UB23O5K3-p09w8jej.js +41 -0
  48. package/dist/canvas/chunks/ebnfDiagram-BXEA7PRR-j975ycq5.js +1 -0
  49. package/dist/canvas/chunks/erDiagram-JOGREHBK-sxp6hjn8.js +85 -0
  50. package/dist/canvas/chunks/eventmodeling-45OFAUF4-xzfgn6xg.js +1 -0
  51. package/dist/canvas/chunks/flowDiagram-UKHOOZJN-2nsmkskb.js +1 -0
  52. package/dist/canvas/chunks/ganttDiagram-PKOTCBZU-4tv230y2.js +292 -0
  53. package/dist/canvas/chunks/gitGraph-TEB2WS4Q-macbhand.js +1 -0
  54. package/dist/canvas/chunks/gitGraphDiagram-DS77QQ5N-mqgmnw9g.js +106 -0
  55. package/dist/canvas/chunks/index-037z5dz2.js +232 -0
  56. package/dist/canvas/chunks/index-081n3har.js +207 -0
  57. package/dist/canvas/chunks/index-5n03dmb9.js +2 -0
  58. package/dist/canvas/chunks/index-5tv8v1hk.js +1 -0
  59. package/dist/canvas/chunks/index-60pgzdqe.js +157 -0
  60. package/dist/canvas/chunks/index-6ceya556.js +332 -0
  61. package/dist/canvas/chunks/index-8g1vb57n.js +2 -0
  62. package/dist/canvas/chunks/index-8rjes9r6.js +2 -0
  63. package/dist/canvas/chunks/index-9022d1n9.js +16 -0
  64. package/dist/canvas/chunks/index-9b02042t.js +2 -0
  65. package/dist/canvas/chunks/index-ap4q4vez.js +2 -0
  66. package/dist/canvas/chunks/index-dyp2nhd3.js +2 -0
  67. package/dist/canvas/chunks/index-frvta4tm.js +2 -0
  68. package/dist/canvas/chunks/index-gf4e0et4.js +2 -0
  69. package/dist/canvas/chunks/index-h9ycj8n2.js +2 -0
  70. package/dist/canvas/chunks/index-hj99nz1f.js +1 -0
  71. package/dist/canvas/chunks/index-mergmj97.js +2 -0
  72. package/dist/canvas/chunks/index-nwsya6dj.js +301 -0
  73. package/dist/canvas/chunks/index-nz8qbd1p.js +2 -0
  74. package/dist/canvas/chunks/index-qhfrazv3.js +2 -0
  75. package/dist/canvas/chunks/index-v119nznk.js +4 -0
  76. package/dist/canvas/chunks/index-vpt37m3d.js +89 -0
  77. package/dist/canvas/chunks/index-y9ma6azy.js +2 -0
  78. package/dist/canvas/chunks/index-zx0j3a2z.js +179 -0
  79. package/dist/canvas/chunks/info-DKCQHKI2-a0ykzs9z.js +1 -0
  80. package/dist/canvas/chunks/infoDiagram-6WML65LV-qv97qq6a.js +2 -0
  81. package/dist/canvas/chunks/ishikawaDiagram-WSZJBQD7-p9306gh0.js +70 -0
  82. package/dist/canvas/chunks/journeyDiagram-NVQOT4AX-sv67zats.js +139 -0
  83. package/dist/canvas/chunks/kanban-definition-27J2QSJJ-k2pfam6p.js +89 -0
  84. package/dist/canvas/chunks/katex-dmg8k4zm.js +257 -0
  85. package/dist/canvas/chunks/mermaid.core-83r0fdce.js +12 -0
  86. package/dist/canvas/chunks/mindmap-definition-FAOFIHXS-vg2newm1.js +96 -0
  87. package/dist/canvas/chunks/packet-7NZHBO7P-tqnabcdv.js +1 -0
  88. package/dist/canvas/chunks/pegDiagram-VL7TDLO6-k2h7zc5n.js +1 -0
  89. package/dist/canvas/chunks/pie-RZYD4A2V-wke6gyhe.js +1 -0
  90. package/dist/canvas/chunks/pieDiagram-7S7Q4E2Y-hg169p1v.js +39 -0
  91. package/dist/canvas/chunks/quadrantDiagram-CIZ2JOQS-bxtvsq0b.js +7 -0
  92. package/dist/canvas/chunks/radar-I7S5WNFK-w7ka0drw.js +1 -0
  93. package/dist/canvas/chunks/railroad-3IZDKUUU-y3vg318x.js +1 -0
  94. package/dist/canvas/chunks/railroad-abnf-AHOZXSZD-6hqvcz3c.js +1 -0
  95. package/dist/canvas/chunks/railroad-ebnf-EBAXGLYW-vcae260m.js +1 -0
  96. package/dist/canvas/chunks/railroad-peg-LSFZ7HO6-0dbyme23.js +1 -0
  97. package/dist/canvas/chunks/railroadDiagram-AXF67PYL-njyhcp4p.js +1 -0
  98. package/dist/canvas/chunks/requirementDiagram-LRYGKXZP-2z6v09gm.js +84 -0
  99. package/dist/canvas/chunks/sankeyDiagram-W5VNT64P-15mzam0e.js +40 -0
  100. package/dist/canvas/chunks/sequenceDiagram-SI44F4Z6-rbshyd2c.js +162 -0
  101. package/dist/canvas/chunks/sizeCapture-X5ZJPWSS-sg26xwts.js +1 -0
  102. package/dist/canvas/chunks/stateDiagram-OKZ733FA-6eahp98e.js +1 -0
  103. package/dist/canvas/chunks/stateDiagram-v2-UEYNNEHI-tty0ggn5.js +1 -0
  104. package/dist/canvas/chunks/swimlanes-SLNWSIFB-ze5db10t.js +1 -0
  105. package/dist/canvas/chunks/swimlanesDiagram-ULZ7WXOC-thze75gq.js +8 -0
  106. package/dist/canvas/chunks/timeline-definition-Z64GVDOM-vnp7jyy8.js +120 -0
  107. package/dist/canvas/chunks/treeView-QDETBFTQ-6ysffnm6.js +1 -0
  108. package/dist/canvas/chunks/treemap-6X3UGDF4-m3h9p066.js +1 -0
  109. package/dist/canvas/chunks/vennDiagram-T6HMQDX7-0qrnb7mj.js +34 -0
  110. package/dist/canvas/chunks/wardley-OPB4EBWU-dp37drwx.js +1 -0
  111. package/dist/canvas/chunks/wardleyDiagram-T6FBY63Y-8nxg8wqt.js +78 -0
  112. package/dist/canvas/chunks/xychartDiagram-ELKLHX3M-nj921e7s.js +7 -0
  113. package/dist/canvas/global.css +483 -230
  114. package/dist/canvas/index.js +158 -219
  115. package/dist/canvas/mcp-app.html +4301 -548
  116. package/dist/canvas/mermaid-entry.js +338 -338
  117. package/dist/canvas/surface-theme.css +6 -6
  118. package/dist/json-render/index.css +1 -1
  119. package/dist/json-render/index.js +49 -49
  120. package/dist/types/client/canvas/BarHint.d.ts +5 -3
  121. package/dist/types/client/canvas/BoardMoveDialog.d.ts +2 -0
  122. package/dist/types/client/canvas/CanvasNode.d.ts +0 -11
  123. package/dist/types/client/canvas/EdgeEditor.d.ts +19 -0
  124. package/dist/types/client/canvas/EdgeLayer.d.ts +1 -2
  125. package/dist/types/client/canvas/GroupNavigation.d.ts +2 -0
  126. package/dist/types/client/canvas/TextPrompt.d.ts +4 -0
  127. package/dist/types/client/canvas/auto-fit.d.ts +4 -5
  128. package/dist/types/client/mermaid-entry.d.ts +1 -2
  129. package/dist/types/client/mermaid-render.d.ts +1 -0
  130. package/dist/types/client/nodes/BoardNode.d.ts +1 -1
  131. package/dist/types/client/nodes/ExtAppFrame.d.ts +7 -90
  132. package/dist/types/client/nodes/McpAppNode.d.ts +1 -25
  133. package/dist/types/client/nodes/MermaidNode.d.ts +1 -8
  134. package/dist/types/client/nodes/PromptNode.d.ts +1 -0
  135. package/dist/types/client/nodes/ViewerFrame.d.ts +29 -0
  136. package/dist/types/client/nodes/ViewerHost.d.ts +6 -0
  137. package/dist/types/client/nodes/WorkCard.d.ts +7 -0
  138. package/dist/types/client/nodes/iframe-document-url.d.ts +3 -9
  139. package/dist/types/client/nodes/primitive-copy.d.ts +5 -0
  140. package/dist/types/client/nodes/use-ax-surface-bridge.d.ts +1 -0
  141. package/dist/types/client/nodes/use-iframe-content-height.d.ts +1 -1
  142. package/dist/types/client/nodes/use-surface-frame.d.ts +4 -6
  143. package/dist/types/client/nodes/viewer-runtime-state.d.ts +2 -1
  144. package/dist/types/client/state/canvas-store.d.ts +18 -1
  145. package/dist/types/client/state/human-store.d.ts +2 -0
  146. package/dist/types/client/state/intent-bridge.d.ts +5 -2
  147. package/dist/types/client/state/presentation.d.ts +17 -6
  148. package/dist/types/client/state/relation-store.d.ts +11 -0
  149. package/dist/types/client/types.d.ts +1 -1
  150. package/dist/types/json-render/catalog.d.ts +2 -2
  151. package/dist/types/json-render/server.d.ts +2 -1
  152. package/dist/types/server/agent-presence.d.ts +1 -0
  153. package/dist/types/server/ax-interaction.d.ts +1 -0
  154. package/dist/types/server/ax-state-manager.d.ts +10 -2
  155. package/dist/types/server/board-local.d.ts +4 -0
  156. package/dist/types/server/board-move.d.ts +38 -0
  157. package/dist/types/server/canvas-db.d.ts +12 -2
  158. package/dist/types/server/canvas-operations.d.ts +5 -6
  159. package/dist/types/server/canvas-provenance.d.ts +1 -1
  160. package/dist/types/server/canvas-serialization.d.ts +1 -0
  161. package/dist/types/server/canvas-state.d.ts +86 -20
  162. package/dist/types/server/card-relocation.d.ts +6 -0
  163. package/dist/types/server/context-reads.d.ts +3 -1
  164. package/dist/types/server/human-presence.d.ts +1 -1
  165. package/dist/types/server/index.d.ts +26 -10
  166. package/dist/types/server/intent-registry.d.ts +8 -4
  167. package/dist/types/server/knowledge-lifecycle.d.ts +4 -2
  168. package/dist/types/server/mutation-history.d.ts +7 -5
  169. package/dist/types/server/operations/ops/boards.d.ts +0 -1
  170. package/dist/types/server/operations/registry.d.ts +2 -0
  171. package/dist/types/server/tour-control.d.ts +13 -3
  172. package/dist/types/server/trace-manager.d.ts +1 -0
  173. package/dist/types/shared/ax-kinds.d.ts +6 -0
  174. package/dist/types/shared/ax-surface-protocol.d.ts +8 -9
  175. package/dist/types/shared/human-presence.d.ts +1 -0
  176. package/dist/types/shared/lifecycle-status.d.ts +2 -0
  177. package/dist/types/shared/tour.d.ts +8 -0
  178. package/docs/RELEASE.md +21 -14
  179. package/docs/agent-plugin.md +16 -2
  180. package/docs/amp-plugin.md +271 -0
  181. package/docs/cli.md +42 -3
  182. package/docs/design/Chrome.dc.html +32 -6
  183. package/docs/design/GuestName.dc.html +50 -0
  184. package/docs/design/PluginLogo.svg +7 -0
  185. package/docs/design/Types1.dc.html +3 -2
  186. package/docs/design/Types2.dc.html +1 -1
  187. package/docs/design/Types3.dc.html +1 -1
  188. package/docs/design/WorkCards.dc.html +39 -0
  189. package/docs/design/Zoom.dc.html +37 -60
  190. package/docs/design/canvas.json +17 -1
  191. package/docs/design/plugin-logo.png +0 -0
  192. package/docs/design.md +280 -12
  193. package/docs/evals/agents-md-sections.md +38 -0
  194. package/docs/http-api.md +179 -11
  195. package/docs/mcp.md +69 -9
  196. package/docs/node-types.md +109 -4
  197. package/docs/plans/plan-009-tech-debt-backlog.md +3 -3
  198. package/docs/plans/plan-019-post-0.9-roadmap.md +327 -31
  199. package/docs/plans/plan-020-wave-5-work-planning.md +553 -0
  200. package/docs/product-vision-2026-09.md +42 -17
  201. package/docs/sdk.md +18 -0
  202. package/package.json +7 -4
  203. package/plugins/pmx-canvas/assets/preview.png +0 -0
  204. package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/extension.mjs +3 -1
  205. package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/runtime.json +1 -1
  206. package/plugins/pmx-canvas/plugin.json +2 -2
  207. package/plugins/pmx-canvas/runtime.json +1 -1
  208. package/plugins/pmx-canvas/tools.json +688 -128
  209. package/skills/data-analysis/SKILL.md +13 -26
  210. package/skills/frontend-design/LICENSE.txt +177 -0
  211. package/skills/frontend-design/SKILL.md +3 -0
  212. package/skills/pmx-canvas/SKILL.md +232 -849
  213. package/skills/pmx-canvas/evals/evals.json +26 -3
  214. package/skills/pmx-canvas/references/full-reference.md +89 -24
  215. package/skills/pmx-canvas/references/html-primitives.md +7 -0
  216. package/skills/pmx-canvas/references/installing-pmx-canvas.md +6 -6
  217. package/skills/pmx-canvas/references/tours-and-recording.md +29 -2
  218. package/skills/pmx-canvas/references/workbench-workflows.md +900 -0
  219. package/skills/pmx-canvas-testing/SKILL.md +7 -5
  220. package/skills/published-consumer-e2e/SKILL.md +25 -8
  221. package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +51 -77
  222. package/skills/web-artifacts-builder/LICENSE.txt +202 -0
  223. package/skills/web-artifacts-builder/SKILL.md +6 -0
  224. package/skills/web-artifacts-builder/scripts/init-artifact.sh +2 -2
  225. package/src/cli/commands/apps.ts +1 -0
  226. package/src/cli/commands/boards.ts +30 -0
  227. package/src/client/App.tsx +20 -4
  228. package/src/client/canvas/AttentionHistory.tsx +10 -2
  229. package/src/client/canvas/BarHint.tsx +6 -3
  230. package/src/client/canvas/BoardMoveDialog.tsx +225 -0
  231. package/src/client/canvas/CanvasNode.tsx +79 -49
  232. package/src/client/canvas/CanvasViewport.tsx +42 -14
  233. package/src/client/canvas/ContextMenu.tsx +97 -15
  234. package/src/client/canvas/EdgeEditor.tsx +149 -0
  235. package/src/client/canvas/EdgeLayer.tsx +441 -174
  236. package/src/client/canvas/ExpandedNodeOverlay.tsx +5 -2
  237. package/src/client/canvas/GroupNavigation.tsx +85 -0
  238. package/src/client/canvas/Presentation.tsx +53 -3
  239. package/src/client/canvas/RelationsPanel.tsx +9 -0
  240. package/src/client/canvas/SelectionBar.tsx +21 -0
  241. package/src/client/canvas/SessionPanel.tsx +35 -1
  242. package/src/client/canvas/TextPrompt.tsx +18 -1
  243. package/src/client/canvas/TopBar.tsx +54 -9
  244. package/src/client/canvas/auto-fit.ts +9 -11
  245. package/src/client/canvas/canvas-area.ts +2 -2
  246. package/src/client/canvas/use-focus-trap.ts +6 -1
  247. package/src/client/mermaid-entry.ts +6 -20
  248. package/src/client/mermaid-render.ts +39 -0
  249. package/src/client/nodes/AxStepControls.tsx +45 -69
  250. package/src/client/nodes/BoardNode.tsx +65 -9
  251. package/src/client/nodes/ContextNode.tsx +88 -396
  252. package/src/client/nodes/ExtAppFrame.tsx +302 -1465
  253. package/src/client/nodes/FileNode.tsx +92 -81
  254. package/src/client/nodes/HtmlNode.tsx +8 -36
  255. package/src/client/nodes/LedgerNode.tsx +31 -17
  256. package/src/client/nodes/MarkdownNode.tsx +14 -24
  257. package/src/client/nodes/McpAppNode.tsx +48 -154
  258. package/src/client/nodes/MermaidNode.tsx +80 -69
  259. package/src/client/nodes/PromptNode.tsx +44 -17
  260. package/src/client/nodes/ResponseNode.tsx +8 -6
  261. package/src/client/nodes/StatusNode.tsx +34 -7
  262. package/src/client/nodes/StatusSummary.tsx +16 -3
  263. package/src/client/nodes/TraceNode.tsx +8 -8
  264. package/src/client/nodes/ViewerFrame.tsx +273 -0
  265. package/src/client/nodes/ViewerHost.tsx +41 -0
  266. package/src/client/nodes/WebpageNode.tsx +22 -24
  267. package/src/client/nodes/WorkCard.tsx +175 -0
  268. package/src/client/nodes/iframe-document-url.ts +20 -27
  269. package/src/client/nodes/primitive-copy.ts +97 -0
  270. package/src/client/nodes/use-ax-surface-bridge.ts +18 -14
  271. package/src/client/nodes/use-iframe-content-height.ts +34 -10
  272. package/src/client/nodes/use-surface-frame.ts +22 -11
  273. package/src/client/nodes/viewer-runtime-state.ts +41 -35
  274. package/src/client/state/attention-bridge.ts +5 -0
  275. package/src/client/state/attention-store.ts +1 -0
  276. package/src/client/state/canvas-store.ts +202 -26
  277. package/src/client/state/human-store.ts +22 -2
  278. package/src/client/state/intent-bridge.ts +20 -5
  279. package/src/client/state/presentation.ts +135 -15
  280. package/src/client/state/relation-store.ts +127 -1
  281. package/src/client/state/sse-bridge.ts +18 -19
  282. package/src/client/theme/global.css +483 -230
  283. package/src/client/theme/surface-theme.css +6 -6
  284. package/src/client/types.ts +1 -0
  285. package/src/json-render/charts/tufte-components.tsx +44 -2
  286. package/src/json-render/renderer/index.css +62 -2
  287. package/src/json-render/renderer/index.tsx +31 -7
  288. package/src/json-render/server.ts +3 -2
  289. package/src/mcp/server.ts +13 -3
  290. package/src/server/agent-presence.ts +43 -23
  291. package/src/server/ax-flow-loop.ts +6 -0
  292. package/src/server/ax-gate-ttl.ts +8 -1
  293. package/src/server/ax-interaction.ts +16 -10
  294. package/src/server/ax-state-manager.ts +17 -4
  295. package/src/server/ax-wait.ts +20 -6
  296. package/src/server/board-export.ts +54 -30
  297. package/src/server/board-local.ts +20 -0
  298. package/src/server/board-move.ts +297 -0
  299. package/src/server/canvas-db.ts +249 -158
  300. package/src/server/canvas-geometry.ts +1 -0
  301. package/src/server/canvas-operations.ts +139 -109
  302. package/src/server/canvas-schema.ts +21 -0
  303. package/src/server/canvas-serialization.ts +2 -0
  304. package/src/server/canvas-state.ts +797 -159
  305. package/src/server/card-relocation.ts +53 -0
  306. package/src/server/code-graph.ts +4 -3
  307. package/src/server/context-reads.ts +83 -55
  308. package/src/server/demo-state.json +140 -114
  309. package/src/server/file-watcher.ts +30 -10
  310. package/src/server/html-primitives.ts +3 -9
  311. package/src/server/html-surface.ts +8 -0
  312. package/src/server/human-presence.ts +18 -5
  313. package/src/server/index.ts +54 -24
  314. package/src/server/intent-registry.ts +43 -5
  315. package/src/server/knowledge-lifecycle.ts +32 -9
  316. package/src/server/lifecycle-status.ts +29 -1
  317. package/src/server/mcp-app-runtime.ts +26 -7
  318. package/src/server/mutation-history.ts +37 -8
  319. package/src/server/operations/composites.ts +6 -3
  320. package/src/server/operations/mcp-contracts.ts +32 -2
  321. package/src/server/operations/mcp.ts +36 -9
  322. package/src/server/operations/ops/annotation.ts +22 -1
  323. package/src/server/operations/ops/ax-await.ts +1 -0
  324. package/src/server/operations/ops/ax-timeline.ts +28 -2
  325. package/src/server/operations/ops/batch.ts +25 -11
  326. package/src/server/operations/ops/boards.ts +45 -6
  327. package/src/server/operations/ops/nodes.ts +70 -0
  328. package/src/server/operations/ops/query.ts +32 -3
  329. package/src/server/operations/ops/snapshots.ts +1 -0
  330. package/src/server/operations/ops/viewport.ts +11 -9
  331. package/src/server/operations/registry.ts +49 -4
  332. package/src/server/server.ts +69 -75
  333. package/src/server/tour-control.ts +97 -12
  334. package/src/server/trace-manager.ts +4 -0
  335. package/src/server/web-artifacts/scripts/init-artifact.sh +2 -2
  336. package/src/shared/agent-context.ts +7 -1
  337. package/src/shared/auto-arrange.ts +5 -4
  338. package/src/shared/ax-kinds.ts +13 -0
  339. package/src/shared/ax-surface-protocol.ts +20 -9
  340. package/src/shared/content-height-reporter.ts +4 -3
  341. package/src/shared/human-presence.ts +1 -0
  342. package/src/shared/lifecycle-status.ts +2 -0
  343. package/src/shared/tour.ts +8 -0
@@ -8,26 +8,88 @@
8
8
  *
9
9
  * This module must never import server.ts or index.ts.
10
10
  */
11
- import { derivedTour, resolveStop, tourStopSchema, type Camera, type Tour, type TourStop } from '../shared/tour.js';
12
- import { canvasState } from './canvas-state.js';
11
+ import {
12
+ derivedTour,
13
+ resolveStop,
14
+ tourPresenterSchema,
15
+ tourStopSchema,
16
+ type Camera,
17
+ type Tour,
18
+ type TourPresenter,
19
+ type TourStop,
20
+ } from '../shared/tour.js';
21
+ import { boardCatalogEpoch, canvasState } from './canvas-state.js';
13
22
  import { getClientViewportSize } from './canvas-operations.js';
14
23
  import { OperationError } from './operations/types.js';
24
+ import { createBoardLocal } from './board-local.js';
15
25
 
16
26
  export type TourStep = number | 'next' | 'previous';
17
27
 
18
- export interface TourStepResult {
28
+ export interface TourDelivery {
29
+ catalogEpoch: string;
30
+ boardGeneration: number;
31
+ sequence: number;
32
+ }
33
+
34
+ export interface TourStepResult extends TourDelivery {
19
35
  index: number;
20
36
  total: number;
21
37
  stop: TourStop;
22
38
  }
23
39
 
40
+ export interface TourSuperseded {
41
+ superseded: true;
42
+ }
43
+
24
44
  export interface TourState {
25
45
  tour: Tour;
26
46
  derived: boolean;
27
47
  position: number | null;
28
48
  }
29
49
 
30
- let cursor: { boardGeneration: number; tour: string; index: number } | null = null;
50
+ const boardTour = createBoardLocal(() => ({
51
+ cursor: null as { boardGeneration: number; viewGeneration: number; tour: string; index: number } | null,
52
+ presenterGeneration: -1,
53
+ presenterIntents: new Map<string, number>(),
54
+ }));
55
+ // One order for both HTTP acknowledgements and event delivery in this server run.
56
+ let sequence = 0;
57
+
58
+ function claimPresenter(presenter: TourPresenter | undefined): boolean {
59
+ if (presenter === undefined) return true;
60
+ const state = boardTour.current;
61
+ const { presenterIntents } = state;
62
+ const { clientId, intent, catalogEpoch, boardGeneration } = tourPresenterSchema.parse(presenter);
63
+ if (
64
+ canvasState.isBackgroundBoard ||
65
+ catalogEpoch !== boardCatalogEpoch ||
66
+ boardGeneration !== canvasState.visibleBoardGeneration
67
+ )
68
+ return false;
69
+ if (state.presenterGeneration !== boardGeneration) {
70
+ presenterIntents.clear();
71
+ state.presenterGeneration = boardGeneration;
72
+ }
73
+ const previous = presenterIntents.get(clientId);
74
+ if (previous !== undefined && intent <= previous) return false;
75
+ // Never evict an identity: that would make its delayed requests valid again.
76
+ if (previous === undefined && presenterIntents.size >= 4096)
77
+ throw new OperationError(
78
+ 'Too many presentation documents on this board activation. Reopen the board to continue.',
79
+ 409,
80
+ );
81
+ // Even a later invalid stop supersedes older commands. Claim before resolving it.
82
+ presenterIntents.set(clientId, intent);
83
+ return true;
84
+ }
85
+
86
+ function nextDelivery(): TourDelivery {
87
+ return {
88
+ catalogEpoch: boardCatalogEpoch,
89
+ boardGeneration: canvasState.isBackgroundBoard ? canvasState.boardGeneration : canvasState.visibleBoardGeneration,
90
+ sequence: ++sequence,
91
+ };
92
+ }
31
93
 
32
94
  export function currentTour(): TourState {
33
95
  const saved = canvasState.getTour();
@@ -37,14 +99,23 @@ export function currentTour(): TourState {
37
99
 
38
100
  /** The stop the tour is on for the active board, or null when not touring. */
39
101
  function tourPosition(tour: Tour): number | null {
40
- if (cursor && (cursor.boardGeneration !== canvasState.boardGeneration || cursor.tour !== JSON.stringify(tour))) {
41
- cursor = null;
102
+ const { cursor } = boardTour.current;
103
+ if (
104
+ cursor &&
105
+ (cursor.boardGeneration !== canvasState.boardLifetimeGeneration ||
106
+ (!canvasState.isBackgroundBoard && cursor.viewGeneration !== canvasState.visibleBoardGeneration) ||
107
+ cursor.tour !== JSON.stringify(tour))
108
+ ) {
109
+ boardTour.current.cursor = null;
42
110
  }
43
- return cursor?.index ?? null;
111
+ return boardTour.current.cursor?.index ?? null;
44
112
  }
45
113
 
46
114
  /** Move the shared cursor. `next`/`previous` clamp at the ends; an explicit index must exist. */
47
- export function goToTourStop(step: TourStep): TourStepResult {
115
+ export function goToTourStop(step: TourStep): TourStepResult;
116
+ export function goToTourStop(step: TourStep, presenter: TourPresenter | undefined): TourStepResult | TourSuperseded;
117
+ export function goToTourStop(step: TourStep, presenter?: TourPresenter): TourStepResult | TourSuperseded {
118
+ if (!claimPresenter(presenter)) return { superseded: true };
48
119
  const { tour, position: at } = currentTour();
49
120
  const { stops } = tour;
50
121
  if (stops.length === 0) {
@@ -55,12 +126,26 @@ export function goToTourStop(step: TourStep): TourStepResult {
55
126
  else if (step === 'previous') index = at === null ? 0 : Math.max(0, Math.min(stops.length - 1, at - 1));
56
127
  else if (Number.isInteger(step) && step >= 0 && step < stops.length) index = step;
57
128
  else throw new OperationError(`Tour stop ${step} does not exist (stops 0–${stops.length - 1}).`, 400);
58
- cursor = { boardGeneration: canvasState.boardGeneration, tour: JSON.stringify(tour), index };
59
- return { index, total: stops.length, stop: stops[index] as TourStop };
129
+ boardTour.current.cursor = {
130
+ boardGeneration: canvasState.boardLifetimeGeneration,
131
+ viewGeneration: canvasState.visibleBoardGeneration,
132
+ tour: JSON.stringify(tour),
133
+ index,
134
+ };
135
+ return {
136
+ ...nextDelivery(),
137
+ index,
138
+ total: stops.length,
139
+ stop: stops[index] as TourStop,
140
+ };
60
141
  }
61
142
 
62
- export function exitTour(): void {
63
- cursor = null;
143
+ export function exitTour(): TourDelivery;
144
+ export function exitTour(presenter: TourPresenter | undefined): TourDelivery | TourSuperseded;
145
+ export function exitTour(presenter?: TourPresenter): TourDelivery | TourSuperseded {
146
+ if (!claimPresenter(presenter)) return { superseded: true };
147
+ boardTour.current.cursor = null;
148
+ return nextDelivery();
64
149
  }
65
150
 
66
151
  /**
@@ -72,6 +72,10 @@ class TraceManager {
72
72
  return this._enabled;
73
73
  }
74
74
 
75
+ get ownedNodeIds(): readonly string[] {
76
+ return this.traceNodeIds;
77
+ }
78
+
75
79
  setEnabled(value: boolean): void {
76
80
  this._enabled = value;
77
81
  if (value) {
@@ -146,8 +146,8 @@ fi
146
146
 
147
147
  echo "🚀 Creating new React + Vite project: $PROJECT_NAME"
148
148
 
149
- # Create new Vite project (always use latest create-vite, pin vite version later)
150
- run_pnpm_quiet create vite "$PROJECT_NAME" --template react-ts --no-interactive
149
+ # 9.3.2 shipped without templates; keep scaffolding on the verified complete package.
150
+ run_pnpm_quiet create vite@9.3.1 "$PROJECT_NAME" --template react-ts --no-interactive
151
151
 
152
152
  # Navigate into project directory
153
153
  cd "$PROJECT_NAME"
@@ -374,8 +374,14 @@ export function summarizeNodeForAgentContext(node: CanvasNodeState, options: Age
374
374
  return truncateContextText(`${prefix}${fileContent}`, defaultTextLength);
375
375
  }
376
376
  case 'status':
377
+ if (typeof node.data.workItemId === 'string') {
378
+ return truncateContextText(
379
+ `Read-only live task: ${node.data.workItemId}\n${node.data.liveWorkAvailable === false ? 'Task unavailable' : textFields(node.data, ['title', 'workState', 'detail', 'liveWorkSource'])}`,
380
+ defaultTextLength,
381
+ );
382
+ }
377
383
  return truncateContextText(
378
- `Status: ${textFields(node.data, ['phase']) || textFields(node.data, ['content']) || textFields(node.data, ['status']) || 'unknown'}\n${textFields(node.data, ['detail', 'message', 'activeTool'])}`,
384
+ `Status: ${textFields(node.data, ['workState']) || textFields(node.data, ['phase']) || textFields(node.data, ['content']) || textFields(node.data, ['status']) || 'unknown'}\n${textFields(node.data, ['detail', 'message', 'activeTool'])}${typeof node.data.progress === 'number' ? `\nProgress: ${node.data.progress}%` : ''}`,
379
385
  defaultTextLength,
380
386
  );
381
387
  case 'context':
@@ -463,10 +463,11 @@ export function computeAutoArrange(
463
463
  const { outgoing, undirected, indegree, outdegree } = buildUnitGraphs(units, nodeToUnit, allEdges);
464
464
  const clusters = collectSpatialClusters(units, undirected);
465
465
  const absoluteUnitPositions = new Map<string, ArrangePosition>();
466
- // Already-packed cluster rects: a cluster that grew past its old bounds is
467
- // shifted below earlier clusters instead of overlapping them. Clusters are
468
- // processed top-left first, so the cascade is deterministic.
469
- const packedRects: Array<ArrangePosition & ArrangeSize> = [];
466
+ // Reserve fixed cards as well as already-packed clusters. A growing cluster
467
+ // shifts below blockers without moving pinned cards or splitting its groups.
468
+ const packedRects: Array<ArrangePosition & ArrangeSize> = allNodes
469
+ .filter((node) => node.pinned)
470
+ .map((node) => ({ ...node.position, ...node.size }));
470
471
 
471
472
  for (const clusterUnits of clusters) {
472
473
  const components = collectComponents(clusterUnits, undirected).map((component) =>
@@ -5,6 +5,19 @@
5
5
  */
6
6
  export type AxWorkItemStatus = 'todo' | 'in-progress' | 'blocked' | 'done' | 'cancelled';
7
7
 
8
+ /** Authored work cards use the task vocabulary without creating an AX task. */
9
+ export const WORK_CARD_STATES: Record<AxWorkItemStatus, { label: string; glyph: string }> = {
10
+ todo: { label: 'To do', glyph: '○' },
11
+ 'in-progress': { label: 'In progress', glyph: '◐' },
12
+ blocked: { label: 'Blocked', glyph: '⧗' },
13
+ done: { label: 'Done', glyph: '✓' },
14
+ cancelled: { label: 'Cancelled', glyph: '×' },
15
+ };
16
+
17
+ export function isWorkCardState(value: unknown): value is AxWorkItemStatus {
18
+ return typeof value === 'string' && Object.hasOwn(WORK_CARD_STATES, value);
19
+ }
20
+
8
21
  /** `held` = auto-held by the unattended-approval policy: the action did NOT proceed. */
9
22
  export type AxApprovalStatus = 'pending' | 'approved' | 'rejected' | 'held';
10
23
 
@@ -21,13 +21,24 @@ export const HTML_SURFACE_PUSH_SOURCE = 'pmx-canvas-html-node';
21
21
  /** Tab-local JSON viewer state handoff, independent of AX capabilities. */
22
22
  export const JSON_VIEWER_STATE_SOURCE = 'pmx-canvas-json-state';
23
23
 
24
- /** Ext-app boot beacon: the iframe's scripts executed (WebKit watchdog liveness). */
25
- export const EXT_APP_BOOT_BEACON_SOURCE = 'pmx-canvas-ext-app-alive';
24
+ /** MCP apps share their window channel with an SDK JSON-RPC transport. */
25
+ export const MCP_SURFACE_METHOD = 'notifications/pmx/surface';
26
26
 
27
- /**
28
- * Parent→ext-app paint probe (Finding N): the parent asks the app document to
29
- * answer with a double-rAF `paint-tick` beacon. A frame whose rendering
30
- * pipeline is live answers within a frame or two; silence past the timeout is
31
- * the paint-fail signal that drives the recovery ladder.
32
- */
33
- export const EXT_APP_PAINT_PROBE_SOURCE = 'pmx-canvas-ext-app-paint-probe';
27
+ export function surfaceNotification(params: Record<string, unknown>) {
28
+ return { jsonrpc: '2.0' as const, method: MCP_SURFACE_METHOD, params };
29
+ }
30
+
31
+ export function readSurfaceNotification(message: unknown): unknown {
32
+ if (
33
+ message &&
34
+ typeof message === 'object' &&
35
+ 'jsonrpc' in message &&
36
+ message.jsonrpc === '2.0' &&
37
+ 'method' in message &&
38
+ message.method === MCP_SURFACE_METHOD &&
39
+ !('id' in message) &&
40
+ 'params' in message
41
+ )
42
+ return message.params;
43
+ return null;
44
+ }
@@ -22,11 +22,12 @@ export function sanitizeFrameToken(token: string): string {
22
22
  export function contentHeightReporterSource(frameToken: string): string {
23
23
  const token = JSON.stringify(sanitizeFrameToken(frameToken));
24
24
  return (
25
- `(function(){var T=${token};var last=0,timer=null;` +
25
+ `(function(){var T=${token};var last=0,lastViewport=0,timer=null;` +
26
26
  `function m(){var d=document.documentElement;return Math.max(d?d.scrollHeight:0,document.body?document.body.scrollHeight:0);}` +
27
- `function r(){var h=m();if(Math.abs(h-last)<=4)return;last=h;window.parent.postMessage({source:'pmx-canvas-frame',type:'content-height',token:T,height:h},'*');}` +
27
+ `function r(force){var h=m(),v=window.innerHeight;if(!force&&Math.abs(h-last)<=4&&v===lastViewport)return;last=h;lastViewport=v;window.parent.postMessage({source:'pmx-canvas-frame',type:'content-height',token:T,height:h},'*');}` +
28
28
  `function s(){if(timer)return;timer=setTimeout(function(){timer=null;r();},100);}` +
29
- `if(document.readyState!=='loading')s();window.addEventListener('load',s,true);` +
29
+ `window.addEventListener('message',function(e){var d=e.data;if(e.source===window.parent&&d&&d.source==='pmx-canvas-frame'&&d.type==='measure-content'&&d.token===T)r(true);});` +
30
+ `if(document.readyState!=='loading')s();window.addEventListener('load',s,true);window.addEventListener('resize',s);` +
30
31
  `try{new ResizeObserver(s).observe(document.documentElement);}catch(e){}` +
31
32
  `new MutationObserver(s).observe(document.documentElement,{subtree:true,childList:true,characterData:true,attributes:true});` +
32
33
  `if(document.fonts)document.fonts.ready.then(s);setTimeout(s,60);})();`
@@ -21,6 +21,7 @@ export interface HumanPresenceSnapshot {
21
21
  humans: HumanPresence[];
22
22
  }
23
23
 
24
+ export const HUMAN_NAME_MAX_LENGTH = 40;
24
25
  /** A tab that stops reporting is gone after this. */
25
26
  export const HUMAN_PRESENCE_TTL_MS = 30_000;
26
27
  /** A grab the tab stops renewing (crash, tab closed mid-drag) releases after this. */
@@ -21,6 +21,8 @@ export interface LifecycleQualification {
21
21
  contentChangedAt: string | null;
22
22
  /** The revisions a validating reviewer must have inspected, qualified by source relation. */
23
23
  observations: Record<string, number | null>;
24
+ /** Warnings keyed by the same qualified source identity as observations. */
25
+ sourceWarnings?: Record<string, string[]>;
24
26
  sources: SourceQualification[];
25
27
  relevance: 'card-pinned' | 'board-pinned' | 'not-selected';
26
28
  }
@@ -21,6 +21,14 @@ export const tourStopSchema = z.object({
21
21
  pullback: z.number().min(0).max(4).optional(),
22
22
  });
23
23
  export const tourSchema = z.object({ stops: z.array(tourStopSchema).max(1000) });
24
+ /** Latest intent from one document, scoped to the server's board activation. */
25
+ export const tourPresenterSchema = z.object({
26
+ clientId: z.string().min(1).max(128),
27
+ intent: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
28
+ catalogEpoch: z.string().min(1).max(128),
29
+ boardGeneration: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
30
+ });
31
+ export type TourPresenter = z.infer<typeof tourPresenterSchema>;
24
32
  export type Tour = z.infer<typeof tourSchema>;
25
33
  export type TourStop = z.infer<typeof tourStopSchema>;
26
34
  export type Camera = z.infer<typeof cameraSchema>;