/** * opencodeGeoBlock.ts — geo-block predicate for the opencode executor loop. * * Leaf module: zero internal imports (layering — errorClassifier pulls * accountFallback + registry + DB; this file must not). The 1010 check below * mirrors errorClassifier.isCloudflareFingerprintRejection semantics for the * tokens this path needs; any divergence is a bug — see the parity test. */ // "not available in your country" is the observed opencode RegionError phrasing // (2026-09-07 — app.log: "This model is not available in your country."); // siblings cover the same class, not the single incident. No bare "in your // country/region": location text without the full prefix is not a geo signal. const GEO_SIGNALS = [ "not available in your country", "not available in your region", "unsupported_country", "unsupported country", ]; // `regionerror` word-bounded: bare substring would match region_error / // region-error variants, which are unobserved phrasings (fail closed). const REGION_ERROR_REGEX = /(? lower.includes(signal)); } export function proxyKeyOf(proxy: { host: string; port: number } | null): string | null { if (!proxy) return null; return `${proxy.host}:${proxy.port}`; }