components

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package components provides reusable Bubbles components with Dracula theme styling. ABOUTME: Help system component for displaying key bindings and context-aware help ABOUTME: Wraps bubbles.Help with Dracula theme and mode-based key binding display

Package components provides reusable Bubbles components with Dracula theme styling. ABOUTME: List component for browsing and selecting items with fuzzy search ABOUTME: Wraps bubbles.List with Dracula theme for history, skills, commands, and plugins

Package components provides reusable Bubbles components with Dracula theme styling. ABOUTME: Progress bar component for visual feedback during operations ABOUTME: Wraps bubbles.Progress with Dracula theme for streaming, tool execution, and token usage

Package components provides reusable Bubbles components with Dracula theme styling. ABOUTME: Table component for displaying structured data with sorting and navigation ABOUTME: Wraps bubbles.Table with Dracula theme and additional features

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyBindingsToKeyMap

func KeyBindingsToKeyMap(bindings []KeyBinding) []key.Binding

KeyBindingsToKeyMap converts KeyBinding slice to bubbles key.Binding slice for use with bubbles.Help.View()

Types

type CommandItem

type CommandItem struct {
	Name        string
	Description string
	KeyBinding  string
}

CommandItem represents a command in the commands list

func (CommandItem) FilterValue

func (c CommandItem) FilterValue() string

FilterValue implements list.Item

func (CommandItem) GetDescription

func (c CommandItem) GetDescription() string

GetDescription implements ListItem

func (CommandItem) GetMetadata

func (c CommandItem) GetMetadata() string

GetMetadata implements ListItem

func (CommandItem) GetSearchText

func (c CommandItem) GetSearchText() string

GetSearchText implements ListItem

func (CommandItem) GetTitle

func (c CommandItem) GetTitle() string

GetTitle implements ListItem

type ConversationItem

type ConversationItem struct {
	ID           string
	Title        string
	Created      string
	MessageCount int
	TokenCount   int
	Model        string
	IsFavorite   bool
}

ConversationItem represents a conversation in the history list

func (ConversationItem) FilterValue

func (c ConversationItem) FilterValue() string

FilterValue implements list.Item

func (ConversationItem) GetDescription

func (c ConversationItem) GetDescription() string

GetDescription implements ListItem

func (ConversationItem) GetMetadata

func (c ConversationItem) GetMetadata() string

GetMetadata implements ListItem

func (ConversationItem) GetSearchText

func (c ConversationItem) GetSearchText() string

GetSearchText implements ListItem

func (ConversationItem) GetTitle

func (c ConversationItem) GetTitle() string

GetTitle implements ListItem

type ConversationMetadata

type ConversationMetadata struct {
	ID           string
	Created      string
	MessageCount string
	TotalTokens  string
	Model        string
}

ConversationMetadata represents conversation metadata for table display

type DefaultListItem

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

DefaultListItem is a default implementation of ListItem

func NewDefaultListItem

func NewDefaultListItem(title, description, metadata string) DefaultListItem

NewDefaultListItem creates a new default list item

func (DefaultListItem) FilterValue

func (i DefaultListItem) FilterValue() string

FilterValue implements list.Item

func (DefaultListItem) GetDescription

func (i DefaultListItem) GetDescription() string

GetDescription implements ListItem

func (DefaultListItem) GetMetadata

func (i DefaultListItem) GetMetadata() string

GetMetadata implements ListItem

func (DefaultListItem) GetSearchText

func (i DefaultListItem) GetSearchText() string

GetSearchText implements ListItem

func (DefaultListItem) GetTitle

func (i DefaultListItem) GetTitle() string

GetTitle implements ListItem

type Help

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

Help wraps bubbles.Help with Dracula styling and context awareness

func DefaultChatHelp

func DefaultChatHelp(width int) *Help

DefaultChatHelp returns default help for chat mode

func DefaultHistoryHelp

