Handles session/cancel. Stop waiting on the pending
session/request_permission requests of the cancelled foreground work,
treat them as not approved, and cancel each with $/cancel_request, for
example by aborting the cancellationSignal passed to
AgentContext.request. Cancel the pending elicitations that the
cancelled work no longer needs the same way. The Agent decides which
requests belong to the cancelled work, and it must cancel each of them.
With stopWaitingOnCancel: true, aborting the signal does both: it sends
$/cancel_request and rejects the request promise with -32800 without
waiting for the Client's answer. Work in the latest background list
keeps running.
When the cancellation stops active foreground work, send that work's
final updates and then idle with stopReason: "cancelled", before
starting new foreground work in the session. Do not wait for listed
background work or for answers to the cancelled requests. If the work
had already ended, its stop reason stands and no further idle update is
needed.
sessionId can name a child session. Cancel the child's foreground
work only while the child advertises capabilities.cancel, and ignore
the notification otherwise. Cancelling a session, parent or child, also
cancels the descendant work that the cancelled work is waiting on, and
the pending requests of the descendants it stops are cancelled with
$/cancel_request too. A child that keeps running keeps its requests.
A child whose work is cancelled reports idle with
stopReason: "cancelled", also when its parent cancelled it.
Agent notification handlers keyed by ACP protocol method name.