pub struct FilterStats {
pub raw_chars: usize,
pub filtered_chars: usize,
pub raw_lines: usize,
pub filtered_lines: usize,
pub confidence: Option<FilterConfidence>,
pub command: Option<String>,
pub kept_lines: Vec<usize>,
}Expand description
Cumulative filter statistics for a single tool execution.
Populated by ShellExecutor when output filters are configured.
Displayed in the TUI to show how much output was compacted before being sent to the LLM.
Fields§
§raw_chars: usizeRaw character count before filtering.
filtered_chars: usizeCharacter count after filtering.
raw_lines: usizeRaw line count before filtering.
filtered_lines: usizeLine count after filtering.
confidence: Option<FilterConfidence>Worst-case confidence across all applied filters.
command: Option<String>The shell command that produced this output, for display purposes.
kept_lines: Vec<usize>Zero-based line indices that were kept after filtering.
Implementations§
Source§impl FilterStats
impl FilterStats
Sourcepub fn savings_pct(&self) -> f64
pub fn savings_pct(&self) -> f64
Returns the percentage of characters removed by filtering.
Returns 0.0 when there was no raw output to filter.
Sourcepub fn estimated_tokens_saved(&self) -> usize
pub fn estimated_tokens_saved(&self) -> usize
Estimates the number of LLM tokens saved by filtering.
Uses the 4-chars-per-token approximation. Suitable for logging and metrics, not for billing or exact budget calculations.
Sourcepub fn format_inline(&self, tool_name: &str) -> String
pub fn format_inline(&self, tool_name: &str) -> String
Formats a one-line filter summary for log messages and TUI status.
§Example
use zeph_tools::FilterStats;
let stats = FilterStats {
raw_chars: 1000,
filtered_chars: 400,
raw_lines: 50,
filtered_lines: 20,
command: Some("cargo build".to_owned()),
..Default::default()
};
let summary = stats.format_inline("shell");
assert!(summary.contains("60.0% filtered"));Trait Implementations§
Source§impl Clone for FilterStats
impl Clone for FilterStats
Source§fn clone(&self) -> FilterStats
fn clone(&self) -> FilterStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more