MCPcopy Index your code
hub / github.com/docker/docker-agent / usageHasTokens

Function usageHasTokens

pkg/runtime/loop.go:1082–1090  ·  view source on GitHub ↗

usageHasTokens reports whether any billable tokens were recorded for a turn. Used to suppress the missing-price warning for empty/no-op turns.

(usage *chat.Usage)

Source from the content-addressed store, hash-verified

1080// usageHasTokens reports whether any billable tokens were recorded for a turn.
1081// Used to suppress the missing-price warning for empty/no-op turns.
1082func usageHasTokens(usage *chat.Usage) bool {
1083 if usage == nil {
1084 return false
1085 }
1086 return usage.InputTokens > 0 ||
1087 usage.OutputTokens > 0 ||
1088 usage.CachedInputTokens > 0 ||
1089 usage.CacheWriteTokens > 0
1090}
1091
1092// compactIfNeeded estimates the token impact of tool results added since
1093// messageCountBefore and triggers proactive compaction when the estimated

Callers 2

TestUsageHasTokensFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestUsageHasTokensFunction · 0.68