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

Function truncateAggregateContent

tools/budget.go:147–163  ·  view source on GitHub ↗
(content string, budget, resultCount int)

Source from the content-addressed store, hash-verified

145 head := firstChars(content, half)
146 tail := lastChars(content, half)
147 if maxChars == 0 {
148 tail = content
149 }
150 removed := charLen(content) - maxChars
151 return fmt.Sprintf("%s\n\n... [%d characters truncated] ...\n\n%s", head, removed, tail)
152}
153
154func truncateAggregateContent(content string, budget, resultCount int) string {
155 if budget <= 0 {
156 return ""
157 }
158 if charLen(content) <= budget {
159 return content
160 }
161 notice := fmt.Sprintf(
162 "\n\n... [Aggregate budget: %d characters truncated across %d concurrent results. If a <persisted-output> path appears above, use read_file to retrieve the full content.]",
163 charLen(content)-budget,
164 resultCount,
165 )
166 if charLen(notice) >= budget {

Callers 1

Calls 2

charLenFunction · 0.85
firstCharsFunction · 0.85

Tested by

no test coverage detected