Skip to main content

Module stages

Module stages 

Source

Structs§

CollapseArraysStage
For JSON content, cap arrays that are both long and large. An array with more than max_items elements whose compact JSON is over max_chars keeps leading elements up to max_chars (never fewer than max_items) and ends with a summary string element. Smaller arrays stay whole, so a search result or a page of records keeps every entry.
CondenseStage
For plain text / CLI output, collapse runs of repeated identical lines down to at most max_repeated_lines. Config options: max_repeated_lines (u32, default 3). Non-plain-text content passes through unchanged.
CustomTransformsStage
No-op stage that serves as the insertion point for plugin stages. Passes content through unchanged.
FlattenStage
For JSON content, flatten nested objects up to max_depth levels using dot-notation for flattened keys (e.g. {"a":{"b":1}} → {"a.b":1}). Config options: max_depth (u32, default 3). Non-JSON content passes through unchanged.
GitDiffFoldStage
For git diff output, fold consecutive unchanged context lines (lines starting with a space) into a compact [N unchanged lines] marker. This preserves all changed lines (+/-) and hunk headers (@@) while dramatically reducing noise from context lines.
KeepFieldsStage
For JSON content, keep only the specified top-level fields; drop all others. Config options: fields — array of field name strings. Non-JSON content passes through unchanged.
StripFieldsStage
For JSON content, remove specified fields by key name. Supports dot-notation for nested fields (e.g. “metadata.internal_id”). Config options: fields — array of field path strings. Non-JSON content passes through unchanged.
StripNullsStage
For JSON content, recursively remove all null-valued fields from objects. Arrays keep their null elements. Config options: enabled (bool).
TruncateStringsStage
For JSON content, truncate string values longer than max_length chars, appending “…” to indicate truncation. Config options: max_length (u32, default 500). Non-JSON content passes through unchanged.
WordAbbreviateStage
For plain text / CLI output, replace common long words with standard abbreviations (e.g. “implementation” → “impl”, “configuration” → “config”).

Constants§

DEFAULT_COLLAPSE_MAX_CHARS
About 8K tokens of compact JSON per array.

Traits§

CompressionStage
A single compression stage in the pipeline.

Functions§

abbreviate_words
Apply word abbreviation to a plain text string.