@@ -7,7 +7,7 @@ import { useLanguage } from "@/runtime/i18n/language"
77import { ServerConnection , serverName } from "@/runtime/server/registry"
88import { useGlobal } from "@/runtime/server/runtime"
99import { projectSettingsKey , useSettings } from "@/settings/model"
10- import { sessionRequests } from "@/shell/layout/project-avatar-state"
10+ import { sessionBackgroundShells , sessionRequests } from "@/shell/layout/project-avatar-state"
1111import { useLayout } from "@/shell/state/layout"
1212import { useTabs } from "@/shell/tabs/tabs"
1313import { sessionLastRunLabel , sessionTabTitle } from "./tab-title"
@@ -16,7 +16,7 @@ import { createSessionBranches } from "./session-branches"
1616import { pathKey } from "@/workspaces/path-key"
1717import "./active-sessions.css"
1818
19- /** The server-wide active index includes running sessions without an open tab, including child sessions. */
19+ /** Execution and collected Shell activity include sessions without an open tab, including child sessions. */
2020export function ActiveSessions ( ) {
2121 const global = useGlobal ( )
2222 const language = useLanguage ( )
@@ -37,7 +37,7 @@ export function ActiveSessions() {
3737
3838 if ( ! ctx || ctx . sdk . connection . status ( ) !== "connected" ) return [ ]
3939
40- return ctx . data . session . active ( ) . map ( ( id ) => ( {
40+ return [ ... new Set ( [ ... ctx . data . session . active ( ) , ... ctx . data . shell . activeSessions ( ) ] ) ] . map ( ( id ) => ( {
4141 key : JSON . stringify ( [ ServerConnection . key ( item . conn ) , id ] ) ,
4242 id,
4343 server : ServerConnection . key ( item . conn ) ,
@@ -117,8 +117,19 @@ export function ActiveSessions() {
117117 }
118118 const duration = ( ) => {
119119 const value = session ( )
120- return value ? workingDuration ( value , clock . now , language ) : undefined
120+ const starts = [
121+ ...( entry ( ) . ctx . data . session . status ( entry ( ) . id ) === "running" ? [ value ?. time . busy ?? 0 ] : [ ] ) ,
122+ ...shells ( ) . map ( ( shell ) => shell . time . started ) ,
123+ ] . filter ( ( time ) => time > 0 )
124+ return starts . length
125+ ? workingDuration ( { time : { busy : Math . min ( ...starts ) } } , clock . now , language )
126+ : undefined
121127 }
128+ const shells = ( ) => sessionBackgroundShells ( entry ( ) . ctx . data , entry ( ) . id )
129+ const background = ( ) =>
130+ entry ( ) . ctx . data . session . status ( entry ( ) . id ) !== "running" && shells ( ) . length > 0
131+ const summary = ( ) =>
132+ shells ( ) . length ? language . plural ( "sidebar.running.shells" , shells ( ) . length ) : undefined
122133
123134 const status = createMemo ( ( ) => {
124135 const value = entry ( )
@@ -155,6 +166,8 @@ export function ActiveSessions() {
155166 branch ( ) ,
156167 session ( ) ?. location . directory ,
157168 sessionLastRunLabel ( session ( ) ?. time , language ) ,
169+ summary ( ) ,
170+ ...shells ( ) . map ( ( shell ) => shell . command ) ,
158171 ]
159172 . filter ( Boolean )
160173 . join ( "\n" ) }
@@ -185,7 +198,13 @@ export function ActiveSessions() {
185198 : language . t ( `sidebar.inbox.status.${ status ( ) } ` )
186199 }
187200 >
188- < span class = "sr-only" > { language . t ( `sidebar.inbox.status.${ status ( ) } ` ) } </ span >
201+ < span class = "sr-only" >
202+ { language . t (
203+ background ( ) && status ( ) === "working"
204+ ? "sidebar.running.background"
205+ : `sidebar.inbox.status.${ status ( ) } ` ,
206+ ) }
207+ </ span >
189208 < span aria-hidden = "true" >
190209 { status ( ) === "working"
191210 ? ( duration ( ) ?? language . t ( "sidebar.inbox.status.working" ) )
@@ -196,6 +215,12 @@ export function ActiveSessions() {
196215 < Show when = { project ( ) } fallback = { language . t ( "common.loading" ) } >
197216 < span class = "min-w-0 truncate" > { projectName ( ) } </ span >
198217 </ Show >
218+ < Show when = { background ( ) } >
219+ < span aria-hidden = "true" > ·</ span >
220+ < span class = "truncate" title = { summary ( ) } >
221+ { language . t ( "sidebar.running.background" ) }
222+ </ span >
223+ </ Show >
199224 < Show when = { branch ( ) || worktree ( ) } >
200225 < span aria-hidden = "true" > ·</ span >
201226 < span class = "flex min-w-0 items-center gap-1" >
0 commit comments