tui

package
v0.0.0-...-92d3d5c Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Package tui provides a full-featured terminal user interface for gmn. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfirmDialogStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(AccentColor).
						Padding(1, 2).
						Background(BackgroundColor)

	ButtonStyle = lipgloss.NewStyle().
				Foreground(TextColor).
				Background(SurfaceColor).
				Padding(0, 2).
				MarginRight(1)

	ConfirmButtonSelectedStyle = lipgloss.NewStyle().
								Foreground(lipgloss.Color("#FFFFFF")).
								Background(SuccessColor).
								Padding(0, 2).
								MarginRight(1).
								Bold(true)

	CancelButtonSelectedStyle = lipgloss.NewStyle().
								Foreground(lipgloss.Color("#FFFFFF")).
								Background(DangerColor).
								Padding(0, 2).
								MarginRight(1).
								Bold(true)

	AlwaysButtonSelectedStyle = lipgloss.NewStyle().
								Foreground(lipgloss.Color("#FFFFFF")).
								Background(AccentColor).
								Padding(0, 2).
								MarginRight(1).
								Bold(true)
)
View Source
var (
	// Primary colors - Gemini-inspired gradient palette
	AccentColor  = lipgloss.Color("#8B5CF6") // Vibrant purple
	AccentColor2 = lipgloss.Color("#06B6D4") // Cyan for gradients
	SuccessColor = lipgloss.Color("#22C55E") // Bright green
	DangerColor  = lipgloss.Color("#EF4444") // Red
	WarningColor = lipgloss.Color("#FBBF24") // Amber
	InfoColor    = lipgloss.Color("#3B82F6") // Blue
	MagentaColor = lipgloss.Color("#EC4899") // Magenta for emphasis
	TealColor    = lipgloss.Color("#14B8A6") // Teal

	// Neutral colors - Codex-inspired dark theme
	TextColor       = lipgloss.Color("#F8FAFC") // Bright white text
	DimTextColor    = lipgloss.Color("#94A3B8") // Slate dim text
	MutedColor      = lipgloss.Color("#64748B") // Slate muted
	SurfaceColor    = lipgloss.Color("#1E293B") // Slate dark surface
	BackgroundColor = lipgloss.Color("#0F172A") // Slate darker background
	BorderColor     = lipgloss.Color("#334155") // Slate border
	HighlightColor  = lipgloss.Color("#475569") // Slate highlight

	// Special - Conversation colors
	UserColor   = lipgloss.Color("#22D3EE") // Cyan for user
	ModelColor  = lipgloss.Color("#A78BFA") // Light purple for model
	SystemColor = lipgloss.Color("#64748B") // Slate for system
	ThinkColor  = lipgloss.Color("#818CF8") // Indigo for thinking
)
View Source
var (
	// Container styles
	BaseContainerStyle = lipgloss.NewStyle().
						Padding(0, 1)

	BorderedContainerStyle = lipgloss.NewStyle().
							Border(lipgloss.RoundedBorder()).
							BorderForeground(BorderColor)

	// Gradient border style (simulated with colors)
	GradientBorderStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(AccentColor)

	// Text styles
	BoldStyle = lipgloss.NewStyle().Bold(true)

	DimStyle = lipgloss.NewStyle().
				Foreground(DimTextColor)

	MutedStyle = lipgloss.NewStyle().
				Foreground(MutedColor)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(DangerColor).
				Bold(true)

	SuccessStyle = lipgloss.NewStyle().
					Foreground(SuccessColor).
					Bold(true)

	WarningStyle = lipgloss.NewStyle().
					Foreground(WarningColor)

	AccentStyle = lipgloss.NewStyle().
				Foreground(AccentColor).
				Bold(true)

	// Gradient text effect (using alternating colors)
	GradientTextStyle = lipgloss.NewStyle().
						Foreground(AccentColor).
						Bold(true)
)
View Source
var (
	HeaderStyle = lipgloss.NewStyle().
				Border(lipgloss.NormalBorder(), false, false, true, false).
				BorderForeground(AccentColor).
				Padding(0, 1).
				Background(BackgroundColor)

	LogoStyle = lipgloss.NewStyle().
				Foreground(AccentColor).
				Bold(true)

	ModelBadgeStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#FFFFFF")).
					Background(AccentColor).
					Padding(0, 1).
					Bold(true)

	YoloBadgeStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#000000")).
					Background(WarningColor).
					Padding(0, 1).
					Bold(true)

	InfoBadgeStyle = lipgloss.NewStyle().
					Foreground(DimTextColor).
					Background(SurfaceColor).
					Padding(0, 1)

	// New: Status indicator badges
	OnlineBadgeStyle = lipgloss.NewStyle().
						Foreground(lipgloss.Color("#000000")).
						Background(SuccessColor).
						Padding(0, 1).
						Bold(true)

	ProcessingBadgeStyle = lipgloss.NewStyle().
							Foreground(lipgloss.Color("#FFFFFF")).
							Background(ThinkColor).
							Padding(0, 1).
							Bold(true)
)
View Source
var (
	SidebarStyle = lipgloss.NewStyle().
					Border(lipgloss.NormalBorder(), false, true, false, false).
					BorderForeground(BorderColor).
					Padding(0, 1).
					Background(BackgroundColor)

	SidebarTitleStyle = lipgloss.NewStyle().
						Foreground(AccentColor).
						Bold(true).
						Padding(0, 0, 1, 0)

	SessionItemStyle = lipgloss.NewStyle().
						Foreground(TextColor).
						Padding(0, 1)

	SessionItemSelectedStyle = lipgloss.NewStyle().
								Foreground(lipgloss.Color("#FFFFFF")).
								Background(AccentColor).
								Padding(0, 1).
								Bold(true)

	SessionItemCurrentStyle = lipgloss.NewStyle().
							Foreground(SuccessColor).
							Padding(0, 1)

	SessionInfoStyle = lipgloss.NewStyle().
						Foreground(DimTextColor).
						Padding(0, 1)
)
View Source
var (
	ChatContainerStyle = lipgloss.NewStyle().
						Padding(0, 1)

	UserMessageStyle = lipgloss.NewStyle().
						Foreground(UserColor).
						Bold(true)

	UserPromptStyle = lipgloss.NewStyle().
					Foreground(UserColor).
					Bold(true)

	ModelMessageStyle = lipgloss.NewStyle().
						Foreground(TextColor)

	ThinkingStyle = lipgloss.NewStyle().
					Foreground(DimTextColor).
					Italic(true)

	TimestampStyle = lipgloss.NewStyle().
					Foreground(MutedColor)

	CodeBlockStyle = lipgloss.NewStyle().
					Background(SurfaceColor).
					Padding(0, 1)
)
View Source
var (
	ToolCallStyle = lipgloss.NewStyle().
					Foreground(AccentColor).
					Bold(true)

	ToolNameStyle = lipgloss.NewStyle().
					Foreground(WarningColor).
					Bold(true)

	ToolResultStyle = lipgloss.NewStyle().
					Foreground(SuccessColor)

	ToolBoxStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(BorderColor).
					Padding(0, 1)

	ToolArgStyle = lipgloss.NewStyle().
					Foreground(DimTextColor)
)
View Source
var (
	InputContainerStyle = lipgloss.NewStyle().
						Border(lipgloss.NormalBorder(), true, false, false, false).
						BorderForeground(BorderColor).
						Padding(0, 1)

	InputPromptStyle = lipgloss.NewStyle().
						Foreground(SuccessColor).
						Bold(true)

	InputPlaceholderStyle = lipgloss.NewStyle().
							Foreground(MutedColor)

	InputCursorStyle = lipgloss.NewStyle().
						Foreground(AccentColor)
)
View Source
var (
	StatusBarStyle = lipgloss.NewStyle().
					Background(SurfaceColor).
					Foreground(DimTextColor).
					Padding(0, 1)

	StatusKeyStyle = lipgloss.NewStyle().
					Foreground(AccentColor).
					Bold(true)

	StatusValueStyle = lipgloss.NewStyle().
						Foreground(DimTextColor)

	StatusDividerStyle = lipgloss.NewStyle().
						Foreground(BorderColor)
)
View Source
var (
	HelpStyle = lipgloss.NewStyle().
				Foreground(DimTextColor)

	HelpKeyStyle = lipgloss.NewStyle().
					Foreground(AccentColor).
					Bold(true)

	HelpDescStyle = lipgloss.NewStyle().
					Foreground(MutedColor)
)
View Source
var (
	SpinnerStyle = lipgloss.NewStyle().
					Foreground(AccentColor)

	SpinnerTextStyle = lipgloss.NewStyle().
						Foreground(DimTextColor)
)
View Source
var (
	ScrollbarThumbStyle = lipgloss.NewStyle().
						Foreground(MutedColor)

	ScrollbarTrackStyle = lipgloss.NewStyle().
						Foreground(BorderColor)
)
View Source
var ContextPanelStyle = lipgloss.NewStyle().
	Border(lipgloss.NormalBorder(), false, false, false, true).
	BorderForeground(BorderColor).
	Padding(0, 1)
