ui

package
v1.16.16 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionModeNormal = iota
	SessionModePlan
	SessionModeYolo
)
View Source
const (
	IndicatorLoadingMCP         = "Loading MCP servers..."
	IndicatorCompressingContext = "Compressing context..."
	IndicatorRenamingSession    = "Renaming session..."
	IndicatorConvertingSession  = "Converting session..."
	IndicatorCheckingUpdate     = "Checking for updates..."
	IndicatorInstallingUpdate   = "Downloading and installing..."
	IndicatorGenInstruction     = "Generating GLLM.md ..."
)
View Source
const (
	LogoFont = "8bitfortress"
	LogoText = "GLLM"
)

Variables

View Source
var WhimsicalProcessingWords = []string{

	"Channelling...",
	"Pondering...",
	"Cogitating...",
	"Contemplating...",
	"Ruminating...",
	"Philosophising...",
	"Musing...",
	"Deliberating...",

	"Conjuring...",
	"Wizarding...",
	"Enchanting...",
	"Spellcrafting...",
	"Transmuting...",
	"Alchemizing...",

	"Computing...",
	"Calculating...",
	"Synthesizing...",
	"Compiling...",
	"Architecting...",
	"Optimizing...",

	"Booping...",
	"Smooshing...",
	"Discombobulating...",
	"Flibbertigibbeting...",
	"Bamboozling...",
	"Zigzagging...",
	"Percolating...",
	"Noodling...",

	"Crafting...",
	"Assembling...",
	"Constructing...",
	"Fabricating...",
	"Orchestrating...",
	"Choreographing...",

	"Imagining...",
	"Dreaming...",
	"Inventing...",
	"Innovating...",
	"Improvising...",

	"Tinkering...",
	"Fiddling...",
	"Futzing...",
	"Wrangling...",
	"Massaging...",
	"Finessing...",
}

WhimsicalProcessingWords is a collection of fun, playful processing indicators inspired by Claude Code's delightful personality

Functions

func Diff

func Diff(content1, content2, file1, file2 string, contextLines int) string

func FormatEnabledIndicator

func FormatEnabledIndicator(enabled bool) string

FormatEnabledIndicator returns a consistent enabled/disabled bracket indicator When enabled: [✔] with green color When disabled: [ ] with no color

func GetDynamicHuhNote

func GetDynamicHuhNote(title string, ms *huh.MultiSelect[string], descFunc func(string) string) *huh.Note

*

func GetDynamicHuhNoteForSelect added in v1.15.15

func GetDynamicHuhNoteForSelect(title string, sel *huh.Select[string], descFunc func(string) string) *huh.Note

GetDynamicHuhNoteForSelect creates a note that updates based on the hovered item in a single select

func GetHuhKeyMap

func GetHuhKeyMap() *huh.KeyMap

GetHuhKeyMap returns a custom keymap for huh forms Specifically disables the Editor key binding for Text fields as it interferes with input

func GetLogo(textColor string, gradientColor string, scale float64) string

func GetNewLineKeyBinding added in v1.14.9

func GetNewLineKeyBinding() key.Binding

GetNewLineKeyBinding returns a key binding for inserting a newline

func GetRandomProcessingWord added in v1.14.4

func GetRandomProcessingWord() string

GetRandomProcessingWord returns a random whimsical processing word

func GetStaticHuhNote

func GetStaticHuhNote(title string, description string) *huh.Note

func GetStaticHuhNoteFull added in v1.14.21

func GetStaticHuhNoteFull(title string, description string) *huh.Note

func NeedUserConfirmToolUse added in v1.14.12

func NeedUserConfirmToolUse(info string, prompt string, description string, toolsUse *data.ToolsUse)

NeedUserConfirmToolUse prompts the user for tool execution confirmation. If toolsUse.AutoApprove is true, it returns ToolConfirmYes immediately. Otherwise, it displays a selection menu for the user to choose "once", "session", or "cancel".

func PrintLogo(textColor string, gradientColor string, scale float64)

func RegisterIndicatorHook added in v1.15.9

func RegisterIndicatorHook()

RegisterIndicatorHook registers the global indicator as a logger hook

func RunFormClearable added in v1.15.31

func RunFormClearable(form *huh.Form, ctx context.Context) error

RunFormClearable runs a huh.Form with context and clears it from the terminal on exit. It uses a goroutine to listen for context cancellation and sends a forceQuitMsg to ensure the TUI clears the screen before the process continues.

func SendEvent added in v1.14.26

func SendEvent(msg tea.Msg)

SendEvent dispatches a message to the active chat input program. Goroutine-safe; saves status globally even if no program is running.

func SendSyncEvent added in v1.16.14

func SendSyncEvent(msg tea.Msg)

SendSyncEvent dispatches a message to the active chat input program synchronously. This is used for messages that need to be processed immediately.

func SortMultiOptions

func SortMultiOptions(options []huh.Option[string], selected []string)

SortMultiOptions sorts options for huh.MultiSelect, pinning selected values to the top and sorting the rest alphabetically (case-sensitive).

func SortOptions

func SortOptions(options []huh.Option[string], selected string)

SortOptions sorts options for huh.Select, pinning the selected value to the top and sorting the rest alphabetically (case-sensitive).

func StartUIEventListener added in v1.15.8

func StartUIEventListener()

StartUIEventListener runs event bus listeners. Call once at app startup. It bridges the decoupled service events to the concrete UI implementations.

