Documentation
¶
Overview ¶
Package renderfmt provides stateless formatting shared by mecatui renderers.
Index ¶
- func ArgumentOrder(name string) []string
- 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 ToolIntent(name, arguments string) string
- func TrivialTurn(msg client.TurnEndMsg) bool
- func TurnStatLine(msg client.TurnEndMsg) string
- type ToolLine
- type ToolState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArgumentOrder ¶ added in v0.0.47
ArgumentOrder returns a caller-owned ordered copy of the known argument names. Unknown tools have no preferred order.
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 ToolIntent ¶ added in v0.0.47
ToolIntent derives a terminal-safe single-line description from a tool call's JSON arguments. Malformed arguments fall back to the tool name.
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 ¶
type ToolLine ¶ added in v0.0.47
type ToolLine struct {
// contains filtered or unexported fields
}
ToolLine is a terminal-safe single-line tool-call presentation.
func PresentToolLine ¶ added in v0.0.47
PresentToolLine derives the complete single-line status vocabulary from the observed lifecycle state. Surface renderers own theme lookup and layout.
func (ToolLine) Content ¶ added in v0.0.47
Content returns the text after the optional glyph, for surfaces that style the glyph separately.
func (ToolLine) Status ¶ added in v0.0.47
Status returns a textual lifecycle cue, empty for a successful settled call.
func (ToolLine) StatusStyle ¶ added in v0.0.47
StatusStyle returns the semantic theme slot for the status glyph and label.