@marver-design/marver 0.22.0 → 0.23.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 (61) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +13 -9
  3. package/dist/agent-BsieQGTD.mjs +99 -0
  4. package/dist/{bake-BSX4XR_U.mjs → bake-l6N12qgx.mjs} +1 -1
  5. package/dist/{board-status-CWGHIdo_.mjs → board-status-D_lHZZ09.mjs} +69 -610
  6. package/dist/{boards-BTGNPVMx.mjs → boards-CahYhF5B.mjs} +3 -1
  7. package/dist/boards-DbVJlbd5.mjs +612 -0
  8. package/dist/{build-Dd2Qm3OG.mjs → build-CuRhHXcY.mjs} +10 -6
  9. package/dist/cli.mjs +22 -12
  10. package/dist/{comments-ClVgfQib.mjs → comments-0d3e274b.mjs} +71 -9
  11. package/dist/{config-DJxMRVD8.mjs → config-g-J8NrPn.mjs} +5 -97
  12. package/dist/{context-DUAENlJ6.mjs → context-fAtQLHt2.mjs} +3 -2
  13. package/dist/{daemon-BmkwErpC.mjs → daemon-DZ367fiM.mjs} +75 -17
  14. package/dist/{dev-BW7a5kDF.mjs → dev-R6zvwbqX.mjs} +55 -9
  15. package/dist/{init-NJ3xjLVu.mjs → init-DAnBlt-V.mjs} +6 -4
  16. package/dist/{ledger-Bu0BjqIe.mjs → ledger-BNXW14Xw.mjs} +1 -6
  17. package/dist/link-CcfAfKY-.mjs +132 -0
  18. package/dist/{manifest-BqBcMJcd.mjs → manifest-BkjJ5OQk.mjs} +73 -5
  19. package/dist/{plugin-8XntSCx_.mjs → plugin-C1avHL7g.mjs} +357 -31
  20. package/dist/{poster-DRZDszTI.mjs → poster-Bc4-3DlQ.mjs} +1 -1
  21. package/dist/{profile-BjAPAJSb.mjs → profile-CrZohD6g.mjs} +1 -1
  22. package/dist/{publish-bakes-CCWRV9iX.mjs → publish-bakes-DQWn14IY.mjs} +2 -2
  23. package/dist/{share--bdSc4G5.mjs → share-BD-wcDQq.mjs} +1 -1
  24. package/dist/{shot-BFEuYbaz.mjs → shot-C1YR_Sqx.mjs} +1 -1
  25. package/dist/{shot-C22Ues04.mjs → shot-CVOlQHUr.mjs} +2 -2
  26. package/dist/{sync-BZaCWqK-.mjs → sync-DoA1vf4u.mjs} +15 -1
  27. package/dist/{work-0YopuMt9.mjs → work-CJ8OIpBD.mjs} +9 -3
  28. package/dist/{work-CLrmY-vQ.mjs → work-CiUvBVa6.mjs} +72 -1
  29. package/docs/boards-and-folders.md +54 -6
  30. package/docs/context.md +10 -2
  31. package/docs/live-jam.md +11 -0
  32. package/package.json +1 -1
  33. package/src/client/content/diagram.tsx +7 -1
  34. package/src/client/content/img-lod.ts +12 -2
  35. package/src/client/content/index.tsx +69 -6
  36. package/src/client/frame-host/inspect.js +23 -0
  37. package/src/client/shell/App.tsx +19 -9
  38. package/src/client/shell/BoardList.tsx +21 -6
  39. package/src/client/shell/LockedApp.tsx +2 -2
  40. package/src/client/shell/Play.tsx +5 -1
  41. package/src/client/shell/StatusPicker.tsx +12 -5
  42. package/src/client/shell/Tip.tsx +25 -5
  43. package/src/client/shell/board-icons.tsx +15 -1
  44. package/src/client/shell/canvas/Canvas.tsx +42 -6
  45. package/src/client/shell/canvas/anchor.ts +41 -0
  46. package/src/client/shell/canvas/ctl.ts +6 -0
  47. package/src/client/shell/comments-store.ts +8 -5
  48. package/src/client/shell/goto.ts +52 -3
  49. package/src/client/shell/hash.ts +24 -3
  50. package/src/client/shell/store.ts +242 -28
  51. package/src/client/shell/styles.css +19 -2
  52. package/src/shared/board-types.ts +10 -6
  53. package/src/shared/status.ts +17 -8
  54. package/templates/AGENTS-embedded.md +54 -8
  55. package/templates/AGENTS-studio.md +54 -8
  56. package/templates/instructions/boards.md +15 -3
  57. package/templates/instructions/context.md +20 -7
  58. package/templates/instructions/iterate.md +29 -16
  59. package/templates/instructions/jam.md +9 -2
  60. package/templates/instructions/reference/deck-layouts.md +2 -1
  61. package/templates/instructions/reference/deck-story.md +2 -1
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
3
3
  import { cac } from "cac";
