(rawMessages: Array<Record<string, unknown>>)
| 422 | } |
| 423 | |
| 424 | function extractCodexPlanText(rawMessages: Array<Record<string, unknown>>): string | null { |
| 425 | const textParts: string[] = [] |
| 426 | for (const raw of rawMessages) { |
| 427 | const message = raw.message as Record<string, unknown> |
| 428 | if (message.type !== "item.completed") continue |
| 429 | const item = typeof message.item === "object" && message.item !== null ? (message.item as Record<string, unknown>) : {} |
| 430 | if (item.type === "agent_message" && typeof item.text === "string") textParts.push(item.text) |
| 431 | } |
| 432 | return textParts.length > 0 ? textParts.join("\n") : null |
| 433 | } |
no test coverage detected