limit_cli/tui/mod.rs
1//! TUI (Terminal User Interface) module for limit-cli
2//!
3//! This module provides a rich terminal interface for interacting with the Limit AI agent.
4//!
5//! # Architecture
6//!
7//! The TUI system is organized into several components:
8//!
9//! - **State**: Core state types (`TuiState`, `FileAutocompleteState`)
10//! - **Bridge**: Connection between agent and UI (`TuiBridge`)
11//! - **App**: Main application loop (`TuiApp`)
12//! - **Input**: Input handling (`InputHandler`, `InputEditor`, `ClipboardHandler`)
13//! - **Activity**: Activity message formatting
14//! - **Autocomplete**: File autocomplete management
15//!
16//! # Example
17//!
18//! ```no_run
19//! use limit_cli::tui::app::{TuiBridge, TuiApp};
20//! use limit_cli::agent_bridge::AgentBridge;
21//! use limit_llm::{Config, ProviderConfig};
22//! use tokio::sync::mpsc;
23//! use std::collections::HashMap;
24//!
25//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
26//! // Create config
27//! let mut providers = HashMap::new();
28//! providers.insert("anthropic".to_string(), ProviderConfig {
29//! api_key: Some("test-key".to_string()),
30//! model: "claude-3-5-sonnet-20241022".to_string(),
31//! base_url: None,
32//! max_tokens: 4096,
33//! timeout: 60,
34//! max_iterations: 100,
35//! thinking_enabled: false,
36//! clear_thinking: true,
37//! });
38//! let config = Config { provider: "anthropic".to_string(), providers, browser: limit_llm::BrowserConfigSection::default() };
39//!
40//! // Create agent bridge and event channel
41//! let (tx, rx) = mpsc::unbounded_channel();
42//! let bridge = AgentBridge::new(config)?;
43//!
44//! // Create TUI bridge
45//! let tui_bridge = TuiBridge::new(bridge, rx)?;
46//!
47//! // Run TUI app
48//! let mut app = TuiApp::new(tui_bridge)?;
49//! app.run()?;
50//! # Ok(())
51//! # }
52//! ```
53
54mod state;
55
56pub mod activity;
57pub mod app;
58pub mod autocomplete;
59pub mod bridge;
60pub mod commands;
61pub mod input;
62pub mod ui;
63
64// Re-export public API
65pub use input::InputHandler;
66pub use state::{FileAutocompleteState, TuiState, MAX_PASTE_SIZE};