@marver-design/marver 0.25.0 → 0.26.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 (92) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +3 -1
  3. package/dist/{anchor-DVV732zR.mjs → anchor-5H1vnoLu.mjs} +6 -1
  4. package/dist/{anchor-check-BE5VVN6Q.mjs → anchor-check-Dg5xpNnU.mjs} +1 -1
  5. package/dist/audio-CmSRYFEs.mjs +429 -0
  6. package/dist/{auth-DdUKeVKt.mjs → auth-Dix8wrXV.mjs} +1 -1
  7. package/dist/{bake-D8byeRzB.mjs → bake-DtVlm0_F.mjs} +45 -6
  8. package/dist/{boards-Csxj2WJn.mjs → boards-DYG22tOe.mjs} +2 -2
  9. package/dist/{build-BHoWLvSj.mjs → build-C_gUgcdC.mjs} +16 -9
  10. package/dist/capture-CrqvU_jh.mjs +729 -0
  11. package/dist/cli.mjs +23 -17
  12. package/dist/{collab-gqNdScUE.mjs → collab-Dxg2trOK.mjs} +4 -3
  13. package/dist/{comments-Zoch254k.mjs → comments-0BSbb04K.mjs} +14 -3
  14. package/dist/{comments-pTLlhjh4.mjs → comments-BqXua-XL.mjs} +7 -7
  15. package/dist/{config-cKgZBRj0.mjs → config-Cf7EjAMf.mjs} +12 -1
  16. package/dist/{context-D2ugHqwO.mjs → context-HQ4Giw58.mjs} +1 -1
  17. package/dist/daemon-DZo6o3rU.mjs +2445 -0
  18. package/dist/{dev-DJdgow47.mjs → dev-_Nlsc6v9.mjs} +189 -18
  19. package/dist/dev-lock-DWSpa6nj.mjs +179 -0
  20. package/dist/{events-DnK_AnrW.mjs → events-CLH4ijKP.mjs} +14 -4
  21. package/dist/{init-DO4DhUt_.mjs → init-D8DtrK_F.mjs} +2 -2
  22. package/dist/{ledger-BNXW14Xw.mjs → ledger-D54iROST.mjs} +17 -1
  23. package/dist/{link-C-qUIuKU.mjs → link-BNzLvdhI.mjs} +2 -2
  24. package/dist/live-Cgzsicwi.mjs +4 -0
  25. package/dist/{manifest-DnAte_fB.mjs → manifest-Nl3KSVOk.mjs} +1 -1
  26. package/dist/{marks-koRsbHfe.mjs → marks-CKgzucHZ.mjs} +2 -2
  27. package/dist/{marks-DFuintmJ.mjs → marks-NQi0wZJ4.mjs} +23 -5
  28. package/dist/{marver-id-gate-DGANtVyC.mjs → marver-id-gate-BjF6v4bT.mjs} +4 -4
  29. package/dist/{perf-QJIWtTw1.mjs → perf-D6VmmJ2q.mjs} +1 -1
  30. package/dist/{perf-CCisg-ny.mjs → perf-DPbLGhhO.mjs} +1 -1
  31. package/dist/{plugin-CTyhjwoJ.mjs → plugin-CTD0rydA.mjs} +279 -38
  32. package/dist/{poster-D0cbV7hi.mjs → poster-ChjXGTS5.mjs} +1 -1
  33. package/dist/{profile-Do0nGkXO.mjs → profile-WU9qcbIo.mjs} +1 -1
  34. package/dist/{publish-bakes--l8ot2eQ.mjs → publish-bakes-CEP_2NRc.mjs} +3 -3
  35. package/dist/queue-BuiCKSX1.mjs +1319 -0
  36. package/dist/reserve-BURNQ2Y3.mjs +53 -0
  37. package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
  38. package/dist/{serve-wv2QWdxB.mjs → serve-C8rVheYk.mjs} +12 -12
  39. package/dist/session-qZWKt_VA.mjs +191 -0
  40. package/dist/{share-ScamJcks.mjs → share--oFJ1bCI.mjs} +2 -2
  41. package/dist/{shot-jdO_B6Qw.mjs → shot-CNbHoZ6H.mjs} +1 -1
  42. package/dist/{shot-CckrGW-J.mjs → shot-DqcxJibP.mjs} +4 -3
  43. package/dist/speech-models-DomiLQcY.mjs +299 -0
  44. package/dist/speech-worker.mjs +319 -0
  45. package/dist/{summary-CrW88e3q.mjs → summary-Y8MY1Wuc.mjs} +2 -2
  46. package/dist/{sync-C3035OnJ.mjs → sync-DKk-yT1V.mjs} +9 -8
  47. package/dist/{work-GE88wb_3.mjs → work-F5u-twpJ.mjs} +28 -5
  48. package/dist/{work-CpJn1gwY.mjs → work-VvX_JIgl.mjs} +2 -2
  49. package/docs/jam-session.md +177 -0
  50. package/docs/live-jam.md +21 -3
  51. package/package.json +7 -1
  52. package/src/client/frame-host/bridge.js +20 -2
  53. package/src/client/frame-host/inspect.d.ts +4 -0
  54. package/src/client/frame-host/inspect.js +88 -3
  55. package/src/client/frame-host/keys.d.ts +6 -0
  56. package/src/client/frame-host/keys.js +55 -0
  57. package/src/client/frame-host/trail.d.ts +7 -0
  58. package/src/client/frame-host/trail.js +204 -0
  59. package/src/client/shell/App.tsx +45 -5
  60. package/src/client/shell/Comments.tsx +20 -6
  61. package/src/client/shell/JamSurface.tsx +340 -0
  62. package/src/client/shell/Play.tsx +22 -3
  63. package/src/client/shell/Tip.tsx +8 -3
  64. package/src/client/shell/canvas/Canvas.tsx +12 -2
  65. package/src/client/shell/canvas/FrameNode.tsx +11 -2
  66. package/src/client/shell/canvas/sleep.ts +19 -1
  67. package/src/client/shell/comments-store.ts +23 -16
  68. package/src/client/shell/icons.tsx +15 -0
  69. package/src/client/shell/jam-capture.ts +939 -0
  70. package/src/client/shell/jam-keys.ts +329 -0
  71. package/src/client/shell/jam-lane.tsx +208 -0
  72. package/src/client/shell/jam-lines.ts +115 -0
  73. package/src/client/shell/jam-panel.tsx +506 -0
  74. package/src/client/shell/jam-queue.ts +126 -0
  75. package/src/client/shell/jam-session.tsx +389 -0
  76. package/src/client/shell/jam-state.ts +61 -0
  77. package/src/client/shell/jam-surface-parts.tsx +102 -0
  78. package/src/client/shell/jam-ui.tsx +104 -0
  79. package/src/client/shell/jam-voice.ts +479 -0
  80. package/src/client/shell/sound.ts +22 -0
  81. package/src/client/shell/stage-size.ts +11 -0
  82. package/src/client/shell/store.ts +34 -13
  83. package/src/client/shell/styles.css +544 -2
  84. package/src/client/stage/main.tsx +16 -2
  85. package/src/shared/capture-frames.ts +41 -0
  86. package/src/shared/events.ts +19 -4
  87. package/src/shared/speech.ts +16 -0
  88. package/templates/AGENTS-embedded.md +10 -2
  89. package/templates/AGENTS-studio.md +10 -2
  90. package/templates/instructions/iterate.md +8 -6
  91. package/templates/instructions/jam.md +129 -59
  92. package/dist/daemon-Cl8KXGW4.mjs +0 -1523
