tui

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NimbusCloudSpinner = spinner.Spinner{
	Frames: []string{
		"☁ ✦",
		"☁ ✧",
		"☁ ˖",
		"☁ ⁺",
		"☁ ⋆",
		"☁ ⁺",
		"☁ ˖",
		"☁ ✧",
		"☁ ✦",
		"☁ ✧",
	},
	FPS: time.Second / 10,
}

NimbusCloudSpinner provides an animated cloud icon with shimmering particles.

View Source
var WordBank = []string{

	"Pondering",
	"Noodling",
	"Percolating",
	"Marinating",
	"Ruminating",
	"Brewing",
	"Cogitating",
	"Simmering",
	"Brainstorming",
	"Contemplating",
	"Meditating",
	"Mulling",
	"Deliberating",
	"Daydreaming",
	"Envisioning",
	"Incubating",
	"Conjuring",
	"Weaving",
	"Cooking",
	"Fermenting",
	"Stewing",
	"Musing",
	"Formulating",
	"Scheming",
	"Ideating",

	"Compiling",
	"Refactoring",
	"Untangling",
	"Scaffolding",
	"Synthesizing",
	"Architecting",
	"Parsing",
	"Optimizing",
	"Indexing",
	"Wiring",
	"Inspecting",
	"Analyzing",
	"Structuring",
	"Composing",
	"Crafting",
	"Benchmarking",
	"Validating",
	"Assembling",
	"Decoupling",
	"Vectorizing",
	"Generating",
	"Calibrating",
	"Tracing",
	"Transforming",
	"Polishing",
	"Resolving",
	"Orchestrating",
	"Refining",
	"Linting",
	"Provisioning",
	"Connecting",
	"Formatting",
}

WordBank contains ~50 present-participle verbs mixing coding-flavored actions with whimsical generic thinking states.

Functions

func EstimateDeltaTokens

func EstimateDeltaTokens(delta string) int

EstimateDeltaTokens approximates token count for a stream delta string.

func NextRandomVerb

func NextRandomVerb(lastVerb string) string

NextRandomVerb returns a random verb from WordBank that does not match lastVerb.

func RenderColorizedDiff

func RenderColorizedDiff(diff string) string

RenderColorizedDiff formats unified diff strings with clean addition and deletion styling.

func RenderMarkdown

func RenderMarkdown(input string, maxWidth int) string

RenderMarkdown parses basic markdown constructs and converts them into Lipgloss styled strings.

func RenderThinkingStatus

func RenderThinkingStatus(m *Model) string

RenderThinkingStatus formats the Claude-Code-style animated thinking indicator. Example: "☁ Percolating… (12s · 340 tokens)" or "☁ Percolating… (12s)"

Types

type ChatItem

type ChatItem struct {
	Role      string // "user" | "assistant" | "system" | "tool"
	Content   string
	Timestamp time.Time
	Plan      *ai.PlanSummary
	Diffs     []string
	ToolName  string
	ToolArgs  map[string]any
	IsError   bool
}

ChatItem represents a structured entry in the chat history.

type Mode

type Mode int
const (
	ModeChat Mode = iota
	ModePlanning
	ModeClarification
	ModePlanReview
	ModeExecuting
	ModeCompleted
)

type Model

type Model struct {
	Agent                *ai.Agent
	Mode                 Mode
	Viewport             viewport.Model
	TextInput            textinput.Model
	StepInput            textinput.Model
	CustomInput          textinput.Model
	Spinner              spinner.Model
	SelectedStep         int
	IsEditingStep        bool
	StreamBuffer         *strings.Builder
	Messages             []ChatItem
	CurrentDiffs         []string
	History              []string
	HistoryIndex         int
	Width                int
	Height               int
	StatusText           string
	ErrorMessage         string
	OneShot              bool
	Ready                bool
	OriginalPrompt       string
	ClarificationPlan    *ai.PlanSummary
	CurrentQuestionIdx   int
	SelectedOptionIdx    int
	ClarificationAnswers map[string]string
	IsCustomInput        bool
	ExecChan             chan tea.Msg

	// Claude-Code-style thinking indicator state
	IsThinking        bool
	ThinkingStartTime time.Time
	ThinkingVerb      string
	LastThinkingVerb  string
	ThinkingTokens    int
	LastVerbChange    time.Time
}

func NewModel

func NewModel(agent *ai.Agent, initialPrompt string, oneShot bool) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

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

func (Model) View

func (m Model) View() string

Jump to

Keyboard shortcuts

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