(output: Output)
| 325 | } |
| 326 | |
| 327 | function formatModelToolResult(output: Output): string { |
| 328 | const lines: string[] = [] |
| 329 | lines.push( |
| 330 | output.error |
| 331 | ? 'JavaScript REPL execution failed.' |
| 332 | : 'JavaScript REPL execution completed.', |
| 333 | ) |
| 334 | |
| 335 | if (output.toolCalls.length > 0) { |
| 336 | lines.push(`Inner tool calls (${output.toolCalls.length}):`) |
| 337 | for (const call of output.toolCalls) { |
| 338 | lines.push(`- ${formatToolCallSummary(call)}`) |
| 339 | } |
| 340 | } else { |
| 341 | lines.push('Inner tool calls: none') |
| 342 | } |
| 343 | |
| 344 | if (output.stdout.trim().length > 0) { |
| 345 | lines.push(`stdout:\n${preview(output.stdout)}`) |
| 346 | } |
| 347 | if (output.stderr.trim().length > 0) { |
| 348 | lines.push(`stderr:\n${preview(output.stderr)}`) |
| 349 | } |
| 350 | if (output.error) { |
| 351 | lines.push(`error:\n${output.error}`) |
| 352 | } else if ('result' in output) { |
| 353 | lines.push(`result:\n${preview(stringifyUnknown(output.result))}`) |
| 354 | } |
| 355 | |
| 356 | return lines.join('\n\n') |
| 357 | } |
| 358 | |
| 359 | function renderProgressHint(data: ReplToolCallProgress): string { |
| 360 | if (data.phase !== 'start') { |
no test coverage detected