()
| 514 | this.onControlRequestSent(message) |
| 515 | } |
| 516 | const aborted = () => { |
| 517 | this.outbound.enqueue({ |
| 518 | type: 'control_cancel_request', |
| 519 | request_id: requestId, |
| 520 | }) |
| 521 | // Immediately reject the outstanding promise, without |
| 522 | // waiting for the host to acknowledge the cancellation. |
| 523 | const request = this.pendingRequests.get(requestId) |
| 524 | if (request) { |
| 525 | // Track the tool_use ID as resolved before rejecting, so that a |
| 526 | // late response from the host is ignored by the orphan handler. |
| 527 | this.trackResolvedToolUseId(request.request) |
| 528 | request.reject(new AbortError()) |
| 529 | } |
| 530 | } |
| 531 | if (signal) { |
| 532 | signal.addEventListener('abort', aborted, { |
| 533 | once: true, |
nothing calls this directly
no test coverage detected