use crate::agent::{AgentEvent, AgentEventBus};
#[derive(Clone)]
pub struct ToolProgress {
events: AgentEventBus,
tool_call_id: String,
tool_name: String,
}
impl ToolProgress {
pub(crate) fn new(events: AgentEventBus, tool_call_id: String, tool_name: String) -> Self {
Self {
events,
tool_call_id,
tool_name,
}
}
pub fn emit(&self, progress: impl Into<String>) {
self.events.send(AgentEvent::ToolExecutionProgress {
id: self.tool_call_id.clone(),
name: self.tool_name.clone(),
progress: progress.into(),
});
}
}
impl std::fmt::Debug for ToolProgress {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ToolProgress")
.field("tool_call_id", &self.tool_call_id)
.field("tool_name", &self.tool_name)
.finish_non_exhaustive()
}
}