Documentation
¶
Overview ¶
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Tool approval UI component for displaying and handling tool approval prompts ABOUTME: Shows formatted tool information with risk levels and interactive approval controls
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Intro screen rendering for first-run experience ABOUTME: Displays ASCII logo, example prompts, services, and keyboard shortcuts
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Layout mode detection and breakpoint logic for responsive UI ABOUTME: Determines whether to show compact or wide layout based on terminal size
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Bubbletea model for interactive chat UI ABOUTME: Manages state, messages, input, viewport, and streaming
ABOUTME: Mux backend integration for interactive mode ABOUTME: Provides types and handlers for using mux backend in the TUI
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Quick actions menu system for keyboard shortcuts ABOUTME: Provides fuzzy-searchable command palette for tools and actions
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Panic recovery utilities for TUI components ABOUTME: Prevents component crashes from taking down the entire application
ABOUTME: Slash command handlers for /feedback and /contact ABOUTME: Handles form completion and email sending via Gmail tools
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Spinner component for showing loading and tool execution states ABOUTME: Provides animated spinners with different styles for various operations
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Status bar component for displaying connection, token, and mode information ABOUTME: Provides comprehensive bottom status bar with color-coded indicators
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Streaming UI enhancements for displaying streaming responses ABOUTME: Provides token rate display, progressive rendering, and typewriter effects
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Bubbletea update function for handling events ABOUTME: Processes keyboard input, window resize, streaming chunks
Package ui provides the Bubble Tea terminal user interface components. ABOUTME: Bubbletea view function for rendering UI ABOUTME: Renders viewport with messages and input textarea
Index ¶
- Constants
- func DetectProvider(input string) string
- func LogoANSI() string
- func ParseActionCommand(input string) (command, args string)
- func RecoverPanic(component string, fn func())
- type ApprovalPrompt
- type Autocomplete
- func (ac *Autocomplete) GetCompletions() []Completion
- func (ac *Autocomplete) GetProvider(name string) (CompletionProvider, bool)
- func (ac *Autocomplete) GetSelected() *Completion
- func (ac *Autocomplete) GetSelectedIndex() int
- func (ac *Autocomplete) Hide()
- func (ac *Autocomplete) IsActive() bool
- func (ac *Autocomplete) Next()
- func (ac *Autocomplete) Previous()
- func (ac *Autocomplete) RegisterProvider(name string, provider CompletionProvider)
- func (ac *Autocomplete) Show(input string, providerName string)
- func (ac *Autocomplete) Update(input string)
- type Card
- type Completion
- type CompletionProvider
- type ConnectionStatus
- type Delta
- type DisplayCardMsg
- type FeedbackType
- type FileProvider
- type HistoryProvider
- type LayoutMode
- type Message
- type Model
- func (m *Model) AcceptSuggestion()
- func (m *Model) AddDisplayCard(title, content string)
- func (m *Model) AddMessage(role, content string)
- func (m *Model) AddMessageWithComponent(role, content string, component interface{})
- func (m *Model) AddPendingToolUse(toolUse *core.ToolUse)
- func (m *Model) AnalyzeSuggestions()
- func (m *Model) AppendStreamingText(chunk string)
- func (m *Model) ApproveMuxTool(approved bool) tea.Cmd
- func (m *Model) ApproveToolUse() tea.Cmd
- func (m *Model) ClearConversation()
- func (m *Model) ClearDisplayCards()
- func (m *Model) ClearMarkdownCache()
- func (m *Model) ClearScreen()
- func (m *Model) ClearStreamingText()
- func (m *Model) CommitStreamingText()
- func (m *Model) DenyToolUse() tea.Cmd
- func (m *Model) DismissSuggestions()
- func (m *Model) EnterHuhApprovalMode() tea.Cmd
- func (m *Model) EnterQuickActionsMode()
- func (m *Model) EnterSearchMode()
- func (m *Model) ExecuteQuickAction() error
- func (m *Model) ExitHuhApprovalMode()
- func (m *Model) ExitQuickActionsMode()
- func (m *Model) ExitSearchMode()
- func (m *Model) ExportConversation() string
- func (m *Model) FocusedPane() Pane
- func (m *Model) GetAutocomplete() *Autocomplete
- func (m *Model) GetContextUsagePercent() float64
- func (m *Model) GetDisplayCallback() func(title, content string)
- func (m *Model) GetHuhApproval() *components.HuhApproval
- func (m *Model) GetLayoutMode() LayoutMode
- func (m *Model) GetPendingToolUses() []*core.ToolUse
- func (m *Model) GetPrunedMessages() []core.Message
- func (m *Model) GetSessionLogger() *logging.SessionLogger
- func (m *Model) GetTheme() themes.Theme
- func (m *Model) Init() tea.Cmd
- func (m *Model) InvalidateMarkdownCache()
- func (m *Model) IsComposeFormActive() bool
- func (m *Model) IsContextFull() bool
- func (m *Model) IsContextNearFull() bool
- func (m *Model) IsFeedbackFormActive() bool
- func (m *Model) IsToolApprovalMode() bool
- func (m *Model) ListenForDisplayCards() tea.Cmd
- func (m *Model) NextView()
- func (m *Model) RejectTopSuggestion()
- func (m *Model) RenderIntro() string
- func (m *Model) RenderMessage(msg Message) (string, error)
- func (m *Model) SaveConversation() error
- func (m *Model) SetAPIClient(client *core.Client)
- func (m *Model) SetContextManager(manager *ctxmgr.Manager)
- func (m *Model) SetDB(db *sql.DB)
- func (m *Model) SetForceLayoutMode(force bool, mode LayoutMode)
- func (m *Model) SetMuxBackend(backend MuxBackend)
- func (m *Model) SetProvider(provider string)
- func (m *Model) SetSessionLogger(logger *logging.SessionLogger)
- func (m *Model) SetSkipAllApprovals(skip bool)
- func (m *Model) SetStatus(status Status)
- func (m *Model) SetSystemPrompt(prompt string)
- func (m *Model) SetToolSystem(registry *tools.Registry, executor *tools.Executor)
- func (m *Model) ToggleFavorite() error
- func (m *Model) ToggleHelp()
- func (m *Model) ToggleTypewriter()
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) UpdateLayoutMode(width, height int)
- func (m *Model) UpdateQuickActionsInput(input string)
- func (m *Model) UpdateSearchQuery(query string)
- func (m *Model) UpdateTokens(input, output int)
- func (m *Model) UpdateViewport()
- func (m *Model) UseMux() bool
- func (m *Model) View() string
- type MuxApprovalRequest
- type MuxApprovalRequestMsg
- type MuxBackend
- type MuxEvent
- type MuxEventMsg
- type Pane
- type ProgressIndicator
- type ProgressState
- type ProgressiveMarkdownRenderer
- type QuickAction
- type QuickActionsRegistry
- func (r *QuickActionsRegistry) Execute(name, args string) error
- func (r *QuickActionsRegistry) FuzzySearch(query string) []*QuickAction
- func (r *QuickActionsRegistry) GetAction(name string) (*QuickAction, error)
- func (r *QuickActionsRegistry) ListActions() []*QuickAction
- func (r *QuickActionsRegistry) RegisterAction(name, description, usage string, handler func(string) error) error
- type RiskLevel
- type SpinnerType
- type Status
- type StatusBar
- func (s *StatusBar) ApplyUpdate(update StatusBarUpdate)
- func (s *StatusBar) ClearCustomMessage()
- func (s *StatusBar) GetFullHelp() string
- func (s *StatusBar) SetConnectionStatus(status ConnectionStatus)
- func (s *StatusBar) SetContextSize(size int)
- func (s *StatusBar) SetCustomMessage(msg string)
- func (s *StatusBar) SetHelpVisible(visible bool)
- func (s *StatusBar) SetMode(mode string)
- func (s *StatusBar) SetModel(model string)
- func (s *StatusBar) SetTokens(input, output int)
- func (s *StatusBar) SetWidth(width int)
- func (s *StatusBar) UpdateTokens(input, output int)
- func (s *StatusBar) View() string
- type StatusBarUpdate
- type StreamChunk
- type StreamChunkMsg
- type StreamingDisplay
- func (s *StreamingDisplay) AdvanceTypewriter()
- func (s *StreamingDisplay) AppendText(chunk string)
- func (s *StreamingDisplay) GetElapsedTime() time.Duration
- func (s *StreamingDisplay) GetFullText() string
- func (s *StreamingDisplay) GetStats() StreamingStats
- func (s *StreamingDisplay) GetText() string
- func (s *StreamingDisplay) GetTokenCount() int
- func (s *StreamingDisplay) GetTokenRate() float64
- func (s *StreamingDisplay) IsTypewriterMode() bool
- func (s *StreamingDisplay) IsWaitingForTokens() bool
- func (s *StreamingDisplay) RenderStreamingIndicator() string
- func (s *StreamingDisplay) RenderWithCursor(text string) string
- func (s *StreamingDisplay) Reset()
- func (s *StreamingDisplay) SetTypewriterMode(enabled bool)
- func (s *StreamingDisplay) ToggleTypewriterMode()
- type StreamingStats
- type Suggestion
- type SuggestionDetector
- type SuggestionLearner
- type TokenUpdate
- type ToolProvider
- type ToolResult
- type ToolSpinner
- func (s *ToolSpinner) GetElapsed() time.Duration
- func (s *ToolSpinner) GetMessage() string
- func (s *ToolSpinner) IsActive() bool
- func (s *ToolSpinner) Start(spinnerType SpinnerType, message string) tea.Cmd
- func (s *ToolSpinner) Stop()
- func (s *ToolSpinner) Tick() tea.Cmd
- func (s *ToolSpinner) Update(msg tea.Msg) tea.Cmd
- func (s *ToolSpinner) UpdateTokens(count int)
- func (s *ToolSpinner) View() string
- type Usage
- type ViewMode
Constants ¶
const ( // CompactModeWidthBreakpoint is the minimum width required for wide layout // Below this width, the UI switches to compact mode CompactModeWidthBreakpoint = 100 // CompactModeHeightBreakpoint is the minimum height required for wide layout // Below this height, the UI switches to compact mode CompactModeHeightBreakpoint = 24 )
const ( FeedbackAccepted = suggestions.FeedbackAccepted FeedbackRejected = suggestions.FeedbackRejected FeedbackIgnored = suggestions.FeedbackIgnored )
Feedback constants
const ChatContentOffset = 6
ChatContentOffset is the width offset applied to chat messages for wrapping This accounts for visual decorations like borders and padding in the chat pane
Variables ¶
This section is empty.
Functions ¶
func DetectProvider ¶
DetectProvider determines which provider to use based on input context
func LogoANSI ¶ added in v0.3.0
func LogoANSI() string
LogoANSI returns the embedded ANSI art logo for use in other packages
func ParseActionCommand ¶
ParseActionCommand splits a command input into command and arguments
func RecoverPanic ¶
func RecoverPanic(component string, fn func())
RecoverPanic wraps a function with panic recovery If a panic occurs, it logs the error with component name, panic value, and stack trace
Types ¶
type ApprovalPrompt ¶
type ApprovalPrompt struct {
// contains filtered or unexported fields
}
ApprovalPrompt manages the tool approval UI
func NewApprovalPrompt ¶
func NewApprovalPrompt(toolUse *core.ToolUse) *ApprovalPrompt
NewApprovalPrompt creates a new approval prompt for a tool use
func (*ApprovalPrompt) SetWidth ¶
func (a *ApprovalPrompt) SetWidth(width int)
SetWidth sets the width of the approval prompt
func (*ApprovalPrompt) ToggleDetails ¶
func (a *ApprovalPrompt) ToggleDetails()
ToggleDetails toggles the detailed view
func (*ApprovalPrompt) View ¶
func (a *ApprovalPrompt) View() string
View renders the approval prompt
type Autocomplete ¶
type Autocomplete struct {
// contains filtered or unexported fields
}
Autocomplete manages completion state and providers
func NewAutocomplete ¶
func NewAutocomplete() *Autocomplete
NewAutocomplete creates a new autocomplete instance
func (*Autocomplete) GetCompletions ¶
func (ac *Autocomplete) GetCompletions() []Completion
GetCompletions returns all current completions
func (*Autocomplete) GetProvider ¶
func (ac *Autocomplete) GetProvider(name string) (CompletionProvider, bool)
GetProvider retrieves a registered provider by name
func (*Autocomplete) GetSelected ¶
func (ac *Autocomplete) GetSelected() *Completion
GetSelected returns the currently selected completion
func (*Autocomplete) GetSelectedIndex ¶
func (ac *Autocomplete) GetSelectedIndex() int
GetSelectedIndex returns the current selection index
func (*Autocomplete) IsActive ¶
func (ac *Autocomplete) IsActive() bool
IsActive returns whether autocomplete is currently showing
func (*Autocomplete) Previous ¶
func (ac *Autocomplete) Previous()
Previous moves selection to previous completion
func (*Autocomplete) RegisterProvider ¶
func (ac *Autocomplete) RegisterProvider(name string, provider CompletionProvider)
RegisterProvider adds a completion provider
func (*Autocomplete) Show ¶
func (ac *Autocomplete) Show(input string, providerName string)
Show activates autocomplete for the given input and provider
func (*Autocomplete) Update ¶
func (ac *Autocomplete) Update(input string)
Update refreshes completions based on new input
type Card ¶ added in v0.1.9
type Card struct {
ID string
Title string
Content string // Raw markdown
Rendered string // Cached glamour output
Timestamp time.Time
// contains filtered or unexported fields
}
Card represents a display card in the right pane
func (*Card) InvalidateCache ¶ added in v0.1.9
func (c *Card) InvalidateCache()
InvalidateCache clears the rendered cache
type Completion ¶
type Completion struct {
// Value is the actual completion text
Value string
// Display is what gets shown in the UI (may include formatting)
Display string
// Description provides context about the completion
Description string
// Score is used for ranking (higher is better)
Score int
}
Completion represents a single completion suggestion
type CompletionProvider ¶
type CompletionProvider interface {
// GetCompletions returns completion suggestions for the given input
GetCompletions(input string) []Completion
}
CompletionProvider is an interface for providing completion suggestions
type ConnectionStatus ¶
type ConnectionStatus int
ConnectionStatus represents API connection state
const ( // ConnectionDisconnected indicates no active connection ConnectionDisconnected ConnectionStatus = iota // ConnectionConnected indicates an active connection ConnectionConnected // ConnectionStreaming indicates an active streaming connection ConnectionStreaming // ConnectionError indicates a connection error ConnectionError )
type DisplayCardMsg ¶ added in v0.1.9
DisplayCardMsg is sent when a card should be added to the display pane
type FeedbackType ¶
type FeedbackType = suggestions.FeedbackType
FeedbackType represents user feedback
type FileProvider ¶
type FileProvider struct {
// contains filtered or unexported fields
}
FileProvider provides file path completions
func NewFileProvider ¶
func NewFileProvider() *FileProvider
NewFileProvider creates a new file completion provider
func (*FileProvider) GetCompletions ¶
func (fp *FileProvider) GetCompletions(input string) []Completion
GetCompletions returns file path completions
func (*FileProvider) SetBasePath ¶
func (fp *FileProvider) SetBasePath(path string)
SetBasePath updates the base directory for file searching
type HistoryProvider ¶
type HistoryProvider struct {
// contains filtered or unexported fields
}
HistoryProvider provides command history completions
func NewHistoryProvider ¶
func NewHistoryProvider() *HistoryProvider
NewHistoryProvider creates a new history completion provider
func (*HistoryProvider) AddToHistory ¶
func (hp *HistoryProvider) AddToHistory(command string)
AddToHistory adds a command to history
func (*HistoryProvider) GetCompletions ¶
func (hp *HistoryProvider) GetCompletions(input string) []Completion
GetCompletions returns history-based completions
type LayoutMode ¶
type LayoutMode int
LayoutMode represents the current UI layout configuration
const ( // LayoutModeWide is used for terminals with sufficient space (>= 100 width, >= 24 height) // Displays full-featured UI with all components visible LayoutModeWide LayoutMode = iota // LayoutModeCompact is used for smaller terminals (< 100 width OR < 24 height) // Displays simplified UI with essential features only LayoutModeCompact )
func DetermineLayoutMode ¶
func DetermineLayoutMode(width, height int) LayoutMode
DetermineLayoutMode determines the appropriate layout mode based on terminal dimensions Returns LayoutModeCompact if either dimension is below the breakpoint Returns LayoutModeWide if both dimensions meet or exceed their breakpoints
func (LayoutMode) String ¶
func (l LayoutMode) String() string
String returns a human-readable representation of the layout mode
type Message ¶
type Message struct {
ID string // Unique identifier for cache keying
Role string
Content string
ContentBlock []core.ContentBlock // For structured content like tool_result blocks
// Rich component for inline rendering (Phase 3)
Component interface{} // Can be *components.Table, *components.Progress, etc.
ComponentID string // Unique ID for routing events to component
}
Message represents a chat message in the UI
type Model ¶
type Model struct {
ConversationID string
Model string
Provider string // LLM provider: anthropic, openai, gemini, openrouter, ollama
Messages []Message
Input textarea.Model
Viewport viewport.Model
Width int
Height int
Streaming bool
StreamingText string
Ready bool
// Task 5: Advanced UI Features
CurrentView ViewMode
Status Status
ErrorMessage string
TokensInput int
TokensOutput int
SearchMode bool
SearchQuery string
// Phase 6C Task 5: Conversation Favorites
IsFavorite bool // Track if current conversation is favorite
// Slash commands
LaunchOnboarding bool // Set when user types /init to trigger onboarding after exit
// contains filtered or unexported fields
}
Model is the Bubbletea model for interactive mode
func (*Model) AcceptSuggestion ¶
func (m *Model) AcceptSuggestion()
AcceptSuggestion accepts the top suggestion and applies it
func (*Model) AddDisplayCard ¶ added in v0.1.9
AddDisplayCard adds a new card to the display pane (prepends to show newest first)
func (*Model) AddMessage ¶
AddMessage adds a message to the conversation
func (*Model) AddMessageWithComponent ¶
AddMessageWithComponent adds a message with an embedded component
func (*Model) AddPendingToolUse ¶
AddPendingToolUse adds a tool use to the pending queue
func (*Model) AnalyzeSuggestions ¶
func (m *Model) AnalyzeSuggestions()
AnalyzeSuggestions analyzes current input and updates suggestions
func (*Model) AppendStreamingText ¶
AppendStreamingText adds a chunk to the streaming buffer
func (*Model) ApproveMuxTool ¶ added in v0.3.10
ApproveMuxTool sends approval response and resumes event processing
func (*Model) ApproveToolUse ¶
ApproveToolUse executes ALL pending tools
func (*Model) ClearConversation ¶
func (m *Model) ClearConversation()
ClearConversation clears all messages (chat pane)
func (*Model) ClearDisplayCards ¶ added in v0.1.9
func (m *Model) ClearDisplayCards()
ClearDisplayCards clears all display cards (display pane)
func (*Model) ClearMarkdownCache ¶
func (m *Model) ClearMarkdownCache()
ClearMarkdownCache clears all cached markdown content
func (*Model) ClearStreamingText ¶
func (m *Model) ClearStreamingText()
ClearStreamingText discards streaming buffer (e.g., on error)
func (*Model) CommitStreamingText ¶
func (m *Model) CommitStreamingText()
CommitStreamingText converts streaming text into a permanent assistant message
func (*Model) DenyToolUse ¶
DenyToolUse rejects ALL pending tools
func (*Model) DismissSuggestions ¶
func (m *Model) DismissSuggestions()
DismissSuggestions hides and clears suggestions
func (*Model) EnterHuhApprovalMode ¶
EnterHuhApprovalMode creates and shows Huh approval dialog Returns the initialization command that should be executed
func (*Model) EnterQuickActionsMode ¶
func (m *Model) EnterQuickActionsMode()
EnterQuickActionsMode opens the quick actions menu
func (*Model) EnterSearchMode ¶
func (m *Model) EnterSearchMode()
EnterSearchMode activates search mode
func (*Model) ExecuteQuickAction ¶
ExecuteQuickAction executes the selected or first filtered action
func (*Model) ExitHuhApprovalMode ¶
func (m *Model) ExitHuhApprovalMode()
ExitHuhApprovalMode closes the approval dialog
func (*Model) ExitQuickActionsMode ¶
func (m *Model) ExitQuickActionsMode()
ExitQuickActionsMode closes the quick actions menu
func (*Model) ExitSearchMode ¶
func (m *Model) ExitSearchMode()
ExitSearchMode deactivates search mode
func (*Model) ExportConversation ¶
ExportConversation exports the conversation to a string
func (*Model) FocusedPane ¶ added in v0.1.9
FocusedPane returns the currently focused pane
func (*Model) GetAutocomplete ¶
func (m *Model) GetAutocomplete() *Autocomplete
GetAutocomplete returns the autocomplete instance
func (*Model) GetContextUsagePercent ¶ added in v0.2.0
GetContextUsagePercent returns the current context usage percentage Returns 0 when contextManager is nil to avoid stale reads
func (*Model) GetDisplayCallback ¶ added in v0.1.9
GetDisplayCallback returns a callback function for the display tool to use. The callback sends messages to the display channel which will be processed in the Update loop to maintain thread safety.
func (*Model) GetHuhApproval ¶
func (m *Model) GetHuhApproval() *components.HuhApproval
GetHuhApproval returns the current Huh approval component
func (*Model) GetLayoutMode ¶
func (m *Model) GetLayoutMode() LayoutMode
GetLayoutMode returns the current layout mode
func (*Model) GetPendingToolUses ¶
GetPendingToolUses returns the pending tool uses
func (*Model) GetPrunedMessages ¶
GetPrunedMessages returns messages pruned to fit context limit
func (*Model) GetSessionLogger ¶ added in v0.3.6
func (m *Model) GetSessionLogger() *logging.SessionLogger
GetSessionLogger returns the session logger
func (*Model) InvalidateMarkdownCache ¶
func (m *Model) InvalidateMarkdownCache()
InvalidateMarkdownCache marks the markdown cache as dirty It will be cleared on next render
func (*Model) IsComposeFormActive ¶ added in v0.3.6
IsComposeFormActive returns whether the compose form is currently showing
func (*Model) IsContextFull ¶ added in v0.2.0
IsContextFull returns true when estimated context usage is at 100% or more This is based on the estimated token count of messages, not cumulative API tokens
func (*Model) IsContextNearFull ¶ added in v0.2.0
IsContextNearFull returns true when estimated context usage is at 90% or more This is based on the estimated token count of messages, not cumulative API tokens
func (*Model) IsFeedbackFormActive ¶ added in v0.3.6
IsFeedbackFormActive returns whether the feedback form is currently showing
func (*Model) IsToolApprovalMode ¶
IsToolApprovalMode returns whether tool approval mode is active
func (*Model) ListenForDisplayCards ¶ added in v0.1.9
ListenForDisplayCards returns a command that listens for display card messages. This should be called from Update when processing display-related messages.
func (*Model) RejectTopSuggestion ¶
func (m *Model) RejectTopSuggestion()
RejectTopSuggestion explicitly rejects the top suggestion
func (*Model) RenderIntro ¶
RenderIntro returns the intro screen content
func (*Model) RenderMessage ¶
RenderMessage renders a message using glamour for assistant messages with theme colors Phase 1 Task 3: Uses caching to avoid expensive re-renders
func (*Model) SaveConversation ¶
SaveConversation saves the conversation (placeholder for future implementation)
func (*Model) SetAPIClient ¶
SetAPIClient sets the API client for streaming
func (*Model) SetContextManager ¶
SetContextManager sets the context manager and initializes context tracking
func (*Model) SetForceLayoutMode ¶
func (m *Model) SetForceLayoutMode(force bool, mode LayoutMode)
SetForceLayoutMode allows the user to override automatic layout mode detection
func (*Model) SetMuxBackend ¶ added in v0.3.10
func (m *Model) SetMuxBackend(backend MuxBackend)
SetMuxBackend sets the mux backend for streaming
func (*Model) SetProvider ¶ added in v0.3.18
SetProvider sets the LLM provider name for display
func (*Model) SetSessionLogger ¶ added in v0.3.6
func (m *Model) SetSessionLogger(logger *logging.SessionLogger)
SetSessionLogger sets the session logger for JSONL logging
func (*Model) SetSkipAllApprovals ¶ added in v0.1.9
SetSkipAllApprovals enables/disables auto-approval of all tools (--dangerously-skip-permissions)
func (*Model) SetSystemPrompt ¶
SetSystemPrompt sets the system prompt for this conversation
func (*Model) SetToolSystem ¶
SetToolSystem sets the tool registry and executor
func (*Model) ToggleFavorite ¶
ToggleFavorite toggles the favorite status of the current conversation
func (*Model) ToggleTypewriter ¶
func (m *Model) ToggleTypewriter()
ToggleTypewriter toggles typewriter mode
func (*Model) UpdateLayoutMode ¶
UpdateLayoutMode updates the layout mode based on terminal dimensions If forceLayoutMode is true, this function does nothing (user override) Otherwise, determines layout mode from width and height
func (*Model) UpdateQuickActionsInput ¶
UpdateQuickActionsInput updates the search query and filters actions
func (*Model) UpdateSearchQuery ¶
UpdateSearchQuery updates the search query
func (*Model) UpdateTokens ¶
UpdateTokens updates the token counters (cumulative across all messages in this session)
func (*Model) UpdateViewport ¶
func (m *Model) UpdateViewport()
UpdateViewport renders messages into viewport
type MuxApprovalRequest ¶ added in v0.3.10
type MuxApprovalRequest = mux.ApprovalRequest
MuxApprovalRequest is an alias for mux.ApprovalRequest for use in the UI
type MuxApprovalRequestMsg ¶ added in v0.3.10
type MuxApprovalRequestMsg struct {
Request MuxApprovalRequest
Done bool // Channel was closed
}
MuxApprovalRequestMsg is a Bubbletea message for tool approval requests
type MuxBackend ¶ added in v0.3.10
type MuxBackend interface {
Run(ctx context.Context, prompt string) <-chan mux.Event
RunInteractive(
ctx context.Context,
prompt string,
needsApproval func(toolName string, params map[string]any) bool,
) (<-chan mux.Event, <-chan mux.ApprovalRequest)
}
MuxBackend is the interface for mux.Backend that the UI uses
type MuxEventMsg ¶ added in v0.3.10
MuxEventMsg is a Bubbletea message carrying a mux event
type ProgressIndicator ¶
type ProgressIndicator struct {
State ProgressState
Message string
}
ProgressIndicator represents different states of operation progress
func NewProgressIndicator ¶
func NewProgressIndicator(state ProgressState, message string) *ProgressIndicator
NewProgressIndicator creates a new progress indicator
func (*ProgressIndicator) View ¶
func (p *ProgressIndicator) View() string
View renders the progress indicator
type ProgressState ¶
type ProgressState int
ProgressState represents the state of an operation
const ( // StateQueued indicates a tool is waiting to execute StateQueued ProgressState = iota // StateRunning indicates a tool is currently executing StateRunning // StateCompleted indicates a tool has finished execution StateCompleted // StateFailed indicates a tool execution failed StateFailed )
type ProgressiveMarkdownRenderer ¶
type ProgressiveMarkdownRenderer struct {
// contains filtered or unexported fields
}
ProgressiveMarkdownRenderer handles progressive rendering of markdown during streaming
func NewProgressiveMarkdownRenderer ¶
func NewProgressiveMarkdownRenderer() *ProgressiveMarkdownRenderer
NewProgressiveMarkdownRenderer creates a new progressive markdown renderer
func (*ProgressiveMarkdownRenderer) Reset ¶
func (r *ProgressiveMarkdownRenderer) Reset()
Reset resets the renderer state
func (*ProgressiveMarkdownRenderer) ShouldRender ¶
func (r *ProgressiveMarkdownRenderer) ShouldRender(text string) bool
ShouldRender determines if we should re-render based on new content
func (*ProgressiveMarkdownRenderer) UpdateRendered ¶
func (r *ProgressiveMarkdownRenderer) UpdateRendered(textLength int)
UpdateRendered updates the last rendered length
type QuickAction ¶
type QuickAction struct {
Name string
Description string
Usage string
Handler func(args string) error
}
QuickAction represents a single quick action
type QuickActionsRegistry ¶
type QuickActionsRegistry struct {
// contains filtered or unexported fields
}
QuickActionsRegistry manages quick actions
func NewQuickActionsRegistry ¶
func NewQuickActionsRegistry() *QuickActionsRegistry
NewQuickActionsRegistry creates a new registry with built-in actions
func (*QuickActionsRegistry) Execute ¶
func (r *QuickActionsRegistry) Execute(name, args string) error
Execute runs an action with the given arguments
func (*QuickActionsRegistry) FuzzySearch ¶
func (r *QuickActionsRegistry) FuzzySearch(query string) []*QuickAction
FuzzySearch searches actions by name using fuzzy matching
func (*QuickActionsRegistry) GetAction ¶
func (r *QuickActionsRegistry) GetAction(name string) (*QuickAction, error)
GetAction retrieves an action by name
func (*QuickActionsRegistry) ListActions ¶
func (r *QuickActionsRegistry) ListActions() []*QuickAction
ListActions returns all registered actions
func (*QuickActionsRegistry) RegisterAction ¶
func (r *QuickActionsRegistry) RegisterAction(name, description, usage string, handler func(string) error) error
RegisterAction adds a new quick action
type SpinnerType ¶
type SpinnerType int
SpinnerType represents different types of spinners
const ( // SpinnerTypeDefault is the standard loading spinner SpinnerTypeDefault SpinnerType = iota // SpinnerTypeToolExecution is used when executing tools SpinnerTypeToolExecution // SpinnerTypeStreaming is used when streaming responses SpinnerTypeStreaming // SpinnerTypeLoading is used for general loading states SpinnerTypeLoading )
type StatusBar ¶
type StatusBar struct {
// contains filtered or unexported fields
}
StatusBar manages the bottom status bar display
func NewStatusBar ¶
NewStatusBar creates a new status bar
func (*StatusBar) ApplyUpdate ¶
func (s *StatusBar) ApplyUpdate(update StatusBarUpdate)
ApplyUpdate applies a status bar update
func (*StatusBar) ClearCustomMessage ¶
func (s *StatusBar) ClearCustomMessage()
ClearCustomMessage clears the custom message
func (*StatusBar) GetFullHelp ¶
GetFullHelp returns full help text for display in a separate panel
func (*StatusBar) SetConnectionStatus ¶
func (s *StatusBar) SetConnectionStatus(status ConnectionStatus)
SetConnectionStatus updates the connection status
func (*StatusBar) SetContextSize ¶
SetContextSize sets the context window size
func (*StatusBar) SetCustomMessage ¶
SetCustomMessage sets a temporary custom message
func (*StatusBar) SetHelpVisible ¶
SetHelpVisible toggles help visibility
func (*StatusBar) UpdateTokens ¶
UpdateTokens updates token counters
type StatusBarUpdate ¶
type StatusBarUpdate struct {
Tokens *TokenUpdate
Connection *ConnectionStatus
Mode *string
Message *string
}
StatusBarUpdate represents an update to the status bar
type StreamChunk ¶
type StreamChunk = core.StreamChunk
StreamChunk is an alias for core.StreamChunk for use in UI
type StreamChunkMsg ¶
type StreamChunkMsg struct {
Chunk *StreamChunk
Error error
}
StreamChunkMsg is a Bubbletea message carrying a streaming chunk
type StreamingDisplay ¶
type StreamingDisplay struct {
// contains filtered or unexported fields
}
StreamingDisplay manages streaming text display with enhancements
func NewStreamingDisplay ¶
func NewStreamingDisplay() *StreamingDisplay
NewStreamingDisplay creates a new streaming display manager
func (*StreamingDisplay) AdvanceTypewriter ¶
func (s *StreamingDisplay) AdvanceTypewriter()
AdvanceTypewriter advances the typewriter position
func (*StreamingDisplay) AppendText ¶
func (s *StreamingDisplay) AppendText(chunk string)
AppendText adds new text to the streaming buffer
func (*StreamingDisplay) GetElapsedTime ¶
func (s *StreamingDisplay) GetElapsedTime() time.Duration
GetElapsedTime returns time since streaming started
func (*StreamingDisplay) GetFullText ¶
func (s *StreamingDisplay) GetFullText() string
GetFullText returns all text regardless of typewriter position
func (*StreamingDisplay) GetStats ¶
func (s *StreamingDisplay) GetStats() StreamingStats
GetStats returns current streaming statistics
func (*StreamingDisplay) GetText ¶
func (s *StreamingDisplay) GetText() string
GetText returns the current text (respecting typewriter mode)
func (*StreamingDisplay) GetTokenCount ¶
func (s *StreamingDisplay) GetTokenCount() int
GetTokenCount returns total tokens received
func (*StreamingDisplay) GetTokenRate ¶
func (s *StreamingDisplay) GetTokenRate() float64
GetTokenRate returns the current token rate (tokens/second)
func (*StreamingDisplay) IsTypewriterMode ¶
func (s *StreamingDisplay) IsTypewriterMode() bool
IsTypewriterMode returns whether typewriter mode is active
func (*StreamingDisplay) IsWaitingForTokens ¶
func (s *StreamingDisplay) IsWaitingForTokens() bool
IsWaitingForTokens returns whether we're still waiting for the first token
func (*StreamingDisplay) RenderStreamingIndicator ¶
func (s *StreamingDisplay) RenderStreamingIndicator() string
RenderStreamingIndicator renders the streaming status indicator
func (*StreamingDisplay) RenderWithCursor ¶
func (s *StreamingDisplay) RenderWithCursor(text string) string
RenderWithCursor renders text with a typewriter cursor if in typewriter mode
func (*StreamingDisplay) Reset ¶
func (s *StreamingDisplay) Reset()
Reset clears the streaming display
func (*StreamingDisplay) SetTypewriterMode ¶
func (s *StreamingDisplay) SetTypewriterMode(enabled bool)
SetTypewriterMode enables or disables typewriter effect
func (*StreamingDisplay) ToggleTypewriterMode ¶
func (s *StreamingDisplay) ToggleTypewriterMode()
ToggleTypewriterMode toggles typewriter mode on/off
type StreamingStats ¶
type StreamingStats struct {
TotalTokens int
AverageRate float64
CurrentRate float64
Duration time.Duration
TypewriterPos int
TotalChars int
}
StreamingStats provides statistics about the streaming session
type Suggestion ¶
type Suggestion = suggestions.Suggestion
Suggestion is an alias for suggestions.Suggestion
type SuggestionDetector ¶
type SuggestionDetector = suggestions.Detector
SuggestionDetector is an alias for suggestions.Detector
func NewSuggestionDetector ¶
func NewSuggestionDetector() *SuggestionDetector
NewSuggestionDetector creates a new detector
type SuggestionLearner ¶
type SuggestionLearner = suggestions.Learner
SuggestionLearner is an alias for suggestions.Learner
func NewSuggestionLearner ¶
func NewSuggestionLearner() *SuggestionLearner
NewSuggestionLearner creates a new learner
type TokenUpdate ¶
TokenUpdate represents a token count update
type ToolProvider ¶
type ToolProvider struct {
// contains filtered or unexported fields
}
ToolProvider provides tool name completions
func NewToolProvider ¶
func NewToolProvider(tools []string) *ToolProvider
NewToolProvider creates a new tool completion provider
func (*ToolProvider) GetCompletions ¶
func (tp *ToolProvider) GetCompletions(input string) []Completion
GetCompletions returns fuzzy-matched tool completions
func (*ToolProvider) SetTools ¶
func (tp *ToolProvider) SetTools(tools []string)
SetTools updates the available tools
type ToolResult ¶
ToolResult represents a tool execution result for the API
type ToolSpinner ¶
type ToolSpinner struct {
// contains filtered or unexported fields
}
ToolSpinner manages spinner state for tool execution
func NewToolSpinner ¶
func NewToolSpinner() *ToolSpinner
NewToolSpinner creates a new spinner for tool execution
func (*ToolSpinner) GetElapsed ¶
func (s *ToolSpinner) GetElapsed() time.Duration
GetElapsed returns the elapsed time since spinner started
func (*ToolSpinner) GetMessage ¶ added in v0.1.9
func (s *ToolSpinner) GetMessage() string
GetMessage returns the current spinner message
func (*ToolSpinner) IsActive ¶
func (s *ToolSpinner) IsActive() bool
IsActive returns whether the spinner is currently active
func (*ToolSpinner) Start ¶
func (s *ToolSpinner) Start(spinnerType SpinnerType, message string) tea.Cmd
Start activates the spinner with a message
func (*ToolSpinner) Tick ¶ added in v0.1.9
func (s *ToolSpinner) Tick() tea.Cmd
Tick returns the spinner tick command for keeping animation alive Use this when you need to batch spinner animation with other commands
func (*ToolSpinner) Update ¶
func (s *ToolSpinner) Update(msg tea.Msg) tea.Cmd
Update processes spinner tick messages
func (*ToolSpinner) UpdateTokens ¶
func (s *ToolSpinner) UpdateTokens(count int)
UpdateTokens updates token count and calculates rate (for streaming)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package components provides reusable UI components for the TUI.
|
Package components provides reusable UI components for the TUI. |
|
Package layout provides consistent border styles and spacing utilities for TUI layout.
|
Package layout provides consistent border styles and spacing utilities for TUI layout. |
|
Package themes provides theming support for the TUI.
|
Package themes provides theming support for the TUI. |
|
Package visualization provides real-time visualization of token usage and context windows.
|
Package visualization provides real-time visualization of token usage and context windows. |