@marver-design/marver 0.27.2 → 0.29.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 (91) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +6 -4
  3. package/dist/{anchor-check-gkxkPAIv.mjs → anchor-check-DhlpKl2K.mjs} +1 -1
  4. package/dist/{audio-Dw1lfMdb.mjs → audio-DX4POHAj.mjs} +39 -4
  5. package/dist/{boards-BqUqKNW8.mjs → boards-BeWtjGUM.mjs} +49 -4
  6. package/dist/boards-EH2onUXM.mjs +995 -0
  7. package/dist/{build-VgNg4rr8.mjs → build-CWbrb2bl.mjs} +9 -5
  8. package/dist/{capture-vadKjuCo.mjs → capture-DEtM4qm5.mjs} +259 -34
  9. package/dist/cli.mjs +40 -19
  10. package/dist/{comments-YEU1Zhv9.mjs → comments-XNhMmSSu.mjs} +4 -4
  11. package/dist/config-BezZTiov.mjs +182 -0
  12. package/dist/conn-BMiHS42T.mjs +222 -0
  13. package/dist/connectors-DekQvKt9.mjs +292 -0
  14. package/dist/{context-Ccjrhr1J.mjs → context-BUnFiyA3.mjs} +2 -2
  15. package/dist/{daemon-Dc9AH0M3.mjs → daemon-Sc_z8gT6.mjs} +2209 -205
  16. package/dist/{dev-ri6nAlRp.mjs → dev-DWBKQhxf.mjs} +31 -15
  17. package/dist/{init-W0nxR1OY.mjs → init-CYlFaRzG.mjs} +7 -2
  18. package/dist/jam-Cj5gBvwD.mjs +373 -0
  19. package/dist/{link-CdTgn94Y.mjs → link-BFFRgrMt.mjs} +3 -3
  20. package/dist/listener-DdLEM79A.mjs +80 -0
  21. package/dist/logo-CXY-1yrn.mjs +305 -0
  22. package/dist/{ls-BZ5TAtd5.mjs → ls-NqmePKOf.mjs} +1 -1
  23. package/dist/{manifest-aFyDmL8C.mjs → manifest-DPZ3WNg_.mjs} +1 -1
  24. package/dist/{marks-CnCCfAbD.mjs → marks-BnNANic9.mjs} +22 -3
  25. package/dist/{marks-BF9pNEgH.mjs → marks-DBp3h1Mc.mjs} +3 -6
  26. package/dist/{marver-id-gate-D-R0hSt_.mjs → marver-id-gate-vBLb_Icb.mjs} +1 -1
  27. package/dist/{perf-DkAUFT6W.mjs → perf-Denssrko.mjs} +45 -27
  28. package/dist/{perf-jam-BaH3Lg0m.mjs → perf-jam-CLkERSHo.mjs} +9 -2
  29. package/dist/permit-DDa6wqOs.mjs +187 -0
  30. package/dist/{plugin-B8UghYuF.mjs → plugin-DqoZB-D6.mjs} +849 -789
  31. package/dist/{poster-BNgafWMK.mjs → poster-CrsjqhY4.mjs} +1 -1
  32. package/dist/{profile-jIS6BcAs.mjs → profile-B1FKOM1e.mjs} +1 -1
  33. package/dist/{publish-bakes-38Nja78p.mjs → publish-bakes-DW-NDgU2.mjs} +3 -3
  34. package/dist/{queue-CAM_vNmX.mjs → queue-DeSQm24g.mjs} +189 -35
  35. package/dist/{recover-B8AiI29B.mjs → recover-GtJ9UDAB.mjs} +2 -2
  36. package/dist/{serve-Dp3nHstu.mjs → serve-DQv3Ti6X.mjs} +8 -4
  37. package/dist/{session-BAaJsK5c.mjs → session-VDJfXEEm.mjs} +1 -1
  38. package/dist/{share-Ce4tP7ji.mjs → share-Bu_kuOKL.mjs} +1 -1
  39. package/dist/{shot-CMQgMVZm.mjs → shot-DBWN8hPP.mjs} +1 -1
  40. package/dist/{shot-Ch24tiMO.mjs → shot-T04Ixrvq.mjs} +7 -6
  41. package/dist/sizes-wjXDev3b.mjs +139 -0
  42. package/dist/{slots-CFNnegCc.mjs → slots-Dn4Onb0V.mjs} +101 -3
  43. package/dist/speech-worker.mjs +23 -3
  44. package/dist/{sync-CQdGARJ9.mjs → sync-CMozOwZ0.mjs} +1 -1
  45. package/dist/transport-C5FnY9ni.mjs +203 -0
  46. package/dist/{work-Bxz-ObF3.mjs → work-BYWD_1Zf.mjs} +3 -3
  47. package/dist/{work-CNhFF9pU.mjs → work-DJxH7cCX.mjs} +1 -1
  48. package/docs/boards-and-folders.md +11 -0
  49. package/docs/jam-session.md +52 -18
  50. package/docs/live-jam.md +95 -10
  51. package/docs/performance.md +1 -1
  52. package/docs/publish.md +7 -0
  53. package/package.json +1 -1
  54. package/src/client/shell/Comments.tsx +5 -4
  55. package/src/client/shell/ContextMenu.tsx +5 -4
  56. package/src/client/shell/JamSurface.tsx +135 -29
  57. package/src/client/shell/Play.tsx +16 -4
  58. package/src/client/shell/api.ts +7 -3
  59. package/src/client/shell/app-bridge.ts +11 -3
  60. package/src/client/shell/comments-store.ts +14 -0
  61. package/src/client/shell/goto.ts +4 -3
  62. package/src/client/shell/icons.tsx +1 -0
  63. package/src/client/shell/jam-capture.ts +136 -37
  64. package/src/client/shell/jam-keys.ts +170 -18
  65. package/src/client/shell/jam-lane.tsx +14 -5
  66. package/src/client/shell/jam-lines.ts +76 -10
  67. package/src/client/shell/jam-panel.tsx +58 -4
  68. package/src/client/shell/jam-queue.ts +55 -8
  69. package/src/client/shell/jam-session.tsx +55 -6
  70. package/src/client/shell/jam-state.ts +19 -4
  71. package/src/client/shell/jam-surface-parts.tsx +6 -3
  72. package/src/client/shell/jam-ui.tsx +10 -1
  73. package/src/client/shell/jam-voice-wait.ts +21 -0
  74. package/src/client/shell/jam-voice.ts +14 -5
  75. package/src/client/shell/live-picture.ts +134 -0
  76. package/src/client/shell/open-item.ts +83 -0
  77. package/src/client/shell/open-resolve.ts +50 -0
  78. package/src/client/shell/store.ts +6 -2
  79. package/src/client/shell/styles.css +29 -11
  80. package/src/client/shell/tidy.ts +3 -2
  81. package/src/client/stage/main.tsx +30 -8
  82. package/src/shared/app-api.ts +173 -3
  83. package/src/shared/app-perf.ts +4 -2
  84. package/src/shared/approval.ts +20 -0
  85. package/src/shared/events.ts +1 -1
  86. package/templates/AGENTS-embedded.md +28 -1
  87. package/templates/AGENTS-studio.md +28 -1
  88. package/templates/instructions/boards.md +7 -1
  89. package/templates/instructions/jam.md +94 -0
  90. package/dist/boards-BHKP5yhI.mjs +0 -342
  91. package/dist/live-Cgzsicwi.mjs +0 -4
