@marver-design/marver 0.27.0 → 0.28.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 (111) hide show
  1. package/CHANGELOG.md +195 -0
  2. package/README.md +9 -4
  3. package/dist/{anchor-check-ChdDqL5z.mjs → anchor-check-PHUOFj1N.mjs} +1 -1
  4. package/dist/{audio-Dw1lfMdb.mjs → audio-DX4POHAj.mjs} +39 -4
  5. package/dist/{board-tree-DRioF94d.mjs → board-tree-BXR8dw4b.mjs} +3 -1
  6. package/dist/{boards-DlTcpF47.mjs → boards-BeWtjGUM.mjs} +50 -5
  7. package/dist/boards-EH2onUXM.mjs +995 -0
  8. package/dist/{build-DZnFysGU.mjs → build-BsAyLMT1.mjs} +9 -22
  9. package/dist/{capture-vadKjuCo.mjs → capture-DdZ6xgoz.mjs} +92 -30
  10. package/dist/cli.mjs +56 -21
  11. package/dist/{collab-Dxg2trOK.mjs → collab-BEAcXrBb.mjs} +1 -1
  12. package/dist/{comments-DxOkCSNE.mjs → comments-CrBHPEQl.mjs} +4 -4
  13. package/dist/config-BezZTiov.mjs +182 -0
  14. package/dist/conn-BMiHS42T.mjs +222 -0
  15. package/dist/connectors-MR9d-EBP.mjs +290 -0
  16. package/dist/{context-HQ4Giw58.mjs → context-BUnFiyA3.mjs} +3 -3
  17. package/dist/{daemon-BSA0lV8d.mjs → daemon-C5dg2R-V.mjs} +2188 -183
  18. package/dist/{dev-eQJhWsqg.mjs → dev-D7YS7iT2.mjs} +25 -14
  19. package/dist/{init-COD0x48i.mjs → init-WE5lQkQL.mjs} +8 -3
  20. package/dist/jam-Cj5gBvwD.mjs +373 -0
  21. package/dist/{link-DDXZVGtv.mjs → link-BFFRgrMt.mjs} +4 -4
  22. package/dist/listener-DdLEM79A.mjs +80 -0
  23. package/dist/{ls-D7O1G505.mjs → ls-BZ5TAtd5.mjs} +1 -1
  24. package/dist/{manifest-Nl3KSVOk.mjs → manifest-DPZ3WNg_.mjs} +2 -2
  25. package/dist/{marks-CWM3WJjc.mjs → marks-Dyn6tmjp.mjs} +3 -3
  26. package/dist/{marks-CKgzucHZ.mjs → marks-Kmdab_5w.mjs} +3 -3
  27. package/dist/{marver-id-gate-BjF6v4bT.mjs → marver-id-gate-D-R0hSt_.mjs} +1 -1
  28. package/dist/perf-Cn5LiRaY.mjs +1319 -0
  29. package/dist/perf-jam-QxD_UnzN.mjs +635 -0
  30. package/dist/permit-DDa6wqOs.mjs +187 -0
  31. package/dist/plugin-C_0yb-Fq.mjs +5089 -0
  32. package/dist/{poster-Bx83ZYVK.mjs → poster-DHi6I1fO.mjs} +1 -1
  33. package/dist/{profile-Bh5Y5zpW.mjs → profile-jIS6BcAs.mjs} +1 -1
  34. package/dist/{publish-bakes-aljgm45S.mjs → publish-bakes-r4PEZuPl.mjs} +3 -3
  35. package/dist/{queue-CAM_vNmX.mjs → queue-c-6aTHEz.mjs} +164 -25
  36. package/dist/{recover-t9Pno3u9.mjs → recover-nrLEVLyJ.mjs} +2 -2
  37. package/dist/{serve-C8rVheYk.mjs → serve-Dp3nHstu.mjs} +3 -3
  38. package/dist/{session-BAaJsK5c.mjs → session-DyVE7cCk.mjs} +1 -1
  39. package/dist/{share-W5H3BNvP.mjs → share-Ce4tP7ji.mjs} +1 -1
  40. package/dist/{shot-LFhC-WYD.mjs → shot-BrRtqaiS.mjs} +34 -8
  41. package/dist/{shot-DoHLl6ig.mjs → shot-DBWN8hPP.mjs} +1 -1
  42. package/dist/sizes-wjXDev3b.mjs +139 -0
  43. package/dist/{slots-DCDo3N0x.mjs → slots-CFNnegCc.mjs} +8 -1
  44. package/dist/speech-worker.mjs +23 -3
  45. package/dist/{sync-BQVlHZpx.mjs → sync-CQdGARJ9.mjs} +1 -1
  46. package/dist/transport-C5FnY9ni.mjs +203 -0
  47. package/dist/{work-BroFwnup.mjs → work-BYWD_1Zf.mjs} +3 -3
  48. package/dist/{work-Bp1p39kq.mjs → work-DJxH7cCX.mjs} +1 -1
  49. package/docs/jam-session.md +42 -16
  50. package/docs/live-jam.md +92 -10
  51. package/docs/performance.md +197 -35
  52. package/package.json +1 -1
  53. package/src/client/content/video.tsx +10 -2
  54. package/src/client/shell/App.tsx +10 -3
  55. package/src/client/shell/Comments.tsx +5 -3
  56. package/src/client/shell/ContextMenu.tsx +5 -3
  57. package/src/client/shell/JamSurface.tsx +56 -21
  58. package/src/client/shell/LockedApp.tsx +3 -0
  59. package/src/client/shell/Play.tsx +4 -2
  60. package/src/client/shell/Tip.tsx +3 -1
  61. package/src/client/shell/api.ts +47 -20
  62. package/src/client/shell/app-bridge.ts +254 -0
  63. package/src/client/shell/app-perf.ts +92 -0
  64. package/src/client/shell/canvas/Canvas.tsx +115 -22
  65. package/src/client/shell/canvas/FrameNode.tsx +10 -6
  66. package/src/client/shell/canvas/admission.ts +23 -8
  67. package/src/client/shell/canvas/ctl.ts +6 -0
  68. package/src/client/shell/canvas/sleep.ts +57 -17
  69. package/src/client/shell/canvas/updates.ts +2 -1
  70. package/src/client/shell/icons.tsx +1 -0
  71. package/src/client/shell/inset.ts +44 -0
  72. package/src/client/shell/jam-capture.ts +113 -33
  73. package/src/client/shell/jam-keys.ts +40 -9
  74. package/src/client/shell/jam-lane.tsx +14 -5
  75. package/src/client/shell/jam-lines.ts +66 -9
  76. package/src/client/shell/jam-panel.tsx +61 -6
  77. package/src/client/shell/jam-queue.ts +50 -8
  78. package/src/client/shell/jam-session.tsx +53 -4
  79. package/src/client/shell/jam-surface-parts.tsx +6 -3
  80. package/src/client/shell/jam-ui.tsx +6 -1
  81. package/src/client/shell/jam-voice-wait.ts +21 -0
  82. package/src/client/shell/jam-voice.ts +62 -15
  83. package/src/client/shell/main.tsx +14 -1
  84. package/src/client/shell/marks-ui.tsx +5 -3
  85. package/src/client/shell/marver-app.ts +21 -0
  86. package/src/client/shell/perf-run-probe.ts +34 -0
  87. package/src/client/shell/perf-run.ts +70 -0
  88. package/src/client/shell/perf.ts +11 -0
  89. package/src/client/shell/recorder.ts +45 -3
  90. package/src/client/shell/store.ts +52 -24
  91. package/src/client/shell/styles.css +65 -17
  92. package/src/client/shell/tidy.ts +3 -2
  93. package/src/client/shell/unsaved.ts +81 -0
  94. package/src/client/shell/whiteout-probes.ts +141 -0
  95. package/src/shared/app-api.ts +205 -0
  96. package/src/shared/app-perf.ts +308 -0
  97. package/src/shared/approval.ts +20 -0
  98. package/src/shared/events.ts +1 -1
  99. package/src/shared/logo-sniff.ts +86 -0
  100. package/src/shared/machine.ts +132 -0
  101. package/src/shared/perf-run.ts +177 -0
  102. package/templates/AGENTS-embedded.md +31 -1
  103. package/templates/AGENTS-studio.md +31 -1
  104. package/templates/instructions/boards.md +10 -2
  105. package/templates/instructions/jam.md +90 -0
  106. package/dist/bake-DM_uWgAA.mjs +0 -786
  107. package/dist/boards-CGg6piKF.mjs +0 -342
  108. package/dist/perf-BWzQwZqj.mjs +0 -369
  109. package/dist/perf-BoDSkbEb.mjs +0 -429
  110. package/dist/perf-jam-D55U3FZK.mjs +0 -242
  111. package/dist/plugin-C-E7omsh.mjs +0 -2762
