Skip to main content

pick_primary

Function pick_primary 

Source
pub fn pick_primary(snapshots: &[AgentSnapshot]) -> Option<&AgentSnapshot>
Expand description

Pick the primary candidate.

Two paths to “primary”:

  1. Recency dominance: top was used ≥ 4 h after the runner-up. Wins unconditionally — fresh activity beats accumulated volume.
  2. Score gap: top’s score is ≥ 1.5× the runner-up’s. Used when both candidates were touched recently and the formula has to break ties on volume.

Returns None when neither path applies (caller should ask the user) or when no candidate has a positive score.