4
- import { readFileSync, realpathSync } from "node:fs";
4
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  //#region src/client/const.ts
@@ -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-NJ3xjLVu.mjs");
85
+ const { init } = await import("./init-DAnBlt-V.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-BW7a5kDF.mjs");
93
+ const { dev } = await import("./dev-R6zvwbqX.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-Dd2Qm3OG.mjs");
103
+ const { buildSite } = await import("./build-CuRhHXcY.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);
@@ -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 · 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>", "scope to one board").option("--body <text>", "reply: the reply text").option("--addressed-in <frame>", "resolve: the variant frame that answered the feedback").action(async (action, value, opts) => {
122
- const { commentsCommand } = await import("./comments-ClVgfQib.mjs");
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-0d3e274b.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--bdSc4G5.mjs");
131
+ const { shareCommand } = await import("./share-BD-wcDQq.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-0YopuMt9.mjs");
140
+ const { workCommand } = await import("./work-CJ8OIpBD.mjs");
141
141
  try {
142
142
  await workCommand(resolve$1(opts.root), action, frames ?? [], opts);
143
143
  } catch (err) {
@@ -145,14 +145,24 @@ 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-CcfAfKY-.mjs");
150
+ try {
151
+ await linkCommand(resolve$1(opts.root), targets ?? [], opts);
152
+ } catch (err) {
153
+ console.error(`[${NAME}] ${err.message}`);
154
+ process.exit(1);
155
+ }
156
+ });
148
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) => {
149
- const { boardsCommand, boardsNew } = await import("./boards-BTGNPVMx.mjs");
158
+ const { boardsCommand, boardsNew } = await import("./boards-CahYhF5B.mjs");
150
159
  try {
151
160
  if (action === void 0) boardsCommand(resolve$1(opts.root), opts);
152
161
  else if (action === "new") {
153
162
  if (!name) throw new Error("name the board: `boards new <name>`");
154
163
  const made = boardsNew(resolve$1(opts.root), name, opts);
155
164
  for (const c of made) console.log(` + ${c}`);
165
+ 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").`);
156
166
  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)`);
157
167
  } else throw new Error(`unknown action "${action}" - \`boards\` lists, \`boards new <name>\` creates`);
158
168
  } catch (err) {
@@ -161,7 +171,7 @@ cli.command("boards [action] [name]", "The sidebar as files: every folder and bo
161
171
  }
162
172
  });
163
173
  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) => {
164
- const { foldersAdd } = await import("./boards-BTGNPVMx.mjs");
174
+ const { foldersAdd } = await import("./boards-CahYhF5B.mjs");
165
175
  try {
166
176
  if (action !== "add") throw new Error(`unknown action "${action}" - \`folders add <module ...>\``);
167
177
  const { added, existing } = foldersAdd(resolve$1(opts.root), modules);
@@ -173,7 +183,7 @@ cli.command("folders <action> [...modules]", "The shared sidebar's typed folders
173
183
  }
174
184
  });
