Skip to main content

Module tui

Module tui 

Source
Expand description

TUI (Terminal User Interface) module for limit-cli

This module provides a rich terminal interface for interacting with the Limit AI agent.

§Architecture

The TUI system is organized into several components:

  • State: Core state types (TuiState, FileAutocompleteState)
  • Bridge: Connection between agent and UI (TuiBridge)
  • App: Main application loop (TuiApp)
  • Input: Input handling (InputHandler, InputEditor, ClipboardHandler)
  • Activity: Activity message formatting
  • Autocomplete: File autocomplete management

§Example

use limit_cli::tui::app::{TuiBridge, TuiApp};
use limit_cli::agent_bridge::AgentBridge;
use limit_llm::{Config, ProviderConfig};
use tokio::sync::mpsc;
use std::collections::HashMap;

// Create config
let mut providers = HashMap::new();
providers.insert("anthropic".to_string(), ProviderConfig {
    api_key: Some("test-key".to_string()),
    model: "claude-3-5-sonnet-20241022".to_string(),
    base_url: None,
    max_tokens: 4096,
    timeout: 60,
    max_iterations: 100,
    thinking_enabled: false,
    clear_thinking: true,
});
let config = Config { provider: "anthropic".to_string(), providers, browser: limit_llm::BrowserConfigSection::default() };

// Create agent bridge and event channel
let (tx, rx) = mpsc::unbounded_channel();
let bridge = AgentBridge::new(config)?;

// Create TUI bridge
let tui_bridge = TuiBridge::new(bridge, rx)?;

// Run TUI app
let mut app = TuiApp::new(tui_bridge)?;
app.run()?;

Re-exports§

pub use input::InputHandler;

Modules§

activity
Activity message formatting for TUI
app
TUI Application module
autocomplete
File autocomplete manager for TUI
bridge
TUI Bridge module
commands
Command system for TUI
input
Input handling module for TUI
ui
UI rendering module

Structs§

FileAutocompleteState
State for file autocomplete popup

Enums§

TuiState
TUI state for displaying agent events

Constants§

MAX_PASTE_SIZE
Maximum paste size to prevent memory issues (300KB)