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

Function buildProjectionText

agentContext/collapse.go:132–149  ·  view source on GitHub ↗
(projections []ProjectedExchange)

Source from the content-addressed store, hash-verified

130}
131
132func buildProjectionText(projections []ProjectedExchange) string {
133 lines := []string{"[Earlier conversation — summarized]\n"}
134 for i, proj := range projections {
135 parts := []string{fmt.Sprintf("Turn %d", i+1)}
136 if proj.Summary != "" {
137 parts = append(parts, fmt.Sprintf(" Summary: %s", proj.Summary))
138 }
139 if len(proj.ToolCalls) > 0 {
140 parts = append(parts, fmt.Sprintf(" Tools called: %s", strings.Join(proj.ToolCalls, ", ")))
141 }
142 if len(proj.KeyOutputs) > 0 {
143 outputs := strings.Join(proj.KeyOutputs[:MinInt(3, len(proj.KeyOutputs))], "; ")
144 parts = append(parts, fmt.Sprintf(" Key outputs: %s", outputs))
145 }
146 lines = append(lines, strings.Join(parts, " "))
147 }
148 return strings.Join(lines, "\n")
149}
150
151func CollapseMessages(messages []map[string]any, keepRecent int) []map[string]any {
152 if len(messages) == 0 {

Callers 2

CollapseMessagesFunction · 0.85
ApplyCollapseIfNeedFunction · 0.85

Calls 1

MinIntFunction · 0.85

Tested by

no test coverage detected