@marver-design/marver 0.27.2 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +160 -0
- package/README.md +6 -4
- package/dist/{anchor-check-gkxkPAIv.mjs → anchor-check-DhlpKl2K.mjs} +1 -1
- package/dist/{audio-Dw1lfMdb.mjs → audio-DX4POHAj.mjs} +39 -4
- package/dist/{boards-BqUqKNW8.mjs → boards-BeWtjGUM.mjs} +49 -4
- package/dist/boards-EH2onUXM.mjs +995 -0
- package/dist/{build-VgNg4rr8.mjs → build-CWbrb2bl.mjs} +9 -5
- package/dist/{capture-vadKjuCo.mjs → capture-DEtM4qm5.mjs} +259 -34
- package/dist/cli.mjs +40 -19
- package/dist/{comments-YEU1Zhv9.mjs → comments-XNhMmSSu.mjs} +4 -4
- package/dist/config-BezZTiov.mjs +182 -0
- package/dist/conn-BMiHS42T.mjs +222 -0
- package/dist/connectors-DekQvKt9.mjs +292 -0
- package/dist/{context-Ccjrhr1J.mjs → context-BUnFiyA3.mjs} +2 -2
- package/dist/{daemon-Dc9AH0M3.mjs → daemon-Sc_z8gT6.mjs} +2209 -205
- package/dist/{dev-ri6nAlRp.mjs → dev-DWBKQhxf.mjs} +31 -15
- package/dist/{init-W0nxR1OY.mjs → init-CYlFaRzG.mjs} +7 -2
- package/dist/jam-Cj5gBvwD.mjs +373 -0
- package/dist/{link-CdTgn94Y.mjs → link-BFFRgrMt.mjs} +3 -3
- package/dist/listener-DdLEM79A.mjs +80 -0
- package/dist/logo-CXY-1yrn.mjs +305 -0
- package/dist/{ls-BZ5TAtd5.mjs → ls-NqmePKOf.mjs} +1 -1
- package/dist/{manifest-aFyDmL8C.mjs → manifest-DPZ3WNg_.mjs} +1 -1
- package/dist/{marks-CnCCfAbD.mjs → marks-BnNANic9.mjs} +22 -3
- package/dist/{marks-BF9pNEgH.mjs → marks-DBp3h1Mc.mjs} +3 -6
- package/dist/{marver-id-gate-D-R0hSt_.mjs → marver-id-gate-vBLb_Icb.mjs} +1 -1
- package/dist/{perf-DkAUFT6W.mjs → perf-Denssrko.mjs} +45 -27
- package/dist/{perf-jam-BaH3Lg0m.mjs → perf-jam-CLkERSHo.mjs} +9 -2
- package/dist/permit-DDa6wqOs.mjs +187 -0
- package/dist/{plugin-B8UghYuF.mjs → plugin-DqoZB-D6.mjs} +849 -789
- package/dist/{poster-BNgafWMK.mjs → poster-CrsjqhY4.mjs} +1 -1
- package/dist/{profile-jIS6BcAs.mjs → profile-B1FKOM1e.mjs} +1 -1
- package/dist/{publish-bakes-38Nja78p.mjs → publish-bakes-DW-NDgU2.mjs} +3 -3
- package/dist/{queue-CAM_vNmX.mjs → queue-DeSQm24g.mjs} +189 -35
- package/dist/{recover-B8AiI29B.mjs → recover-GtJ9UDAB.mjs} +2 -2
- package/dist/{serve-Dp3nHstu.mjs → serve-DQv3Ti6X.mjs} +8 -4
- package/dist/{session-BAaJsK5c.mjs → session-VDJfXEEm.mjs} +1 -1
- package/dist/{share-Ce4tP7ji.mjs → share-Bu_kuOKL.mjs} +1 -1
- package/dist/{shot-CMQgMVZm.mjs → shot-DBWN8hPP.mjs} +1 -1
- package/dist/{shot-Ch24tiMO.mjs → shot-T04Ixrvq.mjs} +7 -6
- package/dist/sizes-wjXDev3b.mjs +139 -0
- package/dist/{slots-CFNnegCc.mjs → slots-Dn4Onb0V.mjs} +101 -3
- package/dist/speech-worker.mjs +23 -3
- package/dist/{sync-CQdGARJ9.mjs → sync-CMozOwZ0.mjs} +1 -1
- package/dist/transport-C5FnY9ni.mjs +203 -0
- package/dist/{work-Bxz-ObF3.mjs → work-BYWD_1Zf.mjs} +3 -3
- package/dist/{work-CNhFF9pU.mjs → work-DJxH7cCX.mjs} +1 -1
- package/docs/boards-and-folders.md +11 -0
- package/docs/jam-session.md +52 -18
- package/docs/live-jam.md +95 -10
- package/docs/performance.md +1 -1
- package/docs/publish.md +7 -0
- package/package.json +1 -1
- package/src/client/shell/Comments.tsx +5 -4
- package/src/client/shell/ContextMenu.tsx +5 -4
- package/src/client/shell/JamSurface.tsx +135 -29
- package/src/client/shell/Play.tsx +16 -4
- package/src/client/shell/api.ts +7 -3
- package/src/client/shell/app-bridge.ts +11 -3
- package/src/client/shell/comments-store.ts +14 -0
- package/src/client/shell/goto.ts +4 -3
- package/src/client/shell/icons.tsx +1 -0
- package/src/client/shell/jam-capture.ts +136 -37
- package/src/client/shell/jam-keys.ts +170 -18
- package/src/client/shell/jam-lane.tsx +14 -5
- package/src/client/shell/jam-lines.ts +76 -10
- package/src/client/shell/jam-panel.tsx +58 -4
- package/src/client/shell/jam-queue.ts +55 -8
- package/src/client/shell/jam-session.tsx +55 -6
- package/src/client/shell/jam-state.ts +19 -4
- package/src/client/shell/jam-surface-parts.tsx +6 -3
- package/src/client/shell/jam-ui.tsx +10 -1
- package/src/client/shell/jam-voice-wait.ts +21 -0
- package/src/client/shell/jam-voice.ts +14 -5
- package/src/client/shell/live-picture.ts +134 -0
- package/src/client/shell/open-item.ts +83 -0
- package/src/client/shell/open-resolve.ts +50 -0
- package/src/client/shell/store.ts +6 -2
- package/src/client/shell/styles.css +29 -11
- package/src/client/shell/tidy.ts +3 -2
- package/src/client/stage/main.tsx +30 -8
- package/src/shared/app-api.ts +173 -3
- package/src/shared/app-perf.ts +4 -2
- package/src/shared/approval.ts +20 -0
- package/src/shared/events.ts +1 -1
- package/templates/AGENTS-embedded.md +28 -1
- package/templates/AGENTS-studio.md +28 -1
- package/templates/instructions/boards.md +7 -1
- package/templates/instructions/jam.md +94 -0
- package/dist/boards-BHKP5yhI.mjs +0 -342
- package/dist/live-Cgzsicwi.mjs +0 -4
|
@@ -8,15 +8,53 @@ import type { Bundle, CaptureRecord } from '../../server/jam/types.ts'
|
|
|
8
8
|
const ordinal = (n: number) => `${n}${n % 100 >= 11 && n % 100 <= 13 ? 'th' : ['th', 'st', 'nd', 'rd'][n % 10] ?? 'th'}`
|
|
9
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
10
|
|
|
11
|
+
/** Why a copy (or a fresh agent) runs it, in a few words, by the reason the canvas gave (daemon.ts, runs.ts): the one that
|
|
12
|
+
* matches, never a near one - any other reason as it was given. */
|
|
13
|
+
const whyShort = (w: string) => w.endsWith('it let it go') ? 'yours let it go' : w.startsWith('your session didn') ? 'yours was busy'
|
|
14
|
+
: w.startsWith('your session was idle') ? 'yours was idle' : w.startsWith('the Jam session had ended') ? 'the Jam session had ended' : w
|
|
15
|
+
|
|
16
|
+
/** Who runs a working card, in words (spec 29b): the tool at work, as its tile says it ("Claude Code is working · 0:42" -
|
|
17
|
+
* Nic, 29 Oct: "Your session" said nothing), then whose run it is - your session, a copy of it and why a copy took it, or
|
|
18
|
+
* a background run - and, for your session, where the run stands. `name` is the agent's name ("Claude Code"); unknown,
|
|
19
|
+
* "Agent". The detail is the working tile's tooltip too (laneTip), so the tile and the icon never disagree. */
|
|
20
|
+
export function runnerLine(c: JamCard, name: (agent: string) => string | undefined, now = Date.now()): { head: string; detail?: string } | null {
|
|
21
|
+
const r = c.runner
|
|
22
|
+
if (c.state !== 'working' || !r) return null
|
|
23
|
+
const tool = (r.agent && name(r.agent)) || undefined
|
|
24
|
+
const yours = tool ? `your ${tool} session` : 'your session'
|
|
25
|
+
const working = `${tool ?? 'Agent'} is working · ${clock(now - c.at)}`
|
|
26
|
+
if (r.kind === 'session') {
|
|
27
|
+
if (r.state === 'offered') return { head: `Dispatching · ${clock(now - c.at)}`, detail: `Offered to ${yours} - it takes the run when it is free` }
|
|
28
|
+
if (r.state === 'waiting') return { head: 'Waiting for your session', detail: 'Open Claude Code, Codex or Cursor in this repo - it takes the run' }
|
|
29
|
+
if (r.state === 'stalled') return { head: `No word from ${yours} for a while`, detail: 'Give it back, run it in the background, or drop it' }
|
|
30
|
+
if (r.state === 'stopping') return { head: `Stopping - waiting for ${yours} to let go`, detail: 'Its frames stay reserved until it does' }
|
|
31
|
+
return { head: working, detail: `In ${yours}${r.agent === 'claude' ? ' - a background subagent of it does the work' : ''}` }
|
|
32
|
+
}
|
|
33
|
+
const why = r.why ? ` (${whyShort(r.why)})` : ''
|
|
34
|
+
if (r.kind === 'fork') return { head: working, detail: `In a copy of ${yours}${why} - with your conversation, tools, MCP servers and skills` }
|
|
35
|
+
return { head: working, detail: `A background ${tool ?? 'agent'} run${why}` }
|
|
36
|
+
}
|
|
37
|
+
|
|
11
38
|
/** What the icon's tooltip says: the state, then the detail - position, clock and agent, the reason
|
|
12
39
|
* a held card waits, why a card failed. */
|
|
13
40
|
export function statusLines(c: JamCard, agent: string | null, harness: Record<string, string>, now = Date.now()): { head: string; detail?: string } {
|
|
14
41
|
const tags = c.events.length > 1 ? ` · ${c.events.length} tags` : ''
|
|
42
|
+
// waiting for more than its place (one runs alone, your session is full): why, never a place in line it does not have -
|
|
43
|
+
// and before a frame another run holds, which it waits for too: that run ending is not enough (Codex's review)
|
|
44
|
+
const w = c.waitsFor
|
|
45
|
+
const also = w ? `; ${w.by === 'chat' ? 'your agent in chat' : w.by ? `"${w.by}"` : 'another run'} is working on ${w.frame}` : ''
|
|
46
|
+
if (c.state === 'queued' && c.waiting === 'alone') return { head: `Queued · waits to run alone${tags}`, detail: `It ${c.exclusive ? 'changes a shared file' : 'names no frame'} and runs on its own - it starts once the other work is done${also}` }
|
|
47
|
+
if (c.state === 'queued' && c.waiting === 'behind') return { head: `Queued · waits - a run goes alone first${tags}`, detail: `A request that runs on its own goes first - this one starts after it${also}` }
|
|
48
|
+
if (c.state === 'queued' && w) {
|
|
49
|
+
return { head: `Queued · waits for ${w.frame}${tags}`, detail: w.by === 'chat' ? 'Your agent in chat is working on it - this one starts when it is done'
|
|
50
|
+
: w.by ? `"${w.by}" is working on it - this one starts when it is done` : 'Another run is working on it - this one starts when it is done' }
|
|
51
|
+
}
|
|
52
|
+
if (c.state === 'queued' && c.waiting === 'session') return { head: `Queued · waits - your session is full${tags}`, detail: 'Your session holds all the runs it can - this one goes to it when one of them ends' }
|
|
15
53
|
if (c.state === 'queued') {
|
|
16
54
|
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'}
|
|
55
|
+
return { head: p <= 1 ? `Queued · next${tags}` : `Queued · ${ordinal(p)}${tags} - runs after ${p - 1} other${p - 1 === 1 ? '' : 's'}` }
|
|
18
56
|
}
|
|
19
|
-
if (c.state === 'working') return { head:
|
|
57
|
+
if (c.state === 'working') return runnerLine(c, (a) => harness[a], now) ?? { head: `${(agent && harness[agent]) || 'Agent'} is working · ${clock(now - c.at)}` }
|
|
20
58
|
if (c.state === 'asks') return { head: 'Asks you - see the question below' }
|
|
21
59
|
if (c.state === 'failed') return { head: `Failed - ${c.note ?? 'the agent could not finish'}`, detail: 'Retry here, or tag @marver again' }
|
|
22
60
|
return { head: c.state }
|
|
@@ -27,15 +65,30 @@ export function statusLines(c: JamCard, agent: string | null, harness: Record<st
|
|
|
27
65
|
/** A card as the lane reads it: the queue's card, with its last run's shots when the view has them. */
|
|
28
66
|
export type LaneCard = JamCard & { shots?: { frame: string; before?: string; after?: string }[] }
|
|
29
67
|
|
|
30
|
-
/** A tile's status line (spec 27 Part 1): "To confirm", "Queued · 2nd", "Queued · next", "
|
|
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
|
-
|
|
68
|
+
/** A tile's status line (spec 27 Part 1): "To confirm", "Queued · 2nd", "Queued · next", "Claude Code
|
|
69
|
+
* is working · 0:41", "Dispatching", "Asks you", "Ready to review", "Done · 2 frames", "Kept, not sent", "Failed ·
|
|
70
|
+
* Retry". A queue position counts every queued card, tags included - they share one queue. `name` is the agent's
|
|
71
|
+
* name ("Claude Code"); unknown, "Agent". */
|
|
72
|
+
export function laneLine(c: LaneCard, now = Date.now(), name: (agent: string) => string | undefined = () => undefined): string {
|
|
34
73
|
switch (c.state) {
|
|
35
|
-
|
|
74
|
+
// a draft the queue would not take (a conflicting comment under its id - an E capture, or a confirm): it says
|
|
75
|
+
// so, never "To confirm" - E's never asked you to confirm anything
|
|
76
|
+
case 'draft': return c.note ? 'Not queued' : 'To confirm'
|
|
36
77
|
case 'confirming': return 'Confirming'
|
|
37
|
-
|
|
38
|
-
|
|
78
|
+
// waiting for one that runs alone, or on a frame another run holds: why, never a place in line it does not have (the
|
|
79
|
+
// run alone first - a frame's run ending is not enough while it waits for that too; Codex's review)
|
|
80
|
+
case 'queued': {
|
|
81
|
+
if (c.waiting) return c.waiting === 'alone' ? 'Waits to run alone' : c.waiting === 'session' ? 'Waits · your session is full' : 'Waits · a run goes alone first'
|
|
82
|
+
if (c.waitsFor) return `Waits for ${c.waitsFor.frame.split('/').pop()}`
|
|
83
|
+
const p = c.position ?? 1; return p <= 1 ? 'Queued · next' : `Queued · ${ordinal(p)}`
|
|
84
|
+
}
|
|
85
|
+
case 'working': {
|
|
86
|
+
// the tool at work, whoever runs it (Nic, 29 Oct: "Your session" and "a copy of your session" said nothing) - whose
|
|
87
|
+
// run it is, and why a copy took it, is the tile's tooltip (laneTip); your session not holding it yet says so
|
|
88
|
+
const r = c.runner
|
|
89
|
+
if (r?.kind === 'session' && r.state && r.state !== 'claimed') return r.state === 'offered' ? 'Dispatching' : r.state === 'waiting' ? 'Waiting for a session' : r.state === 'stalled' ? 'Stalled · choose' : 'Stopping'
|
|
90
|
+
return `${(r?.agent && name(r.agent)) || 'Agent'} is working · ${clock(now - c.at)}`
|
|
91
|
+
}
|
|
39
92
|
case 'asks': return 'Asks you'
|
|
40
93
|
case 'review': return 'Ready to review'
|
|
41
94
|
case 'done': { const n = c.shots?.length ?? 0; return n ? `Done · ${n} frame${n === 1 ? '' : 's'}` : 'Done' }
|
|
@@ -45,6 +98,10 @@ export function laneLine(c: LaneCard, now = Date.now()): string {
|
|
|
45
98
|
}
|
|
46
99
|
}
|
|
47
100
|
|
|
101
|
+
/** A working tile's tooltip (0.28.0): whose run it is - your session, a copy of it and why, a background run - the
|
|
102
|
+
* status icon's own detail (runnerLine), so the two never disagree. Other tiles have none. */
|
|
103
|
+
export const laneTip = (c: LaneCard, name: (agent: string) => string | undefined): string | undefined => runnerLine(c, name)?.detail
|
|
104
|
+
|
|
48
105
|
// ---- the read-back ---------------------------------------------------------------------------------
|
|
49
106
|
|
|
50
107
|
/** One line of a capture's detail: its time in the capture, the kind of step, the words, the element's
|
|
@@ -97,13 +154,22 @@ export function timelineLines(r: CaptureRecord, edited?: string): TimelineLine[]
|
|
|
97
154
|
case 'interact': out.push({ t, kind: 'interact', text: s.on ? 'on' : 'off' }); break
|
|
98
155
|
case 'picture':
|
|
99
156
|
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
|
|
157
|
+
out.push({ t, kind: 'picture', text: `${frameName(s.frame).toLowerCase()}${s.why === 'end' ? ' at E' : s.why === 'pick' ? ' at a pick' : ''}${s.source === 'live' ? ` · ${AS_SEEN}` : ''}`, point: pictures }); break
|
|
101
158
|
case 'missing': out.push({ t, kind: 'missing', text: s.what }); break
|
|
102
159
|
}
|
|
103
160
|
}
|
|
104
161
|
return out
|
|
105
162
|
}
|
|
106
163
|
|
|
164
|
+
/** A live picture's words (A4.6 #38): the Mac app's picture of the stage, as the owner saw it - not a render. */
|
|
165
|
+
const AS_SEEN = 'as you saw it'
|
|
166
|
+
/** A capture's picture as the read-back and the review's Capture tab caption it: "picture N", and "picture N · as you saw
|
|
167
|
+
* it" for a live one (its picture step says `source: 'live'`). */
|
|
168
|
+
export function pictureCaption(r: CaptureRecord, id: string, n: number): string {
|
|
169
|
+
const live = r.timeline.some((s) => s.event === 'picture' && s.id === id && s.source === 'live')
|
|
170
|
+
return `picture ${n}${live ? ` · ${AS_SEEN}` : ''}`
|
|
171
|
+
}
|
|
172
|
+
|
|
107
173
|
/** A line as plain text, the spec's format: `[0:05] (pick 1) <span> "Save 20%" · file.tsx:48`,
|
|
108
174
|
* `[0:04] "this badge"`, `[0:13] (interact on)`. */
|
|
109
175
|
export function lineText(l: TimelineLine): string {
|
|
@@ -146,6 +146,21 @@ function AddedNotes({ added, onAdd }: { added: { at: number; text: string }[]; o
|
|
|
146
146
|
)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/** The review pictures' shapes (width / height) by URL, learned as one loads in a review or ahead of it (preloadShots):
|
|
150
|
+
* a review opens at its pictures' width and layout, never the default first (Nic, 29 Oct: it collapsed, then grew). */
|
|
151
|
+
const shapes = new Map<string, number>()
|
|
152
|
+
const preloaded = new Set<string>()
|
|
153
|
+
/** A card's review pictures loaded ahead, each URL once - as the card is ready to review, before its review opens. */
|
|
154
|
+
export function preloadShots(urls: (string | undefined)[]) {
|
|
155
|
+
for (const url of urls) {
|
|
156
|
+
if (!url || preloaded.has(url)) continue
|
|
157
|
+
preloaded.add(url)
|
|
158
|
+
const im = new Image()
|
|
159
|
+
im.onload = () => { if (im.naturalWidth > 0 && im.naturalHeight > 0) shapes.set(url, im.naturalWidth / im.naturalHeight) }
|
|
160
|
+
im.src = url
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
149
164
|
/** A picture, or the dashed "No picture" where a shot failed. */
|
|
150
165
|
export function Shot({ url, cap, alt, onSize }: { url?: string; cap?: ReactNode; alt?: string; onSize?: (w: number, h: number) => void }) {
|
|
151
166
|
// a picture that cannot load (gone, refused) is "No picture" too - never a broken image
|
|
@@ -188,7 +203,7 @@ const Meta = ({ items }: { items: ReactNode[] }) => (
|
|
|
188
203
|
* capture made during a review; `err` = a confirm that failed closed; `warn` = degraded content
|
|
189
204
|
* ("words may be incomplete").
|
|
190
205
|
*/
|
|
191
|
-
export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, pictures, edited, pending, editing, onEdit, onRetry, onConfirm, onKeep, onDrop, onResume, agent, follows, readOnly, locked, onOpenThread, added, onAddNote, autoNamed, err, warn, style }: {
|
|
206
|
+
export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, pictures, edited, pending, editing, onEdit, onRetry, onConfirm, onKeep, onDrop, onResume, agent, follows, readOnly, locked, onOpenThread, added, onAddNote, autoNamed, err, warn, asks, style }: {
|
|
192
207
|
title: string
|
|
193
208
|
/** beside the title: the Review | Capture switch (a capture under review) */
|
|
194
209
|
head?: ReactNode
|
|
@@ -224,6 +239,9 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
224
239
|
onAddNote?: (text: string, id: string) => Promise<boolean>
|
|
225
240
|
err?: ReactNode
|
|
226
241
|
warn?: ReactNode
|
|
242
|
+
/** a capture whose run asks you something, opened here because its thread cannot show on this board: the question,
|
|
243
|
+
* and a field whose answer goes to its thread with @marver (an answer with a tag is what carries the work on) */
|
|
244
|
+
asks?: { question: string; onAnswer(text: string): Promise<boolean> }
|
|
227
245
|
style?: CSSProperties
|
|
228
246
|
}) {
|
|
229
247
|
const [open, setOpen] = useState(!!editing)
|
|
@@ -255,6 +273,7 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
255
273
|
</div>
|
|
256
274
|
<Meta items={meta} />
|
|
257
275
|
<div className="jm-body">
|
|
276
|
+
{asks && <AsksAnswer question={asks.question} onAnswer={asks.onAnswer} />}
|
|
258
277
|
{follows && <div className="note-line info"><ArrowBendUpLeftIcon size={14} /><span>Follows <b style={{ color: 'var(--glass-ink)' }}>{follows}</b> - confirming sends that review back as more work</span></div>}
|
|
259
278
|
{err && <div className="note-line err"><WarningIcon size={14} /><span>{err}</span></div>}
|
|
260
279
|
{warn && <div className="note-line warn"><WarningIcon size={14} /><span>{warn}</span></div>}
|
|
@@ -275,7 +294,7 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
275
294
|
<div className="actions">
|
|
276
295
|
{readOnly ? (
|
|
277
296
|
<><span className="sp" />{onOpenThread && <button className="jm-btn" onClick={onOpenThread}>Open thread</button>}
|
|
278
|
-
{onRetry && <><button className="jm-btn ghost" onClick={onDrop}>Drop</button><button className="jm-btn primary" onClick={onRetry}>Retry</button></>}</>
|
|
297
|
+
{onRetry && <><button className="jm-btn ghost" data-jam-run-act="drop" onClick={onDrop}>Drop</button><button className="jm-btn primary" data-jam-run-act="retry" onClick={onRetry}>Retry</button></>}</>
|
|
279
298
|
) : (
|
|
280
299
|
<>
|
|
281
300
|
<span className="dim">{agent ? <>For <b style={{ color: 'var(--glass-ink-2)', fontWeight: 600 }}>{agent}</b></> : 'No agent yet - it waits in the queue'}</span>
|
|
@@ -291,6 +310,38 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
291
310
|
)
|
|
292
311
|
}
|
|
293
312
|
|
|
313
|
+
/** What a capture's run asked you, and your answer - for a thread this board cannot show (its frame is on no node
|
|
314
|
+
* here). Sent with @marver in its thread: the answer goes back to the agent, as a tagged reply does. The thread panel
|
|
315
|
+
* (spec 28 A4.6 #30) draws its own messages (no `question`) and says `tag` only when a Jam card is on the thread - a
|
|
316
|
+
* tag anywhere else would start a run nobody asked for, so the answer goes as typed. */
|
|
317
|
+
export function AsksAnswer({ question, onAnswer, tag = true }: { question?: string; onAnswer(text: string): Promise<boolean>; tag?: boolean }) {
|
|
318
|
+
const [text, setText] = useState('')
|
|
319
|
+
const [sending, setSending] = useState(false)
|
|
320
|
+
const send = () => {
|
|
321
|
+
if (!text.trim() || sending) return
|
|
322
|
+
setSending(true)
|
|
323
|
+
void onAnswer(text.trim()).then((ok) => { setSending(false); if (ok) setText('') })
|
|
324
|
+
}
|
|
325
|
+
return (
|
|
326
|
+
<div className="jm-asks" data-jam-asks="" style={{ display: 'flex', flexDirection: 'column', gap: 7 }}>
|
|
327
|
+
{question !== undefined && <div className="jm-reply">
|
|
328
|
+
<Marver size={20} />
|
|
329
|
+
<p>{question || 'It asks you something - see its thread.'}</p>
|
|
330
|
+
</div>}
|
|
331
|
+
<div className="jm-more">
|
|
332
|
+
{tag && <span className="at">@marver</span>}
|
|
333
|
+
<textarea className="txt" rows={1} value={text} placeholder="Your answer" disabled={sending}
|
|
334
|
+
onChange={(e) => setText(e.target.value)}
|
|
335
|
+
onKeyDown={(e) => {
|
|
336
|
+
e.stopPropagation()
|
|
337
|
+
if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) { e.preventDefault(); send() }
|
|
338
|
+
}} />
|
|
339
|
+
<button className="jm-send" disabled={!text.trim() || sending} onClick={send}>Send <kbd>⏎</kbd></button>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
|
|
294
345
|
// ---- the review --------------------------------------------------------------------------------------
|
|
295
346
|
|
|
296
347
|
/**
|
|
@@ -338,9 +389,11 @@ export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active,
|
|
|
338
389
|
const isNew = (f: string) => !!shots.find((s) => s.frame === f)?.new
|
|
339
390
|
// the frame's shape, from its pictures as they load (After's, else Before's): taller than wide (or square) side by
|
|
340
391
|
// side, wider than tall stacked - and the panel as wide as that needs (0.26.1, the owner's first real session)
|
|
392
|
+
// - known before it loads when it was preloaded, or shown before
|
|
341
393
|
const [sizes, setSizes] = useState<Record<string, number>>({})
|
|
342
|
-
const sized = (url?: string) => (url ? (w: number, h: number) => { if (w > 0 && h > 0) setSizes((m) => (m[url] === w / h ? m : { ...m, [url]: w / h })) } : undefined)
|
|
343
|
-
const
|
|
394
|
+
const sized = (url?: string) => (url ? (w: number, h: number) => { if (w > 0 && h > 0) { shapes.set(url, w / h); setSizes((m) => (m[url] === w / h ? m : { ...m, [url]: w / h })) } } : undefined)
|
|
395
|
+
const shape = (url?: string) => (url ? sizes[url] ?? shapes.get(url) : undefined)
|
|
396
|
+
const aspect = shape(shot?.after) || shape(shot?.before) || undefined
|
|
344
397
|
// both slots whenever the frame has a before at all (either may read "No picture") - a missing After never hides a Before
|
|
345
398
|
const both = view === 'both' && !!shot && !shot.new && !!(shot.before || shot.after)
|
|
346
399
|
const side = (aspect ?? 1.6) <= 1.1
|
|
@@ -379,6 +432,7 @@ export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active,
|
|
|
379
432
|
// left on purpose (Esc cleared its words from the map): the composer's words go too; closed by a click
|
|
380
433
|
// elsewhere, the map still holds them
|
|
381
434
|
useEffect(() => { if (more) field.current?.focus(); else if (draftKey && !moreDrafts.has(draftKey)) setTextState('') }, [more])
|
|
435
|
+
// sent as More work, always: the canvas settles a note that only approves ("looks good") as Looks good
|
|
382
436
|
const send = () => { if (text.trim()) onMore(text.trim()) }
|
|
383
437
|
return (
|
|
384
438
|
<div className="jm-panel jm-review" data-jam-review="" style={style}>
|
|
@@ -13,7 +13,7 @@ export type JamCardState = 'draft' | 'confirming' | 'queued' | 'working' | 'asks
|
|
|
13
13
|
export interface JamCard {
|
|
14
14
|
id: string; kind: 'comment' | 'capture' | 'wrapup'; board: string; thread?: string; frames: string[]; events: string[]
|
|
15
15
|
state: JamCardState; note?: string; rev: number; made: number; order: number; at: number
|
|
16
|
-
follows?: string; reply?: string; position?: number; waiting?: string; exclusive?: boolean; batch?: string
|
|
16
|
+
follows?: string; reply?: string; position?: number; waiting?: 'alone' | 'behind' | 'session'; waitsFor?: { frame: string; by?: string }; exclusive?: boolean; batch?: string
|
|
17
17
|
// captures: the lane and the review
|
|
18
18
|
title?: string; inRun?: boolean; shots?: { frame: string; before?: string; after?: string; same?: boolean; new?: boolean }[]
|
|
19
19
|
reviewing?: { card: string; batch: string; rev: number }; edited?: string; added?: { at: number; text: string }[]; notes?: number; capture?: string
|
|
@@ -25,7 +25,19 @@ export interface JamCard {
|
|
|
25
25
|
session?: string
|
|
26
26
|
/** a session record: the file it writes */
|
|
27
27
|
file?: string
|
|
28
|
+
/** who runs it now (spec 29b): your session, a copy of it, or a fresh agent - and where it stands */
|
|
29
|
+
runner?: JamRunner
|
|
30
|
+
/** the occurrence counters a notice's click compares (spec 28 A4.6 #9, #30): how many times it entered review or
|
|
31
|
+
* failed, and its batch's failures. Absent reads 0 */
|
|
32
|
+
att?: number
|
|
33
|
+
fails?: number
|
|
28
34
|
}
|
|
35
|
+
/** `stalls`: how many times its claim went quiet (A4.6 #9; absent reads 0) */
|
|
36
|
+
export interface JamRunner { kind: 'session' | 'fork' | 'fresh'; agent: string; state?: 'offered' | 'claimed' | 'stalled' | 'stopping' | 'waiting'; why?: string; batch: string; gen?: number; stalls?: number }
|
|
37
|
+
/** A coding-agent session connected to this repo (spec 29b): the selected one takes the work while a Jam session runs. */
|
|
38
|
+
export interface JamSession { id: string; agent: 'claude' | 'codex' | 'cursor'; busy: boolean; selected: boolean; since: number; mode?: string }
|
|
39
|
+
/** What Jam does on this machine: the config with the start sheet's switches over it. */
|
|
40
|
+
export interface JamSettings { runner: 'auto' | 'session' | 'background'; session: boolean; context: 'fork' | 'fresh'; mcp: boolean; skills: boolean; others: boolean; sessionMax: number }
|
|
29
41
|
/** The review's frames: the ones the run changed (all of them when none did - there is still a before
|
|
30
42
|
* and after to look at). */
|
|
31
43
|
export const changedShots = (shots: JamCard['shots']) => { const all = shots ?? []; const changed = all.filter((x) => !x.same); return changed.length ? changed : all }
|
|
@@ -38,11 +50,20 @@ interface QueueState {
|
|
|
38
50
|
run: { since: number } | null
|
|
39
51
|
/** the Jam session running now (spec 27 Part 5) */
|
|
40
52
|
session: { id: string; since: number } | null
|
|
41
|
-
|
|
53
|
+
/** the coding-agent sessions connected to this repo, and Jam's settings here (spec 29b) */
|
|
54
|
+
sessions: JamSession[]
|
|
55
|
+
settings: JamSettings | null
|
|
56
|
+
/** resolves true once the canvas answered with a view (applied, or overtaken by a newer one) - one built after the call */
|
|
57
|
+
/** the view now; `signal` lets a caller that stopped waiting cancel the request */
|
|
58
|
+
load(opts?: { signal?: AbortSignal }): Promise<boolean>
|
|
42
59
|
apply(view: unknown): void
|
|
43
60
|
/** A session this page ended (the server said so): gone at once, and no view shows it again */
|
|
44
61
|
forget(session: string): void
|
|
45
62
|
act(card: JamCard, action: JamAction, body?: string): Promise<boolean>
|
|
63
|
+
/** a session run's choice (spec 29b): give it back, run it in the background, drop it - at its generation */
|
|
64
|
+
runAct(card: JamCard, action: 'again' | 'background' | 'drop'): Promise<boolean>
|
|
65
|
+
/** the start sheet's switches, and which session takes the work */
|
|
66
|
+
setPrefs(p: { mcp?: boolean; skills?: boolean; context?: 'fork' | 'fresh'; others?: boolean; pick?: string | null }): Promise<boolean>
|
|
46
67
|
}
|
|
47
68
|
|
|
48
69
|
const csrf = () => /(?:^|;\s*)mv_c=([\w-]+)/.exec(document.cookie)?.[1] ?? ''
|
|
@@ -69,12 +90,20 @@ export const useJamQueue = create<QueueState>((set, get) => {
|
|
|
69
90
|
agent: null,
|
|
70
91
|
run: null,
|
|
71
92
|
session: null,
|
|
72
|
-
|
|
73
|
-
|
|
93
|
+
sessions: [],
|
|
94
|
+
settings: null,
|
|
95
|
+
async load(opts) {
|
|
96
|
+
if (PUBLISHED) return false
|
|
74
97
|
try {
|
|
75
|
-
const res = await api('jam/queue', { headers: { 'x-mv-c': csrf() } })
|
|
76
|
-
if (res.ok)
|
|
77
|
-
|
|
98
|
+
const res = await api('jam/queue', { headers: { 'x-mv-c': csrf() }, ...(opts?.signal ? { signal: opts.signal } : {}) })
|
|
99
|
+
if (!res.ok) return false
|
|
100
|
+
const v = await res.json()
|
|
101
|
+
// the canvas's stand-in while its queue is not up (a restart) is not a view of it: never applied - it would
|
|
102
|
+
// empty the lane and end the session here (its microphone too) over what a push just brought
|
|
103
|
+
if ((v as { unavailable?: unknown } | null)?.unavailable) return false
|
|
104
|
+
get().apply(v)
|
|
105
|
+
return Array.isArray((v as { cards?: unknown } | null)?.cards)
|
|
106
|
+
} catch { return false /* no queue: no icons */ }
|
|
78
107
|
},
|
|
79
108
|
apply(view) {
|
|
80
109
|
const v = (view && typeof view === 'object' ? view : {}) as { cards?: unknown; agent?: unknown }
|
|
@@ -90,8 +119,12 @@ export const useJamQueue = create<QueueState>((set, get) => {
|
|
|
90
119
|
loaded = true
|
|
91
120
|
const run = (v as { run?: { since?: unknown } }).run
|
|
92
121
|
const ses = (v as { session?: { id?: unknown; since?: unknown } }).session
|
|
122
|
+
const sessions = (v as { sessions?: unknown }).sessions
|
|
123
|
+
const settings = (v as { settings?: unknown }).settings
|
|
93
124
|
set({ cards: next, agent: typeof v.agent === 'string' ? v.agent : null, run: run && typeof run.since === 'number' ? { since: run.since } : null,
|
|
94
|
-
session: ses && typeof ses.id === 'string' && typeof ses.since === 'number' && !over.has(ses.id) ? { id: ses.id, since: ses.since } : null
|
|
125
|
+
session: ses && typeof ses.id === 'string' && typeof ses.since === 'number' && !over.has(ses.id) ? { id: ses.id, since: ses.since } : null,
|
|
126
|
+
sessions: Array.isArray(sessions) ? sessions.filter((x): x is JamSession => !!x && typeof x === 'object' && typeof (x as JamSession).id === 'string') : [],
|
|
127
|
+
settings: settings && typeof settings === 'object' ? settings as JamSettings : null })
|
|
95
128
|
if (first) return
|
|
96
129
|
// something to review: a soft chime, once per batch that leaves a capture to review, if the page
|
|
97
130
|
// has focus - never a notice (spec 27, Part 2)
|
|
@@ -120,6 +153,20 @@ export const useJamQueue = create<QueueState>((set, get) => {
|
|
|
120
153
|
await get().load() // the card as it is now (its new rev) before the caller acts again
|
|
121
154
|
return !!res?.ok
|
|
122
155
|
},
|
|
156
|
+
async runAct(card, action) {
|
|
157
|
+
if (!card.runner || card.runner.gen === undefined) return false
|
|
158
|
+
const res = await api('jam/run', {
|
|
159
|
+
method: 'POST', headers: { 'content-type': 'application/json', 'x-mv-c': csrf() },
|
|
160
|
+
body: JSON.stringify({ batch: card.runner.batch, gen: card.runner.gen, action }),
|
|
161
|
+
}).catch(() => null)
|
|
162
|
+
await get().load()
|
|
163
|
+
return !!res?.ok
|
|
164
|
+
},
|
|
165
|
+
async setPrefs(p) {
|
|
166
|
+
const res = await api('jam/prefs', { method: 'POST', headers: { 'content-type': 'application/json', 'x-mv-c': csrf() }, body: JSON.stringify(p) }).catch(() => null)
|
|
167
|
+
await get().load()
|
|
168
|
+
return !!res?.ok
|
|
169
|
+
},
|
|
123
170
|
}
|
|
124
171
|
})
|
|
125
172
|
|
|
@@ -18,7 +18,7 @@ import { JamStateIcon } from './jam-ui.tsx'
|
|
|
18
18
|
import { Marver, moreDraftOf, setMoreDraft } from './jam-panel.tsx'
|
|
19
19
|
import { useJamVoice, voiceSession, voiceSessionEnd, voiceSessionId } from './jam-voice.ts'
|
|
20
20
|
import { HARNESS } from './Comments.tsx'
|
|
21
|
-
import { ArrowRightIcon, CaretIcon, KeyboardIcon, MicrophoneIcon, MicrophoneSlashIcon, WarningIcon, WaveformIcon } from './icons.tsx'
|
|
21
|
+
import { ArrowRightIcon, CaretIcon, CommentIcon, KeyboardIcon, LinkIcon, MicrophoneIcon, MicrophoneSlashIcon, NotebookIcon, UserIcon, WarningIcon, WaveformIcon } from './icons.tsx'
|
|
22
22
|
import { Tip } from './Tip.tsx'
|
|
23
23
|
import { useSessionClock } from './jam-lane.tsx'
|
|
24
24
|
import { CONFIG, stoppedFor, useStore } from './store.ts'
|
|
@@ -117,7 +117,7 @@ export function pressJ() {
|
|
|
117
117
|
if (!ui.sheet && stoppedFor('Jam needs the canvas running')) return
|
|
118
118
|
if (!useJamQueue.getState().session) { ui.setSheet(ui.sheet === 'start' ? null : 'start'); return }
|
|
119
119
|
if (ui.sheet === 'wrap' || ui.sheet === 'wrap-pending') { ui.setSheet(null); return }
|
|
120
|
-
if (useJamCapture.getState().current) { useJamCapture.getState().end(); ui.setSheet('wrap-pending'); return }
|
|
120
|
+
if (useJamCapture.getState().current) { useJamCapture.getState().end(true); ui.setSheet('wrap-pending'); return }
|
|
121
121
|
ui.setSheet('wrap')
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -156,7 +156,7 @@ export function JamButton({ inPlay }: { inPlay?: boolean }) {
|
|
|
156
156
|
|
|
157
157
|
/** Jam's keys, one list: the shortcuts tooltip (the key table in jam-keys.ts is the source of truth). */
|
|
158
158
|
export const JAM_KEYS: [string, string][] = [
|
|
159
|
-
['Start a capture', 'S'], ['
|
|
159
|
+
['Start a capture', 'S'], ['Stop and queue it', 'E'], ['Stop to review it', '⇧E'], ['Drop it', 'esc'], ['Add a note', 'N'], ['Picture of the frame', 'I'],
|
|
160
160
|
['Resume a capture', 'R'], ['The captures', 'Q'], ['Open a capture', '⏎'], ['Keep it, not sent', 'K'], ['Review the next', 'V'], ['End the session', 'J'],
|
|
161
161
|
]
|
|
162
162
|
|
|
@@ -178,6 +178,55 @@ function ShortcutsRow() {
|
|
|
178
178
|
)
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
/** Who does the work, and with what (spec 29b): your own coding-agent session while the Jam session runs, a copy of
|
|
182
|
+
* it, or a background agent - and the three switches over what the runs Marver spawns may use. Starting the
|
|
183
|
+
* session connects every Claude Code, Codex and Cursor session in the repo; nothing else to set up. */
|
|
184
|
+
function WhoWorks({ fallback }: { fallback: string }) {
|
|
185
|
+
const sessions = useJamQueue((s) => s.sessions)
|
|
186
|
+
const settings = useJamQueue((s) => s.settings)
|
|
187
|
+
const agent = useJamQueue((s) => s.agent)
|
|
188
|
+
const [info, setInfo] = useState<{ connectors?: { agent: string; state: string; note?: string }[] } | null>(null)
|
|
189
|
+
useEffect(() => { api('jam/prefs', { headers: { 'x-mv-c': csrf() } }).then((r) => (r.ok ? r.json() : null)).then(setInfo, () => {}) }, [])
|
|
190
|
+
if (!settings) return <div className="row"><ArrowRightIcon size={15} /><span>Hands work to</span><span className="v"><span className="jm-agent"><i />{fallback}</span></span></div>
|
|
191
|
+
const sel = sessions.find((x) => x.selected)
|
|
192
|
+
const context = settings.context !== 'fresh'
|
|
193
|
+
const name = (a: string) => HARNESS[a] ?? a
|
|
194
|
+
const forks = agent === 'claude' || agent === 'codex' || sel?.agent === 'claude' || sel?.agent === 'codex'
|
|
195
|
+
const who = !settings.session || !context || settings.runner === 'background'
|
|
196
|
+
? { line: `A background agent - ${name(agent ?? '')}`, small: context ? 'With your last session\'s context' : 'Starting fresh' }
|
|
197
|
+
: sel
|
|
198
|
+
? { line: `Your ${name(sel.agent)} session`, small: sel.agent === 'claude' ? 'With everything it has' : 'While it works; idle, a copy of it' }
|
|
199
|
+
: { line: forks ? 'A copy of your last session' : `A background agent - ${name(agent ?? '')}`, small: 'Open your agent here and it joins' }
|
|
200
|
+
// several sessions: the next one takes the work (one click), until it ends
|
|
201
|
+
const next = sessions.length > 1 ? sessions[(sessions.findIndex((x) => x.selected) + 1) % sessions.length] : undefined
|
|
202
|
+
// the Codex hint only for someone who is not working in another session now: it is noise to a Claude Code user
|
|
203
|
+
const trust = !sel && info?.connectors?.some((c) => c.agent === 'codex' && c.state === 'installed') && !sessions.some((x) => x.agent === 'codex')
|
|
204
|
+
const set = useJamQueue.getState().setPrefs
|
|
205
|
+
const sw = (on: boolean) => <span className="v">{on ? 'On' : 'Off'}<i className={`jm-switch${on ? ' on' : ''}`} /></span>
|
|
206
|
+
return (<>
|
|
207
|
+
{(() => {
|
|
208
|
+
const body = (<>
|
|
209
|
+
<UserIcon size={15} />
|
|
210
|
+
<span>{who.line}<br /><small title={next ? `${sessions.length} sessions open - click for the next` : undefined}>{next ? `${sessions.length} open · click for the next` : who.small}</small></span>
|
|
211
|
+
{sel && <span className="v"><span className="jm-agent"><i /></span></span>}
|
|
212
|
+
</>)
|
|
213
|
+
return next
|
|
214
|
+
? <button className="row jm-two" data-jam-who={sel ? sel.agent : 'background'} onClick={() => void set({ pick: next.id })}>{body}</button>
|
|
215
|
+
: <div className="row jm-two" data-jam-who={sel ? sel.agent : 'background'}>{body}</div>
|
|
216
|
+
})()}
|
|
217
|
+
<button className="row jm-two" data-jam-switch="mcp" onClick={() => void set({ mcp: !settings.mcp, skills: !settings.mcp })}>
|
|
218
|
+
<LinkIcon size={15} /><span>MCP servers and skills<br /><small>Background runs use yours</small></span>{sw(settings.mcp)}
|
|
219
|
+
</button>
|
|
220
|
+
<button className="row jm-two" data-jam-switch="context" onClick={() => void set({ context: context ? 'fresh' : 'fork' })}>
|
|
221
|
+
<NotebookIcon size={15} /><span>Your session's context<br /><small>Your session or a copy works</small></span>{sw(context)}
|
|
222
|
+
</button>
|
|
223
|
+
<button className="row jm-two" data-jam-switch="others" onClick={() => void set({ others: !settings.others })}>
|
|
224
|
+
<CommentIcon size={15} /><span>Collaborators' comments<br /><small>Their words reach the agent</small></span>{sw(settings.others)}
|
|
225
|
+
</button>
|
|
226
|
+
{trust && <div className="note-line" style={{ margin: '4px 8px' }}><WarningIcon size={14} /><span>Codex runs go to a copy of your session. To let your open Codex session take them itself, type <code style={{ color: 'inherit' }}>/hooks</code> in Codex once and trust Marver's.</span></div>}
|
|
227
|
+
</>)
|
|
228
|
+
}
|
|
229
|
+
|
|
181
230
|
export function StartSheet({ style }: { style?: CSSProperties }) {
|
|
182
231
|
const agent = useJamQueue((s) => s.agent)
|
|
183
232
|
const voice = useJamVoice()
|
|
@@ -196,7 +245,7 @@ export function StartSheet({ style }: { style?: CSSProperties }) {
|
|
|
196
245
|
<span className="v">{mic ? 'On' : 'Off'}<i className={`jm-switch${mic ? ' on' : ''}`} /></span>
|
|
197
246
|
</button>
|
|
198
247
|
{name
|
|
199
|
-
? <
|
|
248
|
+
? <WhoWorks fallback={name} />
|
|
200
249
|
: <div className="note-line warn" style={{ margin: '4px 0' }}><WarningIcon size={14} /><span>No coding agent found - work waits in the queue.<br /><code style={{ color: 'inherit', opacity: .8 }}>npx marver init</code> sets one up.</span></div>}
|
|
201
250
|
</div>
|
|
202
251
|
<ShortcutsRow />
|
|
@@ -348,8 +397,8 @@ export function RecordDetail({ card, agent, more, onMore, onMoreOpen, onGood, on
|
|
|
348
397
|
{failed && <div className="rule" />}
|
|
349
398
|
{failed && (
|
|
350
399
|
<div className="actions">
|
|
351
|
-
<button className="jm-btn primary" onClick={onRetry}>Retry</button>
|
|
352
|
-
<button className="jm-btn ghost" onClick={onDrop}>Drop</button>
|
|
400
|
+
<button className="jm-btn primary" data-jam-run-act="retry" onClick={onRetry}>Retry</button>
|
|
401
|
+
<button className="jm-btn ghost" data-jam-run-act="drop" onClick={onDrop}>Drop</button>
|
|
353
402
|
</div>
|
|
354
403
|
)}
|
|
355
404
|
{review && <div className="rule" />}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where Jam's surfaces stand in the shell (spec 27): the one focus panel (a capture's detail, a
|
|
3
|
-
* review, a wrap-up), the lane's selection and its keyboard (`Q`), the review's picture view.
|
|
3
|
+
* review, a wrap-up, a thread), the lane's selection and its keyboard (`Q`), the review's picture view.
|
|
4
4
|
*/
|
|
5
5
|
import { create } from 'zustand'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/** The focus panel. `thread` (spec 28 A4.6 #30, r1 #3): a thread no frame on its board can show - frameless, its
|
|
8
|
+
* frame gone, resolved - opened where it can be read and answered; `id` is the thread's, on `board`. */
|
|
9
|
+
export type Panel = { kind: 'capture' | 'review' | 'wrapup'; id: string } | { kind: 'thread'; id: string; board: string } | null
|
|
8
10
|
|
|
9
11
|
interface JamUi {
|
|
10
12
|
panel: Panel
|
|
@@ -36,13 +38,22 @@ interface JamUi {
|
|
|
36
38
|
setTab(i: number): void
|
|
37
39
|
setMoreOpen(on: boolean): void
|
|
38
40
|
follow(): void
|
|
41
|
+
/** a card's status icon asked to open its popover once (A4.6 #30): the first `TagStatus` drawing that card takes it */
|
|
42
|
+
statusFor: { card: string; n: number } | null
|
|
43
|
+
askStatus(card: string | null): void
|
|
44
|
+
/** the status icon of the request `n` opened: it is taken */
|
|
45
|
+
tookStatus(n: number): void
|
|
39
46
|
}
|
|
40
47
|
|
|
48
|
+
let asked = 0
|
|
41
49
|
export const useJamUi = create<JamUi>((set, get) => ({
|
|
42
|
-
panel: null, selected: null, laneKeys: false, view: 'both', tab: 0, moreOpen: false, followEnd: 0, sheet: null, doneOpen: false,
|
|
50
|
+
panel: null, selected: null, laneKeys: false, view: 'both', tab: 0, moreOpen: false, followEnd: 0, sheet: null, doneOpen: false, statusFor: null,
|
|
51
|
+
askStatus(card) { set({ statusFor: card ? { card, n: ++asked } : null }) },
|
|
52
|
+
tookStatus(n) { if (get().statusFor?.n === n) set({ statusFor: null }) },
|
|
43
53
|
setSheet(s) { set({ sheet: s }) },
|
|
44
54
|
// the next card opens on Both, its first frame
|
|
45
|
-
|
|
55
|
+
// a thread panel names a thread, never a tile: the lane's selection stays
|
|
56
|
+
open(panel) { set({ panel, selected: panel && panel.kind !== 'thread' ? panel.id : get().selected, view: 'both', tab: 0, moreOpen: false }) },
|
|
46
57
|
close() { set({ panel: null, moreOpen: false }) },
|
|
47
58
|
setLaneKeys(on) { set({ laneKeys: on }) },
|
|
48
59
|
// folding: a done tile that was selected hands its selection to the group
|
|
@@ -76,6 +87,10 @@ export function letGoOfTile() {
|
|
|
76
87
|
useJamUi.setState({ panel: null, moreOpen: false, selected: null, laneKeys: false })
|
|
77
88
|
}
|
|
78
89
|
|
|
90
|
+
/** What JamSurface lends the helpers that open things (jam-keys.ts): a tile's menu opened at the tile, as a right-click
|
|
91
|
+
* opens it (spec 28 A4.6 #30) - false when the tile is not drawn. */
|
|
92
|
+
export const jamSurface = { tileMenu: (_id: string): boolean => false }
|
|
93
|
+
|
|
79
94
|
if (typeof window !== 'undefined' && (import.meta as any).env?.DEV) (window as any).__mvJamUi = useJamUi
|
|
80
95
|
|
|
81
96
|
// ---- the Done fold (0.26.1): two or more done tiles fold into one, at the lane's left end ------------------
|
|
@@ -67,15 +67,18 @@ export function FocusPanelView(p: {
|
|
|
67
67
|
onPrev?: () => void; onNext?: () => void; pending?: string; onRetry?: () => void; locked?: boolean
|
|
68
68
|
/** a note added in the read-back (a draft) */
|
|
69
69
|
onAddNote?(text: string, id: string): Promise<boolean>
|
|
70
|
+
/** a card that asks, opened here (its thread cannot show on this board): its question and your answer */
|
|
71
|
+
asks?: { question: string; onAnswer(text: string): Promise<boolean> }
|
|
70
72
|
}) {
|
|
71
73
|
const c = p.card
|
|
72
74
|
const title = c.title ?? 'Capture'
|
|
73
75
|
// a capture under review: its review, or the capture itself as it was read back (its pictures, its timeline)
|
|
74
76
|
const [pane, setPane] = useState<'review' | 'capture'>('review')
|
|
75
77
|
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)
|
|
78
|
+
// the review asks for the width its pictures need (both at once, as big as the panel's height allows) - each card's
|
|
79
|
+
// review (keyed by it) asks as it mounts, before it paints: a reset here after that would undo a width its preloaded
|
|
80
|
+
// pictures gave it, and the panel would open narrow, then grow
|
|
77
81
|
const [fit, setFit] = useState<number | undefined>(undefined)
|
|
78
|
-
useEffect(() => { setFit(undefined) }, [c.id])
|
|
79
82
|
const head = p.kind === 'review' ? (
|
|
80
83
|
<div className="jm-ftabs jm-panes" role="tablist" data-jam-panes="">
|
|
81
84
|
{(['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>)}
|
|
@@ -99,7 +102,7 @@ export function FocusPanelView(p: {
|
|
|
99
102
|
readOnly={c.state !== 'draft'} locked={p.locked} agent={p.agent}
|
|
100
103
|
follows={c.reviewing ? p.reviewedTitle ?? 'the review on screen' : undefined}
|
|
101
104
|
onEdit={p.onEdit} onConfirm={p.onConfirm} onKeep={p.onKeep} onDrop={p.onDrop} onResume={c.state === 'draft' ? p.onResume : undefined} onOpenThread={c.thread ? p.onOpenThread : undefined}
|
|
102
|
-
onRetry={c.state === 'failed' ? p.onRetry : undefined} />
|
|
105
|
+
onRetry={c.state === 'failed' ? p.onRetry : undefined} asks={c.state === 'asks' ? p.asks : undefined} />
|
|
103
106
|
)}
|
|
104
107
|
</FocusPanel>
|
|
105
108
|
)
|
|
@@ -11,6 +11,7 @@ import { useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode } f
|
|
|
11
11
|
import { Tip } from './Tip.tsx'
|
|
12
12
|
import { cardForEvent, useJamQueue, type JamCardState } from './jam-queue.ts'
|
|
13
13
|
import { statusLines } from './jam-lines.ts'
|
|
14
|
+
import { useJamUi } from './jam-state.ts'
|
|
14
15
|
|
|
15
16
|
const GRAY = 'var(--glass-ink-3)'
|
|
16
17
|
const RED = '#e5484d' // board-icons.tsx RED - errors and failures only
|
|
@@ -71,6 +72,9 @@ export function TagStatus({ board, eventId, harness }: { board?: string; eventId
|
|
|
71
72
|
return () => window.removeEventListener('pointerdown', away, true)
|
|
72
73
|
}, [open])
|
|
73
74
|
useEffect(() => { if (!card) setOpen(false) }, [card])
|
|
75
|
+
// asked to open once (a notice's click, A4.6 #30): this card's icon, wherever it is drawn first - its run's controls on the page
|
|
76
|
+
const asked = useJamUi((s) => (card && s.statusFor?.card === card.id ? s.statusFor.n : 0))
|
|
77
|
+
useEffect(() => { if (asked) { setOpen(true); useJamUi.getState().tookStatus(asked) } }, [asked])
|
|
74
78
|
// the open detail stays on screen: it sits under the icon and slides left at the viewport's edge
|
|
75
79
|
const popRef = useRef<HTMLSpanElement>(null)
|
|
76
80
|
useLayoutEffect(() => {
|
|
@@ -83,6 +87,8 @@ export function TagStatus({ board, eventId, harness }: { board?: string; eventId
|
|
|
83
87
|
if (!card) return null
|
|
84
88
|
const { head, detail } = statusLines(card, agent, harness)
|
|
85
89
|
const move = card.state === 'queued' ? 'drop' : card.state === 'failed' ? 'retry' : null
|
|
90
|
+
// a run your session went quiet on (spec 29b): the owner's three choices, by the run and its generation
|
|
91
|
+
const stalled = card.state === 'working' && card.runner?.kind === 'session' && card.runner.state === 'stalled'
|
|
86
92
|
const lines = <span className="sh-tip-lines"><b>{head}</b>{detail && <small>{detail}</small>}</span>
|
|
87
93
|
return (
|
|
88
94
|
<span className={`cm-tstat${open ? ' on' : ''}`} ref={ref} data-jam-card={card.id} data-jam-state={card.state}>
|
|
@@ -94,9 +100,12 @@ export function TagStatus({ board, eventId, harness }: { board?: string; eventId
|
|
|
94
100
|
</Tip>
|
|
95
101
|
)}
|
|
96
102
|
{open && (
|
|
97
|
-
<span className=
|
|
103
|
+
<span className={`cm-tstat-pop${stalled ? ' many' : ''}`} role="dialog" aria-label={head} ref={popRef}>
|
|
98
104
|
{lines}
|
|
99
105
|
{move && <button className="cm-tstat-act" onClick={() => { void useJamQueue.getState().act(card, move); setOpen(false) }}>{move === 'drop' ? 'Drop' : 'Retry'}</button>}
|
|
106
|
+
{stalled && ([['again', 'Give it back'], ['background', 'Run in the background'], ['drop', 'Drop it']] as const).map(([a, label]) => (
|
|
107
|
+
<button key={a} className="cm-tstat-act" data-jam-run-act={a} onClick={() => { void useJamQueue.getState().runAct(card, a); setOpen(false) }}>{label}</button>
|
|
108
|
+
))}
|
|
100
109
|
</span>
|
|
101
110
|
)}
|
|
102
111
|
</span>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a capture's words are whole, and how long its last words are waited for (jam-voice.ts) - pure, so a test
|
|
3
|
+
* holds them to it.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** A segment's last words are waited for this long after it is cut - and as long again after the speech engine was
|
|
7
|
+
* last heard from (words or a final, for any segment: it is working through what it was given - a cold start of its
|
|
8
|
+
* process, a long last phrase, other phrases ahead of it) - never past FINAL_MAX. Past it the capture seals without
|
|
9
|
+
* them, and a capture stopped with E goes straight on (27 Oct: one reached the agent with no words; the wait was a
|
|
10
|
+
* flat 3 s). A lost engine or connection answers at once, never this late. */
|
|
11
|
+
export const FINAL_MS = 15_000
|
|
12
|
+
export const FINAL_MAX = 60_000
|
|
13
|
+
|
|
14
|
+
/** How much longer to wait for a final, cut at `cut`, with the engine last heard at `heard` (ms; <= 0: stop waiting). */
|
|
15
|
+
export const finalWait = (cut: number, heard: number, now: number): number => Math.min(Math.max(cut, heard) + FINAL_MS, cut + FINAL_MAX) - now
|
|
16
|
+
|
|
17
|
+
/** A capture's words are whole when every segment cut for it came back final and none was lost - and, when you said
|
|
18
|
+
* yes to the microphone, when it had one at all: the engine not available, the microphone still opening (or refused)
|
|
19
|
+
* hears nothing, and those words are missing, not complete. */
|
|
20
|
+
export const wordsWhole = (finals: boolean[], lost: boolean, expected: boolean): boolean =>
|
|
21
|
+
(finals.length > 0 || !expected) && finals.every(Boolean) && !lost
|