@marver-design/marver 0.26.0 → 0.26.1

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 (44) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +2 -2
  3. package/dist/{anchor-check-Dg5xpNnU.mjs → anchor-check-l-ny3UzH.mjs} +1 -1
  4. package/dist/{audio-CmSRYFEs.mjs → audio-Dw1lfMdb.mjs} +14 -0
  5. package/dist/{bake-DtVlm0_F.mjs → bake-C-awKgLA.mjs} +1 -1
  6. package/dist/{build-C_gUgcdC.mjs → build-BDRiO_mP.mjs} +3 -3
  7. package/dist/{capture-CrqvU_jh.mjs → capture-vadKjuCo.mjs} +2 -1
  8. package/dist/cli.mjs +6 -6
  9. package/dist/{daemon-DZo6o3rU.mjs → daemon-DL6Fwq6D.mjs} +394 -270
  10. package/dist/{dev-_Nlsc6v9.mjs → dev-Bw_qYWWq.mjs} +24 -11
  11. package/dist/{marks-NQi0wZJ4.mjs → marks-DyWMv_Z1.mjs} +1 -1
  12. package/dist/perf-C75MZ73h.mjs +167 -0
  13. package/dist/perf-jam-BU3TVrZu.mjs +239 -0
  14. package/dist/{plugin-CTD0rydA.mjs → plugin-DkGmZs_r.mjs} +42 -22
  15. package/dist/{poster-ChjXGTS5.mjs → poster-BdtSKMDm.mjs} +2 -1
  16. package/dist/{publish-bakes-CEP_2NRc.mjs → publish-bakes-9RzRToXV.mjs} +2 -2
  17. package/dist/{queue-BuiCKSX1.mjs → queue-29ok5_eZ.mjs} +2 -2
  18. package/dist/{session-qZWKt_VA.mjs → session-BAaJsK5c.mjs} +1 -1
  19. package/dist/{shot-DqcxJibP.mjs → shot-DQeR_Pfn.mjs} +337 -19
  20. package/dist/shot-XQV7HC9A.mjs +139 -0
  21. package/dist/speech-worker.mjs +40 -5
  22. package/docs/jam-session.md +24 -7
  23. package/docs/live-jam.md +8 -0
  24. package/package.json +1 -1
  25. package/src/client/frame-host/inspect.js +8 -3
  26. package/src/client/frame-host/keys.js +6 -2
  27. package/src/client/shell/App.tsx +8 -4
  28. package/src/client/shell/JamSurface.tsx +9 -3
  29. package/src/client/shell/Play.tsx +11 -7
  30. package/src/client/shell/Toolbar.tsx +5 -4
  31. package/src/client/shell/canvas/FrameNode.tsx +3 -2
  32. package/src/client/shell/icons.tsx +2 -0
  33. package/src/client/shell/jam-capture.ts +77 -11
  34. package/src/client/shell/jam-keys.ts +47 -18
  35. package/src/client/shell/jam-lane.tsx +46 -5
  36. package/src/client/shell/jam-panel.tsx +63 -13
  37. package/src/client/shell/jam-state.ts +48 -6
  38. package/src/client/shell/jam-surface-parts.tsx +10 -6
  39. package/src/client/shell/store.ts +14 -5
  40. package/src/client/shell/styles.css +28 -8
  41. package/src/client/stage/main.tsx +2 -0
  42. package/templates/instructions/jam.md +5 -3
  43. package/dist/perf-D6VmmJ2q.mjs +0 -68
  44. package/dist/shot-CNbHoZ6H.mjs +0 -86
@@ -9,8 +9,9 @@ import { Caption, FocusPanel, NotesCard, ReadBack, ReviewDetail, VoiceAsk } from
9
9
  import type { TimelineLine } from './jam-lines.ts'
10
10
  import type { JamCard } from './jam-queue.ts'
11
11
 
