@marver-design/marver 0.25.0 → 0.26.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 (92) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +3 -1
  3. package/dist/{anchor-DVV732zR.mjs → anchor-5H1vnoLu.mjs} +6 -1
  4. package/dist/{anchor-check-BE5VVN6Q.mjs → anchor-check-Dg5xpNnU.mjs} +1 -1
  5. package/dist/audio-CmSRYFEs.mjs +429 -0
  6. package/dist/{auth-DdUKeVKt.mjs → auth-Dix8wrXV.mjs} +1 -1
  7. package/dist/{bake-D8byeRzB.mjs → bake-DtVlm0_F.mjs} +45 -6
  8. package/dist/{boards-Csxj2WJn.mjs → boards-DYG22tOe.mjs} +2 -2
  9. package/dist/{build-BHoWLvSj.mjs → build-C_gUgcdC.mjs} +16 -9
  10. package/dist/capture-CrqvU_jh.mjs +729 -0
  11. package/dist/cli.mjs +23 -17
  12. package/dist/{collab-gqNdScUE.mjs → collab-Dxg2trOK.mjs} +4 -3
  13. package/dist/{comments-Zoch254k.mjs → comments-0BSbb04K.mjs} +14 -3
  14. package/dist/{comments-pTLlhjh4.mjs → comments-BqXua-XL.mjs} +7 -7
  15. package/dist/{config-cKgZBRj0.mjs → config-Cf7EjAMf.mjs} +12 -1
  16. package/dist/{context-D2ugHqwO.mjs → context-HQ4Giw58.mjs} +1 -1
  17. package/dist/daemon-DZo6o3rU.mjs +2445 -0
  18. package/dist/{dev-DJdgow47.mjs → dev-_Nlsc6v9.mjs} +189 -18
  19. package/dist/dev-lock-DWSpa6nj.mjs +179 -0
  20. package/dist/{events-DnK_AnrW.mjs → events-CLH4ijKP.mjs} +14 -4
  21. package/dist/{init-DO4DhUt_.mjs → init-D8DtrK_F.mjs} +2 -2
  22. package/dist/{ledger-BNXW14Xw.mjs → ledger-D54iROST.mjs} +17 -1
  23. package/dist/{link-C-qUIuKU.mjs → link-BNzLvdhI.mjs} +2 -2
  24. package/dist/live-Cgzsicwi.mjs +4 -0
  25. package/dist/{manifest-DnAte_fB.mjs → manifest-Nl3KSVOk.mjs} +1 -1
  26. package/dist/{marks-koRsbHfe.mjs → marks-CKgzucHZ.mjs} +2 -2
  27. package/dist/{marks-DFuintmJ.mjs → marks-NQi0wZJ4.mjs} +23 -5
  28. package/dist/{marver-id-gate-DGANtVyC.mjs → marver-id-gate-BjF6v4bT.mjs} +4 -4
  29. package/dist/{perf-QJIWtTw1.mjs → perf-D6VmmJ2q.mjs} +1 -1
  30. package/dist/{perf-CCisg-ny.mjs → perf-DPbLGhhO.mjs} +1 -1
  31. package/dist/{plugin-CTyhjwoJ.mjs → plugin-CTD0rydA.mjs} +279 -38
  32. package/dist/{poster-D0cbV7hi.mjs → poster-ChjXGTS5.mjs} +1 -1
  33. package/dist/{profile-Do0nGkXO.mjs → profile-WU9qcbIo.mjs} +1 -1
  34. package/dist/{publish-bakes--l8ot2eQ.mjs → publish-bakes-CEP_2NRc.mjs} +3 -3
  35. package/dist/queue-BuiCKSX1.mjs +1319 -0
  36. package/dist/reserve-BURNQ2Y3.mjs +53 -0
  37. package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
  38. package/dist/{serve-wv2QWdxB.mjs → serve-C8rVheYk.mjs} +12 -12
  39. package/dist/session-qZWKt_VA.mjs +191 -0
  40. package/dist/{share-ScamJcks.mjs → share--oFJ1bCI.mjs} +2 -2
  41. package/dist/{shot-jdO_B6Qw.mjs → shot-CNbHoZ6H.mjs} +1 -1
  42. package/dist/{shot-CckrGW-J.mjs → shot-DqcxJibP.mjs} +4 -3
  43. package/dist/speech-models-DomiLQcY.mjs +299 -0
  44. package/dist/speech-worker.mjs +319 -0
  45. package/dist/{summary-CrW88e3q.mjs → summary-Y8MY1Wuc.mjs} +2 -2
  46. package/dist/{sync-C3035OnJ.mjs → sync-DKk-yT1V.mjs} +9 -8
  47. package/dist/{work-GE88wb_3.mjs → work-F5u-twpJ.mjs} +28 -5
  48. package/dist/{work-CpJn1gwY.mjs → work-VvX_JIgl.mjs} +2 -2
  49. package/docs/jam-session.md +177 -0
  50. package/docs/live-jam.md +21 -3
  51. package/package.json +7 -1
  52. package/src/client/frame-host/bridge.js +20 -2
  53. package/src/client/frame-host/inspect.d.ts +4 -0
  54. package/src/client/frame-host/inspect.js +88 -3
  55. package/src/client/frame-host/keys.d.ts +6 -0
  56. package/src/client/frame-host/keys.js +55 -0
  57. package/src/client/frame-host/trail.d.ts +7 -0
  58. package/src/client/frame-host/trail.js +204 -0
  59. package/src/client/shell/App.tsx +45 -5
  60. package/src/client/shell/Comments.tsx +20 -6
  61. package/src/client/shell/JamSurface.tsx +340 -0
  62. package/src/client/shell/Play.tsx +22 -3
  63. package/src/client/shell/Tip.tsx +8 -3
  64. package/src/client/shell/canvas/Canvas.tsx +12 -2
  65. package/src/client/shell/canvas/FrameNode.tsx +11 -2
  66. package/src/client/shell/canvas/sleep.ts +19 -1
  67. package/src/client/shell/comments-store.ts +23 -16
  68. package/src/client/shell/icons.tsx +15 -0
  69. package/src/client/shell/jam-capture.ts +939 -0
  70. package/src/client/shell/jam-keys.ts +329 -0
  71. package/src/client/shell/jam-lane.tsx +208 -0
  72. package/src/client/shell/jam-lines.ts +115 -0
  73. package/src/client/shell/jam-panel.tsx +506 -0
  74. package/src/client/shell/jam-queue.ts +126 -0
  75. package/src/client/shell/jam-session.tsx +389 -0
  76. package/src/client/shell/jam-state.ts +61 -0
  77. package/src/client/shell/jam-surface-parts.tsx +102 -0
  78. package/src/client/shell/jam-ui.tsx +104 -0
  79. package/src/client/shell/jam-voice.ts +479 -0
  80. package/src/client/shell/sound.ts +22 -0
  81. package/src/client/shell/stage-size.ts +11 -0
  82. package/src/client/shell/store.ts +34 -13
  83. package/src/client/shell/styles.css +544 -2
  84. package/src/client/stage/main.tsx +16 -2
  85. package/src/shared/capture-frames.ts +41 -0
  86. package/src/shared/events.ts +19 -4
  87. package/src/shared/speech.ts +16 -0
  88. package/templates/AGENTS-embedded.md +10 -2
  89. package/templates/AGENTS-studio.md +10 -2
  90. package/templates/instructions/iterate.md +8 -6
  91. package/templates/instructions/jam.md +129 -59
  92. package/dist/daemon-Cl8KXGW4.mjs +0 -1523
