Skip to content

The agent that grows with you

feat(desktop): let queued prompts expand to their full text

Brooklyn Nicholsone865b1f34190
diff --git a/apps/desktop/src/app/chat/composer/queue-panel.test.tsx b/apps/desktop/src/app/chat/composer/queue-panel.test.tsx
new file mode 100644
index 00000000000..b9988cf3e77
--- /dev/null
+++ b/apps/desktop/src/app/chat/composer/queue-panel.test.tsx
@@ -0,0 +1,82 @@
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+import { I18nProvider } from '@/i18n/context'
+import type { QueuedPromptEntry } from '@/store/composer-queue'
+
+import { QueuePanel } from './queue-panel'
+
+const entry = (id: string, text: string): QueuedPromptEntry => ({
+ attachments: [],
+ id,
+ queuedAt: Date.now(),
+ text
+})
+
+function renderPanel(entries: QueuedPromptEntry[]) {
+ return render(
+ <I18nProvider configClient={{ getConfig: async () => ({}), saveConfig: async () => ({ ok: true }) }}>
+ <QueuePanel
+ busy={false}
+ editingId={null}
+ entries={entries}
+ onDelete={vi.fn()}
+ onEdit={vi.fn()}
+ onResume={vi.fn()}
+ onSendNow={vi.fn()}
+ parked={false}
+ />
+ </I18nProvider>
+ )
+}
+
+afterEach(cleanup)
+
+// The panel's StatusSection starts collapsed; tests read the entries, so open it.
+async function renderExpandedPanel(entries: QueuedPromptEntry[]) {
+ const view = renderPanel(entries)
+
+ fireEvent.click(await view.findByRole('button', { name: /queued/i }))
+
+ return view
+}
+
+// #45664: a long queued prompt was only ever readable as one truncated line
+// (or by loading it back into the composer). Long and multiline previews now
+// carry an expand/collapse toggle that reveals the full text in place.
+describe('QueuePanel expandable previews', () => {
+ it('offers expansion for long and multiline entries but not short ones', async () => {
+ await renderExpandedPanel([
+ entry('short', 'Quick note'),
+ entry('long', 'A'.repeat(200)),
+ entry('multiline', 'First line\nSecond line')
+ ])
+
+ await screen.findByText('Quick note')
+
+ // Exactly the two long/multiline entries get a toggle, not the short one.
+ expect(screen.getAllByRole('button', { name: /expand/i })).toHaveLength(2)
+ })
+
+ it('expands an entry to its full text and collapses it back', async () => {
+ const text = `${'A'.repeat(200)}\nlast line`
+ await renderExpandedPanel([entry('long', text)])
+
+ // The DOM keeps the newline in textContent; findByText normalizes
+ // whitespace, so locate the <p> by exact textContent instead.
+ expect(
+ await screen.findByText((_, element) => element?.tagName === 'P' && element.textContent === text)
+ ).toBeTruthy()
+
+ const toggle = screen.getByRole('button', { name: /expand/i })
+ expect(toggle.getAttribute('aria-expanded')).toBe('false')
+
+ fireEvent.click(toggle)
+
+ const collapse = screen.getByRole('button', { name: /collapse/i })
+ expect(collapse.getAttribute('aria-expanded')).toBe('true')
+
+ fireEvent.click(collapse)
+ expect(screen.getByRole('button', { name: /expand/i }).getAttribute('aria-expanded')).toBe('false')
+ })
+})
diff --git a/apps/desktop/src/app/chat/composer/queue-panel.tsx b/apps/desktop/src/app/chat/composer/queue-panel.tsx
index 1f70fbe3ed6..fdd2e8341b1 100644
--- a/apps/desktop/src/app/chat/composer/queue-panel.tsx
+++ b/apps/desktop/src/app/chat/composer/queue-panel.tsx
@@ -1,3 +1,5 @@
+import { useState } from 'react'
+
import { StatusRow } from '@/components/chat/status-row'
import { StatusSection } from '@/components/chat/status-section'
import { Button } from '@/components/ui/button'
@@ -29,6 +31,10 @@ const entryPreview = (entry: QueuedPromptEntry, c: Translations['composer']) =>
? c.hiddenQueued
: (entry.displayText ?? entry.text).trim() || (entry.attachments.length > 0 ? c.attachmentOnly : c.emptyTurn)
+/** A preview long enough (or multiline enough) that two lines may still hide
+ * part of it — the entry gets an in-place expand/collapse toggle (#45664). */
+const shouldOfferExpandedPreview = (preview: string) => preview.length > 140 || preview.includes('\n')
+
export function QueuePanel({
busy,
editingId,
@@ -42,6 +48,21 @@ export function QueuePanel({
}: QueuePanelProps) {
const { t } = useI18n()
const c = t.composer
+ const [expandedIds, setExpandedIds] = useState<ReadonlySet<string>>(() => new Set())
+
+ const toggleExpanded = (id: string) => {
+ setExpandedIds(current => {
+ const next = new Set(current)
+
+ if (next.has(id)) {
+ next.delete(id)
+ } else {
+ next.add(id)
+ }
+
+ return next
+ })
+ }
if (entries.length === 0) {
return null
@@ -73,6 +94,9 @@ export function QueuePanel({
// Steer only surfaces where it can actually deliver: a live turn to
// redirect and an entry the redirect can carry (text-only, no slash).
const canSteer = busy && Boolean(onSteerNow) && isSteerableEntry(entry)
+ const preview = entryPreview(entry, c)
+ const canExpand = shouldOfferExpandedPreview(preview)
+ const isExpanded = expandedIds.has(entry.id)
return (
<StatusRow
@@ -85,6 +109,25 @@ export function QueuePanel({
leading={<Codicon className="text-muted-foreground/70" name="comment" size="0.8rem" />}
trailing={
<>
+ {canExpand && (
+ <Tip label={isExpanded ? c.queueCollapse : c.queueExpand}>
+ <Button
+ aria-expanded={isExpanded}
+ aria-label={isExpanded ? c.queueCollapse : c.queueExpand}
+ className="size-5 rounded-md"
+ onClick={() => toggleExpanded(entry.id)}
+ size="icon-xs"
+ type="button"
+ variant="ghost"
+ >
+ <Codicon
+ className={cn('transition-transform', isExpanded && 'rotate-180')}
+ name="chevron-down"
+ size={iconSize.xs}
+ />
+ </Button>
+ </Tip>
+ )}
<Tip label={c.queueEdit}>
<Button
aria-label={c.queueEdit}
@@ -131,7 +174,14 @@ export function QueuePanel({
trailingVisible={isEditing}
>
<div className="min-w-0 flex-1">
- <p className="truncate text-[0.73rem] leading-4 text-foreground/92">{entryPreview(entry, c)}</p>
+ <p
+ className={cn(
+ 'text-[0.73rem] leading-4 text-foreground/92',
+ isExpanded ? 'max-h-40 overflow-y-auto whitespace-pre-wrap pr-1' : 'line-clamp-2 break-words'
+ )}
+ >
+ {preview}
+ </p>
{(attachmentsCount > 0 || isEditing) && (
<div className="mt-0.5 flex items-center gap-1.5 text-[0.64rem] text-muted-foreground/75">
{attachmentsCount > 0 && <span>{c.attachments(attachmentsCount)}</span>}
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index bce9a4dbe53..5a2f19837d1 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -2385,6 +2385,8 @@ export const ar = defineLocale({
restoredDraftNotice: 'تمت استعادة رسالتك غير المُرسلة',
restoredDraftUndo: 'تراجع',
queueEdit: 'تحرير الرسالة المجدولة',
+ queueExpand: 'توسيع',
+ queueCollapse: 'طي',
queueSendNext: 'إرسالها تاليا',
queueSteer: 'توجيه — تصحيح الدور الجاري فورا',
queueSend: 'إرسالها الآن',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index da8d5f34b17..d3a8eaab9f2 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -4285,6 +4285,8 @@ export const deOverrides = {
restoredDraftNotice: 'Ihre nicht gesendete Nachricht wurde wiederhergestellt',
restoredDraftUndo: 'Rückgängig',
queueEdit: 'Bearbeiten',
+ queueExpand: 'Ausklappen',
+ queueCollapse: 'Einklappen',
queueSendNext: 'Weiter',
queueSteer: 'Steuern — laufenden Turn jetzt umleiten',
queueSend: 'Senden',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index bd6fcf809f5..11636f2d3ba 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -3903,6 +3903,8 @@ export const en: Translations = {
restoredDraftNotice: 'Restored your unsent message',
restoredDraftUndo: 'Undo',
queueEdit: 'Edit',
+ queueExpand: 'Expand',
+ queueCollapse: 'Collapse',
queueSendNext: 'Next',
queueSteer: 'Steer — redirect the live turn now',
queueSend: 'Send',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index f674704cc85..ba75a9095ad 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -4276,6 +4276,8 @@ export const esOverrides = {
restoredDraftNotice: 'Se restauró tu mensaje sin enviar',
restoredDraftUndo: 'Deshacer',
queueEdit: 'Editar',
+ queueExpand: 'Expandir',
+ queueCollapse: 'Contraer',
queueSendNext: 'Próximo',
queueSteer: 'Redirigir — encauzar el turno en vivo ahora',
queueSend: 'Enviar',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index f02f6a2eda7..eb214b9446d 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -4296,6 +4296,8 @@ export const frOverrides = {
restoredDraftNotice: 'Votre message non envoyé a été restauré',
restoredDraftUndo: 'Annuler',
queueEdit: 'Modifier',
+ queueExpand: 'Déplier',
+ queueCollapse: 'Replier',
queueSendNext: 'Suivant',
queueSteer: 'Diriger — réorienter maintenant le tour en cours',
queueSend: 'Envoyer',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 32ae5817954..73a49ffb528 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -2797,6 +2797,8 @@ export const ja = defineLocale({
restoredDraftNotice: '未送信のメッセージを復元しました',
restoredDraftUndo: '元に戻す',
queueEdit: '編集',
+ queueExpand: '展開',
+ queueCollapse: '折りたたむ',
queueSendNext: '次に送信',
queueSteer: 'ステア — 現在のターンを今すぐ修正',
queueSend: '送信',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index a226606dca5..de5c34e9621 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -3000,6 +3000,8 @@ export const ru = defineLocale({
restoredDraftNotice: 'Восстановлено ваше неотправленное сообщение',
restoredDraftUndo: 'Отменить',
queueEdit: 'Изменить',
+ queueExpand: 'Раскрыть',
+ queueCollapse: 'Свернуть',
queueSendNext: 'Дальше',
queueSteer: 'Направить — изменить текущий ход сейчас',
queueSend: 'Отправить',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 50f66e29171..030c54e6220 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -3224,6 +3224,8 @@ export interface Translations {
restoredDraftNotice: string
restoredDraftUndo: string
queueEdit: string
+ queueExpand: string
+ queueCollapse: string
queueSendNext: string
queueSend: string
queueSteer: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index ce957173e23..8a862343379 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -3009,6 +3009,8 @@ export const zhHant = defineLocale({
restoredDraftNotice: '已還原你未送出的訊息',
restoredDraftUndo: '復原',
queueEdit: '編輯',
+ queueExpand: '展開',
+ queueCollapse: '收起',
queueSendNext: '下一個',
queueSteer: '引導 — 立即修正目前回合',
queueSend: '傳送',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index caeaec62178..e55d94d0831 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -3670,6 +3670,8 @@ export const zh = defineLocale({
restoredDraftNotice: '已恢复你未发送的消息',
restoredDraftUndo: '撤销',
queueEdit: '编辑',
+ queueExpand: '展开',
+ queueCollapse: '收起',
queueSendNext: '下一个',
queueSteer: '引导 — 立即修正当前回合',
queueSend: '发送',