( state: EventHandlerState, event: PrintModeToolCall, )
| 301 | } |
| 302 | |
| 303 | const handleRegularToolCall = ( |
| 304 | state: EventHandlerState, |
| 305 | event: PrintModeToolCall, |
| 306 | ) => { |
| 307 | const newToolBlock: ToolContentBlock = { |
| 308 | type: 'tool', |
| 309 | toolCallId: event.toolCallId, |
| 310 | toolName: event.toolName as ToolName, |
| 311 | input: event.input, |
| 312 | agentId: event.agentId, |
| 313 | ...(event.includeToolCall !== undefined && { |
| 314 | includeToolCall: event.includeToolCall, |
| 315 | }), |
| 316 | } |
| 317 | |
| 318 | if (event.parentAgentId && event.agentId) { |
| 319 | state.message.updater.updateAiMessageBlocks((blocks) => |
| 320 | appendToolToAgentBlock(blocks, event.agentId as string, newToolBlock), |
| 321 | ) |
| 322 | return |
| 323 | } |
| 324 | |
| 325 | state.message.updater.updateAiMessageBlocks((blocks) => [ |
| 326 | ...blocks, |
| 327 | newToolBlock, |
| 328 | ]) |
| 329 | } |
| 330 | |
| 331 | const handleToolCall = (state: EventHandlerState, event: PrintModeToolCall) => { |
| 332 | // Close any open native reasoning blocks when a tool call happens |
no test coverage detected