MCPcopy Create free account
hub / github.com/SethGammon/Citadel / buildCompressionReport

Function buildCompressionReport

core/telemetry/report.js:88–119  ·  view source on GitHub ↗
(projectRoot)

Source from the content-addressed store, hash-verified

86}
87
88function buildCompressionReport(projectRoot) {
89 const paths = resolveTelemetryPaths(projectRoot);
90 const data = readJsonlDetailed(paths.compression);
91 let totalInput = 0;
92 let totalOutput = 0;
93
94 for (const entry of data.entries) {
95 totalInput += entry.inputChars || 0;
96 totalOutput += entry.outputChars || 0;
97 }
98
99 const averageRatio = totalInput > 0 ? totalOutput / totalInput : 0;
100 const recent = data.entries.slice(-5).map(entry => ({
101 agent: entry.agent || '?',
102 inputChars: entry.inputChars || 0,
103 outputChars: entry.outputChars || 0,
104 ratio: typeof entry.ratio === 'number'
105 ? entry.ratio
106 : ((entry.inputChars || 0) > 0 ? (entry.outputChars || 0) / entry.inputChars : 0),
107 }));
108
109 return {
110 kind: 'compression',
111 totalEntries: data.entries.length,
112 totalInput,
113 totalOutput,
114 averageRatio,
115 recent,
116 invalidCount: data.invalidCount,
117 invalidSummary: summarizeInvalid(data),
118 };
119}
120
121function formatAgentReport(report) {
122 if (report.visibleEntries === 0) return 'No agent runs recorded yet.\n';

Callers 2

compressionReportFunction · 0.85

Calls 3

resolveTelemetryPathsFunction · 0.85
readJsonlDetailedFunction · 0.85
summarizeInvalidFunction · 0.85

Tested by

no test coverage detected