From 9f910270ef5fa3876416e6e7474785465f3faf2a Mon Sep 17 00:00:00 2001 From: SaladDay Date: Mon, 3 Aug 2026 00:38:34 +0000 Subject: [PATCH] fix(pi): surface pending takeover state --- src/components/proxy/ProxyPanel.tsx | 5 +---- src/components/proxy/ProxyToggle.tsx | 20 ++++++++++++++++++-- src/i18n/locales/en.json | 2 ++ src/i18n/locales/ja.json | 2 ++ src/i18n/locales/zh-TW.json | 2 ++ src/i18n/locales/zh.json | 2 ++ src/types/proxy.ts | 1 + 7 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/components/proxy/ProxyPanel.tsx b/src/components/proxy/ProxyPanel.tsx index 6b84f2766..2242a5ab2 100644 --- a/src/components/proxy/ProxyPanel.tsx +++ b/src/components/proxy/ProxyPanel.tsx @@ -305,10 +305,7 @@ export function ProxyPanel({

{PROXY_APP_IDS.map((appType) => { - const isEnabled = - takeoverStatus?.[ - appType as keyof typeof takeoverStatus - ] ?? false; + const isEnabled = takeoverStatus?.[appType] ?? false; return (
{isPending ? ( + ) : piDegraded ? ( + ) : ( + {piDegraded && ( + + {t("proxy.takeover.degraded", { defaultValue: "Pending" })} + + )}
); } diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index bc52720b1..9f7db782b 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -2790,10 +2790,12 @@ "hint": "Select apps to route — once enabled, requests from that app will go through local routing", "enabled": "{{app}} routing enabled", "disabled": "{{app}} routing disabled", + "degraded": "Pending", "failed": "Failed to toggle routing: {{detail}}", "tooltip": { "active": "{{appLabel}} is routing - {{address}}:{{port}}\nSwitch provider for hot switching", "broken": "{{appLabel}} is routing, but routing service is not running", + "degraded": "{{appLabel}} routing is desired but currently degraded; CC Switch will retry it", "inactive": "Route {{appLabel}}'s requests through local routing" } }, diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 8651cd053..cf723cb00 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -2654,10 +2654,12 @@ "hint": "ルーティングするアプリを選択します。有効にすると、そのアプリのリクエストはローカルルーティング経由で転送されます", "enabled": "{{app}} ルーティング有効", "disabled": "{{app}} ルーティング無効", + "degraded": "復旧待ち", "failed": "ルーティングの切り替えに失敗しました: {{detail}}", "tooltip": { "active": "{{appLabel}} がルーティング中 - {{address}}:{{port}}\nホットスイッチングのためプロバイダを切り替え", "broken": "{{appLabel}} がルーティング中ですが、ルーティングサービスが実行されていません", + "degraded": "{{appLabel}} のルーティング要求は保持されていますが、現在は縮退状態です。CC Switch が再試行します", "inactive": "{{appLabel}} のリクエストをローカルルーティング経由でルーティング" } }, diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json index c64686b44..8bd7a461e 100644 --- a/src/i18n/locales/zh-TW.json +++ b/src/i18n/locales/zh-TW.json @@ -2655,10 +2655,12 @@ "hint": "選擇要路由的應用程式,啟用後該應用程式的請求將透過本地路由轉發", "enabled": "{{app}} 路由已啟用", "disabled": "{{app}} 路由已關閉", + "degraded": "等待復原", "failed": "切換路由狀態失敗:{{detail}}", "tooltip": { "active": "{{appLabel}} 路由中 - {{address}}:{{port}}\n切換該應用程式供應商為熱切換", "broken": "{{appLabel}} 路由中,但路由服務未執行", + "degraded": "{{appLabel}} 路由意圖已保留,但目前處於降級狀態;CC Switch 將繼續重試", "inactive": "路由 {{appLabel}} 的請求,讓該應用程式請求走本地路由" } }, diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 7f2f19bcc..533cd7a0a 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -2790,10 +2790,12 @@ "hint": "选择要路由的应用,启用后该应用的请求将通过本地路由转发", "enabled": "{{app}} 路由已启用", "disabled": "{{app}} 路由已关闭", + "degraded": "等待恢复", "failed": "切换路由状态失败: {{detail}}", "tooltip": { "active": "{{appLabel}} 路由中 - {{address}}:{{port}}\n切换该应用供应商为热切换", "broken": "{{appLabel}} 路由中,但路由服务未运行", + "degraded": "{{appLabel}} 路由意图已保留,但当前处于降级状态;CC Switch 将继续重试", "inactive": "路由 {{appLabel}} 的请求,让该应用请求走本地路由" } }, diff --git a/src/types/proxy.ts b/src/types/proxy.ts index b64a5c443..c3998dbcf 100644 --- a/src/types/proxy.ts +++ b/src/types/proxy.ts @@ -51,6 +51,7 @@ export interface ProxyTakeoverStatus { openclaw: boolean; hermes: boolean; pi: boolean; + pi_operational_state: "disabled" | "active" | "degraded"; } export interface ProviderHealth {