@marver-design/marver 0.28.0 → 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 (62) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +2 -2
  3. package/dist/{anchor-check-PHUOFj1N.mjs → anchor-check-DhlpKl2K.mjs} +1 -1
  4. package/dist/{build-BsAyLMT1.mjs → build-CWbrb2bl.mjs} +5 -3
  5. package/dist/{capture-DdZ6xgoz.mjs → capture-DEtM4qm5.mjs} +168 -5
  6. package/dist/cli.mjs +10 -10
  7. package/dist/{comments-CrBHPEQl.mjs → comments-XNhMmSSu.mjs} +2 -2
  8. package/dist/{connectors-MR9d-EBP.mjs → connectors-DekQvKt9.mjs} +3 -1
  9. package/dist/{daemon-C5dg2R-V.mjs → daemon-Sc_z8gT6.mjs} +28 -29
  10. package/dist/{dev-D7YS7iT2.mjs → dev-DWBKQhxf.mjs} +19 -14
  11. package/dist/{init-WE5lQkQL.mjs → init-CYlFaRzG.mjs} +1 -1
  12. package/dist/logo-CXY-1yrn.mjs +305 -0
  13. package/dist/{ls-BZ5TAtd5.mjs → ls-NqmePKOf.mjs} +1 -1
  14. package/dist/{marks-Kmdab_5w.mjs → marks-BnNANic9.mjs} +20 -1
  15. package/dist/{marks-Dyn6tmjp.mjs → marks-DBp3h1Mc.mjs} +2 -5
  16. package/dist/{marver-id-gate-D-R0hSt_.mjs → marver-id-gate-vBLb_Icb.mjs} +1 -1
  17. package/dist/{perf-Cn5LiRaY.mjs → perf-Denssrko.mjs} +43 -25
  18. package/dist/{perf-jam-QxD_UnzN.mjs → perf-jam-CLkERSHo.mjs} +8 -1
  19. package/dist/{plugin-C_0yb-Fq.mjs → plugin-DqoZB-D6.mjs} +511 -298
  20. package/dist/{poster-DHi6I1fO.mjs → poster-CrsjqhY4.mjs} +1 -1
  21. package/dist/{profile-jIS6BcAs.mjs → profile-B1FKOM1e.mjs} +1 -1
  22. package/dist/{publish-bakes-r4PEZuPl.mjs → publish-bakes-DW-NDgU2.mjs} +3 -3
  23. package/dist/{queue-c-6aTHEz.mjs → queue-DeSQm24g.mjs} +29 -14
  24. package/dist/{recover-nrLEVLyJ.mjs → recover-GtJ9UDAB.mjs} +2 -2
  25. package/dist/{serve-Dp3nHstu.mjs → serve-DQv3Ti6X.mjs} +8 -4
  26. package/dist/{session-DyVE7cCk.mjs → session-VDJfXEEm.mjs} +1 -1
  27. package/dist/{share-Ce4tP7ji.mjs → share-Bu_kuOKL.mjs} +1 -1
  28. package/dist/{shot-BrRtqaiS.mjs → shot-T04Ixrvq.mjs} +3 -3
  29. package/dist/{slots-CFNnegCc.mjs → slots-Dn4Onb0V.mjs} +101 -3
  30. package/dist/{sync-CQdGARJ9.mjs → sync-CMozOwZ0.mjs} +1 -1
  31. package/docs/boards-and-folders.md +11 -0
  32. package/docs/jam-session.md +12 -3
  33. package/docs/live-jam.md +3 -0
  34. package/docs/performance.md +1 -1
  35. package/docs/publish.md +7 -0
  36. package/package.json +1 -1
  37. package/src/client/shell/Comments.tsx +5 -4
  38. package/src/client/shell/ContextMenu.tsx +5 -4
  39. package/src/client/shell/JamSurface.tsx +80 -9
  40. package/src/client/shell/Play.tsx +16 -4
  41. package/src/client/shell/api.ts +7 -3
  42. package/src/client/shell/app-bridge.ts +11 -3
  43. package/src/client/shell/comments-store.ts +14 -0
  44. package/src/client/shell/goto.ts +4 -3
  45. package/src/client/shell/jam-capture.ts +39 -15
  46. package/src/client/shell/jam-keys.ts +166 -40
  47. package/src/client/shell/jam-lines.ts +10 -1
  48. package/src/client/shell/jam-panel.tsx +8 -6
  49. package/src/client/shell/jam-queue.ts +6 -1
  50. package/src/client/shell/jam-session.tsx +2 -2
  51. package/src/client/shell/jam-state.ts +19 -4
  52. package/src/client/shell/jam-ui.tsx +4 -0
  53. package/src/client/shell/live-picture.ts +134 -0
  54. package/src/client/shell/open-item.ts +83 -0
  55. package/src/client/shell/open-resolve.ts +50 -0
  56. package/src/client/shell/store.ts +6 -2
  57. package/src/client/shell/styles.css +2 -0
  58. package/src/client/stage/main.tsx +30 -8
  59. package/src/shared/app-api.ts +173 -3
  60. package/src/shared/app-perf.ts +4 -2
  61. package/templates/instructions/jam.md +4 -0
  62. package/dist/live-Cgzsicwi.mjs +0 -4
package/CHANGELOG.md CHANGED
@@ -2,6 +2,65 @@
2
2
 
