[Terminal UI (TUI)]

Master reference for the full-screen terminal operations cockpit, keyboard shortcuts, view registries, and resilience engines.

The Hoox Terminal User Interface (TUI) is a full-screen, keyboard-driven operations cockpit built with OpenTUI, React 19, and Zustand. It provides real-time visibility into the edge trading mesh—workers, logs, trades, config, queues, KV, secrets, D1, and AI chat—without leaving the terminal.


Launching the TUI

# 1. Recommended: via the hoox CLI
hoox tui

# 2. Optional flags (forwarded as env to the renderer)
hoox tui --fps 60
hoox tui --no-mouse

# 3. Development: package entry
cd packages/tui && bun run dev

# 4. Built bundle
cd packages/tui && bun run build && bun run start

Requirements: Bun ≥ 1.2, 256-color terminal, minimum 80×24, OpenTUI installed via bun install.

Persistent UI state lives under $HOME/.hoox/.tui-state/ (session, crash log, chat history, DB query history).


⌨ Global Keyboard Navigation

ShortcutAction
Ctrl+1Dashboard — system health overview
Ctrl+2Workers Overview — 2-column worker cards
Ctrl+3Worker Detail — metrics / logs / DOs / config (select a worker first)
Ctrl+4Trade Monitor — live fills + positions + performance
Ctrl+5Logs Viewer — filtered log stream
Ctrl+6Service Manager — deploy / repair / kill-switch / edge map
Ctrl+7Config Editor — TOML/JSON editor + validate
Ctrl+8Setup Wizard — onboarding
Ctrl+9Settings — preferences, check setup, fix
Ctrl+0Queue Depth — backlog visualization
Ctrl+Alt+KKV Viewer — read-only KV browser
Ctrl+Alt+SSecrets Viewer — secret names only (never values)
Ctrl+Alt+CAI Chat — streaming agent chat
Ctrl+Alt+QDB Query — read-only D1 SQL
Ctrl+Alt+EEdge Topology — graph-metadata mesh map
Ctrl+PCommand palette (fuzzy)
Ctrl+BToggle sidebar
Ctrl+RRefresh worker data
Ctrl+QQuit (confirmation dialog)
EscClose palette / dismiss modal
Tab / Shift+TabCycle focus
EnterSelect / confirm
SpaceToggle (e.g. pause trade feed)
/Search (searchable views)

If Ctrl+Q is swallowed by XON/XOFF flow control: stty -ixon, or use Ctrl+P → QUIT HOOX.


All 15 Views

1. Dashboard (Ctrl+1)

Service health grid, kill-switch status, auto-repair (hoox check fix), AI model health, alerts, quick stats (P&L, trades, AI calls).

2. Workers Overview (Ctrl+2)

2-column cards: status, uptime, CPU, memory, requests, DO count, edges. Enter opens Worker Detail. Actions: logs / deploy / repair via CLI bridge.

3. Worker Detail (Ctrl+3)

Four panes for the selected worker (select from Workers first): metrics, live logs, Durable Objects (names inferred from count), config preview (hoox config show with fallbacks).

4. Trade Monitor (Ctrl+4)

Live trade feed (SSE /trades/stream when API is up), open positions, today/7d/30d P&L, win rate, Sharpe. Space pauses the feed.

5. Logs Viewer (Ctrl+5)

Level + worker filters, text search, pause, fetch via hoox logs, export to ~/.hoox/logs-export-*.json. SSE /logs/stream when API is up.

6. Service Manager (Ctrl+6)

Per-worker deploy/repair, deploy-all, rebuild, kill-switch show/engage/disengage, interactive PoP-style edge map.

7. Config Editor (Ctrl+7)

File tree + TOML/JSON syntax highlighting, live validate (hoox config validate), format on demand.

8. Setup Wizard (Ctrl+8)

Guided onboarding (Cloudflare, exchanges, AI, strategies, Telegram) ending in deploy.

9. Settings (Ctrl+9)

Theme / notifications / refresh interval / shortcuts reference, Check Setup, Check Fix, config path display.

10. Queue Depth (Ctrl+0)

Queue backlog snapshot via hoox monitor queue-depth (auto-refresh while focused).

11. KV Viewer (Ctrl+Alt+K)

Read-only list + on-demand value reveal for non-secret keys (config kv list / get). Writes stay CLI-only.

12. Secrets Viewer (Ctrl+Alt+S)

Read-only names and metadata only — values are never fetched or shown.

13. AI Chat (Ctrl+Alt+C)

Streaming chat with agent worker models. History persisted under .tui-state/chat-history.json (Bun has no localStorage).

14. DB Query (Ctrl+Alt+Q)

Read-only SQL (SELECT / WITH / EXPLAIN only). Client-side validation + CLI enforcement. History under .tui-state/db-query-history.json.

15. Edge Topology (Ctrl+Alt+E)

Interactive map from monorepo graph-metadata.json (workers, infrastructure, communities, data flows). Resolves the file from CWD or monorepo root.


Data channels

ChannelRole
HTTPfetchWorkers + API when HOOX_API_URL is reachable
CLI bridgeSpawns hoox … for deploy, logs, config, queues, KV, secrets, D1, health
SSETrade + log streams (streamTrades / streamLogs) started after session restore when the API is available

Connection state machine: connectedreconnectingoffline (status bar pills + expandable CLI error panel).


Crash protection

  1. Per-view ErrorBoundary — a broken view shows Retry; sidebar/status keep running.
  2. CrashRecoveryApp — process-level trap → Restart / Safe Mode / Report Bug → $HOME/.hoox/.tui-state/crash.log.

Troubleshooting

SymptomFix
Garbled prompt after exitreset or tput reset
Ctrl+Q ignoredstty -ixon or command palette Quit
Layout brokenResize to ≥ 80×24; export TERM=xterm-256color
OFFLINE foreverStart mesh / set HOOX_API_URL, ensure hoox on PATH
Topology emptyRun from monorepo root or bun run graph to refresh metadata

Next steps