Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TruncationResult ¶
type TruncationResult struct {
TruncatedContent string `json:"truncated_content"`
CacheKey string `json:"cache_key,omitempty"`
RecordPath string `json:"record_path,omitempty"`
TotalRecords int `json:"total_records,omitempty"`
TotalSize int `json:"total_size"`
CacheAvailable bool `json:"cache_available"`
}
TruncationResult represents the result of truncating a tool response
type Truncator ¶
type Truncator struct {
// contains filtered or unexported fields
}
Truncator handles truncating large tool responses
func NewTruncator ¶
NewTruncator creates a new truncator with the specified character limit
func (*Truncator) ShouldTruncate ¶
ShouldTruncate returns true if content should be truncated
func (*Truncator) SimpleTruncateBudget ¶ added in v0.51.0
SimpleTruncateBudget returns the number of content bytes the simpleTruncate path actually retains before appending its notice, or 0 when truncation is disabled (limit 0 = unlimited). Spec 084 (T031b): the TOON encoder's too-small-budget guard must match the truncator's REAL retained prefix, not the raw limit — an encoded TOON block is not valid JSON, so Truncate always falls into simpleTruncate for it, which keeps limit - messageSpace bytes (messageSpace = 200, or limit/2 when limit < 200). This mirrors simpleTruncate exactly; keep the two in sync.