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

Function BuildBudgetAttachmentSection

agentContext/builder.go:562–572  ·  view source on GitHub ↗
(name, heading, rawContent string, preserveSeparator *string, budget PromptAttachmentBudget)

Source from the content-addressed store, hash-verified

560 }
561 candidate := strings.Join(lines, "\n")
562 if budget.MaxChars <= 0 {
563 return "", strings.TrimSpace(candidate) != ""
564 }
565 if len([]rune(candidate)) <= budget.MaxChars {
566 return candidate, truncated
567 }
568 if preserveSeparator != nil && strings.Contains(candidate, *preserveSeparator) {
569 chunks := strings.Split(candidate, *preserveSeparator)
570 if chunks != nil && len(chunks) > 0 {
571 current := chunks[0]
572 if len([]rune(current)) > budget.MaxChars {
573 return firstRunes(current, budget.MaxChars), true
574 }
575 for _, chunk := range chunks[1:] {

Calls 2

TruncateAttachmentTextFunction · 0.85
BuildAttachmentBlockFunction · 0.85