import { ListPlus, X } from 'lucide-react' import type { FC } from 'react' import { Queue, QueueItem, QueueItemAction, QueueItemActions, QueueItemAttachment, QueueItemContent, QueueItemFile, QueueItemImage, QueueList, QueueSection, QueueSectionContent, QueueSectionLabel, QueueSectionTrigger, } from '@/components/ai-elements/queue' import type { HarnessQueuedMessage, HarnessQueuedMessageAttachment, } from '@/entrypoints/app/agents/agent-harness-types' import { firstNonBlankLine } from '@/entrypoints/app/agents/agent-row/agent-row.helpers' interface QueuePanelProps { queue: HarnessQueuedMessage[] onRemove: (messageId: string) => void } /** * Renders the agent's pending message queue using the shared AI * Elements `Queue` primitives. Caller is expected to gate render on * `queue.length > 0` — when empty, this returns null so the panel * disappears cleanly between turns. */ export const QueuePanel: FC = ({ queue, onRemove }) => { if (queue.length === 0) return null return ( } /> {queue.map((entry) => (
{firstNonBlankLine(entry.message)} onRemove(entry.id)} >
{entry.attachments && entry.attachments.length > 0 ? ( {entry.attachments.map((attachment, idx) => renderAttachment(entry.id, attachment, idx), )} ) : null}
))}
) } function renderAttachment( messageId: string, attachment: HarnessQueuedMessageAttachment, idx: number, ) { if (attachment.mediaType.startsWith('image/')) { const src = `data:${attachment.mediaType};base64,${attachment.data}` return } return ( {attachment.mediaType} ) }