()
| 52 | |
| 53 | /** Read + aggregate the metrics file (last 5000 events). Best-effort → zeros if absent. */ |
| 54 | export async function readExtractMetrics(): Promise<ExtractCounts> { |
| 55 | try { |
| 56 | const { promises: fs } = await import('fs'); |
| 57 | const file = await metricsFile(); |
| 58 | const text = await fs.readFile(file, 'utf-8'); |
| 59 | const lines = text.split('\n'); |
| 60 | return parseExtractMetrics(lines.slice(-5000).join('\n')); |
| 61 | } catch { return { semantic: 0, headTail: 0, truncated: 0, semanticRate: 0 }; } |
| 62 | } |
no test coverage detected