(filePath: string)
| 78 | } |
| 79 | |
| 80 | function fileContainsMessages(filePath: string): boolean { |
| 81 | try { |
| 82 | if (filePath.endsWith('.jsonl')) { |
| 83 | const content = fs.readFileSync(filePath, 'utf-8') |
| 84 | for (const line of content.split('\n')) { |
| 85 | const trimmed = line.trim() |
| 86 | if (!trimmed) continue |
| 87 | try { |
| 88 | const obj = JSON.parse(trimmed) |
| 89 | if (obj._type === 'message') return true |
| 90 | } catch { |
| 91 | continue |
| 92 | } |
| 93 | } |
| 94 | return false |
| 95 | } |
| 96 | |
| 97 | const raw = fs.readFileSync(filePath, 'utf-8') |
| 98 | const parsed = JSON.parse(raw) |
| 99 | return Array.isArray(parsed.messages) && parsed.messages.length > 0 |
| 100 | } catch { |
| 101 | return false |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | function getMaxMessageTimestampFromFile(filePath: string): number | null { |
| 106 | try { |
no test coverage detected