(metadata: SessionMetadata)
| 328 | } |
| 329 | |
| 330 | export function buildReattachLine(metadata: SessionMetadata): string | null { |
| 331 | if (!metadata.id) { |
| 332 | return null; |
| 333 | } |
| 334 | const referenceTime = metadata.startedAt ?? metadata.createdAt; |
| 335 | if (!referenceTime) { |
| 336 | return null; |
| 337 | } |
| 338 | const elapsedLabel = formatRelativeDuration(referenceTime); |
| 339 | if (!elapsedLabel) { |
| 340 | return null; |
| 341 | } |
| 342 | if (metadata.status === 'running') { |
| 343 | return `Session ${metadata.id} reattached, request started ${elapsedLabel} ago.`; |
| 344 | } |
| 345 | return null; |
| 346 | } |
| 347 | |
| 348 | export function trimBeforeFirstAnswer(logText: string): string { |
| 349 | const marker = 'Answer:'; |
no test coverage detected