dde71cf8e2
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m12s
CI / quality (pull_request) Successful in 1m24s
CI / push-validation (pull_request) Successful in 33s
CI / helm (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 1m33s
CI / build (pull_request) Successful in 1m13s
CI / benchmark-regression (pull_request) Failing after 37s
CI / security (pull_request) Successful in 2m25s
CI / e2e_tests (pull_request) Successful in 4m31s
CI / unit_tests (pull_request) Successful in 6m25s
CI / integration_tests (pull_request) Successful in 6m24s
CI / docker (pull_request) Successful in 1m36s
CI / coverage (pull_request) Successful in 13m7s
CI / coverage (push) Blocked by required conditions
CI / docker (push) Blocked by required conditions
CI / status-check (push) Blocked by required conditions
CI / benchmark-publish (push) Waiting to run
CI / benchmark-regression (push) Waiting to run
CI / status-check (pull_request) Successful in 5s
CI / push-validation (push) Successful in 31s
CI / quality (push) Successful in 1m22s
CI / lint (push) Successful in 1m28s
CI / helm (push) Successful in 43s
CI / build (push) Successful in 1m0s
CI / security (push) Successful in 1m41s
CI / typecheck (push) Successful in 2m5s
CI / e2e_tests (push) Successful in 4m13s
CI / integration_tests (push) Successful in 4m37s
CI / unit_tests (push) Has been cancelled
Split docs/advanced-concepts.md (554 lines) into four sub-documents under docs/advanced-concepts/ and docs/tui.md (634 lines) into four sub-documents under docs/tui/, each under the 500-line limit per CONTRIBUTING.md. Advanced Concepts sub-documents: - docs/advanced-concepts/index.md: Overview, context strategies, LLM backends - docs/advanced-concepts/resource-types.md: Resource types, A2A rename - docs/advanced-concepts/container-tools.md: Container tools, scope chain, budgets, safety - docs/advanced-concepts/e2e-tests-and-plugins.md: E2E tests, code review, plugins TUI sub-documents: - docs/tui/index.md: Overview, getting started, main screen layout - docs/tui/sidebar-and-personas.md: Sidebar states, persona system - docs/tui/input-and-sessions.md: Reference/command input, session management - docs/tui/configuration-and-integration.md: Config, key bindings, theme, integration Updated mkdocs.yml navigation to reflect new sub-document structure. Updated CONTRIBUTORS.md with contribution entry for PR #9903. ISSUES CLOSED: #10533
210 lines
7.0 KiB
Markdown
210 lines
7.0 KiB
Markdown
# TUI: Configuration, Key Bindings, Theme & Integration (v3.7.0)
|
|
|
|
> **Milestone:** v3.7.0 — M8: TUI Implementation
|
|
> **Parent:** [TUI Overview](index.md)
|
|
|
|
---
|
|
|
|
## Configuration
|
|
|
|
### Settings Screen
|
|
|
|
The Settings screen (`F2` or `/settings`) provides a GUI for all TUI configuration:
|
|
|
|
- **Theme** — select from 17+ Textual built-in themes (default: Dracula)
|
|
- **Sidebar width** — configure the visible sidebar width (default: 32 chars)
|
|
- **Session persistence** — enable/disable session history persistence
|
|
- **Cost display** — configure cost display precision and currency
|
|
- **Notification duration** — configure how long Flash notifications stay visible
|
|
- **Keybindings** — view all keybindings (editing not yet supported in v3.7.0)
|
|
|
|
### Configuration File
|
|
|
|
TUI settings are stored in `~/.config/cleveragents/config.toml` under `[tui]`:
|
|
|
|
```toml
|
|
[tui]
|
|
theme = "dracula"
|
|
sidebar_width = 32
|
|
session_db_path = "~/.local/state/cleveragents/tui.db"
|
|
notification_duration = 3.0 # seconds
|
|
cost_display_precision = 2 # decimal places
|
|
```
|
|
|
|
TUI state (last persona, sidebar state, window dimensions) is stored separately in
|
|
`~/.config/cleveragents/tui-state.yaml`:
|
|
|
|
```yaml
|
|
last_persona: "feature-dev"
|
|
last_preset: "think: high"
|
|
last_session_id: "01HXM8C2..."
|
|
sidebar_state: "visible"
|
|
theme_override: null
|
|
window_width: 180
|
|
window_height: 50
|
|
```
|
|
|
|
---
|
|
|
|
## Key Bindings
|
|
|
|
### Global Bindings
|
|
|
|
| Key | Action |
|
|
|-----|--------|
|
|
| `ctrl+q` | Quit the TUI |
|
|
| `F1` | Open context-sensitive help panel |
|
|
| `F2` / `ctrl+,` | Open Settings screen |
|
|
| `ctrl+s` | Open Sessions screen |
|
|
| `ctrl+n` | New session tab |
|
|
| `ctrl+w` | Close current session tab |
|
|
| `ctrl+[` | Previous session tab |
|
|
| `ctrl+]` | Next session tab |
|
|
|
|
### Conversation Bindings
|
|
|
|
| Key | Action |
|
|
|-----|--------|
|
|
| `alt+up` | Move block cursor up |
|
|
| `alt+down` | Move block cursor down |
|
|
| `enter` / `space` | Expand/collapse focused block |
|
|
| `ctrl+b` | Focus sidebar (when visible) |
|
|
|
|
### Prompt Bindings
|
|
|
|
| Key | Action |
|
|
|-----|--------|
|
|
| `tab` | Cycle to next persona |
|
|
| `ctrl+tab` | Cycle to next argument preset |
|
|
| `shift+tab` | Cycle sidebar state (hidden → visible → fullscreen) |
|
|
| `shift+enter` / `ctrl+j` | Insert newline (multi-line mode) |
|
|
| `escape` | Dismiss overlay / exit multi-line mode / navigate toward main screen |
|
|
|
|
### Sidebar Bindings (when focused)
|
|
|
|
| Key | Action |
|
|
|-----|--------|
|
|
| `up` / `down` | Navigate plan/project list |
|
|
| `enter` | Open detail modal for selected item |
|
|
| `escape` | Return focus to prompt |
|
|
|
|
---
|
|
|
|
## Theme and Styling
|
|
|
|
The TUI uses Textual's CSS (TCSS) system with semantic color tokens. The default theme is
|
|
**Dracula**. All 17+ Textual built-in themes are supported and switchable via:
|
|
|
|
```bash
|
|
/theme dracula # Switch to Dracula theme
|
|
/theme nord # Switch to Nord theme
|
|
/theme monokai # Switch to Monokai theme
|
|
/theme # Show current theme
|
|
```
|
|
|
|
Or via the Settings screen (`F2`).
|
|
|
|
### Throbber
|
|
|
|
A rainbow gradient animated bar spans the full width of the screen at the top, visible only
|
|
when the actor is processing. The gradient cycles through a 12-color spectrum at 15fps.
|
|
When idle, the throbber row collapses to zero height.
|
|
|
|
### Notification System
|
|
|
|
The Flash bar (height: 1, above the prompt) displays transient notifications:
|
|
|
|
- **Info** — blue, 3 seconds
|
|
- **Warning** — yellow, 5 seconds
|
|
- **Error** — red, 10 seconds (or until dismissed with `escape`)
|
|
- **Success** — green, 3 seconds
|
|
|
|
---
|
|
|
|
## TuiMaterializer — Output Rendering Integration
|
|
|
|
The `TuiMaterializer` bridges the existing `OutputSession` / `ElementHandle` pipeline
|
|
(ADR-021) to Textual widgets. All existing CLI command producers render in the TUI without
|
|
modification — the same code that renders Rich tables in the CLI renders interactive Textual
|
|
widgets in the TUI.
|
|
|
|
| ElementHandle Type | Textual Widget |
|
|
|--------------------|----------------|
|
|
| `PanelHandle` | `Static` container with key-value `Label` pairs in a `Collapsible` |
|
|
| `TableHandle` | `DataTable` widget |
|
|
| `TreeHandle` | `Tree` widget |
|
|
| `ProgressHandle` | `ProgressBar` (determinate) or `Throbber` (indeterminate) |
|
|
| `StatusHandle` | `Label` with semantic CSS class |
|
|
| `CodeHandle` | Read-only `TextArea` with tree-sitter syntax highlighting |
|
|
| `DiffHandle` | Custom `DiffView` widget (unified and side-by-side modes) |
|
|
| `SeparatorHandle` | `Rule` widget |
|
|
| `ActionHintHandle` | `Static` with muted text and command references |
|
|
|
|
---
|
|
|
|
## Real-Time A2A Event Subscription
|
|
|
|
The TUI subscribes to A2A events for real-time visibility into system activity:
|
|
|
|
| Event | TUI Effect |
|
|
|-------|-----------|
|
|
| `plan.phase_changed` | Sidebar PlansPanel: update phase indicator |
|
|
| `plan.state_changed` | Sidebar PlansPanel: update state badge |
|
|
| `plan.decision_made` | Sidebar PlansPanel: update depth counter |
|
|
| `tool.invoked` | Conversation: mount ToolCall widget (pending) |
|
|
| `tool.completed` | Conversation: update ToolCall widget (done/fail) |
|
|
| `validation.completed` | Conversation: append validation result |
|
|
| `plan.apply_completed` | Sidebar: update terminal state; Flash: show completion |
|
|
| `plan.error` | Flash: show error; Sidebar: mark plan as errored |
|
|
| `session.message` | Conversation: stream ActorResponse content |
|
|
|
|
In local mode, events arrive via RxPY observables. In server mode, events arrive via A2A
|
|
`TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent` via SSE.
|
|
|
|
---
|
|
|
|
## Content Pruning and Safety Behaviors
|
|
|
|
### Content Pruning
|
|
|
|
When the conversation stream exceeds the configurable threshold (default: 500 message blocks),
|
|
old messages are automatically collapsed (not deleted) to maintain rendering performance.
|
|
Collapsed messages remain in the session history and can be expanded by scrolling up.
|
|
|
|
Configure the pruning threshold:
|
|
|
|
```toml
|
|
[tui]
|
|
conversation_prune_threshold = 500
|
|
```
|
|
|
|
### Safety Behaviors
|
|
|
|
The TUI enforces safety behaviors from the active persona's safety profile:
|
|
|
|
- **Shell danger detection** — commands matching destructive patterns are highlighted in red
|
|
with a confirmation overlay before execution
|
|
- **Permission questions** — single-file tool operations render an inline `PermissionQuestionWidget`
|
|
in the conversation stream; multi-file operations push the full `PermissionsScreen`
|
|
- **Cost warnings** — when session cost approaches the configured budget, a persistent warning
|
|
appears in the Flash bar
|
|
- **Loading states** — the throbber and per-block loading indicators prevent user confusion
|
|
during long-running operations
|
|
|
|
---
|
|
|
|
## Related ADRs
|
|
|
|
| ADR | Title | Relevance |
|
|
|-----|-------|-----------|
|
|
| [ADR-044](../adr/ADR-044-tui-architecture-and-framework.md) | TUI Architecture and Framework | Core TUI design decisions |
|
|
| [ADR-021](../adr/ADR-021-cli-and-output-rendering.md) | CLI and Output Rendering | TuiMaterializer integration |
|
|
| [ADR-026](../adr/ADR-026-agent-client-protocol.md) | Agent-to-Agent Protocol (A2A) | TUI-to-application communication |
|
|
|
|
---
|
|
|
|
*Documentation for v3.7.0 — IN PROGRESS. Features described here reflect the planned scope
|
|
as of 2026-04-15. Some features may be adjusted as implementation progresses.*
|
|
|
|
*Generated by [AUTO-DOCS-5] — CleverAgents Documentation Bot*
|