(content string, budget, resultCount int)
| 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 | |
| 154 | func 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 { |
no test coverage detected