tui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Thinking block colors (depth-based)
	ThinkingColor0 = lipgloss.Color("141") // Light purple
	ThinkingColor1 = lipgloss.Color("105") // Medium purple
	ThinkingColor2 = lipgloss.Color("99")  // Deep purple
	ThinkingColor3 = lipgloss.Color("63")  // Dark purple

	// UI element colors
	ThinkingBorderColor = lipgloss.Color("240") // Gray border
	ThinkingHeaderColor = lipgloss.Color("13")  // Magenta
	ThinkingTextColor   = lipgloss.Color("252") // Light gray
	ThinkingMutedColor  = lipgloss.Color("242") // Muted gray
	CollapsedIconColor  = lipgloss.Color("11")  // Yellow
	ExpandedIconColor   = lipgloss.Color("10")  // Green

	// Code highlighting colors
	CodeKeywordColor  = lipgloss.Color("12")  // Blue
	CodeStringColor   = lipgloss.Color("10")  // Green
	CodeCommentColor  = lipgloss.Color("241") // Gray
	CodeNumberColor   = lipgloss.Color("11")  // Yellow
	CodeFunctionColor = lipgloss.Color("14")  // Cyan
)

Color palette for thinking visualization

View Source
var CodeBlockStyle = lipgloss.NewStyle().
	Background(lipgloss.Color("235")).
	Foreground(lipgloss.Color("252")).
	Padding(1).
	MarginTop(1).
	MarginBottom(1)

CodeBlockStyle styles code blocks within thinking content

View Source
var CollapsedIndicatorStyle = lipgloss.NewStyle().
	Foreground(CollapsedIconColor).
	Bold(true)

CollapsedIndicatorStyle styles the collapsed state indicator

View Source
var ExpandedIndicatorStyle = lipgloss.NewStyle().
	Foreground(ExpandedIconColor).
	Bold(true)

ExpandedIndicatorStyle styles the expanded state indicator

View Source
var InlineCodeStyle = lipgloss.NewStyle().
	Background(lipgloss.Color("236")).
	Foreground(CodeFunctionColor).
	Padding(0, 1)

InlineCodeStyle styles inline code snippets

View Source
var ThinkingContentStyle = lipgloss.NewStyle().
	Foreground(ThinkingTextColor).
	PaddingLeft(2)

ThinkingContentStyle styles the thinking block content

View Source
var ThinkingHeaderStyle = lipgloss.NewStyle().
	Foreground(ThinkingHeaderColor).
	Bold(true)

ThinkingHeaderStyle styles the thinking block header

View Source
var ThinkingLabelStyle = lipgloss.NewStyle().
	Foreground(ThinkingMutedColor).
	Italic(true)

ThinkingLabelStyle styles the "Thinking" label

Functions

func AnimationCmd

func AnimationCmd() tea.Cmd

AnimationCmd returns a command that sends animation ticks

func ApplySyntaxHighlighting

func ApplySyntaxHighlighting(content string) string

ApplySyntaxHighlighting applies basic syntax highlighting to thinking content

func BatchStreamChunks

func BatchStreamChunks(chunks []string) tea.Cmd

BatchStreamChunks creates a command that batches multiple stream chunks This can improve performance for high-frequency streaming

func DefaultKeyMap

func DefaultKeyMap() keyMap

DefaultKeyMap returns the default key map

func ErrorIndicator

func ErrorIndicator(message string) string

ErrorIndicator renders an error indicator

func ExtractFileName

func ExtractFileName(uri string) string

ExtractFileName extracts the file name from a URI

func ExtractFilePath

func ExtractFilePath(uri string) string

ExtractFilePath extracts the full file path from a URI

func FadeInEffect

func FadeInEffect(text string, step int, maxSteps int) string

FadeInEffect creates a fade-in effect using different brightness levels

func FilterCompletionItems

func FilterCompletionItems(items []lsp.CompletionItem, prefix string) []lsp.CompletionItem

FilterCompletionItems filters completion items by prefix

func FindReferences

func FindReferences(ctx context.Context, m *Model, documentURI string, line, char int, includeDeclaration bool) error

FindReferences finds all references to a symbol

func FormatAssistantMessage

