pmx-canvas 0.1.23 → 0.1.24

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 (51) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +591 -0
  2. package/CHANGELOG.md +70 -0
  3. package/Readme.md +36 -5
  4. package/dist/canvas/global.css +36 -3
  5. package/dist/canvas/index.js +54 -54
  6. package/dist/types/client/nodes/ExtAppFrame.d.ts +1 -0
  7. package/dist/types/client/nodes/iframe-document-url.d.ts +8 -0
  8. package/dist/types/client/state/intent-bridge.d.ts +4 -0
  9. package/dist/types/client/types.d.ts +1 -0
  10. package/dist/types/json-render/catalog.d.ts +1 -1
  11. package/dist/types/mcp/canvas-access.d.ts +9 -0
  12. package/dist/types/server/ax-context.d.ts +3 -0
  13. package/dist/types/server/ax-state.d.ts +43 -0
  14. package/dist/types/server/canvas-db.d.ts +5 -0
  15. package/dist/types/server/canvas-state.d.ts +19 -3
  16. package/dist/types/server/index.d.ts +6 -0
  17. package/dist/types/server/mutation-history.d.ts +1 -1
  18. package/docs/cli.md +13 -0
  19. package/docs/http-api.md +24 -0
  20. package/docs/mcp.md +20 -2
  21. package/docs/plans/plan-004-pmx-ax-primitives.md +463 -0
  22. package/docs/screenshot.png +0 -0
  23. package/docs/sdk.md +5 -0
  24. package/package.json +2 -1
  25. package/skills/pmx-canvas/SKILL.md +14 -0
  26. package/skills/pmx-canvas/references/codex-app-adapter.md +107 -0
  27. package/skills/pmx-canvas/references/github-copilot-app-adapter.md +111 -0
  28. package/src/cli/agent.ts +34 -0
  29. package/src/cli/index.ts +2 -1
  30. package/src/client/App.tsx +2 -0
  31. package/src/client/canvas/CanvasNode.tsx +7 -0
  32. package/src/client/canvas/CommandPalette.tsx +2 -1
  33. package/src/client/canvas/use-node-drag.ts +29 -7
  34. package/src/client/canvas/use-node-resize.ts +27 -7
  35. package/src/client/nodes/ExtAppFrame.tsx +51 -10
  36. package/src/client/nodes/HtmlNode.tsx +5 -2
  37. package/src/client/nodes/iframe-document-url.ts +58 -0
  38. package/src/client/state/intent-bridge.ts +8 -0
  39. package/src/client/state/sse-bridge.ts +2 -2
  40. package/src/client/theme/global.css +36 -3
  41. package/src/client/types.ts +1 -0
  42. package/src/mcp/canvas-access.ts +38 -0
  43. package/src/mcp/server.ts +113 -4
  44. package/src/server/ax-context.ts +38 -0
  45. package/src/server/ax-state.ts +130 -0
  46. package/src/server/canvas-db.ts +36 -1
  47. package/src/server/canvas-operations.ts +79 -0
  48. package/src/server/canvas-state.ts +113 -2
  49. package/src/server/index.ts +18 -0
  50. package/src/server/mutation-history.ts +1 -0
  51. package/src/server/server.ts +193 -8
package/Readme.md CHANGED
@@ -55,6 +55,11 @@ prompt engineering, no copy-paste — pin a node in the browser and the MCP
55
55
  server fires a `notifications/resources/updated` event the agent's harness
56
56
  picks up immediately.
57
57
 
58
+ AX context adds a host-agnostic focus layer on top of pins. Core PMX exposes
59
+ `/api/canvas/ax/context`, `canvas://ax-context`, SDK methods, and
60
+ `pmx-canvas ax context|focus`; adapters can map that same primitive to their
61
+ native hook systems without making PMX Canvas GitHub-specific.
62
+
58
63
  ### 05 / Save
59
64
 
60
65
  Spatial state auto-saves to `.pmx-canvas/canvas.db` (debounced ~500 ms) —
@@ -66,12 +71,24 @@ the DB so SQLite WAL data is checkpointed into the file.
66
71
 
67
72
  ### 06 / Any agent
68
73
 
69
- Harness-agnostic. Drive the canvas from [MCP](docs/mcp.md) (42 tools,
70
- 8 resources, change notifications), the [CLI](docs/cli.md), the
74
+ Harness-agnostic. Drive the canvas from [MCP](docs/mcp.md) (45 tools,
75
+ 9 resources, change notifications), the [CLI](docs/cli.md), the
71
76
  [HTTP API](docs/http-api.md), or the [Bun SDK](docs/sdk.md). Works with
72
77
  Claude Code, GitHub Copilot CLI, Codex, Cursor, Windsurf, or any agent
73
78
  that can spawn an MCP stdio server, call a CLI, or hit an HTTP endpoint.
74
79
 
