agent

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SpinnerDots - Braille dots spinner (smooth).
	SpinnerDots = Spinner{
		Frames: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"},
	}

	// SpinnerCircleQuarters - Circle with quarters.
	SpinnerCircleQuarters = Spinner{
		Frames: []string{"◐", "◓", "◑", "◒"},
	}
)
View Source
var (
	// IconSetCodex - Codex CLI style.
	IconSetCodex = IconSet{
		Running: "⏺",
		Success: "✓",
		Error:   "✗",
		Warning: "⚠",
		Info:    "⏺",
		None:    "⏺",
	}
)

Functions

This section is empty.

Types

type IconSet

type IconSet struct {
	Running string
	Success string
	Error   string
	Warning string
	Info    string
	None    string
}

IconSet defines icons for different statuses.

type Spinner

type Spinner struct {
	Frames []string
}

Spinner defines an animation sequence.

func (Spinner) FrameCount

func (s Spinner) FrameCount() int

FrameCount returns the number of frames in the spinner.

func (Spinner) GetFrame

func (s Spinner) GetFrame(index int) string

GetFrame returns the frame at the given index.

type SubagentGroup

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

SubagentGroup renders multiple SubagentPanels in one horizontal row.

func NewSubagentGroup

func NewSubagentGroup(opts ...SubagentGroupOption) *SubagentGroup

NewSubagentGroup creates a new SubagentGroup.

func (*SubagentGroup) AddPanel

func (g *SubagentGroup) AddPanel(p *SubagentPanel)

AddPanel appends one panel to the group.

func (*SubagentGroup) Blur

func (g *SubagentGroup) Blur()

Blur marks the group as not focused.

func (*SubagentGroup) CompletedCount

func (g *SubagentGroup) CompletedCount() int

CompletedCount returns how many panels are completed.

func (*SubagentGroup) Focus

func (g *SubagentGroup) Focus()

Focus marks the group as focused.

func (*SubagentGroup) FocusPanel

func (g *SubagentGroup) FocusPanel(index int)

FocusPanel focuses a specific panel by index.

func (*SubagentGroup) Focused

func (g *SubagentGroup) Focused() bool

Focused returns whether the group is focused.

func (*SubagentGroup) GetPanels

func (g *SubagentGroup) GetPanels() []*SubagentPanel

GetPanels returns the current panel slice.

func (*SubagentGroup) Init

func (g *SubagentGroup) Init() tea.Cmd

Init initializes all child panels.

func (*SubagentGroup) IsAllCompleted

func (g *SubagentGroup) IsAllCompleted() bool

IsAllCompleted reports whether all panels are completed.

func (*SubagentGroup) PanelCount

func (g *SubagentGroup) PanelCount() int

PanelCount returns the number of panels.

func (*SubagentGroup) SetPanels

func (g *SubagentGroup) SetPanels(panels []*SubagentPanel)

SetPanels replaces all panels in the group.

func (*SubagentGroup) SetWidth added in v2.9.0

func (g *SubagentGroup) SetWidth(w int)

SetWidth updates the group's total rendering width.

func (*SubagentGroup) Update

func (g *SubagentGroup) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles group and panel events.

func (*SubagentGroup) View

func (g *SubagentGroup) View() string

View renders header, panel row, and optional completion footer.

type SubagentGroupOption

type SubagentGroupOption func(*SubagentGroup)

SubagentGroupOption configures a SubagentGroup.

func WithSubagentGroupDesignTokens

func WithSubagentGroupDesignTokens(tokens *design.DesignTokens) SubagentGroupOption

WithSubagentGroupDesignTokens applies design-system tokens.

func WithSubagentGroupFocusHint

func WithSubagentGroupFocusHint(hint string) SubagentGroupOption

WithSubagentGroupFocusHint sets the optional header hint text.

func WithSubagentGroupGap

func WithSubagentGroupGap(gap int) SubagentGroupOption

WithSubagentGroupGap sets horizontal spacing between panels.

func WithSubagentGroupMaxPerRow added in v2.4.0

func WithSubagentGroupMaxPerRow(n int) SubagentGroupOption

WithSubagentGroupMaxPerRow sets the max number of panels per row.

func WithSubagentGroupTheme

func WithSubagentGroupTheme(theme string) SubagentGroupOption

WithSubagentGroupTheme applies a named theme.

func WithSubagentGroupWidth added in v2.9.0

func WithSubagentGroupWidth(w int) SubagentGroupOption

WithSubagentGroupWidth sets the total width for the group.

type SubagentPanel

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

SubagentPanel renders a single subagent panel.

func NewSubagentPanel

func NewSubagentPanel(opts ...SubagentPanelOption) *SubagentPanel

NewSubagentPanel creates a new SubagentPanel.

func (*SubagentPanel) AddTool

func (p *SubagentPanel) AddTool(tool SubagentTool)

AddTool appends a tool and recomputes hidden count.

func (*SubagentPanel) AdvanceSpinner added in v2.4.2

func (p *SubagentPanel) AdvanceSpinner()

AdvanceSpinner manually advances the spinner frame. Use this when rendering outside of Bubble Tea's Update loop.

func (*SubagentPanel) Blur

func (p *SubagentPanel) Blur()

Blur marks the panel as not focused.

func (*SubagentPanel) BottomPinnedLines added in v2.9.4

func (p *SubagentPanel) BottomPinnedLines() int

BottomPinnedLines returns the number of lines at the bottom of View() that must stay pinned together (footer + change chips + bottom border).

func (*SubagentPanel) Focus

func (p *SubagentPanel) Focus()

Focus marks the panel as focused.

func (*SubagentPanel) Focused

func (p *SubagentPanel) Focused() bool

Focused reports whether the panel is focused.

func (*SubagentPanel) GetStatus

func (p *SubagentPanel) GetStatus() SubagentStatus

GetStatus returns the current panel status.

func (*SubagentPanel) Init

func (p *SubagentPanel) Init() tea.Cmd

Init starts animation ticks when running.

func (*SubagentPanel) SetCost

func (p *SubagentPanel) SetCost(s string)

SetCost sets cost text.

func (*SubagentPanel) SetElapsed

func (p *SubagentPanel) SetElapsed(d time.Duration)

SetElapsed sets elapsed duration.

func (*SubagentPanel) SetStatus

func (p *SubagentPanel) SetStatus(status SubagentStatus)

SetStatus updates panel status.

func (*SubagentPanel) SetThinking added in v2.4.0

func (p *SubagentPanel) SetThinking(text string)

SetThinking sets prose/thinking text rendered under the header.

func (*SubagentPanel) SetTokenCount

func (p *SubagentPanel) SetTokenCount(s string)

SetTokenCount sets token count text.

func (*SubagentPanel) SetTools

func (p *SubagentPanel) SetTools(tools []SubagentTool)

SetTools replaces tools and recomputes hidden count.

func (*SubagentPanel) Update

func (p *SubagentPanel) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles Bubble Tea messages.

func (*SubagentPanel) View

func (p *SubagentPanel) View() string

View renders the subagent panel.

type SubagentPanelOption

type SubagentPanelOption func(*SubagentPanel)

SubagentPanelOption configures a SubagentPanel.

func WithShimmerColors added in v2.10.0

func WithShimmerColors(baseHex, highlightHex string) SubagentPanelOption

WithShimmerColors configures the shimmer base and highlight hex colors.

func WithSubagentDesignTokens

func WithSubagentDesignTokens(tokens *design.DesignTokens) SubagentPanelOption

WithSubagentDesignTokens applies design-system tokens.

func WithSubagentModel

func WithSubagentModel(model string) SubagentPanelOption

WithSubagentModel sets the model name for footer rendering.

func WithSubagentSpinner added in v2.5.0

func WithSubagentSpinner(s spinner.Spinner) SubagentPanelOption

WithSubagentSpinner sets the spinner animation.

func WithSubagentTheme

func WithSubagentTheme(theme string) SubagentPanelOption

WithSubagentTheme applies a named design-system theme.

func WithSubagentThinking added in v2.4.0

func WithSubagentThinking(text string) SubagentPanelOption

WithSubagentThinking sets prose/thinking text rendered under the header.

func WithSubagentTitle

func WithSubagentTitle(title string) SubagentPanelOption

WithSubagentTitle sets the panel title.

func WithSubagentVisibleTools

func WithSubagentVisibleTools(n int) SubagentPanelOption

WithSubagentVisibleTools sets how many recent tools are shown.

func WithSubagentWidth

func WithSubagentWidth(width int) SubagentPanelOption

WithSubagentWidth sets the render width.

type SubagentStatus