3
3
  Notable changes to `@marver-design/marver`. Format follows [Keep a Changelog](https://keepachangelog.com); versions follow semver.
4
4
 
5
+ ## 0.29.0 - 2026-10-31
6
+
7
+ ### Highlights
8
+
9
+ - **Your agent sees a capture's pictures.** A run was given the ids of a capture's pictures and no way to open them,
10
+ so no picture you took reached your agent. Each request now lists its pictures - the frame each shows and the file
11
+ to open, `design/.local/jam/pictures/<id>.png` - and `design/instructions/jam.md` tells the agent to open the ones it
12
+ needs. In a browser as in the Mac app.
13
+ - **The Mac app tells you when a canvas needs you.** A running canvas now tells Marver's Mac app (0.3) what waits on
14
+ you - a question from Marver, a capture ready to review, a run that failed or stalled - and whether an agent is
15
+ working or a Jam session runs, as it changes. The app counts it on the canvas's tab, hidden or not; with notices on,
16
+ a canvas you are not looking at sends one, and the Dock counts them all. A canvas on 0.28 or earlier shows none of
17
+ this in the app. In a browser nothing changes: the sidebar and the lane say it as before
18
+ ([What needs you](docs/boards-and-folders.md#what-is-new-what-needs-you)).
19
+ - **A notice opens what it names.** Click one in the Mac app and the canvas opens it on its board, where you can see
20
+ it: a question in its thread on the frame (Play is left, and comment pins you hid with `⇧C` come back for it), or,
21
+ when no frame on the board holds it, in a panel with a field to answer; a review in its review; a failed run with
22
+ Retry in view, a stalled one with its three choices (a stalled capture's or Jam session's on its tile in the lane,
23
+ on the board you are on). On a board locked to play, Play stays and the thread opens over it. An item that has moved
24
+ on opens as it is now - a resolved thread read-only - and one that is gone opens its board. Nothing moves while you
25
+ are capturing or have words you have not sent.
26
+ - **A picture in play is what you saw, in the Mac app.** With app 0.3, a capture's pictures in play - `I`, and the ones
27
+ it takes itself as you point and as it ends - are the stage as it was on your screen: a menu you opened, text you
28
+ typed, the comment pins. They are captioned "as you saw it" in the read-back and the review. One is taken once the
29
+ whole stage is in view with nothing over it and has shown its screen for a second (a device preset, a slide fitted
30
+ to the window); otherwise, in a browser, and whenever the app cannot take it, the picture is a fresh render of the
31
+ frame, as before ([Jam sessions](docs/jam-session.md)).
32
+
33
+ ### Added
34
+
35
+ - **A published canvas wears your logo in the browser's tab.** When your repo has a logo (`design/logo.svg`, or the
36
+ first logo file `marver build` finds), it is the only tab icon of the canvas and its sign-in page, so a browser tab -
37
+ and the Mac app's tab for a shared canvas - shows it rather than Marver's mark; without one, Marver's mark as before.
38
+ A canvas published before keeps Marver's mark until you build it again
39
+ ([Publishing](docs/publish.md#name-the-canvas)).
40
+ - `npx marver perf --jam` counts the Mac app's live pictures - kept, failed, rendered instead - and lists a capture
41
+ whose live pictures failed among what went wrong.
42
+
43
+ ### Changed
44
+
45
+ - **Opening a capture's thread shows it where you can see it.** Clicking an "Asks you" tile, or Open thread on a
46
+ capture, opens its thread on the frame: Play is left and comment pins you hid with `⇧C` come back, where it used to
47
+ open unseen under them. With no frame on the board for it, it opens in the capture's panel as before, and on a board
48
+ locked to play, in that panel over Play; a resolved thread opens read-only in the thread panel.
49
+
50
+ ### Fixed
51
+
52
+ - **A canvas in a subfolder of a git repository keeps Jam's hook files out of commits.** In a monorepo, or a
53
+ `canvas/` folder beside your app, `.codex/hooks.json` and `.cursor/hooks.json` showed up in `git status` as new
54
+ files: their line in `.git/info/exclude` named them from the repository's top, not from the canvas's folder. It
55
+ names the folder now.
56
+
57
+ ### Upgrading
58
+
59
+ `npm install @marver-design/marver@latest`, then `npx marver init` to refresh the agent instructions
60
+ (`instructions/jam.md`: a capture's pictures are files to open, and what a live one shows). Restart each canvas; the
61
+ Mac app picks up what a canvas can do as it starts. A published canvas wears your logo once you build and deploy it
62
+ again.
63
+
5
64
  ## 0.28.0 - 2026-10-29
6
65
 
7
66
  ### Highlights
package/README.md CHANGED
@@ -127,7 +127,7 @@ The same glow, driven from the terminal. When your agent takes a request, it cre
127
127
 
128
128
  **Where the canvas runs.** Each canvas on your Mac takes one of twenty fixed ports, localhost:4805 to localhost:4824 - usually the same one each time - and prints its link; `npx marver ls` lists them all. `--port <n>`, or a `port` in `design/config.ts` (other than the old 5199), gives a canvas a port of its own instead. Because an address is reused by whichever canvas starts there next, a tab left open after its canvas stopped says so, and how to bring it back, and keeps your unsaved edits until its own canvas is back, and a local canvas runs no service workers.
129
129
 
130
- **The Mac app.** In Marver's Mac app a canvas tells the app what it holds, so closing its tab, quitting or reloading asks before losing unsaved work, and the app follows its theme and shows its View and Jam items in the menu bar. In a browser none of this runs; browsers ask before a reload or a close loses unsaved work too.
130
+ **The Mac app.** In Marver's Mac app a canvas tells the app what it holds, so closing its tab, quitting or reloading asks before losing unsaved work, and the app follows its theme and shows its View and Jam items in the menu bar. Since 0.29 (app 0.3) it also tells the app what needs you - a question, a capture to review, a run that failed or stalled - which the app counts on the canvas's tab and, with notices on, sends as a notice that opens it; and a capture's pictures in play are your screen as you saw it ([what needs you](docs/boards-and-folders.md#what-is-new-what-needs-you)). In a browser none of this runs; browsers ask before a reload or a close loses unsaved work too.
131
131
 
132
132
  ## Shortcuts
133
133
 
@@ -152,7 +152,7 @@ The same glow, driven from the terminal. When your agent takes a request, it cre
152
152
 
153
153
  - **Next.js**: supported with one caveat - frames render in Vite, outside Next. `next/font` CSS variables are undefined inside frames (give font tokens a fallback chain), `next/image`/`next/link` should be plain `img`/`data-goto` in frames, and Server Components cannot run there. `init` writes the specifics into `design/AGENTS.md` when it detects Next.
154
154
  - **Upgrade**: `npm i -D @marver-design/marver@latest && npx marver init`. The canvas tells you when a new version is out (one anonymous registry check per day, cached in `design/.local/`; `MARVER_NO_UPDATE_CHECK=1` disables), and warns when your `design/instructions/` predate the installed package. Re-running init refreshes the managed files (AGENTS.md, `design/instructions/`) - your edits to them are detected and preserved; when both you and a release changed a file, the fresh version is staged at `design/.local/latest/` for you (or your agent) to merge. Everything else in `design/` is yours and never touched.
155
- - **Name your canvas**: `share: { name: "Your App" }` in `design/config.ts` titles the gate, labels the brand pill, names the canvas in `marver ls`, and tags every powered-by link. Unset, the gate falls back to your `package.json` name and the canvas shell to the directory name - `app` inside most containers. Its logo is the first of `share.logo`, `design/logo.svg|png`, `public/logo.svg|png` and `public/favicon.svg|png|ico` that is a real file in the repo (never a symlink) of at most 256 KB, an SVG, PNG or ICO by its bytes; the gate page and the Mac app's tab wear it.
155
+ - **Name your canvas**: `share: { name: "Your App" }` in `design/config.ts` titles the gate, labels the brand pill, names the canvas in `marver ls`, and tags every powered-by link. Unset, the gate falls back to your `package.json` name and the canvas shell to the directory name - `app` inside most containers. Its logo is the first of `share.logo`, `design/logo.svg|png`, `public/logo.svg|png` and `public/favicon.svg|png|ico` that is a real file in the repo (never a symlink) of at most 256 KB, an SVG, PNG or ICO by its bytes; the gate page, a published canvas's browser tab (built with 0.29 or later) and the Mac app's tab wear it.
156
156
  - **Uninstall**: delete `design/`, remove the dependency. (If `init` patched your tsconfig `exclude`, revert that one line.)
157
157
 
158
158
  ## Status
@@ -1,4 +1,4 @@
1
- import { a as frameUrl, d as withBrowser, n as MOUNTED, o as manifestFrame, s as planShot } from "./shot-BrRtqaiS.mjs";
1
+ import { a as frameUrl, d as withBrowser, n as MOUNTED, o as manifestFrame, s as planShot } from "./shot-T04Ixrvq.mjs";
2
2
  //#region src/server/anchor-check.ts
3
3
  /**
4
4
  * The anchor check (spec 26, Part 6): `comments new --on|--at`, `comments move` and a Live Jam re-pin
@@ -5,8 +5,9 @@ import { g as PUBLISHABLE, s as scanFrames, v as publishableStatus } from "./man
5
5
  import { a as readLog, o as shareable, r as legacyExposure, t as appendEvents } from "./comments-0BSbb04K.mjs";
6
6
  import { t as detectHost } from "./detect-C0wpaePX.mjs";
7
7
  import { n as loadConfig } from "./config-BezZTiov.mjs";
8
- import { i as publishLogo, n as tailwind3Css, r as tailwind4Plugin, t as marverPlugin } from "./plugin-C_0yb-Fq.mjs";
8
+ import { n as tailwind3Css, r as tailwind4Plugin, t as marverPlugin } from "./plugin-DqoZB-D6.mjs";
9
9
  import { i as measuringFrames, n as autoWidthOf, o as readSizes, r as keptSizes } from "./sizes-wjXDev3b.mjs";
10
+ import { i as publishLogo, n as logoIcons } from "./logo-CXY-1yrn.mjs";
10
11
  import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
11
12
  import { basename, dirname, join, sep } from "node:path";
12
13
  import { fileURLToPath } from "node:url";
@@ -787,7 +788,7 @@ async function buildSite(root, boardsFlag, allBoardsFlag, embedSeeds, textures =
787
788
  const realAssets = existsSync(assetsDir) ? realpathSync(assetsDir) : null;
788
789
  for (const r of refs) {
789
790
  if (!isLocalAssetRef(r) || !r.endsWith(".poster.png") || existsSync(join(assetsDir, r))) continue;
790
- const { ensurePoster } = await import("./poster-DHi6I1fO.mjs");
791
+ const { ensurePoster } = await import("./poster-CrsjqhY4.mjs");
791
792
  const g = await ensurePoster(assetsDir, r.slice(0, -11));
792
793
  if (!g.ok) throw new Error(`design/assets/${r}: ${g.error}`);
793
794
  console.log(` poster: rendered design/assets/${r} (${g.width}×${g.height})`);
@@ -836,6 +837,7 @@ async function buildSite(root, boardsFlag, allBoardsFlag, embedSeeds, textures =
836
837
  } catch {}
837
838
  if (config.share.name) name = config.share.name;
838
839
  const logo = publishLogo(root, config.share.logo, outDir, (m) => console.warn(` ${m}`));
840
+ if (logo) writeFileSync(join(outDir, "index.html"), logoIcons(readFileSync(join(outDir, "index.html"), "utf8"), logo));
839
841
  writeFileSync(join(outDir, "meta.json"), JSON.stringify({
840
842
  name,
841
843
  branding: config.share.branding,
@@ -849,7 +851,7 @@ async function buildSite(root, boardsFlag, allBoardsFlag, embedSeeds, textures =
849
851
  }));
850
852
  let textureLine = " textures: skipped (--no-textures)";
851
853
  if (textures && bakeGen) {
852
- const { bakePublished } = await import("./publish-bakes-r4PEZuPl.mjs");
854
+ const { bakePublished } = await import("./publish-bakes-DW-NDgU2.mjs");
853
855
  const pubFrameFile = new Map(pubFrames.map((f) => [f.id, f]));
854
856
  const r = await bakePublished({
855
857
  root,
@@ -1,8 +1,11 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { m as BOUNDS } from "./slots-Dn4Onb0V.mjs";
2
3
  import { n as readTarget } from "./anchor-5H1vnoLu.mjs";
3
4
  import { closeSync, copyFileSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync, writeSync } from "node:fs";
4
5
  import { join, relative, resolve, sep } from "node:path";
5
6
  import { createHash, randomBytes } from "node:crypto";
7
+ import { promisify } from "node:util";
8
+ import { crc32, inflate } from "node:zlib";
6
9
  //#region src/server/jam/packet.ts
7
10
  const CAP = 4096;
8
11
  /** Strip ANSI escapes and control chars (keep \n and \t), and cap length. */
@@ -66,6 +69,8 @@ function goalText(packet, subagents = true, runner) {
66
69
  "A frame they pointed at can be WHERE they want something new (\"a new frame to the right of this one\"), not",
67
70
  "what to change: then leave that frame as it is and make the new one - Marver moves the capture's thread onto it.",
68
71
  "`added` are notes they wrote after the capture ended, in its read-back: read them after the timeline.",
72
+ "Its pictures are files: the member's `pictures` names each one's `file` - open the ones you need. A `live` one is",
73
+ "the owner's screen in play as they saw it (an open menu, text they typed); the others are fresh renders of the frame.",
69
74
  ""
70
75
  ] : [],
71
76
  ...packet.members.some((m) => m.brief.wrapup) ? [
@@ -368,14 +373,18 @@ var capture_exports = /* @__PURE__ */ __exportAll({
368
373
  MAX_PICTURES: () => 12,
369
374
  PICTURE_ID: () => PICTURE_ID,
370
375
  addPicture: () => addPicture,
376
+ addPictureBytes: () => addPictureBytes,
371
377
  captureFrames: () => captureFrames,
372
378
  captureWords: () => captureWords,
379
+ checkPng: () => checkPng,
373
380
  checkRecord: () => checkRecord,
374
381
  continues: () => continues,
375
382
  factsOf: () => factsOf,
376
383
  firstPoint: () => firstPoint,
377
384
  hashOf: () => hashOf,
385
+ isPng: () => isPng,
378
386
  madeOf: () => madeOf,
387
+ packetPictures: () => packetPictures,
379
388
  picturePath: () => picturePath,
380
389
  readCapture: () => readCapture,
381
390
  requestWords: () => requestWords,
@@ -537,7 +546,8 @@ function stepOf(v) {
537
546
  "key",
538
547
  "pick",
539
548
  "end"
540
- ].includes(o.why) ? o.why : "key"
549
+ ].includes(o.why) ? o.why : "key",
550
+ ...o.source === "live" ? { source: "live" } : {}
541
551
  } : null;
542
552
  case "missing": return {
543
553
  ...base,
@@ -773,13 +783,47 @@ function picturePath(root, id) {
773
783
  return null;
774
784
  }
775
785
  }
776
- /** Pictures whose capture never sealed are removed after an hour. */
786
+ /** Keep a live picture's bytes (A4.6 #37) - already checked whole (`checkPng`) - as a jam picture: the same store and
787
+ * index as a render, the file 600, `source: 'live'` on its entry. */
788
+ function addPictureBytes(root, png, entry) {
789
+ const id = `p-${randomBytes(8).toString("hex")}`;
790
+ mkdirSync(picturesDir(root), { recursive: true });
791
+ const file = join("pictures", `${id}.png`);
792
+ writeFileSync(join(jamDir(root), file), png, {
793
+ mode: 384,
794
+ flag: "wx"
795
+ });
796
+ const ix = readIndex(root);
797
+ ix[id] = {
798
+ file,
799
+ when: Date.now(),
800
+ ...entry
801
+ };
802
+ writeIndex(root, ix);
803
+ return id;
804
+ }
805
+ /** Pictures no record keeps are removed after an hour: one whose capture never sealed, and (A4.6 #36) one its sealed
806
+ * capture's record does not list - a live upload or a render that landed after its shot had settled without it. One
807
+ * found listed is marked, so a record is read for it once; a record that cannot be read keeps everything. */
777
808
  function sweepPictures(root, now = Date.now()) {
778
809
  const ix = readIndex(root);
810
+ const lists = /* @__PURE__ */ new Map();
811
+ const listOf = (capture) => {
812
+ if (!lists.has(capture)) lists.set(capture, readCapture(root, capture)?.record.pictures ?? null);
813
+ return lists.get(capture);
814
+ };
779
815
  let changed = false;
780
816
  for (const [id, e] of Object.entries(ix)) {
781
- if (!e.capture || e.batch || now - e.when < 36e5) continue;
782
- if (existsSync(join(capturesDir(root), `${e.capture}.json`))) continue;
817
+ if (!e.capture || e.batch || e.listed || now - e.when < 36e5) continue;
818
+ if (existsSync(join(capturesDir(root), `${e.capture}.json`))) {
819
+ const listed = listOf(e.capture);
820
+ if (!listed) continue;
821
+ if (listed.includes(id)) {
822
+ e.listed = true;
823
+ changed = true;
824
+ continue;
825
+ }
826
+ }
783
827
  try {
784
828
  rmSync(join(jamDir(root), e.file), { force: true });
785
829
  } catch {}
@@ -788,5 +832,124 @@ function sweepPictures(root, now = Date.now()) {
788
832
  }
789
833
  if (changed) writeIndex(root, ix);
790
834
  }
835
+ /** The pictures a packet member's brief names - its capture's, the capture it reviewed, a session record's captures' -
836
+ * each once, as files the agent can open (A4.6 #38): `file` relative to the repo, resolved through `picturePath`, so an
837
+ * id that no longer resolves is left out; `live` for the owner's screen in play. */
838
+ function packetPictures(root, brief) {
839
+ const ids = [
840
+ ...brief.capture?.record.pictures ?? [],
841
+ ...brief.capture?.reviewed?.capture?.record.pictures ?? [],
842
+ ...(brief.wrapup?.content.captures ?? []).flatMap((c) => c.record.pictures ?? [])
843
+ ];
844
+ const out = [];
845
+ for (const id of new Set(ids)) {
846
+ const p = picturePath(root, id);
847
+ if (!p) continue;
848
+ out.push({
849
+ id,
850
+ frame: p.entry.frame,
851
+ file: [
852
+ "design",
853
+ ".local",
854
+ "jam",
855
+ ...p.entry.file.split(/[\\/]/)
856
+ ].join("/"),
857
+ ...p.entry.source === "live" ? { live: true } : {}
858
+ });
859
+ }
860
+ return out;
861
+ }
862
+ const PNG_SIGNATURE = [
863
+ 137,
864
+ 80,
865
+ 78,
866
+ 71,
867
+ 13,
868
+ 10,
869
+ 26,
870
+ 10
871
+ ];
872
+ /** Does it open with the PNG signature? The route's 415, before the whole check. */
873
+ const isPng = (b) => b.length >= 8 && PNG_SIGNATURE.every((x, i) => b[i] === x);
874
+ /** what Chromium's `toPNG()` writes: 8-bit RGBA (6), or RGB (2) for an opaque image - and its bytes a pixel */
875
+ const CHANNELS = {
876
+ 6: 4,
877
+ 2: 3
878
+ };
879
+ const inflateAsync = promisify(inflate);
880
+ let checking = Promise.resolve();
881
+ /**
882
+ * A PNG checked whole, with no decoder added: its size, or why not. Every chunk walked from the signature, each length
883
+ * inside the body and each CRC right; `IHDR` first, 13 bytes, 1-4096 a side, 8-bit RGBA or RGB, never interlaced; the
884
+ * `IDAT` chunks consecutive, `IEND` last and empty, nothing after it; any other critical chunk refused, ancillary ones
885
+ * skipped. The joined `IDAT` inflated to exactly the raw size (a filter byte a row, each 0-4), never past it. Undoing
886
+ * the filters cannot fail on such data, so it is not done. One check at a time in the server, so at most one raw image
887
+ * is held.
888
+ */
889
+ function checkPng(bytes) {
890
+ const run = checking.then(() => checkPngNow(bytes));
891
+ checking = run.catch(() => {});
892
+ return run;
893
+ }
894
+ async function checkPngNow(bytes) {
895
+ if (!isPng(bytes)) return "not a PNG";
896
+ const b = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
897
+ let head = null;
898
+ const idat = [];
899
+ let idatEnded = false, ended = false;
900
+ for (let off = 8; off < b.length;) {
901
+ if (ended) return "data after IEND";
902
+ if (b.length - off < 12) return "a chunk cut short";
903
+ const len = b.readUInt32BE(off);
904
+ const type = b.toString("latin1", off + 4, off + 8);
905
+ if (!/^[A-Za-z]{4}$/.test(type)) return "a chunk with no name";
906
+ if (len > b.length - off - 12) return `${type} cut short`;
907
+ const data = b.subarray(off + 8, off + 8 + len);
908
+ if (crc32(b.subarray(off + 4, off + 8 + len)) !== b.readUInt32BE(off + 8 + len)) return `${type}'s CRC is wrong`;
909
+ off += 12 + len;
910
+ if (!head) {
911
+ if (type !== "IHDR" || len !== 13) return "IHDR is not first";
912
+ const width = data.readUInt32BE(0), height = data.readUInt32BE(4);
913
+ if (width < 1 || height < 1 || width > BOUNDS.captureLong || height > BOUNDS.captureLong) return `${width}x${height} is past ${BOUNDS.captureLong}`;
914
+ if (data[8] !== 8 || !CHANNELS[data[9]]) return `bit depth ${data[8]}, colour type ${data[9]}: not 8-bit RGBA or RGB`;
915
+ if (data[10] || data[11] || data[12]) return "compression, filter or interlace other than 0";
916
+ head = {
917
+ width,
918
+ height,
919
+ channels: CHANNELS[data[9]]
920
+ };
921
+ continue;
922
+ }
923
+ if (type === "IDAT") {
924
+ if (idatEnded) return "IDAT chunks apart";
925
+ idat.push(data);
926
+ continue;
927
+ }
928
+ if (idat.length) idatEnded = true;
929
+ if (type === "IEND") {
930
+ if (len) return "IEND not empty";
931
+ ended = true;
932
+ continue;
933
+ }
934
+ if (type.charCodeAt(0) < 97) return `a critical ${type}`;
935
+ }
936
+ if (!head) return "no IHDR";
937
+ if (!ended) return "no IEND";
938
+ if (!idat.length) return "no IDAT";
939
+ const row = 1 + head.width * head.channels;
940
+ const size = head.height * row;
941
+ let raw;
942
+ try {
943
+ raw = await inflateAsync(Buffer.concat(idat), { maxOutputLength: size });
944
+ } catch {
945
+ return "IDAT does not inflate to its size";
946
+ }
947
+ if (raw.length !== size) return "IDAT inflates short";
948
+ for (let y = 0; y < head.height; y++) if (raw[y * row] > 4) return `row ${y}'s filter is ${raw[y * row]}`;
949
+ return {
950
+ width: head.width,
951
+ height: head.height
952
+ };
953
+ }
791
954
  //#endregion
792
- export { sanitize as C, refusedAsk as S, threadId as T, buildPacket as _, checkRecord as a, parseAgentText as b, firstPoint as c, picturePath as d, readCapture as f, wordsUntil as g, wordsSince as h, capture_exports as i, hashOf as l, storeCapture as m, captureFrames as n, continues as o, requestWords as p, captureWords as r, factsOf as s, CAPTURE_ID as t, madeOf as u, goalText as v, sharedWhy as w, parseMembers as x, packetPath as y };
955
+ export { refusedAsk as C, threadId as E, parseMembers as S, sharedWhy as T, wordsUntil as _, checkRecord as a, packetPath as b, firstPoint as c, packetPictures as d, picturePath as f, wordsSince as g, storeCapture as h, capture_exports as i, hashOf as l, requestWords as m, captureFrames as n, continues as o, readCapture as p, captureWords as r, factsOf as s, CAPTURE_ID as t, madeOf as u, buildPacket as v, sanitize as w, parseAgentText as x, goalText as y };
package/dist/cli.mjs CHANGED
@@ -82,7 +82,7 @@ cli.command("init", "Scaffold design/ in this repo").option("--mode <mode>", "st
82
82
  console.error(`[${NAME}] --kind ${opts.kind}: use product or knowledge`);
83
83
  process.exit(1);
84
84
  }
85
- const { init } = await import("./init-WE5lQkQL.mjs");
85
+ const { init } = await import("./init-CYlFaRzG.mjs");
86
86
  init(resolve$1(opts.root), {
87
87
  mode: opts.mode === "embedded" ? "embedded" : "studio",
88
88
  demo: opts.demo !== false,
@@ -90,7 +90,7 @@ cli.command("init", "Scaffold design/ in this repo").option("--mode <mode>", "st
90
90
  });
91
91
  });
92
92
  for (const [name, desc] of [["dev", "Start the local canvas (everything on: hot reload, comments, Live Jam)"], ["canvas", "Start the local canvas - same as dev"]]) cli.command(name, desc).option("--root <dir>", "Host repo root", { default: "." }).option("--port <port>", "A port of its own (default: a free slot, localhost:4805-4824 - usually the same one next time; a port in that range takes exactly that slot)").option("--recover [n]", "Run on an address this canvas had before, where an unsent Jam capture waits: alone it lists them; with a number it starts on that one; --recover --port <p>: the port 0.26 used").action(async (opts) => {
93
- const { dev, DevStartError, DevLockError } = await import("./dev-D7YS7iT2.mjs");
93
+ const { dev, DevStartError, DevLockError } = await import("./dev-DWBKQhxf.mjs");
94
94
  let port;
95
95
  if (opts.port !== void 0) {
96
96
  const n = Number(opts.port);
@@ -102,7 +102,7 @@ for (const [name, desc] of [["dev", "Start the local canvas (everything on: hot
102
102
  process.exit(1);
103
103
  };
104
104
  try {
105
- if (opts.recover !== void 0 && opts.recover !== false) await (await import("./recover-nrLEVLyJ.mjs")).recoverCommand(resolve$1(opts.root), opts.recover, port, { onFail });
105
+ if (opts.recover !== void 0 && opts.recover !== false) await (await import("./recover-GtJ9UDAB.mjs")).recoverCommand(resolve$1(opts.root), opts.recover, port, { onFail });
106
106
  else await dev(resolve$1(opts.root), {
107
107
  port,
108
108
  onFail
@@ -115,10 +115,10 @@ for (const [name, desc] of [["dev", "Start the local canvas (everything on: hot
115
115
  }
116
116
  });
117
117
  cli.command("ls", "The canvases running on this Mac: slot, link, name, version, state, uptime, folder (no repo needed)").option("--json", "Machine-readable output (never a canvas's key)").action(async (opts) => {
118
- (await import("./ls-BZ5TAtd5.mjs")).lsCommand({ json: opts.json === true });
118
+ (await import("./ls-NqmePKOf.mjs")).lsCommand({ json: opts.json === true });
119
119
  });
120
120
  cli.command("build", "Static export → design/.dist (what ships comes from design/publish.json - publishing is default-closed)").option("--boards <names>", "Publish only these boards (comma-separated); overrides the publish policy").option("--all-boards", "Publish every board - the loud override for the default-closed policy").option("--embed-seeds", "Copy comment history INTO the web root (identifying - every event carries its author's email)").option("--no-textures", "Skip compiling the glass textures the published frames rest under (needs Chrome; a CI without one skips on its own)").option("--root <dir>", "Host repo root", { default: "." }).action(async (opts) => {
121
- const { buildSite } = await import("./build-BsAyLMT1.mjs");
121
+ const { buildSite } = await import("./build-CWbrb2bl.mjs");
122
122
  try {
123
123
  const boards = opts.boards === void 0 ? void 0 : typeof opts.boards === "string" ? opts.boards : "";
124
124
  await buildSite(resolve$1(opts.root), boards, opts.allBoards === true, opts.embedSeeds === true, opts.textures !== false && !process.env.MARVER_NO_TEXTURES);
@@ -128,7 +128,7 @@ cli.command("build", "Static export → design/.dist (what ships comes from desi
128
128
  }
129
129
  });
130
130
  cli.command("serve", "Serve design/.dist (set MARVER_PASSWORD to gate it)").option("--root <dir>", "Host repo root", { default: "." }).option("--port <port>", "Port (default $PORT or 4199)").action(async (opts) => {
131
- const { serve } = await import("./serve-Dp3nHstu.mjs");
131
+ const { serve } = await import("./serve-DQv3Ti6X.mjs");
132
132
  let port;
133
133
  if (opts.port !== void 0) {
134
134
  const n = Number(opts.port);
@@ -137,7 +137,7 @@ cli.command("serve", "Serve design/.dist (set MARVER_PASSWORD to gate it)").opti
137
137
  serve(resolve$1(opts.root), port);
138
138
  });
139
139
  cli.command("comments <action> [value]", "Comment collaboration: connect <url> · sync · list · new <scene/frame> · reply <thread> · move <thread> · resolve <thread> · invite <email> · revoke <email>").option("--root <dir>", "Host repo root", { default: "." }).option("--token <token>", "connect: the canvas's MARVER_CLI_TOKEN (default $MARVER_CLI_TOKEN) - the identity-mode path").option("--invite <token>", "connect: claim this invite instead of signing in").option("--canvas-password <password>", "connect: the canvas gate password (default $MARVER_PASSWORD or prompt)").option("--email <email>", "connect: account email (skips the prompt)").option("--password <password>", "connect: account password (skips the prompt - mind your shell history)").option("--name <name>", "connect --invite: display name for the new account").option("--open", "list: only unresolved threads").option("--json", "list: machine-readable output").option("--board <board>", "list: scope to one board · new: the board to pin on (default: the one its link opens)").option("--body <text>", "new / reply: the text").option("--on <text>", "new / move: pin on the element showing these words").option("--at <selector>", "new / move: pin on the element this data-testid or CSS selector names (an element without words, like an icon)").option("--nth <n>", "new / move: which of several matching elements (1 = the first)").option("--viewport <name>", "new / move: check the frame at this viewport (default: its own)").option("--theme <name>", "new / move: check the frame in this theme (default: light)").option("--thread <id>", "new: add the note to this open thread instead of pinning a new one").option("--fyi", "new: the note asks nothing (default: it asks - it comes first for the human)").option("--ask", "reply: the reply asks the human something").option("--addressed-in <frame>", "resolve: the variant frame that answered the feedback").action(async (action, value, opts) => {
140
- const { commentsCommand } = await import("./comments-CrBHPEQl.mjs");
140
+ const { commentsCommand } = await import("./comments-XNhMmSSu.mjs");
141
141
  try {
142
142
  await commentsCommand(resolve$1(opts.root), action, value, opts);
143
143
  } catch (err) {
@@ -146,7 +146,7 @@ cli.command("comments <action> [value]", "Comment collaboration: connect <url>
146
146
  }
147
147
  });
148
148
  cli.command("share <action> [value]", "Sharing roster (owner): add <who> · remove <who> · block/unblock <email> · general <mode> · list · requests · explain <who> · who").option("--root <dir>", "Host repo root", { default: "." }).option("--role <role>", "add / requests --approve: view (default) or comment").option("--expires <iso>", "add: expiry timestamp, e.g. 2026-12-31T00:00:00Z").option("--approve <email>", "requests: approve this pending request (canvas-wide in v1)").option("--decline <email>", "requests: decline this pending request (silent to the asker)").option("--json", "list: machine-readable output").action(async (action, value, opts) => {
149
- const { shareCommand } = await import("./share-Ce4tP7ji.mjs");
149
+ const { shareCommand } = await import("./share-Bu_kuOKL.mjs");
150
150
  try {
151
151
  await shareCommand(resolve$1(opts.root), action, value, opts);
152
152
  } catch (err) {
@@ -264,7 +264,7 @@ cli.command("context <action>", "The project's context/ (spec 19) · init: creat
264
264
  }
265
265
  });
266
266
  cli.command("marks", "What the human has not reviewed: frames waiting on them (the ones that ask first), their answers nothing has acted on yet, and frames new since they looked").option("--root <dir>", "Host repo root", { default: "." }).option("--json", "Machine-readable output").option("--all", "Also list the answers from before 0.26 that may already be handled").action(async (opts) => {
267
- const { marksCommand } = await import("./marks-Dyn6tmjp.mjs");
267
+ const { marksCommand } = await import("./marks-DBp3h1Mc.mjs");
268
268
  marksCommand(resolve$1(opts.root), opts);
269
269
  });
270
270
  cli.command("perf [action] [board]", "The reload log: what each edit reloaded, page-wide reloads, the slowest frames to settle, one line per board load; --loads: what each board load did; --jam: Jam's timings; `perf run <board>`: a headless run of the board, read-only (needs `dev` running); --runs: those runs compared; --crashes, --flashes, --machine: the Mac app's records").option("--root <dir>", "Host repo root", { default: "." }).option("--minutes <n>", "How far back to read (default 60; 24 h with --jam)").option("--loads", "Board loads, from the page, each board by its title: time to the visible frames ready and all ready (each frame's first render), still from the last move and settled (a second still after it) - or why it was cut, and how many frames were ready by then - how many moves and their causes, when the first frame started, the slowest frames to settle (their last height) and how long each waited for its turn to start, errors (design/.local/perf/page.jsonl)").option("--jam", "Jam's timings: captures, pictures, words, naming, runs, shots - numbers only (design/.local/perf/jam.jsonl)").option("--runs", "The headless runs (`perf run`), compared only inside a cohort (script, board, Chrome, flags, machine, power, --slow, bakes): the latest against the one before with the same inputs, and against the last with other inputs; overlapped and invalid runs listed apart (design/.local/perf/runs.jsonl)").option("--against <run>", "With --runs: the latest run of that run's cohort against it, whatever their inputs (you changed something on purpose)").option("--crashes", "The Mac app's crashes and hangs of this repo's canvases, each joined to its board load by page (what had settled, the last gesture), the minute before it, and the GPU and utility processes' ends by time (~/.marver/perf/app.jsonl, app-dev.jsonl)").option("--flashes", "The flashes marked in the Mac app (⌃⌥F) on this repo's canvases: the board, the gesture the mark fell in (or the one ending within 2 s of it), the GPU process's events, pressure at the mark, the GPU figures and the picture's path; the white-out detector's candidates apart, automatic and not verified").option("--machine", "The machine profiles the Mac app and headless runs wrote (~/.marver/perf/machine), by host, which is current, and how many records and runs name each").option("--all", "With --flashes: also the marks made on other canvases or on Home").option("--days <n>", "How far back --runs, --crashes, --flashes and --machine read (default 14)").option("--slow", "With `run`: the CPU throttled 4x (a stand-in for a slower Mac's CPU, not its GPU or memory)").option("--repeat <n>", "With `run`: how many runs, one after another (1-5, default 1)").option("--json", "Machine-readable output").action(async (action, board, opts) => {
@@ -272,7 +272,7 @@ cli.command("perf [action] [board]", "The reload log: what each edit reloaded, p
272
272
  console.error(`[${NAME}] unknown action "${action}" - the one action is run: ${NAME} perf run <board>`);
273
273
  process.exit(1);
274
274
  }
275
- const { perfCommand, perfRunCommand } = await import("./perf-Cn5LiRaY.mjs");
275
+ const { perfCommand, perfRunCommand } = await import("./perf-Denssrko.mjs");
276
276
  const typed = (v) => typeof v === "number" ? process.argv.find((t) => !t.startsWith("-") && Number(t) === v) ?? String(v) : v === void 0 ? void 0 : String(v);
277
277
  if (action !== "run") return perfCommand(resolve$1(opts.root), {
278
278
  ...opts,
@@ -2,8 +2,8 @@ import { r as NAME } from "./cli.mjs";
2
2
  import { i as readDevInfo } from "./work-DJxH7cCX.mjs";
3
3
  import { r as replay } from "./events-CLH4ijKP.mjs";
4
4
  import { a as readLog, i as listBoards, t as appendEvents } from "./comments-0BSbb04K.mjs";
5
- import { a as syncOnce, i as loadCollab, n as connectClaim, r as connectToken, t as connect } from "./sync-CQdGARJ9.mjs";
6
- import { n as localProfile } from "./profile-jIS6BcAs.mjs";
5
+ import { a as syncOnce, i as loadCollab, n as connectClaim, r as connectToken, t as connect } from "./sync-CMozOwZ0.mjs";
6
+ import { n as localProfile } from "./profile-B1FKOM1e.mjs";
7
7
  import { a as runningAgent } from "./agent-BsieQGTD.mjs";
8
8
  import { n as readTarget, r as uncheckedAnchor } from "./anchor-5H1vnoLu.mjs";
9
9
  import { join } from "node:path";
@@ -151,7 +151,9 @@ function exclude(root, rel) {
151
151
  if (r.status !== 0) return;
152
152
  const p = r.stdout.trim();
153
153
  const file = isAbsolute(p) ? p : join(root, p);
154
- const line = `/${rel.split("\\").join("/")}`;
154
+ const prefix = git(root, ["rev-parse", "--show-prefix"]);
155
+ if (prefix.status !== 0) return;
156
+ const line = `/${prefix.stdout.trim()}${rel.split("\\").join("/")}`;
155
157
  let text = "";
156
158
  try {
157
159
  text = readFileSync(file, "utf8");
@@ -2,20 +2,20 @@ import { l as toFrameId } from "./manifest-DPZ3WNg_.mjs";
2
2
  import { a as workActivity } from "./work-DJxH7cCX.mjs";
3
3
  import { r as replay } from "./events-CLH4ijKP.mjs";
4
4
  import { a as readLog, t as appendEvents } from "./comments-0BSbb04K.mjs";
5
- import { n as localProfile } from "./profile-jIS6BcAs.mjs";
5
+ import { n as localProfile } from "./profile-B1FKOM1e.mjs";
6
6
  import { i as onPath, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
7
7
  import { r as uncheckedAnchor } from "./anchor-5H1vnoLu.mjs";
8
8
  import { S as writeOffers, _ as readPrefs, f as patchConn, g as readOffers, h as readConn, l as listConns, m as pingLine, n as closeConn, o as eligible, p as pidAlive, r as connDir, t as alive } from "./conn-BMiHS42T.mjs";
9
- import { hookBin } from "./connectors-MR9d-EBP.mjs";
9
+ import { hookBin } from "./connectors-DekQvKt9.mjs";
10
10
  import { answer, reqDir, sweep, takeRequests, verify } from "./transport-C5FnY9ni.mjs";
11
11
  import { i as record, t as has } from "./ledger-D54iROST.mjs";
12
- import { C as sanitize, S as refusedAsk, _ as buildPacket, a as checkRecord, b as parseAgentText, c as firstPoint, d as picturePath, f as readCapture, g as wordsUntil, h as wordsSince, m as storeCapture, n as captureFrames, o as continues, p as requestWords, r as captureWords, t as CAPTURE_ID, u as madeOf, v as goalText, w as sharedWhy, x as parseMembers, y as packetPath } from "./capture-DdZ6xgoz.mjs";
13
- import { a as recordFile, c as storeWrapup, i as readWrapup, n as buildWrapup, o as recordPathProblem, r as moreOf, t as SESSION_ID } from "./session-DyVE7cCk.mjs";
14
- import { act, addCapture, addWrapup, answeredSince, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, form, joinAlone, looksGood, moreWrapup, n as releaseLock, ownerOnly, payloadKey, pending, prune, redelivering, requeue, runsAlone, sameComment, settle, startSession, stillOwned, t as acquireLock, textOf, undelivered, wrapupIntact, wrapupOf } from "./queue-c-6aTHEz.mjs";
15
- import { t as logJam } from "./perf-jam-QxD_UnzN.mjs";
12
+ import { C as refusedAsk, S as parseMembers, T as sharedWhy, _ as wordsUntil, a as checkRecord, b as packetPath, c as firstPoint, d as packetPictures, f as picturePath, g as wordsSince, h as storeCapture, m as requestWords, n as captureFrames, o as continues, p as readCapture, r as captureWords, t as CAPTURE_ID, u as madeOf, v as buildPacket, w as sanitize, x as parseAgentText, y as goalText } from "./capture-DEtM4qm5.mjs";
13
+ import { a as recordFile, c as storeWrapup, i as readWrapup, n as buildWrapup, o as recordPathProblem, r as moreOf, t as SESSION_ID } from "./session-VDJfXEEm.mjs";
14
+ import { act, addCapture, addWrapup, answeredSince, beginStep, captureComment, captureIntact, conflictStep, createQueue, ctxFor, endSession, endStep, fail, failCard, form, joinAlone, looksGood, moreWrapup, n as releaseLock, ownerOnly, payloadKey, pending, prune, redelivering, requeue, runsAlone, sameComment, settle, startSession, stillOwned, t as acquireLock, textOf, undelivered, wrapupIntact, wrapupOf } from "./queue-DeSQm24g.mjs";
15
+ import { t as logJam } from "./perf-jam-CLkERSHo.mjs";
16
+ import { i as jamLive } from "./plugin-DqoZB-D6.mjs";
16
17
  import { t as PROTECTED_GLOBS } from "./permit-DDa6wqOs.mjs";
17
18
  import { jamReservations, restoreHolds } from "./reserve-BURNQ2Y3.mjs";
18
- import { jamLive } from "./live-Cgzsicwi.mjs";
19
19
  import { closeSync, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
20
20
  import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
21
21
  import { fileURLToPath } from "node:url";
@@ -1095,6 +1095,14 @@ function newestAny(root, can, env = process.env) {
1095
1095
  return all.sort((a, b) => t(b) - t(a))[0] ?? null;
1096
1096
  }
1097
1097
  const forkable = (s) => !!s && existsSync(s.file) && s.bytes <= 12582912;
1098
+ /** A claimed run with no word from its session in this long is stalled - the owner decides. */
1099
+ const STALL_MS = 9e5;
1100
+ /** STALL_MS, or the suite's MV_JAM_STALL_MS for a dev server a test starts - read in the suite's build only, with
1101
+ * MARVER_SLOT_BASE set (test-build.ts; as perf-run.ts's MV_PERF_RUN_T): a real stall in seconds, so a browser case
1102
+ * drives one through this daemon and the page's own actions. */
1103
+ const stallMs = () => {
1104
+ return STALL_MS;
1105
+ };
1098
1106
  /** How long a request's answer is kept for the same request sent again. */
1099
1107
  const RECEIPT_MS = 6e5;
1100
1108
  /** The longest final message a session hands back (its replies, not its work). */
@@ -1903,11 +1911,12 @@ function createRuns(d) {
1903
1911
  if (writerGone(claim)) await finishStop(b.batchId);
1904
1912
  continue;
1905
1913
  }
1906
- const quiet = writerGone(claim) || now - claim.progress > 9e5;
1914
+ const quiet = writerGone(claim) || now - claim.progress > stallMs();
1907
1915
  if (!claim.stalled && quiet) {
1908
1916
  await q.lock(() => {
1909
1917
  const x = byId(b.batchId)?.claim;
1910
1918
  if (x && x.result === void 0 && !x.stopping) {
1919
+ if (!x.stalled) x.stalls = (x.stalls ?? 0) + 1;
1911
1920
  x.stalled = true;
1912
1921
  q.persist();
1913
1922
  }
@@ -2075,6 +2084,7 @@ function createRuns(d) {
2075
2084
  agent: b.runner.agent,
2076
2085
  batch: b.batchId,
2077
2086
  ...b.claim ? { gen: b.claim.gen } : {},
2087
+ ...b.claim?.stalls ? { stalls: b.claim.stalls } : {},
2078
2088
  ...state ? { state } : {},
2079
2089
  ...b.runner.why ? { why: b.runner.why } : {}
2080
2090
  };
@@ -2960,6 +2970,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
2960
2970
  m.brief = brief;
2961
2971
  }
2962
2972
  const t = c.thread ? threadsOf(m.board).find((x) => x.id === c.thread) : void 0;
2973
+ const pictures = packetPictures(root, brief);
2963
2974
  members.push({
2964
2975
  id: m.id,
2965
2976
  card: c.id,
@@ -2968,19 +2979,15 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
2968
2979
  ...c.thread ? { thread: c.thread } : {},
2969
2980
  frames: c.frames,
2970
2981
  ...t?.anchor !== void 0 ? { anchor: t.anchor } : {},
2971
- brief
2982
+ brief,
2983
+ ...pictures.length ? { pictures } : {}
2972
2984
  });
2973
2985
  }
2974
2986
  if (bad.length) {
2975
2987
  await q.lock((j) => {
2976
2988
  for (const id of bad) {
2977
2989
  const c = j.cards.find((x) => x.id === id);
2978
- if (c && c.state === "working") {
2979
- c.state = "failed";
2980
- c.note = c.kind === "wrapup" ? "the session record changed after it was written - write it again" : "interrupted - Retry";
2981
- c.rev += 1;
2982
- c.at = Date.now();
2983
- }
2990
+ if (c && c.state === "working") failCard(j, c, c.kind === "wrapup" ? "the session record changed after it was written - write it again" : "interrupted - Retry", Date.now());
2984
2991
  }
2985
2992
  q.persist();
2986
2993
  });
@@ -3870,17 +3877,11 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
3870
3877
  const c = j.cards.find((x) => x.id === m.card);
3871
3878
  if (!c) continue;
3872
3879
  if (c.capture && !captureIntact(j, ctx, c.capture)) {
3873
- c.state = "failed";
3874
- c.note = "the capture changed after it was confirmed - capture it again";
3875
- c.rev += 1;
3876
- c.at = Date.now();
3880
+ failCard(j, c, "the capture changed after it was confirmed - capture it again", Date.now());
3877
3881
  continue;
3878
3882
  }
3879
3883
  if (c.kind === "wrapup" && !wrapupIntact(ctx, c)) {
3880
- c.state = "failed";
3881
- c.note = "the session record changed after it was written - write it again";
3882
- c.rev += 1;
3883
- c.at = Date.now();
3884
+ failCard(j, c, "the session record changed after it was written - write it again", Date.now());
3884
3885
  continue;
3885
3886
  }
3886
3887
  const comment = c.kind === "comment";
@@ -3925,12 +3926,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
3925
3926
  b.note = "its packet is gone";
3926
3927
  for (const m of b.members) {
3927
3928
  const c = j.cards.find((x) => x.id === m.card);
3928
- if (c) {
3929
- c.state = "failed";
3930
- c.note = "interrupted - Retry";
3931
- c.rev += 1;
3932
- c.at = Date.now();
3933
- }
3929
+ if (c) failCard(j, c, "interrupted - Retry", Date.now());
3934
3930
  }
3935
3931
  continue;
3936
3932
  }
@@ -4182,6 +4178,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
4182
4178
  } : void 0;
4183
4179
  const position = c.state === "queued" && !busy && !full(c) ? queued.indexOf(c) + 1 : void 0;
4184
4180
  const waiting = c.state === "queued" && exclusiveAhead === "waiting" && alone(c) ? "alone" : c.state === "queued" && exclusiveAhead ? "behind" : c.state === "queued" && full(c) ? "session" : void 0;
4181
+ const fails = c.batch ? j.batches.find((b) => b.batchId === c.batch)?.failures : void 0;
4185
4182
  return {
4186
4183
  id: c.id,
4187
4184
  kind: c.kind,
@@ -4195,6 +4192,8 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
4195
4192
  made: c.made,
4196
4193
  order: c.order,
4197
4194
  at: c.at,
4195
+ ...c.att ? { att: c.att } : {},
4196
+ ...fails ? { fails } : {},
4198
4197
  ...c.follows ? { follows: c.follows } : {},
4199
4198
  ...c.reply ? { reply: c.reply } : {},
4200
4199
  ...c.batch ? { batch: c.batch } : {},