| 105 | .map((event) => event.agentType) |
| 106 | |
| 107 | const countThinkerToolErrors = (events: PrintModeEvent[]) => { |
| 108 | let count = 0 |
| 109 | for (const event of events) { |
| 110 | if (event.type !== 'tool_result') continue |
| 111 | if (!event.parentAgentId?.includes('thinker-codex')) continue |
| 112 | for (const part of event.output) { |
| 113 | if (part.type !== 'json') continue |
| 114 | if (typeof part.value !== 'object' || part.value === null) continue |
| 115 | const message = |
| 116 | 'errorMessage' in part.value |
| 117 | ? part.value.errorMessage |
| 118 | : 'message' in part.value |
| 119 | ? part.value.message |
| 120 | : undefined |
| 121 | if ( |
| 122 | typeof message === 'string' && |
| 123 | message.toLowerCase().includes('error:') |
| 124 | ) { |
| 125 | count++ |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | return count |
| 130 | } |
| 131 | |
| 132 | const writeTrace = async (params: { |
| 133 | testName: string |