Help us shape the future of Go! Take the 2026 Go Developer Survey

tui

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tui is the Bubbletea zoomable fleet tree: a live list of bubbles with status, blink pings from workers, and dive-in selection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Measured added in v0.2.0

func Measured(n int) *int

Measured wraps a count that really was measured, for FleetHealth's optional fields. Its whole job is to make "0 because I looked" impossible to confuse with "0 because nobody looked".

Types

type ClaudeUsage added in v0.2.0

type ClaudeUsage struct {
	OK      bool
	Windows []UsageWindow
}

ClaudeUsage is the account's Claude subscription usage (what `/usage` shows): the rolling 5-hour window, the weekly window, and the per-model (e.g. Fable) weekly window — each its own row in the dashboard.

type ClaudeUsageMsg added in v0.2.0

type ClaudeUsageMsg ClaudeUsage

ClaudeUsageMsg is pushed by the usage poller into the dashboard panel.

type FleetHealth added in v0.2.0

type FleetHealth struct {
	Hot        int // live sessions
	Total      int // all bubbles
	Suppressed int // notices suppressed (INV-1 rate limiting)
	Capped     int // notices capped (INV-1 flood ceiling actively firing)
	Inlined    int // deliveries made inline (vs via tool)
	Backlog    int // total unread messages across the fleet

	Stuck         *int // hot bubbles sitting wedged on unconsumed mail
	CrashLooping  *int // bubbles in relaunch backoff (or given up on)
	OverContext   *int // bubbles past the context-compaction threshold
	FailingChecks *int // registered checks whose last run failed or panicked
	WedgedChecks  *int // registered checks running far past their own interval

	UpdateReady   bool   // a newer binary has been installed than the daemon is running (restart to apply)
	ModelOverride string // the operator's fleet-wide `bubbles --model` override ("" = each bubble's own)
}

FleetHealth is the cost/health summary shown in the dashboard's FLEET block, fed from the costmeter, the stuck detector, the kernel's crash-loop state and the check registry via the existing resource sampler (no new poller).

The Phase 4 health counts are POINTERS on purpose. Their sources can each be absent — the stuck scan may not have completed a sweep yet, the context gauge may not have measured anything, there may be no check registry attached — and a zero would then read as "verified healthy" when it means "not measured". nil is the only honest encoding of that difference, and it is unforgeable: a producer that has nothing to say cannot accidentally say "0". Use Measured to fill one in.

type FleetHealthMsg added in v0.2.0

type FleetHealthMsg FleetHealth

FleetHealthMsg is pushed by the existing resource sampler into the dashboard.

type Headroom added in v0.2.0

type Headroom struct {
	On          bool
	Ready       bool    // proxy /stats is reachable
	SavingsPct  float64 // cumulative COST savings % (cache alignment + compression)
	SavedUSD    float64 // dollars saved (cache + compression)
	TokensSaved int64   // tokens removed by compression
}

Headroom is the token-compression proxy's state for the dashboard: whether it's enabled, whether the proxy is answering, and the cumulative token savings.

type HeadroomMsg added in v0.2.0

type HeadroomMsg Headroom

HeadroomMsg is pushed by the headroom stats poller into the dashboard panel.

type Model

type Model struct {
	BaseDir  string               // dir where `bubbles` was launched; bubble folders are downstream of it
	Marks    map[int]addr.Address // shared number-slots: digit binds (if free) or jumps (if bound)
	AllowAll *bool                // shared permission toggle (Ctrl+P): true => --dangerously-skip-permissions

	// OnPersist, if set, is called (on the tea goroutine, so it's race-free with
	// marks) whenever the registry changes, to save the fleet promptly — this is
	// what makes agent-driven spawn/edit/delete survive a daemon restart.
	OnPersist func()

	Flash string // transient notice (e.g. a failed dive), shown until the next key

	// Selected is set to the address the user dived into, then the program
	// quits so the caller (cmd/bubbles) can hand over the terminal.
	Selected addr.Address
	// contains filtered or unexported fields
}

Model is the fleet tree.

func New

func New(k *kernel.Kernel) Model

New builds a Model over a kernel. Root starts collapsed (minimized) and sits at the bottom, below the groups; expand it with → to reveal the fleet.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Refreshed added in v0.2.0

func (m Model) Refreshed() Model

Refreshed returns m ready to re-run after a dive or detach: rows rebuilt and selection/quit cleared, but the VIEW state (which nodes are expanded, group expansion, and the cursor position) preserved — so coming back from a bubble lands exactly where you left, not in the collapsed default. The cursor is clamped in case rows shrank (e.g. a bubble was deleted) while diving.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type PingMsg

type PingMsg struct {
	From    addr.Address
	Subject string
}

PingMsg is delivered (via tea.Program.Send) when a worker sends root a message.

type UsageMsg added in v0.2.0

type UsageMsg struct {
	TotalMem uint64
	TotalCPU float64 // summed percent across live sessions
	Hot      int     // number of live sessions
	Top      []UsageRow
}

UsageMsg is pushed periodically by the app's resource sampler and rendered in the top-right dashboard panel.

type UsageRow added in v0.2.0

type UsageRow struct {
	Name string
	Mem  uint64  // resident bytes
	CPU  float64 // percent of one core
}

UsageRow is one bubble's live resource use for the dashboard panel.

type UsageWindow added in v0.2.0

type UsageWindow struct {
	Label    string
	Pct      int
	Sev      string // normal | warning | high | critical
	ResetsAt time.Time
}

UsageWindow is one Claude usage limit: a label, a percent used, its severity, and when it resets.

Jump to

Keyboard shortcuts

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