type SubagentStatus int

SubagentStatus represents the subagent execution state.

const (
	SubagentRunning SubagentStatus = iota
	SubagentCompleted
	SubagentFailed
	SubagentAborted
)

type SubagentTool

type SubagentTool struct {
	Name         string
	Status       ToolStatus
	LinesAdded   int
	LinesRemoved int
}

SubagentTool represents one tool operation rendered in the panel.

type ThreadEntry

type ThreadEntry struct {
	ID        string
	Label     string
	Status    ThreadStatus
	Output    []string
	StartTime time.Time
	EndTime   time.Time
	Expanded  bool
	Spinner   Spinner
	// contains filtered or unexported fields
}

ThreadEntry represents a single thread row and its output.

type ThreadProgress

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

ThreadProgress displays concurrent thread/task progress.

func NewThreadProgress

func NewThreadProgress(opts ...ThreadProgressOption) *ThreadProgress

NewThreadProgress creates a new ThreadProgress component.

func (*ThreadProgress) AddThread

func (tp *ThreadProgress) AddThread(id, label string)

AddThread adds (or replaces) a thread by ID.

func (*ThreadProgress) AppendOutput

func (tp *ThreadProgress) AppendOutput(id string, line string)

AppendOutput appends one output line to a thread.

func (*ThreadProgress) Blur

func (tp *ThreadProgress) Blur()

Blur marks the component as unfocused.

func (*ThreadProgress) Focus

func (tp *ThreadProgress) Focus()

Focus marks the component as focused.

func (*ThreadProgress) Focused

func (tp *ThreadProgress) Focused() bool

Focused returns whether the component has focus.

func (*ThreadProgress) GetThread

func (tp *ThreadProgress) GetThread(id string) *ThreadEntry

GetThread returns a thread entry pointer by ID.

func (*ThreadProgress) Init

func (tp *ThreadProgress) Init() tea.Cmd

Init initializes the component.

func (*ThreadProgress) RemoveThread

func (tp *ThreadProgress) RemoveThread(id string)

RemoveThread removes a thread by ID.

func (*ThreadProgress) SetThreadExpanded

func (tp *ThreadProgress) SetThreadExpanded(id string, expanded bool)

SetThreadExpanded sets one thread's expanded state.

func (*ThreadProgress) StartThread

func (tp *ThreadProgress) StartThread(id string) tea.Cmd

StartThread marks a thread as running and returns animation cmd.

func (*ThreadProgress) Update

func (tp *ThreadProgress) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles Bubble Tea messages.

func (*ThreadProgress) UpdateThread

func (tp *ThreadProgress) UpdateThread(id string, status ThreadStatus)

UpdateThread updates thread status and timestamps.

func (*ThreadProgress) View

func (tp *ThreadProgress) View() string

View renders the thread progress UI.

type ThreadProgressOption

type ThreadProgressOption func(*ThreadProgress)

ThreadProgressOption configures a ThreadProgress component.

func WithMaxOutputLines

func WithMaxOutputLines(n int) ThreadProgressOption

WithMaxOutputLines sets max output lines shown when expanded (0 = show all).

func WithShowElapsed

func WithShowElapsed(show bool) ThreadProgressOption

WithShowElapsed toggles elapsed-time rendering.

func WithThreadIconSet

func WithThreadIconSet(is IconSet) ThreadProgressOption

WithThreadIconSet sets icons used for thread statuses.

func WithThreadProgressDesignTokens

func WithThreadProgressDesignTokens(tokens *design.DesignTokens) ThreadProgressOption

WithThreadProgressDesignTokens applies design-system colors.

func WithThreadProgressTheme

func WithThreadProgressTheme(theme string) ThreadProgressOption

WithThreadProgressTheme applies a named design-system theme.

func WithThreadSpinner

func WithThreadSpinner(s Spinner) ThreadProgressOption

WithThreadSpinner sets the default spinner used by running threads.

type ThreadStatus

type ThreadStatus int

ThreadStatus represents a thread execution state.

const (
	ThreadRunning ThreadStatus = iota
	ThreadCompleted
	ThreadFailed
	ThreadEscalated
)

type ToolStatus

type ToolStatus int

ToolStatus represents an individual tool execution state.

const (
	ToolRunning ToolStatus = iota
	ToolCompleted
	ToolFailed
)

Jump to

Keyboard shortcuts

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