patronus-ark 0.1.17

Hybrid Rust security scanners for prompt injection, DLP, PII, and agentic tool risks.
Documentation
// SPDX-License-Identifier: GPL-3.0-only
use crate::L3SchedulerPolicy;

pub fn priority_index(policy: &L3SchedulerPolicy, category: &str, model: &str) -> usize {
    policy
        .priority
        .iter()
        .position(|item| item == category || item == model)
        .unwrap_or(policy.priority.len())
}

pub fn ttl_ms(policy: &L3SchedulerPolicy, category: &str, model: &str) -> u64 {
    policy
        .ttl_ms
        .get(model)
        .or_else(|| policy.ttl_ms.get(category))
        .copied()
        .unwrap_or(7_500)
}

pub fn estimated_cost_ms(policy: &L3SchedulerPolicy, category: &str, model: &str) -> u64 {
    policy
        .estimated_cost_ms
        .get(model)
        .or_else(|| policy.estimated_cost_ms.get(category))
        .copied()
        .unwrap_or(40)
        .max(1)
}