()
| 494 | this.onControlRequestSent(message) |
| 495 | } |
| 496 | const aborted = () => { |
| 497 | this.outbound.enqueue({ |
| 498 | type: 'control_cancel_request', |
| 499 | request_id: requestId, |
| 500 | }) |
| 501 | // Immediately reject the outstanding promise, without |
| 502 | // waiting for the host to acknowledge the cancellation. |
| 503 | const request = this.pendingRequests.get(requestId) |
| 504 | if (request) { |
| 505 | // Track the tool_use ID as resolved before rejecting, so that a |
| 506 | // late response from the host is ignored by the orphan handler. |
| 507 | this.trackResolvedToolUseId(request.request) |
| 508 | request.reject(new AbortError()) |
| 509 | } |
| 510 | } |
| 511 | if (signal) { |
| 512 | signal.addEventListener('abort', aborted, { |
| 513 | once: true, |
nothing calls this directly
no test coverage detected