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

Method Compact

agent/query_engine.go:100–129  ·  view source on GitHub ↗
(state *AgentState)

Source from the content-addressed store, hash-verified

98 return
99 }
100 if q.CoreEngine != nil {
101 q.CoreEngine.ResolveSkillPermission(granted)
102 }
103}
104
105func (q *QueryEngine) ResolveMCPTrust(granted bool) {
106 if q.CoreEngine != nil {
107 q.CoreEngine.ResolveMCPTrust(granted)
108 }
109}
110
111func (q *QueryEngine) SkillRegistry() *skills.SkillRegistry {
112 if q == nil || q.CoreEngine == nil {
113 return nil
114 }
115 return q.CoreEngine.skillRegistry
116}
117
118func (q *QueryEngine) Compact(state *AgentState) (AgentState, agentContext.CompressionStats) {
119 if state == nil {
120 empty := NewAgentState()
121 return empty, *agentContext.DefaultCompressionStats()
122 }
123 state.Messages = StripTransientContextMessages(state.Messages)
124 currentTokens := agentContext.TokenCountWithEstimation(state.Messages)
125 pipeline := agentContext.DefaultContextPipeline()
126 pipeline.Config = q.Config
127 compressed, stats := pipeline.Compress(
128 state.Messages,
129 currentTokens,
130 state.SystemPrompt,
131 q.Config.CompressionContextLimit(),
132 q.Config.CompressionThreshold(),

Calls 10

DefaultCompressionStatsFunction · 0.92
TokenCountWithEstimationFunction · 0.92
DefaultContextPipelineFunction · 0.92
NewAgentStateFunction · 0.85
CompressMethod · 0.80
CompressionThresholdMethod · 0.80
ClearMethod · 0.80