@marver-design/marver 0.26.0 → 0.27.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 (96) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +10 -5
  3. package/dist/{anchor-check-Dg5xpNnU.mjs → anchor-check-ChdDqL5z.mjs} +1 -1
  4. package/dist/{audio-CmSRYFEs.mjs → audio-Dw1lfMdb.mjs} +14 -0
  5. package/dist/{bake-DtVlm0_F.mjs → bake-DM_uWgAA.mjs} +1 -1
  6. package/dist/{boards-DYG22tOe.mjs → boards-DlTcpF47.mjs} +1 -1
  7. package/dist/{build-C_gUgcdC.mjs → build-DZnFysGU.mjs} +4 -4
  8. package/dist/{capture-CrqvU_jh.mjs → capture-vadKjuCo.mjs} +2 -1
  9. package/dist/cli.mjs +28 -16
  10. package/dist/{comments-BqXua-XL.mjs → comments-DxOkCSNE.mjs} +4 -4
  11. package/dist/{daemon-DZo6o3rU.mjs → daemon-BSA0lV8d.mjs} +400 -274
  12. package/dist/detect-C0wpaePX.mjs +125 -0
  13. package/dist/dev-eQJhWsqg.mjs +1273 -0
  14. package/dist/dev-lock-C_FC70Mu.mjs +65 -0
  15. package/dist/exclusive-B1RtpeeP.mjs +150 -0
  16. package/dist/{init-D8DtrK_F.mjs → init-COD0x48i.mjs} +5 -3
  17. package/dist/{link-BNzLvdhI.mjs → link-DDXZVGtv.mjs} +20 -8
  18. package/dist/ls-D7O1G505.mjs +38 -0
  19. package/dist/{marks-NQi0wZJ4.mjs → marks-CWM3WJjc.mjs} +1 -1
  20. package/dist/perf-BWzQwZqj.mjs +369 -0
  21. package/dist/perf-BoDSkbEb.mjs +429 -0
  22. package/dist/perf-jam-D55U3FZK.mjs +242 -0
  23. package/dist/{plugin-CTD0rydA.mjs → plugin-C-E7omsh.mjs} +425 -66
  24. package/dist/{poster-ChjXGTS5.mjs → poster-Bx83ZYVK.mjs} +2 -1
  25. package/dist/{profile-WU9qcbIo.mjs → profile-Bh5Y5zpW.mjs} +1 -1
  26. package/dist/{publish-bakes-CEP_2NRc.mjs → publish-bakes-aljgm45S.mjs} +2 -2
  27. package/dist/{queue-BuiCKSX1.mjs → queue-CAM_vNmX.mjs} +3 -3
  28. package/dist/recover-t9Pno3u9.mjs +66 -0
  29. package/dist/{session-qZWKt_VA.mjs → session-BAaJsK5c.mjs} +1 -1
  30. package/dist/{share--oFJ1bCI.mjs → share-W5H3BNvP.mjs} +1 -1
  31. package/dist/shot-DoHLl6ig.mjs +139 -0
  32. package/dist/{shot-DqcxJibP.mjs → shot-LFhC-WYD.mjs} +343 -19
  33. package/dist/slots-DCDo3N0x.mjs +471 -0
  34. package/dist/speech-worker.mjs +40 -5
  35. package/dist/{sync-DKk-yT1V.mjs → sync-BQVlHZpx.mjs} +4 -3
  36. package/dist/{work-F5u-twpJ.mjs → work-Bp1p39kq.mjs} +4 -2
  37. package/dist/{work-VvX_JIgl.mjs → work-BroFwnup.mjs} +4 -2
  38. package/docs/boards-and-folders.md +3 -1
  39. package/docs/jam-session.md +78 -7
  40. package/docs/live-jam.md +8 -0
  41. package/docs/performance.md +262 -0
  42. package/package.json +2 -2
  43. package/src/client/content/index.tsx +3 -0
  44. package/src/client/content/video.tsx +6 -2
  45. package/src/client/frame-host/bridge.js +22 -6
  46. package/src/client/frame-host/inspect.js +8 -3
  47. package/src/client/frame-host/keys.js +6 -2
  48. package/src/client/frame-host/main.tsx +17 -5
  49. package/src/client/shell/App.tsx +188 -29
  50. package/src/client/shell/BoardList.tsx +5 -5
  51. package/src/client/shell/Comments.tsx +3 -2
  52. package/src/client/shell/JamSurface.tsx +13 -5
  53. package/src/client/shell/LockedApp.tsx +5 -5
  54. package/src/client/shell/Play.tsx +27 -15
  55. package/src/client/shell/Toolbar.tsx +17 -5
  56. package/src/client/shell/api.ts +206 -0
  57. package/src/client/shell/canvas/Canvas.tsx +30 -3
  58. package/src/client/shell/canvas/FrameNode.tsx +15 -5
  59. package/src/client/shell/canvas/admission.ts +8 -1
  60. package/src/client/shell/canvas/camera-broadcast.ts +15 -5
  61. package/src/client/shell/canvas/ctl.ts +2 -0
  62. package/src/client/shell/canvas/frame-registry.ts +28 -2
  63. package/src/client/shell/canvas/sleep.ts +4 -1
  64. package/src/client/shell/comments-store.ts +12 -4
  65. package/src/client/shell/goto.ts +22 -10
  66. package/src/client/shell/icons.tsx +2 -0
  67. package/src/client/shell/jam-capture.ts +96 -16
  68. package/src/client/shell/jam-keys.ts +51 -18
  69. package/src/client/shell/jam-lane.tsx +46 -5
  70. package/src/client/shell/jam-panel.tsx +66 -13
  71. package/src/client/shell/jam-queue.ts +3 -3
  72. package/src/client/shell/jam-session.tsx +14 -8
  73. package/src/client/shell/jam-state.ts +48 -6
  74. package/src/client/shell/jam-surface-parts.tsx +10 -6
  75. package/src/client/shell/jam-voice.ts +7 -5
  76. package/src/client/shell/legacy-links.ts +2 -2
  77. package/src/client/shell/main.tsx +4 -0
  78. package/src/client/shell/notes.ts +8 -1
  79. package/src/client/shell/perf.ts +69 -58
  80. package/src/client/shell/recorder-core.ts +183 -0
  81. package/src/client/shell/recorder.ts +565 -0
  82. package/src/client/shell/store.ts +268 -103
  83. package/src/client/shell/styles.css +54 -9
  84. package/src/client/stage/main.tsx +2 -0
  85. package/templates/AGENTS-embedded.md +22 -4
  86. package/templates/AGENTS-studio.md +22 -4
  87. package/templates/demo/dark.tsx +1 -1
  88. package/templates/demo/welcome.tsx +1 -1
  89. package/templates/instructions/jam.md +5 -3
  90. package/templates/instructions/welcome.md +6 -3
  91. package/dist/config-Cf7EjAMf.mjs +0 -292
  92. package/dist/dev-_Nlsc6v9.mjs +0 -742
  93. package/dist/dev-lock-DWSpa6nj.mjs +0 -179
  94. package/dist/perf-D6VmmJ2q.mjs +0 -68
  95. package/dist/perf-DPbLGhhO.mjs +0 -49
  96. package/dist/shot-CNbHoZ6H.mjs +0 -86
