cancel method

bool cancel()

Cancel the in-flight native loop. rac_tool_calling_session_cancel_proto is thread-safe and idempotent, so it is invoked directly from this isolate (it latches a cancel the worker's in-flight generate checks) rather than queued behind the worker's blocking turn.

Implementation

bool cancel() {
  if (_closed || _resolvedId == 0) return false;
  return DartBridgeToolCalling.shared.cancelSession(_resolvedId);
}