@marver-design/marver 0.25.1 → 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 (95) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +5 -3
  3. package/dist/{anchor-DVV732zR.mjs → anchor-5H1vnoLu.mjs} +6 -1
  4. package/dist/{anchor-check-DGZnYviN.mjs → anchor-check-l-ny3UzH.mjs} +1 -1
  5. package/dist/audio-Dw1lfMdb.mjs +443 -0
  6. package/dist/{auth-DdUKeVKt.mjs → auth-Dix8wrXV.mjs} +1 -1
  7. package/dist/{bake-BpxMZfij.mjs → bake-C-awKgLA.mjs} +1 -1
  8. package/dist/{boards-Csxj2WJn.mjs → boards-DYG22tOe.mjs} +2 -2
  9. package/dist/{build-DKaGhoVN.mjs → build-BDRiO_mP.mjs} +16 -9
  10. package/dist/capture-vadKjuCo.mjs +730 -0
  11. package/dist/cli.mjs +24 -18
  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-DL6Fwq6D.mjs +2569 -0
  18. package/dist/{dev-Diqx1Rt8.mjs → dev-Bw_qYWWq.mjs} +202 -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-DyWMv_Z1.mjs} +23 -5
  28. package/dist/{marver-id-gate-DGANtVyC.mjs → marver-id-gate-BjF6v4bT.mjs} +4 -4
  29. package/dist/perf-C75MZ73h.mjs +167 -0
  30. package/dist/{perf-CCisg-ny.mjs → perf-DPbLGhhO.mjs} +1 -1
  31. package/dist/perf-jam-BU3TVrZu.mjs +239 -0
  32. package/dist/{plugin-dTF5reck.mjs → plugin-DkGmZs_r.mjs} +298 -38
  33. package/dist/{poster-D-zjYpgk.mjs → poster-BdtSKMDm.mjs} +2 -1
  34. package/dist/{profile-Do0nGkXO.mjs → profile-WU9qcbIo.mjs} +1 -1
  35. package/dist/{publish-bakes-C_9VZ-Mq.mjs → publish-bakes-9RzRToXV.mjs} +3 -3
  36. package/dist/queue-29ok5_eZ.mjs +1319 -0
  37. package/dist/reserve-BURNQ2Y3.mjs +53 -0
  38. package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
  39. package/dist/{serve-wv2QWdxB.mjs → serve-C8rVheYk.mjs} +12 -12
  40. package/dist/session-BAaJsK5c.mjs +191 -0
  41. package/dist/{share-ScamJcks.mjs → share--oFJ1bCI.mjs} +2 -2
  42. package/dist/{shot-CUlmkqFX.mjs → shot-DQeR_Pfn.mjs} +339 -20
  43. package/dist/shot-XQV7HC9A.mjs +139 -0
  44. package/dist/speech-models-DomiLQcY.mjs +299 -0
  45. package/dist/speech-worker.mjs +354 -0
  46. package/dist/{summary-CrW88e3q.mjs → summary-Y8MY1Wuc.mjs} +2 -2
  47. package/dist/{sync-C3035OnJ.mjs → sync-DKk-yT1V.mjs} +9 -8
  48. package/dist/{work-GE88wb_3.mjs → work-F5u-twpJ.mjs} +28 -5
  49. package/dist/{work-CpJn1gwY.mjs → work-VvX_JIgl.mjs} +2 -2
  50. package/docs/jam-session.md +194 -0
  51. package/docs/live-jam.md +29 -3
  52. package/package.json +7 -1
  53. package/src/client/frame-host/bridge.js +20 -2
  54. package/src/client/frame-host/inspect.d.ts +4 -0
  55. package/src/client/frame-host/inspect.js +96 -6
  56. package/src/client/frame-host/keys.d.ts +6 -0
  57. package/src/client/frame-host/keys.js +59 -0
  58. package/src/client/frame-host/trail.d.ts +7 -0
  59. package/src/client/frame-host/trail.js +204 -0
  60. package/src/client/shell/App.tsx +52 -8
  61. package/src/client/shell/Comments.tsx +20 -6
  62. package/src/client/shell/JamSurface.tsx +346 -0
  63. package/src/client/shell/Play.tsx +32 -9
  64. package/src/client/shell/Tip.tsx +8 -3
  65. package/src/client/shell/Toolbar.tsx +5 -4
  66. package/src/client/shell/canvas/Canvas.tsx +12 -2
  67. package/src/client/shell/canvas/FrameNode.tsx +14 -4
  68. package/src/client/shell/comments-store.ts +23 -16
  69. package/src/client/shell/icons.tsx +17 -0
  70. package/src/client/shell/jam-capture.ts +1005 -0
  71. package/src/client/shell/jam-keys.ts +358 -0
  72. package/src/client/shell/jam-lane.tsx +249 -0
  73. package/src/client/shell/jam-lines.ts +115 -0
  74. package/src/client/shell/jam-panel.tsx +556 -0
  75. package/src/client/shell/jam-queue.ts +126 -0
  76. package/src/client/shell/jam-session.tsx +389 -0
  77. package/src/client/shell/jam-state.ts +103 -0
  78. package/src/client/shell/jam-surface-parts.tsx +106 -0
  79. package/src/client/shell/jam-ui.tsx +104 -0
  80. package/src/client/shell/jam-voice.ts +479 -0
  81. package/src/client/shell/sound.ts +22 -0
  82. package/src/client/shell/stage-size.ts +11 -0
  83. package/src/client/shell/store.ts +47 -17
  84. package/src/client/shell/styles.css +564 -2
  85. package/src/client/stage/main.tsx +18 -2
  86. package/src/shared/capture-frames.ts +41 -0
  87. package/src/shared/events.ts +19 -4
  88. package/src/shared/speech.ts +16 -0
  89. package/templates/AGENTS-embedded.md +10 -2
  90. package/templates/AGENTS-studio.md +10 -2
  91. package/templates/instructions/iterate.md +8 -6
  92. package/templates/instructions/jam.md +131 -59
  93. package/dist/daemon-Cl8KXGW4.mjs +0 -1523
  94. package/dist/perf-QJIWtTw1.mjs +0 -68
  95. package/dist/shot-jdO_B6Qw.mjs +0 -86
