@marver-design/marver 0.26.1 → 0.27.2

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 (109) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/README.md +12 -4
  3. package/dist/{anchor-check-l-ny3UzH.mjs → anchor-check-gkxkPAIv.mjs} +1 -1
  4. package/dist/{board-tree-DRioF94d.mjs → board-tree-BXR8dw4b.mjs} +3 -1
  5. package/dist/{boards-CGg6piKF.mjs → boards-BHKP5yhI.mjs} +1 -1
  6. package/dist/{boards-DYG22tOe.mjs → boards-BqUqKNW8.mjs} +4 -4
  7. package/dist/{build-BDRiO_mP.mjs → build-VgNg4rr8.mjs} +8 -23
  8. package/dist/cli.mjs +45 -19
  9. package/dist/{collab-Dxg2trOK.mjs → collab-BEAcXrBb.mjs} +1 -1
  10. package/dist/{comments-BqXua-XL.mjs → comments-YEU1Zhv9.mjs} +4 -4
  11. package/dist/{context-HQ4Giw58.mjs → context-Ccjrhr1J.mjs} +3 -3
  12. package/dist/{daemon-DL6Fwq6D.mjs → daemon-Dc9AH0M3.mjs} +9 -7
  13. package/dist/detect-C0wpaePX.mjs +125 -0
  14. package/dist/dev-lock-C_FC70Mu.mjs +65 -0
  15. package/dist/dev-ri6nAlRp.mjs +1273 -0
  16. package/dist/exclusive-B1RtpeeP.mjs +150 -0
  17. package/dist/{init-D8DtrK_F.mjs → init-W0nxR1OY.mjs} +8 -6
  18. package/dist/{link-BNzLvdhI.mjs → link-CdTgn94Y.mjs} +23 -11
  19. package/dist/ls-BZ5TAtd5.mjs +38 -0
  20. package/dist/{manifest-Nl3KSVOk.mjs → manifest-aFyDmL8C.mjs} +2 -2
  21. package/dist/{marks-DyWMv_Z1.mjs → marks-BF9pNEgH.mjs} +3 -3
  22. package/dist/{marks-CKgzucHZ.mjs → marks-CnCCfAbD.mjs} +3 -3
  23. package/dist/{marver-id-gate-BjF6v4bT.mjs → marver-id-gate-D-R0hSt_.mjs} +1 -1
  24. package/dist/perf-DkAUFT6W.mjs +1319 -0
  25. package/dist/perf-jam-BaH3Lg0m.mjs +635 -0
  26. package/dist/plugin-B8UghYuF.mjs +5242 -0
  27. package/dist/{poster-BdtSKMDm.mjs → poster-BNgafWMK.mjs} +1 -1
  28. package/dist/{profile-WU9qcbIo.mjs → profile-jIS6BcAs.mjs} +1 -1
  29. package/dist/{publish-bakes-9RzRToXV.mjs → publish-bakes-38Nja78p.mjs} +3 -3
  30. package/dist/{queue-29ok5_eZ.mjs → queue-CAM_vNmX.mjs} +1 -1
  31. package/dist/recover-B8AiI29B.mjs +66 -0
  32. package/dist/{serve-C8rVheYk.mjs → serve-Dp3nHstu.mjs} +3 -3
  33. package/dist/{share--oFJ1bCI.mjs → share-Ce4tP7ji.mjs} +1 -1
  34. package/dist/{shot-XQV7HC9A.mjs → shot-CMQgMVZm.mjs} +1 -1
  35. package/dist/{shot-DQeR_Pfn.mjs → shot-Ch24tiMO.mjs} +36 -5
  36. package/dist/slots-CFNnegCc.mjs +478 -0
  37. package/dist/{sync-DKk-yT1V.mjs → sync-CQdGARJ9.mjs} +4 -3
  38. package/dist/{work-VvX_JIgl.mjs → work-Bxz-ObF3.mjs} +4 -2
  39. package/dist/{work-F5u-twpJ.mjs → work-CNhFF9pU.mjs} +5 -3
  40. package/docs/boards-and-folders.md +3 -1
  41. package/docs/jam-session.md +57 -2
  42. package/docs/performance.md +424 -0
  43. package/package.json +2 -2
  44. package/src/client/content/index.tsx +3 -0
  45. package/src/client/content/video.tsx +16 -4
  46. package/src/client/frame-host/bridge.js +22 -6
  47. package/src/client/frame-host/main.tsx +17 -5
  48. package/src/client/shell/App.tsx +188 -26
  49. package/src/client/shell/BoardList.tsx +5 -5
  50. package/src/client/shell/Comments.tsx +8 -5
  51. package/src/client/shell/ContextMenu.tsx +5 -3
  52. package/src/client/shell/JamSurface.tsx +4 -2
  53. package/src/client/shell/LockedApp.tsx +8 -5
  54. package/src/client/shell/Play.tsx +20 -10
  55. package/src/client/shell/Tip.tsx +3 -1
  56. package/src/client/shell/Toolbar.tsx +12 -1
  57. package/src/client/shell/api.ts +233 -0
  58. package/src/client/shell/app-bridge.ts +254 -0
  59. package/src/client/shell/app-perf.ts +92 -0
  60. package/src/client/shell/canvas/Canvas.tsx +141 -21
  61. package/src/client/shell/canvas/FrameNode.tsx +22 -9
  62. package/src/client/shell/canvas/admission.ts +31 -9
  63. package/src/client/shell/canvas/camera-broadcast.ts +15 -5
  64. package/src/client/shell/canvas/ctl.ts +8 -0
  65. package/src/client/shell/canvas/frame-registry.ts +28 -2
  66. package/src/client/shell/canvas/sleep.ts +60 -17
  67. package/src/client/shell/canvas/updates.ts +2 -1
  68. package/src/client/shell/comments-store.ts +12 -4
  69. package/src/client/shell/goto.ts +22 -10
  70. package/src/client/shell/inset.ts +44 -0
  71. package/src/client/shell/jam-capture.ts +41 -22
  72. package/src/client/shell/jam-keys.ts +12 -3
  73. package/src/client/shell/jam-panel.tsx +9 -3
  74. package/src/client/shell/jam-queue.ts +3 -3
  75. package/src/client/shell/jam-session.tsx +14 -8
  76. package/src/client/shell/jam-voice.ts +55 -15
  77. package/src/client/shell/legacy-links.ts +2 -2
  78. package/src/client/shell/main.tsx +18 -1
  79. package/src/client/shell/marks-ui.tsx +5 -3
  80. package/src/client/shell/marver-app.ts +21 -0
  81. package/src/client/shell/notes.ts +8 -1
  82. package/src/client/shell/perf-run-probe.ts +34 -0
  83. package/src/client/shell/perf-run.ts +70 -0
  84. package/src/client/shell/perf.ts +80 -58
  85. package/src/client/shell/recorder-core.ts +183 -0
  86. package/src/client/shell/recorder.ts +607 -0
  87. package/src/client/shell/store.ts +294 -110
  88. package/src/client/shell/styles.css +72 -15
  89. package/src/client/shell/unsaved.ts +81 -0
  90. package/src/client/shell/whiteout-probes.ts +141 -0
  91. package/src/shared/app-api.ts +205 -0
  92. package/src/shared/app-perf.ts +308 -0
  93. package/src/shared/logo-sniff.ts +86 -0
  94. package/src/shared/machine.ts +132 -0
  95. package/src/shared/perf-run.ts +177 -0
  96. package/templates/AGENTS-embedded.md +25 -4
  97. package/templates/AGENTS-studio.md +25 -4
  98. package/templates/demo/dark.tsx +1 -1
  99. package/templates/demo/welcome.tsx +1 -1
  100. package/templates/instructions/boards.md +3 -1
  101. package/templates/instructions/welcome.md +6 -3
  102. package/dist/bake-C-awKgLA.mjs +0 -786
  103. package/dist/config-Cf7EjAMf.mjs +0 -292
  104. package/dist/dev-Bw_qYWWq.mjs +0 -755
  105. package/dist/dev-lock-DWSpa6nj.mjs +0 -179
  106. package/dist/perf-C75MZ73h.mjs +0 -167
  107. package/dist/perf-DPbLGhhO.mjs +0 -49
  108. package/dist/perf-jam-BU3TVrZu.mjs +0 -239
  109. package/dist/plugin-DkGmZs_r.mjs +0 -2423
