Append a human gate node (permission requested). Returns the new node's ID.
(&mut self, reason: &str, timestamp: i64)
| 172 | /// |
| 173 | /// Returns the new node's ID. |
| 174 | pub fn append_human_gate(&mut self, reason: &str, timestamp: i64) -> String { |
| 175 | let summary = truncate_prompt(reason, 200); |
| 176 | let mut node = GraphNode::new(self.next_id(), NodeKind::HumanGate, timestamp, &summary); |
| 177 | node.detail = Some(serde_json::json!({ |
| 178 | "reason": reason, |
| 179 | "resolved": false, |
| 180 | })); |
| 181 | |
| 182 | let node_id = node.id.clone(); |
| 183 | |
| 184 | // Edge: last_node --blocked_by-→ gate |
| 185 | if let Some(ref prev) = self.last_node { |
| 186 | self.edges.push(GraphEdge::new( |
| 187 | prev.clone(), |
| 188 | node_id.clone(), |
| 189 | EdgeKind::BlockedBy, |
| 190 | )); |
| 191 | self.stats.edge_count += 1; |
| 192 | } |
| 193 | |
| 194 | self.pending_human_gate = Some(node_id.clone()); |
| 195 | |
| 196 | self.push_node(node); |
| 197 | node_id |
| 198 | } |
| 199 | |
| 200 | /// Append a patch proposal node (change recorded). |
| 201 | /// |