tui

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AgentNames = []string{"Build", "Audit", "Stats"}
View Source
var Themes = []Theme{
	{
		Name:       "default",
		Accent:     "#7D56F4",
		AccentDim:  "#5E40BF",
		Text:       "#FFFFFF",
		TextDim:    "#808080",
		Background: "#1E1E2E",
		Border:     "#7D56F4",
		Success:    "#50FA7B",
		Warn:       "#F1FA8C",
		Error:      "#FF5555",
	},
	{
		Name:       "Dracula",
		Accent:     "#FF79C6",
		AccentDim:  "#BD93F9",
		Text:       "#F8F8F2",
		TextDim:    "#6272A4",
		Background: "#282A36",
		Border:     "#FF79C6",
		Success:    "#50FA7B",
		Warn:       "#F1FA8C",
		Error:      "#FF5555",
	},
	{
		Name:       "Nord",
		Accent:     "#88C0D0",
		AccentDim:  "#5E81AC",
		Text:       "#ECEFF4",
		TextDim:    "#4C566A",
		Background: "#2E3440",
		Border:     "#88C0D0",
		Success:    "#A3BE8C",
		Warn:       "#EBCB8B",
		Error:      "#BF616A",
	},
	{
		Name:       "Solarized",
		Accent:     "#B58900",
		AccentDim:  "#CB4B16",
		Text:       "#FDF6E3",
		TextDim:    "#93A1A1",
		Background: "#002B36",
		Border:     "#B58900",
		Success:    "#859900",
		Warn:       "#B58900",
		Error:      "#DC322F",
	},
	{
		Name:       "Monokai",
		Accent:     "#A6E22E",
		AccentDim:  "#66D9EF",
		Text:       "#F8F8F2",
		TextDim:    "#75715E",
		Background: "#272822",
		Border:     "#A6E22E",
		Success:    "#A6E22E",
		Warn:       "#E6DB74",
		Error:      "#F92672",
	},
}

Functions

func ComposeLayout

func ComposeLayout(tabs Tabs, sidebar Sidebar, view ViewKind, content string, right string, footer Footer, styles Styles, width, height int) string

func RenderCommandPalette

func RenderCommandPalette(items []string, sel int, query string, styles Styles, width, height int) string

func RenderConfigView

func RenderConfigView(entries []ConfigEntry, selected int, styles Styles, width, height int) string

func RenderEFMView

func RenderEFMView(stacks []EFMStack, styles Styles, width, height int, spinner Spinner) string

func RenderHistoryView

func RenderHistoryView(entries []HistoryEntry, selected int, styles Styles, width, height int) string

func RenderRightPanel

func RenderRightPanel(sel *ToolSubItem, view ViewKind, styles Styles, width, height int) string

func RenderSessionsView

func RenderSessionsView(styles Styles, tabs Tabs, width, height int) string

func RenderSubagentsPopup

func RenderSubagentsPopup(styles Styles, width, height int) string

func RenderToolsView

func RenderToolsView(sidebar Sidebar, styles Styles, width, height int) string

Types

type AgentCycleMsg

type AgentCycleMsg struct {
	Index int
}

type ArgInputState

type ArgInputState struct {
	Open  bool
	Cmd   string
	Value string
	Input textinput.Model
}

type ConfigEntry

type ConfigEntry struct {
	Key   string
	Value string
	Hint  string
	Kind  string
}

func DefaultConfigEntries

func DefaultConfigEntries() []ConfigEntry

type EFMRefreshMsg

type EFMRefreshMsg struct {
	Stacks []EFMStack
}

type EFMStack

type EFMStack struct {
	Name      string
	Status    string
	URL       string
	CreatedAt time.Time
	TTL       int
}
type Footer struct {
	Selection  string
	AgentIndex int
	Tokens     int
	TokensPct  float64
	Cost       string
	Width      int
	ShowHints  bool
	HintKeys   []HintPair
	Loading    bool
	Spinner    Spinner
	// contains filtered or unexported fields
}

func NewFooter

func NewFooter(width int) Footer

func (*Footer) AgentName

func (f *Footer) AgentName() string

func (*Footer) CycleAgent

