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