175
185
  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) => {
176
- const ctx = await import("./context-DUAENlJ6.mjs");
186
+ const ctx = await import("./context-fAtQLHt2.mjs");
177
187
  const root = resolve$1(opts.root);
178
188
  try {
179
189
  if (action === "init") {
@@ -209,7 +219,7 @@ cli.command("context <action>", "The project's context/ (spec 19) · init: creat
209
219
  }
210
220
  });
211
221
  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) => {
212
- const { shotCommand } = await import("./shot-BFEuYbaz.mjs");
222
+ const { shotCommand } = await import("./shot-C1YR_Sqx.mjs");
213
223
  try {
214
224
  await shotCommand(resolve$1(opts.root), frames, opts);
215
225
  } catch (err) {
@@ -1,8 +1,9 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
2
  import { n as replay } from "./events-B3LBn74P.mjs";
3
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-BZaCWqK-.mjs";
5
- import { n as localProfile } from "./profile-BjAPAJSb.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";
6
+ import { a as runningAgent } from "./agent-BsieQGTD.mjs";
6
7
  import { join } from "node:path";
7
8
  import { randomUUID } from "node:crypto";
8
9
  import { createInterface } from "node:readline";
@@ -17,7 +18,10 @@ import { createInterface } from "node:readline";
17
18
  * has), --invite <t> to claim an invite, or email + password.
18
19
  * sync one full exchange with the publish target (agent/CI path)
19
20
  * list threads from design/comments/ (--open, --board, --json)
20
- * reply <thread> append a reply (--body) - the agent's voice in the loop
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
+ * 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)
21
25
  * resolve <thread> mark addressed (--addressed-in <frame> records WHICH variant)
22
26
  * invite <email> mint a single-use invite link (owner only, needs connect first)
23
27
  * revoke <email> revoke an account and its sessions (owner only)
@@ -95,7 +99,7 @@ async function commentsCommand(root, action, value, opts) {
95
99
  if (!threads.length) return void console.log(` no ${opts.open ? "open " : ""}comments`);
96
100
  for (const t of threads) {
97
101
  const anchor = t.frame ? ` on ${t.frame}` : "";
98
- console.log(` ${t.resolved ? "✓" : "○"} ${t.id}${anchor} - ${t.author?.name ?? "?"}: ${t.body ?? ""}${t.replies.length ? ` (+${t.replies.length})` : ""}${t.addressedIn ? ` → ${t.addressedIn}` : ""}`);
102
+ console.log(` ${t.resolved ? "✓" : "○"} ${t.id}${anchor} - ${t.agent ? "Marver" : t.author?.name ?? "?"}: ${t.body ?? ""}${t.replies.length ? ` (+${t.replies.length})` : ""}${t.addressedIn ? ` → ${t.addressedIn}` : ""}`);
99
103
  }
100
104
  return;
101
105
  }
@@ -103,17 +107,50 @@ async function commentsCommand(root, action, value, opts) {
103
107
  if (!value || !opts.body) throw new Error("usage: comments reply <thread-id> --body \"...\"");
104
108
  const t = allThreads(root).find((t) => t.id === value);
105
109
  if (!t) throw new Error(`no thread ${value} in design/comments/`);
110
+ const local = ownerThread(root, t);
106
111
  appendEvents(join(root, "design", "comments"), t.board, [{
107
112
  id: randomUUID(),
108
113
  ts: Date.now(),
109
114
  type: "reply",
110
115
  commentId: randomUUID(),
111
116
  parentId: t.id,
112
- author: localAuthor(root),
113
- body: String(opts.body)
117
+ board: t.board,
118
+ ...local ? marverAuthor(root) : { author: localAuthor(root) },
119
+ body: plainDashes(String(opts.body))
114
120
  }]);
115
- await pushIfConnected(root);
116
- console.log(` replied to ${t.id}`);
121
+ if (!local) await pushIfConnected(root);
122
+ 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
+ return;
124
+ }
125
+ 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-CcfAfKY-.mjs");
128
+ const r = resolveLink(root, [value], opts.board);
129
+ if (r.exact.length !== 1) throw new Error(`"${value}" is a folder of frames - pin a note on one frame: comments new <scene/frame>`);
130
+ const frame = r.exact[0];
131
+ 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();
133
+ const threadId = randomUUID();
134
+ appendEvents(join(root, "design", "comments"), r.board, [{
135
+ id: randomUUID(),
136
+ ts: Date.now(),
137
+ type: "create",
138
+ commentId: threadId,
139
+ board: r.board,
140
+ frame,
141
+ ...nodeKey ? { nodeKey } : {},
142
+ ...on ? { anchor: {
143
+ el: { semantics: { quote: on.slice(0, 120) } },
144
+ pos: {
145
+ fx: 1,
146
+ fy: .5
147
+ }
148
+ } } : {},
149
+ ...marverAuthor(root),
150
+ body: plainDashes(String(opts.body))
151
+ }]);
152
+ const origin = await devOrigin(root);
153
+ console.log(` pinned a note on ${frame} (board ${r.board})${origin ? `: ${origin}#/b/${r.board}?c=${threadId}` : ""}`);
117
154
  return;
118
155
  }
