@@ -1719,18 +1719,23 @@ function ToolPart(props: { part: SessionMessageAssistantTool }) {
17191719 const ctx = use ( )
17201720 const data = useData ( )
17211721 const display = createMemo ( ( ) => toolDisplay ( props . part . name ) )
1722- const runningShell = createMemo (
1723- ( ) => {
1724- if ( display ( ) !== "shell" || props . part . state . status === "pending" ) return false
1722+ const activeBackgroundWork = createMemo ( ( ) => {
1723+ if ( props . part . state . status === "pending" ) return false
1724+ if ( display ( ) === "shell" ) {
17251725 const shellID = stringValue ( props . part . state . structured . shellID )
17261726 return Boolean ( shellID && data . shell . get ( shellID ) )
1727- } ,
1728- )
1727+ }
1728+ if ( display ( ) === "subagent" ) {
1729+ const sessionID = stringValue ( props . part . state . structured . sessionID ) ?? stringValue ( props . part . state . structured . sessionId )
1730+ return Boolean ( sessionID && data . session . status ( sessionID ) === "running" )
1731+ }
1732+ return false
1733+ } )
17291734
17301735 // Hide tool if showDetails is false and tool completed successfully
17311736 const shouldHide = createMemo ( ( ) => {
17321737 if ( ctx . showDetails ( ) ) return false
1733- if ( runningShell ( ) ) return false
1738+ if ( activeBackgroundWork ( ) ) return false
17341739 if ( props . part . state . status !== "completed" ) return false
17351740 if ( display ( ) === "shell" ) return false
17361741 return true
@@ -1755,9 +1760,6 @@ function ToolPart(props: { part: SessionMessageAssistantTool }) {
17551760 get part ( ) {
17561761 return props . part
17571762 } ,
1758- get runningShell ( ) {
1759- return runningShell ( )
1760- } ,
17611763 }
17621764
17631765 return (
@@ -1788,7 +1790,7 @@ function ToolPart(props: { part: SessionMessageAssistantTool }) {
17881790 < Edit { ...toolprops } />
17891791 </ Match >
17901792 < Match when = { display ( ) === "subagent" } >
1791- < Task { ...toolprops } />
1793+ < Subagent { ...toolprops } />
17921794 </ Match >
17931795 < Match when = { display ( ) === "apply_patch" } >
17941796 < ApplyPatch { ...toolprops } />
@@ -1816,7 +1818,6 @@ type ToolProps = {
18161818 tool : string
18171819 output ?: string
18181820 part : SessionMessageAssistantTool
1819- runningShell ?: boolean
18201821}
18211822function GenericTool ( props : ToolProps ) {
18221823 const { theme } = useTheme ( )
@@ -2062,7 +2063,11 @@ function Shell(props: ToolProps) {
20622063 return request ?. source ?. type === "tool" && request . source . callID === props . part . id
20632064 } )
20642065 const color = createMemo ( ( ) => ( permission ( ) ? theme . warning : theme . text ) )
2065- const isRunning = createMemo ( ( ) => props . part . state . status === "running" || props . runningShell === true )
2066+ const isRunning = createMemo ( ( ) => {
2067+ if ( props . part . state . status === "running" ) return true
2068+ const shellID = stringValue ( props . metadata . shellID )
2069+ return Boolean ( shellID && data . shell . get ( shellID ) )
2070+ } )
20662071 const command = createMemo ( ( ) => stringValue ( props . input . command ) )
20672072 const output = createMemo ( ( ) => {
20682073 if ( props . part . state . status === "pending" ) return ""
@@ -2225,15 +2230,20 @@ function WebSearch(props: ToolProps) {
22252230 )
22262231}
22272232
2228- function Task ( props : ToolProps ) {
2233+ function Subagent ( props : ToolProps ) {
22292234 const { navigate } = useRoute ( )
2235+ const data = useData ( )
22302236 const sessionID = createMemo ( ( ) => stringValue ( props . metadata . sessionID ) ?? stringValue ( props . metadata . sessionId ) )
22312237 const description = createMemo ( ( ) => stringValue ( props . input . description ) )
2238+ const isRunning = createMemo ( ( ) => {
2239+ const id = sessionID ( )
2240+ return props . part . state . status === "running" || Boolean ( id && data . session . status ( id ) === "running" )
2241+ } )
22322242
22332243 return (
22342244 < InlineTool
2235- icon = { props . part . state . status === "completed" ? "✓" : "│" }
2236- spinner = { props . part . state . status === "running" }
2245+ icon = { isRunning ( ) ? "│" : props . part . state . status === "completed" ? "✓" : "│" }
2246+ spinner = { isRunning ( ) }
22372247 complete = { description ( ) }
22382248 pending = "Delegating..."
22392249 part = { props . part }
0 commit comments