package/docs/live-jam.md CHANGED
@@ -42,6 +42,82 @@ With no agent CLI installed, jam stays off and both `init` and `marver dev` say
42
42
  of going quiet. Workspaces created before 0.9.0 need no re-init; they resolve the same way
43
43
  at every dev boot.
44
44
 
45
+ ## Your own session takes the work (0.28)
46
+
47
+ Start a Jam session on the canvas (`J`, or the Jam button) - that is the one switch. While it runs, your tags and
48
+ captures go to the coding-agent session you already have open in the repo, with its conversation, its tools, your MCP
49
+ servers and skills. When it cannot take a run, a copy of it does; with nothing to copy, a fresh agent with the same
50
+ power. Outside a Jam session, tags go to a background run (a copy of your last session, by default).
51
+
52
+ Nothing to set up. `marver init`, `marver dev` and starting a Jam session write each tool's hooks once, locally -
53
+ `.claude/settings.local.json`, `.codex/hooks.json`, `.cursor/hooks.json` - and keep them out of git (a committed file is
54
+ never changed; one you removed by hand is not written back until you turn that tool on again in the start sheet).
55
+
56
+ | Tool | An idle session | A session at work | A copy of it |
57
+ |---|---|---|---|
58
+ | **Claude Code** | woken through its inbox; it takes the run | reads it between tool calls | `claude -p --resume <id> --fork-session` |
59
+ | **Codex** | a copy of it does the run | its `Stop` hook turns the end of the turn into "run `marver jam next`" | `codex exec fork <id>` |
60
+ | **Cursor** | a full-power Cursor agent does the run | its `stop` hook auto-submits the follow-up | none (Cursor has no fork) |
61
+ | opencode, Grok, droid, pi | background agents | - | - |
62
+
63
+ - **Codex asks you to trust new hooks once** - type `/hooks` in Codex. The start sheet says so while no session is
64
+ connected.
65
+ - **What the session is told**: one line naming the request - "Live Jam: new request from your Marver canvas -
66
+ "Intro frame redesign" (1a2b3c4d) - run `npx marver jam next`" (the same line sent again ends "(again)": Claude
67
+ Code drops a message identical to the one before it). Claude Code shows it in the inbox as a message from another
68
+ session, with a caution that it did not come from you; `design/AGENTS.md` ("Live Jam") tells the agent to expect it and take it as your request.
69
+ - **What the session does** (design/instructions/jam.md, "Runs from the canvas"): `npx marver jam next` takes the run
70
+ and prints a short brief - your request in your words, the frames, how to answer; `jam say <handle> "On it - ..."` posts one line at once; the
71
+ work, with subagents for a capture across frames; `jam progress <handle>` on a long run; `jam done <handle> --file
72
+ <f>` hands back the replies, and the canvas posts them and frees the frames. `jam release` gives a run back,
73
+ `jam status` and `jam mute` are there too. The commands travel through files under `design/.local/jam/`, signed
74
+ with the session's own key, so a sandbox that blocks localhost cannot stop them.
75
+ - **Claude Code dispatches, so it multitasks.** Its brief opens with a few lines for the session - start ONE
76
+ background subagent (the Agent tool, `run_in_background: true`) with the part of the brief below its `----` line and
77
+ what the conversation knows that matters, then `jam next` until nothing waits, and end the turn; every run, however
78
+ small, so the next request never waits behind one - and below the line
79
+ the subagent's own prompt: it owns that run, never takes another, says "On it", works and hands it back itself. A
80
+ subagent's commands carry the session's id, so they speak for its connection; one that cannot reach it adds the
81
+ `--as <id>` its prompt names. Your session is free again in seconds, so several runs go at once: a Claude Code
82
+ session holds up to 8 (Codex and Cursor 3 - Marver gives them their runs one at a time; `jam.sessionMax` caps every
83
+ session), and runs a session holds do not count against `jam.concurrency`, which caps only the runs Marver starts. A
84
+ background subagent's built-in tools can be fewer than the session's, and a permission it needs is asked in the
85
+ session. When you move a run elsewhere, the session is told to stop the subagent on it first, so nothing edits its
86
+ frames once it is released.
87
+ - **Two requests on one frame.** One frame never has two runners - except two runs of your own session: a request on a
88
+ frame your session's run is working is offered to it at once, its ping naming the run it overlaps ("overlaps your
89
+ run r-1a2b3c4d.1"). The session decides: send it to the subagent on that frame, to do after or fold in now, or make it
90
+ a variant in a new frame placed beside it (`boards place --run`). A run your session lets go of while another of its
91
+ runs holds the frame goes back to the queue and waits for the frame; a frame any other runner holds - a copy, a fresh
92
+ agent, your agent in chat - makes the request wait, and its tile says "Waits for <frame>".
93
+ - **A request with no frame** - a capture made on an empty board, a comment on the board itself, the session record -
94
+ goes to your session beside your other runs, in a slot of your session's: with your session full, its tile says
95
+ "Waits · your session is full" until it has room or you choose another session. A capture or a comment reserves no
96
+ frame: it makes what it asks for as new frames, each put on the board with `--run <handle>` (`boards pin <board>
97
+ <scene/frame> --run <handle>` on an empty board). The session record writes its one file and nothing else. With no
98
+ session taking the work it runs alone, as before - a run Marver starts finds the frames it made only when nothing runs
99
+ beside it - and so does one your session does not take or lets go of. Its tile says "Waits to run alone", and the
100
+ requests behind it "Waits · a run goes alone first". Once its run has put a frame on the board it holds that frame, and
101
+ from then on - let go of by your session, retried or tagged again - it is a request on that frame like any other.
102
+ - **Frames placed through Marver.** A run puts a frame next to another with `npx marver boards place <board>
103
+ <scene/frame> --after|--before <scene/frame>` (`--run <handle>`: the new frame is that run's, and its review pictures
104
+ it) - never by editing the board file. A request that still needs a file no run is given (a board file, the comment
105
+ logs, local state, a frame outside its run) comes back to you as a question saying which and why, never as "the
106
+ agent did not answer".
107
+ - **Who works** shows in the start sheet - with several sessions open, the newest takes the work and one click picks
108
+ another - and on every run's tile: "Dispatching" until your session takes it, then "Claude Code is working" (or
109
+ "Codex is working", "Agent is working"). Hover the tile for whose run it is - your session, a copy of it and why a
110
+ copy took it, or a background run; the run's status in its thread says the same.
111
+ - **An offer not taken** - Claude Code not pulling it in 2 minutes, a Codex or Cursor turn ending without taking it -
112
+ goes to a copy or a fresh agent. **A run your session took and went quiet on** for 15 minutes is stalled: give it
113
+ back, run it in the background, or drop it (the tag's status, or the tile's menu). The last two wait for your session
114
+ to let go - it is told to stop, its late `done` is refused, and the frames stay reserved until it releases the run or
115
+ its process is gone.
116
+
117
+ The start sheet's switches: **MCP servers and skills** (on) and **your session's context** (on) for the runs Marver
118
+ spawns, and **collaborators' comments** (off: only your own words reach any runner). Your own session keeps the tools
119
+ you gave it; with context off, no session and no copy take work - fresh agents only.
120
+
45
121
  ## The config block
