Skip to main content

Module truncation_parts

Module truncation_parts 

Source
Expand description

The elision of one message, in either content shape.

Split out of super::truncation, which is at its file budget, and kept beside it because the rule is the same for both shapes: when a message’s text is over the threshold, every piece of it becomes the placeholder and the shape stays. A multi-part message keeps the parts that are not text (an image_url beside the tool output) where they were, and stays readable by the client that sent it in that shape.

Until this existed only the string form was elided and the array form was skipped, so a long array-form history was refused as over budget while every one of its messages was eligible. VS Code’s LLM gateway sends the array form on every message.

Functions§

elide 🔒
Replace this message’s text with the placeholder when it exceeds TOOL_CONTENT_THRESHOLD_CHARS, and say how many characters that reclaimed.