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    // Core types
40    CommandContext, CommandRegistry, CommandResult, CustomCommand, SlashCommand,
41    // Standard commands
42    ClearCommand, CompactCommand, HelpCommand, NewSessionCommand, QuitCommand,
43    SessionsCommand, StatusCommand, ThemesCommand, VersionCommand,
44    // Helper functions
45    default_commands, filter_commands, generate_help_message, get_command_by_name,
46    is_slash_command, parse_command,
47};
48
49// Re-export main types for convenience (now from widgets module)
50pub use widgets::{
51    // Core widgets
52    ChatView, MessageRole, TextInput, ToolMessageData, ToolStatus, RenderFn,
53    // ConversationView trait and factory
54    ConversationView, ConversationViewFactory,
55    // Registerable widgets
56    AnswerState, EnterAction, FocusItem, PermissionKeyAction, PermissionOption, PermissionPanel,
57    QuestionKeyAction, QuestionPanel, SessionInfo, SessionPickerState, SimpleCommand,
58    SlashCommandDisplay, SlashPopupState, StatusBar, StatusBarConfig, StatusBarData,
59    render_session_picker, render_slash_popup,
60};
61pub use markdown::{
62    parse_to_spans, parse_to_styled_words, render_markdown_with_prefix, split_content_segments,
63    wrap_with_prefix, ContentSegment,
64};
65pub use table::{is_table_line, is_table_separator, render_table, PulldownRenderer, TableRenderer};
66
67// Re-export theme types for convenience
68pub use themes::{
69    current_theme_name, default_theme_name, get_theme, init_theme, list_themes,
70    render_theme_picker, set_theme, theme as app_theme, Theme, ThemeInfo,
71    ThemePickerState, THEMES,
72};
73
74// Re-export layout types for convenience
75pub use layout::{
76    LayoutContext, LayoutProvider, LayoutResult, LayoutTemplate,
77    MinimalOptions, SidebarOptions, SidebarPosition, SidebarWidth,
78    SplitOptions, SplitRatio, StandardOptions, WidgetSizes,
79    helpers as layout_helpers,
80};
81
82// Re-export key handling types for convenience
83pub use keys::{
84    AppKeyAction, AppKeyResult, DefaultKeyHandler, ExitHandler, ExitState,
85    KeyBindings, KeyCombo, KeyContext, KeyHandler,
86};