46
122
 
47
123
  ```ts
@@ -54,10 +130,17 @@ jam: { agent: "claude", concurrency: 6 },
54
130
  | `agent` | detected | The CLI the daemon spawns: `"claude"`, `"codex"`, `"cursor"`, `"droid"`, `"opencode"`, `"grok"`, or `"pi"` |
55
131
  | `concurrency` | `6` | Frames worked on at once (1-16). The same frame never gets two agents |
56
132
  | `subagents` | `true` | Inside one job, fan out one subagent per frame |
57
- | `capture` | `"confirm"` | A capture waits for its read-back, or `"at-once"` queues at `E` ([captures](jam-session.md#configuration)) |
133
+ | `capture` | `"confirm"` | No longer used (0.28): `E` queues a capture, `⇧E` stops to review it ([captures](jam-session.md#configuration)) |
58
134
  | `chime` | `true` | A soft chime when a capture is ready to review |
59
135
  | `names` | `true` | Name each capture with Claude Haiku through Claude Code - its words go to Anthropic (Claude Code only) |
60
136
  | `loc` | `true` | Stamp design elements with `data-mv-loc` (file and line, dev only) so the agent goes straight to the source |
137
+ | `runner` | `"auto"` | Who runs a batch: `"auto"` - your session during a Jam session, else a copy of it, else a fresh agent; `"session"` - wait for a session, never fall back; `"background"` - never a session |
138
+ | `session` | `true` | Connect this repo's Claude Code, Codex and Cursor sessions (their hooks). `false`: none are written, and existing ones go quiet |
139
+ | `context` | `"fork"` | Background runs copy your session; `"fresh"` starts them fresh (and no session takes work) |
140
+ | `mcp` | `true` | Background runs use your MCP servers |
141
+ | `skills` | `true` | Background runs use your skills |
142
+ | `others` | `false` | Other people's words reach the agent, labelled; off: only yours |
143
+ | `sessionMax` | unset | Runs one session holds at once - unset: 8 for Claude Code (it dispatches each to a background subagent), 3 for Codex and Cursor; set, it caps every session |
61
144
 
62
145
  Shorthands: `jam: "codex"` names the agent and takes the rest of the defaults, `jam: true`
63
146
  is the default block, and **`jam: false` is the off switch**.
@@ -71,18 +154,17 @@ that fails to parse also leaves jam off, since it may have been the file that sa
71
154
  ## What the agent may do
72
155
 
73
156
  Be clear-eyed about what this is. The real protection is not a sandbox - it is that the
74
- agent doing the work is **your own**, running on **your machine**, and **every change it
75
- makes is a diff you review** before anything is resolved. On top of that, marver removes the
76
- one tool that would turn a prompt-injected comment into silent damage: an unrestricted
77
- **shell**. Each CLI is spawned so the model can read and edit files but cannot open a shell
78
- (or, for Codex and Cursor, only a shell the OS sandbox contains and cuts off from the
79
- network):
157
+ agent doing the work is **your own**, running on **your machine**, that **only your own words
158
+ reach it** by default, and that **every change it makes is a diff you review** before anything
159
+ is resolved. Since 0.28 a run Marver spawns for Claude Code, Codex or Cursor has full power -
160
+ the shell inside the tool's own sandbox, your MCP servers and skills, a copy of your session -
161
+ because a lesser agent was the wrong trade; the other CLIs keep their jails:
80
162
 
81
163
  | | How it is spawned |
82
164
  |---|---|
83
- | **Claude Code** | `claude -p --permission-mode acceptEdits` with an allowlist of Read, Edit, Write, Glob, Grep, WebSearch, WebFetch - and `--disallowedTools Bash`, so there is no shell |
84
- | **Codex** | `codex exec -s workspace-write`, its own OS sandbox, which bounds what commands touch and blocks network egress, but still lets the model run shell commands |
85
- | **Cursor** | `cursor-agent -p --sandbox enabled --trust` - cursor's print mode carries a shell, so like Codex it runs inside the OS sandbox (verified: network egress is blocked); `--trust` only answers the workspace-trust prompt for the repo you already run `marver dev` in, and `--force` is never passed |
165
+ | **Claude Code** | `claude -p --permission-mode acceptEdits`; Bash runs in Claude Code's sandbox (writes in the repo, no network, `~/.ssh`, `~/.aws`, `~/.gnupg` and keychains unreadable - for the Read tool too - and no way out of the sandbox); every other permission question goes to `marver jam permit`, Marver's small MCP server named with `--permission-prompt-tool`: MCP tools and skills when on, the web, subagents and edits inside the repo are allowed, the rest refused, nobody is asked. A copy adds `--resume <id> --fork-session`; MCP off adds `--strict-mcp-config`, skills off `--disable-slash-commands` |
166
+ | **Codex** | `codex exec --approve-for-me` (Codex's own automatic reviewer answers approvals - MCP calls included - inside `workspace-write`, no network for the shell); a copy is `codex exec fork <id>` with the same settings; MCP off turns each server `codex mcp list` names off. Codex's sandbox does not limit reads: the shell has no network, and the reviewer judges what leaves |
167
+ | **Cursor** | `cursor-agent -p --sandbox enabled --trust`, plus `--approve-mcps` with MCP on - the shell runs inside the OS sandbox (network egress blocked); `--trust` only answers the workspace-trust prompt for the repo you already run `marver dev` in, and `--force` is never passed. Cursor's skills and already-approved MCP servers follow your own Cursor setup |
86
168
  | **droid** | `droid exec --auto low` for file edits, with `--disabled-tools` removing the shell (`Execute`), the delegation tools (`Task`, missions), and the Slack/connector tools |
87
169
  | **opencode** | `opencode run --pure` (no external plugins) with a per-run DEFAULT-DENY `OPENCODE_PERMISSION` grant - read/edit/search/web/task allowed by name, everything else (bash included) denied - never its all-approving `--auto` flag |
88
170
  | **grok** | `grok -p --tools read_file,search_replace,list_dir,grep,todo_write` - an ALLOWLIST of read/edit tools only, so the shell, web, and subagents are simply absent (a deny-list is a footgun: it can miss a tool's real name); `--permission-mode acceptEdits` auto-applies the edits |
@@ -11,6 +11,7 @@ agent. A published canvas records nothing.
11
11
  | `design/.local/perf/reloads.jsonl` | each edit and the frames it reached; page-wide reloads, sent or dropped; each frame document that booted, and how long it took | `npx marver perf` |
12
12
  | `design/.local/perf/page.jsonl` | each board load, as the page saw it: every frame's outcome, every move and why, when the board settled; gestures; errors | `npx marver perf --loads` |
13
13
  | `design/.local/perf/jam.jsonl` | Jam's timings: numbers and fixed codes only, never your words | `npx marver perf --jam` |
14
+ | `design/.local/perf/runs.jsonl` | each headless run of a board (`npx marver perf run <board>`): one line, its numbers and whether it is valid | `npx marver perf --runs` |
14
15
 
15
16
  `design/.local/` is gitignored, and `marver dev` never serves it. The perf folder is yours alone: mode 700,
16
17
  each file 600 from the moment it is made - and files an earlier version made are tightened when `marver dev`
@@ -35,11 +36,13 @@ read again because its file changed on disk (`disk-reload`) - the page follows i
35
36
  5. **Quiet.** The first second after it mounts with nothing moving, written as that second ends: it says
36
37
  when the move before it came (the mount itself, when nothing had moved yet). It is not when the board
37
38
  stopped moving - a frame that reports its height later moves it again. That is the **last move**, on
38
- the record that ends the load, settled or cut.
39
+ the record that ends the load, settled or cut. `perf --loads` prints only the last move (`still from`);
40
+ `quiet` is in `--json`.
39
41
  6. **Settled.** Every frame at its outcome, no re-flow pending or held, no frame booting or waiting its
40
- turn to, the camera still, and a second with no move - so a load never settles in under a second. It says
41
- how many moves and why, when the last one came, when the visible frames and all the frames were ready,
42
- and how heavy the board is: elements, frames awake and asleep, the heap (in Chrome).
42
+ turn to, the camera still, and the board still for one second after its last change - its last move, or
43
+ the mount when nothing moved - so a load never settles in under a second. It says how many moves and why,
44
+ when the last one came, when the visible frames and all the frames were ready, and how heavy the board
45
+ is: elements, frames awake and asleep, the heap (in Chrome).
43
46
 
44
47
  Or **cut**: another board (`switch`), the same board loaded again (`reload`), the page hidden (`hidden`),
45
48
  or 120 s without settling (`timeout`). A request that never mounted is cut too: a newer load
@@ -50,44 +53,56 @@ cut (`late`), the cut stays, and what the board does from then is late.
50
53
 
51
54
  ## Reading `perf --loads`
52
55
 
53
- A board of three content frames, opened twice. The first time no height was known; the second time the
54
- heights the first load settled at were in `design/boards/_sizes.json`:
56
+ A board of three content frames, `checkout`, titled "Checkout flow", opened twice. The first time no height
57
+ was known; the second time the heights the first load settled at were in `design/boards/_sizes.json`:
55
58
 
56
59
  ```
