| 167 | |
| 168 | // Helper to format duration in seconds to a human-readable string |
| 169 | const formatSeconds = (totalSeconds: number): string => { |
| 170 | if (totalSeconds < 0) totalSeconds = 0 |
| 171 | const hours = Math.floor(totalSeconds / 3600) |
| 172 | const minutes = Math.floor((totalSeconds % 3600) / 60) |
| 173 | const seconds = Math.floor(totalSeconds % 60) |
| 174 | |
| 175 | if (hours > 0) return `about ${hours} hour(s)` |
| 176 | if (minutes > 0) return `about ${minutes} minute(s)` |
| 177 | return `${seconds}s` |
| 178 | } |
| 179 | |
| 180 | const canRewriteStdoutLine = (): boolean => |
| 181 | Boolean( |