1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! A single tool invocation record with timing, outcome, and file changes.
use ;
use ;
use FileChange;
/// Telemetry record for one tool invocation.
///
/// Build one with [`ToolExecution::start`] at the top of your tool's
/// `execute()` impl, then finalize it with [`ToolExecution::complete`] /
/// [`ToolExecution::fail`] before returning.
///
/// # Examples
///
/// ```rust
/// use codetether_agent::telemetry::ToolExecution;
/// use serde_json::json;
///
/// let mut exec = ToolExecution::start("read", json!({"path": "foo.rs"}));
/// assert!(!exec.success);
/// exec.complete(true, 42);
/// assert!(exec.success);
/// assert_eq!(exec.duration_ms, 42);
/// ```