ToolCallingSessionHandle class

Owned handle for a tool-calling session — combines the C side session id, the Dart broadcast stream of decoded events, and the native callable that must be closed when the session ends.

Properties

events Stream<ToolCallingSessionEvent>
Stream of ToolCallingSessionEvents emitted by commons (forwarded from the session worker over a port).
no setter
hashCode int
The hash code for this object.
no setterinherited
resolvedSessionId int
Resolved C-side session id, or 0 if the worker has not reported it yet.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId Future<int>
Future of the C-side session id, resolved when the worker reports it back (a turn after the first event). Only needed for cancel.
no setter

Methods

cancel() bool
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.
close() Future<void>
Tear the session down: ask the worker to destroy the native session, quiesce, and close its callback (the worker owns the teardown ordering so commons never invokes a freed trampoline), then drop our port. When the worker is idle (the usual case — close runs after the final event) it processes this immediately and exits on its own.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stepWithResult({required String toolCallId, required String resultJson, required String error}) → void
Forward a tool result so commons continues the loop. Runs the next generation turn IN THE SESSION WORKER — never blocks the calling isolate. The worker fills in its own session id, so callers need not await it.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited