/** 报价有效期:3 分钟 */ export const QUOTE_VALIDITY_MS = 3 * 60 * 1_000; /** processing 超时阈值:RPA job 360s + sweeper 60s 宽限期,避免误杀 active job */ export const RPA_QUOTE_PROCESSING_MS = 360 * 1_000; /** sweeper 宽限:须晚于 RPA_JOB_TIMEOUT_MS + lock,再标记 failed */ export const QUOTE_SWEEPER_GRACE_MS = 60 * 1_000; export const QUOTE_TIMEOUT_MS = RPA_QUOTE_PROCESSING_MS + QUOTE_SWEEPER_GRACE_MS; /** 超时扫描间隔:10 秒 */ export const SWEEPER_INTERVAL_MS = 10 * 1_000; /** 幂等记录 TTL:24 小时 */ export const IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1_000; /** quote_id 前缀 */ export const QUOTE_ID_PREFIX = "QTE"; /** 核心四档 service_level × rate_option 组合(最低验收) */ export const REQUIRED_QUOTE_TIERS = [ { service_level: "standard", rate_option: "lowest" }, { service_level: "standard", rate_option: "fastest" }, { service_level: "guaranteed", rate_option: "lowest" }, { service_level: "guaranteed", rate_option: "fastest" }, ] as const; import { compareMotherShipUiTierSortOrder } from "@/lib/constants/mothership-ui-tiers"; /** MotherShip UI 可能出现的档位(仅排序参考,不作过滤白名单) */ export const UI_QUOTE_TIER_SORT_ORDER = [ { service_level: "standard", rate_option: "lowest" }, { service_level: "standard", rate_option: "fastest" }, { service_level: "standard", rate_option: "bestValue" }, { service_level: "guaranteed", rate_option: "lowest" }, { service_level: "guaranteed", rate_option: "fastest" }, { service_level: "guaranteed", rate_option: "bestValue" }, { service_level: "dedicated", rate_option: "bestValue" }, ] as const; /** @deprecated 使用 UI_QUOTE_TIER_SORT_ORDER;MotherShip 返回档位数动态,禁止白名单过滤 */ export const UI_QUOTE_TIERS = UI_QUOTE_TIER_SORT_ORDER; /** 稳定排序:与 MotherShip 官网 Tab 顺序一致(含 dedicated 及未来 Tab) */ export function compareUiTierSortOrder( serviceLevelA: string, rateOptionA: string, serviceLevelB: string, rateOptionB: string, ): number { return compareMotherShipUiTierSortOrder( serviceLevelA, rateOptionA, serviceLevelB, rateOptionB, ); } /** MotherShip 可选档位(如最优性价比 bestValue) */ export const OPTIONAL_QUOTE_TIERS = [ { service_level: "standard", rate_option: "bestValue" }, { service_level: "guaranteed", rate_option: "bestValue" }, ] as const;