View Source
var FilePreviewStyle = lipgloss.NewStyle().
	Border(lipgloss.RoundedBorder()).
	BorderForeground(AccentColor).
	Padding(0, 1)
View Source
var ThinkingBoxStyle = lipgloss.NewStyle().
	Border(lipgloss.RoundedBorder()).
	BorderForeground(AccentColor).
	Padding(0, 1).
	MarginTop(1).
	MarginBottom(1)

Functions

func Run

func Run(config Config, client *api.Client, sessionMgr *session.Manager, registry *tools.Registry) error

Run starts the TUI application

Types

type ActivityItem

type ActivityItem struct {
	Type      ActivityType
	Title     string
	Detail    string
	Status    ActivityStatus
	Timestamp time.Time
	Duration  time.Duration
}

ActivityItem represents an activity in the feed

type ActivityStatus

type ActivityStatus int

ActivityStatus represents the status of an activity

const (
	ActivityStatusPending ActivityStatus = iota
	ActivityStatusRunning
	ActivityStatusSuccess
	ActivityStatusError
)

type ActivityType

type ActivityType int

ActivityType represents the type of activity

const (
	ActivityTypeAPI ActivityType = iota
	ActivityTypeTool
	ActivityTypeFile
	ActivityTypeSearch
	ActivityTypeShell
	ActivityTypeThinking
)

type App

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

App represents the main TUI application

func NewApp

func NewApp(config Config, client *api.Client, sessionMgr *session.Manager, registry *tools.Registry) *App

NewApp creates a new TUI application

func (*App) Init

func (a *App) Init() tea.Cmd

Init initializes the TUI

func (*App) Update

func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (*App) View

func (a *App) View() string

View renders the TUI

type ChatMessage

type ChatMessage struct {
	Type      MessageType
	Content   string
	ToolName  string
	ToolArgs  string
	Timestamp string
	Rendered  string // Pre-rendered content for Markdown
}

ChatMessage represents a single message

type ChatViewModel

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

ChatViewModel represents the chat display area

func NewChatViewModel

func NewChatViewModel() ChatViewModel

NewChatViewModel creates a new chat view model

func (*ChatViewModel) AddMessage

func (c *ChatViewModel) AddMessage(msg ChatMessage)

AddMessage adds a message to the chat

func (*ChatViewModel) Clear

func (c *ChatViewModel) Clear()

Clear clears all messages

func (*ChatViewModel) SetFocused

func (c *ChatViewModel) SetFocused(focused bool)

SetFocused sets focus state

func (*ChatViewModel) SetLoading

func (c *ChatViewModel) SetLoading(loading bool, text string)

SetLoading sets loading state

func (*ChatViewModel) SetSize

func (c *ChatViewModel) SetSize(width, height int)

SetSize sets the chat view dimensions

func (*ChatViewModel) Update

func (c *ChatViewModel) Update(msg tea.Msg) tea.Cmd

Update handles viewport updates

func (*ChatViewModel) UpdateLastMessage

func (c *ChatViewModel) UpdateLastMessage(content string)

UpdateLastMessage updates the last message (for streaming)

func (*ChatViewModel) View

func (c *ChatViewModel) View() string

View renders the chat view

type Config

type Config struct {
	Model           string
	YoloMode        bool
	Cwd             string
	ProjectID       string
	Timeout         time.Duration
	AvailableModels []string
	InitialPrompt   string
	ResumeSession   string
}

Config holds TUI configuration

type ConfirmChoice

type ConfirmChoice int

ConfirmChoice represents the user's choice

const (
	ConfirmChoiceNone ConfirmChoice = iota
	ConfirmChoiceYes
	ConfirmChoiceNo
	ConfirmChoiceAlways
)

type ConfirmDialogModel

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

ConfirmDialogModel represents a confirmation dialog

func NewConfirmDialogModel

func NewConfirmDialogModel() ConfirmDialogModel

NewConfirmDialogModel creates a new confirmation dialog

func (*ConfirmDialogModel) Hide

func (c *ConfirmDialogModel) Hide()

Hide hides the dialog

func (ConfirmDialogModel) IsVisible

func (c ConfirmDialogModel) IsVisible() bool

IsVisible returns visibility

func (*ConfirmDialogModel) SetSize

func (c *ConfirmDialogModel) SetSize(width, height int)

SetSize sets the dialog dimensions

func (*ConfirmDialogModel) Show

Show shows the confirmation dialog

func (*ConfirmDialogModel) Update

func (c *ConfirmDialogModel) Update(msg tea.Msg) tea.Cmd

Update handles input

func (ConfirmDialogModel) View

func (c ConfirmDialogModel) View() string

View renders the dialog

type ConfirmDialogOptions

type ConfirmDialogOptions struct {
	Type       ConfirmationType
	Title      string
	Message    string
	Detail     string
	ToolName   string
	FilePath   string
	Command    string
	URL        string
	OldContent string
	NewContent string
	OnResult   func(ConfirmChoice)
}

ConfirmDialogOptions holds dialog options

type ConfirmationType

type ConfirmationType int

ConfirmationType represents the type of confirmation

const (
	ConfirmTypeFile ConfirmationType = iota
	ConfirmTypeCommand
	ConfirmTypeNetwork
	ConfirmTypeDangerous
)

type ContextItem

type ContextItem struct {
	Type      ContextType
	Path      string
	Name      string
	Size      int64
	LineCount int
	AddedAt   time.Time
}

ContextItem represents an item in the context

type ContextPanelModel

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

ContextPanelModel represents the context/activity panel

func NewContextPanelModel

func NewContextPanelModel() ContextPanelModel

NewContextPanelModel creates a new context panel model

func (*ContextPanelModel) AddActivity

func (c *ContextPanelModel) AddActivity(activity ActivityItem)

AddActivity adds an activity item

func (*ContextPanelModel) AddContextItem

func (c *ContextPanelModel) AddContextItem(item ContextItem)

AddContextItem adds a context item

func (*ContextPanelModel) ClearContext

func (c *ContextPanelModel) ClearContext()

ClearContext clears all context items

func (*ContextPanelModel) RemoveContextItem

func (c *ContextPanelModel) RemoveContextItem(path string)

RemoveContextItem removes a context item by path

func (*ContextPanelModel) SetFocused

func (c *ContextPanelModel) SetFocused(focused bool)

SetFocused sets the focus state

func (*ContextPanelModel) SetSize

func (c *ContextPanelModel) SetSize(width, height int)

SetSize sets the panel dimensions

func (*ContextPanelModel) ToggleActivities

func (c *ContextPanelModel) ToggleActivities()

ToggleActivities toggles activities display

func (*ContextPanelModel) ToggleContext

func (c *ContextPanelModel) ToggleContext()

