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() -> Themefunction. - 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
- Batch
Permission Panel - State for the batch permission panel
- Chat
View - Chat message display widget with streaming and tool execution support.
- Clear
Command - Clear the conversation history.
- Command
Context - Context provided to commands during execution.
- Command
Registry - Registry of slash commands for an agent.
- Compact
Command - Compact the conversation history.
- Custom
Command - A simple custom command using a closure.
- Default
KeyHandler - Default key handler with configurable bindings.
- Help
Command - Show available commands and usage.
- KeyBindings
- Key binding configuration.
- KeyCombo
- A key combination (key + modifiers).
- KeyContext
- Context provided to the KeyHandler.
- Layout
Context - Context available during layout computation
- Layout
Result - Result of layout computation
- Minimal
Options - Options for minimal layout (no status bar, no panels)
- NewSession
Command - Create a new LLM session.
- Permission
Panel - State for the permission panel
- Pulldown
Renderer - Renders tables using pulldown-cmark parsing
- Question
Panel - State for the question panel overlay
- Quit
Command - Exit the application.
- Session
Info - Information about a session for display purposes Information about an LLM session for display in the session picker.
- Session
Picker State - State for the session picker
- Sessions
Command - View and switch between sessions.
- Sidebar
Options - Options for sidebar layout
- Simple
Command - A simple command implementation for testing
- Slash
Popup State - State for the slash command popup
- Split
Options - Options for split layout (two main areas)
- Standard
Options - Options for the standard vertical layout
- Status
Bar - Status bar widget implementation
- Status
BarConfig - Configuration for the status bar widget
- Status
BarData - Data required for rendering the status bar
- Status
Command - Show current session status.
- Text
Input - Text input buffer with cursor management
- Theme
- Complete theme definition for the TUI.
- Theme
Info - Theme metadata for display in picker
- Theme
Picker State - State for the theme picker
- Themes
Command - Open the theme picker to change colors.
- Tool
Message Data - Data for tool execution messages Display data for tool execution messages.
- TuiRunner
- TUI configuration that extends AgentCore with TUI-specific settings.
- Version
Command - Show application version.
- Widget
Sizes - Pre-computed widget size information
Enums§
- Answer
State - Answer state for a single question
- AppKey
Action - Application-level key actions.
- AppKey
Result - Result of handling a key event at the App level.
- Command
Result - Result of executing a slash command.
- Content
Segment - Content segment type for splitting text and tables
- Enter
Action - Result of pressing Enter
- Exit
State - Exit confirmation state for key handlers.
- Focus
Item - Represents a focusable item in the panel
- Layout
Template - Layout templates with customization options
- Message
Role - Role of a chat message
- Permission
KeyAction - Result of handling a key event
- Permission
Option - Options available for the user to select
- Question
KeyAction - Result of handling a key event
- Sidebar
Position - Sidebar position
- Sidebar
Width - Sidebar width specification
- Split
Ratio - Split ratio specification
- Tool
Status - Status of a tool execution
Constants§
- THEMES
- All available themes
Traits§
- Agent
Core Ext - Extension trait to add TUI functionality to AgentCore.
- Conversation
View - Trait for conversation/chat display widgets.
- Exit
Handler - Optional hook for agent cleanup on exit.
- KeyHandler
- Trait for customizing key handling at the App level.
- Layout
Provider - Trait for custom layout providers
- Slash
Command - Trait for slash commands.
- Slash
Command Display - Trait for displaying slash commands in the popup.
- Table
Renderer - 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§
- Conversation
View Factory - Type alias for conversation view factory functions.
- Render
Fn - Type alias for render callbacks used by ChatView