(events)
| 656 | * for callers that only have the raw events (parse-session.mjs). |
| 657 | */ |
| 658 | export function collectExploreTexts(events) { |
| 659 | const nameById = new Map(); |
| 660 | const texts = []; |
| 661 | for (const ev of events) { |
| 662 | const content = ev?.message?.content; |
| 663 | if (!Array.isArray(content)) continue; |
| 664 | for (const b of content) { |
| 665 | if (b.type === 'tool_use') nameById.set(b.id, b.name); |
| 666 | else if (b.type === 'tool_result' && !b.is_error |
| 667 | && /codegraph_explore/.test(nameById.get(b.tool_use_id) || '')) texts.push(textOf(b.content)); |
| 668 | } |
| 669 | } |
| 670 | return texts; |
| 671 | } |
| 672 | |
| 673 | /** |
| 674 | * The final answer a session produced. Headless stream-json carries it on the |
no test coverage detected