tui

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrevAgentKey = key.NewBinding(
		key.WithKeys("shift+left", "ctrl+p"),
		key.WithHelp("shift+"+glyphs.ArrowLeft+"/ctrl+p", "prev agent"),
	)
	NextAgentKey = key.NewBinding(
		key.WithKeys("shift+right", "ctrl+n"),
		key.WithHelp("shift+"+glyphs.ArrowRight+"/ctrl+n", "next agent"),
	)

	// Additional navigation keys for better UX
	FirstAgentKey = key.NewBinding(
		key.WithKeys("home", "ctrl+a"),
		key.WithHelp("home/ctrl+a", "first agent"),
	)
	LastAgentKey = key.NewBinding(
		key.WithKeys("end", "ctrl+e"),
		key.WithHelp("end/ctrl+e", "last agent"),
	)
)

Enhanced key bindings for cycling agents in the unified TUI model.

View Source
var (
	LightPalette = Palette{Background: "#FFFFFF", Foreground: "#000000"}
	DarkPalette  = Palette{Background: "#000000", Foreground: "#FFFFFF"}
)

Pre-defined palettes for light and dark modes.

View Source
var NoNavKeyMap = struct {
	CursorUp             key.Binding
	CursorDown           key.Binding
	PrevPage             key.Binding
	NextPage             key.Binding
	GoToStart            key.Binding
	GoToEnd              key.Binding
	Filter               key.Binding
	ClearFilter          key.Binding
	CancelWhileFiltering key.Binding
	AcceptWhileFiltering key.Binding
	ShowFullHelp         key.Binding
	CloseFullHelp        key.Binding
	Quit                 key.Binding
	ForceQuit            key.Binding
}{
	CursorUp:             key.NewBinding(),
	CursorDown:           key.NewBinding(),
	PrevPage:             key.NewBinding(),
	NextPage:             key.NewBinding(),
	GoToStart:            key.NewBinding(),
	GoToEnd:              key.NewBinding(),
	Filter:               key.NewBinding(),
	ClearFilter:          key.NewBinding(),
	CancelWhileFiltering: key.NewBinding(),
	AcceptWhileFiltering: key.NewBinding(),
	ShowFullHelp:         key.NewBinding(),
	CloseFullHelp:        key.NewBinding(),
	Quit:                 key.NewBinding(),
	ForceQuit:            key.NewBinding(),
}

NoNavKeyMap disables all navigation keys for the list.

Functions

This section is empty.

Types

type AgentInfo

type AgentInfo struct {
	Agent               *core.Agent
	History             string
	Status              AgentStatus
	LastContentType     ContentType // Track what type of content was last added
	PendingStatusUpdate string      // Track ongoing status update for progressive completion
	CurrentTool         string
	// TokenCount removed - use Agent.Cost.TotalTokens() for accurate token counts
	TokenHistory        []int
	ActivityData        []float64   // Activity level per second (0.0 to 1.0)
	ActivityTimes       []time.Time // Timestamp for each activity data point
	LastToken           time.Time
	LastActivity        time.Time
	CurrentActivity     int // Tokens processed in current second
	ModelName           string
	Scanner             *bufio.Scanner
	Cancel              context.CancelFunc
	Spinner             spinner.Model
	TokenProgress       progress.Model // Animated progress bar for token usage
	Name                string
	Role                string // Agent role for display (e.g., "System", "Research", "DevOps")
	TokensStarted       bool   // Flag to stop thinking animation when tokens start
	StreamingResponse   string // Current AI response being streamed (unformatted)
	StreamingTokenCount int    // Live token count during streaming (reconciled on completion)

	// Debug and trace fields
	DebugTrace             []DebugTraceEvent // Debug trace events
	CurrentStep            int               // Current step number
	DebugStreamingResponse string            // Debug streaming response
	// contains filtered or unexported fields
}

type AgentStatus

type AgentStatus int
const (
	StatusIdle AgentStatus = iota
	StatusRunning
	StatusError
	StatusStopped
)

type ContentType

type ContentType int

ContentType represents the type of content last added to history