func FormatAssistantMessage(content string) string

FormatAssistantMessage formats an assistant message for display

func FormatError

func FormatError(err error) string

FormatError formats an error message for display

func FormatHoverContent

func FormatHoverContent(content lsp.MarkupContent) string

FormatHoverContent formats hover content based on its type

func FormatLocation

func FormatLocation(location lsp.Location) string

FormatLocation formats a location for display

func FormatSystemMessage

func FormatSystemMessage(content string) string

FormatSystemMessage formats a system message for display

func FormatThinkingContent

func FormatThinkingContent(content string, config ThinkingConfig) string

FormatThinkingContent formats thinking content for display

func FormatUserMessage

func FormatUserMessage(content string) string

FormatUserMessage formats a user message for display

func GetCollapsedIcon

func GetCollapsedIcon() string

GetCollapsedIcon returns the icon for collapsed state

func GetCompletionKindIcon

func GetCompletionKindIcon(kind lsp.CompletionItemKind) string

GetCompletionKindIcon returns an icon for a completion item kind

func GetContextualHelp

func GetContextualHelp(mode string, streaming bool) []string

GetContextualHelp returns context-sensitive help text

func GetDepthColor

func GetDepthColor(depth int) lipgloss.Color

GetDepthColor returns the color for a specific depth level

func GetDepthPrefix

func GetDepthPrefix(depth int, isLast bool) string

GetDepthPrefix returns the tree-style prefix for a depth level

func GetExpandedIcon

func GetExpandedIcon() string

GetExpandedIcon returns the icon for expanded state

func GetThinkingIcon

func GetThinkingIcon() string

GetThinkingIcon returns the icon for thinking blocks

func GotoDefinition

func GotoDefinition(ctx context.Context, m *Model, documentURI string, line, char int) error

GotoDefinition navigates to the definition of a symbol

func HandleAPIError

func HandleAPIError(err error) tea.Cmd

HandleAPIError creates a command that handles API errors

func InsertCompletion

func InsertCompletion(m *Model)

InsertCompletion inserts the selected completion into the input

func LoadingIndicator

func LoadingIndicator(message string) string

LoadingIndicator renders a simple loading indicator

func ProcessUserInput

func ProcessUserInput(input string, apiKey string) tea.Cmd

ProcessUserInput creates a command that processes user input and streams the response

func PulseAnimation

func PulseAnimation(text string, tick int) string

PulseAnimation creates a pulsing effect for text

func RenderAllThinkingBlocks

func RenderAllThinkingBlocks(state *ThinkingState, config ThinkingConfig) string

RenderAllThinkingBlocks renders all thinking blocks

func RenderCompletion

func RenderCompletion(m *Model) string

RenderCompletion renders the completion popup

func RenderHover

func RenderHover(m *Model) string

RenderHover renders the hover information popup

func RenderInlineHelp

func RenderInlineHelp(hints []string) string

RenderInlineHelp renders a single-line help hint

func RenderMinimalStatusBar

func RenderMinimalStatusBar(isStreaming bool, hasError bool) string

RenderMinimalStatusBar renders a minimal status bar (single line indicator)

func RenderNavigation

func RenderNavigation(m *Model) string

RenderNavigation renders the navigation results popup

func RenderProgressBar

func RenderProgressBar(progress float64, width int) string

RenderProgressBar renders a progress bar with the given completion percentage

func RenderThinkingBlock

func RenderThinkingBlock(block *ThinkingBlock, config ThinkingConfig) string

RenderThinkingBlock renders a single thinking block with all styling

func RenderThinkingHeader

func RenderThinkingHeader(state *ThinkingState) string

RenderThinkingHeader renders a header for the thinking section

func RenderThinkingSummary

func RenderThinkingSummary(state *ThinkingState) string

RenderThinkingSummary renders a summary of thinking blocks

func RenderThinkingToggleHint

func RenderThinkingToggleHint(showThinking bool) string

RenderThinkingToggleHint renders a hint about the thinking toggle

func RequestCompletion

func RequestCompletion(ctx context.Context, m *Model, params lsp.CompletionParams) ([]lsp.CompletionItem, error)

RequestCompletion requests completion items from LSP

func RequestDefinition

