77 */
88
99import { Show } from "solid-js"
10- import { useTerminalDimensions } from "@opentui/solid"
1110import { useTheme } from "@tui/shared/context/theme"
12- import { formatTokens , formatNumber } from "../../state/formatters"
1311import type { WorkflowStatus , AutonomousMode } from "../../state/types"
1412
1513export interface TelemetryBarProps {
1614 workflowName : string
1715 runtime : string
1816 status : WorkflowStatus
19- total : {
20- tokensIn : number
21- tokensOut : number
22- cached ?: number
23- }
2417 autonomousMode ?: AutonomousMode
2518}
2619
2720/**
2821 * Show workflow info, status, and total telemetry in footer
2922 */
30- // Compact threshold - below this width, use compact layout
31- const COMPACT_WIDTH = 80
32-
3323export function TelemetryBar ( props : TelemetryBarProps ) {
3424 const themeCtx = useTheme ( )
35- const dimensions = useTerminalDimensions ( )
36-
37- const isCompact = ( ) => ( dimensions ( ) ?. width ?? 80 ) < COMPACT_WIDTH
38-
39- const totalText = ( ) => {
40- const cached = props . total . cached ?? 0
41- const base = formatTokens ( props . total . tokensIn , props . total . tokensOut )
42- return cached > 0 ? `${ base } (${ formatNumber ( cached ) } cached)` : base
43- }
44-
45- // Compact token display - no "cached" info
46- const compactTokenText = ( ) => {
47- return formatTokens ( props . total . tokensIn , props . total . tokensOut )
48- }
4925
5026 const showStatus = ( ) => props . status === "awaiting" || props . status === "paused" || props . status === "stopped"
5127
@@ -75,12 +51,17 @@ export function TelemetryBar(props: TelemetryBarProps) {
7551 borderStyle = "rounded"
7652 borderColor = { themeCtx . theme . border }
7753 >
78- { /* Left side: workflow name, runtime, status, autonomous mode */ }
54+ { /* Left side: runtime */ }
55+ < box flexDirection = "row" flexShrink = { 0 } >
56+ < text fg = { themeCtx . theme . textMuted } > Runtime: </ text >
57+ < text fg = { themeCtx . theme . text } > { props . runtime } </ text >
58+ </ box >
59+
60+ { /* Right side: workflow name, status, autonomous mode */ }
7961 < box flexDirection = "row" flexShrink = { 1 } >
8062 < text fg = { themeCtx . theme . text } attributes = { 1 } >
8163 { props . workflowName }
8264 </ text >
83- < text fg = { themeCtx . theme . textMuted } > • { props . runtime } </ text >
8465 < Show when = { showStatus ( ) } >
8566 < text fg = { themeCtx . theme . text } > • </ text >
8667 < text fg = { statusColor ( ) } > { statusText ( ) } </ text >
@@ -90,17 +71,6 @@ export function TelemetryBar(props: TelemetryBarProps) {
9071 < text fg = { themeCtx . theme . primary } > { props . autonomousMode === 'always' ? 'AUTO (LOCKED)' : 'AUTO' } </ text >
9172 </ Show >
9273 </ box >
93-
94- { /* Right side: token counts */ }
95- < box flexDirection = "row" flexShrink = { 0 } >
96- < Show when = { ! isCompact ( ) } >
97- < text fg = { themeCtx . theme . textMuted } > Tokens: </ text >
98- < text fg = { themeCtx . theme . text } > { totalText ( ) } </ text >
99- </ Show >
100- < Show when = { isCompact ( ) } >
101- < text fg = { themeCtx . theme . text } > { compactTokenText ( ) } </ text >
102- </ Show >
103- </ box >
10474 </ box >
10575 )
10676}
0 commit comments