MCPcopy Create free account
hub / github.com/anus-dev/ANUS / StatsDisplay

Function StatsDisplay

packages/cli/src/ui/components/StatsDisplay.tsx:148–261  ·  view source on GitHub ↗
({
  duration,
  title,
})

Source from the content-addressed store, hash-verified

146}
147
148export const StatsDisplay: React.FC<StatsDisplayProps> = ({
149 duration,
150 title,
151}) => {
152 const { stats } = useSessionStats();
153 const { metrics } = stats;
154 const { models, tools } = metrics;
155 const computed = computeSessionStats(metrics);
156
157 const successThresholds = {
158 green: TOOL_SUCCESS_RATE_HIGH,
159 yellow: TOOL_SUCCESS_RATE_MEDIUM,
160 };
161 const agreementThresholds = {
162 green: USER_AGREEMENT_RATE_HIGH,
163 yellow: USER_AGREEMENT_RATE_MEDIUM,
164 };
165 const successColor = getStatusColor(computed.successRate, successThresholds);
166 const agreementColor = getStatusColor(
167 computed.agreementRate,
168 agreementThresholds,
169 );
170
171 const renderTitle = () => {
172 if (title) {
173 return Colors.GradientColors && Colors.GradientColors.length > 0 ? (
174 <Gradient colors={Colors.GradientColors}>
175 <Text bold>{title}</Text>
176 </Gradient>
177 ) : (
178 <Text bold color={Colors.AccentPurple}>
179 {title}
180 </Text>
181 );
182 }
183 return (
184 <Text bold color={Colors.AccentPurple}>
185 Session Stats
186 </Text>
187 );
188 };
189
190 return (
191 <Box
192 borderStyle="round"
193 borderColor={Colors.Gray}
194 flexDirection="column"
195 paddingY={1}
196 paddingX={2}
197 >
198 {renderTitle()}
199 <Box height={1} />
200
201 <Section title="Interaction Summary">
202 <StatRow title="Session ID:">
203 <Text>{stats.sessionId}</Text>
204 </StatRow>
205 <StatRow title="Tool Calls:">

Callers

nothing calls this directly

Calls 5

useSessionStatsFunction · 0.85
computeSessionStatsFunction · 0.85
getStatusColorFunction · 0.85
renderTitleFunction · 0.85
formatDurationFunction · 0.85

Tested by

no test coverage detected