( toolCallId: string, timeoutMs: number, abortSignal?: AbortSignal )
| 15 | * waiting for a foreground result |
| 16 | */ |
| 17 | export async function waitForToolCompletion( |
| 18 | toolCallId: string, |
| 19 | timeoutMs: number, |
| 20 | abortSignal?: AbortSignal |
| 21 | ): Promise<AsyncTerminalCompletionSnapshot | null> { |
| 22 | const decision = await waitForToolConfirmation(toolCallId, timeoutMs, abortSignal, { |
| 23 | acceptStatus: (status) => |
| 24 | status === MothershipStreamV1ToolOutcome.success || |
| 25 | status === MothershipStreamV1ToolOutcome.error || |
| 26 | status === ASYNC_TOOL_CONFIRMATION_STATUS.background || |
| 27 | status === MothershipStreamV1ToolOutcome.cancelled, |
| 28 | }) |
| 29 | if (decision && isAsyncTerminalConfirmationStatus(decision.status)) { |
| 30 | return { ...decision, status: decision.status } |
| 31 | } |
| 32 | return null |
| 33 | } |
no test coverage detected