func (f *Footer) CycleAgent()

func (Footer) ProgressBar

func (f Footer) ProgressBar(width int) string

func (Footer) Render

func (f Footer) Render(styles Styles) string

func (*Footer) SetView

func (f *Footer) SetView(v ViewKind)

func (*Footer) View

func (f *Footer) View() ViewKind

type HintPair

type HintPair struct {
	Key   string
	Label string
}

func DefaultHints

func DefaultHints(view ViewKind) []HintPair

type HistoryAppendMsg

type HistoryAppendMsg struct {
	Entry HistoryEntry
}

type HistoryEntry

type HistoryEntry struct {
	Time    time.Time
	View    string
	Action  string
	Detail  string
	Success bool
}

type InterruptMsg

type InterruptMsg struct{}

type Mode

type Mode int
const (
	ModeNormal Mode = iota
	ModePalette
	ModeSubagents
	ModeArgInput
)

type Model

type Model struct {
	Width    int
	Height   int
	ThemeIdx int
	ViewKind ViewKind
	Mode     Mode
	Quitting bool
	Ready    bool
	Loading  bool

	Tabs       Tabs
	Sidebar    Sidebar
	Footer     Footer
	Spinner    Spinner
	Styles     Styles
	RightPanel bool

	Palette   PaletteState
	ArgInput  ArgInputState
	History   []HistoryEntry
	EFMStks   []EFMStack
	Config    []ConfigEntry
	ConfigSel int

	ToolList  list.Model
	ToolItems []list.Item

	OnRun func(name string, args []string) error
}

func NewModel

func NewModel() *Model

func (*Model) AppendHistory

func (m *Model) AppendHistory(view, action, detail string, ok bool)

func (*Model) ApplyTheme

func (m *Model) ApplyTheme()

func (*Model) CloseArgInput

func (m *Model) CloseArgInput()

func (*Model) ClosePalette

func (m *Model) ClosePalette()

func (*Model) CloseSubagents

func (m *Model) CloseSubagents()

func (*Model) CycleTheme

func (m *Model) CycleTheme()

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) NextView

func (m *Model) NextView()

func (*Model) OpenArgInput

func (m *Model) OpenArgInput(cmd string)

func (*Model) OpenPalette

func (m *Model) OpenPalette()

func (*Model) OpenSubagents

func (m *Model) OpenSubagents()

func (*Model) PrevView

func (m *Model) PrevView()

func (*Model) PreviousView

func (m *Model) PreviousView()

func (*Model) RunSelected

func (m *Model) RunSelected()

func (*Model) SwitchView

func (m *Model) SwitchView(v ViewKind)

func (*Model) Update

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

func (*Model) View

func (m *Model) View() string

type PaletteOpenMsg

type PaletteOpenMsg struct {
	Open bool
}

type PaletteState

type PaletteState struct {
	Open   bool
	Query  string
	Items  []string
	Filter []string
	Sel    int
}

type Session

type Session struct {
	Name   string
	Active bool
	Dirty  bool
}

type SessionAddMsg

type SessionAddMsg struct {
	Name string
}

type SessionCloseMsg

type SessionCloseMsg struct {
	Index int
}

type SessionSelectMsg

type SessionSelectMsg struct {
	Index int
}
type Sidebar struct {
	Items        []SidebarItem
	Selected     int
	Width        int
	Collapsed    bool
	ToolSubItems []ToolSubItem
	ToolSel      int
}

func NewSidebar

func NewSidebar() Sidebar

func (*Sidebar) MoveDown

func (s *Sidebar) MoveDown()

func (*Sidebar) MoveUp

func (s *Sidebar) MoveUp()

func (*Sidebar) SelectedTool

func (s *Sidebar) SelectedTool() *ToolSubItem

func (*Sidebar) SelectedView

func (s *Sidebar) SelectedView() ViewKind

func (*Sidebar) SetSelectedView

func (s *Sidebar) SetSelectedView(v ViewKind)

func (*Sidebar) Toggle

func (s *Sidebar) Toggle()

func (*Sidebar) ToolMoveDown

func (s *Sidebar) ToolMoveDown()

