cancelSession method

bool cancelSession(
  1. int sessionHandle
)

Cancel an in-flight session. Safe to call from any isolate; the native side latches the cancel and asks the in-flight LifecycleLlmRef to abort. Idempotent for unknown handles. Returns false when the native cancellation call fails.

Implementation

bool cancelSession(int sessionHandle) {
  final fn = RacNative.bindings.rac_tool_calling_session_cancel_proto;
  try {
    fn(sessionHandle);
    return true;
  } catch (e) {
    _logger.warning('session cancel failed: $e');
    return false;
  }
}