Documentation
¶
Overview ¶
Package tui provides interactive terminal UI components for agk CLI.
Index ¶
- Constants
- Variables
- func GetSpanStyle(spanName string) lipgloss.Style
- type DetailTab
- type FocusArea
- type MetricsCalculator
- type Model
- type ParentSpan
- type RunData
- type Span
- func (s *Span) GetAllAttributes() map[string]interface{}
- func (s *Span) GetAttribute(key string) (interface{}, bool)
- func (s *Span) GetFriendlyName() string
- func (s *Span) GetImportantAttributes() map[string]interface{}
- func (s *Span) GetSpanType() string
- func (s *Span) IsInternalSpan() bool
- func (s *Span) IsWorkflowStep() bool
- type SpanContext
- type SpanNode
- type SpanStatus
- type TraceRun
- type ViewMode
Constants ¶
const ( StatusUnset = "Unset" CtrlC = "ctrl+c" KeyUp = "up" KeyDown = "down" )
Variables ¶
var ( // BoxStyle is the main container style BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(primaryColor). Padding(0, 1) // HeaderStyle for headers HeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(primaryColor). Padding(0, 1) // TitleStyle for main titles TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(primaryColor). Padding(0, 2) // SectionHeaderStyle for detail view sections SectionHeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(secondaryColor). Padding(0, 1). Margin(1, 0, 0, 0) )
Box styles
var ( // SelectedStyle for selected items SelectedStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(secondaryColor) // CursorStyle for the cursor indicator CursorStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) // MutedStyle for less important text MutedStyle = lipgloss.NewStyle(). Foreground(mutedColor) // SuccessStyle for success indicators SuccessStyle = lipgloss.NewStyle(). Foreground(successColor) // ErrorStyle for error indicators ErrorStyle = lipgloss.NewStyle(). Foreground(errorColor) // WarningStyle for warnings WarningStyle = lipgloss.NewStyle(). Foreground(warningColor) // DurationStyle for duration values DurationStyle = lipgloss.NewStyle(). Foreground(accentColor) // AttributeKeyStyle for attribute keys AttributeKeyStyle = lipgloss.NewStyle(). Foreground(secondaryColor) // AttributeValueStyle for attribute values AttributeValueStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#FFFFFF")) )
Text styles
var ( WorkflowSpanStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#8B5CF6")) // Violet AgentSpanStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#3B82F6")) // Blue LLMSpanStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#10B981")) // Emerald ToolSpanStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#F59E0B")) // Amber )
Span type styles
var ( HelpStyle = lipgloss.NewStyle(). Foreground(mutedColor). Padding(0, 1) HelpKeyStyle = lipgloss.NewStyle(). Foreground(secondaryColor). Bold(true) )
Help bar style
var ( LeftPaneStyle = lipgloss.NewStyle(). Border(lipgloss.NormalBorder(), false, true, false, false). BorderForeground(mutedColor). Padding(0, 1) RightPaneStyle = lipgloss.NewStyle(). Padding(0, 1) )
Pane styles for split layout
Functions ¶
func GetSpanStyle ¶
GetSpanStyle returns the appropriate style based on span name
Types ¶
type DetailTab ¶ added in v0.2.2
type DetailTab int
DetailTab represents the active tab in the details panel
type FocusArea ¶ added in v0.2.2
type FocusArea int
FocusArea represents which panel is currently focused
type MetricsCalculator ¶
func (*MetricsCalculator) ProcessNode ¶
func (mc *MetricsCalculator) ProcessNode(node *SpanNode)
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main bubbletea model for the trace viewer
func NewTraceExplorer ¶
NewTraceExplorer creates a trace explorer with multiple runs (for `agk trace` command)
func NewTraceViewer ¶
NewTraceViewer creates a new trace viewer model
func NewTraceViewerWithPath ¶
NewTraceViewerWithPath creates a trace viewer with hot reload support
type ParentSpan ¶
ParentSpan contains parent span reference
type Span ¶
type Span struct {
Name string `json:"Name"`
StartTime string `json:"StartTime"`
EndTime string `json:"EndTime"`
Attributes []map[string]interface{} `json:"Attributes,omitempty"`
SpanContext SpanContext `json:"SpanContext"`
Parent ParentSpan `json:"Parent"`
SpanKind int `json:"SpanKind"`
Status SpanStatus `json:"Status"`
ChildSpanCount int `json:"ChildSpanCount"`
InstrumentationScope map[string]interface{} `json:"InstrumentationScope"`
}
Span represents a parsed OpenTelemetry span
func (*Span) GetAllAttributes ¶
GetAllAttributes returns all attributes as key-value pairs
func (*Span) GetAttribute ¶
GetAttribute gets an attribute value by key
func (*Span) GetFriendlyName ¶
GetFriendlyName returns a user-friendly display name for the span
func (*Span) GetImportantAttributes ¶
GetImportantAttributes returns filtered important attributes
func (*Span) GetSpanType ¶
GetSpanType returns the type of span for styling
func (*Span) IsInternalSpan ¶
IsInternalSpan returns true if this span should be hidden by default (detail level)
func (*Span) IsWorkflowStep ¶
IsWorkflowStep returns true if this span represents a workflow step
type SpanContext ¶
SpanContext contains span identification
type SpanNode ¶
type SpanNode struct {
Span Span
Children []*SpanNode
Depth int
Expanded bool
Parent *SpanNode
DurationMs int64
}
SpanNode represents a span in the hierarchical tree
func BuildSpanTree ¶
BuildSpanTree builds a hierarchical tree from flat span list
func FlattenTree ¶
FlattenTree returns a flat list of visible nodes for display
func (*SpanNode) HasChildren ¶
HasChildren returns true if the span has children
func (*SpanNode) ToggleExpanded ¶
func (n *SpanNode) ToggleExpanded()
ToggleExpanded toggles the expanded state
type SpanStatus ¶
type SpanStatus struct {
Code string `json:"Code"`
Description string `json:"Description,omitempty"`
}
SpanStatus contains span status