Skip to main content

Module compress

Module compress 

Source

Functions§

compress_tool_result
Proxy compression funnel: routes a tool result to the right compressor.
compress_tool_result_for
compress_tool_result_gateway
compress_tool_result for the /v1/compress gateway contract (#702): identical compression, but a lossy result advertises its retrieval hash in LiteLLM’s regex-locked hash=<24hex> form, so a gateway running the headroom-guardrail CCR loop (BerriAI/litellm#31681) can inject its retrieve tool and resolve the original via GET /v1/retrieve/{hash}.
compress_tool_result_gateway_for
compress_tool_result_gateway_with_policy
Gateway variant of compress_tool_result_with_policy.
compress_tool_result_with_policy
Compresses a tool result under a task-aware policy.
shape_command_output
Shape the output of a host-native shell command whose exact command line is known (ctx_shape, fed by a host mod after the native tool ran). Unlike the wire funnel, the real command reaches the engine, so its command-gated policies (protected/verbatim commands, build/test guards, per-tool patterns) apply exactly as for ctx_shell. With a known exit_code the outcome-aware path runs (success compresses, failure keeps its diagnostics); without one the engine’s unknown-outcome guard applies. Lossy results carry the same deterministic CCR recovery handle (#482, #498).
shape_tool_output
compress_tool_result for a caller that is no request of this proxy: the output of a host-native tool handed in after it ran (ctx_shape, every tool whose command line is not known).