@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
@@ -1,8 +1,8 @@
1
1
  import { i as PKG, r as NAME } from "./cli.mjs";
2
- import { a as notePrefer, c as ranDevBefore, f as startedWhere, i as marverHome, m as runIdentity, o as originOf, p as stopPrefer, s as place, t as forgetDevTraces } from "./slots-CFNnegCc.mjs";
2
+ import { _ as runIdentity, a as notePrefer, c as ranDevBefore, f as startedWhere, i as marverHome, o as originOf, p as stopPrefer, s as place, t as forgetDevTraces } from "./slots-Dn4Onb0V.mjs";
3
3
  import { t as detectHost } from "./detect-C0wpaePX.mjs";
4
4
  import { n as loadConfig } from "./config-BezZTiov.mjs";
5
- import { a as installedVersion, n as tailwind3Css, r as tailwind4Plugin, t as marverPlugin } from "./plugin-C_0yb-Fq.mjs";
5
+ import { n as tailwind3Css, o as liveChanged, r as tailwind4Plugin, s as installedVersion, t as marverPlugin } from "./plugin-DqoZB-D6.mjs";
6
6
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, watch, writeSync } from "node:fs";
7
7
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
@@ -1019,7 +1019,7 @@ async function boot(root, opts, instance, t, ctx) {
1019
1019
  if (fromConfig !== void 0 && !placed.fellBackFrom) console.log(` this canvas keeps its own port (${fromConfig} in design/config.ts); remove it to use the slots\n`);
1020
1020
  setTimeout(async () => {
1021
1021
  try {
1022
- await (await import("./shot-BrRtqaiS.mjs").then((n) => n.u)).sweepGhosts((m) => console.log(` ${m}`));
1022
+ await (await import("./shot-T04Ixrvq.mjs").then((n) => n.u)).sweepGhosts((m) => console.log(` ${m}`));
1023
1023
  } catch {}
1024
1024
  }, 0);
1025
1025
  try {
@@ -1037,7 +1037,7 @@ async function boot(root, opts, instance, t, ctx) {
1037
1037
  if (n) console.log(` ${n} feature/project board${n === 1 ? "" : "s"}, no context/ - every status reads Backlog. To start it, tell your agent: "Set up our context."\n`);
1038
1038
  }
1039
1039
  } catch {}
1040
- const { loadCollab, syncOnce } = await import("./sync-CQdGARJ9.mjs").then((n) => n.o);
1040
+ const { loadCollab, syncOnce } = await import("./sync-CMozOwZ0.mjs").then((n) => n.o);
1041
1041
  if (loadCollab(root)) console.log(` comments: syncing with the published canvas\n`);
1042
1042
  let syncing = false;
1043
1043
  const tick = async () => {
@@ -1091,6 +1091,7 @@ async function boot(root, opts, instance, t, ctx) {
1091
1091
  due.set(m[1], setTimeout(() => {
1092
1092
  due.delete(m[1]);
1093
1093
  server.ws.send("sh:jam-comment", { board: m[1] });
1094
+ liveChanged();
1094
1095
  }, 120));
1095
1096
  }));