80
+ The repo also ships a GitHub Copilot app adapter at
81
+ `.github/extensions/pmx-canvas/`. It opens the live PMX workbench in a native
82
+ Copilot canvas panel, injects AX pinned/focused context on prompt submission,
83
+ and exposes adapter actions for status, AX focus, context refresh, and explicit
84
+ session steering.
85
+
86
+ In the Codex app, PMX Canvas is MCP-first plus the Codex in-app Browser: agents
87
+ read `canvas://ax-context` / `canvas_get_ax`, humans use the live `/workbench`
88
+ view, and Codex-originated focus can be labeled with `source: "codex"` through
89
+ `canvas_set_ax_focus`. The CLI remains a fallback for scripts and manual
90
+ debugging, not the native Codex adapter path.
91
+
75
92
  ## Prerequisites
76
93
 
77
94
  - [Bun](https://bun.sh) >= 1.3.12
@@ -126,6 +143,20 @@ Add to your agent's MCP config:
126
143
 
127
144
  The canvas auto-starts on first tool call.
128
145
 
146
+ ### Use inside the GitHub Copilot app
147
+
148
+ This repository includes a project canvas extension:
149
+
150
+ ```text
151
+ .github/extensions/pmx-canvas/extension.mjs
152
+ ```
153
+
154
+ When loaded by the Copilot app, it opens the PMX workbench natively, starts a
155
+ matching local PMX server when needed, and injects `AX` pinned/focused context
156
+ as hidden per-turn context. The adapter is thin: PMX state still lives in
157
+ `.pmx-canvas/canvas.db`, and the same HTTP, MCP, CLI, and SDK surfaces remain
158
+ available to non-GitHub agents.
159
+
129
160
  ### Install the agent skill (recommended)
130
161
 
131
162
  The fastest way to get a working canvas is to install the `pmx-canvas` agent
@@ -148,8 +179,8 @@ Common harness skill directories: `.claude/skills/` (Claude Code),
148
179
  `.github/skills/` or `.copilot/skills/` (Copilot CLI),
149
180
  `.agents/skills/` (cross-harness convention). Once the canvas is running,
150
181
  the agent can read `canvas://skills` and pull in companion skills
151
- (`web-artifacts-builder`, `json-render-*`, `pmx-canvas-testing`,
152
- `playwright-cli`, etc.) as the work demands.
182
+ (`control-session-orchestrator`, `web-artifacts-builder`, `json-render-*`,
183
+ `pmx-canvas-testing`, `playwright-cli`, etc.) as the work demands.
153
184
 
154
185
  ## Documentation
155
186
 
@@ -157,7 +188,7 @@ the agent can read `canvas://skills` and pull in companion skills
157
188
  the three-tier visual matrix (json-render → html → web-artifact)
158
189
  - **[CLI reference](docs/cli.md)** — full command surface, daemon mode,
159
190
  watch streams, WebView automation
160
- - **[MCP reference](docs/mcp.md)** — 42 tools, 8 resources, change
191
+ - **[MCP reference](docs/mcp.md)** — 45 tools, 9 resources, change
161
192
  notifications, node-type routing
162
193
  - **[HTTP API](docs/http-api.md)** — REST endpoints, SSE, batch operations
163
194
  - **[Bun SDK](docs/sdk.md)** — `createCanvas()` for TypeScript on Bun
@@ -1107,10 +1107,13 @@ body,
1107
1107
  position: absolute;
1108
1108
  bottom: 0;
1109
1109
  right: 0;
1110
- width: 16px;
1111
- height: 16px;
1110
+ width: 32px;
1111
+ height: 32px;
1112
+ background: rgba(0, 0, 0, 0.001);
1112
1113
  cursor: nwse-resize;
1113
- z-index: 2;
1114
+ z-index: 30;
1115
+ pointer-events: auto;
1116
+ touch-action: none;
1114
1117
  }
1115
1118
 
1116
1119
  .canvas-node .node-resize-handle::after {
@@ -1130,6 +1133,36 @@ body,
1130
1133
  opacity: 1;
1131
1134
  }
1132
1135
 
1136
+ html.is-node-resizing,
1137
+ html.is-node-resizing * {
1138
+ cursor: nwse-resize !important;
1139
+ }
1140
+
1141
+ html.is-node-resizing .canvas-node {
1142
+ transition: box-shadow 0.15s ease !important;
1143
+ }
1144
+
1145
+ html.is-node-dragging .attention-field-layer {
1146
+ visibility: hidden;
1147
+ }
1148
+
1149
+ html.is-node-dragging,
1150
+ html.is-node-dragging * {
1151
+ cursor: grabbing !important;
1152
+ user-select: none !important;
1153
+ -webkit-user-select: none !important;
1154
+ }
1155
+
1156
+ html.is-node-dragging iframe,
1157
+ html.is-node-dragging .ext-app-preview-catcher {
1158
+ pointer-events: none !important;
1159
+ }
1160
+
1161
+ html.is-node-resizing iframe,
1162
+ html.is-node-resizing .ext-app-preview-catcher {
1163
+ pointer-events: none !important;
1164
+ }
1165
+
1133
1166
  /* Pinned node indicator */
1134
1167
  .canvas-node.pinned {
1135
1168
  border-style: dashed;