MCPcopy
hub / github.com/docker/docker-agent / SessionUsage

Function SessionUsage

pkg/runtime/event.go:399–407  ·  view source on GitHub ↗

SessionUsage builds a Usage from the session's current token counts, the model's context limit, and the session's own cost.

(sess *session.Session, contextLimit int64)

Source from the content-addressed store, hash-verified

397// SessionUsage builds a Usage from the session's current token counts, the
398// model's context limit, and the session's own cost.
399func SessionUsage(sess *session.Session, contextLimit int64) *Usage {
400 return &Usage{
401 InputTokens: sess.InputTokens,
402 OutputTokens: sess.OutputTokens,
403 ContextLength: sess.InputTokens + sess.OutputTokens,
404 ContextLimit: contextLimit,
405 Cost: sess.OwnCost(),
406 }
407}
408
409type SessionTitleEvent struct {
410 AgentContext

Callers 4

runTurnMethod · 0.85
EmitStartupInfoMethod · 0.85
compactWithReasonMethod · 0.85

Calls 1

OwnCostMethod · 0.80

Tested by

no test coverage detected