(ev: Omit<LearningEvent, 'ts'>)
| 31 | } |
| 32 | |
| 33 | export async function recordLearningEvent(ev: Omit<LearningEvent, 'ts'>): Promise<void> { |
| 34 | try { |
| 35 | const full = ledgerPath(); |
| 36 | await fs.mkdir(path.dirname(full), { recursive: true }); |
| 37 | await fs.appendFile(full, JSON.stringify({ ts: new Date().toISOString(), ...ev }) + '\n', 'utf-8'); |
| 38 | } catch (e: any) { |
| 39 | logger.debug('Learning event not recorded', { err: e?.message }); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | export interface LearningStats { |
| 44 | captured: number; |
no test coverage detected