@marver-design/marver 0.31.0 → 0.33.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 (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -2
  3. package/dist/{anchor-check-B92s9tVv.mjs → anchor-check-KCe6WeRA.mjs} +1 -1
  4. package/dist/{boards-OlAhZ87x.mjs → boards-jHmEPLV7.mjs} +1 -1
  5. package/dist/{build-BNssmbqd.mjs → build-4-k2XhhX.mjs} +3 -3
  6. package/dist/cli.mjs +12 -12
  7. package/dist/{comment-actions-Bxf9Ld4g.mjs → comment-actions-BCBcd-Wq.mjs} +12 -5
  8. package/dist/{comments-BakJQwaf.mjs → comments-C2SN1QdM.mjs} +4 -4
  9. package/dist/{daemon-MxoEQajX.mjs → daemon-CCDgagw2.mjs} +49 -8
  10. package/dist/{dev-BBZe_brH.mjs → dev-CJf5upVK.mjs} +9 -9
  11. package/dist/{link-Cmt9Xy4X.mjs → link-aZq5cExV.mjs} +1 -1
  12. package/dist/{pdf-CZENT6t3.mjs → pdf-GGya_nI6.mjs} +3 -3
  13. package/dist/{pdf-0m721FFn.mjs → pdf-HB0prF75.mjs} +1 -1
  14. package/dist/{perf-CIMijND6.mjs → perf-9ZEF5KLO.mjs} +2 -2
  15. package/dist/{perf-BB0XNt1M.mjs → perf-BA_NDarr.mjs} +1 -0
  16. package/dist/{plugin-CL8_wL7a.mjs → plugin-Cm74UDfp.mjs} +128 -47
  17. package/dist/{poster-B7uSjlEP.mjs → poster-BnuT9UyW.mjs} +1 -1
  18. package/dist/{publish-bakes-BjgDNeyS.mjs → publish-bakes-zHmPEOB5.mjs} +2 -2
  19. package/dist/{recover-ByuFQOF9.mjs → recover-BpRQxBA7.mjs} +1 -1
  20. package/dist/{shot-D2TQGo2V.mjs → shot-BuUCG46-.mjs} +1 -1
  21. package/dist/{shot-BqwkdtKn.mjs → shot-HZtclbOT.mjs} +3 -3
  22. package/dist/{show-B1u3DiJw.mjs → show-DhmiUu01.mjs} +2 -2
  23. package/dist/{work-Nv-n2_Un.mjs → work-B4tydWnf.mjs} +37 -1
  24. package/dist/{work-DRdzXPvg.mjs → work-CzIXp7n1.mjs} +3 -3
  25. package/docs/app.md +120 -21
  26. package/docs/boards-and-folders.md +10 -5
  27. package/docs/slides.md +2 -1
  28. package/package.json +1 -1
  29. package/src/client/shell/App.tsx +5 -1
  30. package/src/client/shell/Play.tsx +80 -5
  31. package/src/client/shell/app-bridge.ts +8 -0
  32. package/src/client/shell/immersive.ts +123 -0
  33. package/src/client/shell/inset.ts +29 -3
  34. package/src/client/shell/marks-ui.tsx +2 -2
  35. package/src/client/shell/recorder-signals.ts +5 -2
  36. package/src/client/shell/styles.css +25 -6
  37. package/src/shared/app-api.ts +41 -0
  38. package/src/shared/immersive.ts +13 -0
  39. package/src/shared/perf-records.ts +1 -1
@@ -5,16 +5,16 @@ import { A as resolveType, D as readReason, E as readCapability, O as readStatus
5
5
  import { c as setSceneTitle, d as annotateBoards, f as planNames, m as readContextFacts, n as isNoteFile, p as planWithStage, s as scanFrames, t as affectedFrameIds, u as writeManifest } from "./manifest-CK8Qh4Nq.mjs";
6
6
  import { c as newerVersion, o as checkShowTarget } from "./deep-link-DYtuT740.mjs";
7
7
  import { g as LIVE_WIRE, h as LIVE_BOUNDS, i as marverHome, o as originOf, v as workspaceId } from "./slots-BOcfIqxy.mjs";
8
- import { a as workActivity, r as boardsChanged } from "./work-Nv-n2_Un.mjs";
8
+ import { i as pinningBoards, o as workActivity, r as boardsChanged, s as workClock } from "./work-B4tydWnf.mjs";
9
9
  import { a as replay, t as asks } from "./events-Dieo1482.mjs";
10
10
  import { a as readLog, i as listBoards } from "./comments-0BSbb04K.mjs";
11
11
  import { n as localProfile, t as isConnected } from "./profile-cdmSer1k.mjs";
12
12
  import { c as recordChanged, i as initMarks, n as docRevs, o as observe, r as freshFrames, t as docRev } from "./marks-C8oX8kbE.mjs";
13
- import { C as WRITE_MATCH_MS, S as WRITER_HEADERS, _ as ID12, b as RELOAD_BOUNDS, c as takePageBatch, l as takeReloadBatch, n as appendRun, r as logReloadLines, t as PAGE_BODY_MAX, u as tidyPerfDir, v as RECORDER_LEVELS, w as decodeCmds, y as RECORDER_PARAM } from "./perf-BB0XNt1M.mjs";
13
+ import { C as WRITE_MATCH_MS, S as WRITER_HEADERS, _ as ID12, b as RELOAD_BOUNDS, c as takePageBatch, l as takeReloadBatch, n as appendRun, r as logReloadLines, t as PAGE_BODY_MAX, u as tidyPerfDir, v as RECORDER_LEVELS, w as decodeCmds, y as RECORDER_PARAM } from "./perf-BA_NDarr.mjs";
14
14
  import { c as proofHeaders, i as logoRoute, s as appProofOk, t as findLogo } from "./logo-C9s7-Cy9.mjs";
15
15
  import { n as loadConfig } from "./config-B0YcFtqS.mjs";
16
16
  import { a as mergeSizes, c as serializeSizes, i as measuringFrames, l as sizesPath, n as autoWidthOf, o as readSizes, r as keptSizes, s as readSizesFile } from "./sizes-BckcL4Zz.mjs";
17
- import { c as pool, d as withBrowser, h as launchFlags, l as shotConcurrency, p as Browser, r as SURFACE, t as AREA } from "./shot-BqwkdtKn.mjs";
17
+ import { c as pool, d as withBrowser, h as launchFlags, l as shotConcurrency, p as Browser, r as SURFACE, t as AREA } from "./shot-HZtclbOT.mjs";
18
18
  import { closeSync, copyFileSync, existsSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, utimesSync, watch, writeFileSync } from "node:fs";
19
19
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
20
20
  import { fileURLToPath } from "node:url";
@@ -856,7 +856,7 @@ async function bakeIn(b, opts) {
856
856
  const deadline = setTimeout(() => {
857
857
  timedOut = true;
858
858
  b.abort(me, TIMED_OUT);
859
- }, DEADLINE_MS);
859
+ }, bakeSeams.deadlineMs ?? DEADLINE_MS);
860
860
  const closeTarget = async (id) => {
861
861
  let t;
862
862
  await Promise.race([b.send("Target.closeTarget", { targetId: id }).catch(() => {}), new Promise((r) => {
@@ -1341,11 +1341,13 @@ function endRunBakes(owner) {
1341
1341
  * looks at a COMPILING outlast any held compile (A3.8 r1 #4's case, added by the review of a3-runs). */
1342
1342
  const bakeSeams = {};
1343
1343
  const holdMs = () => {
1344
- return 0;
1344
+ if (bakeSeams.holdMs !== void 0) return bakeSeams.holdMs;
1345
+ const v = process.env.MARVER_SLOT_BASE ? Number(process.env.MV_BAKE_HOLD_MS) : NaN;
1346
+ return Number.isFinite(v) && v > 0 ? Math.min(v, 6e4) : 0;
1345
1347
  };
1346
1348
  /** The suite's answer for a compile still running, under MV_BAKE_STOP_ASKING (above). */
1347
1349
  const STOP_ASKING = "still compiling - the suite asks the page to stop asking";
1348
- const stillCompiling = () => COMPILING;
1350
+ const stillCompiling = () => bakeSeams.stopAsking ?? (!!process.env.MARVER_SLOT_BASE && process.env.MV_BAKE_STOP_ASKING === "1") ? STOP_ASKING : COMPILING;
1349
1351
  /** Compiles in flight, by generation and key: identical asks - inside one request or across
1350
1352
  * concurrent ones - share one compile. */
1351
1353
  const inflight = /* @__PURE__ */ new Map();
@@ -2155,7 +2157,17 @@ const runSeams = {};
2155
2157
  /** RUN_T, with the suite's overrides: `runSeams.t` in-process, `MV_PERF_RUN_T` (JSON) for a dev server a test starts -
2156
2158
  * both read only with MARVER_SLOT_BASE set (the suite's marker). */
2157
2159
  function runT() {
2158
- return { ...RUN_T };
2160
+ const t = { ...RUN_T };
2161
+ if (!process.env.MARVER_SLOT_BASE) return t;
2162
+ let env = {};
2163
+ try {
2164
+ env = JSON.parse(process.env.MV_PERF_RUN_T ?? "{}");
2165
+ } catch {}
2166
+ for (const src of [env, runSeams.t ?? {}]) for (const k of Object.keys(t)) {
2167
+ const v = src[k];
2168
+ if (typeof v === "number" && v >= 0) t[k] = v;
2169
+ }
2170
+ return t;
2159
2171
  }
2160
2172
  /** The shell's address for a run's load: its run id, the warm-up's mark, the recorder's level when not `full` (spec 30
2161
2173
  * #58: the shell reads it, `withWs()` carries it to the frames), the board. */
@@ -2223,6 +2235,7 @@ async function openPage(b, o) {
2223
2235
  }
2224
2236
  };
2225
2237
  function call(m, p = {}, sid, ms = T.callMs) {
2238
+ runSeams.cdp?.(m, p);
2226
2239
  const sent = b.send(m, p, sid, own);
2227
2240
  let t;
2228
2241
  const late = new Promise((_, reject) => {
@@ -2286,6 +2299,7 @@ async function openPage(b, o) {
2286
2299
  async function closePage(b, page) {
2287
2300
  page.stop();
2288
2301
  const bounded = async (m, p, sid) => {
2302
+ runSeams.cdp?.(m, p);
2289
2303
  let t;
2290
2304
  await Promise.race([b.send(m, p, sid).catch(() => {}), new Promise((r) => {
2291
2305
  t = setTimeout(r, 2e3);
@@ -2810,7 +2824,7 @@ async function serveRun(req, res, o) {
2810
2824
  };
2811
2825
  const beat = setInterval(() => write({ heartbeat: Date.now() }), T.heartbeatMs);
2812
2826
  try {
2813
- const drive = runOnce;
2827
+ const drive = runSeams.driver ?? runOnce;
2814
2828
  for (let i = 0; i < asked.req.repeat && !ac.signal.aborted; i++) write({ line: await drive({
2815
2829
  root: o.root,
2816
2830
  origin: o.origin,
@@ -3302,7 +3316,7 @@ function apiMiddleware(root, opts = {}) {
3302
3316
  return json(res, 400, { error: "malformed JSON" });
3303
3317
  }
3304
3318
  if (!b || b.kind !== "capture" && b.kind !== "upload") return json(res, 400, { error: "kind must be capture or upload" });
3305
- (await import("./perf-BB0XNt1M.mjs").then((n) => n.f)).logJam(root, b);
3319
+ (await import("./perf-BA_NDarr.mjs").then((n) => n.f)).logJam(root, b);
3306
3320
  return json(res, 200, { ok: true });
3307
3321
  }
3308
3322
  if (path === "perf/page" && req.method === "POST") {
@@ -3325,7 +3339,7 @@ function apiMiddleware(root, opts = {}) {
3325
3339
  return json(res, "error" in answer ? 503 : 200, answer);
3326
3340
  }
3327
3341
  if (path === "perf/run" && req.method === "POST" || path === "perf/inputs" && req.method === "GET") {
3328
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3342
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
3329
3343
  const token = readDevInfo(root)?.token;
3330
3344
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3331
3345
  if (path === "perf/inputs") {
@@ -3780,7 +3794,7 @@ function apiMiddleware(root, opts = {}) {
3780
3794
  }
3781
3795
  }
3782
3796
  if (path === "shot" && req.method === "GET") {
3783
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3797
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
3784
3798
  const token = readDevInfo(root)?.token;
3785
3799
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3786
3800
  const frameId = url.searchParams.get("frame") ?? "";
@@ -3796,7 +3810,7 @@ function apiMiddleware(root, opts = {}) {
3796
3810
  };
3797
3811
  const asPng = url.searchParams.get("format") === "png";
3798
3812
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
3799
- const { shootFrame } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
3813
+ const { shootFrame } = await import("./shot-HZtclbOT.mjs").then((n) => n.u);
3800
3814
  const r = await shootFrame({
3801
3815
  root,
3802
3816
  viewports: opts.viewports ?? {},
@@ -3831,10 +3845,10 @@ function apiMiddleware(root, opts = {}) {
3831
3845
  }
3832
3846
  const pdfRoute = /^pdf(?:\/([^/]*)(\/file)?)?$/.exec(path);
3833
3847
  if (pdfRoute) {
3834
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3848
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
3835
3849
  const token = readDevInfo(root)?.token;
3836
3850
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3837
- const pdf = await import("./pdf-CZENT6t3.mjs");
3851
+ const pdf = await import("./pdf-GGya_nI6.mjs");
3838
3852
  if (pdfRoute[1] === void 0) {
3839
3853
  if (req.method !== "POST") return json(res, 405, { error: "POST to start a PDF" });
3840
3854
  const raw = await readBody(req);
@@ -3923,7 +3937,7 @@ function apiMiddleware(root, opts = {}) {
3923
3937
  return json(res, 405, { error: "GET or DELETE a job" });
3924
3938
  }
3925
3939
  if (path === "shots" && req.method === "POST") {
3926
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3940
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
3927
3941
  const token = readDevInfo(root)?.token;
3928
3942
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3929
3943
  const raw = await readBody(req);
@@ -3940,7 +3954,7 @@ function apiMiddleware(root, opts = {}) {
3940
3954
  if (typeof theme !== "string" || !/^[a-z0-9-]+$/i.test(theme)) return json(res, 400, { error: "invalid theme" });
3941
3955
  const scale = body.scale === void 0 ? void 0 : body.scale;
3942
3956
  if (scale !== void 0 && !(Number.isInteger(scale) && scale >= 1 && scale <= 4)) return json(res, 400, { error: "invalid scale" });
3943
- const { resolveFrames, shootBatch } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
3957
+ const { resolveFrames, shootBatch } = await import("./shot-HZtclbOT.mjs").then((n) => n.u);
3944
3958
  const sel = resolveFrames(root, body);
3945
3959
  if (!sel.ok) return json(res, sel.status, { error: sel.error });
3946
3960
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
@@ -3958,7 +3972,7 @@ function apiMiddleware(root, opts = {}) {
3958
3972
  }
3959
3973
  }
3960
3974
  if (path === "anchor" && req.method === "POST") {
3961
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
3975
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
3962
3976
  const token = readDevInfo(root)?.token;
3963
3977
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
3964
3978
  const raw = await readBody(req);
@@ -3974,7 +3988,7 @@ function apiMiddleware(root, opts = {}) {
3974
3988
  if (typeof target === "string") return json(res, 400, { error: target });
3975
3989
  const others = Array.isArray(b.others) ? b.others.filter((o) => typeof o?.key === "string").slice(0, 200) : [];
3976
3990
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
3977
- const { checkAnchor, CheckInputError } = await import("./anchor-check-B92s9tVv.mjs");
3991
+ const { checkAnchor, CheckInputError } = await import("./anchor-check-KCe6WeRA.mjs");
3978
3992
  try {
3979
3993
  return json(res, 200, await checkAnchor({
3980
3994
  root,
@@ -4082,8 +4096,8 @@ function apiMiddleware(root, opts = {}) {
4082
4096
  return json(res, 400, { error: "malformed JSON" });
4083
4097
  }
4084
4098
  const src = typeof b?.src === "string" ? b.src : "";
4085
- const { ensurePoster, isLocalClip } = await import("./poster-B7uSjlEP.mjs");
4086
- const { isLocalAssetRef } = await import("./build-BNssmbqd.mjs");
4099
+ const { ensurePoster, isLocalClip } = await import("./poster-BnuT9UyW.mjs");
4100
+ const { isLocalAssetRef } = await import("./build-4-k2XhhX.mjs");
4087
4101
  if (!isLocalAssetRef(src) || !isLocalClip(src)) return json(res, 400, { error: "src must be a clip under design/assets/" });
4088
4102
  const r = await ensurePoster(join(root, "design", "assets"), src);
4089
4103
  if (!r.ok) return json(res, r.error.includes("does not exist") ? 404 : 503, { error: r.error });
@@ -4146,7 +4160,7 @@ function apiMiddleware(root, opts = {}) {
4146
4160
  return json(res, 405, { error: "method not allowed" });
4147
4161
  }
4148
4162
  if (path === "show" || path === "show/ack" || path === "show/acks") {
4149
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
4163
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
4150
4164
  const token = readDevInfo(root)?.token;
4151
4165
  const tokenOk = !!token && req.headers["x-mv-work"] === token;
4152
4166
  if (path === "show" && req.method === "POST") {
@@ -4183,14 +4197,14 @@ function apiMiddleware(root, opts = {}) {
4183
4197
  return json(res, 405, { error: "method not allowed" });
4184
4198
  }
4185
4199
  if (path === "work") {
4186
- const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
4200
+ const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
4187
4201
  const tokenOk = () => {
4188
4202
  const t = readDevInfo(root)?.token;
4189
4203
  return !!t && req.headers["x-mv-work"] === t;
4190
4204
  };
4191
4205
  if (req.method === "GET") {
4192
4206
  if (!ownerGated(req) && !tokenOk()) return json(res, 403, { error: "forbidden" });
4193
- const { boardsShowing, activityClock } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
4207
+ const { boardsShowing, activityClock } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
4194
4208
  const frames = workActivity.active();
4195
4209
  return json(res, 200, {
4196
4210
  frames,
@@ -4539,7 +4553,7 @@ function apiMiddleware(root, opts = {}) {
4539
4553
  if (!b || typeof b.capture !== "string" || !CAPTURE_ID.test(b.capture) || typeof b.frame !== "string") return json(res, 400, { error: "expected { capture, frame, theme?, viewport? }" });
4540
4554
  if (readCapture(root, b.capture)) return json(res, 409, { error: "that capture is sealed" });
4541
4555
  const theme = typeof b.theme === "string" && /^[a-z0-9-]+$/i.test(b.theme) ? b.theme : "light";
4542
- const { shootFrame } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
4556
+ const { shootFrame } = await import("./shot-HZtclbOT.mjs").then((n) => n.u);
4543
4557
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
4544
4558
  const vp = typeof b.viewport === "string" ? opts.viewports?.[b.viewport] : void 0;
4545
4559
  const dim = (v) => typeof v === "number" && Number.isFinite(v) ? Math.round(v) : void 0;
@@ -4616,7 +4630,7 @@ function apiMiddleware(root, opts = {}) {
4616
4630
  return json(res, 200, { boards: ownership(root) });
4617
4631
  }
4618
4632
  if ((path === "comment-actions/resolve-all" || path === "comment-actions/undo") && req.method === "POST") {
4619
- const { readDevInfo } = await import("./work-Nv-n2_Un.mjs").then((n) => n.o);
4633
+ const { readDevInfo } = await import("./work-B4tydWnf.mjs").then((n) => n.c);
4620
4634
  const token = readDevInfo(root)?.token;
4621
4635
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
4622
4636
  const raw = await readBody(req);
@@ -4627,7 +4641,7 @@ function apiMiddleware(root, opts = {}) {
4627
4641
  } catch {
4628
4642
  return json(res, 400, { error: "malformed JSON" });
4629
4643
  }
4630
- const ca = await import("./comment-actions-Bxf9Ld4g.mjs");
4644
+ const ca = await import("./comment-actions-BCBcd-Wq.mjs");
4631
4645
  const { jamLive } = await Promise.resolve().then(() => live_exports);
4632
4646
  if (typeof b?.op !== "string" || !ca.OP_RE.test(b.op)) return json(res, 400, { error: "expected { op: <8-64 char token>, ... }" });
4633
4647
  if (path === "comment-actions/undo") {
@@ -4947,6 +4961,11 @@ function elsewhere(res) {
4947
4961
  * contracts: the Mac app's fake canvas runs it under Node's type stripping over a scripted `read()`, so the app's cases
4948
4962
  * meet this code, not a copy (#4).
4949
4963
  */
4964
+ /**
4965
+ * Spec 32 F2: the time app-live first saw a working Jam card with no `startedAt` (an older batch never claimed), by its
4966
+ * card - what its run counts from then. Kept for the process, a card leaving work forgets it.
4967
+ */
4968
+ const firstSeenWorking = /* @__PURE__ */ new Map();
4950
4969
  /** An item's id (#9): its kind and the first 20 hex of a sha256 over the occurrence's persisted parts, NUL-joined. */
4951
4970
  const liveId = (kind, ...parts) => `${kind}:${createHash("sha256").update(parts.map(String).join("\0")).digest("hex").slice(0, 20)}`;
4952
4971
  /** One line of at most `max` UTF-16 units: whitespace collapsed, control characters gone, never cut inside a pair. A
@@ -5068,38 +5087,93 @@ function liveSnapshot(input) {
5068
5087
  };
5069
5088
  for (const i of items) counts[i.kind]++;
5070
5089
  const shown = items.filter(refsFit).sort((a, b) => b.at - a.at || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
5071
- const working = input.cli.length > 0 || cards.some((c) => c.state === "working" && (!c.runner || !c.runner.state || c.runner.state === "claimed"));
5090
+ const runsNow = cards.filter((c) => c.state === "working" && !c.unstarted && (!c.runner || !c.runner.state || c.runner.state === "claimed"));
5091
+ const working = input.cli.length > 0 || runsNow.length > 0;
5092
+ const kept = shown.slice(0, LIVE_BOUNDS.items);
5093
+ const work = workOf(input, runsNow);
5094
+ const titles = titlesOf(input.titles, [...work?.board ? [work.board] : [], ...kept.map((i) => i.board)]);
5072
5095
  return {
5073
5096
  jam: view ? "on" : "off",
5074
- items: shown.slice(0, LIVE_BOUNDS.items),
5097
+ items: kept,
5075
5098
  cut: Math.max(0, shown.length - LIVE_BOUNDS.items),
5076
5099
  counts,
5077
5100
  unseen: input.fresh.length,
5078
5101
  working,
5079
- session: !!view?.session
5102
+ session: !!view?.session,
5103
+ ...work ? { work } : {},
5104
+ ...titles ? { titles } : {}
5080
5105
  };
5081
5106
  }
5107
+ /**
5108
+ * Spec 32 F2, `work`: since when something has been at work, and on which board. `since` is the earlier of `marver
5109
+ * work`'s clock and the oldest working run's start (its `startedAt`, else when it was first seen working); `board` the
5110
+ * newest working Jam card's board (the last made, then by id - never the latest run start), else the first board by name pinning a frame
5111
+ * the CLI holds; absent when nothing works.
5112
+ */
5113
+ function workOf(input, runsNow) {
5114
+ const now = input.now ?? Date.now();
5115
+ const ids = new Set(runsNow.map((c) => c.id));
5116
+ for (const id of [...firstSeenWorking.keys()]) if (!ids.has(id)) firstSeenWorking.delete(id);
5117
+ const startOf = (c) => {
5118
+ if (typeof c.startedAt === "number") return c.startedAt;
5119
+ let t = firstSeenWorking.get(c.id);
5120
+ if (t === void 0) firstSeenWorking.set(c.id, t = now);
5121
+ return t;
5122
+ };
5123
+ const cli = input.cli.length > 0 && typeof input.cliSince === "number" ? input.cliSince : void 0;
5124
+ const all = [...cli !== void 0 ? [cli] : [], ...runsNow.map(startOf)];
5125
+ if (!all.length) return void 0;
5126
+ const board = [...runsNow].sort((a, b) => b.made - a.made || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))[0]?.board ?? (input.cli.length ? input.pinning?.[0] : void 0);
5127
+ return {
5128
+ ...board && board.length <= LIVE_BOUNDS.ref ? { board } : {},
5129
+ since: Math.min(...all)
5130
+ };
5131
+ }
5132
+ /** Spec 32 F2, `titles`: the titles of the boards named, in that order, each once - at most `LIVE_TITLES_MAX`, a key a
5133
+ * ref (at most `LIVE_BOUNDS.ref`) and a value one line of at most `LIVE_BOUNDS.title`; absent when none has one. */
5134
+ function titlesOf(all, boards) {
5135
+ if (!all) return void 0;
5136
+ const out = {};
5137
+ let n = 0;
5138
+ for (const b of boards) {
5139
+ if (n >= 32) break;
5140
+ if (Object.hasOwn(out, b) || b.length > LIVE_BOUNDS.ref || !Object.hasOwn(all, b)) continue;
5141
+ const t = oneLine(all[b]);
5142
+ if (!t) continue;
5143
+ out[b] = t;
5144
+ n++;
5145
+ }
5146
+ return n ? out : void 0;
5147
+ }
5082
5148
  const block = (e) => `event: ${LIVE_WIRE.event}\ndata: ${JSON.stringify(e)}\n\n`;
5149
+ /** The event with only these items, and only the titles they or `work` still name (spec 32 F2: titles count in the bytes). */
5150
+ function withItems(e, items, cut) {
5151
+ const { titles, ...rest } = e;
5152
+ const named = /* @__PURE__ */ new Set([...e.work?.board ? [e.work.board] : [], ...items.map((i) => i.board)]);
5153
+ const kept = titles ? Object.fromEntries(Object.entries(titles).filter(([b]) => named.has(b))) : {};
5154
+ return {
5155
+ ...rest,
5156
+ items,
5157
+ cut,
5158
+ ...Object.keys(kept).length ? { titles: kept } : {}
5159
+ };
5160
+ }
5083
5161
  /**
5084
5162
  * The event as written (#11, r1 #4): `event: live`, one `data:` line, a blank line - within `LIVE_BOUNDS.eventBytes`
5085
5163
  * in UTF-8. While it is over, the oldest whole items go (the end of `items`), counted in `cut`; `counts` stay exact.
5086
5164
  */
5087
5165
  function encodeLive(e) {
5088
- let text = block(e);
5166
+ const text = block(e);
5089
5167
  if (Buffer.byteLength(text) <= LIVE_BOUNDS.eventBytes) return text;
5090
- const sizes = e.items.map((i) => Buffer.byteLength(JSON.stringify(i)) + 1);
5091
- let over = Buffer.byteLength(text) - LIVE_BOUNDS.eventBytes;
5092
- let keep = e.items.length;
5093
- while (keep > 0 && over > 0) over -= sizes[--keep];
5094
- for (;;) {
5095
- text = block({
5096
- ...e,
5097
- items: e.items.slice(0, keep),
5098
- cut: e.cut + e.items.length - keep
5099
- });
5100
- if (keep === 0 || Buffer.byteLength(text) <= LIVE_BOUNDS.eventBytes) return text;
5101
- keep--;
5168
+ const at = (keep) => block(withItems(e, e.items.slice(0, keep), e.cut + e.items.length - keep));
5169
+ const fits = (keep) => Buffer.byteLength(at(keep)) <= LIVE_BOUNDS.eventBytes;
5170
+ let lo = 0, hi = e.items.length - 1;
5171
+ while (lo < hi) {
5172
+ const mid = lo + hi + 1 >> 1;
5173
+ if (fits(mid)) lo = mid;
5174
+ else hi = mid - 1;
5102
5175
  }
5176
+ return at(lo);
5103
5177
  }
5104
5178
  /** `seq`: per server process, rising across Vite restarts - one counter for every hub this module makes (#11, #14). */
5105
5179
  const SEQ = { n: 0 };
@@ -5552,7 +5626,7 @@ function marverPlugin(ctx) {
5552
5626
  server.middlewares.use(perfRunBarrier());
5553
5627
  const hub = ctx.proof ? createLiveHub({
5554
5628
  instance: ctx.proof.instance,
5555
- read: () => liveSnapshot(live.read(manifest.frames)),
5629
+ read: () => liveSnapshot(live.read(manifest.frames, manifest.boards)),
5556
5630
  on: (fn) => workActivity.onChange(fn)
5557
5631
  }) : null;
5558
5632
  if (hub) onClose(() => hub.close());
@@ -5608,7 +5682,7 @@ function marverPlugin(ctx) {
5608
5682
  server.httpServer?.once("close", () => resetPdf(root));
5609
5683
  server.middlewares.use((req, res, next) => {
5610
5684
  if (!(req.url ?? "").startsWith(`/__mv/handout/`)) return next();
5611
- import("./pdf-CZENT6t3.mjs").then((m) => m.handoutMiddleware()(req, res, next), next);
5685
+ import("./pdf-GGya_nI6.mjs").then((m) => m.handoutMiddleware()(req, res, next), next);
5612
5686
  });
5613
5687
  server.middlewares.use(apiMiddleware(root, {
5614
5688
  viewports: config.viewports,
@@ -5894,7 +5968,7 @@ function marverPlugin(ctx) {
5894
5968
  });
5895
5969
  return;
5896
5970
  }
5897
- const { shootFrame, shootBatch, resolveFrames } = await import("./shot-BqwkdtKn.mjs").then((n) => n.u);
5971
+ const { shootFrame, shootBatch, resolveFrames } = await import("./shot-HZtclbOT.mjs").then((n) => n.u);
5898
5972
  if (ways[0] === "frame") {
5899
5973
  if (typeof spec.frame !== "string") {
5900
5974
  write({
@@ -5978,7 +6052,7 @@ function liveSources(root) {
5978
6052
  const cache = /* @__PURE__ */ new Map();
5979
6053
  let reads = 0;
5980
6054
  return {
5981
- read(frames) {
6055
+ read(frames, manifestBoards) {
5982
6056
  const names = listBoards(dir);
5983
6057
  for (const b of cache.keys()) if (!names.includes(b)) cache.delete(b);
5984
6058
  const boards = [];
@@ -6004,11 +6078,18 @@ function liveSources(root) {
6004
6078
  threads: c.threads
6005
6079
  });
6006
6080
  }
6081
+ const cli = workActivity.leases("cli").map(([f]) => f);
6082
+ const titles = {};
6083
+ for (const b of manifestBoards ?? []) if (b.title) titles[b.name] = b.title;
6084
+ const since = workClock.since();
6007
6085
  return {
6008
6086
  boards,
6009
6087
  fresh: freshFrames(root, frames),
6010
6088
  jam: jamLive.view?.(),
6011
- cli: workActivity.leases("cli").map(([f]) => f)
6089
+ cli,
6090
+ ...since !== void 0 ? { cliSince: since } : {},
6091
+ ...cli.length ? { pinning: pinningBoards(root, cli) } : {},
6092
+ titles
6012
6093
  };
6013
6094
  },
6014
6095
  reads: () => reads
@@ -1,4 +1,4 @@
1
- import { i as capture, m as findChrome } from "./shot-BqwkdtKn.mjs";
1
+ import { i as capture, m as findChrome } from "./shot-HZtclbOT.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";
@@ -1,6 +1,6 @@
1
1
  import { o as slideSize } from "./cli.mjs";
2
- import { l as ASK_MAX, u as bakeBatch } from "./plugin-CL8_wL7a.mjs";
3
- import { m as findChrome, s as planShot } from "./shot-BqwkdtKn.mjs";
2
+ import { l as ASK_MAX, u as bakeBatch } from "./plugin-Cm74UDfp.mjs";
3
+ import { m as findChrome, s as planShot } from "./shot-HZtclbOT.mjs";
4
4
  import { MIME } from "./serve-kcF6-H8V.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,6 +1,6 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
2
  import { d as recoverTarget, r as legacyEntry, u as recoverEntries, v as workspaceId } from "./slots-BOcfIqxy.mjs";
3
- import { DevStartError, dev } from "./dev-BBZe_brH.mjs";
3
+ import { DevStartError, dev } from "./dev-CJf5upVK.mjs";
4
4
  //#region src/cli/recover.ts
5
5
  /**
6
6
  * `marver dev --recover` (spec 28 A1.6). A Jam capture the page could not send waits in that browser's
@@ -1,5 +1,5 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { i as readDevInfo } from "./work-Nv-n2_Un.mjs";
2
+ import { a as readDevInfo } from "./work-B4tydWnf.mjs";
3
3
  import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { randomBytes } from "node:crypto";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { a as ROUTE, o as slideSize } from "./cli.mjs";
3
- import { d as logJam } from "./perf-BB0XNt1M.mjs";
3
+ import { d as logJam } from "./perf-BA_NDarr.mjs";
4
4
  import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
5
5
  import { join } from "node:path";
6
6
  import { randomBytes } from "node:crypto";
@@ -524,8 +524,8 @@ async function shootFrame(opts) {
524
524
  };
525
525
  const plan = planShot(frame, viewports, size);
526
526
  if (frame.kind !== "html") try {
527
- const { scanAssetRefs } = await import("./build-BNssmbqd.mjs");
528
- const { ensurePoster } = await import("./poster-B7uSjlEP.mjs");
527
+ const { scanAssetRefs } = await import("./build-4-k2XhhX.mjs");
528
+ const { ensurePoster } = await import("./poster-BnuT9UyW.mjs");
529
529
  const refs = scanAssetRefs(readFileSync(join(root, frame.file), "utf8"), frame.file);
530
530
  for (const r of refs) if (r.endsWith(".poster.png")) await ensurePoster(join(root, "design", "assets"), r.slice(0, -11));
531
531
  } catch {}
@@ -1,8 +1,8 @@
1
1
  import { l as listBoardFiles, o as checkBoardsDir } from "./boards-Cim1GTKc.mjs";
2
2
  import { f as isBoardName } from "./board-tree-DGj0HhEE.mjs";
3
3
  import { s as hashOfTarget } from "./deep-link-DYtuT740.mjs";
4
- import { i as readDevInfo } from "./work-Nv-n2_Un.mjs";
5
- import { NOT_RUNNING, findDev, linkFor, resolveLink, unreachable } from "./link-Cmt9Xy4X.mjs";
4
+ import { a as readDevInfo } from "./work-B4tydWnf.mjs";
5
+ import { NOT_RUNNING, findDev, linkFor, resolveLink, unreachable } from "./link-aZq5cExV.mjs";
6
6
  import { join } from "node:path";
7
7
  //#region src/cli/show.ts
8
8
  /**
@@ -83,15 +83,42 @@ var work_exports = /* @__PURE__ */ __exportAll({
83
83
  activityClock: () => activityClock,
84
84
  boardsChanged: () => boardsChanged,
85
85
  boardsShowing: () => boardsShowing,
86
+ createWorkClock: () => createWorkClock,
86
87
  nextActivitySeq: () => nextActivitySeq,
87
88
  onBoardsChanged: () => onBoardsChanged,
89
+ pinningBoards: () => pinningBoards,
88
90
  readDevInfo: () => readDevInfo,
89
91
  removeDevInfo: () => removeDevInfo,
90
92
  workActivity: () => workActivity,
93
+ workClock: () => workClock,
91
94
  writeDevInfo: () => writeDevInfo
92
95
  });
93
96
  /** One per process - the dev server, the jam daemon, and the API all share it. */
94
97
  const workActivity = createActivity();
98
+ function createWorkClock(a, now = Date.now) {
99
+ let since;
100
+ let until = 0;
101
+ const read = () => {
102
+ const leases = a.leases("cli");
103
+ const t = now();
104
+ if (!leases.length) {
105
+ since = void 0;
106
+ until = 0;
107
+ return;
108
+ }
109
+ if (since === void 0 || until <= t) since = t;
110
+ until = Math.max(...leases.map(([, u]) => u));
111
+ };
112
+ const stop = a.onChange(read);
113
+ read();
114
+ return {
115
+ since: () => since !== void 0 && until > now() ? since : void 0,
116
+ stop
117
+ };
118
+ }
119
+ /** The process's clock over `workActivity`, subscribed once at module load: a Vite restart, a hub made again or a client
120
+ * that reconnects keeps it; a new `marver dev` process starts again. */
121
+ const workClock = createWorkClock(workActivity);
95
122
  /** The order of what the shell is told about activity: each broadcast takes the next number, and the
96
123
  * snapshot a page asks for carries the latest - so a slow snapshot never undoes a newer broadcast.
97
124
  * Time-based, so a restarted server never counts backwards past a page that outlived it. */
@@ -179,6 +206,15 @@ function onBoardsChanged(fn) {
179
206
  boardListeners.delete(fn);
180
207
  };
181
208
  }
209
+ /** The boards that pin any of these frames, by name - never the auto boards, which hold every frame (spec 32 F2: the
210
+ * board a `marver work` hold is named by, its first). */
211
+ function pinningBoards(root, frames) {
212
+ if (!frames.length) return [];
213
+ const ix = indexOf(root);
214
+ const out = /* @__PURE__ */ new Set();
215
+ for (const f of frames) for (const b of ix.byFrame.get(f) ?? []) if (!ix.auto.includes(b)) out.add(b);
216
+ return [...out].sort();
217
+ }
182
218
  /** The boards that show any of these frames - what the sidebar lights while an agent works (the
183
219
  * board's type icon shimmers): every board pinning one, and every auto board, which holds every
184
220
  * frame. Sorted, so an unchanged answer compares equal. */
@@ -190,4 +226,4 @@ function boardsShowing(root, frames) {
190
226
  return [...out].sort();
191
227
  }
192
228
  //#endregion
193
- export { workActivity as a, readDevInfo as i, WORK_TTL_MAX as n, work_exports as o, boardsChanged as r, WORK_TTL_DEFAULT as t };
229
+ export { readDevInfo as a, work_exports as c, pinningBoards as i, WORK_TTL_MAX as n, workActivity as o, boardsChanged as r, workClock as s, WORK_TTL_DEFAULT as t };
@@ -1,6 +1,6 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { i as readDevInfo, n as WORK_TTL_MAX, t as WORK_TTL_DEFAULT } from "./work-Nv-n2_Un.mjs";
3
- import { unreachable } from "./link-Cmt9Xy4X.mjs";
2
+ import { a as readDevInfo, n as WORK_TTL_MAX, t as WORK_TTL_DEFAULT } from "./work-B4tydWnf.mjs";
3
+ import { unreachable } from "./link-aZq5cExV.mjs";
4
4
  //#region src/cli/work.ts
5
5
  /**
6
6
  * `marver work` - the coding agent's hand on the canvas working state.
@@ -68,7 +68,7 @@ async function workCommand(root, action, frames, opts) {
68
68
  });
69
69
  console.log(active.length ? `still working: ${active.join(", ")}` : "nothing working - all clear");
70
70
  const done = before.filter((f) => !active.includes(f));
71
- const { links, hints } = done.length ? await (await import("./link-Cmt9Xy4X.mjs")).handBack(root, done) : {
71
+ const { links, hints } = done.length ? await (await import("./link-aZq5cExV.mjs")).handBack(root, done) : {
72
72
  links: [],
73
73
  hints: []
74
74
  };