@@ -23,6 +23,7 @@ import { getDefaultCharacters, type SpinnerMode } from './Spinner/index.js';
2323import { SpinnerAnimationRow } from './Spinner/SpinnerAnimationRow.js' ;
2424import { useSettings } from '../hooks/useSettings.js' ;
2525import { isInProcessTeammateTask } from '../tasks/InProcessTeammateTask/types.js' ;
26+ import { isLocalAgentTask } from '../tasks/LocalAgentTask/LocalAgentTask.js' ;
2627import { isBackgroundTask } from '../tasks/types.js' ;
2728import { getAllInProcessTeammateTasks } from '../tasks/InProcessTeammateTask/InProcessTeammateTask.js' ;
2829import { getEffortSuffix } from '../utils/effort.js' ;
@@ -209,15 +210,22 @@ function SpinnerWithVerbInner({
209210 const hasRunningTeammates = runningTeammates . length > 0 ;
210211 const allIdle = hasRunningTeammates && runningTeammates . every ( t => t . isIdle ) ;
211212
212- // Gather aggregate token stats from all running swarm teammates
213- // In spinner-tree mode, skip aggregation (teammates have their own lines in the tree)
213+ // Gather aggregate token stats from all running agents.
214+ // In spinner-tree mode, skip in-process teammates (they have their own
215+ // per-teammate lines in the tree) but still count local-agent tasks
216+ // (background agents) which have no dedicated tree rows.
214217 let teammateTokens = 0 ;
215- if ( ! showSpinnerTree ) {
216- for ( const task of Object . values ( tasks ) ) {
217- if ( isInProcessTeammateTask ( task ) && task . status === 'running' ) {
218- if ( task . progress ?. tokenCount ) {
219- teammateTokens += task . progress . tokenCount ;
220- }
218+ for ( const task of Object . values ( tasks ) ) {
219+ if ( task . status !== 'running' ) continue ;
220+ if ( isInProcessTeammateTask ( task ) ) {
221+ if ( ! showSpinnerTree && task . progress ?. tokenCount ) {
222+ teammateTokens += task . progress . tokenCount ;
223+ }
224+ continue ;
225+ }
226+ if ( isLocalAgentTask ( task ) ) {
227+ if ( task . progress ?. tokenCount ) {
228+ teammateTokens += task . progress . tokenCount ;
221229 }
222230 }
223231 }
0 commit comments