CallProgress class

What one tool call is doing right now: feeds the heartbeat, names the stuck phase on a timeout, and owns the subprocesses to kill when the call is abandoned. Found from any code on the call via current.

Constructors

CallProgress({required String tool, ProgressToken? token, void send(ProgressNotification)?})

Properties

abandoned → bool
no setter
batchId ↔ String?
Set by a batch on the call that runs its steps, so every step's usage event names the batch.
getter/setter pair
clock → Stopwatch
Awake time since the call began; stops while the Mac sleeps, unlike the wall clock.
final
hashCode → int
The hash code for this object.
no setterinherited
phase → String
no setter
phaseMs → int
no setter
runningProcesses → List<String>
Labels of the subprocesses this call still has running.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
send → void Function(ProgressNotification)?
final
token → ProgressToken?
final
tool → String
final
trail → List<String>
The last phases with how long each ran, oldest first, ending with the current one.
no setter

Methods

abandon() → void
Cancels the call's work: stops every subprocess it started, with its children, and refuses new phases and processes.
forward(ProgressNotification n) → void
Sends n to the client with a progress value that only grows; a no-op without a client token or sender.
mark() → CallMark
The counters and per-key milliseconds so far, including phases still running; a nested key's time is also in the phase around it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerProcess(Process process, String label) → void
run<T>(T body()) → T
Runs body with this call as the current one for everything it starts.
sleptSince(DateTime since) → int
Wall-clock milliseconds the machine slept since since, found by the one-second tick.
stop() → void
toString() → String
A string representation of this object.
inherited
unregisterProcess(Process process) → void
watch({required Duration ceiling, required void onCeiling(), Duration heartbeatEvery = const Duration(seconds: 10)}) → void
Starts the one-second tick (sleep detection), the heartbeat every heartbeatEvery, and the ceiling timer.

Operators

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

Static Properties

cancelled → bool
Whether the running call, or the timeboxed part it is in, was cancelled.
no setter
current → CallProgress?
The call running in the current zone, or null outside a tool call.
no setter
inFlight → int
Tool calls running in this process right now.
no setter

Static Methods

checkAlive() → void
Throws CallAbandoned when the running call, or the timeboxed part it is in, was cancelled.
during<T>(String phase, Future<T> body(), {required String key}) → Future<T>
Runs body under phase phase, restoring the previous phase after; its time counts under key and still counts in the phase it ran inside.
enter(String phase, {required String key}) → void
Marks the current phase of the running call, counted in usage events under key; no-op outside a tool call, throws CallAbandoned once the call was cancelled.
note(String? text) → void
Sets what the heartbeat adds after the phase, such as what a wait last saw; null clears it. No-op outside a tool call.
noteVmRetry() → void
Counts a VM service call that was repeated after the isolate changed, on the running call.
noteVmTimeout() → void
Counts a VM service call that hit its timeout, on the running call.
release(Process process) → void
Hands process over to outlive the running call, so abandoning the call leaves it running.
stepLabel(String? text) → void
Sets which step of a longer call this is, shown after the phase in the heartbeat; null clears it.
timeboxed<T>(Duration limit, Future<T> body(), {Duration unwind = const Duration(seconds: 1)}) → Future<T>
Runs body for at most limit. Past it the part is cancelled: its next checkAlive throws, the subprocesses it started are stopped, and after at most unwind for the body to finish this throws CallTimeboxExceeded.