57
60
  $ npx marver perf --loads
58
61
  board loads, last 60 min - design/.local/perf/page.jsonl
59
62
 
60
- 3:41:36 PM Checkout (boot) settled 2.1 s
63
+ 3:41:36 PM Checkout flow (boot) settled 1.8 s
61
64
  committed 0.0 s · 3 frames (3 content) · 3 measure, 0 opened at a known height
62
- first frame started 0.36 s · visible ready 0.5 s (3 frames) · all ready 0.5 s · quiet 1.1 s · last move 1.1 s · settled 2.1 s
65
+ first frame started 0.05 s · visible ready 0.2 s (3 frames) · all ready 0.2 s · still from 0.8 s · settled 1.8 s
63
66
  5 moves, 1650 px: measure-height 3, reflow:measured 2
64
- slowest: checkout/risks 0.7 s (waited 0.42 s, then 0.28 s), checkout/flows 0.6 s (waited 0.42 s, then 0.18 s), checkout/brief 0.6 s (waited 0.36 s, then 0.24 s)
67
+ slowest to settle: checkout/risks 0.4 s (waited 0.11 s, then 0.28 s), checkout/flows 0.3 s (waited 0.11 s, then 0.18 s), checkout/brief 0.3 s (waited 0.05 s, then 0.24 s)
65
68
 
66
- 3:42:03 PM Checkout (boot) settled 1.0 s
69
+ 3:42:03 PM Checkout flow (boot) settled 1.0 s
67
70
  committed 0.0 s · 3 frames (3 content) · 3 measure, 3 opened at a known height
68
- first frame started 0.36 s · visible ready 0.5 s (3 frames) · all ready 0.5 s · quiet 0.0 s · settled 1.0 s
71
+ first frame started 0.05 s · visible ready 0.2 s (3 frames) · all ready 0.2 s · still from 0.0 s · settled 1.0 s
69
72
  0 moves
