(line: string)
| 109 | } |
| 110 | |
| 111 | function parseCLIEventLine(line: string): CLIEvent | null { |
| 112 | try { |
| 113 | const parsed: unknown = JSON.parse(line); |
| 114 | if (!isRecord(parsed) || typeof parsed.type !== 'string') return null; |
| 115 | return { |
| 116 | type: parsed.type, |
| 117 | data: recordValue(parsed.data), |
| 118 | timestamp: typeof parsed.timestamp === 'string' ? parsed.timestamp : undefined, |
| 119 | id: typeof parsed.id === 'string' ? parsed.id : undefined, |
| 120 | }; |
| 121 | } catch { |
| 122 | return null; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | function getTurnEndState(turn: TurnState): 'errored' | undefined { |
| 127 | const noResponseRecorded = turn.responseChunks.length === 0 |
no test coverage detected