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

renderfmt

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package renderfmt provides stateless formatting shared by mecatui renderers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheHitRate

func CacheHitRate(u client.Usage) float64

CacheHitRate returns the cache-read fraction of input tokens.

func FormatDuration

func FormatDuration(ms int64) string

FormatDuration renders an elapsed millisecond count compactly.

func HumanizeBytes

func HumanizeBytes(n int64) string

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

func HumanizeDuration(ms int64) string

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

func HumanizeTokens(n int64) string

HumanizeTokens renders a token count compactly.

func PctString

func PctString(frac float64) string

PctString formats a fraction as a clamped integer percentage.

func RenderContextMeter

func RenderContextMeter(th theme.Theme, used, window int64) string

RenderContextMeter formats context for a team roster subhead.

func RenderContextMeterPlain

func RenderContextMeterPlain(used, window int64) string

RenderContextMeterPlain is the ANSI-free representation required before generic roster wrapping; RenderContextMeter's styled bar must not be sanitized as raw text.

func StopReasonLabel

func StopReasonLabel(stop string) (text, slot string)

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.

Jump to

Keyboard shortcuts

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