English | 简体中文
A high-density Terminal (TUI) workbench built with Rust + Ratatui + Tokio, orchestrating CLI AI agents through RPC technology.
Meta-TUI connects to pi (or other CLI agents) via RPC, providing a three-panel TUI interface:
- Left panel: Active session + workspace tree (expandable session list)
- Center: Conversation/message area + bottom input box
- Right panel: Subagent list (AGENTS) + SKILLS + MCPS + TASKS (discovered from
~/.pi/agent/) - Bottom bar: Keyboard shortcuts + status hints + Context/Token/Cost info
Text selection is confined within each panel boundary; releasing the mouse automatically copies the selection to the system clipboard.
# Build
cargo build
# Print configuration info (without starting pi)
cargo run -- --dry-run
# Run TUI (automatically starts pi RPC backend)
cargo run -- --tui
# Run Router standalone mode (Provider config TUI)
cargo run -- --router
# Test
cargo test
cargo clippy -- -D warnings
cargo fmt --check| Component | Technology |
|---|---|
| Language | Rust (edition 2024, MSRV 1.85) |
| TUI Framework | Ratatui 0.30.2 + Crossterm 0.29 |
| Async Runtime | Tokio |
| RPC | Custom JSONL RPC Protocol |
| Error Handling | color-eyre + thiserror |
| Logging | tracing + tracing-subscriber |
meta-tui/
├── src/
│ ├── main.rs # Entry point + --dry-run
│ ├── lib.rs # Library root
│ ├── action.rs # Action enum
│ ├── app.rs # App state machine + TuiState
│ ├── persistence.rs # UI state persistence (state.json)
│ ├── tui.rs # TUI event loop (RPC + mouse/keyboard)
│ ├── selection.rs # Mouse selection highlighting + text collection
│ ├── config.rs # CLI argument parsing
│ ├── errors.rs # Error types
│ ├── logging.rs # Log initialization
│ ├── message.rs # ChatMessage + ContentBlock model
│ ├── theme.rs # Cyan industrial theme
│ ├── state.rs # Session state context management
│ ├── tui_state.rs # TUI layout state (scroll, collapse, cursor)
│ ├── router_tui.rs # Router standalone mode TUI (Provider config)
│ ├── utils.rs # Utility functions (JSON parsing, string utils)
│ ├── backend/
│ │ ├── mod.rs # AgentBackend trait
│ │ ├── rpc.rs # PiRpcBackend (process management)
│ │ ├── rpc_client.rs # JSONL RPC client
│ │ └── event.rs # PiEvent types + parsing
│ ├── provider/
│ │ ├── mod.rs # ProviderConfig + persistence
│ │ └── router.rs # axum HTTP reverse proxy
│ └── components/
│ ├── mod.rs # Component trait (&mut self)
│ ├── sidebar.rs # Left: session + workspace tree + PROVIDER/MODEL
│ ├── main_view.rs # Center: conversation + input + block collapse
│ ├── markdown.rs # Markdown → Ratatui Line renderer (GFM + code blocks)
│ ├── agent_panel.rs # Right: AGENTS / SKILLS / MCPS / TASKS
│ ├── bottom_bar.rs # Bottom: shortcuts + status + Token
│ ├── top_bar.rs # Top tab bar
│ └── popup.rs # Popup overlay
└── tests/
└── integration_test.rs
MIT