Parent
Epic: #426
Summary
Add an OutputFilter trait and registry to zeph-tools that applies command-specific filtering between execute_bash() and ToolOutput construction.
Design
pub trait OutputFilter: Send + Sync {
/// Commands this filter handles (e.g., ["cargo test", "cargo nextest"])
fn matches(&self, command: &str) -> bool;
/// Filter raw output, return compressed version
fn filter(&self, command: &str, raw_output: &str, exit_code: i32) -> FilterResult;
}
pub struct FilterResult {
pub output: String,
pub raw_chars: usize,
pub filtered_chars: usize,
}
pub struct OutputFilterRegistry {
filters: Vec<Box<dyn OutputFilter>>,
}
Implementation
- Define
OutputFilter trait in crates/zeph-tools/src/filter.rs
- Add
OutputFilterRegistry with register() and apply(command, output, exit_code) methods
- Match logic: iterate filters, first
matches() wins; fallback = passthrough
- Integrate into
ShellExecutor::execute_inner() after execute_bash() returns
- Add config toggle:
[tools.filters] enabled = true
- Preserve full output in overflow file before filtering (tee pattern)
Acceptance Criteria
Parent
Epic: #426
Summary
Add an
OutputFiltertrait and registry tozeph-toolsthat applies command-specific filtering betweenexecute_bash()andToolOutputconstruction.Design
Implementation
OutputFiltertrait incrates/zeph-tools/src/filter.rsOutputFilterRegistrywithregister()andapply(command, output, exit_code)methodsmatches()wins; fallback = passthroughShellExecutor::execute_inner()afterexecute_bash()returns[tools.filters] enabled = trueAcceptance Criteria
OutputFiltertrait defined and documentedShellExecutor