70
- slowest: checkout/risks 0.6 s (waited 0.42 s, then 0.18 s), checkout/flows 0.6 s (waited 0.42 s, then 0.18 s), checkout/brief 0.5 s (waited 0.36 s, then 0.14 s)
73
+ slowest to settle: checkout/risks 0.3 s (waited 0.11 s, then 0.18 s), checkout/flows 0.3 s (waited 0.11 s, then 0.18 s), checkout/brief 0.2 s (waited 0.05 s, then 0.14 s)
71
74
  ```
72
75
 
73
- The first load opened each frame at a guess: each reported its height (`measure-height`) and the frames
74
- below moved with the re-flow (`reflow:measured`) - five moves, the last at 1.1 s, settled at 2.1 s. The
75
- second opened at the known heights: nothing moved (so no last move), and it settled at 1.0 s, the
76
- one-second floor.
77
-
78
- Each slowest frame says how long it waited for its turn to start, then how long it took once started. The canvas
79
- starts a board's frames a few at a time: the first alone, once the first camera fit has settled - about 0.35 s after
80
- the board mounts, `first frame started` - then up to four at once, those in view first. Here every frame took a
81
- quarter of a second or less of its own; most of the time before them was the wait.
82
-
83
- `quiet` and `last move` agree here. On a heavy board they part: one that held still for its first second
84
- and then moved again as late frames reported their heights says `quiet 1.8 s · last move 15.0 s`. `quiet`
85
- is the first still second; `last move` is when it stopped moving.
76
+ Each load names its board as the sidebar does - its title, else its name - and `--json` by its name
77
+ (`board`). The first load opened each frame at a guess: each reported its height (`measure-height`) and
78
+ the frames below moved with the re-flow (`reflow:measured`) - five moves, the last at 0.8 s: still from
79
+ 0.8 s, settled at 1.8 s. The second opened at the known heights: nothing moved, so it was still from the
80
+ mount, and it settled at 1.0 s, the one-second floor.
81
+
82
+ **Ready and settled are two clocks.** A frame is *ready* at its first render: `visible ready` and `all
83
+ ready` say when the last of the frames in view, and of all the frames, was. A content frame that measures
84
+ its own height has *settled* at its last height, later; `slowest to settle` lists the frames that took
85
+ longest to reach that (ready, for a frame that does not measure), so its times can come after `all ready`.
86
+ The board has *settled* once every frame has, and it has been still for one second after its last change:
87
+ `still from` says when that stillness began - its last move, or the mount when nothing moved - and
88
+ `settled` comes a second after it at the soonest, later when a frame was still on its way.
89
+
90
+ Each frame in `slowest to settle` says how long it waited for its turn to start, then how long it took once
91
+ started. The canvas starts a board's frames a few at a time: the first alone, as the board's first camera fit
92
+ sets off - a frame after the board mounts, 0.06 s later on a switch: `first frame started` - chosen as the
93
+ one nearest the centre of where the fit will land, then up to four at once, those in view first. Here every
94
+ frame took a quarter of a second or less of its own, and none waited much more than a tenth of one.
95
+
96
+ `--json` also has `quietMs`: when the first still second after the mount began. On a heavy board they part:
97
+ one that held still for a second after a move at 1.8 s, then moved again as late frames reported their
98
+ heights, has `quietMs` 1800 and says `still from 15.0 s`. The printed report leaves `quiet` out: the settle
99
+ waits on the last move, not the first still second.
86
100
 
87
101
  A load that was cut has no ready times to give; it says how many of its frames were ready by the cut
88
102
  instead - `69 of 121 ready`, of the frames on the board then (those placed while it loaded included, those
89
- removed not) - and, after its slowest, how many never finished (`52 never finished`):
90
- `slowest` lists only frames that finished. A load can also say `never ready: ...`, `missing: ...`, its
103
+ removed not) - when it last moved (`last move`: it never settled, so nothing was still from then), and,
104
+ after its slowest, how many never finished (`52 never finished`): `slowest to settle` lists only frames
105
+ that finished. A load can also say `never ready: ...`, `missing: ...`, its
91
106
  errors (`late error` for one after it ended, settled or cut), how many errors past the first 50 went
92
107
  unrecorded, and its gestures (how many, the worst p95, the frames over 33 ms). The last line says how many
93
108
  records never reached the log, when any did.
@@ -102,15 +117,41 @@ Read the load, name the lever, change it, compare the next load - you, or your a
102
117
  ([Sizes](boards-and-folders.md#sizes)), and the next load opens at those heights (`savedHeights`
103
118
  counts them) and the moves go, as above. Commit it with the rest of `design/`, and every clone and the
104
119
  published canvas open at them too.
105
- - **`slowest`** names the frames that held the load longest, of those that finished. Look at those first:
120
+ - **`slowest to settle`** names the frames that held the load longest, of those that finished. Look at those first:
106
121
  what they load, how much they render - the time after `then` is the frame's own. A load cut before its frames
107
122
  finished counts the rest apart; cut at 120 s (`timeout`), the board is too heavy to finish - split it, or
108
123
  lighten what its frames load.
109
124
  - **A frame that waits long to start: the queue, not the frame.** `waited` (and `first frame started`) is the
110
125
  time before its turn came; nothing in the frame shortens it. On a board of many frames the last wait for those
111
- before them: fewer frames on the board, or lighter ones that hand their turn on sooner. The first frame's wait,
112
- about 0.35 s, is the canvas's own and the same on every board - a one-frame board that settles at 1.0 s has no
126
+ before them: fewer frames on the board, or lighter ones that hand their turn on sooner. The first frame's wait
127
+ is the canvas's own and about the same on every board - 0.03-0.08 s on a page's first load, 0.08-0.11 s on a
128
+ switch, the time until the camera's first fit sets off - and a one-frame board that settles at 1.0 s has no
113
129
  lever left in the project.
130
+ - **The canvas's own lever, taken in 0.27.2.** Until 0.27.0 the first frame waited 0.35 s after the board
131
+ mounted, for the first camera fit to land (`SETTLE` in `canvas/admission.ts`): that wait exists so the first
132
+ frame - booting alone, the quickest first content - is the one nearest the centre of the view you will see,
133
+ not of a camera still on its way. It now starts as the fit sets off, ranked on where the fit will land
134
+ (`canvasCtl.landing`); with no fit said (a frame added, a calm update), it waits as before. Measured on a
135
+ real project's boards - four of them, each opened three times in a fresh tab (`boot`) and three times picked
136
+ from another board (`switch`), headless Chrome at 1440x900, `perf --loads --json`, medians in ms (every frame
137
+ was in view, so visible ready and all ready are the same):
138
+
139
+ | board, frames | load | first frame started | ready | settled | moves |
140
+ |---|---|---|---|---|---|
141
+ | v1 build, 4 content | boot | 392 → 39 | 672 → 251 | 1051 → 1025 | 0 → 0 |
142
+ | v1 lo-fi, 30 | boot | 425 → 83 | 1306 → 1039 | 1370 → 1087 | 0 → 0 |
143
+ | Meeting, 14 | boot | 409 → 64 | 769 → 504 | 1029 → 1027 | 0 → 0 |
144
+ | Capture, 13 | boot | 404 → 52 | 721 → 457 | 1028 → 1019 | 0 → 0 |
145
+ | v1 build | switch | 369 → 82 | 613 → 500 | 1005 → 1005 | 0 → 0 |
146
+ | v1 lo-fi | switch | 395 → 112 | 1187 → 912 | 1194 → 1007 | 0 → 0 |
147
+ | Meeting | switch | 388 → 103 | 752 → 472 | 1005 → 1005 | 0 → 0 |
148
+ | Capture | switch | 380 → 93 | 636 → 377 | 1005 → 1005 | 0 → 0 |
149
+
150
+ Every board's first frame was the same one before and after. What it costs: that frame boots during the
151
+ fit's 0.32 s zoom over blank cards, which draws a frame or two fewer - over the twelve switches, 221 frames
152
+ drawn instead of 241, 18 intervals over 17 ms instead of 3 (4 over 33 ms instead of 3, none over 50 ms).
153
+ The boards that settle at 1.0 s were already at the one-second floor; a board whose frames finish later
154
+ settles sooner.
114
155
  - **Never ready, missing, errors** are broken frames, not slow ones: fix them first. A missing frame's
115
156
  file was deleted or renamed.
116
157
  - **The weight** (`settled.weight`) says how heavy the settled board is: elements in the page and its
@@ -203,16 +244,17 @@ counts every change to the board; `perf --loads` counts move records, where a dr
203
244
 
204
245
  ## `--json`
205
246
 
206
- `npx marver perf --loads --json` prints `{ minutes, loads, unowned, dropped }`. Each load has `board`,
207
- `cause` and `state` - `settled`, `cut`, or `open` (still going, or its end past the window) - and, as it
247
+ `npx marver perf --loads --json` prints `{ minutes, loads, unowned, dropped }`. Each load has `board` (the
248
+ board's name; the printed report shows its title), `cause` and `state` - `settled`, `cut`, or `open` (still going, or its end past the window) - and, as it
208
249
  got there:
209
250
 
210
251
  - `cut`: `reason`, `ms`, and `request: true` when the cut came before it mounted;
211
252
  - the commit: `commitMs`, `frames`, `byKind`, `measuring`, `savedHeights` - and `mountedAfterCut: true` for a
212
253
  request cut first whose board arrived after all (`perf --loads` says `cut (hidden) at 0.4 s before it