119
156
  case "resolve": {
@@ -152,7 +189,7 @@ async function commentsCommand(root, action, value, opts) {
152
189
  await ownerApi(root, "revoke", { email: value });
153
190
  console.log(` revoked ${value} - their sessions are dead`);
154
191
  return;
155
- default: throw new Error(`unknown action "${action}" - connect | sync | list | reply | resolve | invite | revoke`);
192
+ default: throw new Error(`unknown action "${action}" - connect | sync | list | new | reply | resolve | invite | revoke`);
156
193
  }
157
194
  }
158
195
  /** Owner-only account call against the connected canvas, via the device credential. */
@@ -175,6 +212,31 @@ const pushIfConnected = async (root) => {
175
212
  const collab = loadCollab(root);
176
213
  if (collab) await syncOnce(root, collab).catch((e) => console.log(` (push deferred: ${e.message})`));
177
214
  };
215
+ /** Did this thread start on this machine - by the owner, or by Marver? A thread a collaborator
216
+ * started carries their address; one with no address was written here before a profile existed. */
217
+ const ownerThread = (root, t) => {
218
+ if (t.agent) return true;
219
+ const theirs = t.author?.email?.toLowerCase();
220
+ const mine = localProfile(root).email?.toLowerCase();
221
+ return !theirs || !!mine && theirs === mine;
222
+ };
223
+ /** Marver's voice for CLI-born events, the way Live Jam writes it (daemon.ts): the owner's identity
224
+ * (attributable), `agent: true` (renders as Marver, raises the owner's pill, never triggers a jam
225
+ * job, never syncs), and the harness that ran the command when its marker says so. */
226
+ const marverAuthor = (root) => {
227
+ const me = localProfile(root);
228
+ const harness = runningAgent();
229
+ return {
230
+ author: me,
231
+ agent: true,
232
+ agentMeta: {
233
+ devUser: me.name,
234
+ ...harness ? { harness } : {}
235
+ }
236
+ };
237
+ };
238
+ /** House style: never an em/en dash in a reply - a plain dash reads human (as Live Jam). */
239
+ const plainDashes = (s) => s.replace(/\s*[—–]\s*/g, " - ");
178
240
  /** Author snapshot for CLI-born events: the connected account (the server validates
179
241
  * authors against the session - an authorless push would be rejected), else the
180
242
  * local dev profile. */
