Skip to main content

OutputCompressor

Trait OutputCompressor 

Source
pub trait OutputCompressor:
    Send
    + Sync
    + Debug {
    // Required methods
    fn compress<'a>(
        &'a self,
        tool_name: &'a ToolName,
        output: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, CompressionError>> + Send + 'a>>;
    fn name(&self) -> &'static str;
}
Expand description

Core abstraction for tool output compression.

Returning Ok(None) means “pass through unchanged”. Non-None Ok(Some(s)) replaces the tool output with s before it reaches the LLM context.

Implementors must be Send + Sync + Debug.

Required Methods§

Source

fn compress<'a>( &'a self, tool_name: &'a ToolName, output: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, CompressionError>> + Send + 'a>>

Attempt to compress output for the given tool_name.

Returns Ok(None) when no rule matched or compression is not applicable. Returns Ok(Some(compressed)) with the replacement string.

§Errors

Returns CompressionError on internal failure. Errors are logged and the raw output is used as fallback by CompressedExecutor.

Source

fn name(&self) -> &'static str

Stable identifier for this compressor (used in logs).

Implementors§