Documentation
¶
Overview ¶
Go Multi-Agent - Metrics Display
ChatCLI - CLI metrics
Copyright (c) 2024 Edilson Freitas
License: MIT
ChatCLI - CLI metrics
Copyright (c) 2024 Edilson Freitas
License: MIT
ChatCLI - Metrics Timer
Copyright (c) 2024 Edilson Freitas
License: MIT
Index ¶
- Constants
- func ClearLine() string
- func ClearLines(n int) string
- func FormatDispatchProgress(state *AgentProgressState, model string) string
- func FormatDuration(d time.Duration) string
- func FormatDurationShort(d time.Duration) string
- func FormatTimerComplete(d time.Duration) string
- func FormatTimerStatus(d time.Duration, model, msg string) string
- func FormatTurnInfo(t, m int, d time.Duration, stats *TurnStats) string
- func GetDotsAnimation() string
- func GetSpinnerFrame() string
- type AgentProgressState
- func (p *AgentProgressState) CompletedCount() int
- func (p *AgentProgressState) LineCount() int
- func (p *AgentProgressState) MarkCompleted(callID string, d time.Duration)
- func (p *AgentProgressState) MarkFailed(callID string, d time.Duration, errMsg string)
- func (p *AgentProgressState) MarkStarted(callID string)
- type AgentSlot
- type AgentSlotStatus
- type Spinner
- type Timer
- type TurnStats
Constants ¶
const ( ColorReset = "\033[0m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorRed = "\033[31m" ColorCyan = "\033[36m" ColorGray = "\033[90m" ColorBold = "\033[1m" )
Variables ¶
This section is empty.
Functions ¶
func ClearLines ¶ added in v1.68.2
ClearLines moves cursor up N lines and clears each one.
func FormatDispatchProgress ¶ added in v1.68.2
func FormatDispatchProgress(state *AgentProgressState, model string) string
FormatDispatchProgress renders a multi-line live progress display.
func FormatDuration ¶
func FormatDurationShort ¶
func FormatTimerComplete ¶
func GetDotsAnimation ¶ added in v1.49.0
func GetDotsAnimation() string
func GetSpinnerFrame ¶ added in v1.49.0
func GetSpinnerFrame() string
Types ¶
type AgentProgressState ¶ added in v1.68.2
type AgentProgressState struct {
Total int
Agents []AgentSlot
StartTime time.Time
// contains filtered or unexported fields
}
AgentProgressState tracks the live status of each agent in a dispatch batch. It is safe for concurrent use.
func NewAgentProgressState ¶ added in v1.68.2
func NewAgentProgressState(total int, agents []struct{ CallID, Agent, Task string }) *AgentProgressState
NewAgentProgressState creates a progress tracker for N agents.
func (*AgentProgressState) CompletedCount ¶ added in v1.68.2
func (p *AgentProgressState) CompletedCount() int
CompletedCount returns how many agents have finished (completed + failed).
func (*AgentProgressState) LineCount ¶ added in v1.68.2
func (p *AgentProgressState) LineCount() int
LineCount returns the number of display lines FormatDispatchProgress produces.
func (*AgentProgressState) MarkCompleted ¶ added in v1.68.2
func (p *AgentProgressState) MarkCompleted(callID string, d time.Duration)
MarkCompleted marks an agent as completed.
func (*AgentProgressState) MarkFailed ¶ added in v1.68.2
func (p *AgentProgressState) MarkFailed(callID string, d time.Duration, errMsg string)
MarkFailed marks an agent as failed.
func (*AgentProgressState) MarkStarted ¶ added in v1.68.2
func (p *AgentProgressState) MarkStarted(callID string)
MarkStarted marks an agent as running.
type AgentSlot ¶ added in v1.68.2
type AgentSlot struct {
CallID string
Agent string
Task string
Status AgentSlotStatus
Duration time.Duration
Error string
}
AgentSlot represents the current status of a single agent.
type AgentSlotStatus ¶ added in v1.68.2
type AgentSlotStatus int
AgentSlotStatus represents the lifecycle state of an agent slot.
const ( SlotPending AgentSlotStatus = iota SlotRunning SlotCompleted SlotFailed )
type Spinner ¶ added in v1.49.0
type Spinner struct {
// contains filtered or unexported fields
}
func NewSpinner ¶ added in v1.49.0
func NewSpinner() *Spinner
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer representa um cronometro de execução com display em tempo real
func (*Timer) Pause ¶ added in v1.64.0
func (t *Timer) Pause()
Pause temporarily suppresses the display output without stopping the timer. The elapsed time continues accumulating. Call Resume to restore display. If an onPause callback was registered, it runs under the mutex before pausing, allowing multi-line displays to be properly cleared.
func (*Timer) Resume ¶ added in v1.64.0
func (t *Timer) Resume()
Resume restores the display output after a Pause.
func (*Timer) SetOnPause ¶ added in v1.68.3
func (t *Timer) SetOnPause(f func())
SetOnPause registers a callback that runs (under mu) when Pause is called. Use this to clear multi-line displays before a security prompt takes over. The callback runs under the same mutex as displayFunc, so sharing closure variables (like a line counter) between them is safe without extra locking.