MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / usageStatus

Method usageStatus

internal/ui/program.go:1165–1186  ·  view source on GitHub ↗

usageStatus formats the session's cumulative token usage for the status line. Empty when no calls have been made or no UsageFunc was wired.

()

Source from the content-addressed store, hash-verified

1163// usageStatus formats the session's cumulative token usage for the status
1164// line. Empty when no calls have been made or no UsageFunc was wired.
1165func (m harness) usageStatus() string {
1166 if m.usageFunc == nil {
1167 return ""
1168 }
1169 u, cost := m.usageFunc()
1170 if u.InputTokens == 0 && u.OutputTokens == 0 {
1171 return ""
1172 }
1173 parts := []string{
1174 fmt.Sprintf("%s in", formatThousands(u.InputTokens)),
1175 fmt.Sprintf("%s out", formatThousands(u.OutputTokens)),
1176 }
1177 if u.CacheCreationTokens > 0 || u.CacheReadTokens > 0 {
1178 parts = append(parts, fmt.Sprintf("cache %s/%s",
1179 formatThousands(u.CacheCreationTokens),
1180 formatThousands(u.CacheReadTokens)))
1181 }
1182 if cost >= 0 {
1183 parts = append(parts, fmt.Sprintf("~$%.4f", cost))
1184 }
1185 return strings.Join(parts, " · ")
1186}
1187
1188// formatThousands inserts thousands separators into a non-negative int.
1189// Mirrors the helper in commands.go; lives here too to avoid a UI → main

Callers 1

inputAreaMethod · 0.95

Calls 1

formatThousandsFunction · 0.70

Tested by

no test coverage detected