components

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package components provides TUI components

Package components provides TUI components

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAgentLine

func FormatAgentLine(theme *Theme, ag agent.Agent, width int) string

FormatAgentLine formats an agent for display

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration for display

func MiniStats

func MiniStats(theme *Theme, stats *session.Stats) string

MiniStats renders a compact one-line stats display

func RenderGrouped

func RenderGrouped(theme *Theme, groups []session.Group, width int) string

RenderGrouped renders agents in groups

func ShortHelp

func ShortHelp(theme *Theme) string

func StatusIndicator

func StatusIndicator(theme *Theme, status agent.Status) string

StatusIndicator returns a styled status indicator

Types

type AgentItem

type AgentItem struct {
	Agent      agent.Agent
	ChildCount int
}

func (AgentItem) Description

func (i AgentItem) Description() string

func (AgentItem) FilterValue

func (i AgentItem) FilterValue() string

func (AgentItem) Title

func (i AgentItem) Title() string

type AgentList

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

func NewAgentList

func NewAgentList(theme *Theme, manager *session.Manager, width, height int) *AgentList

func (*AgentList) FilterValue

func (a *AgentList) FilterValue() string

FilterValue returns the current filter value

func (*AgentList) GroupMode

func (a *AgentList) GroupMode() session.GroupMode

GroupMode returns the current group mode

func (*AgentList) Init

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

Init initializes the agent list

func (*AgentList) IsFocused

func (a *AgentList) IsFocused() bool

IsFocused returns the focus state

func (*AgentList) ParentAgent

func (a *AgentList) ParentAgent() agent.Agent

func (*AgentList) Selected

func (a *AgentList) Selected() agent.Agent

Selected returns the currently selected agent

func (*AgentList) SetFocused

func (a *AgentList) SetFocused(focused bool)

SetFocused sets the focus state

func (*AgentList) SetGroupMode

func (a *AgentList) SetGroupMode(mode session.GroupMode)

func (*AgentList) SetSelected

func (a *AgentList) SetSelected(id string)

SetSelected sets the selected agent by ID

func (*AgentList) SetSize

func (a *AgentList) SetSize(width, height int)

SetSize sets the component size

func (*AgentList) Update

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

func (*AgentList) View

func (a *AgentList) View() string

func (*AgentList) ViewMode

func (a *AgentList) ViewMode() ViewMode

type AgentListKeyMap

type AgentListKeyMap struct {
	Up           key.Binding
	Down         key.Binding
	Select       key.Binding
	ToggleGroup  key.Binding
	Terminate    key.Binding
	Pause        key.Binding
	Filter       key.Binding
	ClearFilter  key.Binding
	ViewChildren key.Binding
	GoBack       key.Binding
}

func DefaultAgentListKeyMap

func DefaultAgentListKeyMap() AgentListKeyMap

type AgentListRefreshMsg

type AgentListRefreshMsg struct{}

AgentListRefreshMsg triggers a refresh

type AgentSelectedMsg

type AgentSelectedMsg struct {
	Agent agent.Agent
}

AgentSelectedMsg is sent when an agent is selected

type AlertRefreshMsg

type AlertRefreshMsg struct{}

AlertRefreshMsg triggers a refresh

type AlertsPanel

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

AlertsPanel displays alerts and notifications

func NewAlertsPanel

func NewAlertsPanel(theme *Theme, alertMgr *alert.Manager, width, height int) *AlertsPanel

NewAlertsPanel creates a new alerts panel

func (*AlertsPanel) Init

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

Init initializes the alerts panel

func (*AlertsPanel) IsFocused

func (a *AlertsPanel) IsFocused() bool

IsFocused returns the focus state

func (*AlertsPanel) SetFocused

func (a *AlertsPanel) SetFocused(focused bool)

SetFocused sets the focus state

func (*AlertsPanel) SetSize

func (a *AlertsPanel) SetSize(width, height int)

SetSize sets the component size

func (*AlertsPanel) UnreadCount

func (a *AlertsPanel) UnreadCount() int

UnreadCount returns the number of unread alerts

func (*AlertsPanel) Update

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

Update handles messages

func (*AlertsPanel) View

func (a *AlertsPanel) View() string

View renders the alerts panel

type Command

type Command struct {
	Name        string
	Description string
	Keys        string
	Action      func() tea.Msg
}

Command represents a command palette command

func DefaultCommands

func DefaultCommands() []Command

DefaultCommands returns the default command set

type CommandPalette

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

CommandPalette is a fuzzy command palette

func NewCommandPalette

func NewCommandPalette(theme *Theme, commands []Command) *CommandPalette

NewCommandPalette creates a new command palette

func (*CommandPalette) AddCommand

func (c *CommandPalette) AddCommand(cmd Command)

AddCommand adds a command

func (*CommandPalette) Hide

func (c *CommandPalette) Hide()

Hide hides the command palette

func (*CommandPalette) Init

func (c *CommandPalette) Init() tea.Cmd

Init initializes the command palette

func (*CommandPalette) IsVisible

func (c *CommandPalette) IsVisible() bool

IsVisible returns whether the palette is visible