ToggleContext toggles context display

func (*ContextPanelModel) UpdateLastActivity

func (c *ContextPanelModel) UpdateLastActivity(status ActivityStatus, duration time.Duration)

UpdateLastActivity updates the most recent activity

func (ContextPanelModel) View

func (c ContextPanelModel) View() string

View renders the context panel

type ContextType

type ContextType int

ContextType represents the type of context item

const (
	ContextTypeFile ContextType = iota
	ContextTypeDirectory
	ContextTypeURL
	ContextTypeClipboard
)

type DiffLine

type DiffLine struct {
	Type    DiffLineType
	Content string
	OldNum  int
	NewNum  int
}

DiffLine represents a line in the diff

type DiffLineType

type DiffLineType int

DiffLineType represents the type of diff line

const (
	DiffLineContext DiffLineType = iota
	DiffLineAdded
	DiffLineRemoved
	DiffLineHeader
)

type FilePreviewModel

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

FilePreviewModel represents the file preview/diff component

func NewFilePreviewModel

func NewFilePreviewModel() FilePreviewModel

NewFilePreviewModel creates a new file preview model

func (*FilePreviewModel) Hide

func (f *FilePreviewModel) Hide()

Hide hides the preview

func (*FilePreviewModel) IsVisible

func (f *FilePreviewModel) IsVisible() bool

IsVisible returns visibility state

func (*FilePreviewModel) ScrollDown

func (f *FilePreviewModel) ScrollDown(lines int)

ScrollDown scrolls down

func (*FilePreviewModel) ScrollUp

func (f *FilePreviewModel) ScrollUp(lines int)

ScrollUp scrolls up

func (*FilePreviewModel) SetCommandPreview

func (f *FilePreviewModel) SetCommandPreview(command, explanation string)

SetCommandPreview sets a command preview

func (*FilePreviewModel) SetDiffPreview

func (f *FilePreviewModel) SetDiffPreview(title, path, oldContent, newContent string)

SetDiffPreview sets a diff preview

func (*FilePreviewModel) SetFilePreview

func (f *FilePreviewModel) SetFilePreview(title, path, content string)

SetFilePreview sets a file preview

func (*FilePreviewModel) SetOutputPreview

func (f *FilePreviewModel) SetOutputPreview(title, output string)

SetOutputPreview sets an output preview

func (*FilePreviewModel) SetSize

func (f *FilePreviewModel) SetSize(width, height int)

SetSize sets the preview dimensions

func (*FilePreviewModel) Show

func (f *FilePreviewModel) Show()

Show shows the preview

func (*FilePreviewModel) Toggle

func (f *FilePreviewModel) Toggle()

Toggle toggles visibility

func (FilePreviewModel) View

func (f FilePreviewModel) View() string

View renders the file preview

type FocusArea

type FocusArea int

FocusArea represents which panel is focused

const (
	FocusInput FocusArea = iota
	FocusChat
	FocusSidebar
)

type HeaderModel

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

HeaderModel represents the header component

func NewHeaderModel

func NewHeaderModel(modelName string, yoloMode bool, cwd string) HeaderModel

NewHeaderModel creates a new header model

func (*HeaderModel) SetModel

func (h *HeaderModel) SetModel(modelName string)

SetModel sets the model name

func (*HeaderModel) SetWidth

func (h *HeaderModel) SetWidth(width int)

SetWidth sets the width of the header

func (HeaderModel) View

func (h HeaderModel) View() string

View renders the header

type InputModel

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

InputModel represents the text input component

func NewInputModel

func NewInputModel() InputModel

NewInputModel creates a new input model

func (*InputModel) DeleteChar

func (i *InputModel) DeleteChar()

DeleteChar deletes character before cursor (backspace)

func (*InputModel) DeleteCharForward

func (i *InputModel) DeleteCharForward()

DeleteCharForward deletes character at cursor (delete)

func (*InputModel) DeleteLine

func (i *InputModel) DeleteLine()

DeleteLine clears the line

func (*InputModel) DeleteWord

