@marver-design/marver 0.29.0 → 0.30.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 +44 -0
- package/README.md +2 -1
- package/dist/{anchor-check-DhlpKl2K.mjs → anchor-check-c52IDkiQ.mjs} +1 -1
- package/dist/{build-CWbrb2bl.mjs → build-C3mUtjEn.mjs} +5 -4
- package/dist/cli.mjs +5 -5
- package/dist/{daemon-Sc_z8gT6.mjs → daemon-B0Wi1OQ3.mjs} +5 -3
- package/dist/{dev-DWBKQhxf.mjs → dev-5dlxoW28.mjs} +8 -8
- package/dist/{perf-Denssrko.mjs → perf-6MOTHxay.mjs} +710 -99
- package/dist/perf-BCxAo0IS.mjs +1743 -0
- package/dist/{plugin-DqoZB-D6.mjs → plugin-CXRoMA8g.mjs} +898 -539
- package/dist/{poster-CrsjqhY4.mjs → poster-CYmCa00B.mjs} +1 -1
- package/dist/{publish-bakes-DW-NDgU2.mjs → publish-bakes-C_2ZtHou.mjs} +2 -2
- package/dist/{recover-GtJ9UDAB.mjs → recover-XD8iXJOj.mjs} +1 -1
- package/dist/{shot-T04Ixrvq.mjs → shot-CRRGgxru.mjs} +3 -3
- package/docs/app.md +194 -0
- package/docs/performance.md +98 -18
- package/package.json +1 -1
- package/src/client/frame-host/bridge.js +17 -8
- package/src/client/frame-host/inplace.ts +124 -0
- package/src/client/frame-host/inspect.d.ts +1 -0
- package/src/client/frame-host/inspect.js +13 -4
- package/src/client/frame-host/main.tsx +12 -3
- package/src/client/frame-host/messages.ts +85 -0
- package/src/client/frame-host/signals.d.ts +15 -0
- package/src/client/frame-host/signals.js +219 -0
- package/src/client/recorder-level.ts +41 -0
- package/src/client/shell/App.tsx +158 -88
- package/src/client/shell/BoardList.tsx +103 -48
- package/src/client/shell/Comments.tsx +66 -42
- package/src/client/shell/ContextMenu.tsx +3 -2
- package/src/client/shell/JamSurface.tsx +116 -71
- package/src/client/shell/LockedApp.tsx +19 -3
- package/src/client/shell/Play.tsx +94 -58
- package/src/client/shell/StatusPicker.tsx +19 -9
- package/src/client/shell/Toolbar.tsx +15 -7
- package/src/client/shell/api.ts +18 -4
- package/src/client/shell/app-bridge.ts +12 -6
- package/src/client/shell/app-perf.ts +31 -1
- package/src/client/shell/canvas/Canvas.tsx +17 -6
- package/src/client/shell/canvas/FrameNode.tsx +25 -12
- package/src/client/shell/canvas/Sticky.tsx +4 -2
- package/src/client/shell/canvas/ctl.ts +2 -0
- package/src/client/shell/canvas/ready-watch.ts +4 -0
- package/src/client/shell/canvas/sleep.ts +2 -0
- package/src/client/shell/canvas/updates.ts +13 -6
- package/src/client/shell/commands.ts +765 -0
- package/src/client/shell/comments-store.ts +42 -27
- package/src/client/shell/goto.ts +11 -6
- package/src/client/shell/jam-keys.ts +141 -75
- package/src/client/shell/jam-lane.tsx +19 -12
- package/src/client/shell/jam-panel.tsx +61 -48
- package/src/client/shell/jam-session.tsx +41 -37
- package/src/client/shell/jam-state.ts +9 -1
- package/src/client/shell/jam-surface-parts.tsx +8 -6
- package/src/client/shell/jam-ui.tsx +9 -6
- package/src/client/shell/jam-voice.ts +4 -2
- package/src/client/shell/main.tsx +7 -1
- package/src/client/shell/marks-ui.tsx +11 -0
- package/src/client/shell/perf.ts +51 -5
- package/src/client/shell/recorder-core.ts +4 -1
- package/src/client/shell/recorder-hmr.ts +36 -0
- package/src/client/shell/recorder-reloads.ts +264 -0
- package/src/client/shell/recorder-seams.ts +116 -0
- package/src/client/shell/recorder-self.ts +73 -0
- package/src/client/shell/recorder-signals-core.ts +139 -0
- package/src/client/shell/recorder-signals.ts +485 -0
- package/src/client/shell/recorder.ts +115 -41
- package/src/client/shell/store.ts +56 -22
- package/src/client/shell/whiteout-probes.ts +3 -1
- package/src/client/stage/main.tsx +10 -5
- package/src/shared/app-api.ts +28 -6
- package/src/shared/app-perf.ts +99 -6
- package/src/shared/app-report.ts +586 -0
- package/src/shared/perf-records.ts +445 -0
- package/src/shared/perf-run.ts +6 -2
- package/dist/perf-jam-CLkERSHo.mjs +0 -642
|
@@ -7,18 +7,22 @@
|
|
|
7
7
|
* glyph; the selected tile alone wears the accent ring. Every tile is one width - selecting one never
|
|
8
8
|
* resizes it; a title cut short shows whole in a tooltip, and a right-click opens the tile's menu.
|
|
9
9
|
*
|
|
10
|
-
* Presentational only - the shell decides what is on it (jam-capture.ts and App mount it).
|
|
10
|
+
* Presentational only - the shell decides what is on it (jam-capture.ts and App mount it). A tile's button names its
|
|
11
|
+
* command here (spec 30); what the shell does with it ends it, from the handle it is handed.
|
|
11
12
|
*/
|
|
12
13
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
13
14
|
import { JamStateIcon, type JamGlyph } from './jam-ui.tsx'
|
|
14
15
|
import { Tip } from './Tip.tsx'
|
|
15
16
|
import { DONE_CLOSE, DONE_GROUP, doneFold, doneLine } from './jam-state.ts'
|
|
17
|
+
import { cmd, endAfterFrames, type CmdHandle, type CmdOpts } from './commands.ts'
|
|
16
18
|
import { ArrowsInLineHorizontalIcon, CursorClickIcon, FileCodeIcon, ImagesSquareIcon, LaserIcon, MicrophoneIcon, MicrophoneSlashIcon, PauseIcon, PencilSimpleIcon } from './icons.tsx'
|
|
17
19
|
|
|
18
20
|
/** The lane's height with its air: the 44 px tile + 12 px. While the lane shows, the sidebar stops
|
|
19
21
|
* above it and everything else on the bottom edge (the Update pill, toasts, notices) rises this much. */
|
|
20
22
|
export const LANE_H = 56
|
|
21
23
|
|
|
24
|
+
const CLICK: CmdOpts = { via: 'click', in: 'shell' }
|
|
25
|
+
|
|
22
26
|
export interface LaneTile {
|
|
23
27
|
id: string
|
|
24
28
|
state: JamGlyph
|
|
@@ -55,7 +59,8 @@ export interface LaneRecording {
|
|
|
55
59
|
finishing?: boolean
|
|
56
60
|
/** the microphone: hearing you (`on`), or not (`off` - a click asks again); none when never asked */
|
|
57
61
|
mic?: 'on' | 'off'
|
|
58
|
-
|
|
62
|
+
/** a click asks again, once you were asked: it ends the handle when the voice state changed */
|
|
63
|
+
onMic?(h: CmdHandle): void
|
|
59
64
|
onNote(): void
|
|
60
65
|
onStop(): void
|
|
61
66
|
onStopReview(): void
|
|
@@ -92,7 +97,8 @@ export interface LaneBetween {
|
|
|
92
97
|
since: number
|
|
93
98
|
/** the microphone hears the session's talk */
|
|
94
99
|
mic: boolean
|
|
95
|
-
|
|
100
|
+
/** ends the handle: a capture recording, or refused */
|
|
101
|
+
onCapture(h: CmdHandle): void
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
export function Lane({ tiles, recording, between, selected, keyboard, onOpen, onMenu, followEnd, doneOpen = false, onDoneOpen }: {
|
|
@@ -105,7 +111,8 @@ export function Lane({ tiles, recording, between, selected, keyboard, onOpen, on
|
|
|
105
111
|
between?: LaneBetween
|
|
106
112
|
selected?: string
|
|
107
113
|
keyboard?: boolean
|
|
108
|
-
|
|
114
|
+
/** ends the handle once the tile's surface is drawn, or it could not be */
|
|
115
|
+
onOpen(id: string, h: CmdHandle): void
|
|
109
116
|
/** a right-click on a tile: its menu */
|
|
110
117
|
onMenu?(e: React.MouseEvent, id: string): void
|
|
111
118
|
followEnd?: unknown
|
|
@@ -170,7 +177,7 @@ export function Lane({ tiles, recording, between, selected, keyboard, onOpen, on
|
|
|
170
177
|
{fold && !doneOpen && (
|
|
171
178
|
<button key={DONE_GROUP} data-tile={DONE_GROUP} data-state="done" data-jam-done="folded"
|
|
172
179
|
className={`jm-card done group${selected === DONE_GROUP ? ' focus' : ''}`}
|
|
173
|
-
onClick={() => onDoneOpen?.(true, done.map((t) => t.id))}>
|
|
180
|
+
onClick={() => { cmd('jam-done-fold', { ...CLICK, arg: 'open' }); onDoneOpen?.(true, done.map((t) => t.id)) }}>
|
|
174
181
|
<JamStateIcon state="done" />
|
|
175
182
|
<span className="tx">
|
|
176
183
|
<span className="t">Done</span>
|
|
@@ -181,14 +188,14 @@ export function Lane({ tiles, recording, between, selected, keyboard, onOpen, on
|
|
|
181
188
|
{fold && doneOpen && (
|
|
182
189
|
<button key={DONE_CLOSE} data-tile={DONE_CLOSE} data-jam-done="open" aria-label="Fold the done captures"
|
|
183
190
|
className={`jm-card close${selected === DONE_CLOSE ? ' focus' : ''}`}
|
|
184
|
-
onClick={() => onDoneOpen?.(false, done.map((t) => t.id))}>
|
|
191
|
+
onClick={() => { cmd('jam-done-fold', { ...CLICK, arg: 'fold' }); onDoneOpen?.(false, done.map((t) => t.id)) }}>
|
|
185
192
|
<ArrowsInLineHorizontalIcon size={15} /><span className="t">Done</span>
|
|
186
193
|
</button>
|
|
187
194
|
)}
|
|
188
195
|
{shown.map((t) => (
|
|
189
196
|
<button key={t.id} data-tile={t.id} data-state={t.state}
|
|
190
197
|
className={`jm-card ${t.state}${selected === t.id ? ' focus' : ''}${fold && t.state === 'done' ? ' unfold' : ''}`}
|
|
191
|
-
onClick={() => onOpen(t.id)} onContextMenu={onMenu ? (e) => onMenu(e, t.id) : undefined}>
|
|
198
|
+
onClick={() => onOpen(t.id, cmd('jam-open', CLICK))} onContextMenu={onMenu ? (e) => onMenu(e, t.id) : undefined}>
|
|
192
199
|
<JamStateIcon state={t.state} />
|
|
193
200
|
<span className="tx">
|
|
194
201
|
{/* the whole title, in the shell's own tooltip - only when the tile cuts it short */}
|
|
@@ -215,7 +222,7 @@ export function BetweenTile({ since, mic, onCapture }: LaneBetween) {
|
|
|
215
222
|
<span className="stats">{mic ? <><MicrophoneIcon size={12} />Listening between captures</> : <><MicrophoneSlashIcon size={12} />Between captures</>}</span>
|
|
216
223
|
</span>
|
|
217
224
|
<i className="sep" />
|
|
218
|
-
<button className="go" onClick={onCapture}>Capture<kbd>S</kbd></button>
|
|
225
|
+
<button className="go" onClick={() => onCapture(cmd('jam-capture', CLICK))}>Capture<kbd>S</kbd></button>
|
|
219
226
|
</div>
|
|
220
227
|
)
|
|
221
228
|
}
|
|
@@ -229,7 +236,7 @@ export function CaptureTile({ time, points, pictures = 0, picturesMax, steps, co
|
|
|
229
236
|
{finishing ? <JamStateIcon state="confirming" /> : <i className="jm-live-dot" />}
|
|
230
237
|
{mic && !finishing && (
|
|
231
238
|
<Tip label={mic === 'on' ? 'Hearing you - words on this Mac' : 'Microphone off - click to use it'}>
|
|
232
|
-
<button className={`mic${mic === 'off' ? ' off' : ''}`} data-jam-mic={mic} onClick={onMic} aria-label={mic === 'on' ? 'Microphone on' : 'Microphone off'}>
|
|
239
|
+
<button className={`mic${mic === 'off' ? ' off' : ''}`} data-jam-mic={mic} onClick={() => { const h = cmd('jam-mic', CLICK); if (onMic) onMic(h); else h.noop('on') }} aria-label={mic === 'on' ? 'Microphone on' : 'Microphone off'}>
|
|
233
240
|
{mic === 'on' ? <MicrophoneIcon size={13} /> : <MicrophoneSlashIcon size={13} />}
|
|
234
241
|
</button>
|
|
235
242
|
</Tip>
|
|
@@ -244,14 +251,14 @@ export function CaptureTile({ time, points, pictures = 0, picturesMax, steps, co
|
|
|
244
251
|
</span>
|
|
245
252
|
</span>
|
|
246
253
|
<i className="sep" />
|
|
247
|
-
<button className={`notebtn${noteOn ? ' on' : ''}`} onClick={onNote} disabled={finishing} aria-pressed={noteOn}>
|
|
254
|
+
<button className={`notebtn${noteOn ? ' on' : ''}`} onClick={() => { const h = cmd('jam-notes', CLICK); onNote(); endAfterFrames(h) }} disabled={finishing} aria-pressed={noteOn}>
|
|
248
255
|
<PencilSimpleIcon size={13} />Note{notes ? <b>{notes}</b> : null}<kbd>N</kbd>
|
|
249
256
|
</button>
|
|
250
257
|
<Tip label="Stop and queue it - the agent starts on it">
|
|
251
|
-
<button className="stop" onClick={onStop} disabled={finishing}>Stop<kbd>E</kbd></button>
|
|
258
|
+
<button className="stop" onClick={() => { const h = cmd('jam-end', CLICK); onStop(); endAfterFrames(h) }} disabled={finishing}>Stop<kbd>E</kbd></button>
|
|
252
259
|
</Tip>
|
|
253
260
|
<Tip label="Stop and look it over first - add notes, then queue it">
|
|
254
|
-
<button className="stop review" onClick={onStopReview} disabled={finishing}><PauseIcon size={12} />Stop to review<kbd>⇧E</kbd></button>
|
|
261
|
+
<button className="stop review" onClick={() => { const h = cmd('jam-end-review', CLICK); onStopReview(); endAfterFrames(h) }} disabled={finishing}><PauseIcon size={12} />Stop to review<kbd>⇧E</kbd></button>
|
|
255
262
|
</Tip>
|
|
256
263
|
</div>
|
|
257
264
|
)
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* capture's marks on the canvas (the teal edge ring, numbered points).
|
|
5
5
|
*
|
|
6
6
|
* Presentational only: every component takes what it shows and calls back what was chosen. The shell
|
|
7
|
-
* (jam-capture.ts, App) owns state, keys and the API.
|
|
7
|
+
* (jam-capture.ts, App) owns state, keys and the API. A button names its command here (spec 30) and hands the handle to
|
|
8
|
+
* the callback, whose work ends it. Never a note's, an answer's or a read-back's words in a command.
|
|
8
9
|
*/
|
|
9
10
|
import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react'
|
|
10
11
|
import { JamStateIcon } from './jam-ui.tsx'
|
|
@@ -20,6 +21,10 @@ import { Tip } from './Tip.tsx'
|
|
|
20
21
|
import { useJamQueue } from './jam-queue.ts'
|
|
21
22
|
import { holdsReload } from './api.ts'
|
|
22
23
|
import { unsavedWhen, workChanged } from './unsaved.ts'
|
|
24
|
+
import { endOnOk } from './jam-state.ts'
|
|
25
|
+
import { cmd, endAfterFrames, keysOf, type CmdHandle, type CmdOpts } from './commands.ts'
|
|
26
|
+
|
|
27
|
+
const CLICK: CmdOpts = { via: 'click', in: 'shell' }
|
|
23
28
|
|
|
24
29
|
/** A heading cut short by its ellipsis: its tooltip shows it whole (one that fits shows none). */
|
|
25
30
|
const cutShort = (el: HTMLElement) => el.scrollWidth > el.clientWidth + 1
|
|
@@ -47,7 +52,7 @@ export function FocusPanel({ children, left, width = 580, onClose }: { children:
|
|
|
47
52
|
return (
|
|
48
53
|
<div className="jm-focus" data-jam-focus="" style={{ left, width: w, bottom: `calc(var(--edge) + ${LANE_H + 2}px)` }}>
|
|
49
54
|
{children}
|
|
50
|
-
{onClose && <button className="jm-iconbtn jm-focus-x" aria-label="Close" onClick={onClose}><XIcon size={13} /></button>}
|
|
55
|
+
{onClose && <button className="jm-iconbtn jm-focus-x" aria-label="Close" onClick={() => { cmd('jam-close', CLICK); onClose() }}><XIcon size={13} /></button>}
|
|
51
56
|
</div>
|
|
52
57
|
)
|
|
53
58
|
}
|
|
@@ -111,11 +116,12 @@ function AddedNotes({ added, onAdd }: { added: { at: number; text: string }[]; o
|
|
|
111
116
|
const [busy, setBusy] = useState(false)
|
|
112
117
|
// the note in the field: one id until it saves (a failed one sent again is the same note)
|
|
113
118
|
const nid = useRef(newNoteId())
|
|
114
|
-
const add = async () => {
|
|
119
|
+
const add = async (o: CmdOpts) => {
|
|
115
120
|
const t = text.trim()
|
|
116
121
|
if (!t || busy || !onAdd) return
|
|
122
|
+
const h = cmd('jam-note-add', o)
|
|
117
123
|
setBusy(true)
|
|
118
|
-
const ok = await onAdd(t, nid.current)
|
|
124
|
+
const ok = await endOnOk(h, onAdd(t, nid.current))
|
|
119
125
|
setBusy(false)
|
|
120
126
|
if (ok) { setText(''); nid.current = newNoteId() }
|
|
121
127
|
}
|
|
@@ -136,10 +142,10 @@ function AddedNotes({ added, onAdd }: { added: { at: number; text: string }[]; o
|
|
|
136
142
|
onKeyDown={(e) => {
|
|
137
143
|
e.stopPropagation()
|
|
138
144
|
if ((e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) return
|
|
139
|
-
if (e.key === 'Enter') { e.preventDefault(); void add() }
|
|
140
|
-
else if (e.key === 'Escape') { e.preventDefault(); setText(''); (e.target as HTMLInputElement).blur() }
|
|
145
|
+
if (e.key === 'Enter') { e.preventDefault(); void add({ via: 'key', in: 'shell', keys: keysOf(e) }) }
|
|
146
|
+
else if (e.key === 'Escape') { e.preventDefault(); cmd('jam-field-discard', { via: 'key', in: 'shell', keys: keysOf(e), arg: 'note' }); setText(''); (e.target as HTMLInputElement).blur() }
|
|
141
147
|
}} />
|
|
142
|
-
<button className="jm-btn" disabled={!text.trim() || busy} onClick={() => void add()}>Add note</button>
|
|
148
|
+
<button className="jm-btn" disabled={!text.trim() || busy} onClick={() => void add(CLICK)}>Add note</button>
|
|
143
149
|
</div>
|
|
144
150
|
)}
|
|
145
151
|
</div>
|
|
@@ -180,8 +186,8 @@ export function Shot({ url, cap, alt, onSize }: { url?: string; cap?: ReactNode;
|
|
|
180
186
|
const Walk = ({ of, onPrev, onNext }: { of?: [number, number]; onPrev?: () => void; onNext?: () => void }) => of ? (
|
|
181
187
|
<>
|
|
182
188
|
<span className="dim">{of[0]} of {of[1]}</span>
|
|
183
|
-
<button className="jm-iconbtn" disabled={of[0] <= 1 || !onPrev} onClick={onPrev} aria-label="Previous"><ArrowLeftIcon size={13} /></button>
|
|
184
|
-
<button className="jm-iconbtn" disabled={of[0] >= of[1] || !onNext} onClick={onNext} aria-label="Next"><ArrowRightIcon size={13} /></button>
|
|
189
|
+
<button className="jm-iconbtn" disabled={of[0] <= 1 || !onPrev} onClick={() => { cmd('jam-step', { ...CLICK, arg: 'prev' }); onPrev?.() }} aria-label="Previous"><ArrowLeftIcon size={13} /></button>
|
|
190
|
+
<button className="jm-iconbtn" disabled={of[0] >= of[1] || !onNext} onClick={() => { cmd('jam-step', { ...CLICK, arg: 'next' }); onNext?.() }} aria-label="Next"><ArrowRightIcon size={13} /></button>
|
|
185
191
|
</>
|
|
186
192
|
) : null
|
|
187
193
|
|
|
@@ -217,20 +223,20 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
217
223
|
/** words written that have not saved yet - they win over `edited` */
|
|
218
224
|
pending?: string
|
|
219
225
|
/** a failed capture: its Retry (with Drop beside it) in the read-only footer */
|
|
220
|
-
onRetry?: () => void
|
|
226
|
+
onRetry?: (h: CmdHandle) => void
|
|
221
227
|
editing?: boolean
|
|
222
|
-
onEdit?: (text: string) => void
|
|
223
|
-
onConfirm?: () => void
|
|
224
|
-
onKeep?: () => void
|
|
225
|
-
onDrop?: () => void
|
|
228
|
+
onEdit?: (text: string, h: CmdHandle) => void
|
|
229
|
+
onConfirm?: (h: CmdHandle) => void
|
|
230
|
+
onKeep?: (h: CmdHandle) => void
|
|
231
|
+
onDrop?: (h: CmdHandle) => void
|
|
226
232
|
/** ended too soon: recording goes on where it stopped (R) */
|
|
227
|
-
onResume?: () => void
|
|
233
|
+
onResume?: (h: CmdHandle) => void
|
|
228
234
|
agent?: string | null
|
|
229
235
|
follows?: string
|
|
230
236
|
readOnly?: boolean
|
|
231
237
|
/** the words cannot be edited for now (its Resume is starting) - the rest stays as it is */
|
|
232
238
|
locked?: boolean
|
|
233
|
-
onOpenThread?: () => void
|
|
239
|
+
onOpenThread?: (h: CmdHandle) => void
|
|
234
240
|
/** notes written here after it ended - under a divider, as the timeline shows its own */
|
|
235
241
|
added?: { at: number; text: string }[]
|
|
236
242
|
/** the title came from Claude Haiku (jam.names): its tooltip says so, and where the words went */
|
|
@@ -259,7 +265,8 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
259
265
|
const lastSent = useRef<string | undefined>(undefined)
|
|
260
266
|
const save = () => {
|
|
261
267
|
setOpen(false)
|
|
262
|
-
|
|
268
|
+
// blur: its words save (`jam-edit`), whatever took the focus
|
|
269
|
+
if (text !== (lastSent.current ?? pending ?? edited ?? words)) { lastSent.current = text; onEdit?.(text, cmd('jam-edit', CLICK)) }
|
|
263
270
|
}
|
|
264
271
|
// once the saved edit is what was last sent, the intent is settled
|
|
265
272
|
useEffect(() => { if (lastSent.current !== undefined && edited === lastSent.current && pending === undefined) lastSent.current = undefined }, [edited, pending])
|
|
@@ -281,7 +288,7 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
281
288
|
{open && !readOnly && !locked ? (
|
|
282
289
|
<textarea ref={field} className="jm-edit" value={text} rows={Math.min(10, Math.max(3, Math.ceil(text.length / 60)))}
|
|
283
290
|
onChange={(e) => setText(e.target.value)} onBlur={save}
|
|
284
|
-
onKeyDown={(e) => { e.stopPropagation(); if (e.key === 'Escape') { setText(edited ?? words); setOpen(false) } }} />
|
|
291
|
+
onKeyDown={(e) => { e.stopPropagation(); if (e.key === 'Escape') { cmd('jam-field-discard', { via: 'key', in: 'shell', keys: keysOf(e), arg: 'words' }); setText(edited ?? words); setOpen(false) } }} />
|
|
285
292
|
) : (
|
|
286
293
|
<div className={readOnly || locked ? undefined : 'jm-editable'} title={readOnly || locked ? undefined : 'Click to edit the words'} onClick={readOnly || locked ? undefined : () => setOpen(true)}>
|
|
287
294
|
{edited !== undefined && !readOnly && <div className="jm-edited"><PencilSimpleIcon size={12} />Your edit</div>}
|
|
@@ -293,16 +300,16 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
293
300
|
<div className="rule" />
|
|
294
301
|
<div className="actions">
|
|
295
302
|
{readOnly ? (
|
|
296
|
-
<><span className="sp" />{onOpenThread && <button className="jm-btn" onClick={onOpenThread}>Open thread</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></>}</>
|
|
303
|
+
<><span className="sp" />{onOpenThread && <button className="jm-btn" onClick={() => onOpenThread(cmd('jam-thread', CLICK))}>Open thread</button>}
|
|
304
|
+
{onRetry && <><button className="jm-btn ghost" data-jam-run-act="drop" onClick={() => onDrop?.(cmd('jam-drop', CLICK))}>Drop</button><button className="jm-btn primary" data-jam-run-act="retry" onClick={() => onRetry(cmd('jam-retry', CLICK))}>Retry</button></>}</>
|
|
298
305
|
) : (
|
|
299
306
|
<>
|
|
300
307
|
<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>
|
|
301
308
|
<span className="sp" />
|
|
302
|
-
{onResume && <button className="jm-btn ghost" onClick={onResume}>Resume <kbd>R</kbd></button>}
|
|
303
|
-
<button className="jm-btn ghost" onClick={onDrop}>Drop <kbd>esc</kbd></button>
|
|
304
|
-
<button className="jm-btn ghost" onClick={onKeep}>Keep <kbd>K</kbd></button>
|
|
305
|
-
<button className="jm-btn primary" onClick={onConfirm}>Add to queue <kbd>⏎</kbd></button>
|
|
309
|
+
{onResume && <button className="jm-btn ghost" onClick={() => onResume(cmd('jam-resume', CLICK))}>Resume <kbd>R</kbd></button>}
|
|
310
|
+
<button className="jm-btn ghost" onClick={() => onDrop?.(cmd('jam-drop', CLICK))}>Drop <kbd>esc</kbd></button>
|
|
311
|
+
<button className="jm-btn ghost" onClick={() => onKeep?.(cmd('jam-keep', CLICK))}>Keep <kbd>K</kbd></button>
|
|
312
|
+
<button className="jm-btn primary" onClick={() => onConfirm?.(cmd('jam-confirm', CLICK))}>Add to queue <kbd>⏎</kbd></button>
|
|
306
313
|
</>
|
|
307
314
|
)}
|
|
308
315
|
</div>
|
|
@@ -317,10 +324,11 @@ export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, picture
|
|
|
317
324
|
export function AsksAnswer({ question, onAnswer, tag = true }: { question?: string; onAnswer(text: string): Promise<boolean>; tag?: boolean }) {
|
|
318
325
|
const [text, setText] = useState('')
|
|
319
326
|
const [sending, setSending] = useState(false)
|
|
320
|
-
const send = () => {
|
|
327
|
+
const send = (o: CmdOpts) => {
|
|
321
328
|
if (!text.trim() || sending) return
|
|
329
|
+
const h = cmd('jam-answer', o)
|
|
322
330
|
setSending(true)
|
|
323
|
-
void onAnswer(text.trim()).then((ok) => { setSending(false); if (ok) setText('') })
|
|
331
|
+
void endOnOk(h, onAnswer(text.trim()), 'send-failed').then((ok) => { setSending(false); if (ok) setText('') })
|
|
324
332
|
}
|
|
325
333
|
return (
|
|
326
334
|
<div className="jm-asks" data-jam-asks="" style={{ display: 'flex', flexDirection: 'column', gap: 7 }}>
|
|
@@ -334,9 +342,9 @@ export function AsksAnswer({ question, onAnswer, tag = true }: { question?: stri
|
|
|
334
342
|
onChange={(e) => setText(e.target.value)}
|
|
335
343
|
onKeyDown={(e) => {
|
|
336
344
|
e.stopPropagation()
|
|
337
|
-
if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) { e.preventDefault(); send() }
|
|
345
|
+
if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) { e.preventDefault(); send({ via: 'key', in: 'shell', keys: keysOf(e) }) }
|
|
338
346
|
}} />
|
|
339
|
-
<button className="jm-send" disabled={!text.trim() || sending} onClick={send}>Send <kbd>⏎</kbd></button>
|
|
347
|
+
<button className="jm-send" disabled={!text.trim() || sending} onClick={() => send(CLICK)}>Send <kbd>⏎</kbd></button>
|
|
340
348
|
</div>
|
|
341
349
|
</div>
|
|
342
350
|
)
|
|
@@ -375,11 +383,11 @@ export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active,
|
|
|
375
383
|
agent?: string
|
|
376
384
|
when?: string
|
|
377
385
|
more?: boolean
|
|
378
|
-
onMore(text: string): void
|
|
386
|
+
onMore(text: string, h: CmdHandle): void
|
|
379
387
|
onMoreOpen(open: boolean): void
|
|
380
|
-
onGood(): void
|
|
381
|
-
onLater(): void
|
|
382
|
-
onOpenThread?: () => void
|
|
388
|
+
onGood(h: CmdHandle): void
|
|
389
|
+
onLater(h: CmdHandle): void
|
|
390
|
+
onOpenThread?: (h: CmdHandle) => void
|
|
383
391
|
/** the card the More work words belong to (kept across the panel closing) */
|
|
384
392
|
draftKey?: string
|
|
385
393
|
style?: CSSProperties
|
|
@@ -433,7 +441,7 @@ export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active,
|
|
|
433
441
|
// elsewhere, the map still holds them
|
|
434
442
|
useEffect(() => { if (more) field.current?.focus(); else if (draftKey && !moreDrafts.has(draftKey)) setTextState('') }, [more])
|
|
435
443
|
// sent as More work, always: the canvas settles a note that only approves ("looks good") as Looks good
|
|
436
|
-
const send = () => { if (text.trim()) onMore(text.trim()) }
|
|
444
|
+
const send = (o: CmdOpts) => { if (text.trim()) onMore(text.trim(), cmd('jam-more-send', o)) }
|
|
437
445
|
return (
|
|
438
446
|
<div className="jm-panel jm-review" data-jam-review="" style={style}>
|
|
439
447
|
<div className="top">
|
|
@@ -447,19 +455,19 @@ export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active,
|
|
|
447
455
|
<Marver size={20} />
|
|
448
456
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, minWidth: 0 }}>
|
|
449
457
|
<p>{reply}</p>
|
|
450
|
-
{onOpenThread && <button className="jm-link" onClick={onOpenThread}>Open thread</button>}
|
|
458
|
+
{onOpenThread && <button className="jm-link" onClick={() => onOpenThread(cmd('jam-thread', CLICK))}>Open thread</button>}
|
|
451
459
|
</div>
|
|
452
460
|
</div>
|
|
453
461
|
{names.length > 0 && (
|
|
454
462
|
<div className="jm-fbar">
|
|
455
463
|
{names.length > 1
|
|
456
|
-
? <div className="jm-ftabs" role="tablist">{names.map((f, i) => <button key={f} role="tab" aria-selected={i === active} className={i === active ? 'on' : undefined} onClick={() => onTab(i)}><FrameRectIcon size={12} />{label(f)}{isNew(f) && <span className="jm-newtag">New</span>}</button>)}</div>
|
|
464
|
+
? <div className="jm-ftabs" role="tablist">{names.map((f, i) => <button key={f} role="tab" aria-selected={i === active} className={i === active ? 'on' : undefined} onClick={() => { const h = cmd('jam-frame-tab', CLICK); onTab(i); endAfterFrames(h) }}><FrameRectIcon size={12} />{label(f)}{isNew(f) && <span className="jm-newtag">New</span>}</button>)}</div>
|
|
457
465
|
: <span className="jm-framehd"><FrameRectIcon size={12} />{label(names[0])}{isNew(names[0]) && <span className="jm-newtag">New</span>}</span>}
|
|
458
466
|
<span className="sp" />
|
|
459
467
|
{/* a frame the run made has nothing before it: no switch */}
|
|
460
468
|
{shot?.new ? <span className="dim" data-jam-new="">New frame</span> : (
|
|
461
469
|
<Tip side="bottom" label={<span>Both / Before / After<kbd style={{ marginLeft: 8 }}>B</kbd></span>}>
|
|
462
|
-
<div className="jm-ftabs" data-jam-flip="">{(['both', 'before', 'after'] as const).map((v) => <button key={v} className={v === view ? 'on' : undefined} aria-pressed={v === view} onClick={() => onFlip(v)}>{v === 'both' ? 'Both' : v === 'before' ? 'Before' : 'After'}</button>)}</div>
|
|
470
|
+
<div className="jm-ftabs" data-jam-flip="">{(['both', 'before', 'after'] as const).map((v) => <button key={v} className={v === view ? 'on' : undefined} aria-pressed={v === view} onClick={() => { const h = cmd('jam-before-after', { ...CLICK, arg: v }); onFlip(v); endAfterFrames(h) }}>{v === 'both' ? 'Both' : v === 'before' ? 'Before' : 'After'}</button>)}</div>
|
|
463
471
|
</Tip>
|
|
464
472
|
)}
|
|
465
473
|
</div>
|
|
@@ -482,18 +490,18 @@ export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active,
|
|
|
482
490
|
onChange={(e) => setText(e.target.value)}
|
|
483
491
|
onKeyDown={(e) => {
|
|
484
492
|
e.stopPropagation()
|
|
485
|
-
if (e.key === 'Escape') { e.preventDefault(); setText(''); onMoreOpen(false) }
|
|
486
|
-
else if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) { e.preventDefault(); send() }
|
|
493
|
+
if (e.key === 'Escape') { e.preventDefault(); cmd('jam-field-discard', { via: 'key', in: 'shell', keys: keysOf(e), arg: 'more' }); setText(''); onMoreOpen(false) }
|
|
494
|
+
else if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) { e.preventDefault(); send({ via: 'key', in: 'shell', keys: keysOf(e) }) }
|
|
487
495
|
}} />
|
|
488
|
-
<button className="jm-send" disabled={!text.trim()} onClick={send}>Send <kbd>⏎</kbd></button>
|
|
496
|
+
<button className="jm-send" disabled={!text.trim()} onClick={() => send(CLICK)}>Send <kbd>⏎</kbd></button>
|
|
489
497
|
</div>
|
|
490
498
|
<span className="dim" style={{ paddingLeft: 4 }}>Back to the agent, next in line - the tile keeps its place · esc to cancel</span>
|
|
491
499
|
</div>
|
|
492
500
|
) : (
|
|
493
501
|
<div className="actions">
|
|
494
|
-
<button className="jm-btn primary" onClick={onGood}>Looks good <kbd>⏎</kbd></button>
|
|
495
|
-
<button className="jm-btn" onClick={() => onMoreOpen(true)}>More work <kbd>⇧⏎</kbd></button>
|
|
496
|
-
<button className="jm-btn ghost" onClick={onLater}>Later <kbd>→</kbd></button>
|
|
502
|
+
<button className="jm-btn primary" onClick={() => onGood(cmd('jam-good', CLICK))}>Looks good <kbd>⏎</kbd></button>
|
|
503
|
+
<button className="jm-btn" onClick={() => { const h = cmd('jam-more', CLICK); onMoreOpen(true); endAfterFrames(h) }}>More work <kbd>⇧⏎</kbd></button>
|
|
504
|
+
<button className="jm-btn ghost" onClick={() => onLater(cmd('jam-later', CLICK))}>Later <kbd>→</kbd></button>
|
|
497
505
|
<span className="sp" /><kbd>esc</kbd>
|
|
498
506
|
</div>
|
|
499
507
|
)}
|
|
@@ -529,8 +537,9 @@ export function NotesCard({ notes, draft, onDraft, onAdd, onClose, style }: {
|
|
|
529
537
|
onKeyDown={(e) => {
|
|
530
538
|
e.stopPropagation()
|
|
531
539
|
if ((e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) return
|
|
532
|
-
if (e.key === 'Escape') { e.preventDefault(); onClose() }
|
|
533
|
-
|
|
540
|
+
if (e.key === 'Escape') { e.preventDefault(); cmd('jam-notes-close', { via: 'key', in: 'shell', keys: keysOf(e) }); onClose() }
|
|
541
|
+
// the note step is added in this turn
|
|
542
|
+
else if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); if (draft.trim()) { const h = cmd('jam-capture-note', { via: 'key', in: 'shell', keys: keysOf(e) }); onAdd(); h.done() } }
|
|
534
543
|
}} />
|
|
535
544
|
<div className="foot"><span>⏎ add</span><span>esc close</span></div>
|
|
536
545
|
</div>
|
|
@@ -546,6 +555,10 @@ export const Caption = ({ old, live, style }: { old?: string; live?: string; sty
|
|
|
546
555
|
</div>
|
|
547
556
|
)
|
|
548
557
|
|
|
558
|
+
/** The microphone question's choices (the fixed name, spec 30): the callback ends the command when the consent or the
|
|
559
|
+
* download state changed. */
|
|
560
|
+
const voiceChoice = (arg: 'use-mic' | 'download' | 'try-again' | 'not-now' | 'typed-only') => cmd('jam-voice', { ...CLICK, arg })
|
|
561
|
+
|
|
549
562
|
/** The one question words need (first `S` on a canvas), then the model's download if it is missing:
|
|
550
563
|
* a header that says what is happening, a line on why, then what the model is (trial 3: "Words on this
|
|
551
564
|
* Mac" said neither). */
|
|
@@ -554,7 +567,7 @@ export function VoiceAsk({ step, mb, progress, error, onYes, onNo, onDownload, s
|
|
|
554
567
|
mb: number
|
|
555
568
|
progress?: number
|
|
556
569
|
error?: string
|
|
557
|
-
onYes(): void; onNo(): void; onDownload(): void
|
|
570
|
+
onYes(h: CmdHandle): void; onNo(h: CmdHandle): void; onDownload(h: CmdHandle): void
|
|
558
571
|
style?: CSSProperties
|
|
559
572
|
}) {
|
|
560
573
|
const pct = Math.round((progress ?? 0) * 100)
|
|
@@ -582,9 +595,9 @@ export function VoiceAsk({ step, mb, progress, error, onYes, onNo, onDownload, s
|
|
|
582
595
|
{step === 'checking' && <div className="jm-progress busy"><i /></div>}
|
|
583
596
|
<div className="actions">
|
|
584
597
|
<span className="sp" />
|
|
585
|
-
{step === 'ask' && <><button className="jm-btn ghost" onClick={onNo}>Not now</button><button className="jm-btn primary" onClick={onYes}>Use the microphone</button></>}
|
|
586
|
-
{(step === 'download' || step === 'failed') && <><button className="jm-btn ghost" onClick={onNo}>Not now</button><button className="jm-btn primary" onClick={onDownload}>{step === 'failed' ? 'Try again' : `Download ${mb} MB`}</button></>}
|
|
587
|
-
{step === 'unavailable' && <><button className="jm-btn ghost" onClick={onNo}>Typed notes only</button><button className="jm-btn primary" onClick={onYes}>Try again</button></>}
|
|
598
|
+
{step === 'ask' && <><button className="jm-btn ghost" onClick={() => onNo(voiceChoice('not-now'))}>Not now</button><button className="jm-btn primary" onClick={() => onYes(voiceChoice('use-mic'))}>Use the microphone</button></>}
|
|
599
|
+
{(step === 'download' || step === 'failed') && <><button className="jm-btn ghost" onClick={() => onNo(voiceChoice('not-now'))}>Not now</button><button className="jm-btn primary" onClick={() => onDownload(voiceChoice(step === 'failed' ? 'try-again' : 'download'))}>{step === 'failed' ? 'Try again' : `Download ${mb} MB`}</button></>}
|
|
600
|
+
{step === 'unavailable' && <><button className="jm-btn ghost" onClick={() => onNo(voiceChoice('typed-only'))}>Typed notes only</button><button className="jm-btn primary" onClick={() => onYes(voiceChoice('try-again'))}>Try again</button></>}
|
|
588
601
|
</div>
|
|
589
602
|
</div>
|
|
590
603
|
)
|