func DefaultHistoryHelp(width int) *Help

DefaultHistoryHelp returns default help for history mode

func DefaultToolsHelp

func DefaultToolsHelp(width int) *Help

DefaultToolsHelp returns default help for tools mode

func NewHelp

func NewHelp(mode HelpMode, width int) *Help

NewHelp creates a new help component with Dracula styling

func (*Help) IsExpanded

func (h *Help) IsExpanded() bool

IsExpanded returns whether help is expanded

func (*Help) SetExpanded

func (h *Help) SetExpanded(expanded bool)

SetExpanded sets the expanded state

func (*Help) SetMode

func (h *Help) SetMode(mode HelpMode)

SetMode updates the help mode and key bindings

func (*Help) SetWidth

func (h *Help) SetWidth(width int)

SetWidth sets the help width

func (*Help) ToggleExpanded

func (h *Help) ToggleExpanded()

ToggleExpanded toggles between short and full help

func (*Help) Update

func (h *Help) Update(_ tea.Msg) tea.Cmd

Update handles help updates

func (*Help) View

func (h *Help) View() string

View renders the help

func (*Help) ViewAsOverlay

func (h *Help) ViewAsOverlay(screenWidth, screenHeight int) string

ViewAsOverlay renders help as a centered overlay

func (*Help) ViewCompact

func (h *Help) ViewCompact() string

ViewCompact renders a compact single-line help

func (*Help) ViewExpanded

func (h *Help) ViewExpanded() string

ViewExpanded renders full categorized help

type HelpMode

type HelpMode int

HelpMode represents different help contexts

const (
	// HelpModeChat shows help for chat interface
	HelpModeChat HelpMode = iota
	// HelpModeHistory shows help for history browser
	HelpModeHistory
	// HelpModeTools shows help for tools view
	HelpModeTools
	// HelpModeApproval shows help for tool approval
	HelpModeApproval
	// HelpModeSearch shows help for search mode
	HelpModeSearch
	// HelpModeQuickActions shows help for quick actions
	HelpModeQuickActions
)

type KeyBinding

type KeyBinding struct {
	Key         string
	Description string
}

KeyBinding represents a key binding with description

type KeyBindingCategory

type KeyBindingCategory struct {
	Name     string
	Bindings []KeyBinding
}

KeyBindingCategory represents a category of key bindings

type List

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

List wraps bubbles.List with Dracula styling and fuzzy search

func CommandsList

func CommandsList(commands []CommandItem, width, height int) *List

CommandsList creates a list for commands selector

func ConversationHistoryList

func ConversationHistoryList(conversations []ConversationItem, width, height int) *List

ConversationHistoryList creates a list for conversation history

func NewList

func NewList(items []ListItem, width, height int, listType ListType) *List

NewList creates a new list with Dracula styling

func PluginsList

func PluginsList(plugins []PluginItem, width, height int) *List

PluginsList creates a list for plugin browser

func SkillsList

func SkillsList(skills []SkillItem, width, height int) *List

SkillsList creates a list for skills selector

func (*List) FuzzySearch

func (l *List) FuzzySearch(query string)

FuzzySearch filters items using fuzzy search

func (*List) Index

func (l *List) Index() int

Index returns the current cursor position

func (*List) SelectedItem

func (l *List) SelectedItem() ListItem

SelectedItem returns the currently selected item

func (*List) SetHeight

func (l *List) SetHeight(height int)

SetHeight sets the list height

func (*List) SetItems

func (l *List) SetItems(items []ListItem)

SetItems updates the list items

func (*List) SetTitle

func (l *List) SetTitle(title string)

SetTitle sets the list title

func (*List) SetWidth

func (l *List) SetWidth(width int)

SetWidth sets the list width

func (*List) Update

func (l *List) Update(msg tea.Msg) tea.Cmd

Update handles list updates

func (*List) View

func (l *List) View() string

View renders the list