func RequestDefinition(ctx context.Context, m *Model, params lsp.DefinitionParams) ([]lsp.Location, error)

RequestDefinition requests definition locations from LSP

func RequestHover

func RequestHover(ctx context.Context, m *Model, params lsp.HoverParams) (*lsp.Hover, error)

RequestHover requests hover information from LSP

func RequestReferences

func RequestReferences(ctx context.Context, m *Model, params lsp.ReferencesParams) ([]lsp.Location, error)

RequestReferences requests reference locations from LSP

func SendCollapseAllThinking

func SendCollapseAllThinking() tea.Cmd

SendCollapseAllThinking creates a command to collapse all thinking

func SendError

func SendError(err error) tea.Cmd

SendError creates a command that sends an error message

func SendExpandAllThinking

func SendExpandAllThinking() tea.Cmd

SendExpandAllThinking creates a command to expand all thinking

func SendFeedbackPrompt

func SendFeedbackPrompt(interactionID string) tea.Cmd

SendFeedbackPrompt creates a command to show feedback prompt

func SendFeedbackSubmitted

func SendFeedbackSubmitted(interactionID string, rating int, comment string) tea.Cmd

SendFeedbackSubmitted creates a command for submitted feedback

func SendImplicitFeedback

func SendImplicitFeedback(action string) tea.Cmd

SendImplicitFeedback creates a command to record implicit feedback

func SendReady

func SendReady() tea.Cmd

SendReady creates a command that sends a ready message

func SendStreamChunk

func SendStreamChunk(content string) tea.Cmd

SendStreamChunk creates a command that sends a stream chunk

func SendStreamDone

func SendStreamDone() tea.Cmd

SendStreamDone creates a command that sends a stream done message

func SendThinkingChunk

func SendThinkingChunk(content string, depth int) tea.Cmd

SendThinkingChunk creates a command that sends a thinking chunk

func SendThinkingDone

func SendThinkingDone() tea.Cmd

SendThinkingDone creates a command that sends a thinking done message

func SendToggleThinking

func SendToggleThinking() tea.Cmd

SendToggleThinking creates a command that toggles thinking display

func SendUserInput

func SendUserInput(input string) tea.Cmd

SendUserInput creates a command that sends user input

func SortCompletionItems

func SortCompletionItems(items []lsp.CompletionItem) []lsp.CompletionItem

SortCompletionItems sorts completion items by relevance

func StreamResponse

func StreamResponse(reader io.Reader) tea.Cmd

StreamResponse creates a command that streams API responses This is a more generic streaming handler that can be composed

func StreamingIndicator

func StreamingIndicator(tick int) string

StreamingIndicator renders a streaming indicator

func SuccessIndicator

func SuccessIndicator(message string) string

SuccessIndicator renders a success indicator

func ThinkingBorderStyle

func ThinkingBorderStyle(depth int) lipgloss.Style

ThinkingBorderStyle creates a border style for thinking blocks

func ThinkingIndentStyle

func ThinkingIndentStyle(depth int) lipgloss.Style

ThinkingIndentStyle creates indentation for nested thinking

func ThinkingIndicator

func ThinkingIndicator(tick int) string

ThinkingIndicator renders a thinking indicator with animated dots

func TriggerCompletion

func TriggerCompletion(ctx context.Context, m *Model, documentURI string, line, char int) error

TriggerCompletion triggers completion at the current cursor position

func TriggerHover

func TriggerHover(ctx context.Context, m *Model, documentURI string, line, char int) error

TriggerHover triggers hover information at the current position

func TypewriterEffect

func TypewriterEffect(text string, position int) string

TypewriterEffect simulates a typewriter effect for text

func WaitForStream

func WaitForStream(done <-chan struct{}) tea.Cmd

WaitForStream creates a command that waits for streaming to complete This can be used for synchronization or timeout handling

func WrapThinkingContent

func WrapThinkingContent(content string, width int) string

WrapThinkingContent wraps thinking content to a specific width

Types

type AnimationState

type AnimationState struct {
	Spinner       spinner.Model
	AnimationType AnimationType
	Message       string
	Progress      float64 // 0.0 to 1.0 for progress bars
	StartTime     time.Time
	Visible       bool
}

