Queue prompts in a card grid above the input and send each later with a button, or auto-send them after each reply with a visible countdown

A Claude Code mod that lets you queue prompts in a card grid above the input box and send each one later with a button, so you don't have to write prompts in another app and paste them in.
/plugin marketplace add PulseRH/claude-prompt-queue
/plugin install prompt-queue@pulserh-plugins
/reload-plugins
Then type /queue to show or hide it.
▥), or move it to a side window (◨).⇈ to top, ↑ ↓ reorder (the moved card lights up), ✎ edit, ➤ send now, ✕ delete. Buttons appear on hover (◉ turns that off).⚡): after each finished reply it counts down (3-30 s, visibly) and sends the first queued prompt. Pick how many to send before it switches itself off (1-10 or no limit). Cancel during the countdown stops it.⋯ (hover to peek, click to keep open). At band height L and in the side window the input gets its own row.◐), band height (⤢), paging (‹ ›), tooltips on every button.Built for the desktop Code tab; it also validates on the terminal surface.
claude plugin validate plugins/prompt-queue
claude plugin test plugins/prompt-queue
MIT
hooks/register.tsx 536 lines1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import type { Flash, QueuedPrompt } from '../types'
5
6const PANE = 'prompt-queue'
7const PLACEHOLDER = 'type a prompt, Enter to add'
8const VERSION = '0.5.0'
9const items = atom({ plugin: 'prompt-queue', key: 'items' } as const, [])
10const isOpen = atom({ plugin: 'prompt-queue', key: 'isOpen' } as const, true)
11const mode = atom({ plugin: 'prompt-queue', key: 'mode' } as const, 'band')
12const size = atom({ plugin: 'prompt-queue', key: 'size' } as const, 'M')
13const start = atom({ plugin: 'prompt-queue', key: 'start' } as const, 0)
14const history = atom({ plugin: 'prompt-queue', key: 'history' } as const, [])
15const numCols = atom({ plugin: 'prompt-queue', key: 'numCols' } as const, 2)
16const tone = atom({ plugin: 'prompt-queue', key: 'tone' } as const, 0)
17const isHover = atom({ plugin: 'prompt-queue', key: 'isHover' } as const, true)
18const editId = atom({ plugin: 'prompt-queue', key: 'editId' } as const, '')
19const draft = atom({ plugin: 'prompt-queue', key: 'draft' } as const, '')
20const rev = atom({ plugin: 'prompt-queue', key: 'rev' } as const, 0)
21// the ⋯ settings kept open by a click (a hover only peeks)
22const isMoreOpen = atom({ plugin: 'prompt-queue', key: 'isMoreOpen' } as const, false)
23
24// auto-send: on/off is its own switch; the count and the delay are settings beside it
25const isAuto = atom({ plugin: 'prompt-queue', key: 'isAuto' } as const, false)
26const autoLimit = atom({ plugin: 'prompt-queue', key: 'autoLimit' } as const, 3)
27const autoLeft = atom({ plugin: 'prompt-queue', key: 'autoLeft' } as const, 0)
28const delay = atom({ plugin: 'prompt-queue', key: 'delay' } as const, 5)
29const countdown = atom({ plugin: 'prompt-queue', key: 'countdown' } as const, 0)
30const LIMITS = [1, 2, 3, 5, 10, -1] // -1 is no limit
31const DELAYS = [3, 5, 10, 15, 30]
32
33// the card that just moved, and how far its highlight has faded
34const flash = atom({ plugin: 'prompt-queue', key: 'flash' } as const, null)
35const ACCENT = '#d97757'
36const FADE = [0.9, 0.6, 0.35, 0.15]
37
38const BUDGET: Record<string, number> = { S: 5, M: 9, L: 15 }
39// card fills: warm Claude-ish brown, slate, and the live theme colours
40const TONES: { bg: string; fg?: string }[] = [
41 { bg: '#3a2e28' },
42 { bg: '#2b303b' },
43 { bg: 'claude', fg: 'inverseText' },
44 { bg: 'permission', fg: 'inverseText' },
45]
46const MAX_TEXT_LINES = 3
47
48const isHex = (c: string) => /^#[0-9a-f]{6}$/i.test(c)
49const mix = (from: string, to: string, t: number) => {
50 const ch = (s: string, i: number) => parseInt(s.slice(1 + i * 2, 3 + i * 2), 16)
51 const out = [0, 1, 2].map(i => Math.round(ch(from, i) + (ch(to, i) - ch(from, i)) * t))
52 return '#' + out.map(v => v.toString(16).padStart(2, '0')).join('')
53}
54
55export const register: Register = on => {
56 // the running countdown to the next auto-send (a hot reload drops it; session.start clears the number)
57 let pending: { cancel: () => void } | undefined
58 // every thread of a project shares one queue, under the project root's key in the plugin's store
59 let storeKey = 'items'
60 // re-reads the store so edits made in the project's other threads show up here
61 let sync: { cancel: () => void } | undefined
62
63 on('session.start', async ($, e, next) => {
64 storeKey = 'items@' + (await $.session.root())
65 let saved = (await $.store.get(storeKey)) as QueuedPrompt[] | undefined
66 if (saved === undefined) {
67 // queues saved before they were per project: the old shared one and this thread's own join the project's
68 const sid = await $.session.id()
69 const legacy = (await $.store.get('items')) as QueuedPrompt[] | undefined
70 const mine = (await $.store.get('items:' + sid)) as QueuedPrompt[] | undefined
71 if (legacy !== undefined || mine !== undefined) {
72 const merged = [...(legacy ?? []), ...(mine ?? [])].filter((x, i, all) => all.findIndex(y => y.id === x.id) === i)
73 saved = merged
74 await $.store.set(storeKey, merged)
75 if (legacy !== undefined) await $.store.delete('items')
76 if (mine !== undefined) await $.store.delete('items:' + sid)
77 }
78 }
79 await update($, items, () => saved ?? [])
80 sync?.cancel()
81 sync = $.clock.every(2000, async () => {
82 try {
83 const stored = ((await $.store.get(storeKey)) as QueuedPrompt[] | undefined) ?? []
84 const shown = (await read($, items)) as QueuedPrompt[]
85 if (JSON.stringify(stored) !== JSON.stringify(shown)) await update($, items, () => stored)
86 } catch {
87 // the plugin was reloaded: this timer's environment is gone
88 }
89 })
90 await update($, countdown, () => 0)
91 await $.command.register({ name: 'queue', description: 'Show or hide the prompt queue' })
92 return next(e)
93 })
94
95 on('command.run', { command: 'queue' }, async $ => {
96 const open = await update($, isOpen, (v: boolean) => !v)
97 if (open && (await read($, mode)) === 'pane') {
98 await $.ui.open({ id: PANE, title: 'Prompt queue', focus: true })
99 }
100 if (!open) await $.ui.close({ id: PANE })
101 return { text: (open ? 'Prompt queue shown' : 'Prompt queue hidden') + ' (v' + VERSION + ').' }
102 })
103
104 on('turn.complete', async ($, e, next) => {
105 if (e.isAborted || e.reason !== 'answer' || pending) return next(e)
106 if (!(await read($, isAuto))) return next(e)
107 if (((await read($, items)) as QueuedPrompt[]).length === 0) return next(e)
108
109 // count down visibly so the person can cancel, then send the first prompt
110 const secs = (await read($, delay)) as number
111 await update($, countdown, () => secs)
112 pending = $.clock.every(1000, async () => {
113 const left = await update($, countdown, (n: number) => n - 1)
114 if (left > 0) return
115 pending?.cancel()
116 pending = undefined
117 await update($, countdown, () => 0)
118 if (!(await read($, isAuto))) return
119
120 // the project's other threads may have changed the queue: send what is first in the store now
121 const list = ((await $.store.get(storeKey)) as QueuedPrompt[] | undefined) ?? []
122 if (list.length === 0) return
123 const first = list[0]
124 const rest = list.slice(1)
125 await $.store.set(storeKey, rest)
126 await update($, items, () => rest)
127 const remaining = (await read($, autoLeft)) as number
128 if (remaining > 0) {
129 const now = await update($, autoLeft, (n: number) => n - 1)
130 if (now === 0) await update($, isAuto, () => false)
131 }
132 void $.prompt.submit({ text: first.text, asUser: true })
133 })
134 return next(e)
135 })
136
137 on('ui.render', async ($, e, next) => {
138 const isBand = e.component === 'AbovePrompt'
139 const isPane = e.component === 'Pane' && e.requestId === PANE
140 if (!isBand && !isPane) return next(e)
141
142 const where = (await read($, mode)) as string
143 if (!(await read($, isOpen))) return next(e)
144 if (isBand && (where !== 'band' || e.props.hasSurvey)) return next(e)
145 if (isPane && where !== 'pane') return next(e)
146
147 const { Box, Text, Button, Input } = $.ui.resolve(e)
148 const list = (await read($, items)) as QueuedPrompt[]
149 const sz = (await read($, size)) as string
150 const hist = (await read($, history)) as number[]
151 let from = (await read($, start)) as number
152 if (from >= list.length) from = 0
153
154 const nc = (await read($, numCols)) as number
155 const toneIdx = (await read($, tone)) as number
156 const look = TONES[toneIdx % TONES.length]
157 const moved = (await read($, flash)) as Flash | null
158
159 const cols = Math.max(20, e.props.bodyColumns ?? 80)
160 const cellW = Math.floor((cols - 1) / nc)
161 // the desktop draws proportional text, so a cell holds more than one character
162 const fudge = e.surface === 'desktop' ? 1.5 : 1
163 const perLine = Math.max(8, Math.floor((cellW - 6) * fudge))
164 const budget = isBand ? BUDGET[sz] : Math.max(4, (e.viewport?.rows ?? 24) - 7)
165
166 // short prompt: one row, icons on the same line. Longer: text left, icons stacked right.
167 const ROW_CTRL = Math.round(14 * fudge)
168 const SIDE_CTRL = Math.round(9 * fudge)
169 // hover mode: the icons float over the card's corner on hover, so the text gets the whole card
170 const hoverMode = (await read($, isHover)) as boolean
171 const isInline = (t: string) => !hoverMode && t.length + 4 + ROW_CTRL <= perLine
172 const sideW = hoverMode ? perLine : Math.max(6, perLine - SIDE_CTRL)
173 const textLines = (t: string) =>
174 isInline(t) ? 1 : Math.min(MAX_TEXT_LINES, Math.max(1, Math.ceil((t.length + 4) / sideW)))
175 const cellHeight = (t: string) => (isInline(t) || hoverMode ? textLines(t) : Math.max(2, textLines(t))) + 1
176
177 // pack rows of nc cells until the line budget is used
178 const rows: QueuedPrompt[][] = []
179 let used = 0
180 let at = from
181 while (at < list.length) {
182 const group = list.slice(at, at + nc)
183 const h = Math.max(...group.map(p => cellHeight(p.text)))
184 if (rows.length > 0 && used + h > budget) break
185 rows.push(group)
186 used += h
187 at += group.length
188 }
189 const shown = at - from
190
191 const auto = (await read($, isAuto)) as boolean
192 const limit = (await read($, autoLimit)) as number
193 const left = (await read($, autoLeft)) as number
194 const secs = (await read($, delay)) as number
195 const ticking = (await read($, countdown)) as number
196 const moreOpen = (await read($, isMoreOpen)) as boolean
197 const editing = (await read($, editId)) as string
198 const draftText = (await read($, draft)) as string
199 const revision = (await read($, rev)) as number
200
201 // re-read before every change so this thread never overwrites what another thread of the project wrote
202 const mutate = async (fn: (l: QueuedPrompt[]) => QueuedPrompt[]) => {
203 const stored = ((await $.store.get(storeKey)) as QueuedPrompt[] | undefined) ?? []
204 const out = fn(stored)
205 await $.store.set(storeKey, out)
206 await update($, items, () => out)
207 return out
208 }
209 const add = async (text: string) => {
210 const t = text.trim()
211 if (!t) return
212 const id = editing
213 await (id
214 ? mutate((l: QueuedPrompt[]) => l.map(i => (i.id === id ? { ...i, text: t } : i)))
215 : mutate((l: QueuedPrompt[]) => [...l, { id: String(Date.now()) + Math.random(), text: t }]))
216 await update($, editId, () => '')
217 await update($, draft, () => '')
218 await update($, rev, (n: number) => n + 1)
219 }
220 // every keystroke: keep the draft in step, so a redraw never puts the old text back
221 const typed = async (v: string) => {
222 await update($, draft, () => v)
223 }
224 const toggleMore = async () => {
225 await update($, isMoreOpen, (v: boolean) => !v)
226 }
227 const startEdit = async (item: QueuedPrompt) => {
228 await update($, editId, () => item.id)
229 await update($, draft, () => item.text)
230 await update($, rev, (n: number) => n + 1)
231 }
232 const cancelEdit = async () => {
233 await update($, editId, () => '')
234 await update($, draft, () => '')
235 await update($, rev, (n: number) => n + 1)
236 }
237
238 // auto-send: one press turns it on or off; the count is set separately
239 const toggleAuto = async () => {
240 const on_ = await update($, isAuto, (v: boolean) => !v)
241 if (on_) {
242 await update($, autoLeft, () => limit)
243 } else {
244 pending?.cancel()
245 pending = undefined
246 await update($, countdown, () => 0)
247 }
248 }
249 const cycleLimit = async () => {
250 const next_ = LIMITS[(LIMITS.indexOf(limit) + 1) % LIMITS.length]
251 await update($, autoLimit, () => next_)
252 if (auto) await update($, autoLeft, () => next_)
253 }
254 const setLimit = async (n: number) => {
255 await update($, autoLimit, () => n)
256 if (auto) await update($, autoLeft, () => n)
257 }
258 const setDelay = async (s: number) => {
259 await update($, delay, () => s)
260 }
261 const cycleDelay = async () => {
262 await update($, delay, (s: number) => DELAYS[(DELAYS.indexOf(s) + 1) % DELAYS.length])
263 }
264 // cancel a send that is counting down, and stop auto-send so nothing follows it
265 const cancelSend = async () => {
266 pending?.cancel()
267 pending = undefined
268 await update($, countdown, () => 0)
269 await update($, isAuto, () => false)
270 }
271
272 const toggleHover = async () => {
273 await update($, isHover, (v: boolean) => !v)
274 }
275 const remove = async (id: string) => {
276 await mutate((l: QueuedPrompt[]) => l.filter(i => i.id !== id))
277 }
278 // the plugin UI cannot slide a card, so the one that moved lights up and fades
279 const lightUp = async (id: string, dir: number) => {
280 const seq = Math.random()
281 await update($, flash, () => ({ id, dir, step: 0, seq }))
282 void (async () => {
283 try {
284 for (const step of [1, 2, 3]) {
285 await $.clock.sleep(150)
286 await update($, flash, (f: Flash | null) => (f && f.seq === seq ? { ...f, step } : f))
287 }
288 await $.clock.sleep(150)
289 await update($, flash, (f: Flash | null) => (f && f.seq === seq ? null : f))
290 } catch {
291 // the plugin was reloaded mid-fade: the highlight just stops
292 }
293 })()
294 }
295 const move = async (id: string, by: number) => {
296 await mutate((l: QueuedPrompt[]) => {
297 const i = l.findIndex(x => x.id === id)
298 const j = i + by
299 if (i < 0 || j < 0 || j >= l.length) return l
300 const c = [...l]
301 c[i] = l[j]
302 c[j] = l[i]
303 return c
304 })
305 await lightUp(id, by)
306 }
307 // jump a prompt to the front of the queue
308 const toTop = async (id: string) => {
309 await mutate((l: QueuedPrompt[]) => {
310 const found = l.find(x => x.id === id)
311 return found ? [found, ...l.filter(x => x.id !== id)] : l
312 })
313 await update($, start, () => 0)
314 await update($, history, () => [])
315 await lightUp(id, -1)
316 }
317 const send = async (item: QueuedPrompt) => {
318 await remove(item.id)
319 void $.prompt.submit({ text: item.text, asUser: true })
320 }
321 const next_ = async () => {
322 await update($, history, (h: number[]) => [...h, from])
323 await update($, start, () => from + shown)
324 }
325 const prev = async () => {
326 const back = hist[hist.length - 1] ?? 0
327 await update($, history, (h: number[]) => h.slice(0, -1))
328 await update($, start, () => back)
329 }
330 const cycleSize = async () => {
331 await update($, size, (s: string) => (s === 'S' ? 'M' : s === 'M' ? 'L' : 'S'))
332 await update($, history, () => [])
333 }
334 const cycleCols = async () => {
335 await update($, numCols, (c: number) => (c >= 3 ? 1 : c + 1))
336 await update($, history, () => [])
337 }
338 const cycleTone = async () => {
339 await update($, tone, (t: number) => (t + 1) % TONES.length)
340 }
341 const toggleWhere = async () => {
342 const w = await update($, mode, (m: string) => (m === 'band' ? 'pane' : 'band'))
343 await update($, history, () => [])
344 if (w === 'pane') await $.ui.open({ id: PANE, title: 'Prompt queue', focus: true })
345 else await $.ui.close({ id: PANE })
346 }
347
348 // no native tooltip exists, so a button's name appears beside it while the pointer is over it
349 const tip = (name: string, button: unknown, text: string) => (
350 <Box key={'tip-' + name} flexDirection="row" alignItems="center">
351 {button}
352 <Box display="none" hover={{ display: 'flex' }} marginLeft={1}>
353 <Text dimColor>{text}</Text>
354 </Box>
355 </Box>
356 )
357
358 const cell = (item: QueuedPrompt, n: number) => {
359 const lines = textLines(item.text)
360 const inline = isInline(item.text)
361 const width = inline ? perLine - ROW_CTRL : sideW
362 const cap = lines * width - 4
363 const body = item.text.length > cap ? item.text.slice(0, Math.max(1, cap - 1)) + '…' : item.text
364 // the first prompt is already at the top, so it gets no jump-to-top button
365 const top = n > 1 ? tip('top-' + item.id, <Button key={'top-' + item.id} plain onPress={() => toTop(item.id)}>⇈</Button>, 'to top') : null
366 const up = tip('up-' + item.id, <Button key={'up-' + item.id} plain onPress={() => move(item.id, -1)}>↑</Button>, 'up one')
367 const dn = tip('dn-' + item.id, <Button key={'dn-' + item.id} plain onPress={() => move(item.id, 1)}>↓</Button>, 'down one')
368 const ed = tip('edit-' + item.id, <Button key={'edit-' + item.id} plain onPress={() => startEdit(item)}>✎</Button>, 'edit')
369 const go = tip('send-' + item.id, <Button key={'send-' + item.id} variant="primary" onPress={() => send(item)}>➤</Button>, 'send now')
370 const del = tip('del-' + item.id, <Button key={'del-' + item.id} dimColor onPress={() => remove(item.id)}>✕</Button>, 'delete')
371
372 const lit = moved && moved.id === item.id ? moved : null
373 const fill = lit ? (isHex(look.bg) ? mix(look.bg, ACCENT, FADE[lit.step]) : lit.step < 2 ? ACCENT : look.bg) : look.bg
374 const arrow = lit ? (lit.dir < 0 ? '↑ ' : '↓ ') : ''
375 return (
376 <Box
377 key={item.id}
378 flexDirection="row"
379 width={cellW - 1}
380 marginRight={1}
381 marginBottom={1}
382 paddingX={1}
383 borderStyle="round"
384 borderColor={fill}
385 backgroundColor={fill}
386 >
387 <Box flexGrow={1} flexShrink={1}>
388 <Text wrap="wrap" color={look.fg}>{arrow}{n}. {body}</Text>
389 </Box>
390 {hoverMode ? (
391 <Box
392 position="absolute"
393 top={0}
394 right={0}
395 display="none"
396 hover={{ display: 'flex' }}
397 flexDirection="row"
398 gap={1}
399 paddingX={1}
400 backgroundColor={fill}
401 >
402 {top}{up}{dn}{ed}{go}{del}
403 </Box>
404 ) : inline ? (
405 <Box flexDirection="row" flexShrink={0} gap={1}>{top}{up}{dn}{ed}{go}{del}</Box>
406 ) : (
407 <Box flexDirection="column" flexShrink={0} alignItems="flex-end">
408 <Box flexDirection="row" gap={1}>{top}{up}{dn}{del}</Box>
409 <Box flexDirection="row" gap={1}>{ed}{go}</Box>
410 </Box>
411 )}
412 </Box>
413 )
414 }
415
416 // lit up while auto-send is on, so the three controls read as one thing
417 const autoBg = auto ? mix('#2a2a2a', ACCENT, 0.35) : '#2e2e2e'
418
419 const barW = Math.min(secs, 15)
420 const filled = Math.ceil((ticking / secs) * barW)
421 const nextText = list[0]?.text ?? ''
422 const nextShort = nextText.length > 40 ? nextText.slice(0, 39) + '…' : nextText
423
424 // the built-in field cannot be resized, but the desktop sizes it to its placeholder text,
425 // so the placeholder is padded with invisible figure spaces to fill the room it has
426 const twoRows = !isBand || sz === 'L'
427 const CONTROL_CELLS = 46
428 const fieldCells = Math.max(16, (twoRows ? cols : cols - CONTROL_CELLS) - 8)
429 const padCount = Math.max(0, Math.round(fieldCells * fudge) - PLACEHOLDER.length)
430 const placeholder = PLACEHOLDER + ' '.repeat(padCount)
431
432 const field = (
433 <Box flexGrow={1} flexShrink={1} flexDirection="column" alignItems="stretch">
434 <Input
435 key={'new-' + revision}
436 label={editing ? 'Edit: ' : 'Queue: '}
437 placeholder={placeholder}
438 value={draftText}
439 submitLabel={editing ? 'save' : 'add'}
440 onSubmit={add}
441 onInput={(v: string) => typed(v)}
442 />
443 </Box>
444 )
445
446 // the less used settings live behind ⋯: hover to peek, click to keep them open
447 const controls = (
448 <Box flexDirection="row" gap={1} flexShrink={0} alignItems="center">
449 <Box flexShrink={0} flexDirection="row" alignItems="center" gap={1} paddingX={1} backgroundColor={autoBg}>
450 {tip('auto', <Button key="auto" variant={auto ? 'primary' : 'secondary'} onPress={toggleAuto}>
451 {auto ? '⚡ On' : '⚡ Off'}
452 </Button>, 'auto-send after each reply')}
453 {/* each of these reveals its own choices beside it on hover: wider, never taller */}
454 <Box key="limgrp" flexDirection="row" alignItems="center">
455 <Button key="limit" plain onPress={cycleLimit}>
456 {auto ? (left < 0 ? '∞ left' : left + ' left') : '×' + (limit < 0 ? '∞' : limit)}
457 </Button>
458 <Box display="none" hover={{ display: 'flex' }} flexDirection="row" gap={1} marginLeft={1}>
459 <Text dimColor>send</Text>
460 {LIMITS.map(n => (
461 <Button key={'lim-' + n} plain variant={n === limit ? 'primary' : 'secondary'} onPress={() => setLimit(n)}>
462 {n < 0 ? '∞' : String(n)}
463 </Button>
464 ))}
465 </Box>
466 </Box>
467 <Box key="dlygrp" flexDirection="row" alignItems="center">
468 <Button key="delay" plain onPress={cycleDelay}>{'⏱ ' + secs + 's'}</Button>
469 <Box display="none" hover={{ display: 'flex' }} flexDirection="row" gap={1} marginLeft={1}>
470 <Text dimColor>wait</Text>
471 {DELAYS.map(s => (
472 <Button key={'dly-' + s} plain variant={s === secs ? 'primary' : 'secondary'} onPress={() => setDelay(s)}>
473 {s + 's'}
474 </Button>
475 ))}
476 </Box>
477 </Box>
478 </Box>
479 {editing && (
480 <Box flexShrink={0}>
481 <Button key="cancel" plain onPress={cancelEdit}>✕ Cancel</Button>
482 </Box>
483 )}
484 <Box flexShrink={0} flexDirection="row" gap={1}>
485 {tip('prev', <Button key="prev" plain dimColor={hist.length === 0} onPress={prev}>‹</Button>, 'previous page')}
486 <Text dimColor wrap="truncate-end">
487 {list.length === 0 ? '0' : `${from + 1}-${from + shown}/${list.length}`}
488 </Text>
489 {tip('next', <Button key="next" plain dimColor={from + shown >= list.length} onPress={next_}>›</Button>, 'next page')}
490 </Box>
491 <Box key="moregrp" flexDirection="row" alignItems="center" gap={1}>
492 {tip('more', <Button key="more" plain onPress={toggleMore}>⋯</Button>, moreOpen ? 'hide settings' : 'settings')}
493 <Box display={moreOpen ? 'flex' : 'none'} {...(moreOpen ? {} : { hover: { display: 'flex' } })} flexDirection="row" gap={1}>
494 {isBand && tip('size', <Button key="size" plain onPress={cycleSize}>{'⤢ ' + sz}</Button>, 'band height')}
495 {tip('cols', <Button key="cols" plain onPress={cycleCols}>{'▥ ' + nc}</Button>, 'columns')}
496 {tip('hov', <Button key="hov" plain onPress={toggleHover}>{hoverMode ? '◉' : '○'}</Button>, 'card buttons on hover')}
497 {tip('tone', <Button key="tone" plain onPress={cycleTone}>◐</Button>, 'card color')}
498 {tip('where', <Button key="where" plain onPress={toggleWhere}>{isBand ? '◨' : '⬒'}</Button>, isBand ? 'side window' : 'above input')}
499 </Box>
500 </Box>
501 </Box>
502 )
503
504 return (
505 <Box flexDirection="column">
506 {twoRows ? (
507 <Box flexDirection="column">
508 {field}
509 {controls}
510 </Box>
511 ) : (
512 <Box flexDirection="row" gap={1}>
513 {field}
514 {controls}
515 </Box>
516 )}
517 {ticking > 0 && (
518 <Box flexDirection="row" gap={1} marginY={1}>
519 <Text bold color="claude">{'⏱ ' + ticking}</Text>
520 <Text color="claude">{'●'.repeat(filled) + '○'.repeat(barW - filled)}</Text>
521 <Box flexGrow={1} flexShrink={1}>
522 <Text wrap="truncate-end">{'sending "' + nextShort + '"'}</Text>
523 </Box>
524 <Button key="cdcancel" variant="primary" onPress={cancelSend}>✕ Cancel</Button>
525 </Box>
526 )}
527 {rows.map((pair, r) => (
528 <Box key={'row' + r} flexDirection="row">
529 {pair.map((item, c) => cell(item, from + r * nc + c + 1))}
530 </Box>
531 ))}
532 </Box>
533 )
534 })
535}
536types/index.d.ts 29 lines1export type QueuedPrompt = { id: string; text: string }
2export type Flash = { id: string; dir: number; step: number; seq: number }
3
4declare module 'claude-code' {
5 interface PluginState {
6 'prompt-queue': {
7 items: QueuedPrompt[]
8 isOpen: boolean
9 mode: 'band' | 'pane'
10 size: 'S' | 'M' | 'L'
11 start: number
12 history: number[]
13 numCols: number
14 tone: number
15 isAuto: boolean
16 autoLimit: number
17 autoLeft: number
18 delay: number
19 countdown: number
20 flash: Flash | null
21 isHover: boolean
22 editId: string
23 draft: string
24 rev: number
25 isMoreOpen: boolean
26 }
27 }
28}
29