| 55 | /// Returns the new node's ID. |
| 56 | #[allow(clippy::too_many_arguments)] |
| 57 | pub fn append_tool_call( |
| 58 | &mut self, |
| 59 | tool_name: &str, |
| 60 | tool_call_id: Option<&str>, |
| 61 | tool_input: Option<&serde_json::Value>, |
| 62 | tool_output: Option<&str>, |
| 63 | status: Option<&str>, |
| 64 | duration_ms: Option<u64>, |
| 65 | timestamp: i64, |
| 66 | ) -> String { |
| 67 | let kind = classify_tool_call(tool_name, tool_input, tool_output, status); |
| 68 | let summary = summarize_tool_call(tool_name, kind, tool_input, tool_output, status); |
| 69 | |
| 70 | let mut node = |
| 71 | GraphNode::new(self.next_id(), kind, timestamp, summary).with_tool_name(tool_name); |
| 72 | |
| 73 | if let Some(id) = tool_call_id { |
| 74 | node = node.with_tool_call_id(id); |
| 75 | } |
| 76 | if let Some(ms) = duration_ms { |
| 77 | node = node.with_duration_ms(ms); |
| 78 | } |
| 79 | |
| 80 | // Attach detail based on kind |
| 81 | node.detail = build_tool_detail(kind, tool_name, tool_input, tool_output, status); |
| 82 | |
| 83 | let node_id = node.id.clone(); |
| 84 | |
| 85 | // Infer edges based on the classified kind |
| 86 | self.infer_edges(&node_id, kind); |
| 87 | |
| 88 | self.push_node(node); |
| 89 | node_id |
| 90 | } |
| 91 | |
| 92 | /// Append a reasoning/thinking node (chain-of-thought from the model). |
| 93 | /// |