@marver-design/marver 0.27.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +6 -4
  3. package/dist/{anchor-check-gkxkPAIv.mjs → anchor-check-DhlpKl2K.mjs} +1 -1
  4. package/dist/{audio-Dw1lfMdb.mjs → audio-DX4POHAj.mjs} +39 -4
  5. package/dist/{boards-BqUqKNW8.mjs → boards-BeWtjGUM.mjs} +49 -4
  6. package/dist/boards-EH2onUXM.mjs +995 -0
  7. package/dist/{build-VgNg4rr8.mjs → build-CWbrb2bl.mjs} +9 -5
  8. package/dist/{capture-vadKjuCo.mjs → capture-DEtM4qm5.mjs} +259 -34
  9. package/dist/cli.mjs +40 -19
  10. package/dist/{comments-YEU1Zhv9.mjs → comments-XNhMmSSu.mjs} +4 -4
  11. package/dist/config-BezZTiov.mjs +182 -0
  12. package/dist/conn-BMiHS42T.mjs +222 -0
  13. package/dist/connectors-DekQvKt9.mjs +292 -0
  14. package/dist/{context-Ccjrhr1J.mjs → context-BUnFiyA3.mjs} +2 -2
  15. package/dist/{daemon-Dc9AH0M3.mjs → daemon-Sc_z8gT6.mjs} +2209 -205
  16. package/dist/{dev-ri6nAlRp.mjs → dev-DWBKQhxf.mjs} +31 -15
  17. package/dist/{init-W0nxR1OY.mjs → init-CYlFaRzG.mjs} +7 -2
  18. package/dist/jam-Cj5gBvwD.mjs +373 -0
  19. package/dist/{link-CdTgn94Y.mjs → link-BFFRgrMt.mjs} +3 -3
  20. package/dist/listener-DdLEM79A.mjs +80 -0
  21. package/dist/logo-CXY-1yrn.mjs +305 -0
  22. package/dist/{ls-BZ5TAtd5.mjs → ls-NqmePKOf.mjs} +1 -1
  23. package/dist/{manifest-aFyDmL8C.mjs → manifest-DPZ3WNg_.mjs} +1 -1
  24. package/dist/{marks-CnCCfAbD.mjs → marks-BnNANic9.mjs} +22 -3
  25. package/dist/{marks-BF9pNEgH.mjs → marks-DBp3h1Mc.mjs} +3 -6
  26. package/dist/{marver-id-gate-D-R0hSt_.mjs → marver-id-gate-vBLb_Icb.mjs} +1 -1
  27. package/dist/{perf-DkAUFT6W.mjs → perf-Denssrko.mjs} +45 -27
  28. package/dist/{perf-jam-BaH3Lg0m.mjs → perf-jam-CLkERSHo.mjs} +9 -2
  29. package/dist/permit-DDa6wqOs.mjs +187 -0
  30. package/dist/{plugin-B8UghYuF.mjs → plugin-DqoZB-D6.mjs} +849 -789
  31. package/dist/{poster-BNgafWMK.mjs → poster-CrsjqhY4.mjs} +1 -1
  32. package/dist/{profile-jIS6BcAs.mjs → profile-B1FKOM1e.mjs} +1 -1
  33. package/dist/{publish-bakes-38Nja78p.mjs → publish-bakes-DW-NDgU2.mjs} +3 -3
  34. package/dist/{queue-CAM_vNmX.mjs → queue-DeSQm24g.mjs} +189 -35
  35. package/dist/{recover-B8AiI29B.mjs → recover-GtJ9UDAB.mjs} +2 -2
  36. package/dist/{serve-Dp3nHstu.mjs → serve-DQv3Ti6X.mjs} +8 -4
  37. package/dist/{session-BAaJsK5c.mjs → session-VDJfXEEm.mjs} +1 -1
  38. package/dist/{share-Ce4tP7ji.mjs → share-Bu_kuOKL.mjs} +1 -1
  39. package/dist/{shot-CMQgMVZm.mjs → shot-DBWN8hPP.mjs} +1 -1
  40. package/dist/{shot-Ch24tiMO.mjs → shot-T04Ixrvq.mjs} +7 -6
  41. package/dist/sizes-wjXDev3b.mjs +139 -0
  42. package/dist/{slots-CFNnegCc.mjs → slots-Dn4Onb0V.mjs} +101 -3
  43. package/dist/speech-worker.mjs +23 -3
  44. package/dist/{sync-CQdGARJ9.mjs → sync-CMozOwZ0.mjs} +1 -1
  45. package/dist/transport-C5FnY9ni.mjs +203 -0
  46. package/dist/{work-Bxz-ObF3.mjs → work-BYWD_1Zf.mjs} +3 -3
  47. package/dist/{work-CNhFF9pU.mjs → work-DJxH7cCX.mjs} +1 -1
  48. package/docs/boards-and-folders.md +11 -0
  49. package/docs/jam-session.md +52 -18
  50. package/docs/live-jam.md +95 -10
  51. package/docs/performance.md +1 -1
  52. package/docs/publish.md +7 -0
  53. package/package.json +1 -1
  54. package/src/client/shell/Comments.tsx +5 -4
  55. package/src/client/shell/ContextMenu.tsx +5 -4
  56. package/src/client/shell/JamSurface.tsx +135 -29
  57. package/src/client/shell/Play.tsx +16 -4
  58. package/src/client/shell/api.ts +7 -3
  59. package/src/client/shell/app-bridge.ts +11 -3
  60. package/src/client/shell/comments-store.ts +14 -0
  61. package/src/client/shell/goto.ts +4 -3
  62. package/src/client/shell/icons.tsx +1 -0
  63. package/src/client/shell/jam-capture.ts +136 -37
  64. package/src/client/shell/jam-keys.ts +170 -18
  65. package/src/client/shell/jam-lane.tsx +14 -5
  66. package/src/client/shell/jam-lines.ts +76 -10
  67. package/src/client/shell/jam-panel.tsx +58 -4
  68. package/src/client/shell/jam-queue.ts +55 -8
  69. package/src/client/shell/jam-session.tsx +55 -6
  70. package/src/client/shell/jam-state.ts +19 -4
  71. package/src/client/shell/jam-surface-parts.tsx +6 -3
  72. package/src/client/shell/jam-ui.tsx +10 -1
  73. package/src/client/shell/jam-voice-wait.ts +21 -0
  74. package/src/client/shell/jam-voice.ts +14 -5
  75. package/src/client/shell/live-picture.ts +134 -0
  76. package/src/client/shell/open-item.ts +83 -0
  77. package/src/client/shell/open-resolve.ts +50 -0
  78. package/src/client/shell/store.ts +6 -2
  79. package/src/client/shell/styles.css +29 -11
  80. package/src/client/shell/tidy.ts +3 -2
  81. package/src/client/stage/main.tsx +30 -8
  82. package/src/shared/app-api.ts +173 -3
  83. package/src/shared/app-perf.ts +4 -2
  84. package/src/shared/approval.ts +20 -0
  85. package/src/shared/events.ts +1 -1
  86. package/templates/AGENTS-embedded.md +28 -1
  87. package/templates/AGENTS-studio.md +28 -1
  88. package/templates/instructions/boards.md +7 -1
  89. package/templates/instructions/jam.md +94 -0
  90. package/dist/boards-BHKP5yhI.mjs +0 -342
  91. package/dist/live-Cgzsicwi.mjs +0 -4