func (*CommandPalette) SetCommands

func (c *CommandPalette) SetCommands(commands []Command)

SetCommands sets the available commands

func (*CommandPalette) SetSize

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

SetSize sets the component size

func (*CommandPalette) Show

func (c *CommandPalette) Show() tea.Cmd

Show shows the command palette

func (*CommandPalette) Update

func (c *CommandPalette) Update(msg tea.Msg) (*CommandPalette, tea.Cmd)

Update handles messages

func (*CommandPalette) View

func (c *CommandPalette) View() string

View renders the command palette

type Filter

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

func NewFilter

func NewFilter() Filter

func (Filter) Apply

func (f Filter) Apply(agents []agent.Agent) []agent.Agent

func (Filter) HelpText

func (f Filter) HelpText() string

func (Filter) Init

func (f Filter) Init() tea.Cmd

func (Filter) IsActive

func (f Filter) IsActive() bool

func (Filter) IsSearchActive

func (f Filter) IsSearchActive() bool

func (Filter) SearchQuery

func (f Filter) SearchQuery() string

func (*Filter) SetCounts

func (f *Filter) SetCounts(filtered, total int)

func (Filter) StatusFilter

func (f Filter) StatusFilter() agent.Status

func (Filter) Update

func (f Filter) Update(msg tea.Msg) (Filter, tea.Cmd)

func (Filter) View

func (f Filter) View() string

type FilterMode

type FilterMode int
const (
	FilterModeNone FilterMode = iota
	FilterModeSearch
	FilterModeStatus
)

type HelpScreen

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

HelpScreen displays keybindings and help information

func NewHelpScreen

func NewHelpScreen(theme *Theme) *HelpScreen

NewHelpScreen creates a new help screen

func (*HelpScreen) Hide

func (h *HelpScreen) Hide()

Hide hides the help screen

func (*HelpScreen) Init

func (h *HelpScreen) Init() tea.Cmd

Init initializes the help screen

func (*HelpScreen) IsVisible

func (h *HelpScreen) IsVisible() bool

IsVisible returns whether the help screen is visible

func (*HelpScreen) SetSize

func (h *HelpScreen) SetSize(width, height int)

SetSize sets the component size

func (*HelpScreen) Show

func (h *HelpScreen) Show()

Show shows the help screen

func (*HelpScreen) Toggle

func (h *HelpScreen) Toggle()

Toggle toggles the help screen

func (*HelpScreen) Update

func (h *HelpScreen) Update(msg tea.Msg) (*HelpScreen, tea.Cmd)

Update handles messages

func (*HelpScreen) View

func (h *HelpScreen) View() string

View renders the help screen

type InputBar

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

InputBar is a text input component

func NewInputBar

func NewInputBar(theme *Theme, width int) *InputBar

NewInputBar creates a new input bar

func (*InputBar) Blur

func (i *InputBar) Blur()

Blur unfocuses the input

func (*InputBar) Focus

func (i *InputBar) Focus() tea.Cmd

Focus focuses the input

func (*InputBar) Init

func (i *InputBar) Init() tea.Cmd

Init initializes the input bar

func (*InputBar) IsActive

func (i *InputBar) IsActive() bool

IsActive returns whether the input is active

func (*InputBar) OnSubmit

func (i *InputBar) OnSubmit(fn func(string))

OnSubmit sets the submit callback

func (*InputBar) SetPlaceholder

func (i *InputBar) SetPlaceholder(placeholder string)

SetPlaceholder sets the placeholder text

func (*InputBar) SetValue

func (i *InputBar) SetValue(value string)

SetValue sets the input value

func (*InputBar) SetWidth

func (i *InputBar) SetWidth(width int)

SetWidth sets the input width

func (*InputBar) Update

func (i *InputBar) Update(msg tea.Msg) (*InputBar, tea.Cmd)

Update handles messages

func (*InputBar) Value

func (i *InputBar) Value() string

Value returns the current input value

func (*InputBar) View

func (i *InputBar) View() string

View renders the input bar

type InputSubmitMsg

type InputSubmitMsg struct {
	Value string
}

InputSubmitMsg is sent when input is submitted

type RefreshMsg

type RefreshMsg struct{}

type SessionViewport

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

SessionViewport displays agent session output

func NewSessionViewport

func NewSessionViewport(theme *Theme, width, height int) *SessionViewport

NewSessionViewport creates a new session viewport

func (*SessionViewport) Agent

func (s *SessionViewport) Agent() agent.Agent

Agent returns the current agent

func (*SessionViewport) Init

func (s *SessionViewport) Init() tea.Cmd

Init initializes the viewport

func (*SessionViewport) IsFocused

func (s *SessionViewport) IsFocused() bool

IsFocused returns the focus state

func (*SessionViewport) ScrollToBottom

func (s *SessionViewport) ScrollToBottom()

ScrollToBottom scrolls to the bottom

func (*SessionViewport) ScrollToTop

func (s *SessionViewport) ScrollToTop()

ScrollToTop scrolls to the top

func (*SessionViewport) SetAgent

func (s *SessionViewport) SetAgent(ag agent.Agent)

SetAgent sets the agent to display