@@ -1,4 +1,4 @@
1
- import { i as capture, p as findChrome } from "./shot-Ch24tiMO.mjs";
1
+ import { i as capture, p as findChrome } from "./shot-T04Ixrvq.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,4 +1,4 @@
1
- import { i as loadCollab } from "./sync-CQdGARJ9.mjs";
1
+ import { i as loadCollab } from "./sync-CMozOwZ0.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  //#region src/server/profile.ts
@@ -1,7 +1,7 @@
1
1
  import { o as slideSize } from "./cli.mjs";
2
- import { o as ASK_MAX, s as bakeBatch } from "./plugin-B8UghYuF.mjs";
3
- import { p as findChrome, s as planShot } from "./shot-Ch24tiMO.mjs";
4
- import { MIME } from "./serve-Dp3nHstu.mjs";
2
+ import { c as ASK_MAX, l as bakeBatch } from "./plugin-DqoZB-D6.mjs";
3
+ import { p as findChrome, s as planShot } from "./shot-T04Ixrvq.mjs";
4
+ import { MIME } from "./serve-DQv3Ti6X.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";
7
7
  import { createServer } from "node:http";
@@ -1,9 +1,10 @@
1
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
+ import { n as localProfile } from "./profile-B1FKOM1e.mjs";
4
5
  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-vadKjuCo.mjs";
6
- import { i as readWrapup, o as recordPathProblem } from "./session-BAaJsK5c.mjs";
6
+ import { E as threadId, b as packetPath, g as wordsSince, l as hashOf, m as requestWords, n as captureFrames, p as readCapture, s as factsOf, u as madeOf, v as buildPacket, w as sanitize } from "./capture-DEtM4qm5.mjs";
7
+ import { i as readWrapup, o as recordPathProblem } from "./session-VDJfXEEm.mjs";
7
8
  import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
8
9
  import { join } from "node:path";
9
10
  import { randomBytes, randomUUID } from "node:crypto";
@@ -67,7 +68,8 @@ function readRaw(root) {
67
68
  ...j.session && typeof j.session.id === "string" && /^ses-\d{10,16}-[a-z0-9]{4,12}$/.test(j.session.id) && typeof j.session.since === "number" ? { session: {
68
69
  id: j.session.id,
69
70
  since: j.session.since
70
- } } : {}
71
+ } } : {},
72
+ ...j.receipts && typeof j.receipts === "object" && !Array.isArray(j.receipts) ? { receipts: Object.fromEntries(Object.entries(j.receipts).filter(([k, r]) => /^[0-9a-f-]{36}$/.test(k) && r && typeof r.at === "number" && r.out && typeof r.out === "object")) } : {}
71
73
  } };