@@ -10,6 +10,11 @@
10
10
  * on - no auto-fade, no hover magic. The bottom-left navigator (restart · prev · i/N ·
11
11
  * next) stays prototype-only.
12
12
  */
13
+ import { setStageSize } from './stage-size.ts'
14
+ import { frameLoaded, frameReady, onFrameMessage, stageNavigated } from './jam-capture.ts'
15
+ import { jamKey } from './jam-keys.ts'
16
+ import { letGoOfTile } from './jam-state.ts'
17
+ import { JamButton } from './jam-session.tsx'
13
18
  import { useEffect, useRef, useState } from 'react'
14
19
  import { useStore, BOARD_POLICY, BRANDING, CONFIG, PUBLISHED, SOURCE_REVEALED, boardLabel, boardLocked, cap, fetchBoardNames, modeAllowed, playsAsSlides, SLIDE_INTRINSIC, type Node } from './store.ts'
15
20
  import { deckOrder } from './play-order.ts'
@@ -21,6 +26,7 @@ import { poweredByUrl } from '../../shared/utm.ts'
21
26
  import { canvasCtl } from './canvas/ctl.ts'
22
27
  import { revealFrame } from './goto.ts'
23
28
  import { Tip } from './Tip.tsx'
29
+ import { keyAllowed } from '../frame-host/keys.js'
24
30
  import { CommentButton, DevicePicker, HideUIButton, isHideUI, LaserButton, Popover, ThemePicker, toggleHideUI, usePopover } from './Toolbar.tsx'
25
31
  import { DraftComposer, Pins, placePins, ThreadCard } from './Comments.tsx'
