MCPcopy Create free account
hub / github.com/AI45Lab/Code / contains_explicit_reference

Function contains_explicit_reference

core/src/agent/auto_delegation.rs:225–254  ·  view source on GitHub ↗
(prompt: &str, name: &str)

Source from the content-addressed store, hash-verified

223}
224
225fn contains_explicit_reference(prompt: &str, name: &str) -> bool {
226 let direct_mentions = [
227 format!("@{name}"),
228 format!("@\"{name}"),
229 format!("@'{name}"),
230 format!("{name} (agent)"),
231 ];
232 if direct_mentions
233 .iter()
234 .any(|needle| contains_bounded(prompt, needle))
235 {
236 return true;
237 }
238
239 [
240 format!("use {name} subagent"),
241 format!("use the {name} subagent"),
242 format!("use {name} agent"),
243 format!("use the {name} agent"),
244 format!("delegate to {name}"),
245 format!("ask {name}"),
246 format!("ask the {name}"),
247 format!("使用{name}"),
248 format!("使用 {name}"),
249 format!("用{name}"),
250 format!("用 {name}"),
251 ]
252 .iter()
253 .any(|needle| contains_bounded(prompt, needle))
254}
255
256fn contains_bounded(text: &str, needle: &str) -> bool {
257 text.match_indices(needle).any(|(idx, _)| {

Callers 2

explicit_agent_targetFunction · 0.85

Calls 1

contains_boundedFunction · 0.85

Tested by

no test coverage detected