type ListItem

type ListItem interface {
	list.Item
	// GetSearchText returns the text to search against
	GetSearchText() string
	// GetTitle returns the item title
	GetTitle() string
	// GetDescription returns the item description
	GetDescription() string
	// GetMetadata returns additional metadata
	GetMetadata() string
}

ListItem is an item in the list

type ListType

type ListType int

ListType represents different types of lists

const (
	// ListTypeHistory for conversation history browser
	ListTypeHistory ListType = iota
	// ListTypeSkills for skills selector
	ListTypeSkills
	// ListTypeCommands for commands selector
	ListTypeCommands
	// ListTypePlugins for plugin browser
	ListTypePlugins
	// ListTypeMCPServers for MCP server browser
	ListTypeMCPServers
)

type MCPServerInfo

type MCPServerInfo struct {
	Name      string
	Status    string
	ToolCount string
	Endpoint  string
}

MCPServerInfo represents MCP server information for table display

type PluginInfo

type PluginInfo struct {
	Name        string
	Status      string
	Version     string
	Description string
}

PluginInfo represents plugin information for table display

type PluginItem

type PluginItem struct {
	Name        string
	Version     string
	Description string
	Status      string
	Enabled     bool
}

PluginItem represents a plugin in the plugins list

func (PluginItem) FilterValue

func (p PluginItem) FilterValue() string

FilterValue implements list.Item

func (PluginItem) GetDescription

func (p PluginItem) GetDescription() string

GetDescription implements ListItem

func (PluginItem) GetMetadata

func (p PluginItem) GetMetadata() string

GetMetadata implements ListItem

func (PluginItem) GetSearchText

func (p PluginItem) GetSearchText() string

GetSearchText implements ListItem

func (PluginItem) GetTitle

func (p PluginItem) GetTitle() string

GetTitle implements ListItem

type Progress

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

Progress wraps bubbles.Progress with Dracula styling

func BatchProgress

func BatchProgress(current, total int, operation string, width int) *Progress

BatchProgress creates a progress bar for batch operations

func NewProgress

func NewProgress(progressType ProgressType, width int) *Progress

NewProgress creates a new progress bar with Dracula styling

func StreamingProgress

func StreamingProgress(chunksReceived, estimatedTotal int, width int) *Progress

StreamingProgress creates a progress bar for API streaming

func TokenUsageProgress

func TokenUsageProgress(currentTokens, maxTokens int, width int) *Progress

TokenUsageProgress creates a progress bar for token/context usage

func ToolExecutionProgress

func ToolExecutionProgress(toolName string, width int) *Progress

ToolExecutionProgress creates a progress bar for tool execution

func (*Progress) GetProgress

func (p *Progress) GetProgress() float64

GetProgress returns the current progress value

func (*Progress) IncrementProgress

func (p *Progress) IncrementProgress(delta float64)

IncrementProgress increments the progress by a delta

func (*Progress) IsComplete

func (p *Progress) IsComplete() bool

IsComplete returns true if progress is at 100%

func (*Progress) Reset

func (p *Progress) Reset()

Reset resets the progress to 0

func (*Progress) SetLabel

func (p *Progress) SetLabel(label string)

SetLabel sets the progress bar label

func (*Progress) SetProgress

func (p *Progress) SetProgress(value float64)

SetProgress updates the progress value (0.0 to 1.0)

func (*Progress) SetProgressValues

func (p *Progress) SetProgressValues(current, total float64)

SetProgressValues sets current and total values (calculates percentage)

func (*Progress) SetWidth

func (p *Progress) SetWidth(width int)

SetWidth sets the progress bar width

func (*Progress) Update

func (p *Progress) Update(msg tea.Msg) tea.Cmd

Update handles progress bar updates

func (*Progress) View

func (p *Progress) View() string

View renders the progress bar

func (*Progress) ViewCompact

func (p *Progress) ViewCompact() string

