MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / BuildContextWindowSnapshot

Function BuildContextWindowSnapshot

ui/context_status.go:19–32  ·  view source on GitHub ↗
(cfg config.Config, state *agent.AgentState)

Source from the content-addressed store, hash-verified

17}
18
19func BuildContextWindowSnapshot(cfg config.Config, state *agent.AgentState) ContextWindowSnapshot {
20 used := 0
21 if state != nil {
22 used = agentContext.TokenCountWithEstimation(state.Messages)
23 if state.SystemPrompt != "" {
24 used += agentContext.RoughEstimate(state.SystemPrompt)
25 }
26 }
27 return ContextWindowSnapshot{
28 ModelName: cfg.APIModel,
29 UsedTokens: used,
30 LimitTokens: cfg.CompressionContextLimit(),
31 }
32}
33
34func FormatContextWindowStatus(model string, usedTokens, limitTokens int, width int) string {
35 if width <= 0 {

Calls 3

TokenCountWithEstimationFunction · 0.92
RoughEstimateFunction · 0.92