Skip to main content

entrenar/monitor/tui/
mod.rs

1//! Detached TUI Monitor (SPEC-FT-001 Section 10)
2//!
3//! Implements the producer-consumer pattern for real-time training visualization.
4//!
5//! # Architecture
6//!
7//! ```text
8//! ┌──────────────┐          ┌──────────────┐
9//! │  Trainer     │──write──▶│  Metric      │◀──read──│  TUI Monitor │
10//! │  (Producer)  │          │  Store (IPC) │          │  (Consumer)  │
11//! └──────────────┘          └──────────────┘          └──────────────┘
12//! ```
13//!
14//! The TUI runs in a separate process/shell, reading state without blocking training.
15//!
16//! # Usage
17//!
18//! ```bash
19//! # Shell 1: Start training (writes to metric store)
20//! cargo run --example finetune_test_gen -- --output ./experiments/ft-001
21//!
22//! # Shell 2: Attach TUI monitor (reads from metric store)
23//! cargo run --example finetune_test_gen -- --monitor --experiment ./experiments/ft-001
24//! ```
25//!
26//! # Toyota Way: Andon (アンドン)
27//!
28//! Visual alerting system for immediate problem detection.
29//! Loss spikes, OOM warnings, and gradient explosions trigger visual alerts.
30
31pub mod app;
32pub mod color;
33pub mod dashboard;
34pub mod headless;
35pub mod panel;
36pub mod render;
37pub mod state;
38
39pub use app::{TrainingStateWriter, TuiMonitor, TuiMonitorConfig};
40pub use color::{colored_bar, colored_value, ColorMode, Rgb, Styled, TrainingPalette};
41pub use dashboard::TrainingDashboard;
42pub use headless::{
43    HeadlessGpu, HeadlessMonitor, HeadlessOutput, HeadlessSample, HeadlessWriter, OutputFormat,
44};
45pub use panel::{
46    layout_can_render, verify_layout, GpuPanel, LossCurvePanel, MetricsPanel, Panel,
47    PanelVerification, ProcessPanel, SamplePanel,
48};
49pub use render::{
50    render_braille_chart, render_gauge, render_layout, render_layout_colored, BrailleChart,
51};
52pub use state::{
53    GpuProcessInfo, GpuTelemetry, LossTrend, SamplePeek, TrainingSnapshot, TrainingState,
54    TrainingStatus,
55};