@@ -1,14 +1,14 @@
1
- import { l as toFrameId } from "./manifest-Nl3KSVOk.mjs";
2
- import { a as workActivity } from "./work-F5u-twpJ.mjs";
1
+ import { l as toFrameId } from "./manifest-aFyDmL8C.mjs";
2
+ import { a as workActivity } from "./work-CNhFF9pU.mjs";
3
3
  import { r as replay } from "./events-CLH4ijKP.mjs";
4
4
  import { a as readLog, t as appendEvents } from "./comments-0BSbb04K.mjs";
5
- import { n as localProfile } from "./profile-WU9qcbIo.mjs";
5
+ import { n as localProfile } from "./profile-jIS6BcAs.mjs";
6
6
  import { r as uncheckedAnchor } from "./anchor-5H1vnoLu.mjs";
7
7
  import { i as record, t as has } from "./ledger-D54iROST.mjs";
8
8
  import { _ as packetPath, a as checkRecord, c as firstPoint, d as picturePath, f as readCapture, g as goalText, h as buildPacket, n as captureFrames, o as continues, p as storeCapture, r as captureWords, t as CAPTURE_ID, v as parseAgentText, x as sharedFile, y as parseMembers } from "./capture-vadKjuCo.mjs";
9
9
  import { a as recordFile, c as storeWrapup, i as readWrapup, n as buildWrapup, o as recordPathProblem, r as moreOf, t as SESSION_ID } from "./session-BAaJsK5c.mjs";