@@ -0,0 +1,292 @@
1
+ import { i as onPath } from "./agent-BsieQGTD.mjs";
2
+ import { C as writePrefs, _ as readPrefs, c as jamDir, x as writeAtomic } from "./conn-BMiHS42T.mjs";
3
+ import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
4
+ import { dirname, isAbsolute, join } from "node:path";
5
+ import { spawnSync } from "node:child_process";
6
+ //#region src/server/jam/connectors.ts
7
+ /**
8
+ * Connectors (spec 29b, Part 2): the hooks that connect Claude Code, Codex and Cursor sessions in this
9
+ * repo to Live Jam - written by `marver init`, by `marver dev` at boot, and when a Jam session starts.
10
+ * The owner never writes them; they are what makes starting a Jam session the one switch.
11
+ *
12
+ * Every entry runs one command, `<repo>/node_modules/.bin/marver jam hook|listen ...`. The merge only
13
+ * ever touches Marver's own entries (recognised by that command), keeps every other key and hook, and
14
+ * leaves alone a file that does not parse, a file git tracks, and an entry the owner removed by hand.
15
+ */
16
+ /** Marver's own hook commands - how an entry is recognised as ours, whatever path it was written with. */
17
+ const OURS = /\bmarver(?:\.mjs)?["']?\s+jam\s+(?:hook|listen)\b/;
18
+ const FILES = {
19
+ claude: ".claude/settings.local.json",
20
+ codex: ".codex/hooks.json",
21
+ cursor: ".cursor/hooks.json"
22
+ };
23
+ /** The CLIs (and app) whose presence means the owner uses that tool here. */
24
+ const BINS = {
25
+ claude: ["claude"],
26
+ codex: ["codex"],
27
+ cursor: ["cursor-agent", "cursor"]
28
+ };
29
+ /** The marver the hooks run: the repo's own install (fast, no network). */
30
+ const hookBin = (root) => {
31
+ const bin = join(root, "node_modules", ".bin", "marver");
32
+ return existsSync(bin) ? bin : null;
33
+ };
34
+ const q = (s) => `"${s.replace(/(["\\$`])/g, "\\$1")}"`;
35
+ /** Every event's handlers, as Claude Code and Codex nest them: `hooks[event] = [{ matcher?, hooks: [handler] }]`. */
36
+ function mergeNested(file, want) {
37
+ const hooks = file.hooks && typeof file.hooks === "object" && !Array.isArray(file.hooks) ? { ...file.hooks } : {};
38
+ for (const ev of Object.keys(hooks)) {
39
+ if (!Array.isArray(hooks[ev])) continue;
40
+ hooks[ev] = hooks[ev].map((g) => g && Array.isArray(g.hooks) ? {
41
+ ...g,
42
+ hooks: g.hooks.filter((h) => !(typeof h?.command === "string" && OURS.test(h.command)))
43
+ } : g).filter((g) => !(g && Array.isArray(g.hooks) && g.hooks.length === 0));
44
+ if (!hooks[ev].length) delete hooks[ev];
45
+ }
46
+ for (const [ev, handlers] of Object.entries(want)) hooks[ev] = [...Array.isArray(hooks[ev]) ? hooks[ev] : [], { hooks: handlers }];
47
+ return {
48
+ ...file,
49
+ hooks
50
+ };
51
+ }
52
+ /** Cursor's flat shape: `hooks[event] = [{ command, ... }]`, with `version: 1`. */
53
+ function mergeFlat(file, want) {
54
+ const hooks = file.hooks && typeof file.hooks === "object" && !Array.isArray(file.hooks) ? { ...file.hooks } : {};
55
+ for (const ev of Object.keys(hooks)) {
56
+ if (!Array.isArray(hooks[ev])) continue;
57
+ hooks[ev] = hooks[ev].filter((h) => !(typeof h?.command === "string" && OURS.test(h.command)));
58
+ if (!hooks[ev].length) delete hooks[ev];
59
+ }
60
+ for (const [ev, entries] of Object.entries(want)) hooks[ev] = [...Array.isArray(hooks[ev]) ? hooks[ev] : [], ...entries];
61
+ return {
62
+ version: 1,
63
+ ...file,
64
+ hooks
65
+ };
66
+ }
67
+ /** Is any entry of ours in this file? (Each command looked at as written - in JSON its quotes are escaped.) */
68
+ const hasOurs = (file) => {
69
+ const cmds = [];
70
+ const walk = (v) => {
71
+ if (Array.isArray(v)) v.forEach(walk);
72
+ else if (v && typeof v === "object") for (const [k, x] of Object.entries(v)) if (k === "command" && typeof x === "string") cmds.push(x);
73
+ else walk(x);
74
+ };
75
+ walk(file.hooks);
76
+ return cmds.some((c) => OURS.test(c));
77
+ };
78
+ /** What each tool's file should hold, for this repo's marver. */
79
+ function wanted(agent, bin, root) {
80
+ const r = ` --root ${q(root)}`;
81
+ if (agent === "claude") {
82
+ const listen = {
83
+ type: "command",
84
+ command: `${q(bin)} jam listen${r}`,
85
+ async: true
86
+ };
87
+ return { nested: {
88
+ SessionStart: [listen],
89
+ UserPromptSubmit: [listen],
90
+ SessionEnd: [{
91
+ type: "command",
92
+ command: `${q(bin)} jam hook claude end${r}`,
93
+ timeout: 10
94
+ }]
95
+ } };
96
+ }
97
+ if (agent === "codex") {
98
+ const h = (ev) => ({
99
+ type: "command",
100
+ command: `${q(bin)} jam hook codex ${ev}${r}`,
101
+ timeout: 10
102
+ });
103
+ return { nested: {
104
+ SessionStart: [h("start")],
105
+ UserPromptSubmit: [h("prompt")],
106
+ Stop: [h("stop")],
107
+ SessionEnd: [h("end")]
108
+ } };
109
+ }
110
+ const h = (ev, extra = {}) => ({
111
+ command: `${q(bin)} jam hook cursor ${ev}${r}`,
112
+ timeout: 10,
113
+ ...extra
114
+ });
115
+ return { flat: {
116
+ sessionStart: [h("start")],
117
+ beforeSubmitPrompt: [h("prompt")],
118
+ stop: [h("stop", { loop_limit: 20 })],
119
+ sessionEnd: [h("end")]
120
+ } };
121
+ }
122
+ const git = (root, args) => spawnSync("git", [
123
+ "-C",
124
+ root,
125
+ ...args
126
+ ], {
127
+ encoding: "utf8",
128
+ timeout: 5e3
129
+ });
130
+ const inGit = (root) => git(root, ["rev-parse", "--git-dir"]).status === 0;
131
+ const tracked = (root, rel) => inGit(root) && git(root, [
132
+ "ls-files",
133
+ "--error-unmatch",
134
+ "--",
135
+ rel
136
+ ]).status === 0;
137
+ const ignored = (root, rel) => git(root, [
138
+ "check-ignore",
139
+ "-q",
140
+ "--",
141
+ rel
142
+ ]).status === 0;
143
+ /** Keep `rel` out of commits without touching a committed file: .git/info/exclude is local. */
144
+ function exclude(root, rel) {
145
+ if (!inGit(root) || ignored(root, rel)) return;
146
+ const r = git(root, [
147
+ "rev-parse",
148
+ "--git-path",
149
+ "info/exclude"
150
+ ]);
151
+ if (r.status !== 0) return;
152
+ const p = r.stdout.trim();
153
+ const file = isAbsolute(p) ? p : join(root, p);
154
+ const prefix = git(root, ["rev-parse", "--show-prefix"]);
155
+ if (prefix.status !== 0) return;
156
+ const line = `/${prefix.stdout.trim()}${rel.split("\\").join("/")}`;
157
+ let text = "";
158
+ try {
159
+ text = readFileSync(file, "utf8");
160
+ } catch {}
161
+ if (text.split("\n").some((l) => l.trim() === line)) return;
162
+ mkdirSync(dirname(file), { recursive: true });
163
+ writeAtomic(file, `${text}${text && !text.endsWith("\n") ? "\n" : ""}# marver: Live Jam's local hooks\n${line}\n`, 420);
164
+ }
165
+ const recordFile = (root) => join(jamDir(root), "connectors.json");
166
+ const readInstalled = (root) => {
167
+ try {
168
+ return JSON.parse(readFileSync(recordFile(root), "utf8"));
169
+ } catch {
170
+ return {};
171
+ }
172
+ };
173
+ const writeInstalled = (root, r) => {
174
+ mkdirSync(jamDir(root), {
175
+ recursive: true,
176
+ mode: 448
177
+ });
178
+ writeAtomic(recordFile(root), JSON.stringify(r, null, 1));
179
+ };
180
+ /** Is this tool used on this Mac (its CLI on PATH, or - Cursor - its app)? */
181
+ function present(agent, env = process.env) {
182
+ if (BINS[agent].some((b) => onPath(b, env))) return true;
183
+ return agent === "cursor" && existsSync("/Applications/Cursor.app");
184
+ }
185
+ /**
186
+ * Write the connectors this repo is missing. `force` (the start sheet turning a tool back on) writes
187
+ * one the owner had removed. Never throws: each tool's result says what happened.
188
+ */
189
+ function ensureConnectors(root, opts = {}) {
190
+ const env = opts.env ?? process.env;
191
+ const agents = opts.agents ?? [
192
+ "claude",
193
+ "codex",
194
+ "cursor"
195
+ ].filter((a) => present(a, env));
196
+ const bin = opts.bin === void 0 ? hookBin(root) : opts.bin;
197
+ const prefs = readPrefs(root);
198
+ const installed = readInstalled(root);
199
+ const out = [];
200
+ if (opts.force?.some((a) => prefs.off?.[a])) {
201
+ for (const a of opts.force) delete prefs.off?.[a];
202
+ try {
203
+ writePrefs(root, prefs);
204
+ } catch {}
205
+ }
206
+ for (const agent of agents) {
207
+ const rel = FILES[agent];
208
+ const file = join(root, rel);
209
+ const res = (state, note) => out.push({
210
+ agent,
211
+ file: rel,
212
+ state,
213
+ ...note ? { note } : {}
214
+ });
215
+ try {
216
+ if (prefs.off?.[agent] && !opts.force?.includes(agent)) {
217
+ res("off");
218
+ continue;
219
+ }
220
+ if (!bin) {
221
+ res("no-bin", "marver is not installed in this repo (node_modules/.bin/marver)");
222
+ continue;
223
+ }
224
+ let cur = {};
225
+ if (existsSync(file)) {
226
+ if (!statSync(file).isFile()) {
227
+ res("unreadable", `${rel} is not a file`);
228
+ continue;
229
+ }
230
+ try {
231
+ cur = JSON.parse(readFileSync(file, "utf8") || "{}");
232
+ } catch {
233
+ res("unreadable", `${rel} does not parse - left as it is`);
234
+ continue;
235
+ }
236
+ if (!cur || typeof cur !== "object" || Array.isArray(cur)) {
237
+ res("unreadable", `${rel} is not a JSON object - left as it is`);
238
+ continue;
239
+ }
240
+ }
241
+ if (tracked(root, rel)) {
242
+ res("tracked", `${rel} is committed to git - Marver never changes a committed file`);
243
+ continue;
244
+ }
245
+ if (installed[agent] && (!existsSync(file) || !hasOurs(cur)) && !opts.force?.includes(agent)) {
246
+ res("removed");
247
+ continue;
248
+ }
249
+ const w = wanted(agent, bin, root);
250
+ const next = w.nested ? mergeNested(cur, w.nested) : mergeFlat(cur, w.flat);
251
+ if (JSON.stringify(next) === JSON.stringify(cur)) {
252
+ exclude(root, rel);
253
+ res("present");
254
+ continue;
255
+ }
256
+ mkdirSync(dirname(file), { recursive: true });
257
+ writeAtomic(file, JSON.stringify(next, null, 2) + "\n", 420);
258
+ exclude(root, rel);
259
+ installed[agent] = {
260
+ file: rel,
261
+ at: Date.now()
262
+ };
263
+ res("installed");
264
+ } catch (err) {
265
+ res("failed", err.message);
266
+ }
267
+ }
268
+ try {
269
+ writeInstalled(root, installed);
270
+ } catch {}
271
+ return out;
272
+ }
273
+ /** One line for the dev server and init: what the connectors did, or nothing worth saying. */
274
+ function connectorLine(results) {
275
+ const name = {
276
+ claude: "Claude Code",
277
+ codex: "Codex",
278
+ cursor: "Cursor"
279
+ };
280
+ const made = results.filter((r) => r.state === "installed").map((r) => name[r.agent]);
281
+ const skipped = results.filter((r) => [
282
+ "tracked",
283
+ "unreadable",
284
+ "failed"
285
+ ].includes(r.state));
286
+ const parts = [];
287
+ if (made.length) parts.push(`jam: connected ${made.join(", ")} sessions in this repo - their hooks are in ${results.filter((r) => r.state === "installed").map((r) => r.file).join(", ")} (local, never committed)${results.some((r) => r.state === "installed" && r.agent === "codex") ? "; Codex asks you to trust them once (/hooks)" : ""}`);
288
+ for (const s of skipped) parts.push(`jam: ${name[s.agent]} not connected - ${s.note ?? s.state}`);
289
+ return parts.length ? parts.map((p) => ` ${p}`).join("\n") : null;
290
+ }
291
+ //#endregion
292
+ export { connectorLine, ensureConnectors, hookBin, present };
@@ -1,7 +1,7 @@
1
1
  import { r as NAME } from "./cli.mjs";
