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
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright 2024-2026 Jonathan Shook
// SPDX-License-Identifier: Apache-2.0
//! # nmbrs-tui
//!
//! Contract & axioms: [SRD 59](../../docs/SRD/59_tui_contract.md).
//!
//! Terminal UI for nmbrs, built on [ratatui]. Provides a live
//! dashboard showing the scenario tree, per-phase progress and
//! detail blocks, throughput sparklines, latency percentile
//! histograms, an optional log panel, and a help overlay.
//!
//! ## Architecture
//!
//! - [`state::RunState`] — shared state between the executor
//! thread and the render thread. Holds the canonical
//! `SceneTree` (parent / children / status), the
//! side-mapped `PhaseSummary` per node, active-phase live
//! counters, log ring buffer, ops-history sparkline data,
//! etc.
//! - [`app::App`] — owns the render loop. Reads `RunState` at
//! the tick rate (default 4 Hz) and produces a frame.
//! Handles keyboard input (LOD cycle, log toggle, pause,
//! help, control-edit prompt).
//! - [`reporter`] — a `nmbrs_metrics::scheduler::Reporter`
//! implementation that observers register so per-tick
//! `MetricSet` snapshots flow into `RunState`'s sparkline /
//! percentile histories.
//! - `widgets` — small custom widgets where ratatui's
//! built-ins fall short.
//!
//! Lifecycle: `nmbrs` builds a [`run_state_actor::RunStateHandle`]
//! (the actor owns a private `RunState` and publishes immutable
//! `Arc<RunState>` snapshots via `arc_swap::ArcSwap`), hands the
//! handle to the runner-side executor via
//! [`observer::TuiObserver`] and to the TUI thread, and spawns
//! the TUI on a dedicated `std::thread` (not tokio — the TUI
//! never blocks the async runtime). Observers and the TUI both
//! mutate state by sending typed [`run_state_actor::RunStateCmd`]
//! messages into the actor's inbox; nothing ever takes a write
//! lock on shared state. See SRD-02 §"Display and Diagnostic
//! Decoupling".
//!
//! ## See also
//!
//! - SRD 62 (`docs/SRD/62_tui_layout.md`) — layout, LOD
//! cycle, phase status glyphs, spinner cadence, "scenario
//! done?" semantics.
//! - SRD 18b — scene tree (the canonical structure
//! `RunState.tree` mirrors).
//!
//! [ratatui]: https://crates.io/crates/ratatui
pub
pub
pub
pub
pub
pub