@marver-design/marver 0.26.0 → 0.27.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.
- package/CHANGELOG.md +158 -0
- package/README.md +10 -5
- package/dist/{anchor-check-Dg5xpNnU.mjs → anchor-check-ChdDqL5z.mjs} +1 -1
- package/dist/{audio-CmSRYFEs.mjs → audio-Dw1lfMdb.mjs} +14 -0
- package/dist/{bake-DtVlm0_F.mjs → bake-DM_uWgAA.mjs} +1 -1
- package/dist/{boards-DYG22tOe.mjs → boards-DlTcpF47.mjs} +1 -1
- package/dist/{build-C_gUgcdC.mjs → build-DZnFysGU.mjs} +4 -4
- package/dist/{capture-CrqvU_jh.mjs → capture-vadKjuCo.mjs} +2 -1
- package/dist/cli.mjs +28 -16
- package/dist/{comments-BqXua-XL.mjs → comments-DxOkCSNE.mjs} +4 -4
- package/dist/{daemon-DZo6o3rU.mjs → daemon-BSA0lV8d.mjs} +400 -274
- package/dist/detect-C0wpaePX.mjs +125 -0
- package/dist/dev-eQJhWsqg.mjs +1273 -0
- package/dist/dev-lock-C_FC70Mu.mjs +65 -0
- package/dist/exclusive-B1RtpeeP.mjs +150 -0
- package/dist/{init-D8DtrK_F.mjs → init-COD0x48i.mjs} +5 -3
- package/dist/{link-BNzLvdhI.mjs → link-DDXZVGtv.mjs} +20 -8
- package/dist/ls-D7O1G505.mjs +38 -0
- package/dist/{marks-NQi0wZJ4.mjs → marks-CWM3WJjc.mjs} +1 -1
- package/dist/perf-BWzQwZqj.mjs +369 -0
- package/dist/perf-BoDSkbEb.mjs +429 -0
- package/dist/perf-jam-D55U3FZK.mjs +242 -0
- package/dist/{plugin-CTD0rydA.mjs → plugin-C-E7omsh.mjs} +425 -66
- package/dist/{poster-ChjXGTS5.mjs → poster-Bx83ZYVK.mjs} +2 -1
- package/dist/{profile-WU9qcbIo.mjs → profile-Bh5Y5zpW.mjs} +1 -1
- package/dist/{publish-bakes-CEP_2NRc.mjs → publish-bakes-aljgm45S.mjs} +2 -2
- package/dist/{queue-BuiCKSX1.mjs → queue-CAM_vNmX.mjs} +3 -3
- package/dist/recover-t9Pno3u9.mjs +66 -0
- package/dist/{session-qZWKt_VA.mjs → session-BAaJsK5c.mjs} +1 -1
- package/dist/{share--oFJ1bCI.mjs → share-W5H3BNvP.mjs} +1 -1
- package/dist/shot-DoHLl6ig.mjs +139 -0
- package/dist/{shot-DqcxJibP.mjs → shot-LFhC-WYD.mjs} +343 -19
- package/dist/slots-DCDo3N0x.mjs +471 -0
- package/dist/speech-worker.mjs +40 -5
- package/dist/{sync-DKk-yT1V.mjs → sync-BQVlHZpx.mjs} +4 -3
- package/dist/{work-F5u-twpJ.mjs → work-Bp1p39kq.mjs} +4 -2
- package/dist/{work-VvX_JIgl.mjs → work-BroFwnup.mjs} +4 -2
- package/docs/boards-and-folders.md +3 -1
- package/docs/jam-session.md +78 -7
- package/docs/live-jam.md +8 -0
- package/docs/performance.md +262 -0
- package/package.json +2 -2
- package/src/client/content/index.tsx +3 -0
- package/src/client/content/video.tsx +6 -2
- package/src/client/frame-host/bridge.js +22 -6
- package/src/client/frame-host/inspect.js +8 -3
- package/src/client/frame-host/keys.js +6 -2
- package/src/client/frame-host/main.tsx +17 -5
- package/src/client/shell/App.tsx +188 -29
- package/src/client/shell/BoardList.tsx +5 -5
- package/src/client/shell/Comments.tsx +3 -2
- package/src/client/shell/JamSurface.tsx +13 -5
- package/src/client/shell/LockedApp.tsx +5 -5
- package/src/client/shell/Play.tsx +27 -15
- package/src/client/shell/Toolbar.tsx +17 -5
- package/src/client/shell/api.ts +206 -0
- package/src/client/shell/canvas/Canvas.tsx +30 -3
- package/src/client/shell/canvas/FrameNode.tsx +15 -5
- package/src/client/shell/canvas/admission.ts +8 -1
- package/src/client/shell/canvas/camera-broadcast.ts +15 -5
- package/src/client/shell/canvas/ctl.ts +2 -0
- package/src/client/shell/canvas/frame-registry.ts +28 -2
- package/src/client/shell/canvas/sleep.ts +4 -1
- package/src/client/shell/comments-store.ts +12 -4
- package/src/client/shell/goto.ts +22 -10
- package/src/client/shell/icons.tsx +2 -0
- package/src/client/shell/jam-capture.ts +96 -16
- package/src/client/shell/jam-keys.ts +51 -18
- package/src/client/shell/jam-lane.tsx +46 -5
- package/src/client/shell/jam-panel.tsx +66 -13
- package/src/client/shell/jam-queue.ts +3 -3
- package/src/client/shell/jam-session.tsx +14 -8
- package/src/client/shell/jam-state.ts +48 -6
- package/src/client/shell/jam-surface-parts.tsx +10 -6
- package/src/client/shell/jam-voice.ts +7 -5
- package/src/client/shell/legacy-links.ts +2 -2
- package/src/client/shell/main.tsx +4 -0
- package/src/client/shell/notes.ts +8 -1
- package/src/client/shell/perf.ts +69 -58
- package/src/client/shell/recorder-core.ts +183 -0
- package/src/client/shell/recorder.ts +565 -0
- package/src/client/shell/store.ts +268 -103
- package/src/client/shell/styles.css +54 -9
- package/src/client/stage/main.tsx +2 -0
- package/templates/AGENTS-embedded.md +22 -4
- package/templates/AGENTS-studio.md +22 -4
- package/templates/demo/dark.tsx +1 -1
- package/templates/demo/welcome.tsx +1 -1
- package/templates/instructions/jam.md +5 -3
- package/templates/instructions/welcome.md +6 -3
- package/dist/config-Cf7EjAMf.mjs +0 -292
- package/dist/dev-_Nlsc6v9.mjs +0 -742
- package/dist/dev-lock-DWSpa6nj.mjs +0 -179
- package/dist/perf-D6VmmJ2q.mjs +0 -68
- package/dist/perf-DPbLGhhO.mjs +0 -49
- package/dist/shot-CNbHoZ6H.mjs +0 -86
package/dist/dev-_Nlsc6v9.mjs
DELETED
|
@@ -1,742 +0,0 @@
|
|
|
1
|
-
import { i as PKG, r as NAME } from "./cli.mjs";
|
|
2
|
-
import { n as loadConfig, r as detectHost } from "./config-Cf7EjAMf.mjs";
|
|
3
|
-
import { n as tailwind3Css, r as tailwind4Plugin, t as marverPlugin } from "./plugin-CTD0rydA.mjs";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, watch } from "node:fs";
|
|
5
|
-
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { createServer } from "node:net";
|
|
8
|
-
import { createLogger, createServer as createServer$1, parseAst, parseSync, searchForWorkspaceRoot } from "vite";
|
|
9
|
-
import react from "@vitejs/plugin-react";
|
|
10
|
-
import MagicString from "magic-string";
|
|
11
|
-
//#region src/server/icons.ts
|
|
12
|
-
/**
|
|
13
|
-
* Icon barrels, unrolled.
|
|
14
|
-
*
|
|
15
|
-
* `import { Truck } from '@phosphor-icons/react'` makes Vite hand the frame the WHOLE prebundled
|
|
16
|
-
* package - 3000 icons, 6.5 MB of JavaScript - and every frame on a board is its own realm, so every
|
|
17
|
-
* frame parses and evaluates all of it: ~400 ms, the whole boot of a lo-fi frame (measured,
|
|
18
|
-
* research/hifi/frameres.ts: the scene import is 530 of a 550 ms boot; a board of 128 frames spends
|
|
19
|
-
* 50 s on it). The packages ship one module per icon and their barrel says which: this reads the
|
|
20
|
-
* INSTALLED barrel once (every alias, whatever the version), rewrites the import declarations of
|
|
21
|
-
* design sources to the per-icon modules, one line for one line, and names those modules to the
|
|
22
|
-
* dependency optimizer at server start so nothing is discovered - and reloaded for - on first use.
|
|
23
|
-
* A name the barrel does not map, a default or namespace import, a re-export: left as it is.
|
|
24
|
-
*/
|
|
25
|
-
const LIBS = [{
|
|
26
|
-
barrel: "@phosphor-icons/react",
|
|
27
|
-
spec: (rel) => {
|
|
28
|
-
const m = rel.match(/^\.\/csr\/([\w-]+)\.es\.js$/);
|
|
29
|
-
return m ? `@phosphor-icons/react/dist/csr/${m[1]}` : null;
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
barrel: "lucide-react",
|
|
33
|
-
spec: (rel) => {
|
|
34
|
-
const m = rel.match(/^\.\/icons\/([\w-]+\.m?js)$/);
|
|
35
|
-
return m ? `lucide-react/dist/esm/icons/${m[1]}` : null;
|
|
36
|
-
}
|
|
37
|
-
}];
|
|
38
|
-
/** The map read from a barrel's source: `import { A as x } from './f'` + `export { x as Name }`
|
|
39
|
-
* (phosphor) and `export { default as Name } from './f'` (lucide). */
|
|
40
|
-
function parseBarrel(source, lib) {
|
|
41
|
-
const map = /* @__PURE__ */ new Map();
|
|
42
|
-
const locals = /* @__PURE__ */ new Map();
|
|
43
|
-
for (const m of source.matchAll(/import\s*\{([^}]*)\}\s*from\s*["']([^"']+)["']/g)) {
|
|
44
|
-
const spec = lib.spec(m[2]);
|
|
45
|
-
if (!spec) continue;
|
|
46
|
-
for (const s of m[1].split(",")) {
|
|
47
|
-
const [name, local = name] = s.trim().split(/\s+as\s+/);
|
|
48
|
-
if (name) locals.set(local, {
|
|
49
|
-
spec,
|
|
50
|
-
name
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (const m of source.matchAll(/export\s*\{([^}]*)\}(?:\s*from\s*["']([^"']+)["'])?/g)) {
|
|
55
|
-
const spec = m[2] ? lib.spec(m[2]) : null;
|
|
56
|
-
if (m[2] && !spec) continue;
|
|
57
|
-
for (const s of m[1].split(",")) {
|
|
58
|
-
const [name, exported = name] = s.trim().split(/\s+as\s+/);
|
|
59
|
-
if (!name) continue;
|
|
60
|
-
if (spec) map.set(exported, {
|
|
61
|
-
spec,
|
|
62
|
-
name
|
|
63
|
-
});
|
|
64
|
-
else {
|
|
65
|
-
const l = locals.get(name);
|
|
66
|
-
if (l) map.set(exported, l);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return map;
|
|
71
|
-
}
|
|
72
|
-
const maps = /* @__PURE__ */ new Map();
|
|
73
|
-
/** The maps for every icon package installed under `root` (read once per server). */
|
|
74
|
-
function iconMaps(root) {
|
|
75
|
-
let m = maps.get(root);
|
|
76
|
-
if (m) return m;
|
|
77
|
-
m = /* @__PURE__ */ new Map();
|
|
78
|
-
for (const lib of LIBS) {
|
|
79
|
-
const dir = join(root, "node_modules", lib.barrel);
|
|
80
|
-
try {
|
|
81
|
-
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
|
|
82
|
-
const dot = pkg.exports?.["."];
|
|
83
|
-
const entry = (typeof dot === "object" ? dot.import : typeof dot === "string" ? dot : void 0) ?? pkg.module;
|
|
84
|
-
if (!entry) continue;
|
|
85
|
-
const map = parseBarrel(readFileSync(join(dir, entry), "utf8"), lib);
|
|
86
|
-
if (map.size) m.set(lib.barrel, map);
|
|
87
|
-
} catch {}
|
|
88
|
-
}
|
|
89
|
-
maps.set(root, m);
|
|
90
|
-
return m;
|
|
91
|
-
}
|
|
92
|
-
/** The code with every mapped icon import unrolled and the per-icon specifiers it now imports;
|
|
93
|
-
* null when nothing changed. Real import declarations only (a template literal is content). */
|
|
94
|
-
function unrollIcons(code, maps) {
|
|
95
|
-
if (![...maps.keys()].some((b) => code.includes(b))) return null;
|
|
96
|
-
let ast;
|
|
97
|
-
try {
|
|
98
|
-
ast = parseAst(code);
|
|
99
|
-
} catch {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
const edits = [];
|
|
103
|
-
const modules = [];
|
|
104
|
-
for (const node of ast.body) {
|
|
105
|
-
if (node.type !== "ImportDeclaration" || !node.source) continue;
|
|
106
|
-
const map = maps.get(node.source.value);
|
|
107
|
-
if (!map || !node.specifiers?.length) continue;
|
|
108
|
-
const lines = [], keep = [];
|
|
109
|
-
let icons = 0;
|
|
110
|
-
for (const s of node.specifiers) {
|
|
111
|
-
const imported = s.type === "ImportSpecifier" ? s.imported?.name ?? s.imported?.value : void 0;
|
|
112
|
-
const hit = imported ? map.get(imported) : void 0;
|
|
113
|
-
if (!hit) {
|
|
114
|
-
if (s.type !== "ImportSpecifier") {
|
|
115
|
-
lines.length = 0;
|
|
116
|
-
icons = 0;
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
keep.push(imported === s.local.name ? imported : `${imported} as ${s.local.name}`);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
icons++;
|
|
123
|
-
modules.push(hit.spec);
|
|
124
|
-
lines.push(hit.name === "default" ? `import ${s.local.name} from '${hit.spec}';` : `import { ${hit.name === s.local.name ? hit.name : `${hit.name} as ${s.local.name}`} } from '${hit.spec}';`);
|
|
125
|
-
}
|
|
126
|
-
if (!icons) continue;
|
|
127
|
-
if (keep.length) lines.push(`import { ${keep.join(", ")} } from '${node.source.value}';`);
|
|
128
|
-
const original = code.slice(node.start, node.end);
|
|
129
|
-
edits.push({
|
|
130
|
-
start: node.start,
|
|
131
|
-
end: node.end,
|
|
132
|
-
text: lines.join(" ") + "\n".repeat((original.match(/\n/g) ?? []).length)
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (!edits.length) return null;
|
|
136
|
-
let out = "", at = 0;
|
|
137
|
-
for (const e of edits) {
|
|
138
|
-
out += code.slice(at, e.start) + e.text;
|
|
139
|
-
at = e.end;
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
code: out + code.slice(at),
|
|
143
|
-
modules
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/** Every per-icon module the design sources import (for the optimizer, at server start). Raw
|
|
147
|
-
* TypeScript is scanned by a plain pattern; only names the barrel maps count. */
|
|
148
|
-
function iconModules(root) {
|
|
149
|
-
const m = iconMaps(root);
|
|
150
|
-
if (!m.size) return [];
|
|
151
|
-
const found = /* @__PURE__ */ new Set();
|
|
152
|
-
const walk = (dir) => {
|
|
153
|
-
let names;
|
|
154
|
-
try {
|
|
155
|
-
names = readdirSync(dir);
|
|
156
|
-
} catch {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
for (const n of names) {
|
|
160
|
-
if (n === "node_modules" || n.startsWith(".")) continue;
|
|
161
|
-
const p = join(dir, n);
|
|
162
|
-
let st;
|
|
163
|
-
try {
|
|
164
|
-
st = statSync(p);
|
|
165
|
-
} catch {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
if (st.isDirectory()) walk(p);
|
|
169
|
-
else if (/\.[jt]sx?$/.test(n)) {
|
|
170
|
-
const src = readFileSync(p, "utf8").replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, (c) => " ".repeat(c.length));
|
|
171
|
-
for (const im of src.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g)) {
|
|
172
|
-
const map = m.get(im[2]);
|
|
173
|
-
if (!map) continue;
|
|
174
|
-
for (const s of im[1].split(",")) {
|
|
175
|
-
const name = s.trim().replace(/^type\s+/, "").split(/\s+as\s+/)[0];
|
|
176
|
-
const hit = map.get(name);
|
|
177
|
-
if (hit) found.add(hit.spec);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
walk(join(root, "design"));
|
|
184
|
-
return [...found].sort();
|
|
185
|
-
}
|
|
186
|
-
/** The Vite plugin: design sources only, after the TS/JSX transform (a normal plugin runs after
|
|
187
|
-
* the core ones), before import analysis resolves the specifiers. The rewrite keeps every line
|
|
188
|
-
* where it was, so the file's map still lands (no map of its own). */
|
|
189
|
-
function iconsPlugin(root) {
|
|
190
|
-
const design = join(root, "design") + "/";
|
|
191
|
-
return {
|
|
192
|
-
name: "marver:icons",
|
|
193
|
-
transform(code, id) {
|
|
194
|
-
if (!id.startsWith(design) || !/\.[jt]sx?(\?|$)/.test(id)) return;
|
|
195
|
-
const r = unrollIcons(code, iconMaps(root));
|
|
196
|
-
return r ? {
|
|
197
|
-
code: r.code,
|
|
198
|
-
map: null
|
|
199
|
-
} : void 0;
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/server/loc.ts
|
|
205
|
-
/**
|
|
206
|
-
* Every element knows its source (spec 27, Part 6). A dev-only transform on design files adds
|
|
207
|
-
* `data-mv-loc="<path>:<line>:<col>"` to every HOST JSX element - a lowercase plain name (`<div>`,
|
|
208
|
-
* `<button>`, `<my-el>`). Components (`<Card>`) and member names (`<motion.div>`) are skipped: they
|
|
209
|
-
* may not pass attributes on. The laser and a capture's bundles already read `dataset.mvLoc` into
|
|
210
|
-
* `source` (frame-host/inspect.js), so a pick names its file and line and the agent goes there first.
|
|
211
|
-
*
|
|
212
|
-
* It parses with Vite's own `parseSync` (oxc), so anything Vite compiles it reads, and inserts the
|
|
213
|
-
* attribute right after the tag name - FIRST, so an explicit `data-mv-loc` or a spread later in the
|
|
214
|
-
* tag wins. Edits go through magic-string, whose hires map composes with Vite's.
|
|
215
|
-
*
|
|
216
|
-
* Location: the `<` of the opening tag in the ORIGINAL source, 1-based line and 1-based column, the
|
|
217
|
-
* column in UTF-16 code units - what JS string indices, source maps and editors' column counters
|
|
218
|
-
* (VS Code included) use, so an emoji before the tag counts 2.
|
|
219
|
-
*/
|
|
220
|
-
const DESIGN_FILE = /\.(tsx|jsx)$/;
|
|
221
|
-
/** Line starts of `code`, so an offset becomes a 1-based line and column. */
|
|
222
|
-
function lineIndex(code) {
|
|
223
|
-
const starts = [0];
|
|
224
|
-
for (let i = 0; i < code.length; i++) if (code.charCodeAt(i) === 10) starts.push(i + 1);
|
|
225
|
-
return (offset) => {
|
|
226
|
-
let lo = 0, hi = starts.length - 1;
|
|
227
|
-
while (lo < hi) {
|
|
228
|
-
const mid = lo + hi + 1 >> 1;
|
|
229
|
-
if (starts[mid] <= offset) lo = mid;
|
|
230
|
-
else hi = mid - 1;
|
|
231
|
-
}
|
|
232
|
-
return {
|
|
233
|
-
line: lo + 1,
|
|
234
|
-
col: offset - starts[lo] + 1
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
/** Add `data-mv-loc` to every host element of one design file. `file` is the path the attribute
|
|
239
|
-
* names (relative to the repo root, forward slashes). Null when there is nothing to add or the
|
|
240
|
-
* file does not parse - Vite then reports the error as it would have. */
|
|
241
|
-
function addSourceLocations(code, file) {
|
|
242
|
-
if (!code.includes("<")) return null;
|
|
243
|
-
const parsed = parseSync(file, code, {
|
|
244
|
-
lang: file.endsWith(".jsx") ? "jsx" : "tsx",
|
|
245
|
-
sourceType: "module"
|
|
246
|
-
});
|
|
247
|
-
if (parsed.errors.length) return null;
|
|
248
|
-
const at = lineIndex(code);
|
|
249
|
-
const s = new MagicString(code);
|
|
250
|
-
let added = 0;
|
|
251
|
-
const walk = (n) => {
|
|
252
|
-
if (!n || typeof n !== "object") return;
|
|
253
|
-
if (Array.isArray(n)) {
|
|
254
|
-
for (const x of n) walk(x);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
const node = n;
|
|
258
|
-
if (node.type === "JSXOpeningElement" && node.name?.type === "JSXIdentifier" && /^[a-z]/.test(node.name.name ?? "") && typeof node.start === "number" && typeof node.name.end === "number") {
|
|
259
|
-
const { line, col } = at(node.start);
|
|
260
|
-
s.appendLeft(node.name.end, ` data-mv-loc={${JSON.stringify(`${file}:${line}:${col}`)}}`);
|
|
261
|
-
added++;
|
|
262
|
-
}
|
|
263
|
-
for (const k in node) if (k !== "parent") walk(node[k]);
|
|
264
|
-
};
|
|
265
|
-
walk(parsed.program);
|
|
266
|
-
if (!added) return null;
|
|
267
|
-
return {
|
|
268
|
-
code: s.toString(),
|
|
269
|
-
map: s.generateMap({
|
|
270
|
-
hires: true,
|
|
271
|
-
source: file,
|
|
272
|
-
includeContent: true
|
|
273
|
-
})
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
/** The dev server's plugin: design/**\/*.tsx|jsx only, never node_modules, never the published
|
|
277
|
-
* build (dev.ts adds it; build.ts does not). Ids are real paths, so the root is matched both ways. */
|
|
278
|
-
function locPlugin(root) {
|
|
279
|
-
const roots = [.../* @__PURE__ */ new Set([root, safeReal$1(root)])];
|
|
280
|
-
const repoPath = (id) => {
|
|
281
|
-
const file = id.split("?")[0];
|
|
282
|
-
if (!DESIGN_FILE.test(file) || file.includes(`${sep}node_modules${sep}`) || file.includes("/node_modules/")) return null;
|
|
283
|
-
for (const r of roots) {
|
|
284
|
-
const rel = relative(r, file);
|
|
285
|
-
if (!rel.startsWith("..") && (rel.startsWith(`design${sep}`) || rel.startsWith("design/"))) return rel.split(sep).join("/");
|
|
286
|
-
}
|
|
287
|
-
return null;
|
|
288
|
-
};
|
|
289
|
-
return {
|
|
290
|
-
name: "marver:loc",
|
|
291
|
-
enforce: "pre",
|
|
292
|
-
apply: "serve",
|
|
293
|
-
transform(code, id) {
|
|
294
|
-
const file = repoPath(id);
|
|
295
|
-
return file ? addSourceLocations(code, file) : null;
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function safeReal$1(p) {
|
|
300
|
-
try {
|
|
301
|
-
return realpathSync(p);
|
|
302
|
-
} catch {
|
|
303
|
-
return p;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region src/server/dev.ts
|
|
308
|
-
/** packageDir = the installed marver package root (dist/cli.js lives one level down). */
|
|
309
|
-
function packageDir() {
|
|
310
|
-
return join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
311
|
-
}
|
|
312
|
-
const portFree = (p) => new Promise((res) => {
|
|
313
|
-
const s = createServer();
|
|
314
|
-
s.once("error", () => res(false));
|
|
315
|
-
s.once("listening", () => s.close(() => res(true)));
|
|
316
|
-
s.listen(p, "127.0.0.1");
|
|
317
|
-
});
|
|
318
|
-
/** realpath, or the path itself when it cannot be resolved (never throws at boot). */
|
|
319
|
-
const safeReal = (p) => {
|
|
320
|
-
try {
|
|
321
|
-
return realpathSync(p);
|
|
322
|
-
} catch {
|
|
323
|
-
return p;
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
/** C1: a deterministic per-project port in [5200,5399] derived from the root path. Two projects
|
|
327
|
-
* never collide, and the same project always lands on the same port across restarts. */
|
|
328
|
-
const projectPort = (root) => {
|
|
329
|
-
let h = 0;
|
|
330
|
-
for (let i = 0; i < root.length; i++) h = Math.imul(h, 31) + root.charCodeAt(i) | 0;
|
|
331
|
-
return 5200 + Math.abs(h) % 200;
|
|
332
|
-
};
|
|
333
|
-
/** Pick the port to serve on: the desired one if free, else a DETERMINISTIC per-project fallback -
|
|
334
|
-
* never a silent next-free drift, which made a bookmarked tab silently serve a DIFFERENT project. */
|
|
335
|
-
async function pickPort(root, desired) {
|
|
336
|
-
if (await portFree(desired)) return {
|
|
337
|
-
port: desired,
|
|
338
|
-
fellBack: false
|
|
339
|
-
};
|
|
340
|
-
let p = projectPort(root);
|
|
341
|
-
for (let i = 0; i < 200; i++) {
|
|
342
|
-
if (p !== desired && await portFree(p)) return {
|
|
343
|
-
port: p,
|
|
344
|
-
fellBack: true
|
|
345
|
-
};
|
|
346
|
-
p = 5200 + (p - 5200 + 1) % 200;
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
port: desired,
|
|
350
|
-
fellBack: true
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* What the dev server must never hand out, however deep in the repo it sits.
|
|
355
|
-
*
|
|
356
|
-
* `marver dev` puts the whole repository on the web so frames can import from it.
|
|
357
|
-
* The collaboration credential no longer lives in there - it moved to
|
|
358
|
-
* ~/.marver/canvases/ precisely because guarding it here could not be finished -
|
|
359
|
-
* but design/.local still holds the local profile and whatever a previous version
|
|
360
|
-
* left behind, and none of that is anybody's business but the author's.
|
|
361
|
-
*
|
|
362
|
-
* Vite's own defaults are restated rather than assumed. `fs.deny` REPLACES the
|
|
363
|
-
* default list, so an array containing only our own rule quietly re-exposes
|
|
364
|
-
* `.env`, private keys, `.npmrc` and `.git` - a much larger hole than the one
|
|
365
|
-
* being closed, opened by closing it. Kept as an exported constant so a test can
|
|
366
|
-
* hold both halves.
|
|
367
|
-
*/
|
|
368
|
-
const FS_DENY = [
|
|
369
|
-
".env",
|
|
370
|
-
".env.*",
|
|
371
|
-
"*.{crt,pem,key,p12,pfx,cer,der}",
|
|
372
|
-
".npmrc",
|
|
373
|
-
".yarnrc.yml",
|
|
374
|
-
"**/.git/**",
|
|
375
|
-
".dev.vars",
|
|
376
|
-
".dev.vars.*",
|
|
377
|
-
"**/design/.local/**"
|
|
378
|
-
];
|
|
379
|
-
/**
|
|
380
|
-
* The half of the credential guard that globs cannot do.
|
|
381
|
-
*
|
|
382
|
-
* `fs.deny` matches the REQUEST path, lexically, and then Vite stats and streams
|
|
383
|
-
* whatever that path resolves to. So a repository containing
|
|
384
|
-
* `leak.json -> design/.local/anything` serves that file at `/leak.json` to any
|
|
385
|
-
* authored frame that asks - the deny rule never sees the name it is looking for.
|
|
386
|
-
* Verified against a real dev server before this existed.
|
|
387
|
-
*
|
|
388
|
-
* More patterns cannot fix that; only resolving can. This runs BEFORE Vite's own
|
|
389
|
-
* middlewares (a `configureServer` hook that does not return a function is
|
|
390
|
-
* installed first) and refuses any request whose real file lands inside
|
|
391
|
-
* design/.local, whatever route it took to get there.
|
|
392
|
-
*
|
|
393
|
-
* "Whatever route" means every place Vite would look, not just the project root.
|
|
394
|
-
* `public/` is mapped onto `/`, so `public/leak.json -> ../design/.local/x` is
|
|
395
|
-
* served at `/leak.json` - and Vite skips its own deny checks entirely for public
|
|
396
|
-
* files, so that spelling was reachable even with the root candidate guarded.
|
|
397
|
-
* Each candidate is resolved; if any lands in design/.local, the request is
|
|
398
|
-
* refused.
|
|
399
|
-
*
|
|
400
|
-
* The boundary this does NOT claim: a repository that can write symlinks can also
|
|
401
|
-
* write `design/config.ts`, which `marver dev` imports and RUNS in this process
|
|
402
|
-
* before any of the above exists. Running `dev` on a repository you do not trust
|
|
403
|
-
* hands it your machine long before it hands it a file, so a symlink is not the
|
|
404
|
-
* interesting way in. What this closes is the frame-in-a-trusted-repo case: a
|
|
405
|
-
* component that runs in the browser, same-origin, that can only ask for URLs and
|
|
406
|
-
* cannot create a file to ask for.
|
|
407
|
-
*/
|
|
408
|
-
function denyLocalSecrets(root) {
|
|
409
|
-
const guardedAt = join(root, "design", ".local");
|
|
410
|
-
const publicAt = join(root, "public");
|
|
411
|
-
const inside = (real, dir) => {
|
|
412
|
-
const rel = relative(dir, real);
|
|
413
|
-
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
414
|
-
};
|
|
415
|
-
return {
|
|
416
|
-
name: "marver:deny-local-secrets",
|
|
417
|
-
configureServer(server) {
|
|
418
|
-
server.middlewares.use((req, res, next) => {
|
|
419
|
-
let pathname;
|
|
420
|
-
try {
|
|
421
|
-
pathname = decodeURIComponent((req.url ?? "/").split("?")[0].split("#")[0]);
|
|
422
|
-
} catch {
|
|
423
|
-
return next();
|
|
424
|
-
}
|
|
425
|
-
const rel = "." + (pathname.startsWith("/") ? pathname : `/${pathname}`);
|
|
426
|
-
const derived = (base) => [
|
|
427
|
-
base,
|
|
428
|
-
`${base}.html`,
|
|
429
|
-
join(base, "index"),
|
|
430
|
-
join(base, "index.html")
|
|
431
|
-
];
|
|
432
|
-
const candidates = pathname.startsWith("/@fs/") ? derived(pathname.slice(4)) : [...derived(resolve(root, rel)), ...derived(resolve(publicAt, rel))];
|
|
433
|
-
let guarded;
|
|
434
|
-
try {
|
|
435
|
-
guarded = realpathSync(guardedAt);
|
|
436
|
-
} catch {
|
|
437
|
-
return next();
|
|
438
|
-
}
|
|
439
|
-
if (!candidates.some((c) => {
|
|
440
|
-
try {
|
|
441
|
-
return inside(realpathSync(c), guarded);
|
|
442
|
-
} catch {
|
|
443
|
-
return false;
|
|
444
|
-
}
|
|
445
|
-
})) return next();
|
|
446
|
-
res.statusCode = 403;
|
|
447
|
-
res.setHeader("content-type", "text/plain; charset=utf-8");
|
|
448
|
-
res.end("design/.local holds this canvas's credentials and is never served");
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
/** A canvas already runs in this folder (or one is starting): the line says where, or what to do. */
|
|
454
|
-
var DevLockError = class extends Error {};
|
|
455
|
-
async function dev(root, portFlag) {
|
|
456
|
-
const { takeDevLock } = await import("./dev-lock-DWSpa6nj.mjs").then((n) => n.n);
|
|
457
|
-
const lock = await takeDevLock(root);
|
|
458
|
-
if (!lock.ok) throw new DevLockError(lock.message);
|
|
459
|
-
const { removeDevInfo } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
|
|
460
|
-
const onExit = () => {
|
|
461
|
-
removeDevInfo(root, lock.instance);
|
|
462
|
-
lock.release();
|
|
463
|
-
};
|
|
464
|
-
const onSignal = (sig) => {
|
|
465
|
-
onExit();
|
|
466
|
-
process.kill(process.pid, sig);
|
|
467
|
-
};
|
|
468
|
-
process.once("exit", onExit);
|
|
469
|
-
process.once("SIGINT", onSignal);
|
|
470
|
-
process.once("SIGTERM", onSignal);
|
|
471
|
-
process.once("SIGHUP", onSignal);
|
|
472
|
-
const unhook = () => {
|
|
473
|
-
process.off("exit", onExit);
|
|
474
|
-
process.off("SIGINT", onSignal);
|
|
475
|
-
process.off("SIGTERM", onSignal);
|
|
476
|
-
process.off("SIGHUP", onSignal);
|
|
477
|
-
lock.release();
|
|
478
|
-
};
|
|
479
|
-
try {
|
|
480
|
-
return await boot(root, portFlag, lock.instance, unhook);
|
|
481
|
-
} catch (err) {
|
|
482
|
-
unhook();
|
|
483
|
-
throw err;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
async function boot(root, portFlag, instance, unhook) {
|
|
487
|
-
const config = await loadConfig(root);
|
|
488
|
-
const host = detectHost(root);
|
|
489
|
-
const pkgDir = packageDir();
|
|
490
|
-
const clientDir = join(pkgDir, "src", "client");
|
|
491
|
-
const projectName = basename(root);
|
|
492
|
-
const desiredPort = portFlag ?? (config.port !== 5199 ? config.port : void 0) ?? projectPort(root);
|
|
493
|
-
const picked = await pickPort(root, desiredPort);
|
|
494
|
-
const esc = (p) => join(p, "design").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
495
|
-
const designDir = new RegExp(`^(${[.../* @__PURE__ */ new Set([root, safeReal(root)])].map(esc).join("|")})[/\\\\]`);
|
|
496
|
-
const plugins = [denyLocalSecrets(root), react({ exclude: [/\/node_modules\//, designDir] })];
|
|
497
|
-
if (config.jam?.loc !== false) plugins.unshift(locPlugin(root));
|
|
498
|
-
if (host.tailwind === 4) {
|
|
499
|
-
const tw = await tailwind4Plugin(root);
|
|
500
|
-
if (tw) plugins.push(...tw);
|
|
501
|
-
else console.warn(`[marver] tailwindcss v4 detected but @tailwindcss/vite could not be loaded - utility classes WILL be missing from frames. Fix: npm i -D @tailwindcss/vite (used only by the canvas, never by your app's build).`);
|
|
502
|
-
}
|
|
503
|
-
let css;
|
|
504
|
-
if (host.tailwind === 3) css = await tailwind3Css(root) ?? void 0;
|
|
505
|
-
plugins.push(...marverPlugin({
|
|
506
|
-
root,
|
|
507
|
-
clientDir,
|
|
508
|
-
config,
|
|
509
|
-
detectedThemeCss: host.themeCss
|
|
510
|
-
}), iconsPlugin(root));
|
|
511
|
-
const logger = createLogger("info");
|
|
512
|
-
const noise = (msg) => /Sourcemap for .*node_modules.*points to/.test(msg);
|
|
513
|
-
const warnBase = logger.warn.bind(logger);
|
|
514
|
-
const warnOnceBase = logger.warnOnce.bind(logger);
|
|
515
|
-
logger.warn = (msg, opts) => {
|
|
516
|
-
if (!noise(msg)) warnBase(msg, opts);
|
|
517
|
-
};
|
|
518
|
-
logger.warnOnce = (msg, opts) => {
|
|
519
|
-
if (!noise(msg)) warnOnceBase(msg, opts);
|
|
520
|
-
};
|
|
521
|
-
const server = await createServer$1({
|
|
522
|
-
configFile: false,
|
|
523
|
-
root,
|
|
524
|
-
css,
|
|
525
|
-
customLogger: logger,
|
|
526
|
-
plugins,
|
|
527
|
-
server: {
|
|
528
|
-
port: picked.port,
|
|
529
|
-
hmr: { overlay: false },
|
|
530
|
-
strictPort: false,
|
|
531
|
-
fs: {
|
|
532
|
-
allow: [.../* @__PURE__ */ new Set([
|
|
533
|
-
root,
|
|
534
|
-
safeReal(root),
|
|
535
|
-
pkgDir,
|
|
536
|
-
safeReal(pkgDir),
|
|
537
|
-
searchForWorkspaceRoot(root)
|
|
538
|
-
])],
|
|
539
|
-
deny: FS_DENY
|
|
540
|
-
},
|
|
541
|
-
watch: { ignored: [
|
|
542
|
-
"**/design/manifest.json",
|
|
543
|
-
"**/design/boards/**",
|
|
544
|
-
"**/design/.local/**",
|
|
545
|
-
"**/design/.dist/**",
|
|
546
|
-
"**/design/comments/**",
|
|
547
|
-
"**/.next/**",
|
|
548
|
-
"**/.turbo/**",
|
|
549
|
-
"**/.vercel/**",
|
|
550
|
-
"**/.output/**",
|
|
551
|
-
"**/dist/**",
|
|
552
|
-
"**/build/**",
|
|
553
|
-
"**/out/**",
|
|
554
|
-
"**/coverage/**",
|
|
555
|
-
"**/.gstack/**",
|
|
556
|
-
"**/.git/**",
|
|
557
|
-
"**/.playwright-mcp/**",
|
|
558
|
-
"**/context/map.json",
|
|
559
|
-
"**/context/sync/**"
|
|
560
|
-
] },
|
|
561
|
-
warmup: { clientFiles: [
|
|
562
|
-
join(clientDir, "frame-host", "main.tsx"),
|
|
563
|
-
join(clientDir, "frame-host", "bridge.js"),
|
|
564
|
-
join(clientDir, "content", "index.tsx"),
|
|
565
|
-
join(clientDir, "content", "diagram.tsx"),
|
|
566
|
-
join(clientDir, "content", "md.ts")
|
|
567
|
-
] }
|
|
568
|
-
},
|
|
569
|
-
resolve: {
|
|
570
|
-
dedupe: ["react", "react-dom"],
|
|
571
|
-
tsconfigPaths: true
|
|
572
|
-
},
|
|
573
|
-
optimizeDeps: {
|
|
574
|
-
exclude: [PKG],
|
|
575
|
-
include: [
|
|
576
|
-
"react",
|
|
577
|
-
"react-dom",
|
|
578
|
-
"react-dom/client",
|
|
579
|
-
"react/jsx-runtime",
|
|
580
|
-
"react/jsx-dev-runtime",
|
|
581
|
-
`${PKG} > marked`,
|
|
582
|
-
`${PKG} > mermaid`,
|
|
583
|
-
`${PKG} > roughjs`,
|
|
584
|
-
`${PKG} > html-to-image`,
|
|
585
|
-
...iconModules(root)
|
|
586
|
-
],
|
|
587
|
-
entries: [join(clientDir, "frame-host", "index.html"), "design/**/*.{tsx,jsx}"]
|
|
588
|
-
},
|
|
589
|
-
logLevel: "info"
|
|
590
|
-
});
|
|
591
|
-
await server.listen();
|
|
592
|
-
const addr = server.httpServer?.address();
|
|
593
|
-
const port = typeof addr === "object" && addr ? addr.port : picked.port;
|
|
594
|
-
if (picked.fellBack) console.log(`\n port ${desiredPort} is in use - serving "${projectName}" on ${port} instead`);
|
|
595
|
-
console.log(`\n ${NAME} · ${projectName} → http://localhost:${port}/\n`);
|
|
596
|
-
setTimeout(async () => {
|
|
597
|
-
try {
|
|
598
|
-
await (await import("./shot-DqcxJibP.mjs")).sweepGhosts((m) => console.log(` ${m}`));
|
|
599
|
-
} catch {}
|
|
600
|
-
}, 0);
|
|
601
|
-
try {
|
|
602
|
-
const { staleManagedInstructions } = await import("./managed-HwHVNI3h.mjs");
|
|
603
|
-
const { installedVersion } = await import("./plugin-CTD0rydA.mjs").then((n) => n.i);
|
|
604
|
-
const stale = staleManagedInstructions(root);
|
|
605
|
-
if (stale.length) {
|
|
606
|
-
const shown = stale.slice(0, 4).join(", ") + (stale.length > 4 ? `, +${stale.length - 4} more` : "");
|
|
607
|
-
const v = installedVersion();
|
|
608
|
-
console.log(` instructions predate ${v ? NAME + " " + v : "the installed version"} (${shown}) - run: npx ${NAME} init\n`);
|
|
609
|
-
}
|
|
610
|
-
} catch {}
|
|
611
|
-
try {
|
|
612
|
-
if (!existsSync(join(root, "context"))) {
|
|
613
|
-
const n = (await import("./manifest-Nl3KSVOk.mjs").then((n) => n.i)).statusBoards(root).length;
|
|
614
|
-
if (n) console.log(` ${n} feature/project board${n === 1 ? "" : "s"}, no context/ - every status reads Backlog. To start it, tell your agent: "Set up our context."\n`);
|
|
615
|
-
}
|
|
616
|
-
} catch {}
|
|
617
|
-
const { loadCollab, syncOnce } = await import("./sync-DKk-yT1V.mjs").then((n) => n.o);
|
|
618
|
-
if (loadCollab(root)) console.log(` comments: syncing with the published canvas\n`);
|
|
619
|
-
let syncing = false;
|
|
620
|
-
const tick = async () => {
|
|
621
|
-
if (syncing) return;
|
|
622
|
-
syncing = true;
|
|
623
|
-
try {
|
|
624
|
-
const collab = loadCollab(root);
|
|
625
|
-
if (collab) await syncOnce(root, collab).catch(() => {});
|
|
626
|
-
} finally {
|
|
627
|
-
syncing = false;
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
tick();
|
|
631
|
-
setInterval(tick, 3e4).unref();
|
|
632
|
-
const { workActivity, writeDevInfo, removeDevInfo, boardsShowing, onBoardsChanged, nextActivitySeq } = await import("./work-F5u-twpJ.mjs").then((n) => n.o);
|
|
633
|
-
let sent = "";
|
|
634
|
-
const broadcast = (frames) => {
|
|
635
|
-
const state = {
|
|
636
|
-
frames: [...frames].sort(),
|
|
637
|
-
boards: boardsShowing(root, frames)
|
|
638
|
-
};
|
|
639
|
-
const key = JSON.stringify(state);
|
|
640
|
-
if (key === sent) return;
|
|
641
|
-
sent = key;
|
|
642
|
-
server.ws.send("sh:jam-activity", {
|
|
643
|
-
...state,
|
|
644
|
-
seq: nextActivitySeq()
|
|
645
|
-
});
|
|
646
|
-
};
|
|
647
|
-
const unsubscribe = workActivity.onChange(broadcast);
|
|
648
|
-
const offBoards = onBoardsChanged((r) => {
|
|
649
|
-
if (r === root) broadcast(workActivity.active());
|
|
650
|
-
});
|
|
651
|
-
const sweep = setInterval(() => workActivity.sweep(), 15e3);
|
|
652
|
-
sweep.unref?.();
|
|
653
|
-
writeDevInfo(root, port, instance);
|
|
654
|
-
{
|
|
655
|
-
const close = server.close.bind(server);
|
|
656
|
-
server.close = (async () => {
|
|
657
|
-
unsubscribe();
|
|
658
|
-
offBoards();
|
|
659
|
-
clearInterval(sweep);
|
|
660
|
-
removeDevInfo(root, instance);
|
|
661
|
-
unhook();
|
|
662
|
-
return close();
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
{
|
|
666
|
-
const dir = join(root, "design", "comments");
|
|
667
|
-
const due = /* @__PURE__ */ new Map();
|
|
668
|
-
try {
|
|
669
|
-
mkdirSync(dir, { recursive: true });
|
|
670
|
-
const w = watch(dir, { persistent: false }, (_e, file) => {
|
|
671
|
-
const m = typeof file === "string" ? file.match(/^([a-z0-9][a-z0-9-]*)\.jsonl$/) : null;
|
|
672
|
-
if (!m) return;
|
|
673
|
-
clearTimeout(due.get(m[1]));
|
|
674
|
-
due.set(m[1], setTimeout(() => {
|
|
675
|
-
due.delete(m[1]);
|
|
676
|
-
server.ws.send("sh:jam-comment", { board: m[1] });
|
|
677
|
-
}, 120));
|
|
678
|
-
});
|
|
679
|
-
const close = server.close.bind(server);
|
|
680
|
-
server.close = (async () => {
|
|
681
|
-
w.close();
|
|
682
|
-
for (const t of due.values()) clearTimeout(t);
|
|
683
|
-
return close();
|
|
684
|
-
});
|
|
685
|
-
} catch {}
|
|
686
|
-
}
|
|
687
|
-
if (config.jam) {
|
|
688
|
-
const { startJam } = await import("./daemon-DZo6o3rU.mjs");
|
|
689
|
-
const { checkAnchor } = await import("./anchor-check-Dg5xpNnU.mjs");
|
|
690
|
-
const jam = startJam(root, config.jam, (m) => console.log(m), (board) => server.ws.send("sh:jam-comment", { board }), (frameId, target, others, look) => checkAnchor({
|
|
691
|
-
root,
|
|
692
|
-
viewports: config.viewports,
|
|
693
|
-
origin: `http://localhost:${port}`,
|
|
694
|
-
frameId,
|
|
695
|
-
target,
|
|
696
|
-
others,
|
|
697
|
-
...look
|
|
698
|
-
}), (() => {
|
|
699
|
-
let due = null;
|
|
700
|
-
return () => {
|
|
701
|
-
due ??= setTimeout(async () => {
|
|
702
|
-
due = null;
|
|
703
|
-
const { jamLive } = await import("./live-Cgzsicwi.mjs");
|
|
704
|
-
server.ws.send("sh:jam-queue", jamLive.view?.() ?? { cards: [] });
|
|
705
|
-
}, 60);
|
|
706
|
-
};
|
|
707
|
-
})(), async (frameId, theme, entry, size) => {
|
|
708
|
-
const { shootFrame } = await import("./shot-DqcxJibP.mjs");
|
|
709
|
-
const r = await shootFrame({
|
|
710
|
-
root,
|
|
711
|
-
viewports: config.viewports,
|
|
712
|
-
frameId,
|
|
713
|
-
theme,
|
|
714
|
-
origin: `http://localhost:${port}`,
|
|
715
|
-
...size ? { size } : {}
|
|
716
|
-
});
|
|
717
|
-
if (!r.ok) return null;
|
|
718
|
-
const { addPicture } = await import("./capture-CrqvU_jh.mjs").then((n) => n.i);
|
|
719
|
-
return addPicture(root, r.path, {
|
|
720
|
-
frame: frameId,
|
|
721
|
-
...entry
|
|
722
|
-
});
|
|
723
|
-
});
|
|
724
|
-
if (jam) {
|
|
725
|
-
const { createSpeech, speechLive } = await import("./audio-CmSRYFEs.mjs");
|
|
726
|
-
const { appendTalk } = await import("./session-qZWKt_VA.mjs").then((n) => n.s);
|
|
727
|
-
const speech = createSpeech({ onTalk: (t) => appendTalk(root, t.session, t.words) });
|
|
728
|
-
if (server.httpServer) speech.attach(server.httpServer);
|
|
729
|
-
speechLive.svc = speech;
|
|
730
|
-
const close = server.close.bind(server);
|
|
731
|
-
server.close = (async () => {
|
|
732
|
-
jam.stop();
|
|
733
|
-
speech.stop();
|
|
734
|
-
speechLive.svc = void 0;
|
|
735
|
-
return close();
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
} else if (config.jamOff === "no-agent") console.log(` jam: no agent CLI on PATH (claude, codex, cursor, droid, opencode, grok, or pi) - install one and tag @${NAME} in a comment\n`);
|
|
739
|
-
return server;
|
|
740
|
-
}
|
|
741
|
-
//#endregion
|
|
742
|
-
export { DevLockError, dev };
|