func (*Sidebar) ToolMoveUp

func (s *Sidebar) ToolMoveUp()

func (Sidebar) View

func (s Sidebar) View(styles Styles) string

type SidebarItem

type SidebarItem struct {
	View     ViewKind
	Icon     string
	Label    string
	Shortcut string
}

func DefaultSidebarItems

func DefaultSidebarItems() []SidebarItem

type SidebarToggleMsg

type SidebarToggleMsg struct{}

type Spinner

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

func NewSpinner

func NewSpinner() Spinner

func (Spinner) Frame

func (s Spinner) Frame() int

func (Spinner) Init

func (s Spinner) Init() tea.Cmd

func (Spinner) Update

func (s Spinner) Update(msg tea.Msg) (Spinner, tea.Cmd)

func (Spinner) View

func (s Spinner) View(style lipgloss.Style) string

func (Spinner) ViewPlain

func (s Spinner) ViewPlain() string

type SpinnerTickMsg

type SpinnerTickMsg time.Time

type Styles

type Styles struct {
	Theme Theme

	Header     lipgloss.Style
	TabActive  lipgloss.Style
	TabIdle    lipgloss.Style
	TabAdd     lipgloss.Style
	Sidebar    lipgloss.Style
	SidebarSel lipgloss.Style
	SidebarHdr lipgloss.Style
	Content    lipgloss.Style
	ContentHdr lipgloss.Style
	Footer     lipgloss.Style
	FooterKey  lipgloss.Style
	FooterVal  lipgloss.Style
	Popup      lipgloss.Style
	PopupItem  lipgloss.Style
	PopupSel   lipgloss.Style
	Spinner    lipgloss.Style
	Progress   lipgloss.Style
	StatusOK   lipgloss.Style
	StatusWarn lipgloss.Style
	StatusErr  lipgloss.Style
	Hint       lipgloss.Style
	AccentText lipgloss.Style
	Bold       lipgloss.Style
	Muted      lipgloss.Style
}

func NewStyles

func NewStyles(theme Theme) Styles

func (Styles) Accent

func (s Styles) Accent() lipgloss.TerminalColor

func (Styles) BorderColor

func (s Styles) BorderColor() lipgloss.TerminalColor

func (Styles) Text

func (s Styles) Text() lipgloss.TerminalColor

func (Styles) TextDim

func (s Styles) TextDim() lipgloss.TerminalColor

type SubagentsOpenMsg

type SubagentsOpenMsg struct {
	Open bool
}

type Tabs

type Tabs struct {
	Sessions   []Session
	ActiveIdx  int
	MaxVisible int
	Width      int
}

func NewTabs

func NewTabs() Tabs

func (Tabs) Active

func (t Tabs) Active() Session

func (*Tabs) Add

func (t *Tabs) Add(name string)

func (*Tabs) Close

func (t *Tabs) Close(idx int)

func (*Tabs) Next

func (t *Tabs) Next()

func (*Tabs) Prev

func (t *Tabs) Prev()

func (*Tabs) Select

func (t *Tabs) Select(idx int)

func (Tabs) View

func (t Tabs) View(s Styles) string

type Theme

type Theme struct {
	Name       string
	Accent     string
	AccentDim  string
	Text       string
	TextDim    string
	Background string
	Border     string
	Success    string
	Warn       string
	Error      string
}

type ThemeChangedMsg

type ThemeChangedMsg struct {
	Index int
}

type ToolRunMsg

type ToolRunMsg struct {
	Name string
	Args []string
}

type ToolSubItem

type ToolSubItem struct {
	Name        string
	Description string
	Runnable    bool
}

func DefaultToolSubItems

func DefaultToolSubItems() []ToolSubItem

type ViewKind

type ViewKind int
const (
	ViewTools ViewKind = iota
	ViewSessions
	ViewEFM
	ViewConfig
	ViewHistory
)

func (ViewKind) Short

func (v ViewKind) Short() string

func (ViewKind) String

func (v ViewKind) String() string

type ViewSwitchMsg

type ViewSwitchMsg struct {
	View ViewKind
}

Jump to

Keyboard shortcuts

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