MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / StatsDialog

Function StatsDialog

lib/tui/dialogs.tsx:99–155  ·  view source on GitHub ↗
(props: { api: TuiApi; report: StatsReport; onBack: () => void })

Source from the content-addressed store, hash-verified

97}
98
99export function StatsDialog(props: { api: TuiApi; report: StatsReport; onBack: () => void }) {
100 const theme = props.api.theme.current
101 const ratio = formatRatio(props.report.sessionTokens, props.report.sessionSummaryTokens)
102 return (
103 <DcpFrame api={props.api} title="Stats" eyebrow="DCP" onBack={props.onBack}>
104 <Card theme={theme} title="Session">
105 <Metric
106 theme={theme}
107 label="Tokens saved"
108 value={`~${formatTokenCount(props.report.sessionTokens)}`}
109 hint="tokens"
110 />
111 <Metric
112 theme={theme}
113 label="Summary size"
114 value={`~${formatTokenCount(props.report.sessionSummaryTokens)}`}
115 hint="tokens"
116 />
117 <Metric theme={theme} label="Compression ratio" value={ratio} />
118 <Metric
119 theme={theme}
120 label="Compression time"
121 value={formatDuration(props.report.sessionDurationMs)}
122 />
123 <Metric theme={theme} label="Tools pruned" value={`${props.report.sessionTools}`} />
124 <Metric
125 theme={theme}
126 label="Messages pruned"
127 value={`${props.report.sessionMessages}`}
128 />
129 </Card>
130 <Card theme={theme} title="All time">
131 <Metric
132 theme={theme}
133 label="Tokens saved"
134 value={`~${formatTokenCount(props.report.allTime.totalTokens)}`}
135 hint="tokens"
136 />
137 <Metric
138 theme={theme}
139 label="Tools pruned"
140 value={`${props.report.allTime.totalTools}`}
141 />
142 <Metric
143 theme={theme}
144 label="Messages pruned"
145 value={`${props.report.allTime.totalMessages}`}
146 />
147 <Metric
148 theme={theme}
149 label="Sessions with DCP history"
150 value={`${props.report.allTime.sessionCount}`}
151 />
152 </Card>
153 </DcpFrame>
154 )
155}
156

Callers

nothing calls this directly

Calls 3

formatRatioFunction · 0.90
formatTokenCountFunction · 0.90
formatDurationFunction · 0.90

Tested by

no test coverage detected