@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
|
@@ -7,20 +7,21 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
9
9
|
import { ROUTE } from '../const.ts'
|
|
10
|
-
import { captureCounts, useJamCapture } from './jam-capture.ts'
|
|
10
|
+
import { captureCounts, endedToReview, useJamCapture } from './jam-capture.ts'
|
|
11
11
|
import { useJamVoice, voiceSession, voiceSessionEnd, voiceSessionId, type Heard } from './jam-voice.ts'
|
|
12
12
|
import { holdsSessionMic, PlayCounter, RecordDetail, StartSheet, WrapSheet } from './jam-session.tsx'
|
|
13
|
-
import { FocusPanel, VoiceAsk } from './jam-panel.tsx'
|
|
13
|
+
import { AsksAnswer, FocusPanel, Marver, VoiceAsk } from './jam-panel.tsx'
|
|
14
14
|
import { addNote, decideDraft, laneCards, openThread, openTile, pendingEdit, resumeDraft, reveal, saveEdit, shownLane, startCapture } from './jam-keys.ts'
|
|
15
15
|
import { ContextMenu, useContextMenu, type MenuItem } from './ContextMenu.tsx'
|
|
16
16
|
import { ArrowBendUpLeftIcon, ArrowLineUpIcon, ArrowUpIcon, CheckSquareOffsetIcon, CommentIcon, EyeIcon, NotebookIcon, PencilSimpleIcon, PlayIcon, ReloadIcon, XIcon } from './icons.tsx'
|
|
17
|
-
import { laneLine, timelineLines } from './jam-lines.ts'
|
|
17
|
+
import { laneLine, laneTip, pictureCaption, timelineLines } from './jam-lines.ts'
|
|
18
18
|
import { changedShots, useJamQueue, type JamCard } from './jam-queue.ts'
|
|
19
|
-
import { DONE_GROUP, doneFold, letGoOfTile, useJamUi } from './jam-state.ts'
|
|
19
|
+
import { DONE_GROUP, doneFold, jamSurface, letGoOfTile, useJamUi } from './jam-state.ts'
|
|
20
20
|
import { CaptureLaneRow, FocusPanelView } from './jam-surface-parts.tsx'
|
|
21
|
-
import { clearMoreDraft, EdgeRing } from './jam-panel.tsx'
|
|
21
|
+
import { clearMoreDraft, EdgeRing, preloadShots } from './jam-panel.tsx'
|
|
22
22
|
import { useComments } from './comments-store.ts'
|
|
23
|
-
import { HARNESS } from './Comments.tsx'
|
|
23
|
+
import { Avatar, HARNESS } from './Comments.tsx'
|
|
24
|
+
import { TagStatus } from './jam-ui.tsx'
|
|
24
25
|
import { PUBLISHED, useStore } from './store.ts'
|
|
25
26
|
import { api, withWs } from './api.ts'
|
|
26
27
|
import type { CaptureRecord } from '../../server/jam/types.ts'
|
|
@@ -68,22 +69,38 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
68
69
|
useEffect(() => { const t = setInterval(() => setTick((n) => n + 1), 1000); return () => clearInterval(t) }, [])
|
|
69
70
|
// a new capture or a new draft brings the lane back to its right end
|
|
70
71
|
useEffect(() => { ui.follow() }, [cap.current, cards?.filter((c) => c.kind === 'capture').length])
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
72
|
+
const made = (id: string) => Number(/^cap-(\d+)-/.exec(id)?.[1] ?? 0)
|
|
73
|
+
// the read-back of the capture stopped TO REVIEW last (⇧E, or J's wrap-up) opens when capturing stops - over a
|
|
74
|
+
// review too (a capture made during a review is confirmed in its read-back; the review it follows stays bound in
|
|
75
|
+
// its record). It waits for that capture's own card: a resumed one replaces its draft, which must not open instead.
|
|
76
|
+
// The one ENDED last among them, not the one that sealed last (pictures can keep an earlier one sealing longer) -
|
|
77
|
+
// one capture records at a time, so that is the one started last. A capture stopped with E after it, before it
|
|
78
|
+
// had finished, never takes its place; and one stopped with E never opens, selects or moves anything - not even
|
|
79
|
+
// when the queue left it a draft (Nic, 27 Oct: "only when the user says Stop and Review should we have the To
|
|
80
|
+
// confirm state and open the capture card")
|
|
75
81
|
const [shownFor, setShownFor] = useState<string | null>(null)
|
|
76
82
|
useEffect(() => {
|
|
77
|
-
if (cap.current
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
if (cap.current) return
|
|
84
|
+
const toReview = cap.sealed.filter((x) => x.review).reduce<(typeof cap.sealed)[number] | undefined>((a, x) => (!a || made(x.id) > made(a.id) ? x : a), undefined)
|
|
85
|
+
// one stopped to review after it that is still finishing is the one to open: wait for it, never open the older
|
|
86
|
+
if (Object.values(cap.caps).some((c) => c.review && c.id !== toReview?.id && made(c.id) > (toReview ? made(toReview.id) : 0))) return
|
|
87
|
+
if (!toReview?.card || toReview.id === shownFor) return
|
|
88
|
+
const draft = cards?.find((c) => c.id === toReview.card!.id && c.state === 'draft')
|
|
81
89
|
if (!draft) return
|
|
82
|
-
setShownFor(
|
|
90
|
+
setShownFor(toReview.id)
|
|
83
91
|
if (ui.panel?.kind === 'capture' && ui.panel.id === draft.id) return
|
|
84
92
|
ui.open({ kind: 'capture', id: draft.id })
|
|
85
93
|
reveal(draft)
|
|
86
|
-
}, [cap.current, cap.sealed,
|
|
94
|
+
}, [cap.current, cap.sealed, cards])
|
|
95
|
+
|
|
96
|
+
// a review whose card left review under it - a capture made over it and stopped with E took it as More work, or
|
|
97
|
+
// another tab decided it: its panel closes (its verdicts would only fail now); nothing else opens or moves
|
|
98
|
+
const reviewing = ui.panel?.kind === 'review' ? cards?.find((c) => c.id === ui.panel!.id)?.state : undefined
|
|
99
|
+
const wasReviewing = useRef(reviewing)
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (wasReviewing.current === 'review' && reviewing && reviewing !== 'review' && useJamUi.getState().panel?.kind === 'review') ui.close()
|
|
102
|
+
wasReviewing.current = reviewing
|
|
103
|
+
}, [reviewing, ui.panel?.id])
|
|
87
104
|
|
|
88
105
|
// the session as the server holds it: a page opened (or reloaded) during one hears its talk again; one
|
|
89
106
|
// ended elsewhere (another tab) stops the talk here
|
|
@@ -111,6 +128,18 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
111
128
|
// a draft being resumed is the capture recording (or sealing) now: its own tile steps aside
|
|
112
129
|
const list = shownLane(cards, run, cap.resuming)
|
|
113
130
|
const cm = useContextMenu()
|
|
131
|
+
// a tile's menu opened at the tile, for the helper that opens a stalled run's controls (jam-keys.ts openRunControls)
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
jamSurface.tileMenu = (id) => {
|
|
134
|
+
const c = useJamQueue.getState().cards?.find((x) => x.id === id)
|
|
135
|
+
const el = document.querySelector(`.jm-lane [data-tile="${CSS.escape(id)}"]`)
|
|
136
|
+
if (!c || !el) return false
|
|
137
|
+
const r = el.getBoundingClientRect()
|
|
138
|
+
cm.open({ preventDefault() {}, clientX: r.left + 8, clientY: r.top - 8 }, tileMenu(c), `tile:${id}`)
|
|
139
|
+
return true
|
|
140
|
+
}
|
|
141
|
+
return () => { jamSurface.tileMenu = () => false }
|
|
142
|
+
}, [])
|
|
114
143
|
// a comment opening (a pin, a thread, Open thread) takes the place of the read-back or review: the panel
|
|
115
144
|
// closes; the tile lets go too, unless the thread is that tile's own (a capture that asks opens its thread)
|
|
116
145
|
useEffect(() => useComments.subscribe((s, p) => {
|
|
@@ -119,13 +148,15 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
119
148
|
const sel = useJamQueue.getState().cards?.find((c) => c.id === st.selected)
|
|
120
149
|
if (sel?.thread === s.active) { if (st.panel) st.close() } else letGoOfTile()
|
|
121
150
|
}), [])
|
|
122
|
-
const
|
|
123
|
-
const withMade = list.map((c) => ({ made: c.made, tile: { id: c.id, state: c.state, title: c.title ?? 'Capture', line: laneLine(c), ...(c.exclusive ? { exclusive: true } : {}), ...(c.state === 'done' && c.shots?.some((x) => !x.same) ? { frames: c.shots.filter((x) => !x.same).map((x) => x.frame) } : {}), ...(c.kind === 'wrapup' ? { record: true } : {}) } as { id: string; state: JamCard['state']; title: string; line: string; exclusive?: boolean; frames?: string[]; record?: boolean } })
|
|
151
|
+
const tool = (a: string): string | undefined => HARNESS[a]
|
|
152
|
+
const withMade = list.map((c) => { const tip = laneTip(c, tool); return { made: c.made, tile: { id: c.id, state: c.state, title: c.title ?? 'Capture', line: laneLine(c, Date.now(), tool), ...(tip ? { tip } : {}), ...(c.exclusive ? { exclusive: true } : {}), ...(c.state === 'done' && c.shots?.some((x) => !x.same) ? { frames: c.shots.filter((x) => !x.same).map((x) => x.frame) } : {}), ...(c.kind === 'wrapup' ? { record: true } : {}) } as { id: string; state: JamCard['state']; title: string; line: string; tip?: string; exclusive?: boolean; frames?: string[]; record?: boolean } } })
|
|
124
153
|
// captures the server does not hold yet: sealing (pictures and flushes still out) or waiting to send -
|
|
125
|
-
// each in its place by when it started, so one sealing late never swaps with a newer one
|
|
154
|
+
// each in its place by when it started, so one sealing late never swaps with a newer one. Stopped with E it is
|
|
155
|
+
// being sent to the queue ("Sending", the spinning glyph of work under way - never To confirm); stopped to review
|
|
156
|
+
// (⇧E) it is finishing for its read-back
|
|
126
157
|
const known = new Set(list.map((c) => c.id))
|
|
127
|
-
for (const c of Object.values(cap.caps)) if (c.state === 'draining' && !known.has(c.id)) withMade.push({ made: made(c.id), tile: { id: c.id, state: 'confirming', title: 'Capture', line: 'Finishing' } })
|
|
128
|
-
for (const id of cap.unsent) if (!known.has(id) && !cap.caps[id]) withMade.push({ made: made(id), tile: { id, state: 'confirming', title: 'Capture', line: 'Waiting to send' } })
|
|
158
|
+
for (const c of Object.values(cap.caps)) if (c.state === 'draining' && !known.has(c.id)) withMade.push({ made: made(c.id), tile: { id: c.id, state: 'confirming', title: 'Capture', line: c.review ? 'Finishing' : 'Sending' } })
|
|
159
|
+
for (const id of cap.unsent) if (!known.has(id) && !cap.caps[id]) withMade.push({ made: made(id), tile: { id, state: 'confirming', title: 'Capture', line: cap.away ? 'Waiting to send' : endedToReview(id) ? 'Finishing' : 'Sending' } })
|
|
129
160
|
const tiles = withMade.sort((a, b) => a.made - b.made).map((x) => x.tile)
|
|
130
161
|
// a selected tile that became done while the Done group is folded: the group holds the selection now
|
|
131
162
|
const doneNow = doneFold(tiles, ui.doneOpen)
|
|
@@ -137,7 +168,7 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
137
168
|
const counts = captureCounts(c)
|
|
138
169
|
const steps = (c?.steps ?? []).filter((x) => ['select', 'device', 'theme', 'copied', 'interact'].includes(x.event)).length
|
|
139
170
|
return { time: counts.time, points: c?.points.length ?? 0, pictures: c?.pictures.length ?? 0, picturesMax: (c?.pictures.length ?? 0) >= 12, steps,
|
|
140
|
-
notes: counts.notes, noteOn: cap.noteOpen, onNote: () => cap.setNoteOpen(!cap.noteOpen), onStop: () => cap.end(),
|
|
171
|
+
notes: counts.notes, noteOn: cap.noteOpen, onNote: () => cap.setNoteOpen(!cap.noteOpen), onStop: () => cap.end(), onStopReview: () => cap.end(true),
|
|
141
172
|
// the microphone: on while it hears this capture; off once you were asked (a click asks again)
|
|
142
173
|
...(voice.hearing === cap.current ? { mic: 'on' as const } : voice.choice !== null || voice.denied ? { mic: 'off' as const, onMic: () => useJamVoice.setState({ asking: true, choice: null }) } : {}) }
|
|
143
174
|
})() : undefined
|
|
@@ -148,11 +179,15 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
148
179
|
onCapture: () => startCapture(), // as S: one started over an open review follows it
|
|
149
180
|
} : undefined
|
|
150
181
|
|
|
151
|
-
const panelCard = ui.panel ? cards?.find((c) => c.id === ui.panel!.id) : undefined
|
|
182
|
+
const panelCard = ui.panel && ui.panel.kind !== 'thread' ? cards?.find((c) => c.id === ui.panel!.id) : undefined
|
|
183
|
+
// a card ready to review, and the one whose review is open: its pictures load now, every frame's - its review opens
|
|
184
|
+
// at their size and moves between frames without waiting (each URL once; never a card that is not in review)
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
for (const c of cards ?? []) if (c.state === 'review' || (ui.panel?.kind === 'review' && c.id === ui.panel.id)) preloadShots(changedShots(c.shots).flatMap((x) => [picture(x.before), picture(x.after)]))
|
|
187
|
+
}, [cards, ui.panel])
|
|
152
188
|
const rec = useRecord(ui.panel?.kind === 'capture' || ui.panel?.kind === 'review' ? ui.panel.id : undefined)
|
|
153
189
|
const agentName = agent ? HARNESS[agent] ?? agent : 'your agent'
|
|
154
190
|
const act = (c: JamCard | undefined, action: Parameters<ReturnType<typeof useJamQueue.getState>['act']>[1], body?: string) => (c ? useJamQueue.getState().act(c, action, body) : Promise.resolve(false))
|
|
155
|
-
const openThread = (c?: JamCard) => { if (c?.thread) useComments.getState().setActive(c.thread) }
|
|
156
191
|
/** The panel's arrows: the previous or next card of the same kind on the lane (reviews among reviews). */
|
|
157
192
|
const step = (d: number) => {
|
|
158
193
|
if (!ui.panel || !panelCard) return undefined
|
|
@@ -171,6 +206,7 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
171
206
|
// the microphone question in a session with no capture recording: under the Jam button
|
|
172
207
|
const askAlone = voice.asking && !cap.current && !!session
|
|
173
208
|
if (!shown && !ui.panel && !sheetOpen && !askAlone) return null
|
|
209
|
+
const panel = ui.panel
|
|
174
210
|
// in play the lane folds to a counter beside the navigator (Q opens it); the capture recording stays
|
|
175
211
|
const folded = playing && !ui.laneKeys
|
|
176
212
|
return (
|
|
@@ -186,7 +222,7 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
186
222
|
tiles={folded ? [] : tiles} recording={recording} between={between} selected={ui.selected ?? undefined} keyboard={ui.laneKeys} followEnd={ui.followEnd}
|
|
187
223
|
doneOpen={ui.doneOpen} onDoneOpen={(open, ids) => ui.setDoneOpen(open, ids)}
|
|
188
224
|
onOpen={(id) => openTile(id)}
|
|
189
|
-
onMenu={(e, id) => { const c = cards?.find((x) => x.id === id); if (c) { ui.select(id); cm.open(e, tileMenu(c)) } else e.preventDefault() }}
|
|
225
|
+
onMenu={(e, id) => { const c = cards?.find((x) => x.id === id); if (c) { ui.select(id); cm.open(e, tileMenu(c), `tile:${id}`) } else e.preventDefault() }}
|
|
190
226
|
ask={voice.asking && cap.current ? voiceAsk(voice) : undefined}
|
|
191
227
|
caption={cap.current ? captionOf(voice.heard[cap.current]) : undefined}
|
|
192
228
|
notes={cap.noteOpen ? {
|
|
@@ -195,6 +231,11 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
195
231
|
} : undefined}
|
|
196
232
|
/>
|
|
197
233
|
)}
|
|
234
|
+
{panel?.kind === 'thread' && (
|
|
235
|
+
<FocusPanel left={sidebarRight} onClose={() => ui.close()}>
|
|
236
|
+
<ThreadPanel key={`${panel.board}/${panel.id}`} board={panel.board} id={panel.id} />
|
|
237
|
+
</FocusPanel>
|
|
238
|
+
)}
|
|
198
239
|
{ui.panel && panelCard && panelCard.kind === 'wrapup' && (
|
|
199
240
|
<FocusPanel left={sidebarRight} onClose={() => ui.close()}>
|
|
200
241
|
<RecordDetail key={panelCard.id} card={panelCard} agent={agentName} more={ui.moreOpen} of={detail?.of} onPrev={step(-1)} onNext={step(1)}
|
|
@@ -209,16 +250,16 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
209
250
|
})()} />
|
|
210
251
|
</FocusPanel>
|
|
211
252
|
)}
|
|
212
|
-
{
|
|
253
|
+
{panel && panel.kind !== 'thread' && panelCard && panelCard.kind !== 'wrapup' && (
|
|
213
254
|
<FocusPanelView
|
|
214
255
|
left={sidebarRight}
|
|
215
|
-
kind={
|
|
256
|
+
kind={panel.kind}
|
|
216
257
|
card={panelCard}
|
|
217
258
|
of={detail?.of}
|
|
218
259
|
agent={agentName}
|
|
219
260
|
reviewedTitle={panelCard.reviewing ? cards?.find((c) => c.id === panelCard.reviewing!.card)?.title : undefined}
|
|
220
261
|
lines={rec ? timelineLines(rec.record, panelCard.edited ?? rec.edited) : []}
|
|
221
|
-
pictures={(rec?.record.pictures ?? []).map((id, i) => ({ id, url: picture(id)!, caption:
|
|
262
|
+
pictures={(rec?.record.pictures ?? []).map((id, i) => ({ id, url: picture(id)!, caption: pictureCaption(rec!.record, id, i + 1) }))}
|
|
222
263
|
shots={changedShots(panelCard.shots).map((x) => ({ frame: x.frame, before: picture(x.before), after: picture(x.after), ...(x.new ? { new: true } : {}) }))}
|
|
223
264
|
reply={panelCard.reply ? replyText(panelCard) : ''}
|
|
224
265
|
view={ui.view} tab={ui.tab} moreOpen={ui.moreOpen}
|
|
@@ -238,6 +279,12 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
238
279
|
})()}
|
|
239
280
|
onLater={() => { void act(panelCard, 'later'); ui.close() }}
|
|
240
281
|
onOpenThread={() => openThread(panelCard)}
|
|
282
|
+
asks={panelCard.thread ? { question: replyText(panelCard), onAnswer: async (text) => {
|
|
283
|
+
const ok = await useComments.getState().replyOk(panelCard.thread!, /@marver\b/i.test(text) ? text : `@marver ${text}`)
|
|
284
|
+
if (!ok) useStore.getState().toast('your answer was not sent - try again')
|
|
285
|
+
else ui.close()
|
|
286
|
+
return ok
|
|
287
|
+
} } : undefined}
|
|
241
288
|
onPrev={step(-1)} onNext={step(1)} pending={pendingEdit(panelCard.id)} locked={cap.settling === panelCard.id}
|
|
242
289
|
onRetry={() => void (async () => { if (await act(useJamQueue.getState().cards?.find((x) => x.id === panelCard.id), 'retry')) ui.close(); else useStore.getState().toast('the capture could not be retried - look again') })()}
|
|
243
290
|
/>
|
|
@@ -247,6 +294,58 @@ export function JamSurface({ sidebarRight }: { sidebarRight: number }) {
|
|
|
247
294
|
)
|
|
248
295
|
}
|
|
249
296
|
|
|
297
|
+
/**
|
|
298
|
+
* A thread no card on the canvas can show (spec 28 A4.6 #30, r1 #3, r2 #2, r3 #1): a question with no frame, one whose
|
|
299
|
+
* frame left its board, an early question while its card still works, a resolved thread. Its root line, its last
|
|
300
|
+
* message, the status of each Jam comment card on it - the thread card's own icon, tooltip and popover, so its Retry or
|
|
301
|
+
* its three choices act as there - and a field that answers in the thread: with @marver when a Jam card is on the
|
|
302
|
+
* thread (the answer carries the work on, as the capture panel's does), as typed otherwise (a tag would start a run
|
|
303
|
+
* nobody asked for). Resolved, it reads only - "Resolved", no field: a reply would land in a closed thread and reopen
|
|
304
|
+
* nothing - and its cards' status stays, since a resolve keeps a working card running.
|
|
305
|
+
*/
|
|
306
|
+
function ThreadPanel({ board, id }: { board: string; id: string }) {
|
|
307
|
+
const t = useComments((s) => s.threads.find((x) => x.id === id && (!x.board || x.board === board)))
|
|
308
|
+
const cards = useJamQueue((s) => s.cards)
|
|
309
|
+
const frame = useStore((s) => (t?.frame ? s.manifest?.frames.find((f) => f.id === t.frame)?.title ?? t.frame : null))
|
|
310
|
+
const onThread = (cards ?? []).filter((c) => c.board === board && c.thread === id)
|
|
311
|
+
const line = (b?: string) => (b ?? '').replace(/\s+/g, ' ').trim()
|
|
312
|
+
const last = t && t.replies.length ? t.replies[t.replies.length - 1] : t
|
|
313
|
+
return (
|
|
314
|
+
<div className="jm-panel jm-thread" data-jam-thread-panel={id} {...(t?.resolved ? { 'data-resolved': '' } : {})}>
|
|
315
|
+
<div className="top">
|
|
316
|
+
<h3>{frame ?? 'Thread'}</h3>
|
|
317
|
+
{t?.resolved && <span className="dim" data-jam-thread-resolved="">Resolved</span>}
|
|
318
|
+
</div>
|
|
319
|
+
<div className="jm-body">
|
|
320
|
+
{!t ? <p>This thread is gone.</p> : <>
|
|
321
|
+
<div className="jm-reply" data-jam-thread-root="">
|
|
322
|
+
{t.agent ? <Marver size={20} /> : <Avatar author={t.author} size={20} />}
|
|
323
|
+
<p>{line(t.body)}</p>
|
|
324
|
+
</div>
|
|
325
|
+
{last && last !== t && (
|
|
326
|
+
<div className="jm-reply" data-jam-thread-last="">
|
|
327
|
+
{last.agent ? <Marver size={20} /> : <Avatar author={last.author} size={20} />}
|
|
328
|
+
<p>{last.body}</p>
|
|
329
|
+
</div>
|
|
330
|
+
)}
|
|
331
|
+
{/* each Jam comment card's status, by its tag's time in the thread card: here the same icon and popover */}
|
|
332
|
+
{onThread.filter((c) => c.kind === 'comment').map((c) => (
|
|
333
|
+
<div key={c.id} className="jm-thread-status"><TagStatus board={board} eventId={c.events[c.events.length - 1]} harness={HARNESS} /></div>
|
|
334
|
+
))}
|
|
335
|
+
{!t.resolved && (
|
|
336
|
+
<AsksAnswer tag={onThread.length > 0} onAnswer={async (text) => {
|
|
337
|
+
const body = onThread.length && !/@marver\b/i.test(text) ? `@marver ${text}` : text
|
|
338
|
+
const ok = await useComments.getState().replyOk(id, body)
|
|
339
|
+
if (!ok) useStore.getState().toast('your answer was not sent - try again')
|
|
340
|
+
return ok
|
|
341
|
+
}} />
|
|
342
|
+
)}
|
|
343
|
+
</>}
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
)
|
|
347
|
+
}
|
|
348
|
+
|
|
250
349
|
/** In play: just right of the stage's navigator (its restart and frame arrows), where the counter sits. */
|
|
251
350
|
function playNavRight(): number {
|
|
252
351
|
const r = document.querySelector('.sh-play-nav')?.getBoundingClientRect()
|
|
@@ -283,7 +382,8 @@ function replyIn(c: JamCard) {
|
|
|
283
382
|
// once the thread's card has drawn (on another board, once that board has loaded)
|
|
284
383
|
const until = performance.now() + 3_000
|
|
285
384
|
const focus = () => {
|
|
286
|
-
const el = useComments.getState().active === c.thread ? document.querySelector<HTMLTextAreaElement>('.cm-card textarea')
|
|
385
|
+
const el = useComments.getState().active === c.thread ? document.querySelector<HTMLTextAreaElement>('.cm-card textarea')
|
|
386
|
+
: useJamUi.getState().panel?.id === c.id ? document.querySelector<HTMLTextAreaElement>('.jm-asks textarea') : null
|
|
287
387
|
if (el) { el.focus(); el.setSelectionRange(el.value.length, el.value.length) } else if (performance.now() < until) requestAnimationFrame(focus)
|
|
288
388
|
}
|
|
289
389
|
requestAnimationFrame(focus)
|
|
@@ -310,6 +410,12 @@ function tileMenu(c: JamCard): MenuItem[] {
|
|
|
310
410
|
case 'review': return [open, ...reply, ...thread, rename]
|
|
311
411
|
case 'asks': return [...reply, open, rename]
|
|
312
412
|
case 'failed': return [item('Retry', <ReloadIcon size={14} />, () => act('retry')), open, ...thread, item('Drop', <XIcon size={14} />, () => act('drop'))]
|
|
413
|
+
case 'working': {
|
|
414
|
+
// a run your session went quiet on (spec 29b): give it back, run it in the background, or drop it
|
|
415
|
+
if (c.runner?.kind !== 'session' || c.runner.state !== 'stalled') return [open, ...reply, ...thread, rename]
|
|
416
|
+
const run = (a: 'again' | 'background' | 'drop') => () => { const fresh = useJamQueue.getState().cards?.find((x) => x.id === c.id); if (fresh) void useJamQueue.getState().runAct(fresh, a) }
|
|
417
|
+
return [item('Give it back to your session', <ReloadIcon size={14} />, run('again')), item('Run it in the background', <ArrowUpIcon size={14} />, run('background')), open, ...thread, item('Drop it', <XIcon size={14} />, run('drop'))]
|
|
418
|
+
}
|
|
313
419
|
default: return [open, ...reply, ...thread, rename]
|
|
314
420
|
}
|
|
315
421
|
}
|
|
@@ -164,6 +164,11 @@ export const playCtl = {
|
|
|
164
164
|
setAt: (_at: string) => {},
|
|
165
165
|
/** Apply a parsed play hash to the OPEN session - at, device, and theme alike. */
|
|
166
166
|
sync: (_p: { at?: string; device?: string; theme?: string }) => {},
|
|
167
|
+
/** Leave play as its own Esc does: then back on the canvas at the frame you ended on */
|
|
168
|
+
exit: () => {},
|
|
169
|
+
/** Leave play and nothing more - no way back to its frame (no fit, no board switch): a notice's click opening something
|
|
170
|
+
* on the canvas owns what moves next (spec 28 A4.6 r4 #1; code review r2 P1). False on a board with no way out. */
|
|
171
|
+
leave: (): boolean => false,
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
export function PlayOverlay() {
|
|
@@ -351,14 +356,19 @@ function PlayInner() {
|
|
|
351
356
|
useEffect(() => { postStage({ type: 'sh:laser', on: laser, inspect: laserInspect }) }, [laser, laserInspect])
|
|
352
357
|
useEffect(() => { postStage({ type: 'sh:pick', on: commentMode, quiet: !useComments.getState().showAnchor }) }, [commentMode, playShowAnchor])
|
|
353
358
|
|
|
354
|
-
|
|
359
|
+
/** Play torn down, nothing more: false where there is no way out */
|
|
360
|
+
const leave = (): boolean => {
|
|
355
361
|
// the lock caps disclosure: a locked board has no way out into other modes,
|
|
356
362
|
// and a deep-link visit carries no door on the surface (URL still works)
|
|
357
|
-
if (noDoor) return
|
|
363
|
+
if (noDoor) return false
|
|
358
364
|
frozenDeck = null
|
|
359
|
-
const { at } = useStore.getState().play ?? {}
|
|
360
365
|
if (isHideUI()) toggleHideUI() // never strand the canvas with its chrome hidden
|
|
361
366
|
useStore.getState().setPlay(null)
|
|
367
|
+
return true
|
|
368
|
+
}
|
|
369
|
+
const exit = () => {
|
|
370
|
+
const { at } = useStore.getState().play ?? {}
|
|
371
|
+
if (!leave()) return
|
|
362
372
|
// land back on the canvas at the frame you ended on
|
|
363
373
|
const n = useStore.getState().nodes.find((x) => x.frame === at && !x.missing)
|
|
364
374
|
if (n) { useStore.getState().select(n.key); setTimeout(() => canvasCtl.fitNode(n.key), 30) }
|
|
@@ -448,7 +458,9 @@ function PlayInner() {
|
|
|
448
458
|
if (p.theme && p.theme !== cur.theme) setTheme(p.theme)
|
|
449
459
|
if (p.at && p.at !== cur.at) playCtl.setAt(p.at)
|
|
450
460
|
}
|
|
451
|
-
|
|
461
|
+
playCtl.exit = exit
|
|
462
|
+
playCtl.leave = leave
|
|
463
|
+
return () => { playCtl.setAt = () => {}; playCtl.sync = () => {}; playCtl.exit = () => {}; playCtl.leave = () => false }
|
|
452
464
|
}, [])
|
|
453
465
|
|
|
454
466
|
// messages from the stage; source-validated against our one iframe
|
package/src/client/shell/api.ts
CHANGED
|
@@ -207,12 +207,16 @@ export const resumed: { outcome: ResumeOutcome; board?: string; camera?: { x: nu
|
|
|
207
207
|
// words a person typed into the page and has not sent (a comment, a Jam edit, a name): a reload would drop them
|
|
208
208
|
const typed = new WeakSet<EventTarget>()
|
|
209
209
|
const TEXT_FIELDS = 'textarea, input:not([type]), input[type=text], input[type=search], input[type=email], input[type=url], input[type=password]'
|
|
210
|
+
/** Does a text field on the page hold words typed and not sent? The `typing` reason's own check, and what a notice's
|
|
211
|
+
* click reads before every move (spec 28 A4.6 #30, r2 #1): a board change, another thread or a panel replaced would
|
|
212
|
+
* unmount the field and lose them. Words the shell keeps with no field on screen (a More work draft, a read-back's
|
|
213
|
+
* edit still saving) are not here: they survive a move. */
|
|
214
|
+
export const typedUnsent = (): boolean => [...document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>(TEXT_FIELDS)].some((el) => typed.has(el) && el.value.trim() !== '')
|
|
210
215
|
if (WS) {
|
|
211
216
|
document.addEventListener('input', (e) => { if (e.target) typed.add(e.target); if (canvasStopped()) noteUnsaved(); workChanged() }, true)
|
|
212
|
-
|
|
213
|
-
holdsReload(typedWords)
|
|
217
|
+
holdsReload(typedUnsent)
|
|
214
218
|
// and leaving the page asks first (spec 28 A2.9): the words are only here
|
|
215
|
-
unsavedWhen('typing',
|
|
219
|
+
unsavedWhen('typing', typedUnsent)
|
|
216
220
|
}
|
|
217
221
|
|
|
218
222
|
// one question before this page goes, whatever it holds that the server does not have (unsaved.ts): a capture, a
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
* name, never as an accelerator, so the key stays the page's (A2.7); a click replays that key, so the menu does
|
|
18
18
|
* exactly what the key does;
|
|
19
19
|
* - `mv:app-state`: `shown` runs a resume reconcile, `untrusted` stops every microphone track the page holds (A2.14
|
|
20
|
-
* #13), `hidden` changes nothing (a hidden tab keeps running, A2.6)
|
|
20
|
+
* #13), `hidden` changes nothing (a hidden tab keeps running, A2.6) - but each of the two ends a notice's click in
|
|
21
|
+
* hand (A4.6 #30);
|
|
22
|
+
* - `mv:open` (app 0.3, A4.6 #29, #30): a notice's click, opened by open-item.ts and answered as `mv:opened`. An app
|
|
23
|
+
* without `onOpen` never sends one, and nothing here waits for it.
|
|
21
24
|
*
|
|
22
25
|
* The one ground (0.27.2, A3.8 #27, #31): `mv:hello` says the inset the shell applied (inset.ts's `TOP`: 44 only when
|
|
23
26
|
* the app said so and gave the whole presentation contract), and each `mv:present { epoch, w, h, frames }` is answered
|
|
@@ -40,6 +43,7 @@ import { useJamCapture } from './jam-capture.ts'
|
|
|
40
43
|
import { useJamQueue } from './jam-queue.ts'
|
|
41
44
|
import { useJamUi } from './jam-state.ts'
|
|
42
45
|
import { useJamVoice, voiceUntrusted } from './jam-voice.ts'
|
|
46
|
+
import { endOpen, openLiveItem } from './open-item.ts'
|
|
43
47
|
|
|
44
48
|
/** The ground under the strip (A2.14 #26): the shell's own - never a frame's pinned theme. */
|
|
45
49
|
export const shellDark = (): boolean => { const s = useStore.getState(); return !!s.play || s.viewTheme === 'dark' }
|
|
@@ -173,8 +177,10 @@ export async function resumeReconcile(): Promise<void> {
|
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
function onAppState(s: AppState): void {
|
|
176
|
-
if (s === 'shown') void resumeReconcile()
|
|
177
|
-
|
|
180
|
+
if (s === 'shown') { void resumeReconcile(); return }
|
|
181
|
+
// a notice's click still reading or waiting moves nothing more once the tab is hidden or its trust is gone
|
|
182
|
+
endOpen()
|
|
183
|
+
if (s === 'untrusted') voiceUntrusted()
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
// ---- the bridge ---------------------------------------------------------------------------------------------
|
|
@@ -193,6 +199,8 @@ export function startAppBridge(): void {
|
|
|
193
199
|
// what the app says, listened for before the page says anything
|
|
194
200
|
call(() => app.onAppState((s) => onAppState(s)))
|
|
195
201
|
call(() => app.onMenuClick((p) => runMenuItem(typeof p?.id === 'string' ? p.id : '')))
|
|
202
|
+
// a notice's click (A4.6 #29, #30): the exact item, resolved against fresh reads and answered
|
|
203
|
+
if (typeof app.onOpen === 'function') call(() => { app.onOpen!((p) => openLiveItem(p)) })
|
|
196
204
|
// the one ground's presentation requests (0.27.2): answered only when the shell took the inset - a shell that did
|
|
197
205
|
// not is placed below the strip and never asked (A3.8 #31)
|
|
198
206
|
if (TOP) call(() => { answerPresents(app, call) })
|
|
@@ -59,6 +59,9 @@ interface CommentsState {
|
|
|
59
59
|
* path as the poll, so dedup + the reply notification behave identically. ANY board:
|
|
60
60
|
* notifications must reach the user wherever they are on the canvas. */
|
|
61
61
|
poke(board?: string): void
|
|
62
|
+
/** Read a board's log now and answer whether the read succeeded (spec 28 A4.6 #30): `poke`'s read, awaited, its
|
|
63
|
+
* events merged - the board, the open thread and a draft stay as they are (never `load`, which clears them first). */
|
|
64
|
+
refresh(board: string): Promise<boolean>
|
|
62
65
|
/** A thread by id, from any board's log - one sweep first when it is not loaded yet. */
|
|
63
66
|
findThread(id: string): Promise<Thread | null>
|
|
64
67
|
/** `board` routes the write to a thread's ORIGIN log; default = the active board. */
|
|
@@ -253,6 +256,17 @@ export const useComments = create<CommentsState>((set, get) => {
|
|
|
253
256
|
})
|
|
254
257
|
},
|
|
255
258
|
|
|
259
|
+
async refresh(board) {
|
|
260
|
+
if (!board || apiOff || board === UNPLACED) return false
|
|
261
|
+
try {
|
|
262
|
+
const r = await api(`comments/${board}`)
|
|
263
|
+
if (!r.ok) return false
|
|
264
|
+
union(stamped(r.data.events, board))
|
|
265
|
+
baselinedBoards.add(board)
|
|
266
|
+
return true
|
|
267
|
+
} catch { return false }
|
|
268
|
+
},
|
|
269
|
+
|
|
256
270
|
async load(board) {
|
|
257
271
|
// threads are frame-scoped and global - a board switch keeps them all (the same
|
|
258
272
|
// frame on another board keeps its pins); only the open card and a draft reset
|
package/src/client/shell/goto.ts
CHANGED
|
@@ -72,9 +72,10 @@ export const isLatest = (seq: number): boolean => seq === gotoSeq
|
|
|
72
72
|
* notification's View: the switch is navigation `nav`'s (a new one, unless the caller took it at its own start, before
|
|
73
73
|
* a lookup), and true only once it landed with nothing newer since. What the caller does on the board - select, set a
|
|
74
74
|
* mode, enter play, move the camera - waits for true: a switch a newer navigation cancelled comes back too, and may
|
|
75
|
-
* find the board it asked for, the newer one's by then.
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
* find the board it asked for, the newer one's by then. `mayCommit`: the caller's own condition, read just before the
|
|
76
|
+
* board commits - false keeps the board shown (a notice's request, jam-keys.ts toBoard). */
|
|
77
|
+
export async function switchFor(board: string, nav: number = navigated(), mayCommit?: () => boolean): Promise<boolean> {
|
|
78
|
+
await useStore.getState().switchBoard(board, mayCommit)
|
|
78
79
|
return isLatest(nav) && useStore.getState().board === board
|
|
79
80
|
}
|
|
80
81
|
/** The camera to a node once it is drawn - unless a newer navigation has it by then. */
|
|
@@ -53,6 +53,7 @@ export const PanelFilledIcon = icon(<><rect x="32" y="48" width="192" height="16
|
|
|
53
53
|
export const FrameRectIcon = icon(<rect x="40" y="52" width="176" height="152" rx="20" fill="none" stroke="currentColor" strokeWidth="16" />)
|
|
54
54
|
export const UserIcon = icon(<path d="M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z" />)
|
|
55
55
|
export const PencilSimpleIcon = icon(<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z" />)
|
|
56
|
+
export const PauseIcon = icon(<><rect x="64" y="40" width="40" height="176" rx="10" /><rect x="152" y="40" width="40" height="176" rx="10" /></>)
|
|
56
57
|
export const LinkIcon = icon(<path d="M137.54,186.36a8,8,0,0,1,0,11.31l-9.94,10A56,56,0,0,1,48.38,128.4L72.5,104.28A56,56,0,0,1,149.31,102a8,8,0,1,1-10.64,12,40,40,0,0,0-54.85,1.63L59.7,139.72a40,40,0,0,0,56.58,56.58l9.94-9.94A8,8,0,0,1,137.54,186.36Zm70.08-138a56.08,56.08,0,0,0-79.22,0l-9.94,9.95a8,8,0,0,0,11.32,11.31l9.94-9.94a40,40,0,0,1,56.58,56.58L172.18,140.4a40,40,0,0,1-54.85,1.6,8,8,0,1,0-10.64,12,56,56,0,0,0,76.81-2.26l24.12-24.12A56.08,56.08,0,0,0,207.62,48.38Z" />)
|
|
57
58
|
export const LaserIcon = icon(<><circle cx="128" cy="128" r="56" fill="none" stroke="currentColor" strokeWidth="16" /><path d="M128 24 V56 M128 200 V232 M24 128 H56 M200 128 H232" fill="none" stroke="currentColor" strokeWidth="16" strokeLinecap="round" /><circle cx="128" cy="128" r="12" /></>)
|
|
58
59
|
|