From 3c0af3654ac5491e79c6f9b55de5debf0e1e13c1 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Fri, 15 Aug 2025 15:39:54 -0700 Subject: Update semantic color tokens (#6253) Co-authored-by: jacob314 --- packages/cli/src/ui/components/StatsDisplay.tsx | 115 ++++++++++++++---------- 1 file changed, 66 insertions(+), 49 deletions(-) (limited to 'packages/cli/src/ui/components/StatsDisplay.tsx') diff --git a/packages/cli/src/ui/components/StatsDisplay.tsx b/packages/cli/src/ui/components/StatsDisplay.tsx index 71c88aef..03c1fff6 100644 --- a/packages/cli/src/ui/components/StatsDisplay.tsx +++ b/packages/cli/src/ui/components/StatsDisplay.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { Box, Text } from 'ink'; import Gradient from 'ink-gradient'; -import { Colors } from '../colors.js'; +import { theme } from '../semantic-colors.js'; import { formatDuration } from '../utils/formatters.js'; import { useSessionStats, ModelMetrics } from '../contexts/SessionContext.js'; import { @@ -29,7 +29,7 @@ const StatRow: React.FC = ({ title, children }) => ( {/* Fixed width for the label creates a clean "gutter" for alignment */} - {title} + {title} {children} @@ -45,7 +45,7 @@ const SubStatRow: React.FC = ({ title, children }) => ( {/* Adjust width for the "» " prefix */} - » {title} + » {title} {children} @@ -59,7 +59,9 @@ interface SectionProps { const Section: React.FC = ({ title, children }) => ( - {title} + + {title} + {children} ); @@ -79,16 +81,24 @@ const ModelUsageTable: React.FC<{ {/* Header */} - Model Usage + + Model Usage + - Reqs + + Reqs + - Input Tokens + + Input Tokens + - Output Tokens + + Output Tokens + {/* Divider */} @@ -98,6 +108,7 @@ const ModelUsageTable: React.FC<{ borderTop={false} borderLeft={false} borderRight={false} + borderColor={theme.border.default} width={nameWidth + requestsWidth + inputTokensWidth + outputTokensWidth} > @@ -105,18 +116,20 @@ const ModelUsageTable: React.FC<{ {Object.entries(models).map(([name, modelMetrics]) => ( - {name.replace('-001', '')} + {name.replace('-001', '')} - {modelMetrics.api.totalRequests} + + {modelMetrics.api.totalRequests} + - + {modelMetrics.tokens.prompt.toLocaleString()} - + {modelMetrics.tokens.candidates.toLocaleString()} @@ -124,13 +137,13 @@ const ModelUsageTable: React.FC<{ ))} {cacheEfficiency > 0 && ( - - Savings Highlight:{' '} + + Savings Highlight:{' '} {totalCachedTokens.toLocaleString()} ({cacheEfficiency.toFixed(1)} %) of input tokens were served from the cache, reducing costs. - + » Tip: For a full token breakdown, run `/stats model`. @@ -169,18 +182,18 @@ export const StatsDisplay: React.FC = ({ const renderTitle = () => { if (title) { - return Colors.GradientColors && Colors.GradientColors.length > 0 ? ( - + return theme.ui.gradient && theme.ui.gradient.length > 0 ? ( + {title} ) : ( - + {title} ); } return ( - + Session Stats ); @@ -189,7 +202,7 @@ export const StatsDisplay: React.FC = ({ return ( = ({ {renderTitle()} -
- - {stats.sessionId} - - - - {tools.totalCalls} ({' '} - ✔ {tools.totalSuccess}{' '} - ✖ {tools.totalFail} ) - - - - {computed.successRate.toFixed(1)}% - - {computed.totalDecisions > 0 && ( - - - {computed.agreementRate.toFixed(1)}%{' '} - - ({computed.totalDecisions} reviewed) - + {tools.totalCalls > 0 && ( +
+ + {stats.sessionId} + + + + {tools.totalCalls} ({' '} + ✔ {tools.totalSuccess}{' '} + ✖ {tools.totalFail} ) - )} -
+ + {computed.successRate.toFixed(1)}% + + {computed.totalDecisions > 0 && ( + + + {computed.agreementRate.toFixed(1)}%{' '} + + ({computed.totalDecisions} reviewed) + + + + )} +
+ )}
- {duration} + {duration} - {formatDuration(computed.agentActiveTime)} + + {formatDuration(computed.agentActiveTime)} + - + {formatDuration(computed.totalApiTime)}{' '} - + ({computed.apiTimePercent.toFixed(1)}%) - + {formatDuration(computed.totalToolTime)}{' '} - + ({computed.toolTimePercent.toFixed(1)}%) -- cgit v1.2.3