(text: &str)
| 2288 | } |
| 2289 | |
| 2290 | fn extract_braced_json_candidates(text: &str) -> Vec<String> { |
| 2291 | let chars: Vec<char> = text.chars().collect(); |
| 2292 | let mut out = Vec::new(); |
| 2293 | let mut starts = Vec::new(); |
| 2294 | let mut depth: usize = 0; |
| 2295 | let mut in_string = false; |
| 2296 | let mut escaped = false; |
| 2297 | |
| 2298 | for (index, ch) in chars.iter().enumerate() { |
| 2299 | if in_string { |
| 2300 | if escaped { |
| 2301 | escaped = false; |
| 2302 | continue; |
| 2303 | } |
| 2304 | |
| 2305 | if *ch == '\\' { |
| 2306 | escaped = true; |
| 2307 | continue; |
| 2308 | } |
| 2309 | |
| 2310 | if *ch == '"' { |
| 2311 | in_string = false; |
| 2312 | } |
| 2313 | |
| 2314 | continue; |
| 2315 | } |
| 2316 | |
| 2317 | if *ch == '"' { |
| 2318 | in_string = true; |
| 2319 | continue; |
| 2320 | } |
| 2321 | |
| 2322 | if *ch == '{' { |
| 2323 | if depth == 0 { |
| 2324 | starts.push(index); |
| 2325 | } |
| 2326 | depth = depth.saturating_add(1); |
| 2327 | continue; |
| 2328 | } |
| 2329 | |
| 2330 | if *ch == '}' { |
| 2331 | if depth == 0 { |
| 2332 | continue; |
| 2333 | } |
| 2334 | |
| 2335 | depth -= 1; |
| 2336 | if depth == 0 { |
| 2337 | if let Some(start) = starts.pop() { |
| 2338 | let candidate: String = chars[start..=index].iter().collect(); |
| 2339 | if candidate.contains("\"subagents\"") { |
| 2340 | out.push(candidate); |
| 2341 | } |
| 2342 | } |
| 2343 | } |
| 2344 | } |
| 2345 | } |
| 2346 | |
| 2347 | out |
no outgoing calls
no test coverage detected