pmx-canvas 0.4.3 → 0.4.4
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/CHANGELOG.md +27 -0
- package/Readme.md +7 -6
- package/dist/canvas/global.css +55 -0
- package/dist/canvas/index.js +2 -2
- package/dist/canvas/surface-theme.css +32 -0
- package/dist/types/cli/agent.d.ts +1 -0
- package/dist/types/cli/commands/skills.d.ts +41 -0
- package/dist/types/client/state/sse-bridge.d.ts +1 -0
- package/dist/types/shared/themes.d.ts +1 -1
- package/docs/RELEASE.md +14 -6
- package/docs/bun-webview-integration.md +2 -2
- package/docs/cli.md +24 -1
- package/docs/environment.md +2 -2
- package/docs/http-api.md +6 -3
- package/docs/plans/plan-009-tech-debt-backlog.md +4 -3
- package/docs/screenshot.png +0 -0
- package/package.json +1 -1
- package/skills/pmx-canvas/SKILL.md +14 -4
- package/skills/pmx-canvas/references/full-reference.md +1 -1
- package/skills/pmx-canvas-testing/SKILL.md +4 -0
- package/src/cli/agent.ts +1 -0
- package/src/cli/commands/skills.ts +183 -0
- package/src/cli/index.ts +3 -1
- package/src/cli/shared.ts +1 -0
- package/src/client/state/sse-bridge.ts +14 -3
- package/src/client/theme/global.css +55 -0
- package/src/client/theme/surface-theme.css +32 -0
- package/src/server/operations/ops/canvas-wire.ts +1 -1
- package/src/server/server.ts +13 -2
- package/src/shared/themes.ts +2 -0
|
@@ -281,6 +281,38 @@
|
|
|
281
281
|
--color-danger: #E57373;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
:root[data-theme="volt"] {
|
|
285
|
+
/* ── Core palette (volt · green-tinted charcoal + coral) ── */
|
|
286
|
+
--c-bg: #0B0D0B;
|
|
287
|
+
--c-panel: #171A17;
|
|
288
|
+
--c-panel-soft: #111311;
|
|
289
|
+
--c-line: #272A27;
|
|
290
|
+
--c-text: #F6FFF5;
|
|
291
|
+
--c-text-soft: #CBD3CA;
|
|
292
|
+
--c-muted: #9CA49C;
|
|
293
|
+
--c-dim: #626962;
|
|
294
|
+
--c-accent: #F34E3F;
|
|
295
|
+
--c-ok: #52C880;
|
|
296
|
+
--c-warn: #E4C465;
|
|
297
|
+
--c-warn-alt: #FFB300;
|
|
298
|
+
--c-danger: #D67670;
|
|
299
|
+
--c-purple: #BC8FB4;
|
|
300
|
+
|
|
301
|
+
--color-bg: #0B0D0B;
|
|
302
|
+
--color-panel: #171A17;
|
|
303
|
+
--color-surface: #111311;
|
|
304
|
+
--color-border: #272A27;
|
|
305
|
+
--color-text: #F6FFF5;
|
|
306
|
+
--color-text-primary: #F6FFF5;
|
|
307
|
+
--color-text-secondary: #CBD3CA;
|
|
308
|
+
--color-text-muted: #9CA49C;
|
|
309
|
+
--color-text-dim: #626962;
|
|
310
|
+
--color-accent: #F34E3F;
|
|
311
|
+
--color-success: #52C880;
|
|
312
|
+
--color-warning: #E4C465;
|
|
313
|
+
--color-danger: #D67670;
|
|
314
|
+
}
|
|
315
|
+
|
|
284
316
|
html,
|
|
285
317
|
body {
|
|
286
318
|
margin: 0;
|
|
@@ -22,5 +22,6 @@ import './commands/ax.js';
|
|
|
22
22
|
import './commands/webview.js';
|
|
23
23
|
import './commands/apps.js';
|
|
24
24
|
import './commands/copilot.js';
|
|
25
|
+
import './commands/skills.js';
|
|
25
26
|
export { extractGlobalTargetFlags };
|
|
26
27
|
export declare function runAgentCli(rawArgs: string[]): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const BUNDLED_SKILLS: readonly ["pmx-canvas", "pmx-canvas-testing"];
|
|
2
|
+
export interface SkillTreeComparison {
|
|
3
|
+
inSync: boolean;
|
|
4
|
+
/** Files present in the package tree but missing or different in the mirror. */
|
|
5
|
+
missingOrDifferent: string[];
|
|
6
|
+
/** Files present in the mirror but not in the package tree. */
|
|
7
|
+
extra: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function compareSkillTrees(sourceRoot: string, targetRoot: string): SkillTreeComparison;
|
|
10
|
+
export interface InstalledSkillMirror {
|
|
11
|
+
/** The directory that owns the skills/ folder (e.g. ".codex", ".github", or any agent dir). */
|
|
12
|
+
host: string;
|
|
13
|
+
skill: string;
|
|
14
|
+
dir: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Find the bundled skills' installed copies in this workspace: any immediate
|
|
18
|
+
* child directory holding `skills/<skill>/SKILL.md`, regardless of which agent
|
|
19
|
+
* that directory belongs to. The package's own skills source is excluded so
|
|
20
|
+
* running inside the pmx-canvas checkout never compares a tree to itself.
|
|
21
|
+
*/
|
|
22
|
+
export declare function discoverInstalledSkillMirrors(workspaceRoot: string, packageSkillsRoot: string): InstalledSkillMirror[];
|
|
23
|
+
export interface SkillMirrorResult {
|
|
24
|
+
host: string;
|
|
25
|
+
skill: string;
|
|
26
|
+
dir: string;
|
|
27
|
+
status: 'in-sync' | 'synced' | 'drifted' | 'skipped-not-a-package-copy';
|
|
28
|
+
missingOrDifferent?: string[];
|
|
29
|
+
extra?: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A mirror is only replaceable when its SKILL.md frontmatter `name:` matches
|
|
33
|
+
* the bundled skill it sits under. A user's own skill living in a same-named
|
|
34
|
+
* directory (different frontmatter identity) must never be deleted — these
|
|
35
|
+
* trees are typically gitignored, so a wrong replace is unrecoverable.
|
|
36
|
+
*/
|
|
37
|
+
export declare function mirrorIdentityMatches(mirrorDir: string, skill: string): boolean;
|
|
38
|
+
/** Sync (or, with check=true, only compare) every INSTALLED mirror against the package trees. */
|
|
39
|
+
export declare function syncInstalledSkillMirrors(packageSkillsRoot: string, workspaceRoot: string, opts: {
|
|
40
|
+
check: boolean;
|
|
41
|
+
}): SkillMirrorResult[];
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* theme picker, server validation, and surface documents pick it up from this
|
|
10
10
|
* list.
|
|
11
11
|
*/
|
|
12
|
-
export declare const CANVAS_THEMES: readonly ["dark", "light", "high-contrast", "midnight", "sepia", "arctic", "ember", "forest"];
|
|
12
|
+
export declare const CANVAS_THEMES: readonly ["dark", "light", "high-contrast", "midnight", "sepia", "arctic", "ember", "forest", "volt"];
|
|
13
13
|
export type CanvasThemeName = (typeof CANVAS_THEMES)[number];
|
|
14
14
|
export declare function isCanvasTheme(value: unknown): value is CanvasThemeName;
|
|
15
15
|
export declare function normalizeCanvasThemeName(value: unknown, fallback?: CanvasThemeName): CanvasThemeName;
|
package/docs/RELEASE.md
CHANGED
|
@@ -134,12 +134,20 @@ publishing, update the installed package in the consumer workspace and re-sync
|
|
|
134
134
|
its four mirrors from `<global npm root>/pmx-canvas/skills/` so the first test
|
|
135
135
|
pass runs against the released skills, not the previous version's guidance.
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
This is now one command in the consumer workspace (added post-0.4.3):
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pmx-canvas skills sync --yes # refreshes every INSTALLED skill copy from the package
|
|
141
|
+
pmx-canvas skills sync --check # drift detection only (exit 1 when stale)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
It discovers the skill copies already installed in the workspace (whatever
|
|
145
|
+
agent layout owns them — no host list is assumed) and compares/replaces
|
|
146
|
+
**whole trees** — `references/`, `evals/`, fixtures — not `SKILL.md` hashes
|
|
147
|
+
alone (the 0.3.x–0.4.x cycles repeatedly hit drift where the hash matched but
|
|
148
|
+
supporting files were stale). Also re-run
|
|
149
|
+
`pmx-canvas copilot install-extension --yes` in repos that use the Copilot
|
|
150
|
+
adapter so the panel picks up new open-URL behavior.
|
|
143
151
|
|
|
144
152
|
## GitHub release
|
|
145
153
|
|
|
@@ -12,7 +12,7 @@ This document tracks:
|
|
|
12
12
|
|
|
13
13
|
**Implemented** for Phase 1.
|
|
14
14
|
|
|
15
|
-
The repo now targets Bun `>=1.3.
|
|
15
|
+
The repo now targets Bun `>=1.3.14`, and PMX Canvas ships an opt-in, server-owned WebView automation session that can:
|
|
16
16
|
|
|
17
17
|
- start a headless browser session for `/workbench`
|
|
18
18
|
- report WebView runtime status
|
|
@@ -192,7 +192,7 @@ If `chromePath` or `chromeArgv` is provided, PMX Canvas forces a Chrome-backed s
|
|
|
192
192
|
|
|
193
193
|
The repo now requires:
|
|
194
194
|
|
|
195
|
-
- Bun `>=1.3.
|
|
195
|
+
- Bun `>=1.3.14`
|
|
196
196
|
|
|
197
197
|
That change is reflected in:
|
|
198
198
|
|
package/docs/cli.md
CHANGED
|
@@ -20,7 +20,7 @@ pmx-canvas # Start canvas, open browser
|
|
|
20
20
|
pmx-canvas --demo # Start with the saved dashboard demo board
|
|
21
21
|
pmx-canvas --port=8080 # Custom port
|
|
22
22
|
pmx-canvas --no-open # Headless (for agents/CI)
|
|
23
|
-
pmx-canvas --theme=light # dark | light | high-contrast | midnight | sepia | arctic | ember | forest
|
|
23
|
+
pmx-canvas --theme=light # dark | light | high-contrast | midnight | sepia | arctic | ember | forest | volt
|
|
24
24
|
pmx-canvas --mcp # Run as MCP server (stdio)
|
|
25
25
|
pmx-canvas --webview-automation # Start headless Bun.WebView session
|
|
26
26
|
pmx-canvas open # Open the current workbench in a browser
|
|
@@ -211,6 +211,29 @@ pmx-canvas copilot install-extension --dry-run # Preview target, writes nothin
|
|
|
211
211
|
pmx-canvas copilot install-extension --yes # Install/overwrite into .github/extensions/pmx-canvas/
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
+
## Skill sync
|
|
215
|
+
|
|
216
|
+
Refresh the pmx-canvas skill copies **already installed** in this workspace.
|
|
217
|
+
The command discovers them (any `<agent-dir>/skills/pmx-canvas[-testing]`,
|
|
218
|
+
whichever agent layout the workspace uses) and compares/replaces whole trees —
|
|
219
|
+
references, evals, and fixtures included — so a copy can no longer drift while
|
|
220
|
+
its `SKILL.md` hash matches. It never creates a copy where none is installed
|
|
221
|
+
and makes no assumptions about which agents you use.
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
pmx-canvas skills sync --yes # Refresh every installed copy from the package
|
|
225
|
+
pmx-canvas skills sync --check # Report drift only (exit 1 when stale), change nothing
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Replacing a tree is destructive, so the sync requires `--yes`; without it the
|
|
229
|
+
command only reports drift (like `--check`) and hints at the flag. A directory
|
|
230
|
+
whose `SKILL.md` identity doesn't match the bundled skill is skipped, never
|
|
231
|
+
replaced.
|
|
232
|
+
|
|
233
|
+
Run `skills sync --yes` (and `copilot install-extension --yes` if the repo uses the
|
|
234
|
+
Copilot adapter) after every `pmx-canvas` upgrade so agents operate on the
|
|
235
|
+
released guidance.
|
|
236
|
+
|
|
214
237
|
## WebView automation
|
|
215
238
|
|
|
216
239
|
Drive a headless Bun.WebView (Chromium or WebKit) pointed at the workbench:
|
package/docs/environment.md
CHANGED
|
@@ -25,8 +25,8 @@ optional; defaults are listed.
|
|
|
25
25
|
|
|
26
26
|
| Variable | Read by | Effect |
|
|
27
27
|
|---|---|---|
|
|
28
|
-
| `PMX_CANVAS_THEME` | server | Startup theme: `dark` (default), `light`, `high-contrast`, `midnight`, `sepia`, `arctic`, `ember`, `forest`. |
|
|
29
|
-
| `AMP_ORB` | server | Set by Amp orb services. When present, the served canvas page tells the browser it is running in an orb, which skips the iframe embed probe
|
|
28
|
+
| `PMX_CANVAS_THEME` | server | Startup theme: `dark` (default), `light`, `high-contrast`, `midnight`, `sepia`, `arctic`, `ember`, `forest`, `volt`. |
|
|
29
|
+
| `AMP_ORB` | server | Set by Amp orb services. When present, the served canvas page tells the browser it is running in an orb, which skips the iframe embed probe, forces `srcdoc` surface rendering when embedded (the orb portal blocks `src`-URL child iframes and the probe is unreliable there), and defaults the event transport to polling instead of SSE (the portal proxy buffers streams; `?transport=sse` overrides for diagnosis). |
|
|
30
30
|
| `PMX_CANVAS_DISABLE_BROWSER_OPEN` | server | `1` suppresses auto-opening the browser (used by tests/CI). |
|
|
31
31
|
| `PMX_CANVAS_DIST` | server | Explicit client bundle directory to serve instead of the packaged `dist/canvas`. |
|
|
32
32
|
| `PMX_CANVAS_WEBVIEW_TIMEOUT_MS` | server | Startup timeout for the Bun.WebView automation session. |
|
package/docs/http-api.md
CHANGED
|
@@ -341,9 +341,12 @@ Responses are `{ ok, transport: "poll", snapshot, seq, events }` — poll again
|
|
|
341
341
|
with `since=<seq>` every couple of seconds. A `since` from a previous server
|
|
342
342
|
run or one that fell off the bounded event ring recovers with a fresh
|
|
343
343
|
snapshot. The browser client uses this automatically: if the SSE stream
|
|
344
|
-
produces no event within 3 seconds of connecting, it switches to polling
|
|
345
|
-
|
|
346
|
-
|
|
344
|
+
produces no event within 3 seconds of connecting, it switches to polling (and
|
|
345
|
+
tells the boot screen to wait for the fallback instead of alarming). Pages
|
|
346
|
+
served by an Amp orb (`AMP_ORB` set — the same stamp that drives srcdoc mode)
|
|
347
|
+
skip SSE entirely and default straight to polling. Force a transport with
|
|
348
|
+
`/workbench?transport=poll` (or `transport=sse` to disable the fallback /
|
|
349
|
+
override the orb default).
|
|
347
350
|
|
|
348
351
|
## Session theme override (host-default theming)
|
|
349
352
|
|
|
@@ -66,7 +66,7 @@ The remaining items were re-analyzed with pros/cons and tiered; the maintainer a
|
|
|
66
66
|
|---|---|
|
|
67
67
|
| Windows web-artifacts | The artifact build pipeline is bash-script-backed (POSIX-only); `tests/unit/web-artifacts.test.ts` self-skips on win32 and docs now state the boundary. Decide: port the build scripts to a cross-platform runner, or keep the documented "build on POSIX, render anywhere" stance. |
|
|
68
68
|
| Composite parity no longer machine-checked | Since v0.3.0 removed the legacy standalones, the byte-identical composite-vs-legacy guarantee has no head-to-head test — regressions in `buildInput`/`formatResult` reuse surface only via output-shape assertions. Accepted at review; revisit if a composite drifts. |
|
|
69
|
-
| Portal-layer ext-app mount (contingency) | If the maintainer sets the WebKit UX bar at "never any visible gap", inline ext-app iframes must render outside the world transform — an architectural change that reopens the parked M3. 0.4.1 shipped the cheaper mimic (post-settle WebKit repaint nudge, `repaint-nudge` trail event) and the 0.4.1 Copilot report confirms the nudge RUNS but residual black tiles still appear (Diamond on first-load settle, Ellipse after restart settle) — the contingency's trigger condition is now met. This portal-layer mount is the designated next Finding N step; scope it as its own project (drag/zoom sync, z-order, clipping, minimap interplay), not a patch-release bolt-on. |
|
|
69
|
+
| Portal-layer ext-app mount (contingency) | If the maintainer sets the WebKit UX bar at "never any visible gap", inline ext-app iframes must render outside the world transform — an architectural change that reopens the parked M3. 0.4.1 shipped the cheaper mimic (post-settle WebKit repaint nudge, `repaint-nudge` trail event) and the 0.4.1 Copilot report confirms the nudge RUNS but residual black tiles still appear (Diamond on first-load settle, Ellipse after restart settle) — the contingency's trigger condition is now met. 0.4.3 Codex hardens the evidence: three ready tiles blank in WebKit with **byte-identical** early/late screenshots while the recovery trail reported initialized/settled — DOM-level recovery completion does not prove compositor paint, so no DOM-side nudge can close this. This portal-layer mount is the designated next Finding N step; scope it as its own project (drag/zoom sync, z-order, clipping, minimap interplay), not a patch-release bolt-on. |
|
|
70
70
|
|
|
71
71
|
## Added post-0.4.0 (2026-08-04 report cycle)
|
|
72
72
|
|
|
@@ -75,6 +75,7 @@ The remaining items were re-analyzed with pros/cons and tiered; the maintainer a
|
|
|
75
75
|
| Finding S — frame documents vs server restart | **Done + field-confirmed (0.4.1 reports, both hosts):** the browser revalidates minted frame-document URLs on every reconnect epoch (`workbenchConnectionEpoch`, HEAD probe) and re-mints against the new process when the store is gone; `/api/canvas/frame-documents/:id` answers HEAD. Copilot: IDs fully rotated, all post-restart 200, no frame-not-found tiles. Codex: re-mint without workbench reload. Server-side persistence deliberately NOT done — frames are client-derived and re-mintable. |
|
|
76
76
|
| Amp portal nested-iframe embedding | **Done (2026-08-04):** boot-time embed probe (`/api/canvas/iframe-probe`) + fetch()+srcdoc fallback for all same-origin surfaces (`useSurfaceFrame`, `useIframeDocument` srcdoc short-circuit), `?iframe-mode` override, e2e-forced-mode coverage. External (cross-origin) app URLs cannot be inlined — documented limitation. |
|
|
77
77
|
| Copilot adapter `canvas_snapshot list` descriptor lag | Host-side cached tool schema still requires `name`; fresh `--mcp` is correct. Adapter/packaging issue, not a daemon defect — nothing to change in core; 0.4.2 cycle saw the legacy tools gone from the host list after refresh. |
|
|
78
|
-
| Finding T — theme/More menu mis-anchored | **Done (
|
|
79
|
-
| Finding U — sticky `-32001` session-error banner over rendering content | **
|
|
78
|
+
| Finding T — theme/More menu mis-anchored | **Done + field-confirmed (0.4.3 reports, both hosts):** menus moved inside `.toolbar-menu-anchor` wrappers around their triggers. Copilot measured button/menu right edges equal; Codex measured delta 0. Anchor-geometry e2e regression tests in place. |
|
|
79
|
+
| Finding U — sticky `-32001` session-error banner over rendering content | **Presentation fix field-confirmed (0.4.3 reports, both hosts); root cause open:** forced error state renders the soft saved-content notice. The underlying stressed-reconnect MCP timeout is still not clean-reproducible — investigate session re-establishment retry/backoff if a future cycle reproduces it. |
|
|
80
|
+
| Skill-mirror drift automation | **Done (2026-08-05):** `pmx-canvas skills sync` (+ `--check`, exit 1 on drift) discovers the skill copies already installed in the workspace — no assumed host layout, per maintainer direction — and whole-tree-replaces them from the package. Closes the recurring every-cycle hand-sync complaint in the audit addenda. Remaining audit ask: a true model-vs-baseline benchmark of the 17 eval prompts (a test-harness task, not a repo artifact). |
|
|
80
81
|
| Registry-migration dead-code sweep | **Done (2026-08-03):** removed the orphaned `describeOp`/`describeGateOp` (composites.ts, dead since the v0.3.0 registration filter) and the `compactNodePayload`/`compactLayoutPayload`/`wantsFullPayload` duplicates in `mcp/server.ts` (live copies are in `ops/nodes.ts`). |
|
package/docs/screenshot.png
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmx-canvas",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Spatial canvas workbench for coding agents \u2014 infinite 2D canvas with agent-native CLI, MCP integration, nodes, edges, file watching, and snapshots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/server/index.ts",
|
|
@@ -18,6 +18,14 @@ Humans curate agent context by pinning nodes; agents read that curation through
|
|
|
18
18
|
|
|
19
19
|
## Required Operating Sequence
|
|
20
20
|
|
|
21
|
+
0. **After a `pmx-canvas` upgrade, refresh this skill first.** Run
|
|
22
|
+
`pmx-canvas skills sync --yes` (`--check` to detect drift; exit 1 when stale) — it finds the skill
|
|
23
|
+
copies already installed in the workspace (whatever layout your agent uses) and replaces the
|
|
24
|
+
complete trees from the package, references/evals/fixtures included. Sync ONLY from the
|
|
25
|
+
installed package, never from a source checkout: this skill documents the runtime it ships
|
|
26
|
+
with, and a newer repo skill paired with an older installed runtime advertises commands and
|
|
27
|
+
themes the binary does not have (0.4.3 report skew finding). Also restart the HTTP daemon and
|
|
28
|
+
any `--mcp` processes; Bun does not hot-reload a running process.
|
|
21
29
|
1. **Open or focus the workbench before mutating.** Reuse one visible canvas surface for the
|
|
22
30
|
session.
|
|
23
31
|
2. **Verify workspace identity.** Read `GET /health` or `pmx-canvas serve status`; the returned
|
|
@@ -175,8 +183,8 @@ Use the visible workbench when the human is actively curating layout:
|
|
|
175
183
|
- Drop files or URLs to create matching nodes.
|
|
176
184
|
- Double-click markdown to edit inline.
|
|
177
185
|
- Use toolbar snapshots before experiments and restore only after confirmation.
|
|
178
|
-
- The toolbar carries view controls (fit, reset, zoom), arrange, minimap, a theme picker (
|
|
179
|
-
themes: dark, light, high-contrast, midnight, sepia, arctic, ember, forest), snapshots, trace,
|
|
186
|
+
- The toolbar carries view controls (fit, reset, zoom), arrange, minimap, a theme picker (nine
|
|
187
|
+
themes: dark, light, high-contrast, midnight, sepia, arctic, ember, forest, volt), snapshots, trace,
|
|
180
188
|
the annotation tools, search (Cmd+K), and shortcuts. On narrow viewports (≤900px — most
|
|
181
189
|
embedded host panes and mobile) the secondary controls collapse into a single "⋯" More menu at
|
|
182
190
|
the end of the bar; every action is still there as a labeled row, including the theme list. If
|
|
@@ -265,8 +273,10 @@ Prefer `canvas_query { action: "search" }` over parsing the full layout.
|
|
|
265
273
|
with a gray placeholder. The canvas probes this at boot and auto-falls back to fetching
|
|
266
274
|
same-origin surfaces and rendering them inline via `srcdoc` (HTML, graph, json-render, frame
|
|
267
275
|
documents). In Amp orbs specifically, the server sees `AMP_ORB` in its environment and stamps
|
|
268
|
-
the page so the embedded client skips the (there-unreliable) probe
|
|
269
|
-
|
|
276
|
+
the page so the embedded client skips the (there-unreliable) probe, goes straight to `srcdoc`,
|
|
277
|
+
AND defaults to the polling transport (the portal proxy buffers SSE — waiting out the watchdog
|
|
278
|
+
could trip the boot modal); HTML surfaces also inline their theme stylesheet so they render
|
|
279
|
+
styled. External app
|
|
270
280
|
URLs cannot be inlined (cross-origin) and may stay blocked in such hosts. Force a mode with
|
|
271
281
|
`/workbench?iframe-mode=srcdoc` (or `iframe-mode=src`) when diagnosing.
|
|
272
282
|
- Graph and json-render standalone surfaces use `display=site` and fill the browser viewport, and
|
|
@@ -132,7 +132,7 @@ pmx-canvas --theme=light # Light theme
|
|
|
132
132
|
pmx-canvas --version # Print installed version and exit
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
`--theme` accepts `dark` (default), `light`, `high-contrast`, `midnight`, `sepia`, `arctic`, `ember`, or `
|
|
135
|
+
`--theme` accepts `dark` (default), `light`, `high-contrast`, `midnight`, `sepia`, `arctic`, `ember`, `forest`, or `volt` (0.4.x; the browser toolbar has a matching theme picker). Same value can be set via
|
|
136
136
|
the `PMX_CANVAS_THEME` environment variable, or toggled live in the browser toolbar.
|
|
137
137
|
|
|
138
138
|
Start the canvas once per session, then reuse it. Use `--no-open` when running as an agent — the
|
|
@@ -74,6 +74,10 @@ Prefer extending the existing suites before inventing a one-off script.
|
|
|
74
74
|
- MCP harnesses using the official SDK must wind down BOTH halves: call `client.close()` AND
|
|
75
75
|
`transport.close()` on the `StdioClientTransport`. Closing only the client leaves the spawned
|
|
76
76
|
stdio server process alive after the test exits (0.4.0 cycle finding)
|
|
77
|
+
- Before a version-test cycle, run `pmx-canvas skills sync --check` in the consumer workspace —
|
|
78
|
+
exit 1 means the installed skill copies are stale against the package; run
|
|
79
|
+
`pmx-canvas skills sync --yes` to refresh them (whole trees, whatever agent layout owns them) before
|
|
80
|
+
trusting skill-guided results
|
|
77
81
|
|
|
78
82
|
## Layout And Embedded Content Checks
|
|
79
83
|
|
package/src/cli/agent.ts
CHANGED
|
@@ -31,6 +31,7 @@ import './commands/ax.js';
|
|
|
31
31
|
import './commands/webview.js';
|
|
32
32
|
import './commands/apps.js';
|
|
33
33
|
import './commands/copilot.js';
|
|
34
|
+
import './commands/skills.js';
|
|
34
35
|
|
|
35
36
|
// Re-exported for existing importers (tests import it from this module).
|
|
36
37
|
export { extractGlobalTargetFlags };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// Skill mirror commands: skills sync (+ --check drift detection).
|
|
2
|
+
//
|
|
3
|
+
// Every release cycle found installed skill copies stale against the package,
|
|
4
|
+
// and testers hand-synced complete trees before results were trustworthy.
|
|
5
|
+
// This command automates that WITHOUT assuming any agent layout: it discovers
|
|
6
|
+
// the pmx-canvas skill copies already installed in the workspace (any
|
|
7
|
+
// `<dir>/skills/<skill-name>/SKILL.md`, whatever agent owns `<dir>`) and
|
|
8
|
+
// compares/replaces whole trees — references, evals, fixtures included. It
|
|
9
|
+
// never creates a mirror where none is installed.
|
|
10
|
+
|
|
11
|
+
import { cpSync, existsSync, readFileSync, readdirSync, renameSync, rmSync } from 'node:fs';
|
|
12
|
+
import { join, resolve } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
import { cmd, output, parseFlags, showCommandHelp } from '../shared.js';
|
|
15
|
+
|
|
16
|
+
export const BUNDLED_SKILLS = ['pmx-canvas', 'pmx-canvas-testing'] as const;
|
|
17
|
+
|
|
18
|
+
function listFilesRecursive(root: string, prefix = ''): string[] {
|
|
19
|
+
const out: string[] = [];
|
|
20
|
+
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
21
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
22
|
+
if (entry.isDirectory()) {
|
|
23
|
+
out.push(...listFilesRecursive(join(root, entry.name), rel));
|
|
24
|
+
} else if (entry.isFile()) {
|
|
25
|
+
out.push(rel);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return out.sort();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SkillTreeComparison {
|
|
32
|
+
inSync: boolean;
|
|
33
|
+
/** Files present in the package tree but missing or different in the mirror. */
|
|
34
|
+
missingOrDifferent: string[];
|
|
35
|
+
/** Files present in the mirror but not in the package tree. */
|
|
36
|
+
extra: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function compareSkillTrees(sourceRoot: string, targetRoot: string): SkillTreeComparison {
|
|
40
|
+
const sourceFiles = listFilesRecursive(sourceRoot);
|
|
41
|
+
const targetFiles = listFilesRecursive(targetRoot);
|
|
42
|
+
const targetSet = new Set(targetFiles);
|
|
43
|
+
const missingOrDifferent: string[] = [];
|
|
44
|
+
for (const rel of sourceFiles) {
|
|
45
|
+
if (!targetSet.has(rel)) {
|
|
46
|
+
missingOrDifferent.push(rel);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (!readFileSync(join(sourceRoot, rel)).equals(readFileSync(join(targetRoot, rel)))) {
|
|
50
|
+
missingOrDifferent.push(rel);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const sourceSet = new Set(sourceFiles);
|
|
54
|
+
const extra = targetFiles.filter((rel) => !sourceSet.has(rel));
|
|
55
|
+
return { inSync: missingOrDifferent.length === 0 && extra.length === 0, missingOrDifferent, extra };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface InstalledSkillMirror {
|
|
59
|
+
/** The directory that owns the skills/ folder (e.g. ".codex", ".github", or any agent dir). */
|
|
60
|
+
host: string;
|
|
61
|
+
skill: string;
|
|
62
|
+
dir: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Find the bundled skills' installed copies in this workspace: any immediate
|
|
67
|
+
* child directory holding `skills/<skill>/SKILL.md`, regardless of which agent
|
|
68
|
+
* that directory belongs to. The package's own skills source is excluded so
|
|
69
|
+
* running inside the pmx-canvas checkout never compares a tree to itself.
|
|
70
|
+
*/
|
|
71
|
+
export function discoverInstalledSkillMirrors(
|
|
72
|
+
workspaceRoot: string,
|
|
73
|
+
packageSkillsRoot: string,
|
|
74
|
+
): InstalledSkillMirror[] {
|
|
75
|
+
const found: InstalledSkillMirror[] = [];
|
|
76
|
+
for (const entry of readdirSync(workspaceRoot, { withFileTypes: true })) {
|
|
77
|
+
if (!entry.isDirectory() || entry.name === 'node_modules') continue;
|
|
78
|
+
const skillsDir = join(workspaceRoot, entry.name, 'skills');
|
|
79
|
+
if (!existsSync(skillsDir)) continue;
|
|
80
|
+
for (const skill of BUNDLED_SKILLS) {
|
|
81
|
+
const dir = join(skillsDir, skill);
|
|
82
|
+
if (!existsSync(join(dir, 'SKILL.md'))) continue;
|
|
83
|
+
if (resolve(dir) === resolve(join(packageSkillsRoot, skill))) continue;
|
|
84
|
+
found.push({ host: entry.name, skill, dir });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return found;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SkillMirrorResult {
|
|
91
|
+
host: string;
|
|
92
|
+
skill: string;
|
|
93
|
+
dir: string;
|
|
94
|
+
status: 'in-sync' | 'synced' | 'drifted' | 'skipped-not-a-package-copy';
|
|
95
|
+
missingOrDifferent?: string[];
|
|
96
|
+
extra?: string[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* A mirror is only replaceable when its SKILL.md frontmatter `name:` matches
|
|
101
|
+
* the bundled skill it sits under. A user's own skill living in a same-named
|
|
102
|
+
* directory (different frontmatter identity) must never be deleted — these
|
|
103
|
+
* trees are typically gitignored, so a wrong replace is unrecoverable.
|
|
104
|
+
*/
|
|
105
|
+
export function mirrorIdentityMatches(mirrorDir: string, skill: string): boolean {
|
|
106
|
+
try {
|
|
107
|
+
const head = readFileSync(join(mirrorDir, 'SKILL.md'), 'utf-8').slice(0, 2000);
|
|
108
|
+
const match = /^name:\s*(\S+)\s*$/m.exec(head);
|
|
109
|
+
return match?.[1] === skill;
|
|
110
|
+
} catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Sync (or, with check=true, only compare) every INSTALLED mirror against the package trees. */
|
|
116
|
+
export function syncInstalledSkillMirrors(
|
|
117
|
+
packageSkillsRoot: string,
|
|
118
|
+
workspaceRoot: string,
|
|
119
|
+
opts: { check: boolean },
|
|
120
|
+
): SkillMirrorResult[] {
|
|
121
|
+
const results: SkillMirrorResult[] = [];
|
|
122
|
+
for (const mirror of discoverInstalledSkillMirrors(workspaceRoot, packageSkillsRoot)) {
|
|
123
|
+
const source = join(packageSkillsRoot, mirror.skill);
|
|
124
|
+
if (!mirrorIdentityMatches(mirror.dir, mirror.skill)) {
|
|
125
|
+
results.push({ ...mirror, status: 'skipped-not-a-package-copy' });
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const cmp = compareSkillTrees(source, mirror.dir);
|
|
129
|
+
if (cmp.inSync) {
|
|
130
|
+
results.push({ ...mirror, status: 'in-sync' });
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (opts.check) {
|
|
134
|
+
results.push({ ...mirror, status: 'drifted', ...cmp });
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
// Full-tree replace: a copy-over would leave deleted package files behind
|
|
138
|
+
// in the mirror, which is exactly the drift class release audits kept
|
|
139
|
+
// hitting even when SKILL.md hashes matched. Stage the complete new tree
|
|
140
|
+
// BESIDE the mirror first, so a crash between the rm and the rename leaves
|
|
141
|
+
// the staged copy on disk as recovery instead of losing the install.
|
|
142
|
+
const staging = `${mirror.dir}.pmx-sync-staging`;
|
|
143
|
+
rmSync(staging, { recursive: true, force: true });
|
|
144
|
+
cpSync(source, staging, { recursive: true });
|
|
145
|
+
rmSync(mirror.dir, { recursive: true, force: true });
|
|
146
|
+
renameSync(staging, mirror.dir);
|
|
147
|
+
results.push({ ...mirror, status: 'synced' });
|
|
148
|
+
}
|
|
149
|
+
return results;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ── skills sync ──────────────────────────────────────────────
|
|
153
|
+
cmd(
|
|
154
|
+
'skills sync',
|
|
155
|
+
'Refresh the pmx-canvas skill copies already installed in this workspace (any agent layout)',
|
|
156
|
+
['pmx-canvas skills sync --yes', 'pmx-canvas skills sync --check'],
|
|
157
|
+
async (args) => {
|
|
158
|
+
const { flags } = parseFlags(args);
|
|
159
|
+
if (flags.help || flags.h) return showCommandHelp('skills sync');
|
|
160
|
+
|
|
161
|
+
const packageSkillsRoot = fileURLToPath(new URL('../../../skills', import.meta.url));
|
|
162
|
+
// Replacing a mirror deletes a whole installed tree — destructive, so it
|
|
163
|
+
// follows the CLI's `--yes` contract. Without --yes (or with --check) the
|
|
164
|
+
// command only reports drift; exit 1 signals stale either way.
|
|
165
|
+
const check = flags.check === true || flags.yes !== true;
|
|
166
|
+
const results = syncInstalledSkillMirrors(packageSkillsRoot, process.cwd(), { check });
|
|
167
|
+
|
|
168
|
+
const drifted = results.filter((r) => r.status === 'drifted');
|
|
169
|
+
const ok = drifted.length === 0;
|
|
170
|
+
output({
|
|
171
|
+
ok,
|
|
172
|
+
check,
|
|
173
|
+
packageSkillsRoot,
|
|
174
|
+
mirrorsFound: results.length,
|
|
175
|
+
...(results.length === 0 ? { note: 'No installed pmx-canvas skill copies found in this workspace.' } : {}),
|
|
176
|
+
...(drifted.length > 0 && flags.yes !== true
|
|
177
|
+
? { note: 'Drift detected. Re-run with --yes to replace the drifted trees from the installed package.' }
|
|
178
|
+
: {}),
|
|
179
|
+
results,
|
|
180
|
+
});
|
|
181
|
+
if (!ok) process.exitCode = 1;
|
|
182
|
+
},
|
|
183
|
+
);
|
package/src/cli/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ const AGENT_COMMANDS = new Set([
|
|
|
66
66
|
'validate',
|
|
67
67
|
'serve',
|
|
68
68
|
'copilot',
|
|
69
|
+
'skills',
|
|
69
70
|
]);
|
|
70
71
|
|
|
71
72
|
const firstArg = args[0] ?? '';
|
|
@@ -253,7 +254,7 @@ Server options:
|
|
|
253
254
|
--log-file=PATH Daemon log file (default: ./.pmx-canvas/daemon-${port}.log)
|
|
254
255
|
--pid-file=PATH Optional daemon PID file (default: ./.pmx-canvas/daemon-${port}.pid)
|
|
255
256
|
--wait-ms=MS Health-check wait budget for daemon mode (default: 10000)
|
|
256
|
-
--theme=THEME Theme: dark (default), light, high-contrast, midnight, sepia, arctic, ember, forest
|
|
257
|
+
--theme=THEME Theme: dark (default), light, high-contrast, midnight, sepia, arctic, ember, forest, volt
|
|
257
258
|
--webview-automation Start a headless Bun.WebView automation session for /workbench
|
|
258
259
|
--webview-backend=BACKEND Bun.WebView backend: chrome or webkit
|
|
259
260
|
--webview-width=PX Automation WebView width (default: 1280)
|
|
@@ -343,6 +344,7 @@ Examples:
|
|
|
343
344
|
pmx-canvas watch --events context-pin,move-end Watch semantic deltas
|
|
344
345
|
pmx-canvas clear --dry-run Preview destructive op
|
|
345
346
|
pmx-canvas copilot install-extension --dry-run Preview Copilot adapter install
|
|
347
|
+
pmx-canvas skills sync --yes Refresh installed pmx-canvas skill copies in this workspace (--check to detect drift)
|
|
346
348
|
`);
|
|
347
349
|
process.exit(0);
|
|
348
350
|
}
|
package/src/cli/shared.ts
CHANGED
|
@@ -57,10 +57,17 @@ let pollSeq: number | null = null;
|
|
|
57
57
|
let pollGeneration = 0;
|
|
58
58
|
let sseFirstEventWatchdog: ReturnType<typeof setTimeout> | null = null;
|
|
59
59
|
|
|
60
|
-
function forcedTransport(): 'poll' | 'sse' | null {
|
|
61
|
-
if (typeof location === 'undefined') return null;
|
|
60
|
+
export function forcedTransport(): 'poll' | 'sse' | null {
|
|
61
|
+
if (typeof location === 'undefined' || typeof window === 'undefined') return null;
|
|
62
62
|
const value = new URLSearchParams(location.search).get('transport');
|
|
63
|
-
|
|
63
|
+
if (value === 'poll' || value === 'sse') return value;
|
|
64
|
+
// Amp orbs: the portal proxy buffers SSE, so auto mode burns the 3s
|
|
65
|
+
// watchdog before falling back — and on slow proxy days that trips the
|
|
66
|
+
// boot modal. The server stamps the orb flag into the page (canvasSpaHtml);
|
|
67
|
+
// go straight to the transport that works there. `?transport=sse` above
|
|
68
|
+
// still overrides for diagnosis.
|
|
69
|
+
if ((window as Window & { __PMX_AMP_ORB?: unknown }).__PMX_AMP_ORB === true) return 'poll';
|
|
70
|
+
return null;
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
// Maps responseNodeId → thread prompt node ID so response deltas/completions
|
|
@@ -1124,6 +1131,10 @@ export function connectSSE(): () => void {
|
|
|
1124
1131
|
sseFirstEventWatchdog = null;
|
|
1125
1132
|
if (gotFirstEvent || eventSource !== source) return;
|
|
1126
1133
|
console.warn('[sse-bridge] No SSE event within watchdog window — switching to polling transport.');
|
|
1134
|
+
// Give the bootstrap card a fresh deadline for the fallback transport so
|
|
1135
|
+
// the "did not finish booting" modal doesn't fire while polling is
|
|
1136
|
+
// already recovering the boot (the inline bootstrap script listens).
|
|
1137
|
+
window.dispatchEvent(new Event('pmx-canvas-boot-extend'));
|
|
1127
1138
|
source.close();
|
|
1128
1139
|
eventSource = null;
|
|
1129
1140
|
startPollingTransport();
|
|
@@ -446,6 +446,61 @@
|
|
|
446
446
|
--c-annotation: #EDF5EF;
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
+
:root[data-theme="volt"] {
|
|
450
|
+
/* ── Core palette (volt · green-tinted charcoal + coral) ── */
|
|
451
|
+
--c-bg: #0B0D0B;
|
|
452
|
+
--c-panel: #171A17;
|
|
453
|
+
--c-panel-soft: #111311;
|
|
454
|
+
--c-line: #272A27;
|
|
455
|
+
--c-text: #F6FFF5;
|
|
456
|
+
--c-text-soft: #CBD3CA;
|
|
457
|
+
--c-muted: #9CA49C;
|
|
458
|
+
--c-dim: #626962;
|
|
459
|
+
--c-accent: #F34E3F;
|
|
460
|
+
--c-ok: #52C880;
|
|
461
|
+
--c-warn: #E4C465;
|
|
462
|
+
--c-warn-alt: #FFB300;
|
|
463
|
+
--c-danger: #D67670;
|
|
464
|
+
--c-purple: #BC8FB4;
|
|
465
|
+
--c-thinking: #BC8FB4;
|
|
466
|
+
--c-subagent: #6CA0E0;
|
|
467
|
+
--c-input-bg: #111311;
|
|
468
|
+
--c-dot-grid: rgba(243, 78, 63, 0.08);
|
|
469
|
+
--c-panel-overlay: rgba(11, 13, 11, 0.6);
|
|
470
|
+
--c-panel-glass: rgba(23, 26, 23, 0.92);
|
|
471
|
+
--c-shadow: rgba(0, 0, 0, 0.3);
|
|
472
|
+
--c-shadow-heavy: rgba(0, 0, 0, 0.5);
|
|
473
|
+
--c-glow-accent: rgba(243, 78, 63, 0.15);
|
|
474
|
+
--c-surface-hover: rgba(255, 255, 255, 0.06);
|
|
475
|
+
--c-surface-subtle: rgba(255, 255, 255, 0.03);
|
|
476
|
+
--c-surface-th: rgba(255, 255, 255, 0.04);
|
|
477
|
+
--c-accent-8: rgba(243, 78, 63, 0.08);
|
|
478
|
+
--c-accent-10: rgba(243, 78, 63, 0.1);
|
|
479
|
+
--c-accent-12: rgba(243, 78, 63, 0.12);
|
|
480
|
+
--c-accent-15: rgba(243, 78, 63, 0.15);
|
|
481
|
+
--c-accent-25: rgba(243, 78, 63, 0.25);
|
|
482
|
+
--c-accent-30: rgba(243, 78, 63, 0.3);
|
|
483
|
+
--c-accent-40: rgba(243, 78, 63, 0.4);
|
|
484
|
+
--c-ok-10: rgba(82, 200, 128, 0.1);
|
|
485
|
+
--c-ok-12: rgba(82, 200, 128, 0.12);
|
|
486
|
+
--c-ok-20: rgba(82, 200, 128, 0.2);
|
|
487
|
+
--c-ok-25: rgba(82, 200, 128, 0.25);
|
|
488
|
+
--c-warn-10: rgba(228, 196, 101, 0.1);
|
|
489
|
+
--c-warn-12: rgba(228, 196, 101, 0.12);
|
|
490
|
+
--c-warn-15: rgba(228, 196, 101, 0.15);
|
|
491
|
+
--c-warn-20: rgba(228, 196, 101, 0.2);
|
|
492
|
+
--c-warn-22: rgba(228, 196, 101, 0.22);
|
|
493
|
+
--c-warn-30: rgba(228, 196, 101, 0.3);
|
|
494
|
+
--c-warn-60: rgba(228, 196, 101, 0.6);
|
|
495
|
+
--c-danger-12: rgba(214, 118, 112, 0.12);
|
|
496
|
+
--c-line-30: rgba(39, 42, 39, 0.3);
|
|
497
|
+
--c-contrast-fg: #0B0D0B;
|
|
498
|
+
--c-accent-hover: #F8695B;
|
|
499
|
+
--c-warn-hover: #EBD087;
|
|
500
|
+
--c-canvas-wash: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0));
|
|
501
|
+
--c-annotation: #F1F7F0;
|
|
502
|
+
}
|
|
503
|
+
|
|
449
504
|
* {
|
|
450
505
|
box-sizing: border-box;
|
|
451
506
|
margin: 0;
|