Agent Client Protocol - v2.12.0
    Preparing search index...

    Type Alias SendRequestOptions

    Options for sending a JSON-RPC request.

    type SendRequestOptions = {
        cancellationSignal?: AbortSignal;
        stopWaitingOnCancel?: boolean;
    }
    Index
    cancellationSignal?: AbortSignal

    Aborting this signal sends $/cancel_request for the outgoing request. Cancellation is cooperative: the returned promise is still settled by the peer's eventual response. That response is a successful result only where the method defines one for cancellation, such as session/request_permission with the cancelled outcome; otherwise it is a -32800 error (RequestError.requestCancelled()). A response the peer sent before it received the cancellation may still be a normal result.

    Set stopWaitingOnCancel to also stop waiting for that response.

    stopWaitingOnCancel?: boolean

    When true, aborting cancellationSignal sends $/cancel_request and rejects the returned promise right away with a -32800 RequestError (RequestError.requestCancelled()), whose data is the signal's reason. A RequestError with code -32800 used as the reason is passed through unchanged. With an already-aborted signal, the request and $/cancel_request are still sent and the promise rejects immediately.

    The peer still sends one response. The connection matches it to the request and drops it. It is never surfaced, logged, or reported as an unhandled rejection. Closing the connection first also releases the request.

    ACP v2 Agents use this to stop waiting for pending session/request_permission requests on session/cancel and session/close. The default, false, keeps the request pending until the peer answers.