import type { ProviderHealth } from "../types.js"; export function allowedConcurrency(health: ProviderHealth, policyMaximum: number, now = Date.now()): number { if (health.cooldownUntil && Date.parse(health.cooldownUntil) > now) return 0; return Math.min(policyMaximum, Math.max(1, health.concurrency)); } export function staggerDelayMs(index: number): number { return 150 + (Math.max(0, index) % 2) * 150; }