(text)
| 2350 | } |
| 2351 | |
| 2352 | function parseLastJsonLine(text) { |
| 2353 | const lines = stripAnsi(text) |
| 2354 | .split('\n') |
| 2355 | .map(line => line.trim()) |
| 2356 | .filter(Boolean) |
| 2357 | |
| 2358 | for (let index = lines.length - 1; index >= 0; index -= 1) { |
| 2359 | try { |
| 2360 | return JSON.parse(lines[index]) |
| 2361 | } catch { |
| 2362 | // keep scanning |
| 2363 | } |
| 2364 | } |
| 2365 | |
| 2366 | return null |
| 2367 | } |
| 2368 | |
| 2369 | function buildToolArtifacts(payload) { |
| 2370 | const uses = Array.isArray(payload?.tool_uses) ? payload.tool_uses : [] |
no test coverage detected