pmx-canvas 0.1.23 → 0.1.25
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.
- package/.github/extensions/pmx-canvas/extension.mjs +591 -0
- package/CHANGELOG.md +123 -0
- package/Readme.md +36 -5
- package/dist/canvas/global.css +36 -3
- package/dist/canvas/index.js +54 -54
- package/dist/types/client/nodes/ExtAppFrame.d.ts +1 -0
- package/dist/types/client/nodes/McpAppNode.d.ts +1 -0
- package/dist/types/client/nodes/iframe-document-url.d.ts +8 -0
- package/dist/types/client/state/intent-bridge.d.ts +4 -0
- package/dist/types/client/types.d.ts +1 -0
- package/dist/types/json-render/catalog.d.ts +1 -1
- package/dist/types/mcp/canvas-access.d.ts +9 -0
- package/dist/types/server/ax-context.d.ts +3 -0
- package/dist/types/server/ax-state.d.ts +43 -0
- package/dist/types/server/canvas-db.d.ts +5 -0
- package/dist/types/server/canvas-operations.d.ts +4 -0
- package/dist/types/server/canvas-state.d.ts +20 -3
- package/dist/types/server/index.d.ts +6 -0
- package/dist/types/server/mutation-history.d.ts +1 -1
- package/docs/cli.md +13 -0
- package/docs/http-api.md +24 -0
- package/docs/mcp.md +20 -2
- package/docs/plans/plan-004-pmx-ax-primitives.md +463 -0
- package/docs/screenshot.png +0 -0
- package/docs/sdk.md +5 -0
- package/package.json +2 -1
- package/skills/pmx-canvas/SKILL.md +14 -0
- package/skills/pmx-canvas/references/codex-app-adapter.md +110 -0
- package/skills/pmx-canvas/references/github-copilot-app-adapter.md +125 -0
- package/src/cli/agent.ts +34 -0
- package/src/cli/index.ts +2 -1
- package/src/client/App.tsx +2 -0
- package/src/client/canvas/CanvasNode.tsx +7 -0
- package/src/client/canvas/CommandPalette.tsx +2 -1
- package/src/client/canvas/use-node-drag.ts +29 -7
- package/src/client/canvas/use-node-resize.ts +27 -7
- package/src/client/nodes/ExtAppFrame.tsx +51 -10
- package/src/client/nodes/HtmlNode.tsx +5 -2
- package/src/client/nodes/McpAppNode.tsx +13 -1
- package/src/client/nodes/iframe-document-url.ts +58 -0
- package/src/client/state/intent-bridge.ts +8 -0
- package/src/client/state/sse-bridge.ts +3 -3
- package/src/client/theme/global.css +36 -3
- package/src/client/types.ts +1 -0
- package/src/mcp/canvas-access.ts +38 -0
- package/src/mcp/server.ts +113 -4
- package/src/server/ax-context.ts +38 -0
- package/src/server/ax-state.ts +130 -0
- package/src/server/canvas-db.ts +36 -1
- package/src/server/canvas-operations.ts +96 -4
- package/src/server/canvas-state.ts +123 -4
- package/src/server/index.ts +29 -2
- package/src/server/mutation-history.ts +12 -0
- package/src/server/server.ts +312 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,127 @@
|
|
|
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.25] - 2026-06-03
|
|
7
|
+
|
|
8
|
+
Adapter-regression cleanup on top of 0.1.24. Fixes several issues the
|
|
9
|
+
GitHub Copilot and Codex canvas adapters surfaced: effective pinned
|
|
10
|
+
state now shows up on node reads, PMX-served frame-document iframes are
|
|
11
|
+
trusted automatically, group membership is settable through the generic
|
|
12
|
+
node APIs, default node sizes were retuned, and the mutation-history
|
|
13
|
+
diff no longer reports spurious "data changed" for title/content edits.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **Node reads report effective pinned state.** `canvas_get_node` and
|
|
18
|
+
`canvas_get_layout` (and every read path) now return `pinned: true`
|
|
19
|
+
when a node is in the context-pin set, not only when its own
|
|
20
|
+
`pinned` flag is set. Adapters that key off `pinned` now see what
|
|
21
|
+
the human actually pinned.
|
|
22
|
+
- **Larger default node sizes.** Markdown nodes default to 640×420
|
|
23
|
+
(was 520×360) and `mcp-app` nodes get an explicit 960×600 default,
|
|
24
|
+
applied consistently across the HTTP create/batch path, the SDK,
|
|
25
|
+
and browser auto-placement. Larger app frames render their embedded
|
|
26
|
+
content without immediate manual resizing.
|
|
27
|
+
- **Mutation-history diff ignores title/content for "data changed".**
|
|
28
|
+
`canvas_diff` and the history timeline no longer flag a generic
|
|
29
|
+
"data changed" when only a node's `title` or `content` differs —
|
|
30
|
+
those are already reported as their own title/content changes, so
|
|
31
|
+
the data-level diff now compares the remaining fields.
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **PMX-served frame documents are trusted automatically.** Embedded
|
|
36
|
+
`mcp-app` iframes whose source is a same-origin
|
|
37
|
+
`/api/canvas/frame-documents/<id>` URL are now treated as trusted
|
|
38
|
+
(no sandbox-escape warning), via a new
|
|
39
|
+
`isSameOriginFrameDocumentUrl()` guard that validates both the
|
|
40
|
+
origin and the path prefix. External URLs and unrelated same-origin
|
|
41
|
+
paths remain untrusted.
|
|
42
|
+
- **Group membership through the generic node APIs.** `POST
|
|
43
|
+
/api/canvas/group` and the node update path accept `children` /
|
|
44
|
+
`childIds` (or `data.children`) and persist group membership, with
|
|
45
|
+
validation that rejects missing child IDs, self-references, and
|
|
46
|
+
nested-group children. Snapshot diffs expose the resulting
|
|
47
|
+
membership.
|
|
48
|
+
|
|
49
|
+
### Internal
|
|
50
|
+
|
|
51
|
+
- Regression coverage for: frame-document trust (same-origin PMX path
|
|
52
|
+
trusted; external and unrelated same-origin paths not), generic
|
|
53
|
+
group-children APIs persisting membership and surfacing it in
|
|
54
|
+
snapshot diffs, the retuned default node sizes through CLI/HTTP/MCP,
|
|
55
|
+
effective-pinned read state, and the title/content-aware
|
|
56
|
+
mutation-history diff.
|
|
57
|
+
|
|
58
|
+
## [0.1.24] - 2026-06-03
|
|
59
|
+
|
|
60
|
+
Host-adapter and agent-experience (AX) release. Adds host-agnostic AX
|
|
61
|
+
focus/context primitives across every layer, ships GitHub Copilot and
|
|
62
|
+
Codex canvas adapters, moves embedded HTML/MCP-app iframes onto a
|
|
63
|
+
same-origin frame-document transport (still strictly sandboxed via a
|
|
64
|
+
CSP `sandbox` response header), and fixes a batch of iframe-backed
|
|
65
|
+
node drag/resize/fullscreen interaction glitches.
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
|
|
69
|
+
- **PMX AX focus + context primitives.** A new host-agnostic
|
|
70
|
+
"agent experience" focus field lets any surface mark which nodes
|
|
71
|
+
an agent is attending to without moving the viewport. Implemented
|
|
72
|
+
end to end with full parity:
|
|
73
|
+
- State: `CanvasStateManager.getAxFocus()` / `setAxFocus()` /
|
|
74
|
+
`getAxState()`, recorded as a `setAxFocus` mutation-history op
|
|
75
|
+
(undo/redo) and persisted in a new SQLite `ax_state` table.
|
|
76
|
+
- SDK: `PmxCanvas.getAxState()`, `getAxContext()`, `setAxFocus()`.
|
|
77
|
+
- HTTP: `GET`/`PATCH /api/canvas/ax`, `GET /api/canvas/ax/context`,
|
|
78
|
+
`POST /api/canvas/ax/focus`.
|
|
79
|
+
- MCP: `canvas_get_ax`, `canvas_set_ax_focus` (45 tools total),
|
|
80
|
+
plus `canvas://ax` and `canvas://ax-context` resources that emit
|
|
81
|
+
`notifications/resources/updated` on change.
|
|
82
|
+
- CLI: `pmx-canvas ax focus <node-id...>` / `--clear`.
|
|
83
|
+
Focus state carries a `source` tag (`agent`/`api`/`browser`/`cli`/
|
|
84
|
+
`codex`/`copilot`/`mcp`/`sdk`/`system`) and node IDs are validated
|
|
85
|
+
against the live layout.
|
|
86
|
+
- **GitHub Copilot canvas adapter.** A new
|
|
87
|
+
`.github/extensions/pmx-canvas/extension.mjs` (591 lines) plus
|
|
88
|
+
`skills/pmx-canvas/references/github-copilot-app-adapter.md`
|
|
89
|
+
document and implement driving the canvas from GitHub Copilot.
|
|
90
|
+
- **Codex canvas adapter coverage.**
|
|
91
|
+
`skills/pmx-canvas/references/codex-app-adapter.md` documents the
|
|
92
|
+
Codex host integration, with browser regression coverage.
|
|
93
|
+
- **Same-origin frame-document transport for embedded apps.**
|
|
94
|
+
Embedded HTML and MCP-app iframes now load their document from
|
|
95
|
+
`POST /api/canvas/frame-documents` → `GET /api/canvas/frame-
|
|
96
|
+
documents/<id>` instead of an inline `srcdoc`. The served document
|
|
97
|
+
carries `Content-Security-Policy: sandbox <tokens>`,
|
|
98
|
+
`Referrer-Policy: no-referrer`, and `X-Content-Type-Options:
|
|
99
|
+
nosniff`. The sandbox-token allowlist deliberately excludes
|
|
100
|
+
`allow-same-origin` and top-navigation tokens, so frame content
|
|
101
|
+
stays in an opaque origin and cannot reach the canvas host. The
|
|
102
|
+
document store is in-memory, capped at 128 entries (LRU eviction)
|
|
103
|
+
and 5 MB per document.
|
|
104
|
+
|
|
105
|
+
### Changed
|
|
106
|
+
|
|
107
|
+
- **Iframe-backed node drag is flicker-free.** Node drag now
|
|
108
|
+
rAF-throttles pointer moves, clears the browser text selection,
|
|
109
|
+
and toggles an `is-node-dragging` document class to suppress
|
|
110
|
+
selection and attention-field repaint artifacts. Inline app
|
|
111
|
+
iframes are kept pointer-inert near the resize handle so resize
|
|
112
|
+
starts reliably.
|
|
113
|
+
- **Docs tool/resource references updated.** `docs/mcp.md` and the
|
|
114
|
+
README now read 45 tools + 9 core resources; the `AGENTS.md` and
|
|
115
|
+
`CLAUDE.md` MCP tool enumerations were corrected to the full
|
|
116
|
+
45-tool list (they had drifted to 42 and 39 respectively and were
|
|
117
|
+
missing `canvas_fit_view` and the new AX tools).
|
|
118
|
+
|
|
119
|
+
### Internal
|
|
120
|
+
|
|
121
|
+
- Regression coverage for: AX focus set/clear/persistence through
|
|
122
|
+
state, HTTP, MCP, SDK, and CLI; AX focus round-tripping through
|
|
123
|
+
SQLite; arrange-lock interactions; iframe-backed node
|
|
124
|
+
drag/resize/fullscreen behavior (large browser e2e additions); and
|
|
125
|
+
the Copilot/Codex adapter surfaces.
|
|
126
|
+
|
|
6
127
|
## [0.1.23] - 2026-05-12
|
|
7
128
|
|
|
8
129
|
Persistence overhaul. Canvas state, snapshots, context pins, and the
|
|
@@ -1114,6 +1235,8 @@ otherwise have to discover by trial and error.
|
|
|
1114
1235
|
- Regression coverage for snapshot flat-`id` aliases on both MCP and
|
|
1115
1236
|
HTTP surfaces, plus async / top-level-`await` WebView script bodies.
|
|
1116
1237
|
|
|
1238
|
+
[0.1.25]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.25
|
|
1239
|
+
[0.1.24]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.24
|
|
1117
1240
|
[0.1.23]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.23
|
|
1118
1241
|
[0.1.22]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.22
|
|
1119
1242
|
[0.1.21]: https://github.com/pskoett/pmx-canvas/releases/tag/v0.1.21
|
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) (
|
|
70
|
-
|
|
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-*`,
|
|
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)** —
|
|
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
|
package/dist/canvas/global.css
CHANGED
|
@@ -1107,10 +1107,13 @@ body,
|
|
|
1107
1107
|
position: absolute;
|
|
1108
1108
|
bottom: 0;
|
|
1109
1109
|
right: 0;
|
|
1110
|
-
width:
|
|
1111
|
-
height:
|
|
1110
|
+
width: 32px;
|
|
1111
|
+
height: 32px;
|
|
1112
|
+
background: rgba(0, 0, 0, 0.001);
|
|
1112
1113
|
cursor: nwse-resize;
|
|
1113
|
-
z-index:
|
|
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;
|