isUnfinished function
Whether this frame is a progress indicator that has not resolved yet.
Frames arrive one write at a time, so collapsing within a chunk is not
enough: the first frame of a spinner lands in its own chunk and would be
printed, leaving a stray ⠋ Generating… above every ✓ Generated…. With
several services interleaved that is most of the output.
A frame still wearing a spinner glyph is unfinished by definition — the
same line is about to be redrawn, and the redraw ends in ✓ or ✗, which
is the part worth keeping. Anything a child prints that does not animate
passes through untouched.
The glyph is looked for in the frame's visible text. A child that colours
its output writes ESC[92m⠋ESC[0m Retrieving…, whose first code unit is the
escape byte and not the glyph — so testing the raw string would stop
matching the moment colour was turned on, and would do it silently: every
frame becomes a settled line, the spinner column in the roster empties, and
nothing anywhere reports an error. stripAnsi is what keeps this test about
what the child drew rather than about how it drew it.
Public so a renderer that owns its own region — a per-service pane, which can redraw in place rather than only appending — can hold an unfinished frame instead of dropping it. A second copy of this test would drift from this one.
Implementation
bool isUnfinished(String frame) {
final visible = stripAnsi(frame).trim();
return visible.isNotEmpty && _spinnerGlyphs.contains(visible.codeUnitAt(0));
}