@marver-design/marver 0.24.0 → 0.25.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 (80) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +1 -1
  3. package/dist/anchor-DVV732zR.mjs +33 -0
  4. package/dist/anchor-check-BE5VVN6Q.mjs +135 -0
  5. package/dist/{bake-ZhXq-X9f.mjs → bake-D8byeRzB.mjs} +1 -1
  6. package/dist/{boards-BRLnoTC3.mjs → board-tree-DRioF94d.mjs} +21 -277
  7. package/dist/boards-CGg6piKF.mjs +342 -0
  8. package/dist/{boards-Dv-Ipd8G.mjs → boards-Csxj2WJn.mjs} +23 -9
  9. package/dist/{build-ckcinlWH.mjs → build-BHoWLvSj.mjs} +63 -37
  10. package/dist/cli.mjs +31 -17
  11. package/dist/{collab-mAiNZlDj.mjs → collab-gqNdScUE.mjs} +39 -9
  12. package/dist/{comments-DZyobpxG.mjs → comments-Zoch254k.mjs} +19 -1
  13. package/dist/{comments-Dx1hCVOT.mjs → comments-pTLlhjh4.mjs} +150 -20
  14. package/dist/{config-BUKprFAp.mjs → config-cKgZBRj0.mjs} +1 -1
  15. package/dist/{context-BncTXjLB.mjs → context-D2ugHqwO.mjs} +17 -123
  16. package/dist/{daemon-CQv73-jM.mjs → daemon-Cl8KXGW4.mjs} +146 -64
  17. package/dist/{dev-gv4NS6Fk.mjs → dev-DJdgow47.mjs} +23 -11
  18. package/dist/{events-B3LBn74P.mjs → events-DnK_AnrW.mjs} +13 -15
  19. package/dist/imports-WBSnnHLb.mjs +143 -0
  20. package/dist/{init--3Moc4J7.mjs → init-DO4DhUt_.mjs} +28 -6
  21. package/dist/link-C-qUIuKU.mjs +160 -0
  22. package/dist/{board-status-BZSzc9Hp.mjs → manifest-DnAte_fB.mjs} +537 -13
  23. package/dist/marks-DFuintmJ.mjs +50 -0
  24. package/dist/marks-koRsbHfe.mjs +397 -0
  25. package/dist/{marver-id-gate-B_idGdHm.mjs → marver-id-gate-DGANtVyC.mjs} +2 -2
  26. package/dist/perf-CCisg-ny.mjs +49 -0
  27. package/dist/perf-QJIWtTw1.mjs +68 -0
  28. package/dist/{plugin-Sa08E7wO.mjs → plugin-CTyhjwoJ.mjs} +424 -207
  29. package/dist/{poster-B2QPvKOq.mjs → poster-D0cbV7hi.mjs} +1 -1
  30. package/dist/{profile-CrZohD6g.mjs → profile-Do0nGkXO.mjs} +1 -1
  31. package/dist/{publish-bakes-BJR3huhu.mjs → publish-bakes--l8ot2eQ.mjs} +9 -9
  32. package/dist/{serve-z5qtj_wJ.mjs → serve-wv2QWdxB.mjs} +6 -6
  33. package/dist/{share-BD-wcDQq.mjs → share-ScamJcks.mjs} +1 -1
  34. package/dist/{shot-Cw96h5Kk.mjs → shot-CckrGW-J.mjs} +19 -11
  35. package/dist/{shot-Dh6fV1Lm.mjs → shot-jdO_B6Qw.mjs} +1 -1
  36. package/dist/{summary-C7CAypbB.mjs → summary-CrW88e3q.mjs} +1 -1
  37. package/dist/{sync-DoA1vf4u.mjs → sync-C3035OnJ.mjs} +18 -8
  38. package/dist/{work-CBUfsOOT.mjs → work-CpJn1gwY.mjs} +8 -4
  39. package/dist/{work-ayuL_9Kk.mjs → work-GE88wb_3.mjs} +4 -4
  40. package/docs/boards-and-folders.md +62 -21
  41. package/docs/live-jam.md +10 -5
  42. package/package.json +1 -1
  43. package/src/client/frame-host/bridge.js +2 -1
  44. package/src/client/frame-host/inspect.js +195 -84
  45. package/src/client/frame-host/main.tsx +7 -2
  46. package/src/client/frame-host/registry.ts +5 -5
  47. package/src/client/shell/App.tsx +66 -22
  48. package/src/client/shell/BoardList.tsx +54 -11
  49. package/src/client/shell/Comments.tsx +79 -34
  50. package/src/client/shell/ContextMenu.tsx +5 -2
  51. package/src/client/shell/LockedApp.tsx +45 -12
  52. package/src/client/shell/Play.tsx +35 -34
  53. package/src/client/shell/Toolbar.tsx +3 -1
  54. package/src/client/shell/canvas/Canvas.tsx +1 -1
  55. package/src/client/shell/canvas/FrameNode.tsx +10 -5
  56. package/src/client/shell/canvas/sleep.ts +4 -3
  57. package/src/client/shell/canvas/updates.ts +55 -0
  58. package/src/client/shell/comments-store.ts +48 -19
  59. package/src/client/shell/goto.ts +11 -14
  60. package/src/client/shell/hash.ts +12 -5
  61. package/src/client/shell/icons.tsx +1 -2
  62. package/src/client/shell/legacy-links.ts +67 -0
  63. package/src/client/shell/marks-ui.tsx +17 -19
  64. package/src/client/shell/pin-layout.ts +37 -0
  65. package/src/client/shell/store.ts +312 -92
  66. package/src/client/shell/styles.css +10 -8
  67. package/src/client/stage/main.tsx +19 -2
  68. package/src/shared/anchor.ts +57 -0
  69. package/src/shared/board-tree.ts +27 -10
  70. package/src/shared/events.ts +19 -10
  71. package/src/shared/marks.ts +17 -12
  72. package/templates/AGENTS-embedded.md +34 -15
  73. package/templates/AGENTS-studio.md +34 -15
  74. package/templates/instructions/boards.md +9 -5
  75. package/templates/instructions/iterate.md +20 -10
  76. package/templates/instructions/jam.md +13 -4
  77. package/templates/instructions/publish.md +2 -1
  78. package/templates/instructions/reference/deck-story.md +2 -2
  79. package/dist/link-vXjxMHTG.mjs +0 -132
  80. package/dist/manifest-cyG3kbhk.mjs +0 -528
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--3Moc4J7.mjs");
85
+ const { init } = await import("./init-DO4DhUt_.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>", "Port (default 5199)").action(async (opts) => {
93
- const { dev } = await import("./dev-gv4NS6Fk.mjs");
93
+ const { dev } = await import("./dev-DJdgow47.mjs");
94
94
  let port;
95
95
  if (opts.port !== void 0) {
96
96
  const n = Number(opts.port);
@@ -100,7 +100,7 @@ for (const [name, desc] of [["dev", "Start the local canvas (everything on: hot
100
100
  await dev(resolve$1(opts.root), port);
101
101
  });
102
102
  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) => {
103
- const { buildSite } = await import("./build-ckcinlWH.mjs");
103
+ const { buildSite } = await import("./build-BHoWLvSj.mjs");
104
104
  try {
105
105
  const boards = opts.boards === void 0 ? void 0 : typeof opts.boards === "string" ? opts.boards : "";
106
106
  await buildSite(resolve$1(opts.root), boards, opts.allBoards === true, opts.embedSeeds === true, opts.textures !== false && !process.env.MARVER_NO_TEXTURES);
@@ -110,7 +110,7 @@ cli.command("build", "Static export → design/.dist (what ships comes from desi
110
110
  }
111
111
  });
112
112
  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) => {
113
- const { serve } = await import("./serve-z5qtj_wJ.mjs");
113
+ const { serve } = await import("./serve-wv2QWdxB.mjs");
114
114
  let port;
115
115
  if (opts.port !== void 0) {
116
116
  const n = Number(opts.port);
@@ -118,8 +118,8 @@ cli.command("serve", "Serve design/.dist (set MARVER_PASSWORD to gate it)").opti
118
118
  }
119
119
  serve(resolve$1(opts.root), port);
120
120
  });
121
- cli.command("comments <action> [value]", "Comment collaboration: connect <url> · sync · list · new <scene/frame> · reply <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: pin on the element showing this text (default: the frame, top right)").option("--addressed-in <frame>", "resolve: the variant frame that answered the feedback").action(async (action, value, opts) => {
122
- const { commentsCommand } = await import("./comments-Dx1hCVOT.mjs");
121
+ 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) => {
122
+ const { commentsCommand } = await import("./comments-pTLlhjh4.mjs");
123
123
  try {
124
124
  await commentsCommand(resolve$1(opts.root), action, value, opts);
125
125
  } catch (err) {
@@ -128,7 +128,7 @@ cli.command("comments <action> [value]", "Comment collaboration: connect <url>
128
128
  }
129
129
  });
130
130
  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) => {
131
- const { shareCommand } = await import("./share-BD-wcDQq.mjs");
131
+ const { shareCommand } = await import("./share-ScamJcks.mjs");
132
132
  try {
133
133
  await shareCommand(resolve$1(opts.root), action, value, opts);
134
134
  } catch (err) {
@@ -137,7 +137,7 @@ cli.command("share <action> [value]", "Sharing roster (owner): add <who> · remo
137
137
  }
138
138
  });
139
139
  cli.command("work <action> [...frames]", "Working state on the canvas: start <scene/frame ...> · done <scene/frame ...> | --all · list").option("--root <dir>", "Host repo root", { default: "." }).option("--ttl <minutes>", "start: minutes before the glow self-expires (default 10, max 30)").option("--all", "done: clear every working frame").action(async (action, frames, opts) => {
140
- const { workCommand } = await import("./work-CBUfsOOT.mjs");
140
+ const { workCommand } = await import("./work-CpJn1gwY.mjs");
141
141
  try {
142
142
  await workCommand(resolve$1(opts.root), action, frames ?? [], opts);
143
143
  } catch (err) {
@@ -145,8 +145,8 @@ cli.command("work <action> [...frames]", "Working state on the canvas: start <sc
145
145
  process.exit(1);
146
146
  }
147
147
  });
148
- cli.command("link [...targets]", "The canvas link that lands on frames: link <scene/frame | scene ...> - their board, in canvas mode, selected and fitted").option("--root <dir>", "Host repo root", { default: "." }).option("--board <board>", "The board to open (default: the first board that shows them all, else all-scenes)").action(async (targets, opts) => {
149
- const { linkCommand } = await import("./link-vXjxMHTG.mjs");
148
+ cli.command("link [...targets]", "The canvas link that lands on frames: link <scene/frame | scene ...> - their board, in canvas mode, selected and fitted").option("--root <dir>", "Host repo root", { default: "." }).option("--board <board>", "The board to open (default: the first board that shows them all, else one link per board)").action(async (targets, opts) => {
149
+ const { linkCommand } = await import("./link-C-qUIuKU.mjs");
150
150
  try {
151
151
  await linkCommand(resolve$1(opts.root), targets ?? [], opts);
152
152
  } catch (err) {
@@ -154,24 +154,30 @@ cli.command("link [...targets]", "The canvas link that lands on frames: link <sc
154
154
  process.exit(1);
155
155
  }
156
156
  });
157
- cli.command("boards [action] [name]", "The sidebar as files: every folder and board in reading order, with types and statuses · new <name>: a board in its type's starting layout").option("--root <dir>", "Host repo root", { default: "." }).option("--json", "The tree as JSON ({ tree, boards, landing, registry })").option("--type <type>", "new: start | feature | surface | project | feedback | context | deck | archive (default: the folder's)").option("--folder <folder>", "new: the folder it sits in").option("--title <title>", "new: what humans see").option("--description <sentence>", "new: what agents read").option("--capability <slug>", "new: the capability it shows, when not its own name").action(async (action, name, opts) => {
158
- const { boardsCommand, boardsNew } = await import("./boards-Dv-Ipd8G.mjs");
157
+ cli.command("boards [action] [...args]", "The sidebar as files: every folder and board in reading order, with types and statuses, and the frames on no board · new <name>: a board in its type's starting layout · pin <board> <scene/frame ...>: put frames on a board").option("--root <dir>", "Host repo root", { default: "." }).option("--json", "The tree as JSON ({ tree, boards, landing, unplaced, registry })").option("--type <type>", "new: start | feature | surface | project | feedback | context | deck | archive (default: the folder's)").option("--folder <folder>", "new: the folder it sits in").option("--title <title>", "new: what humans see").option("--description <sentence>", "new: what agents read").option("--capability <slug>", "new: the capability it shows, when not its own name").action(async (action, args, opts) => {
158
+ const { boardsCommand, boardsNew, boardsPin } = await import("./boards-Csxj2WJn.mjs");
159
+ const [name, ...frames] = args ?? [];
159
160
  try {
160
161
  if (action === void 0) boardsCommand(resolve$1(opts.root), opts);
161
- else if (action === "new") {
162
+ else if (action === "pin") {
163
+ if (!name) throw new Error("name the board: `boards pin <board> <scene/frame ...>`");
164
+ const { added, already } = boardsPin(resolve$1(opts.root), name, frames);
165
+ for (const f of added) console.log(` + ${f} on ${name}`);
166
+ if (already.length) console.log(` already on ${name}: ${already.join(", ")}`);
167
+ } else if (action === "new") {
162
168
  if (!name) throw new Error("name the board: `boards new <name>`");
163
169
  const made = boardsNew(resolve$1(opts.root), name, opts);
164
170
  for (const c of made) console.log(` + ${c}`);
165
171
  if (/\((feature|project)\b/.test(made[0] ?? "") && !existsSync(join(resolve$1(opts.root), "context"))) console.log(`\n note: no context/ yet - this board's status reads Backlog until there is one. Agent: end your reply with the context line in design/AGENTS.md ("Before the method").`);
166
172
  if (made.some((c) => c.endsWith("/_brief.md")) && !made.some((c) => /\.(tsx|jsx|html)$/.test(c))) console.log(`\n next: a frame you make in these scenes shows on the board once it is pinned - a node in\n design/boards/${name}.json (an agent does this as it works: design/AGENTS.md)`);
167
- } else throw new Error(`unknown action "${action}" - \`boards\` lists, \`boards new <name>\` creates`);
173
+ } else throw new Error(`unknown action "${action}" - \`boards\` lists, \`boards new <name>\` creates, \`boards pin <board> <scene/frame ...>\` puts frames on a board`);
168
174
  } catch (err) {
169
175
  console.error(`[${NAME}] ${err.message}`);
170
176
  process.exit(1);
171
177
  }
172
178
  });
173
179
  cli.command("folders <action> [...modules]", "The shared sidebar's typed folders · add <start|features|surfaces|projects|feedback|context|decks|archive ...>").option("--root <dir>", "Host repo root", { default: "." }).action(async (action, modules, opts) => {
174
- const { foldersAdd } = await import("./boards-Dv-Ipd8G.mjs");
180
+ const { foldersAdd } = await import("./boards-Csxj2WJn.mjs");
175
181
  try {
176
182
  if (action !== "add") throw new Error(`unknown action "${action}" - \`folders add <module ...>\``);
177
183
  const { added, existing } = foldersAdd(resolve$1(opts.root), modules);
@@ -183,7 +189,7 @@ cli.command("folders <action> [...modules]", "The shared sidebar's typed folders
183
189
  }
184
190
  });
185
191
  cli.command("context <action>", "The project's context/ (spec 19) · init: create it · check: keep it true (exit 0 pass, 1 fail, 2 cannot determine) · index: regenerate the index's capability table").option("--root <dir>", "Host repo root", { default: "." }).option("--base <ref>", "check: the pull request's base - a change to a contracted capability's code must change its contract or say why (in ci, read from the event)").option("--head <ref>", "check: the pull request's head (default HEAD)").option("--body-file <file>", "check: the pull request's body, for `no-contract-change: <capability> - <why>`").option("--json", "check: the findings as JSON ({ exit, failures, unsure, notes })").option("--kind <kind>", "init: product (a shipped record) or knowledge (a delivered record)", { default: "product" }).action(async (action, opts) => {
186
- const ctx = await import("./context-BncTXjLB.mjs");
192
+ const ctx = await import("./context-D2ugHqwO.mjs");
187
193
  const root = resolve$1(opts.root);
188
194
  try {
189
195
  if (action === "init") {
@@ -218,8 +224,16 @@ cli.command("context <action>", "The project's context/ (spec 19) · init: creat
218
224
  process.exit(1);
219
225
  }
220
226
  });
227
+ cli.command("marks", "What the human has not reviewed: frames waiting on them (the ones that ask first) and frames new since they looked").option("--root <dir>", "Host repo root", { default: "." }).option("--json", "Machine-readable output").action(async (opts) => {
228
+ const { marksCommand } = await import("./marks-DFuintmJ.mjs");
229
+ marksCommand(resolve$1(opts.root), opts);
230
+ });
231
+ cli.command("perf", "The reload log: what each edit reloaded, page-wide reloads, the slowest frames to settle").option("--root <dir>", "Host repo root", { default: "." }).option("--minutes <n>", "How far back to read (default 60)").option("--json", "Machine-readable output").action(async (opts) => {
232
+ const { perfCommand } = await import("./perf-QJIWtTw1.mjs");
233
+ perfCommand(resolve$1(opts.root), opts);
234
+ });
221
235
  cli.command("shot [...frames]", "Render frames headless and print the PNG paths (needs `dev` running): ids, --scene <name> or --all").option("--root <dir>", "Host repo root", { default: "." }).option("--scene <name>", "Every frame of one scene").option("--all", "Every frame of the canvas").option("--theme <name>", "Theme to render (default: light)").option("--scale <n>", "Device pixels per CSS px, 1-4 (default: 2; 4 for print-quality stills)").option("--json", "Print the results as JSON ({ results: [...] }) instead of paths").action(async (frames, opts) => {
222
- const { shotCommand } = await import("./shot-Dh6fV1Lm.mjs");
236
+ const { shotCommand } = await import("./shot-jdO_B6Qw.mjs");
223
237
  try {
224
238
  await shotCommand(resolve$1(opts.root), frames, opts);
225
239
  } catch (err) {
@@ -1,6 +1,7 @@
1
- import { i as readLog, r as listBoards, t as appendEvents } from "./comments-DZyobpxG.mjs";
1
+ import { t as ALL_SCENES } from "./board-tree-DRioF94d.mjs";
2
+ import { a as readLog, i as listBoards, r as legacyExposure, t as appendEvents } from "./comments-Zoch254k.mjs";
2
3
  import { A as reconfirmGrant, C as commentAllowed, D as operativeMode, E as loadShare, F as setBlocked, I as setGeneralMode, L as shareState, M as resolveAccess, N as resolveRequest, O as provisionVerdict, P as rosterEtag, S as ceilingsFromRights, T as loadRequests, _ as sessionUser, a as claimInvite, b as updateProfile, c as issueDeviceSession, d as opaqueId, f as ownerName, g as sessionIsOperator, h as revokeUser, j as removeGrant, k as putRequest, l as loadStore, m as publicUser, o as createInvite, s as inviteInfo, u as normEmail, v as signIn, w as entryAllowed, y as signOut, z as upsertGrant } from "./auth-DdUKeVKt.mjs";
3
- import { canvasIdentity, deriveThreads, loadSeen, markSeen, signCanvasJws, unreadCount, verifyCanvasJws } from "./summary-C7CAypbB.mjs";
4
+ import { canvasIdentity, deriveThreads, loadSeen, markSeen, signCanvasJws, unreadCount, verifyCanvasJws } from "./summary-CrW88e3q.mjs";
4
5
  import { t as secureSuffix } from "./secure-cookie-_K1Hsx8H.mjs";
5
6
  import { readFileSync } from "node:fs";
6
7
  import { join } from "node:path";
@@ -233,6 +234,11 @@ function validateEvents(incoming, log, u, board, opts = {}) {
233
234
  if (ev.body !== void 0 && (typeof ev.body !== "string" || ev.body.length > MAX_BODY_TEXT)) return "body too long";
234
235
  if ((ev.type === "create" || ev.type === "reply") && !ev.body?.trim()) return "a comment needs a body";
235
236
  if (badMentions(ev, !!opts.operator)) return "invalid mentions";
237
+ if (ev.asks !== void 0 && (typeof ev.asks !== "boolean" || ![
238
+ "create",
239
+ "reply",
240
+ "edit"
241
+ ].includes(ev.type))) return "asks is a flag on a comment";
236
242
  if ((ev.type === "create" || ev.type === "reply" || ev.type === "react" || ev.type === "edit" || ev.type === "reanchor" || ev.type === "profile") && ev.author?.email?.toLowerCase() !== me) return "event author must be the signed-in account";
237
243
  if (typeof ev.commentId !== "string" || !ID_RE.test(ev.commentId)) {
238
244
  if (ev.type !== "profile") return "event needs a commentId";
@@ -279,6 +285,8 @@ function collabHandler(dataDir, distDir) {
279
285
  rights = meta.rights ?? {};
280
286
  } catch {}
281
287
  const commentsDir = join(dataDir, "comments");
288
+ const shows = meta.shows ?? null;
289
+ const isLegacy = (board) => board === "all-scenes" && !!shows;
282
290
  const idIssuer = (process.env.MARVER_ID_ISSUER ?? "").trim() || null;
283
291
  const publicOrigin = (process.env.MARVER_PUBLIC_ORIGIN ?? "").trim() || null;
284
292
  const appOrigin = (process.env.MARVER_APP_ORIGIN ?? "").trim() || "https://app.marver.design";
@@ -399,7 +407,9 @@ function collabHandler(dataDir, distDir) {
399
407
  if (email) map.set(opaqueId(dataDir, email), normEmail(email));
400
408
  };
401
409
  for (const usr of loadStore(dataDir).users) add(usr.email);
402
- for (const st of threads.values()) for (const ev of st.events) {
410
+ const old = shows ? readLog(commentsDir, ALL_SCENES) : [];
411
+ const exposed = shows ? legacyExposure(old, rights, shows) : () => [];
412
+ for (const ev of [...[...threads.values()].flatMap((st) => st.events), ...old.filter((e) => exposed(e).length)]) {
403
413
  add(ev.author?.email);
404
414
  for (const mn of ev.mentions ?? []) add(mn.email);
405
415
  }
@@ -817,16 +827,26 @@ function collabHandler(dataDir, distDir) {
817
827
  }
818
828
  if (path === "boards") {
819
829
  const name = ownerName(dataDir);
830
+ const legacy = shows ? {
831
+ board: ALL_SCENES,
832
+ frames: [...new Set(Object.keys(rights).filter((b) => rights[b] === "comment").flatMap((b) => shows[b] ?? []))]
833
+ } : null;
820
834
  return json(res, 200, {
821
835
  rights,
822
836
  stored: listBoards(commentsDir),
837
+ ...legacy ? { legacy } : {},
823
838
  ...name ? { owner: { name } } : {}
824
839
  }), true;
825
840
  }
826
841
  const m = /^comments\/([a-z0-9][a-z0-9-]*)$/.exec(path);
827
842
  if (m) {
828
- if (!can(currentUser(req), rights, m[1], "read")) return json(res, 404, { error: "no such board" }), true;
829
- const events = readLog(commentsDir, m[1]);
843
+ const legacy = isLegacy(m[1]);
844
+ if (!legacy && !can(currentUser(req), rights, m[1], "read")) return json(res, 404, { error: "no such board" }), true;
845
+ let events = readLog(commentsDir, m[1]);
846
+ if (legacy) {
847
+ const exposed = legacyExposure(events, rights, shows);
848
+ events = events.filter((e) => exposed(e).length);
849
+ }
830
850
  return json(res, 200, { events: rawTransport(req) ? events : events.map(project) }), true;
831
851
  }
832
852
  if (path === "invite-info") {
@@ -928,12 +948,22 @@ function collabHandler(dataDir, distDir) {
928
948
  const m = /^comments\/([a-z0-9][a-z0-9-]*)$/.exec(path);
929
949
  if (m) {
930
950
  const u = currentUser(req);
931
- if (!can(u, rights, m[1], "comment", dataDir)) return json(res, u ? 403 : 401, { error: u ? `this board is read-only - ask ${ownerName(dataDir) ?? "the canvas owner"} for commenting access` : "sign in to comment" }), true;
951
+ const legacy = isLegacy(m[1]);
952
+ if (legacy ? !u : !can(u, rights, m[1], "comment", dataDir)) return json(res, u ? 403 : 401, { error: u ? `this board is read-only - ask ${ownerName(dataDir) ?? "the canvas owner"} for commenting access` : "sign in to comment" }), true;
932
953
  const b = await readBody(req);
933
954
  const incoming = Array.isArray(b.events) ? b.events : [];
934
955
  if (incoming.length > 100) return json(res, 400, { error: "too many events in one push" }), true;
935
956
  const operator = rawTransport(req);
936
- const bad = validateEvents(incoming, readLog(commentsDir, m[1]), u, m[1], { operator });
957
+ const log = readLog(commentsDir, m[1]);
958
+ if (legacy) {
959
+ const events = incoming.filter((e) => !!e && typeof e === "object");
960
+ const exposed = legacyExposure([...log, ...events], rights, shows);
961
+ for (const ev of events) {
962
+ if (ev.type === "create" && !operator) return json(res, 403, { error: "pin it on a board to comment - this is the old All Scenes log" }), true;
963
+ if (!exposed(ev).some((board) => can(u, rights, board, "comment", dataDir))) return json(res, 403, { error: `this thread is on no board you may comment on - ask ${ownerName(dataDir) ?? "the canvas owner"} for commenting access` }), true;
964
+ }
965
+ }
966
+ const bad = validateEvents(incoming, log, u, m[1], { operator });
937
967
  if (bad) return json(res, 400, { error: bad }), true;
938
968
  if (!operator && incoming.some((ev) => ev.mentions?.length)) {
939
969
  const targets = mentionTargets();
@@ -952,12 +982,12 @@ function collabHandler(dataDir, distDir) {
952
982
  }
953
983
  }
954
984
  const fresh = appendEvents(commentsDir, m[1], incoming);
955
- if (fresh.length) {
985
+ if (fresh.length && !legacy) {
956
986
  const st = threads.get(m[1]);
957
987
  threads.set(m[1], deriveThreads([...st?.events ?? [], ...fresh]));
958
988
  }
959
989
  broadcast(m[1], fresh.map(project));
960
- if (fresh.length) notifyCommentActivity(notifyCtx, m[1], fresh, threads.get(m[1])?.events ?? [], (email) => mailAllowed(m[1], email));
990
+ if (fresh.length) notifyCommentActivity(notifyCtx, m[1], fresh, legacy ? [...log, ...fresh] : threads.get(m[1])?.events ?? [], (email) => legacy ? Object.keys(rights).some((b) => mailAllowed(b, email)) : mailAllowed(m[1], email));
961
991
  return json(res, 200, { accepted: fresh.length }), true;
962
992
  }
963
993
  return false;
@@ -14,6 +14,7 @@ import { join } from "node:path";
14
14
  var comments_exports = /* @__PURE__ */ __exportAll({
15
15
  appendEvents: () => appendEvents,
16
16
  dataDir: () => dataDir,
17
+ legacyExposure: () => legacyExposure,
17
18
  listBoards: () => listBoards,
18
19
  readLog: () => readLog
19
20
  });
@@ -86,5 +87,22 @@ function dataDir() {
86
87
  mkdirSync(join(dir, "comments"), { recursive: true });
87
88
  return dir;
88
89
  }
90
+ /** The old all-scenes comment log (spec 26, Part 7) outlives its board: a thread there is exposed
91
+ * when some published board shows its frame - `shows`, each published board's frames, written by
92
+ * builds from 0.25 on. Answers, for any event in the log or arriving with it, the published boards
93
+ * showing its thread's frame (none = unexposed). A reply finds its thread by parentId; a resolve,
94
+ * an edit or a reaction through the comment it names. */
95
+ function legacyExposure(events, rights, shows) {
96
+ const boards = /* @__PURE__ */ new Map();
97
+ const rootOf = /* @__PURE__ */ new Map();
98
+ for (const e of events) {
99
+ if (e.type === "create" && e.commentId && !boards.has(e.commentId)) {
100
+ boards.set(e.commentId, Object.keys(rights).filter((b) => typeof e.frame === "string" && !!shows[b]?.includes(e.frame)));
101
+ rootOf.set(e.commentId, e.commentId);
102
+ }
103
+ if (e.type === "reply" && e.commentId && e.parentId && !rootOf.has(e.commentId)) rootOf.set(e.commentId, e.parentId);
104
+ }
105
+ return (e) => boards.get(rootOf.get((e.type === "reply" ? e.parentId : e.commentId) ?? "") ?? "") ?? [];
106
+ }
89
107
  //#endregion
90
- export { readLog as i, comments_exports as n, listBoards as r, appendEvents as t };
108
+ export { readLog as a, listBoards as i, comments_exports as n, legacyExposure as r, appendEvents as t };
@@ -1,9 +1,11 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { n as replay } from "./events-B3LBn74P.mjs";
3
- import { i as readLog, r as listBoards, t as appendEvents } from "./comments-DZyobpxG.mjs";
4
- import { a as syncOnce, i as loadCollab, n as connectClaim, r as connectToken, t as connect } from "./sync-DoA1vf4u.mjs";
5
- import { n as localProfile } from "./profile-CrZohD6g.mjs";
2
+ import { i as readDevInfo } from "./work-GE88wb_3.mjs";
3
+ import { r as replay } from "./events-DnK_AnrW.mjs";
4
+ import { a as readLog, i as listBoards, t as appendEvents } from "./comments-Zoch254k.mjs";
5
+ import { a as syncOnce, i as loadCollab, n as connectClaim, r as connectToken, t as connect } from "./sync-C3035OnJ.mjs";
6
+ import { n as localProfile } from "./profile-Do0nGkXO.mjs";
6
7
  import { a as runningAgent } from "./agent-BsieQGTD.mjs";
8
+ import { readTarget, uncheckedAnchor } from "./anchor-DVV732zR.mjs";
7
9
  import { join } from "node:path";
8
10
  import { randomUUID } from "node:crypto";
9
11
  import { createInterface } from "node:readline";
@@ -18,10 +20,14 @@ import { createInterface } from "node:readline";
18
20
  * has), --invite <t> to claim an invite, or email + password.
19
21
  * sync one full exchange with the publish target (agent/CI path)
20
22
  * list threads from design/comments/ (--open, --board, --json)
21
- * new <frame> pin a note on a frame (--body, --on "<text on screen>") - Marver's voice, the
22
- * owner's pill: what an agent leaves where it needs the human's eyes
23
+ * new <frame> pin a note on an element of a frame (--body, --on "<words it shows>" or --at
24
+ * "<selector or data-testid>") - Marver's voice, the owner's pill: what an agent
25
+ * leaves where it needs the human's eyes. Checked against the rendered frame when
26
+ * `dev` runs; it asks (--fyi: it does not). --thread <id> adds it to an open thread.
23
27
  * reply <thread> append a reply (--body) - the agent's voice in the loop: Marver's on a thread
24
- * started here, the owner's on a collaborator's (the voice that reaches them)
28
+ * started here, the owner's on a collaborator's (the voice that reaches them);
29
+ * --ask when the reply asks the human something
30
+ * move <thread> re-pin a thread on another element (--on / --at) - its author's only
25
31
  * resolve <thread> mark addressed (--addressed-in <frame> records WHICH variant)
26
32
  * invite <email> mint a single-use invite link (owner only, needs connect first)
27
33
  * revoke <email> revoke an account and its sessions (owner only)
@@ -116,20 +122,26 @@ async function commentsCommand(root, action, value, opts) {
116
122
  parentId: t.id,
117
123
  board: t.board,
118
124
  ...local ? marverAuthor(root) : { author: localAuthor(root) },
119
- body: plainDashes(String(opts.body))
125
+ body: plainDashes(String(opts.body)),
126
+ asks: !!opts.ask
120
127
  }]);
121
128
  if (!local) await pushIfConnected(root);
122
129
  console.log(local ? ` replied to ${t.id} as Marver` : ` replied to ${t.id} in your voice - ${t.author?.name ?? "its author"} sees it on the published canvas`);
123
130
  return;
124
131
  }
125
132
  case "new": {
126
- if (!value || !opts.body) throw new Error("usage: comments new <scene/frame> --body \"...\" [--on \"<text on screen>\"] [--board <board>]");
127
- const { resolveLink, devOrigin } = await import("./link-vXjxMHTG.mjs");
133
+ if (opts.thread !== void 0) return addToThread(root, String(opts.thread), value, opts);
134
+ if (!value || !opts.body) throw new Error("usage: comments new <scene/frame> --body \"...\" --on \"<words it shows>\" | --at \"<selector or data-testid>\" [--nth <n>] [--fyi] [--board <board>]");
135
+ const { resolveLink, devOrigin } = await import("./link-C-qUIuKU.mjs");
128
136
  const r = resolveLink(root, [value], opts.board);
129
137
  if (r.exact.length !== 1) throw new Error(`"${value}" is a folder of frames - pin a note on one frame: comments new <scene/frame>`);
138
+ if (!r.board) throw new Error(`a note needs a board to live on - ${r.hints.join("\n")}`);
139
+ const target = readTarget(opts);
140
+ if (typeof target === "string") throw new Error(`a note goes on an element - ${target}`);
130
141
  const frame = r.exact[0];
131
142
  const nodeKey = r.nodesOf(r.board).find((n) => n.frame === frame && typeof n.key === "string")?.key;
132
- const on = opts.on === void 0 ? "" : String(opts.on).replace(/\s+/g, " ").trim();
143
+ const open = allThreads(root).filter((t) => !t.resolved && t.frame === frame && !isNoteThread(t));
144
+ const { anchor, holders } = await pinOn(root, frame, target, opts, open);
133
145
  const threadId = randomUUID();
134
146
  appendEvents(join(root, "design", "comments"), r.board, [{
135
147
  id: randomUUID(),
@@ -139,18 +151,40 @@ async function commentsCommand(root, action, value, opts) {
139
151
  board: r.board,
140
152
  frame,
141
153
  ...nodeKey ? { nodeKey } : {},
142
- ...on ? { anchor: {
143
- el: { semantics: { quote: on.slice(0, 120) } },
144
- pos: {
145
- fx: 1,
146
- fy: .5
147
- }
148
- } } : {},
154
+ anchor,
149
155
  ...marverAuthor(root),
150
- body: plainDashes(String(opts.body))
156
+ body: plainDashes(String(opts.body)),
157
+ asks: !opts.fyi
151
158
  }]);
152
159
  const origin = await devOrigin(root);
153
160
  console.log(` pinned a note on ${frame} (board ${r.board})${origin ? `: ${origin}#/b/${r.board}?c=${threadId}` : ""}`);
161
+ for (const t of open.filter((t) => holders.includes(t.id))) {
162
+ const next = ownerThread(root, t) ? `comments new --thread ${t.id} --body "..."` : `comments reply ${t.id} --body "..."`;
163
+ console.log(` that element already holds thread ${t.id} (${t.agent ? "Marver" : t.author?.name ?? "someone"}: "${(t.body ?? "").slice(0, 60)}") - a follow-up on it is \`${NAME} ${next}\``);
164
+ }
165
+ return;
166
+ }
167
+ case "move": {
168
+ if (!value) throw new Error("usage: comments move <thread-id> --on \"<words it shows>\" | --at \"<selector or data-testid>\" [--nth <n>]");
169
+ const target = readTarget(opts);
170
+ if (typeof target === "string") throw new Error(target);
171
+ const t = allThreads(root).find((t) => t.id === value);
172
+ if (!t) throw new Error(`no thread ${value} in design/comments/`);
173
+ if (!t.frame || isNoteThread(t)) throw new Error(`thread ${value} is not pinned in a frame - move it on the canvas`);
174
+ if (!ownerThread(root, t)) throw new Error(`thread ${value} is ${t.author?.name ?? "a collaborator"}'s - only its author can move it`);
175
+ const others = allThreads(root).filter((o) => !o.resolved && o.frame === t.frame && o.id !== t.id && !isNoteThread(o));
176
+ const { anchor } = await pinOn(root, t.frame, target, opts, others);
177
+ appendEvents(join(root, "design", "comments"), t.board, [{
178
+ id: randomUUID(),
179
+ ts: Date.now(),
180
+ type: "reanchor",
181
+ commentId: t.id,
182
+ board: t.board,
183
+ anchor,
184
+ ...t.agent ? marverAuthor(root) : { author: localAuthor(root) }
185
+ }]);
186
+ if (!t.agent) await pushIfConnected(root);
187
+ console.log(` moved ${t.id} on ${t.frame}`);
154
188
  return;
155
189
  }
156
190
  case "resolve": {
@@ -189,9 +223,105 @@ async function commentsCommand(root, action, value, opts) {
189
223
  await ownerApi(root, "revoke", { email: value });
190
224
  console.log(` revoked ${value} - their sessions are dead`);
191
225
  return;
192
- default: throw new Error(`unknown action "${action}" - connect | sync | list | new | reply | resolve | invite | revoke`);
226
+ default: throw new Error(`unknown action "${action}" - connect | sync | list | new | reply | move | resolve | invite | revoke`);
193
227
  }
194
228
  }
229
+ /** `comments new --thread <id>`: one thread per topic - a follow-up joins the open thread, as
230
+ * Marver, and asks unless --fyi. A collaborator's thread is answered with `comments reply`, which
231
+ * keeps its voice and sync rules. */
232
+ const addToThread = (root, id, frame, opts) => {
233
+ if (!id || !opts.body) throw new Error("usage: comments new --thread <thread-id> --body \"...\" [--fyi]");
234
+ if (opts.on !== void 0 || opts.at !== void 0) throw new Error(`--thread adds to a thread already pinned - leave out --on/--at (\`${NAME} comments move\` re-pins it)`);
235
+ const t = allThreads(root).find((t) => t.id === id);
236
+ if (!t) throw new Error(`no thread ${id} in design/comments/`);
237
+ if (frame && frame !== t.frame) throw new Error(`thread ${id} is on ${t.frame}, not ${frame}`);
238
+ if (t.resolved) throw new Error(`thread ${id} is resolved - start a new note on its element instead`);
239
+ if (!ownerThread(root, t)) throw new Error(`thread ${id} is ${t.author?.name ?? "a collaborator"}'s - answer it with \`${NAME} comments reply ${id} --body "..."\``);
240
+ appendEvents(join(root, "design", "comments"), t.board, [{
241
+ id: randomUUID(),
242
+ ts: Date.now(),
243
+ type: "reply",
244
+ commentId: randomUUID(),
245
+ parentId: t.id,
246
+ board: t.board,
247
+ ...marverAuthor(root),
248
+ body: plainDashes(String(opts.body)),
249
+ asks: !opts.fyi
250
+ }]);
251
+ console.log(` added to ${t.id} on ${t.frame} as Marver`);
252
+ };
253
+ /** A thread pinned on a sticky note (spec 18), not in the frame document. */
254
+ const isNoteThread = (t) => !!t.anchor?.el?.note;
255
+ /** The anchor for a target: checked against the rendered frame when `dev` runs (the full element
256
+ * bundle, and which open threads already sit on that element), unchecked with a warning when the
257
+ * check cannot run, refused only when the frame rendered with no match or several. */
258
+ const pinOn = async (root, frame, target, opts, open) => {
259
+ const check = await askDev(root, frame, target, opts, open);
260
+ if (check.ok) {
261
+ console.log(` found it on ${frame} at ${check.viewport}, ${check.theme} theme`);
262
+ return {
263
+ anchor: check.anchor,
264
+ holders: check.holders
265
+ };
266
+ }
267
+ const named = target.on ? `"${target.on}"` : `--at "${target.at}"`;
268
+ if ("refused" in check && check.refused === "none") {
269
+ const shows = check.visible.length ? ` It shows:\n${check.visible.map((v) => ` ${v}`).join("\n")}\n ` : "";
270
+ throw new Error(`no visible element on ${frame} matches ${named} (checked at ${check.viewport}, ${check.theme} theme).${shows} Use words one of them shows (--on), --at for an element without words, or --viewport / --theme if only another one shows it.`);
271
+ }
272
+ if ("refused" in check) {
273
+ const past = target.nth ? ` (--nth ${target.nth} is past them)` : "";
274
+ throw new Error(`${named} matches ${check.matches.length} visible elements on ${frame}${past}:\n${check.matches.map((m, i) => ` ${i + 1}. ${m}`).join("\n")}\n add --nth <n> to pick one`);
275
+ }
276
+ console.error(` (not checked - ${check.unchecked}. Pinned as named; if it does not resolve on the canvas it shows in the frame's column, and \`${NAME} comments move\` fixes it)`);
277
+ const anchor = uncheckedAnchor(target);
278
+ const sameKey = (a) => a?.el?.semantics?.quote?.toLowerCase() ?? a?.el?.at;
279
+ return {
280
+ anchor,
281
+ holders: open.filter((t) => sameKey(t.anchor) === sameKey(anchor)).map((t) => t.id)
282
+ };
283
+ };
284
+ /** Ask the running dev server to find the target in the frame - within 20 s, else unchecked. */
285
+ const askDev = async (root, frame, target, opts, open) => {
286
+ const info = readDevInfo(root);
287
+ if (!info) return {
288
+ ok: false,
289
+ unchecked: `\`${NAME} dev\` is not running`
290
+ };
291
+ let res;
292
+ try {
293
+ res = await fetch(`http://localhost:${info.port}/__mv/api/anchor`, {
294
+ method: "POST",
295
+ headers: {
296
+ "x-mv-work": info.token,
297
+ "content-type": "application/json"
298
+ },
299
+ body: JSON.stringify({
300
+ frame,
301
+ ...target,
302
+ viewport: opts.viewport,
303
+ theme: opts.theme,
304
+ others: open.map((t) => ({
305
+ key: t.id,
306
+ anchor: t.anchor
307
+ }))
308
+ }),
309
+ signal: AbortSignal.timeout(2e4)
310
+ });
311
+ } catch (err) {
312
+ return {
313
+ ok: false,
314
+ unchecked: err.name === "TimeoutError" ? "the check passed its 20 s deadline" : `could not reach \`${NAME} dev\` on port ${info.port}`
315
+ };
316
+ }
317
+ const data = await res.json().catch(() => null);
318
+ if (res.status === 400 && data?.error) throw new Error(data.error);
319
+ if (!res.ok || !data) return {
320
+ ok: false,
321
+ unchecked: `the dev server answered ${res.status}`
322
+ };
323
+ return data;
324
+ };
195
325
  /** Owner-only account call against the connected canvas, via the device credential. */
196
326
  const ownerApi = async (root, path, body) => {
197
327
  const collab = loadCollab(root);
@@ -1,4 +1,4 @@
1
- import { b as readDescription } from "./boards-BRLnoTC3.mjs";
1
+ import { m as readDescription } from "./board-tree-DRioF94d.mjs";
2
2
  import { i as onPath, n as AGENT_NAMES, r as detectAgent, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { join } from "node:path";