tui

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxCommandLines is the default number of lines to show when collapsed
	DefaultMaxCommandLines = 20
)
View Source
const (
	// DefaultMaxVisibleLines is the default number of lines to show when collapsed
	DefaultMaxVisibleLines = 20
)

Variables

View Source
var DarkTheme = Theme{
	Muted:     lipgloss.Color("#6B7280"),
	Accent:    lipgloss.Color("#F59E0B"),
	Primary:   lipgloss.Color("#60A5FA"),
	AI:        lipgloss.Color("#A78BFA"),
	Separator: lipgloss.Color("#4B5563"),

	Text:         lipgloss.Color("#D1D5DB"),
	TextDim:      lipgloss.Color("#9CA3AF"),
	TextBright:   lipgloss.Color("#FFFFFF"),
	TextDisabled: lipgloss.Color("#4B5563"),

	Success: lipgloss.Color("#10B981"),
	Error:   lipgloss.Color("#EF4444"),
	Warning: lipgloss.Color("#FBBF24"),

	SuccessBg: lipgloss.Color("#1a2e1a"),
	ErrorBg:   lipgloss.Color("#2e1a1a"),

	Border:     lipgloss.Color("#374151"),
	Background: lipgloss.Color("#1F2937"),
}

DarkTheme is the color palette for dark terminals

View Source
var LightTheme = Theme{
	Muted:     lipgloss.Color("#6B7280"),
	Accent:    lipgloss.Color("#D97706"),
	Primary:   lipgloss.Color("#2563EB"),
	AI:        lipgloss.Color("#7C3AED"),
	Separator: lipgloss.Color("#D1D5DB"),

	Text:         lipgloss.Color("#1F2937"),
	TextDim:      lipgloss.Color("#4B5563"),
	TextBright:   lipgloss.Color("#111827"),
	TextDisabled: lipgloss.Color("#9CA3AF"),

	Success: lipgloss.Color("#059669"),
	Error:   lipgloss.Color("#DC2626"),
	Warning: lipgloss.Color("#B45309"),

	SuccessBg: lipgloss.Color("#dafbe1"),
	ErrorBg:   lipgloss.Color("#ffebe9"),

	Border:     lipgloss.Color("#E5E7EB"),
	Background: lipgloss.Color("#F3F4F6"),
}

LightTheme is the color palette for light terminals

Functions

func ExecuteCommand

func ExecuteCommand(ctx context.Context, m *model, input string) (string, bool)

ExecuteCommand executes a slash command

func GetTaskProgressChan added in v1.2.0

func GetTaskProgressChan() chan string

GetTaskProgressChan returns the global task progress channel

func IsDarkBackground added in v1.1.0

func IsDarkBackground() bool

IsDarkBackground returns whether the terminal has a dark background

func IsSkillCommand added in v1.1.0

func IsSkillCommand(cmd string) (*skill.Skill, bool)

IsSkillCommand checks if the command is a registered skill. Returns the skill and true if found, nil and false otherwise.

func ParseCommand

func ParseCommand(input string) (cmd string, args string, isCmd bool)

ParseCommand parses input and returns command name and args if it's a slash command

func Run

func Run() error

func RunWithContinue added in v1.3.0

func RunWithContinue() error

RunWithContinue runs TUI and resumes the most recent session

func RunWithPlanMode added in v1.1.0

func RunWithPlanMode(task string) error

func RunWithResume added in v1.3.0

func RunWithResume() error

RunWithResume runs TUI with the session selector to choose a session to resume

func SendTaskProgress added in v1.2.0

func SendTaskProgress(msg string)

SendTaskProgress sends a progress message (non-blocking)

Types

type AgentItem added in v1.2.0

type AgentItem struct {
	Name           string
	Description    string
	Model          string // inherit/sonnet/opus/haiku
	PermissionMode string // default/acceptEdits/dontAsk/plan
	Tools          string // Tool list as string
	IsCustom       bool   // Whether this is a custom agent
	Enabled        bool   // Current enabled state
}

AgentItem represents an agent in the selector

type AgentPreview added in v1.2.0

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

AgentPreview renders a preview of agent metadata for permission prompts

func NewAgentPreview added in v1.2.0

func NewAgentPreview(meta *permission.AgentMetadata) *AgentPreview

NewAgentPreview creates a new AgentPreview instance

func (*AgentPreview) Render added in v1.2.0

func (p *AgentPreview) Render(width int) string

Render renders the agent preview

type AgentSaveLevel added in v1.2.0

type AgentSaveLevel int

AgentSaveLevel represents where to save agent settings

const (
	AgentSaveLevelProject AgentSaveLevel = iota // Save to .gen/agents.json
	AgentSaveLevelUser                          // Save to ~/.gen/agents.json
)

func (AgentSaveLevel) String added in v1.2.0

