( step: ToolCallStepContext, execution: RunnableToolExecution, toolCall: ToolCall, toolName: string, metadata: unknown, )
| 537 | } |
| 538 | |
| 539 | async function executeTool( |
| 540 | step: ToolCallStepContext, |
| 541 | execution: RunnableToolExecution, |
| 542 | toolCall: ToolCall, |
| 543 | toolName: string, |
| 544 | metadata: unknown, |
| 545 | ): Promise<ExecutableToolResult> { |
| 546 | const { dispatchEvent, signal, turnId } = step; |
| 547 | |
| 548 | signal.throwIfAborted(); |
| 549 | |
| 550 | const executePromise = execution.execute({ |
| 551 | turnId, |
| 552 | toolCallId: toolCall.id, |
| 553 | metadata, |
| 554 | signal, |
| 555 | onUpdate: (update) => { |
| 556 | if (signal.aborted) return; |
| 557 | dispatchEvent({ |
| 558 | type: 'tool.progress', |
| 559 | toolCallId: toolCall.id, |
| 560 | update, |
| 561 | }); |
| 562 | }, |
| 563 | }); |
| 564 | return raceExecuteWithGraceTimeout(executePromise, signal, toolName); |
| 565 | } |
| 566 | |
| 567 | async function raceExecuteWithGraceTimeout( |
| 568 | executePromise: Promise<ExecutableToolResult>, |
no test coverage detected