1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! 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
//! - **InputQueue**: Message queue for async operations
//!
//! # Example
//!
//! ```no_run
//! use limit_cli::tui::app::{TuiBridge, TuiApp};
//! use limit_cli::agent_bridge::AgentBridge;
//! use limit_llm::{Config, ProviderConfig, CompactionSettings, CacheSettings};
//! use tokio::sync::mpsc;
//! use std::collections::HashMap;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // 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(),
//! compaction: CompactionSettings::default(),
//! cache: CacheSettings::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()?;
//! # Ok(())
//! # }
//! ```
// Re-export public API
pub use InputHandler;
pub use InputQueue;
pub use ;