10
- import { act, addCapture, addWrapup, answeredSince, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, form, looksGood, moreWrapup, n as releaseLock, payloadKey, pending, prune, redelivering, sameComment, settle, startSession, stillOwned, t as acquireLock, textOf, undelivered, wrapupIntact, wrapupOf } from "./queue-29ok5_eZ.mjs";
11
- import { t as logJam } from "./perf-jam-BU3TVrZu.mjs";
10
+ import { act, addCapture, addWrapup, answeredSince, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, form, looksGood, moreWrapup, n as releaseLock, payloadKey, pending, prune, redelivering, sameComment, settle, startSession, stillOwned, t as acquireLock, textOf, undelivered, wrapupIntact, wrapupOf } from "./queue-CAM_vNmX.mjs";
11
+ import { t as logJam } from "./perf-jam-BaH3Lg0m.mjs";
12
12
  import { jamReservations, restoreHolds } from "./reserve-BURNQ2Y3.mjs";
13
13
  import { jamLive } from "./live-Cgzsicwi.mjs";
14
14
  import { lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
@@ -2496,8 +2496,9 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
2496
2496
  * activity set (work.ts) - the `marver work` CLI writes the same set, so the canvas shows
2497
2497
  * one merged glow, and its holds are also reservations (reserve.ts), restored here before
2498
2498
  * anything is scheduled. Returns null when the adapter is unavailable or another dev server
2499
- * already holds the repo lock (that one runs the loop; this one watches without it). */
2500
- function startJam(root, cfg, log = () => {}, onChanged = () => {}, anchor, onQueue, shoot) {
2499
+ * already holds the repo lock (that one runs the loop; this one watches without it). `watched` takes the comments
2500
+ * watcher as it is made, so its error is the dev server's to say (dev.ts watchGuard), never Node's unhandled one. */
2501
+ function startJam(root, cfg, log = () => {}, onChanged = () => {}, anchor, onQueue, shoot, watched) {
2501
2502
  const adapter = adapters[cfg.agent] ?? null;
2502
2503
  if (!adapter) {
2503
2504
  log(` jam: the "${cfg.agent}" adapter is not available yet; Live Jam is off`);
@@ -2534,6 +2535,7 @@ function startJam(root, cfg, log = () => {}, onChanged = () => {}, anchor, onQue
2534
2535
  let watcher = null;
2535
2536
  try {
2536
2537
  watcher = watch(commentsDir, { persistent: false }, schedule);
2538
+ watched?.(watcher);
2537
2539
  } catch {}
2538
2540
  const interval = setInterval(() => void core.poke(), RESCAN_MS);
2539
2541
  interval.unref?.();
@@ -0,0 +1,125 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ //#region src/server/detect.ts
4
+ function readJson(file) {
5
+ try {
6
+ return JSON.parse(stripJsonComments(readFileSync(file, "utf8")));
7
+ } catch {
8
+ return null;
9
+ }
10
+ }
11
+ function stripJsonComments(s) {
12
+ let out = "", inStr = false, inLine = false, inBlock = false;
13
+ for (let i = 0; i < s.length; i++) {
14
+ const c = s[i], n = s[i + 1];
15
+ if (inLine) {
16
+ if (c === "\n") {
17
+ inLine = false;
18
+ out += c;
19
+ }
20
+ continue;
21
+ }
22
+ if (inBlock) {
23
+ if (c === "*" && n === "/") {
24
+ inBlock = false;
25
+ i++;
26
+ }
27
+ continue;
28
+ }
29
+ if (inStr) {
30
+ out += c;
31
+ if (c === "\\") {
32
+ out += n ?? "";
33
+ i++;
34
+ } else if (c === "\"") inStr = false;
35
+ continue;
36
+ }
37
+ if (c === "\"") {
38
+ inStr = true;
39
+ out += c;
40
+ continue;
41
+ }
42
+ if (c === "/" && n === "/") {
43
+ inLine = true;
44
+ i++;
45
+ continue;
46
+ }
47
+ if (c === "/" && n === "*") {
48
+ inBlock = true;
49
+ i++;
50
+ continue;
51
+ }
52
+ out += c;
53
+ }
54
+ let res = "", inS = false;
55
+ for (let i = 0; i < out.length; i++) {
56
+ const c = out[i];
57
+ if (inS) {
58
+ res += c;
59
+ if (c === "\\") {
60
+ res += out[i + 1] ?? "";
61
+ i++;
62
+ } else if (c === "\"") inS = false;
63
+ continue;
64
+ }
65
+ if (c === "\"") {
66
+ inS = true;
67
+ res += c;
68
+ continue;
69
+ }
70
+ if (c === ",") {
71
+ let j = i + 1;
72
+ while (j < out.length && /\s/.test(out[j])) j++;
73
+ if (out[j] === "}" || out[j] === "]") continue;
74
+ }
75
+ res += c;
76
+ }
77
+ return res;
78
+ }
79
+ function detectHost(root) {
80
+ const pkg = readJson(join(root, "package.json")) ?? {};
81
+ const deps = {
82
+ ...pkg.dependencies,
83
+ ...pkg.devDependencies
84
+ };
85
+ const twRange = deps["tailwindcss"];
86
+ const tailwind = !twRange ? null : /(^|[^\d])4\./.test(twRange) || twRange.startsWith("^4") || twRange.startsWith("~4") ? 4 : 3;
87
+ const router = deps["next"] ? "next" : deps["react-router"] || deps["react-router-dom"] ? "react-router" : null;
88
+ const routerPkg = deps["react-router-dom"] ? "react-router-dom" : "react-router";
89
+ const toaster = deps["sonner"] ? "sonner" : deps["react-hot-toast"] ? "react-hot-toast" : null;
90
+ let shadcn = null;
91
+ const comp = readJson(join(root, "components.json"));
92
+ if (comp?.tailwind?.css) shadcn = {
93
+ themeCss: comp.tailwind.css,
94
+ uiAlias: comp.aliases?.ui ?? "@/components/ui"
95
+ };
96
+ const themeCss = shadcn?.themeCss && existsSync(join(root, shadcn.themeCss)) ? shadcn.themeCss : firstExisting(root, [
97
+ "src/index.css",
98
+ "src/styles/theme.css",
99
+ "src/styles/globals.css",
100
+ "src/app/globals.css",
101
+ "app/globals.css",
102
+ "src/globals.css",
103
+ "src/style.css",
104
+ "styles/globals.css"
105
+ ]);
106
+ const ts = readJson(join(root, "tsconfig.json"));
107
+ const include = ts?.include;
108
+ const exclude = ts?.exclude ?? [];
109
+ const sweeps = ts != null && !exclude.some((e) => e === "design" || e.startsWith("design/")) && (!include || include.some((i) => i === "." || i.startsWith("**") || i.startsWith("design")));
110
+ return {
111
+ tailwind,
112
+ router,
113
+ routerPkg,
114
+ toaster,
115
+ shadcn,
116
+ themeCss,
117
+ tsconfigSweepsDesign: !!sweeps
118
+ };
119
+ }
120
+ function firstExisting(root, candidates) {
121
+ for (const c of candidates) if (existsSync(join(root, c))) return c;
122
+ return null;
123
+ }
124
+ //#endregion
125
+ export { readJson as n, detectHost as t };
@@ -0,0 +1,65 @@
1
+ import { a as readJson, i as portInUse, o as takeExclusive, r as pidRuns } from "./exclusive-B1RtpeeP.mjs";
2
+ import { mkdirSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { randomUUID } from "node:crypto";
5
+ //#region src/server/dev-lock.ts
6
+ /**
7
+ * One canvas per folder (#19, spec 27 Part 7). `marver dev` takes design/.local/dev.lock before it
8
+ * starts the server, so a second `marver dev` in the same folder says where the first one runs
9
+ * instead of taking over dev.json (which the CLI - `work`, `shot`, `comments new --on` - reads to
10
+ * find the canvas).
11
+ *
12
+ * The rules, none of which guess a holder dead from time or from an unanswered request:
13
+ * - no lock: create it exclusively. Done.
14
+ * - a lock whose pid runs: a canvas runs here (a slow or paused one too) - stop with its link.
15
+ * - a lock whose pid is dead: reclaim it while holding dev.lock.reclaim (also exclusive): read it
16
+ * again, still the same dead holder -> replace it. A reclaim lock already there means another
17
+ * start is reclaiming: wait a second and start over once; still there -> fail closed.
18
+ * - a 0.25 server writes no lock and no pid: dev.json without a lock is decided by binding its port.
19
+ *
20
+ * Both files are created by linking a fully written temp file into place, so a reader never sees
21
+ * an empty or half-written lock - `link` fails if the name exists, which is the exclusive create.
22
+ * The file rules themselves live in exclusive.ts (spec 28 A1.2), shared with the slot files; this
23
+ * module keeps the lock's words and the 0.25 check.
24
+ */
25
+ const localDir = (root) => join(root, "design", ".local");
26
+ const lockPath = (root) => join(localDir(root), "dev.lock");
27
+ const infoPath = (root) => join(localDir(root), "dev.json");
28
+ const runsHere = (root) => {
29
+ const port = readJson(infoPath(root))?.port;
30
+ return typeof port === "number" ? `a canvas already runs here: http://localhost:${port} - open it, or stop it first` : "a canvas already runs here - open it, or stop it first";
31
+ };
32
+ const RECLAIM_STUCK = "a canvas is starting here, or a start crashed: delete design/.local/dev.lock.reclaim if no canvas runs";
33
+ /** Take the folder's canvas lock. On success the caller owns dev.lock until `release()` (which
34
+ * removes it only while it still names this instance). */
35
+ async function takeDevLock(root, opts = {}) {
36
+ mkdirSync(localDir(root), { recursive: true });
37
+ const me = {
38
+ pid: opts.pid ?? process.pid,
39
+ instance: randomUUID(),
40
+ at: Date.now()
41
+ };
42
+ const r = await takeExclusive(lockPath(root), me, JSON.stringify(me), { reclaimWaitMs: opts.reclaimWaitMs });
43
+ if (!r.ok) return {
44
+ ok: false,
45
+ message: r.why === "held" ? runsHere(root) : r.why === "unreadable" ? "design/.local/dev.lock is unreadable: delete it if no canvas runs" : RECLAIM_STUCK
46
+ };
47
+ opts.onTaken?.(r.release);
48
+ const info = readJson(infoPath(root));
49
+ if (info && info.instance !== me.instance) {
50
+ if (typeof info.pid === "number" ? pidRuns(info.pid) : typeof info.port === "number" ? await portInUse(info.port) : false) {
51
+ r.release();
52
+ return {
53
+ ok: false,
54
+ message: `${runsHere(root)}${typeof info.pid === "number" ? "" : " (or delete design/.local/dev.json if it is not)"}`
55
+ };
56
+ }
57
+ }
58
+ return {
59
+ ok: true,
60
+ instance: me.instance,
61
+ release: r.release
62
+ };
63
+ }
64
+ //#endregion
65
+ export { takeDevLock };