AnimationState manages all animation state

func NewAnimationState

func NewAnimationState() *AnimationState

NewAnimationState creates a new animation state with default settings

func (*AnimationState) GetElapsedTime

func (a *AnimationState) GetElapsedTime() time.Duration

GetElapsedTime returns the time elapsed since animation started

func (*AnimationState) Render

func (a *AnimationState) Render() string

Render renders the animation based on current state

func (*AnimationState) SetProgress

func (a *AnimationState) SetProgress(progress float64)

SetProgress updates the progress value (0.0 to 1.0)

func (*AnimationState) StartAnimation

func (a *AnimationState) StartAnimation(animType AnimationType, message string)

StartAnimation starts an animation with the given type and message

func (*AnimationState) StopAnimation

func (a *AnimationState) StopAnimation()

StopAnimation stops the current animation

func (*AnimationState) UpdateMessage

func (a *AnimationState) UpdateMessage(message string)

UpdateMessage updates the animation message

type AnimationTickMsg

type AnimationTickMsg struct {
	Time time.Time
}

AnimationTickMsg is sent to update animation state

type AnimationType

type AnimationType int

AnimationType represents the type of animation to display

const (
	AnimationNone AnimationType = iota
	AnimationLoading
	AnimationThinking
	AnimationProcessing
	AnimationSuccess
	AnimationError
)

type CodeBlock

type CodeBlock struct {
	Language string
	Code     string
}

CodeBlock represents a code block extracted from markdown

func ExtractCodeBlocks

func ExtractCodeBlocks(markdown string) []CodeBlock

ExtractCodeBlocks extracts code blocks from markdown

type HelpState

type HelpState struct {
	Visible         bool
	FullHelp        bool // false = compact, true = full
	CurrentCategory string
	HelpModel       help.Model
}

HelpState manages the help overlay state

func NewHelpState

func NewHelpState() *HelpState

NewHelpState creates a new help state

func (*HelpState) Hide

func (h *HelpState) Hide()

Hide hides the help overlay

func (*HelpState) RenderHelp

func (h *HelpState) RenderHelp(width, height int) string

RenderHelp renders the help overlay

func (*HelpState) SetCategory

func (h *HelpState) SetCategory(category string)

SetCategory sets the current help category

func (*HelpState) Show

func (h *HelpState) Show()

Show displays the help overlay

func (*HelpState) Toggle

func (h *HelpState) Toggle()

Toggle toggles the help overlay

func (*HelpState) ToggleFullHelp

func (h *HelpState) ToggleFullHelp()

ToggleFullHelp toggles between compact and full help

type KeyBinding

type KeyBinding struct {
	Key         string
	Description string
	Category    string // "navigation", "editing", "view", "system"
}

KeyBinding represents a keyboard shortcut

func GetAllKeyBindings

func GetAllKeyBindings() []KeyBinding

GetAllKeyBindings returns all available key bindings

func GetKeyBindingsByCategory

func GetKeyBindingsByCategory(category string) []KeyBinding

GetKeyBindingsByCategory returns key bindings filtered by category

type Message

type Message struct {
	Role    string // "user", "assistant", "system"
	Content string
}

Message represents a chat message

type Model

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

Model represents the TUI application state

func NewModel

func NewModel() Model

NewModel creates a new TUI model

func NewModelWithLSP

func NewModelWithLSP(workspace string) Model

NewModelWithLSP creates a new TUI model with LSP enabled

func (*Model) AddMessage

func (m *Model) AddMessage(role, content string)

AddMessage adds a new message to the conversation

func (*Model) AddThinking

func (m *Model) AddThinking(content string, depth int)

AddThinking adds a new thinking block

func (*Model) AppendThinking

func (m *Model) AppendThinking(content string)

AppendThinking appends content to the current thinking block

func (*Model) CaptureInteraction

func (m *Model) CaptureInteraction(prompt, response, modelID string)

CaptureInteraction captures an interaction for RLHF

func (*Model) ClearCompletion

func (m *Model) ClearCompletion()

ClearCompletion clears the completion popup

func (*Model) ClearError

func (m *Model) ClearError()

ClearError clears the error state

func (*Model) ClearHover

func (m *Model) ClearHover()