func (l AgentSaveLevel) String() string

String returns the display name for the save level

type AgentSelectorCancelledMsg added in v1.2.0

type AgentSelectorCancelledMsg struct{}

AgentSelectorCancelledMsg is sent when the agent selector is cancelled

type AgentSelectorState added in v1.2.0

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

AgentSelectorState holds state for the agent selector

func NewAgentSelectorState added in v1.2.0

func NewAgentSelectorState() AgentSelectorState

NewAgentSelectorState creates a new AgentSelectorState

func (*AgentSelectorState) Cancel added in v1.2.0

func (s *AgentSelectorState) Cancel()

Cancel cancels the selector

func (*AgentSelectorState) EnterAgentSelect added in v1.2.0

func (s *AgentSelectorState) EnterAgentSelect(width, height int) error

EnterAgentSelect enters agent selection mode

func (*AgentSelectorState) HandleKeypress added in v1.2.0

func (s *AgentSelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if needed

func (*AgentSelectorState) IsActive added in v1.2.0

func (s *AgentSelectorState) IsActive() bool

IsActive returns whether the selector is active

func (*AgentSelectorState) MoveDown added in v1.2.0

func (s *AgentSelectorState) MoveDown()

MoveDown moves the selection down

func (*AgentSelectorState) MoveUp added in v1.2.0

func (s *AgentSelectorState) MoveUp()

MoveUp moves the selection up

func (*AgentSelectorState) Render added in v1.2.0

func (s *AgentSelectorState) Render() string

Render renders the agent selector

func (*AgentSelectorState) Toggle added in v1.2.0

func (s *AgentSelectorState) Toggle() tea.Cmd

Toggle toggles the enabled state of the currently selected agent

type AgentToggleMsg added in v1.2.0

type AgentToggleMsg struct {
	AgentName string
	Enabled   bool
}

AgentToggleMsg is sent when an agent's enabled state is toggled

type AuthMethodItem

type AuthMethodItem struct {
	Provider    provider.Provider
	AuthMethod  provider.AuthMethod
	DisplayName string
	Status      provider.ProviderStatus
	EnvVars     []string
}

AuthMethodItem represents an auth method in the second level

type BashPreview

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

BashPreview renders a bash command preview with expand/collapse functionality

func NewBashPreview

func NewBashPreview(meta *permission.BashMetadata) *BashPreview

NewBashPreview creates a new BashPreview instance

func (*BashPreview) IsExpanded

func (b *BashPreview) IsExpanded() bool

IsExpanded returns whether the preview is expanded

func (*BashPreview) NeedsExpand

func (b *BashPreview) NeedsExpand() bool

NeedsExpand returns true if the command has more lines than the default visible count

func (*BashPreview) Render

func (b *BashPreview) Render(width int) string

Render renders the bash command preview with simplified format (3-space indent, no line numbers)

func (*BashPreview) SetMaxVisible

func (b *BashPreview) SetMaxVisible(n int)

SetMaxVisible sets the maximum visible lines when collapsed

func (*BashPreview) ToggleExpand

func (b *BashPreview) ToggleExpand()

ToggleExpand toggles between expanded and collapsed view

type Command

type Command struct {
	Name        string
	Description string
	Handler     CommandHandler
}

Command represents a slash command

func GetMatchingCommands

func GetMatchingCommands(query string) []Command

GetMatchingCommands returns commands matching the query using fuzzy search

func GetSkillCommands added in v1.1.0

func GetSkillCommands() []Command

GetSkillCommands returns skill commands for command suggestions. Skill names use the format namespace:name (e.g., git:commit).

type CommandHandler

type CommandHandler func(ctx context.Context, m *model, args string) (string, error)

CommandHandler is a function that handles a slash command

type CompactResultMsg added in v1.3.0

type CompactResultMsg struct {
	Summary       string
	OriginalCount int
	Error         error
}

CompactResultMsg is sent when conversation compaction completes

type DiffPreview

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

DiffPreview renders a diff preview with expand/collapse functionality

func NewDiffPreview

func NewDiffPreview(diffMeta *permission.DiffMetadata, filePath string) *DiffPreview

NewDiffPreview creates a new DiffPreview instance

func (*DiffPreview) IsExpanded

func (d *DiffPreview) IsExpanded() bool

IsExpanded returns whether the preview is expanded

func (*DiffPreview) Render

func (d *DiffPreview) Render(width int) string

Render renders the diff preview

func (*DiffPreview) SetMaxVisible

func (d *DiffPreview) SetMaxVisible(n int)

SetMaxVisible sets the maximum visible lines when collapsed

func (*DiffPreview) ToggleExpand

func (d *DiffPreview) ToggleExpand()

ToggleExpand toggles between expanded and collapsed view

type EditorFinishedMsg added in v1.3.0

type EditorFinishedMsg struct {
	Err error
}

EditorFinishedMsg is sent when an external editor process completes

type EnterPlanPrompt added in v1.1.0

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

EnterPlanPrompt manages the enter plan mode confirmation UI

func NewEnterPlanPrompt added in v1.1.0

func NewEnterPlanPrompt() *EnterPlanPrompt

NewEnterPlanPrompt creates a new EnterPlanPrompt

func (*EnterPlanPrompt) GetRequest added in v1.1.0

func (p *EnterPlanPrompt) GetRequest() *tool.EnterPlanRequest

GetRequest returns the current request

func (*EnterPlanPrompt) HandleKeypress added in v1.1.0

func (p *EnterPlanPrompt) HandleKeypress(msg tea.KeyMsg) tea.Cmd

HandleKeypress handles keyboard input

func (*EnterPlanPrompt) Hide added in v1.1.0

func (p *EnterPlanPrompt) Hide()

Hide hides the prompt

func (*EnterPlanPrompt) IsActive added in v1.1.0

func (p *EnterPlanPrompt) IsActive() bool

IsActive returns whether the prompt is visible

func (*EnterPlanPrompt) Render added in v1.1.0

func (p *EnterPlanPrompt) Render() string

Render renders the prompt

func (*EnterPlanPrompt) SetWidth added in v1.1.0

func (p *EnterPlanPrompt) SetWidth(width int)

SetWidth updates the prompt width

func (*EnterPlanPrompt) Show added in v1.1.0

func (p *EnterPlanPrompt) Show(req *tool.EnterPlanRequest, width int)

Show displays the enter plan prompt

type EnterPlanRequestMsg added in v1.1.0

type EnterPlanRequestMsg struct {
	Request *tool.EnterPlanRequest
}

EnterPlanRequestMsg is sent when EnterPlanMode tool is called

type EnterPlanResponseMsg added in v1.1.0

type EnterPlanResponseMsg struct {
	Request  *tool.EnterPlanRequest
	Response *tool.EnterPlanResponse
	Approved bool
}

EnterPlanResponseMsg is sent when user responds

type FileSuggestion added in v1.3.0

type FileSuggestion struct {
	Path        string // Relative path from cwd
	DisplayName string // Display name (shortened)
	IsDir       bool   // Is it a directory
}

FileSuggestion represents a file suggestion for @import

type MCPConnectMsg added in v1.3.0

type MCPConnectMsg struct {
	ServerName string
}

MCPConnectMsg is sent when connecting to a server

type MCPConnectResultMsg added in v1.3.0

type MCPConnectResultMsg struct {
	ServerName string
	Success    bool
	ToolCount  int
	Error      error
}

MCPConnectResultMsg is sent when connection completes

type MCPDisconnectMsg added in v1.3.0

type MCPDisconnectMsg struct {
	ServerName string
}

MCPDisconnectMsg is sent when disconnecting from a server

type MCPSelectorCancelledMsg added in v1.3.0

type MCPSelectorCancelledMsg struct{}

MCPSelectorCancelledMsg is sent when the selector is cancelled

type MCPSelectorState added in v1.3.0

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

MCPSelectorState holds state for the MCP server selector

func NewMCPSelectorState added in v1.3.0

func NewMCPSelectorState() MCPSelectorState

NewMCPSelectorState creates a new MCPSelectorState

func (*MCPSelectorState) Cancel added in v1.3.0

func (s *MCPSelectorState) Cancel()

Cancel cancels the selector

func (*MCPSelectorState) EnterMCPSelect added in v1.3.0

func (s *MCPSelectorState) EnterMCPSelect(width, height int) error

EnterMCPSelect enters MCP server selection mode

func (*MCPSelectorState) HandleConnectResult added in v1.3.0

func (s *MCPSelectorState) HandleConnectResult(msg MCPConnectResultMsg)

HandleConnectResult handles the result of a connection attempt

func (*MCPSelectorState) HandleDisconnect added in v1.3.0

func (s *MCPSelectorState) HandleDisconnect(name string)

HandleDisconnect handles a disconnect request

func (*MCPSelectorState) HandleKeypress added in v1.3.0

func (s *MCPSelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if needed

func (*MCPSelectorState) IsActive added in v1.3.0

func (s *MCPSelectorState) IsActive() bool

IsActive returns whether the selector is active

func (*MCPSelectorState) MoveDown added in v1.3.0

func (s *MCPSelectorState) MoveDown()

MoveDown moves the selection down

func (*MCPSelectorState) MoveUp added in v1.3.0

func (s *MCPSelectorState) MoveUp()

MoveUp moves the selection up

func (*MCPSelectorState) Render added in v1.3.0

func (s *MCPSelectorState) Render() string

Render renders the MCP selector

func (*MCPSelectorState) Toggle added in v1.3.0

func (s *MCPSelectorState) Toggle() tea.Cmd

Toggle toggles the connection state of the currently selected server

type MCPServerItem added in v1.3.0

type MCPServerItem struct {
	Name      string
	Type      string // stdio, http, sse
	Status    mcp.ServerStatus
	ToolCount int
	Error     string
}

MCPServerItem represents an MCP server in the selector

type MemoryItem added in v1.3.0

type MemoryItem struct {
	Label       string // Display label (e.g., "Global", "Project", "Local")
	Description string // Description (e.g., "Saved in ~/.gen/GEN.md")
	Path        string // File path (empty if not exists)
	Exists      bool   // Whether the file exists
	Size        int64  // File size in bytes
	Level       string // "global", "project", "local"
	CreateHint  string // Command to create if not exists
}

MemoryItem represents a memory file option in the selector

type MemorySelectedMsg added in v1.3.0

type MemorySelectedMsg struct {
	Path  string
	Level string
}

MemorySelectedMsg is sent when a memory file is selected for editing

type MemorySelectorCancelledMsg added in v1.3.0

type MemorySelectorCancelledMsg struct{}

MemorySelectorCancelledMsg is sent when the selector is cancelled

type MemorySelectorState added in v1.3.0

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

MemorySelectorState holds the state for the memory selector

func NewMemorySelectorState added in v1.3.0

func NewMemorySelectorState() MemorySelectorState

NewMemorySelectorState creates a new MemorySelectorState

func (*MemorySelectorState) Cancel added in v1.3.0

func (s *MemorySelectorState) Cancel()

Cancel cancels the selector

func (*MemorySelectorState) EnterMemorySelect added in v1.3.0

func (s *MemorySelectorState) EnterMemorySelect(cwd string, width, height int)

EnterMemorySelect enters memory selection mode

func (*MemorySelectorState) HandleKeypress added in v1.3.0

func (s *MemorySelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if selection is made

func (*MemorySelectorState) IsActive added in v1.3.0

func (s *MemorySelectorState) IsActive() bool

IsActive returns whether the selector is active

func (*MemorySelectorState) MoveDown added in v1.3.0

func (s *MemorySelectorState) MoveDown()

MoveDown moves the selection down

func (*MemorySelectorState) MoveUp added in v1.3.0

func (s *MemorySelectorState) MoveUp()

MoveUp moves the selection up

func (*MemorySelectorState) Render added in v1.3.0

func (s *MemorySelectorState) Render() string

Render renders the selector

func (*MemorySelectorState) Select added in v1.3.0

func (s *MemorySelectorState) Select() tea.Cmd

Select handles selection and returns a command

type ModelItem

type ModelItem struct {
	ID               string
	Name             string
	DisplayName      string
	ProviderName     string
	AuthMethod       provider.AuthMethod
	IsCurrent        bool
	InputTokenLimit  int
	OutputTokenLimit int
}

ModelItem represents a model in the model selector

type ModelSelectedMsg

type ModelSelectedMsg struct {
	ModelID      string
	ProviderName string
	AuthMethod   provider.AuthMethod
}

ModelSelectedMsg is sent when a model is selected

type PermissionPrompt

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

PermissionPrompt manages the permission request UI with Claude Code style.

func NewPermissionPrompt

func NewPermissionPrompt() *PermissionPrompt

NewPermissionPrompt creates a new PermissionPrompt instance

func (*PermissionPrompt) GetRequest

GetRequest returns the current permission request

func (*PermissionPrompt) HandleKeypress

func (p *PermissionPrompt) HandleKeypress(msg tea.KeyMsg) tea.Cmd

HandleKeypress handles keyboard input for the permission prompt

func (*PermissionPrompt) Hide

func (p *PermissionPrompt) Hide()

Hide hides the permission prompt

func (*PermissionPrompt) IsActive

func (p *PermissionPrompt) IsActive() bool

IsActive returns whether the prompt is visible

func (*PermissionPrompt) Render

func (p *PermissionPrompt) Render() string

Render renders the permission prompt (calls RenderInline)

func (*PermissionPrompt) RenderInline

func (p *PermissionPrompt) RenderInline() string

RenderInline renders the permission prompt inline with Claude Code style

func (*PermissionPrompt) Show

func (p *PermissionPrompt) Show(req *permission.PermissionRequest, width, height int)

Show displays the permission prompt with the given request

type PermissionRequestMsg

type PermissionRequestMsg struct {
	Request  *permission.PermissionRequest
	ToolCall interface{} // The original tool call
}

PermissionRequestMsg is sent when a tool needs permission

type PermissionResponseMsg

type PermissionResponseMsg struct {
	Approved bool
	AllowAll bool // True if user selected "allow all during session"
	Request  *permission.PermissionRequest
}

PermissionResponseMsg is sent when the user responds to a permission request

type PlanPrompt added in v1.1.0

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

PlanPrompt manages the plan approval UI

func NewPlanPrompt added in v1.1.0

func NewPlanPrompt() *PlanPrompt

NewPlanPrompt creates a new PlanPrompt

func (*PlanPrompt) GetRequest added in v1.1.0

func (p *PlanPrompt) GetRequest() *tool.PlanRequest

GetRequest returns the current plan request

func (*PlanPrompt) HandleKeypress added in v1.1.0

func (p *PlanPrompt) HandleKeypress(msg tea.KeyMsg) tea.Cmd

HandleKeypress handles keyboard input for the plan prompt

func (*PlanPrompt) Hide added in v1.1.0

func (p *PlanPrompt) Hide()

Hide hides the plan prompt

func (*PlanPrompt) IsActive added in v1.1.0

func (p *PlanPrompt) IsActive() bool

IsActive returns whether the prompt is visible

func (*PlanPrompt) IsEditing added in v1.1.0

func (p *PlanPrompt) IsEditing() bool

IsEditing returns whether the prompt is in edit mode

func (*PlanPrompt) Render added in v1.1.0

func (p *PlanPrompt) Render() string

Render renders the plan prompt (legacy - full render)

func (*PlanPrompt) RenderContent added in v1.1.0

func (p *PlanPrompt) RenderContent() string

RenderContent renders the plan content for the chat viewport (above separator) This returns the rendered markdown directly (not wrapped in a viewport), allowing the main chat viewport to handle scrolling.

func (*PlanPrompt) RenderMenu added in v1.1.0

func (p *PlanPrompt) RenderMenu() string

RenderMenu renders the menu options for the input area (below separator)

func (*PlanPrompt) SetSize added in v1.1.0

func (p *PlanPrompt) SetSize(width, height int)

SetSize updates the prompt dimensions

func (*PlanPrompt) Show added in v1.1.0

func (p *PlanPrompt) Show(req *tool.PlanRequest, planPath string, width, height int)

Show displays the plan prompt with the given request

type PlanRequestMsg added in v1.1.0

type PlanRequestMsg struct {
	Request *tool.PlanRequest
}

PlanRequestMsg is sent when ExitPlanMode tool is called

type PlanResponseMsg added in v1.1.0

type PlanResponseMsg struct {
	Request      *tool.PlanRequest
	Response     *tool.PlanResponse
	Approved     bool
	ApproveMode  string // "clear-auto" | "auto" | "manual" | "modify"
	ModifiedPlan string // Modified plan if edited
}

PlanResponseMsg is sent when user responds to plan approval

type ProviderConnectResultMsg

type ProviderConnectResultMsg struct {
	AuthIdx   int
	Success   bool
	Message   string
	NewStatus provider.ProviderStatus
}

ProviderConnectResultMsg is sent when inline connection completes

type ProviderItem

type ProviderItem struct {
	Provider    provider.Provider
	DisplayName string
	AuthMethods []AuthMethodItem
}

ProviderItem represents a provider in the first level

type ProviderSelectedMsg

type ProviderSelectedMsg struct {
	Provider   provider.Provider
	AuthMethod provider.AuthMethod
}

ProviderSelectedMsg is sent when a provider is selected

type QuestionPrompt added in v1.1.0

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

QuestionPrompt manages the question prompt UI for AskUserQuestion tool

func NewQuestionPrompt added in v1.1.0

func NewQuestionPrompt() *QuestionPrompt

NewQuestionPrompt creates a new QuestionPrompt

func (*QuestionPrompt) GetRequest added in v1.1.0

func (p *QuestionPrompt) GetRequest() *tool.QuestionRequest

GetRequest returns the current question request

func (*QuestionPrompt) HandleKeypress added in v1.1.0

func (p *QuestionPrompt) HandleKeypress(msg tea.KeyMsg) tea.Cmd

HandleKeypress handles keyboard input for the question prompt

func (*QuestionPrompt) Hide added in v1.1.0

func (p *QuestionPrompt) Hide()

Hide hides the question prompt

func (*QuestionPrompt) IsActive added in v1.1.0

func (p *QuestionPrompt) IsActive() bool

IsActive returns whether the prompt is visible

func (*QuestionPrompt) Render added in v1.1.0

func (p *QuestionPrompt) Render() string

Render renders the question prompt

func (*QuestionPrompt) Show added in v1.1.0

func (p *QuestionPrompt) Show(req *tool.QuestionRequest, width int)

Show displays the question prompt with the given request

type QuestionRequestMsg added in v1.1.0

type QuestionRequestMsg struct {
	Request  *tool.QuestionRequest
	ToolCall interface{} // Original tool call
}

QuestionRequestMsg is sent when AskUserQuestion tool is called

type QuestionResponseMsg added in v1.1.0

type QuestionResponseMsg struct {
	Request   *tool.QuestionRequest
	Response  *tool.QuestionResponse
	Cancelled bool
}

QuestionResponseMsg is sent when user answers or cancels

type SaveLevel added in v1.1.0

type SaveLevel int

SaveLevel represents where to save the tool settings

const (
	SaveLevelProject SaveLevel = iota // Save to .gen/settings.json
	SaveLevelUser                     // Save to ~/.gen/settings.json
)

func (SaveLevel) String added in v1.1.0

func (l SaveLevel) String() string

String returns the display name for the save level

type SearchProviderItem

type SearchProviderItem struct {
	Name        search.ProviderName
	DisplayName string
	Status      string // "current", "available", "unavailable"
	RequiresKey bool
	EnvVars     []string
}

SearchProviderItem represents a search provider in the selector

type SearchProviderSelectedMsg

type SearchProviderSelectedMsg struct {
	Provider search.ProviderName
}

SearchProviderSelectedMsg is sent when a search provider is selected

type SelectionLevel

type SelectionLevel int

SelectionLevel represents the current selection level

const (
	LevelProvider SelectionLevel = iota
	LevelAuthMethod
)

type SelectorCancelledMsg

type SelectorCancelledMsg struct{}

SelectorCancelledMsg is sent when the selector is cancelled

type SelectorState

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

SelectorState holds the state for the interactive selector

func NewSelectorState

func NewSelectorState() SelectorState

NewSelectorState creates a new SelectorState

func (*SelectorState) Cancel

func (s *SelectorState) Cancel()

Cancel cancels the selector

func (*SelectorState) ConnectProvider

func (s *SelectorState) ConnectProvider(ctx context.Context, p provider.Provider, authMethod provider.AuthMethod) (string, error)

ConnectProvider connects to the selected provider and verifies the connection

func (*SelectorState) EnterModelSelect

func (s *SelectorState) EnterModelSelect(ctx context.Context, width, height int) error

EnterModelSelect enters model selection mode

func (*SelectorState) EnterProviderSelect

func (s *SelectorState) EnterProviderSelect(width, height int) error

EnterProviderSelect enters provider selection mode

func (*SelectorState) GoBack

func (s *SelectorState) GoBack() bool

GoBack goes back to the previous level

func (*SelectorState) HandleConnectResult

func (s *SelectorState) HandleConnectResult(msg ProviderConnectResultMsg)

HandleConnectResult updates the selector state with connection result

func (*SelectorState) HandleKeypress

func (s *SelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if selection is made

func (*SelectorState) IsActive

func (s *SelectorState) IsActive() bool

IsActive returns whether the selector is active

func (*SelectorState) MoveDown

func (s *SelectorState) MoveDown()

MoveDown moves the selection down

func (*SelectorState) MoveUp

func (s *SelectorState) MoveUp()

MoveUp moves the selection up

func (*SelectorState) Render

func (s *SelectorState) Render() string

Render renders the selector

func (*SelectorState) Select

func (s *SelectorState) Select() tea.Cmd

Select handles selection and returns a command

func (*SelectorState) SetModel

func (s *SelectorState) SetModel(modelID string, providerName string, authMethod provider.AuthMethod) (string, error)

SetModel sets the current model

type SelectorTab

type SelectorTab int

SelectorTab represents which tab is active in the provider selector

const (
	TabLLM SelectorTab = iota
	TabSearch
)

type SelectorType

type SelectorType int

SelectorType represents what kind of selection we're doing

const (
	SelectorTypeProvider SelectorType = iota
	SelectorTypeModel
)

type SessionSelectedMsg added in v1.3.0

type SessionSelectedMsg struct {
	SessionID string
}

SessionSelectedMsg is sent when a session is selected

type SessionSelectorCancelledMsg added in v1.3.0

type SessionSelectorCancelledMsg struct{}

SessionSelectorCancelledMsg is sent when the session selector is cancelled

type SessionSelectorState added in v1.3.0

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

SessionSelectorState holds the state for the session selector

func NewSessionSelectorState added in v1.3.0

func NewSessionSelectorState() SessionSelectorState

NewSessionSelectorState creates a new SessionSelectorState

func (*SessionSelectorState) Cancel added in v1.3.0

func (s *SessionSelectorState) Cancel()

Cancel cancels the selector

func (*SessionSelectorState) EnterSessionSelect added in v1.3.0

func (s *SessionSelectorState) EnterSessionSelect(width, height int, store *session.Store, cwd string) error

EnterSessionSelect enters session selection mode

func (*SessionSelectorState) HandleKeypress added in v1.3.0

func (s *SessionSelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if selection is made

func (*SessionSelectorState) IsActive added in v1.3.0

func (s *SessionSelectorState) IsActive() bool

IsActive returns whether the selector is active

func (*SessionSelectorState) MoveDown added in v1.3.0

func (s *SessionSelectorState) MoveDown()

MoveDown moves the selection down

func (*SessionSelectorState) MoveUp added in v1.3.0

func (s *SessionSelectorState) MoveUp()

MoveUp moves the selection up

func (*SessionSelectorState) Render added in v1.3.0

func (s *SessionSelectorState) Render() string

Render renders the session selector

func (*SessionSelectorState) Select added in v1.3.0

func (s *SessionSelectorState) Select() tea.Cmd

Select returns a command when a session is selected

type SkillCycleMsg added in v1.1.0

type SkillCycleMsg struct {
	SkillName string
	NewState  skill.SkillState
}

SkillCycleMsg is sent when a skill's state is cycled.

type SkillInvokeMsg added in v1.1.0

type SkillInvokeMsg struct {
	SkillName string
}

SkillInvokeMsg is sent when a skill is invoked from the selector.

type SkillItem added in v1.1.0

type SkillItem struct {
	Name        string // Base name
	Namespace   string // Optional namespace
	Description string
	Hint        string // argument-hint
	State       skill.SkillState
	Scope       skill.SkillScope
}

SkillItem represents a skill in the selector.

func (*SkillItem) FullName added in v1.1.0

func (s *SkillItem) FullName() string

FullName returns the namespaced skill name (namespace:name or just name).

type SkillPreview added in v1.2.0

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

SkillPreview renders a preview of skill metadata for permission prompts

func NewSkillPreview added in v1.2.0

func NewSkillPreview(meta *permission.SkillMetadata) *SkillPreview

NewSkillPreview creates a new SkillPreview instance

func (*SkillPreview) Render added in v1.2.0

func (p *SkillPreview) Render(width int) string

Render renders the skill preview

type SkillSaveLevel added in v1.1.0

type SkillSaveLevel int

SkillSaveLevel represents where to save skill settings.

const (
	SkillSaveLevelProject SkillSaveLevel = iota // Save to .gen/skills.json
	SkillSaveLevelUser                          // Save to ~/.gen/skills.json
)

func (SkillSaveLevel) String added in v1.1.0

func (l SkillSaveLevel) String() string

String returns the display name for the save level.

type SkillSelectorCancelledMsg added in v1.1.0

type SkillSelectorCancelledMsg struct{}

SkillSelectorCancelledMsg is sent when the skill selector is cancelled.

type SkillSelectorState added in v1.1.0

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

SkillSelectorState holds state for the skill selector.

func NewSkillSelectorState added in v1.1.0

func NewSkillSelectorState() SkillSelectorState

NewSkillSelectorState creates a new SkillSelectorState.

func (*SkillSelectorState) Cancel added in v1.1.0

func (s *SkillSelectorState) Cancel()

Cancel cancels the selector.

func (*SkillSelectorState) CycleState added in v1.1.0

func (s *SkillSelectorState) CycleState() tea.Cmd

CycleState cycles the state of the currently selected skill.

func (*SkillSelectorState) EnterSkillSelect added in v1.1.0

func (s *SkillSelectorState) EnterSkillSelect(width, height int) error

EnterSkillSelect enters skill selection mode.

func (*SkillSelectorState) HandleKeypress added in v1.1.0

func (s *SkillSelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if needed.

func (*SkillSelectorState) IsActive added in v1.1.0

func (s *SkillSelectorState) IsActive() bool

IsActive returns whether the selector is active.

func (*SkillSelectorState) MoveDown added in v1.1.0

func (s *SkillSelectorState) MoveDown()

MoveDown moves the selection down.

func (*SkillSelectorState) MoveUp added in v1.1.0

func (s *SkillSelectorState) MoveUp()

MoveUp moves the selection up.

func (*SkillSelectorState) Render added in v1.1.0

func (s *SkillSelectorState) Render() string

Render renders the skill selector.

type SuggestionState

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

SuggestionState holds the state for command and file suggestions

func NewSuggestionState

func NewSuggestionState() SuggestionState

NewSuggestionState creates a new SuggestionState

func (*SuggestionState) GetAtQuery added in v1.3.0

func (s *SuggestionState) GetAtQuery() string

GetAtQuery returns the current @ query

func (*SuggestionState) GetSelected

func (s *SuggestionState) GetSelected() string

GetSelected returns the currently selected suggestion, or empty string if none

func (*SuggestionState) GetSuggestionType added in v1.3.0

func (s *SuggestionState) GetSuggestionType() SuggestionType

GetSuggestionType returns the current suggestion type

func (*SuggestionState) Hide

func (s *SuggestionState) Hide()

Hide hides the suggestions

func (*SuggestionState) IsVisible

func (s *SuggestionState) IsVisible() bool

IsVisible returns whether suggestions are visible

func (*SuggestionState) MoveDown

func (s *SuggestionState) MoveDown()

MoveDown moves the selection down

func (*SuggestionState) MoveUp

func (s *SuggestionState) MoveUp()

MoveUp moves the selection up

func (*SuggestionState) Render

func (s *SuggestionState) Render(width int) string

Render renders the suggestions box

func (*SuggestionState) Reset

func (s *SuggestionState) Reset()

Reset resets the suggestion state

func (*SuggestionState) SetCwd added in v1.3.0

func (s *SuggestionState) SetCwd(cwd string)

SetCwd sets the current working directory for file scanning

func (*SuggestionState) UpdateSuggestions

func (s *SuggestionState) UpdateSuggestions(input string)

UpdateSuggestions updates suggestions based on input

type SuggestionType added in v1.3.0

type SuggestionType int

SuggestionType indicates what kind of suggestion is being shown

const (
	SuggestionTypeCommand SuggestionType = iota
	SuggestionTypeFile
)

type TaskProgressMsg added in v1.2.0

type TaskProgressMsg struct {
	Message string
}

TaskProgressMsg is sent when a Task tool reports progress

type Theme added in v1.1.0

type Theme struct {
	// Base colors
	Muted     lipgloss.Color // muted text, placeholders
	Accent    lipgloss.Color // spinner, highlights
	Primary   lipgloss.Color // user prompt, links
	AI        lipgloss.Color // AI responses
	Separator lipgloss.Color // separator lines

	// Text colors
	Text         lipgloss.Color // normal text
	TextDim      lipgloss.Color // dimmed text
	TextBright   lipgloss.Color // bright/highlighted text
	TextDisabled lipgloss.Color // disabled/strikethrough text

	// Semantic colors
	Success lipgloss.Color // green - added, completed
	Error   lipgloss.Color // red - removed, errors
	Warning lipgloss.Color // amber/orange - in progress

	// Diff background colors
	SuccessBg lipgloss.Color // subtle green background for added lines
	ErrorBg   lipgloss.Color // subtle red/pink background for removed lines

	// UI element colors
	Border     lipgloss.Color // borders
	Background lipgloss.Color // backgrounds for badges/boxes
}

Theme holds all color definitions for the UI

var CurrentTheme Theme

CurrentTheme holds the active theme based on terminal background

type TokenLimitResultMsg added in v1.3.0

type TokenLimitResultMsg struct {
	Result string
	Error  error
}

TokenLimitResultMsg is sent when token limit fetching completes

type ToolItem added in v1.1.0

type ToolItem struct {
	Name        string
	Description string
	Enabled     bool
}

ToolItem represents a tool in the selector

type ToolSelectorCancelledMsg added in v1.1.0

type ToolSelectorCancelledMsg struct{}

ToolSelectorCancelledMsg is sent when the tool selector is cancelled

type ToolSelectorState added in v1.1.0

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

ToolSelectorState holds state for the tool selector

func NewToolSelectorState added in v1.1.0

func NewToolSelectorState() ToolSelectorState

NewToolSelectorState creates a new ToolSelectorState

func (*ToolSelectorState) Cancel added in v1.1.0

func (s *ToolSelectorState) Cancel()

Cancel cancels the selector

func (*ToolSelectorState) EnterToolSelect added in v1.1.0

func (s *ToolSelectorState) EnterToolSelect(width, height int, disabledTools map[string]bool) error

EnterToolSelect enters tool selection mode

func (*ToolSelectorState) HandleKeypress added in v1.1.0

func (s *ToolSelectorState) HandleKeypress(key tea.KeyMsg) tea.Cmd

HandleKeypress handles a keypress and returns a command if needed

func (*ToolSelectorState) IsActive added in v1.1.0

func (s *ToolSelectorState) IsActive() bool

IsActive returns whether the selector is active

func (*ToolSelectorState) MoveDown added in v1.1.0

func (s *ToolSelectorState) MoveDown()

MoveDown moves the selection down

func (*ToolSelectorState) MoveUp added in v1.1.0

func (s *ToolSelectorState) MoveUp()

MoveUp moves the selection up

func (*ToolSelectorState) Render added in v1.1.0

func (s *ToolSelectorState) Render() string

Render renders the tool selector

func (*ToolSelectorState) Toggle added in v1.1.0

func (s *ToolSelectorState) Toggle() tea.Cmd

Toggle toggles the enabled state of the currently selected tool

type ToolToggleMsg added in v1.1.0

type ToolToggleMsg struct {
	ToolName string
	Enabled  bool
}

ToolToggleMsg is sent when a tool's enabled state is toggled

Jump to

Keyboard shortcuts

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