Documentation
¶
Overview ¶
Package status provides the animated run-status indicator that anchors the squad TUI footer. It owns a single line: a shimmering glyph encoding the run state, a bold label, optional detail text, an elapsed timer, and a trailing "esc to interrupt" affordance shown only while a run is alive.
The renderer is pure (Render takes a frame counter and elapsed duration, not the wall clock) so callers can golden-test the output without time flakiness. The bubble-tea Model wraps Render with a 32ms ticker.
Index ¶
- Constants
- func Render(s Snapshot) string
- type Model
- func (m Model) Init() tea.Cmd
- func (m *Model) SetDetail(detail string)
- func (m *Model) SetInterrupt(b bool)
- func (m *Model) SetLabel(label string)
- func (m *Model) SetState(s State)
- func (m *Model) SetWidth(w int)
- func (m Model) Snapshot() Snapshot
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- type Snapshot
- type State
- type TickMsg
Constants ¶
const TickInterval = 32 * time.Millisecond
TickInterval is the animation cadence (~31 FPS). Lifted from codex's status indicator — fast enough that the shimmer reads as motion, slow enough that a sleeping terminal doesn't burn CPU.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is a Bubble Tea wrapper around Render. It owns the animation tick and the start timestamp; callers update state/label/detail via setters.
func (*Model) SetInterrupt ¶
SetInterrupt toggles the "esc to interrupt" hint.
func (*Model) SetState ¶
SetState transitions the indicator. Starting from StateIdle or StateError into StateWorking resets the elapsed timer; transitioning to a terminal state (Completed/Error/Paused) freezes it.
type Snapshot ¶
type Snapshot struct {
State State
Label string // e.g. "Working", "Completed"
Detail string // e.g. "31/40 iter · 142 tools · $1.84/$5.00"
Elapsed time.Duration // since the run started
Frame uint64 // animation tick counter
Width int // terminal width for right-aligning the timer
Interrupt bool // show "esc to interrupt" affordance
}
Snapshot is the immutable input to Render. Keeping the render function pure (no time.Now, no internal state) makes it trivially testable.