12
- export function CaptureLaneRow({ tiles, recording, between, selected, keyboard, followEnd, onOpen, onMenu, notes, ask, caption }: {
12
+ export function CaptureLaneRow({ tiles, recording, between, selected, keyboard, followEnd, onOpen, onMenu, notes, ask, caption, doneOpen, onDoneOpen }: {
13
13
  tiles: LaneTile[]; recording?: LaneRecording; between?: LaneBetween; selected?: string; keyboard?: boolean; followEnd?: number; onOpen(id: string): void
14
+ doneOpen?: boolean; onDoneOpen?(open: boolean, doneIds: string[]): void
14
15
  onMenu?(e: React.MouseEvent, id: string): void
15
16
  notes?: { notes: { t: string; text: string }[]; draft: string; onDraft(t: string): void; onAdd(): void; onClose(): void }
16
17
  /** the microphone question (and the model's download), over the capture tile */
@@ -35,7 +36,7 @@ export function CaptureLaneRow({ tiles, recording, between, selected, keyboard,
35
36
  const roomLeft = (at?.left ?? 10) - 8 >= 300
36
37
  return (
37
38
  <>
38
- <Lane tiles={tiles} recording={recording} between={between} selected={selected} keyboard={keyboard} followEnd={followEnd} onOpen={onOpen} onMenu={onMenu} />
39
+ <Lane tiles={tiles} recording={recording} between={between} selected={selected} keyboard={keyboard} followEnd={followEnd} onOpen={onOpen} onMenu={onMenu} doneOpen={doneOpen} onDoneOpen={onDoneOpen} />
39
40
  {/* one lane up, over the capture tile: the question, then the notes card above it; the words just
40
41
  left of the notes card (bottoms aligned), or over the tile when it is closed */}
41
42
  {(notes || ask) && (
@@ -59,8 +60,8 @@ export function FocusPanelView(p: {
59
60
  left: number; kind: 'capture' | 'review' | 'wrapup'; card: JamCard; of: [number, number] | undefined; agent: string; reviewedTitle?: string
60
61
  lines: TimelineLine[]; pictures: { id: string; url: string; caption: string }[]
61
62
  shots: { frame: string; before?: string; after?: string; new?: boolean }[]; reply: string
62
- view: 'after' | 'before'; tab: number; moreOpen: boolean
63
- onTab(i: number): void; onFlip(): void; onMoreOpen(on: boolean): void; onClose(): void
63
+ view: 'both' | 'before' | 'after'; tab: number; moreOpen: boolean
64
+ onTab(i: number): void; onFlip(view: 'both' | 'before' | 'after'): void; onMoreOpen(on: boolean): void; onClose(): void
64
65
  onEdit(text: string): void; onConfirm(): void; onKeep(): void; onDrop(): void; onResume?: () => void
65
66
  onGood(): void; onMore(text: string): void; onLater(): void; onOpenThread(): void
66
67
  onPrev?: () => void; onNext?: () => void; pending?: string; onRetry?: () => void; locked?: boolean
@@ -72,6 +73,9 @@ export function FocusPanelView(p: {
72
73
  // a capture under review: its review, or the capture itself as it was read back (its pictures, its timeline)
73
74
  const [pane, setPane] = useState<'review' | 'capture'>('review')
74
75
  useEffect(() => { setPane('review') }, [c.id])
76
+ // the review asks for the width its pictures need (both at once, as big as the panel's height allows)
77
+ const [fit, setFit] = useState<number | undefined>(undefined)
78
+ useEffect(() => { setFit(undefined) }, [c.id])
75
79
  const head = p.kind === 'review' ? (
76
80
  <div className="jm-ftabs jm-panes" role="tablist" data-jam-panes="">
77
81
  {(['review', 'capture'] as const).map((v) => <button key={v} role="tab" aria-selected={v === pane} className={v === pane ? 'on' : undefined} onClick={() => setPane(v)}>{v === 'review' ? 'Review' : 'Capture'}</button>)}
@@ -84,10 +88,10 @@ export function FocusPanelView(p: {
84
88
  points ? `${points} point${points === 1 ? '' : 's'}` : '', p.pictures.length ? `${p.pictures.length} picture${p.pictures.length === 1 ? '' : 's'}` : '',
85
89
  notes ? `${notes} note${notes === 1 ? '' : 's'}` : ''].filter(Boolean)
86
90
  return (
87
- <FocusPanel left={p.left} onClose={p.onClose}>
91
+ <FocusPanel left={p.left} onClose={p.onClose} width={p.kind === 'review' && pane === 'review' ? fit : undefined}>
88
92
  {p.kind === 'review' && pane === 'review' ? (
89
93
  <ReviewDetail key={c.id} title={title} head={head} of={p.of} onPrev={p.onPrev} onNext={p.onNext} frames={p.shots.map((s) => s.frame)} active={p.tab} onTab={p.onTab}
90
- view={p.view} onFlip={() => p.onFlip()} reply={p.reply} shots={p.shots} agent={p.agent}
94
+ view={p.view} onFlip={(v) => p.onFlip(v)} onFit={setFit} reply={p.reply} shots={p.shots} agent={p.agent}
91
95
  more={p.moreOpen} draftKey={c.id} onMore={p.onMore} onMoreOpen={p.onMoreOpen} onGood={p.onGood} onLater={p.onLater} onOpenThread={p.onOpenThread} />
92
96
  ) : (
93
97
  <ReadBack key={c.id} title={title} head={head} of={p.of} onPrev={p.onPrev} onNext={p.onNext} meta={meta} lines={p.lines} pictures={p.pictures} edited={c.edited} pending={p.pending}
@@ -506,7 +506,8 @@ interface State {
506
506
  gesture: boolean // a frame drag/resize is in progress - canvas panning is disabled
507
507
  /** the node a person resized last (a new object each time) - a measurement never sets it */
508
508
  resized: { key: string } | null
509
- laser: boolean // laser/inspect mode: frames outline their structure
509
+ laser: boolean // laser mode: a pointer - the element under the cursor lit, a click copies its path
510
+ laserInspect: boolean // the laser as inspect (⌥L): every element outlined, as the laser was before 0.26.1
510
511
  board: string // active board name; UNPLACED is the Not on a board view
511
512
  boardAuto: boolean // auto boards gain new frames on arrival; curated boards never do
512
513
  deviceView: string | null // board-wide device preview (viewport name), null = free-form layout
@@ -556,7 +557,9 @@ interface State {
556
557
  setInteract(key: string | null): void
557
558
  setPlay(p: State['play']): void
558
559
  setGesture(g: boolean): void
559
- setLaser(on: boolean): void
560
+ setLaser(on: boolean, inspect?: boolean): void
561
+ /** L (`inspect` false) or ⌥L (true): the same mode again turns the laser off; the other switches to it */
562
+ toggleLaser(inspect: boolean): void
560
563
  invalidateFrames(frameIds: string[], revision: string, docs?: { epoch?: string; docs?: Record<string, number> }): void
561
564
  setExternalLease(nodeKey: string, reason: 'laser' | 'comment', on: boolean): void
562
565
  /** A safe point (a lease ended, a gesture ended): stale nodes may reload now. */
@@ -1035,7 +1038,7 @@ export const useStore = create<State>((set, get) => {
1035
1038
  }
1036
1039
 
1037
1040
  return {
1038
- manifest: null, nodes: [], selection: [], interact: null, viewTheme: initialViewTheme(), play: null, gesture: false, resized: null, laser: false,
1041
+ manifest: null, nodes: [], selection: [], interact: null, viewTheme: initialViewTheme(), play: null, gesture: false, resized: null, laser: false, laserInspect: false,
1039
1042
  board: DATA?.default ?? UNPLACED, boardAuto: false, deviceView: null, sceneRows: null, layout: null, layoutRaw: undefined, baseLayout: null, laidOut: null, baseLaidOut: null,
1040
1043
  panelOpen: true, scale: 1, toasts: [], working: [], workingSince: {}, workingBoards: [], workingSeq: -1, boardHash: null, dirty: false, boardTitles: DATA?.titles ?? {}, boardMeta: DATA?.meta ?? {},
1041
1044
  externalLeases: {}, playUpdateRevision: null, stageShown: null, playNav: 0, pathPulse: 0, imagePulse: 0, imageBusy: false,
@@ -1573,12 +1576,18 @@ export const useStore = create<State>((set, get) => {
1573
1576
  get().flushFrameUpdates() // A6: the frame just left interact is no longer leased
1574
1577
  },
1575
1578
  setPlay(play) { set({ play }) },
1576
- setLaser(laser) {
1577
- if (laser) { set({ laser }); return }
1579
+ toggleLaser(inspect) {
1580
+ const s = get()
1581
+ if (s.laser && s.laserInspect === inspect) s.setLaser(false)
1582
+ else s.setLaser(true, inspect)
1583
+ },
1584
+ setLaser(laser, inspect = false) {
1585
+ if (laser) { set({ laser, laserInspect: inspect }); return }
1578
1586
  // leaving laser mode drops every laser engagement lease (the bridge stops reporting), but
1579
1587
  // keeps comment engagement; the freed frames may now flush a deferred update
1580
1588
  set((s) => ({
1581
1589
  laser,
1590
+ laserInspect: false,
1582
1591
  externalLeases: Object.fromEntries(
1583
1592
  Object.entries(s.externalLeases).filter(([, v]) => v.comment).map(([k]) => [k, { comment: true as const }])),
1584
1593
  }))
@@ -1496,16 +1496,16 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
1496
1496
  much more transparent than the shell's glass, a strong backdrop blur so text reads over any frame, a
1497
1497
  glaze (top highlight + a thin light rim) and a teeny shadow. Colour lives in the state glyph only. ---- */
1498
1498
  .sh-app {
1499
- --jm-tile: rgba(255, 255, 255, .36);
1500
- --jm-tile-hover: rgba(255, 255, 255, .58);
1499
+ --jm-tile: rgba(255, 255, 255, .6);
1500
+ --jm-tile-hover: rgba(255, 255, 255, .78);
1501
1501
  --jm-tile-glaze: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .08) 55%, rgba(255, 255, 255, 0));
1502
1502
  --jm-tile-blur: blur(18px) saturate(180%);
1503
1503
  --jm-tile-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .75), inset 0 1px 0 rgba(255, 255, 255, .9),
1504
1504
  0 0 0 .5px rgba(24, 24, 27, .09), 0 1px 1.5px rgba(24, 24, 27, .06), 0 3px 8px -4px rgba(24, 24, 27, .14);
1505
1505
  --jm-r: 11px }
1506
1506
  .sh-app.dark, .jm-stage {
1507
- --jm-tile: rgba(34, 34, 42, .42);
1508
- --jm-tile-hover: rgba(52, 52, 62, .6);
1507
+ --jm-tile: rgba(34, 34, 42, .62);
1508
+ --jm-tile-hover: rgba(52, 52, 62, .76);
1509
1509
  --jm-tile-glaze: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .015) 55%, rgba(255, 255, 255, 0));
1510
1510
  --jm-tile-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1), inset 0 1px 0 rgba(255, 255, 255, .1),
1511
1511
  0 0 0 .5px rgba(0, 0, 0, .4), 0 1px 1.5px rgba(0, 0, 0, .25), 0 3px 8px -4px rgba(0, 0, 0, .45) }
@@ -1522,9 +1522,15 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
1522
1522
  .jm-lane-in { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; pointer-events: auto;
1523
1523
  padding: 6px 4px; margin: -6px -4px; scrollbar-width: none; overscroll-behavior-x: contain } /* room for the tiles' shadow inside the scroller */
1524
1524
  .jm-lane-in::-webkit-scrollbar { display: none }
1525
- .jm-lane-in.fade-r { -webkit-mask: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 56px), transparent) }
1526
- .jm-lane-in.fade-l { -webkit-mask: linear-gradient(90deg, transparent, #000 56px); mask: linear-gradient(90deg, transparent, #000 56px) }
1527
- .jm-lane-in.fade-l.fade-r { -webkit-mask: linear-gradient(90deg, transparent, #000 56px calc(100% - 56px), transparent); mask: linear-gradient(90deg, transparent, #000 56px calc(100% - 56px), transparent) }
1525
+ /* the edge fades: two strips BESIDE the scroller, never a mask on it - a masked ancestor is a backdrop root,
1526
+ and every tile inside it would lose its blur (0.26.2: the lane was unreadable exactly when it was full).
1527
+ Each strip blurs what is under it and tints it toward the ground, under its own mask (its own mask leaves
1528
+ its own backdrop filter alone). */
1529
+ .jm-lane-edge { position: absolute; top: -6px; bottom: -6px; width: 56px; pointer-events: none; z-index: 1;
1530
+ background: linear-gradient(90deg, var(--ground), transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
1531
+ -webkit-mask: linear-gradient(90deg, #000, transparent); mask: linear-gradient(90deg, #000, transparent) }
1532
+ .jm-lane-edge.l { left: -4px }
1533
+ .jm-lane-edge.r { right: -4px; transform: scaleX(-1) }
1528
1534
  .jm-lane .jm-chip { flex: none } /* the recording tile: last, whole */
1529
1535
 
1530
1536
  /* ---- the toolbar's Jam button (between Laser and Tidy). No blue while a session runs: blue is hover and
@@ -1558,6 +1564,12 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
1558
1564
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums }
1559
1565
  .jm-card .x { flex: none; display: inline-flex; color: var(--glass-ink-3); margin-left: auto }
1560
1566
  .jm-card.review .m { color: var(--glass-ink-2) }
1567
+ /* the Done fold (0.26.1): the group tile, the narrow collapse tile that leads the opened done tiles, and their slide */
1568
+ .jm-card.close { width: auto; gap: 6px; padding: 0 12px; color: var(--glass-ink-2) }
1569
+ .jm-card.close .t { font: 600 12px -apple-system, system-ui, sans-serif }
1570
+ .jm-card.unfold { animation: jm-unfold .16s cubic-bezier(.2, .7, .3, 1) both }
1571
+ @keyframes jm-unfold { from { transform: translateX(-14px); opacity: 0 } }
1572
+ @media (prefers-reduced-motion: reduce) { .jm-card.unfold { animation: none } }
1561
1573
  .jm-card.queued .t, .jm-card.confirming .t { color: var(--glass-ink-2) }
1562
1574
  .jm-card.done .t, .jm-card.kept .t { color: var(--glass-ink-3) }
1563
1575
  .jm-card.held { color: var(--glass-ink-3) }
@@ -1801,7 +1813,7 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
1801
1813
  .jm-focus { position: absolute; top: var(--edge); bottom: calc(var(--edge) + var(--jm-lane) + 2px); z-index: 31; display: flex }
1802
1814
  .jm-focus > .jm-panel { width: 100%; height: 100%; min-height: 0 }
1803
1815
  /* one big picture at a time: the frame tabs and a Before | After switch above it (B flips) */
1804
- .jm-fbar { display: flex; align-items: center; gap: 8px }
1816
+ .jm-fbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap } /* a narrow window wraps the switch under the tabs */
1805
1817
  .jm-fbar .sp { flex: 1 }
1806
1818
  .jm-fbar kbd { font: 500 10.5px -apple-system, system-ui, sans-serif; color: var(--glass-ink-3); background: none; border: 0; padding: 0 4px 0 2px; align-self: center }
1807
1819
  .jm-big { flex: 1; min-height: 0; display: flex }
@@ -1843,6 +1855,14 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
1843
1855
  .jm-big .jm-shot .pic img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px;
1844
1856
  box-shadow: 0 0 0 1px var(--glass-brd), 0 2px 10px -4px rgba(24, 24, 27, .18) }
1845
1857
  .jm-big .jm-shot .pic.none { border: 1px dashed var(--glass-ink-3); border-radius: 8px }
1858
+ /* before and after at once (0.26.1): side by side for a tall frame, stacked for a wide one - each a caption over its
1859
+ picture, both at the frame's own proportions */
1860
+ .jm-big.pair { gap: 10px; align-items: stretch }
1861
+ .jm-big.pair.side { flex-direction: row }
1862
+ .jm-big.pair.stack { flex-direction: column }
1863
+ .jm-big.pair .jm-shot { flex: 1; min-width: 0; min-height: 0; height: auto; display: flex; flex-direction: column-reverse; gap: 4px }
1864
+ .jm-big.pair .jm-shot .pic { flex: 1; min-height: 0; height: auto }
1865
+ .jm-big.pair .jm-shot .cap { flex: none; height: 14px; font: 600 11px/14px -apple-system, system-ui, sans-serif; color: var(--glass-ink-2); text-align: center }
1846
1866
  /* the editable words: a quiet hover says "click to edit" */
1847
1867
  .jm-editable { margin: -6px -8px; padding: 6px 8px; border-radius: 10px; cursor: text }
1848
1868
  .jm-editable:hover { background: var(--glass-hover) }
@@ -268,6 +268,8 @@ function Stage() {
268
268
  // comment/laser first, else exit) - the stage can't see review mode
269
269
  if (e.key === 'Escape') { post({ type: 'sh:stage-key', key: 'Escape', code: e.code }); return }
270
270
  if (!keyAllowed(e)) return // the one guard: never from a field, an editable, an IME composition
271
+ // ⌥L (inspect): Option types a symbol on a Mac - named by the key pressed
272
+ if (e.altKey && e.code === 'KeyL') { post({ type: 'sh:stage-key', key: 'l', code: e.code, alt: true }); return }
271
273
  // every play shortcut belongs to the shell (it owns walk order + chrome) - forward.
272
274
  // l/c toggle laser/comment, C (shift+c) hides pins; the shell acts and broadcasts back.
273
275
  if (/^Digit[0-9]$/.test(e.code) || ['d', 'h', 'r', 'l', 'c', 'C', '[', ']', 'ArrowRight', 'ArrowLeft'].includes(e.key))
@@ -168,9 +168,11 @@ full, not cropped. A frame tall enough to hit the capture cap comes back with
168
168
  printing one PNG path per line; a failed frame goes to stderr and the exit code is 1. After
169
169
  writing a scene, shoot the scene, not the frames. `--scale 4` is for a print-quality still -
170
170
  the human's "copy as image" on the canvas uses this same renderer, so you both see one
171
- picture. If it says the dev server cannot be reached - a sandbox that blocks the network
172
- blocks localhost too - drop a request file as above instead: it works in every sandbox. Never
173
- reply that you could not look.)
171
+ picture. In a sandbox that blocks the network (localhost too) the command takes the picture
172
+ through the file inbox by itself; if it still says the dev server cannot be reached, drop a
173
+ request file as above. Never reply that you could not look. A picture that came back tiled
174
+ from Chrome is taken again for you; a shot that fails with "stale surface" is worth one more
175
+ try.)
174
176
 
175
177
  Verification is best-effort, not a gate. If your model cannot read images, or the result
176
178
  reports no Chrome on the machine, still act on `ok`/`error` - and say plainly in your reply
@@ -1,68 +0,0 @@
1
- import { r as readReloads } from "./perf-DPbLGhhO.mjs";
2
- //#region src/cli/perf.ts
3
- /**
4
- * `marver perf` (spec 26 Part 1): the reload log read back - per edited file, the frames it reached
5
- * and how; every page-wide reload (sent or dropped) and every time the canvas page itself booted,
6
- * with what came just before; the slowest frames to settle. Reads design/.local/perf/reloads.jsonl.
7
- */
8
- function perfCommand(root, opts) {
9
- const minutes = Number(opts.minutes) > 0 ? Number(opts.minutes) : 60;
10
- const log = readReloads(root, Date.now() - minutes * 6e4);
11
- const files = /* @__PURE__ */ new Map();
12
- for (const e of log) if (e.kind === "update") {
13
- const f = files.get(e.file ?? "(no file)") ?? {
14
- edits: 0,
15
- reload: /* @__PURE__ */ new Set(),
16
- inPlace: /* @__PURE__ */ new Set()
17
- };
18
- f.edits++;
19
- for (const id of e.reload ?? []) f.reload.add(id);
20
- for (const id of e.inPlace ?? []) f.inPlace.add(id);
21
- files.set(e.file ?? "(no file)", f);
22
- }
23
- const reloads = log.filter((e) => e.kind === "full-reload");
24
- const boots = log.flatMap((e, i) => e.kind === "shell-boot" ? [{
25
- ts: e.ts,
26
- before: log.slice(Math.max(0, i - 3), i).filter((x) => x.kind !== "ready" && x.kind !== "settled")
27
- }] : []);
28
- const slow = log.filter((e) => e.kind === "settled" && typeof e.ms === "number").sort((a, b) => b.ms - a.ms).slice(0, 5);
29
- const booted = log.filter((e) => e.kind === "ready");
30
- const by = (c) => booted.filter((e) => e.cause === c).length;
31
- const reloaded = by("job");
32
- if (opts.json) {
33
- console.log(JSON.stringify({
34
- minutes,
35
- files: Object.fromEntries([...files].map(([k, v]) => [k, {
36
- edits: v.edits,
37
- reached: [...v.reload],
38
- inPlace: [...v.inPlace]
39
- }])),
40
- documents: {
41
- afterEdit: reloaded,
42
- byHand: by("manual"),
43
- retried: by("retry"),
44
- self: by("self"),
45
- first: by("first")
46
- },
47
- reloads,
48
- boots,
49
- slow
50
- }, null, 2));
51
- return;
52
- }
53
- const t = (ts) => new Date(ts).toLocaleTimeString();
54
- console.log(`last ${minutes} min - design/.local/perf/reloads.jsonl`);
55
- console.log(`\nedits (${files.size} files)`);
56
- for (const [file, f] of [...files].sort((a, b) => b[1].edits - a[1].edits)) console.log(` ${file} ${f.edits}x reached ${f.reload.size} frame${f.reload.size === 1 ? "" : "s"}${f.inPlace.size ? `, ${f.inPlace.size} updated in place` : ""}`);
57
- console.log(`\nframe documents booted: ${reloaded} after an edit (a frame off screen reloads when it comes into view), ${by("first")} first loads, ${by("manual")} by hand, ${by("retry")} watchdog retries, ${by("self")} reloaded themselves`);
58
- console.log(`\npage-wide reloads: ${reloads.filter((r) => r.passed).length} sent (dependency rebuilds), ${reloads.filter((r) => !r.passed).length} dropped`);
59
- for (const r of reloads) console.log(` ${t(r.ts)} ${r.passed ? "sent " : "dropped"} ${r.triggeredBy ?? "no file named"}`);
60
- console.log(`\ncanvas page loads: ${boots.length}`);
61
- for (const b of boots) console.log(` ${t(b.ts)}${b.before.length ? ` after: ${b.before.map((x) => x.kind + (x.file ? ` ${x.file}` : "")).join(", ")}` : ""}`);
62
- if (slow.length) {
63
- console.log("\nslowest to settle");
64
- for (const s of slow) console.log(` ${s.frame} ${s.ms} ms`);
65
- }
66
- }
67
- //#endregion
68
- export { perfCommand };
@@ -1,86 +0,0 @@
1
- import { r as NAME } from "./cli.mjs";
2
- import { i as readDevInfo } from "./work-F5u-twpJ.mjs";
3
- //#region src/cli/shot.ts
4
- /**
5
- * `marver shot <scene/frame> [...]`, `--scene <name>`, `--all` - render frames headless and
6
- * print the PNG paths, one per line, in the order asked.
7
- *
8
- * The shell-ful agents' door into the same verify loop jam teaches: build, shoot, LOOK. One
9
- * frame goes through /api/shot; several, a scene or everything go through /api/shots as ONE
10
- * operation (one browser, several frames at a time), so shooting a scene costs about what
11
- * shooting a frame did. shot.ts (server) has the capture story.
12
- */
13
- async function shotCommand(root, frames, opts) {
14
- const usage = `${NAME} shot <scene/frame ...> | --scene <name> | --all [--theme <name>] [--scale 1-4] [--json]`;
15
- if ([
16
- frames.length > 0,
17
- !!opts.scene,
18
- !!opts.all
19
- ].filter(Boolean).length !== 1) throw new Error(`name the frames, one way: ${usage}`);
20
- const info = readDevInfo(root);
21
- if (!info) throw new Error(`\`${NAME} dev\` is not running in this repo (design/.local/dev.json not found) - start it first.`);
22
- const scale = opts.scale != null ? Number(opts.scale) : void 0;
23
- const theme = opts.theme;
24
- const single = frames.length === 1 && !opts.scene && !opts.all;
25
- let res;
26
- try {
27
- if (single) {
28
- const qs = new URLSearchParams({
29
- frame: frames[0],
30
- ...theme ? { theme } : {},
31
- ...scale != null ? { scale: String(scale) } : {}
32
- });
33
- res = await fetch(`http://localhost:${info.port}/__mv/api/shot?${qs}`, { headers: { "x-mv-work": info.token } });
34
- } else {
35
- const sel = opts.all ? { all: true } : opts.scene ? { scene: opts.scene } : { frames };
36
- res = await fetch(`http://localhost:${info.port}/__mv/api/shots`, {
37
- method: "POST",
38
- headers: {
39
- "x-mv-work": info.token,
40
- "content-type": "application/json"
41
- },
42
- body: JSON.stringify({
43
- ...sel,
44
- ...theme ? { theme } : {},
45
- ...scale != null ? { scale } : {}
46
- })
47
- });
48
- }
49
- } catch {
50
- throw new Error(`could not reach \`${NAME} dev\` on port ${info.port} - is it still running?`);
51
- }
52
- const data = await res.json().catch(() => ({}));
53
- if (!res.ok) throw new Error(data.error ?? `shot failed (${res.status})`);
54
- const one = data;
55
- const results = single ? [one.path ? {
56
- frame: frames[0],
57
- ok: true,
58
- path: one.path,
59
- width: one.width,
60
- height: one.height,
61
- scale: one.scale,
62
- ...one.truncated ? { truncated: true } : {},
63
- ...one.unsettled ? { unsettled: true } : {},
64
- ...one.note ? { note: one.note } : {}
65
- } : {
66
- frame: frames[0],
67
- ok: false,
68
- error: one.error ?? "shot failed"
69
- }] : data.results ?? [];
70
- if (opts.json) {
71
- console.log(JSON.stringify({ results }, null, 2));
72
- if (results.some((r) => !r.ok)) process.exitCode = 1;
73
- return;
74
- }
75
- let failed = false;
76
- for (const r of results) if (r.ok) {
77
- console.log(r.path);
78
- if (r.note) console.error(`${r.frame}: ${r.note}`);
79
- } else {
80
- failed = true;
81
- console.error(`${r.frame}: ${r.error}`);
82
- }
83
- if (failed) process.exitCode = 1;
84
- }
85
- //#endregion
86
- export { shotCommand };