Expand description
§nmbrs-tui
Contract & axioms: SRD 59.
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 canonicalSceneTree(parent / children / status), the side-mappedPhaseSummaryper node, active-phase live counters, log ring buffer, ops-history sparkline data, etc.app::App— owns the render loop. ReadsRunStateat the tick rate (default 4 Hz) and produces a frame. Handles keyboard input (LOD cycle, log toggle, pause, help, control-edit prompt).reporter— anmbrs_metrics::scheduler::Reporterimplementation that observers register so per-tickMetricSetsnapshots flow intoRunState’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.treemirrors).
Modules§
- app
- TUI application: event loop, terminal setup, frame rendering.
- display_
sink DisplaySink— uniform consumer interface for the run-state snapshot stream.- formatted_
line_ sink FormattedLineSink— non-interactive, non-positioning display sink for log-archive / piped-stderr runs.- inspector_
repl nmbrs --inspector— interactive REPL TUI for the OOB introspection endpoint (seecrate::inspector_server).- inspector_
server - Out-of-band introspection endpoint.
- key_
watcher - Stdin keystroke watcher for terminal-mode display.
- log_
only_ observer LogOnlyObserver—RunObserverimpl fortui=offmode.- log_
only_ sink LogOnlySink—DisplaySinkimpl that renders every log entry to stderr.- observer
- TUI-driving [
RunObserver] implementation. - repl_
state - REPL visibility state machine.
- reporter
- TUI reporter: receives base-cadence metrics snapshots and forwards them to the TUI render thread via an mpsc channel. Used for sparkline feeds, history rings, and the live percentile display.
- run_
state_ actor - Display-side actor that owns
RunStateand publishes immutable snapshots. - sink_
supervisor SinkSupervisor— coordinates the activecrate::display_sink::DisplaySinkand thecrate::key_watcher::KeyWatcheracross atui=terminalrun.- state
- Shared state between the executor and the TUI display.
- status_
fold - SRD-100 P2 — consumer-side per-phase status renderer.