Rebuild grid agent TUI with Ratatui dashboards
Some checks failed
CI / rust-skia (Rust only) (push) Has been cancelled
CI / required (push) Has been cancelled

This commit is contained in:
2026-08-23 18:40:27 +02:00
parent 5a533dfa00
commit 95cca3e777
7 changed files with 2283 additions and 435 deletions

View File

@@ -1,8 +1,9 @@
# Grid-agent operator TUI
The operator TUI is a pure-Rust, cross-platform view of the versioned control
plane. Embedded and split modes use the same reducer, snapshots, commands, and
authenticated control requests; the UI never reads private runtime state.
The operator TUI is a pure-Rust, cross-platform Ratatui dashboard over the
versioned control plane. Embedded and split modes use the same reducer,
snapshots, widgets, commands, and authenticated control requests; the UI never
reads private runtime state. Standalone preferences uses the same Ratatui form.
Run an embedded UI with a live-grid integrated configuration:
@@ -31,19 +32,33 @@ Up/Down to select, Enter to edit/commit, `w` to save, and Esc to cancel. Changes
to connection or authorization settings apply after restart. A one-time
`--import-env /path/to/.env` migrates legacy `GRID_*` and `OPENAPI_*` values.
Use Tab/arrow keys to change panels and scroll. `r` refreshes; `p`/`u` pause or
resume; `f` reconnects the grid; `a`/`d` approve or deny the first pending
approval; `x` cancels the newest visible action; `e` expires the first visible
session; `t` toggles the first roaming schedule; `s` requests shutdown; and
`q` or Ctrl-C exits. Mutations other than pause/resume require confirmation,
with shutdown marked high risk. Exiting or crashing a split TUI does not stop
the service.
The Overview dashboard shows readiness, region/pose, behavior, build and visual
work, approvals, and recent failures. Queues & budgets shows real queue and
rate-limit gauges, active work, outcome counts, dropped events, aggregate
latency, and a bounded 120-refresh history. Sessions, roaming schedules,
approvals, timeline/audit, errors, diagnostics, health, and preferences retain
focused tables or panels and contextual detail. Missing backend data is marked
unavailable rather than estimated.
Rendering is terminal-independent, Unicode display-width aware, responsive to
resize events, and monochrome when `NO_COLOR` is set or `TERM=dumb`. Input uses
a bounded queue. Snapshot ticks coalesce while a request is slow, and timeline
storage is bounded. The terminal guard restores raw mode, cursor visibility,
and the alternate screen on success, error, Ctrl-C, or panic unwinding.
Use Tab/Shift-Tab or Left/Right to change panels and Up/Down to select rows.
`/` searches event, audit, correlation, time, duration, result, and reason data;
Enter applies the search and Esc clears it. `r` refreshes; `p`/`u` pause or
resume; `f` reconnects the grid; `a`/`d` approve or deny the selected approval;
`x` cancels the newest visible action; `e` expires the selected session; `t`
toggles the selected roaming schedule; `s` requests shutdown; and `q` or
Ctrl-C exits. Mutations other than pause/resume require confirmation, with
shutdown marked high risk. Exiting or crashing a split TUI does not stop the
service.
Ratatui's Crossterm backend provides buffered/diff rendering without clearing
the full screen on every frame. Layouts respond to resize and collapse to a
compact status view on very small terminals; focus and failure markers remain
visible without color when `NO_COLOR` is set or `TERM=dumb`. Input, refresh
work, results, event history, errors, and performance history are all bounded.
Slow snapshots run outside the input reducer, and refresh ticks are dropped
when the bounded worker queue is full. The terminal guard restores raw mode,
cursor visibility, and the alternate screen on success, error, Ctrl-C, or
panic unwinding.
Diagnostic panels show only explicitly captured redacted envelopes. Prompt
and response content, API keys, grid passwords, operator tokens, capability
@@ -52,7 +67,8 @@ URLs, and model reasoning have no TUI representation.
Focused verification:
```sh
cargo test --locked -p metacrate-grid-agent --lib tui_tests
cargo test --locked -p metacrate-grid-agent tui --lib
cargo test --locked -p metacrate-grid-agent --test preferences_config
cargo test --locked -p metacrate-grid-agent --test dependency_policy
cargo clippy --locked -p metacrate-grid-agent --all-targets --features live-grid -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --locked -p metacrate-grid-agent --no-deps