types

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStringBoolEnabled added in v0.1.6

func IsStringBoolEnabled(value string) bool

IsStringBoolEnabled returns true if a string boolean field is enabled For fields that default to DISABLED (false): Treats "enabled", "true" as enabled Treats "disabled", "false", and empty string as disabled

func IsStringBoolEnabledWithDefault added in v0.1.6

func IsStringBoolEnabledWithDefault(value string) bool

IsStringBoolEnabledWithDefault returns true if a string boolean field is enabled For fields that default to ENABLED (true): Treats "enabled", "true", and empty string as enabled Treats "disabled", "false" as disabled

Types

type BorderStyle

type BorderStyle string
const (
	BorderStyleNone   BorderStyle = "none"   // No borders
	BorderStyleSingle BorderStyle = "single" // Default ASCII borders
)

type Component

type Component interface {
	GetKey() string
	GetView() *gocui.View
	GetViewName() string

	HandleFocus() error
	HandleFocusLost() error

	GetKeybindings() []*KeyBinding

	Render() error

	HasControlledBounds() bool

	// UI properties that define how this component should be displayed
	GetWindowProperties() WindowProperties
	GetTitle() string
}

type Config

type Config struct {
	ShowCursor        string // "enabled" or "disabled" (default: "enabled")
	MarkdownRendering string // "enabled" or "disabled" (default: "enabled")
	Theme             string
	WrapMessages      string // "enabled" or "disabled" (default: "enabled")
	ShowTimestamps    bool

	// Terminal output configuration
	// OutputMode controls gocui color and Unicode support:
	// - "true": 24-bit color with enhanced Unicode support (default, recommended)
	// - "normal": 8-color mode with basic Unicode
	// - "256": 256-color mode
	OutputMode string

	// Markdown rendering configuration
	// GlamourTheme controls the glamour theme for markdown rendering:
	// Available themes: "dark", "light", "dracula", "tokyo-night", "pink", "ascii", "notty", "auto"
	// Set to "auto" to use theme-based mapping, or specify a specific glamour theme
	GlamourTheme string

	// Diff rendering configuration
	// DiffTheme controls the diff theme for diff rendering:
	// Available themes: "default", "subtle", "vibrant", "github", "classic", "auto"
	// Set to "auto" to use theme-based mapping, or specify a specific diff theme
	DiffTheme string

	// Component border settings
	ShowMessagesBorder string // "enabled" or "disabled" (default: "enabled")

	// Chat behavior settings
	MaxChatMessages int // Maximum number of chat messages to keep in memory (default: 500)

	// Editor configuration
	VimMode bool // Enable vim-style editing mode (default: false)

	// Mouse configuration
	EnableMouse string // Enable gocui mouse support for UI interactions: "enabled" or "disabled" (default: "enabled")

	// Message role labels/symbols
	UserLabel      string // Symbol for user messages (default: "○")
	AssistantLabel string // Symbol for assistant messages (default: "●")
	SystemLabel    string // Symbol for system messages (default: "●")
	ErrorLabel     string // Symbol for error messages (default: "●")

	// Tool behavior configurations
	ToolConfigs map[string]ToolConfig // Per-tool configurations (hide/auto-accept)

	Layout LayoutConfig
}

func (*Config) IsMarkdownRenderingEnabled added in v0.1.6

func (c *Config) IsMarkdownRenderingEnabled() bool

IsMarkdownRenderingEnabled returns true if markdown rendering is enabled in config

func (*Config) IsMouseEnabled added in v0.1.6

func (c *Config) IsMouseEnabled() bool

IsMouseEnabled returns true if mouse is enabled in config

func (*Config) IsShowCursorEnabled added in v0.1.6

func (c *Config) IsShowCursorEnabled() bool

IsShowCursorEnabled returns true if cursor is enabled in config

func (*Config) IsShowMessagesBorderEnabled added in v0.1.6

func (c *Config) IsShowMessagesBorderEnabled() bool

IsShowMessagesBorderEnabled returns true if messages border is enabled in config

func (*Config) IsWrapMessagesEnabled added in v0.1.6

func (c *Config) IsWrapMessagesEnabled() bool

IsWrapMessagesEnabled returns true if message wrapping is enabled in config

type FocusStyle

type FocusStyle string
const (
	FocusStyleBorder FocusStyle = "border" // Colored border only
	FocusStyleNone   FocusStyle = "none"   // No visual focus
)

