Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(hetero): show the CLI status of the device a hetero agent runs on (#21931)

AmAzing-a68842036340
diff --git a/locales/ar/setting.json b/locales/ar/setting.json
index 57bde1893a9..7fa9b3b06dc 100644
--- a/locales/ar/setting.json
+++ b/locales/ar/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "أضف المستودعات إلى القائمة. قم بتبديل المستودع النشط من الشريط السفلي في عرض الدردشة.",
"heterogeneousStatus.cloud.repoLabel": "المستودعات",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo أو https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "السحابة",
"heterogeneousStatus.cloud.tokenCancel": "إلغاء",
"heterogeneousStatus.cloud.tokenChange": "تغيير",
"heterogeneousStatus.cloud.tokenDesc": "رمز OAuth الخاص بـ Claude Code. يتم حفظه بأمان في بيانات الاعتماد بمجرد إرساله. قم بتشغيل `claude setup-token` في الطرفية الخاصة بك لتوليد واحد.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "تحرير الأمر",
"heterogeneousStatus.command.label": "أمر التشغيل",
"heterogeneousStatus.command.placeholder": "اسم الأمر أو المسار المطلق",
- "heterogeneousStatus.desktop.tabLabel": "سطح المكتب",
"heterogeneousStatus.detecting": "يتم الآن اكتشاف واجهة سطر الأوامر لـ {{name}}...",
"heterogeneousStatus.plan.label": "الخطة",
"heterogeneousStatus.redetect": "إعادة الاكتشاف",
diff --git a/locales/bg-BG/setting.json b/locales/bg-BG/setting.json
index 41c6d667072..1fb0f43c2b0 100644
--- a/locales/bg-BG/setting.json
+++ b/locales/bg-BG/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Добавете хранилища към списъка. Превключете активното от долната лента в изгледа на чата.",
"heterogeneousStatus.cloud.repoLabel": "Хранилища",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo или https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Облак",
"heterogeneousStatus.cloud.tokenCancel": "Отказ",
"heterogeneousStatus.cloud.tokenChange": "Промяна",
"heterogeneousStatus.cloud.tokenDesc": "Вашият Claude Code OAuth токен. Съхранява се сигурно в Идентификационни данни след подаване. Изпълнете `claude setup-token` в терминала си, за да генерирате такъв.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Редактиране на команда",
"heterogeneousStatus.command.label": "Команда за стартиране",
"heterogeneousStatus.command.placeholder": "Име на команда или абсолютен път",
- "heterogeneousStatus.desktop.tabLabel": "Работен плот",
"heterogeneousStatus.detecting": "Откриване на {{name}} CLI...",
"heterogeneousStatus.plan.label": "План",
"heterogeneousStatus.redetect": "Повторно откриване",
diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json
index f1d3bc852ba..9ccfe65e809 100644
--- a/locales/de-DE/setting.json
+++ b/locales/de-DE/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Fügen Sie Repositories zur Liste hinzu. Wechseln Sie das aktive Repository über die untere Leiste in der Chat-Ansicht.",
"heterogeneousStatus.cloud.repoLabel": "Repositories",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo oder https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Cloud",
"heterogeneousStatus.cloud.tokenCancel": "Abbrechen",
"heterogeneousStatus.cloud.tokenChange": "Ändern",
"heterogeneousStatus.cloud.tokenDesc": "Ihr Claude Code OAuth-Token. Nach dem Absenden sicher in den Anmeldeinformationen gespeichert. Führen Sie `claude setup-token` in Ihrem Terminal aus, um einen zu generieren.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Befehl bearbeiten",
"heterogeneousStatus.command.label": "Startbefehl",
"heterogeneousStatus.command.placeholder": "Befehlname oder absoluter Pfad",
- "heterogeneousStatus.desktop.tabLabel": "Desktop",
"heterogeneousStatus.detecting": "{{name}} CLI wird erkannt...",
"heterogeneousStatus.plan.label": "Plan",
"heterogeneousStatus.redetect": "Erneut erkennen",
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 9044d6fadfb..4a319fb4ba9 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -895,6 +895,7 @@
"heterogeneousStatus.apiMode.smallFastModel": "Background model",
"heterogeneousStatus.apiMode.smallFastModelDesc": "Used for session titles, summaries, and other background work. Does not change the main conversation.",
"heterogeneousStatus.apiMode.smallFastModelPlaceholder": "Same as primary model",
+ "heterogeneousStatus.apiMode.useSubscription": "Use subscription",
"heterogeneousStatus.apiMode.workspaceUnsupported": "Not available for workspace agents",
"heterogeneousStatus.auth.api": "API",
"heterogeneousStatus.auth.label": "Auth Method",
@@ -908,7 +909,6 @@
"heterogeneousStatus.cloud.repoDesc": "Add repositories to the list. Switch the active one from the bottom bar in the chat view.",
"heterogeneousStatus.cloud.repoLabel": "Repositories",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo or https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Cloud",
"heterogeneousStatus.cloud.tokenCancel": "Cancel",
"heterogeneousStatus.cloud.tokenChange": "Change",
"heterogeneousStatus.cloud.tokenDesc": "Your Claude Code OAuth token. Saved securely to Credentials once submitted. Run `claude setup-token` in your terminal to generate one.",
@@ -928,8 +928,19 @@
"heterogeneousStatus.command.edit": "Edit command",
"heterogeneousStatus.command.label": "Launch Command",
"heterogeneousStatus.command.placeholder": "Command name or absolute path",
- "heterogeneousStatus.desktop.tabLabel": "Desktop",
"heterogeneousStatus.detecting": "Detecting {{name}} CLI...",
+ "heterogeneousStatus.device.afterInstall": "After installing, run `{{command}}` on that device once to sign in, then check again.",
+ "heterogeneousStatus.device.detecting": "Checking {{name}} CLI on {{device}}…",
+ "heterogeneousStatus.device.installDesc": "Run one of these commands in a terminal on {{device}}:",
+ "heterogeneousStatus.device.installTitle": "Install on {{device}}",
+ "heterogeneousStatus.device.label": "Device",
+ "heterogeneousStatus.device.missing": "The bound device is no longer available. Choose another execution environment above.",
+ "heterogeneousStatus.device.offline": "{{device}} is offline. Check again once it reconnects.",
+ "heterogeneousStatus.device.openDocs": "Installation guide",
+ "heterogeneousStatus.device.scanFailed": "Couldn’t check {{name}} CLI on {{device}}. Update LobeHub on that device and try again.",
+ "heterogeneousStatus.device.scanFailedTag": "Unknown",
+ "heterogeneousStatus.device.showDetails": "Show details",
+ "heterogeneousStatus.device.unavailable": "{{name}} CLI not found on {{device}}",
"heterogeneousStatus.plan.label": "Plan",
"heterogeneousStatus.redetect": "Re-detect",
"heterogeneousStatus.runtime.bundled": "dsh CLI",
@@ -937,6 +948,10 @@
"heterogeneousStatus.runtime.description": "Requires the DeepSeek Harness CLI: npm i -g @deepseek-ai/dsh",
"heterogeneousStatus.runtime.keyMissing": "Configure the DeepSeek provider API key",
"heterogeneousStatus.runtime.keyReady": "Using the DeepSeek provider API key",
+ "heterogeneousStatus.sandbox.desc": "{{name}} runs in the cloud sandbox. Nothing needs to be installed on your devices.",
+ "heterogeneousStatus.target.desc": "New topics run here. Existing topics stay on the device they ran on.",
+ "heterogeneousStatus.target.fixed": "This environment is fixed. Members can’t change it.",
+ "heterogeneousStatus.target.overridden": "Applies only to you. Other members keep the Agent default.",
"heterogeneousStatus.unavailable": "{{name}} CLI not found. Please install or configure it.",
"hotkey.clearBinding": "Clear binding",
"hotkey.conflicts": "Conflicts with existing hotkeys",
diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json
index e639fcd570e..cc30d883ea2 100644
--- a/locales/es-ES/setting.json
+++ b/locales/es-ES/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Agrega repositorios a la lista. Cambia el activo desde la barra inferior en la vista de chat.",
"heterogeneousStatus.cloud.repoLabel": "Repositorios",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo o https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Nube",
"heterogeneousStatus.cloud.tokenCancel": "Cancelar",
"heterogeneousStatus.cloud.tokenChange": "Cambiar",
"heterogeneousStatus.cloud.tokenDesc": "Tu token OAuth de Claude Code. Guardado de forma segura en Credenciales una vez enviado. Ejecuta `claude setup-token` en tu terminal para generar uno.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Editar comando",
"heterogeneousStatus.command.label": "Comando de inicio",
"heterogeneousStatus.command.placeholder": "Nombre del comando o ruta absoluta",
- "heterogeneousStatus.desktop.tabLabel": "Escritorio",
"heterogeneousStatus.detecting": "Detectando la CLI de {{name}}...",
"heterogeneousStatus.plan.label": "Plan",
"heterogeneousStatus.redetect": "Volver a detectar",
diff --git a/locales/fa-IR/setting.json b/locales/fa-IR/setting.json
index f008dd9a514..0696743da05 100644
--- a/locales/fa-IR/setting.json
+++ b/locales/fa-IR/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "مخازن را به لیست اضافه کنید. مخزن فعال را از نوار پایین در نمای چت تغییر دهید.",
"heterogeneousStatus.cloud.repoLabel": "مخازن",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo یا https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "ابر",
"heterogeneousStatus.cloud.tokenCancel": "لغو",
"heterogeneousStatus.cloud.tokenChange": "تغییر",
"heterogeneousStatus.cloud.tokenDesc": "توکن OAuth Claude Code شما. پس از ارسال، به‌صورت امن در اعتبارنامه‌ها ذخیره می‌شود. دستور `claude setup-token` را در ترمینال خود اجرا کنید تا یک توکن ایجاد کنید.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "ویرایش فرمان",
"heterogeneousStatus.command.label": "فرمان اجرا",
"heterogeneousStatus.command.placeholder": "نام فرمان یا مسیر کامل",
- "heterogeneousStatus.desktop.tabLabel": "دسکتاپ",
"heterogeneousStatus.detecting": "در حال شناسایی رابط خط فرمان {{name}} ...",
"heterogeneousStatus.plan.label": "طرح",
"heterogeneousStatus.redetect": "شناسایی دوباره",
diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json
index 1d6714e5a13..8b613e5084f 100644
--- a/locales/fr-FR/setting.json
+++ b/locales/fr-FR/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Ajoutez des dépôts à la liste. Changez celui actif depuis la barre inférieure dans la vue de chat.",
"heterogeneousStatus.cloud.repoLabel": "Dépôts",
"heterogeneousStatus.cloud.repoPlaceholder": "propriétaire/dépôt ou https://github.com/propriétaire/dépôt",
- "heterogeneousStatus.cloud.tabLabel": "Cloud",
"heterogeneousStatus.cloud.tokenCancel": "Annuler",
"heterogeneousStatus.cloud.tokenChange": "Modifier",
"heterogeneousStatus.cloud.tokenDesc": "Votre jeton OAuth Claude Code. Sauvegardé de manière sécurisée dans les autorisations une fois soumis. Exécutez `claude setup-token` dans votre terminal pour en générer un.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Modifier la commande",
"heterogeneousStatus.command.label": "Commande de lancement",
"heterogeneousStatus.command.placeholder": "Nom de la commande ou chemin absolu",
- "heterogeneousStatus.desktop.tabLabel": "Bureau",
"heterogeneousStatus.detecting": "Détection du CLI {{name}}…",
"heterogeneousStatus.plan.label": "Forfait",
"heterogeneousStatus.redetect": "Relancer la détection",
diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json
index 3a56223a86d..ad43cb316d7 100644
--- a/locales/it-IT/setting.json
+++ b/locales/it-IT/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Aggiungi repository all'elenco. Cambia quello attivo dalla barra inferiore nella vista chat.",
"heterogeneousStatus.cloud.repoLabel": "Repository",
"heterogeneousStatus.cloud.repoPlaceholder": "proprietario/repo o https://github.com/proprietario/repo",
- "heterogeneousStatus.cloud.tabLabel": "Cloud",
"heterogeneousStatus.cloud.tokenCancel": "Annulla",
"heterogeneousStatus.cloud.tokenChange": "Modifica",
"heterogeneousStatus.cloud.tokenDesc": "Il tuo token OAuth di Claude Code. Salvato in modo sicuro nelle Credenziali una volta inviato. Esegui `claude setup-token` nel tuo terminale per generarne uno.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Modifica comando",
"heterogeneousStatus.command.label": "Comando di avvio",
"heterogeneousStatus.command.placeholder": "Nome del comando o percorso assoluto",
- "heterogeneousStatus.desktop.tabLabel": "Desktop",
"heterogeneousStatus.detecting": "Rilevamento della CLI di {{name}}...",
"heterogeneousStatus.plan.label": "Piano",
"heterogeneousStatus.redetect": "Rileva di nuovo",
diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json
index e772295131d..3358befe1f3 100644
--- a/locales/ja-JP/setting.json
+++ b/locales/ja-JP/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "リポジトリをリストに追加します。チャットビューの下部バーからアクティブなリポジトリを切り替えられます。",
"heterogeneousStatus.cloud.repoLabel": "リポジトリ",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo または https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "クラウド",
"heterogeneousStatus.cloud.tokenCancel": "キャンセル",
"heterogeneousStatus.cloud.tokenChange": "変更",
"heterogeneousStatus.cloud.tokenDesc": "Claude Code OAuthトークンです。送信後、資格情報に安全に保存されます。ターミナルで`claude setup-token`を実行して生成してください。",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "コマンドを編集",
"heterogeneousStatus.command.label": "起動コマンド",
"heterogeneousStatus.command.placeholder": "コマンド名または絶対パス",
- "heterogeneousStatus.desktop.tabLabel": "デスクトップ",
"heterogeneousStatus.detecting": "{{name}} CLI を検出しています…",
"heterogeneousStatus.plan.label": "プラン",
"heterogeneousStatus.redetect": "再検出",
diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json
index 64c2660abe9..990ee3e3d4d 100644
--- a/locales/ko-KR/setting.json
+++ b/locales/ko-KR/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "저장소를 목록에 추가하세요. 채팅 뷰 하단 바에서 활성 저장소를 전환할 수 있습니다.",
"heterogeneousStatus.cloud.repoLabel": "저장소",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo 또는 https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "클라우드",
"heterogeneousStatus.cloud.tokenCancel": "취소",
"heterogeneousStatus.cloud.tokenChange": "변경",
"heterogeneousStatus.cloud.tokenDesc": "Claude Code OAuth 토큰입니다. 제출 후 자격 증명에 안전하게 저장됩니다. 터미널에서 `claude setup-token`을 실행하여 생성하세요.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "명령어 편집",
"heterogeneousStatus.command.label": "실행 명령어",
"heterogeneousStatus.command.placeholder": "명령어 이름 또는 절대 경로",
- "heterogeneousStatus.desktop.tabLabel": "데스크톱",
"heterogeneousStatus.detecting": "{{name}} CLI 감지 중...",
"heterogeneousStatus.plan.label": "플랜",
"heterogeneousStatus.redetect": "다시 감지",
diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json
index 3fae733928e..a3de358a90f 100644
--- a/locales/nl-NL/setting.json
+++ b/locales/nl-NL/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Voeg repositories toe aan de lijst. Wissel de actieve repository via de onderste balk in de chatweergave.",
"heterogeneousStatus.cloud.repoLabel": "Repositories",
"heterogeneousStatus.cloud.repoPlaceholder": "eigenaar/repo of https://github.com/eigenaar/repo",
- "heterogeneousStatus.cloud.tabLabel": "Cloud",
"heterogeneousStatus.cloud.tokenCancel": "Annuleren",
"heterogeneousStatus.cloud.tokenChange": "Wijzigen",
"heterogeneousStatus.cloud.tokenDesc": "Je Claude Code OAuth-token. Wordt veilig opgeslagen bij Referenties zodra het is ingediend. Voer `claude setup-token` uit in je terminal om er een te genereren.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Opdracht bewerken",
"heterogeneousStatus.command.label": "Opstartopdracht",
"heterogeneousStatus.command.placeholder": "Opdrachtnaam of absoluut pad",
- "heterogeneousStatus.desktop.tabLabel": "Desktop",
"heterogeneousStatus.detecting": "{{name}} CLI wordt gedetecteerd...",
"heterogeneousStatus.plan.label": "Plan",
"heterogeneousStatus.redetect": "Opnieuw detecteren",
diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json
index ba683e57a4d..2dd0bdfd85e 100644
--- a/locales/pl-PL/setting.json
+++ b/locales/pl-PL/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Dodaj repozytoria do listy. Zmień aktywne z dolnego paska w widoku czatu.",
"heterogeneousStatus.cloud.repoLabel": "Repozytoria",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo lub https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Chmura",
"heterogeneousStatus.cloud.tokenCancel": "Anuluj",
"heterogeneousStatus.cloud.tokenChange": "Zmień",
"heterogeneousStatus.cloud.tokenDesc": "Twój token OAuth Claude Code. Bezpiecznie zapisany w Poświadczeniach po przesłaniu. Uruchom `claude setup-token` w terminalu, aby go wygenerować.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Edytuj polecenie",
"heterogeneousStatus.command.label": "Polecenie startowe",
"heterogeneousStatus.command.placeholder": "Nazwa polecenia lub pełna ścieżka",
- "heterogeneousStatus.desktop.tabLabel": "Pulpit",
"heterogeneousStatus.detecting": "Wykrywanie CLI {{name}}...",
"heterogeneousStatus.plan.label": "Plan",
"heterogeneousStatus.redetect": "Wykryj ponownie",
diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json
index 278dcf0ce66..8b1a2170455 100644
--- a/locales/pt-BR/setting.json
+++ b/locales/pt-BR/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Adicione repositórios à lista. Alterne o ativo na barra inferior na visualização de chat.",
"heterogeneousStatus.cloud.repoLabel": "Repositórios",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo ou https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Nuvem",
"heterogeneousStatus.cloud.tokenCancel": "Cancelar",
"heterogeneousStatus.cloud.tokenChange": "Alterar",
"heterogeneousStatus.cloud.tokenDesc": "Seu token OAuth do Claude Code. Salvo com segurança nas Credenciais após o envio. Execute `claude setup-token` no seu terminal para gerar um.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Editar comando",
"heterogeneousStatus.command.label": "Comando de Execução",
"heterogeneousStatus.command.placeholder": "Nome do comando ou caminho absoluto",
- "heterogeneousStatus.desktop.tabLabel": "Desktop",
"heterogeneousStatus.detecting": "Detectando CLI de {{name}}...",
"heterogeneousStatus.plan.label": "Plano",
"heterogeneousStatus.redetect": "Detectar novamente",
diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json
index 5bec128693e..c869b520e6d 100644
--- a/locales/ru-RU/setting.json
+++ b/locales/ru-RU/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Добавьте репозитории в список. Переключайте активный репозиторий через нижнюю панель в режиме чата.",
"heterogeneousStatus.cloud.repoLabel": "Репозитории",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo или https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Облако",
"heterogeneousStatus.cloud.tokenCancel": "Отмена",
"heterogeneousStatus.cloud.tokenChange": "Изменить",
"heterogeneousStatus.cloud.tokenDesc": "Ваш OAuth токен Claude Code. Сохраняется безопасно в учетных данных после отправки. Запустите `claude setup-token` в вашем терминале, чтобы сгенерировать токен.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Редактировать команду",
"heterogeneousStatus.command.label": "Команда запуска",
"heterogeneousStatus.command.placeholder": "Название команды или абсолютный путь",
- "heterogeneousStatus.desktop.tabLabel": "Рабочий стол",
"heterogeneousStatus.detecting": "Обнаружение CLI {{name}}...",
"heterogeneousStatus.plan.label": "Тарифный план",
"heterogeneousStatus.redetect": "Повторное обнаружение",
diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json
index 8c89165ddd8..4da4d72f8f8 100644
--- a/locales/tr-TR/setting.json
+++ b/locales/tr-TR/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Depoları listeye ekleyin. Sohbet görünümündeki alt çubuktan aktif olanı değiştirin.",
"heterogeneousStatus.cloud.repoLabel": "Depolar",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo veya https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Bulut",
"heterogeneousStatus.cloud.tokenCancel": "İptal",
"heterogeneousStatus.cloud.tokenChange": "Değiştir",
"heterogeneousStatus.cloud.tokenDesc": "Claude Code OAuth jetonunuz. Gönderildikten sonra Kimlik Bilgilerine güvenli bir şekilde kaydedilir. Bir tane oluşturmak için terminalinizde `claude setup-token` komutunu çalıştırın.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Komutu düzenle",
"heterogeneousStatus.command.label": "Komut Başlat",
"heterogeneousStatus.command.placeholder": "Komut adı veya mutlak yol",
- "heterogeneousStatus.desktop.tabLabel": "Masaüstü",
"heterogeneousStatus.detecting": "{{name}} CLI algılanıyor...",
"heterogeneousStatus.plan.label": "Plan",
"heterogeneousStatus.redetect": "Yeniden algıla",
diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json
index 71bcf112d78..ff6820ddadb 100644
--- a/locales/vi-VN/setting.json
+++ b/locales/vi-VN/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "Thêm các kho lưu trữ vào danh sách. Chuyển đổi kho lưu trữ đang hoạt động từ thanh dưới cùng trong chế độ xem trò chuyện.",
"heterogeneousStatus.cloud.repoLabel": "Kho lưu trữ",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo hoặc https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "Đám mây",
"heterogeneousStatus.cloud.tokenCancel": "Hủy",
"heterogeneousStatus.cloud.tokenChange": "Thay đổi",
"heterogeneousStatus.cloud.tokenDesc": "Mã OAuth Claude Code của bạn. Được lưu trữ an toàn vào Thông tin xác thực sau khi gửi. Chạy `claude setup-token` trong terminal của bạn để tạo mã.",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "Chỉnh sửa lệnh",
"heterogeneousStatus.command.label": "Lệnh khởi chạy",
"heterogeneousStatus.command.placeholder": "Tên lệnh hoặc đường dẫn tuyệt đối",
- "heterogeneousStatus.desktop.tabLabel": "Máy tính để bàn",
"heterogeneousStatus.detecting": "Đang dò tìm CLI {{name}}...",
"heterogeneousStatus.plan.label": "Gói",
"heterogeneousStatus.redetect": "Dò lại",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index f159f2a10e3..3d0bdb160c8 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -895,6 +895,7 @@
"heterogeneousStatus.apiMode.smallFastModel": "后台模型",
"heterogeneousStatus.apiMode.smallFastModelDesc": "Claude Code 用来生成会话标题、摘要等后台任务,不影响主对话。",
"heterogeneousStatus.apiMode.smallFastModelPlaceholder": "不设置则与主模型相同",
+ "heterogeneousStatus.apiMode.useSubscription": "改用订阅认证",
"heterogeneousStatus.apiMode.workspaceUnsupported": "工作区 Agent 暂不支持服务商绑定",
"heterogeneousStatus.auth.api": "API",
"heterogeneousStatus.auth.label": "认证方式",
@@ -908,7 +909,6 @@
"heterogeneousStatus.cloud.repoDesc": "在此管理仓库列表,在对话视图底栏切换当前激活的仓库。",
"heterogeneousStatus.cloud.repoLabel": "代码仓库",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo 或 https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "云端",
"heterogeneousStatus.cloud.tokenCancel": "取消",
"heterogeneousStatus.cloud.tokenChange": "修改",
"heterogeneousStatus.cloud.tokenDesc": "你的 Claude Code OAuth Token,提交后将安全保存到凭证管理。在终端运行 `claude setup-token` 即可获取。",
@@ -928,8 +928,19 @@
"heterogeneousStatus.command.edit": "编辑指令",
"heterogeneousStatus.command.label": "启动指令",
"heterogeneousStatus.command.placeholder": "指令名称或绝对路径",
- "heterogeneousStatus.desktop.tabLabel": "桌面端",
"heterogeneousStatus.detecting": "正在检测 {{name}} CLI…",
+ "heterogeneousStatus.device.afterInstall": "安装完成后,在该设备上运行一次 `{{command}}` 完成登录,再点击重新检测。",
+ "heterogeneousStatus.device.detecting": "正在 {{device}} 上检测 {{name}} CLI…",
+ "heterogeneousStatus.device.installDesc": "在 {{device}} 的终端中运行以下任一命令:",
+ "heterogeneousStatus.device.installTitle": "在 {{device}} 上安装",
+ "heterogeneousStatus.device.label": "设备",
+ "heterogeneousStatus.device.missing": "绑定的设备已不可用,请在上方重新选择执行环境。",
+ "heterogeneousStatus.device.offline": "{{device}} 已离线,设备上线后再重新检测。",
+ "heterogeneousStatus.device.openDocs": "安装指南",
+ "heterogeneousStatus.device.scanFailed": "无法检测 {{device}} 上的 {{name}} CLI,请更新该设备上的 LobeHub 客户端后重试。",
+ "heterogeneousStatus.device.scanFailedTag": "无法检测",
+ "heterogeneousStatus.device.showDetails": "查看详情",
+ "heterogeneousStatus.device.unavailable": "未在 {{device}} 上检测到 {{name}} CLI",
"heterogeneousStatus.plan.label": "方案",
"heterogeneousStatus.redetect": "重新检测",
"heterogeneousStatus.runtime.bundled": "dsh CLI",
@@ -937,6 +948,10 @@
"heterogeneousStatus.runtime.description": "需要安装 DeepSeek Harness CLI:npm i -g @deepseek-ai/dsh",
"heterogeneousStatus.runtime.keyMissing": "请配置 DeepSeek 服务商 API Key",
"heterogeneousStatus.runtime.keyReady": "已复用 DeepSeek 服务商 API Key",
+ "heterogeneousStatus.sandbox.desc": "{{name}} 在云端沙箱中运行,无需在你的设备上安装。",
+ "heterogeneousStatus.target.desc": "新话题默认在这里运行,已有话题仍在原来的设备上运行。",
+ "heterogeneousStatus.target.fixed": "执行环境已固定,成员不能切换。",
+ "heterogeneousStatus.target.overridden": "仅对你生效,其他成员仍使用 Agent 的默认设置。",
"heterogeneousStatus.unavailable": "未检测到 {{name}} CLI,请先安装或配置",
"hotkey.clearBinding": "清除绑定",
"hotkey.conflicts": "与现有快捷键冲突",
diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json
index e714f82b73e..5c3b8f341e2 100644
--- a/locales/zh-TW/setting.json
+++ b/locales/zh-TW/setting.json
@@ -908,7 +908,6 @@
"heterogeneousStatus.cloud.repoDesc": "將存儲庫添加到列表中。可在聊天視圖底部欄切換活躍的存儲庫。",
"heterogeneousStatus.cloud.repoLabel": "存儲庫",
"heterogeneousStatus.cloud.repoPlaceholder": "owner/repo 或 https://github.com/owner/repo",
- "heterogeneousStatus.cloud.tabLabel": "雲端",
"heterogeneousStatus.cloud.tokenCancel": "取消",
"heterogeneousStatus.cloud.tokenChange": "更改",
"heterogeneousStatus.cloud.tokenDesc": "您的 Claude Code OAuth Token。提交後將安全保存到憑證中。在終端中運行 `claude setup-token` 以生成。",
@@ -928,7 +927,6 @@
"heterogeneousStatus.command.edit": "編輯指令",
"heterogeneousStatus.command.label": "啟動指令",
"heterogeneousStatus.command.placeholder": "指令名稱或絕對路徑",
- "heterogeneousStatus.desktop.tabLabel": "桌面",
"heterogeneousStatus.detecting": "正在偵測 {{name}} CLI...",
"heterogeneousStatus.plan.label": "方案",
"heterogeneousStatus.redetect": "重新偵測",
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index b136a0814bf..76cf81dba0c 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -489,6 +489,7 @@ export default {
'heterogeneousStatus.apiMode.smallFastModelPlaceholder': 'Same as primary model',
'heterogeneousStatus.apiMode.provider': 'Provider',
'heterogeneousStatus.apiMode.providerPlaceholder': 'Select a provider',
+ 'heterogeneousStatus.apiMode.useSubscription': 'Use subscription',
'heterogeneousStatus.apiMode.workspaceUnsupported': 'Not available for workspace agents',
'heterogeneousStatus.apiMode.serverDefault.checking': 'Checking deployment provider...',
'heterogeneousStatus.apiMode.serverDefault.disabled':
@@ -519,8 +520,7 @@ export default {
'heterogeneousStatus.runtime.keyMissing': 'Configure the DeepSeek provider API key',
'heterogeneousStatus.runtime.configure': 'Provider Settings',
- // Heterogeneous agent — Cloud tab (web environment config)
- 'heterogeneousStatus.cloud.tabLabel': 'Cloud',
+ // Heterogeneous agent — cloud sandbox config
'heterogeneousStatus.cloud.tokenLabel': 'Claude Code Token',
'heterogeneousStatus.cloud.tokenDesc':
'Your Claude Code OAuth token. Saved securely to Credentials once submitted. Run `claude setup-token` in your terminal to generate one.',
@@ -557,8 +557,30 @@ export default {
'heterogeneousStatus.cloud.repoPlaceholder': 'owner/repo or https://github.com/owner/repo',
'heterogeneousStatus.cloud.repoAdd': 'Add',
- // Heterogeneous agent — Desktop tab
- 'heterogeneousStatus.desktop.tabLabel': 'Desktop',
+ // Heterogeneous agent — execution environment and its bound device
+ 'heterogeneousStatus.device.afterInstall':
+ 'After installing, run `{{command}}` on that device once to sign in, then check again.',
+ 'heterogeneousStatus.device.detecting': 'Checking {{name}} CLI on {{device}}…',
+ 'heterogeneousStatus.device.installDesc':
+ 'Run one of these commands in a terminal on {{device}}:',
+ 'heterogeneousStatus.device.installTitle': 'Install on {{device}}',
+ 'heterogeneousStatus.device.label': 'Device',
+ 'heterogeneousStatus.device.missing':
+ 'The bound device is no longer available. Choose another execution environment above.',
+ 'heterogeneousStatus.device.offline': '{{device}} is offline. Check again once it reconnects.',
+ 'heterogeneousStatus.device.openDocs': 'Installation guide',
+ 'heterogeneousStatus.device.scanFailed':
+ 'Couldn’t check {{name}} CLI on {{device}}. Update LobeHub on that device and try again.',
+ 'heterogeneousStatus.device.scanFailedTag': 'Unknown',
+ 'heterogeneousStatus.device.showDetails': 'Show details',
+ 'heterogeneousStatus.device.unavailable': '{{name}} CLI not found on {{device}}',
+ 'heterogeneousStatus.sandbox.desc':
+ '{{name}} runs in the cloud sandbox. Nothing needs to be installed on your devices.',
+ 'heterogeneousStatus.target.desc':
+ 'New topics run here. Existing topics stay on the device they ran on.',
+ 'heterogeneousStatus.target.fixed': 'This environment is fixed. Members can’t change it.',
+ 'heterogeneousStatus.target.overridden':
+ 'Applies only to you. Other members keep the Agent default.',
// Connected agent profile config panel (openclaw / hermes)
'platformAgentConfig.title': 'Connection',
diff --git a/scripts/stylexMigration/legacyFiles.json b/scripts/stylexMigration/legacyFiles.json
index 93111019cd6..85c1a0b8341 100644
--- a/scripts/stylexMigration/legacyFiles.json
+++ b/scripts/stylexMigration/legacyFiles.json
@@ -1176,7 +1176,6 @@
"src/routes/(main)/agent/profile/features/ProfileEditor/CloudHeterogeneousConfig.tsx",
"src/routes/(main)/agent/profile/features/ProfileEditor/HeterogeneousAgentStatusCard.tsx",
"src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx",
- "src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.tsx",
"src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentPolicyCard.tsx",
"src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx",
"src/routes/(main)/community/(detail)/_layout/Header/style.ts",
diff --git a/src/features/ExecutionTargetPicker/index.tsx b/src/features/ExecutionTargetPicker/index.tsx
index b542272b82f..5adbd8ece11 100644
--- a/src/features/ExecutionTargetPicker/index.tsx
+++ b/src/features/ExecutionTargetPicker/index.tsx
@@ -1,7 +1,7 @@
'use client';
import type { DeviceExecutionTarget, DeviceListItem } from '@lobechat/types';
-import { createStaticStyles, cssVar, Icon } from '@lobehub/ui';
+import { createStaticStyles, cssVar, Flexbox, Icon } from '@lobehub/ui';
import { BoxIcon, LaptopIcon, MonitorOffIcon, SparklesIcon } from 'lucide-react';
import { memo } from 'react';
@@ -32,6 +32,84 @@ const styles = createStaticStyles(({ css }) => ({
gap: 6px;
align-items: center;
`,
+ option: css`
+ display: flex;
+ flex: 1;
+ gap: 8px;
+ align-items: center;
+
+ min-width: 0;
+ `,
+ optionDescription: css`
+ font-size: 12px;
+ line-height: 16px;
+ color: ${cssVar.colorTextDescription};
+ `,
+ optionIcon: css`
+ display: flex;
+ flex: none;
+ align-items: center;
+ justify-content: center;
+
+ width: 24px;
+ height: 24px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+
+ color: ${cssVar.colorText};
+
+ background: ${cssVar.colorBgElevated};
+ `,
+ optionName: css`
+ overflow: hidden;
+
+ font-size: 14px;
+ font-weight: 500;
+ line-height: 20px;
+ color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ selectItem: css`
+ min-height: 40px;
+ `,
+ selectPopup: css`
+ max-width: calc(100vw - 24px);
+ `,
+ selectValue: css`
+ > span {
+ display: flex;
+ flex: 1;
+ min-width: 0;
+ }
+ `,
+ triggerIcon: css`
+ display: flex;
+ flex: none;
+ align-items: center;
+ justify-content: center;
+
+ width: 20px;
+ height: 20px;
+
+ color: ${cssVar.colorTextSecondary};
+ `,
+ triggerLabel: css`
+ display: flex;
+ flex: 1;
+ gap: 8px;
+ align-items: center;
+
+ min-width: 0;
+ `,
+ triggerName: css`
+ overflow: hidden;
+ flex: 1;
+
+ text-align: start;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
}));
export const SHARED_EXECUTION_TARGETS = ['auto', 'device', 'none', 'sandbox'] as const;
@@ -207,3 +285,64 @@ export const ExecutionTargetDeviceStatus = memo<ExecutionTargetDeviceStatusProps
);
ExecutionTargetDeviceStatus.displayName = 'ExecutionTargetPicker.ExecutionTargetDeviceStatus';
+
+/** Select slots for execution-environment pickers that render {@link ExecutionTargetLabel}. */
+export const executionTargetSelectClassNames = {
+ item: styles.selectItem,
+ popup: styles.selectPopup,
+ value: styles.selectValue,
+};
+
+interface ExecutionTargetLabelProps {
+ compact?: boolean;
+ description: string;
+ device?: DeviceListItem;
+ label: string;
+ offlineLabel: string;
+ onlineLabel: string;
+ target: DeviceExecutionTarget;
+ unknownLabel: string;
+}
+
+export const ExecutionTargetLabel = memo<ExecutionTargetLabelProps>(
+ ({ compact, description, device, label, offlineLabel, onlineLabel, target, unknownLabel }) => {
+ const icon = <ExecutionTargetIcon devicePlatform={device?.platform} target={target} />;
+ const secondary = device ? (
+ <ExecutionTargetDeviceStatus
+ offlineLabel={offlineLabel}
+ online={device.online}
+ onlineLabel={onlineLabel}
+ unknown={device.onlineUnknown}
+ unknownLabel={unknownLabel}
+ />
+ ) : (
+ description
+ );
+
+ if (compact) {
+ return (
+ <span className={styles.triggerLabel}>
+ <span aria-hidden className={styles.triggerIcon}>
+ {icon}
+ </span>
+ <span className={styles.triggerName}>{label}</span>
+ {device ? <span className={styles.optionDescription}>{secondary}</span> : null}
+ </span>
+ );
+ }
+
+ return (
+ <span className={styles.option}>
+ <span aria-hidden className={styles.optionIcon}>
+ {icon}
+ </span>
+ <Flexbox flex={1} style={{ minWidth: 0 }}>
+ <span className={styles.optionName}>{label}</span>
+ <span className={styles.optionDescription}>{secondary}</span>
+ </Flexbox>
+ </span>
+ );
+ },
+);
+
+ExecutionTargetLabel.displayName = 'ExecutionTargetPicker.ExecutionTargetLabel';
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/ApiAuthLocalOnlyNotice.tsx b/src/features/HeterogeneousAgent/ExecutionEnvironment/ApiAuthLocalOnlyNotice.tsx
new file mode 100644
index 00000000000..c6ecbc37074
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/ApiAuthLocalOnlyNotice.tsx
@@ -0,0 +1,37 @@
+'use client';
+
+import { Alert, Button } from '@lobehub/ui';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+interface ApiAuthLocalOnlyNoticeProps {
+ /** Switches the agent back to subscription auth; omitted for read-only callers. */
+ onUseSubscription?: () => void;
+}
+
+/**
+ * API-mode auth runs only on this desktop. Shown beside a non-local
+ * environment, where dispatch would reject the run, with the way back to the
+ * subscription login that environment can use.
+ */
+export const ApiAuthLocalOnlyNotice = memo<ApiAuthLocalOnlyNoticeProps>(({ onUseSubscription }) => {
+ const { t } = useTranslation(['setting', 'chat']);
+
+ return (
+ <Alert
+ showIcon
+ description={t('chat:heteroAgent.apiMode.localOnly.desc')}
+ title={t('chat:heteroAgent.apiMode.localOnly.title')}
+ type={'warning'}
+ action={
+ onUseSubscription ? (
+ <Button size="small" onClick={onUseSubscription}>
+ {t('heterogeneousStatus.apiMode.useSubscription')}
+ </Button>
+ ) : undefined
+ }
+ />
+ );
+});
+
+ApiAuthLocalOnlyNotice.displayName = 'ApiAuthLocalOnlyNotice';
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/DeviceCliStatusCard.tsx b/src/features/HeterogeneousAgent/ExecutionEnvironment/DeviceCliStatusCard.tsx
new file mode 100644
index 00000000000..69277c19bdf
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/DeviceCliStatusCard.tsx
@@ -0,0 +1,282 @@
+'use client';
+
+import { isDesktop } from '@lobechat/const';
+import { getHeterogeneousAgentClientConfig } from '@lobechat/heterogeneous-agents/client';
+import type { HeterogeneousProviderConfig } from '@lobechat/types';
+import {
+ ActionIcon,
+ Button,
+ Flexbox,
+ Icon,
+ Popover,
+ Snippet,
+ Spin,
+ Tag,
+ Text,
+ Tooltip,
+} from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { ExternalLink, RefreshCw, XCircle } from 'lucide-react';
+import type { ReactNode } from 'react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { getPlatformLabel } from '@/features/DeviceManager/getDeviceIcon';
+import { ExecutionTargetDeviceStatus, ExecutionTargetIcon } from '@/features/ExecutionTargetPicker';
+import { electronSystemService } from '@/services/electron/system';
+
+import { type DeviceCliState, getDeviceInstallCommands } from './deviceCliStatus';
+import { useDeviceCliStatus } from './useDeviceCliStatus';
+
+const styles = stylex.create({
+ card: {
+ backgroundColor: cssVar.colorBgContainer,
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ borderStyle: 'solid',
+ borderWidth: 1,
+ paddingBlock: 16,
+ paddingInline: 16,
+ },
+ detailLabel: {
+ color: cssVar.colorTextTertiary,
+ flexShrink: 0,
+ fontSize: 12,
+ width: 96,
+ },
+ detailRow: {
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ borderBlockStartStyle: 'solid',
+ borderBlockStartWidth: 1,
+ minHeight: 48,
+ paddingBlock: 8,
+ },
+ deviceName: {
+ color: cssVar.colorText,
+ fontSize: 14,
+ minWidth: 0,
+ },
+ metaText: {
+ color: cssVar.colorTextSecondary,
+ fontSize: 13,
+ },
+ reasonDetails: {
+ maxHeight: 200,
+ overflow: 'auto',
+ whiteSpace: 'pre-wrap',
+ wordBreak: 'break-word',
+ },
+});
+
+interface DeviceCliStatusCardProps {
+ deviceId: string;
+ provider: HeterogeneousProviderConfig;
+}
+
+const openExternal = (url: string) => {
+ const opened = isDesktop
+ ? electronSystemService.openExternalLink(url)
+ : Promise.resolve(window.open(url, '_blank', 'noopener,noreferrer'));
+ opened.catch(console.error);
+};
+
+/**
+ * The agent CLI on the device a heterogeneous agent is bound to, probed over
+ * the device gateway rather than on whichever machine the profile is open.
+ *
+ * The local-only controls of the desktop card are absent on purpose: a device
+ * run resolves the CLI's default command itself and authenticates with the
+ * device's own login, so a custom command or API mode would not apply there
+ * (the host shows `ApiAuthLocalOnlyNotice` for an API-mode agent).
+ */
+export const DeviceCliStatusCard = memo<DeviceCliStatusCardProps>(({ deviceId, provider }) => {
+ const { t } = useTranslation(['setting', 'chat']);
+ const providerConfig = getHeterogeneousAgentClientConfig(provider.type);
+ const displayName = providerConfig?.title || provider.type;
+ const AgentIcon = providerConfig?.icon;
+ const install =
+ providerConfig && 'install' in providerConfig ? providerConfig.install : undefined;
+ const signInCommand =
+ providerConfig && 'auth' in providerConfig ? providerConfig.auth.signInCommand : undefined;
+
+ const { device, isRedetecting, redetect, state } = useDeviceCliStatus({
+ agentType: provider.type,
+ deviceId,
+ });
+
+ const deviceName =
+ device?.friendlyName || device?.hostname || t('chat:heteroAgent.executionTarget.unknownDevice');
+
+ const renderStatusTag = (current: DeviceCliState) => {
+ switch (current.status) {
+ case 'available': {
+ return <Tag color="success">{t('settingSystemTools.status.available')}</Tag>;
+ }
+ case 'unavailable':
+ case 'deviceMissing': {
+ return <Tag color="error">{t('settingSystemTools.status.unavailable')}</Tag>;
+ }
+ case 'offline': {
+ return <Tag>{t('chat:heteroAgent.executionTarget.offline')}</Tag>;
+ }
+ case 'scanFailed': {
+ return <Tag color="warning">{t('heterogeneousStatus.device.scanFailedTag')}</Tag>;
+ }
+ default: {
+ return <Tag>{t('settingSystemTools.detecting')}</Tag>;
+ }
+ }
+ };
+
+ const renderStatusMeta = (current: DeviceCliState): ReactNode => {
+ const params = { device: deviceName, name: displayName };
+ switch (current.status) {
+ case 'available': {
+ return current.version ? <Tag color="processing">{current.version}</Tag> : null;
+ }
+ case 'checking': {
+ return (
+ <Flexbox horizontal align="center" gap={8}>
+ <Spin size="small" style={{ opacity: 0.6 }} />
+ <Text {...stylex.props(styles.metaText)}>
+ {t('heterogeneousStatus.device.detecting', params)}
+ </Text>
+ </Flexbox>
+ );
+ }
+ case 'unavailable': {
+ return (
+ <Flexbox horizontal align="center" gap={8}>
+ <Icon color="var(--lobe-color-error)" icon={XCircle} size={16} />
+ <Text {...stylex.props(styles.metaText)}>
+ {t('heterogeneousStatus.device.unavailable', params)}
+ </Text>
+ </Flexbox>
+ );
+ }
+ case 'offline': {
+ return (
+ <Text {...stylex.props(styles.metaText)}>
+ {t('heterogeneousStatus.device.offline', params)}
+ </Text>
+ );
+ }
+ case 'deviceMissing': {
+ return (
+ <Text {...stylex.props(styles.metaText)}>{t('heterogeneousStatus.device.missing')}</Text>
+ );
+ }
+ case 'scanFailed': {
+ // One readable line; the raw probe reason (a gateway or device-client
+ // message) stays folded behind a click, as the device CLI update does.
+ return (
+ <Flexbox horizontal align="center" gap={4} wrap={'wrap'}>
+ <Text {...stylex.props(styles.metaText)}>
+ {t('heterogeneousStatus.device.scanFailed', params)}
+ </Text>
+ {current.reason && (
+ <Popover
+ placement={'bottomLeft'}
+ styles={{ content: { maxWidth: 'min(400px, 80vw)' } }}
+ trigger={'click'}
+ content={
+ <Text fontSize={12} {...stylex.props(styles.reasonDetails)}>
+ {current.reason}
+ </Text>
+ }
+ >
+ <Button size={'small'} type={'text'}>
+ {t('heterogeneousStatus.device.showDetails')}
+ </Button>
+ </Popover>
+ )}
+ </Flexbox>
+ );
+ }
+ }
+ };
+
+ const installCommands =
+ state.status === 'unavailable' && install
+ ? getDeviceInstallCommands(install.commands, device?.platform)
+ : [];
+ const platformLabel = getPlatformLabel(device?.platform, device?.architecture);
+
+ return (
+ <Flexbox {...stylex.props(styles.card)} gap={12}>
+ <Flexbox horizontal align="flex-start" gap={12} justify="space-between">
+ <Flexbox flex={1} gap={8} style={{ minWidth: 0 }}>
+ <Flexbox horizontal align="center" gap={8}>
+ {AgentIcon && <AgentIcon size={16} />}
+ <Text strong>{`${displayName} CLI`}</Text>
+ </Flexbox>
+ <Flexbox horizontal align="center" gap={8} wrap={'wrap'}>
+ {renderStatusTag(state)}
+ {renderStatusMeta(state)}
+ </Flexbox>
+ </Flexbox>
+ <Tooltip title={t('heterogeneousStatus.redetect')}>
+ <ActionIcon
+ aria-label={t('heterogeneousStatus.redetect')}
+ disabled={isRedetecting}
+ icon={RefreshCw}
+ loading={isRedetecting}
+ size="small"
+ onClick={redetect}
+ />
+ </Tooltip>
+ </Flexbox>
+
+ <Flexbox horizontal align="center" gap={16} {...stylex.props(styles.detailRow)}>
+ <Text {...stylex.props(styles.detailLabel)}>{t('heterogeneousStatus.device.label')}</Text>
+ <Flexbox horizontal align="center" gap={8} style={{ minWidth: 0 }} wrap={'wrap'}>
+ <ExecutionTargetIcon devicePlatform={device?.platform} target={'device'} />
+ <Text ellipsis {...stylex.props(styles.deviceName)}>
+ {deviceName}
+ </Text>
+ {platformLabel && <Text type={'secondary'}>{platformLabel}</Text>}
+ {device && (
+ <ExecutionTargetDeviceStatus
+ offlineLabel={t('chat:heteroAgent.executionTarget.offline')}
+ online={device.online}
+ onlineLabel={t('chat:heteroAgent.executionTarget.online')}
+ unknown={device.onlineUnknown}
+ unknownLabel={t('chat:heteroAgent.executionTarget.presenceChecking')}
+ />
+ )}
+ </Flexbox>
+ </Flexbox>
+
+ {installCommands.length > 0 && install && (
+ <Flexbox gap={8}>
+ <Text strong>{t('heterogeneousStatus.device.installTitle', { device: deviceName })}</Text>
+ <Text fontSize={12} type={'secondary'}>
+ {t('heterogeneousStatus.device.installDesc', { device: deviceName })}
+ </Text>
+ {installCommands.map((command) => (
+ <Snippet key={command} language={'bash'}>
+ {command}
+ </Snippet>
+ ))}
+ {signInCommand && (
+ <Text fontSize={12} type={'secondary'}>
+ {t('heterogeneousStatus.device.afterInstall', { command: signInCommand })}
+ </Text>
+ )}
+ <Flexbox horizontal justify="flex-end">
+ <Button
+ icon={<ExternalLink size={14} />}
+ size="small"
+ onClick={() => openExternal(install.docsUrl)}
+ >
+ {t('heterogeneousStatus.device.openDocs')}
+ </Button>
+ </Flexbox>
+ </Flexbox>
+ )}
+ </Flexbox>
+ );
+});
+
+DeviceCliStatusCard.displayName = 'DeviceCliStatusCard';
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/HeteroExecutionTargetSelect.tsx b/src/features/HeterogeneousAgent/ExecutionEnvironment/HeteroExecutionTargetSelect.tsx
new file mode 100644
index 00000000000..265500bdabd
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/HeteroExecutionTargetSelect.tsx
@@ -0,0 +1,269 @@
+'use client';
+
+import { isDesktop } from '@lobechat/const';
+import { HETEROGENEOUS_TYPE_LABELS } from '@lobechat/heterogeneous-agents';
+import type { DeviceExecutionTarget, DeviceListItem } from '@lobechat/types';
+import type { SelectOption, SelectOptions } from '@lobehub/ui';
+import { Select, Text } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import AsyncError from '@/components/AsyncError';
+import { useSelectExecutionTarget } from '@/features/ChatInput/hooks/useSelectExecutionTarget';
+import {
+ devicePoolForAgent,
+ ExecutionTargetLabel,
+ executionTargetSelectClassNames,
+ executionTargetValue,
+ groupExecutionTargetDevices,
+ parseExecutionTargetValue,
+} from '@/features/ExecutionTargetPicker';
+import { useAgentManagementAccess } from '@/features/ResourcePermission/useAgentManagementAccess';
+import { isHeterogeneousSandboxExecutionAvailable } from '@/helpers/executionTarget';
+import { useAgentStore } from '@/store/agent';
+import { useDeviceList } from '@/store/device';
+
+import {
+ getPrivateDeviceBlock,
+ getTargetHint,
+ getTargetSelectValue,
+} from './heteroTargetSelection';
+
+const styles = stylex.create({
+ select: {
+ maxWidth: 480,
+ width: '100%',
+ },
+});
+
+type FixedTarget = Extract<DeviceExecutionTarget, 'local' | 'sandbox'>;
+
+interface HeteroExecutionTargetSelectProps {
+ agentId: string;
+ deviceId?: string;
+ isOverridden: boolean;
+ isPending: boolean;
+ isSelectable: boolean;
+ providerType: string;
+ target: DeviceExecutionTarget;
+}
+
+/**
+ * Where a heterogeneous agent's new topics run, as the current caller will
+ * actually run them: the picker, the line saying whose pick applies, and the
+ * device-list error. The host supplies the surrounding card.
+ *
+ * Picks go through the same writer as the chat-input switcher, so a member
+ * changes only their own environment and a manager's pick replaces the shared
+ * default.
+ */
+export const HeteroExecutionTargetSelect = memo<HeteroExecutionTargetSelectProps>(
+ ({ agentId, deviceId, isOverridden, isPending, isSelectable, providerType, target }) => {
+ const { t } = useTranslation(['setting', 'chat']);
+ const agent = useAgentStore((s) => s.agentMap[agentId]);
+ const isWorkspaceAgent = !!agent?.workspaceId;
+ const { canManageAgent } = useAgentManagementAccess(agentId);
+ const selectExecutionTarget = useSelectExecutionTarget(agentId);
+ const supportsSandbox = isHeterogeneousSandboxExecutionAvailable(providerType);
+
+ const { data: devices, error, isConfirmed, isLoading, mutate } = useDeviceList();
+ const { personal, privateWorkspace, workspace } = groupExecutionTargetDevices(devices);
+ const privateDeviceBlock = getPrivateDeviceBlock({
+ canManageAgent,
+ isWorkspaceAgent,
+ selectionPolicy: agent?.agencyConfig?.executionTargetSelectionPolicy,
+ visibility: agent?.visibility,
+ });
+ const privateDeviceBlockedReason = privateDeviceBlock
+ ? t(
+ privateDeviceBlock === 'fixed'
+ ? 'settingAgent.devicePolicy.privateDeviceFixed'
+ : 'settingAgent.devicePolicy.privateDevicePublicAgent',
+ )
+ : undefined;
+
+ const fixedTargetLabels: Record<FixedTarget, { description: string; label: string }> = {
+ local: {
+ description: t('chat:heteroAgent.executionTarget.localDesc'),
+ label: t('chat:heteroAgent.executionTarget.local'),
+ },
+ sandbox: {
+ description: t(
+ supportsSandbox
+ ? 'chat:heteroAgent.executionTarget.sandboxDesc'
+ : 'chat:heteroAgent.executionTarget.sandboxUnsupported',
+ {
+ name: HETEROGENEOUS_TYPE_LABELS[providerType as keyof typeof HETEROGENEOUS_TYPE_LABELS],
+ },
+ ),
+ label: t('chat:heteroAgent.executionTarget.sandbox'),
+ },
+ };
+ const statusLabels = {
+ offlineLabel: t('chat:heteroAgent.executionTarget.offline'),
+ onlineLabel: t('chat:heteroAgent.executionTarget.online'),
+ unknownLabel: t('chat:heteroAgent.executionTarget.presenceChecking'),
+ };
+
+ const renderFixedTargetLabel = (fixedTarget: FixedTarget, compact = false) => (
+ <ExecutionTargetLabel
+ {...statusLabels}
+ compact={compact}
+ description={fixedTargetLabels[fixedTarget].description}
+ label={fixedTargetLabels[fixedTarget].label}
+ target={fixedTarget}
+ />
+ );
+ const renderDeviceLabel = (device: DeviceListItem, compact = false) => (
+ <ExecutionTargetLabel
+ {...statusLabels}
+ compact={compact}
+ description=""
+ device={device}
+ label={device.friendlyName || device.hostname || device.deviceId}
+ target={'device'}
+ />
+ );
+
+ // Until the server confirms the list, the stored copy may hold devices that
+ // were since removed (binding one points the agent at a machine it cannot
+ // reach): show its rows, but only a confirmed row can be picked.
+ const toDeviceOption = (device: DeviceListItem, blocked = false): SelectOption<string> => ({
+ disabled: !isConfirmed || blocked,
+ label: renderDeviceLabel(device),
+ title: device.friendlyName || device.hostname || device.deviceId,
+ value: executionTargetValue('device', device.deviceId),
+ });
+ const poolStatusOptions = (rows: DeviceListItem[], emptyLabel: string) =>
+ isLoading || (!isConfirmed && rows.length === 0)
+ ? [
+ {
+ disabled: true,
+ label: t('chat:heteroAgent.executionTarget.loading'),
+ value: 'status:loading',
+ },
+ ]
+ : rows.length === 0
+ ? [{ disabled: true, label: emptyLabel, value: 'status:empty' }]
+ : [];
+
+ const fixedTargetOptions: SelectOption<string>[] = [
+ ...(isDesktop
+ ? [
+ {
+ label: renderFixedTargetLabel('local'),
+ title: fixedTargetLabels.local.label,
+ value: executionTargetValue('local'),
+ },
+ ]
+ : []),
+ {
+ disabled: !supportsSandbox,
+ label: renderFixedTargetLabel('sandbox'),
+ title: fixedTargetLabels.sandbox.label,
+ value: executionTargetValue('sandbox'),
+ },
+ ];
+
+ // A personal agent lists the account's own devices flat, as the chat
+ // switcher does: Private / Workspace name workspace pools only.
+ const deviceOptions: SelectOptions<string> = error
+ ? []
+ : !isWorkspaceAgent
+ ? [
+ ...personal.map((device) => toDeviceOption(device)),
+ ...poolStatusOptions(personal, t('chat:heteroAgent.executionTarget.noDevices')),
+ ]
+ : [
+ // Only the caller's own private devices reach this list, so the
+ // group is simply absent for anyone without one.
+ ...(!isLoading && privateWorkspace.length > 0
+ ? [
+ {
+ label: t('chat:heteroAgent.executionTarget.personalGroup'),
+ options: [
+ ...privateWorkspace.map((device) =>
+ toDeviceOption(device, !!privateDeviceBlockedReason),
+ ),
+ ...(privateDeviceBlockedReason
+ ? [
+ {
+ disabled: true,
+ label: privateDeviceBlockedReason,
+ value: 'status:privateUnavailable',
+ },
+ ]
+ : []),
+ ],
+ },
+ ]
+ : []),
+ {
+ label: t('chat:heteroAgent.executionTarget.workspaceGroup'),
+ options: [
+ ...workspace.map((device) => toDeviceOption(device)),
+ ...poolStatusOptions(workspace, t('settingAgent.devicePolicy.noPublicDevice')),
+ ],
+ },
+ ];
+
+ const hint = getTargetHint({ isOverridden, isSelectable });
+
+ return (
+ <>
+ <Select
+ {...stylex.props(styles.select)}
+ classNames={executionTargetSelectClassNames}
+ disabled={isPending || !isSelectable}
+ optionRender={(option) => option.label}
+ options={[...fixedTargetOptions, ...deviceOptions]}
+ placeholder={t('settingAgent.devicePolicy.selectTarget')}
+ popupMatchSelectWidth={true}
+ value={getTargetSelectValue(target, deviceId)}
+ labelRender={(option) => {
+ if (typeof option.value !== 'string') return option.label;
+ const selection = parseExecutionTargetValue(option.value);
+ if (!selection) return option.label;
+ if (selection.target === 'local' || selection.target === 'sandbox')
+ return renderFixedTargetLabel(selection.target, true);
+ if (selection.target !== 'device') return option.label;
+
+ const device = devicePoolForAgent(devices, isWorkspaceAgent).find(
+ (item) => item.deviceId === selection.deviceId,
+ );
+ if (device) return renderDeviceLabel(device, true);
+
+ // The bound device is not in this caller's pool (removed, unshared,
+ // or the list is still loading): name that instead of a raw id.
+ return t(
+ isConfirmed
+ ? 'chat:heteroAgent.executionTarget.unknownDevice'
+ : 'chat:heteroAgent.executionTarget.loading',
+ );
+ }}
+ onChange={(next) => {
+ if (typeof next !== 'string') return;
+ const selection = parseExecutionTargetValue(next);
+ if (!selection) return;
+ void selectExecutionTarget(selection.target, selection.deviceId);
+ }}
+ />
+ <Text fontSize={12} type={'secondary'}>
+ {t(
+ hint === 'fixed'
+ ? 'heterogeneousStatus.target.fixed'
+ : hint === 'overridden'
+ ? 'heterogeneousStatus.target.overridden'
+ : 'heterogeneousStatus.target.desc',
+ )}
+ </Text>
+ {error ? (
+ <AsyncError error={error} variant={'inline'} onRetry={() => void mutate()} />
+ ) : null}
+ </>
+ );
+ },
+);
+
+HeteroExecutionTargetSelect.displayName = 'HeteroExecutionTargetSelect';
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/boundDevicePresence.test.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/boundDevicePresence.test.ts
similarity index 100%
rename from src/routes/(main)/agent/profile/features/ProfileEditor/boundDevicePresence.test.ts
rename to src/features/HeterogeneousAgent/ExecutionEnvironment/boundDevicePresence.test.ts
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/boundDevicePresence.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/boundDevicePresence.ts
similarity index 100%
rename from src/routes/(main)/agent/profile/features/ProfileEditor/boundDevicePresence.ts
rename to src/features/HeterogeneousAgent/ExecutionEnvironment/boundDevicePresence.ts
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/deviceCliStatus.test.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/deviceCliStatus.test.ts
new file mode 100644
index 00000000000..09ca7d056b0
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/deviceCliStatus.test.ts
@@ -0,0 +1,89 @@
+import { describe, expect, it } from 'vitest';
+
+import { getDeviceInstallCommands, resolveDeviceCliState } from './deviceCliStatus';
+
+const CLAUDE_INSTALL = [
+ 'curl -fsSL https://claude.ai/install.sh | bash',
+ 'brew install --cask claude-code',
+];
+
+describe('resolveDeviceCliState', () => {
+ it('reports the version an online device found', () => {
+ expect(
+ resolveDeviceCliState({
+ agentType: 'claude-code',
+ presence: 'online',
+ scan: { agents: { 'claude-code': { available: true, version: '2.1.0' } } },
+ }),
+ ).toEqual({ status: 'available', version: '2.1.0' });
+ });
+
+ it('reports the CLI missing only when the online device answered without it', () => {
+ expect(
+ resolveDeviceCliState({
+ agentType: 'claude-code',
+ presence: 'online',
+ scan: { agents: { 'claude-code': { available: false } } },
+ }),
+ ).toEqual({ status: 'unavailable' });
+ });
+
+ it('never calls an offline device "not installed"', () => {
+ expect(resolveDeviceCliState({ agentType: 'claude-code', presence: 'offline' })).toEqual({
+ status: 'offline',
+ });
+ });
+
+ it('waits while presence or the scan is unknown', () => {
+ expect(resolveDeviceCliState({ agentType: 'claude-code', presence: 'checking' })).toEqual({
+ status: 'checking',
+ });
+ expect(resolveDeviceCliState({ agentType: 'claude-code', presence: 'online' })).toEqual({
+ status: 'checking',
+ });
+ });
+
+ it('separates a failed scan from a missing CLI', () => {
+ expect(
+ resolveDeviceCliState({
+ agentType: 'claude-code',
+ presence: 'online',
+ scan: { agents: {}, error: 'Device tool call failed' },
+ }),
+ ).toEqual({ reason: 'Device tool call failed', status: 'scanFailed' });
+ expect(
+ resolveDeviceCliState({
+ agentType: 'claude-code',
+ presence: 'online',
+ scanError: new Error('timeout'),
+ }),
+ ).toEqual({ reason: 'timeout', status: 'scanFailed' });
+ });
+
+ it('treats a type an older device client did not probe as unknown', () => {
+ expect(
+ resolveDeviceCliState({
+ agentType: 'kimi-code',
+ presence: 'online',
+ scan: { agents: { 'claude-code': { available: true } } },
+ }),
+ ).toEqual({ status: 'scanFailed' });
+ });
+
+ it('flags a bound device that is gone from the confirmed list', () => {
+ expect(resolveDeviceCliState({ agentType: 'claude-code', presence: 'missing' })).toEqual({
+ status: 'deviceMissing',
+ });
+ });
+});
+
+describe('getDeviceInstallCommands', () => {
+ it('drops Homebrew for a Linux device', () => {
+ expect(getDeviceInstallCommands(CLAUDE_INSTALL, 'linux')).toEqual([CLAUDE_INSTALL[0]]);
+ });
+
+ it('keeps Homebrew for macOS and for an unknown platform', () => {
+ expect(getDeviceInstallCommands(CLAUDE_INSTALL, 'darwin')).toEqual(CLAUDE_INSTALL);
+ expect(getDeviceInstallCommands(CLAUDE_INSTALL, null)).toEqual(CLAUDE_INSTALL);
+ });
+});
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/deviceCliStatus.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/deviceCliStatus.ts
new file mode 100644
index 00000000000..4fe6d64110a
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/deviceCliStatus.ts
@@ -0,0 +1,65 @@
+import type { HeterogeneousAgentScanMap } from '@lobechat/heterogeneous-agents';
+
+import type { getBoundDevicePresence } from './boundDevicePresence';
+
+export type DeviceCliState =
+ | { status: 'available'; version?: string }
+ | { status: 'checking' }
+ | { status: 'deviceMissing' }
+ | { status: 'offline' }
+ | { reason?: string; status: 'scanFailed' }
+ | { status: 'unavailable' };
+
+interface ResolveDeviceCliStateParams {
+ agentType: string;
+ presence: ReturnType<typeof getBoundDevicePresence>;
+ scan?: { agents: HeterogeneousAgentScanMap; error?: string } | null;
+ scanError?: unknown;
+}
+
+/**
+ * What the profile can honestly say about an agent CLI on its bound device.
+ *
+ * Only an online device that answered the scan can report the CLI as missing.
+ * An offline device, a failed scan, or a device client too old to know this
+ * agent type all stay distinct from "not installed", so the profile never
+ * sends someone off to install a CLI that may already be there.
+ */
+export const resolveDeviceCliState = ({
+ agentType,
+ presence,
+ scan,
+ scanError,
+}: ResolveDeviceCliStateParams): DeviceCliState => {
+ if (presence === 'none' || presence === 'missing') return { status: 'deviceMissing' };
+ if (presence === 'checking') return { status: 'checking' };
+ if (presence === 'offline') return { status: 'offline' };
+
+ const failure = scanError
+ ? scanError instanceof Error
+ ? scanError.message
+ : String(scanError)
+ : scan?.error;
+ if (failure) return { reason: failure, status: 'scanFailed' };
+ if (!scan) return { status: 'checking' };
+
+ const entry = scan.agents[agentType as keyof HeterogeneousAgentScanMap];
+ // Older device clients leave out types they predate: no answer, not "missing".
+ if (!entry) return { status: 'scanFailed' };
+
+ return entry.available
+ ? { status: 'available', version: entry.version }
+ : { status: 'unavailable' };
+};
+
+/**
+ * Install commands that can run on the device's OS. Homebrew is offered as the
+ * macOS alternative, so it is dropped for a known non-macOS device.
+ */
+export const getDeviceInstallCommands = (
+ commands: readonly string[],
+ platform: string | null | undefined,
+): string[] =>
+ platform && platform !== 'darwin'
+ ? commands.filter((command) => !command.trimStart().startsWith('brew '))
+ : [...commands];
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroProfilePanel.test.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroProfilePanel.test.ts
new file mode 100644
index 00000000000..851d770a5c1
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroProfilePanel.test.ts
@@ -0,0 +1,54 @@
+import { describe, expect, it } from 'vitest';
+
+import { resolveHeteroProfilePanel } from './heteroProfilePanel';
+
+describe('resolveHeteroProfilePanel', () => {
+ it('describes the bound device for an agent connected from a remote device', () => {
+ // An agent created from a remote device is stored as `device` + that
+ // device id; the profile must probe it, not the desktop it is open on.
+ expect(
+ resolveHeteroProfilePanel({
+ deviceId: 'device-us-1',
+ providerType: 'claude-code',
+ target: 'device',
+ }),
+ ).toEqual({ deviceId: 'device-us-1', kind: 'device' });
+ });
+
+ it('probes this desktop only for a local target', () => {
+ expect(resolveHeteroProfilePanel({ providerType: 'codex', target: 'local' })).toEqual({
+ kind: 'local',
+ });
+ });
+
+ it('shows the cloud config for a Claude Code sandbox target', () => {
+ expect(resolveHeteroProfilePanel({ providerType: 'claude-code', target: 'sandbox' })).toEqual({
+ kind: 'cloud',
+ });
+ });
+
+ it('shows the plain sandbox panel for providers without cloud config', () => {
+ expect(resolveHeteroProfilePanel({ providerType: 'codex', target: 'sandbox' })).toEqual({
+ kind: 'sandbox',
+ });
+ });
+
+ it('waits for a pick when no device is bound or no target is chosen', () => {
+ expect(resolveHeteroProfilePanel({ providerType: 'claude-code', target: 'device' })).toEqual({
+ kind: 'pending',
+ });
+ expect(resolveHeteroProfilePanel({ providerType: 'opencode', target: 'none' })).toEqual({
+ kind: 'pending',
+ });
+ });
+
+ it('keeps bundled runtimes on their runtime panel', () => {
+ expect(
+ resolveHeteroProfilePanel({
+ deviceId: 'device-us-1',
+ providerType: 'deepseek-harness',
+ target: 'device',
+ }),
+ ).toEqual({ kind: 'runtime' });
+ });
+});
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroProfilePanel.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroProfilePanel.ts
new file mode 100644
index 00000000000..9526db884eb
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroProfilePanel.ts
@@ -0,0 +1,51 @@
+import { isLocalRuntimeHeterogeneousType } from '@lobechat/heterogeneous-agents';
+import type { DeviceExecutionTarget } from '@lobechat/types';
+
+export type HeteroProfilePanel =
+ /** Claude Code's cloud sandbox: token, GitHub credential and repositories. */
+ | { kind: 'cloud' }
+ /** The CLI on a gateway-routed device, probed through the device gateway. */
+ | { deviceId: string; kind: 'device' }
+ /** The CLI on this desktop, probed over Electron IPC. */
+ | { kind: 'local' }
+ /** No environment to describe yet: the picker asks for one. */
+ | { kind: 'pending' }
+ /** A bundled runtime with nothing installed per machine. */
+ | { kind: 'runtime' }
+ /** A cloud sandbox run with nothing to configure here. */
+ | { kind: 'sandbox' };
+
+/**
+ * Which configuration panel a heterogeneous agent's profile shows.
+ *
+ * Decided by where the agent's new topics run — never by the client the profile
+ * is open on. A desktop showing a device-bound agent must describe that device,
+ * not probe its own PATH.
+ */
+export const resolveHeteroProfilePanel = ({
+ deviceId,
+ providerType,
+ target,
+}: {
+ deviceId?: string;
+ providerType?: string;
+ target: DeviceExecutionTarget;
+}): HeteroProfilePanel => {
+ if (!providerType) return { kind: 'pending' };
+ if (isLocalRuntimeHeterogeneousType(providerType)) return { kind: 'runtime' };
+
+ switch (target) {
+ case 'local': {
+ return { kind: 'local' };
+ }
+ case 'sandbox': {
+ return providerType === 'claude-code' ? { kind: 'cloud' } : { kind: 'sandbox' };
+ }
+ case 'device': {
+ return deviceId ? { deviceId, kind: 'device' } : { kind: 'pending' };
+ }
+ default: {
+ return { kind: 'pending' };
+ }
+ }
+};
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroTargetSelection.test.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroTargetSelection.test.ts
new file mode 100644
index 00000000000..d4a636290f1
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroTargetSelection.test.ts
@@ -0,0 +1,88 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ getPrivateDeviceBlock,
+ getTargetHint,
+ getTargetSelectValue,
+} from './heteroTargetSelection';
+
+describe('getPrivateDeviceBlock', () => {
+ it('blocks a private device on the shared row of a public workspace agent', () => {
+ expect(
+ getPrivateDeviceBlock({
+ canManageAgent: true,
+ isWorkspaceAgent: true,
+ visibility: 'public',
+ }),
+ ).toBe('publicAgent');
+ });
+
+ it('blocks a private device once a private agent is fixed', () => {
+ expect(
+ getPrivateDeviceBlock({
+ canManageAgent: true,
+ isWorkspaceAgent: true,
+ selectionPolicy: 'fixed',
+ visibility: 'private',
+ }),
+ ).toBe('fixed');
+ });
+
+ it("allows the owner's private device on a private agent", () => {
+ expect(
+ getPrivateDeviceBlock({
+ canManageAgent: true,
+ isWorkspaceAgent: true,
+ selectionPolicy: 'member',
+ visibility: 'private',
+ }),
+ ).toBeUndefined();
+ });
+
+ it("allows a member's private device, which stays in their own override", () => {
+ expect(
+ getPrivateDeviceBlock({
+ canManageAgent: false,
+ isWorkspaceAgent: true,
+ visibility: 'public',
+ }),
+ ).toBeUndefined();
+ });
+
+ it('never blocks for a personal agent', () => {
+ expect(
+ getPrivateDeviceBlock({ canManageAgent: true, isWorkspaceAgent: false }),
+ ).toBeUndefined();
+ });
+});
+
+describe('getTargetSelectValue', () => {
+ it('selects the bound device', () => {
+ expect(getTargetSelectValue('device', 'device-us-1')).toBe('device:device-us-1');
+ });
+
+ it('selects this desktop or the sandbox', () => {
+ expect(getTargetSelectValue('local', 'device-us-1')).toBe('target:local');
+ expect(getTargetSelectValue('sandbox', undefined)).toBe('target:sandbox');
+ });
+
+ it('leaves the placeholder when nothing runnable is chosen', () => {
+ expect(getTargetSelectValue('device', undefined)).toBeUndefined();
+ expect(getTargetSelectValue('none', undefined)).toBeUndefined();
+ expect(getTargetSelectValue('auto', undefined)).toBeUndefined();
+ });
+});
+
+describe('getTargetHint', () => {
+ it('explains a fixed environment before anything else', () => {
+ expect(getTargetHint({ isOverridden: true, isSelectable: false })).toBe('fixed');
+ });
+
+ it("says when the caller's own pick applies", () => {
+ expect(getTargetHint({ isOverridden: true, isSelectable: true })).toBe('overridden');
+ });
+
+ it('otherwise describes what the default sets', () => {
+ expect(getTargetHint({ isOverridden: false, isSelectable: true })).toBe('default');
+ });
+});
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroTargetSelection.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroTargetSelection.ts
new file mode 100644
index 00000000000..53ddbcc1ef6
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/heteroTargetSelection.ts
@@ -0,0 +1,50 @@
+import type { DeviceExecutionTarget } from '@lobechat/types';
+
+import { executionTargetValue } from '@/features/ExecutionTargetPicker';
+
+export type PrivateDeviceBlock = 'fixed' | 'publicAgent';
+
+/**
+ * Why the profile picker cannot bind a private workspace device, if it cannot.
+ *
+ * A manager's pick replaces the shared default that every member resolves, and
+ * a private device resolves only for the member who enrolled it — so the
+ * shared row may name one only on a private Agent that is not fixed. A
+ * member's pick stays in their own override, where their private device is
+ * fine. Personal agents have no private workspace devices at all.
+ */
+export const getPrivateDeviceBlock = ({
+ canManageAgent,
+ isWorkspaceAgent,
+ selectionPolicy,
+ visibility,
+}: {
+ canManageAgent: boolean;
+ isWorkspaceAgent: boolean;
+ selectionPolicy?: string;
+ visibility?: 'private' | 'public';
+}): PrivateDeviceBlock | undefined => {
+ if (!isWorkspaceAgent || !canManageAgent) return;
+ if (visibility !== 'private') return 'publicAgent';
+ if (selectionPolicy === 'fixed') return 'fixed';
+};
+
+/** The picker value for a resolved target; undefined leaves the placeholder. */
+export const getTargetSelectValue = (
+ target: DeviceExecutionTarget,
+ deviceId: string | undefined,
+): string | undefined => {
+ if (target === 'device') return deviceId ? executionTargetValue('device', deviceId) : undefined;
+ if (target === 'local' || target === 'sandbox') return executionTargetValue(target);
+};
+
+export type TargetHint = 'default' | 'fixed' | 'overridden';
+
+/** The one line under the picker: why it is locked, whose pick applies, or what it sets. */
+export const getTargetHint = ({
+ isOverridden,
+ isSelectable,
+}: {
+ isOverridden: boolean;
+ isSelectable: boolean;
+}): TargetHint => (!isSelectable ? 'fixed' : isOverridden ? 'overridden' : 'default');
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceAgentScan.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceAgentScan.ts
new file mode 100644
index 00000000000..fc9fbf27b4f
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceAgentScan.ts
@@ -0,0 +1,18 @@
+import { useClientDataSWR } from '@/libs/swr';
+import { deviceService } from '@/services/device';
+
+/**
+ * Live scan of the agent CLIs installed on a connected device, probed over the
+ * device gateway. Pass no `deviceId` (e.g. while the device is offline) to skip
+ * the probe.
+ *
+ * Shares its key with the device page and the connect wizard, so opening an
+ * agent right after connecting it reuses that scan instead of starting another
+ * ten-second probe. Only an explicit `mutate` re-probes.
+ */
+export const useDeviceAgentScan = (deviceId: string | undefined) =>
+ useClientDataSWR(
+ deviceId ? ['device/agentScan', deviceId] : null,
+ () => (deviceId ? deviceService.scanAgents({ deviceId }) : null),
+ { revalidateOnFocus: false, revalidateOnReconnect: false, shouldRetryOnError: false },
+ );
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceCliStatus.test.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceCliStatus.test.ts
new file mode 100644
index 00000000000..2bfe2ec30cf
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceCliStatus.test.ts
@@ -0,0 +1,127 @@
+import type { DeviceListItem } from '@lobechat/types';
+import { act, renderHook, waitFor } from '@testing-library/react';
+import { createElement, type ReactNode } from 'react';
+import { SWRConfig } from 'swr';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { deviceService } from '@/services/device';
+import * as deviceList from '@/store/device/useDeviceList';
+
+import { useDeviceCliStatus } from './useDeviceCliStatus';
+
+const linuxDevice = {
+ channels: [],
+ deviceId: 'device-us-1',
+ friendlyName: 'US Node 1',
+ online: true,
+ platform: 'linux',
+ scope: 'personal',
+} as unknown as DeviceListItem;
+
+const refreshDevices = vi.fn();
+
+const mockDevices = (devices: DeviceListItem[]) =>
+ vi.spyOn(deviceList, 'useDeviceList').mockReturnValue({
+ data: devices,
+ error: undefined,
+ isConfirmed: true,
+ isLoading: false,
+ isValidating: false,
+ mutate: refreshDevices,
+ });
+
+// A fresh SWR cache per test, so one test's scan never answers another's.
+const wrapper = ({ children }: { children: ReactNode }) =>
+ createElement(SWRConfig, { value: { dedupingInterval: 0, provider: () => new Map() } }, children);
+
+const renderStatus = () =>
+ renderHook(() => useDeviceCliStatus({ agentType: 'claude-code', deviceId: 'device-us-1' }), {
+ wrapper,
+ });
+
+describe('useDeviceCliStatus', () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ refreshDevices.mockReset();
+ });
+
+ it('scans the bound device and reports the CLI missing there', async () => {
+ mockDevices([linuxDevice]);
+ const scanAgents = vi
+ .spyOn(deviceService, 'scanAgents')
+ .mockResolvedValue({ agents: { 'claude-code': { available: false } } });
+
+ const { result } = renderStatus();
+
+ await waitFor(() => expect(result.current.state).toEqual({ status: 'unavailable' }));
+ expect(scanAgents).toHaveBeenCalledWith({ deviceId: 'device-us-1' });
+ expect(result.current.device?.friendlyName).toBe('US Node 1');
+ });
+
+ it('reports the version the device found', async () => {
+ mockDevices([linuxDevice]);
+ vi.spyOn(deviceService, 'scanAgents').mockResolvedValue({
+ agents: { 'claude-code': { available: true, version: '2.1.0' } },
+ });
+
+ const { result } = renderStatus();
+
+ await waitFor(() =>
+ expect(result.current.state).toEqual({ status: 'available', version: '2.1.0' }),
+ );
+ });
+
+ it('does not scan an offline device', () => {
+ mockDevices([{ ...linuxDevice, online: false }]);
+ const scanAgents = vi.spyOn(deviceService, 'scanAgents');
+
+ const { result } = renderStatus();
+
+ expect(result.current.state).toEqual({ status: 'offline' });
+ expect(scanAgents).not.toHaveBeenCalled();
+ });
+
+ it('re-checks presence instead of scanning when redetecting an offline device', () => {
+ mockDevices([{ ...linuxDevice, online: false }]);
+ const scanAgents = vi.spyOn(deviceService, 'scanAgents');
+
+ const { result } = renderStatus();
+ act(() => result.current.redetect());
+
+ expect(refreshDevices).toHaveBeenCalledTimes(1);
+ expect(scanAgents).not.toHaveBeenCalled();
+ });
+
+ it('re-scans an online device on redetect', async () => {
+ mockDevices([linuxDevice]);
+ const scanAgents = vi
+ .spyOn(deviceService, 'scanAgents')
+ .mockResolvedValueOnce({ agents: { 'claude-code': { available: false } } })
+ .mockResolvedValueOnce({ agents: { 'claude-code': { available: true } } });
+
+ const { result } = renderStatus();
+ await waitFor(() => expect(result.current.state).toEqual({ status: 'unavailable' }));
+
+ act(() => result.current.redetect());
+
+ await waitFor(() => expect(result.current.state).toEqual({ status: 'available' }));
+ expect(scanAgents).toHaveBeenCalledTimes(2);
+ });
+
+ it('keeps a failed scan apart from a missing CLI', async () => {
+ mockDevices([linuxDevice]);
+ vi.spyOn(deviceService, 'scanAgents').mockResolvedValue({
+ agents: {},
+ error: 'Device tool call failed',
+ });
+
+ const { result } = renderStatus();
+
+ await waitFor(() =>
+ expect(result.current.state).toEqual({
+ reason: 'Device tool call failed',
+ status: 'scanFailed',
+ }),
+ );
+ });
+});
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceCliStatus.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceCliStatus.ts
new file mode 100644
index 00000000000..da2d55ce9dc
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/useDeviceCliStatus.ts
@@ -0,0 +1,46 @@
+import { useDeviceList } from '@/store/device';
+
+import { getBoundDevicePresence } from './boundDevicePresence';
+import { resolveDeviceCliState } from './deviceCliStatus';
+import { useDeviceAgentScan } from './useDeviceAgentScan';
+
+/**
+ * The agent CLI on a bound device, probed over the device gateway.
+ *
+ * Scans only once the device is known to be online. Redetect re-scans an
+ * online device and re-checks presence otherwise, since an offline device
+ * cannot answer a scan.
+ */
+export const useDeviceCliStatus = ({
+ agentType,
+ deviceId,
+}: {
+ agentType: string;
+ deviceId: string;
+}) => {
+ const {
+ data: devices,
+ isConfirmed,
+ isValidating: isRefreshingDevices,
+ mutate: refreshDevices,
+ } = useDeviceList();
+ const device = devices?.find((item) => item.deviceId === deviceId);
+ const presence = getBoundDevicePresence(deviceId, device, isConfirmed);
+ const scan = useDeviceAgentScan(presence === 'online' ? deviceId : undefined);
+
+ const redetect = () => {
+ void (presence === 'online' ? scan.mutate() : refreshDevices());
+ };
+
+ return {
+ device,
+ isRedetecting: scan.isValidating || isRefreshingDevices,
+ redetect,
+ state: resolveDeviceCliState({
+ agentType,
+ presence,
+ scan: scan.data,
+ scanError: scan.error,
+ }),
+ };
+};
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget.test.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget.test.ts
new file mode 100644
index 00000000000..608ed330eaa
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget.test.ts
@@ -0,0 +1,168 @@
+import type { LobeAgentAgencyConfig } from '@lobechat/types';
+import { renderHook } from '@testing-library/react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { useProfileExecutionTarget } from './useProfileExecutionTarget';
+
+const testState = vi.hoisted(() => ({
+ agencyConfig: undefined as LobeAgentAgencyConfig | undefined,
+ isDesktop: true,
+ isPreferenceLoading: false,
+ workspaceScoped: false,
+}));
+
+vi.mock('@lobechat/const', async (importOriginal) => ({
+ ...(await importOriginal<object>()),
+ get isDesktop() {
+ return testState.isDesktop;
+ },
+}));
+
+vi.mock('@/hooks/useEffectiveAgencyConfig', () => ({
+ useEffectiveAgencyConfig: () => ({
+ agencyConfig: testState.agencyConfig,
+ canDisplayExecutionTarget: !testState.isPreferenceLoading,
+ canSelectExecutionTarget: !testState.isPreferenceLoading,
+ executionTargetOverridden: false,
+ isPreferenceLoading: testState.isPreferenceLoading,
+ topicDeviceUnknown: false,
+ workspaceScoped: testState.workspaceScoped,
+ }),
+}));
+
+describe('useProfileExecutionTarget', () => {
+ beforeEach(() => {
+ testState.agencyConfig = undefined;
+ testState.isDesktop = true;
+ testState.isPreferenceLoading = false;
+ testState.workspaceScoped = false;
+ });
+
+ it('describes the bound device on a desktop for an agent connected from a device', () => {
+ // What the connect wizard writes when the agent is created on a remote
+ // device. The profile used to probe the desktop it was open on instead.
+ testState.agencyConfig = {
+ boundDeviceId: 'device-us-1',
+ executionTarget: 'device',
+ heterogeneousProvider: { type: 'claude-code' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.target).toBe('device');
+ expect(result.current.panel).toEqual({ deviceId: 'device-us-1', kind: 'device' });
+ });
+
+ it('probes this desktop only when the agent runs locally', () => {
+ testState.agencyConfig = {
+ boundDeviceId: 'this-desktop',
+ executionTarget: 'local',
+ heterogeneousProvider: { type: 'claude-code' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.panel).toEqual({ kind: 'local' });
+ expect(result.current.deviceId).toBeUndefined();
+ });
+
+ it('opens on the cloud config when a desktop agent runs in the sandbox', () => {
+ testState.agencyConfig = {
+ executionTarget: 'sandbox',
+ heterogeneousProvider: { type: 'claude-code' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.panel).toEqual({ kind: 'cloud' });
+ });
+
+ it('describes the pinned desktop when a local agent is opened on the web', () => {
+ testState.isDesktop = false;
+ testState.agencyConfig = {
+ boundDeviceId: 'my-desktop',
+ executionTarget: 'local',
+ heterogeneousProvider: { type: 'codex' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.panel).toEqual({ deviceId: 'my-desktop', kind: 'device' });
+ });
+
+ it('never runs a shared workspace default on whichever member opened it', () => {
+ testState.workspaceScoped = true;
+ testState.agencyConfig = {
+ executionTarget: 'local',
+ heterogeneousProvider: { type: 'claude-code' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.target).toBe('sandbox');
+ expect(result.current.panel).toEqual({ kind: 'cloud' });
+ });
+
+ it('waits for a device pick when a device-only CLI has no environment', () => {
+ testState.isDesktop = false;
+ testState.agencyConfig = { heterogeneousProvider: { type: 'opencode' } };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.panel).toEqual({ kind: 'pending' });
+ });
+
+ it('flags API auth on the cloud sandbox, where dispatch rejects it', () => {
+ // The sandbox panel has no auth controls, so the profile must surface the
+ // block and the way back to subscription auth.
+ testState.agencyConfig = {
+ executionTarget: 'sandbox',
+ heterogeneousProvider: { authMode: 'api', type: 'claude-code' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.panel).toEqual({ kind: 'cloud' });
+ expect(result.current.isApiAuthBlocked).toBe(true);
+ });
+
+ it('flags API auth on a bound device too', () => {
+ testState.agencyConfig = {
+ boundDeviceId: 'device-us-1',
+ executionTarget: 'device',
+ heterogeneousProvider: { authMode: 'api', type: 'codex' },
+ };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.isApiAuthBlocked).toBe(true);
+ });
+
+ it('keeps API auth usable on this desktop and ignores subscription auth', () => {
+ testState.agencyConfig = {
+ executionTarget: 'local',
+ heterogeneousProvider: { authMode: 'api', type: 'claude-code' },
+ };
+ expect(
+ renderHook(() => useProfileExecutionTarget('agent-1')).result.current.isApiAuthBlocked,
+ ).toBe(false);
+
+ testState.agencyConfig = {
+ executionTarget: 'sandbox',
+ heterogeneousProvider: { authMode: 'subscription', type: 'claude-code' },
+ };
+ expect(
+ renderHook(() => useProfileExecutionTarget('agent-1')).result.current.isApiAuthBlocked,
+ ).toBe(false);
+ });
+
+ it('reports a pending target while the workspace preference loads', () => {
+ testState.isPreferenceLoading = true;
+ testState.agencyConfig = { heterogeneousProvider: { type: 'claude-code' } };
+
+ const { result } = renderHook(() => useProfileExecutionTarget('agent-1'));
+
+ expect(result.current.isPending).toBe(true);
+ expect(result.current.isSelectable).toBe(false);
+ });
+});
diff --git a/src/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget.ts b/src/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget.ts
new file mode 100644
index 00000000000..11d808faf0c
--- /dev/null
+++ b/src/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget.ts
@@ -0,0 +1,69 @@
+import { isDesktop } from '@lobechat/const';
+import type { DeviceExecutionTarget, LobeAgentAgencyConfig } from '@lobechat/types';
+
+import { isApiAuthBlockedOnTarget } from '@/features/HeterogeneousAgent/apiMode';
+import { resolveExecutionTarget } from '@/helpers/executionTarget';
+import { useEffectiveAgencyConfig } from '@/hooks/useEffectiveAgencyConfig';
+
+import { type HeteroProfilePanel, resolveHeteroProfilePanel } from './heteroProfilePanel';
+
+export interface ProfileExecutionTarget {
+ /** Shared config merged with the caller's own override, without a topic binding. */
+ agencyConfig: LobeAgentAgencyConfig | undefined;
+ /** The gateway-routed device, set only when `target` is `device`. */
+ deviceId?: string;
+ /** API-mode auth cannot run on `target`; dispatch rejects it off this desktop. */
+ isApiAuthBlocked: boolean;
+ /** The caller's own pick applies instead of the shared default. */
+ isOverridden: boolean;
+ /** The workspace preference is still loading, so `target` may still flip. */
+ isPending: boolean;
+ /** False when a fixed workspace policy keeps this member on the shared target. */
+ isSelectable: boolean;
+ /** The configuration panel for that environment. */
+ panel: HeteroProfilePanel;
+ target: DeviceExecutionTarget;
+}
+
+/**
+ * Where the current caller's NEW topics of a heterogeneous agent run.
+ *
+ * The profile's environment picker and its CLI status panel both read this, so
+ * the panel always describes the machine the picker names — never the client
+ * the profile happens to be open on.
+ */
+export const useProfileExecutionTarget = (agentId: string): ProfileExecutionTarget => {
+ const {
+ agencyConfig,
+ canSelectExecutionTarget,
+ executionTargetOverridden,
+ isPreferenceLoading,
+ workspaceScoped,
+ } = useEffectiveAgencyConfig(agentId, { topicId: null });
+ const target = resolveExecutionTarget(agencyConfig, {
+ clientExecutionAvailable: isDesktop,
+ isHetero: true,
+ workspaceScoped,
+ });
+
+ const deviceId = target === 'device' ? agencyConfig?.boundDeviceId : undefined;
+ const panel = resolveHeteroProfilePanel({
+ deviceId,
+ providerType: agencyConfig?.heterogeneousProvider?.type,
+ target,
+ });
+
+ return {
+ agencyConfig,
+ deviceId,
+ // A bundled runtime has its own provider-key auth, not the CLI API mode.
+ isApiAuthBlocked:
+ panel.kind !== 'runtime' &&
+ isApiAuthBlockedOnTarget(agencyConfig?.heterogeneousProvider?.authMode, target),
+ isOverridden: executionTargetOverridden,
+ isPending: isPreferenceLoading,
+ isSelectable: canSelectExecutionTarget,
+ panel,
+ target,
+ };
+};
diff --git a/src/features/HeterogeneousAgent/apiMode.test.ts b/src/features/HeterogeneousAgent/apiMode.test.ts
index 088907107b7..1697eefbf11 100644
--- a/src/features/HeterogeneousAgent/apiMode.test.ts
+++ b/src/features/HeterogeneousAgent/apiMode.test.ts
@@ -1,7 +1,7 @@
import { isHeterogeneousProviderBindingSupported } from '@lobechat/heterogeneous-agents';
import { describe, expect, it } from 'vitest';
-import { supportsHeterogeneousApiMode } from './apiMode';
+import { isApiAuthBlockedOnTarget, supportsHeterogeneousApiMode } from './apiMode';
describe('supportsHeterogeneousApiMode', () => {
it.each(['opencode', 'droid'])(
@@ -17,3 +17,18 @@ describe('supportsHeterogeneousApiMode', () => {
expect(supportsHeterogeneousApiMode('amp')).toBe(false);
});
});
+
+describe('isApiAuthBlockedOnTarget', () => {
+ it.each(['sandbox', 'device', 'auto', 'none'] as const)(
+ 'blocks API auth when the agent runs on %s',
+ (target) => {
+ expect(isApiAuthBlockedOnTarget('api', target)).toBe(true);
+ },
+ );
+
+ it('allows API auth on this desktop and never blocks subscription auth', () => {
+ expect(isApiAuthBlockedOnTarget('api', 'local')).toBe(false);
+ expect(isApiAuthBlockedOnTarget('subscription', 'sandbox')).toBe(false);
+ expect(isApiAuthBlockedOnTarget(undefined, 'device')).toBe(false);
+ });
+});
diff --git a/src/features/HeterogeneousAgent/apiMode.ts b/src/features/HeterogeneousAgent/apiMode.ts
index f33f7293cd5..c692aa3041a 100644
--- a/src/features/HeterogeneousAgent/apiMode.ts
+++ b/src/features/HeterogeneousAgent/apiMode.ts
@@ -2,8 +2,19 @@ import {
isHeterogeneousProviderBindingSupported,
isServerDefaultHeterogeneousAgentType,
} from '@lobechat/heterogeneous-agents';
+import type { DeviceExecutionTarget, HeterogeneousAuthMode } from '@lobechat/types';
/** Deployment relay support does not require user-provider credentials support. */
export const supportsHeterogeneousApiMode = (agentType: string): boolean =>
isHeterogeneousProviderBindingSupported(agentType) ||
isServerDefaultHeterogeneousAgentType(agentType);
+
+/**
+ * API-mode auth runs only in-process on this desktop: dispatch
+ * (`selectRuntimeType`) rejects it on any other target. Surfaces that show a
+ * non-local environment use this to offer the way back to subscription auth.
+ */
+export const isApiAuthBlockedOnTarget = (
+ authMode: HeterogeneousAuthMode | undefined,
+ target: DeviceExecutionTarget,
+): boolean => authMode === 'api' && target !== 'local';
diff --git a/src/hooks/useEffectiveAgencyConfig.test.ts b/src/hooks/useEffectiveAgencyConfig.test.ts
index 09b790c7137..c32cd797caa 100644
--- a/src/hooks/useEffectiveAgencyConfig.test.ts
+++ b/src/hooks/useEffectiveAgencyConfig.test.ts
@@ -152,6 +152,7 @@ describe('useEffectiveAgencyConfig', () => {
agencyConfig: { boundDeviceId: 'owner-desktop', executionTarget: 'local' },
canDisplayExecutionTarget: true,
canSelectExecutionTarget: true,
+ executionTargetOverridden: true,
isPreferenceLoading: false,
topicDeviceUnknown: false,
workspaceScoped: false,
@@ -191,12 +192,31 @@ describe('useEffectiveAgencyConfig', () => {
agencyConfig: { boundDeviceId: 'manager-desktop', executionTarget: 'local' },
canDisplayExecutionTarget: true,
canSelectExecutionTarget: true,
+ executionTargetOverridden: true,
isPreferenceLoading: false,
topicDeviceUnknown: false,
workspaceScoped: false,
});
});
+ // A fixed policy constrains members, not the shared default: the author or a
+ // Workspace admin must still be able to repoint it (e.g. off a deleted or
+ // offline device) from the profile picker.
+ it("keeps a fixed public Workspace Agent's target selectable for its author or admin", () => {
+ managementAccess.canManageAgent = true;
+ setupStores({
+ agencyConfig: { ...sharedConfig, executionTargetSelectionPolicy: 'fixed' },
+ visibility: 'public',
+ workspaceId: 'ws-1',
+ });
+
+ const { result } = renderHook(() => useEffectiveAgencyConfig('agent-1', { topicId: null }));
+
+ expect(result.current.agencyConfig).toEqual(sharedConfig);
+ expect(result.current.canSelectExecutionTarget).toBe(true);
+ expect(result.current.executionTargetOverridden).toBe(false);
+ });
+
it('shows a read-only execution summary when an ordinary member is fixed to the shared target', () => {
setupStores({
agencyConfig: {
@@ -216,6 +236,46 @@ describe('useEffectiveAgencyConfig', () => {
});
});
+ it('reports that a member override applies instead of the shared default', () => {
+ setupStores({
+ override: { boundDeviceId: 'my-device', executionTarget: 'device' },
+ visibility: 'public',
+ workspaceId: 'ws-1',
+ });
+
+ const { result } = renderHook(() => useEffectiveAgencyConfig('agent-1'));
+
+ expect(result.current.executionTargetOverridden).toBe(true);
+ });
+
+ it('does not report an override that a fixed policy shelves for a member', () => {
+ setupStores({
+ agencyConfig: { ...sharedConfig, executionTargetSelectionPolicy: 'fixed' },
+ override: { boundDeviceId: 'my-device', executionTarget: 'device' },
+ visibility: 'public',
+ workspaceId: 'ws-1',
+ });
+
+ const { result } = renderHook(() => useEffectiveAgencyConfig('agent-1'));
+
+ expect(result.current.agencyConfig?.boundDeviceId).toBe('creator-device');
+ expect(result.current.executionTargetOverridden).toBe(false);
+ });
+
+ it('never reports an override for a personal agent or a device-only override', () => {
+ setupStores({ override: { boundDeviceId: 'my-device', executionTarget: 'device' } });
+ expect(
+ renderHook(() => useEffectiveAgencyConfig('agent-1')).result.current
+ .executionTargetOverridden,
+ ).toBe(false);
+
+ setupStores({ override: { boundDeviceId: 'my-device' }, workspaceId: 'ws-1' });
+ expect(
+ renderHook(() => useEffectiveAgencyConfig('agent-1')).result.current
+ .executionTargetOverridden,
+ ).toBe(false);
+ });
+
it('preserves workspace scope when an override has no explicit execution target', () => {
setupStores({ override: { boundDeviceId: 'my-device' }, workspaceId: 'ws-1' });
diff --git a/src/hooks/useEffectiveAgencyConfig.ts b/src/hooks/useEffectiveAgencyConfig.ts
index 6782210229d..5955a0cee29 100644
--- a/src/hooks/useEffectiveAgencyConfig.ts
+++ b/src/hooks/useEffectiveAgencyConfig.ts
@@ -26,6 +26,12 @@ export interface UseEffectiveAgencyConfigResult {
canDisplayExecutionTarget: boolean;
/** Whether this caller may open the execution-target selector. */
canSelectExecutionTarget: boolean;
+ /**
+ * The caller's own per-agent execution target applies instead of the shared
+ * default: a member's pick under the member-selection policy, or a manager's
+ * this-machine pick (always kept per user). Ignores the topic binding.
+ */
+ executionTargetOverridden: boolean;
/**
* The workspace preference fetch is still in flight. Until it settles, a
* workspace agent's `agencyConfig` may reflect only the shared row — callers
@@ -109,6 +115,14 @@ export const useEffectiveAgencyConfig = (
visibility: agent?.visibility,
workspaceId: agent?.workspaceId,
});
+ // Mirrors `resolveAgentAgencyConfig`: a fixed policy shelves a member's
+ // override, while managers and private-agent owners keep theirs.
+ const executionTargetOverridden =
+ !!agent?.workspaceId &&
+ override?.executionTarget !== undefined &&
+ !(
+ usesWorkspaceMemberSelection && sharedAgencyConfig?.executionTargetSelectionPolicy === 'fixed'
+ );
const activeTopicId = useChatStore((s) => s.activeTopicId);
const bindingTopicId = topicId === undefined ? activeTopicId : topicId;
const topicDeviceId = useChatStore((s) =>
@@ -153,6 +167,7 @@ export const useEffectiveAgencyConfig = (
!isProjectDirectoryTopic &&
!isPreferenceLoading &&
agencyConfig?.executionTargetSelectionPolicy !== 'fixed',
+ executionTargetOverridden,
isPreferenceLoading,
topicDeviceUnknown,
workspaceScoped,
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx
index ed8f51a6029..207c1d065c7 100644
--- a/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx
+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/RemoteAgentConfigCard.tsx
@@ -26,12 +26,14 @@ import { memo, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AsyncError from '@/components/AsyncError';
+import {
+ getBoundDevicePresence,
+ getDeviceSelectState,
+} from '@/features/HeterogeneousAgent/ExecutionEnvironment/boundDevicePresence';
import { deviceService } from '@/services/device';
import { useAgentStore } from '@/store/agent';
import { isDevicePresenceUnknown, useDeviceList } from '@/store/device';
-import { getBoundDevicePresence, getDeviceSelectState } from './boundDevicePresence';
-
const styles = createStaticStyles(({ css }) => ({
card: css`
padding-block: 16px 4px;
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.tsx
index 7550eea2c15..8de111cba06 100644
--- a/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.tsx
+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/WorkspaceAgentDevicePolicy.tsx
@@ -1,17 +1,17 @@
'use client';
import { HETEROGENEOUS_TYPE_LABELS } from '@lobechat/heterogeneous-agents';
-import type { DeviceExecutionTarget, DeviceListItem, LobeAgentAgencyConfig } from '@lobechat/types';
+import type { DeviceListItem, LobeAgentAgencyConfig } from '@lobechat/types';
import type { SelectOption, SelectOptions } from '@lobehub/ui';
-import { createStaticStyles, cssVar, Flexbox, Select } from '@lobehub/ui';
+import { Select } from '@lobehub/ui';
import { MonitorSmartphone } from 'lucide-react';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import AsyncError from '@/components/AsyncError';
import {
- ExecutionTargetDeviceStatus,
- ExecutionTargetIcon,
+ ExecutionTargetLabel,
+ executionTargetSelectClassNames,
executionTargetValue,
groupExecutionTargetDevices,
parseExecutionTargetValue,
@@ -23,141 +23,6 @@ import { useDeviceList } from '@/store/device';
import { WorkspaceAgentPolicyCard } from './WorkspaceAgentPolicyCard';
-const styles = createStaticStyles(({ css }) => ({
- option: css`
- display: flex;
- flex: 1;
- gap: 8px;
- align-items: center;
-
- min-width: 0;
- `,
- optionDescription: css`
- font-size: 12px;
- line-height: 16px;
- color: ${cssVar.colorTextDescription};
- `,
- optionIcon: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: 24px;
- height: 24px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- color: ${cssVar.colorText};
-
- background: ${cssVar.colorBgElevated};
- `,
- optionName: css`
- overflow: hidden;
-
- font-size: 14px;
- font-weight: 500;
- line-height: 20px;
- color: ${cssVar.colorText};
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- selectItem: css`
- min-height: 40px;
- `,
- selectPopup: css`
- max-width: calc(100vw - 24px);
- `,
- selectValue: css`
- > span {
- display: flex;
- flex: 1;
- min-width: 0;
- }
- `,
- triggerIcon: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: 20px;
- height: 20px;
-
- color: ${cssVar.colorTextSecondary};
- `,
- triggerLabel: css`
- display: flex;
- flex: 1;
- gap: 8px;
- align-items: center;
-
- min-width: 0;
- `,
- triggerName: css`
- overflow: hidden;
- flex: 1;
-
- text-align: start;
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
-}));
-
-interface ExecutionTargetLabelProps {
- compact?: boolean;
- description: string;
- device?: DeviceListItem;
- label: string;
- offlineLabel: string;
- onlineLabel: string;
- target: DeviceExecutionTarget;
- unknownLabel: string;
-}
-
-const ExecutionTargetLabel = memo<ExecutionTargetLabelProps>(
- ({ compact, description, device, label, offlineLabel, onlineLabel, target, unknownLabel }) => {
- const icon = <ExecutionTargetIcon devicePlatform={device?.platform} target={target} />;
- const secondary = device ? (
- <ExecutionTargetDeviceStatus
- offlineLabel={offlineLabel}
- online={device.online}
- onlineLabel={onlineLabel}
- unknown={device.onlineUnknown}
- unknownLabel={unknownLabel}
- />
- ) : (
- description
- );
-
- if (compact) {
- return (
- <span className={styles.triggerLabel}>
- <span aria-hidden className={styles.triggerIcon}>
- {icon}
- </span>
- <span className={styles.triggerName}>{label}</span>
- {device ? <span className={styles.optionDescription}>{secondary}</span> : null}
- </span>
- );
- }
-
- return (
- <span className={styles.option}>
- <span aria-hidden className={styles.optionIcon}>
- {icon}
- </span>
- <Flexbox flex={1} style={{ minWidth: 0 }}>
- <span className={styles.optionName}>{label}</span>
- <span className={styles.optionDescription}>{secondary}</span>
- </Flexbox>
- </span>
- );
- },
-);
-
-ExecutionTargetLabel.displayName = 'WorkspaceAgentDevicePolicy.ExecutionTargetLabel';
-
interface WorkspaceAgentDevicePolicyProps {
agentId: string;
showDevicePicker?: boolean;
@@ -380,16 +245,12 @@ const WorkspaceAgentDevicePolicy = memo<WorkspaceAgentDevicePolicyProps>(
>
{showDevicePicker ? (
<Select
+ classNames={executionTargetSelectClassNames}
optionRender={(option) => option.label}
options={targetOptions}
placeholder={t('settingAgent.devicePolicy.selectTarget')}
popupMatchSelectWidth={true}
value={selectedValue}
- classNames={{
- item: styles.selectItem,
- popup: styles.selectPopup,
- value: styles.selectValue,
- }}
labelRender={(option) => {
if (typeof option.value !== 'string') return option.label;
const selection = parseExecutionTargetValue(option.value);
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
index c1da522624e..6454ce72d6c 100644
--- a/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
@@ -2,27 +2,29 @@
import { isDesktop } from '@lobechat/const';
import {
+ HETEROGENEOUS_TYPE_LABELS,
isHeterogeneousProviderBindingSupported,
isRemoteHeterogeneousType,
isServerDefaultHeterogeneousAgentType,
} from '@lobechat/heterogeneous-agents';
import type { HeterogeneousApiConfig, HeterogeneousAuthMode } from '@lobechat/types';
-import type { TabsItem } from '@lobehub/ui';
-import { Alert, Button, createStaticStyles, cssVar, Flexbox, Tabs } from '@lobehub/ui';
+import { Alert, Button, createStaticStyles, cssVar, Flexbox } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
-import { ChevronDown, Wrench } from 'lucide-react';
+import { ChevronDown, MonitorSmartphone, Wrench } from 'lucide-react';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { AGENT_SHARE_ALLOWED_PROVIDERS } from '@/business/agent-share';
import { useAgentShareSupported } from '@/business/client/useAgentShareSupported';
import { ModelIcon } from '@/components/LobeIcons';
+import { ApiAuthLocalOnlyNotice } from '@/features/HeterogeneousAgent/ExecutionEnvironment/ApiAuthLocalOnlyNotice';
+import { DeviceCliStatusCard } from '@/features/HeterogeneousAgent/ExecutionEnvironment/DeviceCliStatusCard';
+import { HeteroExecutionTargetSelect } from '@/features/HeterogeneousAgent/ExecutionEnvironment/HeteroExecutionTargetSelect';
+import { useProfileExecutionTarget } from '@/features/HeterogeneousAgent/ExecutionEnvironment/useProfileExecutionTarget';
import { resolveServerDefaultAgentModels } from '@/features/HeterogeneousAgent/modelPicker';
import ReasoningEffortSelect from '@/features/ModelSelect/ReasoningEffortSelect';
import ModelSwitchPanel from '@/features/ModelSwitchPanel';
import RunPriorityHint from '@/features/ProfileEditor/AgentUserTools/RunPriorityHint';
-import { resolveExecutionTarget } from '@/helpers/executionTarget';
-import { useEffectiveAgencyConfig } from '@/hooks/useEffectiveAgencyConfig';
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
import { usePermission } from '@/hooks/usePermission';
import { useAgentStore } from '@/store/agent';
@@ -78,10 +80,9 @@ const ProfileEditor = memo(() => {
const updateAgentConfigById = useAgentStore((s) => s.updateAgentConfigById);
const isHeterogeneous = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
const heterogeneousProvider = config?.agencyConfig?.heterogeneousProvider;
- const { agencyConfig: effectiveAgencyConfig, workspaceScoped } = useEffectiveAgencyConfig(
- agentId,
- { topicId: null },
- );
+ // Where this caller's new topics run. The environment picker and the panel
+ // below both follow it, so the panel never describes this client by default.
+ const executionTarget = useProfileExecutionTarget(agentId);
const updateHeterogeneousCommand = async (command: string) => {
if (!canEdit) return;
@@ -134,15 +135,8 @@ const ProfileEditor = memo(() => {
isHeterogeneous &&
!!heterogeneousProvider &&
isRemoteHeterogeneousType(heterogeneousProvider.type);
- const showCloudHeterogeneousTab = heterogeneousProvider?.type === 'claude-code';
const localDesktopAvailable =
- isDesktop &&
- !!heterogeneousProvider &&
- resolveExecutionTarget(effectiveAgencyConfig, {
- clientExecutionAvailable: true,
- isHetero: true,
- workspaceScoped,
- }) === 'local';
+ isDesktop && !!heterogeneousProvider && executionTarget.target === 'local';
// Workspace agents are excluded even when the author could spawn them
// locally: the binding UI would list workspace-scoped providers, but Desktop
// main resolves the reference in the personal scope only (see
@@ -188,46 +182,85 @@ const ProfileEditor = memo(() => {
: serverCapabilityEnabled && !serverCapabilityLoading && !serverDefaultAvailable
? t('heterogeneousStatus.apiMode.serverDefault.unsupported')
: undefined;
- const heterogeneousTabItems: TabsItem[] = heterogeneousProvider
- ? [
- ...(showCloudHeterogeneousTab
- ? [
- {
- key: 'cloud',
- label: t('heterogeneousStatus.cloud.tabLabel'),
- children: (
- <CloudHeterogeneousConfig
- provider={heterogeneousProvider}
- onEnvChange={updateHeterogeneousEnv}
- />
- ),
- },
- ]
- : []),
- {
- key: 'desktop',
- label: t('heterogeneousStatus.desktop.tabLabel'),
- disabled: !isDesktop,
- children: (
- <HeterogeneousAgentStatusCard
- apiModeAvailable={apiModeAvailable}
- apiModeWorkspaceBlocked={isWorkspaceAgent}
- provider={heterogeneousProvider}
- serverDefaultAvailable={serverDefaultAvailable}
- serverDefaultLoading={serverCapabilityLoading}
- serverDefaultModels={serverDefaultModels}
- serverDefaultUnavailableReason={serverDefaultUnavailableReason}
- onApiConfigChange={updateHeterogeneousApiConfig}
- onAuthModeChange={updateHeterogeneousAuthMode}
- onCommandChange={updateHeterogeneousCommand}
- onServerDefaultRetry={() => {
- void serverCapabilitySync.revalidate();
- }}
- />
- ),
- },
- ]
- : [];
+ const renderHeterogeneousPanelBody = () => {
+ if (!heterogeneousProvider) return null;
+
+ const { panel } = executionTarget;
+
+ switch (panel.kind) {
+ case 'cloud': {
+ return (
+ <CloudHeterogeneousConfig
+ provider={heterogeneousProvider}
+ onEnvChange={updateHeterogeneousEnv}
+ />
+ );
+ }
+ case 'device': {
+ return <DeviceCliStatusCard deviceId={panel.deviceId} provider={heterogeneousProvider} />;
+ }
+ case 'local':
+ case 'runtime': {
+ return (
+ <HeterogeneousAgentStatusCard
+ apiModeAvailable={apiModeAvailable}
+ apiModeWorkspaceBlocked={isWorkspaceAgent}
+ provider={heterogeneousProvider}
+ serverDefaultAvailable={serverDefaultAvailable}
+ serverDefaultLoading={serverCapabilityLoading}
+ serverDefaultModels={serverDefaultModels}
+ serverDefaultUnavailableReason={serverDefaultUnavailableReason}
+ onApiConfigChange={updateHeterogeneousApiConfig}
+ onAuthModeChange={updateHeterogeneousAuthMode}
+ onCommandChange={updateHeterogeneousCommand}
+ onServerDefaultRetry={() => {
+ void serverCapabilitySync.revalidate();
+ }}
+ />
+ );
+ }
+ case 'sandbox': {
+ return (
+ <Alert
+ showIcon
+ type={'info'}
+ title={t('heterogeneousStatus.sandbox.desc', {
+ name: HETEROGENEOUS_TYPE_LABELS[heterogeneousProvider.type],
+ })}
+ />
+ );
+ }
+ case 'pending': {
+ return null;
+ }
+ }
+ };
+
+ const renderHeterogeneousPanel = () => {
+ // Until the member's own override loads, the target may still flip.
+ if (!heterogeneousProvider || executionTarget.isPending) return null;
+
+ return (
+ <>
+ {/* Dispatch rejects API auth off this desktop, and only the local card
+ edits auth — so every other environment offers the way back. */}
+ {executionTarget.isApiAuthBlocked && (
+ <ApiAuthLocalOnlyNotice
+ onUseSubscription={
+ canEdit
+ ? () =>
+ void updateHeterogeneousAuthMode(
+ 'subscription',
+ heterogeneousProvider.apiConfig,
+ )
+ : undefined
+ }
+ />
+ )}
+ {renderHeterogeneousPanelBody()}
+ </>
+ );
+ };
return (
<>
@@ -251,12 +284,25 @@ const ProfileEditor = memo(() => {
onBoundDeviceChange={updateBoundDeviceId}
/>
) : isHeterogeneous && heterogeneousProvider ? (
- // Local CLI agents: Claude Code supports cloud config; Codex is desktop-only for now.
- <Tabs
- defaultActiveKey={isDesktop || !showCloudHeterogeneousTab ? 'desktop' : 'cloud'}
- items={heterogeneousTabItems}
- size="small"
- />
+ // CLI agents: pick where new topics run, then configure that environment.
+ <>
+ <WorkspaceAgentPolicyCard
+ fullWidth
+ icon={MonitorSmartphone}
+ title={t('settingAgent.devicePolicy.title')}
+ >
+ <HeteroExecutionTargetSelect
+ agentId={agentId}
+ deviceId={executionTarget.deviceId}
+ isOverridden={executionTarget.isOverridden}
+ isPending={executionTarget.isPending}
+ isSelectable={executionTarget.isSelectable}
+ providerType={heterogeneousProvider.type}
+ target={executionTarget.target}
+ />
+ </WorkspaceAgentPolicyCard>
+ {renderHeterogeneousPanel()}
+ </>
) : isWorkspaceAgent ? (
<>
<Flexbox horizontal gap={8} wrap={'wrap'}>
@@ -319,8 +365,8 @@ const ProfileEditor = memo(() => {
<AgentTool />
</Flexbox>
)}
- {isHeterogeneous ? (
- <WorkspaceAgentDevicePolicy agentId={agentId} showDevicePicker={!isRemoteHetero} />
+ {isRemoteHetero ? (
+ <WorkspaceAgentDevicePolicy agentId={agentId} showDevicePicker={false} />
) : null}
</Flexbox>
</Flexbox>