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`] - 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;
19pub mod keys;
20pub mod layout;
21pub mod themes;
22mod commands;
23pub mod markdown;
24pub mod messages;
25pub mod table;
26pub mod widgets;
27
28// Re-export App and related types
29pub use app::{App, AppConfig};
30pub use commands::{
31    filter_commands, generate_help_message, get_command_by_name, get_default_commands,
32    is_slash_command, parse_command, SlashCommand, DEFAULT_COMMANDS,
33};
34
35// Re-export main types for convenience (now from widgets module)
36pub use widgets::{
37    // Core widgets
38    ChatView, MessageRole, TextInput, ToolMessageData, ToolStatus, RenderFn,
39    // Chat helpers for customization
40    centered_text, title_bar, welcome_art, welcome_art_styled,
41    // Registerable widgets
42    AnswerState, EnterAction, FocusItem, PermissionKeyAction, PermissionOption, PermissionPanel,
43    QuestionKeyAction, QuestionPanel, SessionInfo, SessionPickerState, SimpleCommand,
44    SlashCommandTrait, SlashPopupState, render_session_picker, render_slash_popup,
45};
46pub use markdown::{
47    parse_to_spans, parse_to_styled_words, render_markdown_with_prefix, split_content_segments,
48    wrap_with_prefix, ContentSegment,
49};
50pub use table::{is_table_line, is_table_separator, render_table, PulldownRenderer, TableRenderer};
51pub use messages::{different_random_index, random_message_index, FUNNY_MESSAGES};
52
53// Re-export theme types for convenience
54pub use themes::{
55    current_theme_name, default_theme_name, get_theme, init_theme, list_themes,
56    render_theme_picker, set_theme, theme as app_theme, Theme, ThemeInfo,
57    ThemePickerState, THEMES,
58};
59
60// Re-export layout types for convenience
61pub use layout::{
62    LayoutContext, LayoutProvider, LayoutResult, LayoutTemplate,
63    MinimalOptions, SidebarOptions, SidebarPosition, SidebarWidth,
64    SplitOptions, SplitRatio, StandardOptions, WidgetSizes,
65    helpers as layout_helpers,
66};
67
68// Re-export key handling types for convenience
69pub use keys::{
70    AppKeyAction, AppKeyResult, DefaultKeyHandler, ExitHandler, ExitState,
71    KeyBindings, KeyCombo, KeyContext, KeyHandler,
72};