| 1 | import type { DictKey } from "./i18n"; |
| 2 | |
| 3 | // Observe the remote's actual policy, without guessing a version or changing |
| 4 | // its settings. Notify at most once for each remote session. |
| 5 | export function createLegacyRemotePolicyNoticeTracker() { |
| 6 | const warned = new Set<string>(); |
| 7 | return (sessionKey: string, qualityFloor?: string, stopCause?: string, qualityPause = false): DictKey | undefined => { |
| 8 | const delivery = qualityFloor === "delivery"; |
| 9 | if (!delivery && stopCause !== "evaluator_unavailable" && !qualityPause) return; |
| 10 | if (warned.has(sessionKey)) return; |
| 11 | warned.add(sessionKey); |
| 12 | return delivery ? "remote.legacyDeliveryPolicy" : "remote.legacyExecutionPolicy"; |
| 13 | }; |
| 14 | } |
| 15 |