1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Turn-status indicator painter: a thin DOM shim over the pure
//! [`crate::turn_stage::StagePipeline`] (GitHub #19 — the $LH-payment →
//! execution transition was an opaque pause). The active phase surfaces as
//! ONE pulsing lucide glyph in a FIXED header slot (`#turn-status`, right of
//! the brand) — brain (thinking) / waves (streaming) / wrench (tools). The
//! slot is empty (button GONE) whenever no phase is active or between turns;
//! [`enter`] repaints only when the pipeline's current stage changes, and
//! [`end`] empties it when the turn completes.
use ;
use crate;
use ;
/// The fixed header slot id the active-phase glyph paints into (see
/// `templates::site_header` / `templates::stage_status_slot`). ONE slot,
/// reused every turn — no per-turn id.
const SLOT: &str = "turn-status";
thread_local!
/// Arm the painter for a fresh turn: empty pipeline, empty slot. Nothing is
/// painted yet (no phase has happened), so the header button stays GONE until
/// the first thinking/streaming/tools event.
pub
/// Record that `stage` is happening NOW and repaint the header glyph iff the
/// pipeline's current stage changed. After `enter`, `stage` IS the current
/// phase, so it maps straight to a glyph — `Paying`/`Starting` resolve to an
/// empty fragment ([`templates::stage_status_button`]), which collapses the
/// slot (button gone). No-op when no turn is armed.
pub
/// The turn completed (done, errored, or cancelled): empty the slot (button
/// gone) and disarm. Idempotent; called from `mark_turn_done` and
/// (belt-and-braces) the run's `TurnGuard`.
pub