Skip to main content

Module message_truncation

Module message_truncation 

Source
Expand description

Message-level truncation: cap oversized text, thinking, and tool-result fields.

This layer shrinks individual messages without changing conversation shape.

Structs§

MessageTruncationConfig
Knobs for message-level truncation. None disables the corresponding budget.
MessageTruncationResult
Outcome of truncate_message.
TruncationCompressor
Brute-force Unicode truncation — keeps the longest prefix whose serialised JSON form fits in target_bytes.

Traits§

ContentCompressor
Pluggable strategy for compressing a single content string.

Functions§

truncate_message
Compress content fields inside message blocks so the total serialised size fits within the budget. Delegates to the configured ContentCompressor.