11/**
2- * Density ramp — the activity primitive. Two surfaces draw from it.
3- *
4- * The wide fill (`rampFor`) is the provider-setup status line; the single
5- * cell (`rampPulse`) is the session shell's status slot, where one column
6- * is all the border row can spare:
7- *
8- * working █ ▓ ▒ ░ … cycling density — visibly moving
9- * done █ still
10- * blocked ▌ static half block — stillness is the signal
11- * stalled ! / █ bang/block alternation, then static !
12- *
13- * `blocked` and `stalled` share a color (both wait on outside action) but
14- * differ by glyph and motion, so all states read without color.
15- *
16- * Pure and clock-injected: `nowMs` is the only time source.
2+ * Density ramp — the activity primitive. The wide fill (`rampFor`) is the
3+ * provider-setup status line; the single cell (`rampPulse`) is the session
4+ * shell's status slot, where one column is all the border row can spare.
5+ * `blocked` and `stalled` share a color (both wait on outside action), but
6+ * every phase differs by glyph and motion — working cycles density, done
7+ * and blocked hold still, stalled blinks then sits on `!` — so states read
8+ * without color. Pure and clock-injected: `nowMs` is the only time source.
179 */
1810
1911import { UI } from "./theme.js" ;
@@ -30,8 +22,8 @@ const EMPTY = " ";
3022const COMET_LENGTH = FEATHER . length ;
3123
3224/**
33- * One full comet traversal; slow enough to read as motion, not a strobe at
34- * the 250 ms status tick .
25+ * One full comet traversal, slow enough to read as motion at the 250 ms
26+ * status tick, not a strobe .
3527 */
3628export const RAMP_CYCLE_MS = 1200 ;
3729
@@ -48,16 +40,16 @@ const BLOCKED_GLYPH = "▌";
4840export const STALL_BLINK_CYCLE_MS = 900 ;
4941
5042/**
51- * How long the stall blink runs before settling to a static bang. A stall
52- * can last minutes; an unbounded blink would strobe until it means
53- * nothing. The burst spends attention up front; the static bang still
54- * reads as a problem.
43+ * How long the stall blink runs before settling to a static bang: a
44+ * minutes-long stall would strobe an unbounded blink into noise, so the
45+ * burst spends attention up front and the static bang still reads as a
46+ * problem.
5547 */
5648export const STALL_BLINK_BURST_MS = STALL_BLINK_CYCLE_MS * 9 ;
5749
5850/**
5951 * Whether `nowMs` is in the solid half of the stall blink; exported so every
60- * stalled surface blinks on the same clock .
52+ * stalled surface blinks in sync .
6153 */
6254export function stallBlinkOn ( nowMs : number ) : boolean {
6355 const phase =
@@ -81,7 +73,7 @@ function clamp01(value: number): number {
8173/**
8274 * Determinate fill: solid cells up to `progress`, then a short dither
8375 * feather at the leading edge so the boundary reads as texture, not a hard
84- * stop. A full ramp is entirely solid.
76+ * stop.
8577 */
8678export function renderRamp ( progress : number , width = RAMP_WIDTH ) : string {
8779 if ( width <= 0 ) return "" ;
@@ -95,8 +87,8 @@ export function renderRamp(progress: number, width = RAMP_WIDTH): string {
9587}
9688
9789/**
98- * Indeterminate fill: a comet traveling left to right and wrapping. Most
99- * work has no denominator, so it animates rather than faking a percentage.
90+ * Indeterminate fill: a left-to- right wrapping comet . Most work has no
91+ * denominator, so it animates rather than faking a percentage.
10092 */
10193export function renderIndeterminateRamp (
10294 nowMs : number ,
@@ -117,14 +109,14 @@ export function renderIndeterminateRamp(
117109export type RampPhase = "working" | "done" | "blocked" | "stalled" ;
118110
119111/**
120- * Wide-fill phases. Only a live session reports a stall, and it paints the
121- * single cell, so a wide stall would produce glyphs nothing renders.
112+ * Only a live session reports a stall, and it paints the single cell, so
113+ * a wide stall would produce glyphs nothing renders.
122114 */
123115export type RampFillPhase = Exclude < RampPhase , "stalled" > ;
124116
125117/**
126- * Stalled duration, or null when not stalled. Required: it decides whether
127- * the blink still runs; forgetting it paints a permanent strobe.
118+ * Stalled duration, or null when not stalled. It decides whether the blink
119+ * still runs; forgetting it paints a permanent strobe.
128120 */
129121export type StallAge = number | null ;
130122
@@ -156,9 +148,9 @@ export function rampFg(phase: RampPhase): string {
156148}
157149
158150/**
159- * Whether the phase still has frames to draw. False for terminal and waiting
160- * states and for a settled stall, so the caller's tick can fall back to its
161- * slow cadence.
151+ * Whether the phase still has frames to draw. False for terminal, waiting,
152+ * and settled- stall states , so the caller's tick can fall back to its slow
153+ * cadence.
162154 */
163155export function rampAnimating (
164156 phase : RampPhase ,
0 commit comments