ClearHover clears the hover popup

func (*Model) ClearMessages

func (m *Model) ClearMessages()

ClearMessages removes all messages

func (*Model) ClearNavigation

func (m *Model) ClearNavigation()

ClearNavigation clears the navigation result

func (*Model) ClearThinking

func (m *Model) ClearThinking()

ClearThinking removes all thinking blocks

func (*Model) CollapseAllThinking

func (m *Model) CollapseAllThinking()

CollapseAllThinking collapses all thinking blocks

func (*Model) DisableSyntaxHighlighting

func (m *Model) DisableSyntaxHighlighting()

DisableSyntaxHighlighting disables syntax highlighting

func (*Model) DismissFeedbackPrompt

func (m *Model) DismissFeedbackPrompt()

DismissFeedbackPrompt dismisses the feedback prompt

func (*Model) EnableSyntaxHighlighting

func (m *Model) EnableSyntaxHighlighting()

EnableSyntaxHighlighting enables syntax highlighting

func (*Model) ExpandAllThinking

func (m *Model) ExpandAllThinking()

ExpandAllThinking expands all thinking blocks

func (*Model) GetFeedbackPromptModel

func (m *Model) GetFeedbackPromptModel() *rlhf.FeedbackPromptModel

GetFeedbackPromptModel returns the feedback prompt model

func (*Model) GetHoverInfo

func (m *Model) GetHoverInfo() *lsp.Hover

GetHoverInfo returns the hover information

func (*Model) GetLSPClient

func (m *Model) GetLSPClient() *lsp.Client

GetLSPClient returns the LSP client

func (*Model) GetLSPStatus

func (m *Model) GetLSPStatus() lsp.ConnectionStatus

GetLSPStatus returns the LSP connection status

func (*Model) GetNavigationResult

func (m *Model) GetNavigationResult() []lsp.Location

GetNavigationResult returns the navigation results

func (*Model) GetSelectedCompletion

func (m *Model) GetSelectedCompletion() *lsp.CompletionItem

GetSelectedCompletion returns the currently selected completion item

func (*Model) GetShowCompletion

func (m *Model) GetShowCompletion() bool

GetShowCompletion returns whether the completion popup is shown

func (*Model) GetShowFeedbackPrompt

func (m *Model) GetShowFeedbackPrompt() bool

GetShowFeedbackPrompt returns whether the feedback prompt should be shown

func (*Model) GetShowHover

func (m *Model) GetShowHover() bool

GetShowHover returns whether the hover popup is shown

func (*Model) GetShowNavigation

func (m *Model) GetShowNavigation() bool

GetShowNavigation returns whether the navigation popup is shown

func (*Model) GetSyntaxHighlighter

func (m *Model) GetSyntaxHighlighter() *syntax.Highlighter

GetSyntaxHighlighter returns the syntax highlighter

func (*Model) GetThinkingConfig

func (m *Model) GetThinkingConfig() ThinkingConfig

GetThinkingConfig returns the thinking configuration

func (*Model) GetThinkingState

func (m *Model) GetThinkingState() *ThinkingState

GetThinkingState returns the thinking state

func (*Model) GetUserInput

func (m *Model) GetUserInput() string

GetUserInput returns and clears the current input

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the TUI and returns initial commands This function is called once when the Bubble Tea program starts

func (*Model) IsLSPEnabled

func (m *Model) IsLSPEnabled() bool

IsLSPEnabled returns whether LSP is enabled

func (*Model) IsQuitting

func (m *Model) IsQuitting() bool

IsQuitting returns whether the TUI is quitting

func (*Model) IsReady

func (m *Model) IsReady() bool

IsReady returns whether the TUI is ready to display

func (*Model) IsStreaming

func (m *Model) IsStreaming() bool

IsStreaming returns whether a response is being streamed

func (*Model) IsSyntaxHighlightingEnabled

func (m *Model) IsSyntaxHighlightingEnabled() bool

IsSyntaxHighlightingEnabled returns whether syntax highlighting is enabled

func (*Model) IsThinkingVisible

func (m *Model) IsThinkingVisible() bool

IsThinkingVisible returns whether thinking blocks are visible

func (*Model) NextCompletion