Types

type AskUserRequest added in v1.14.25

type AskUserRequest struct {
	Question     string
	QuestionType QuestionType
	Options      []string
	Placeholder  string
}

AskUserRequest is the structured input from the LLM tool call.

type AskUserResponse added in v1.14.25

type AskUserResponse struct {
	Answer    string   `json:"answer,omitempty"`    // text / confirm / single-select
	Answers   []string `json:"answers,omitempty"`   // multi-select
	Cancelled bool     `json:"cancelled,omitempty"` // user pressed Ctrl-C / Esc
}

AskUserResponse carries the user's answer back to the model.

func RunAskUser added in v1.14.25

func RunAskUser(req AskUserRequest) (AskUserResponse, error)

RunAskUser stops the spinner, renders the appropriate huh form, and returns the answer.

type BannerMsg added in v1.14.26

type BannerMsg struct{ Text string }

BannerMsg carries a notification banner text to display above the input.

type ChatInputHooks added in v1.14.28

type ChatInputHooks struct {
	// EventChatInputReady is called when the chat input is ready
	EventChatInputReady func()

	// IsPlanModeActive returns true if in plan mode
	IsPlanModeActive func() bool

	// IsYoloModeActive returns true if in yolo mode
	IsYoloModeActive func() bool

	// ToggleSessionMode toggles the session mode
	ToggleSessionMode func()

	// OnPasteRequested is called when the user presses Ctrl+V.
	// The orchestrator is responsible for reading the clipboard and calling
	// ui.SendEvent(PasteResultMsg{...}) with the outcome.
	OnPasteRequested func()
}

ChatInputHooks allows an external orchestrator to provide state and handle events

type ChatInputModel added in v1.14.9

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

ChatInputModel is the Bubble Tea model for the chat input with autocomplete

func NewChatInputModel added in v1.14.9

func NewChatInputModel(commands []Suggestion, initialValue string, history []string, hooks ChatInputHooks) ChatInputModel

NewChatInputModel creates a new chat input model

func (ChatInputModel) Init added in v1.14.9

func (m ChatInputModel) Init() tea.Cmd

func (ChatInputModel) Update added in v1.14.9

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

User input, move cursor, type text, all trigger Update

func (ChatInputModel) UpdateSuggestions added in v1.14.10

func (m ChatInputModel) UpdateSuggestions(msg tea.Msg) (tea.Model, tea.Cmd)

UpdateSuggestions updates the suggestions based on the current input

func (ChatInputModel) View added in v1.14.9

func (m ChatInputModel) View() string

View renders the chat input Whether to show suggestions or not is determined by the model View renders the program's UI, which is just a string. The view is rendered after every Update.

type ChatInputResult added in v1.14.9

type ChatInputResult struct {
	Value    string
	Canceled bool
	History  []string
}

ChatInputResult holds the result of the chat input

func RunChatInput added in v1.14.9

func RunChatInput(commands []Suggestion, initialValue string, history []string, hooks ChatInputHooks) (ChatInputResult, error)

RunChatInput runs the chat input program

type Indicator added in v1.14.4

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

func GetIndicator added in v1.14.7

func GetIndicator() *Indicator

GetIndicator returns the singleton indicator instance

func (*Indicator) AfterLog added in v1.15.9

func (i *Indicator) AfterLog(wasActive bool)

func (*Indicator) BeforeLog added in v1.15.9

func (i *Indicator) BeforeLog() bool

LoggerHook implementation to satisfy util.LoggerHook interface

func (*Indicator) IsActive added in v1.14.7

func (i *Indicator) IsActive() bool

func (*Indicator) Start added in v1.14.4

func (i *Indicator) Start(text string)

func (*Indicator) Stop added in v1.14.4

func (i *Indicator) Stop()

type PasteResultMsg added in v1.16.6

type PasteResultMsg struct {
	PastedAttachments string // non-empty: show as attachment badge in pendingBanner
	PastedText        string // non-empty: insert into the textarea (text fallback)
}

PasteResultMsg is sent back by the orchestrator (e.g. repl.go) after processing a paste request initiated by the user pressing Ctrl+V. The UI uses this to update banners or insert text — it performs no I/O itself.

type QuestionType added in v1.14.25

type QuestionType string

QuestionType enumerates the supported interaction modes.

const (
	QuestionTypeSelect      QuestionType = "select"
	QuestionTypeMultiSelect QuestionType = "multiselect"
	QuestionTypeText        QuestionType = "text"
	QuestionTypeConfirm     QuestionType = "confirm"
)

type SessionMode added in v1.14.28

type SessionMode int

type SessionModeMsg added in v1.14.28

type SessionModeMsg struct{ Mode SessionMode }

SessionModeMsg signals a session mode toggle to the UI.

type StatusMsg added in v1.15.4

type StatusMsg struct{ Text string }

StatusMsg carries a background status update for the right-side banner.

type Suggestion added in v1.14.9

type Suggestion struct {
	Command     string
	Description string
}

Suggestion represents a suggestion item

type ViewportModel

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

func NewViewportModel

func NewViewportModel(provider string, content string, headerFunc func() string) ViewportModel

func (ViewportModel) Init

func (m ViewportModel) Init() tea.Cmd

func (ViewportModel) Update

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

func (ViewportModel) View

func (m ViewportModel) View() string

Jump to

Keyboard shortcuts

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