Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateConversationHeight(totalHeight int) int
- func CalculateInputHeight(totalHeight int) int
- func CalculateStatusHeight(totalHeight int) int
- func CreateColoredText(text string, color Color) string
- func CreateDimText(text string) string
- func CreateSeparator(width int, char string) string
- func CreateStrikethroughText(text string) string
- func CreateStyledText(text, colorCode string) string
- func FormatResponsiveMessage(content string, width int) string
- func FormatToolCall(toolName string, args map[string]any) string
- func FormatToolResultExpanded(result *domain.ToolExecutionResult) string
- func FormatToolResultExpandedResponsive(result *domain.ToolExecutionResult, terminalWidth int) string
- func FormatToolResultForUI(result *domain.ToolExecutionResult) string
- func FormatToolResultForUIResponsive(result *domain.ToolExecutionResult, terminalWidth int) string
- func FormatWarning(message string) string
- func GetResponsiveWidth(terminalWidth int) int
- func Reset() string
- func TruncateText(text string, maxLength int) string
- func WrapText(text string, width int) string
- type ApprovalComponent
- type ApprovalRequestMsg
- type ApprovalResponseMsg
- type AutocompleteInterface
- type ClearErrorMsg
- type ClearInputMsg
- type Color
- type CommonStyles
- type ConversationRenderer
- type DebugKeyMsg
- type FileSelectedMsg
- type FileSelectionRequestMsg
- type FocusRequestMsg
- type HelpBarComponent
- type HideHelpBarMsg
- type InputComponent
- type KeyShortcut
- type ModelSelectedMsg
- type ResizeMsg
- type ScrollDirection
- type ScrollRequestMsg
- type SetInputMsg
- type SetStatusMsg
- type SetupFileSelectionMsg
- type ShowErrorMsg
- type StatusComponent
- type StatusProgress
- type StatusType
- type Theme
- type ToggleHelpBarMsg
- type UpdateHistoryMsg
- type UpdateStatusMsg
- type UserInputMsg
Constants ¶
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorBlue = "\033[34m" ColorCyan = "\033[36m" ColorMagenta = "\033[35m" ColorWhite = "\033[37m" ColorGray = "\033[90m" ColorBrightRed = "\033[91m" ColorStrikethrough = "\033[9m" ColorDim = "\033[2m" )
ANSI Color Codes
const ( LipglossBlue = "34" LipglossGray = "240" LipglossCyan = "39" LipglossMagenta = "205" )
Lipgloss Color Names
Variables ¶
var ( UserColor = Color{ANSI: ColorCyan, Lipgloss: "36"} AssistantColor = Color{ANSI: ColorGreen, Lipgloss: "32"} ErrorColor = Color{ANSI: ColorRed, Lipgloss: "31"} StatusColor = Color{ANSI: ColorBlue, Lipgloss: LipglossBlue} AccentColor = Color{ANSI: ColorMagenta, Lipgloss: "35"} DimColor = Color{ANSI: ColorGray, Lipgloss: LipglossGray} BorderColor = Color{ANSI: ColorWhite, Lipgloss: "37"} HeaderColor = Color{ANSI: ColorCyan, Lipgloss: LipglossCyan} SpinnerColor = Color{ANSI: ColorMagenta, Lipgloss: LipglossMagenta} DiffAddColor = Color{ANSI: ColorGreen, Lipgloss: "32"} DiffRemoveColor = Color{ANSI: ColorRed, Lipgloss: "31"} )
Predefined colors for consistent theming
Functions ¶
func CalculateConversationHeight ¶ added in v0.27.0
Layout calculation utilities
func CalculateInputHeight ¶ added in v0.27.0
func CalculateStatusHeight ¶ added in v0.27.0
func CreateColoredText ¶
CreateColoredText creates colored text with automatic reset
func CreateDimText ¶ added in v0.20.0
CreateDimText creates text with dim/faint styling
func CreateSeparator ¶
CreateSeparator creates a separator line with the given width and character
func CreateStrikethroughText ¶ added in v0.20.0
CreateStrikethroughText creates text with strikethrough styling
func CreateStyledText ¶
CreateStyledText creates text with color and reset, commonly used pattern
func FormatResponsiveMessage ¶
FormatResponsiveMessage formats a message with responsive text wrapping
func FormatToolCall ¶
FormatToolCall formats a tool call for consistent display across the application
func FormatToolResultExpanded ¶
func FormatToolResultExpanded(result *domain.ToolExecutionResult) string
FormatToolResultExpanded formats a tool execution result with full details This is shown when user presses Ctrl+R to expand
func FormatToolResultExpandedResponsive ¶
func FormatToolResultExpandedResponsive(result *domain.ToolExecutionResult, terminalWidth int) string
FormatToolResultExpandedResponsive formats a tool execution result with full details and responsive width
func FormatToolResultForUI ¶
func FormatToolResultForUI(result *domain.ToolExecutionResult) string
FormatToolResultForUI formats tool execution results specifically for UI display
func FormatToolResultForUIResponsive ¶
func FormatToolResultForUIResponsive(result *domain.ToolExecutionResult, terminalWidth int) string
FormatToolResultForUIResponsive formats tool execution results for UI display with responsive width
func FormatWarning ¶ added in v0.27.0
FormatWarning creates a properly formatted warning message
func GetResponsiveWidth ¶
GetResponsiveWidth calculates appropriate width based on terminal size
func TruncateText ¶ added in v0.29.6
TruncateText truncates text to fit within maxLength, adding "..." if needed
Types ¶
type ApprovalComponent ¶ added in v0.27.0
type ApprovalComponent interface {
SetWidth(width int)
SetHeight(height int)
Render(toolExecution *domain.ToolExecutionSession, selectedIndex int) string
}
ApprovalComponent interface for approval display
type ApprovalRequestMsg ¶
ApprovalRequestMsg requests user approval for an action
type ApprovalResponseMsg ¶
ApprovalResponseMsg provides approval response
type AutocompleteInterface ¶
type AutocompleteInterface interface {
Update(inputText string, cursorPos int)
HandleKey(key tea.KeyMsg) (bool, string)
IsVisible() bool
SetWidth(width int)
Render() string
GetSelectedCommand() string
Hide()
}
AutocompleteInterface defines the interface for autocomplete functionality
type Color ¶
Color represents a color that can be used in both ANSI and Lipgloss contexts
func (Color) GetLipglossColor ¶
GetLipglossColor returns a lipgloss color for the given Color
type CommonStyles ¶
type CommonStyles struct {
Header lipgloss.Style
Border lipgloss.Style
Separator lipgloss.Style
Input lipgloss.Style
Status lipgloss.Style
HelpBar lipgloss.Style
Conversation lipgloss.Style
BashIndicator lipgloss.Style
ModelIndicator lipgloss.Style
PlaceholderText lipgloss.Style
}
CommonStyles contains reusable lipgloss styles
func NewCommonStyles ¶
func NewCommonStyles() *CommonStyles
NewCommonStyles creates a new set of common styles with consistent theming
type ConversationRenderer ¶ added in v0.27.0
type ConversationRenderer interface {
SetConversation([]domain.ConversationEntry)
GetScrollOffset() int
CanScrollUp() bool
CanScrollDown() bool
ToggleToolResultExpansion(index int)
ToggleAllToolResultsExpansion()
IsToolResultExpanded(index int) bool
SetWidth(width int)
SetHeight(height int)
Render() string
}
ConversationRenderer interface for conversation display
type DebugKeyMsg ¶
DebugKeyMsg provides debug information about key presses
type FileSelectedMsg ¶
type FileSelectedMsg struct {
FilePath string
}
FileSelectedMsg indicates file selection
type FileSelectionRequestMsg ¶
type FileSelectionRequestMsg struct{}
FileSelectionRequestMsg requests file selection UI
type FocusRequestMsg ¶
type FocusRequestMsg struct {
ComponentID string
}
FocusRequestMsg requests focus change
type HelpBarComponent ¶ added in v0.27.0
type HelpBarComponent interface {
SetShortcuts(shortcuts []KeyShortcut)
IsEnabled() bool
SetEnabled(enabled bool)
SetWidth(width int)
SetHeight(height int)
Render() string
}
HelpBarComponent interface for help bar
type HideHelpBarMsg ¶
type HideHelpBarMsg struct{}
HideHelpBarMsg hides the help bar when typing other characters
type InputComponent ¶ added in v0.27.0
type InputComponent interface {
GetInput() string
ClearInput()
SetPlaceholder(text string)
GetCursor() int
SetCursor(position int)
SetText(text string)
SetWidth(width int)
SetHeight(height int)
Render() string
HandleKey(key tea.KeyMsg) (tea.Model, tea.Cmd)
CanHandle(key tea.KeyMsg) bool
IsAutocompleteVisible() bool
AddToHistory(text string) error
}
InputComponent interface for input handling
type KeyShortcut ¶
KeyShortcut represents a keyboard shortcut with description
type ModelSelectedMsg ¶
type ModelSelectedMsg struct {
Model string
}
ModelSelectedMsg indicates model selection
type ScrollDirection ¶
type ScrollDirection int
ScrollDirection represents different scroll directions
const ( ScrollUp ScrollDirection = iota ScrollDown ScrollToTop ScrollToBottom )
type ScrollRequestMsg ¶
type ScrollRequestMsg struct {
ComponentID string
Direction ScrollDirection
Amount int
}
ScrollRequestMsg requests scrolling in a component
type SetStatusMsg ¶
type SetStatusMsg struct {
Message string
Spinner bool
TokenUsage string
StatusType StatusType
Progress *StatusProgress
}
SetStatusMsg sets a status message
type SetupFileSelectionMsg ¶ added in v0.27.0
type SetupFileSelectionMsg struct {
Files []string
}
SetupFileSelectionMsg sets up file selection state with files
type ShowErrorMsg ¶
ShowErrorMsg displays an error message
type StatusComponent ¶ added in v0.27.0
type StatusComponent interface {
ShowStatus(message string)
ShowError(message string)
ShowSpinner(message string)
ClearStatus()
IsShowingError() bool
IsShowingSpinner() bool
SetTokenUsage(usage string)
SetWidth(width int)
SetHeight(height int)
Render() string
}
StatusComponent interface for status display
type StatusProgress ¶ added in v0.27.0
StatusProgress represents progress information for status messages
type StatusType ¶ added in v0.27.0
type StatusType int
StatusType represents different types of status messages
const ( StatusDefault StatusType = iota StatusThinking StatusGenerating StatusWorking StatusProcessing StatusPreparing )
type Theme ¶ added in v0.27.0
type Theme interface {
GetUserColor() string
GetAssistantColor() string
GetErrorColor() string
GetStatusColor() string
GetAccentColor() string
GetDimColor() string
GetBorderColor() string
GetDiffAddColor() string
GetDiffRemoveColor() string
}
Theme interface for UI theming
type ToggleHelpBarMsg ¶
type ToggleHelpBarMsg struct{}
ToggleHelpBarMsg toggles the help bar visibility
type UpdateHistoryMsg ¶
type UpdateHistoryMsg struct {
History []domain.ConversationEntry
}
UpdateHistoryMsg updates the conversation history display
type UpdateStatusMsg ¶ added in v0.27.0
type UpdateStatusMsg struct {
Message string
StatusType StatusType
}
UpdateStatusMsg updates an existing status message without resetting timer
type UserInputMsg ¶
type UserInputMsg struct {
Content string
}
UserInputMsg represents user input submission