MCPcopy Create free account
hub / github.com/GCWing/BitFun / build_display_map

Function build_display_map

src/crates/execution/agent-runtime/src/deep_research.rs:133–158  ·  view source on GitHub ↗
(
    body: &str,
    registry_status: &HashMap<String, String>,
)

Source from the content-addressed store, hash-verified

131}
132
133fn build_display_map(
134 body: &str,
135 registry_status: &HashMap<String, String>,
136) -> (HashMap<String, usize>, Vec<String>, usize) {
137 let mut display_map: HashMap<String, usize> = HashMap::new();
138 let mut order: Vec<String> = Vec::new();
139 let mut rejected_refs_in_body = 0usize;
140
141 for m in CIT_ID_RE.find_iter(body) {
142 let cit_id = m.as_str();
143 if display_map.contains_key(cit_id) {
144 continue;
145 }
146 if let Some(status) = registry_status.get(cit_id) {
147 if status == "REJECTED" {
148 rejected_refs_in_body += 1;
149 continue;
150 }
151 }
152 let n = order.len() + 1;
153 display_map.insert(cit_id.to_string(), n);
154 order.push(cit_id.to_string());
155 }
156
157 (display_map, order, rejected_refs_in_body)
158}
159
160fn renumber_body(body: &str, display_map: &HashMap<String, usize>) -> String {
161 let pass1 = BRACKETED_GROUP_RE.replace_all(body, |caps: &regex::Captures| {

Callers 1

renumber_research_reportFunction · 0.85

Calls 5

as_strMethod · 0.45
getMethod · 0.45
lenMethod · 0.45
insertMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected