🤯 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
✨ feat(topic): merge one machine's device identities in topic groups (#22243)
Mocha67aaf17da1f4
diff --git a/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts b/apps/desktop/src/main/controllers/GatewayConnectionCtr.tsindex ef21227bf5a..16d40bdac90 100644--- a/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts+++ b/apps/desktop/src/main/controllers/GatewayConnectionCtr.ts@@ -285,6 +285,16 @@ export default class GatewayConnectionCtr extends ControllerModule {return this.service.resolveCurrentDeviceId();}+ /**+ * The id this machine holds as a device of `workspaceId` — derived locally,+ * whether or not it is enrolled there — so the renderer can tell its own+ * workspace device apart from other machines.+ */+ @IpcMethod()+ async getWorkspaceDeviceId({ workspaceId }: { workspaceId: string }): Promise<string> {+ return this.service.resolveWorkspaceDeviceId(workspaceId);+ }+@IpcMethod()async getDeviceInfo(): Promise<{deviceId: string;diff --git a/apps/desktop/src/main/services/gatewayConnectionSrv.ts b/apps/desktop/src/main/services/gatewayConnectionSrv.tsindex cd6ac8d77e1..769199e138f 100644--- a/apps/desktop/src/main/services/gatewayConnectionSrv.ts+++ b/apps/desktop/src/main/services/gatewayConnectionSrv.ts@@ -868,6 +868,10 @@ export default class GatewayConnectionService extends ServiceModule {return { success: true };}+ async resolveWorkspaceDeviceId(workspaceId: string): Promise<string> {+ return (await this.resolveWorkspaceDeviceIdentity(workspaceId)).deviceId;+ }+/*** Identity for a WORKSPACE share connection. MUST stay byte-compatible with* the CLI's `resolveWorkspaceDeviceIdentity` (apps/cli/src/device/register.ts):diff --git a/locales/ar/chat.json b/locales/ar/chat.jsonindex d1b060aed9e..4f83795a919 100644--- a/locales/ar/chat.json+++ b/locales/ar/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "متصل","heteroAgent.executionTarget.onlineConnections_one": "متصل · {{count}} اتصال","heteroAgent.executionTarget.onlineConnections_other": "متصل · {{count}} اتصالات",- "heteroAgent.executionTarget.personalGroup": "شخصي",+ "heteroAgent.executionTarget.personalGroup": "الأجهزة الخاصة","heteroAgent.executionTarget.presenceChecking": "جارٍ التحقق من الحالة...","heteroAgent.executionTarget.projectDevicesHint": "يتم إدراج الأجهزة التي تحتوي على دليل العمل لهذا المشروع فقط. أضف دليلاً لجهاز آخر في إعدادات المشروع.","heteroAgent.executionTarget.reconnect": "إعادة الاتصال",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "بيئة التنفيذ","heteroAgent.executionTarget.topicTag": "هذا الموضوع","heteroAgent.executionTarget.unknownDevice": "جهاز غير معروف",- "heteroAgent.executionTarget.workspaceGroup": "مساحة العمل",+ "heteroAgent.executionTarget.workspaceGroup": "أجهزة مساحة العمل","heteroAgent.fullAccess.label": "وصول كامل","heteroAgent.fullAccess.tooltip": "يعمل Claude Code محليًا مع صلاحية قراءة/كتابة كاملة في دليل العمل. تبديل أوضاع الصلاحيات غير متاح بعد.","heteroAgent.kimiCodeQuota.calendar.title": "تقويم استخدام Kimi Code",diff --git a/locales/bg-BG/chat.json b/locales/bg-BG/chat.jsonindex 8fd8c864ef5..2fa20250a26 100644--- a/locales/bg-BG/chat.json+++ b/locales/bg-BG/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Онлайн","heteroAgent.executionTarget.onlineConnections_one": "Онлайн · {{count}} връзка","heteroAgent.executionTarget.onlineConnections_other": "Онлайн · {{count}} връзки",- "heteroAgent.executionTarget.personalGroup": "Лично",+ "heteroAgent.executionTarget.personalGroup": "Лични устройства","heteroAgent.executionTarget.presenceChecking": "Проверка на статуса...","heteroAgent.executionTarget.projectDevicesHint": "Само устройства с работната директория на този проект са изброени. Добавете директория за друго устройство в настройките на проекта.","heteroAgent.executionTarget.reconnect": "Свържи отново",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Среда за изпълнение","heteroAgent.executionTarget.topicTag": "Тази тема","heteroAgent.executionTarget.unknownDevice": "Неизвестно устройство",- "heteroAgent.executionTarget.workspaceGroup": "Работно пространство",+ "heteroAgent.executionTarget.workspaceGroup": "Устройства в работното пространство","heteroAgent.fullAccess.label": "Пълен достъп","heteroAgent.fullAccess.tooltip": "Claude Code работи локално с пълен достъп за четене/запис в работната директория. Превключването на режимите на достъп все още не е налично.","heteroAgent.kimiCodeQuota.calendar.title": "Календар за използване на Kimi Code",diff --git a/locales/de-DE/chat.json b/locales/de-DE/chat.jsonindex f1c950c8cb8..be3e867391f 100644--- a/locales/de-DE/chat.json+++ b/locales/de-DE/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Online","heteroAgent.executionTarget.onlineConnections_one": "Online · {{count}} Verbindung","heteroAgent.executionTarget.onlineConnections_other": "Online · {{count}} Verbindungen",- "heteroAgent.executionTarget.personalGroup": "Persönlich",+ "heteroAgent.executionTarget.personalGroup": "Private Geräte","heteroAgent.executionTarget.presenceChecking": "Status wird überprüft…","heteroAgent.executionTarget.projectDevicesHint": "Es werden nur Geräte mit dem Arbeitsverzeichnis dieses Projekts aufgelistet. Fügen Sie ein Verzeichnis für ein anderes Gerät in den Projekteinstellungen hinzu.","heteroAgent.executionTarget.reconnect": "Erneut verbinden",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Ausführungsumgebung","heteroAgent.executionTarget.topicTag": "Dieses Thema","heteroAgent.executionTarget.unknownDevice": "Unbekanntes Gerät",- "heteroAgent.executionTarget.workspaceGroup": "Arbeitsbereich",+ "heteroAgent.executionTarget.workspaceGroup": "Geräte im Arbeitsbereich","heteroAgent.fullAccess.label": "Vollzugriff","heteroAgent.fullAccess.tooltip": "Claude Code läuft lokal mit vollständigem Lese-/Schreibzugriff auf das Arbeitsverzeichnis. Das Umschalten von Berechtigungsmodi ist derzeit nicht verfügbar.","heteroAgent.kimiCodeQuota.calendar.title": "Kimi Code-Nutzungskalender",diff --git a/locales/es-ES/chat.json b/locales/es-ES/chat.jsonindex c80f71e822e..8b59c2573db 100644--- a/locales/es-ES/chat.json+++ b/locales/es-ES/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Conectado","heteroAgent.executionTarget.onlineConnections_one": "En línea · {{count}} conexión","heteroAgent.executionTarget.onlineConnections_other": "En línea · {{count}} conexiones",- "heteroAgent.executionTarget.personalGroup": "Personal",+ "heteroAgent.executionTarget.personalGroup": "Dispositivos privados","heteroAgent.executionTarget.presenceChecking": "Comprobando el estado…","heteroAgent.executionTarget.projectDevicesHint": "Solo se enumeran los dispositivos con el directorio de trabajo de este proyecto. Agrega un directorio para otro dispositivo en la configuración del proyecto.","heteroAgent.executionTarget.reconnect": "Reconectar",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Entorno de Ejecución","heteroAgent.executionTarget.topicTag": "Este tema","heteroAgent.executionTarget.unknownDevice": "Dispositivo desconocido",- "heteroAgent.executionTarget.workspaceGroup": "Espacio de trabajo",+ "heteroAgent.executionTarget.workspaceGroup": "Dispositivos del espacio de trabajo","heteroAgent.fullAccess.label": "Acceso completo","heteroAgent.fullAccess.tooltip": "Claude Code se ejecuta localmente con acceso completo de lectura y escritura al directorio de trabajo. Cambiar los modos de permiso aún no está disponible.","heteroAgent.kimiCodeQuota.calendar.title": "Calendario de uso de Kimi Code",diff --git a/locales/fa-IR/chat.json b/locales/fa-IR/chat.jsonindex f15f63e404b..9099e8da087 100644--- a/locales/fa-IR/chat.json+++ b/locales/fa-IR/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "آنلاین","heteroAgent.executionTarget.onlineConnections_one": "آنلاین · {{count}} اتصال","heteroAgent.executionTarget.onlineConnections_other": "آنلاین · {{count}} اتصالات",- "heteroAgent.executionTarget.personalGroup": "شخصی",+ "heteroAgent.executionTarget.personalGroup": "دستگاههای خصوصی","heteroAgent.executionTarget.presenceChecking": "در حال بررسی وضعیت…","heteroAgent.executionTarget.projectDevicesHint": "فقط دستگاههایی که دارای دایرکتوری کاری این پروژه هستند فهرست شدهاند. برای افزودن دایرکتوری برای دستگاه دیگر، به تنظیمات پروژه بروید.","heteroAgent.executionTarget.reconnect": "اتصال مجدد",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "محیط اجرایی","heteroAgent.executionTarget.topicTag": "این موضوع","heteroAgent.executionTarget.unknownDevice": "دستگاه ناشناخته",- "heteroAgent.executionTarget.workspaceGroup": "محیط کاری",+ "heteroAgent.executionTarget.workspaceGroup": "دستگاههای محیط کاری","heteroAgent.fullAccess.label": "دسترسی کامل","heteroAgent.fullAccess.tooltip": "Claude Code بهصورت محلی با دسترسی کامل خواندن/نوشتن در پوشه کاری اجرا میشود. تغییر حالتهای دسترسی فعلاً امکانپذیر نیست.","heteroAgent.kimiCodeQuota.calendar.title": "تقویم استفاده Kimi Code",diff --git a/locales/fr-FR/chat.json b/locales/fr-FR/chat.jsonindex 89238358f67..ceea9346102 100644--- a/locales/fr-FR/chat.json+++ b/locales/fr-FR/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "En ligne","heteroAgent.executionTarget.onlineConnections_one": "En ligne · {{count}} connexion","heteroAgent.executionTarget.onlineConnections_other": "En ligne · {{count}} connexions",- "heteroAgent.executionTarget.personalGroup": "Personnel",+ "heteroAgent.executionTarget.personalGroup": "Appareils privés","heteroAgent.executionTarget.presenceChecking": "Vérification du statut…","heteroAgent.executionTarget.projectDevicesHint": "Seuls les appareils avec le répertoire de travail de ce projet sont listés. Ajoutez un répertoire pour un autre appareil dans les paramètres du projet.","heteroAgent.executionTarget.reconnect": "Reconnecter",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Environnement d'exécution","heteroAgent.executionTarget.topicTag": "Ce sujet","heteroAgent.executionTarget.unknownDevice": "Appareil inconnu",- "heteroAgent.executionTarget.workspaceGroup": "Espace de travail",+ "heteroAgent.executionTarget.workspaceGroup": "Appareils de l'espace de travail","heteroAgent.fullAccess.label": "Accès complet","heteroAgent.fullAccess.tooltip": "Claude Code s’exécute localement avec un accès complet en lecture/écriture au répertoire de travail. Le changement de mode d’autorisation n’est pas encore disponible.","heteroAgent.kimiCodeQuota.calendar.title": "Calendrier d'utilisation de Kimi Code",diff --git a/locales/it-IT/chat.json b/locales/it-IT/chat.jsonindex a69044c3702..c5c9ea2bed9 100644--- a/locales/it-IT/chat.json+++ b/locales/it-IT/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Online","heteroAgent.executionTarget.onlineConnections_one": "Online · {{count}} connessione","heteroAgent.executionTarget.onlineConnections_other": "Online · {{count}} connessioni",- "heteroAgent.executionTarget.personalGroup": "Personale",+ "heteroAgent.executionTarget.personalGroup": "Dispositivi privati","heteroAgent.executionTarget.presenceChecking": "Verifica dello stato in corso…","heteroAgent.executionTarget.projectDevicesHint": "Sono elencati solo i dispositivi con la directory di lavoro di questo progetto. Aggiungi una directory per un altro dispositivo nelle impostazioni del progetto.","heteroAgent.executionTarget.reconnect": "Riconnetti",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Ambiente di Esecuzione","heteroAgent.executionTarget.topicTag": "Questo argomento","heteroAgent.executionTarget.unknownDevice": "Dispositivo sconosciuto",- "heteroAgent.executionTarget.workspaceGroup": "Workspace",+ "heteroAgent.executionTarget.workspaceGroup": "Dispositivi del workspace","heteroAgent.fullAccess.label": "Accesso completo","heteroAgent.fullAccess.tooltip": "Claude Code viene eseguito localmente con accesso completo in lettura/scrittura alla directory di lavoro. Il cambio delle modalità di autorizzazione non è ancora disponibile.","heteroAgent.kimiCodeQuota.calendar.title": "Calendario utilizzo Kimi Code",diff --git a/locales/ja-JP/chat.json b/locales/ja-JP/chat.jsonindex 976d0b3ab7b..4cc69110953 100644--- a/locales/ja-JP/chat.json+++ b/locales/ja-JP/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "オンライン","heteroAgent.executionTarget.onlineConnections_one": "オンライン · {{count}} 接続","heteroAgent.executionTarget.onlineConnections_other": "オンライン · {{count}} 接続",- "heteroAgent.executionTarget.personalGroup": "個人",+ "heteroAgent.executionTarget.personalGroup": "プライベートデバイス","heteroAgent.executionTarget.presenceChecking": "ステータスを確認中…","heteroAgent.executionTarget.projectDevicesHint": "このプロジェクトの作業ディレクトリを持つデバイスのみが表示されます。プロジェクト設定で別のデバイスのディレクトリを追加してください。","heteroAgent.executionTarget.reconnect": "再接続",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "実行環境","heteroAgent.executionTarget.topicTag": "このトピック","heteroAgent.executionTarget.unknownDevice": "不明なデバイス",- "heteroAgent.executionTarget.workspaceGroup": "ワークスペース",+ "heteroAgent.executionTarget.workspaceGroup": "ワークスペースのデバイス","heteroAgent.fullAccess.label": "フルアクセス","heteroAgent.fullAccess.tooltip": "Claude Code はローカルで動作し、作業ディレクトリへの読み書きが可能です。権限モードの切り替えはまだ利用できません。","heteroAgent.kimiCodeQuota.calendar.title": "Kimi Code使用カレンダー",diff --git a/locales/ko-KR/chat.json b/locales/ko-KR/chat.jsonindex 640f6fe113f..25b9da9aa59 100644--- a/locales/ko-KR/chat.json+++ b/locales/ko-KR/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "온라인","heteroAgent.executionTarget.onlineConnections_one": "온라인 · {{count}} 연결","heteroAgent.executionTarget.onlineConnections_other": "온라인 · {{count}} 연결",- "heteroAgent.executionTarget.personalGroup": "개인",+ "heteroAgent.executionTarget.personalGroup": "비공개 장치","heteroAgent.executionTarget.presenceChecking": "상태 확인 중…","heteroAgent.executionTarget.projectDevicesHint": "이 프로젝트의 작업 디렉토리가 있는 장치만 나열됩니다. 프로젝트 설정에서 다른 장치에 디렉토리를 추가하세요.","heteroAgent.executionTarget.reconnect": "다시 연결",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "실행 환경","heteroAgent.executionTarget.topicTag": "이 주제","heteroAgent.executionTarget.unknownDevice": "알 수 없는 장치",- "heteroAgent.executionTarget.workspaceGroup": "워크스페이스",+ "heteroAgent.executionTarget.workspaceGroup": "워크스페이스 장치","heteroAgent.fullAccess.label": "전체 권한","heteroAgent.fullAccess.tooltip": "Claude Code는 작업 디렉터리에 대한 전체 읽기/쓰기 권한으로 로컬에서 실행됩니다. 권한 모드 전환은 아직 지원되지 않습니다.","heteroAgent.kimiCodeQuota.calendar.title": "Kimi Code 사용 캘린더",diff --git a/locales/nl-NL/chat.json b/locales/nl-NL/chat.jsonindex 5fc624da980..a6dca382578 100644--- a/locales/nl-NL/chat.json+++ b/locales/nl-NL/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Online","heteroAgent.executionTarget.onlineConnections_one": "Online · {{count}} verbinding","heteroAgent.executionTarget.onlineConnections_other": "Online · {{count}} verbindingen",- "heteroAgent.executionTarget.personalGroup": "Persoonlijk",+ "heteroAgent.executionTarget.personalGroup": "Privéapparaten","heteroAgent.executionTarget.presenceChecking": "Status controleren…","heteroAgent.executionTarget.projectDevicesHint": "Alleen apparaten met de werkmap van dit project worden weergegeven. Voeg een map toe voor een ander apparaat in de projectinstellingen.","heteroAgent.executionTarget.reconnect": "Opnieuw verbinden",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Uitvoeringsomgeving","heteroAgent.executionTarget.topicTag": "Dit onderwerp","heteroAgent.executionTarget.unknownDevice": "Onbekend apparaat",- "heteroAgent.executionTarget.workspaceGroup": "Werkruimte",+ "heteroAgent.executionTarget.workspaceGroup": "Werkruimteapparaten","heteroAgent.fullAccess.label": "Volledige toegang","heteroAgent.fullAccess.tooltip": "Claude Code draait lokaal met volledige lees-/schrijfrechten voor de werkmap. Wisselen van toestemmingsmodus is nog niet beschikbaar.","heteroAgent.kimiCodeQuota.calendar.title": "Kimi Code-gebruikskalender",diff --git a/locales/pl-PL/chat.json b/locales/pl-PL/chat.jsonindex 5afbf1796b7..29250ef4fcd 100644--- a/locales/pl-PL/chat.json+++ b/locales/pl-PL/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Online","heteroAgent.executionTarget.onlineConnections_one": "Online · {{count}} połączenie","heteroAgent.executionTarget.onlineConnections_other": "Online · {{count}} połączenia",- "heteroAgent.executionTarget.personalGroup": "Osobiste",+ "heteroAgent.executionTarget.personalGroup": "Prywatne urządzenia","heteroAgent.executionTarget.presenceChecking": "Sprawdzanie statusu…","heteroAgent.executionTarget.projectDevicesHint": "Wyświetlane są tylko urządzenia z katalogiem roboczym tego projektu. Dodaj katalog dla innego urządzenia w ustawieniach projektu.","heteroAgent.executionTarget.reconnect": "Połącz ponownie",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Środowisko wykonawcze","heteroAgent.executionTarget.topicTag": "Ten temat","heteroAgent.executionTarget.unknownDevice": "Nieznane urządzenie",- "heteroAgent.executionTarget.workspaceGroup": "Przestrzeń robocza",+ "heteroAgent.executionTarget.workspaceGroup": "Urządzenia przestrzeni roboczej","heteroAgent.fullAccess.label": "Pełny dostęp","heteroAgent.fullAccess.tooltip": "Claude Code działa lokalnie z pełnym dostępem do odczytu i zapisu w katalogu roboczym. Przełączanie trybów uprawnień nie jest jeszcze dostępne.","heteroAgent.kimiCodeQuota.calendar.title": "Kalendarz użycia Kimi Code",diff --git a/locales/pt-BR/chat.json b/locales/pt-BR/chat.jsonindex 09f7eadcd61..fa7a7a09cdb 100644--- a/locales/pt-BR/chat.json+++ b/locales/pt-BR/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Online","heteroAgent.executionTarget.onlineConnections_one": "Online · {{count}} conexão","heteroAgent.executionTarget.onlineConnections_other": "Online · {{count}} conexões",- "heteroAgent.executionTarget.personalGroup": "Pessoal",+ "heteroAgent.executionTarget.personalGroup": "Dispositivos Privados","heteroAgent.executionTarget.presenceChecking": "Verificando status…","heteroAgent.executionTarget.projectDevicesHint": "Apenas dispositivos com o diretório de trabalho deste projeto estão listados. Adicione um diretório para outro dispositivo nas configurações do projeto.","heteroAgent.executionTarget.reconnect": "Reconectar",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Ambiente de Execução","heteroAgent.executionTarget.topicTag": "Este tópico","heteroAgent.executionTarget.unknownDevice": "Dispositivo desconhecido",- "heteroAgent.executionTarget.workspaceGroup": "Espaço de Trabalho",+ "heteroAgent.executionTarget.workspaceGroup": "Dispositivos do Espaço de Trabalho","heteroAgent.fullAccess.label": "Acesso total","heteroAgent.fullAccess.tooltip": "Claude Code é executado localmente com acesso completo de leitura/gravação ao diretório de trabalho. A troca de modos de permissão ainda não está disponível.","heteroAgent.kimiCodeQuota.calendar.title": "Calendário de uso do Kimi Code",diff --git a/locales/ru-RU/chat.json b/locales/ru-RU/chat.jsonindex 7913f9d940b..b0886c6a54c 100644--- a/locales/ru-RU/chat.json+++ b/locales/ru-RU/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Онлайн","heteroAgent.executionTarget.onlineConnections_one": "Онлайн · {{count}} соединение","heteroAgent.executionTarget.onlineConnections_other": "Онлайн · {{count}} соединений",- "heteroAgent.executionTarget.personalGroup": "Личное",+ "heteroAgent.executionTarget.personalGroup": "Личные устройства","heteroAgent.executionTarget.presenceChecking": "Проверка статуса…","heteroAgent.executionTarget.projectDevicesHint": "Указаны только устройства с рабочей директорией этого проекта. Добавьте директорию для другого устройства в настройках проекта.","heteroAgent.executionTarget.reconnect": "Переподключить",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Среда выполнения","heteroAgent.executionTarget.topicTag": "Эта тема","heteroAgent.executionTarget.unknownDevice": "Неизвестное устройство",- "heteroAgent.executionTarget.workspaceGroup": "Рабочее пространство",+ "heteroAgent.executionTarget.workspaceGroup": "Устройства рабочего пространства","heteroAgent.fullAccess.label": "Полный доступ","heteroAgent.fullAccess.tooltip": "Claude Code работает локально с полными правами на чтение и запись в рабочей директории. Переключение режимов доступа пока недоступно.","heteroAgent.kimiCodeQuota.calendar.title": "Календарь использования Kimi Code",diff --git a/locales/tr-TR/chat.json b/locales/tr-TR/chat.jsonindex b402c45f854..76a7d74c543 100644--- a/locales/tr-TR/chat.json+++ b/locales/tr-TR/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Çevrimiçi","heteroAgent.executionTarget.onlineConnections_one": "Çevrimiçi · {{count}} bağlantı","heteroAgent.executionTarget.onlineConnections_other": "Çevrimiçi · {{count}} bağlantı",- "heteroAgent.executionTarget.personalGroup": "Kişisel",+ "heteroAgent.executionTarget.personalGroup": "Özel Cihazlar","heteroAgent.executionTarget.presenceChecking": "Durum kontrol ediliyor…","heteroAgent.executionTarget.projectDevicesHint": "Sadece bu projenin çalışma dizinine sahip cihazlar listelenir. Proje ayarlarından başka bir cihaz için bir dizin ekleyin.","heteroAgent.executionTarget.reconnect": "Yeniden bağlan",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Çalışma Ortamı","heteroAgent.executionTarget.topicTag": "Bu konu","heteroAgent.executionTarget.unknownDevice": "Bilinmeyen cihaz",- "heteroAgent.executionTarget.workspaceGroup": "Çalışma Alanı",+ "heteroAgent.executionTarget.workspaceGroup": "Çalışma Alanı Cihazları","heteroAgent.fullAccess.label": "Tam erişim","heteroAgent.fullAccess.tooltip": "Claude Code yerel olarak çalışır ve çalışma dizinine tam okuma/yazma erişimi vardır. İzin modları arasında geçiş henüz mevcut değil.","heteroAgent.kimiCodeQuota.calendar.title": "Kimi Code kullanım takvimi",diff --git a/locales/vi-VN/chat.json b/locales/vi-VN/chat.jsonindex ab5b8a3f344..f1455fea817 100644--- a/locales/vi-VN/chat.json+++ b/locales/vi-VN/chat.json@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "Trực tuyến","heteroAgent.executionTarget.onlineConnections_one": "Trực tuyến · {{count}} kết nối","heteroAgent.executionTarget.onlineConnections_other": "Trực tuyến · {{count}} kết nối",- "heteroAgent.executionTarget.personalGroup": "Cá nhân",+ "heteroAgent.executionTarget.personalGroup": "Thiết bị riêng tư","heteroAgent.executionTarget.presenceChecking": "Đang kiểm tra trạng thái…","heteroAgent.executionTarget.projectDevicesHint": "Chỉ các thiết bị có thư mục làm việc của dự án này được liệt kê. Thêm một thư mục cho thiết bị khác trong cài đặt dự án.","heteroAgent.executionTarget.reconnect": "Kết nối lại",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "Môi trường Thực thi","heteroAgent.executionTarget.topicTag": "Chủ đề này","heteroAgent.executionTarget.unknownDevice": "Thiết bị không xác định",- "heteroAgent.executionTarget.workspaceGroup": "Không gian làm việc",+ "heteroAgent.executionTarget.workspaceGroup": "Thiết bị không gian làm việc","heteroAgent.fullAccess.label": "Toàn quyền truy cập","heteroAgent.fullAccess.tooltip": "Claude Code chạy cục bộ với toàn quyền đọc/ghi vào thư mục làm việc. Chưa hỗ trợ chuyển đổi chế độ quyền.","heteroAgent.kimiCodeQuota.calendar.title": "Lịch sử sử dụng Kimi Code",diff --git a/locales/zh-TW/chat.json b/locales/zh-TW/chat.jsonindex b83f591a6b8..a7c522f05cd 100644--- a/locales/zh-TW/chat.json+++ b/locales/zh-TW/chat.json@@ -1482,7 +1482,7 @@"heteroAgent.executionTarget.infoTooltip": "選擇此代理運行的位置。一個設備可以讀寫文件或操作計算機;雲端沙盒則在一個隔離的臨時環境中運行。","heteroAgent.executionTarget.loadFailed": "無法載入設備。","heteroAgent.executionTarget.loading": "正在載入設備…",- "heteroAgent.executionTarget.local": "本設備",+ "heteroAgent.executionTarget.local": "本機裝置","heteroAgent.executionTarget.localDesc": "在此桌面應用程式中作為本地進程運行","heteroAgent.executionTarget.localSandbox": "本地沙盒","heteroAgent.executionTarget.localSandboxDesc": "在此電腦上運行,指令僅限於工作目錄且無網路連接",@@ -1499,7 +1499,7 @@"heteroAgent.executionTarget.online": "在線","heteroAgent.executionTarget.onlineConnections_one": "在線 · {{count}} 個連接","heteroAgent.executionTarget.onlineConnections_other": "在線 · {{count}} 個連接",- "heteroAgent.executionTarget.personalGroup": "個人",+ "heteroAgent.executionTarget.personalGroup": "私人裝置","heteroAgent.executionTarget.presenceChecking": "正在檢查狀態…","heteroAgent.executionTarget.projectDevicesHint": "僅列出具有此專案工作目錄的設備。請在專案設定中為其他設備新增目錄。","heteroAgent.executionTarget.reconnect": "重新連接",@@ -1514,7 +1514,7 @@"heteroAgent.executionTarget.title": "執行環境","heteroAgent.executionTarget.topicTag": "此主題","heteroAgent.executionTarget.unknownDevice": "未知設備",- "heteroAgent.executionTarget.workspaceGroup": "工作區",+ "heteroAgent.executionTarget.workspaceGroup": "工作區裝置","heteroAgent.fullAccess.label": "完整存取","heteroAgent.fullAccess.tooltip": "Claude Code 於本機執行,並擁有對工作目錄的完整讀寫權限。目前尚無法切換權限模式。","heteroAgent.kimiCodeQuota.calendar.title": "Kimi Code 使用日曆",diff --git a/packages/types/src/topic/topic.ts b/packages/types/src/topic/topic.tsindex fd833c903cb..0033bfb87d1 100644--- a/packages/types/src/topic/topic.ts+++ b/packages/types/src/topic/topic.ts@@ -35,6 +35,12 @@ export type TopicQuerySortBy = 'updatedAt' | 'status';export interface GroupedTopic {children: ChatTopic[];+ /**+ * Set on a folder group only when another folder group shows the same path+ * on a different machine, so the renderer can name the device that tells+ * them apart.+ */+ deviceId?: string;id: string;title?: string;}diff --git a/packages/utils/src/client/topic.test.ts b/packages/utils/src/client/topic.test.tsindex a65411142b6..1fae85e424f 100644--- a/packages/utils/src/client/topic.test.ts+++ b/packages/utils/src/client/topic.test.ts@@ -599,6 +599,90 @@ it('keeps project directory bindings and device identities separate', () => {expect(groupTopicsByProject(topics, 'updatedAt')).toHaveLength(4);});+describe('groupTopicsByProject on one machine with several device identities', () => {+ const row = (id: string, updatedAt: number, boundDeviceId?: string): ChatTopic => ({+ createdAt: updatedAt,+ id,+ metadata: { boundDeviceId, workingDirectory: '/home/me/workspaces/cpc' },+ title: id,+ updatedAt,+ });++ it('merges one folder used through both identities of this machine', () => {+ const topics = [row('desk', 3, 'local-personal'), row('shared', 2, 'local-workspace')];++ expect(+ groupTopicsByProject(topics, 'updatedAt', {+ localDeviceIds: ['local-personal', 'local-workspace'],+ }),+ ).toEqual([+ {+ children: [topics[0], topics[1]],+ id: 'project:local-personal:/home/me/workspaces/cpc',+ title: 'cpc',+ },+ ]);+ });++ it('keeps the folder of another machine apart, naming its device to tell them apart', () => {+ const topics = [row('desk', 3, 'local-personal'), row('remote', 2, 'other-machine')];++ expect(+ groupTopicsByProject(topics, 'updatedAt', { localDeviceIds: ['local-personal'] }).map(+ ({ deviceId, id, title }) => ({ deviceId, id, title }),+ ),+ ).toEqual([+ {+ deviceId: 'local-personal',+ id: 'project:local-personal:/home/me/workspaces/cpc',+ title: 'cpc',+ },+ {+ deviceId: 'other-machine',+ id: 'project:other-machine:/home/me/workspaces/cpc',+ title: 'cpc',+ },+ ]);+ });++ it('names no device when the folder title is already unambiguous', () => {+ const [group] = groupTopicsByProject([row('only', 1, 'other-machine')], 'updatedAt');++ expect(group.title).toBe('cpc');+ expect(group).not.toHaveProperty('deviceId');+ });++ it('keeps the short name when a project registers the same folder', () => {+ const projectTopic: ChatTopic = {+ ...row('project', 4, 'local-personal'),+ projectId: 'pro_1',+ projectWorkingDirectoryId: 'dir_1',+ };+ const topics = [projectTopic, row('desk', 3, 'local-personal'), row('remote', 2, 'other')];++ expect(+ groupTopicsByProject(topics, 'updatedAt').map(({ id, title }) => ({ id, title })),+ ).toEqual([+ { id: 'project-id:pro_1', title: 'cpc' },+ { id: 'project:local-personal:/home/me/workspaces/cpc', title: 'cpc' },+ { id: 'project:other:/home/me/workspaces/cpc', title: 'cpc' },+ ]);+ });++ it('still lengthens the name of different folders that share a basename', () => {+ const other: ChatTopic = {+ ...row('elsewhere', 1, 'local-personal'),+ metadata: { boundDeviceId: 'local-personal', workingDirectory: '/srv/cpc' },+ };++ expect(+ groupTopicsByProject([row('desk', 3, 'local-personal'), other], 'updatedAt').map(+ (group) => group.title,+ ),+ ).toEqual(['workspaces/cpc', 'srv/cpc']);+ });+});+describe('groupTopicsByProject project merging', () => {const base = { createdAt: 0, title: 'Work', updatedAt: 0 };@@ -915,6 +999,28 @@ describe('groupTopicsByDevice', () => {]);});+ it("merges this machine's device identities into one group under its first id", () => {+ const topics = [+ createRow('desk', 3, { metadata: { boundDeviceId: 'local-personal' } }),+ createRow('shared', 2, { projectWorkingDirectoryId: 'dir-shared' }),+ createRow('remote', 1, { metadata: { boundDeviceId: 'other-machine' } }),+ ];++ expect(+ groupTopicsByDevice(+ topics,+ 'updatedAt',+ [{ deviceId: 'local-workspace', id: 'dir-shared' }],+ {+ localDeviceIds: ['local-personal', 'local-workspace'],+ },+ ),+ ).toEqual([+ { children: [topics[0], topics[1]], id: 'device:local-personal' },+ { children: [topics[2]], id: 'device:other-machine' },+ ]);+ });+it('sorts children and groups by the chosen field descending', () => {const topics = [createRow('old', 1, { metadata: { boundDeviceId: 'device-x' } }),diff --git a/packages/utils/src/client/topic.ts b/packages/utils/src/client/topic.tsindex a2e004aca62..7444cecfeb4 100644--- a/packages/utils/src/client/topic.ts+++ b/packages/utils/src/client/topic.ts@@ -204,18 +204,31 @@ export const getTopicWorkingDirectoryEffectivePath = (topic: ChatTopic): string* deliberate, not inferred from a directory), then directory-derived groups,* then `no-project`; each tier keeps most-recent-activity order.* - Basenames for unique projects and distinguishing path suffixes for collisions.+ * The same folder on several machines is one name; each of those groups+ * carries its `deviceId` so the renderer can tell them apart.+ *+ * `localDeviceIds` are the device identities this machine is registered+ * under (its personal device first, then its workspace device): a folder used+ * through any of them is the same folder on disk, so it forms one group keyed+ * by the first id.*/export const groupTopicsByProject = (topics: ChatTopic[],field: 'createdAt' | 'updatedAt',+ { localDeviceIds }: { localDeviceIds?: readonly string[] } = {},): GroupedTopic[] => {if (!topics.length) return [];- const groupsMap = new Map<string, { children: ChatTopic[]; paths: Set<string> }>();+ const groupsMap = new Map<+ string,+ { children: ChatTopic[]; deviceId?: string; paths: Set<string> }+ >();+ const canonicalDeviceId = (deviceId: string | undefined) =>+ deviceId && localDeviceIds?.includes(deviceId) ? localDeviceIds[0] : deviceId;for (const topic of topics) {const normalized = getTopicWorkingDirectorySourcePath(topic) ?? '';- const deviceId = topic.metadata?.boundDeviceId;+ const deviceId = canonicalDeviceId(topic.metadata?.boundDeviceId);const id = topic.projectId? `${PROJECT_ID_GROUP_PREFIX}${topic.projectId}`: topic.projectWorkingDirectoryId@@ -230,6 +243,8 @@ export const groupTopicsByProject = (} else {groupsMap.set(id, {children: [topic],+ // Only a folder group is tied to one machine by its id.+ deviceId: id.startsWith(PROJECT_GROUP_PREFIX) ? deviceId : undefined,paths: normalized ? new Set([normalized]) : new Set(),});}@@ -241,10 +256,20 @@ export const groupTopicsByProject = (}// Count suffixes once so an expanding project list does not compare every pair- // of paths. A merged project group contributes each of its directories once.+ // of paths. Each distinct path counts once, however many groups show it: a+ // folder seen on several machines is told apart by its device, and a project+ // registering the same folder by its project name — not by a longer path.const suffixCounts = new Map<string, number>();+ const folderGroupsByPath = new Map<string, number>();+ for (const [id, { paths }] of groupsMap) {+ if (!id.startsWith(PROJECT_GROUP_PREFIX)) continue;+ for (const path of paths) folderGroupsByPath.set(path, (folderGroupsByPath.get(path) ?? 0) + 1);+ }+ const countedPaths = new Set<string>();for (const { paths } of groupsMap.values()) {for (const path of paths) {+ if (countedPaths.has(path)) continue;+ countedPaths.add(path);const segments = path.split(/[/\\]+/).filter(Boolean);for (let depth = 1; depth <= segments.length; depth++) {const suffix = segments.slice(-depth).join('/');@@ -253,7 +278,7 @@ export const groupTopicsByProject = (}}const groups: GroupedTopic[] = Array.from(groupsMap.entries()).map(- ([id, { children, paths }]) => {+ ([id, { children, deviceId, paths }]) => {// A merged project group spans directories; its most recently active// directory names the group. Groups without any path stay title-less and// let the renderer resolve the project name from its directory registry.@@ -263,8 +288,11 @@ export const groupTopicsByProject = (: (children.map((topic) => getTopicWorkingDirectorySourcePath(topic)).find((path): path is string => !!path) ?? [...paths][0]);+ const sharesPathWithAnotherMachine =+ !!deviceId && !!primaryPath && (folderGroupsByPath.get(primaryPath) ?? 0) > 1;return {children,+ ...(sharesPathWithAnotherMachine && { deviceId }),id,title:id === NO_PROJECT_GROUP_ID || !primaryPath@@ -388,7 +416,8 @@ export interface TopicDeviceDirectory {* `directories`.** Returns:- * - `device:{deviceId}` groups sorted by most recent activity, and a+ * - `device:{deviceId}` groups sorted by most recent activity (this machine's+ * identities share the `device:` group of its first `localDeviceIds` entry), and a* title-less `no-device` bucket for rows without any device attribution.* Groups carry no title — the renderer names them from its directory and* device registries.@@ -413,13 +442,16 @@ export const groupTopicsByDevice = (topics: ChatTopic[],field: 'createdAt' | 'updatedAt',directories?: ReadonlyArray<TopicDeviceDirectory>,+ /** This machine's device identities (personal first): one machine, one group. */+ { localDeviceIds }: { localDeviceIds?: readonly string[] } = {},): GroupedTopic[] => {if (!topics.length) return [];const resolveDeviceId = createTopicDeviceResolver(directories);const groupsMap = new Map<string, ChatTopic[]>();for (const topic of topics) {- const deviceId = resolveDeviceId(topic);+ const resolved = resolveDeviceId(topic);+ const deviceId = resolved && localDeviceIds?.includes(resolved) ? localDeviceIds[0] : resolved;const id = deviceId ? `${DEVICE_GROUP_PREFIX}${deviceId}` : NO_DEVICE_GROUP_ID;const existing = groupsMap.get(id);if (existing) {diff --git a/src/features/AgentSidebar/Topic/ToggleGroups.tsx b/src/features/AgentSidebar/Topic/ToggleGroups.tsxindex d9750737467..1c9c6e45c49 100644--- a/src/features/AgentSidebar/Topic/ToggleGroups.tsx+++ b/src/features/AgentSidebar/Topic/ToggleGroups.tsx@@ -4,6 +4,7 @@ import { Maximize2, Minimize2 } from 'lucide-react';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';+import { useLocalMachineDeviceIds } from '@/hooks/useLocalMachineDeviceIds';import { useTopicGroupCollapse } from '@/hooks/useTopicGroupCollapse';import { useChatStore } from '@/store/chat';import { topicSelectors } from '@/store/chat/selectors';@@ -22,6 +23,7 @@ const ToggleGroups = memo(() => {const topicIncludeCompleted = useUserStore(preferenceSelectors.topicIncludeCompleted);const { topicGroupMode } = useAgentTopicGroupMode();+ const localDeviceIds = useLocalMachineDeviceIds();const groupSelector = useMemo(() =>topicSelectors.groupedTopicsForSidebar(@@ -29,8 +31,9 @@ const ToggleGroups = memo(() => {topicSortBy,topicGroupMode,topicIncludeCompleted,+ localDeviceIds,),- [topicPageSize, topicSortBy, topicGroupMode, topicIncludeCompleted],+ [topicPageSize, topicSortBy, topicGroupMode, topicIncludeCompleted, localDeviceIds],);const agentGroups = useChatStore(groupSelector, isEqual);const scoped = useScopedSidebarTopics(diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/GroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/GroupItem.tsxindex 365902fafc8..a04bd56ed42 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/GroupItem.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/GroupItem.tsx@@ -12,6 +12,7 @@ import {cx,Flexbox,Icon,+ Tag,Text,} from '@lobehub/ui';import isEqual from 'fast-deep-equal';@@ -19,25 +20,34 @@ import { MonitorIcon, PlusIcon } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';+import TailMarquee from '@/components/TailMarquee';import { getDeviceIcon } from '@/features/DeviceManager/getDeviceIcon';import { startProjectTopicDraft } from '@/features/Projects/WorkingDirectories/startProjectTopicDraft';import { useAgentFixedDeviceId } from '@/features/Projects/WorkingDirectories/useAgentFixedDeviceId';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useLocalMachineDeviceIds } from '@/hooks/useLocalMachineDeviceIds';import { useAgentStore } from '@/store/agent';import { useDeviceStore } from '@/store/device';import { deviceSelectors } from '@/store/device/selectors';+import { useElectronStore } from '@/store/electron';import { useProjectDirectories } from '@/store/projectWorkingDirectory';import TopicItem from '../../List/Item';import { useTopicListScope } from '../../TopicListScope';+import { deviceCategoryKey } from '../ByProjectMode/deviceIdentity';import { type GroupItemComponentProps } from '../GroupedAccordion';-import { findDeviceTopicDirectory, resolveDeviceGroupName } from './resolveDeviceGroup';+import {+ findDeviceTopicDirectory,+ hasNamesakeDevice,+ resolveDeviceGroupName,+} from './resolveDeviceGroup';const DEVICE_GROUP_PREFIX = 'device:';const GroupItem = memo<GroupItemComponentProps>(({ group }) => {const { t } = useTranslation('topic');const { t: tProject } = useTranslation('project');+ const { t: tChat } = useTranslation('chat');const { id, title, children } = group;const deviceId = id.startsWith(DEVICE_GROUP_PREFIX)? id.slice(DEVICE_GROUP_PREFIX.length)@@ -47,11 +57,15 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {const directories = useProjectDirectories(scope?.projectId);const activeAgentId = useAgentStore((s) => s.activeAgentId);// The directory registry names most buckets; the device list covers devices- // whose directory was removed from the project.- useDeviceStore((s) => s.useFetchDevices)(- !!deviceId && !directories.some((d) => d.deviceId === deviceId && d.deviceName),- );+ // whose directory was removed from the project, and tells namesakes apart.+ useDeviceStore((s) => s.useFetchDevices)(!!deviceId);const device = useDeviceStore(deviceSelectors.getDeviceById(deviceId));+ const devices = useDeviceStore(deviceSelectors.deviceList);+ // This machine's group (keyed by its personal id) holds every identity it is+ // registered under; any other group stands for one device.+ const localDeviceIds = useLocalMachineDeviceIds();+ const ownIds = deviceId ? (localDeviceIds[0] === deviceId ? localDeviceIds : [deviceId]) : [];+ const currentDeviceId = useElectronStore((s) => s.gatewayDeviceInfo?.deviceId);// A synthetic bucket (e.g. favorites) carries its own title; only real// `device:` buckets resolve a name from the directory/device registries.@@ -62,6 +76,12 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {title,unknownLabel: t('groupTitle.byDevice.unknown'),});+ // Where this machine's identities cannot be merged (web, another machine),+ // a namesake group is told apart by its execution-environment category.+ const categoryKey =+ deviceId && hasNamesakeDevice({ devices, directories, name, ownIds })+ ? deviceCategoryKey(deviceId, devices, currentDeviceId)+ : undefined;// Stage a directory on this device so the blank conversation runs where the// group points; only a runnable directory can take the run, so without@@ -70,7 +90,7 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {const navigate = useWorkspaceAwareNavigate();const fallbackAgentId = scope?.coordinatorAgentId ?? activeAgentId;const fixedDeviceId = useAgentFixedDeviceId(fallbackAgentId);- const targetDirectory = findDeviceTopicDirectory(directories, deviceId, fixedDeviceId);+ const targetDirectory = findDeviceTopicDirectory(directories, ownIds, fixedDeviceId);const canAddTopic = !!scope && !!deviceId && !!fallbackAgentId && !!targetDirectory;const handleAddTopic = () => {if (!scope || !deviceId || !fallbackAgentId || !targetDirectory) return;@@ -94,9 +114,23 @@ const GroupItem = memo<GroupItemComponentProps>(({ group }) => {<Icon icon={MonitorIcon} size={{ size: 15, strokeWidth: 1.5 }} />)}</Center>- <Text ellipsis fontSize={14} style={{ flex: 1 }}>+ <Text ellipsis fontSize={14} style={{ flex: categoryKey ? '0 1 auto' : 1 }}>{name}</Text>+ {categoryKey && (+ <Tag+ size={'small'}+ style={{+ color: cssVar.colorTextDescription,+ flex: '0 100 auto',+ fontSize: 10,+ minWidth: 48,+ overflow: 'hidden',+ }}+ >+ <TailMarquee>{tChat(categoryKey)}</TailMarquee>+ </Tag>+ )}</Flexbox></AccordionTrigger>{canAddTopic && (diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.test.ts b/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.test.tsindex 2efa19ceddf..61f672e6e0c 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.test.ts+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.test.ts@@ -1,6 +1,10 @@import { describe, expect, it } from 'vitest';-import { findDeviceTopicDirectory, resolveDeviceGroupName } from './resolveDeviceGroup';+import {+ findDeviceTopicDirectory,+ hasNamesakeDevice,+ resolveDeviceGroupName,+} from './resolveDeviceGroup';const directories = [{ deviceId: 'dev-a', id: 'dir-a-plain' },@@ -49,6 +53,15 @@ describe('findDeviceTopicDirectory', () => {expect(findDeviceTopicDirectory(directories, 'dev-b', 'dev-b')?.id).toBe('dir-b-instance');});+ it("tries one machine's identities in order and starts on the first that can run", () => {+ expect(findDeviceTopicDirectory(directories, ['dev-missing', 'dev-b', 'dev-a'])?.id).toBe(+ 'dir-b-instance',+ );+ expect(findDeviceTopicDirectory(directories, ['dev-a', 'dev-b'], 'dev-b')?.id).toBe(+ 'dir-b-instance',+ );+ });+it('returns undefined for groups without a device (favorites, unknown bucket)', () => {expect(findDeviceTopicDirectory(directories, undefined)).toBeUndefined();expect(findDeviceTopicDirectory(directories)).toBeUndefined();@@ -80,3 +93,39 @@ describe('resolveDeviceGroupName', () => {expect(resolveDeviceGroupName({ unknownLabel: 'Unknown device' })).toBe('Unknown device');});});++describe('hasNamesakeDevice', () => {+ const devices = [+ { deviceId: 'laptop', friendlyName: null, hostname: 'mocha-laptop' },+ { deviceId: 'laptop-ws', friendlyName: null, hostname: 'mocha-laptop' },+ { deviceId: 'studio', friendlyName: 'Studio', hostname: 'mocha-laptop' },+ ];++ it('finds another device shown under the same name', () => {+ expect(+ hasNamesakeDevice({ devices, directories: [], name: 'mocha-laptop', ownIds: ['laptop'] }),+ ).toBe(true);+ });++ it("ignores this machine's own identities and devices shown under another name", () => {+ expect(+ hasNamesakeDevice({+ devices,+ directories: [],+ name: 'mocha-laptop',+ ownIds: ['laptop', 'laptop-ws'],+ }),+ ).toBe(false);+ });++ it('reads the name a project directory gives a device first', () => {+ expect(+ hasNamesakeDevice({+ devices,+ directories: [{ deviceId: 'studio', deviceName: 'mocha-laptop' }],+ name: 'mocha-laptop',+ ownIds: ['laptop', 'laptop-ws'],+ }),+ ).toBe(true);+ });+});diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.ts b/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.tsindex d40ee8ca78d..92bea4971e8 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.ts+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByDeviceMode/resolveDeviceGroup.ts@@ -12,16 +12,53 @@ interface DeviceDirectoryLike {* The add-topic affordance on a device group is only safe with a runnable* directory on THIS device that the draft's agent may run on — otherwise the* blank conversation would be staged somewhere the first send is refused, or- * on another device altogether.+ * on another device altogether. A group for this machine passes all of its+ * device identities, tried in order (its personal device first).*/export const findDeviceTopicDirectory = <T extends DeviceDirectoryLike>(directories: T[],- deviceId?: string,+ deviceIds?: string | readonly string[],fixedDeviceId?: string | null,-): T | undefined =>- deviceId- ? directories.find((d) => d.deviceId === deviceId && canStageDraftOn(d, fixedDeviceId))- : undefined;+): T | undefined => {+ for (const deviceId of typeof deviceIds === 'string' ? [deviceIds] : (deviceIds ?? [])) {+ const directory = directories.find(+ (d) => d.deviceId === deviceId && canStageDraftOn(d, fixedDeviceId),+ );+ if (directory) return directory;+ }+};++/**+ * Whether another device is shown under the same name as this group — e.g.+ * one machine's personal and workspace identities, which only this machine can+ * merge. `ownIds` are the group's own identities, never counted as namesakes.+ * Names resolve like the group title: project directory name, then the+ * device's friendly name, then its hostname.+ */+export const hasNamesakeDevice = ({+ devices,+ directories,+ name,+ ownIds,+}: {+ devices: { deviceId: string; friendlyName?: string | null; hostname?: string | null }[];+ directories: { deviceId?: string | null; deviceName?: string | null }[];+ name: string;+ ownIds: readonly string[];+}): boolean => {+ const ids = new Set<string>();+ for (const item of [...devices, ...directories]) if (item.deviceId) ids.add(item.deviceId);+ for (const id of ids) {+ if (ownIds.includes(id)) continue;+ const device = devices.find((item) => item.deviceId === id);+ const otherName =+ directories.find((item) => item.deviceId === id && item.deviceName)?.deviceName ??+ device?.friendlyName ??+ device?.hostname;+ if (otherName === name) return true;+ }+ return false;+};/*** A synthetic bucket (e.g. favorites) carries its own title and wins over anydiff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsxindex 744a07e317a..91d8abd0f2d 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx@@ -48,11 +48,17 @@ vi.mock('@/store/global', () => ({}),}));+const deviceRows = vi.hoisted(() => [+ { deviceId: 'device-2', friendlyName: 'Studio Linux', scope: 'personal' },+ // This desktop (`device-1`) as a workspace device: same machine, own id.+ { deviceId: 'device-1-ws', hostname: 'mocha-laptop', scope: 'workspace' },+ { deviceId: 'device-1', hostname: 'mocha-laptop', scope: 'personal' },+]);vi.mock('@/store/device', () => ({deviceSelectors: { deviceList: (s: { devices: unknown[] }) => s.devices },useDeviceStore: (selector: (state: object) => unknown) =>selector({- devices: [{ deviceId: 'device-2', friendlyName: 'Studio Linux' }],+ devices: deviceRows,useFetchDevices: () => ({}),}),}));@@ -324,6 +330,65 @@ describe('Project topic group item', () => {expect(document.body.textContent).not.toContain('groupTitle.byDevice.unknown');});+ it("sections a folder by device once it merges this machine's two device identities", () => {+ subGroupModeMock.value = 'byDevice';+ const folder = (id: string, boundDeviceId: string) => ({+ id,+ metadata: { boundDeviceId, workingDirectory: '/tmp/x' },+ title: id,+ });+ render(+ <AccordionRoot defaultValue={['project:/tmp/x']}>+ <GroupItem+ expanded+ group={{+ children: [+ folder('Desktop topic', 'device-1'),+ folder('Shared topic', 'device-1-ws'),+ ] as any,+ id: 'project:/tmp/x',+ title: 'x',+ }}+ />+ </AccordionRoot>,+ );++ const text = document.body.textContent ?? '';+ // Both sections are "mocha-laptop"; the category tells them apart.+ expect(text.match(/mocha-laptop/g)).toHaveLength(2);+ expect(text.indexOf('heteroAgent.executionTarget.local')).toBeLessThan(+ text.indexOf('Desktop topic'),+ );+ expect(text.indexOf('Desktop topic')).toBeLessThan(+ text.indexOf('heteroAgent.executionTarget.workspaceGroup'),+ );+ expect(text.indexOf('heteroAgent.executionTarget.workspaceGroup')).toBeLessThan(+ text.indexOf('Shared topic'),+ );+ });++ it('names the device of a folder that another machine also has', () => {+ render(+ <AccordionRoot>+ <GroupItem+ expanded+ group={{+ children: [+ { id: 't1', metadata: { boundDeviceId: 'device-2', workingDirectory: '/tmp/x' } },+ ] as any,+ deviceId: 'device-2',+ id: 'project:device-2:/tmp/x',+ title: 'x',+ }}+ />+ </AccordionRoot>,+ );++ expect(document.body.textContent).toContain(+ 'Studio Linux · heteroAgent.executionTarget.personalGroup',+ );+ });+it('archives only this group\'s merged-PR topics from the group "more" menu', async () => {const merged = { github: { pullRequest: { mergedAt: '2026-10-01', state: 'closed' } } };render(diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsxindex 0ce5ccc51da..7252f60c4ac 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx@@ -13,6 +13,7 @@ import {DropdownMenu,Flexbox,Icon,+ Tag,Text,toast,} from '@lobehub/ui';@@ -21,6 +22,7 @@ import {Archive,FolderClosedIcon,FolderOpenIcon,+ LaptopIcon,ListFilter,LucideCheck,PlusIcon,@@ -46,6 +48,7 @@ import { usePermission } from '@/hooks/usePermission';import { useQueryRoute } from '@/hooks/useQueryRoute';import { useAgentStore } from '@/store/agent';import { useChatStore } from '@/store/chat';+import { deviceSelectors, useDeviceStore } from '@/store/device';import { useElectronStore } from '@/store/electron';import { useGlobalStore } from '@/store/global';import { type ProjectTopicSubGroupMode } from '@/store/global/initialState';@@ -60,16 +63,18 @@ import { useTopicListScope } from '../../TopicListScope';import { getMergedPullRequestTopics } from '../../utils/mergedPullRequestTopics';import { type GroupItemComponentProps } from '../GroupedAccordion';import { indicatorStyles, useCollapsedIndicators } from './CollapsedIndicators';+import { deviceCategoryKey, deviceDisplayName } from './deviceIdentity';import ProjectTopicList from './ProjectTopicList';const PROJECT_GROUP_PREFIX = 'project:';const PROJECT_ID_GROUP_PREFIX = 'project-id:';const SUB_GROUP_MODES: ProjectTopicSubGroupMode[] = ['none', 'byDevice', 'byTime', 'byStatus'];-// A plain folder lives on one machine, so sectioning it by device says nothing.+// A plain folder usually lives on one device, so sectioning it by device says+// nothing — unless it merges one machine's personal and workspace identities.const FOLDER_SUB_GROUP_MODES = SUB_GROUP_MODES.filter((mode) => mode !== 'byDevice');const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {- const { id, title, children } = group;+ const { id, title, children, deviceId: groupDeviceId } = group;const scope = useTopicListScope();const navigate = useWorkspaceAwareNavigate();// `project-id:` groups merge every directory of one project — resolve the@@ -208,7 +213,21 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {const { t: tProject } = useTranslation('project');const isProjectGroup = !!projectId || !!children[0]?.projectWorkingDirectoryId;- const subGroupModes = isProjectGroup ? SUB_GROUP_MODES : FOLDER_SUB_GROUP_MODES;+ const spansDevices =+ new Set(children.map((topic) => topic.metadata?.boundDeviceId).filter(Boolean)).size > 1;+ const subGroupModes = isProjectGroup || spansDevices ? SUB_GROUP_MODES : FOLDER_SUB_GROUP_MODES;++ // The same folder on another machine is its own group with the same name:+ // name the device, and its category for one machine's several identities.+ useDeviceStore((s) => s.useFetchDevices)(!!groupDeviceId);+ const devices = useDeviceStore(deviceSelectors.deviceList);+ const { t: tChat } = useTranslation('chat');+ const deviceLabel = useMemo(() => {+ if (!groupDeviceId) return;+ const name = deviceDisplayName(groupDeviceId, devices);+ const categoryKey = deviceCategoryKey(groupDeviceId, devices, currentDeviceId);+ return categoryKey ? `${name} · ${tChat(categoryKey)}` : name;+ }, [groupDeviceId, devices, currentDeviceId, tChat]);const storedSubGroupMode = useGlobalStore(systemStatusSelectors.projectTopicSubGroupMode(id));const subGroupMode = subGroupModes.includes(storedSubGroupMode) ? storedSubGroupMode : 'none';const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);@@ -376,10 +395,40 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {) : (// A bare path reads from its end: keep the tail in view and// scroll to the head on hover.- <TailMarquee style={{ color: cssVar.colorTextSecondary, fontSize: 14 }}>+ <TailMarquee+ style={{+ color: cssVar.colorTextSecondary,+ fontSize: 14,+ // Beside a device tag, hug the name instead of filling the row,+ // so it stays next to its icon and the tag follows it.+ ...(deviceLabel && { flex: '0 1 auto' }),+ }}+ >{title}</TailMarquee>)}+ {deviceLabel && (+ // The folder name stays readable: the device tag takes nearly all+ // the shrinking when the row is tight; an overflowing label reads+ // from its category end and scrolls to the device name on hover,+ // like the folder path beside it.+ <Tag+ size={'small'}+ style={{+ color: cssVar.colorTextDescription,+ flex: '0 100 auto',+ fontSize: 10,+ // A long path title still leaves the icon and a few letters.+ minWidth: 48,+ overflow: 'hidden',+ }}+ >+ <Flexbox horizontal align={'center'} gap={3} style={{ minWidth: 0 }}>+ <Icon icon={LaptopIcon} size={{ size: 10 }} style={{ flex: 'none' }} />+ <TailMarquee>{deviceLabel}</TailMarquee>+ </Flexbox>+ </Tag>+ )}</Flexbox></AccordionTrigger><divdiff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsxindex caf7757473e..c01172452e0 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx@@ -11,6 +11,7 @@ import {cx,Flexbox,Icon,+ Tag,Text,} from '@lobehub/ui';import isEqual from 'fast-deep-equal';@@ -23,6 +24,7 @@ import {TOPIC_GROUP_VISUALS,TOPIC_STATUS_VISUALS,} from '@/components/ExecutionStatus';+import TailMarquee from '@/components/TailMarquee';import { projectDirectoryDeviceName } from '@/features/ChatInput/ControlBar/projectDeviceTargets';import EmptyNavItem from '@/features/NavPanel/components/EmptyNavItem';import { useAgentStore } from '@/store/agent';@@ -30,6 +32,7 @@ import { agentByIdSelectors } from '@/store/agent/selectors';import { useChatStore } from '@/store/chat';import { operationSelectors } from '@/store/chat/selectors';import { deviceSelectors, useDeviceStore } from '@/store/device';+import { useElectronStore } from '@/store/electron';import { type ProjectTopicSubGroupMode } from '@/store/global/initialState';import { type ProjectDirectory, useProjectDirectories } from '@/store/projectWorkingDirectory';import { useUserStore } from '@/store/user';@@ -39,6 +42,7 @@ import { type ChatTopic, type GroupedTopic } from '@/types/topic';import TopicItem from '../../List/Item';import { formatTimeGroupId } from '../ByTimeMode/timeGroupTitle';import { indicatorStyles, useCollapsedIndicators } from './CollapsedIndicators';+import { deviceCategoryKey, deviceDisplayName } from './deviceIdentity';import {DEVICE_SUB_GROUP_PREFIX,groupProjectTopics,@@ -91,11 +95,22 @@ interface SubGroupItemProps {onStartInDirectory?: (projectWorkingDirectoryId: string) => void;startDirectoryId?: string;suppressAgentAvatar?: boolean;+ /** Tells apart sections whose titles match, e.g. one machine's two device identities. */+ tag?: string;title: string;}const SubGroupItem = memo<SubGroupItemProps>(- ({ expanded, group, icon, onStartInDirectory, startDirectoryId, suppressAgentAvatar, title }) => {+ ({+ expanded,+ group,+ icon,+ onStartInDirectory,+ startDirectoryId,+ suppressAgentAvatar,+ tag,+ title,+ }) => {const { t } = useTranslation('topic');const { t: tProject } = useTranslation('project');// A folded section keeps the project row's running / awaiting / failed@@ -115,6 +130,21 @@ const SubGroupItem = memo<SubGroupItemProps>(<Text ellipsis fontSize={12} type={'secondary'} weight={500}>{title}</Text>+ {tag && (+ <Tag+ size={'small'}+ style={{+ color: cssVar.colorTextDescription,+ flex: '0 1 auto',+ fontSize: 10,+ maxWidth: '50%',+ minWidth: 0,+ overflow: 'hidden',+ }}+ >+ <TailMarquee>{tag}</TailMarquee>+ </Tag>+ )}</Flexbox></AccordionTrigger>{(startDirectoryId || hasIndicators) && (@@ -167,7 +197,7 @@ const SubGroupItem = memo<SubGroupItemProps>(SubGroupItem.displayName = 'ProjectTopicSubGroupItem';interface ProjectTopicListProps {- /** The group's effective sub-group mode (folders never get `byDevice`). */+ /** The group's effective sub-group mode (a folder gets `byDevice` only across machines). */mode: ProjectTopicSubGroupMode;/** Opens the new-topic composer staged on one project directory. */onStartInDirectory?: (projectWorkingDirectoryId: string) => void;@@ -187,11 +217,13 @@ interface ProjectTopicListProps {const ProjectTopicList = memo<ProjectTopicListProps>((props) => {const { mode, onStartInDirectory, suppressAgentAvatar, topics } = props;const { t } = useTranslation('topic');+ const { t: tChat } = useTranslation('chat');const topicSortBy = useUserStore(preferenceSelectors.topicSortBy);const field = topicSortBy === 'createdAt' ? 'createdAt' : 'updatedAt';useDeviceStore((s) => s.useFetchDevices)(mode === 'byDevice');const devices = useDeviceStore(deviceSelectors.deviceList);+ const currentDeviceId = useElectronStore((s) => s.gatewayDeviceInfo?.deviceId);const directories = useProjectDirectories();// The shared row, not a topic-pinned config: a fixed target is the author's// setting, and it is what the server checks a start against.@@ -269,12 +301,24 @@ const ProjectTopicList = memo<ProjectTopicListProps>((props) => {const deviceId = group.id.slice(DEVICE_SUB_GROUP_PREFIX.length);const directory = directories.find((item) => item.deviceId === deviceId);if (directory) return projectDirectoryDeviceName(directory, devices);- const device = devices.find((item) => item.deviceId === deviceId);- return device?.friendlyName || device?.hostname || deviceId;+ return deviceDisplayName(deviceId, devices);},[mode, t, directories, devices],);+ // Device sections sharing a name — one machine under its personal and its+ // workspace identity — are told apart by their execution-environment category.+ const getTag = (group: GroupedTopic, title: string, titles: string[]) => {+ if (mode !== 'byDevice' || !group.id.startsWith(DEVICE_SUB_GROUP_PREFIX)) return;+ if (titles.filter((item) => item === title).length < 2) return;+ const key = deviceCategoryKey(+ group.id.slice(DEVICE_SUB_GROUP_PREFIX.length),+ devices,+ currentDeviceId,+ );+ return key && tChat(key);+ };+// The directory a device section's "+" starts in: the one its newest topic// runs in, else any of the group's directories on that device.const getStartDirectoryId = (group: GroupedTopic) => {@@ -311,6 +355,8 @@ const ProjectTopicList = memo<ProjectTopicListProps>((props) => {);}+ const titles = groups.map(getTitle);+return (<AccordionRootindicatorPlacement="inline"@@ -318,14 +364,15 @@ const ProjectTopicList = memo<ProjectTopicListProps>((props) => {value={expandedIds}onValueChange={handleExpandedChange}>- {groups.map((group) => (+ {groups.map((group, index) => (<SubGroupItemexpanded={!!expandedIds?.includes(group.id)}group={group}key={group.id}startDirectoryId={getStartDirectoryId(group)}suppressAgentAvatar={suppressAgentAvatar}- title={getTitle(group)}+ tag={getTag(group, titles[index], titles)}+ title={titles[index]}icon={mode === 'byStatus'? STATUS_ICON[group.id]diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/deviceIdentity.ts b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/deviceIdentity.tsnew file mode 100644index 00000000000..d8274725a91--- /dev/null+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/deviceIdentity.ts@@ -0,0 +1,26 @@+import type { DeviceListItem } from '@lobechat/types';++/**+ * The execution-environment category a device belongs to, named with the same+ * keys the device switcher groups by: this desktop, a private device, or a+ * workspace device. One machine can be several of these at once (its personal+ * and workspace identities), which is exactly when the name alone is not+ * enough. Unknown devices get no category rather than a guessed one.+ */+export const deviceCategoryKey = (+ deviceId: string,+ devices: DeviceListItem[] | undefined,+ currentDeviceId: string | undefined,+) => {+ if (deviceId === currentDeviceId) return 'heteroAgent.executionTarget.local' as const;+ const device = devices?.find((item) => item.deviceId === deviceId);+ if (!device) return;+ return device.scope === 'workspace'+ ? ('heteroAgent.executionTarget.workspaceGroup' as const)+ : ('heteroAgent.executionTarget.personalGroup' as const);+};++export const deviceDisplayName = (deviceId: string, devices: DeviceListItem[] | undefined) => {+ const device = devices?.find((item) => item.deviceId === deviceId);+ return device?.friendlyName || device?.hostname || deviceId;+};diff --git a/src/features/AgentSidebar/Topic/TopicListContent/GroupedAccordion.tsx b/src/features/AgentSidebar/Topic/TopicListContent/GroupedAccordion.tsxindex 4f0b199f13b..327c6959e2f 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/GroupedAccordion.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/GroupedAccordion.tsx@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';import NavItem from '@/features/NavPanel/components/NavItem';import SkeletonList from '@/features/NavPanel/components/SkeletonList';+import { useLocalMachineDeviceIds } from '@/hooks/useLocalMachineDeviceIds';import { useTopicGroupCollapse } from '@/hooks/useTopicGroupCollapse';import { useChatStore } from '@/store/chat';import { topicSelectors } from '@/store/chat/selectors';@@ -46,6 +47,7 @@ const GroupedAccordion = memo<GroupedAccordionProps>(({ GroupItem }) => {s.activeTopicId,]);+ const localDeviceIds = useLocalMachineDeviceIds();const groupSelector = useMemo(() =>topicSelectors.groupedTopicsForSidebar(@@ -53,8 +55,9 @@ const GroupedAccordion = memo<GroupedAccordionProps>(({ GroupItem }) => {topicSortBy,topicGroupMode,topicIncludeCompleted,+ localDeviceIds,),- [topicPageSize, topicSortBy, topicGroupMode, topicIncludeCompleted],+ [topicPageSize, topicSortBy, topicGroupMode, topicIncludeCompleted, localDeviceIds],);const agentGroups = useChatStore(groupSelector, isEqual);const scoped = useScopedSidebarTopics(diff --git a/src/features/AgentSidebar/Topic/useScopedTopics.ts b/src/features/AgentSidebar/Topic/useScopedTopics.tsindex 0a119e1a6e6..033faaff5cc 100644--- a/src/features/AgentSidebar/Topic/useScopedTopics.ts+++ b/src/features/AgentSidebar/Topic/useScopedTopics.ts@@ -3,6 +3,7 @@ import { useMemo } from 'react';import { MAIN_SIDEBAR_EXCLUDE_TRIGGERS } from '@/const/topic';import { useActiveRouteParams } from '@/hooks/useActiveRouteParams';+import { useLocalMachineDeviceIds } from '@/hooks/useLocalMachineDeviceIds';import { useTopicOnlyMine } from '@/hooks/useTopicOnlyMine';import { useChatStore } from '@/store/chat';import { operationSelectors } from '@/store/chat/selectors';@@ -103,6 +104,7 @@ export const useScopedSidebarTopics = (const reveal = useTopicListReveal();const visibleLimit = pageSize + (reveal?.extraRows ?? 0);const running = useChatStore(operationSelectors.visiblyRunningTopicIds);+ const localDeviceIds = useLocalMachineDeviceIds();const directories = useProjectDirectories(scope?.projectId);const filter = useTopicListFilter()?.filter;const filtering = !!(filter?.status || filter?.device);@@ -141,11 +143,28 @@ export const useScopedSidebarTopics = ();const coordinatorAgentId = scope?.coordinatorAgentId;const groups = useMemo(() => {- const grouped = groupSidebarTopics(visible, groupMode, sortBy, running, directories);+ const grouped = groupSidebarTopics(+ visible,+ groupMode,+ sortBy,+ running,+ directories,+ localDeviceIds,+ );if (groupMode !== 'byAgent') return grouped;const pinned = pinCoordinatorGroup(grouped, coordinatorAgentId);return filtering ? pinned : withCoordinatorGroup(pinned, scope);- }, [visible, groupMode, sortBy, running, directories, coordinatorAgentId, filtering, scope]);+ }, [+ visible,+ groupMode,+ sortBy,+ running,+ directories,+ localDeviceIds,+ coordinatorAgentId,+ filtering,+ scope,+ ]);const hasMore =candidates.filtered.filter((topic) => includeCompleted || topic.status !== 'completed').length >visibleLimit;diff --git a/src/features/AgentTopicManager/index.tsx b/src/features/AgentTopicManager/index.tsxindex 3fd6c0f9ed6..ffbe3256a3c 100644--- a/src/features/AgentTopicManager/index.tsx+++ b/src/features/AgentTopicManager/index.tsx@@ -11,6 +11,7 @@ import { useTranslation } from 'react-i18next';import AsyncError from '@/components/AsyncError';import TopicsSkeleton from '@/components/Skeleton/Topics';+import { useLocalMachineDeviceIds } from '@/hooks/useLocalMachineDeviceIds';import { useChatStore } from '@/store/chat';import { topicSelectors } from '@/store/chat/selectors';import { shinyTextStyles } from '@/styles/loading';@@ -41,6 +42,7 @@ const PAGE_SIZE = 30;const AgentTopicManager = memo(() => {const { t } = useTranslation('topic');const activeAgentId = useChatStore((s) => s.activeAgentId);+ const localDeviceIds = useLocalMachineDeviceIds();// Use the management page's dedicated SWR pipeline so the heavier// `withDetails` fetch doesn't share a bucket with the sidebar's cheap// fetch (the shared bucket let whichever response landed last clobber the@@ -148,10 +150,10 @@ const AgentTopicManager = memo(() => {if (!useGroups) return [{ children: filtered, id: 'all' }];if (groupBy === 'byProject') {const field: 'createdAt' | 'updatedAt' = sortBy === 'createdAt' ? 'createdAt' : 'updatedAt';- return groupTopicsByProject(filtered, field);+ return groupTopicsByProject(filtered, field, { localDeviceIds });}return groupTopicsByUpdatedTime(filtered);- }, [filtered, useGroups, groupBy, sortBy]);+ }, [filtered, useGroups, groupBy, sortBy, localDeviceIds]);const projects = useMemo(() => {const map = new Map<string, string>();diff --git a/src/hooks/useLocalMachineDeviceIds.ts b/src/hooks/useLocalMachineDeviceIds.tsnew file mode 100644index 00000000000..68fe8c0ef83--- /dev/null+++ b/src/hooks/useLocalMachineDeviceIds.ts@@ -0,0 +1,33 @@+import { isDesktop } from '@lobechat/const';+import { useMemo } from 'react';+import useSWR from 'swr';++import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import { electronKeys } from '@/libs/swr/keys';+import { gatewayConnectionService } from '@/services/electron/gatewayConnection';+import { useElectronStore } from '@/store/electron';++/**+ * The device identities this desktop is registered under: its personal device+ * first, then its device in the active workspace (the one `lh connect+ * --workspace` or a desktop share enrolls). The ids are separate on purpose —+ * the server cannot link them — but only this machine can derive both, so it+ * is the one place topics run through either can be shown as the same machine.+ * Empty off-desktop.+ */+export const useLocalMachineDeviceIds = (): string[] => {+ useElectronStore((s) => s.useFetchGatewayDeviceInfo)();+ const personalDeviceId = useElectronStore((s) => s.gatewayDeviceInfo?.deviceId);+ const workspaceId = useActiveWorkspaceId();+ const { data: workspaceDeviceId } = useSWR(+ isDesktop && workspaceId ? electronKeys.workspaceDeviceId(workspaceId) : null,+ () => gatewayConnectionService.getWorkspaceDeviceId(workspaceId!),+ { revalidateOnFocus: false },+ );++ return useMemo(+ () =>+ personalDeviceId ? [personalDeviceId, ...(workspaceDeviceId ? [workspaceDeviceId] : [])] : [],+ [personalDeviceId, workspaceDeviceId],+ );+};diff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.tsindex edad258995e..a33bef5dc0f 100644--- a/src/libs/swr/keys.ts+++ b/src/libs/swr/keys.ts@@ -983,6 +983,11 @@ export const electronKeys = {remoteServerConfig: def('electron:getRemoteServerConfig', () => ['electron:getRemoteServerConfig',]),+ /** This machine's derived device id in a workspace (local, no network). */+ workspaceDeviceId: def('electron:getWorkspaceDeviceId', (workspaceId: string) => [+ 'electron:getWorkspaceDeviceId',+ workspaceId,+ ]),};/**diff --git a/src/services/electron/gatewayConnection.ts b/src/services/electron/gatewayConnection.tsindex 90e4e4ef47d..32c5f348dad 100644--- a/src/services/electron/gatewayConnection.ts+++ b/src/services/electron/gatewayConnection.ts@@ -28,6 +28,10 @@ class GatewayConnectionService {getStableDeviceId = async () => {return ensureElectronIpc().gatewayConnection.getStableDeviceId();};++ getWorkspaceDeviceId = async (workspaceId: string) => {+ return ensureElectronIpc().gatewayConnection.getWorkspaceDeviceId({ workspaceId });+ };}export const gatewayConnectionService = new GatewayConnectionService();diff --git a/src/store/chat/slices/topic/selectors.ts b/src/store/chat/slices/topic/selectors.tsindex 1640414de0a..7c446d37ba7 100644--- a/src/store/chat/slices/topic/selectors.ts+++ b/src/store/chat/slices/topic/selectors.ts@@ -381,11 +381,12 @@ const getGroupFn = (sortBy: TopicSortBy,loadingTopicIds?: ReadonlySet<string>,directories?: ReadonlyArray<TopicDeviceDirectory>,+ localDeviceIds?: readonly string[],) => {const field: 'createdAt' | 'updatedAt' = sortBy === 'createdAt' ? 'createdAt' : 'updatedAt';if (groupMode === 'byProject') {return (topics: ChatTopic[]) =>- groupTopicsByProject(topics, field).map((group) =>+ groupTopicsByProject(topics, field, { localDeviceIds }).map((group) =>group.id === 'no-project'? { ...group, title: t('groupTitle.byProject.noProject', { ns: 'topic' }) }: group,@@ -407,7 +408,8 @@ const getGroupFn = (if (groupMode === 'byDevice') {// Device names resolve at render time from the directory and device// registries, so groups stay title-less here.- return (topics: ChatTopic[]) => groupTopicsByDevice(topics, field, directories);+ return (topics: ChatTopic[]) =>+ groupTopicsByDevice(topics, field, directories, { localDeviceIds });}return sortBy === 'updatedAt' ? groupTopicsByUpdatedTime : groupTopicsByTime;};@@ -443,7 +445,13 @@ export const groupSidebarTopics = (sortBy: TopicSortBy,loadingTopicIds?: ReadonlySet<string>,directories?: ReadonlyArray<TopicDeviceDirectory>,-) => buildGroupedTopics(topics, getGroupFn(groupMode, sortBy, loadingTopicIds, directories));+ /** This machine's device identities (`useLocalMachineDeviceIds`), merged in byProject. */+ localDeviceIds?: readonly string[],+) =>+ buildGroupedTopics(+ topics,+ getGroupFn(groupMode, sortBy, loadingTopicIds, directories, localDeviceIds),+ );const groupedTopicsSelector =(groupFn: typeof groupTopicsByTime = groupTopicsByTime) =>@@ -459,6 +467,7 @@ const groupedTopicsForSidebar =sortBy: TopicSortBy = 'updatedAt',groupMode: TopicGroupMode = 'byTime',includeCompleted = true,+ localDeviceIds?: readonly string[],) =>(s: ChatStoreState): GroupedTopic[] => {const limitedTopics = displayTopicsForSidebar(pageSize, sortBy, includeCompleted)(s);@@ -469,7 +478,14 @@ const groupedTopicsForSidebar =// buckets straight from `topic.status`.const loadingTopicIds =groupMode === 'byStatus' ? operationSelectors.visiblyRunningTopicIds(s) : undefined;- return groupSidebarTopics(limitedTopics, groupMode, sortBy, loadingTopicIds);+ return groupSidebarTopics(+ limitedTopics,+ groupMode,+ sortBy,+ loadingTopicIds,+ undefined,+ localDeviceIds,+ );};const hasMoreTopics = (s: ChatStoreState): boolean => {