72
74
  } catch {
73
75
  return {};
@@ -184,12 +186,23 @@ const ctxFor = (root) => ({
184
186
  });
185
187
  const isOwned = (ctx, board, id) => ctx.owned.has(`${board}\t${id}`);
186
188
  const seenKey = (board, id) => `${board}|${id}`;
189
+ /** Every move of a card's state but a requeue's. Entering review or failed from another state begins an episode: one
190
+ * more `att` (spec 28 A4.6 #9), what a live item's id hashes - a heartbeat, a rename or a re-read never changes it. */
187
191
  const set = (c, state, now, note) => {
192
+ if ((state === "review" || state === "failed") && c.state !== state) c.att = (c.att ?? 0) + 1;
188
193
  c.state = state;
189
194
  c.rev += 1;
190
195
  c.at = now;
191
196
  if (note !== void 0) c.note = note;
192
197
  };
198
+ /** The one way a card turns failed (A4.6 #9, r1 #1): `set` it, and when the journal holds its batch, that batch's
199
+ * `failures` one more - so a redelivery that fails again is a new occurrence of the same run. Several cards failing
200
+ * in one write add several: an id is compared, never counted. daemon.ts calls it too, never writing `failed` itself. */
201
+ function failCard(j, c, note, now) {
202
+ set(c, "failed", now, note);
203
+ const b = c.batch ? j.batches.find((x) => x.batchId === c.batch) : void 0;
204
+ if (b) b.failures = (b.failures ?? 0) + 1;
205
+ }
193
206
  const onThread = (j, board, thread) => j.cards.filter((c) => c.board === board && c.thread === thread);
194
207
  /** The frame each thread sits on (a reply names only its thread). */
195
208
  const framesOf = (events) => {
@@ -341,6 +354,10 @@ function merge(j, queued, other, now) {
341
354
  if (gone.exclusive || keep.exclusive) keep.exclusive = [.../* @__PURE__ */ new Set([...keep.exclusive ?? [], ...gone.exclusive ?? []])];
342
355
  keep.shared = Math.max(keep.shared ?? 0, gone.shared ?? 0) || void 0;
343
356
  for (const f of gone.frames) if (!keep.frames.includes(f)) keep.frames.push(f);
357
+ if (gone.alone) {
358
+ keep.alone = joinAlone(gone.alone, keep.alone ?? {});
359
+ delete gone.alone;
360
+ }
344
361
  if (gone.batch || gone.ran?.length) keep.follows ??= gone.id;
345
362
  keep.state = "queued";
346
363
  keep.rev += 1;
@@ -363,6 +380,7 @@ function requeue(j, c, now, first = false) {
363
380
  const other = c.thread ? onThread(j, c.board, c.thread).find((x) => x !== c && x.state === "queued") : void 0;
364
381
  return other ? merge(j, other, c, now) : c;
365
382
  }
383
+ /** (the three `session-` actions are a stalled session run's choices - the daemon answers them, spec 29b Part 7) */
366
384
  const ACTIONS = [
367
385
  "drop",
368
386
  "retry",
@@ -374,7 +392,10 @@ const ACTIONS = [
374
392
  "more",
375
393
  "later",
376
394
  "rename",
377
- "note"
395
+ "note",
396
+ "session-again",
397
+ "session-background",
398
+ "session-drop"
378
399
  ];
379
400
  /** One card action from the page (POST /jam/card). It applies only if the card is still at `rev`
380
401
  * (two tabs cannot both decide); anything not allowed answers with the current card. */
@@ -418,9 +439,11 @@ function act(j, id, rev, action, now = Date.now(), body) {
418
439
  };
419
440
  }
420
441
  if (action === "edit" && capture && c.state === "draft" && typeof body === "string") {
442
+ const text = body.slice(0, 2e4);
421
443
  c.payload = {
422
444
  ...c.payload,
423
- edited: body.slice(0, 2e4)
445
+ edited: text,
446
+ editedAt: text === c.payload?.edited && c.payload.editedAt ? c.payload.editedAt : now
424
447
  };
425
448
  c.rev += 1;
426
449
  c.at = now;
@@ -535,8 +558,11 @@ const resultText = (j, batchId, card, fallback = "") => {
535
558
  };
536
559
  /** Freeze a card's brief as text, from the logs as they stand at claim. Covers every owner event it
537
560
  * copies (the `covered` record that takes a plain reply off `marver marks`). */
538
- function freezeBrief(j, ctx, c, events) {
539
- const msgs = c.thread ? events.filter((e) => e.type === "create" && e.commentId === c.thread || e.type === "reply" && e.parentId === c.thread) : [];
561
+ function freezeBrief(j, ctx, c, events, others = true) {
562
+ const inThread = c.thread ? events.filter((e) => e.type === "create" && e.commentId === c.thread || e.type === "reply" && e.parentId === c.thread) : [];
563
+ const me = others ? void 0 : localProfile(ctx.root);
564
+ const mine = (a) => !!me && (me.email ? a?.email === me.email : !a?.email && a?.name === me.name);
565
+ const msgs = others ? inThread : inThread.filter((e) => c.events.includes(e.id) || !e.agent && isOwned(ctx, c.board, e.id) || !!e.agent && mine(e.author));
540
566
  const dropped = new Set(j.cards.filter((x) => x.board === c.board && x.state === "dropped").flatMap((x) => x.events));
541
567
  const asks = new Set(c.events);
542
568
  const toMsg = (e) => {
@@ -552,6 +578,7 @@ function freezeBrief(j, ctx, c, events) {
552
578
  owner: true,
553
579
  rev
554
580
  } : {},
581
+ ...owner && rev !== e.id ? { edited: events.find((x) => x.id === rev)?.ts ?? e.ts } : {},
555
582
  body: sanitize(body, Infinity),
556
583
  ts: e.ts,
557
584
  ...note ? { note } : {}
@@ -569,7 +596,10 @@ function freezeBrief(j, ctx, c, events) {
569
596
  brief.capture = {
570
597
  record: cap.record,
571
598
  recordHash: cap.hash,
572
- ...capCard.payload.edited !== void 0 ? { edited: capCard.payload.edited } : {},
599
+ ...capCard.payload.edited !== void 0 ? {
600
+ edited: capCard.payload.edited,
601
+ ...capCard.payload.editedAt ? { editedAt: capCard.payload.editedAt } : {}
602
+ } : {},
573
603
  ...capCard.payload.added?.length ? { added: capCard.payload.added } : {},
574
604
  ...capCard.payload.reviewed ? { reviewed: capCard.payload.reviewed } : {},
575
605
  ...note ? { note } : {}
@@ -602,6 +632,29 @@ function freezeBrief(j, ctx, c, events) {
602
632
  }
603
633
  return brief;
604
634
  }
635
+ /** A brief frozen with other people's words (before 0.28, or with `jam.others` on), made owner-only: the owner's
636
+ * own messages and Marver's own replies stay; everyone else's, and anything whose author is not known, go. */
637
+ function ownerOnly(brief, me) {
638
+ const keep = (m) => !!m.owner || !!m.agent && m.author === me.name;
639
+ const asks = (l) => l.filter((m) => !!m.owner);
640
+ const cap = brief.capture;
641
+ return {
642
+ ...brief,
643
+ history: brief.history.filter(keep),
644
+ asks: asks(brief.asks),
645
+ ...brief.follows ? { follows: {
646
+ ...brief.follows,
647
+ asks: asks(brief.follows.asks)
648
+ } } : {},
649
+ ...cap?.reviewed ? { capture: {
650
+ ...cap,
651
+ reviewed: {
652
+ ...cap.reviewed,
653
+ asks: asks(cap.reviewed.asks)
654
+ }
655
+ } } : {}
656
+ };
657
+ }
605
658
  /** Are a card's asks still the owner's? Each must be in its board's log and ledgered; the ones that
606
659
  * are not are dropped, and a card with none left is dropped ("no longer authorized"). */
607
660
  /** Is a capture still what was ledgered at confirm - its sealed record's hash and the confirmed edit?
@@ -620,24 +673,24 @@ function wrapupIntact(ctx, c) {
620
673
  /** The wrap-up content a card writes from (a More work card writes from the same, its note added). */
621
674
  const wrapupOf = (c) => c.id;
622
675
  function validate(ctx, c, events, now, j) {
623
- if (c.capture && j && !captureIntact(j, ctx, c.capture)) {
624
- set(c, "failed", now, "the capture changed after it was confirmed - capture it again");
676
+ if (c.capture && !captureIntact(j, ctx, c.capture)) {
677
+ failCard(j, c, "the capture changed after it was confirmed - capture it again", now);
625
678
  return false;
626
679
  }
627
680
  if (c.kind === "capture") {
628
681
  const ok = c.events.every((id) => isOwned(ctx, c.board, id) && events.some((e) => e.id === id));
629
- if (!ok) set(c, "failed", now, "an ask on this capture is no longer the owner's");
682
+ if (!ok) failCard(j, c, "an ask on this capture is no longer the owner's", now);
630
683
  return ok;
631
684
  }
632
685
  if (c.kind === "wrapup") {
633
686
  if (!wrapupIntact(ctx, c)) {
634
- set(c, "failed", now, "the session record changed after it was written - write it again");
687
+ failCard(j, c, "the session record changed after it was written - write it again", now);
635
688
  return false;
636
689
  }
637
690
  const w = readWrapup(ctx.root, c.id);
638
691
  const unsafe = w && recordPathProblem(ctx.root, w.wrapup.file);
639
692
  if (unsafe) {
640
- set(c, "failed", now, `the record's file is not safe to write: ${unsafe}`);
693
+ failCard(j, c, `the record's file is not safe to write: ${unsafe}`, now);
641
694
  return false;
642
695
  }
643
696
  return true;
@@ -655,11 +708,19 @@ function validate(ctx, c, events, now, j) {
655
708
  }
656
709
  return true;
657
710
  }
711
+ /** Does a queued card run alone - once nothing runs and no hold is left, and while it waits nothing new starts? One that
712
+ * must edit a shared file does. So does one with no frame, unless a session takes the work now (F5): then it runs beside
713
+ * the others, each frame it makes claimed with `--run` - never one back from a run that left its session, as a run Marver
714
+ * spawns finds the frames it made only when nothing ran beside it. A card that holds a frame - yours, or one an earlier
715
+ * run of it made - is a request on that frame like any other: what it holds now decides, never what it held once. The
716
+ * one rule: the queue, the lane and the holds read it. */
717
+ const runsAlone = (c, session) => !!c.exclusive || !c.frames.length && (!!c.alone || !session(c.kind === "wrapup"));
658
718
  /** Claim what can run now: the queued cards of one board on one single frame join one batch, in
659
719
  * run order, up to 8; a card naming several frames runs alone and waits for all of them; a card
660
- * with no frame, or one that must edit a shared file, runs exclusive - alone, once nothing runs and
661
- * no hold is left, and while it waits nothing new starts. Briefs are frozen, cards turn working,
662
- * and each packet is written to its file. Returns the new batches (already in the journal). */
720
+ * with no frame runs beside them while a session takes the work, each its own run; one that runs
721
+ * alone (`runsAlone`) runs exclusive - once nothing runs and no hold is left, and while it waits
722
+ * nothing new starts. Briefs are frozen, cards turn working, and each packet is written to its
723
+ * file. Returns the new batches (already in the journal). */
663
724
  function form(j, ctx, o, now = Date.now()) {
664
725
  const logs = /* @__PURE__ */ new Map();
665
726
  const log = (board) => {
@@ -667,12 +728,13 @@ function form(j, ctx, o, now = Date.now()) {
667
728
  if (!l) logs.set(board, l = readLog(ctx.dir, board));
668
729
  return l;
669
730
  };
670
- for (const c of j.cards) if (c.state === "queued" && (c.exclusive || !c.frames.length)) validate(ctx, c, log(c.board), now, j);
731
+ const alone = (c) => runsAlone(c, (record) => !!o.session?.(record));
732
+ for (const c of j.cards) if (c.state === "queued" && alone(c)) validate(ctx, c, log(c.board), now, j);
671
733
  const queued = j.cards.filter((c) => c.state === "queued").sort((a, b) => a.order - b.order || a.made - b.made);
672
- const exclusive = queued.filter((c) => c.exclusive || !c.frames.length);
734
+ const exclusive = queued.filter(alone);
673
735
  const forming = [];
674
736
  if (exclusive.length) {
675
- if (o.exclusiveRunning || o.running.size || o.anyHold() || o.free < 1) return {
737
+ if (o.exclusiveRunning || o.running.size || o.active || o.anyHold() || o.free < 1) return {
676
738
  batches: [],
677
739
  exclusiveWaiting: !o.exclusiveRunning
678
740
  };
@@ -686,32 +748,64 @@ function form(j, ctx, o, now = Date.now()) {
686
748
  });
687
749
  } else if (!o.exclusiveRunning) {
688
750
  const reserved = new Set(o.running);
689
- for (const c of queued) if (c.frames.length === 1) {
751
+ const formedNow = /* @__PURE__ */ new Set();
752
+ let took = 0;
753
+ const one = !!o.session?.(false);
754
+ const spawns = (b) => b.cards.some((c) => !!c.alone?.spawn);
755
+ const taken = (session) => forming.filter((b) => !one ? !!b.for === session : !session || !spawns(b)).length;
756
+ const sharable = (c, f) => !c.alone && !formedNow.has(f) && !!o.share?.(f);
757
+ for (const c of queued) if (!c.frames.length) {
758
+ const s = o.session(c.kind === "wrapup");
759
+ if (taken(true) >= s.room) continue;
760
+ if (!validate(ctx, c, log(c.board), now, j)) continue;
761
+ forming.push({
762
+ board: c.board,
763
+ frames: [],
764
+ cards: [c],
765
+ single: false,
766
+ for: {
767
+ conn: s.conn,
768
+ inc: s.inc
769
+ }
770
+ });
771
+ took += 1;
772
+ } else if (c.frames.length === 1) {
690
773
  const f = c.frames[0];
691
- const join = forming.find((b) => b.single && b.board === c.board && b.frames[0] === f && b.cards.length < 8);
774
+ const join = forming.find((b) => b.single && b.board === c.board && b.frames[0] === f && b.cards.length < 8 && !(c.alone && b.overlaps));
692
775
  if (join) {
693
776
  if (validate(ctx, c, log(c.board), now, j)) join.cards.push(c);
694
777
  continue;
695
778
  }
696
- if (reserved.has(f) || o.held(f) || forming.length >= o.free) continue;
779
+ const shared = reserved.has(f) && (o.shareRoom ?? 0) > took && sharable(c, f);
780
+ if (reserved.has(f) && !shared || o.held(f) || taken(false) >= o.free) continue;
697
781
  if (!validate(ctx, c, log(c.board), now, j)) continue;
698
782
  forming.push({
699
783
  board: c.board,
700
784
  frames: [f],
701
785
  cards: [c],
702
- single: true
786
+ single: true,
787
+ ...shared ? { overlaps: o.share(f) } : {}
703
788
  });
789
+ if (shared) took += 1;
704
790
  reserved.add(f);
791
+ formedNow.add(f);
705
792
  } else {
706
- if (c.frames.some((f) => reserved.has(f) || o.held(f)) || forming.length >= o.free) continue;
793
+ const busy = c.frames.filter((f) => reserved.has(f));
794
+ const shared = busy.length > 0 && (o.shareRoom ?? 0) > took && busy.every((f) => sharable(c, f));
795
+ if (busy.length && !shared || c.frames.some((f) => o.held(f)) || taken(false) >= o.free) continue;
707
796
  if (!validate(ctx, c, log(c.board), now, j)) continue;
708
797
  forming.push({
709
798
  board: c.board,
710
799
  frames: [...c.frames],
711
800
  cards: [c],
712
- single: false
801
+ single: false,
802
+ ...shared ? { overlaps: [...new Set(busy.flatMap((f) => o.share(f)))] } : {}
713
803
  });
714
- for (const f of c.frames) reserved.add(f);
804
+ if (shared) took += 1;
805
+ for (const f of c.frames) {
806
+ reserved.add(f);
807
+ formedNow.add(f);
808
+ }
715
809
  }
716
810
  }
717
811
  const batches = [];
@@ -721,7 +815,7 @@ function form(j, ctx, o, now = Date.now()) {
721
815
  const packetMembers = [];
722
816
  const threads = replay(log(f.board));
723
817
  for (const c of f.cards) {
724
- const brief = freezeBrief(j, ctx, c, log(c.board));
818
+ const brief = freezeBrief(j, ctx, c, log(c.board), o.others !== false);
725
819
  const id = `m${members.length + 1}`;
726
820
  c.brief = brief;
727
821
  c.batch = batchId;
@@ -745,6 +839,28 @@ function form(j, ctx, o, now = Date.now()) {
745
839
  });
746
840
  }
747
841
  const files = f.exclusive ? [...new Set(f.cards.flatMap((c) => c.exclusive ?? []))] : void 0;
842
+ const back = f.cards.find((c) => c.alone?.spawn)?.alone;
843
+ const created = [...new Set(f.cards.flatMap((c) => c.alone?.created ?? []))].filter((x) => f.frames.includes(x));
844
+ const kept = /* @__PURE__ */ new Map();
845
+ for (const s of f.cards.flatMap((c) => c.alone?.shots ?? [])) {
846
+ if (!f.frames.includes(s.frame)) continue;
847
+ const k = kept.get(s.frame);
848
+ if (!k || s.at !== void 0 && (k.at === void 0 || s.at < k.at)) kept.set(s.frame, {
849
+ before: s.before,
850
+ ...s.at !== void 0 ? { at: s.at } : {}
851
+ });
852
+ }
853
+ const shots = kept.size || created.length ? f.frames.filter((x) => !created.includes(x)).map((x) => {
854
+ const k = kept.get(x);
855
+ return {
856
+ frame: x,
857
+ ...k ? {
858
+ before: k.before,
859
+ ...k.at !== void 0 ? { beforeAt: k.at } : {}
860
+ } : {}
861
+ };
862
+ }) : void 0;
863
+ for (const c of f.cards) delete c.alone;
748
864
  const b = {
749
865
  batchId,
750
866
  members,
@@ -753,7 +869,18 @@ function form(j, ctx, o, now = Date.now()) {
753
869
  state: "claimed",
754
870
  leaseUntil: 0,
755
871
  attempts: 0,
756
- at: now
872
+ at: now,
873
+ others: o.others !== false,
874
+ ...f.overlaps?.length && o.sharer ? {
875
+ overlaps: f.overlaps,
876
+ share: { ...o.sharer }
877
+ } : f.for ? { share: f.for } : {},
878
+ ...back ? {
879
+ handoff: "spawn",
880
+ ...back.why ? { handoffWhy: back.why } : {}
881
+ } : {},
882
+ ...created.length ? { created } : {},
883
+ ...shots ? { shots } : {}
757
884
  };
758
885
  j.batches.push(b);
759
886
  writePacket(ctx.root, buildPacket(batchId, packetMembers, f.frames, f.exclusive ? files : void 0), new Set(j.batches.filter((x) => x.state === "claimed").map((x) => x.batchId)));
@@ -764,6 +891,25 @@ function form(j, ctx, o, now = Date.now()) {
764
891
  exclusiveWaiting: exclusive.length > 0 && batches.length === 0
765
892
  };
766
893
  }
894
+ /** What a card waiting again carries from the runs that left it (F4) - joined, never replaced: a second run let go into the
895
+ * same card (a follow-up on its thread) adds the frames it made, and a frame's picture from before any edit is the
896
+ * first one kept (Codex's review: the second requeue replaced the first's, and its review started from partial work). */
897
+ function joinAlone(was, add) {
898
+ const created = [.../* @__PURE__ */ new Set([...was?.created ?? [], ...add.created ?? []])];
899
+ const shots = [...was?.shots ?? []].map((x) => ({ ...x }));
900
+ for (const x of add.shots ?? []) {
901
+ const i = shots.findIndex((y) => y.frame === x.frame);
902
+ if (i < 0) shots.push({ ...x });
903
+ else if (x.at !== void 0 && (shots[i].at === void 0 || x.at < shots[i].at)) shots[i] = { ...x };
904
+ }
905
+ const why = was?.why ?? add.why;
906
+ return {
907
+ ...was?.spawn || add.spawn ? { spawn: true } : {},
908
+ ...why ? { why } : {},
909
+ ...created.length ? { created } : {},
910
+ ...shots.length ? { shots } : {}
911
+ };
912
+ }
767
913
  const PACKETS_KEPT = 50;
768
914
  /** Write a batch's packet once (a rerun reads the same file) and forget old ones - never one an
769
915
  * unfinished batch (`keep`) still needs to resume. */
@@ -821,13 +967,13 @@ function settleOne(j, b, m, p, now, out) {
821
967
  set(c, "done", now, "resolved");
822
968
  out.push({ card: c });
823
969
  } else if ("missing" in r) {
824
- set(c, "failed", now, "the agent did not answer this one");
970
+ failCard(j, c, "the agent did not answer this one", now);
825
971
  out.push({
826
972
  card: c,
827
973
  notice: "failed"
828
974
  });
829
975
  } else if (c.exclusive || (c.shared ?? 0) >= 1) {
830
- set(c, "failed", now, "needed more shared files than it was given");
976
+ failCard(j, c, "needed more shared files than it was given", now);
831
977
  out.push({
832
978
  card: c,
833
979
  notice: "failed"
@@ -846,7 +992,7 @@ function fail(j, b, note, now = Date.now()) {
846
992
  if (!c || c.state !== "working" || c.batch !== b.batchId) continue;
847
993
  if (c.resolved) set(c, "done", now, "resolved");
848
994
  else {
849
- set(c, "failed", now, note);
995
+ failCard(j, c, note, now);
850
996
  out.push({
851
997
  card: c,
852
998
  notice: "failed"
@@ -868,7 +1014,7 @@ function undelivered(j, b, note, now = Date.now()) {
868
1014
  const r = b.results?.[m.id];
869
1015
  if (r && !("body" in r)) settleOne(j, b, m, {}, now, out);
870
1016
  else {
871
- set(c, "failed", now, note);
1017
+ failCard(j, c, note, now);
872
1018
  out.push({
873
1019
  card: c,
874
1020
  notice: "failed"
@@ -981,7 +1127,10 @@ function upgrade(v1, ctx, now = Date.now()) {
981
1127
  if (b.state === "done") continue;
982
1128
  if (b.state === "claimed" && b.pgid) fence.push(b.pgid);
983
1129
  if (!tag) continue;
984
- j.cards.push(card("failed", b.state === "failed" ? "the agent could not finish - Retry" : "interrupted by the upgrade - Retry"));
1130
+ j.cards.push({
1131
+ ...card("failed", b.state === "failed" ? "the agent could not finish - Retry" : "interrupted by the upgrade - Retry"),
1132
+ att: 1
1133
+ });
985
1134
  j.batches.push({
986
1135
  batchId: b.batchId,
987
1136
  members: [{
@@ -994,6 +1143,7 @@ function upgrade(v1, ctx, now = Date.now()) {
994
1143
  leaseUntil: 0,
995
1144
  attempts: b.attempts,
996
1145
  ...b.pgid ? { pgid: b.pgid } : {},
1146
+ failures: 1,
997
1147
  at: now
998
1148
  });
999
1149
  }
@@ -1095,7 +1245,11 @@ function addCapture(j, record, hash, now = Date.now()) {
1095
1245
  * text stays in the record), its facts, the capture it stands for; pinned on the first point, else
1096
1246
  * its first frame, else the board. Deterministic ids, so a resumed confirm writes it once. */
1097
1247
  function captureComment(c, record, at, author, now = Date.now()) {
1098
- const words = [captureWords(record, c.payload?.edited), ...(c.payload?.added ?? []).map((a) => a.text)].filter(Boolean).join("\n");
1248
+ const words = requestWords({
1249
+ record,
1250
+ edited: c.payload?.edited,
1251
+ added: c.payload?.added
1252
+ });
1099
1253
  return {
1100
1254
  id: `cap-${c.id}-e`,
1101
1255
  ts: now,
@@ -1316,4 +1470,4 @@ function createQueue(root, onUpgrade, alive = () => true) {
1316
1470
  };
1317
1471
  }
1318
1472
  //#endregion
1319
- export { ACTIONS, act, addCapture, addWrapup, answeredSince, answers, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, form, looksGood, moreWrapup, releaseLock as n, payloadKey, pending, prune, redelivering, sameComment, settle, startSession, stillOwned, acquireLock as t, textOf, undelivered, wrapupIntact, wrapupOf };
1473
+ export { ACTIONS, act, addCapture, addWrapup, answeredSince, answers, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, failCard, form, joinAlone, looksGood, moreWrapup, releaseLock as n, ownerOnly, payloadKey, pending, prune, redelivering, requeue, runsAlone, sameComment, settle, startSession, stillOwned, acquireLock as t, textOf, undelivered, wrapupIntact, wrapupOf };
@@ -1,6 +1,6 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { d as recoverTarget, h as workspaceId, r as legacyEntry, u as recoverEntries } from "./slots-CFNnegCc.mjs";
3
- import { DevStartError, dev } from "./dev-ri6nAlRp.mjs";
2
+ import { d as recoverTarget, r as legacyEntry, u as recoverEntries, v as workspaceId } from "./slots-Dn4Onb0V.mjs";
3
+ import { DevStartError, dev } from "./dev-DWBKQhxf.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,4 +1,5 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
+ import { t as logoIconLink } from "./logo-CXY-1yrn.mjs";
2
3
  import { t as secureSuffix } from "./secure-cookie-_K1Hsx8H.mjs";
3
4
  import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
4
5
  import { extname, isAbsolute, join, relative, resolve } from "node:path";
@@ -147,7 +148,7 @@ async function serve(root, portFlag) {
147
148
  console.error(`[${NAME}] MARVER_ID_ISSUER is set but MARVER_PUBLIC_ORIGIN is not.\n Every assertion is bound to this canvas's exact origin, and it cannot be\n inferred from request headers - a proxy can make any request look local.\n Set it to the origin people actually reach this canvas on:\n MARVER_PUBLIC_ORIGIN=https://canvas.example.com\n MARVER_PUBLIC_ORIGIN=http://localhost:${portFlag ?? (Number(process.env.PORT) || 4199)} (development)`);
148
149
  process.exit(1);
149
150
  }
150
- const { marverIdHandler } = await import("./marver-id-gate-D-R0hSt_.mjs");
151
+ const { marverIdHandler } = await import("./marver-id-gate-vBLb_Icb.mjs");
151
152
  const { dataDir } = await import("./comments-0BSbb04K.mjs").then((n) => n.n);
152
153
  const canvasName = humanName(meta.name);
153
154
  const { ceilingsFromRights } = await import("./auth-Dix8wrXV.mjs").then((n) => n.R);
@@ -322,6 +323,11 @@ function isCosmetic(pathname) {
322
323
  const MARK_AT = (size) => `<svg viewBox="0 0 256 256" width="${size}" height="${size}" fill="currentColor" aria-hidden><path d="M239.29,59.28l-64.8,144a8,8,0,0,1-7.3,4.72H24a8,8,0,0,1-7.3-11.28l64.8-144A8,8,0,0,1,88.81,48H232A8,8,0,0,1,239.29,59.28Z" opacity=".1"/><path d="M245.43,47.31A15.94,15.94,0,0,0,232,40H88.81a16,16,0,0,0-14.59,9.43l-64.8,144A16,16,0,0,0,24,216H167.19a16,16,0,0,0,14.59-9.43l64.8-144A16,16,0,0,0,245.43,47.31ZM167.19,200H24L88.81,56H232Z"/></svg>`;
323
324
  const MARK = MARK_AT(17);
324
325
  const MARK_LG = MARK_AT(24);
326
+ /** Marver's own tab icons: the gate's only when the build found no repo logo, whose icon is then the one there is
327
+ * (spec 28 A4.6 #46; release review P2 - beside it, a browser could still pick one of these). */
328
+ const MARVER_ICONS = `<link rel="icon" href="/__mv/favicon/favicon.ico" sizes="48x48" />
329
+ <link rel="icon" type="image/png" sizes="32x32" href="/__mv/favicon/favicon-32x32.png" />
330
+ <link rel="icon" type="image/png" sizes="16x16" href="/__mv/favicon/favicon-16x16.png" />`;
325
331
  /** The gate: the canvas's own antechamber - light ground, dot grid, glass card in the
326
332
  * shell's exact token language. Three doors, one credential each:
327
333
  * guests pay the canvas password, members sign in with their OWN password, and an
@@ -413,9 +419,7 @@ function gate(res, meta, collabOn, error, idOn = false) {
413
419
  ${meta.branding ? "<meta property=\"og:site_name\" content=\"Marver\" />" : ""}
414
420
  <meta property="og:type" content="website" />
415
421
  <meta name="twitter:card" content="summary" />
416
- <link rel="icon" href="/__mv/favicon/favicon.ico" sizes="48x48" />
417
- <link rel="icon" type="image/png" sizes="32x32" href="/__mv/favicon/favicon-32x32.png" />
418
- <link rel="icon" type="image/png" sizes="16x16" href="/__mv/favicon/favicon-16x16.png" />
422
+ ${logoIconLink(meta.logo) || MARVER_ICONS}
419
423
  <link rel="apple-touch-icon" href="/__mv/favicon/apple-touch-icon.png" />
420
424
  <style>
421
425
  * { box-sizing: border-box; margin: 0 }
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { f as readCapture } from "./capture-vadKjuCo.mjs";
2
+ import { p as readCapture } from "./capture-DEtM4qm5.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-CQdGARJ9.mjs";
3
+ import { i as loadCollab } from "./sync-CMozOwZ0.mjs";
4
4
  //#region src/cli/share.ts
5
5
  /**
6
6
  * `marver share <action>` - the roster from the terminal (01-sharing §9).
@@ -1,5 +1,5 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { i as readDevInfo } from "./work-CNhFF9pU.mjs";
2
+ import { i as readDevInfo } from "./work-DJxH7cCX.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 { t as logJam } from "./perf-jam-BaH3Lg0m.mjs";
3
+ import { t as logJam } from "./perf-jam-CLkERSHo.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-VgNg4rr8.mjs");
528
- const { ensurePoster } = await import("./poster-BNgafWMK.mjs");
527
+ const { scanAssetRefs } = await import("./build-CWbrb2bl.mjs");
528
+ const { ensurePoster } = await import("./poster-CrsjqhY4.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 {}
@@ -535,7 +535,7 @@ async function shootFrame(opts) {
535
535
  const explicit = opts.scale !== void 0;
536
536
  const relFor = (used) => {
537
537
  const tag = !explicit || scale === 2 && used === 2 ? "" : used === scale ? `@${scale}x` : `@${scale}x-as-${used}x`;
538
- return `design/.local/shots/${slug(frameId)}--${theme}${tag}.png`;
538
+ return `design/.local/shots/${slug(frameId)}--${theme}${tag}${opts.lane === "picture" ? ".picture" : ""}.png`;
539
539
  };
540
540
  const tmp = join(shotsDir, `.${slug(frameId)}--${theme}.${randomBytes(6).toString("hex")}.tmp.png`);
541
541
  const req = {
@@ -546,7 +546,7 @@ async function shootFrame(opts) {
546
546
  fullHeight: plan.fullHeight,
547
547
  scale
548
548
  };
549
- const result = browser ? await captureIn(req, browser) : await capture(req);
549
+ const result = browser ? await captureIn(req, browser) : await capture(req, opts.lane ?? "shot");
550
550
  logJam(root, shotEvent(frameId, scale, result));
551
551
  if (!result.ok) {
552
552
  rmSync(tmp, { force: true });
@@ -814,7 +814,8 @@ function sweepTemps(dir) {
814
814
  * write the same output at the same time. Posters have their own lane - a frame being shot
815
815
  * may ask for its poster mid-render, and on the shot's lane that request would wait for the
816
816
  * very shot that is waiting for it - and so do anchor checks, which have a deadline of their
817
- * own and must not wait out a batch of shots. */
817
+ * own and must not wait out a batch of shots, and a capture's pictures: a capture waits at most 20 s for each,
818
+ * and a bake pass on the shot lane (a frame can take 20 s to settle) would outlast that. */
818
819
  const chains = /* @__PURE__ */ new Map();
819
820
  function withBrowser(lane, fn, o = {}) {
820
821
  const run = async () => {