1096
1097
  t.defer(() => {
@@ -1100,9 +1101,12 @@ async function boot(root, opts, instance, t, ctx) {
1100
1101
  } catch {}
1101
1102
  }
1102
1103
  if (config.jam) {
1103
- const { startJam } = await import("./daemon-C5dg2R-V.mjs");
1104
- const { checkAnchor } = await import("./anchor-check-PHUOFj1N.mjs");
1105
- const jam = startJam(root, config.jam, (m) => console.log(m), (board) => server.ws.send("sh:jam-comment", { board }), (frameId, target, others, look) => checkAnchor({
1104
+ const { startJam } = await import("./daemon-Sc_z8gT6.mjs");
1105
+ const { checkAnchor } = await import("./anchor-check-DhlpKl2K.mjs");
1106
+ const jam = startJam(root, config.jam, (m) => console.log(m), (board) => {
1107
+ server.ws.send("sh:jam-comment", { board });
1108
+ liveChanged();
1109
+ }, (frameId, target, others, look) => checkAnchor({
1106
1110
  root,
1107
1111
  viewports: config.viewports,
1108
1112
  origin: `http://localhost:${port}`,
@@ -1115,12 +1119,13 @@ async function boot(root, opts, instance, t, ctx) {
1115
1119
  return () => {
1116
1120
  due ??= setTimeout(async () => {
1117
1121
  due = null;
1118
- const { jamLive } = await import("./live-Cgzsicwi.mjs");
1122
+ const { jamLive } = await import("./plugin-DqoZB-D6.mjs").then((n) => n.a);
1119
1123
  server.ws.send("sh:jam-queue", jamLive.view?.() ?? { cards: [] });
1124
+ liveChanged();
1120
1125
  }, 60);
1121
1126
  };
1122
1127
  })(), async (frameId, theme, entry, size) => {
1123
- const { shootFrame } = await import("./shot-BrRtqaiS.mjs").then((n) => n.u);
1128
+ const { shootFrame } = await import("./shot-T04Ixrvq.mjs").then((n) => n.u);
1124
1129
  const r = await shootFrame({
1125
1130
  root,
1126
1131
  viewports: config.viewports,
@@ -1130,7 +1135,7 @@ async function boot(root, opts, instance, t, ctx) {
1130
1135
  ...size ? { size } : {}
1131
1136
  });
1132
1137
  if (!r.ok) return null;
1133
- const { addPicture } = await import("./capture-DdZ6xgoz.mjs").then((n) => n.i);
1138
+ const { addPicture } = await import("./capture-DEtM4qm5.mjs").then((n) => n.i);
1134
1139
  return addPicture(root, r.path, {
1135
1140
  frame: frameId,
1136
1141
  ...entry,
@@ -1140,8 +1145,8 @@ async function boot(root, opts, instance, t, ctx) {
1140
1145
  if (jam) {
1141
1146
  t.defer(() => jam.stop());
1142
1147
  if (config.jam.session !== false) try {
1143
- const { ensureConnectors, connectorLine } = await import("./connectors-MR9d-EBP.mjs");
1144
- const { jamLive } = await import("./live-Cgzsicwi.mjs");
1148
+ const { ensureConnectors, connectorLine } = await import("./connectors-DekQvKt9.mjs");
1149
+ const { jamLive } = await import("./plugin-DqoZB-D6.mjs").then((n) => n.a);
1145
1150
  const results = ensureConnectors(root);
1146
1151
  jamLive.connectors = results;
1147
1152
  const line = connectorLine(results);
@@ -1150,8 +1155,8 @@ async function boot(root, opts, instance, t, ctx) {
1150
1155
  console.log(` jam: could not connect sessions - ${err.message}`);
1151
1156
  }
1152
1157
  const { createSpeech, speechLive } = await import("./audio-DX4POHAj.mjs");
1153
- const { appendTalk } = await import("./session-DyVE7cCk.mjs").then((n) => n.s);
1154
- const { logJam } = await import("./perf-jam-QxD_UnzN.mjs").then((n) => n.n);
1158
+ const { appendTalk } = await import("./session-VDJfXEEm.mjs").then((n) => n.s);
1159
+ const { logJam } = await import("./perf-jam-CLkERSHo.mjs").then((n) => n.n);
1155
1160
  const speech = createSpeech({
1156
1161
  onTalk: (t) => appendTalk(root, t.session, t.words),
1157
1162
  onTiming: (t) => logJam(root, {
@@ -6,7 +6,7 @@ import { r as detectAgent } from "./agent-BsieQGTD.mjs";
6
6
  import { MANAGED_PREFIX, enumerateInstructionTemplates, hashBody, pkgDir } from "./managed-HwHVNI3h.mjs";
7
7
  import { t as writeManaged } from "./managed-write-Bo-oPc-i.mjs";
8
8
  import { n as readJson, t as detectHost } from "./detect-C0wpaePX.mjs";
9
- import { connectorLine, ensureConnectors } from "./connectors-MR9d-EBP.mjs";
9
+ import { connectorLine, ensureConnectors } from "./connectors-DekQvKt9.mjs";
10
10
  import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
11
11
  import { basename, dirname, join, relative } from "node:path";
12
12
  //#region src/cli/init.ts
@@ -0,0 +1,305 @@
1
+ import { a as ROUTE } from "./cli.mjs";
2
+ import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readSync, realpathSync, writeFileSync } from "node:fs";
3
+ import { join, resolve, sep } from "node:path";
4
+ import { createHash, createHmac, timingSafeEqual } from "node:crypto";
5
+ //#region src/server/proof.ts
6
+ /**
7
+ * The document proof (spec 28 A1.4). The Mac app puts a fresh nonce on every main-frame request to a
8
+ * local canvas (`x-mv-nonce`) and checks the answer before the document commits; only the canvas
9
+ * holding the slot file's key can sign it, so the privileges the app grants belong to that exact
10
+ * document. The proof rides the very response the app commits - the check and the load can never
11
+ * reach different listeners.
12
+ *
13
+ * Pinned exactly, so the app (A2.3 `proof.ts`) computes the same: the key is the slot file's 32 bytes
14
+ * (base64url there), HMAC-SHA256 over UTF-8 `doc|<nonce>|<port>` (port in decimal), base64url without
15
+ * padding. Requests from the app itself carry `app|<port>` the same way, and the logo the app fetches
16
+ * (`GET /__mv/logo`, spec 28 A2.4) `logo|<nonce>|<port>`: a listener that took the port after the tab was
17
+ * verified can never hand it a logo. The live stream (`GET /__mv/app/live`, A4.6 #6) is proved both ways: the
18
+ * request carries `x-mv-app` (`appProof`, checked by `appProofOk`), the answer `live|<nonce>|<port>` - a
19
+ * listener that took the port after a canvas stopped can never put words into a notice.
20
+ */
21
+ /** 16-64 base64url characters - anything else is not a nonce, and is ignored. */
22
+ const NONCE = /^[A-Za-z0-9_-]{16,64}$/;
23
+ const sign$1 = (key, msg) => createHmac("sha256", key).update(msg, "utf8").digest("base64url");
24
+ const docProof = (key, nonce, port) => sign$1(key, `doc|${nonce}|${port}`);
25
+ const appProof = (key, port) => sign$1(key, `app|${port}`);
26
+ const logoProof = (key, nonce, port) => sign$1(key, `logo|${nonce}|${port}`);
27
+ const liveProof = (key, nonce, port) => sign$1(key, `live|${nonce}|${port}`);
28
+ const PROOFS = {
29
+ doc: docProof,
30
+ logo: logoProof,
31
+ live: liveProof
32
+ };
33
+ /** The two headers for a request carrying a well-formed `x-mv-nonce`, else null: over the shell's document
34
+ * (`doc`), the logo (`logo`) or the live stream (`live`). */
35
+ function proofHeaders(p, nonce, kind = "doc") {
36
+ if (!p || typeof nonce !== "string" || !NONCE.test(nonce)) return null;
37
+ return {
38
+ "x-mv-instance": p.instance,
39
+ "x-mv-proof": PROOFS[kind](p.key, nonce, p.port)
40
+ };
41
+ }
42
+ /** Is this `x-mv-app` header the app's own, `appProof(key, port)`? Compared in constant time over equal lengths;
43
+ * anything but one string is no. The HMAC is never relaxed: no cookie, no token stands in for it (A4.6 #6). */
44
+ function appProofOk(p, header) {
45
+ if (typeof header !== "string") return false;
46
+ const got = Buffer.from(header);
47
+ const want = Buffer.from(appProof(p.key, p.port));
48
+ return got.length === want.length && timingSafeEqual(got, want);
49
+ }
50
+ /** The type each sniffed logo is served with. */
51
+ const LOGO_MIME = {
52
+ png: "image/png",
53
+ ico: "image/x-icon",
54
+ svg: "image/svg+xml"
55
+ };
56
+ const PNG = [
57
+ 137,
58
+ 80,
59
+ 78,
60
+ 71,
61
+ 13,
62
+ 10,
63
+ 26,
64
+ 10
65
+ ];
66
+ /** The logo type these bytes are, or null when they are none of the three. */
67
+ function sniffLogo(b) {
68
+ if (b.length >= PNG.length && PNG.every((x, i) => b[i] === x)) return "png";
69
+ if (b.length >= 4 && b[0] === 0 && b[1] === 0 && b[2] === 1 && b[3] === 0) return "ico";
70
+ return svgRoot(b) ? "svg" : null;
71
+ }
72
+ /** Is this UTF-8 text an SVG document: its root element `<svg`, with only the prolog A2.14 #24 allows before it? */
73
+ function svgRoot(b) {
74
+ let s;
75
+ try {
76
+ s = new TextDecoder("utf-8", { fatal: true }).decode(b);
77
+ } catch {
78
+ return false;
79
+ }
80
+ let i = s.charCodeAt(0) === 65279 ? 1 : 0;
81
+ const space = () => {
82
+ while (i < s.length && /\s/.test(s[i])) i++;
83
+ };
84
+ space();
85
+ if (s.startsWith("<?xml", i) && /[\s?]/.test(s[i + 5] ?? "")) {
86
+ const end = s.indexOf("?>", i);
87
+ if (end < 0) return false;
88
+ i = end + 2;
89
+ }
90
+ let doctype = false;
91
+ for (;;) {
92
+ space();
93
+ if (s.startsWith("<!--", i)) {
94
+ const end = s.indexOf("-->", i + 4);
95
+ if (end < 0) return false;
96
+ i = end + 3;
97
+ continue;
98
+ }
99
+ if (s.startsWith("<!DOCTYPE", i)) {
100
+ if (doctype) return false;
101
+ doctype = true;
102
+ const end = doctypeEnd(s, i + 9);
103
+ if (end < 0) return false;
104
+ i = end;
105
+ continue;
106
+ }
107
+ break;
108
+ }
109
+ return s.startsWith("<svg", i) && /[\s>/]/.test(s[i + 4] ?? "");
110
+ }
111
+ /** Just past the `>` that closes a `<!DOCTYPE svg ...>` whose body starts at `i`, or -1: another root name, an
112
+ * internal subset (`[` outside quotes) or no end. Quoted public and system ids may hold anything but their quote. */
113
+ function doctypeEnd(s, i) {
114
+ if (!/\s/.test(s[i] ?? "")) return -1;
115
+ while (i < s.length && /\s/.test(s[i])) i++;
116
+ if (!s.startsWith("svg", i) || !/[\s>]/.test(s[i + 3] ?? "")) return -1;
117
+ i += 3;
118
+ while (i < s.length) {
119
+ const c = s[i];
120
+ if (c === ">") return i + 1;
121
+ if (c === "[") return -1;
122
+ if (c === "\"" || c === "'") {
123
+ const close = s.indexOf(c, i + 1);
124
+ if (close < 0) return -1;
125
+ i = close + 1;
126
+ continue;
127
+ }
128
+ i++;
129
+ }
130
+ return -1;
131
+ }
132
+ //#endregion
133
+ //#region src/server/logo.ts
134
+ const LOGO_LADDER = [
135
+ "design/logo.svg",
136
+ "design/logo.png",
137
+ "public/logo.svg",
138
+ "public/logo.png",
139
+ "public/favicon.svg",
140
+ "public/favicon.png",
141
+ "public/favicon.ico"
142
+ ];
143
+ /** The first candidate that passes every check, read whole; null when none does. `warn` hears why a `share.logo`
144
+ * was ignored (the ladder's own entries are tried quietly: most repos have none of them). */
145
+ function findLogo(root, shareLogo, warn) {
146
+ let realRoot;
147
+ try {
148
+ realRoot = realpathSync(root);
149
+ } catch {
150
+ return null;
151
+ }
152
+ const own = typeof shareLogo === "string" && shareLogo !== "" ? shareLogo : null;
153
+ for (const cand of new Set(own ? [own, ...LOGO_LADDER] : LOGO_LADDER)) {
154
+ const r = readLogo(realRoot, resolve(realRoot, cand));
155
+ if (typeof r !== "string") return {
156
+ ...r,
157
+ from: cand
158
+ };
159
+ if (cand === own) warn?.(`share.logo ${own} is ignored: ${r}`);
160
+ }
161
+ return null;
162
+ }
163
+ /** One candidate: its bytes and type, or why it does not count. */
164
+ function readLogo(realRoot, file) {
165
+ let st;
166
+ try {
167
+ st = lstatSync(file);
168
+ } catch (e) {
169
+ return e.code === "ENOENT" || e.code === "ENOTDIR" ? "no such file" : "unreadable";
170
+ }
171
+ if (st.isSymbolicLink()) return "a symlink";
172
+ if (!st.isFile()) return "not a file";
173
+ if (!/\.(svg|png|ico)$/i.test(file)) return "not .svg, .png or .ico";
174
+ if (st.size > 262144) return "over 256 KB";
175
+ let real;
176
+ try {
177
+ real = realpathSync(file);
178
+ } catch {
179
+ return "unreadable";
180
+ }
181
+ if (!real.startsWith(realRoot + sep)) return "outside the repo";
182
+ let fd;
183
+ try {
184
+ fd = openSync(real, constants.O_RDONLY | constants.O_NOFOLLOW);
185
+ } catch {
186
+ return "unreadable";
187
+ }
188
+ try {
189
+ const f = fstatSync(fd);
190
+ if (!f.isFile() || f.ino !== st.ino || f.dev !== st.dev) return "changed while it was read";
191
+ const buf = Buffer.alloc(262145);
192
+ let n = 0;
193
+ for (let k = 1; k > 0 && n < buf.length; n += k) k = readSync(fd, buf, n, buf.length - n, null);
194
+ if (n > 262144) return "over 256 KB";
195
+ const bytes = Buffer.from(buf.subarray(0, n));
196
+ const type = sniffLogo(bytes);
197
+ return type ? {
198
+ type,
199
+ bytes
200
+ } : "not an image (PNG, ICO or SVG)";
201
+ } catch {
202
+ return "unreadable";
203
+ } finally {
204
+ closeSync(fd);
205
+ }
206
+ }
207
+ /** `marver build`: the logo into `<outDir>/__mv/logo.<type>` (an `.ico` as `logo.ico`), by its bytes - never a copy
208
+ * that follows a link. Its published path, or undefined when the repo has none. */
209
+ function publishLogo(root, shareLogo, outDir, warn) {
210
+ const logo = findLogo(root, shareLogo, warn);
211
+ if (!logo) return void 0;
212
+ const dir = join(outDir, ROUTE.slice(1));
213
+ mkdirSync(dir, { recursive: true });
214
+ writeFileSync(join(dir, `logo.${logo.type}`), logo.bytes);
215
+ return `${ROUTE}/logo.${logo.type}`;
216
+ }
217
+ /**
218
+ * The repo's logo as the `<link rel="icon">` of the published shell and gate (spec 28 A4.6 #46, marver 0.29.0): a
219
+ * browser tab, and the Mac app's tab for a shared canvas, wear the repo's logo. `logo` is `publishLogo`'s answer
220
+ * (`meta.json`'s `logo`); '' for none - or anything else, never written into the page.
221
+ */
222
+ function logoIconLink(logo) {
223
+ const m = typeof logo === "string" ? new RegExp(`^${ROUTE}/logo\\.(svg|png|ico)$`).exec(logo) : null;
224
+ return m ? `<link rel="icon" type="${LOGO_MIME[m[1]]}" href="${logo}" />` : "";
225
+ }
226
+ /** A tab icon's `<link>`, its line's indent and line end with it: `rel="icon"` or `"shortcut icon"`, in any quotes,
227
+ * padded or not, and attribute order. `apple-touch-icon` and the manifest are no tab icon. */
228
+ const TAB_ICON = /[ \t]*<link\b(?=[^>]*\srel\s*=\s*["']?\s*(?:shortcut\s+)?icon["'\s/>])[^>]*>[ \t]*\r?\n?/gi;
229
+ /**
230
+ * A page's HTML with the logo's icon as its only tab icon (A4.6 #46; release review P2): the logo's line takes the
231
+ * first `<link rel="icon">`'s place and every other one goes - Marver's own set beside it would compete, since a
232
+ * browser picks among icons by type and size, the last declared among equals, never simply the first. The Mac app's
233
+ * shared tab picks the logo by its path from whatever a page lists (app/src/shared/links.ts remoteFaviconPick). No
234
+ * logo: the page as it was, Marver's set its icons. No icon line: the logo's at the head's end.
235
+ */
236
+ function logoIcons(html, logo) {
237
+ const link = logoIconLink(logo);
238
+ if (!link) return html;
239
+ let placed = false;
240
+ const out = html.replace(TAB_ICON, (line) => {
241
+ if (placed) return "";
242
+ placed = true;
243
+ return line.replace(/<link\b[^>]*>/i, () => link);
244
+ });
245
+ if (placed) return out;
246
+ return html.includes("</head>") ? html.replace("</head>", () => `${link}\n</head>`) : html;
247
+ }
248
+ /** A strong `ETag` for these bytes. */
249
+ const logoTag = (bytes) => `"${createHash("sha256").update(bytes).digest("base64url").slice(0, 22)}"`;
250
+ /** Does an `If-None-Match` name this tag (a list, a weak tag, or `*`)? */
251
+ function matches(header, tag) {
252
+ if (typeof header !== "string") return false;
253
+ return header.split(",").map((t) => t.trim().replace(/^W\//, "")).some((t) => t === "*" || t === tag);
254
+ }
255
+ /**
256
+ * `marver dev`'s `GET|HEAD /__mv/logo`. Read once per request (256 KB at most), checked, and answered with its sniffed
257
+ * type, an `ETag` and `Cache-Control: no-cache`; `x-content-type-options: nosniff` and a CSP that runs nothing, so an
258
+ * SVG opened as a page is a picture. A request carrying a well-formed `x-mv-nonce` gets the logo proof
259
+ * (`x-mv-instance`, `x-mv-proof` over `logo|<nonce>|<port>`), on a 200 and a 304 alike. 404 when the repo has none.
260
+ */
261
+ function logoRoute(root, shareLogo, proof) {
262
+ const warned = /* @__PURE__ */ new Set();
263
+ const warn = (m) => {
264
+ if (warned.has(m)) return;
265
+ warned.add(m);
266
+ console.warn(` marver: ${m}`);
267
+ };
268
+ return (req, res, next) => {
269
+ let path;
270
+ try {
271
+ path = new URL(req.url ?? "/", "http://x").pathname;
272
+ } catch {
273
+ return next();
274
+ }
275
+ if (path !== `/__mv/logo`) return next();
276
+ if (req.method !== "GET" && req.method !== "HEAD") {
277
+ res.statusCode = 405;
278
+ res.setHeader("allow", "GET, HEAD");
279
+ return res.end();
280
+ }
281
+ const logo = findLogo(root, shareLogo(), warn);
282
+ if (!logo) {
283
+ res.statusCode = 404;
284
+ res.setHeader("cache-control", "no-store");
285
+ return res.end();
286
+ }
287
+ const tag = logoTag(logo.bytes);
288
+ res.setHeader("content-type", LOGO_MIME[logo.type]);
289
+ res.setHeader("etag", tag);
290
+ res.setHeader("cache-control", "no-cache");
291
+ res.setHeader("vary", "x-mv-nonce");
292
+ res.setHeader("x-content-type-options", "nosniff");
293
+ res.setHeader("content-security-policy", "default-src 'none'; style-src 'unsafe-inline'");
294
+ const signed = proofHeaders(proof, req.headers["x-mv-nonce"], "logo");
295
+ if (signed) for (const [k, v] of Object.entries(signed)) res.setHeader(k, v);
296
+ if (matches(req.headers["if-none-match"], tag)) {
297
+ res.statusCode = 304;
298
+ return res.end();
299
+ }
300
+ res.setHeader("content-length", String(logo.bytes.length));
301
+ res.end(req.method === "HEAD" ? void 0 : logo.bytes);
302
+ };
303
+ }
304
+ //#endregion
305
+ export { appProofOk as a, publishLogo as i, logoIcons as n, proofHeaders as o, logoRoute as r, logoIconLink as t };
@@ -1,5 +1,5 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { l as readRunning, n as formatRunning } from "./slots-CFNnegCc.mjs";
2
+ import { l as readRunning, n as formatRunning } from "./slots-Dn4Onb0V.mjs";
3
3
  //#region src/cli/ls.ts
4
4
  /**
5
5
  * `marver ls` (spec 28 A1.5): the canvases running on this Mac, read from the registry
@@ -87,6 +87,9 @@ function compare(was, now, deps, ids, boot, only) {
87
87
  /** App code: outside design/, and code (a component, a helper) - not content like a spec's markdown. */
88
88
  const isApp = (rel) => !rel.startsWith("design/") && /\.(tsx?|jsx?|mjs|cjs)$/.test(rel);
89
89
  //#endregion
90
+ //#region src/shared/marks.ts
91
+ const isNew = (m, id) => !!m && (m.changed[id] ?? 0) > (m.seen[id] ?? 0);
92
+ //#endregion
90
93
  //#region src/server/marks.ts
91
94
  /**
92
95
  * Sidebar marks, the dev server's half (spec 25, made exact by spec 26): which frames changed, and
@@ -111,6 +114,7 @@ const isApp = (rel) => !rel.startsWith("design/") && /\.(tsx?|jsx?|mjs|cjs)$/.te
111
114
  var marks_exports = /* @__PURE__ */ __exportAll({
112
115
  docRev: () => docRev,
113
116
  docRevs: () => docRevs,
117
+ freshFrames: () => freshFrames,
114
118
  initMarks: () => initMarks,
115
119
  markSeen: () => markSeen,
116
120
  observe: () => observe,
@@ -375,6 +379,21 @@ function readMarks(root, manifest) {
375
379
  const st = state(root, manifest.frames);
376
380
  return st && snapshot(root, manifest, st);
377
381
  }
382
+ /** The frames new to the owner now, for the live stream (spec 28 A4.6 #7): the running server's own state read with
383
+ * the pure `isNew` - never `projectMarks` (the next boot's view, from disk) nor `readMarks` (it reads every board
384
+ * file). Never loads a state: marks off, or not started, is none. */
385
+ function freshFrames(root, frames) {
386
+ const st = states.get(root);
387
+ if (!st || st === "off") return [];
388
+ const m = {
389
+ epoch: st.epoch,
390
+ changed: st.changed,
391
+ doc: st.doc,
392
+ seen: st.seen,
393
+ boards: {}
394
+ };
395
+ return frames.map((f) => f.id).filter((id) => isNew(m, id));
396
+ }
378
397
  /** The marks as the next `marver dev` would see them, from the files alone - nothing is written, so
379
398
  * looking never starts the clock. `null` before the first `marver dev` on 0.25. */
380
399
  function projectMarks(root, manifest) {
@@ -394,4 +413,4 @@ function projectMarks(root, manifest) {
394
413
  return snapshot(root, manifest, st);
395
414
  }
396
415
  //#endregion
397
- export { observe as a, marks_exports as i, docRevs as n, projectMarks as o, initMarks as r, recordChanged as s, docRev as t };
416
+ export { marks_exports as a, recordChanged as c, initMarks as i, isNew as l, docRevs as n, observe as o, freshFrames as r, projectMarks as s, docRev as t };
@@ -1,12 +1,9 @@
1
1
  import { s as scanFrames } from "./manifest-DPZ3WNg_.mjs";
2
2
  import { r as replay, t as asks } from "./events-CLH4ijKP.mjs";
3
3
  import { a as readLog, i as listBoards } from "./comments-0BSbb04K.mjs";
4
- import { o as projectMarks } from "./marks-Kmdab_5w.mjs";
5
- import { answers } from "./queue-c-6aTHEz.mjs";
4
+ import { l as isNew, s as projectMarks } from "./marks-BnNANic9.mjs";
5
+ import { answers } from "./queue-DeSQm24g.mjs";
6
6
  import { join } from "node:path";
7
- //#region src/shared/marks.ts
8
- const isNew = (m, id) => !!m && (m.changed[id] ?? 0) > (m.seen[id] ?? 0);
9
- //#endregion
10
7
  //#region src/cli/marks.ts
11
8
  /**
12
9
  * `marver marks` (spec 26): what the human has not reviewed yet - the frames waiting on them (a
@@ -1,6 +1,6 @@
1
1
  import { i as avatarSourceFor, n as attachAvatar, p as provisionFromMarverId } from "./auth-Dix8wrXV.mjs";
2
2
  import { TransactionStore, browserBinding, verifyAssertion } from "./marver-id-CVCoaMGI.mjs";
3
- import { t as poweredByUrl } from "./serve-Dp3nHstu.mjs";
3
+ import { t as poweredByUrl } from "./serve-DQv3Ti6X.mjs";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { isIP } from "node:net";
6
6
  import { lookup } from "node:dns/promises";
@@ -1,8 +1,8 @@
1
1
  import { a as checkBoardsDir, c as listBoardFiles, r as boardFields } from "./boards-EH2onUXM.mjs";
2
2
  import { f as isBoardName, p as labelOf } from "./board-tree-BXR8dw4b.mjs";
3
3
  import { i as readDevInfo } from "./work-DJxH7cCX.mjs";
4
- import { h as workspaceId, i as marverHome } from "./slots-CFNnegCc.mjs";
5
- import { d as readRuns, l as readPage, r as readJam, u as readReloads } from "./perf-jam-QxD_UnzN.mjs";
4
+ import { i as marverHome, v as workspaceId } from "./slots-Dn4Onb0V.mjs";
5
+ import { d as readRuns, l as readPage, r as readJam, u as readReloads } from "./perf-jam-CLkERSHo.mjs";
6
6
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
7
7
  import { join } from "node:path";
8
8
  import { homedir } from "node:os";
@@ -930,32 +930,49 @@ function jamSummary(events) {
930
930
  };
931
931
  const outcomes = {};
932
932
  for (const r of runs) for (const m of r.members ?? []) outcomes[m.outcome ?? "unknown"] = (outcomes[m.outcome ?? "unknown"] ?? 0) + 1;
933
+ const problems = [
934
+ ...of("run").filter((r) => r.failure).map((r) => ({
935
+ ts: r.ts,
936
+ what: `run ${String(r.batch).slice(0, 8)} ${r.redelivered ? "could not post its replies" : `failed: ${r.failure}`}`
937
+ })),
938
+ ...shots.filter((s) => s.outcome && s.outcome !== "ok").map((s) => ({
939
+ ts: s.ts,
940
+ what: `shot ${s.frame ?? "?"}: ${s.outcome}${s.recaptures ? ` after ${s.recaptures} retakes` : ""}`
941
+ })),
942
+ ...caps.filter((c) => c.pictures?.late || c.pictures?.failed).map((c) => ({
943
+ ts: c.ts,
944
+ what: `capture ${c.capture}: ${c.pictures.late ?? 0} picture(s) too late, ${c.pictures.failed ?? 0} failed`
945
+ })),
946
+ ...caps.filter((c) => c.pictures?.live?.failed).map((c) => ({
947
+ ts: c.ts,
948
+ what: `capture ${c.capture}: ${c.pictures.live.failed} live picture(s) failed, ${c.pictures.live.fellBack ?? 0} rendered instead`
949
+ })),
950
+ ...of("name").filter((n) => !n.ok).map((n) => ({
951
+ ts: n.ts,
952
+ what: `naming ${n.capture} gave no name`
953
+ })),
954
+ ...of("dropped").map((d) => ({
955
+ ts: d.ts,
956
+ what: `${d.count} event(s) dropped (the log was busy)`
957
+ }))
958
+ ].sort((a, b) => b.ts - a.ts).slice(0, 10);
959
+ const lives = caps.map((c) => c.pictures?.live).filter((l) => !!l);
960
+ const live = {
961
+ count: 0,
962
+ failed: 0,
963
+ fellBack: 0
964
+ };
965
+ for (const l of lives) for (const k of [
966
+ "count",
967
+ "failed",
968
+ "fellBack"
969
+ ]) live[k] += typeof l[k] === "number" ? l[k] : 0;
933
970
  return {
934
971
  steps,
935
972
  outcomes,
936
- problems: [
937
- ...of("run").filter((r) => r.failure).map((r) => ({
938
- ts: r.ts,
939
- what: `run ${String(r.batch).slice(0, 8)} ${r.redelivered ? "could not post its replies" : `failed: ${r.failure}`}`
940
- })),
941
- ...shots.filter((s) => s.outcome && s.outcome !== "ok").map((s) => ({
942
- ts: s.ts,
943
- what: `shot ${s.frame ?? "?"}: ${s.outcome}${s.recaptures ? ` after ${s.recaptures} retakes` : ""}`
944
- })),
945
- ...caps.filter((c) => c.pictures?.late || c.pictures?.failed).map((c) => ({
946
- ts: c.ts,
947
- what: `capture ${c.capture}: ${c.pictures.late ?? 0} picture(s) too late, ${c.pictures.failed ?? 0} failed`
948
- })),
949
- ...of("name").filter((n) => !n.ok).map((n) => ({
950
- ts: n.ts,
951
- what: `naming ${n.capture} gave no name`
952
- })),
953
- ...of("dropped").map((d) => ({
954
- ts: d.ts,
955
- what: `${d.count} event(s) dropped (the log was busy)`
956
- }))
957
- ].sort((a, b) => b.ts - a.ts).slice(0, 10),
958
- retakes: shots.reduce((n, s) => n + (s.recaptures ?? 0), 0)
973
+ problems,
974
+ retakes: shots.reduce((n, s) => n + (s.recaptures ?? 0), 0),
975
+ ...lives.length ? { live } : {}
959
976
  };
960
977
  }
961
978
  function jamPerf(root, opts) {
@@ -986,6 +1003,7 @@ function jamPerf(root, opts) {
986
1003
  const out = Object.entries(sum.outcomes);
987
1004
  if (out.length) console.log(`\nruns by outcome: ${out.map(([k, n]) => `${n} ${k}`).join(", ")}`);
988
1005
  if (sum.retakes) console.log(`pictures taken again (a stale surface): ${sum.retakes}`);
1006
+ if (sum.live) console.log(`live pictures (the Mac app's, in play): ${sum.live.count} kept, ${sum.live.failed} failed (${sum.live.fellBack} rendered instead)`);
989
1007
  if (sum.problems.length) {
990
1008
  console.log("\nlately");
991
1009
  for (const p of sum.problems) console.log(` ${new Date(p.ts).toLocaleTimeString()} ${p.what}`);
@@ -466,6 +466,12 @@ function cleanJamEvent(raw) {
466
466
  const p = raw.pictures && typeof raw.pictures === "object" ? raw.pictures : {};
467
467
  const capture = capId(raw.capture);
468
468
  if (!capture) return null;
469
+ const l = p.live && typeof p.live === "object" ? p.live : null;
470
+ const live = l ? prune({
471
+ count: count(l.count),
472
+ failed: count(l.failed),
473
+ fellBack: count(l.fellBack)
474
+ }) : void 0;
469
475
  return prune({
470
476
  kind: "capture",
471
477
  capture,
@@ -475,7 +481,8 @@ function cleanJamEvent(raw) {
475
481
  count: count(p.count),
476
482
  ms: msList(p.ms),
477
483
  late: count(p.late),
478
- failed: count(p.failed)
484
+ failed: count(p.failed),
485
+ live: live && Object.keys(live).length ? live : void 0
479
486
  }),
480
487
  interrupted: raw.interrupted === true ? true : void 0
481
488
  });