ViewCompact renders a compact version without label

type ProgressBar

type ProgressBar struct {
	*Progress
}

ProgressBar is a simple wrapper for backward compatibility

func NewProgressBar

func NewProgressBar(width int) *ProgressBar

NewProgressBar creates a new progress bar (backward compatible)

type ProgressBarMsg

type ProgressBarMsg struct {
	Progress float64
	Label    string
}

ProgressBarMsg is a message for updating progress

type ProgressCompleteMsg

type ProgressCompleteMsg struct{}

ProgressCompleteMsg is sent when progress reaches 100%

type ProgressType

type ProgressType int

ProgressType represents different types of progress indicators

const (
	// ProgressTypeStreaming indicates API streaming progress
	ProgressTypeStreaming ProgressType = iota
	// ProgressTypeToolExecution indicates tool execution progress
	ProgressTypeToolExecution
	// ProgressTypeTokenUsage indicates token/context usage
	ProgressTypeTokenUsage
	// ProgressTypeBatch indicates batch operation progress
	ProgressTypeBatch
)

type SkillItem

type SkillItem struct {
	Name        string
	Description string
	Category    string
	Enabled     bool
}

SkillItem represents a skill in the skills list

func (SkillItem) FilterValue

func (s SkillItem) FilterValue() string

FilterValue implements list.Item

func (SkillItem) GetDescription

func (s SkillItem) GetDescription() string

GetDescription implements ListItem

func (SkillItem) GetMetadata

func (s SkillItem) GetMetadata() string

GetMetadata implements ListItem

func (SkillItem) GetSearchText

func (s SkillItem) GetSearchText() string

GetSearchText implements ListItem

func (SkillItem) GetTitle

func (s SkillItem) GetTitle() string

GetTitle implements ListItem

type Table

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

Table wraps bubbles.Table with Dracula styling and additional functionality

func ConversationMetadataTable

func ConversationMetadataTable(metadata []ConversationMetadata, width, height int) *Table

ConversationMetadataTable creates a table for displaying conversation metadata

func MCPServerTable

func MCPServerTable(servers []MCPServerInfo, width, height int) *Table

MCPServerTable creates a table for displaying MCP server status

func NewTable

func NewTable(columns []table.Column, rows []table.Row, width, height int) *Table

NewTable creates a new table with Dracula styling

func PluginTable

func PluginTable(plugins []PluginInfo, width, height int) *Table

PluginTable creates a table for displaying plugin status

func ToolResultsTable

func ToolResultsTable(results []ToolResult, width, height int) *Table

ToolResultsTable creates a table for displaying tool execution results

func (*Table) Blur

func (t *Table) Blur()

Blur removes focus from the table

func (*Table) Cursor

func (t *Table) Cursor() int

Cursor returns the current cursor position

func (*Table) Focus

func (t *Table) Focus()

Focus sets focus on the table

func (*Table) SelectedRow

func (t *Table) SelectedRow() table.Row

SelectedRow returns the currently selected row

func (*Table) SetColumns

func (t *Table) SetColumns(columns []table.Column)

SetColumns updates the table columns

func (*Table) SetHeight

func (t *Table) SetHeight(height int)

SetHeight sets the table height

func (*Table) SetRows

func (t *Table) SetRows(rows []table.Row)

SetRows updates the table rows

func (*Table) SetTitle

func (t *Table) SetTitle(title string)

SetTitle sets the table title

func (*Table) SetWidth

func (t *Table) SetWidth(width int)

SetWidth sets the table width

func (*Table) Update

func (t *Table) Update(msg tea.Msg) tea.Cmd

Update handles table updates

func (*Table) View

func (t *Table) View() string

View renders the table

type ToolResult

type ToolResult struct {
	ToolName string
	Success  bool
	Duration string
	Output   string
}

ToolResult represents a tool execution result for table display

Jump to

Keyboard shortcuts

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