@@ -1,6 +1,6 @@
1
- import { i as avatarSourceFor, n as attachAvatar, p as provisionFromMarverId } from "./auth-DdUKeVKt.mjs";
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-wv2QWdxB.mjs";
3
+ import { t as poweredByUrl } from "./serve-C8rVheYk.mjs";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { isIP } from "node:net";
6
6
  import { lookup } from "node:dns/promises";
@@ -419,10 +419,10 @@ function marverIdHandler(dir, issuer, canvasName, branding = true, ceilings = {}
419
419
  console.warn(`[marver-id] ${result.identity.email} is not on this canvas's list`);
420
420
  let request;
421
421
  try {
422
- const { shareState, provisionVerdict } = await import("./auth-DdUKeVKt.mjs").then((n) => n.R);
422
+ const { shareState, provisionVerdict } = await import("./auth-Dix8wrXV.mjs").then((n) => n.R);
423
423
  const share = shareState(dir);
424
424
  if (!(share ? provisionVerdict(share, result.identity.email) === "blocked" : false)) {
425
- const { signCanvasJws } = await import("./summary-CrW88e3q.mjs");
425
+ const { signCanvasJws } = await import("./summary-Y8MY1Wuc.mjs");
426
426
  const now = Math.floor(Date.now() / 1e3);
427
427
  request = signCanvasJws(dir, {
428
428
  aud: origin,
@@ -1,4 +1,4 @@
1
- import { r as readReloads } from "./perf-CCisg-ny.mjs";
1
+ import { r as readReloads } from "./perf-DPbLGhhO.mjs";
2
2
  //#region src/cli/perf.ts
3
3
  /**
4
4
  * `marver perf` (spec 26 Part 1): the reload log read back - per edited file, the frames it reached
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { a as checkRealDirs } from "./boards-CGg6piKF.mjs";
3
3
  import { appendFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
@@ -1,17 +1,17 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
2
  import { a as ROUTE, i as PKG, r as NAME } from "./cli.mjs";
3
3
  import { c as nodeExists, d as readMembership, f as readRegistry, h as hash, i as checkBoardsDir, l as parseBoard, m as withRegistryLock, o as isRegularFile, r as boardFields, s as listBoardFiles, t as AUTHOR_FIELDS, u as pinFrames } from "./boards-CGg6piKF.mjs";
4
4
  import { A as settableStatuses, D as readStatusWord, E as readReason, O as readType, T as readCapability, _ as wireKids, a as buildTree, c as folderMap, g as validateWire, h as readTitle, k as resolveType, m as readDescription, n as BOARD_NAME, r as FOLDERS_FILE, t as ALL_SCENES, x as HAS_STATUS } from "./board-tree-DRioF94d.mjs";
5
- import { c as setSceneTitle, d as annotateBoards, f as planNames, m as readContextFacts, n as isNoteFile, o as rendersDoc, p as planWithStage, r as layoutDocSource, s as scanFrames, t as affectedFrameIds, u as writeManifest } from "./manifest-DnAte_fB.mjs";
6
- import { r as boardsChanged } from "./work-GE88wb_3.mjs";
7
- import { n as localProfile, t as isConnected } from "./profile-Do0nGkXO.mjs";
8
- import { n as loadConfig } from "./config-cKgZBRj0.mjs";
9
- import { a as observe, n as docRevs, r as initMarks, s as recordChanged, t as docRev } from "./marks-koRsbHfe.mjs";
10
- import { t as logReload } from "./perf-CCisg-ny.mjs";
5
+ import { c as setSceneTitle, d as annotateBoards, f as planNames, m as readContextFacts, n as isNoteFile, o as rendersDoc, p as planWithStage, r as layoutDocSource, s as scanFrames, t as affectedFrameIds, u as writeManifest } from "./manifest-Nl3KSVOk.mjs";
6
+ import { r as boardsChanged } from "./work-F5u-twpJ.mjs";
7
+ import { n as localProfile, t as isConnected } from "./profile-WU9qcbIo.mjs";
8
+ import { n as loadConfig } from "./config-Cf7EjAMf.mjs";
9
+ import { a as observe, n as docRevs, r as initMarks, s as recordChanged, t as docRev } from "./marks-CKgzucHZ.mjs";
10
+ import { t as logReload } from "./perf-DPbLGhhO.mjs";
11
11
  import { closeSync, copyFileSync, existsSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, watch, writeFileSync } from "node:fs";
12
12
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
13
13
  import { fileURLToPath } from "node:url";
14
- import { randomBytes } from "node:crypto";
14
+ import { createHash, randomBytes } from "node:crypto";
15
15
  //#region src/shared/frames.ts
16
16
  /** A canvas made of content frames alone (Doc, Md, Diagram ship their own styling) needs no theme -
17
17
  * only an app frame does (#4). Empty counts as not content-only: the warning still helps there. */
@@ -286,13 +286,13 @@ function json(res, status, body) {
286
286
  res.setHeader("content-type", "application/json");
287
287
  res.end(JSON.stringify(body));
288
288
  }
289
- function readBody(req) {
289
+ function readBody(req, limit = BODY_LIMIT) {
290
290
  return new Promise((done) => {
291
291
  let size = 0;
292
292
  const chunks = [];
293
293
  req.on("data", (c) => {
294
294
  size += c.length;
295
- if (size > BODY_LIMIT) {
295
+ if (size > limit) {
296
296
  done(null);
297
297
  req.destroy();
298
298
  } else chunks.push(c);
@@ -607,7 +607,7 @@ function apiMiddleware(root, opts = {}) {
607
607
  const str = (v) => typeof v === "string" ? v.slice(0, 200) : void 0;
608
608
  const num = (v) => typeof v === "number" && Number.isFinite(v) ? Math.round(v) : void 0;
609
609
  if (!str(b?.kind)) return json(res, 400, { error: "kind required" });
610
- (await import("./perf-CCisg-ny.mjs").then((n) => n.n)).logReload(root, {
610
+ (await import("./perf-DPbLGhhO.mjs").then((n) => n.n)).logReload(root, {
611
611
  kind: str(b.kind),
612
612
  tab: str(b.tab),
613
613
  node: str(b.node),
@@ -1009,7 +1009,7 @@ function apiMiddleware(root, opts = {}) {
1009
1009
  }
1010
1010
  }
1011
1011
  if (path === "shot" && req.method === "GET") {
1012
- const { readDevInfo } = await import("./work-GE88wb_3.mjs").then((n) => n.o);
1012
+ const { readDevInfo } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
1013
1013
  const token = readDevInfo(root)?.token;
1014
1014
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
1015
1015
  const frameId = url.searchParams.get("frame") ?? "";
@@ -1025,7 +1025,7 @@ function apiMiddleware(root, opts = {}) {
1025
1025
  };
1026
1026
  const asPng = url.searchParams.get("format") === "png";
1027
1027
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
1028
- const { shootFrame } = await import("./shot-CckrGW-J.mjs");
1028
+ const { shootFrame } = await import("./shot-DqcxJibP.mjs");
1029
1029
  const r = await shootFrame({
1030
1030
  root,
1031
1031
  viewports: opts.viewports ?? {},
@@ -1058,7 +1058,7 @@ function apiMiddleware(root, opts = {}) {
1058
1058
  return res.end(png);
1059
1059
  }
1060
1060
  if (path === "shots" && req.method === "POST") {
1061
- const { readDevInfo } = await import("./work-GE88wb_3.mjs").then((n) => n.o);
1061
+ const { readDevInfo } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
1062
1062
  const token = readDevInfo(root)?.token;
1063
1063
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
1064
1064
  const raw = await readBody(req);
@@ -1075,7 +1075,7 @@ function apiMiddleware(root, opts = {}) {
1075
1075
  if (typeof theme !== "string" || !/^[a-z0-9-]+$/i.test(theme)) return json(res, 400, { error: "invalid theme" });
1076
1076
  const scale = body.scale === void 0 ? void 0 : body.scale;
1077
1077
  if (scale !== void 0 && !(Number.isInteger(scale) && scale >= 1 && scale <= 4)) return json(res, 400, { error: "invalid scale" });
1078
- const { resolveFrames, shootBatch } = await import("./shot-CckrGW-J.mjs");
1078
+ const { resolveFrames, shootBatch } = await import("./shot-DqcxJibP.mjs");
1079
1079
  const sel = resolveFrames(root, body);
1080
1080
  if (!sel.ok) return json(res, sel.status, { error: sel.error });
1081
1081
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
@@ -1093,7 +1093,7 @@ function apiMiddleware(root, opts = {}) {
1093
1093
  }
1094
1094
  }
1095
1095
  if (path === "anchor" && req.method === "POST") {
1096
- const { readDevInfo } = await import("./work-GE88wb_3.mjs").then((n) => n.o);
1096
+ const { readDevInfo } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
1097
1097
  const token = readDevInfo(root)?.token;
1098
1098
  if (!ownerGated(req) && !(token && req.headers["x-mv-work"] === token)) return json(res, 403, { error: "forbidden" });
1099
1099
  const raw = await readBody(req);
@@ -1104,12 +1104,12 @@ function apiMiddleware(root, opts = {}) {
1104
1104
  } catch {
1105
1105
  return json(res, 400, { error: "malformed JSON" });
1106
1106
  }
1107
- const { readTarget } = await import("./anchor-DVV732zR.mjs");
1107
+ const { readTarget } = await import("./anchor-5H1vnoLu.mjs").then((n) => n.t);
1108
1108
  const target = readTarget(b ?? {});
1109
1109
  if (typeof target === "string") return json(res, 400, { error: target });
1110
1110
  const others = Array.isArray(b.others) ? b.others.filter((o) => typeof o?.key === "string").slice(0, 200) : [];
1111
1111
  const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
1112
- const { checkAnchor, CheckInputError } = await import("./anchor-check-BE5VVN6Q.mjs");
1112
+ const { checkAnchor, CheckInputError } = await import("./anchor-check-Dg5xpNnU.mjs");
1113
1113
  try {
1114
1114
  return json(res, 200, await checkAnchor({
1115
1115
  root,
@@ -1137,7 +1137,7 @@ function apiMiddleware(root, opts = {}) {
1137
1137
  return json(res, 400, { error: "malformed JSON" });
1138
1138
  }
1139
1139
  if (!body || typeof body !== "object" || !Array.isArray(body.asks) || !body.asks.length || body.asks.length > 200) return json(res, 400, { error: "asks must list 1-200 frames" });
1140
- const { bakeBatch, ASK_MAX } = await import("./bake-D8byeRzB.mjs");
1140
+ const { bakeBatch, ASK_MAX } = await import("./bake-DtVlm0_F.mjs");
1141
1141
  let manifest = {};
1142
1142
  try {
1143
1143
  manifest = JSON.parse(readFileSync(join(root, "design", "manifest.json"), "utf8"));
@@ -1158,7 +1158,7 @@ function apiMiddleware(root, opts = {}) {
1158
1158
  });
1159
1159
  docs.push(typeof a?.doc === "string" ? a.doc : void 0);
1160
1160
  }
1161
- const { docRev } = await import("./marks-koRsbHfe.mjs").then((n) => n.i);
1161
+ const { docRev } = await import("./marks-CKgzucHZ.mjs").then((n) => n.i);
1162
1162
  const all = devManifest().frames;
1163
1163
  const pending = opts.settled ? !opts.settled() : false;
1164
1164
  const behind = docs.map((d, i) => d !== void 0 && (pending || d !== docRev(root, all, asks[i].frame)));
@@ -1178,7 +1178,8 @@ function apiMiddleware(root, opts = {}) {
1178
1178
  const f = frames.get(ask.frame);
1179
1179
  return f.kind === "html" ? `${origin}/${f.file}?theme=${encodeURIComponent(ask.theme)}` : `${origin}${ROUTE}/frame/?id=${encodeURIComponent(ask.frame)}&theme=${encodeURIComponent(ask.theme)}`;
1180
1180
  },
1181
- urlBase: `${ROUTE}/bakes`
1181
+ urlBase: `${ROUTE}/bakes`,
1182
+ waitMs: 2500
1182
1183
  });
1183
1184
  const after = docs.map((d, i) => d !== void 0 && (!!opts.settled && !opts.settled() || d !== docRev(root, devManifest().frames, asks[i].frame)));
1184
1185
  let k = 0;
@@ -1200,8 +1201,8 @@ function apiMiddleware(root, opts = {}) {
1200
1201
  if (path === "poster" && req.method === "GET") {
1201
1202
  if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1202
1203
  const src = url.searchParams.get("src") ?? "";
1203
- const { ensurePoster, isLocalClip } = await import("./poster-D0cbV7hi.mjs");
1204
- const { isLocalAssetRef } = await import("./build-BHoWLvSj.mjs");
1204
+ const { ensurePoster, isLocalClip } = await import("./poster-ChjXGTS5.mjs");
1205
+ const { isLocalAssetRef } = await import("./build-C_gUgcdC.mjs");
1205
1206
  if (!isLocalAssetRef(src) || !isLocalClip(src)) return json(res, 400, { error: "src must be a clip under design/assets/" });
1206
1207
  const r = await ensurePoster(join(root, "design", "assets"), src);
1207
1208
  if (!r.ok) return json(res, r.error.includes("does not exist") ? 404 : 503, { error: r.error });
@@ -1228,7 +1229,7 @@ function apiMiddleware(root, opts = {}) {
1228
1229
  }
1229
1230
  const dir = join(root, "design", ".local");
1230
1231
  mkdirSync(dir, { recursive: true });
1231
- const { validAvatar } = await import("./collab-gqNdScUE.mjs");
1232
+ const { validAvatar } = await import("./collab-Dxg2trOK.mjs");
1232
1233
  let cur = {};
1233
1234
  try {
1234
1235
  cur = JSON.parse(readFileSync(join(dir, "profile.json"), "utf8"));
@@ -1244,7 +1245,7 @@ function apiMiddleware(root, opts = {}) {
1244
1245
  }
1245
1246
  if (path === "marks" || path === "marks/seen") {
1246
1247
  if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1247
- const { readMarks, markSeen } = await import("./marks-koRsbHfe.mjs").then((n) => n.i);
1248
+ const { readMarks, markSeen } = await import("./marks-CKgzucHZ.mjs").then((n) => n.i);
1248
1249
  const manifest = devManifest();
1249
1250
  if (path === "marks" && req.method === "GET") return json(res, 200, readMarks(root, manifest));
1250
1251
  if (path === "marks/seen" && req.method === "POST") {
@@ -1264,14 +1265,14 @@ function apiMiddleware(root, opts = {}) {
1264
1265
  return json(res, 405, { error: "method not allowed" });
1265
1266
  }
1266
1267
  if (path === "work") {
1267
- const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-GE88wb_3.mjs").then((n) => n.o);
1268
+ const { workActivity, readDevInfo, WORK_TTL_DEFAULT, WORK_TTL_MAX } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
1268
1269
  const tokenOk = () => {
1269
1270
  const t = readDevInfo(root)?.token;
1270
1271
  return !!t && req.headers["x-mv-work"] === t;
1271
1272
  };
1272
1273
  if (req.method === "GET") {
1273
1274
  if (!ownerGated(req) && !tokenOk()) return json(res, 403, { error: "forbidden" });
1274
- const { boardsShowing, activityClock } = await import("./work-GE88wb_3.mjs").then((n) => n.o);
1275
+ const { boardsShowing, activityClock } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
1275
1276
  const frames = workActivity.active();
1276
1277
  return json(res, 200, {
1277
1278
  frames,
@@ -1294,17 +1295,27 @@ function apiMiddleware(root, opts = {}) {
1294
1295
  if (!on && b.all === true) {
1295
1296
  const done = workActivity.active().filter((f) => workActivity.has(f, "cli"));
1296
1297
  if (done.length) {
1297
- (await import("./marks-koRsbHfe.mjs").then((n) => n.i)).recordChanged(root, devFrames(), done, { doc: false });
1298
+ (await import("./marks-CKgzucHZ.mjs").then((n) => n.i)).recordChanged(root, devFrames(), done, { doc: false });
1298
1299
  opts.notify?.("sh:marks");
1299
1300
  }
1300
1301
  workActivity.clearAll("cli");
1302
+ (await import("./reserve-BURNQ2Y3.mjs")).saveHolds(root, workActivity);
1301
1303
  return json(res, 200, { frames: workActivity.active() });
1302
1304
  }
1303
1305
  if (!frames.length) return json(res, 400, { error: "frames required" });
1304
1306
  const ttl = Math.min(Math.max(Number(b.ttlMs) || WORK_TTL_DEFAULT, 1e4), WORK_TTL_MAX);
1307
+ const { refuseHold, saveHolds } = await import("./reserve-BURNQ2Y3.mjs");
1308
+ if (on) {
1309
+ const refused = frames.map((f) => refuseHold(f, workActivity.has(f, "cli"))).find(Boolean);
1310
+ if (refused) return json(res, 409, {
1311
+ error: refused,
1312
+ frames: workActivity.active()
1313
+ });
1314
+ }
1305
1315
  for (const f of frames) on ? workActivity.mark(f, ttl, "cli") : workActivity.clear(f, "cli");
1316
+ saveHolds(root, workActivity);
1306
1317
  if (!on) {
1307
- (await import("./marks-koRsbHfe.mjs").then((n) => n.i)).recordChanged(root, devFrames(), frames, { doc: false });
1318
+ (await import("./marks-CKgzucHZ.mjs").then((n) => n.i)).recordChanged(root, devFrames(), frames, { doc: false });
1308
1319
  opts.notify?.("sh:marks");
1309
1320
  return json(res, 200, { frames: workActivity.active() });
1310
1321
  }
@@ -1338,8 +1349,231 @@ function apiMiddleware(root, opts = {}) {
1338
1349
  });
1339
1350
  }
1340
1351
  }
1352
+ if (path === "jam/queue" && req.method === "GET") {
1353
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1354
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1355
+ return json(res, 200, jamLive.view?.() ?? {
1356
+ agent: null,
1357
+ cards: []
1358
+ });
1359
+ }
1360
+ if (path === "jam/card" && req.method === "POST") {
1361
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1362
+ const raw = await readBody(req);
1363
+ if (raw == null) return json(res, 400, { error: "body too large" });
1364
+ let b;
1365
+ try {
1366
+ b = JSON.parse(raw);
1367
+ } catch {
1368
+ return json(res, 400, { error: "malformed JSON" });
1369
+ }
1370
+ const { ACTIONS } = await import("./queue-BuiCKSX1.mjs");
1371
+ if (!b || typeof b.id !== "string" || !Number.isInteger(b.rev) || !ACTIONS.includes(b.action) || b.body !== void 0 && typeof b.body !== "string") return json(res, 400, { error: "expected { id, rev, action, body? }" });
1372
+ if ("kind" in b) return json(res, 400, { error: "a capture has no category" });
1373
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1374
+ if (!jamLive.act) return json(res, 409, { error: "jam is not running here" });
1375
+ const r = await jamLive.act(b.id, b.rev, b.action, b.body);
1376
+ return json(res, r.ok ? 200 : 409, r);
1377
+ }
1378
+ if (path === "jam/audio-ticket" && req.method === "POST") {
1379
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1380
+ const { issueTicket, speechLive } = await import("./audio-CmSRYFEs.mjs");
1381
+ if (!speechLive.svc) return json(res, 409, { error: "jam is not running here" });
1382
+ return json(res, 200, { ticket: issueTicket() });
1383
+ }
1384
+ if (path === "jam/voice" && (req.method === "GET" || req.method === "POST")) {
1385
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1386
+ const { speechLive } = await import("./audio-CmSRYFEs.mjs");
1387
+ const { downloadModels, downloadState, DOWNLOAD_MB } = await import("./speech-models-DomiLQcY.mjs");
1388
+ if (!speechLive.svc) return json(res, 409, { error: "jam is not running here" });
1389
+ if (req.method === "POST") {
1390
+ const raw = await readBody(req);
1391
+ if (raw == null) return json(res, 400, { error: "body too large" });
1392
+ let b;
1393
+ try {
1394
+ b = JSON.parse(raw);
1395
+ } catch {
1396
+ return json(res, 400, { error: "malformed JSON" });
1397
+ }
1398
+ if (b?.retry === true) speechLive.svc.retry();
1399
+ else if (b?.download === true) downloadModels();
1400
+ else return json(res, 400, { error: "expected { download: true } or { retry: true }" });
1401
+ }
1402
+ return json(res, 200, {
1403
+ ...await speechLive.svc.state(),
1404
+ download: downloadState(),
1405
+ mb: DOWNLOAD_MB,
1406
+ busy: speechLive.svc.busy()
1407
+ });
1408
+ }
1409
+ if (path === "jam/session" && (req.method === "GET" || req.method === "POST")) {
1410
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1411
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1412
+ if (!jamLive.session || !jamLive.view) return json(res, 409, { error: "jam is not running here" });
1413
+ if (req.method === "GET") {
1414
+ const ses = jamLive.view().session ?? null;
1415
+ const { readTalk, talkMinutes, recordFile } = await import("./session-qZWKt_VA.mjs").then((n) => n.s);
1416
+ const folder = ses ? recordFile(root, ses.since, ses.id).replace(/[^/]+$/, "") : null;
1417
+ return json(res, 200, {
1418
+ session: ses,
1419
+ talkMinutes: ses ? talkMinutes(readTalk(root, ses.id)) : 0,
1420
+ tags: ses ? jamLive.tags?.(ses.id) ?? 0 : 0,
1421
+ folder
1422
+ });
1423
+ }
1424
+ const raw = await readBody(req);
1425
+ if (raw == null) return json(res, 400, { error: "body too large" });
1426
+ let b;
1427
+ try {
1428
+ b = JSON.parse(raw);
1429
+ } catch {
1430
+ return json(res, 400, { error: "malformed JSON" });
1431
+ }
1432
+ if (!b || typeof b.id !== "string" || ![
1433
+ "start",
1434
+ "end",
1435
+ "wrapup"
1436
+ ].includes(b.action)) return json(res, 400, { error: "expected { action, id }" });
1437
+ if (b.action === "wrapup" && (typeof b.instructions !== "string" || typeof b.board !== "string")) return json(res, 400, { error: "expected { instructions, board }" });
1438
+ if (b.action === "wrapup") {
1439
+ const why = jamLive.canWrap?.(b.id);
1440
+ if (why) return json(res, 409, {
1441
+ ok: false,
1442
+ error: why
1443
+ });
1444
+ }
1445
+ if (b.action !== "start") {
1446
+ const { speechLive } = await import("./audio-CmSRYFEs.mjs");
1447
+ if (!await (speechLive.svc?.finishTalk(b.id) ?? Promise.resolve(true)).catch(() => false) && b.action === "wrapup" && b.includeTalk !== false) return json(res, 409, {
1448
+ ok: false,
1449
+ error: "what was said is still being written down - write the record again in a moment (or leave what was said out)"
1450
+ });
1451
+ }
1452
+ const r = await jamLive.session(b.action === "wrapup" ? {
1453
+ action: "wrapup",
1454
+ id: b.id,
1455
+ instructions: b.instructions,
1456
+ includeTalk: b.includeTalk !== false,
1457
+ tags: Number(b.tags) || 0,
1458
+ board: b.board
1459
+ } : {
1460
+ action: b.action,
1461
+ id: b.id
1462
+ });
1463
+ return json(res, r.ok ? 200 : 409, r);
1464
+ }
1465
+ if (path === "jam/capture-open" && req.method === "POST") {
1466
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1467
+ const raw = await readBody(req);
1468
+ let b;
1469
+ try {
1470
+ b = JSON.parse(raw ?? "");
1471
+ } catch {
1472
+ return json(res, 400, { error: "malformed JSON" });
1473
+ }
1474
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1475
+ if (!jamLive.captureOpen) return json(res, 409, { error: "jam is not running here" });
1476
+ if (typeof b?.capture !== "string" || typeof b?.session !== "string") return json(res, 400, { error: "expected { capture, session, on }" });
1477
+ return jamLive.captureOpen(b.capture, b.session, b.on === true) === "ended" ? json(res, 409, {
1478
+ ok: false,
1479
+ ended: true,
1480
+ error: "the session has ended"
1481
+ }) : json(res, 200, { ok: true });
1482
+ }
1483
+ if (path === "jam/record" && req.method === "GET") {
1484
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1485
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1486
+ const r = jamLive.record?.(url.searchParams.get("id") ?? "");
1487
+ return r ? json(res, 200, r) : json(res, 404, { error: "no such record" });
1488
+ }
1489
+ if (path === "jam/capture" && req.method === "POST") {
1490
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1491
+ const raw = await readBody(req, 4e6);
1492
+ if (raw == null) return json(res, 400, { error: "body too large" });
1493
+ let b;
1494
+ try {
1495
+ b = JSON.parse(raw);
1496
+ } catch {
1497
+ return json(res, 400, { error: "malformed JSON" });
1498
+ }
1499
+ const { createHash } = await import("node:crypto");
1500
+ if (b?.workspace !== void 0 && b.workspace !== createHash("sha256").update(root).digest("hex").slice(0, 16)) return json(res, 409, { error: "this capture was made in another workspace" });
1501
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1502
+ if (!jamLive.capture) return json(res, 409, { error: "jam is not running here" });
1503
+ const r = await jamLive.capture(b?.record);
1504
+ return json(res, r.ok ? 200 : 400, r);
1505
+ }
1506
+ if (path === "jam/capture" && req.method === "GET") {
1507
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1508
+ const { readCapture } = await import("./capture-CrqvU_jh.mjs").then((n) => n.i);
1509
+ const id = url.searchParams.get("id") ?? "";
1510
+ const cap = readCapture(root, id);
1511
+ if (!cap) return json(res, 404, { error: "no such capture" });
1512
+ const { jamLive } = await import("./live-Cgzsicwi.mjs");
1513
+ const card = jamLive.view?.().cards.find((c) => c.id === id);
1514
+ return json(res, 200, {
1515
+ record: cap.record,
1516
+ ...card?.edited !== void 0 ? { edited: card.edited } : {},
1517
+ pictures: cap.record.pictures,
1518
+ sealed: jamLive.sealed?.(id) ?? false
1519
+ });
1520
+ }
1521
+ if (path === "jam/picture" && req.method === "POST") {
1522
+ if (!ownerGated(req)) return json(res, 403, { error: "forbidden" });
1523
+ const raw = await readBody(req);
1524
+ if (raw == null) return json(res, 400, { error: "body too large" });
1525
+ let b;
1526
+ try {
1527
+ b = JSON.parse(raw);
1528
+ } catch {
1529
+ return json(res, 400, { error: "malformed JSON" });
1530
+ }
1531
+ const { CAPTURE_ID, readCapture, addPicture, sweepPictures } = await import("./capture-CrqvU_jh.mjs").then((n) => n.i);
1532
+ if (!b || typeof b.capture !== "string" || !CAPTURE_ID.test(b.capture) || typeof b.frame !== "string") return json(res, 400, { error: "expected { capture, frame, theme?, viewport? }" });
1533
+ if (readCapture(root, b.capture)) return json(res, 409, { error: "that capture is sealed" });
1534
+ const theme = typeof b.theme === "string" && /^[a-z0-9-]+$/i.test(b.theme) ? b.theme : "light";
1535
+ const { shootFrame } = await import("./shot-DqcxJibP.mjs");
1536
+ const origin = opts.origin?.() ?? `http://${req.headers.host ?? "localhost"}`;
1537
+ const vp = typeof b.viewport === "string" ? opts.viewports?.[b.viewport] : void 0;
1538
+ const dim = (v) => typeof v === "number" && Number.isFinite(v) ? Math.round(v) : void 0;
1539
+ const size = dim(b.w) ? {
1540
+ w: dim(b.w),
1541
+ h: dim(b.h)
1542
+ } : vp ? {
1543
+ w: vp.width,
1544
+ h: vp.height
1545
+ } : void 0;
1546
+ const r = await shootFrame({
1547
+ root,
1548
+ viewports: opts.viewports ?? {},
1549
+ frameId: b.frame,
1550
+ theme,
1551
+ origin,
1552
+ ...size ? { size } : {}
1553
+ });
1554
+ if (!r.ok) return json(res, r.error.startsWith("unknown frame") ? 404 : 503, { error: r.error });
1555
+ sweepPictures(root);
1556
+ return json(res, 200, { id: addPicture(root, r.path, {
1557
+ frame: b.frame,
1558
+ capture: b.capture
1559
+ }) });
1560
+ }
1561
+ if (path === "jam/picture" && req.method === "GET") {
1562
+ const site = String(req.headers["sec-fetch-site"] ?? "");
1563
+ if (!ownerGated(req) && !(cookie(req, "mv_c") && (site === "same-origin" || site === "none"))) return json(res, 403, { error: "forbidden" });
1564
+ const { picturePath } = await import("./capture-CrqvU_jh.mjs").then((n) => n.i);
1565
+ const p = picturePath(root, url.searchParams.get("id") ?? "");
1566
+ if (!p) return json(res, 404, { error: "no such picture" });
1567
+ const png = readFileSync(p.path);
1568
+ res.writeHead(200, {
1569
+ "content-type": "image/png",
1570
+ "content-length": png.length,
1571
+ "cache-control": "no-store"
1572
+ });
1573
+ return res.end(png);
1574
+ }
1341
1575
  if (path === "boards.rights" && req.method === "GET") {
1342
- const { listBoards } = await import("./comments-Zoch254k.mjs").then((n) => n.n);
1576
+ const { listBoards } = await import("./comments-0BSbb04K.mjs").then((n) => n.n);
1343
1577
  return json(res, 200, {
1344
1578
  local: true,
1345
1579
  stored: listBoards(join(root, "design", "comments"))
@@ -1347,7 +1581,7 @@ function apiMiddleware(root, opts = {}) {
1347
1581
  }
1348
1582
  const cm = /^comments\/([a-z0-9][a-z0-9-]*)$/.exec(path);
1349
1583
  if (cm) {
1350
- const { appendEvents, readLog } = await import("./comments-Zoch254k.mjs").then((n) => n.n);
1584
+ const { appendEvents, readLog } = await import("./comments-0BSbb04K.mjs").then((n) => n.n);
1351
1585
  const dir = join(root, "design", "comments");
1352
1586
  if (req.method === "GET") return json(res, 200, { events: readLog(dir, cm[1]) });
1353
1587
  if (req.method === "POST") {
@@ -1376,14 +1610,15 @@ function apiMiddleware(root, opts = {}) {
1376
1610
  };
1377
1611
  });
1378
1612
  const fresh = appendEvents(dir, cm[1], stamped);
1379
- const { record } = await import("./ledger-BNXW14Xw.mjs");
1380
- for (const ev of fresh) if (ev.type === "create" || ev.type === "reply") record(root, cm[1], ev.id);
1613
+ const { record } = await import("./ledger-D54iROST.mjs").then((n) => n.n);
1614
+ for (const ev of fresh) if (ev.type === "create" || ev.type === "reply" || ev.type === "edit") record(root, cm[1], ev.id);
1615
+ (await import("./live-Cgzsicwi.mjs")).jamLive.poke?.();
1381
1616
  backgroundPush(root);
1382
1617
  return json(res, 200, { accepted: fresh.length });
1383
1618
  }
1384
1619
  }
1385
1620
  if (path === "sync" && req.method === "POST") {
1386
- const { loadCollab, syncOnce } = await import("./sync-C3035OnJ.mjs").then((n) => n.o);
1621
+ const { loadCollab, syncOnce } = await import("./sync-DKk-yT1V.mjs").then((n) => n.o);
1387
1622
  const collab = loadCollab(root);
1388
1623
  if (!collab) return json(res, 200, { connected: false });
1389
1624
  try {
@@ -1412,7 +1647,7 @@ function backgroundPush(root) {
1412
1647
  pushTimer = setTimeout(async () => {
1413
1648
  pushTimer = null;
1414
1649
  try {
1415
- const { loadCollab, syncOnce } = await import("./sync-C3035OnJ.mjs").then((n) => n.o);
1650
+ const { loadCollab, syncOnce } = await import("./sync-DKk-yT1V.mjs").then((n) => n.o);
1416
1651
  const collab = loadCollab(root);
1417
1652
  if (collab) await syncOnce(root, collab);
1418
1653
  } catch {}
@@ -1717,7 +1952,13 @@ function marverPlugin(ctx) {
1717
1952
  noTheme: themeFile() == null,
1718
1953
  setup: setupPending,
1719
1954
  projectName: config.share.name || basename(root),
1720
- branding: config.share.branding
1955
+ branding: config.share.branding,
1956
+ jam: config.jam ? {
1957
+ chime: config.jam.chime,
1958
+ capture: config.jam.capture,
1959
+ names: config.jam.names && config.jam.agent === "claude"
1960
+ } : null,
1961
+ workspace: createHash("sha256").update(root).digest("hex").slice(0, 16)
1721
1962
  })}`;
1722
1963
  }
1723
1964
  if (id === "\0virtual:sh-data") return "export default null";
@@ -1858,7 +2099,7 @@ function marverPlugin(ctx) {
1858
2099
  };
1859
2100
  const prune = () => setTimeout(async () => {
1860
2101
  try {
1861
- (await import("./bake-D8byeRzB.mjs")).pruneBakes(root, bakeGen);
2102
+ (await import("./bake-DtVlm0_F.mjs")).pruneBakes(root, bakeGen);
1862
2103
  } catch {}
1863
2104
  }, 500);
1864
2105
  prune();
@@ -2038,7 +2279,7 @@ function marverPlugin(ctx) {
2038
2279
  });
2039
2280
  return;
2040
2281
  }
2041
- const { shootFrame, shootBatch, resolveFrames } = await import("./shot-CckrGW-J.mjs");
2282
+ const { shootFrame, shootBatch, resolveFrames } = await import("./shot-DqcxJibP.mjs");
2042
2283
  if (ways[0] === "frame") {
2043
2284
  if (typeof spec.frame !== "string") {
2044
2285
  write({
@@ -1,4 +1,4 @@
1
- import { capture, t as findChrome } from "./shot-CckrGW-J.mjs";
1
+ import { capture, t as findChrome } from "./shot-DqcxJibP.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-C3035OnJ.mjs";
1
+ import { i as loadCollab } from "./sync-DKk-yT1V.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 { planShot, t as findChrome } from "./shot-CckrGW-J.mjs";
3
- import { ASK_MAX, bakeBatch } from "./bake-D8byeRzB.mjs";
4
- import { MIME } from "./serve-wv2QWdxB.mjs";
2
+ import { planShot, t as findChrome } from "./shot-DqcxJibP.mjs";
3
+ import { ASK_MAX, bakeBatch } from "./bake-DtVlm0_F.mjs";
4
+ import { MIME } from "./serve-C8rVheYk.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";