2
- import { a as checkRealDirs } from "./boards-BHKP5yhI.mjs";
2
+ import { o as checkRealDirs } from "./boards-EH2onUXM.mjs";
3
3
  import { O as readStatusWord, f as isBoardName, l as framesOn } from "./board-tree-BXR8dw4b.mjs";
4
- import { A as levelsIn, C as LEVEL, D as globRe, E as frontMatter, F as tables, I as wordCount, M as looseTables, N as parseMap, O as hasGlob, P as proseLines, S as GENERATED, T as capabilityTable, b as CITED_FILE, j as lf, k as isRecordTable, s as scanFrames, w as availableLevels, x as EVIDENCE_COLUMN, y as CITATION } from "./manifest-aFyDmL8C.mjs";
4
+ import { A as levelsIn, C as LEVEL, D as globRe, E as frontMatter, F as tables, I as wordCount, M as looseTables, N as parseMap, O as hasGlob, P as proseLines, S as GENERATED, T as capabilityTable, b as CITED_FILE, j as lf, k as isRecordTable, s as scanFrames, w as availableLevels, x as EVIDENCE_COLUMN, y as CITATION } from "./manifest-DPZ3WNg_.mjs";
5
5
  import { pkgDir } from "./managed-HwHVNI3h.mjs";
6
6
  import { t as writeManaged } from "./managed-write-Bo-oPc-i.mjs";
7
7
  import { t as imports } from "./imports-WBSnnHLb.mjs";