(projectRoot)
| 86 | } |
| 87 | |
| 88 | function 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 | |
| 121 | function formatAgentReport(report) { |
| 122 | if (report.visibleEntries === 0) return 'No agent runs recorded yet.\n'; |
no test coverage detected