func (i *InputModel) DeleteWord()

DeleteWord deletes word before cursor

func (*InputModel) HistoryDown

func (i *InputModel) HistoryDown()

HistoryDown navigates to next history item

func (*InputModel) HistoryUp

func (i *InputModel) HistoryUp()

HistoryUp navigates to previous history item

func (*InputModel) InsertChar

func (i *InputModel) InsertChar(c rune)

InsertChar inserts a character at cursor

func (*InputModel) InsertString

func (i *InputModel) InsertString(s string)

InsertString inserts a string at cursor

func (*InputModel) MoveLeft

func (i *InputModel) MoveLeft()

MoveLeft moves cursor left

func (*InputModel) MoveRight

func (i *InputModel) MoveRight()

MoveRight moves cursor right

func (*InputModel) MoveToEnd

func (i *InputModel) MoveToEnd()

MoveToEnd moves cursor to end

func (*InputModel) MoveToStart

func (i *InputModel) MoveToStart()

MoveToStart moves cursor to start

func (*InputModel) Reset

func (i *InputModel) Reset()

Reset clears the input

func (*InputModel) SetFocused

func (i *InputModel) SetFocused(focused bool)

SetFocused sets focus state

func (*InputModel) SetValue

func (i *InputModel) SetValue(value string)

SetValue sets the value

func (*InputModel) SetWidth

func (i *InputModel) SetWidth(width int)

SetWidth sets the input width

func (*InputModel) Value

func (i *InputModel) Value() string

Value returns the current value

func (*InputModel) View

func (i *InputModel) View() string

View renders the input

type KeyMap

type KeyMap struct {
	// Navigation
	Up       key.Binding
	Down     key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Home     key.Binding
	End      key.Binding

	// Actions
	Submit key.Binding
	Cancel key.Binding
	Help   key.Binding
	Quit   key.Binding

	// Panels
	FocusChat     key.Binding
	FocusSidebar  key.Binding
	FocusInput    key.Binding
	ToggleSidebar key.Binding
	ToggleContext key.Binding
	TogglePreview key.Binding

	// Commands
	NewSession  key.Binding
	SaveSession key.Binding
	LoadSession key.Binding
	ClearChat   key.Binding
	SwitchModel key.Binding
	ShowStats   key.Binding

	// Editor
	NewLine    key.Binding
	DeleteWord key.Binding
	DeleteLine key.Binding
}

KeyMap defines key bindings for the TUI

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns all keybindings for the full help view

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns keybindings for the mini help view

type MarkdownRenderer

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

MarkdownRenderer renders markdown content with syntax highlighting

func NewMarkdownRenderer

func NewMarkdownRenderer(width int) *MarkdownRenderer

NewMarkdownRenderer creates a new markdown renderer

func (*MarkdownRenderer) Render

func (r *MarkdownRenderer) Render(content string) string

Render renders markdown content

func (*MarkdownRenderer) SetWidth

func (r *MarkdownRenderer) SetWidth(width int)

SetWidth sets the render width

type MessageType

type MessageType int

MessageType represents the type of message

const (
	MessageTypeUser MessageType = iota
	MessageTypeModel
	MessageTypeTool
	MessageTypeError
	MessageTypeSystem
)

type PreviewType

type PreviewType int

PreviewType represents the type of preview

const (
	PreviewTypeFile PreviewType = iota
	PreviewTypeDiff
	PreviewTypeCommand
	PreviewTypeOutput
)

type SessionInfo

type SessionInfo struct {
	ID        string
	Name      string
	Messages  int
	UpdatedAt string
	IsCurrent bool
}

SessionInfo represents a session in the sidebar

type SidebarModel

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

SidebarModel represents the sidebar component

func NewSidebarModel

func NewSidebarModel() SidebarModel

NewSidebarModel creates a new sidebar model

func (*SidebarModel) MoveDown

func (s *SidebarModel) MoveDown()

MoveDown moves selection down

func (*SidebarModel) MoveUp

func (s *SidebarModel) MoveUp()

