pub fn detect_injection(text: &str) -> InjectionScoreExpand description
Detect prompt-injection signals in user text.
Iterates the weighted rule set; for each match the rule’s weight is added to
a running sum and its label is recorded. The aggregate score is the sum
clamped to [0.0, 1.0] (sum.min(1.0)), so a single typical signal
(weight 0.4–0.5) already scores at or above 0.4, two signals saturate
to 1.0, and it is exactly 0.0 when nothing matches. Matched labels are
deduplicated, preserving first-seen order.