Documentation
¶
Overview ¶
Package progress shows what an AI request is doing.
It wraps the shared spinner so that provider tool events ("Running `atmos list stacks`…") update the spinner text, and so the spinner steps aside while an approval prompt owns the terminal.
Index ¶
- type Indicator
- type Progress
- func (p *Progress) Attach(target any) bool
- func (p *Progress) Handle(event approval.Event)
- func (p *Progress) OnInterrupt(handler func())
- func (p *Progress) Pause()
- func (p *Progress) PromptHooks() (before, after func())
- func (p *Progress) Resume()
- func (p *Progress) Start()
- func (p *Progress) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Indicator ¶
type Indicator interface {
Start()
Stop()
Update(message string)
SetInterruptHandler(handler func())
}
Indicator is the subset of the spinner used by Progress. It is satisfied by *spinner.Spinner.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress drives a spinner for the lifetime of one AI request. All methods are safe for concurrent use.
func (*Progress) Attach ¶
Attach subscribes Progress to a provider's events when the provider reports them. It reports whether the provider does.
func (*Progress) OnInterrupt ¶
func (p *Progress) OnInterrupt(handler func())
OnInterrupt registers a function that runs when the user presses ctrl+c while the spinner is showing. Call it before Start. Pausing for a prompt is not an interrupt.
func (*Progress) Pause ¶
func (p *Progress) Pause()
Pause hides the spinner so a prompt can use the terminal. It does nothing when the spinner is not showing.
func (*Progress) PromptHooks ¶
func (p *Progress) PromptHooks() (before, after func())
PromptHooks returns functions to call immediately before and after a prompt is shown.
func (*Progress) Resume ¶
func (p *Progress) Resume()
Resume shows the spinner again after Pause. It does nothing after Stop.