🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(chat-input): execution environment device groups as submenus (#23151)
Rdmclin2a46f073f115e
diff --git a/locales/ar/chat.json b/locales/ar/chat.jsonindex 4b94debe0be..bf08496c4f5 100644--- a/locales/ar/chat.json+++ b/locales/ar/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} مكتسب إجمالاً","heteroAgent.executionTarget.auto": "تلقائي","heteroAgent.executionTarget.autoDesc": "استخدام جهاز متصل تلقائيًا، واختيار واحد عند توفر عدة أجهزة",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} متصل · {{total}} إجمالًا",+ "heteroAgent.executionTarget.devicesGroup": "الأجهزة","heteroAgent.executionTarget.downloadDesktop": "احصل على تطبيق سطح المكتب","heteroAgent.executionTarget.downloadDesktopDesc": "قم بتشغيل الوكلاء مع الوصول إلى جهاز الكمبيوتر الخاص بك","heteroAgent.executionTarget.downloadDesktopTitle": "احصل على تطبيق سطح المكتب",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "إعداد","heteroAgent.executionTarget.localSandboxUnavailable": "غير متوفر على هذا الجهاز: {{reason}}","heteroAgent.executionTarget.manage": "إدارة",+ "heteroAgent.executionTarget.myDevicesGroup": "أجهزتي","heteroAgent.executionTarget.noWorkspaceDevices": "لا توجد أجهزة مساحة عمل حتى الآن. قم بتشغيل `{{cmd}}` على جهاز لتسجيله لكل عضو.","heteroAgent.executionTarget.none": "لا يوجد جهاز","heteroAgent.executionTarget.noneDesc": "لم يتم تمكين أي جهاز",diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.jsonindex 1a88c4aea40..d14a972245e 100644--- a/locales/bg-BG/chat.json+++ b/locales/bg-BG/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} спечелени общо","heteroAgent.executionTarget.auto": "Автоматично","heteroAgent.executionTarget.autoDesc": "Автоматично използване на онлайн устройство, избирайки едно, когато има няколко налични",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} онлайн · общо {{total}}",+ "heteroAgent.executionTarget.devicesGroup": "Устройства","heteroAgent.executionTarget.downloadDesktop": "Изтеглете десктоп приложението","heteroAgent.executionTarget.downloadDesktopDesc": "Стартирайте агенти с достъп до вашия компютър","heteroAgent.executionTarget.downloadDesktopTitle": "Изтеглете десктоп приложението",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Настройване","heteroAgent.executionTarget.localSandboxUnavailable": "Не е налично на това устройство: {{reason}}","heteroAgent.executionTarget.manage": "Управление",+ "heteroAgent.executionTarget.myDevicesGroup": "Моите устройства","heteroAgent.executionTarget.noWorkspaceDevices": "Все още няма устройства в работното пространство. Изпълнете `{{cmd}}` на машина, за да я регистрирате за всеки член.","heteroAgent.executionTarget.none": "Няма устройство","heteroAgent.executionTarget.noneDesc": "Няма активирано устройство",diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.jsonindex 7aabaa039fd..0867b9ed8b4 100644--- a/locales/de-DE/chat.json+++ b/locales/de-DE/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} insgesamt verdient","heteroAgent.executionTarget.auto": "Automatisch","heteroAgent.executionTarget.autoDesc": "Automatisch ein Online-Gerät verwenden, wobei eines ausgewählt wird, wenn mehrere verfügbar sind",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} online · {{total}} insgesamt",+ "heteroAgent.executionTarget.devicesGroup": "Geräte","heteroAgent.executionTarget.downloadDesktop": "Desktop-App herunterladen","heteroAgent.executionTarget.downloadDesktopDesc": "Führen Sie Agenten mit Zugriff auf Ihren Computer aus","heteroAgent.executionTarget.downloadDesktopTitle": "Desktop-App herunterladen",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Einrichten","heteroAgent.executionTarget.localSandboxUnavailable": "Auf diesem Gerät nicht verfügbar: {{reason}}","heteroAgent.executionTarget.manage": "Verwalten",+ "heteroAgent.executionTarget.myDevicesGroup": "Meine Geräte","heteroAgent.executionTarget.noWorkspaceDevices": "Noch keine Arbeitsbereichsgeräte. Führen Sie `{{cmd}}` auf einem Gerät aus, um es für jedes Mitglied zu registrieren.","heteroAgent.executionTarget.none": "Kein Gerät","heteroAgent.executionTarget.noneDesc": "Kein Gerät aktiviert",diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex 574428c5df1..aea254c37c5 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -1551,6 +1551,8 @@"heteroAgent.executionTarget.auto": "Auto","heteroAgent.executionTarget.autoDesc": "Use an online device automatically, picking one when several are available","heteroAgent.executionTarget.builtinGroup": "Built-in",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} online · {{total}} total",+ "heteroAgent.executionTarget.devicesGroup": "Devices","heteroAgent.executionTarget.downloadDesktop": "Get Desktop App","heteroAgent.executionTarget.downloadDesktopDesc": "Run agents with access to your computer","heteroAgent.executionTarget.downloadDesktopTitle": "Get the desktop app",@@ -1567,6 +1569,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Set up","heteroAgent.executionTarget.localSandboxUnavailable": "Not available on this device: {{reason}}","heteroAgent.executionTarget.manage": "Manage",+ "heteroAgent.executionTarget.myDevicesGroup": "My devices","heteroAgent.executionTarget.noDevices": "No other devices yet. Run `lh connect` on another computer to add one.","heteroAgent.executionTarget.noWorkspaceDevices": "No workspace devices yet. Run `{{cmd}}` on a machine to enroll it for every member.","heteroAgent.executionTarget.none": "No device",@@ -1590,6 +1593,7 @@"heteroAgent.executionTarget.switchTopic.content": "This topic has been running on {{name}}, where its working directory and agent session are kept. After switching, its next turn starts a fresh session in the new environment. New topics will use this choice too.","heteroAgent.executionTarget.switchTopic.ok": "Switch","heteroAgent.executionTarget.switchTopic.title": "Move this topic to another environment?",+ "heteroAgent.executionTarget.temporarySandbox": "Temporary Sandbox","heteroAgent.executionTarget.temporarySandboxDesc": "Discarded after use, for coding and one-off data processing","heteroAgent.executionTarget.title": "Execution Environment","heteroAgent.executionTarget.topicTag": "This topic",diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.jsonindex b7b071476ae..9db4198beac 100644--- a/locales/es-ES/chat.json+++ b/locales/es-ES/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} ganados en total","heteroAgent.executionTarget.auto": "Automático","heteroAgent.executionTarget.autoDesc": "Usar un dispositivo en línea automáticamente, eligiendo uno cuando haya varios disponibles",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} en línea · {{total}} en total",+ "heteroAgent.executionTarget.devicesGroup": "Dispositivos","heteroAgent.executionTarget.downloadDesktop": "Obtener la aplicación de escritorio","heteroAgent.executionTarget.downloadDesktopDesc": "Ejecuta agentes con acceso a tu computadora","heteroAgent.executionTarget.downloadDesktopTitle": "Obtener la aplicación de escritorio",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Configurar","heteroAgent.executionTarget.localSandboxUnavailable": "No disponible en este dispositivo: {{reason}}","heteroAgent.executionTarget.manage": "Gestionar",+ "heteroAgent.executionTarget.myDevicesGroup": "Mis dispositivos","heteroAgent.executionTarget.noWorkspaceDevices": "Aún no hay dispositivos en el espacio de trabajo. Ejecuta `{{cmd}}` en una máquina para inscribirla para cada miembro.","heteroAgent.executionTarget.none": "Sin dispositivo","heteroAgent.executionTarget.noneDesc": "No hay dispositivos habilitados",diff --git a/locales/fa-IR/chat.json b/locales/fa-IR/chat.jsonindex 8ba3f757ea9..30687315e3e 100644--- a/locales/fa-IR/chat.json+++ b/locales/fa-IR/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} در مجموع کسب شده","heteroAgent.executionTarget.auto": "خودکار","heteroAgent.executionTarget.autoDesc": "به طور خودکار از یک دستگاه آنلاین استفاده کنید و یکی را در صورت موجود بودن چندین دستگاه انتخاب کنید",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} آنلاین · {{total}} در مجموع",+ "heteroAgent.executionTarget.devicesGroup": "دستگاهها","heteroAgent.executionTarget.downloadDesktop": "دریافت اپلیکیشن دسکتاپ","heteroAgent.executionTarget.downloadDesktopDesc": "اجرای عوامل با دسترسی به کامپیوتر شما","heteroAgent.executionTarget.downloadDesktopTitle": "دریافت اپلیکیشن دسکتاپ",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "راهاندازی","heteroAgent.executionTarget.localSandboxUnavailable": "در این دستگاه در دسترس نیست: {{reason}}","heteroAgent.executionTarget.manage": "مدیریت",+ "heteroAgent.executionTarget.myDevicesGroup": "دستگاههای من","heteroAgent.executionTarget.noWorkspaceDevices": "هنوز هیچ دستگاهی در فضای کاری وجود ندارد. دستور `{{cmd}}` را روی یک دستگاه اجرا کنید تا برای همه اعضا ثبت شود.","heteroAgent.executionTarget.none": "بدون دستگاه","heteroAgent.executionTarget.noneDesc": "هیچ دستگاهی فعال نشده است",diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.jsonindex 43c9b0bb8a3..7f465a6f8b0 100644--- a/locales/fr-FR/chat.json+++ b/locales/fr-FR/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} gagnés au total","heteroAgent.executionTarget.auto": "Auto","heteroAgent.executionTarget.autoDesc": "Utiliser automatiquement un appareil en ligne, en choisissant un lorsqu'il y en a plusieurs disponibles",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} en ligne · {{total}} au total",+ "heteroAgent.executionTarget.devicesGroup": "Appareils","heteroAgent.executionTarget.downloadDesktop": "Obtenir l'application de bureau","heteroAgent.executionTarget.downloadDesktopDesc": "Exécutez des agents avec accès à votre ordinateur","heteroAgent.executionTarget.downloadDesktopTitle": "Obtenir l'application de bureau",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Configurer","heteroAgent.executionTarget.localSandboxUnavailable": "Non disponible sur cet appareil : {{reason}}","heteroAgent.executionTarget.manage": "Gérer",+ "heteroAgent.executionTarget.myDevicesGroup": "Mes appareils","heteroAgent.executionTarget.noWorkspaceDevices": "Aucun appareil de l'espace de travail pour le moment. Exécutez `{{cmd}}` sur une machine pour l'inscrire pour chaque membre.","heteroAgent.executionTarget.none": "Aucun appareil","heteroAgent.executionTarget.noneDesc": "Aucun appareil activé",diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.jsonindex 59be87429d2..96aeabb1910 100644--- a/locales/it-IT/chat.json+++ b/locales/it-IT/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} guadagnati in totale","heteroAgent.executionTarget.auto": "Automatico","heteroAgent.executionTarget.autoDesc": "Usa automaticamente un dispositivo online, scegliendone uno quando ce ne sono diversi disponibili",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} online · {{total}} in totale",+ "heteroAgent.executionTarget.devicesGroup": "Dispositivi","heteroAgent.executionTarget.downloadDesktop": "Scarica l'App Desktop","heteroAgent.executionTarget.downloadDesktopDesc": "Esegui agenti con accesso al tuo computer","heteroAgent.executionTarget.downloadDesktopTitle": "Scarica l'app desktop",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Configura","heteroAgent.executionTarget.localSandboxUnavailable": "Non disponibile su questo dispositivo: {{reason}}","heteroAgent.executionTarget.manage": "Gestisci",+ "heteroAgent.executionTarget.myDevicesGroup": "I miei dispositivi","heteroAgent.executionTarget.noWorkspaceDevices": "Nessun dispositivo di workspace al momento. Esegui `{{cmd}}` su una macchina per registrarla per ogni membro.","heteroAgent.executionTarget.none": "Nessun dispositivo","heteroAgent.executionTarget.noneDesc": "Nessun dispositivo abilitato",diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.jsonindex b43108ffb65..c7ab7009944 100644--- a/locales/ja-JP/chat.json+++ b/locales/ja-JP/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "合計で{{count}}獲得","heteroAgent.executionTarget.auto": "自動","heteroAgent.executionTarget.autoDesc": "複数のオンラインデバイスが利用可能な場合、自動的に選択して使用",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} 台オンライン · 全 {{total}} 台",+ "heteroAgent.executionTarget.devicesGroup": "デバイス","heteroAgent.executionTarget.downloadDesktop": "デスクトップアプリを取得","heteroAgent.executionTarget.downloadDesktopDesc": "コンピュータにアクセスできるエージェントを実行","heteroAgent.executionTarget.downloadDesktopTitle": "デスクトップアプリを取得",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "セットアップ","heteroAgent.executionTarget.localSandboxUnavailable": "このデバイスでは利用できません: {{reason}}","heteroAgent.executionTarget.manage": "管理",+ "heteroAgent.executionTarget.myDevicesGroup": "マイデバイス","heteroAgent.executionTarget.noWorkspaceDevices": "まだワークスペースデバイスがありません。マシンで `{{cmd}}` を実行して、すべてのメンバーのために登録してください。","heteroAgent.executionTarget.none": "デバイスなし","heteroAgent.executionTarget.noneDesc": "有効なデバイスがありません",diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.jsonindex 876f18ffd65..b54dbf6a420 100644--- a/locales/ko-KR/chat.json+++ b/locales/ko-KR/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "총 {{count}} 획득","heteroAgent.executionTarget.auto": "자동","heteroAgent.executionTarget.autoDesc": "온라인 장치를 자동으로 사용하며, 여러 장치가 있을 경우 하나를 선택합니다",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}}대 온라인 · 총 {{total}}대",+ "heteroAgent.executionTarget.devicesGroup": "기기","heteroAgent.executionTarget.downloadDesktop": "데스크톱 앱 받기","heteroAgent.executionTarget.downloadDesktopDesc": "컴퓨터에 액세스할 수 있는 에이전트를 실행하세요","heteroAgent.executionTarget.downloadDesktopTitle": "데스크톱 앱 받기",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "설정","heteroAgent.executionTarget.localSandboxUnavailable": "이 장치에서 사용할 수 없음: {{reason}}","heteroAgent.executionTarget.manage": "관리",+ "heteroAgent.executionTarget.myDevicesGroup": "내 기기","heteroAgent.executionTarget.noWorkspaceDevices": "아직 워크스페이스 장치가 없습니다. 모든 구성원을 위해 기기를 등록하려면 `{{cmd}}`를 실행하세요.","heteroAgent.executionTarget.none": "장치 없음","heteroAgent.executionTarget.noneDesc": "활성화된 장치가 없습니다",diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.jsonindex cd5a9e149fc..d24452e171d 100644--- a/locales/nl-NL/chat.json+++ b/locales/nl-NL/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} in totaal verdiend","heteroAgent.executionTarget.auto": "Auto","heteroAgent.executionTarget.autoDesc": "Gebruik automatisch een online apparaat, waarbij er één wordt gekozen als er meerdere beschikbaar zijn",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} online · {{total}} in totaal",+ "heteroAgent.executionTarget.devicesGroup": "Apparaten","heteroAgent.executionTarget.downloadDesktop": "Download Desktop App","heteroAgent.executionTarget.downloadDesktopDesc": "Voer agents uit met toegang tot uw computer","heteroAgent.executionTarget.downloadDesktopTitle": "Download de desktop-app",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Instellen","heteroAgent.executionTarget.localSandboxUnavailable": "Niet beschikbaar op dit apparaat: {{reason}}","heteroAgent.executionTarget.manage": "Beheren",+ "heteroAgent.executionTarget.myDevicesGroup": "Mijn apparaten","heteroAgent.executionTarget.noWorkspaceDevices": "Nog geen werkruimte-apparaten. Voer `{{cmd}}` uit op een machine om deze voor elk lid in te schrijven.","heteroAgent.executionTarget.none": "Geen apparaat","heteroAgent.executionTarget.noneDesc": "Geen apparaat ingeschakeld",diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.jsonindex c602c18ae07..b315d55fcb7 100644--- a/locales/pl-PL/chat.json+++ b/locales/pl-PL/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} zdobytych w sumie","heteroAgent.executionTarget.auto": "Automatycznie","heteroAgent.executionTarget.autoDesc": "Automatycznie użyj urządzenia online, wybierając jedno, gdy dostępnych jest kilka",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} online · łącznie {{total}}",+ "heteroAgent.executionTarget.devicesGroup": "Urządzenia","heteroAgent.executionTarget.downloadDesktop": "Pobierz aplikację na komputer","heteroAgent.executionTarget.downloadDesktopDesc": "Uruchamiaj agentów z dostępem do swojego komputera","heteroAgent.executionTarget.downloadDesktopTitle": "Pobierz aplikację na komputer",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Skonfiguruj","heteroAgent.executionTarget.localSandboxUnavailable": "Niedostępne na tym urządzeniu: {{reason}}","heteroAgent.executionTarget.manage": "Zarządzaj",+ "heteroAgent.executionTarget.myDevicesGroup": "Moje urządzenia","heteroAgent.executionTarget.noWorkspaceDevices": "Brak urządzeń w przestrzeni roboczej. Uruchom `{{cmd}}` na maszynie, aby zarejestrować ją dla każdego członka.","heteroAgent.executionTarget.none": "Brak urządzenia","heteroAgent.executionTarget.noneDesc": "Brak włączonego urządzenia",diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.jsonindex f3382e4abb5..1a77d5c87c7 100644--- a/locales/pt-BR/chat.json+++ b/locales/pt-BR/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} ganhos no total","heteroAgent.executionTarget.auto": "Automático","heteroAgent.executionTarget.autoDesc": "Use um dispositivo online automaticamente, escolhendo um quando vários estiverem disponíveis",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} online · {{total}} no total",+ "heteroAgent.executionTarget.devicesGroup": "Dispositivos","heteroAgent.executionTarget.downloadDesktop": "Obter Aplicativo para Desktop","heteroAgent.executionTarget.downloadDesktopDesc": "Execute agentes com acesso ao seu computador","heteroAgent.executionTarget.downloadDesktopTitle": "Obter o aplicativo para desktop",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Configurar","heteroAgent.executionTarget.localSandboxUnavailable": "Não disponível neste dispositivo: {{reason}}","heteroAgent.executionTarget.manage": "Gerenciar",+ "heteroAgent.executionTarget.myDevicesGroup": "Meus dispositivos","heteroAgent.executionTarget.noWorkspaceDevices": "Ainda não há dispositivos no espaço de trabalho. Execute `{{cmd}}` em uma máquina para registrá-la para todos os membros.","heteroAgent.executionTarget.none": "Nenhum dispositivo","heteroAgent.executionTarget.noneDesc": "Nenhum dispositivo habilitado",diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.jsonindex 890109d14da..1a63370a0d3 100644--- a/locales/ru-RU/chat.json+++ b/locales/ru-RU/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "Всего заработано: {{count}}","heteroAgent.executionTarget.auto": "Авто","heteroAgent.executionTarget.autoDesc": "Автоматически использовать онлайн-устройство, выбирая одно из нескольких доступных",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} в сети · всего {{total}}",+ "heteroAgent.executionTarget.devicesGroup": "Устройства","heteroAgent.executionTarget.downloadDesktop": "Скачать приложение для компьютера","heteroAgent.executionTarget.downloadDesktopDesc": "Запускайте агентов с доступом к вашему компьютеру","heteroAgent.executionTarget.downloadDesktopTitle": "Скачать приложение для компьютера",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Настроить","heteroAgent.executionTarget.localSandboxUnavailable": "Недоступно на этом устройстве: {{reason}}","heteroAgent.executionTarget.manage": "Управлять",+ "heteroAgent.executionTarget.myDevicesGroup": "Мои устройства","heteroAgent.executionTarget.noWorkspaceDevices": "Пока нет устройств рабочего пространства. Запустите `{{cmd}}` на машине, чтобы зарегистрировать её для каждого участника.","heteroAgent.executionTarget.none": "Нет устройства","heteroAgent.executionTarget.noneDesc": "Устройство не включено",diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.jsonindex 6e3d5ed1f49..372a6729425 100644--- a/locales/tr-TR/chat.json+++ b/locales/tr-TR/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "Toplamda {{count}} kazanıldı","heteroAgent.executionTarget.auto": "Otomatik","heteroAgent.executionTarget.autoDesc": "Birden fazla cihaz mevcut olduğunda, otomatik olarak bir çevrimiçi cihaz seçin",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} çevrimiçi · toplam {{total}}",+ "heteroAgent.executionTarget.devicesGroup": "Cihazlar","heteroAgent.executionTarget.downloadDesktop": "Masaüstü Uygulamasını Edinin","heteroAgent.executionTarget.downloadDesktopDesc": "Bilgisayarınıza erişimi olan ajanları çalıştırın","heteroAgent.executionTarget.downloadDesktopTitle": "Masaüstü uygulamasını edinin",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Kurulum yap","heteroAgent.executionTarget.localSandboxUnavailable": "Bu cihazda mevcut değil: {{reason}}","heteroAgent.executionTarget.manage": "Yönet",+ "heteroAgent.executionTarget.myDevicesGroup": "Cihazlarım","heteroAgent.executionTarget.noWorkspaceDevices": "Henüz çalışma alanı cihazı yok. Her üye için bir cihazı kaydetmek için bir makinede `{{cmd}}` komutunu çalıştırın.","heteroAgent.executionTarget.none": "Cihaz yok","heteroAgent.executionTarget.noneDesc": "Etkinleştirilmiş cihaz yok",diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.jsonindex df968db190e..2b9089e54d7 100644--- a/locales/vi-VN/chat.json+++ b/locales/vi-VN/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "{{count}} đã kiếm được tổng cộng","heteroAgent.executionTarget.auto": "Tự động","heteroAgent.executionTarget.autoDesc": "Tự động sử dụng một thiết bị trực tuyến, chọn một thiết bị khi có nhiều thiết bị khả dụng",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} trực tuyến · tổng {{total}}",+ "heteroAgent.executionTarget.devicesGroup": "Thiết bị","heteroAgent.executionTarget.downloadDesktop": "Tải ứng dụng máy tính","heteroAgent.executionTarget.downloadDesktopDesc": "Chạy các tác nhân với quyền truy cập vào máy tính của bạn","heteroAgent.executionTarget.downloadDesktopTitle": "Tải ứng dụng máy tính",@@ -1526,6 +1528,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "Thiết lập","heteroAgent.executionTarget.localSandboxUnavailable": "Không khả dụng trên thiết bị này: {{reason}}","heteroAgent.executionTarget.manage": "Quản lý",+ "heteroAgent.executionTarget.myDevicesGroup": "Thiết bị của tôi","heteroAgent.executionTarget.noWorkspaceDevices": "Chưa có thiết bị không gian làm việc. Chạy `{{cmd}}` trên một máy để đăng ký cho mọi thành viên.","heteroAgent.executionTarget.none": "Không có thiết bị","heteroAgent.executionTarget.noneDesc": "Không có thiết bị được kích hoạt",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 8d576ff0851..82cd43c7373 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -1551,6 +1551,8 @@"heteroAgent.executionTarget.auto": "自动","heteroAgent.executionTarget.autoDesc": "自动使用在线设备,有多台时择一使用","heteroAgent.executionTarget.builtinGroup": "内置",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} 台在线 · 共 {{total}} 台",+ "heteroAgent.executionTarget.devicesGroup": "设备","heteroAgent.executionTarget.downloadDesktop": "下载桌面端","heteroAgent.executionTarget.downloadDesktopDesc": "让 Agent 直接连接你的电脑","heteroAgent.executionTarget.downloadDesktopTitle": "下载桌面端",@@ -1567,6 +1569,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "启用","heteroAgent.executionTarget.localSandboxUnavailable": "此设备上不可用:{{reason}}","heteroAgent.executionTarget.manage": "管理",+ "heteroAgent.executionTarget.myDevicesGroup": "我的设备","heteroAgent.executionTarget.noDevices": "暂无其他设备。在另一台电脑上执行 `lh connect` 即可接入。","heteroAgent.executionTarget.noWorkspaceDevices": "暂无工作区设备。在一台机器上执行 `{{cmd}}` 即可注册,供所有成员使用。","heteroAgent.executionTarget.none": "无设备",@@ -1590,6 +1593,7 @@"heteroAgent.executionTarget.switchTopic.content": "本话题一直在「{{name}}」上运行,工作目录和会话都保存在那里。切换后,下一轮会在新环境中开启新会话;之后的新话题也会使用这个选择。","heteroAgent.executionTarget.switchTopic.ok": "切换","heteroAgent.executionTarget.switchTopic.title": "将本话题切换到其他执行环境?",+ "heteroAgent.executionTarget.temporarySandbox": "临时沙箱","heteroAgent.executionTarget.temporarySandboxDesc": "即用即销毁,适合编程和临时数据处理","heteroAgent.executionTarget.title": "执行环境","heteroAgent.executionTarget.topicTag": "本话题",diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.jsonindex 03bd0816ab9..524208acd56 100644--- a/locales/zh-TW/chat.json+++ b/locales/zh-TW/chat.json@@ -1512,6 +1512,8 @@"heteroAgent.codexQuota.totalEarned_other": "總共獲得 {{count}}","heteroAgent.executionTarget.auto": "自動","heteroAgent.executionTarget.autoDesc": "自動使用在線設備,當有多個可用時選擇一個",+ "heteroAgent.executionTarget.deviceGroupSummary": "{{online}} 台在線 · 共 {{total}} 台",+ "heteroAgent.executionTarget.devicesGroup": "裝置","heteroAgent.executionTarget.downloadDesktop": "下載桌面應用程式","heteroAgent.executionTarget.downloadDesktopDesc": "運行可訪問您電腦的代理","heteroAgent.executionTarget.downloadDesktopTitle": "下載桌面應用程式",@@ -1528,6 +1530,7 @@"heteroAgent.executionTarget.localSandboxSetUp": "設置","heteroAgent.executionTarget.localSandboxUnavailable": "此設備上不可用:{{reason}}","heteroAgent.executionTarget.manage": "管理",+ "heteroAgent.executionTarget.myDevicesGroup": "我的裝置","heteroAgent.executionTarget.noWorkspaceDevices": "尚無工作區設備。在機器上執行 `{{cmd}}`,以便為每位成員註冊。","heteroAgent.executionTarget.none": "無設備","heteroAgent.executionTarget.noneDesc": "未啟用任何設備",@@ -1547,6 +1550,7 @@"heteroAgent.executionTarget.switchTopic.content": "此主題已在 {{name}} 上運行,其工作目錄和代理會話已保留。切換後,其下一回合將在新環境中啟動一個新會話。新主題也將使用此選擇。","heteroAgent.executionTarget.switchTopic.ok": "切換","heteroAgent.executionTarget.switchTopic.title": "將此主題移至另一個環境?",+ "heteroAgent.executionTarget.temporarySandbox": "臨時沙盒","heteroAgent.executionTarget.title": "執行環境","heteroAgent.executionTarget.topicTag": "此主題","heteroAgent.executionTarget.unknownDevice": "未知設備",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 65b8c0d8ed2..33eeffc49a0 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -978,9 +978,13 @@ export default {'heteroAgent.executionTarget.persistentSandbox': 'Persistent Sandbox','heteroAgent.executionTarget.persistentSandboxDesc':'Keeps results and work on your drive, for everyday tasks',+ 'heteroAgent.executionTarget.temporarySandbox': 'Temporary Sandbox','heteroAgent.executionTarget.temporarySandboxDesc':'Discarded after use, for coding and one-off data processing','heteroAgent.executionTarget.workspaceGroup': 'Workspace Devices',+ 'heteroAgent.executionTarget.deviceGroupSummary': '{{online}} online · {{total}} total',+ 'heteroAgent.executionTarget.devicesGroup': 'Devices',+ 'heteroAgent.executionTarget.myDevicesGroup': 'My devices','heteroAgent.executionTarget.downloadDesktop': 'Get Desktop App','heteroAgent.executionTarget.downloadDesktopDesc': 'Run agents with access to your computer','heteroAgent.executionTarget.downloadDesktopTitle': 'Get the desktop app',diff --git a/src/features/ChatInput/ControlBar/DeviceGroupSubmenu.tsx b/src/features/ChatInput/ControlBar/DeviceGroupSubmenu.tsxnew file mode 100644index 00000000000..c52246e9543--- /dev/null+++ b/src/features/ChatInput/ControlBar/DeviceGroupSubmenu.tsx@@ -0,0 +1,102 @@+'use client';++import type { DeviceListItem } from '@lobechat/types';+import { Flexbox, Icon, Popover } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import { Building2Icon, LockKeyholeIcon, MonitorSmartphoneIcon } from 'lucide-react';+import { memo, type ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++import { summarizeDeviceGroup } from './deviceGroupSummary';+import OptionRow from './OptionRow';+import SubmenuHeader from './SubmenuHeader';++const styles = stylex.create({+ list: {+ overflowY: 'auto',+ maxHeight: '360px',+ },+});++/**+ * The list can grow after the submenu opens (a reconnect, a fresh device list),+ * so the positioner is left to size itself again rather than keep its first+ * measurement — same as the work-location submenus.+ */+const SUBMENU_STYLES = {+ content: { padding: 4 },+ root: { height: 'auto', width: 'auto' },+};++/** Which pool the group is: a workspace's private or shared devices, or the caller's own. */+export type DeviceGroupKind = 'devices' | 'private' | 'workspace';++const GROUP_ICONS = {+ devices: MonitorSmartphoneIcon,+ private: LockKeyholeIcon,+ workspace: Building2Icon,+} as const;++interface DeviceGroupSubmenuProps {+ /** The device the agent is set to run on, when it is one of this group's. */+ activeDeviceId?: string;+ devices: DeviceListItem[];+ kind: DeviceGroupKind;+ label: string;+ renderDevice: (device: DeviceListItem) => ReactNode;+}++/**+ * One device group in the execution environment menu, as a second level: the+ * first level keeps a single row per group — how many machines are online, and+ * the current pick by name — and the machines themselves open beside it. A+ * growing fleet then lengthens the submenu, not the menu the built-in+ * environments live in.+ */+const DeviceGroupSubmenu = memo<DeviceGroupSubmenuProps>(+ ({ activeDeviceId, devices, kind, label, renderDevice }) => {+ const { t } = useTranslation('chat');+ const { activeDevice, online, presenceUnknown, total } = summarizeDeviceGroup(+ devices,+ activeDeviceId,+ );++ return (+ <Popover+ arrow={false}+ closeDelay={150}+ placement={'rightBottom'}+ styles={SUBMENU_STYLES}+ trigger={['hover', 'click']}+ content={+ <Flexbox gap={2} style={{ maxWidth: 320, minWidth: 280 }}>+ <SubmenuHeader title={label} />+ <div {...stylex.props(styles.list)}>{devices.map((d) => renderDevice(d))}</div>+ </Flexbox>+ }+ >+ <div data-testid={`device-group-${kind}`}>+ <OptionRow+ arrow+ active={!!activeDevice}+ hint={activeDevice ? activeDevice.friendlyName || activeDevice.hostname : undefined}+ icon={<Icon icon={GROUP_ICONS[kind]} size={14} />}+ label={label}+ desc={+ // Until presence is confirmed the count would read "0 online";+ // say it is still checking, as the device rows themselves do.+ presenceUnknown+ ? t('heteroAgent.executionTarget.presenceChecking')+ : t('heteroAgent.executionTarget.deviceGroupSummary', { online, total })+ }+ onClick={() => {}}+ />+ </div>+ </Popover>+ );+ },+);++DeviceGroupSubmenu.displayName = 'DeviceGroupSubmenu';++export default DeviceGroupSubmenu;diff --git a/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx b/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsxindex dd810ecc86c..09c85f6e20b 100644--- a/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx@@ -50,6 +50,7 @@ import { useElectronStore } from '@/store/electron';import { useTopicId } from '../hooks/useTopicId';import { formatLockedControlTooltip } from '../utils/lockedControlTooltip';+import DeviceGroupSubmenu from './DeviceGroupSubmenu';import DeviceOptionRow from './DeviceOptionRow';import { getDevicePoolStatus } from './devicePoolStatus';import OptionRow from './OptionRow';@@ -102,12 +103,6 @@ const styles = stylex.create({color: { 'default': cssVar.colorTextQuaternary, ':hover': cssVar.colorTextSecondary },transition: 'color 0.2s',},- deviceList: {- overflowY: 'auto',- maxHeight: '240px',- marginInlineEnd: '-4px',- paddingInlineEnd: '4px',- },empty: {paddingBlock: '8px',paddingInline: '8px',@@ -560,7 +555,15 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {// Compute chiplet chipIcon: ReactNode = <ExecutionTargetIcon target={'sandbox'} />;- let chipLabel = t('heteroAgent.executionTarget.sandbox');+ // Next to the persistent sandbox the plain one is named for what sets it+ // apart: it is discarded after use. Without a drive on offer there is only+ // one sandbox, and it keeps its usual name.+ const sandboxLabel = t(+ offersPersistentSandbox+ ? 'heteroAgent.executionTarget.temporarySandbox'+ : 'heteroAgent.executionTarget.sandbox',+ );+ let chipLabel = sandboxLabel;if (chipExecutionTarget === 'sandbox' && sandboxMode.persistent) {chipIcon = <Icon icon={HardDriveIcon} size={14} />;chipLabel = t('heteroAgent.executionTarget.persistentSandbox');@@ -631,6 +634,9 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {};const showLocalRow = isDesktop && (!ownWorkspaceDevice || isActive('local'));+ const activeDeviceId = executionTarget === 'device' ? boundDeviceId : undefined;+ const hasDeviceSection =+ privateDevices.length + workspaceDevices.length + personalOnlyDevices.length > 0;const renderDeviceRow = (d: DeviceListItem, { thisComputer = false } = {}) => (<DeviceOptionRowactive={isActive('device', d.deviceId)}@@ -704,7 +710,11 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {`local` is still the pick) it keeps its machine name, so two rowsnever both read "This computer". */}{thisComputerDevices.map((d) => renderDeviceRow(d, { thisComputer: !showLocalRow }))}- {isDesktop ? (+ {/* Desktop always splits This computer from Built-in. On web Built-in is+ labelled once a Devices section follows: with Persistent and Cloud+ Sandbox side by side, the device directories below would otherwise+ read as a third sandbox. */}+ {isDesktop || hasDeviceSection ? (<div {...stylex.props(styles.groupLabel)}>{t('heteroAgent.executionTarget.builtinGroup')}</div>@@ -814,7 +824,7 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {active={isActive('sandbox') && !sandboxMode.persistent}disabled={!supportsSandbox}icon={<ExecutionTargetIcon target={'sandbox'} />}- label={t('heteroAgent.executionTarget.sandbox')}+ label={sandboxLabel}desc={t(!supportsSandbox? 'heteroAgent.executionTarget.sandboxUnsupported'@@ -825,42 +835,45 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {)}onClick={() => void selectSandbox(false)}/>- {deviceRows.length > 0 ? (- showDeviceGroups ? (- <>- {privateDevices.length > 0 ? (- <>- <div {...stylex.props(styles.groupLabel)}>- {t('heteroAgent.executionTarget.personalGroup')}- </div>- <div {...stylex.props(styles.deviceList)}>- {privateDevices.map((d) => renderDeviceRow(d))}- </div>- </>- ) : null}- {workspaceDevices.length > 0 ? (- <>- <div {...stylex.props(styles.groupLabel)}>- {t('heteroAgent.executionTarget.workspaceGroup')}- </div>- <div {...stylex.props(styles.deviceList)}>- {workspaceDevices.map((d) => renderDeviceRow(d))}- </div>- </>- ) : null}- </>- ) : personalOnlyDevices.length > 0 ? (- <>- {isDesktop ? (- <div {...stylex.props(styles.groupLabel)}>- {t('heteroAgent.executionTarget.otherDevicesGroup')}- </div>- ) : null}- <div {...stylex.props(styles.deviceList)}>- {personalOnlyDevices.map((d) => renderDeviceRow(d))}- </div>- </>- ) : null+ {/* Devices sit one level down, a row per group: the list keeps growing,+ and the built-in environments above should not scroll away with it.+ The section gets its own label, as Built-in has, so the group rows+ don't read as more built-in environments. */}+ {hasDeviceSection ? (+ <div {...stylex.props(styles.groupLabel)}>+ {t('heteroAgent.executionTarget.devicesGroup')}+ </div>+ ) : null}+ {showDeviceGroups && privateDevices.length > 0 ? (+ <DeviceGroupSubmenu+ activeDeviceId={activeDeviceId}+ devices={privateDevices}+ kind={'private'}+ label={t('heteroAgent.executionTarget.personalGroup')}+ renderDevice={renderDeviceRow}+ />+ ) : null}+ {showDeviceGroups && workspaceDevices.length > 0 ? (+ <DeviceGroupSubmenu+ activeDeviceId={activeDeviceId}+ devices={workspaceDevices}+ kind={'workspace'}+ label={t('heteroAgent.executionTarget.workspaceGroup')}+ renderDevice={renderDeviceRow}+ />+ ) : null}+ {!showDeviceGroups && personalOnlyDevices.length > 0 ? (+ <DeviceGroupSubmenu+ activeDeviceId={activeDeviceId}+ devices={personalOnlyDevices}+ kind={'devices'}+ renderDevice={renderDeviceRow}+ label={t(+ isDesktop+ ? 'heteroAgent.executionTarget.otherDevicesGroup'+ : 'heteroAgent.executionTarget.myDevicesGroup',+ )}+ />) : null}{poolStatus === 'loading' ? (<div {...stylex.props(styles.empty)}>{t('heteroAgent.executionTarget.loading')}</div>diff --git a/src/features/ChatInput/ControlBar/__tests__/DeviceGroupSubmenu.test.tsx b/src/features/ChatInput/ControlBar/__tests__/DeviceGroupSubmenu.test.tsxnew file mode 100644index 00000000000..463dbf96199--- /dev/null+++ b/src/features/ChatInput/ControlBar/__tests__/DeviceGroupSubmenu.test.tsx@@ -0,0 +1,112 @@+import type { DeviceListItem } from '@lobechat/types';+import { fireEvent, render, screen } from '@testing-library/react';+import type { ReactNode } from 'react';+import { describe, expect, it, vi } from 'vitest';++import DeviceGroupSubmenu from '../DeviceGroupSubmenu';++vi.mock('react-i18next', () => ({+ useTranslation: () => ({+ t: (key: string, options?: Record<string, unknown>) =>+ options ? `${key}:${JSON.stringify(options)}` : key,+ }),+}));++// The popover itself is @lobehub/ui's; what matters here is what the group puts+// on the first level and what it hands the second level.+vi.mock('@lobehub/ui', async (importOriginal) => ({+ ...(await importOriginal<Record<string, unknown>>()),+ Popover: ({ children, content }: { children: ReactNode; content: ReactNode }) => (+ <div>+ {children}+ <div data-testid={'submenu'}>{content}</div>+ </div>+ ),+}));++const device = (deviceId: string, online: boolean, friendlyName?: string) =>+ ({+ channels: [],+ deviceId,+ friendlyName,+ hostname: deviceId,+ online,+ }) as unknown as DeviceListItem;++const devices = [+ device('hetzner', true, 'Hetzner 8C64G'),+ device('zeabur', true),+ device('lin-pc', false),+];++describe('DeviceGroupSubmenu', () => {+ it('keeps one first-level row with the online count, and lists the devices in the submenu', () => {+ render(+ <DeviceGroupSubmenu+ devices={devices}+ kind={'private'}+ label={'Private Devices'}+ renderDevice={(d) => <div key={d.deviceId}>row:{d.deviceId}</div>}+ />,+ );++ const groupRow = screen.getByTestId('device-group-private');+ expect(groupRow.textContent).toContain('Private Devices');+ expect(groupRow.textContent).toContain('"online":2');+ expect(groupRow.textContent).toContain('"total":3');+ expect(groupRow.textContent).not.toContain('row:');++ const submenu = screen.getByTestId('submenu');+ expect(submenu.textContent).toContain('row:hetzner');+ expect(submenu.textContent).toContain('row:zeabur');+ expect(submenu.textContent).toContain('row:lin-pc');+ });++ it('names the picked device on the first level when it is in the group', () => {+ render(+ <DeviceGroupSubmenu+ activeDeviceId={'hetzner'}+ devices={devices}+ kind={'private'}+ label={'Private Devices'}+ renderDevice={(d) => <div key={d.deviceId}>row:{d.deviceId}</div>}+ />,+ );++ expect(screen.getByTestId('device-group-private').textContent).toContain('Hetzner 8C64G');+ });++ it('says presence is still being checked instead of counting cached rows as offline', () => {+ render(+ <DeviceGroupSubmenu+ devices={[{ ...device('cached', false), onlineUnknown: true } as DeviceListItem]}+ kind={'devices'}+ label={'Devices'}+ renderDevice={(d) => <div key={d.deviceId}>row:{d.deviceId}</div>}+ />,+ );++ const groupRow = screen.getByTestId('device-group-devices');+ expect(groupRow.textContent).toContain('heteroAgent.executionTarget.presenceChecking');+ expect(groupRow.textContent).not.toContain('"online":0');+ });++ it('hands a device click to the row the caller renders', () => {+ const onSelect = vi.fn();+ render(+ <DeviceGroupSubmenu+ devices={devices}+ kind={'workspace'}+ label={'Workspace Devices'}+ renderDevice={(d) => (+ <button key={d.deviceId} type={'button'} onClick={() => onSelect(d.deviceId)}>+ {d.deviceId}+ </button>+ )}+ />,+ );++ fireEvent.click(screen.getByText('zeabur'));+ expect(onSelect).toHaveBeenCalledWith('zeabur');+ });+});diff --git a/src/features/ChatInput/ControlBar/__tests__/HeteroDeviceSwitcher.sandboxMode.test.tsx b/src/features/ChatInput/ControlBar/__tests__/HeteroDeviceSwitcher.sandboxMode.test.tsxindex 891b984385b..31ccb0a64eb 100644--- a/src/features/ChatInput/ControlBar/__tests__/HeteroDeviceSwitcher.sandboxMode.test.tsx+++ b/src/features/ChatInput/ControlBar/__tests__/HeteroDeviceSwitcher.sandboxMode.test.tsx@@ -97,6 +97,7 @@ vi.mock('../useSandboxModeSelect', () => ({}));const SANDBOX = 'heteroAgent.executionTarget.sandbox';+const TEMPORARY = 'heteroAgent.executionTarget.temporarySandbox';const PERSISTENT = 'heteroAgent.executionTarget.persistentSandbox';beforeEach(() => {@@ -117,10 +118,19 @@ describe('HeteroDeviceSwitcher — persistent sandbox', () => {it('offers the persistent sandbox next to the temporary one', () => {render(<HeteroDeviceSwitcher agentId="agent-1" />);- expect(screen.getAllByText(SANDBOX).length).toBeGreaterThan(0);+ expect(screen.getAllByText(TEMPORARY).length).toBeGreaterThan(0);expect(screen.getByText('heteroAgent.executionTarget.persistentSandboxDesc')).toBeTruthy();});+ // Next to the persistent sandbox, the plain one is called the temporary+ // sandbox, on its row and on the chip.+ it('names the plain sandbox temporary next to the persistent one', () => {+ render(<HeteroDeviceSwitcher agentId="agent-1" />);++ expect(screen.getByTestId('chip').textContent).toContain(TEMPORARY);+ expect(screen.queryByText(SANDBOX)).toBeNull();+ });+// The persistent sandbox is where everyday work belongs, so it comes first;// the temporary one is described as the place for coding and one-off work.it('lists the persistent sandbox above the temporary one', () => {@@ -141,6 +151,8 @@ describe('HeteroDeviceSwitcher — persistent sandbox', () => {expect(screen.getByText('heteroAgent.executionTarget.sandboxDesc')).toBeTruthy();expect(screen.queryByText('heteroAgent.executionTarget.temporarySandboxDesc')).toBeNull();+ expect(screen.getAllByText(SANDBOX).length).toBeGreaterThan(0);+ expect(screen.queryByText(TEMPORARY)).toBeNull();});it('names the persistent sandbox on the chip when the conversation keeps its files', () => {diff --git a/src/features/ChatInput/ControlBar/__tests__/deviceGroupSummary.test.ts b/src/features/ChatInput/ControlBar/__tests__/deviceGroupSummary.test.tsnew file mode 100644index 00000000000..08ed26aa0dc--- /dev/null+++ b/src/features/ChatInput/ControlBar/__tests__/deviceGroupSummary.test.ts@@ -0,0 +1,44 @@+import type { DeviceListItem } from '@lobechat/types';+import { describe, expect, it } from 'vitest';++import { summarizeDeviceGroup } from '../deviceGroupSummary';++const device = (deviceId: string, online: boolean) =>+ ({ channels: [], deviceId, hostname: deviceId, online }) as unknown as DeviceListItem;++describe('summarizeDeviceGroup', () => {+ it('counts online devices against the whole group', () => {+ const summary = summarizeDeviceGroup([+ device('a', true),+ device('b', false),+ device('c', true),+ ]);++ expect(summary.online).toBe(2);+ expect(summary.total).toBe(3);+ expect(summary.activeDevice).toBeUndefined();+ });++ it('names the active device only when it belongs to the group', () => {+ const devices = [device('a', true), device('b', false)];++ expect(summarizeDeviceGroup(devices, 'b').activeDevice?.deviceId).toBe('b');+ expect(summarizeDeviceGroup(devices, 'elsewhere').activeDevice).toBeUndefined();+ });++ it('handles an empty group', () => {+ expect(summarizeDeviceGroup([])).toEqual({+ activeDevice: undefined,+ online: 0,+ presenceUnknown: false,+ total: 0,+ });+ });++ it('flags a group whose presence is not confirmed yet', () => {+ const cached = { ...device('a', false), onlineUnknown: true } as DeviceListItem;++ expect(summarizeDeviceGroup([cached, device('b', true)]).presenceUnknown).toBe(true);+ expect(summarizeDeviceGroup([device('b', true)]).presenceUnknown).toBe(false);+ });+});diff --git a/src/features/ChatInput/ControlBar/deviceGroupSummary.ts b/src/features/ChatInput/ControlBar/deviceGroupSummary.tsnew file mode 100644index 00000000000..d57f75baa14--- /dev/null+++ b/src/features/ChatInput/ControlBar/deviceGroupSummary.ts@@ -0,0 +1,30 @@+import type { DeviceListItem } from '@lobechat/types';++import { isDevicePresenceUnknown } from '@/store/device';++export interface DeviceGroupSummary {+ /** The group's device that is the current pick, so the first level can name it. */+ activeDevice?: DeviceListItem;+ online: number;+ /**+ * A row restored from the persisted list before the server confirms presence+ * reads `online: false`, so the online count would undercount until then.+ */+ presenceUnknown: boolean;+ total: number;+}++/**+ * What the first level of the execution environment menu says about a device+ * group without opening it: how many of its machines can run now, and which+ * one (if any) is the current pick.+ */+export const summarizeDeviceGroup = (+ devices: DeviceListItem[],+ activeDeviceId?: string,+): DeviceGroupSummary => ({+ activeDevice: activeDeviceId ? devices.find((d) => d.deviceId === activeDeviceId) : undefined,+ online: devices.filter((d) => d.online).length,+ presenceUnknown: devices.some((d) => isDevicePresenceUnknown(d)),+ total: devices.length,+});