Append a human gate node (permission requested). Returns the new node's ID.
(&mut self, reason: &str, timestamp: i64)
| 223 | /// |
| 224 | /// Returns the new node's ID. |
| 225 | pub fn append_human_gate(&mut self, reason: &str, timestamp: i64) -> String { |
| 226 | let summary = truncate_prompt(reason, 200); |
| 227 | let mut node = GraphNode::new(self.next_id(), NodeKind::HumanGate, timestamp, &summary); |
| 228 | node.detail = Some(serde_json::json!({ |
| 229 | "reason": reason, |
| 230 | "resolved": false, |
| 231 | })); |
| 232 | |
| 233 | let node_id = node.id.clone(); |
| 234 | |
| 235 | // Edge: last_node --blocked_by-→ gate |
| 236 | if let Some(ref prev) = self.last_node { |
| 237 | self.edges.push(GraphEdge::new( |
| 238 | prev.clone(), |
| 239 | node_id.clone(), |
| 240 | EdgeKind::BlockedBy, |
| 241 | )); |
| 242 | self.stats.edge_count += 1; |
| 243 | } |
| 244 | |
| 245 | self.pending_human_gate = Some(node_id.clone()); |
| 246 | |
| 247 | self.push_node(node); |
| 248 | node_id |
| 249 | } |
| 250 | |
| 251 | /// Append a patch proposal node (change recorded). |
| 252 | /// |