func (*SessionViewport) SetAutoScroll

func (s *SessionViewport) SetAutoScroll(enabled bool)

SetAutoScroll sets the auto-scroll state

func (*SessionViewport) SetFocused

func (s *SessionViewport) SetFocused(focused bool)

SetFocused sets the focus state

func (*SessionViewport) SetSize

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

SetSize sets the component size

func (*SessionViewport) Update

func (s *SessionViewport) Update(msg tea.Msg) (*SessionViewport, tea.Cmd)

Update handles messages

func (*SessionViewport) View

func (s *SessionViewport) View() string

View renders the viewport

type ShowHelpMsg

type ShowHelpMsg struct{}

Command message types

type SpawnDialog

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

func NewSpawnDialog

func NewSpawnDialog() SpawnDialog

func (SpawnDialog) Init

func (d SpawnDialog) Init() tea.Cmd

func (SpawnDialog) IsCancelled

func (d SpawnDialog) IsCancelled() bool

func (SpawnDialog) IsComplete

func (d SpawnDialog) IsComplete() bool

func (SpawnDialog) Result

func (d SpawnDialog) Result() SpawnResult

func (SpawnDialog) Update

func (d SpawnDialog) Update(msg tea.Msg) (SpawnDialog, tea.Cmd)

func (SpawnDialog) View

func (d SpawnDialog) View() string

type SpawnResult

type SpawnResult struct {
	Config    agent.SpawnConfig
	Cancelled bool
}

type SpawnState

type SpawnState int
const (
	SpawnStateDirectory SpawnState = iota
	SpawnStateName
	SpawnStateConfirm
)

type StartInputMsg

type StartInputMsg struct{}

type StartSearchMsg

type StartSearchMsg struct{}

type StatsPanel

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

StatsPanel displays aggregate statistics

func NewStatsPanel

func NewStatsPanel(theme *Theme, manager *session.Manager, width, height int) *StatsPanel

NewStatsPanel creates a new stats panel

func (*StatsPanel) Init

func (s *StatsPanel) Init() tea.Cmd

Init initializes the stats panel

func (*StatsPanel) IsFocused

func (s *StatsPanel) IsFocused() bool

IsFocused returns the focus state

func (*StatsPanel) SetFocused

func (s *StatsPanel) SetFocused(focused bool)

SetFocused sets the focus state

func (*StatsPanel) SetSize

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

SetSize sets the component size

func (*StatsPanel) Update

func (s *StatsPanel) Update(msg tea.Msg) (*StatsPanel, tea.Cmd)

Update handles messages

func (*StatsPanel) View

func (s *StatsPanel) View() string

View renders the stats panel

type TerminateAgentMsg

type TerminateAgentMsg struct{}

type Theme

type Theme struct {
	// Colors
	Primary       lipgloss.Color
	Secondary     lipgloss.Color
	Accent        lipgloss.Color
	Background    lipgloss.Color
	Foreground    lipgloss.Color
	Border        lipgloss.Color
	BorderFocused lipgloss.Color
	StatusRunning lipgloss.Color
	StatusIdle    lipgloss.Color
	StatusError   lipgloss.Color
	StatusDone    lipgloss.Color

	// Base styles
	Base        lipgloss.Style
	Title       lipgloss.Style
	Subtitle    lipgloss.Style
	Header      lipgloss.Style
	Footer      lipgloss.Style
	BorderStyle lipgloss.Style

	// Component styles
	AgentListStyle    lipgloss.Style
	ViewportStyle     lipgloss.Style
	StatsStyle        lipgloss.Style
	AlertsStyle       lipgloss.Style
	InputStyle        lipgloss.Style
	CommandStyle      lipgloss.Style
	HelpStyle         lipgloss.Style
	SelectedItemStyle lipgloss.Style
	NormalItemStyle   lipgloss.Style

	// Status styles
	StatusStyles map[agent.Status]lipgloss.Style
}

Theme holds all the styles for the TUI

func DefaultDarkTheme

func DefaultDarkTheme() *Theme

DefaultDarkTheme returns the default dark theme

func DefaultLightTheme

func DefaultLightTheme() *Theme

DefaultLightTheme returns the default light theme

func NewTheme

func NewTheme(cfg *config.ThemeConfig) *Theme

NewTheme creates a new theme from config

func (*Theme) FocusedBorder

func (t *Theme) FocusedBorder(base lipgloss.Style) lipgloss.Style

FocusedBorder returns a style with focused border

func (*Theme) StatusStyle

func (t *Theme) StatusStyle(status agent.Status) lipgloss.Style

StatusStyle returns the style for a status

type ToggleAlertsMsg

type ToggleAlertsMsg struct{}

type ToggleGroupingMsg

type ToggleGroupingMsg struct{}

type ToggleStatsMsg

type ToggleStatsMsg struct{}

type ViewMode

type ViewMode string
const (
	ViewModePrimary  ViewMode = "primary"
	ViewModeChildren ViewMode = "children"
)

type ViewportRefreshMsg

type ViewportRefreshMsg struct{}

ViewportRefreshMsg triggers a content refresh

Jump to

Keyboard shortcuts

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