@@ -0,0 +1,115 @@
1
+ /**
2
+ * What jam cards say in words (spec 27) - the status icon's tooltip, a lane tile's status line, a
3
+ * capture's merged timeline. Pure, so it is tested without a page.
4
+ */
5
+ import type { JamCard } from './jam-queue.ts'
6
+ import type { Bundle, CaptureRecord } from '../../server/jam/types.ts'
7
+
8
+ const ordinal = (n: number) => `${n}${n % 100 >= 11 && n % 100 <= 13 ? 'th' : ['th', 'st', 'nd', 'rd'][n % 10] ?? 'th'}`
9
+ const clock = (ms: number) => { const s = Math.max(0, Math.floor(ms / 1000)); return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}` }
10
+
11
+ /** What the icon's tooltip says: the state, then the detail - position, clock and agent, the reason
12
+ * a held card waits, why a card failed. */
13
+ export function statusLines(c: JamCard, agent: string | null, harness: Record<string, string>, now = Date.now()): { head: string; detail?: string } {
14
+ const tags = c.events.length > 1 ? ` · ${c.events.length} tags` : ''
15
+ if (c.state === 'queued') {
16
+ const p = c.position ?? 1
17
+ return { head: p <= 1 ? `Queued · next${tags}` : `Queued · ${ordinal(p)}${tags} - runs after ${p - 1} other${p - 1 === 1 ? '' : 's'}`, ...(c.waiting ? { detail: c.waiting } : {}) }
18
+ }
19
+ if (c.state === 'working') return { head: `Agent working · ${clock(now - c.at)}${agent ? ` - ${harness[agent] ?? agent}` : ''}` }
20
+ if (c.state === 'asks') return { head: 'Asks you - see the question below' }
21
+ if (c.state === 'failed') return { head: `Failed - ${c.note ?? 'the agent could not finish'}`, detail: 'Retry here, or tag @marver again' }
22
+ return { head: c.state }
23
+ }
24
+
25
+ // ---- the lane --------------------------------------------------------------------------------------
26
+
27
+ /** A card as the lane reads it: the queue's card, with its last run's shots when the view has them. */
28
+ export type LaneCard = JamCard & { shots?: { frame: string; before?: string; after?: string }[] }
29
+
30
+ /** A tile's status line (spec 27 Part 1): "To confirm", "Queued · 2nd", "Queued · next", "Agent
31
+ * working · 0:41", "Asks you", "Ready to review", "Done · 2 frames", "Kept, not sent", "Failed ·
32
+ * Retry". A queue position counts every queued card, tags included - they share one queue. */
33
+ export function laneLine(c: LaneCard, now = Date.now()): string {
34
+ switch (c.state) {
35
+ case 'draft': return 'To confirm'
36
+ case 'confirming': return 'Confirming'
37
+ case 'queued': { const p = c.position ?? 1; return p <= 1 ? 'Queued · next' : `Queued · ${ordinal(p)}` }
38
+ case 'working': return `Agent working · ${clock(now - c.at)}`
39
+ case 'asks': return 'Asks you'
40
+ case 'review': return 'Ready to review'
41
+ case 'done': { const n = c.shots?.length ?? 0; return n ? `Done · ${n} frame${n === 1 ? '' : 's'}` : 'Done' }
42
+ case 'kept': return 'Kept, not sent'
43
+ case 'failed': return 'Failed · Retry'
44
+ case 'dropped': return 'Dropped'
45
+ }
46
+ }
47
+
48
+ // ---- the read-back ---------------------------------------------------------------------------------
49
+
50
+ /** One line of a capture's detail: its time in the capture, the kind of step, the words, the element's
51
+ * source (file:line) and point number when it has them. */
52
+ export interface TimelineLine { t: string; kind: string; text: string; source?: string; point?: number }
53
+
54
+ /** `<span> "Save 20%"` - an element as a line names it; a secret stays "•••". */
55
+ const el = (b: Bundle): string =>
56
+ [b.tag ? `<${b.tag}>` : '', b.quote ? `"${b.quote}"` : b.ariaLabel ? `"${b.ariaLabel}"` : b.testId ? `#${b.testId}` : ''].filter(Boolean).join(' ') || 'an element'
57
+ /** The source without its column: file:line is what a reader follows. */
58
+ const src = (b: Bundle): string | undefined => (b.source ? b.source.replace(/:\d+:\d+$/, (m) => m.slice(0, m.lastIndexOf(':'))) : undefined)
59
+ /** A frame as a reader says it: its last segment, capitalised. */
60
+ const frameName = (f?: string): string => {
61
+ const last = (f ?? '').split('/').pop() ?? ''
62
+ return last ? last[0].toUpperCase() + last.slice(1).replace(/-/g, ' ') : 'the frame'
63
+ }
64
+
65
+ /** The read-back's merged timeline (spec 27 Part 3): words and notes interleaved with every pick,
66
+ * click, hover, field, screen and UI step at the moment it happened, timed from the capture's first
67
+ * step. With `edited`, your edit stands in for the words (one line at 0:00); every step stays. */
68
+ export function timelineLines(r: CaptureRecord, edited?: string): TimelineLine[] {
69
+ const t0 = r.timeline[0]?.at ?? 0
70
+ const at = (ms: number) => clock(ms - t0)
71
+ // your edit stands in for the words and the notes - an empty one too (you deleted them)
72
+ const ed = edited === undefined ? undefined : edited.trim()
73
+ const out: TimelineLine[] = ed !== undefined ? [{ t: at(t0), kind: 'words', text: ed ? `"${ed}"` : '(no words - your edit removed them)' }] : []
74
+ let pictures = 0
75
+ for (const s of r.timeline) {
76
+ const t = at(s.at)
77
+ const from = (b: Bundle) => (src(b) ? { source: src(b) } : {})
78
+ switch (s.event) {
79
+ case 'words': if (ed === undefined) out.push({ t, kind: 'words', text: `"${s.text}"` }); break
80
+ case 'note': if (ed === undefined) out.push({ t, kind: 'note', text: `"${s.text}"` }); break
81
+ case 'pick': case 'click':
82
+ out.push({ t, kind: s.event, text: `${el(s.bundle)}${s.mode !== 'canvas' ? ` · ${s.mode}` : ''}`, ...from(s.bundle), ...(s.point != null ? { point: s.point } : {}) }); break
83
+ case 'hover': out.push({ t, kind: 'hover', text: `held over ${el(s.bundle)}`, ...from(s.bundle) }); break
84
+ case 'field': out.push({ t, kind: 'field', text: `${el(s.bundle)} → ${s.value}`, ...from(s.bundle) }); break
85
+ case 'screen': out.push({ t, kind: 'screen', text: `moved to ${s.to}` }); break
86
+ case 'scroll': out.push({ t, kind: 'scroll', text: `scrolled to ${Math.round(s.y)}` }); break
87
+ case 'view': {
88
+ const v = s.view
89
+ const where = v.board ? (v.frames?.length ? `${v.board} / ${v.frames.map(frameName).join(', ')}` : v.board) : v.frames?.map(frameName).join(', ')
90
+ const size = v.viewport ? `${v.viewport}${v.width ? ` ${v.width}×${v.height}` : ''}` : ''
91
+ out.push({ t, kind: 'view', text: [where, size, v.theme].filter(Boolean).join(' · ') || 'the canvas' }); break
92
+ }
93
+ case 'select': out.push({ t, kind: 'select', text: s.frames.map(frameName).join(', ') || 'nothing' }); break
94
+ case 'device': out.push({ t, kind: 'device', text: `${frameName(s.frame)} · ${s.viewport}${s.width ? ` ${s.width}` : ''}` }); break
95
+ case 'theme': out.push({ t, kind: 'theme', text: s.theme }); break
96
+ case 'copied': out.push({ t, kind: 'copied', text: `${s.what} of ${frameName(s.frame)}` }); break
97
+ case 'interact': out.push({ t, kind: 'interact', text: s.on ? 'on' : 'off' }); break
98
+ case 'picture':
99
+ pictures++
100
+ out.push({ t, kind: 'picture', text: `${frameName(s.frame).toLowerCase()}${s.why === 'end' ? ' at E' : s.why === 'pick' ? ' at a pick' : ''}`, point: pictures }); break
101
+ case 'missing': out.push({ t, kind: 'missing', text: s.what }); break
102
+ }
103
+ }
104
+ return out
105
+ }
106
+
107
+ /** A line as plain text, the spec's format: `[0:05] (pick 1) <span> "Save 20%" · file.tsx:48`,
108
+ * `[0:04] "this badge"`, `[0:13] (interact on)`. */
109
+ export function lineText(l: TimelineLine): string {
110
+ if (l.kind === 'words') return `[${l.t}] ${l.text}`
111
+ if (l.kind === 'interact') return `[${l.t}] (interact ${l.text})`
112
+ if (l.kind === 'copied') return `[${l.t}] (copied) ${l.text}`
113
+ const head = l.point != null ? `${l.kind} ${l.point}` : l.kind
114
+ return `[${l.t}] (${head}) ${l.text}${l.source ? ` · ${l.source}` : ''}`
115
+ }