Documentation
¶
Overview ¶
Package tui provides terminal UI components for comanda using bubbletea and lipgloss
Index ¶
- func RunChart(workflowName string, nodes []*ChartNode, stats ChartStats) error
- type Activity
- type ChartModel
- type ChartNode
- type ChartStats
- type DashboardModel
- type EventMsg
- type LogWatcher
- type LoopConfig
- type Output
- func (o *Output) Bold(message string) string
- func (o *Output) Box(content string) string
- func (o *Output) Divider() string
- func (o *Output) Error(message string) string
- func (o *Output) Header(title string) string
- func (o *Output) HighlightBox(content string) string
- func (o *Output) Info(message string) string
- func (o *Output) ModelTag(model string) string
- func (o *Output) Muted(message string) string
- func (o *Output) Progress(current, total int, label string) string
- func (o *Output) Section(title, content string) string
- func (o *Output) SetEnabled(enabled bool)
- func (o *Output) StatsBox(stats map[string]interface{}) string
- func (o *Output) Step(name, model, status string) string
- func (o *Output) SubHeader(title string) string
- func (o *Output) Success(message string) string
- func (o *Output) Table(headers []string, rows [][]string) string
- func (o *Output) Warning(message string) string
- type ProgressEvent
- type ProgressReporter
- func (p *ProgressReporter) Close()
- func (p *ProgressReporter) Complete(err error)
- func (p *ProgressReporter) Emit(event ProgressEvent)
- func (p *ProgressReporter) GetResourceUsage() (cpuPercent float64, memoryMB float64)
- func (p *ProgressReporter) LoopIteration(loopName string, iteration, maxIter int)
- func (p *ProgressReporter) Output(message string)
- func (p *ProgressReporter) StepEnd(name string, err error)
- func (p *ProgressReporter) StepStart(name string)
- func (p *ProgressReporter) Subscribe() chan ProgressEvent
- func (p *ProgressReporter) TokenUpdate(used, available int)
- func (p *ProgressReporter) ToolCall(message string)
- func (p *ProgressReporter) Unsubscribe(ch chan ProgressEvent)
- type Theme
- type TickMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity struct {
Timestamp time.Time
Type string // "tool", "output", "error", "info"
Message string
}
Activity represents a recent activity in the dashboard
type ChartModel ¶
type ChartModel struct {
// contains filtered or unexported fields
}
ChartModel is the bubbletea model for the chart view
func NewChartModel ¶
func NewChartModel(workflowName string, nodes []*ChartNode, stats ChartStats) ChartModel
NewChartModel creates a new chart model
type ChartNode ¶
type ChartNode struct {
Name string
Model string
Type string // "step", "parallel", "loop", "condition"
IsValid bool
Children []*ChartNode
Input string
Output string
Action string
LoopConfig *LoopConfig
IsDeferred bool
Description string
}
ChartNode represents a node in the workflow chart
type ChartStats ¶
type ChartStats struct {
TotalSteps int
ParallelSteps int
LoopCount int
ValidSteps int
DeferredSteps int
Models map[string]int
}
ChartStats holds workflow statistics
type DashboardModel ¶
type DashboardModel struct {
// contains filtered or unexported fields
}
DashboardModel is the bubbletea model for the live dashboard
func NewDashboardModel ¶
func NewDashboardModel(workflowName string, reporter *ProgressReporter) *DashboardModel
NewDashboardModel creates a new dashboard model
func RunDashboard ¶
func RunDashboard(workflowName string, reporter *ProgressReporter) (*DashboardModel, *tea.Program)
RunDashboard starts the dashboard TUI and returns the program for external control
type LogWatcher ¶
type LogWatcher struct {
// contains filtered or unexported fields
}
LogWatcher monitors a stream log file and emits progress events
func NewLogWatcher ¶
func NewLogWatcher(path string, reporter *ProgressReporter) *LogWatcher
NewLogWatcher creates a new log watcher
type LoopConfig ¶
LoopConfig contains loop-specific configuration
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output provides styled output for non-TUI mode
func (*Output) HighlightBox ¶
HighlightBox wraps content in a highlighted box
func (*Output) SetEnabled ¶
SetEnabled enables or disables styled output
type ProgressEvent ¶
type ProgressEvent struct {
Type string // "step_start", "step_end", "loop_iter", "tool_call", "output", "error", "complete"
Timestamp time.Time
StepName string
LoopName string
Iteration int
MaxIter int
Message string
TokensUsed int
TokensAvail int
Error error
}
ProgressEvent represents an event during workflow processing
type ProgressReporter ¶
type ProgressReporter struct {
// contains filtered or unexported fields
}
ProgressReporter sends progress events to subscribers
func NewProgressReporter ¶
func NewProgressReporter() *ProgressReporter
NewProgressReporter creates a new progress reporter
func (*ProgressReporter) Complete ¶
func (p *ProgressReporter) Complete(err error)
Complete emits a completion event
func (*ProgressReporter) Emit ¶
func (p *ProgressReporter) Emit(event ProgressEvent)
Emit sends an event to all subscribers
func (*ProgressReporter) GetResourceUsage ¶
func (p *ProgressReporter) GetResourceUsage() (cpuPercent float64, memoryMB float64)
GetResourceUsage returns current CPU and memory usage
func (*ProgressReporter) LoopIteration ¶
func (p *ProgressReporter) LoopIteration(loopName string, iteration, maxIter int)
LoopIteration emits a loop iteration event
func (*ProgressReporter) Output ¶
func (p *ProgressReporter) Output(message string)
Output emits an output event
func (*ProgressReporter) StepEnd ¶
func (p *ProgressReporter) StepEnd(name string, err error)
StepEnd emits a step end event
func (*ProgressReporter) StepStart ¶
func (p *ProgressReporter) StepStart(name string)
StepStart emits a step start event
func (*ProgressReporter) Subscribe ¶
func (p *ProgressReporter) Subscribe() chan ProgressEvent
Subscribe adds a subscriber channel
func (*ProgressReporter) TokenUpdate ¶
func (p *ProgressReporter) TokenUpdate(used, available int)
TokenUpdate emits a token usage update
func (*ProgressReporter) ToolCall ¶
func (p *ProgressReporter) ToolCall(message string)
ToolCall emits a tool call event
func (*ProgressReporter) Unsubscribe ¶
func (p *ProgressReporter) Unsubscribe(ch chan ProgressEvent)
Unsubscribe removes a subscriber channel
type Theme ¶
type Theme struct {
// Base colors
Primary lipgloss.Color
Secondary lipgloss.Color
Accent lipgloss.Color
Muted lipgloss.Color
Success lipgloss.Color
Warning lipgloss.Color
Error lipgloss.Color
// Background colors
BgPrimary lipgloss.Color
BgSecondary lipgloss.Color
// Model colors (for distinguishing different AI providers)
ModelColors map[string]lipgloss.Color
// Pre-built styles
Title lipgloss.Style
Subtitle lipgloss.Style
Body lipgloss.Style
MutedText lipgloss.Style
SuccessText lipgloss.Style
WarningText lipgloss.Style
ErrorText lipgloss.Style
// Box styles
BoxNormal lipgloss.Style
BoxHighlight lipgloss.Style
BoxError lipgloss.Style
BoxSuccess lipgloss.Style
// Progress bar colors
ProgressFull lipgloss.Color
ProgressEmpty lipgloss.Color
}
Theme defines the color scheme and styles for the TUI
func (*Theme) ModelColor ¶
ModelColor returns the color for a given model name
func (*Theme) ModelStyle ¶
ModelStyle returns a style configured for a given model
func (*Theme) ProgressBar ¶
ProgressBar creates a progress bar string