@@ -1,4 +1,4 @@
1
- import { capture, t as findChrome } from "./shot-DqcxJibP.mjs";
1
+ import { capture, t as findChrome } from "./shot-LFhC-WYD.mjs";
2
2
  import { constants, copyFileSync, existsSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, join, sep } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
@@ -120,6 +120,7 @@ async function ensurePosterNow(assetsDir, src, out) {
120
120
  ok: false,
121
121
  error: `could not render a poster for ${basename(src)} - ${r.error}`
122
122
  };
123
+ if (r.note && /not checked for a stale surface/.test(r.note)) console.warn(`[marver] poster ${basename(src)}: ${r.note}`);
123
124
  try {
124
125
  copyFileSync(tmp, out, constants.COPYFILE_EXCL);
125
126
  } catch (err) {
@@ -1,4 +1,4 @@
1
- import { i as loadCollab } from "./sync-DKk-yT1V.mjs";
1
+ import { i as loadCollab } from "./sync-BQVlHZpx.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  //#region src/server/profile.ts
@@ -1,6 +1,6 @@
1
1
  import { o as slideSize } from "./cli.mjs";
2
- import { planShot, t as findChrome } from "./shot-DqcxJibP.mjs";
3
- import { ASK_MAX, bakeBatch } from "./bake-DtVlm0_F.mjs";
2
+ import { planShot, t as findChrome } from "./shot-LFhC-WYD.mjs";
3
+ import { ASK_MAX, bakeBatch } from "./bake-DM_uWgAA.mjs";
4
4
  import { MIME } from "./serve-C8rVheYk.mjs";
5
5
  import { copyFileSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { extname, isAbsolute, join, relative, resolve } from "node:path";
@@ -1,9 +1,9 @@
1
- import { r as pidRuns, t as createExclusive } from "./dev-lock-DWSpa6nj.mjs";
1
+ import { n as createExclusive, r as pidRuns } from "./exclusive-B1RtpeeP.mjs";
2
2
  import { r as replay } from "./events-CLH4ijKP.mjs";
3
3
  import { a as readLog, i as listBoards } from "./comments-0BSbb04K.mjs";
4
4
  import { a as deviceId, r as owned } from "./ledger-D54iROST.mjs";
5
- import { S as threadId, _ as packetPath, b as sanitize, f as readCapture, h as buildPacket, l as hashOf, m as wordsSince, n as captureFrames, r as captureWords, s as factsOf, u as madeOf } from "./capture-CrqvU_jh.mjs";
6
- import { i as readWrapup, o as recordPathProblem } from "./session-qZWKt_VA.mjs";
5
+ import { S as threadId, _ as packetPath, b as sanitize, f as readCapture, h as buildPacket, l as hashOf, m as wordsSince, n as captureFrames, r as captureWords, s as factsOf, u as madeOf } from "./capture-vadKjuCo.mjs";
6
+ import { i as readWrapup, o as recordPathProblem } from "./session-BAaJsK5c.mjs";
7
7
  import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  import { randomBytes, randomUUID } from "node:crypto";
@@ -0,0 +1,66 @@
1
+ import { r as NAME } from "./cli.mjs";
2
+ import { d as recoverTarget, h as workspaceId, r as legacyEntry, u as recoverEntries } from "./slots-DCDo3N0x.mjs";
3
+ import { DevStartError, dev } from "./dev-eQJhWsqg.mjs";
4
+ //#region src/cli/recover.ts
5
+ /**
6
+ * `marver dev --recover` (spec 28 A1.6). A Jam capture the page could not send waits in that browser's
7
+ * storage, at that page's address and under that workspace key, and goes out the next time a canvas
8
+ * opens there. When the canvas moved (0.27 moved every canvas to a slot; a later start can land on
9
+ * another slot), this starts it again on exactly an earlier address: its port, the address it bound,
10
+ * and the workspace key that run used - never another one. Alone it lists them: the project's recorded
11
+ * addresses, newest first, then the one 0.26 gave the folder.
12
+ */
13
+ const MONTHS = [
14
+ "Jan",
15
+ "Feb",
16
+ "Mar",
17
+ "Apr",
18
+ "May",
19
+ "Jun",
20
+ "Jul",
21
+ "Aug",
22
+ "Sep",
23
+ "Oct",
24
+ "Nov",
25
+ "Dec"
26
+ ];
27
+ const when = (t) => {
28
+ const d = new Date(t);
29
+ return `${d.getDate()} ${MONTHS[d.getMonth()]} ${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
30
+ };
31
+ /** The list `--recover` prints (tests read `^\s+(\d+)\s+(http://localhost:\d+/)`). */
32
+ function formatEntries(root, entries) {
33
+ const own = workspaceId(root);
34
+ const width = Math.max(...entries.map((e) => e.url.length));
35
+ return [
36
+ "addresses this canvas ran on, newest first:",
37
+ ...entries.map((e, i) => ` ${String(i + 1).padStart(2)} ${e.url.padEnd(width)} ${e.legacy ? "the address 0.26 gave it" : `bound ${e.bind} ${e.from ? when(e.from) : "?"} - ${e.until ? when(e.until) : "?"}`}${e.ws !== own ? " (another workspace key)" : ""}`),
38
+ `start on one: npx ${NAME} dev --recover <n> - then open its link in the browser that made the capture`
39
+ ];
40
+ }
41
+ /** `--recover` alone (cac hands over `true`), `--recover <n>` (a number or its string), or `--recover --port <p>`. */
42
+ async function recoverCommand(root, which, port, with_ = {}) {
43
+ const listOnly = which === true || which === "";
44
+ if (!listOnly && port !== void 0) throw new DevStartError("give --recover <n>, or --recover --port <p> - not both");
45
+ if (port !== void 0) {
46
+ await dev(root, {
47
+ ...with_,
48
+ recover: recoverTarget(legacyEntry(root, port))
49
+ });
50
+ return;
51
+ }
52
+ const entries = recoverEntries(root);
53
+ if (listOnly) {
54
+ console.log(`\n${formatEntries(root, entries).map((l) => ` ${l}`).join("\n")}\n`);
55
+ return;
56
+ }
57
+ const n = Number(which);
58
+ const entry = Number.isInteger(n) && n >= 1 ? entries[n - 1] : void 0;
59
+ if (!entry) throw new DevStartError(`no address ${String(which)} - npx ${NAME} dev --recover lists them`);
60
+ await dev(root, {
61
+ ...with_,
62
+ recover: recoverTarget(entry)
63
+ });
64
+ }
65
+ //#endregion
66
+ export { recoverCommand };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { f as readCapture } from "./capture-CrqvU_jh.mjs";
2
+ import { f as readCapture } from "./capture-vadKjuCo.mjs";
3
3
  import { appendFileSync, closeSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, writeSync } from "node:fs";
4
4
  import { dirname, join, relative, sep } from "node:path";
5
5
  import { createHash, randomBytes } from "node:crypto";
@@ -1,6 +1,6 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
2
  import { M as resolveAccess } from "./auth-Dix8wrXV.mjs";
3
- import { i as loadCollab } from "./sync-DKk-yT1V.mjs";
3
+ import { i as loadCollab } from "./sync-BQVlHZpx.mjs";
4
4
  //#region src/cli/share.ts
5
5
  /**
6
6
  * `marver share <action>` - the roster from the terminal (01-sharing §9).
@@ -0,0 +1,139 @@
1
+ import { r as NAME } from "./cli.mjs";
2
+ import { i as readDevInfo } from "./work-Bp1p39kq.mjs";
3
+ import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { randomBytes } from "node:crypto";
6
+ //#region src/cli/shot.ts
7
+ /**
8
+ * `marver shot <scene/frame> [...]`, `--scene <name>`, `--all` - render frames headless and
9
+ * print the PNG paths, one per line, in the order asked.
10
+ *
11
+ * The shell-ful agents' door into the same verify loop jam teaches: build, shoot, LOOK. One
12
+ * frame goes through /api/shot; several, a scene or everything go through /api/shots as ONE
13
+ * operation (one browser, several frames at a time), so shooting a scene costs about what
14
+ * shooting a frame did. shot.ts (server) has the capture story.
15
+ */
16
+ /** The fetch never reached the server: refused, unreachable, or forbidden by a sandbox (Codex's blocks the network,
17
+ * localhost included). Only these move a shot to the file inbox - never an HTTP answer, never a failure after the
18
+ * request went out. */
19
+ const CONNECT = /* @__PURE__ */ new Set([
20
+ "ECONNREFUSED",
21
+ "EPERM",
22
+ "EACCES",
23
+ "EHOSTUNREACH",
24
+ "ENETUNREACH",
25
+ "EADDRNOTAVAIL"
26
+ ]);
27
+ function cannotConnect(err) {
28
+ const cause = err?.cause;
29
+ if (!cause) return false;
30
+ if (Array.isArray(cause.errors) && cause.errors.length) return cause.errors.every((e) => !!e?.code && CONNECT.has(e.code));
31
+ return !!cause.code && CONNECT.has(cause.code);
32
+ }
33
+ /** The same request through the file inbox the dev server watches (design/.local/shots): a name of its own, written
34
+ * whole, its own result read and both files removed. Waiting stops at `ms` - it does not cancel; a request still
35
+ * unclaimed then is removed, so it never runs later. */
36
+ async function viaInbox(root, spec, ms) {
37
+ const inbox = join(root, "design", ".local", "shots");
38
+ const name = `cli-${randomBytes(8).toString("hex")}`;
39
+ const request = join(inbox, `${name}.request.json`), result = join(inbox, `${name}.result.json`);
40
+ try {
41
+ const tmp = join(inbox, `.${name}.tmp`);
42
+ writeFileSync(tmp, JSON.stringify(spec));
43
+ renameSync(tmp, request);
44
+ } catch (err) {
45
+ throw new Error(`could not reach \`${NAME} dev\` (the network is blocked here) and could not write to design/.local/shots - ${err.message}`);
46
+ }
47
+ for (const by = Date.now() + ms; Date.now() < by;) {
48
+ if (existsSync(result)) try {
49
+ const data = JSON.parse(readFileSync(result, "utf8"));
50
+ rmSync(result, { force: true });
51
+ return data;
52
+ } catch {}
53
+ await new Promise((r) => setTimeout(r, 150));
54
+ }
55
+ rmSync(request, { force: true });
56
+ throw new Error(`stopped waiting for \`${NAME} dev\` after ${Math.round(ms / 1e3)} s (asked through design/.local/shots - the network is blocked here)`);
57
+ }
58
+ async function shotCommand(root, frames, opts) {
59
+ const usage = `${NAME} shot <scene/frame ...> | --scene <name> | --all [--theme <name>] [--scale 1-4] [--json]`;
60
+ if ([
61
+ frames.length > 0,
62
+ !!opts.scene,
63
+ !!opts.all
64
+ ].filter(Boolean).length !== 1) throw new Error(`name the frames, one way: ${usage}`);
65
+ const info = readDevInfo(root);
66
+ if (!info) throw new Error(`\`${NAME} dev\` is not running in this repo (design/.local/dev.json not found) - start it first.`);
67
+ const scale = opts.scale != null ? Number(opts.scale) : void 0;
68
+ const theme = opts.theme;
69
+ const single = frames.length === 1 && !opts.scene && !opts.all;
70
+ const sel = single ? { frame: frames[0] } : opts.all ? { all: true } : opts.scene ? { scene: opts.scene } : { frames };
71
+ let data;
72
+ try {
73
+ let res;
74
+ if (single) {
75
+ const qs = new URLSearchParams({
76
+ frame: frames[0],
77
+ ...theme ? { theme } : {},
78
+ ...scale != null ? { scale: String(scale) } : {}
79
+ });
80
+ res = await fetch(`http://localhost:${info.port}/__mv/api/shot?${qs}`, { headers: { "x-mv-work": info.token } });
81
+ } else res = await fetch(`http://localhost:${info.port}/__mv/api/shots`, {
82
+ method: "POST",
83
+ headers: {
84
+ "x-mv-work": info.token,
85
+ "content-type": "application/json"
86
+ },
87
+ body: JSON.stringify({
88
+ ...sel,
89
+ ...theme ? { theme } : {},
90
+ ...scale != null ? { scale } : {}
91
+ })
92
+ });
93
+ data = await res.json().catch(() => ({}));
94
+ if (!res.ok) throw Object.assign(new Error(data.error ?? `shot failed (${res.status})`), { answered: true });
95
+ } catch (err) {
96
+ if (err.answered) throw err;
97
+ if (!cannotConnect(err)) throw new Error(`could not reach \`${NAME} dev\` on port ${info.port} - is it still running?`);
98
+ const waitMs = Number(process.env.MARVER_SHOT_INBOX_WAIT_MS) > 0 ? Number(process.env.MARVER_SHOT_INBOX_WAIT_MS) : single ? 12e4 : 6e5;
99
+ data = await viaInbox(root, {
100
+ ...sel,
101
+ ...theme ? { theme } : {},
102
+ ...scale != null ? { scale } : {}
103
+ }, waitMs);
104
+ if (data.ok === false) throw new Error(String(data.error ?? "shot failed"));
105
+ }
106
+ const one = data;
107
+ const results = single ? [one.path ? {
108
+ frame: frames[0],
109
+ ok: true,
110
+ path: one.path,
111
+ width: one.width,
112
+ height: one.height,
113
+ scale: one.scale,
114
+ ...one.truncated ? { truncated: true } : {},
115
+ ...one.unsettled ? { unsettled: true } : {},
116
+ ...one.note ? { note: one.note } : {},
117
+ recaptures: one.recaptures ?? 0
118
+ } : {
119
+ frame: frames[0],
120
+ ok: false,
121
+ error: one.error ?? "shot failed"
122
+ }] : data.results ?? [];
123
+ if (opts.json) {
124
+ console.log(JSON.stringify({ results }, null, 2));
125
+ if (results.some((r) => !r.ok)) process.exitCode = 1;
126
+ return;
127
+ }
128
+ let failed = false;
129
+ for (const r of results) if (r.ok) {
130
+ console.log(r.path);
131
+ if (r.note) console.error(`${r.frame}: ${r.note}`);
132
+ } else {
133
+ failed = true;
134
+ console.error(`${r.frame}: ${r.error}`);
135
+ }
136
+ if (failed) process.exitCode = 1;
137
+ }
138
+ //#endregion
139
+ export { shotCommand };