vtcode_core/tools/registry/
history_facade.rs1use serde_json::Value;
4use std::time::Duration;
5
6use super::{ToolExecutionRecord, ToolRegistry, ToolTaskTelemetrySnapshot};
7
8impl ToolRegistry {
9 pub fn get_recent_tool_records(&self, count: usize) -> Vec<ToolExecutionRecord> {
11 self.execution_history.get_recent_records(count)
12 }
13
14 pub fn get_recent_tool_failures(&self, count: usize) -> Vec<ToolExecutionRecord> {
16 self.execution_history.get_recent_failures(count)
17 }
18
19 pub fn task_tool_telemetry_snapshot(
21 &self,
22 task_id: Option<&str>,
23 task_completed_successfully: Option<bool>,
24 ) -> ToolTaskTelemetrySnapshot {
25 self.execution_history
26 .task_telemetry_snapshot(task_id, task_completed_successfully)
27 }
28
29 pub fn find_recent_spooled_output(&self, tool_name: &str, args: &Value, max_age: Duration) -> Option<Value> {
31 self.execution_history.find_recent_spooled_result(tool_name, args, max_age)
32 }
33
34 pub fn find_recent_successful_output(&self, tool_name: &str, args: &Value, max_age: Duration) -> Option<Value> {
36 self.execution_history.find_recent_successful_result(tool_name, args, max_age)
37 }
38
39 pub fn find_recent_successful_by_read_target(
43 &self,
44 tool_name: &str,
45 args: &Value,
46 max_age: Duration,
47 ) -> Option<Value> {
48 self.execution_history
49 .find_recent_successful_by_read_target(tool_name, args, max_age)
50 }
51
52 pub fn find_recent_read_file_spool_progress(&self, path: &str, max_age: Duration) -> Option<(usize, usize)> {
56 self.execution_history.find_recent_read_file_spool_progress(path, max_age)
57 }
58
59 pub fn clear_execution_history(&self) {
61 self.execution_history.clear();
62 }
63
64 pub fn execution_history_len(&self) -> usize {
66 self.execution_history.len()
67 }
68}