vtcode_core/tools/registry/
history_facade.rs1use serde_json::Value;
4use std::time::Duration;
5
6use super::{ToolExecutionRecord, ToolRegistry};
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 find_recent_spooled_output(
21 &self,
22 tool_name: &str,
23 args: &Value,
24 max_age: Duration,
25 ) -> Option<Value> {
26 self.execution_history
27 .find_recent_spooled_result(tool_name, args, max_age)
28 }
29
30 pub fn find_recent_successful_output(
32 &self,
33 tool_name: &str,
34 args: &Value,
35 max_age: Duration,
36 ) -> Option<Value> {
37 self.execution_history
38 .find_recent_successful_result(tool_name, args, max_age)
39 }
40
41 pub fn find_recent_read_file_spool_progress(
45 &self,
46 path: &str,
47 max_age: Duration,
48 ) -> Option<(usize, usize)> {
49 self.execution_history
50 .find_recent_read_file_spool_progress(path, max_age)
51 }
52
53 pub fn clear_execution_history(&self) {
55 self.execution_history.clear();
56 }
57
58 pub fn execution_history_len(&self) -> usize {
60 self.execution_history.len()
61 }
62}