Documentation
¶
Overview ¶
Package renderfmt provides stateless formatting shared by mecatui renderers.
Index ¶
- func CacheHitRate(u client.Usage) float64
- func FormatDuration(ms int64) string
- func HumanizeBytes(n int64) string
- func HumanizeDuration(ms int64) string
- func HumanizeTokens(n int64) string
- func PctString(frac float64) string
- func RenderContextMeter(th theme.Theme, used, window int64) string
- func RenderContextMeterPlain(used, window int64) string
- func StopReasonLabel(stop string) (text, slot string)
- func TrivialTurn(msg client.TurnEndMsg) bool
- func TurnStatLine(msg client.TurnEndMsg) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheHitRate ¶
CacheHitRate returns the cache-read fraction of input tokens.
func FormatDuration ¶
FormatDuration renders an elapsed millisecond count compactly.
func HumanizeBytes ¶
HumanizeBytes renders a byte count compactly: bytes verbatim under 1 KB, then "N.N KB"/"N.N MB"/"N.N GB"/"N.N TB" with one decimal (trailing ".0" trimmed). The math is SI/decimal (1 KB = 1000 B, 1 MB = 1e6 B, …).
func HumanizeDuration ¶
HumanizeDuration renders a millisecond wall-clock duration compactly: sub-second as "Nms", under a minute as "N.Ns", else "Nm Ns". A non-positive duration (no clock) renders as "0ms".
func HumanizeTokens ¶
HumanizeTokens renders a token count compactly.
func RenderContextMeter ¶
RenderContextMeter formats context for a team roster subhead.
func RenderContextMeterPlain ¶
RenderContextMeterPlain is the ANSI-free representation required before generic roster wrapping; RenderContextMeter's styled bar must not be sanitized as raw text.
func StopReasonLabel ¶
StopReasonLabel maps a terminal stop reason to status text and theme style slot.
func TrivialTurn ¶
func TrivialTurn(msg client.TurnEndMsg) bool
TrivialTurn reports whether a turn's statistics are too negligible for scrollback.
func TurnStatLine ¶
func TurnStatLine(msg client.TurnEndMsg) string
TurnStatLine formats the inline per-turn model-exchange statistics.
Types ¶
This section is empty.