@@ -6,11 +6,12 @@ import removeMd from "remove-markdown"
66import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
77import useSound from "use-sound"
88import { LRUCache } from "lru-cache"
9+ import { useTranslation } from "react-i18next"
910
1011import { useDebounceEffect } from "@src/utils/useDebounceEffect"
1112import { appendImages } from "@src/utils/imageUtils"
1213
13- import type { ClineAsk , ClineMessage } from "@roo-code/types"
14+ import type { ClineAsk , ClineMessage , QueuedMessage } from "@roo-code/types"
1415
1516import { ClineSayBrowserAction , ClineSayTool , ExtensionMessage } from "@roo/ExtensionMessage"
1617import { McpServer , McpTool } from "@roo/mcp"
@@ -22,6 +23,7 @@ import { getApiMetrics } from "@roo/getApiMetrics"
2223import { AudioType } from "@roo/WebviewMessage"
2324import { getAllModes } from "@roo/modes"
2425import { ProfileValidator } from "@roo/ProfileValidator"
26+ import { getLatestTodo } from "@roo/todo"
2527
2628import { vscode } from "@src/utils/vscode"
2729import {
@@ -30,16 +32,15 @@ import {
3032 findLongestPrefixMatch ,
3133 parseCommand ,
3234} from "@src/utils/command-validation"
33- import { useTranslation } from "react-i18next"
3435import { useAppTranslation } from "@src/i18n/TranslationContext"
3536import { useExtensionState } from "@src/context/ExtensionStateContext"
37+ import { useAutoApprovalState } from "@src/hooks/useAutoApprovalState"
38+ import { useAutoApprovalToggles } from "@src/hooks/useAutoApprovalToggles"
3639import { useSelectedModel } from "@src/components/ui/hooks/useSelectedModel"
3740import RooHero from "@src/components/welcome/RooHero"
3841import RooTips from "@src/components/welcome/RooTips"
3942import RooCloudCTA from "@src/components/welcome/RooCloudCTA"
4043import { StandardTooltip } from "@src/components/ui"
41- import { useAutoApprovalState } from "@src/hooks/useAutoApprovalState"
42- import { useAutoApprovalToggles } from "@src/hooks/useAutoApprovalToggles"
4344
4445import TelemetryBanner from "../common/TelemetryBanner"
4546import VersionIndicator from "../common/VersionIndicator"
@@ -55,8 +56,6 @@ import SystemPromptWarning from "./SystemPromptWarning"
5556import ProfileViolationWarning from "./ProfileViolationWarning"
5657import { CheckpointWarning } from "./CheckpointWarning"
5758import QueuedMessages from "./QueuedMessages"
58- import { getLatestTodo } from "@roo/todo"
59- import { QueuedMessage } from "@roo-code/types"
6059
6160export interface ChatViewProps {
6261 isHidden : boolean
@@ -164,7 +163,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
164163 const retryCountRef = useRef < Map < string , number > > ( new Map ( ) )
165164 const MAX_RETRY_ATTEMPTS = 3
166165
167- // we need to hold on to the ask because useEffect > lastMessage will always let us know when an ask comes in and handle it, but by the time handleMessage is called, the last message might not be the ask anymore (it could be a say that followed)
166+ // We need to hold on to the ask because useEffect > lastMessage will always
167+ // let us know when an ask comes in and handle it, but by the time
168+ // handleMessage is called, the last message might not be the ask anymore
169+ // (it could be a say that followed).
168170 const [ clineAsk , setClineAsk ] = useState < ClineAsk | undefined > ( undefined )
169171 const [ enableButtons , setEnableButtons ] = useState < boolean > ( false )
170172 const [ primaryButtonText , setPrimaryButtonText ] = useState < string | undefined > ( undefined )
@@ -209,13 +211,16 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
209211 [ apiConfiguration , organizationAllowList ] ,
210212 )
211213
212- // UI layout depends on the last 2 messages
213- // (since it relies on the content of these messages, we are deep comparing. i.e. the button state after hitting button sets enableButtons to false, and this effect otherwise would have to true again even if messages didn't change
214+ // UI layout depends on the last 2 messages (since it relies on the content
215+ // of these messages, we are deep comparing. i.e. the button state after
216+ // hitting button sets enableButtons to false, and this effect otherwise
217+ // would have to true again even if messages didn't change.
214218 const lastMessage = useMemo ( ( ) => messages . at ( - 1 ) , [ messages ] )
215219 const secondLastMessage = useMemo ( ( ) => messages . at ( - 2 ) , [ messages ] )
216220
217- // Setup sound hooks with use-sound
221+ // Setup sound hooks with use-sound.
218222 const volume = typeof soundVolume === "number" ? soundVolume : 0.5
223+
219224 const soundConfig = {
220225 volume,
221226 // useSound expects 'disabled' property, not 'soundEnabled'
@@ -449,11 +454,13 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
449454 clearTimeout ( autoApproveTimeoutRef . current )
450455 autoApproveTimeoutRef . current = null
451456 }
457+
452458 // Reset user response flag for new task
453459 userRespondedRef . current = false
454460
455461 // Clear message queue when starting a new task
456462 setMessageQueue ( [ ] )
463+
457464 // Clear retry counts
458465 retryCountRef . current . clear ( )
459466 } , [ task ?. ts ] )
@@ -583,6 +590,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
583590 setSelectedImages ( [ ] )
584591 return
585592 }
593+
586594 // Mark that user has responded - this prevents any pending auto-approvals
587595 userRespondedRef . current = true
588596
0 commit comments