Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions crates/zeph-core/src/agent/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,43 @@ impl<C: Channel, T: ToolExecutor> Agent<C, T> {
.await;
let (output, is_error) = match tool_result {
Ok(Some(out)) => {
if let Some(ref fs) = out.filter_stats {
let saved = fs.estimated_tokens_saved() as u64;
let raw = (fs.raw_chars / 4) as u64;
let confidence = fs.confidence;
let was_filtered = fs.filtered_chars < fs.raw_chars;
self.update_metrics(|m| {
m.filter_raw_tokens += raw;
m.filter_saved_tokens += saved;
m.filter_applications += 1;
m.filter_total_commands += 1;
if was_filtered {
m.filter_filtered_commands += 1;
}
if let Some(c) = confidence {
match c {
zeph_tools::FilterConfidence::Full => {
m.filter_confidence_full += 1;
}
zeph_tools::FilterConfidence::Partial => {
m.filter_confidence_partial += 1;
}
zeph_tools::FilterConfidence::Fallback => {
m.filter_confidence_fallback += 1;
}
}
}
});
}
if let Some(diff) = out.diff {
let _ = self.channel.send_diff(diff).await;
}
if let Some(ref fs) = out.filter_stats
&& fs.filtered_lines < fs.raw_lines
{
let stats_line = fs.format_inline(&tc.name);
self.channel.send(&stats_line).await?;
}
(out.summary, false)
}
Ok(None) => ("(no output)".to_owned(), false),
Expand Down
11 changes: 0 additions & 11 deletions crates/zeph-tools/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,6 @@ impl ShellExecutor {
};
self.log_audit(block, result, duration_ms).await;

if let Some(ref tx) = self.tool_event_tx {
let _ = tx.send(ToolEvent::Completed {
tool_name: "bash".to_owned(),
command: (*block).to_owned(),
output: out.clone(),
success: !out.contains("[error]"),
filter_stats: None,
diff: None,
});
}

let sanitized = sanitize_output(&out);
let mut per_block_stats: Option<FilterStats> = None;
let filtered = if let Some(ref registry) = self.output_filter_registry {
Expand Down
Loading