Skip to main content

agent_core/tui/
mod.rs

1//! LLM TUI Components
2//!
3//! Reusable Ratatui components for LLM-powered terminal applications.
4//!
5//! This module provides:
6//!
7//! - App - Complete TUI application with chat, input, and command handling
8//! - ChatView - Chat message display with streaming support
9//! - Layout system - Flexible layout system with templates and custom layouts
10//! - Permission and question panels for tool interactions
11//! - Markdown rendering with theming support
12//! - Table rendering
13//! - Session pickers
14//! - Slash command system
15//! - Text input with cursor management
16//! - Theme system with 45+ built-in themes
17
18mod app;
19/// Slash command system.
20pub mod commands;
21/// Key handling and bindings.
22pub mod keys;
23/// Layout templates and providers.
24pub mod layout;
25/// Markdown rendering utilities.
26pub mod markdown;
27/// Table rendering utilities.
28pub mod table;
29/// Theme system and built-in themes.
30pub mod themes;
31/// TUI widgets (chat, input, panels).
32pub mod widgets;
33
34// Re-export App and related types
35pub use app::{App, AppConfig};
36
37// Re-export command system types
38pub use commands::{
39    // Standard commands
40    ClearCommand,
41    // Core types
42    CommandContext,
43    CommandRegistry,
44    CommandResult,
45    CompactCommand,
46    CustomCommand,
47    HelpCommand,
48    NewSessionCommand,
49    QuitCommand,
50    SessionsCommand,
51    SlashCommand,
52    StatusCommand,
53    ThemesCommand,
54    VersionCommand,
55    // Helper functions
56    default_commands,
57    filter_commands,
58    generate_help_message,
59    get_command_by_name,
60    is_slash_command,
61    parse_command,
62};
63
64// Re-export main types for convenience (now from widgets module)
65pub use markdown::{
66    ContentSegment, parse_to_spans, parse_to_styled_words, render_markdown_with_prefix,
67    split_content_segments, wrap_with_prefix,
68};
69pub use table::{PulldownRenderer, TableRenderer, is_table_line, is_table_separator, render_table};
70pub use widgets::{
71    // Registerable widgets
72    AnswerState,
73    // Core widgets
74    ChatView,
75    // ConversationView trait and factory
76    ConversationView,
77    ConversationViewFactory,
78    EnterAction,
79    FocusItem,
80    MessageRole,
81    PermissionKeyAction,
82    PermissionOption,
83    PermissionPanel,
84    QuestionKeyAction,
85    QuestionPanel,
86    RenderFn,
87    SessionInfo,
88    SessionPickerState,
89    SimpleCommand,
90    SlashCommandDisplay,
91    SlashPopupState,
92    StatusBar,
93    StatusBarConfig,
94    StatusBarData,
95    TextInput,
96    ToolMessageData,
97    ToolStatus,
98    render_session_picker,
99    render_slash_popup,
100};
101
102// Re-export theme types for convenience
103pub use themes::{
104    THEMES, Theme, ThemeInfo, ThemePickerState, current_theme_name, default_theme_name, get_theme,
105    init_theme, list_themes, render_theme_picker, set_theme, theme as app_theme,
106};
107
108// Re-export layout types for convenience
109pub use layout::{
110    LayoutContext, LayoutProvider, LayoutResult, LayoutTemplate, MinimalOptions, SidebarOptions,
111    SidebarPosition, SidebarWidth, SplitOptions, SplitRatio, StandardOptions, WidgetSizes,
112    helpers as layout_helpers,
113};
114
115// Re-export key handling types for convenience
116pub use keys::{
117    AppKeyAction, AppKeyResult, DefaultKeyHandler, ExitHandler, ExitState, KeyBindings, KeyCombo,
118    KeyContext, KeyHandler,
119};