@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,292 +0,0 @@
1
- import { m as readDescription } from "./board-tree-DRioF94d.mjs";
2
- import { i as onPath, n as AGENT_NAMES, r as detectAgent, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
3
- import { existsSync, readFileSync } from "node:fs";
4
- import { join } from "node:path";
5
- import { pathToFileURL } from "node:url";
6
- //#region src/server/detect.ts
7
- function readJson(file) {
8
- try {
9
- return JSON.parse(stripJsonComments(readFileSync(file, "utf8")));
10
- } catch {
11
- return null;
12
- }
13
- }
14
- function stripJsonComments(s) {
15
- let out = "", inStr = false, inLine = false, inBlock = false;
16
- for (let i = 0; i < s.length; i++) {
17
- const c = s[i], n = s[i + 1];
18
- if (inLine) {
19
- if (c === "\n") {
20
- inLine = false;
21
- out += c;
22
- }
23
- continue;
24
- }
25
- if (inBlock) {
26
- if (c === "*" && n === "/") {
27
- inBlock = false;
28
- i++;
29
- }
30
- continue;
31
- }
32
- if (inStr) {
33
- out += c;
34
- if (c === "\\") {
35
- out += n ?? "";
36
- i++;
37
- } else if (c === "\"") inStr = false;
38
- continue;
39
- }
40
- if (c === "\"") {
41
- inStr = true;
42
- out += c;
43
- continue;
44
- }
45
- if (c === "/" && n === "/") {
46
- inLine = true;
47
- i++;
48
- continue;
49
- }
50
- if (c === "/" && n === "*") {
51
- inBlock = true;
52
- i++;
53
- continue;
54
- }
55
- out += c;
56
- }
57
- let res = "", inS = false;
58
- for (let i = 0; i < out.length; i++) {
59
- const c = out[i];
60
- if (inS) {
61
- res += c;
62
- if (c === "\\") {
63
- res += out[i + 1] ?? "";
64
- i++;
65
- } else if (c === "\"") inS = false;
66
- continue;
67
- }
68
- if (c === "\"") {
69
- inS = true;
70
- res += c;
71
- continue;
72
- }
73
- if (c === ",") {
74
- let j = i + 1;
75
- while (j < out.length && /\s/.test(out[j])) j++;
76
- if (out[j] === "}" || out[j] === "]") continue;
77
- }
78
- res += c;
79
- }
80
- return res;
81
- }
82
- function detectHost(root) {
83
- const pkg = readJson(join(root, "package.json")) ?? {};
84
- const deps = {
85
- ...pkg.dependencies,
86
- ...pkg.devDependencies
87
- };
88
- const twRange = deps["tailwindcss"];
89
- const tailwind = !twRange ? null : /(^|[^\d])4\./.test(twRange) || twRange.startsWith("^4") || twRange.startsWith("~4") ? 4 : 3;
90
- const router = deps["next"] ? "next" : deps["react-router"] || deps["react-router-dom"] ? "react-router" : null;
91
- const routerPkg = deps["react-router-dom"] ? "react-router-dom" : "react-router";
92
- const toaster = deps["sonner"] ? "sonner" : deps["react-hot-toast"] ? "react-hot-toast" : null;
93
- let shadcn = null;
94
- const comp = readJson(join(root, "components.json"));
95
- if (comp?.tailwind?.css) shadcn = {
96
- themeCss: comp.tailwind.css,
97
- uiAlias: comp.aliases?.ui ?? "@/components/ui"
98
- };
99
- const themeCss = shadcn?.themeCss && existsSync(join(root, shadcn.themeCss)) ? shadcn.themeCss : firstExisting(root, [
100
- "src/index.css",
101
- "src/styles/theme.css",
102
- "src/styles/globals.css",
103
- "src/app/globals.css",
104
- "app/globals.css",
105
- "src/globals.css",
106
- "src/style.css",
107
- "styles/globals.css"
108
- ]);
109
- const ts = readJson(join(root, "tsconfig.json"));
110
- const include = ts?.include;
111
- const exclude = ts?.exclude ?? [];
112
- const sweeps = ts != null && !exclude.some((e) => e === "design" || e.startsWith("design/")) && (!include || include.some((i) => i === "." || i.startsWith("**") || i.startsWith("design")));
113
- return {
114
- tailwind,
115
- router,
116
- routerPkg,
117
- toaster,
118
- shadcn,
119
- themeCss,
120
- tsconfigSweepsDesign: !!sweeps
121
- };
122
- }
123
- function firstExisting(root, candidates) {
124
- for (const c of candidates) if (existsSync(join(root, c))) return c;
125
- return null;
126
- }
127
- //#endregion
128
- //#region src/server/config.ts
129
- const DEFAULTS = {
130
- mode: "studio",
131
- theme: null,
132
- viewports: {
133
- mobile: {
134
- width: 390,
135
- height: 844
136
- },
137
- tablet: {
138
- width: 768,
139
- height: 1024
140
- },
141
- laptop: {
142
- width: 1280,
143
- height: 800
144
- },
145
- monitor: {
146
- width: 1920,
147
- height: 1080
148
- }
149
- },
150
- themes: ["light", "dark"],
151
- port: 5199,
152
- zoomSpeed: 1,
153
- share: { branding: true }
154
- };
155
- /** Load design/config.ts via native TS import (Node >= 22.18). Missing or broken fields fall back to defaults. */
156
- async function loadConfig(root) {
157
- const file = join(root, "design", "config.ts");
158
- if (!existsSync(file)) return {
159
- ...DEFAULTS,
160
- ...jamFields(void 0)
161
- };
162
- try {
163
- const user = (await import(`${pathToFileURL(file).href}?t=${Date.now()}`)).default ?? {};
164
- return {
165
- ...DEFAULTS,
166
- ...user,
167
- viewports: validViewports(user.viewports) ?? DEFAULTS.viewports,
168
- themes: Array.isArray(user.themes) && user.themes.length ? user.themes.map(String) : DEFAULTS.themes,
169
- port: validPort(user.port) ?? DEFAULTS.port,
170
- zoomSpeed: validZoom(user.zoomSpeed) ?? DEFAULTS.zoomSpeed,
171
- description: readDescription(user.description),
172
- share: {
173
- branding: user.share?.branding !== false,
174
- name: typeof user.share?.name === "string" ? user.share.name : void 0,
175
- logo: typeof user.share?.logo === "string" ? user.share.logo : void 0,
176
- frontDoor: user.share?.frontDoor !== false && user.share?.front_door !== false,
177
- notify: user.share?.notify !== false
178
- },
179
- ...jamFields(user.jam)
180
- };
181
- } catch (err) {
182
- console.error(`[marver] design/config.ts failed to load, using defaults and leaving Live Jam OFF:\n ${err.message}`);
183
- return {
184
- ...DEFAULTS,
185
- jamOff: "unreadable"
186
- };
187
- }
188
- }
189
- const validDim = (n) => typeof n === "number" && Number.isFinite(n) && n >= 1 && n <= 2e4;
190
- function validPort(n) {
191
- return typeof n === "number" && Number.isInteger(n) && n > 0 && n < 65536 ? n : null;
192
- }
193
- function validZoom(n) {
194
- return typeof n === "number" && Number.isFinite(n) && n >= .1 && n <= 10 ? n : null;
195
- }
196
- /** Six frames at once is what a jam actually feels like - at 3, half of a multi-frame
197
- * ask sat waiting on the other half while the human watched. */
198
- const DEFAULT_CONCURRENCY = 6;
199
- /** A config value, printable in a warning. Never throws - a formatter that can crash inside an
200
- * error path (JSON.stringify does, on a BigInt) turns a clear message into a mystery. */
201
- const show = (v) => {
202
- try {
203
- return JSON.stringify(v) ?? String(v);
204
- } catch {
205
- return String(v);
206
- }
207
- };
208
- /** A `{...}` written by hand, not a Date/Map/class instance that merely types as "object". */
209
- const plainObject = (v) => {
210
- if (!v || typeof v !== "object") return false;
211
- const proto = Object.getPrototypeOf(v);
212
- return proto === Object.prototype || proto === null;
213
- };
214
- /** The agent to arm with - or, when the human NAMED one we cannot use, why not (said once,
215
- * here, because a bad `jam.agent` is a config-file error like any other).
216
- *
217
- * A named agent is never quietly swapped for another: running a different tool than the one
218
- * asked for is worse than not running. Nor is one armed that cannot be spawned - that would
219
- * claim every @marver mention, fail it, and never retry. */
220
- function resolveAgent(named) {
221
- if (named === void 0) return detectAgent() ?? "no-agent";
222
- if (typeof named !== "string" || !Object.hasOwn(AGENT_BIN, named)) {
223
- console.warn(`[marver] design/config.ts: jam.agent ${show(named)} is not an agent marver can spawn - Live Jam is off. Use ${AGENT_NAMES}.`);
224
- return "bad-agent";
225
- }
226
- const agent = named;
227
- if (!onPath(AGENT_BIN[agent])) {
228
- console.warn(`[marver] design/config.ts names jam.agent "${agent}", but \`${AGENT_BIN[agent]}\` is not on PATH - Live Jam is off until it is installed.`);
229
- return "bad-agent";
230
- }
231
- return agent;
232
- }
233
- /** Resolve the jam block. Live Jam is ON by default: an absent or partial `jam` resolves
234
- * to whatever agent CLI this machine has, so a fresh workspace jams with nothing
235
- * configured and an old one needs no re-init. `jam: false` is the off switch. */
236
- function resolveJam(v) {
237
- if (v === false) return "opted-out";
238
- const shape = v === void 0 || v === true ? {} : typeof v === "string" ? { agent: v } : plainObject(v) ? v : null;
239
- if (!shape) {
240
- console.warn(`[marver] design/config.ts: jam must be false, an agent name, or an options object - got ${show(v)}. Live Jam is off.`);
241
- return "bad-agent";
242
- }
243
- const j = shape;
244
- const agent = resolveAgent(j.agent);
245
- if (agent === "no-agent" || agent === "bad-agent") return agent;
246
- const c = j.concurrency;
247
- const pick = (key, v, ok, fallback, want) => {
248
- if (v === void 0) return fallback;
249
- if (ok(v)) return v;
250
- console.warn(`[marver] design/config.ts: jam.${key} must be ${want} - got ${show(v)}. Using ${JSON.stringify(fallback)}.`);
251
- return fallback;
252
- };
253
- const bool = (v) => typeof v === "boolean";
254
- return {
255
- agent,
256
- concurrency: typeof c === "number" && Number.isInteger(c) && c >= 1 && c <= 16 ? c : DEFAULT_CONCURRENCY,
257
- subagents: j.subagents !== false,
258
- proactive: j.proactive === true,
259
- chime: pick("chime", j.chime, bool, true, "true or false"),
260
- capture: pick("capture", j.capture, (v) => v === "confirm" || v === "at-once", "confirm", `'confirm' or 'at-once'`),
261
- loc: pick("loc", j.loc, bool, true, "true or false"),
262
- names: pick("names", j.names, bool, true, "true or false")
263
- };
264
- }
265
- /** Exactly one of `jam` (armed) or `jamOff` (why not) - so the dev server can speak up about
266
- * the one off-state nothing has reported yet, and stay quiet about the rest. BOTH keys are
267
- * always written: these spread over the user's own `jam`, and a raw `jam: false` reaching the
268
- * server as config would arm the daemon against a truthy object check. */
269
- function jamFields(v) {
270
- const r = resolveJam(v);
271
- return typeof r === "string" ? {
272
- jam: void 0,
273
- jamOff: r
274
- } : {
275
- jam: r,
276
- jamOff: void 0
277
- };
278
- }
279
- function validViewports(v) {
280
- if (!v || typeof v !== "object") return null;
281
- const out = {};
282
- for (const [k, val] of Object.entries(v)) {
283
- const vp = val;
284
- if (validDim(vp?.width) && validDim(vp?.height)) out[k] = {
285
- width: Math.round(vp.width),
286
- height: Math.round(vp.height)
287
- };
288
- }
289
- return Object.keys(out).length ? out : null;
290
- }
291
- //#endregion
292
- export { readJson as i, loadConfig as n, detectHost as r, DEFAULTS as t };