cancelSession method
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 {
return fn(sessionHandle) == RacResultCodes.success;
} catch (e) {
_logger.warning('session cancel failed: $e');
return false;
}
}