@@ -464,68 +464,113 @@ function selectActivityRow(state: FooterState): FooterActivityRowViewModel {
464464 } ) ;
465465}
466466
467- function selectStatusItems (
467+ function selectStatusItemParts (
468468 state : FooterState ,
469469 clockMs : number ,
470470 statusLine : StatusLineConfig ,
471- ) : string [ ] {
472- const items : string [ ] = [ ] ;
471+ ) : {
472+ readonly update : string | null ;
473+ readonly model : string | null ;
474+ readonly speed : string | null ;
475+ readonly spend : string | null ;
476+ readonly context : string | null ;
477+ readonly git : string | null ;
478+ readonly modes : string | null ;
479+ readonly elapsed : string | null ;
480+ readonly goal : string | null ;
481+ readonly background : readonly string [ ] ;
482+ } {
473483 const update = formatUpdate ( state . update ) ;
474- if ( update !== null ) items . push ( update ) ;
475- const model = normalizeSingleLine ( state . status . model ) ;
476- if ( statusLine . showModel && model . length > 0 ) {
484+ const modelName = normalizeSingleLine ( state . status . model ) ;
485+ const speed = statusLine . showTokenSpeed ? formatTokenSpeed ( state . status ) : null ;
486+ let model : string | null = null ;
487+ if ( statusLine . showModel && modelName . length > 0 ) {
477488 const effortSuffix =
478489 statusLine . showEffort && state . status . thinkingLevel !== 'off'
479490 ? ` · ${ shortEffortLabel ( state . status . thinkingLevel ) } `
480491 : '' ;
481492 // Fast rides on the model item and only while mode badges are visible,
482493 // so it can never appear twice in the row.
483494 const fastSuffix = statusLine . showModes && state . status . fastMode ? ' · ↯ fast' : '' ;
484- const speed = statusLine . showTokenSpeed ? formatTokenSpeed ( state . status ) : null ;
485- items . push ( `${ model } ${ effortSuffix } ${ fastSuffix } ${ speed === null ? '' : ` · ${ speed } ` } ` ) ;
486- }
487-
488- if ( statusLine . showModel ) {
489- const spend = formatSessionSpend ( state . status . sessionSpendUsd ) ;
490- if ( spend !== null ) items . push ( spend ) ;
491- }
492-
493- if ( statusLine . showContextBar ) items . push ( formatContext ( state . status ) ) ;
494-
495- if ( statusLine . showGit ) {
496- const git = formatGitStatus ( state . status . git ) ;
497- if ( git !== null ) items . push ( git ) ;
495+ model = `${ modelName } ${ effortSuffix } ${ fastSuffix } ${ speed === null ? '' : ` · ${ speed } ` } ` ;
498496 }
499497
498+ let modes : string | null = null ;
500499 if ( statusLine . showModes ) {
501- const modes : string [ ] = [ ] ;
502- if ( state . status . dynamicWorkflowMode ) modes . push ( 'workflow' ) ;
503- if ( state . status . permissionMode === 'auto' ) modes . push ( 'auto' ) ;
504- if ( state . status . planMode ) modes . push ( 'plan' ) ;
505- if ( modes . length > 0 ) items . push ( modes . join ( ' ' ) ) ;
506- }
507-
508- if ( statusLine . showElapsed && state . status . elapsedMs !== null ) {
509- items . push ( `elapsed ${ formatStatusElapsed ( state . status . elapsedMs ) } ` ) ;
510- }
511-
512- if ( statusLine . showGoal ) {
513- const goal = formatGoal ( state . goal , clockMs ) ;
514- if ( goal !== null ) items . push ( goal ) ;
500+ const modeItems : string [ ] = [ ] ;
501+ if ( state . status . dynamicWorkflowMode ) modeItems . push ( 'workflow' ) ;
502+ if ( state . status . permissionMode === 'auto' ) modeItems . push ( 'auto' ) ;
503+ if ( state . status . planMode ) modeItems . push ( 'plan' ) ;
504+ if ( modeItems . length > 0 ) modes = modeItems . join ( ' ' ) ;
515505 }
516506
507+ const background : string [ ] = [ ] ;
517508 if ( statusLine . showBackgroundTasks ) {
518509 const bashTasks = nonNegativeInteger ( state . background . bashTasks ) ;
519510 if ( bashTasks > 0 ) {
520- items . push ( `[${ String ( bashTasks ) } ${ plural ( bashTasks , 'task' ) } running]` ) ;
511+ background . push ( `[${ String ( bashTasks ) } ${ plural ( bashTasks , 'task' ) } running]` ) ;
521512 }
522513 const agentTasks = nonNegativeInteger ( state . background . agentTasks ) ;
523514 if ( agentTasks > 0 ) {
524- items . push (
515+ background . push (
525516 `[${ String ( agentTasks ) } ${ plural ( agentTasks , 'agent' ) } running]` ,
526517 ) ;
527518 }
528519 }
520+
521+ return {
522+ update,
523+ model,
524+ speed,
525+ spend : statusLine . showModel ? formatSessionSpend ( state . status . sessionSpendUsd ) : null ,
526+ context : statusLine . showContextBar ? formatContext ( state . status ) : null ,
527+ git : statusLine . showGit ? formatGitStatus ( state . status . git ) : null ,
528+ modes,
529+ elapsed :
530+ statusLine . showElapsed && state . status . elapsedMs !== null
531+ ? `elapsed ${ formatStatusElapsed ( state . status . elapsedMs ) } `
532+ : null ,
533+ goal : statusLine . showGoal ? formatGoal ( state . goal , clockMs ) : null ,
534+ background,
535+ } ;
536+ }
537+
538+ function selectStatusItems (
539+ state : FooterState ,
540+ clockMs : number ,
541+ statusLine : StatusLineConfig ,
542+ ) : string [ ] {
543+ const parts = selectStatusItemParts ( state , clockMs , statusLine ) ;
544+ const items = [
545+ parts . update ,
546+ parts . model ,
547+ parts . spend ,
548+ parts . context ,
549+ parts . git ,
550+ parts . modes ,
551+ parts . elapsed ,
552+ parts . goal ,
553+ ] . filter ( ( item ) : item is string => item !== null ) ;
554+ items . push ( ...parts . background ) ;
555+ return items ;
556+ }
557+
558+ export function selectStatusBarExtras (
559+ state : FooterState ,
560+ clockMs : number ,
561+ statusLine : StatusLineConfig ,
562+ ) : string [ ] {
563+ const parts = selectStatusItemParts ( state , clockMs , statusLine ) ;
564+ const items = [
565+ parts . update ,
566+ parts . speed ,
567+ parts . spend ,
568+ parts . context ,
569+ parts . git ,
570+ parts . elapsed ,
571+ parts . goal ,
572+ ] . filter ( ( item ) : item is string => item !== null ) ;
573+ items . push ( ...parts . background ) ;
529574 return items ;
530575}
531576
0 commit comments