def should_escalate
import cswap-bend-cli@0.1.0.0/daemon/collect.bend as Collectimport Base
import cswap-bend-cli@0.1.0.0/policy/types.bend as T
import cswap-bend-cli@0.1.0.0/policy/usage.bend as PU
41# Fetch every candidate too when the active account's headroom is unknown (and
42# the token is not just expired on an idle Claude Code), or it is within 15
43# points of the threshold.
44def should_escalate(+m: Maybe<&2, T.Usage>, +now: Nat, +thr: U32, +ms: List<&2, String>) -> Bool:
45 match m:
46 case None{}:
47 False{}
48 case Some{u}:
49 escalate2(PU.headroom(u, now, ms), is_token_expired(u), thr)