@@ -16,7 +16,6 @@ import {
1616 getStatusIndicatorState ,
1717} from './components/status-indicator'
1818import { SuggestionMenu } from './components/suggestion-menu'
19- import { Button } from './components/button'
2019import { SLASH_COMMANDS } from './data/slash-commands'
2120import { useAgentValidation } from './hooks/use-agent-validation'
2221import { useAuthState } from './hooks/use-auth-state'
@@ -44,6 +43,7 @@ import { buildMessageTree } from './utils/message-tree-utils'
4443import { computeInputLayoutMetrics } from './utils/text-layout'
4544import { createMarkdownPalette } from './utils/theme-system'
4645import { BORDER_CHARS } from './utils/ui-constants'
46+ import { Button } from './components/button'
4747
4848import type { ContentBlock } from './types/chat'
4949import type { SendMessageFn } from './types/contracts/send-message'
@@ -365,12 +365,17 @@ export const Chat = ({
365365 const {
366366 queuedMessages,
367367 streamStatus,
368+ queuePaused,
368369 streamMessageIdRef,
369370 addToQueue,
370371 startStreaming,
371372 stopStreaming,
372373 setStreamStatus,
373374 setCanProcessQueue,
375+ pauseQueue,
376+ resumeQueue,
377+ clearQueue,
378+ isQueuePausedRef,
374379 } = useMessageQueue (
375380 ( content : string ) =>
376381 sendMessageRef . current ?.( { content, agentMode } ) ?? Promise . resolve ( ) ,
@@ -414,6 +419,8 @@ export const Chat = ({
414419 lastMessageMode,
415420 setLastMessageMode,
416421 addSessionCredits,
422+ isQueuePausedRef,
423+ resumeQueue,
417424 } )
418425
419426 sendMessageRef . current = sendMessage
@@ -441,6 +448,7 @@ export const Chat = ({
441448 streamMessageIdRef,
442449 addToQueue,
443450 clearMessages,
451+ clearQueue,
444452 handleCtrlC,
445453 saveToHistory,
446454 scrollToLatest,
@@ -464,6 +472,9 @@ export const Chat = ({
464472 isChainInProgressRef ,
465473 scrollToLatest ,
466474 handleCtrlC ,
475+ clearQueue ,
476+ queuedMessages ,
477+ pauseQueue ,
467478 ] ,
468479 )
469480
@@ -496,6 +507,11 @@ export const Chat = ({
496507 navigateDown,
497508 toggleAgentMode,
498509 onCtrlC : handleCtrlC ,
510+ onInterrupt : ( ) => {
511+ if ( queuedMessages . length > 0 ) {
512+ pauseQueue ( )
513+ }
514+ } ,
499515 historyNavUpEnabled,
500516 historyNavDownEnabled,
501517 } )
@@ -524,12 +540,22 @@ export const Chat = ({
524540 </ text >
525541 ) : null
526542
527- const shouldShowQueuePreview = queuedMessages . length > 0
543+ const shouldShowQueuePreview = queuedMessages . length > 0 && ! queuePaused
528544 const queuePreviewTitle = useMemo ( ( ) => {
529545 if ( ! shouldShowQueuePreview ) return undefined
530546 const previewWidth = Math . max ( 30 , separatorWidth - 20 )
531547 return formatQueuedPreview ( queuedMessages , previewWidth )
532548 } , [ queuedMessages , separatorWidth , shouldShowQueuePreview ] )
549+
550+ const pausedQueueText = useMemo ( ( ) => {
551+ if ( ! queuePaused || queuedMessages . length === 0 ) return undefined
552+ const count = queuedMessages . length
553+ return `${ count } queued — your next message sends first`
554+ } , [ queuePaused , queuedMessages ] )
555+
556+ const handleClearQueue = useCallback ( ( ) => {
557+ clearQueue ( )
558+ } , [ clearQueue ] )
533559 const hasSlashSuggestions =
534560 slashContext . active && slashSuggestionItems . length > 0
535561 const hasMentionSuggestions =
@@ -836,6 +862,32 @@ export const Chat = ({
836862 ) }
837863 </ box >
838864 </ box >
865+
866+ { /* Paused queue indicator - fake bottom border continuation */ }
867+ { pausedQueueText && (
868+ < box style = { { width : '100%' } } >
869+ < box style = { { flexDirection : 'row' , alignItems : 'center' } } >
870+ < text style = { { wrapMode : 'none' , flexGrow : 1 } } >
871+ < span fg = { theme . warning } >
872+ { BORDER_CHARS . vertical } ⏸ { pausedQueueText }
873+ </ span >
874+ </ text >
875+ < Button onClick = { handleClearQueue } style = { { paddingRight : 1 } } >
876+ < text >
877+ < span fg = { theme . error } > ✕</ span >
878+ </ text >
879+ </ Button >
880+ < text style = { { wrapMode : 'none' } } >
881+ < span fg = { theme . warning } > { BORDER_CHARS . vertical } </ span >
882+ </ text >
883+ </ box >
884+ < text style = { { wrapMode : 'none' } } >
885+ < span fg = { theme . warning } >
886+ { BORDER_CHARS . bottomLeft } { BORDER_CHARS . horizontal . repeat ( separatorWidth - 2 ) } { BORDER_CHARS . bottomRight }
887+ </ span >
888+ </ text >
889+ </ box >
890+ ) }
839891 </ box >
840892
841893 { /* Login Modal Overlay - show when not authenticated and done checking */ }
0 commit comments