(parts: SessionV1.Part[])
| 8 | * Throws only for truly empty responses. |
| 9 | */ |
| 10 | export function extractResponseText(parts: SessionV1.Part[]): string | null { |
| 11 | const textPart = parts.findLast((p) => p.type === "text") |
| 12 | if (textPart) return textPart.text |
| 13 | |
| 14 | // Non-text parts (tools, reasoning, step-start/step-finish, etc.) - signal summary needed |
| 15 | if (parts.length > 0) return null |
| 16 | |
| 17 | throw new Error("Failed to parse response: no parts returned") |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Formats a PROMPT_TOO_LARGE error message with details about files in the prompt. |
no outgoing calls
no test coverage detected