@@ -1,6 +1,7 @@
1
- import { U as readDescription } from "./board-status-CWGHIdo_.mjs";
2
- import { accessSync, constants, existsSync, readFileSync, statSync } from "node:fs";
3
- import { delimiter, isAbsolute, join } from "node:path";
1
+ import { y as readDescription } from "./boards-DbVJlbd5.mjs";
2
+ import { i as onPath, n as AGENT_NAMES, r as detectAgent, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { join } from "node:path";
4
5
  import { pathToFileURL } from "node:url";
5
6
  //#region src/server/detect.ts
6
7
  function readJson(file) {
@@ -124,99 +125,6 @@ function firstExisting(root, candidates) {
124
125
  return null;
125
126
  }
126
127
  //#endregion
127
- //#region src/server/jam/agent.ts
128
- /**
129
- * Which coding agent drives this repo.
130
- *
131
- * Live Jam is ON by default, so this is the answer to "on by default with WHAT" - asked
132
- * once by `init` (which writes the answer into design/config.ts, where it is visible and
133
- * editable) and again at every dev boot, so a workspace that predates the block - or a
134
- * human who switched tools - still jams without editing anything.
135
- *
136
- * The tool RUNNING us wins: `init` is usually run BY the agent, so its env markers are
137
- * evidence rather than a guess. Whatever wins must still be on PATH - the daemon has to
138
- * spawn it.
139
- */
140
- /** Ordered by preference when a machine has several installed and none is running us. */
141
- const AGENTS = [
142
- "claude",
143
- "codex",
144
- "cursor",
145
- "droid",
146
- "opencode",
147
- "grok",
148
- "pi"
149
- ];
150
- /** Env vars each CLI sets in the processes it spawns. Deliberately NOT CODEX_HOME or
151
- * ANTHROPIC_API_KEY: those are configuration a human exports by hand, not evidence that
152
- * the tool is running right now. (opencode's `AGENT=1` and pi's `AI_AGENT` are skipped
153
- * for the same reason in reverse - too generic to prove WHICH tool is running.)
154
- * droid and grok set no marker at all in the shells they spawn (verified against the
155
- * grok-build source and droid 0.200.0), so they are found by PATH order only. */
156
- const MARKERS = {
157
- claude: ["CLAUDECODE", "CLAUDE_CODE_ENTRYPOINT"],
158
- codex: ["CODEX_SANDBOX", "CODEX_THREAD_ID"],
159
- cursor: ["CURSOR_AGENT"],
160
- droid: [],
161
- opencode: ["OPENCODE", "OPENCODE_PID"],
162
- grok: [],
163
- pi: ["PI_CODING_AGENT", "PI_SESSION_ID"]
164
- };
165
- /** The executable each agent name maps to. Only cursor differs: its CLI installs BOTH
166
- * `cursor-agent` and a bare `agent` - and grok's installer symlinks `agent` too, so the
167
- * short name is a coin flip on a machine with both. The long name is unambiguous. */
168
- const AGENT_BIN = {
169
- claude: "claude",
170
- codex: "codex",
171
- cursor: "cursor-agent",
172
- droid: "droid",
173
- opencode: "opencode",
174
- grok: "grok",
175
- pi: "pi"
176
- };
177
- /** The valid `jam.agent` values as an English list - one string, so every surface
178
- * (config warning, init note, dev boot line) names the same set and none goes stale. */
179
- const AGENT_NAMES = `${AGENTS.slice(0, -1).map((a) => `"${a}"`).join(", ")}, or "${AGENTS[AGENTS.length - 1]}"`;
180
- /** Is `cmd` an executable FILE on PATH? A direct stat per PATH entry - no spawn, no shell,
181
- * so this is safe to call on every dev boot. Two deliberate narrowings, both in service of
182
- * "found means spawnable", because arming an agent that cannot run is worse than staying off:
183
- *
184
- * - `isFile`, because a directory carries the execute bit too (it means "traversable"), so an
185
- * access check alone would call a folder named `claude` an agent.
186
- * - the bare name only, no PATHEXT: the daemon spawns without a shell, and Node cannot run a
187
- * Windows `.cmd`/`.bat` shim that way. Finding one would arm a job that fails on every run.
188
- *
189
- * Only ABSOLUTE PATH entries count. An empty entry means the current directory on POSIX, and
190
- * a relative one (`.`, `bin`) resolves against it too - and the current directory is the repo
191
- * that was just opened, so a `claude` binary shipped inside it is precisely what must never
192
- * be found and spawned. */
193
- function onPath(cmd, env = process.env) {
194
- for (const dir of (env.PATH ?? "").split(delimiter)) {
195
- if (!isAbsolute(dir)) continue;
196
- try {
197
- const file = join(dir, cmd);
198
- if (statSync(file).isFile()) {
199
- accessSync(file, constants.X_OK);
200
- return true;
201
- }
202
- } catch {}
203
- }
204
- return false;
205
- }
206
- /** The agent to jam with, or undefined when this machine has none installed.
207
- *
208
- * One knowingly-imperfect case: agents nest, and env is inherited, so a codex run started
209
- * FROM Claude Code carries both marker families and this picks claude. Env has no depth to
210
- * read, and walking the process tree to find the nearest agent ancestor costs more than the
211
- * case is worth - so the answer is made visible instead of clever: `init` prints the agent
212
- * it chose and writes it into design/config.ts, and instructions/jam.md has the agent confirm
213
- * that line names the tool it actually is. One word to correct, once per repo. */
214
- function detectAgent(env = process.env) {
215
- const running = AGENTS.find((a) => MARKERS[a].some((k) => env[k]));
216
- if (running && onPath(AGENT_BIN[running], env)) return running;
217
- return AGENTS.find((a) => onPath(AGENT_BIN[a], env));
218
- }
219
- //#endregion
220
128
  //#region src/server/config.ts
221
129
  const DEFAULTS = {
222
130
  mode: "studio",
@@ -370,4 +278,4 @@ function validViewports(v) {
370
278
  return Object.keys(out).length ? out : null;
371
279
  }
372
280
  //#endregion
373
- export { readJson as a, detectHost as i, loadConfig as n, detectAgent as r, DEFAULTS as t };
281
+ export { readJson as i, loadConfig as n, detectHost as r, DEFAULTS as t };
@@ -1,8 +1,9 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { C as tables, S as proseLines, _ as isRecordTable, b as looseTables, c as CITED_FILE, d as LEVEL, f as availableLevels, g as hasGlob, h as globRe, k as checkRealDirs, l as EVIDENCE_COLUMN, m as frontMatter, p as capabilityTable, s as CITATION, tt as readStatusWord, u as GENERATED, v as levelsIn, w as wordCount, x as parseMap, y as lf } from "./board-status-CWGHIdo_.mjs";
2
+ import { M as readStatusWord, a as checkRealDirs } from "./boards-DbVJlbd5.mjs";
3
+ import { C as parseMap, E as wordCount, S as looseTables, T as tables, _ as globRe, b as levelsIn, d as EVIDENCE_COLUMN, f as GENERATED, g as frontMatter, h as capabilityTable, l as CITATION, m as availableLevels, p as LEVEL, u as CITED_FILE, v as hasGlob, w as proseLines, x as lf, y as isRecordTable } from "./board-status-D_lHZZ09.mjs";
3
4
  import { pkgDir } from "./managed-HwHVNI3h.mjs";
4
5
  import { t as writeManaged } from "./managed-write-Bo-oPc-i.mjs";
5
- import { r as scanFrames } from "./manifest-BqBcMJcd.mjs";
6
+ import { o as scanFrames } from "./manifest-BkjJ5OQk.mjs";
6
7
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
7
8
  import { basename, dirname, join, normalize, relative, sep } from "node:path";
8
9
  import { execFileSync } from "node:child_process";
@@ -1,9 +1,9 @@
1
1
  import { n as replay } from "./events-B3LBn74P.mjs";
2
2
  import { i as readLog, r as listBoards, t as appendEvents } from "./comments-DZyobpxG.mjs";
3
- import { n as localProfile } from "./profile-BjAPAJSb.mjs";
4
- import { a as toFrameId } from "./manifest-BqBcMJcd.mjs";
5
- import { workActivity } from "./work-CLrmY-vQ.mjs";
6
- import { r as deviceId, t as has } from "./ledger-Bu0BjqIe.mjs";
3
+ import { n as localProfile } from "./profile-CrZohD6g.mjs";
4
+ import { c as toFrameId } from "./manifest-BkjJ5OQk.mjs";
5
+ import { a as workActivity } from "./work-CiUvBVa6.mjs";
6
+ import { has, t as deviceId } from "./ledger-BNXW14Xw.mjs";
7
7
  import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, watch, writeFileSync, writeSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  import { randomBytes, randomUUID } from "node:crypto";
@@ -865,11 +865,30 @@ function releaseLock(root) {
865
865
  * - the event id is in the device ledger (the trust boundary, §1) - synced-in events fail this
866
866
  */
867
867
  const MENTION = /@marver\b/i;
868
- /** Threads Marver is already ENGAGED in (it has replied there). An owner follow-up in one of
869
- * these is a conversation turn - it triggers without re-tagging @marver. */
870
- function engagedThreads(events) {
871
- const s = /* @__PURE__ */ new Set();
872
- for (const ev of events) if (ev.agent && ev.type === "reply" && ev.parentId) s.add(ev.parentId);
868
+ /** Threads Marver is already ENGAGED in, each with the moment it engaged. `owners` is the ledger
869
+ * check: only the owner's own mentions start a conversation (a synced collaborator's never does). An owner follow-up in an
870
+ * engaged thread written AFTER that moment is a conversation turn - it triggers without re-tagging;
871
+ * one written before it never wakes a job retroactively, whatever engages the thread later.
872
+ * - a chat agent's note or reply from the CLI engages from that event;
873
+ * - a Live Jam reply engages from the @marver mention that started the conversation, so an owner
874
+ * follow-up written while the job ran still counts. A jam reply with no mention in its thread
875
+ * answered a follow-up, which a CLI event already engaged - it adds nothing. */
876
+ function engagedThreads(events, owners) {
877
+ const s = /* @__PURE__ */ new Map();
878
+ const engage = (thread, at) => s.set(thread, Math.min(s.get(thread) ?? Infinity, at));
879
+ const mentioned = /* @__PURE__ */ new Map();
880
+ for (const ev of events) {
881
+ if (ev.agent || ev.type !== "create" && ev.type !== "reply" || !MENTION.test(ev.body ?? "") || !owners(ev.id)) continue;
882
+ const t = threadId(ev);
883
+ if (t) mentioned.set(t, Math.min(mentioned.get(t) ?? Infinity, ev.ts));
884
+ }
885
+ for (const ev of events) {
886
+ if (!ev.agent) continue;
887
+ if (ev.type === "create" && ev.commentId) engage(ev.commentId, ev.ts);
888
+ if (ev.type !== "reply" || !ev.parentId) continue;
889
+ if (!ev.id.startsWith("jam-")) engage(ev.parentId, ev.ts);
890
+ else if (mentioned.has(ev.parentId)) engage(ev.parentId, mentioned.get(ev.parentId));
891
+ }
873
892
  return s;
874
893
  }
875
894
  /** The one gate. An event on `board` triggers a job iff it passes every clause. Keyed on
@@ -879,7 +898,8 @@ function engagedThreads(events) {
879
898
  function triggers(root, board, ev, engaged) {
880
899
  if (ev.agent) return false;
881
900
  if (ev.type !== "create" && ev.type !== "reply") return false;
882
- const followUp = ev.type === "reply" && !!engaged?.has(threadId(ev));
901
+ const since = ev.type === "reply" ? engaged?.get(threadId(ev)) : void 0;
902
+ const followUp = since !== void 0 && ev.ts > since;
883
903
  if (!MENTION.test(ev.body ?? "") && !followUp) return false;
884
904
  return has(root, board, ev.id);
885
905
  }
@@ -888,12 +908,16 @@ function scanPending(root, commentsDir, journal) {
888
908
  const out = [];
889
909
  for (const board of listBoards(commentsDir)) {
890
910
  const events = readLog(commentsDir, board);
891
- const engaged = engagedThreads(events);
911
+ const engaged = engagedThreads(events, (id) => has(root, board, id));
912
+ const frameOf = /* @__PURE__ */ new Map();
913
+ for (const ev of events) if (ev.type === "create" && ev.commentId && ev.frame) frameOf.set(ev.commentId, ev.frame);
892
914
  for (const ev of events) {
893
915
  if (seen.has(ev.id) || !triggers(root, board, ev, engaged)) continue;
916
+ const frame = ev.frame ?? frameOf.get(threadId(ev));
894
917
  out.push({
895
918
  board,
896
- event: ev
919
+ event: ev,
920
+ ...frame ? { frame } : {}
897
921
  });
898
922
  }
899
923
  }
@@ -932,6 +956,8 @@ const JOB_TIMEOUT_MS = 6e5;
932
956
  const MAX_ATTEMPTS = 2;
933
957
  const MAX_OUT = 2e6;
934
958
  const RESCAN_MS = 5e3;
959
+ /** How often a chain held by a chat agent's `work start` looks again. */
960
+ const HOLD_RECHECK_MS = 2e3;
935
961
  /** Kill a whole process group (the child is detached, so pid === pgid). Best-effort. */
936
962
  const fenceGroup = (pid) => {
937
963
  try {
@@ -1141,7 +1167,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
1141
1167
  * and `triggers` re-confirms ledger/agent/type/mention - the job can never drift to other content. */
1142
1168
  const resolveMember = (board, id) => {
1143
1169
  const events = readLog(commentsDir, board);
1144
- const engaged = engagedThreads(events);
1170
+ const engaged = engagedThreads(events, (id) => has(root, board, id));
1145
1171
  for (const ev of events) if (ev.id === id) return triggers(root, board, ev, engaged) ? {
1146
1172
  board,
1147
1173
  event: ev
@@ -1238,16 +1264,34 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
1238
1264
  const rt = replay(readLog(commentsDir, p.board)).find((t) => t.id === threadId(p.event));
1239
1265
  return rt?.frame ? `f:${rt.frame}` : `t:${threadId(p.event) || p.event.id}`;
1240
1266
  };
1267
+ const heldKey = (key) => key.startsWith("f:") && !!hooks.held?.(key.slice(2));
1268
+ let recheck = null;
1269
+ const holdLater = () => {
1270
+ if (recheck || stopped) return;
1271
+ recheck = setTimeout(() => {
1272
+ recheck = null;
1273
+ pump();
1274
+ }, HOLD_RECHECK_MS);
1275
+ recheck.unref?.();
1276
+ };
1241
1277
  const pump = () => {
1242
1278
  if (stopped) return;
1243
1279
  for (const [key, q] of chains) {
1244
1280
  if (activeChains >= Math.max(1, cfg.concurrency)) break;
1245
1281
  if (q.running || !q.items.length) continue;
1282
+ if (heldKey(key)) {
1283
+ holdLater();
1284
+ continue;
1285
+ }
1246
1286
  q.running = true;
1247
1287
  activeChains += 1;
1248
1288
  (async () => {
1249
1289
  try {
1250
1290
  while (!stopped && q.items.length) {
1291
+ if (heldKey(key)) {
1292
+ holdLater();
1293
+ break;
1294
+ }
1251
1295
  const job = q.items.shift();
1252
1296
  try {
1253
1297
  await runBatch(job.b, job.p);
@@ -1288,11 +1332,12 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
1288
1332
  * ONE shared waiter: overlapping ticks (the 5s rescan during a 10-min job) join the same
1289
1333
  * promise instead of each spinning its own poll loop. */
1290
1334
  let idleP = null;
1335
+ const quiet = () => activeChains === 0 && [...chains].every(([key, q]) => !q.items.length || heldKey(key));
1291
1336
  const idle = () => {
1292
- if (activeChains === 0 && chains.size === 0) return Promise.resolve();
1337
+ if (quiet()) return Promise.resolve();
1293
1338
  idleP ??= new Promise((res) => {
1294
1339
  const check = () => {
1295
- if (stopped || activeChains === 0 && chains.size === 0) {
1340
+ if (stopped || quiet()) {
1296
1341
  idleP = null;
1297
1342
  res();
1298
1343
  } else setTimeout(check, 50);
@@ -1302,6 +1347,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
1302
1347
  return idleP;
1303
1348
  };
1304
1349
  let resumed = false;
1350
+ const waiting = /* @__PURE__ */ new Set();
1305
1351
  const tick = async () => {
1306
1352
  if (stopped) return;
1307
1353
  try {
@@ -1315,7 +1361,17 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
1315
1361
  else finish(b);
1316
1362
  }
1317
1363
  }
1318
- for (const p of scanPending(root, commentsDir, journal)) enqueue(claim(p), p);
1364
+ for (const p of scanPending(root, commentsDir, journal)) {
1365
+ if (p.frame && hooks.held?.(p.frame)) {
1366
+ if (!waiting.has(p.event.id)) {
1367
+ waiting.add(p.event.id);
1368
+ log(` jam: waiting - ${p.frame} is being worked on in chat; the comment runs once it is done`);
1369
+ }
1370
+ continue;
1371
+ }
1372
+ waiting.delete(p.event.id);
1373
+ enqueue(claim(p), p);
1374
+ }
1319
1375
  } catch (err) {
1320
1376
  log(` jam: tick error - ${err.message}`);
1321
1377
  }
@@ -1325,6 +1381,7 @@ function createJam(root, cfg, adapter, log = () => {}, hooks = {}) {
1325
1381
  tick,
1326
1382
  stop() {
1327
1383
  stopped = true;
1384
+ if (recheck) clearTimeout(recheck);
1328
1385
  for (const c of activeChildren) fenceGroup(c.pid);
1329
1386
  },
1330
1387
  snapshot() {
@@ -1351,7 +1408,8 @@ function startJam(root, cfg, log = () => {}, onChanged = () => {}) {
1351
1408
  const activity = workActivity;
1352
1409
  const core = createJam(root, cfg, adapter, log, {
1353
1410
  work: (f, on) => on ? activity.mark(f ?? "", void 0, "jam") : activity.clear(f ?? "", "jam"),
1354
- changed: onChanged
1411
+ changed: onChanged,
1412
+ held: (f) => activity.has(f, "cli")
1355
1413
  });
1356
1414
  let stopped = false;
1357
1415
  let scheduled = null;