func (m *Model) NextCompletion()

NextCompletion moves to the next completion item

func (*Model) PrevCompletion

func (m *Model) PrevCompletion()

PrevCompletion moves to the previous completion item

func (*Model) RecordExplicitFeedback

func (m *Model) RecordExplicitFeedback(interactionID string, score float64, feedback string)

RecordExplicitFeedback records explicit user feedback

func (*Model) RecordImplicitFeedback

func (m *Model) RecordImplicitFeedback(action rlhf.FeedbackAction)

RecordImplicitFeedback records an implicit feedback signal

func (*Model) SetCompletionItems

func (m *Model) SetCompletionItems(items []lsp.CompletionItem)

SetCompletionItems sets the completion items

func (*Model) SetError

func (m *Model) SetError(err error)

SetError sets an error state

func (*Model) SetHoverInfo

func (m *Model) SetHoverInfo(hover *lsp.Hover)

SetHoverInfo sets the hover information

func (*Model) SetNavigationResult

func (m *Model) SetNavigationResult(locations []lsp.Location)

SetNavigationResult sets the navigation result

func (*Model) SetQuitting

func (m *Model) SetQuitting(quitting bool)

SetQuitting sets the quitting state

func (*Model) SetRLHFCollector

func (m *Model) SetRLHFCollector(collector *rlhf.Collector)

SetRLHFCollector sets the RLHF collector

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize updates the model dimensions

func (*Model) SetStreaming

func (m *Model) SetStreaming(streaming bool)

SetStreaming sets the streaming state

func (*Model) SetThinkingConfig

func (m *Model) SetThinkingConfig(config ThinkingConfig)

SetThinkingConfig sets the thinking configuration

func (*Model) SetValue

func (m *Model) SetValue(value string)

SetValue sets the input value (for testing)

func (*Model) ToggleThinkingDisplay

func (m *Model) ToggleThinkingDisplay()

ToggleThinkingDisplay toggles the display of thinking blocks

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles state transitions based on incoming messages

func (Model) View

func (m Model) View() string

View renders the complete TUI interface

type StatusBarState

type StatusBarState struct {
	Provider      string
	Model         string
	TokensUsed    int
	TokensTotal   int
	SessionStart  time.Time
	ConnectionOK  bool
	CurrentMode   string // "chat", "help", "settings", etc.
	CustomMessage string
	ShowKeyHints  bool
	AnimationTick int // For animated elements
}

StatusBarState represents the state of the status bar

func NewStatusBarState

func NewStatusBarState() *StatusBarState

NewStatusBarState creates a new status bar state with defaults

func (*StatusBarState) AddTokens

func (s *StatusBarState) AddTokens(tokens int)

AddTokens adds to the token count

func (*StatusBarState) ClearCustomMessage

func (s *StatusBarState) ClearCustomMessage()

ClearCustomMessage clears the custom message

func (*StatusBarState) GetSessionDuration

func (s *StatusBarState) GetSessionDuration() time.Duration

GetSessionDuration returns the duration of the current session

func (*StatusBarState) IncrementAnimationTick

func (s *StatusBarState) IncrementAnimationTick()

IncrementAnimationTick increments the animation tick counter

func (*StatusBarState) RenderStatusBar

func (s *StatusBarState) RenderStatusBar(width int, isStreaming bool, hasError bool) string

RenderStatusBar renders the complete status bar

func (*StatusBarState) SetConnectionStatus

func (s *StatusBarState) SetConnectionStatus(ok bool)

SetConnectionStatus sets the connection status

func (*StatusBarState) SetCustomMessage

func (s *StatusBarState) SetCustomMessage(message string)

SetCustomMessage sets a custom message to display

func (*StatusBarState) SetMode

func (s *StatusBarState) SetMode(mode string)

SetMode sets the current mode

func (*StatusBarState) SetModel

func (s *StatusBarState) SetModel(model string)

SetModel sets the AI model name

func (*StatusBarState) SetProvider

func (s *StatusBarState) SetProvider(provider string)

SetProvider sets the AI provider name

func (*StatusBarState) SetTokens

func (s *StatusBarState) SetTokens(used, total int)

SetTokens sets the token usage