type Gui

type Gui interface {
	GetGui() *gocui.Gui
	PostUIUpdate(func())
}

type IStateAccessor

type IStateAccessor interface {
	GetMessages() []Message
	AddMessage(msg Message)
	ClearMessages()

	// Confirmation state
	SetWaitingConfirmation(waiting bool)
	IsWaitingConfirmation() bool

	// UI state management
	IsContextViewerActive() bool
	SetContextViewerActive(active bool)
}

type KeyBinding

type KeyBinding struct {
	View    string
	Key     interface{}
	Mod     gocui.Modifier
	Handler func(*gocui.Gui, *gocui.View) error
}

type LLMContextDataProvider

type LLMContextDataProvider interface {
	GetContextData() map[string]string
	HandleComponentEvent(eventName string, data interface{}) error
}

LLMContextDataProvider is the interface components use to interact with the LLMContextController

type LayoutConfig

type LayoutConfig struct {
	ChatPanelWidth    float64
	ShowSidebar       string // "enabled" or "disabled" (default: "enabled")
	CompactMode       bool
	ResponsePanelMode string
	MinPanelWidth     int
	MinPanelHeight    int
	BorderStyle       BorderStyle // Default border style for all components
	PortraitMode      string
	SidePanelWidth    float64
	ExpandedSidePanel bool
	ShowBorders       bool       // Global borders on/off
	FocusStyle        FocusStyle // Default focus style for all components
}

func (*LayoutConfig) IsShowSidebarEnabled added in v0.1.6

func (lc *LayoutConfig) IsShowSidebarEnabled() bool

IsShowSidebarEnabled returns true if sidebar is enabled in config

type Message

type Message struct {
	Role        string
	Content     string
	ContentType string // "text" or "markdown"
}

type MockNotification

type MockNotification struct {
	SystemMessages []string
	ErrorMessages  []string
}

func (*MockNotification) AddErrorMessage

func (m *MockNotification) AddErrorMessage(msg string)

func (*MockNotification) AddSystemMessage

func (m *MockNotification) AddSystemMessage(msg string)

type Notification

type Notification interface {
	AddSystemMessage(string)
	AddErrorMessage(string)
}

type Theme

type Theme struct {
	// Accent colors (for UI elements, indicators, borders) - legacy compatibility
	Primary   string // AI assistant accents/indicators
	Secondary string // System accents/indicators
	Tertiary  string // User accents/indicators
	Error     string
	Warning   string
	Success   string
	Muted     string

	// Text colors (for message content)
	TextPrimary   string // AI assistant message text
	TextSecondary string // System message text
	TextTertiary  string // User message text

	// Border colors (legacy)
	BorderDefault string // Default border color
	BorderFocused string // Focused border color
	BorderMuted   string // Inactive/dimmed borders

	// Focus colors (legacy)
	FocusBackground string // Background when focused
	FocusForeground string // Text color when focused

	// Active state colors (legacy)
	ActiveBackground string // Active component background
	ActiveForeground string // Active component text

	// Diff-specific colors
	DiffAddedFg   string // Foreground color for added lines
	DiffAddedBg   string // Background color for added lines
	DiffRemovedFg string // Foreground color for removed lines
	DiffRemovedBg string // Background color for removed lines
	DiffHeaderFg  string // Foreground color for file headers (+++/---)
	DiffHeaderBg  string // Background color for file headers
	DiffHunkFg    string // Foreground color for hunk headers (@@)
	DiffHunkBg    string // Background color for hunk headers
	DiffContextFg string // Foreground color for context lines
	DiffContextBg string // Background color for context lines

}

type ToolConfig added in v0.1.4

type ToolConfig struct {
	Hide       bool // Hide tool execution messages in chat
	AutoAccept bool // Auto-accept confirmations for this tool
}

ToolConfig holds per-tool behavior settings

type WindowProperties

type WindowProperties struct {
	// Basic properties
	Focusable  bool
	Editable   bool
	Wrap       bool
	Autoscroll bool
	Highlight  bool
	Frame      bool

	// Border configuration
	BorderStyle BorderStyle // What type of border
	BorderColor string      // Override border color (empty = use theme)
	FocusBorder bool        // Show special focus border

	// Focus behavior
	FocusStyle FocusStyle // How to show focus state

	// Title properties
	Subtitle string // Subtitle shown on right side of border
}

Jump to

Keyboard shortcuts

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