Merge pull request #21 from appalexhu/feat/proactive-auto-switch
feat: Proactive auto-switch before hitting rate limits (opt-in) Conflict in AppState.swift resolved by keeping both blocks of state: #22's usage-polling state (isRefreshing / usageFetchCursor / usageRetryNotBefore) and #21's auto-switch state. Purely additive, no behaviour from either PR was changed in the resolution. Two known interactions with #22 are NOT fixed here and are handled in a follow-up commit, so that each contributor's work stays intact: 1. evaluateAutoSwitch() runs at the end of refresh(), while #22's isRefreshing guard is still true, so the switchTo() -> refresh() that should update state after an automatic switch is skipped. 2. #21 treats a candidate with no usage sample as eligible. That was safe when every account was polled every cycle; with #22's round-robin a candidate can be unsampled or minutes stale, so an automatic switch can land on an account that is itself maxed out. Auto-switch is opt-in and defaults to off, so the default path is unaffected either way.
X
XueshiQiao committed
d044013e344ee5ba6f4f57618ace8e6c40d13080