213
254
  mounted · mounted 3.2 s`, and counts its moves as late);
214
- - `visible` (with `visibleAssumed`), `visibleReadyMs`, `allReadyMs`, `quietMs`, `lastMoveMs` (settled or cut),
215
- `settledMs`;
255
+ - `visible` (with `visibleAssumed`), `visibleReadyMs`, `allReadyMs` (each frame's first render), `quietMs` (when
256
+ the first still second began), `lastMoveMs` (settled or cut; `still from` in the printed report, which says the
257
+ mount when it is absent), `settledMs`;
216
258
  - `moves`: `count`, `distance`, the top five `causes` as `[cause, count]` pairs, and `late` (count and
217
259
  causes of the moves after the load ended, settled or cut);
218
260
  - `slowest`: the five slowest frames that finished (`node`, `frame`, `ms` - when it settled, or was ready -
@@ -242,17 +284,137 @@ otherwise its last records go with `keepalive`, 16 KB at most.
242
284
  The dev server takes them only from the canvas's own page, rebuilds each from the fields its kind allows -
243
285
  strings cut to 200 characters, 512 KB a request - and appends them to `page.jsonl`.
244
286
 
287
+ ## Headless runs
288
+
289
+ `npx marver perf run <board>` measures a board the same way every time, in the canvas's own headless Chrome
290
+ (`marver dev` must be running; no app, no window): your agent's way to tell whether a change made a board
291
+ faster or slower. One line per run goes to `design/.local/perf/runs.jsonl`.
292
+
293
+ ```
294
+ $ npx marver perf run main
295
+ run 3f1c9a20b7d4e815: warming up
296
+ measuring
297
+ closing
298
+ run 3f1c9a20b7d4e815 · Main · Chrome 156 · bakes warm
299
+ load to settled 1.57 s · 4 moves · p50 16.7 ms p95 16.8 ms · 0 frames over 33 ms · heap peak 26.1 MB
300
+ valid · inputs 68cff66a… (24 files)
301
+ ```
302
+
303
+ **The script** (version 1). One warm-up load, not measured: Vite's transforms and the dependency cache warm up,
304
+ and the frames' sleep bakes compile. It waits until the board's load has ended - settled, or cut: a cut warm-up
305
+ still counts as warm - and nothing is still compiling, 60 s at most; past that the run goes on and its line says
306
+ `bakes: 'cold'`. Then a fresh browser context, the cache off, 1440 x 900 at scale 2: the board loads, settles
307
+ (120 s at most), waits again until nothing is compiling (30 s),
308
+ fits, and runs three gestures with the pointer at the canvas's centre - 40 ctrl-wheel steps in, 40 out, then a
309
+ pan of 60 steps right and 60 back - each ended by the canvas itself. `--slow` throttles the CPU 4x before the
310
+ load: a stand-in for a slower Mac's CPU, not for its GPU or its memory. `--repeat <n>` runs it up to 5 times,
311
+ one after another. Ctrl-C cancels: the line says `cancelled`. Every call to the page has 15 s to answer: a
312
+ frame whose script never returns stops the canvas's page with it, and the run ends `cut` (`unresponsive`) instead
313
+ of waiting for ever. If the dev server restarts in place during a run (an `.env` or config edit), the run's line
314
+ says `inputs` - never `cancelled` - and `perf run` says the dev server restarted.
315
+
316
+ **Read-only.** The run's page refuses every write before it is sent - board saves, heights, the seen marks,
317
+ comments, captures, Jam, work - and the dev server refuses and counts any that gets through, from the page or
318
+ from a frame. Only two kinds go out: the page's own load records (stamped with the run by the server, so
319
+ `perf --loads` leaves them out and says how many) and the sleep bakes, which only fill a cache. A video whose
320
+ generated poster is missing runs without it, and the line counts it (`postersMissing`); its frame's bake is the
321
+ run's alone, never the shared cache. A frame's own code can still write: runs are for boards whose frames do
322
+ not.
323
+
324
+ **Valid or not.** A run is valid when none of these held, and its line names the first that did:
325
+ `cancelled`, `crash` (the page or the browser crashed), `inputs` (a watched file changed during the run, even if it
326
+ was put back, or the dev server restarted), `writes` (the dev server refused a write: one that got past the page,
327
+ or a frame's own - a write the page refuses before sending is only counted, as `refusedInPage`), `cut` (the load
328
+ never settled - its `cut` says why: `unresponsive` when the page stopped answering, `driver: ...` when the run
329
+ failed for another reason, such as a page script that threw), `frames` (a frame missing or never ready), `errors`, `bakes` (still
330
+ compiling 30 s after the load), `gesture` (the camera never came to rest after the fit, a gesture the canvas never
331
+ ended within 5 s, or one in which no frame was timed - then `over33ms` is `null`, never 0), `records` (the page's
332
+ records did not all land, or some were lost to a bound on the way). `gestures` counts the run's own three that the
333
+ canvas ended. A compile of the run still running 50 s after it ends is said in its line (`bakesPending`), and the
334
+ next run, measured beside it, is `overlapped`. Headless numbers are intervals in headless Chrome - not what a display
335
+ shows.
336
+
337
+ **The inputs.** `inputs` fingerprints every file in the project the dev server watches (git status plays no part,
338
+ so an ignored file a frame imports counts) plus the board files and `_sizes.json`. Outside the project - a sibling
339
+ package's source in a monorepo - it counts the files the board itself loads: the run takes its fingerprint after its
340
+ warm-up has loaded the board, from the files that page requested, what they import directly (a stylesheet's
341
+ `@import`s) and the `tsconfig` above them, and hashes the same files again at its end. Another board's sibling
342
+ files, which the dev server watches once any page loaded them, are never in it, so two runs of a board with nothing
343
+ changed have the same inputs. `GET /__mv/api/perf/inputs?run=<id>` reads a run's own files again now (for the last
344
+ 32 runs, while the dev server runs); without `?run=` it reads every file the dev server watches. A frame importing
345
+ from a folder the dev server ignores (a sibling package's `dist/`) is not in it.
346
+
347
+ **Comparing.** `npx marver perf --runs` compares runs only inside a cohort - the same script, board, Chrome,
348
+ flags, Mac (`machine`, a profile of its own in `~/.marver/perf/machine/`), power source, `--slow` and warm or
349
+ cold bakes - and inside it by inputs: the latest run against the one before with the same inputs ("within
350
+ 10 %" of its load to settled and p95, or not), and against the last one with other inputs (the deltas).
351
+ `--against <run>` compares the latest run of its cohort made after it with that one, whatever their inputs, when you
352
+ changed something on purpose. Runs that overlapped another are listed, never compared; invalid runs are listed with
353
+ their reason. `--days <n>` (14 by default) and `--json` as elsewhere.
354
+
245
355
  ## Options
246
356
 
247
357
  | Option | |
248
358
  |---|---|
249
359
  | `--loads` | each board load in full |
250
360
  | `--jam` | Jam's timings |
361
+ | `run <board>` | a headless run of the board ([Headless runs](#headless-runs)); with `--slow` and `--repeat <n>` (1-5) |
362
+ | `--runs` | the headless runs, compared inside their cohorts; with `--against <run>` and `--days <n>` (14) |
363
+ | `--crashes` | the Mac app's crashes and hangs of this repo's canvases (below) |
364
+ | `--flashes` | the flashes marked in the Mac app, and the white-out candidates (below) |
365
+ | `--machine` | the machine profiles (below) |
366
+ | `--all` | with `--flashes`: also the marks on other canvases or on Home |
367
+ | `--days <n>` | how far back `--runs`, `--crashes`, `--flashes` and `--machine` read: 14 by default |
251
368
  | `--json` | machine-readable |
252
369
  | `--minutes <n>` | how far back to read: 60 by default (24 h with `--jam`) |
253
370
  | `--root <dir>` | the project (default: here) |
254
371
 
255
- Plain `npx marver perf` reads the reload log and ends with one line per board load.
372
+ Plain `npx marver perf` reads the reload log and ends with one line per board load. It and `--loads` leave out a
373
+ headless run's loads (`marver perf run`): they say how many.
374
+
375
+ ## The Mac app's half
376
+
377
+ The Mac app (0.2 and later) records what only the app can see, in `~/.marver/perf/`: `app.jsonl` (Marver Dev writes
378
+ `app-dev.jsonl`; one writer per file), one line per event with `{ v, ts, kind, app, seq, flavour, machine }` - `app`
379
+ names the launch, `seq` counts its lines, `machine` the profile the line was written on. Every 5 s the app samples its
380
+ processes (`getAppMetrics()`: CPU from cumulative time, memory as each process's working set, a canvas renderer's own
381
+ footprint from its page, the memory pressure level), keeps the last minute in memory and writes one `sample` line a
382
+ minute; and it records renderer and GPU process ends, hangs, GPU changes, power and thermal events, each tab's state
383
+ and document, and the time a tab switch takes to its second frame (`shown`: until the app hears back from that
384
+ frame, so the reply's own way back is in it). A minute's canvas memory per tab (`canvases.byTab`) counts a renderer
385
+ two tabs share in each of them and says `shared`; add up `canvases.memMB`, never `byTab`. A line about a tab carries
386
+ its `tab`, `ws`, `commit` and `page` - the page id the shell's hello sent, which is the `page` of its records in
387
+ `page.jsonl`. With Settings' recorder off, nothing of this is written (a flash you mark still is, and so is an
388
+ error main did not catch: a `main-error` line, in `app-dev.jsonl` for Marver Dev, written the moment it happens).
389
+ `machine/<hash>.json` holds one profile per distinct machine state (the chip, the displays and their rates, the
390
+ GPU's renderer, power): a display change, the window moved to another display, or a GPU fallback makes a new one, and
391
+ old lines keep theirs. The app keeps 14 days of it (`keepPerfDays`, pruned a few seconds after launch and then
392
+ daily), at most 5 MB a file, 50 flash pictures and 10 crash reports; a profile a headless run wrote stays at least 14
393
+ days, as long as a repo's `runs.jsonl` may name it.
394
+
395
+ `marver perf` joins the two halves by `page`, so each app event lands on the board load it happened in:
396
+
397
+ - `--crashes`: each canvas crash of this repo (not one the app ended itself: an unload, Reload Page) with its board,
398
+ whether its load had settled, the last gesture before it, and the minute before it - or, for a document that
399
+ ended before its first batch of records reached `page.jsonl`, that its page recorded nothing; hangs, and when the
400
+ page answered again; then, **by time (machine-wide)**, the GPU process's and utility processes' ends and a GPU process
401
+ replaced silently (`gpu-restart`); and how many crash reports `crashpad/completed` holds.
402
+ - `--flashes`: each flash you marked with `⌃⌥F` on this repo's canvases, with its board, the gesture you marked it
403
+ during (when it started and when it ended) or else the one that ended within 2 s of it, before or after; the GPU
404
+ process's own events within a second (its end, its replacement, a feature change - not a renderer's or a utility
405
+ process's), the pressure at the mark (unknown when the last reading was over 10 s old: with the recorder off and
406
+ nothing to unload the app reads none), thermal state, the GPU figures (machine-wide) and the picture's path, or
407
+ that it was pruned since. A mark is dated by the moment you pressed it (the state the app took then), not by its
408
+ line, which is written a second or two later, once the picture and the GPU figures are in. The picture is the app's views as the app stacks them, not the screen: it holds no traffic
409
+ lights and may miss a flash that happens in the compositor. Marks on Home or other canvases are counted (`--all`
410
+ shows them). White-out candidates, found automatically during gestures, are listed apart: automatic, not verified.
411
+ - `--machine`: the profiles, grouped by host (the app and a headless run of one Mac share its `hostHash`), which is
412
+ current, and how many records and runs name each.
413
+
414
+ A record that carries a page joins that page and no other: when the page recorded nothing, the output says so
415
+ rather than lending it the tab's earlier document. A record that carries no page (a 0.27.0 canvas, or a document that
416
+ has not said hello) is joined by workspace and time, and the output says so. The repo's workspaces are its own and every workspace in its `page.jsonl`, so a
417
+ `--recover` run's records join too.
256
418
 
257
419
  ## In the page
258
420
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marver-design/marver",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "The agent-native design canvas. A design/ folder, one command, a canvas of live frames built from your repo's real components - comment @marver and your own coding agent does the work. The tool ships no AI.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -27,6 +27,7 @@ import { useEffect, useRef, useState, useSyncExternalStore, type CSSProperties }
27
27
  import { ROUTE } from '../const.ts'
28
28
  import { assetUrl } from './md.ts'
29
29
  import { useSlidePlay } from './slide.tsx'
30
+ import { RUN_ID, RUN_PARAM } from '../../shared/perf-run.ts'
30
31
 
31
32
  const isRemote = (s: string) => /^https:\/\//.test(s)
32
33
  const resolve = (s: string): string | null => (isRemote(s) ? s : assetUrl(s))
@@ -42,6 +43,11 @@ const csrf = () => /(?:^|;\s*)mv_c=([\w-]+)/.exec(document.cookie)?.[1] ?? ''
42
43
  // it too, so a frame left open after its canvas stopped never asks another project for anything
43
44
  const WS = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('ws') : null
44
45
  const named = (h: Record<string, string> = {}) => (WS ? { ...h, 'x-mv-ws': WS } : h)
46
+ // a headless perf run (spec 28 A3.8 #17, #19): the canvas names the run in the frame's URL, and the bake that renders
47
+ // this frame for the run too. A run is read-only: a missing poster is never generated - the clip rests without one,
48
+ // in the same box, and the document says so (`data-mv-poster-skipped`), so no compile of it fills the shared cache
49
+ const RUN = (() => { try { const id = new URLSearchParams(location.search).get(RUN_PARAM); return id && RUN_ID.test(id) ? id : null } catch { return null } })()
50
+ const POSTER_SKIPPED = 'data-mv-poster-skipped'
45
51
  // in-flight probes + generations, for the shot renderer's settle (like __mvLodBusy): a
46
52
  // screenshot taken while a poster is still being rendered would show the empty box
47
53
  let busy = 0
@@ -131,7 +137,7 @@ export function Video({ src, poster, ratio, autoplay = false }: { src: string; p
131
137
  // or failed (the card). The <img> mounts only once ready: no broken-image glyph while the
132
138
  // dev server renders the poster, and a shot taken meanwhile waits on __mvPosterBusy.
133
139
  const generated = !poster && !isRemote(src) ? posterNameFor(src) : null
134
- const [gen, setGen] = useState<'probing' | 'ready' | 'failed'>(generated ? 'probing' : 'ready')
140
+ const [gen, setGen] = useState<'probing' | 'ready' | 'failed' | 'skipped'>(generated ? 'probing' : 'ready')
135
141
  const [bust, setBust] = useState(0)
136
142
  const posterUrl = poster ? resolve(poster) : generated ? resolve(generated) : null
137
143
  const posterSrc = posterUrl && bust ? `${posterUrl}?v=${bust}` : posterUrl
@@ -144,9 +150,11 @@ export function Video({ src, poster, ratio, autoplay = false }: { src: string; p
144
150
  busy++
145
151
  const done = () => { if (pending) { pending = false; busy-- } }
146
152
  const probe = new Image()
147
- const settle = (state: 'ready' | 'failed', rebust = false) => { done(); if (!alive) return; if (rebust) setBust(Date.now()); setGen(state) }
153
+ const settle = (state: 'ready' | 'failed' | 'skipped', rebust = false) => { done(); if (!alive) return; if (rebust) setBust(Date.now()); setGen(state) }
148
154
  probe.onload = () => settle('ready')
149
155
  probe.onerror = () => {
156
+ // a perf run asks for nothing: the box rests without its poster
157
+ if (RUN) { document.documentElement.setAttribute(POSTER_SKIPPED, ''); return settle('skipped') }
150
158
  // not there yet: ask the dev server to render it (once per clip per document)
151
159
  void requestPoster(src).then((ok) => settle(ok ? 'ready' : 'failed', ok))
152
160
  }
@@ -9,6 +9,9 @@ import { Component, useEffect, useLayoutEffect, useRef, useState, type MouseEven
9
9
  import { useStore, BOARD_GONE, CONFIG, CANVAS_NAME, DISK_WON, LOCKED_SHELL, PUBLISHED, SOURCE_REVEALED, stoppedFor, logReload, takeReloadCause, addToBoard, boardLabel, cap, humanize, fetchBoardNames, landingBoard, tabTitle, hydrateBoardPolicy, landingMode, playsAsSlides, sceneLabel, switchCount, type FrameEntry } from './store.ts'
10
10
  import { AddToBoard, BoardList } from './BoardList.tsx'
11
11
  import { ContextMenu, copyToClipboard, framePath, useContextMenu, type MenuItem } from './ContextMenu.tsx'
12
+ import { TOP } from './inset.ts'
13
+ // a headless run's probe (main.tsx): canvas code, so it comes through this module, never into a locked bundle
14
+ export { startPerfRunProbe } from './perf-run-probe.ts'
12
15
  import { Tip } from './Tip.tsx'
13
16
  import { PKG, ROUTE } from '../const.ts'
14
17
  import { api, resumed, scoped, useLink } from './api.ts'
@@ -170,7 +173,8 @@ function SelectionBar() {
170
173
  left: barW
171
174
  ? `clamp(8px, calc(${centerX} - ${Math.round(barW / 2)}px), calc(100vw - ${barW + 8}px))`
172
175
  : centerX,
173
- top: `clamp(8px, ${rawTop}, calc(100vh - 52px))`,
176
+ // below the Mac app's strip and its scroll edge when the shell took the inset (TOP 44: 52 px; else 8)
177
+ top: `clamp(${TOP + 8}px, ${rawTop}, calc(100vh - 52px))`,
174
178
  transform: barW ? undefined : 'translateX(-50%)',
175
179
  }}
176
180
  >
@@ -916,6 +920,8 @@ export function App() {
916
920
  return (
917
921
  <div ref={appRef} tabIndex={-1} className={`sh-app${dark ? ' dark' : ''}${interacting ? ' interacting' : ''}${laneLift}`}>
918
922
  <Canvas />
923
+ {/* the scroll edge under the Mac app's transparent strip (0.27.2, A3.8 #31): over the world, under the chrome */}
924
+ {TOP ? <div className="sh-edge" aria-hidden="true" /> : null}
919
925
  <SelectionBar />
920
926
 
921
927
  {/* floating pill panel (no top bar - spec); panel and fab are both always
@@ -1182,8 +1188,9 @@ function placeBanner(el: HTMLElement) {
1182
1188
  // the toolbar row: its centre line, and its foot - the sidebar runs down the page, so it is no part of the row
1183
1189
  const tall = !!left && left.bottom - left.top > 64
1184
1190
  const row = [right, tall ? null : left].filter((b): b is NonNullable<typeof b> => !!b)
1185
- const mid = row.length ? Math.max(...row.map((b) => (b.top + b.bottom) / 2)) : edge + 23
1186
- const foot = Math.max(edge + 46, ...row.map((b) => b.bottom))
1191
+ // with no row to measure: the toolbar's line, below the Mac app's strip when the shell took the inset
1192
+ const mid = row.length ? Math.max(...row.map((b) => (b.top + b.bottom) / 2)) : TOP + edge + 23
1193
+ const foot = Math.max(TOP + edge + 46, ...row.map((b) => b.bottom))
1187
1194
  const W = app.clientWidth
1188
1195
  const from = left ? left.right + BANNER_GAP : edge, to = right ? right.left - BANNER_GAP : W - edge
1189
1196
  const at = (where: 'row' | 'stack' | 'below', x0: number, x1: number, top?: number) => {
@@ -5,6 +5,7 @@
5
5
  * size via --sh-inv (the vbadge pattern) so zoom never shrinks them away, and never
6
6
  * overlap (pin-layout.ts places them).
7
7
  */
8
+ import { TOP } from './inset.ts'
8
9
  import { useEffect, useMemo, useRef, useState } from 'react'
9
10
  import { createPortal } from 'react-dom'
10
11
  import { avatarFallback, useComments } from './comments-store.ts'
@@ -729,15 +730,16 @@ export function ThreadCard({ thread, at, bounds, nodeKey, side = 'r', flank, sta
729
730
  // a device/theme switch resizes .sh-play-stage and a window resize shifts it.
730
731
  const computeStagePos = (): React.CSSProperties | null => {
731
732
  if (!stage) return null
732
- const W = 320, M = 12, maxH = Math.min(660, window.innerHeight - 2 * M)
733
+ // the view below the Mac app's strip when the shell took the inset (TOP 44)
734
+ const W = 320, M = 12, maxH = Math.min(660, window.innerHeight - TOP - 2 * M)
733
735
  const rect = document.querySelector('.sh-play-stage')?.getBoundingClientRect()
734
- if (!rect) return { position: 'fixed', left: M, top: 72, maxHeight: maxH }
736
+ if (!rect) return { position: 'fixed', left: M, top: TOP + 72, maxHeight: maxH }
735
737
  const roomR = window.innerWidth - rect.right >= W + 30
736
738
  const roomL = rect.left >= W + 30
737
739
  const s: 'l' | 'r' = at.x < bounds.w / 2 ? (roomL ? 'l' : 'r') : (roomR ? 'r' : 'l')
738
740
  const x = Math.min(Math.max(s === 'r' ? rect.right + 18 : rect.left - 18 - W, M), window.innerWidth - W - M)
739
741
  // worst-case clamp (content = maxH): even a full-height thread keeps its composer on screen
740
- const y = Math.min(Math.max(rect.top + at.y - 36, M), Math.max(M, window.innerHeight - maxH - M))
742
+ const y = Math.min(Math.max(rect.top + at.y - 36, TOP + M), Math.max(TOP + M, window.innerHeight - maxH - M))
741
743
  return { position: 'fixed', left: x, top: y, maxHeight: maxH }
742
744
  }
743
745
  const [stagePos, setStagePos] = useState<React.CSSProperties | null>(computeStagePos)
@@ -2,6 +2,7 @@ import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 're
2
2
  import { createPortal } from 'react-dom'
3
3
  import { useStore, SOURCE_REVEALED } from './store.ts'
4
4
  import { UNPLACED } from './hash.ts'
5
+ import { TOP } from './inset.ts'
5
6
 
6
7
  /** Copy text to the clipboard, toasting the outcome. Success is confirmed out loud; a
7
8
  * blocked clipboard (no user gesture / permission) says so instead of failing silently. */
@@ -35,8 +36,9 @@ export function useContextMenu() {
35
36
  e.preventDefault()
36
37
  const MENU_W = 240 // the CSS max-width; labels ellipsize inside it
37
38
  // a menu taller than the window (many "Move to …" folders) pins to the top edge and scrolls
38
- const h = Math.min(items.length * 32 + 12, window.innerHeight - 16)
39
- setMenu({ x: Math.max(8, Math.min(e.clientX, window.innerWidth - MENU_W - 8)), y: Math.max(8, Math.min(e.clientY, window.innerHeight - h - 8)), items })
39
+ // ...and never under the Mac app's strip (TOP 44 when the shell took the inset)
40
+ const h = Math.min(items.length * 32 + 12, window.innerHeight - 16 - TOP)
41
+ setMenu({ x: Math.max(8, Math.min(e.clientX, window.innerWidth - MENU_W - 8)), y: Math.max(TOP + 8, Math.min(e.clientY, window.innerHeight - h - 8)), items })
40
42
  }
41
43
  return { menu, open, close: () => setMenu(null) }
42
44
  }
@@ -50,7 +52,7 @@ export function ContextMenu({ menu, close }: { menu: MenuState | null; close: ()
50
52
  useLayoutEffect(() => {
51
53
  if (!menu || !ref.current) return
52
54
  const h = ref.current.getBoundingClientRect().height
53
- setTop(Math.max(8, Math.min(menu.y, window.innerHeight - h - 8)))
55
+ setTop(Math.max(TOP + 8, Math.min(menu.y, window.innerHeight - h - 8)))
54
56
  }, [menu, panel])
55
57
  useEffect(() => {
56
58
  if (!menu) return