1- import { useCallback , useEffect , useMemo , useRef , useState } from 'react'
21import { useKeyboard } from '@opentui/react'
2+ import { useCallback , useEffect , useMemo , useRef , useState } from 'react'
33import { useShallow } from 'zustand/react/shallow'
44
55import { routeUserPrompt } from './commands/router'
6- import { MessageWithAgents } from './components/message-with-agents'
7- import { useFeedbackStore } from './state/feedback-store'
8- import type { MultilineInputHandle } from './components/multiline-input'
6+ import { AnnouncementBanner } from './components/announcement-banner'
97import { ChatInputBar } from './components/chat-input-bar'
10- import { getStatusIndicatorState } from './utils/status-indicator-state '
8+ import { MessageWithAgents } from './components/message-with-agents '
119import { StatusBar } from './components/status-bar'
1210import { SLASH_COMMANDS } from './data/slash-commands'
1311import { useAgentValidation } from './hooks/use-agent-validation'
@@ -20,26 +18,26 @@ import { useInputHistory } from './hooks/use-input-history'
2018import { useKeyboardHandlers } from './hooks/use-keyboard-handlers'
2119import { useMessageQueue } from './hooks/use-message-queue'
2220import { useMessageVirtualization } from './hooks/use-message-virtualization'
21+ import { useQueueControls } from './hooks/use-queue-controls'
22+ import { useQueueUi } from './hooks/use-queue-ui'
2323import { useChatScrollbox } from './hooks/use-scroll-management'
2424import { useSendMessage } from './hooks/use-send-message'
2525import { useSuggestionEngine } from './hooks/use-suggestion-engine'
2626import { useSuggestionMenuHandlers } from './hooks/use-suggestion-menu-handlers'
2727import { useTerminalDimensions } from './hooks/use-terminal-dimensions'
2828import { useTheme } from './hooks/use-theme'
2929import { useValidationBanner } from './hooks/use-validation-banner'
30- import { useQueueUi } from './hooks/use-queue-ui'
31- import { useQueueControls } from './hooks/use-queue-controls'
32- import { logger } from './utils/logger'
33- import { AnalyticsEvent } from '@codebuff/common/constants/analytics-events'
3430import { useChatStore } from './state/chat-store'
31+ import { useFeedbackStore } from './state/feedback-store'
3532import { createChatScrollAcceleration } from './utils/chat-scroll-accel'
3633import { loadLocalAgents } from './utils/local-agent-registry'
3734import { buildMessageTree } from './utils/message-tree-utils'
35+ import { getStatusIndicatorState } from './utils/status-indicator-state'
3836import { computeInputLayoutMetrics } from './utils/text-layout'
3937import { createMarkdownPalette } from './utils/theme-system'
40- import { BORDER_CHARS } from './utils/ui-constants'
4138
42- import type { ChatMessage , ContentBlock } from './types/chat'
39+ import type { MultilineInputHandle } from './components/multiline-input'
40+ import type { ContentBlock } from './types/chat'
4341import type { SendMessageFn } from './types/contracts/send-message'
4442import type { User } from './utils/auth'
4543import type { FileTreeNode } from '@codebuff/common/util/file'
@@ -120,6 +118,8 @@ export const Chat = ({
120118 resetChatStore,
121119 sessionCreditsUsed,
122120 setRunState,
121+ isAnnouncementVisible,
122+ setIsAnnouncementVisible,
123123 } = useChatStore (
124124 useShallow ( ( store ) => ( {
125125 inputValue : store . inputValue ,
@@ -153,6 +153,8 @@ export const Chat = ({
153153 resetChatStore : store . reset ,
154154 sessionCreditsUsed : store . sessionCreditsUsed ,
155155 setRunState : store . setRunState ,
156+ isAnnouncementVisible : store . isAnnouncementVisible ,
157+ setIsAnnouncementVisible : store . setIsAnnouncementVisible ,
156158 } ) ) ,
157159 )
158160
@@ -290,7 +292,7 @@ export const Chat = ({
290292
291293 return block
292294 } )
293-
295+
294296 // Return original array reference if nothing changed
295297 return foundTarget ? result : blocks
296298 }
@@ -329,7 +331,7 @@ export const Chat = ({
329331 const contentHeight = scrollbox . scrollHeight
330332 const viewportHeight = scrollbox . viewport . height
331333 const isOverflowing = contentHeight > viewportHeight
332-
334+
333335 // Only update state if overflow status actually changed
334336 if ( hasOverflowRef . current !== isOverflowing ) {
335337 hasOverflowRef . current = isOverflowing
@@ -346,8 +348,6 @@ export const Chat = ({
346348 }
347349 } , [ ] )
348350
349-
350-
351351 const inertialScrollAcceleration = useMemo (
352352 ( ) => createChatScrollAcceleration ( ) ,
353353 [ ] ,
@@ -850,7 +850,10 @@ export const Chat = ({
850850 stickyStart = "bottom"
851851 scrollX = { false }
852852 scrollbarOptions = { { visible : false } }
853- verticalScrollbarOptions = { { visible : ! isStreaming && hasOverflow , trackOptions : { width : 1 } } }
853+ verticalScrollbarOptions = { {
854+ visible : ! isStreaming && hasOverflow ,
855+ trackOptions : { width : 1 } ,
856+ } }
854857 { ...appliedScrollboxProps }
855858 style = { {
856859 flexGrow : 1 ,
@@ -878,6 +881,10 @@ export const Chat = ({
878881 } ,
879882 } }
880883 >
884+ { isAnnouncementVisible && (
885+ < AnnouncementBanner onClose = { ( ) => setIsAnnouncementVisible ( false ) } />
886+ ) }
887+
881888 { headerContent }
882889 { virtualizationNotice }
883890 { topLevelMessages . map ( ( message , idx ) => {
@@ -954,7 +961,6 @@ export const Chat = ({
954961 handleExitFeedback = { handleExitFeedback }
955962 handleSubmit = { handleSubmit }
956963 />
957-
958964 </ box >
959965
960966 { validationBanner }
0 commit comments