1- import { memo , useEffect , useRef , useState } from "react"
1+ import { memo , useEffect , useRef , useState , useMemo } from "react"
22import { useTranslation } from "react-i18next"
33import { useCloudUpsell } from "@src/hooks/useCloudUpsell"
44import { CloudUpsellDialog } from "@src/components/cloud/CloudUpsellDialog"
@@ -10,7 +10,8 @@ import {
1010 Coins ,
1111 HardDriveDownload ,
1212 HardDriveUpload ,
13- FoldVerticalIcon ,
13+ FoldVertical ,
14+ Globe ,
1415} from "lucide-react"
1516import prettyBytes from "pretty-bytes"
1617
@@ -21,9 +22,10 @@ import { findLastIndex } from "@roo/array"
2122
2223import { formatLargeNumber } from "@src/utils/format"
2324import { cn } from "@src/lib/utils"
24- import { StandardTooltip } from "@src/components/ui"
25+ import { StandardTooltip , Button } from "@src/components/ui"
2526import { useExtensionState } from "@src/context/ExtensionStateContext"
2627import { useSelectedModel } from "@/components/ui/hooks/useSelectedModel"
28+ import { vscode } from "@src/utils/vscode"
2729
2830import Thumbnails from "../common/Thumbnails"
2931
@@ -59,7 +61,7 @@ const TaskHeader = ({
5961 todos,
6062} : TaskHeaderProps ) => {
6163 const { t } = useTranslation ( )
62- const { apiConfiguration, currentTaskItem, clineMessages } = useExtensionState ( )
64+ const { apiConfiguration, currentTaskItem, clineMessages, isBrowserSessionActive } = useExtensionState ( )
6365 const { id : modelId , info : model } = useSelectedModel ( apiConfiguration )
6466 const [ isTaskExpanded , setIsTaskExpanded ] = useState ( false )
6567 const [ showLongRunningTaskMessage , setShowLongRunningTaskMessage ] = useState ( false )
@@ -95,14 +97,29 @@ const TaskHeader = ({
9597 const textRef = useRef < HTMLDivElement > ( null )
9698 const contextWindow = model ?. contextWindow || 1
9799
100+ // Detect if this task had any browser session activity so we can show a grey globe when inactive
101+ const browserSessionStartIndex = useMemo ( ( ) => {
102+ const msgs = clineMessages || [ ]
103+ for ( let i = 0 ; i < msgs . length ; i ++ ) {
104+ const m = msgs [ i ] as any
105+ if ( m ?. ask === "browser_action_launch" ) return i
106+ if ( m ?. say === "browser_session_status" && typeof m . text === "string" && m . text . includes ( "opened" ) ) {
107+ return i
108+ }
109+ }
110+ return - 1
111+ } , [ clineMessages ] )
112+
113+ const showBrowserGlobe = browserSessionStartIndex !== - 1 || ! ! isBrowserSessionActive
114+
98115 const condenseButton = (
99- < LucideIconButton
100- title = { t ( "chat:task.condenseContext" ) }
101- icon = { FoldVerticalIcon }
102- disabled = { buttonsDisabled }
103- onClick = { ( ) => currentTaskItem && handleCondenseContext ( currentTaskItem . id ) }
104- />
105- )
116+ < LucideIconButton
117+ title = { t ( "chat:task.condenseContext" ) }
118+ icon = { FoldVertical }
119+ disabled = { buttonsDisabled }
120+ onClick = { ( ) => currentTaskItem && handleCondenseContext ( currentTaskItem . id ) }
121+ />
122+ )
106123
107124 const hasTodos = todos && Array . isArray ( todos ) && todos . length > 0
108125
@@ -355,6 +372,41 @@ const TaskHeader = ({
355372 ) }
356373 { /* Todo list - always shown at bottom when todos exist */ }
357374 { hasTodos && < TodoListDisplay todos = { todos ?? ( task as any ) ?. tool ?. todos ?? [ ] } /> }
375+
376+ { /* Browser session status moved from bottom bar to header (bottom-right) */ }
377+ { showBrowserGlobe && (
378+ < div
379+ className = "absolute bottom-2 right-3 flex items-center gap-1"
380+ onClick = { ( e ) => e . stopPropagation ( ) } >
381+ < StandardTooltip content = { t ( "chat:browser.session" ) } >
382+ < Button
383+ variant = "ghost"
384+ size = "sm"
385+ aria-label = { t ( "chat:browser.session" ) }
386+ onClick = { ( ) => vscode . postMessage ( { type : "openBrowserSessionPanel" } as any ) }
387+ className = { cn (
388+ "relative h-5 w-5 p-0" ,
389+ "text-vscode-foreground opacity-85" ,
390+ "hover:opacity-100 hover:bg-[rgba(255,255,255,0.03)]" ,
391+ "focus:outline-none focus-visible:ring-1 focus-visible:ring-vscode-focusBorder" ,
392+ ) } >
393+ < Globe
394+ className = "w-4 h-4"
395+ style = { {
396+ color : isBrowserSessionActive
397+ ? "#4ade80"
398+ : "var(--vscode-descriptionForeground)" ,
399+ } }
400+ />
401+ </ Button >
402+ </ StandardTooltip >
403+ { isBrowserSessionActive && (
404+ < span className = "text-sm font-medium" style = { { color : "var(--vscode-testing-iconPassed)" } } >
405+ Active
406+ </ span >
407+ ) }
408+ </ div >
409+ ) }
358410 </ div >
359411 < CloudUpsellDialog open = { isOpen } onOpenChange = { closeUpsell } onConnect = { handleConnect } />
360412 </ div >
0 commit comments