func (*StatusBarState) ToggleKeyHints

func (s *StatusBarState) ToggleKeyHints()

ToggleKeyHints toggles the display of keyboard hints

type ThinkingBlock

type ThinkingBlock struct {
	ID        string           // Unique identifier
	Content   string           // Thinking content
	Depth     int              // Nesting depth (0 = root)
	Collapsed bool             // Whether the block is collapsed
	Timestamp time.Time        // When the thinking occurred
	Children  []*ThinkingBlock // Nested thinking blocks
}

ThinkingBlock represents a collapsible thinking content block

func (*ThinkingBlock) AddChild

func (tb *ThinkingBlock) AddChild(child *ThinkingBlock)

AddChild adds a child thinking block

func (*ThinkingBlock) GetDepthIndicator

func (tb *ThinkingBlock) GetDepthIndicator() string

GetDepthIndicator returns a visual indicator for the depth level

func (*ThinkingBlock) GetLineCount

func (tb *ThinkingBlock) GetLineCount() int

GetLineCount returns the number of lines in the thinking content

func (*ThinkingBlock) GetPreview

func (tb *ThinkingBlock) GetPreview(maxLength int) string

GetPreview returns a preview of the thinking content (first line)

func (*ThinkingBlock) HasChildren

func (tb *ThinkingBlock) HasChildren() bool

HasChildren returns whether the block has nested children

func (*ThinkingBlock) IsCollapsed

func (tb *ThinkingBlock) IsCollapsed() bool

IsCollapsed returns whether a block is collapsed

type ThinkingConfig

type ThinkingConfig struct {
	ShowThinking       bool // Whether to show thinking blocks
	CollapseByDefault  bool // Whether new blocks start collapsed
	MaxPreviewLength   int  // Maximum length of preview text
	SyntaxHighlighting bool // Whether to apply syntax highlighting
	ShowTimestamps     bool // Whether to show timestamps
	ShowDepthIndicator bool // Whether to show depth indicators
}

ThinkingConfig holds configuration for thinking visualization

func DefaultThinkingConfig

func DefaultThinkingConfig() ThinkingConfig

DefaultThinkingConfig returns default configuration

type ThinkingState

type ThinkingState struct {
	Blocks       []*ThinkingBlock          // All thinking blocks in order
	ShowThinking bool                      // Whether to show thinking blocks
	CurrentBlock *ThinkingBlock            // Currently active/focused block
	BlocksByID   map[string]*ThinkingBlock // Quick lookup by ID
	// contains filtered or unexported fields
}

ThinkingState manages the state of all thinking blocks

func NewThinkingState

func NewThinkingState() *ThinkingState

NewThinkingState creates a new thinking state manager

func (*ThinkingState) AddThinkingBlock

func (ts *ThinkingState) AddThinkingBlock(content string, depth int) *ThinkingBlock

AddThinkingBlock creates and adds a new thinking block

func (*ThinkingState) AppendToCurrentBlock

func (ts *ThinkingState) AppendToCurrentBlock(content string)

AppendToCurrentBlock appends content to the currently active block

func (*ThinkingState) ClearBlocks

func (ts *ThinkingState) ClearBlocks()

ClearBlocks removes all thinking blocks

func (*ThinkingState) CollapseAll

func (ts *ThinkingState) CollapseAll()

CollapseAll collapses all thinking blocks

func (*ThinkingState) ExpandAll

func (ts *ThinkingState) ExpandAll()

ExpandAll expands all thinking blocks

func (*ThinkingState) GetVisibleBlocks

func (ts *ThinkingState) GetVisibleBlocks() []*ThinkingBlock

GetVisibleBlocks returns blocks that should be displayed

func (*ThinkingState) ToggleAllBlocks

func (ts *ThinkingState) ToggleAllBlocks(collapsed bool)

ToggleAllBlocks toggles all blocks to collapsed/expanded

func (*ThinkingState) ToggleBlock

func (ts *ThinkingState) ToggleBlock(blockID string)

ToggleBlock toggles the collapsed state of a block by ID

func (*ThinkingState) ToggleDisplay

func (ts *ThinkingState) ToggleDisplay()

ToggleDisplay toggles whether thinking blocks are shown

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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