MoveUp moves selection up

func (*SidebarModel) SelectedSession

func (s *SidebarModel) SelectedSession() *SessionInfo

SelectedSession returns the currently selected session

func (*SidebarModel) SetFocused

func (s *SidebarModel) SetFocused(focused bool)

SetFocused sets focus state

func (*SidebarModel) SetSessions

func (s *SidebarModel) SetSessions(sessions []SessionInfo)

SetSessions sets the session list

func (*SidebarModel) SetSize

func (s *SidebarModel) SetSize(width, height int)

SetSize sets the sidebar dimensions

func (SidebarModel) View

func (s SidebarModel) View() string

View renders the sidebar

type SpinnerModel

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

SpinnerModel represents a loading spinner

func NewSpinnerModel

func NewSpinnerModel() SpinnerModel

NewSpinnerModel creates a new spinner model

func (SpinnerModel) IsActive

func (s SpinnerModel) IsActive() bool

IsActive returns whether the spinner is active

func (*SpinnerModel) Start

func (s *SpinnerModel) Start(text string) tea.Cmd

Start starts the spinner

func (*SpinnerModel) Stop

func (s *SpinnerModel) Stop()

Stop stops the spinner

func (*SpinnerModel) Update

func (s *SpinnerModel) Update(msg tea.Msg) tea.Cmd

Update updates the spinner

func (SpinnerModel) View

func (s SpinnerModel) View() string

View renders the spinner

type StatusBarModel

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

StatusBarModel represents the status bar

func NewStatusBarModel

func NewStatusBarModel() StatusBarModel

NewStatusBarModel creates a new status bar model

func (*StatusBarModel) SetModel

func (s *StatusBarModel) SetModel(model string)

SetModel sets the model name

func (*StatusBarModel) SetSessionID

func (s *StatusBarModel) SetSessionID(sessionID string)

SetSessionID sets the session ID

func (*StatusBarModel) SetTokens

func (s *StatusBarModel) SetTokens(input, output int)

SetTokens sets token counts

func (*StatusBarModel) SetWidth

func (s *StatusBarModel) SetWidth(width int)

SetWidth sets the status bar width

func (StatusBarModel) View

func (s StatusBarModel) View() string

View renders the status bar

type StepStatus

type StepStatus int

StepStatus represents the status of a thinking step

const (
	StepPending StepStatus = iota
	StepActive
	StepCompleted
	StepFailed
)

type ThinkingModel

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

ThinkingModel represents the thinking/processing indicator

func NewThinkingModel

func NewThinkingModel() ThinkingModel

NewThinkingModel creates a new thinking model

func (*ThinkingModel) AddStep

func (t *ThinkingModel) AddStep(label string)

AddStep adds a thinking step

func (*ThinkingModel) CompleteStep

func (t *ThinkingModel) CompleteStep()

CompleteStep completes the current step

func (*ThinkingModel) FailStep

func (t *ThinkingModel) FailStep()

FailStep marks the current step as failed

func (ThinkingModel) IsActive

func (t ThinkingModel) IsActive() bool

IsActive returns whether the thinking indicator is active

func (*ThinkingModel) SetMessage

func (t *ThinkingModel) SetMessage(message string)

SetMessage sets the thinking message

func (*ThinkingModel) SetWidth

func (t *ThinkingModel) SetWidth(width int)

SetWidth sets the width

func (*ThinkingModel) Start

func (t *ThinkingModel) Start(message string) tea.Cmd

Start starts the thinking indicator

func (*ThinkingModel) Stop

func (t *ThinkingModel) Stop()

Stop stops the thinking indicator

func (*ThinkingModel) Update

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

Update updates the thinking model

func (ThinkingModel) View

func (t ThinkingModel) View() string

View renders the thinking indicator

type ThinkingStep

type ThinkingStep struct {
	Label     string
	Status    StepStatus
	StartTime time.Time
	Duration  time.Duration
}

ThinkingStep represents a step in the thinking process

Jump to

Keyboard shortcuts

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