shared

package
v0.48.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateConversationHeight added in v0.27.0

func CalculateConversationHeight(totalHeight int) int

Layout calculation utilities

func CalculateInputHeight added in v0.27.0

func CalculateInputHeight(totalHeight int) int

func CalculateStatusHeight added in v0.27.0

func CalculateStatusHeight(totalHeight int) int

func FormatCurrentTokenUsage added in v0.33.2

func FormatCurrentTokenUsage(conversationRepo domain.ConversationRepository) string

FormatCurrentTokenUsage returns current session token usage string

func FormatResponsiveMessage

func FormatResponsiveMessage(content string, width int) string

FormatResponsiveMessage formats a message with responsive text wrapping

func FormatToolCall

func FormatToolCall(toolName string, args map[string]any) string

FormatToolCall formats a tool call for consistent display across the application

func FormatToolCallWithOptions added in v0.33.3

func FormatToolCallWithOptions(toolName string, args map[string]any, expanded bool) string

FormatToolCallWithOptions formats a tool call with options for expansion

func FormatWarning added in v0.27.0

func FormatWarning(message string) string

FormatWarning creates a properly formatted warning message

func GetResponsiveWidth

func GetResponsiveWidth(terminalWidth int) int

GetResponsiveWidth calculates appropriate width based on terminal size

func TruncateText added in v0.29.6

func TruncateText(text string, maxLength int) string

TruncateText truncates text to fit within maxLength, adding "..." if needed

func WrapText

func WrapText(text string, width int) string

WrapText wraps text to fit within the specified width using wordwrap

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 AutocompleteInterface

type AutocompleteInterface interface {
	Update(inputText string, cursorPos int)
	HandleKey(key tea.KeyMsg) (bool, string)
	IsVisible() bool
	SetWidth(width int)
	Render() string
	GetSelectedShortcut() string
	Hide()
}

AutocompleteInterface defines the interface for autocomplete functionality

type ConversationLineFormatter added in v0.38.0

type ConversationLineFormatter struct {
	// contains filtered or unexported fields
}

ConversationLineFormatter converts conversation entries to text lines

func NewConversationLineFormatter added in v0.38.0

func NewConversationLineFormatter(width int, toolFormatter domain.ToolFormatter) *ConversationLineFormatter

NewConversationLineFormatter creates a new conversation line formatter

func (*ConversationLineFormatter) FormatConversationToLines added in v0.38.0

func (f *ConversationLineFormatter) FormatConversationToLines(conversation []domain.ConversationEntry) []string

FormatConversationToLines converts conversation entries to plain text lines

func (*ConversationLineFormatter) SetWidth added in v0.38.0

func (f *ConversationLineFormatter) SetWidth(width int)

SetWidth updates the formatter width

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 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 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
	NavigateHistoryUp()
	NavigateHistoryDown()
	IsAutocompleteVisible() bool
	TryHandleAutocomplete(key tea.KeyMsg) (handled bool, completion string)
	AddToHistory(text string) error
	SetTextSelectionMode(enabled bool)
	IsTextSelectionMode() bool
}

InputComponent interface for input handling

type KeyShortcut

type KeyShortcut struct {
	Key         string
	Description string
}

KeyShortcut represents a keyboard shortcut with description

type ScrollDirection

type ScrollDirection int

ScrollDirection represents different scroll directions

const (
	ScrollUp ScrollDirection = iota
	ScrollDown
	ScrollToTop
	ScrollToBottom
)

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
	SaveCurrentState()
	RestoreSavedState() tea.Cmd
	HasSavedState() bool
}

StatusComponent interface for status display

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL