Idempotent: calling multiple times on the same taskId is safe.
If the task has already completed, this is a no-op.
If the task has not yet completed, the status transitions to "cancelled"
and any future invoke() resolution is ignored.
If onCancel was provided in startTask options, it is called to
propagate cancellation to the backend. This ensures the backend
can stop ongoing work rather than continuing to mutate state.
Signal cancellation for a running task.
Idempotent: calling multiple times on the same taskId is safe. If the task has already completed, this is a no-op. If the task has not yet completed, the status transitions to "cancelled" and any future invoke() resolution is ignored.
If
onCancelwas provided in startTask options, it is called to propagate cancellation to the backend. This ensures the backend can stop ongoing work rather than continuing to mutate state.