const (
	ContentTypeEmpty ContentType = iota
	ContentTypeUserInput
	ContentTypeAIResponse
	ContentTypeStatusMessage
)

type DebugTraceEvent

type DebugTraceEvent struct {
	Timestamp time.Time
	Type      string
	Data      map[string]interface{}
	StepNum   int
	Details   string
}

type Diag

type Diag struct {
	File     string
	Line     int
	Col      int
	Code     string
	Severity string
	Message  string
}

Diag is a structured diagnostic entry for rendering

type Keybinds

type Keybinds struct {
	Quit        string `json:"quit"`
	ToggleTab   string `json:"toggleTab"`
	Submit      string `json:"submit"`
	NextPane    string `json:"nextPane"`
	PrevPane    string `json:"prevPane"`
	Pause       string `json:"pause"`
	Diagnostics string `json:"diagnostics"`
}

Keybinds define keyboard shortcuts for the TUI actions.

type Model

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

Model is the root TUI model.

func New

func New(ag *core.Agent) Model

New creates a new TUI model bound to an Agent.

func NewWithConfig

func NewWithConfig(ag *core.Agent, includePaths []string, configDir string) Model

NewWithConfig creates a new TUI model bound to an Agent with optional config.

func (*Model) Cleanup

func (m *Model) Cleanup()

Cleanup cancels all running agents and performs necessary cleanup. This should be called when the application is shutting down.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) RenderMarkdownIfNeeded

func (m Model) RenderMarkdownIfNeeded(content string, width int) string

renderMarkdownIfNeeded applies markdown rendering to AI responses

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Palette

type Palette struct {
	Background string `json:"background"`
	Foreground string `json:"foreground"`
}

Theme holds colour settings and keybinds. Palette defines a set of base colours for the UI panels.

type RobotFace

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

RobotFace represents our cute little robot companion

func NewRobotFace

func NewRobotFace() *RobotFace

NewRobotFace creates a new robot face

func (*RobotFace) GetFace

func (r *RobotFace) GetFace() string

GetFace returns the current face string based on state

func (*RobotFace) GetMoodText

func (r *RobotFace) GetMoodText() string

GetMoodText returns a cute status text based on the robot's state

func (*RobotFace) GetStyledFace

func (r *RobotFace) GetStyledFace() string

GetStyledFace returns the robot face with appropriate styling

func (*RobotFace) GetStyledMoodText

func (r *RobotFace) GetStyledMoodText() string

GetStyledMoodText returns the mood text with appropriate styling

func (*RobotFace) SetState

func (r *RobotFace) SetState(state RobotState)

SetState changes the robot's emotional state

func (*RobotFace) Update

func (r *RobotFace) Update()

Update advances the robot's animation state

type RobotState

type RobotState int

RobotState represents different emotional/activity states of the robot

const (
	RobotIdle RobotState = iota
	RobotActive
	RobotThinking
	RobotError
	RobotSleeping
	RobotBlinking
)

type Theme

type Theme struct {
	Mode         string  `json:"mode"`
	Palette      Palette `json:"palette"`
	UserBarColor string  `json:"userBarColor"`
	AIBarColor   string  `json:"aiBarColor"`

	IdleColor    string `json:"idleColor"`
	RunningColor string `json:"runningColor"`
	ErrorColor   string `json:"errorColor"`
	StoppedColor string `json:"stoppedColor"`

	// Advanced agent panel colors
	RoleColor       string `json:"roleColor"`
	ToolColor       string `json:"toolColor"`
	PanelTitleColor string `json:"panelTitleColor"`

	Keybinds Keybinds `json:"keybinds"`
}

Theme holds colour settings and keybinds. Mode selects which built-in palette to use ("light" or "dark").

func DefaultTheme

func DefaultTheme() Theme

DefaultTheme returns built‑in colours and keybindings.

func LoadTheme

func LoadTheme() Theme

LoadTheme loads theme.json from the current directory hierarchy or "$HOME/.config/agentry". Local files override global ones.

Jump to

Keyboard shortcuts

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