Skip to main content

Module tui

Module tui 

Source
Expand description

TUI frontend for agent-core.

This module provides a ratatui-based terminal interface for agents. Use AgentCoreExt::into_tui() to convert an AgentCore into a TuiRunner.

Modules§

agent
Agent infrastructure and configuration. Agent Infrastructure
client
LLM client interface and provider implementations. LLM client with provider-agnostic interface.
commands
Slash command system. Slash command system for the TUI.
controller
LLM session controller and tool execution. LLM session controller and tool execution framework.
keys
Key handling and bindings. Customizable key handling for LLM TUI applications.
layout
Layout templates and providers. Layout system for TUI widgets
markdown
Markdown rendering utilities. Markdown parsing utilities for TUI rendering
permissions
Permission system for controlling agent access to resources. Permission system for controlling agent access to resources.
table
Table rendering utilities. Table rendering utilities for TUI
themes
Theme system and built-in themes. Application-level TUI components
widgets
TUI widgets (chat, input, panels). TUI Widgets

Macros§

define_theme
Macro to define a theme from a color palette. Generates the pub fn theme() -> Theme function.
register_themes
Macro to register all themes with their metadata. Generates mod declarations, THEMES array, and get_theme function.

Structs§

App
Terminal UI application with chat, input, and command handling.
AppConfig
Configuration for the App
BatchPermissionPanel
State for the batch permission panel
ChatView
Chat message display widget with streaming and tool execution support.
ClearCommand
Clear the conversation history.
CommandContext
Context provided to commands during execution.
CommandRegistry
Registry of slash commands for an agent.
CompactCommand
Compact the conversation history.
CustomCommand
A simple custom command using a closure.
DefaultKeyHandler
Default key handler with configurable bindings.
HelpCommand
Show available commands and usage.
KeyBindings
Key binding configuration.
KeyCombo
A key combination (key + modifiers).
KeyContext
Context provided to the KeyHandler.
LayoutContext
Context available during layout computation
LayoutResult
Result of layout computation
MinimalOptions
Options for minimal layout (no status bar, no panels)
NewSessionCommand
Create a new LLM session.
PermissionPanel
State for the permission panel
PulldownRenderer
Renders tables using pulldown-cmark parsing
QuestionPanel
State for the question panel overlay
QuitCommand
Exit the application.
SessionInfo
Information about a session for display purposes Information about an LLM session for display in the session picker.
SessionPickerState
State for the session picker
SessionsCommand
View and switch between sessions.
SidebarOptions
Options for sidebar layout
SimpleCommand
A simple command implementation for testing
SlashPopupState
State for the slash command popup
SplitOptions
Options for split layout (two main areas)
StandardOptions
Options for the standard vertical layout
StatusBar
Status bar widget implementation
StatusBarConfig
Configuration for the status bar widget
StatusBarData
Data required for rendering the status bar
StatusCommand
Show current session status.
TextInput
Text input buffer with cursor management
Theme
Complete theme definition for the TUI.
ThemeInfo
Theme metadata for display in picker
ThemePickerState
State for the theme picker
ThemesCommand
Open the theme picker to change colors.
ToolMessageData
Data for tool execution messages Display data for tool execution messages.
TuiRunner
TUI configuration that extends AgentCore with TUI-specific settings.
VersionCommand
Show application version.
WidgetSizes
Pre-computed widget size information

Enums§

AnswerState
Answer state for a single question
AppKeyAction
Application-level key actions.
AppKeyResult
Result of handling a key event at the App level.
CommandResult
Result of executing a slash command.
ContentSegment
Content segment type for splitting text and tables
EnterAction
Result of pressing Enter
ExitState
Exit confirmation state for key handlers.
FocusItem
Represents a focusable item in the panel
LayoutTemplate
Layout templates with customization options
MessageRole
Role of a chat message
PermissionKeyAction
Result of handling a key event
PermissionOption
Options available for the user to select
QuestionKeyAction
Result of handling a key event
SidebarPosition
Sidebar position
SidebarWidth
Sidebar width specification
SplitRatio
Split ratio specification
ToolStatus
Status of a tool execution

Constants§

THEMES
All available themes

Traits§

AgentCoreExt
Extension trait to add TUI functionality to AgentCore.
ConversationView
Trait for conversation/chat display widgets.
ExitHandler
Optional hook for agent cleanup on exit.
KeyHandler
Trait for customizing key handling at the App level.
LayoutProvider
Trait for custom layout providers
SlashCommand
Trait for slash commands.
SlashCommandDisplay
Trait for displaying slash commands in the popup.
TableRenderer
Trait for table rendering strategies

Functions§

app_theme
Get the current theme (cloned for safe access)
current_theme_name
Get the current theme name
default_commands
Returns the standard set of commands most agents will want.
default_theme_name
Get default theme name
filter_commands
Filter commands that match the given input prefix.
generate_help_message
Generate help message listing all available commands.
get_command_by_name
Get a command by its exact name.
get_theme
Get a theme by name
init_theme
Initialize the global theme (call once at startup)
is_slash_command
Check if input starts with a slash command.
is_table_line
Check if a line could be part of a table (contains |)
is_table_separator
Check if a line is a table separator (|—|—|)
list_themes
List all available theme names
parse_command
Parse slash command from input, returning (command_name, args).
parse_to_spans
Parse markdown text into styled ratatui spans
parse_to_styled_words
Parse markdown and split into words with their styles
render_markdown_with_prefix
Render markdown content with diamond prefix and manual wrapping
render_session_picker
Render the session picker
render_slash_popup
Render the slash command popup
render_table
Render a table using PulldownRenderer
render_theme_picker
Render the theme picker
set_theme
Set a new theme at runtime
split_content_segments
Split content into text, table, and code block segments
wrap_with_prefix
Wrap text with a first-line prefix and continuation prefix

Type Aliases§

ConversationViewFactory
Type alias for conversation view factory functions.
RenderFn
Type alias for render callbacks used by ChatView