@@ -100,6 +100,35 @@ export function Prompt(props: PromptProps) {
100100 const dialog = useDialog ( )
101101 const toast = useToast ( )
102102 const status = createMemo ( ( ) => sync . data . session_status ?. [ props . sessionID ?? "" ] ?? { type : "idle" } )
103+ const subagents = createMemo ( ( ) => {
104+ if ( ! props . sessionID ) return { total : 0 , active : 0 }
105+ const byParent = new Map < string , ( typeof sync . data . session ) [ number ] [ ] > ( )
106+ for ( const s of sync . data . session ) {
107+ if ( ! s . parentID ) continue
108+ const list = byParent . get ( s . parentID ) ?? [ ]
109+ list . push ( s )
110+ byParent . set ( s . parentID , list )
111+ }
112+ const descendants : ( typeof sync . data . session ) [ number ] [ ] = [ ]
113+ const queue = [ props . sessionID ]
114+ const visited = new Set < string > ( )
115+ while ( queue . length > 0 ) {
116+ const pid = queue . pop ( ) !
117+ if ( visited . has ( pid ) ) continue
118+ visited . add ( pid )
119+ const children = byParent . get ( pid )
120+ if ( ! children ) continue
121+ for ( const c of children ) {
122+ descendants . push ( c )
123+ queue . push ( c . id )
124+ }
125+ }
126+ const active = descendants . filter ( ( d ) => {
127+ const st = sync . data . session_status [ d . id ] ?. type
128+ return st === "busy" || st === "retry"
129+ } ) . length
130+ return { total : descendants . length , active }
131+ } )
103132 const history = usePromptHistory ( )
104133 const stash = usePromptStash ( )
105134 const command = useCommandDialog ( )
@@ -1350,6 +1379,12 @@ export function Prompt(props: PromptProps) {
13501379 </ Switch >
13511380 < text fg = { theme . text } >
13521381 { keybind . print ( "command_list" ) } < span style = { { fg : theme . textMuted } } > commands</ span >
1382+ < Show when = { subagents ( ) . total > 0 } >
1383+ < span style = { { fg : subagents ( ) . active > 0 ? theme . warning : theme . textMuted } } >
1384+ { subagents ( ) . active > 0 ? " ⚡" : " " }
1385+ { subagents ( ) . active } /{ subagents ( ) . total } sub agents
1386+ </ span >
1387+ </ Show >
13531388 </ text >
13541389 </ Match >
13551390 < Match when = { store . mode === "shell" } >
0 commit comments