26
32
  import { ArrowLeftIcon, ArrowRightIcon, BrowsersIcon, CaretIcon, CheckIcon, GridIcon, PanelFilledIcon, PanelHollowIcon, ParallelogramDuoIcon, ReloadIcon, SpecDocIcon } from './icons.tsx'
@@ -444,7 +450,11 @@ function PlayInner() {
444
450
  const data = e.data
445
451
  if (!data || typeof data.type !== 'string') return
446
452
  const s = useStore.getState()
453
+ // Jam (spec 27): the stage records like a frame; a key the shell owns comes back as sh:key
454
+ if (onFrameMessage('stage', data)) return
455
+ if (data.type === 'sh:key') { if (typeof data.key === 'string') jamKey({ key: data.key, shift: !!data.shift, alt: !!data.alt, meta: !!data.meta, ctrl: !!data.ctrl }); return }
447
456
  if (data.type === 'sh:stage-ready') {
457
+ frameReady('stage')
448
458
  // an iframe reload (registry HMR invalidation) boots at the frozen initial src -
449
459
  // resync it to the shell's current truth: navigation, theme, AND review modes
450
460
  const p = s.play
@@ -462,7 +472,7 @@ function PlayInner() {
462
472
  useStore.setState({ stageShown: { at: data.at, shown: `${String(data.epoch ?? '')}:${Number(data.doc) || 0}` } })
463
473
  } else if (data.type === 'sh:stage-at') {
464
474
  const p = s.play
465
- if (p && typeof data.at === 'string') s.setPlay({ ...p, at: data.at })
475
+ if (p && typeof data.at === 'string') stageNavigated(data.at, () => s.setPlay({ ...p, at: data.at }))
466
476
  } else if (data.type === 'sh:stage-exit') {
467
477
  exit()
468
478
  } else if (data.type === 'sh:stage-error') {
@@ -492,6 +502,7 @@ function PlayInner() {
492
502
  } else if (data.type === 'sh:frame-down') {
493
503
  const c = commentsStore()
494
504
  if (c.active) c.setActive(null)
505
+ letGoOfTile() // a click in the prototype closes the review open over it, as on the canvas
495
506
  } else if (data.type === 'sh:laser-copy') {
496
507
  // laser click in the prototype: copy the element's address ([board ▸ scene] +
497
508
  // frame file + css path) and confirm in the frame's own hover label, like the canvas
@@ -548,7 +559,9 @@ function PlayInner() {
548
559
  const toggleCollapse = () => setPillOpen((o) => !o)
549
560
  useEffect(() => {
550
561
  const onKey = (e: KeyboardEvent) => {
551
- if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return
562
+ if (!keyAllowed(e)) return // the one key guard (frame-host/keys.js): never from a field, an editable, an IME composition
563
+ // Jam's keys first - a review open takes the arrows before they step screens
564
+ if (!e.repeat && jamKey({ key: e.key, shift: e.shiftKey, alt: e.altKey, meta: e.metaKey, ctrl: e.ctrlKey })) { e.preventDefault(); return }
552
565
  if ((e.metaKey || e.ctrlKey) && e.key === '/') { e.preventDefault(); toggleCollapse(); return }
553
566
  if (e.metaKey || e.ctrlKey) return
554
567
  handleKey(e.key, e.code)
@@ -578,6 +591,10 @@ function PlayInner() {
578
591
  : docPreset ? { width: Math.min(win.w, 860), height: win.h }
579
592
  : fill ? { width: win.w, height: win.h }
580
593
  : CONFIG.viewports[play.device] ?? Object.values(CONFIG.viewports)[0]
594
+ // (a capture reads what the stage is: the size a frame seen here is pictured at - published after this layout)
595
+ // (no hook here - this is past the early return: a microtask, right after this layout)
596
+ const stageAt = play.at, stageW = Math.round(vp.width), stageH = Math.round(vp.height)
597
+ queueMicrotask(() => setStageSize(stageAt, stageW, stageH))
581
598
  const scale = stage ? Math.max(0.05, fill ? Math.min(win.w / vp.width, win.h / vp.height)
582
599
  : slides ? Math.min((win.w - 48) / vp.width, (win.h - (deckChrome === 'none' ? 48 : 88)) / vp.height)
583
600
  : Math.min((win.w - 96) / vp.width, (win.h - 128) / vp.height))
@@ -611,6 +628,7 @@ function PlayInner() {
611
628
  <iframe
612
629
  ref={iframeRef}
613
630
  src={src.current}
631
+ onLoad={() => frameLoaded('stage', iframeRef.current)}
614
632
  title="play"
615
633
  style={{ width: vp.width, height: vp.height, transform: `scale(${dw / vp.width}, ${dh / vp.height})` }}
616
634
  />
@@ -668,6 +686,7 @@ function PlayInner() {
668
686
  <CommentButton />
669
687
  {!trimmed && <>
670
688
  <LaserButton />
689
+ {!PUBLISHED && CONFIG.jam && <JamButton inPlay />}
671
690
  <i className="sep" />
672
691
  {!docPreset && <DevicePicker value={fill ? 'fill' : play.device} onSelect={(n) => n && setDevice(n)} includeFill includeSlide={slides} stageOnly={slides} hint={deviceHint} dark />}
673
692
  <ThemePicker value={play.theme} onSelect={setTheme} hint="D" dark />
@@ -691,7 +710,7 @@ function PlayInner() {
691
710
  deep link (the link's chrome) - not hidden, not rendered */}
692
711
  {!noDoor && (
693
712
  <Tip side="bottom" label={<><b>Open in canvas</b><span>Esc</span></>}>
694
- <button className="sh-pill-btn" onClick={exit}><GridIcon size={16} /></button>
713
+ <button className="sh-pill-btn" data-play-exit="" onClick={exit}><GridIcon size={16} /></button>
695
714
  </Tip>
696
715
  )}
697
716
  {BRANDING && PUBLISHED && !trimmed && (
@@ -4,11 +4,13 @@ import { createPortal } from 'react-dom'
4
4
  /** shadcn-style tooltip: snappy (150ms in, instant out), contrast-flipped, zoom-fade.
5
5
  * Portaled to the app root - glass never nests, and neither do overlays. `inv` pins the
6
6
  * flipped (light) bubble for surfaces with fixed dark chrome (play mode), where the
7
- * theme-following default would sit dark-on-dark. */
8
- export function Tip({ label, side = 'top', inv = false, children }: { label: ReactNode; side?: 'top' | 'bottom' | 'right'; inv?: boolean; children: ReactElement }) {
7
+ * theme-following default would sit dark-on-dark. `only(trigger)` decides at hover whether it shows. */
8
+ export function Tip({ label, side = 'top', inv = false, only, children }: { label: ReactNode; side?: 'top' | 'bottom' | 'right'; inv?: boolean; only?: (el: HTMLElement) => boolean; children: ReactElement }) {
9
9
  const [pos, setPos] = useState<{ x: number; y: number } | null>(null)
10
10
  const timer = useRef<number | undefined>(undefined)
11
- const show = (e: React.MouseEvent) => {
11
+ const show = (e: React.SyntheticEvent) => {
12
+ // `only`: shown when the trigger needs it (a title cut short shows whole; one that fits shows nothing)
13
+ if (only && !only(e.currentTarget as HTMLElement)) return
12
14
  const r = (e.currentTarget as HTMLElement).getBoundingClientRect()
13
15
  // right: beside the trigger, centred on it - a sidebar row's glyph, read toward the canvas
14
16
  const at = side === 'right' ? { x: r.right + 9, y: r.top + r.height / 2 } : { x: r.left + r.width / 2, y: side === 'top' ? r.top - 7 : r.bottom + 7 }
@@ -52,6 +54,9 @@ export function Tip({ label, side = 'top', inv = false, children }: { label: Rea
52
54
  {cloneElement(child, {
53
55
  onMouseEnter: (e: React.MouseEvent) => { child.props.onMouseEnter?.(e); show(e) },
54
56
  onMouseLeave: (e: React.MouseEvent) => { child.props.onMouseLeave?.(e); hide() },
57
+ // the keyboard's way in: a trigger reached by Tab shows its tip too (a mouse click never does)
58
+ onFocus: (e: React.FocusEvent) => { child.props.onFocus?.(e); if ((e.currentTarget as HTMLElement).matches(':focus-visible')) show(e) },
59
+ onBlur: (e: React.FocusEvent) => { child.props.onBlur?.(e); hide() },
55
60
  onClick: (e: React.MouseEvent) => { child.props.onClick?.(e); hide() },
56
61
  })}
57
62
  {pos && app && createPortal(
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useLayoutEffect, useRef } from 'react'
2
2
  import { TransformWrapper, TransformComponent, type ReactZoomPanPinchContentRef } from 'react-zoom-pan-pinch'
3
3
  import { CONFIG, useStore } from '../store.ts'
4
+ import { letGoOfTile } from '../jam-state.ts'
4
5
  import { bootHash, linkTargets } from '../hash.ts'
5
6
  import { revealFrame } from '../goto.ts'
6
7
  import { startPerf } from '../perf.ts'
@@ -35,11 +36,16 @@ function insets(el: HTMLElement) {
35
36
  const rect = (q: string) => document.querySelector(q)?.getBoundingClientRect()
36
37
  const side = rect('.sh-panel:not(.closed)') ?? rect('.sh-fab')
37
38
  const pill = rect('.sh-pill')
39
+ // Jam (spec 27): the focus panel sits right of the sidebar and the lane along the bottom - a card's
40
+ // frames fit in the space left of neither
41
+ const focus = rect('.jm-focus')
42
+ const lane = rect('.jm-lane')
43
+ const leftEdge = Math.max(side ? side.right : 0, focus ? focus.right : 0)
38
44
  return {
39
- left: (side ? Math.max(0, side.right - c.left) : 0) + GAP,
45
+ left: (leftEdge ? Math.max(0, leftEdge - c.left) : 0) + GAP,
40
46
  right: GAP + 16,
41
47
  top: (pill ? Math.max(0, pill.bottom - c.top) : 0) + 12 + BAR,
42
- bottom: GAP + 16,
48
+ bottom: (lane ? Math.max(0, c.bottom - lane.top) : 0) + GAP + 16,
43
49
  }
44
50
  }
45
51
 
@@ -259,6 +265,10 @@ export function Canvas() {
259
265
  if (!el) return
260
266
  const down = (e: PointerEvent) => {
261
267
  const t = e.target as HTMLElement | null
268
+ // anywhere on the canvas, a frame too: the panel closes and its tile lets go - except on a comment's
269
+ // own controls (its pin, its card, its reply): opening one closes the panel there and keeps the
270
+ // tile when the thread is its own (JamSurface)
271
+ if (!t?.closest('.cm-layer, .cm-card, .cm-pin, .cm-stack')) letGoOfTile()
262
272
  if (t?.closest('.sh-node') || t?.closest('.sh-gcaption')) return
263
273
  const s = useStore.getState()
264
274
  if (s.selection.length || s.interact) s.select(null)
@@ -6,6 +6,7 @@ import { CommentLayer } from '../Comments.tsx'
6
6
  import { useComments } from '../comments-store.ts'
7
7
  import { threadHostKey } from '../keys.ts'
8
8
  import { registerFrame, unregisterFrame } from './frame-registry.ts'
9
+ import { canvasClick, canvasPointer, frameGone, frameLoaded, pressNow, useJamCapture } from '../jam-capture.ts'
9
10
  import { primeCameraFor } from './camera-broadcast.ts'
10
11
  import { sleep, wake } from './sleep.ts'
11
12
  import { canAutoReload, shouldArmReadyWatch } from './ready-watch.ts'
@@ -138,6 +139,9 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
138
139
  // as an unknown source (misleading 10s timeout). The WindowProxy is stable across
139
140
  // navigations; onLoad re-asserts it (idempotent) after each navigation.
140
141
  const regWin = useRef<WindowProxy | null>(null)
142
+ const downAt = useRef<{ x: number; y: number; t: number } | null>(null)
143
+ const capturing = useJamCapture((s) => !!s.current)
144
+ useEffect(() => () => frameGone(node.key), [node.key])
141
145
  const registerWin = () => {
142
146
  const iframe = iframeRef.current
143
147
  const win = iframe?.contentWindow
@@ -441,7 +445,7 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
441
445
  className="sh-live"
442
446
  src={src}
443
447
  title={frame.id}
444
- onLoad={registerWin}
448
+ onLoad={() => { registerWin(); frameLoaded(node.key, iframeRef.current) }}
445
449
  style={{ ...iframeBox(stage, node), display: node.missing || node.status === 'error' ? 'none' : 'block' }}
446
450
  />
447
451
  {/* the overlay eats mouse events for drag-by-body; laser and comment mode both
@@ -450,8 +454,13 @@ export const FrameNode = memo(function FrameNode({ node }: { node: Node }) {
450
454
  {!interact && !commentMode && !laser && (
451
455
  <div
452
456
  className="sh-overlay sh-no-pan"
453
- onPointerDown={(e) => drag(e, 'move')}
457
+ onPointerDown={(e) => { downAt.current = { x: e.clientX, y: e.clientY, t: pressNow() }; if (capturing) canvasPointer(null); drag(e, 'move') }}
454
458
  onDoubleClick={(e) => { e.stopPropagation(); setInteract(node.key) }}
459
+ // a capture records canvas-mode clicks and hovers: the overlay keeps the click (drag and
460
+ // select are unchanged) and asks the frame what is under it
461
+ onClick={(e) => { const d = downAt.current; if (capturing && d && Math.hypot(e.clientX - d.x, e.clientY - d.y) < 4) canvasClick(node.key, e.clientX, e.clientY, d.t) }}
462
+ onPointerMove={capturing ? (e) => (e.buttons ? canvasPointer(null) : canvasPointer(node.key, e.clientX, e.clientY)) : undefined} // no hover while a button is held (a drag)
463
+ onPointerLeave={capturing ? () => canvasPointer(null) : undefined}
455
464
  />
456
465
  )}
457
466
  {working && <div className="sh-work-wave" />}
@@ -54,6 +54,13 @@ let seq = 0
54
54
  /** Nodes with one retry of a failed compile in flight. */
55
55
  const retried = new Set<string>()
56
56
  const RETRY_MS = 4000
57
+ /** The server's answer for a compile still running (src/server/bake.ts COMPILING), and how many times a
58
+ * node looks again for it before settling for the pause alone. */
59
+ const COMPILING = 'compiling - ask again'
60
+ const COMPILING_TRIES = 15
61
+ /** Looks so far, per node, for the sleep key they were for: a new key (an edit, a theme, a size)
62
+ * or a wake starts the count again. */
63
+ const compiling = new Map<string, { key: string; n: number }>()
57
64
 
58
65
  /** Does this document have anything to compile? Cheap: one computed style per element. */
59
66
  export function hasEffects(doc: Document): boolean {
@@ -125,6 +132,15 @@ export async function sleep(nodeKey: string, iframe: HTMLIFrameElement, key: Sle
125
132
  }
126
133
  const answer = await ask(key)
127
134
  if (!current()) return 'live'
135
+ // still compiling (issue #23): the server answered in seconds and carries on by itself. The frame
136
+ // stays LIVE meanwhile - pausing now would freeze a finite animation midway, under a texture of its
137
+ // end - and looks again, a bounded number of times; past that, the pause alone below
138
+ if (!PUBLISHED && !answer.ok && answer.error === COMPILING) {
139
+ const was = compiling.get(nodeKey)
140
+ const n = (was && was.key === k ? was.n : 0) + 1
141
+ compiling.set(nodeKey, { key: k, n })
142
+ if (n <= COMPILING_TRIES) { setTimeout(() => { if (current()) void sleep(nodeKey, iframe, key) }, RETRY_MS); return 'live' }
143
+ }
128
144
  // no compiler (a published canvas, a compile that failed): the pause alone, the glass live -
129
145
  // never an effect layer without its texture
130
146
  let targets = answer.ok ? answer.targets.filter((t) => t.verified && t.texture) : []
@@ -138,7 +154,8 @@ export async function sleep(nodeKey: string, iframe: HTMLIFrameElement, key: Sle
138
154
  if (!install(doc, targets)) return 'live'
139
155
  // a certified sleep is remembered; the pause-only fallback is not, so the next lifecycle event
140
156
  // asks again (a compile the source outran, a server hiccup), and one retry is scheduled now
141
- if (targets.length) asleep.set(nodeKey, { key: k, doc })
157
+ if (targets.length) { asleep.set(nodeKey, { key: k, doc }); compiling.delete(nodeKey) }
158
+ else if (answer.ok === false && answer.error === COMPILING) { /* out of looks: the pause alone, final */ }
142
159
  else if (!PUBLISHED && !retried.has(nodeKey)) { retried.add(nodeKey); setTimeout(() => { retried.delete(nodeKey); if (current()) void sleep(nodeKey, iframe, key) }, RETRY_MS) } // a static miss is final
143
160
  return 'asleep'
144
161
  }
@@ -147,6 +164,7 @@ export async function sleep(nodeKey: string, iframe: HTMLIFrameElement, key: Sle
147
164
  export function wake(nodeKey: string, iframe: HTMLIFrameElement | null): void {
148
165
  pending.delete(nodeKey)
149
166
  asleep.delete(nodeKey)
167
+ compiling.delete(nodeKey)
150
168
  const doc = iframe?.contentDocument
151
169
  const st = doc?.getElementById(STYLE_ID)
152
170
  if (!doc || !st) return
@@ -111,13 +111,13 @@ export const useComments = create<CommentsState>((set, get) => {
111
111
  // the boot instant: an event younger than the page can never be "history", so it may
112
112
  // notify even before its board's baseline sweep lands (the poke/SSE-beats-load race)
113
113
  const bootTs = Date.now()
114
- // Marver - a Live Jam reply, or a note or reply an agent left from the CLI - arriving AFTER
115
- // the baseline raises a persistent bottom-right pill - from ANY board (the store holds every
116
- // log), keyed on the event id via `union`'s fresh filter so it fires exactly once. The pill's
117
- // board is the THREAD's origin board, so View can navigate there. One ping per batch, like a
118
- // person's - except for a jam job's opening "On it" line (ids `jam-e<attempt>-…`, daemon.ts): the pill
119
- // shows it, the ping waits for the answer. A jam job whose final block asks what its opening
120
- // line already said re-flags that line (an edit carrying `asks`): the question gets its notice.
114
+ // Marver - a Live Jam reply, or a note or reply an agent left from the CLI - that ASKS, arriving
115
+ // AFTER the baseline, raises a persistent bottom-right pill - from ANY board (the store holds
116
+ // every log), keyed on the event id via `union`'s fresh filter so it fires exactly once. The
117
+ // pill's board is the THREAD's origin board, so View can navigate there. One ping per batch. A
118
+ // reply that does not ask raises nothing (spec 27): it is read in its thread. A jam job whose
119
+ // final block asks what its opening line already said re-flags that line (an edit carrying
120
+ // `asks`): the question gets its notice.
121
121
  const notifyAgent = (fresh: CommentEvent[]) => {
122
122
  const news = fresh.flatMap((e) => {
123
123
  if (!e.agent) return []
@@ -126,23 +126,30 @@ export const useComments = create<CommentsState>((set, get) => {
126
126
  const t = get().threads.find((t) => t.id === e.commentId || t.replies.some((r) => r.id === e.commentId))
127
127
  return t ? [{ e, threadId: t.id, body: (t.id === e.commentId ? t : t.replies.find((r) => r.id === e.commentId))?.body, ask: true }] : []
128
128
  })
129
- if (!news.length) return
130
- if (news.some(({ e }) => !/^jam-e\d+-/.test(e.id))) playPing()
129
+ // only a question interrupts (spec 27): a reply that says it is done is read in its thread, and
130
+ // the sidebar marks its frame - no notice, no ping
131
+ // one notice per batch: a jam job's questions (`jam-<batch>-m<n>`) fold into one, the rest under it
132
+ const questions = news.filter((n) => n.ask)
133
+ if (!questions.length) return
134
+ const groups = new Map<string, typeof questions>()
135
+ for (const n of questions) { const k = /^jam-(.+)-m\d+$/.exec(n.e.id)?.[1] ?? n.e.id; groups.set(k, [...(groups.get(k) ?? []), n]) }
136
+ const asking = [...groups].map(([batch, g]) => ({ ...g[g.length - 1], batch, rest: g.slice(0, -1) }))
131
137
  void import('./store.ts').then(({ useStore }) => {
132
138
  const s = useStore.getState()
133
- for (const { e, threadId, body, ask } of news) {
134
- // the FRAME is the news: resolve the reply's thread -> frame -> manifest title + intent
139
+ // a batch whose notice is already up folds in quietly: one ping per batch, like one notice
140
+ if (asking.some((n) => !s.toasts.some((t) => t.jam?.batch === n.batch))) playPing()
141
+ // the FRAME is the news: resolve the reply's thread -> frame -> manifest title + intent
142
+ const noteOf = ({ e, threadId, body }: { e: CommentEvent; threadId: string; body?: string }) => {
135
143
  const t = get().threads.find((t) => t.id === threadId)
136
144
  const entry = t?.frame ? s.manifest?.frames.find((f) => f.id === t.frame) : undefined
137
- s.jamToast({
145
+ return {
138
146
  threadId, board: t?.board ?? e.board ?? get().board ?? '', ts: e.ts,
139
147
  preview: (body ?? '').replace(/\s+/g, ' ').slice(0, 90),
140
148
  frame: t?.frame, frameTitle: entry?.title ?? t?.frame, intent: entry?.intent,
141
- // a message that asks stands alone; the rest fold into the board's round (the writer's
142
- // `asks`, else the old rule: a note asks, a reply asks when it ends in "?")
143
- round: !ask,
144
- })
149
+ }
145
150
  }
151
+ // a batch's other questions ride under its notice - View walks through them
152
+ for (const n of asking) s.jamToast({ ...noteOf(n), batch: n.batch, ...(n.rest.length ? { stack: n.rest.map((r) => ({ ...noteOf(r), batch: n.batch })) } : {}) })
146
153
  })
147
154
  }
148
155
  // A HUMAN's fresh comment that concerns me raises the same pill the agent
@@ -95,3 +95,18 @@ export const FolderOpenIcon = icon(<path d="M245,110.64A16,16,0,0,0,232,104H216V
95
95
  export const FolderPlusIcon = icon(<path d="M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM92.69,56l16,16H40V56ZM216,200H40V88H216Zm-88-88a8,8,0,0,1,8,8v16h16a8,8,0,0,1,0,16H136v16a8,8,0,0,1-16,0V152H104a8,8,0,0,1,0-16h16V120A8,8,0,0,1,128,112Z" />)
96
96
  export const FolderMinusIcon = icon(<path d="M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM92.69,56l16,16H40V56ZM216,200H40V88H216ZM104,136h48a8,8,0,0,1,0,16H104a8,8,0,0,1,0-16Z" />)
97
97
  export const ArrowLineUpIcon = icon(<path d="M205.66,138.34a8,8,0,0,1-11.32,11.32L136,91.31V224a8,8,0,0,1-16,0V91.31L61.66,149.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0ZM216,32H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z" />)
98
+
99
+ // Jam V2 (spec 27): the capture and review surfaces. Phosphor regular, same source and licence.
100
+ export const WaveformIcon = icon(<path d="M56,96v64a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0ZM88,24a8,8,0,0,0-8,8V224a8,8,0,0,0,16,0V32A8,8,0,0,0,88,24Zm40,32a8,8,0,0,0-8,8V192a8,8,0,0,0,16,0V64A8,8,0,0,0,128,56Zm40,32a8,8,0,0,0-8,8v64a8,8,0,0,0,16,0V96A8,8,0,0,0,168,88Zm40-16a8,8,0,0,0-8,8v96a8,8,0,0,0,16,0V80A8,8,0,0,0,208,72Z" />)
101
+ export const StopIcon = icon(<path d="M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z" />)
102
+ export const MicrophoneIcon = icon(<path d="M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z" />)
103
+ export const MicrophoneSlashIcon = icon(<path d="M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z" />)
104
+ export const CursorClickIcon = icon(<path d="M88,24V16a8,8,0,0,1,16,0v8a8,8,0,0,1-16,0ZM16,104h8a8,8,0,0,0,0-16H16a8,8,0,0,0,0,16ZM124.42,39.16a8,8,0,0,0,10.74-3.58l8-16a8,8,0,0,0-14.31-7.16l-8,16A8,8,0,0,0,124.42,39.16Zm-96,81.69-16,8a8,8,0,0,0,7.16,14.31l16-8a8,8,0,1,0-7.16-14.31ZM219.31,184a16,16,0,0,1,0,22.63l-12.68,12.68a16,16,0,0,1-22.63,0L132.7,168,115,214.09c0,.1-.08.21-.13.32a15.83,15.83,0,0,1-14.6,9.59l-.79,0a15.83,15.83,0,0,1-14.41-11L32.8,52.92A16,16,0,0,1,52.92,32.8L213,85.07a16,16,0,0,1,1.41,29.8l-.32.13L168,132.69ZM208,195.31,156.69,144h0a16,16,0,0,1,4.93-26l.32-.14,45.95-17.64L48,48l52.2,159.86,17.65-46c0-.11.08-.22.13-.33a16,16,0,0,1,11.69-9.34,16.72,16.72,0,0,1,3-.28,16,16,0,0,1,11.3,4.69L195.31,208Z" />)
105
+ export const CursorIcon = icon(<path d="M168,132.69,214.08,115l.33-.13A16,16,0,0,0,213,85.07L52.92,32.8A15.95,15.95,0,0,0,32.8,52.92L85.07,213a15.82,15.82,0,0,0,14.41,11l.78,0a15.84,15.84,0,0,0,14.61-9.59l.13-.33L132.69,168,184,219.31a16,16,0,0,0,22.63,0l12.68-12.68a16,16,0,0,0,0-22.63ZM195.31,208,144,156.69a16,16,0,0,0-26,4.93c0,.11-.09.22-.13.32l-17.65,46L48,48l159.85,52.2-45.95,17.64-.32.13a16,16,0,0,0-4.93,26h0L208,195.31Z" />)
106
+ export const TextboxIcon = icon(<path d="M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z" />)
107
+ export const EyeIcon = icon(<path d="M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z" />)
108
+ export const FileCodeIcon = icon(<path d="M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z" />)
109
+ export const KeyboardIcon = icon(<path d="M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z" />)
110
+ export const ArrowBendUpLeftIcon = icon(<path d="M232,200a8,8,0,0,1-16,0,88.1,88.1,0,0,0-88-88H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,61.66L51.31,96H128A104.11,104.11,0,0,1,232,200Z" />)
111
+ export const WarningIcon = icon(<path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z" />)
112
+ export const NotebookIcon = icon(<path d="M184,112a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16h64A8,8,0,0,1,184,112Zm-8,24H112a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm48-88V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM48,208H72V48H48Zm160,0V48H88V208H208Z" />)