🤯 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(device): improve device connection management (#16191)
AmAzing-9d6bf3f8fad0
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex ff7eebafdad..db73db6d5d1 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -239,26 +239,21 @@"heteroAgent.cloudRepo.notSet": "No repo selected","heteroAgent.cloudRepo.sectionTitle": "Repositories","heteroAgent.executionTarget.auto": "Auto",- "heteroAgent.executionTarget.autoDesc": "Use an online device automatically, picking one when several are available",- "heteroAgent.executionTarget.downloadDesktop": "Get Desktop App",- "heteroAgent.executionTarget.downloadDesktopDesc": "Run agents with access to your computer",- "heteroAgent.executionTarget.downloadDesktopTitle": "Get the desktop app",- "heteroAgent.executionTarget.gateway": "Gateway",- "heteroAgent.executionTarget.gatewayDesc": "Run through the device gateway so other clients can follow progress",- "heteroAgent.executionTarget.infoTooltip": "Pick a device and the agent uses it as its runtime environment — reading and writing files and operating the computer. Cloud sandbox is provided by LobeHub Marketplace.",+ "heteroAgent.executionTarget.autoDesc": "Use any available connected device automatically",+ "heteroAgent.executionTarget.autoUnavailableDesc": "No connected device is online yet",+ "heteroAgent.executionTarget.infoTooltip": "Choose where the agent runs. Connected devices use configured folders, terminal access, and command-line tools installed on that device; Cloud Sandbox runs in an isolated temporary cloud environment.","heteroAgent.executionTarget.loading": "Loading devices…","heteroAgent.executionTarget.local": "This device",- "heteroAgent.executionTarget.localDesc": "Run as a local process on this desktop app",- "heteroAgent.executionTarget.manage": "Manage",- "heteroAgent.executionTarget.noDevices": "No remote devices yet. Run `lh connect` on another machine to add one.",+ "heteroAgent.executionTarget.localDesc": "Run locally in this desktop app",+ "heteroAgent.executionTarget.manage": "Manage devices","heteroAgent.executionTarget.none": "No device",- "heteroAgent.executionTarget.noneDesc": "No device enabled",+ "heteroAgent.executionTarget.noneDesc": "Don't use a connected device or Cloud Sandbox","heteroAgent.executionTarget.offline": "Offline","heteroAgent.executionTarget.online": "Online","heteroAgent.executionTarget.personalGroup": "Personal","heteroAgent.executionTarget.sandbox": "Cloud Sandbox",- "heteroAgent.executionTarget.sandboxDesc": "Run in an ephemeral cloud sandbox",- "heteroAgent.executionTarget.title": "Execution Device",+ "heteroAgent.executionTarget.sandboxDesc": "Run in an isolated temporary cloud environment",+ "heteroAgent.executionTarget.title": "Execution Environment","heteroAgent.executionTarget.unknownDevice": "Unknown device","heteroAgent.executionTarget.workspaceGroup": "Workspace","heteroAgent.fullAccess.label": "Full access",diff --git a/locales/en-US/electron.json b/locales/en-US/electron.jsonindex 030a61d8437..a5627343c28 100644--- a/locales/en-US/electron.json+++ b/locales/en-US/electron.json@@ -27,11 +27,11 @@"gateway.descriptionPlaceholder": "Optional","gateway.deviceName": "Device Name","gateway.deviceNamePlaceholder": "Enter device name",- "gateway.enableConnection": "Connect to Gateway",- "gateway.statusConnected": "Connected to Gateway",- "gateway.statusConnecting": "Connecting to Gateway...",- "gateway.statusDisconnected": "Not connected to Gateway",- "gateway.title": "Device Gateway",+ "gateway.enableConnection": "Device Connection",+ "gateway.statusConnected": "Device Connection is on",+ "gateway.statusConnecting": "Turning on Device Connection...",+ "gateway.statusDisconnected": "Device Connection is off",+ "gateway.title": "Device Connection","navigation.chat": "Chat","navigation.discover": "Discover","navigation.discoverAssistants": "Discover Agents",diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex ad277db7480..bb0a1183504 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -278,15 +278,9 @@"defaultAgent.model.desc": "Model used when creating new agents","defaultAgent.model.title": "Model","defaultAgent.title": "New Agent",+ "devices.actions.connectAnother": "Connect another device","devices.actions.edit": "Edit","devices.actions.remove": "Remove",- "devices.capabilities.commands.desc": "Safely execute terminal commands in your environment.",- "devices.capabilities.commands.title": "Run commands",- "devices.capabilities.files.desc": "Let agents directly access and organize the files on your computer.",- "devices.capabilities.files.title": "Read & write local files",- "devices.capabilities.title": "What you can do once connected",- "devices.capabilities.tools.desc": "Connect local tools to extend what agents can do.",- "devices.capabilities.tools.title": "Call system tools","devices.channel.connected": "Connected {{time}}","devices.connectWizard.button": "Connect Device","devices.connectWizard.cli.connectDesc": "Start the background daemon to keep the device online and listening for remote operations.",@@ -298,14 +292,13 @@"devices.connectWizard.desktop.downloadLink": "Download LobeHub Desktop","devices.connectWizard.desktop.step1": "Download the desktop app","devices.connectWizard.desktop.step1Desc": "Visit the LobeHub downloads page and get the app for your operating system.",- "devices.connectWizard.desktop.step2": "Sign in and open the device gateway",- "devices.connectWizard.desktop.step2Desc": "After signing in, click the device gateway icon in the top-right corner and confirm it's turned on.",+ "devices.connectWizard.desktop.step2": "Sign in and turn on Device Connection",+ "devices.connectWizard.desktop.step2Desc": "After signing in, click Device Connection in the top-right corner of LobeHub Desktop and turn it on.","devices.connectWizard.desktop.step3": "Your device appears automatically",- "devices.connectWizard.desktop.step3Desc": "The desktop app registers itself as a device on launch — you'll see it in the list once connected.",- "devices.connectWizard.footer": "Only device metadata is registered — your data is never accessed.",+ "devices.connectWizard.desktop.step3Desc": "Once Device Connection is on, LobeHub Desktop registers this device — you'll see it in the list once connected.",+ "devices.connectWizard.footer": "LobeHub only stores device metadata and configured working directories. File access and commands run only while LobeHub Desktop is open with Device Connection on, or while the CLI daemon is running.","devices.connectWizard.method.cli": "Via CLI","devices.connectWizard.method.desktop": "Via Desktop",- "devices.connectWizard.subtitle": "Choose how to connect your computer to LobeHub.","devices.connectWizard.title": "Connect Device","devices.currentBadge": "This device","devices.detail.addDir": "Add directory",@@ -320,18 +313,37 @@"devices.edit.friendlyNamePlaceholder": "A name to recognize this device","devices.edit.save": "Save","devices.edit.title": "Edit device",- "devices.empty.desc": "Once connected, LobeHub agents can read/write files, run commands, and call system tools directly on your computer.",+ "devices.empty.desc": "Connect a trusted computer or server so agents can work in configured directories, run commands, and use command-line tools available on that device.","devices.empty.methodCli.desc": "Install the CLI in your terminal — great for servers or headless machines.","devices.empty.methodCli.title": "Connect via CLI","devices.empty.methodDesktop.badge": "Recommended",- "devices.empty.methodDesktop.desc": "Download the desktop app, sign in, and your device connects automatically.",+ "devices.empty.methodDesktop.desc": "Download the desktop app, sign in, and turn on Device Connection.","devices.empty.methodDesktop.title": "Connect via Desktop","devices.empty.title": "Connect your first device","devices.fallbackBadge": "Unstable identity","devices.fallbackTooltip": "This device couldn't be identified by its machine ID, so reinstalling the app may create a duplicate entry.","devices.lastSeen": "Last active {{time}}",+ "devices.overview.personal.desc": "After you select a device, agents can use its configured directories, terminal, and installed command-line tools.",+ "devices.overview.personal.title": "Run agents on local devices",+ "devices.overview.workspace.desc": "Enroll a trusted machine so workspace members can run agents there with access to shared project folders, commands, and installed command-line tools.",+ "devices.overview.workspace.title": "Run agents on shared workspace devices",+ "devices.placeholder.connection": "Check whether LobeHub Desktop is open with Device Connection on, or whether the CLI daemon is running.",+ "devices.placeholder.cwd": "Set the default working folder for agent runs.",+ "devices.placeholder.desc": "Review live connections, set the default working folder, and choose where agents run local operations.",+ "devices.placeholder.security": "Turn off Device Connection, quit LobeHub Desktop, or stop the CLI daemon when you don't want agents to run on this machine.",+ "devices.placeholder.title": "Select a device to manage it",+ "devices.placeholder.workspace.connection": "Check whether the CLI daemon is running on the shared machine.",+ "devices.placeholder.workspace.cwd": "Set the shared project folder for agent runs.",+ "devices.placeholder.workspace.security": "Stop the CLI daemon when this machine should no longer be available to the workspace.","devices.remove.confirm": "Remove this device?","devices.remove.confirmDesc": "This disconnects the device from your account. It does not sign the device out, and it can re-register on next connect.",+ "devices.security.personal.metadata": "LobeHub stores device metadata and configured working directories, not your files.",+ "devices.security.personal.onlineOnly": "Agents can use this device only while LobeHub Desktop is open with Device Connection on, or while the CLI daemon is running.",+ "devices.security.personal.stop": "To take a device offline, turn off Device Connection or quit LobeHub Desktop on that machine. For CLI devices, stop the daemon.",+ "devices.security.title": "Security & access",+ "devices.security.workspace.members": "Workspace devices are visible to members, but only owners can enroll devices and manage settings.",+ "devices.security.workspace.onlineOnly": "Members can run agents on a shared device only while its CLI daemon is running.",+ "devices.security.workspace.scope": "Keep working directories limited to projects the workspace should access.","devices.status.offline": "Offline","devices.status.online": "Online","devices.title": "My Devices",@@ -1990,11 +2002,11 @@"workspace.wizard.step3.title": "Welcome to {{name}}!","workspace.wizard.title": "Create Workspace","workspaceSetting.breadcrumb.settings": "Settings",- "workspaceSetting.devices.desc": "Shared machines enrolled into this workspace. Members can run agents on them.",+ "workspaceSetting.devices.desc": "Shared machines enrolled in this workspace. Members can run agents on them.","workspaceSetting.devices.empty": "No workspace devices yet.",- "workspaceSetting.devices.enrollDesc": "Run this on the machine you want to share (workspace owner only):",+ "workspaceSetting.devices.enrollDesc": "Run this on the machine you want to share (workspace owners only):","workspaceSetting.devices.enrollTitle": "Add a device",- "workspaceSetting.devices.heroDesc": "Enroll a shared machine — a build server or a team Mac — and every member can run agents on it: read/write files, run commands, and call system tools.",+ "workspaceSetting.devices.heroDesc": "Enroll a trusted shared machine — such as a build server or team Mac — so workspace members can run agents there with access to shared project folders, commands, and installed command-line tools.","workspaceSetting.devices.heroTitle": "Connect your first workspace device","workspaceSetting.devices.offline": "Offline","workspaceSetting.devices.online": "Online",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 5b57650965b..6f6de635261 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -239,26 +239,21 @@"heteroAgent.cloudRepo.notSet": "未选择仓库","heteroAgent.cloudRepo.sectionTitle": "代码仓库","heteroAgent.executionTarget.auto": "自动",- "heteroAgent.executionTarget.autoDesc": "自动使用在线设备,有多台时择一使用",- "heteroAgent.executionTarget.downloadDesktop": "下载桌面端",- "heteroAgent.executionTarget.downloadDesktopDesc": "让 Agent 直接连接你的电脑",- "heteroAgent.executionTarget.downloadDesktopTitle": "下载桌面端",- "heteroAgent.executionTarget.gateway": "网关",- "heteroAgent.executionTarget.gatewayDesc": "经由设备网关运行,其他客户端可跟踪进度",- "heteroAgent.executionTarget.infoTooltip": "选择某台设备后,Agent 将以该设备为运行环境,读写文件、操作电脑。云端沙箱由 LobeHub Marketplace 提供服务",+ "heteroAgent.executionTarget.autoDesc": "自动使用可用的已连接设备",+ "heteroAgent.executionTarget.autoUnavailableDesc": "暂无在线的已连接设备",+ "heteroAgent.executionTarget.infoTooltip": "选择助理运行的位置。已连接设备可使用已配置目录、终端访问,以及该设备上已安装的命令行工具;云端沙箱会在隔离的临时云端环境中运行。","heteroAgent.executionTarget.loading": "正在加载设备…","heteroAgent.executionTarget.local": "本机",- "heteroAgent.executionTarget.localDesc": "在当前桌面端以本地进程运行",- "heteroAgent.executionTarget.manage": "管理",- "heteroAgent.executionTarget.noDevices": "暂无远程设备。在另一台机器上执行 `lh connect` 即可接入。",+ "heteroAgent.executionTarget.localDesc": "在当前桌面端本地运行",+ "heteroAgent.executionTarget.manage": "管理设备","heteroAgent.executionTarget.none": "无设备",- "heteroAgent.executionTarget.noneDesc": "不启用任何设备",+ "heteroAgent.executionTarget.noneDesc": "不使用已连接设备或云端沙箱","heteroAgent.executionTarget.offline": "离线","heteroAgent.executionTarget.online": "在线","heteroAgent.executionTarget.personalGroup": "个人设备","heteroAgent.executionTarget.sandbox": "云端沙箱",- "heteroAgent.executionTarget.sandboxDesc": "在临时云端沙箱中运行",- "heteroAgent.executionTarget.title": "执行设备",+ "heteroAgent.executionTarget.sandboxDesc": "在隔离的临时云端环境中运行",+ "heteroAgent.executionTarget.title": "执行环境","heteroAgent.executionTarget.unknownDevice": "未知设备","heteroAgent.executionTarget.workspaceGroup": "工作区设备","heteroAgent.fullAccess.label": "完全访问权限",diff --git a/locales/zh-CN/electron.json b/locales/zh-CN/electron.jsonindex f17438e5342..7e503a79dcc 100644--- a/locales/zh-CN/electron.json+++ b/locales/zh-CN/electron.json@@ -27,11 +27,11 @@"gateway.descriptionPlaceholder": "可选","gateway.deviceName": "设备名称","gateway.deviceNamePlaceholder": "输入设备名称",- "gateway.enableConnection": "连接到网关",- "gateway.statusConnected": "已连接到网关",- "gateway.statusConnecting": "正在连接到网关...",- "gateway.statusDisconnected": "未连接到网关",- "gateway.title": "设备网关",+ "gateway.enableConnection": "设备连接",+ "gateway.statusConnected": "设备连接已开启",+ "gateway.statusConnecting": "正在开启设备连接...",+ "gateway.statusDisconnected": "设备连接已关闭",+ "gateway.title": "设备连接","navigation.chat": "对话","navigation.discover": "发现","navigation.discoverAssistants": "发现助理",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex 955d6f32520..8fdc0b18775 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -278,15 +278,9 @@"defaultAgent.model.desc": "创建新助理时使用的模型","defaultAgent.model.title": "模型","defaultAgent.title": "新建助理",+ "devices.actions.connectAnother": "再连接一台设备","devices.actions.edit": "编辑","devices.actions.remove": "移除",- "devices.capabilities.commands.desc": "在你的环境中安全地执行终端命令。",- "devices.capabilities.commands.title": "运行命令",- "devices.capabilities.files.desc": "让智能体直接访问并整理你电脑上的文件。",- "devices.capabilities.files.title": "读写本地文件",- "devices.capabilities.title": "连接后你能做什么",- "devices.capabilities.tools.desc": "连接本地工具,扩展智能体的能力边界。",- "devices.capabilities.tools.title": "调用系统工具","devices.channel.connected": "已连接 {{time}}","devices.connectWizard.button": "连接设备","devices.connectWizard.cli.connectDesc": "启动后台守护进程,保持设备在线并等待远程操作。",@@ -298,14 +292,13 @@"devices.connectWizard.desktop.downloadLink": "下载 LobeHub 桌面端","devices.connectWizard.desktop.step1": "下载桌面端","devices.connectWizard.desktop.step1Desc": "前往 LobeHub 下载页获取适用于你操作系统的桌面版应用。",- "devices.connectWizard.desktop.step2": "登录并打开设备网关",- "devices.connectWizard.desktop.step2Desc": "登录后,点击右上角的设备网关图标,确认开关已打开。",+ "devices.connectWizard.desktop.step2": "登录并开启设备连接",+ "devices.connectWizard.desktop.step2Desc": "登录后,点击 LobeHub 桌面端右上角的「设备连接」,并确认开关已开启。","devices.connectWizard.desktop.step3": "设备自动出现",- "devices.connectWizard.desktop.step3Desc": "桌面端启动后会自动注册为设备,连接成功后即可在列表中看到它。",- "devices.connectWizard.footer": "仅注册设备信息,不会访问你的数据。",+ "devices.connectWizard.desktop.step3Desc": "开启「设备连接」后,LobeHub 桌面端会注册此设备,连接成功后即可在列表中看到它。",+ "devices.connectWizard.footer": "LobeHub 仅保存设备信息和已配置的工作目录;只有在 LobeHub 桌面端打开且「设备连接」已开启,或 CLI 守护进程运行时,才会进行文件访问和命令执行。","devices.connectWizard.method.cli": "通过 CLI","devices.connectWizard.method.desktop": "通过桌面端",- "devices.connectWizard.subtitle": "选择一种方式将你的电脑连接到 LobeHub。","devices.connectWizard.title": "连接设备","devices.currentBadge": "当前设备","devices.detail.addDir": "添加目录",@@ -320,18 +313,37 @@"devices.edit.friendlyNamePlaceholder": "便于识别此设备的名称","devices.edit.save": "保存","devices.edit.title": "编辑设备",- "devices.empty.desc": "连接后,LobeHub 上的智能体可以直接在你的电脑上读写文件、运行命令和调用系统工具。",+ "devices.empty.desc": "连接一台可信的电脑或服务器,让助理在已配置目录中处理文件、运行命令,并调用该设备终端中可用的命令行工具。","devices.empty.methodCli.desc": "通过终端安装 CLI,适用于服务器或无桌面环境。","devices.empty.methodCli.title": "使用 CLI 连接","devices.empty.methodDesktop.badge": "推荐",- "devices.empty.methodDesktop.desc": "下载桌面端,登录后设备自动连接。",+ "devices.empty.methodDesktop.desc": "下载桌面端,登录后开启「设备连接」。","devices.empty.methodDesktop.title": "使用桌面端连接","devices.empty.title": "连接你的第一台设备","devices.fallbackBadge": "身份不稳定","devices.fallbackTooltip": "未能通过机器 ID 识别此设备,重装应用可能会产生重复条目。","devices.lastSeen": "最近活跃 {{time}}",+ "devices.overview.personal.desc": "选择设备后,助理可以使用已配置目录、终端,以及该设备上已安装的命令行工具。",+ "devices.overview.personal.title": "在本地设备上运行助理",+ "devices.overview.workspace.desc": "注册一台可信机器,让工作区成员可通过助理访问共享项目目录、运行命令,并调用该设备上已安装的命令行工具。",+ "devices.overview.workspace.title": "在工作区共享设备上运行助理",+ "devices.placeholder.connection": "确认 LobeHub 桌面端已打开且「设备连接」已开启,或 CLI 守护进程正在运行。",+ "devices.placeholder.cwd": "设置助理默认进入的工作目录。",+ "devices.placeholder.desc": "查看实时连接、设置默认工作目录,并决定助理在哪个环境中执行本地操作。",+ "devices.placeholder.security": "不需要助理在此设备上执行任务时,可关闭「设备连接」、退出桌面端,或停止 CLI 守护进程。",+ "devices.placeholder.title": "选择一台设备进行管理",+ "devices.placeholder.workspace.connection": "确认共享机器上的 CLI 守护进程正在运行。",+ "devices.placeholder.workspace.cwd": "设置助理默认进入的共享项目目录。",+ "devices.placeholder.workspace.security": "当这台机器不应继续提供给工作区使用时,请停止 CLI 守护进程。","devices.remove.confirm": "移除此设备?","devices.remove.confirmDesc": "这会断开设备与你账户的关联,但不会让设备登出,下次连接时它可重新注册。",+ "devices.security.personal.metadata": "LobeHub 仅保存设备信息和已配置的工作目录,不会同步你的文件。",+ "devices.security.personal.onlineOnly": "只有 LobeHub 桌面端打开且「设备连接」已开启,或 CLI 守护进程运行时,助理才能使用此设备。",+ "devices.security.personal.stop": "要让设备离线,请在该机器上关闭「设备连接」或退出 LobeHub 桌面端;CLI 设备请停止守护进程。",+ "devices.security.title": "安全与访问",+ "devices.security.workspace.members": "工作区成员可以看到共享设备,但只有所有者可以注册和管理设备。",+ "devices.security.workspace.onlineOnly": "只有 CLI 守护进程运行时,成员才能在共享设备上运行助理。",+ "devices.security.workspace.scope": "请将工作目录限制在工作区需要访问的项目范围内。","devices.status.offline": "离线","devices.status.online": "在线","devices.title": "我的设备",@@ -1990,12 +2002,12 @@"workspace.wizard.step3.title": "欢迎来到 {{name}}!","workspace.wizard.title": "创建工作区","workspaceSetting.breadcrumb.settings": "设置",- "workspaceSetting.devices.desc": "加入此工作区的共享设备。成员可以在这些设备上运行代理。",+ "workspaceSetting.devices.desc": "已注册到此工作区的共享设备。成员可以在这些设备上运行助理。","workspaceSetting.devices.empty": "尚无工作区设备。",- "workspaceSetting.devices.enrollDesc": "在您想要共享的设备上运行以下命令(仅限工作区所有者):",+ "workspaceSetting.devices.enrollDesc": "在要共享的设备上运行以下命令(仅限工作区所有者):","workspaceSetting.devices.enrollTitle": "添加设备",- "workspaceSetting.devices.heroDesc": "注册一台共享设备——例如构建服务器或团队的 Mac——每个成员都可以在其上运行代理:读取/写入文件、运行命令以及调用系统工具。",- "workspaceSetting.devices.heroTitle": "连接您的第一个工作区设备",+ "workspaceSetting.devices.heroDesc": "注册一台可信的共享设备,例如构建服务器或团队 Mac。工作区成员可通过助理访问共享项目目录、运行命令,并调用该设备上已安装的命令行工具。",+ "workspaceSetting.devices.heroTitle": "连接你的第一台工作区设备","workspaceSetting.devices.offline": "离线","workspaceSetting.devices.online": "在线","workspaceSetting.group.admin": "管理",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex f369be6e605..2f8775fccf0 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -190,31 +190,23 @@ export default {'heteroAgent.cloudRepo.noRepos': 'No repositories configured. Add them in agent settings.','heteroAgent.cloudRepo.multiSelected': '{{count}} repos selected','heteroAgent.executionTarget.auto': 'Auto',- 'heteroAgent.executionTarget.autoDesc':- 'Use an online device automatically, picking one when several are available',+ 'heteroAgent.executionTarget.autoDesc': 'Use any available connected device automatically',+ 'heteroAgent.executionTarget.autoUnavailableDesc': 'No connected device is online yet','heteroAgent.executionTarget.infoTooltip':- 'Pick a device and the agent uses it as its runtime environment — reading and writing files and operating the computer. Cloud sandbox is provided by LobeHub Marketplace.',- 'heteroAgent.executionTarget.gateway': 'Gateway',- 'heteroAgent.executionTarget.gatewayDesc':- 'Run through the device gateway so other clients can follow progress',+ 'Choose where the agent runs. Connected devices use configured folders, terminal access, and command-line tools installed on that device; Cloud Sandbox runs in an isolated temporary cloud environment.','heteroAgent.executionTarget.loading': 'Loading devices…','heteroAgent.executionTarget.local': 'This device',- 'heteroAgent.executionTarget.localDesc': 'Run as a local process on this desktop app',- 'heteroAgent.executionTarget.manage': 'Manage',- 'heteroAgent.executionTarget.noDevices':- 'No remote devices yet. Run `lh connect` on another machine to add one.',+ 'heteroAgent.executionTarget.localDesc': 'Run locally in this desktop app',+ 'heteroAgent.executionTarget.manage': 'Manage devices','heteroAgent.executionTarget.none': 'No device',- 'heteroAgent.executionTarget.noneDesc': 'No device enabled',+ 'heteroAgent.executionTarget.noneDesc': "Don't use a connected device or Cloud Sandbox",'heteroAgent.executionTarget.offline': 'Offline','heteroAgent.executionTarget.online': 'Online','heteroAgent.executionTarget.personalGroup': 'Personal','heteroAgent.executionTarget.sandbox': 'Cloud Sandbox',- 'heteroAgent.executionTarget.sandboxDesc': 'Run in an ephemeral cloud sandbox',+ 'heteroAgent.executionTarget.sandboxDesc': 'Run in an isolated temporary cloud environment','heteroAgent.executionTarget.workspaceGroup': 'Workspace',- 'heteroAgent.executionTarget.downloadDesktop': 'Get Desktop App',- 'heteroAgent.executionTarget.downloadDesktopDesc': 'Run agents with access to your computer',- 'heteroAgent.executionTarget.downloadDesktopTitle': 'Get the desktop app',- 'heteroAgent.executionTarget.title': 'Execution Device',+ 'heteroAgent.executionTarget.title': 'Execution Environment','heteroAgent.executionTarget.unknownDevice': 'Unknown device','hideForYou':"Direct message content is hidden. Please enable 'Show Direct Message Content' in settings to view.",diff --git a/packages/locales/src/default/electron.ts b/packages/locales/src/default/electron.tsindex 11783a48800..6f9ccc80a94 100644--- a/packages/locales/src/default/electron.ts+++ b/packages/locales/src/default/electron.ts@@ -103,11 +103,11 @@ export default {'gateway.descriptionPlaceholder': 'Optional','gateway.deviceName': 'Device Name','gateway.deviceNamePlaceholder': 'Enter device name',- 'gateway.enableConnection': 'Connect to Gateway',- 'gateway.statusConnected': 'Connected to Gateway',- 'gateway.statusConnecting': 'Connecting to Gateway...',- 'gateway.statusDisconnected': 'Not connected to Gateway',- 'gateway.title': 'Device Gateway',+ 'gateway.enableConnection': 'Device Connection',+ 'gateway.statusConnected': 'Device Connection is on',+ 'gateway.statusConnecting': 'Turning on Device Connection...',+ 'gateway.statusDisconnected': 'Device Connection is off',+ 'gateway.title': 'Device Connection','remoteServer.authError': 'Authorization failed: {{error}}','remoteServer.authPending': 'Please complete the authorization in your browser','remoteServer.configDesc': 'Connect to the remote LobeHub server to enable data synchronization',diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex 3d1c3eec3cd..950b21c55cc 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -337,6 +337,7 @@ export default {'creds.view.title': 'View Credential: {{name}}','creds.view.values': 'Credential Values','creds.view.warning': 'These values are sensitive. Do not share them with others.',+ 'devices.actions.connectAnother': 'Connect another device','devices.actions.edit': 'Edit','devices.actions.remove': 'Remove','devices.channel.connected': 'Connected {{time}}',@@ -353,14 +354,6 @@ export default {'devices.edit.friendlyNamePlaceholder': 'A name to recognize this device','devices.edit.save': 'Save','devices.edit.title': 'Edit device',- 'devices.capabilities.commands.desc': 'Safely execute terminal commands in your environment.',- 'devices.capabilities.commands.title': 'Run commands',- 'devices.capabilities.files.desc':- 'Let agents directly access and organize the files on your computer.',- 'devices.capabilities.files.title': 'Read & write local files',- 'devices.capabilities.title': 'What you can do once connected',- 'devices.capabilities.tools.desc': 'Connect local tools to extend what agents can do.',- 'devices.capabilities.tools.title': 'Call system tools','devices.connectWizard.button': 'Connect Device','devices.connectWizard.cli.connectDesc':'Start the background daemon to keep the device online and listening for remote operations.',@@ -375,35 +368,66 @@ export default {'devices.connectWizard.desktop.step1': 'Download the desktop app','devices.connectWizard.desktop.step1Desc':'Visit the LobeHub downloads page and get the app for your operating system.',- 'devices.connectWizard.desktop.step2': 'Sign in and open the device gateway',+ 'devices.connectWizard.desktop.step2': 'Sign in and turn on Device Connection','devices.connectWizard.desktop.step2Desc':- "After signing in, click the device gateway icon in the top-right corner and confirm it's turned on.",+ 'After signing in, click Device Connection in the top-right corner of LobeHub Desktop and turn it on.','devices.connectWizard.desktop.step3': 'Your device appears automatically','devices.connectWizard.desktop.step3Desc':- "The desktop app registers itself as a device on launch — you'll see it in the list once connected.",+ "Once Device Connection is on, LobeHub Desktop registers this device — you'll see it in the list once connected.",'devices.connectWizard.footer':- 'Only device metadata is registered — your data is never accessed.',+ 'LobeHub only stores device metadata and configured working directories. File access and commands run only while LobeHub Desktop is open with Device Connection on, or while the CLI daemon is running.','devices.connectWizard.method.cli': 'Via CLI','devices.connectWizard.method.desktop': 'Via Desktop',- 'devices.connectWizard.subtitle': 'Choose how to connect your computer to LobeHub.','devices.connectWizard.title': 'Connect Device','devices.empty.desc':- 'Once connected, LobeHub agents can read/write files, run commands, and call system tools directly on your computer.',+ 'Connect a trusted computer or server so agents can work in configured directories, run commands, and use command-line tools available on that device.','devices.empty.methodCli.desc':'Install the CLI in your terminal — great for servers or headless machines.','devices.empty.methodCli.title': 'Connect via CLI','devices.empty.methodDesktop.badge': 'Recommended','devices.empty.methodDesktop.desc':- 'Download the desktop app, sign in, and your device connects automatically.',+ 'Download the desktop app, sign in, and turn on Device Connection.','devices.empty.methodDesktop.title': 'Connect via Desktop','devices.empty.title': 'Connect your first device','devices.fallbackBadge': 'Unstable identity','devices.fallbackTooltip':"This device couldn't be identified by its machine ID, so reinstalling the app may create a duplicate entry.",'devices.lastSeen': 'Last active {{time}}',+ 'devices.overview.personal.desc':+ 'After you select a device, agents can use its configured directories, terminal, and installed command-line tools.',+ 'devices.overview.personal.title': 'Run agents on local devices',+ 'devices.overview.workspace.desc':+ 'Enroll a trusted machine so workspace members can run agents there with access to shared project folders, commands, and installed command-line tools.',+ 'devices.overview.workspace.title': 'Run agents on shared workspace devices',+ 'devices.placeholder.connection':+ 'Check whether LobeHub Desktop is open with Device Connection on, or whether the CLI daemon is running.',+ 'devices.placeholder.cwd': 'Set the default working folder for agent runs.',+ 'devices.placeholder.desc':+ 'Review live connections, set the default working folder, and choose where agents run local operations.',+ 'devices.placeholder.security':+ "Turn off Device Connection, quit LobeHub Desktop, or stop the CLI daemon when you don't want agents to run on this machine.",+ 'devices.placeholder.title': 'Select a device to manage it',+ 'devices.placeholder.workspace.connection':+ 'Check whether the CLI daemon is running on the shared machine.',+ 'devices.placeholder.workspace.cwd': 'Set the shared project folder for agent runs.',+ 'devices.placeholder.workspace.security':+ 'Stop the CLI daemon when this machine should no longer be available to the workspace.','devices.remove.confirm': 'Remove this device?','devices.remove.confirmDesc':'This disconnects the device from your account. It does not sign the device out, and it can re-register on next connect.',+ 'devices.security.personal.metadata':+ 'LobeHub stores device metadata and configured working directories, not your files.',+ 'devices.security.personal.onlineOnly':+ 'Agents can use this device only while LobeHub Desktop is open with Device Connection on, or while the CLI daemon is running.',+ 'devices.security.personal.stop':+ 'To take a device offline, turn off Device Connection or quit LobeHub Desktop on that machine. For CLI devices, stop the daemon.',+ 'devices.security.title': 'Security & access',+ 'devices.security.workspace.members':+ 'Workspace devices are visible to members, but only owners can enroll devices and manage settings.',+ 'devices.security.workspace.onlineOnly':+ 'Members can run agents on a shared device only while its CLI daemon is running.',+ 'devices.security.workspace.scope':+ 'Keep working directories limited to projects the workspace should access.','devices.status.offline': 'Offline','devices.status.online': 'Online','devices.title': 'My Devices',@@ -2097,13 +2121,13 @@ When I am ___, I need ___'workspace.onboarding.step3.empty': 'No recommendations available right now.','workspaceSetting.breadcrumb.settings': 'Settings','workspaceSetting.devices.desc':- 'Shared machines enrolled into this workspace. Members can run agents on them.',+ 'Shared machines enrolled in this workspace. Members can run agents on them.','workspaceSetting.devices.empty': 'No workspace devices yet.','workspaceSetting.devices.enrollDesc':- 'Run this on the machine you want to share (workspace owner only):',+ 'Run this on the machine you want to share (workspace owners only):','workspaceSetting.devices.enrollTitle': 'Add a device','workspaceSetting.devices.heroDesc':- 'Enroll a shared machine — a build server or a team Mac — and every member can run agents on it: read/write files, run commands, and call system tools.',+ 'Enroll a trusted shared machine — such as a build server or team Mac — so workspace members can run agents there with access to shared project folders, commands, and installed command-line tools.','workspaceSetting.devices.heroTitle': 'Connect your first workspace device','workspaceSetting.devices.offline': 'Offline','workspaceSetting.devices.online': 'Online',diff --git a/packages/types/src/agent/agencyConfig.ts b/packages/types/src/agent/agencyConfig.tsindex 724d71839a2..78abeb36a08 100644--- a/packages/types/src/agent/agencyConfig.ts+++ b/packages/types/src/agent/agencyConfig.ts@@ -58,14 +58,15 @@ export type DeviceExecutionTarget = 'auto' | 'device' | 'local' | 'none' | 'sandexport interface LobeAgentAgencyConfig {/*** Device ID of the machine connected via `lh connect`.- * Required when `executionTarget === 'device'` (and always set for remote- * hetero agents `openclaw` / `hermes`).+ * Required when `executionTarget === 'device'`. Also persisted for desktop+ * `local` selections so non-desktop clients can resolve "this machine" to the+ * concrete connected device instead of falling back to the sandbox.*/boundDeviceId?: string;/**- * Execution target for the hetero agent. When omitted, resolves to a- * platform default: `'local'` on desktop, `'none'` on web (or `'device'` for- * remote hetero providers).+ * Execution target for this agent. When omitted, resolves to a platform+ * default: `'local'` on desktop, `'none'` on web (or `'device'` for remote+ * hetero providers).*/executionTarget?: DeviceExecutionTarget;heterogeneousProvider?: HeterogeneousProviderConfig;diff --git a/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx b/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsxindex a7d9ed0569b..dae633936b4 100644--- a/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx@@ -11,16 +11,14 @@ import {BoxIcon,CheckIcon,ChevronDownIcon,- ExternalLinkIcon,InfoIcon,LaptopIcon,- MonitorDownIcon,MonitorIcon,MonitorOffIcon,SettingsIcon,SparklesIcon,} from 'lucide-react';-import { memo, type ReactNode, useCallback, useState } from 'react';+import { memo, type ReactNode, useCallback, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';@@ -99,30 +97,6 @@ const styles = createStaticStyles(({ css }) => ({font-size: 12px;color: ${cssVar.colorTextQuaternary};`,- downloadCard: css`- cursor: pointer;-- display: flex;- gap: 10px;- align-items: center;-- padding-block: 8px;- padding-inline: 8px;- border-radius: ${cssVar.borderRadius};-- text-decoration: none;-- transition: background-color 0.2s;-- &:hover {- background: ${cssVar.colorFillTertiary};- }- `,- downloadCardArrow: css`- flex: none;- margin-inline-start: auto;- color: ${cssVar.colorTextQuaternary};- `,option: css`cursor: pointer;@@ -214,21 +188,6 @@ const styles = createStaticStyles(({ css }) => ({color: ${cssVar.colorTextSecondary};}`,- headerLink: css`- display: flex;- gap: 3px;- align-items: center;-- font-size: 11px;- color: ${cssVar.colorTextQuaternary};- text-decoration: none;-- transition: color 0.2s;-- &:hover {- color: ${cssVar.colorPrimary};- }- `,headerTitle: css`font-size: 12px;font-weight: 500;@@ -245,14 +204,15 @@ const styles = createStaticStyles(({ css }) => ({border: none;font-size: 11px;- color: ${cssVar.colorTextQuaternary};+ font-weight: 500;+ color: ${cssVar.colorTextTertiary};background: none;transition: color 0.2s;&:hover {- color: ${cssVar.colorPrimary};+ color: ${cssVar.colorTextSecondary};}`,groupLabel: css`@@ -335,6 +295,7 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {const heteroType = agencyConfig?.heterogeneousProvider?.type;const boundDeviceId = agencyConfig?.boundDeviceId;+ const isRemoteHetero = heteroType ? isRemoteHeterogeneousType(heteroType) : false;// Heterogeneous agents (Claude Code / Codex — remote types already early-return// below) bring their own toolchain and must execute somewhere, so `'none'`@@ -346,16 +307,17 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {staleTime: 30_000,});- // The current machine's own gateway deviceId (desktop only), used to badge the- // matching device row with a "This device" tag and show the local-process- // description instead of the generic online/offline status.+ // The current machine's Device Connection id (desktop only). The desktop+ // picker shows this machine once as the dedicated local option, but we still+ // persist the id with that local choice so web/mobile can resolve it back to+ // this concrete connected device instead of falling back to the sandbox.useElectronStore((s) => s.useFetchGatewayDeviceInfo)();const gatewayDeviceInfo = useElectronStore((s) => s.gatewayDeviceInfo);const currentDeviceId = isDesktop ? gatewayDeviceInfo?.deviceId : undefined;- // Effective target: shared with server dispatch. In particular, a hetero- // desktop "local" selection that carries this desktop's boundDeviceId becomes- // a device target when the same agent is opened from web.+ // Effective target: shared with server dispatch. In particular, a desktop+ // "local" selection that carries this desktop's boundDeviceId becomes a+ // device target when the same agent is opened from web.const executionTarget = resolveExecutionTarget(agencyConfig, {isHetero,clientExecutionAvailable: isDesktop,@@ -369,6 +331,10 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {// gate + client `getRuntimeModeById` derive `runtimeMode` from it.let nextBoundDeviceId = target === 'device' ? deviceId : boundDeviceId;if (target === 'local') {+ // Desktop local execution is selected by location ("this machine"), not+ // by transport. Store the machine's connected-device id anyway so the+ // same agent opened outside desktop knows which device "local" referred+ // to and can display/route that selection as `device` there.nextBoundDeviceId = currentDeviceId;if (!nextBoundDeviceId) {try {@@ -391,20 +357,54 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {[agentId, agencyConfig, boundDeviceId, currentDeviceId, isHetero, updateAgentConfigById],);+ useEffect(() => {+ if (+ !isDesktop ||+ isRemoteHetero ||+ !currentDeviceId ||+ agencyConfig?.executionTarget !== 'device' ||+ boundDeviceId !== currentDeviceId+ ) {+ return;+ }++ // Historical/cross-client configs may store this desktop as an explicit+ // `device` target. In the desktop picker we show the current machine only+ // once as `local`, so normalize that equivalent location instead of adding+ // a duplicate "same machine via Device Connection" row just to mark it+ // selected.+ void updateAgentConfigById(agentId, {+ agencyConfig: { ...agencyConfig, boundDeviceId: currentDeviceId, executionTarget: 'local' },+ });+ }, [+ agentId,+ agencyConfig,+ boundDeviceId,+ currentDeviceId,+ isRemoteHetero,+ updateAgentConfigById,+ ]);+// Don't render for remote hetero agents — they use RemoteAgentConfigCard in profile.- if (heteroType && isRemoteHeterogeneousType(heteroType)) return null;+ if (isRemoteHetero) return null;const boundDevice =executionTarget === 'device' ? devices?.find((d) => d.deviceId === boundDeviceId) : undefined;const currentDevice = devices?.find((d) => d.deviceId === currentDeviceId);const deviceRows = devices ?? [];+ // Avoid showing the same execution location twice on desktop. The current+ // machine is already represented by the local option above; the connected+ // device list is for other machines. Cross-client continuity is handled by the+ // `boundDeviceId` stored with local selections, not by exposing a duplicate+ // "same machine through Device Connection" row here.+ const visibleDeviceRows = currentDeviceId+ ? deviceRows.filter((device) => device.deviceId !== currentDeviceId)+ : deviceRows;const hasNoDevices = deviceRows.length === 0;- // On web with no device, the prominent download card below replaces the small- // header link — avoid showing the same CTA twice.- const showWebDownloadCard = !isDesktop && hasNoDevices && !isLoading;+ const hasOnlineDevices = deviceRows.some((device) => device.online);- const personalDevices = (devices ?? []).filter((d) => d.scope === 'personal');- const workspaceDevices = (devices ?? []).filter((d) => d.scope === 'workspace');+ const personalDevices = visibleDeviceRows.filter((d) => d.scope === 'personal');+ const workspaceDevices = visibleDeviceRows.filter((d) => d.scope === 'workspace');// Only split into Personal / Workspace sections once a workspace device exists;// otherwise (personal mode / OSS) the list stays flat, exactly as before.const showDeviceGroups = workspaceDevices.length > 0;@@ -430,6 +430,7 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {chipLabel =boundDevice?.friendlyName ??boundDevice?.hostname ??+ (isLoading ? t('heteroAgent.executionTarget.loading') : undefined) ??t('heteroAgent.executionTarget.unknownDevice');}@@ -452,16 +453,11 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {const renderDeviceRow = (d: NonNullable<typeof devices>[number]) => (<OptionRowactive={isActive('device', d.deviceId)}+ desc={renderDeviceStatus(d)}disabled={!d.online}icon={getDeviceIcon(d.platform)}key={d.deviceId}label={d.friendlyName || d.hostname || d.deviceId}- tag={d.deviceId === currentDeviceId ? t('heteroAgent.executionTarget.gateway') : undefined}- desc={- d.deviceId === currentDeviceId- ? t('heteroAgent.executionTarget.gatewayDesc')- : renderDeviceStatus(d)- }onClick={() => void handleSelect('device', d.deviceId)}/>);@@ -477,29 +473,17 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {</span></Tooltip></Flexbox>- {isDesktop || showWebDownloadCard ? (- <button- className={styles.manageButton}- type="button"- onClick={() => {- setOpen(false);- navigate('/settings/devices');- }}- >- <Icon icon={SettingsIcon} size={11} />- <span>{t('heteroAgent.executionTarget.manage')}</span>- </button>- ) : (- <a- className={styles.headerLink}- href="https://lobehub.com/downloads"- rel="noreferrer"- target="_blank"- >- <Icon icon={ExternalLinkIcon} size={11} />- <span>{t('heteroAgent.executionTarget.downloadDesktop')}</span>- </a>- )}+ <button+ className={styles.manageButton}+ type="button"+ onClick={() => {+ setOpen(false);+ navigate('/settings/devices');+ }}+ >+ <Icon icon={SettingsIcon} size={11} />+ <span>{t('heteroAgent.executionTarget.manage')}</span>+ </button></div>{isHetero ? null : (<OptionRow@@ -513,9 +497,15 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {{isHetero ? null : (<OptionRowactive={isActive('auto')}- desc={t('heteroAgent.executionTarget.autoDesc')}icon={<Icon icon={SparklesIcon} size={14} />}label={t('heteroAgent.executionTarget.auto')}+ desc={+ isLoading+ ? t('heteroAgent.executionTarget.loading')+ : hasOnlineDevices+ ? t('heteroAgent.executionTarget.autoDesc')+ : t('heteroAgent.executionTarget.autoUnavailableDesc')+ }onClick={() => void handleSelect('auto')}/>)}@@ -565,32 +555,6 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {{hasNoDevices && isLoading ? (<div className={styles.empty}>{t('heteroAgent.executionTarget.loading')}</div>) : null}- {/* On web with no remote device, guide the user to the desktop app (which- unlocks local execution + `lh connect`) rather than a muted dead-end. */}- {showWebDownloadCard ? (- <a- className={styles.downloadCard}- href="https://lobehub.com/downloads"- rel="noreferrer"- target="_blank"- >- <div className={styles.optionIcon}>- <Icon icon={MonitorDownIcon} size={14} />- </div>- <div className={styles.optionMeta}>- <div className={styles.optionTitle}>- {t('heteroAgent.executionTarget.downloadDesktopTitle')}- </div>- <div className={styles.desc}>- {t('heteroAgent.executionTarget.downloadDesktopDesc')}- </div>- </div>- <Icon className={styles.downloadCardArrow} icon={ExternalLinkIcon} size={13} />- </a>- ) : null}- {hasNoDevices && !isLoading && isDesktop ? (- <div className={styles.empty}>{t('heteroAgent.executionTarget.noDevices')}</div>- ) : null}</Flexbox>);diff --git a/src/features/ChatInput/InputEditor/ActionTag/useSlashActionItems.ts b/src/features/ChatInput/InputEditor/ActionTag/useSlashActionItems.tsindex af412627605..a7400c9869a 100644--- a/src/features/ChatInput/InputEditor/ActionTag/useSlashActionItems.ts+++ b/src/features/ChatInput/InputEditor/ActionTag/useSlashActionItems.ts@@ -59,8 +59,8 @@ export const useSlashActionItems = (): SlashOptions['items'] => {// `device.listProjectSkills` RPC; the local desktop reads over Electron IPC.// Mirror the WorkingSidebar exactly: resolve the EFFECTIVE target first, then// treat it as remote only when it lands on `device` with a bound device. The- // effective target matters because a hetero agent saved as desktop "This- // device" (`local` + boundDeviceId) coerces to `device` when opened on web —+ // effective target matters because an agent saved as desktop "This device"+ // (`local` + boundDeviceId) coerces to `device` when opened on web —// reading the raw stored target would miss that and leave the menu empty even// though the sidebar lists the skills.const agencyConfig = useAgentStore((s) =>diff --git a/src/features/DeviceManager/DeviceConnectModal.tsx b/src/features/DeviceManager/DeviceConnectModal.tsxindex f47f8cbea98..9ef8a97ca34 100644--- a/src/features/DeviceManager/DeviceConnectModal.tsx+++ b/src/features/DeviceManager/DeviceConnectModal.tsx@@ -171,9 +171,9 @@ const DeviceConnectModal = memo<DeviceConnectModalProps>(({ onClose, open, initionCancel={onClose}><Flexbox gap={20}>- <Text className={styles.subtitle}>- {isWorkspace ? t('workspaceSetting.devices.desc') : t('devices.connectWizard.subtitle')}- </Text>+ {isWorkspace && (+ <Text className={styles.subtitle}>{t('workspaceSetting.devices.desc')}</Text>+ )}{isWorkspace ? null : (<Segmenteddiff --git a/src/features/DeviceManager/DeviceItem.tsx b/src/features/DeviceManager/DeviceItem.tsxindex 8c21a754137..b287521acd7 100644--- a/src/features/DeviceManager/DeviceItem.tsx+++ b/src/features/DeviceManager/DeviceItem.tsx@@ -15,6 +15,12 @@ import { refreshDeviceList } from './const';import { getDeviceIcon } from './getDeviceIcon';const styles = createStaticStyles(({ css }) => ({+ action: css`+ display: flex;+ flex: none;+ align-items: center;+ justify-content: center;+ `,cwd: css`overflow: hidden;font-family: ${cssVar.fontFamilyCode};@@ -34,7 +40,14 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorSuccess};`,icon: css`+ display: flex;flex: none;+ align-items: center;+ justify-content: center;++ width: 24px;+ height: 24px;+color: ${cssVar.colorTextSecondary};`,row: css`@@ -105,14 +118,12 @@ const DeviceItem = memo<DeviceItemProps>(({ device, isCurrent, onSelect, selectereturn (<Flexboxhorizontal- align={'flex-start'}+ align={'center'}className={cx(styles.row, selected && styles.rowActive)}gap={12}onClick={onSelect}>- <span className={styles.icon} style={{ marginBlockStart: 2 }}>- {getDeviceIcon(device.platform)}- </span>+ <span className={styles.icon}>{getDeviceIcon(device.platform)}</span><Flexbox flex={1} gap={2} style={{ minWidth: 0 }}><Flexbox horizontal align={'center'} gap={8}><Text ellipsis weight={500}>@@ -137,7 +148,7 @@ const DeviceItem = memo<DeviceItemProps>(({ device, isCurrent, onSelect, selecte</Flexbox>)}</Flexbox>- <span onClick={(e) => e.stopPropagation()}>+ <span className={styles.action} onClick={(e) => e.stopPropagation()}><DropdownMenuitems={[{diff --git a/src/features/DeviceManager/DeviceManager.test.tsx b/src/features/DeviceManager/DeviceManager.test.tsxnew file mode 100644index 00000000000..bc693e0c5a4--- /dev/null+++ b/src/features/DeviceManager/DeviceManager.test.tsx@@ -0,0 +1,268 @@+import type { DeviceListItem } from '@lobechat/types';+import { fireEvent, render, screen } from '@testing-library/react';+import type { ReactNode } from 'react';+import { beforeEach, describe, expect, it, vi } from 'vitest';++import DeviceManager from './DeviceManager';++const mocks = vi.hoisted(() => ({+ electronState: {+ gatewayDeviceInfo: undefined as { deviceId: string } | undefined,+ useFetchGatewayDeviceInfo: vi.fn(),+ },+ isDesktop: false,+ swrState: {+ data: [] as DeviceListItem[] | undefined,+ isLoading: false,+ },+ useClientDataSWR: vi.fn(),+ userState: {+ isLogin: true,+ },+}));++vi.mock('@lobechat/const', () => ({+ get isDesktop() {+ return mocks.isDesktop;+ },+}));++vi.mock('react-i18next', () => ({+ useTranslation: () => ({+ t: (key: string) => key,+ }),+}));++vi.mock('@lobehub/ui', () => ({+ Button: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (+ <button type="button" onClick={onClick}>+ {children}+ </button>+ ),+ Flexbox: ({ children, onClick }: { children?: ReactNode; onClick?: () => void }) => (+ <div onClick={onClick}>{children}</div>+ ),+ Icon: () => <span data-testid="icon" />,+ Skeleton: () => <div data-testid="skeleton" />,+ Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,+}));++vi.mock('antd-style', () => ({+ createStaticStyles: (factory: (context: { css: () => string }) => Record<string, string>) => {+ const rawStyles = factory({ css: () => 'className' });+ return Object.fromEntries(Object.keys(rawStyles).map((key) => [key, key]));+ },+ cssVar: new Proxy({}, { get: (_target, key) => `var(--${String(key)})` }),+}));++vi.mock('lucide-react', () => {+ const StubIcon = () => null;+ return {+ ChevronRightIcon: StubIcon,+ FolderCogIcon: StubIcon,+ MonitorDownIcon: StubIcon,+ MonitorUpIcon: StubIcon,+ ServerIcon: StubIcon,+ ShieldCheckIcon: StubIcon,+ TerminalIcon: StubIcon,+ };+});++vi.mock('@/libs/swr', () => ({+ useClientDataSWR: (...args: unknown[]) => mocks.useClientDataSWR(...args),+}));++vi.mock('@/services/device', () => ({+ deviceService: {+ listDevices: vi.fn(),+ },+}));++vi.mock('@/store/electron', () => ({+ useElectronStore: (selector: (state: typeof mocks.electronState) => unknown) =>+ selector(mocks.electronState),+}));++vi.mock('@/store/user', () => ({+ useUserStore: (selector: (state: typeof mocks.userState) => unknown) => selector(mocks.userState),+}));++vi.mock('@/store/user/selectors', () => ({+ authSelectors: {+ isLogin: (state: typeof mocks.userState) => state.isLogin,+ },+}));++vi.mock('./DeviceDetailPanel', () => ({+ default: ({+ device,+ isCurrent,+ onClose,+ }: {+ device: DeviceListItem;+ isCurrent?: boolean;+ onClose: () => void;+ }) => (+ <section data-current={String(!!isCurrent)} data-testid="device-detail">+ detail:{device.deviceId}+ <button type="button" onClick={onClose}>+ close+ </button>+ </section>+ ),+}));++vi.mock('./DeviceItem', () => ({+ default: ({+ device,+ isCurrent,+ onSelect,+ selected,+ }: {+ device: DeviceListItem;+ isCurrent?: boolean;+ onSelect: () => void;+ selected?: boolean;+ }) => (+ <button+ data-current={String(!!isCurrent)}+ data-selected={String(!!selected)}+ data-testid={`device-item-${device.deviceId}`}+ type="button"+ onClick={onSelect}+ >+ device:{device.deviceId}+ </button>+ ),+}));++const createDevice = (+ deviceId: string,+ scope: DeviceListItem['scope'],+ overrides: Partial<DeviceListItem> = {},+): DeviceListItem => ({+ channels: [],+ defaultCwd: null,+ deviceId,+ friendlyName: null,+ hostname: `${deviceId}.local`,+ identitySource: null,+ lastSeen: '2026-06-22T00:00:00.000Z',+ online: false,+ platform: 'darwin',+ registered: true,+ scope,+ workingDirs: [],+ ...overrides,+});++beforeEach(() => {+ mocks.isDesktop = false;+ mocks.userState.isLogin = true;+ mocks.electronState.gatewayDeviceInfo = undefined;+ mocks.electronState.useFetchGatewayDeviceInfo.mockClear();+ mocks.swrState.data = [];+ mocks.swrState.isLoading = false;+ mocks.useClientDataSWR.mockImplementation(() => ({+ data: mocks.swrState.data,+ isLoading: mocks.swrState.isLoading,+ }));+});++describe('<DeviceManager />', () => {+ it('shows a skeleton while devices are loading', () => {+ mocks.swrState.isLoading = true;++ render(<DeviceManager scope="personal" onConnect={vi.fn()} />);++ expect(screen.getByTestId('skeleton')).toBeInTheDocument();+ });++ it('renders personal empty state with Desktop and CLI connect options', () => {+ const onConnect = vi.fn();++ render(<DeviceManager scope="personal" onConnect={onConnect} />);++ expect(screen.getByText('devices.empty.title')).toBeInTheDocument();+ expect(screen.getByText('devices.empty.methodDesktop.title')).toBeInTheDocument();+ expect(screen.getByText('devices.empty.methodCli.title')).toBeInTheDocument();++ fireEvent.click(screen.getByText('devices.empty.methodDesktop.title'));+ fireEvent.click(screen.getByText('devices.empty.methodCli.title'));++ expect(onConnect).toHaveBeenNthCalledWith(1, 'desktop');+ expect(onConnect).toHaveBeenNthCalledWith(2, 'cli');+ });++ it('renders workspace empty state with CLI enrollment only', () => {+ const onConnect = vi.fn();++ render(<DeviceManager scope="workspace" onConnect={onConnect} />);++ expect(screen.getByText('workspaceSetting.devices.heroTitle')).toBeInTheDocument();+ expect(screen.queryByText('devices.empty.methodDesktop.title')).not.toBeInTheDocument();++ fireEvent.click(screen.getByText('devices.empty.methodCli.title'));++ expect(onConnect).toHaveBeenCalledWith('cli');+ });++ it('uses a null SWR key when a web user is signed out', () => {+ mocks.userState.isLogin = false;++ render(<DeviceManager scope="personal" onConnect={vi.fn()} />);++ expect(mocks.useClientDataSWR).toHaveBeenCalledWith(null, expect.any(Function));+ });++ it('filters by personal scope and auto-selects the current desktop device', () => {+ mocks.isDesktop = true;+ mocks.electronState.gatewayDeviceInfo = { deviceId: 'personal-a' };+ mocks.swrState.data = [+ createDevice('personal-a', 'personal'),+ createDevice('workspace-a', 'workspace'),+ ];++ render(<DeviceManager scope="personal" onConnect={vi.fn()} />);++ expect(screen.getByText('devices.overview.personal.title')).toBeInTheDocument();+ expect(screen.getByText('devices.security.personal.metadata')).toBeInTheDocument();+ expect(screen.getByTestId('device-item-personal-a')).toHaveAttribute('data-current', 'true');+ expect(screen.queryByTestId('device-item-workspace-a')).not.toBeInTheDocument();+ expect(screen.getByTestId('device-detail')).toHaveTextContent('detail:personal-a');+ expect(screen.getByTestId('device-detail')).toHaveAttribute('data-current', 'true');+ });++ it('shows placeholder for multiple devices until the user selects one', () => {+ const onConnect = vi.fn();+ mocks.swrState.data = [+ createDevice('personal-a', 'personal'),+ createDevice('personal-b', 'personal'),+ ];++ render(<DeviceManager scope="personal" onConnect={onConnect} />);++ expect(screen.getByText((content) => content.includes('tab.devices'))).toBeInTheDocument();+ expect(screen.getByText('devices.placeholder.title')).toBeInTheDocument();++ fireEvent.click(screen.getByText('devices.actions.connectAnother'));+ expect(onConnect).toHaveBeenCalledWith();++ fireEvent.click(screen.getByTestId('device-item-personal-a'));+ expect(screen.getByTestId('device-detail')).toHaveTextContent('detail:personal-a');++ fireEvent.click(screen.getByTestId('device-item-personal-a'));+ expect(screen.getByText('devices.placeholder.title')).toBeInTheDocument();+ });++ it('auto-selects a single workspace device and renders workspace security copy', () => {+ mocks.swrState.data = [createDevice('workspace-a', 'workspace')];++ render(<DeviceManager scope="workspace" onConnect={vi.fn()} />);++ expect(screen.getByText('devices.overview.workspace.title')).toBeInTheDocument();+ expect(screen.getByText('devices.security.workspace.members')).toBeInTheDocument();+ expect(screen.getByTestId('device-detail')).toHaveTextContent('detail:workspace-a');+ expect(screen.getByTestId('device-detail')).toHaveAttribute('data-current', 'false');+ });+});diff --git a/src/features/DeviceManager/DeviceManager.tsx b/src/features/DeviceManager/DeviceManager.tsxindex 7d36ace7381..9209b2fea1f 100644--- a/src/features/DeviceManager/DeviceManager.tsx+++ b/src/features/DeviceManager/DeviceManager.tsx@@ -2,19 +2,19 @@import { isDesktop } from '@lobechat/const';import type { DeviceScope } from '@lobechat/types';-import { Flexbox, Icon, Skeleton, Text } from '@lobehub/ui';+import { Button, Flexbox, Icon, Skeleton, Text } from '@lobehub/ui';import { createStaticStyles, cssVar } from 'antd-style';import {ChevronRightIcon,FolderCogIcon,type LucideIcon,MonitorDownIcon,+ MonitorUpIcon,ServerIcon,ShieldCheckIcon,TerminalIcon,- ZapIcon,} from 'lucide-react';-import { memo, useState } from 'react';+import { memo, useLayoutEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { useClientDataSWR } from '@/libs/swr';@@ -39,37 +39,20 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorPrimaryBg};`,- capabilityCard: css`- padding: 16px;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadiusLG};-- background: ${cssVar.colorBgContainer};-- transition: border-color 0.2s;-- &:hover {- border-color: ${cssVar.colorPrimaryBorder};- }- `,- capabilityIcon: css`- display: flex;- align-items: center;- justify-content: center;-- width: 36px;- height: 36px;- border-radius: ${cssVar.borderRadius};-- color: ${cssVar.colorText};-- background: ${cssVar.colorFillSecondary};+ detailPlaceholder: css`+ min-height: 320px;+ padding: 32px;`,detailCol: css`+ overflow: hidden;align-self: stretch;+min-width: 0;+ min-height: 360px;border: 1px solid ${cssVar.colorBorderSecondary};border-radius: ${cssVar.borderRadiusLG};++ background: ${cssVar.colorBgContainer};`,emptyCard: css`overflow: hidden;@@ -86,6 +69,48 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorFillQuaternary};`,+ managerGrid: css`+ display: grid;+ grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);+ gap: 16px;+ align-items: start;++ @media (width <= 920px) {+ grid-template-columns: 1fr;+ }+ `,+ overviewCard: css`+ padding-block: 14px;+ padding-inline: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ background: ${cssVar.colorFillQuaternary};+ `,+ overviewGrid: css`+ display: grid;+ grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);+ gap: 16px;+ align-items: start;++ @media (width <= 860px) {+ grid-template-columns: 1fr;+ }+ `,+ overviewIcon: css`+ display: flex;+ flex-shrink: 0;+ align-items: center;+ justify-content: center;++ width: 32px;+ height: 32px;+ border-radius: ${cssVar.borderRadius};++ color: ${cssVar.colorPrimary};++ background: ${cssVar.colorPrimaryBg};+ `,heroIcon: css`display: flex;align-items: center;@@ -103,6 +128,12 @@ const styles = createStaticStyles(({ css }) => ({min-width: 0;border: 1px solid ${cssVar.colorBorderSecondary};border-radius: ${cssVar.borderRadiusLG};+ background: ${cssVar.colorBgContainer};+ `,+ listHeader: css`+ padding-block: 6px 8px;+ padding-inline: 8px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};`,option: css`cursor: pointer;@@ -120,6 +151,33 @@ const styles = createStaticStyles(({ css }) => ({gap: 1px;background: ${cssVar.colorBorderSecondary};`,+ placeholderIcon: css`+ display: flex;+ align-items: center;+ justify-content: center;++ width: 52px;+ height: 52px;+ border-radius: ${cssVar.borderRadiusLG};++ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillSecondary};+ `,+ placeholderItemIcon: css`+ display: flex;+ flex-shrink: 0;+ align-items: center;+ justify-content: center;++ width: 24px;+ height: 24px;+ border-radius: ${cssVar.borderRadiusSM};++ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillTertiary};+ `,optionIcon: css`display: flex;flex-shrink: 0;@@ -138,6 +196,15 @@ const styles = createStaticStyles(({ css }) => ({font-size: 13px;color: ${cssVar.colorTextTertiary};`,+ securityList: css`+ margin: 0;+ padding-inline-start: 18px;+ color: ${cssVar.colorTextSecondary};++ li + li {+ margin-block-start: 6px;+ }+ `,}));interface ConnectOptionProps {@@ -166,43 +233,115 @@ const ConnectOption = memo<ConnectOptionProps>(({ icon, title, desc, badge, onCl</Flexbox>));-const Capabilities = memo(() => {+interface DeviceOverviewProps {+ scope: DeviceScope;+}++const DeviceOverview = memo<DeviceOverviewProps>(({ scope }) => {const { t } = useTranslation('setting');- const items: { desc: string; icon: LucideIcon; title: string }[] = [- {- desc: t('devices.capabilities.files.desc'),- icon: FolderCogIcon,- title: t('devices.capabilities.files.title'),- },- {- desc: t('devices.capabilities.commands.desc'),- icon: TerminalIcon,- title: t('devices.capabilities.commands.title'),- },- {- desc: t('devices.capabilities.tools.desc'),- icon: ZapIcon,- title: t('devices.capabilities.tools.title'),- },- ];+ const isWorkspace = scope === 'workspace';+ const securityItems = isWorkspace+ ? [+ t('devices.security.workspace.members'),+ t('devices.security.workspace.onlineOnly'),+ t('devices.security.workspace.scope'),+ ]+ : [+ t('devices.security.personal.metadata'),+ t('devices.security.personal.onlineOnly'),+ t('devices.security.personal.stop'),+ ];+return (- <Flexbox gap={16}>- <Flexbox horizontal align={'center'} gap={8}>- <Icon icon={ShieldCheckIcon} size={16} style={{ color: cssVar.colorPrimary }} />- <Text style={{ fontSize: 14, fontWeight: 500 }}>{t('devices.capabilities.title')}</Text>+ <div className={styles.overviewCard}>+ <div className={styles.overviewGrid}>+ <Flexbox horizontal align={'flex-start'} gap={12}>+ <span className={styles.overviewIcon}>+ <Icon icon={isWorkspace ? ServerIcon : MonitorDownIcon} size={18} />+ </span>+ <Flexbox gap={4}>+ <Text style={{ fontSize: 14, fontWeight: 600 }}>+ {t(+ isWorkspace+ ? 'devices.overview.workspace.title'+ : 'devices.overview.personal.title',+ )}+ </Text>+ <Text className={styles.subtitle} style={{ lineHeight: 1.6 }}>+ {t(+ isWorkspace ? 'devices.overview.workspace.desc' : 'devices.overview.personal.desc',+ )}+ </Text>+ </Flexbox>+ </Flexbox>++ <Flexbox horizontal align={'flex-start'} gap={12}>+ <span className={styles.overviewIcon}>+ <Icon icon={ShieldCheckIcon} size={18} />+ </span>+ <Flexbox gap={6}>+ <Text style={{ fontSize: 14, fontWeight: 600 }}>{t('devices.security.title')}</Text>+ <ul className={styles.securityList}>+ {securityItems.map((item) => (+ <li key={item}>+ <Text style={{ fontSize: 12, lineHeight: 1.6 }} type={'secondary'}>+ {item}+ </Text>+ </li>+ ))}+ </ul>+ </Flexbox>+ </Flexbox>+ </div>+ </div>+ );+});++DeviceOverview.displayName = 'DeviceManager.DeviceOverview';++interface DetailPlaceholderProps {+ scope: DeviceScope;+}++const DetailPlaceholder = memo<DetailPlaceholderProps>(({ scope }) => {+ const { t } = useTranslation('setting');+ const isWorkspace = scope === 'workspace';+ const items: { icon: LucideIcon; text: string }[] = isWorkspace+ ? [+ { icon: TerminalIcon, text: t('devices.placeholder.workspace.connection') },+ { icon: FolderCogIcon, text: t('devices.placeholder.workspace.cwd') },+ { icon: ShieldCheckIcon, text: t('devices.placeholder.workspace.security') },+ ]+ : [+ { icon: TerminalIcon, text: t('devices.placeholder.connection') },+ { icon: FolderCogIcon, text: t('devices.placeholder.cwd') },+ { icon: ShieldCheckIcon, text: t('devices.placeholder.security') },+ ];++ return (+ <Flexbox align={'center'} className={styles.detailPlaceholder} gap={18} justify={'center'}>+ <span className={styles.placeholderIcon}>+ <Icon icon={isWorkspace ? ServerIcon : MonitorDownIcon} size={26} />+ </span>+ <Flexbox align={'center'} gap={6}>+ <Text style={{ fontSize: 16, fontWeight: 600 }}>{t('devices.placeholder.title')}</Text>+ <Text+ align={'center'}+ className={styles.subtitle}+ style={{ maxWidth: 360, lineHeight: 1.6 }}+ >+ {t('devices.placeholder.desc')}+ </Text></Flexbox>- <Flexbox horizontal gap={16}>- {items.map((cap) => (- <Flexbox className={styles.capabilityCard} flex={1} gap={12} key={cap.title}>- <span className={styles.capabilityIcon}>- <Icon icon={cap.icon} size={18} />+ <Flexbox gap={8} style={{ maxWidth: 360, width: '100%' }}>+ {items.map((item) => (+ <Flexbox horizontal align={'center'} gap={10} key={item.text}>+ <span className={styles.placeholderItemIcon}>+ <Icon icon={item.icon} size={14} /></span>- <Flexbox gap={2}>- <Text style={{ fontSize: 14, fontWeight: 500 }}>{cap.title}</Text>- <Text className={styles.subtitle} style={{ fontSize: 12 }}>- {cap.desc}- </Text>- </Flexbox>+ <Text style={{ fontSize: 12 }} type={'secondary'}>+ {item.text}+ </Text></Flexbox>))}</Flexbox>@@ -210,6 +349,8 @@ const Capabilities = memo(() => {);});+DetailPlaceholder.displayName = 'DeviceManager.DetailPlaceholder';+interface DeviceManagerProps {/** Open the enrollment wizard (the modal is owned by the route, by the header button). */onConnect: (tab?: 'cli' | 'desktop') => void;@@ -240,7 +381,7 @@ const DeviceManager = memo<DeviceManagerProps>(({ onConnect, scope }) => {);// `listDevices` is workspace-aware and returns both pools — keep each surface// to its own scope.- const devices = (data ?? []).filter((d) => d.scope === scope);+ const devices = useMemo(() => (data ?? []).filter((d) => d.scope === scope), [data, scope]);// The machine the user is on right now (desktop only) — personal pool only;// a workspace device is never "this machine" in the personal sense.@@ -250,46 +391,69 @@ const DeviceManager = memo<DeviceManagerProps>(({ onConnect, scope }) => {const currentDeviceId = !isWorkspace && isDesktop ? gatewayDeviceInfo?.deviceId : undefined;const [selectedId, setSelectedId] = useState<string>();+ const hasAutoSelectedRef = useRef(false);++ useLayoutEffect(() => {+ if (devices.length === 0) {+ if (selectedId) setSelectedId(undefined);+ hasAutoSelectedRef.current = false;+ return;+ }++ if (selectedId && !devices.some((device) => device.deviceId === selectedId)) {+ setSelectedId(undefined);+ hasAutoSelectedRef.current = false;+ return;+ }++ if (selectedId || hasAutoSelectedRef.current) return;++ const currentDevice = currentDeviceId+ ? devices.find((device) => device.deviceId === currentDeviceId)+ : undefined;+ const autoSelectedDevice = currentDevice ?? (devices.length === 1 ? devices[0] : undefined);++ if (autoSelectedDevice) {+ setSelectedId(autoSelectedDevice.deviceId);+ hasAutoSelectedRef.current = true;+ }+ }, [currentDeviceId, devices, selectedId]);if (isLoading) return <Skeleton active paragraph={{ rows: 4 }} title={false} />;- // ─── Empty state: onboarding hero + connect options + capabilities ───+ // ─── Empty state: onboarding hero + connect options ───if (devices.length === 0) {return (- <Flexbox gap={32}>- <Flexbox className={styles.emptyCard}>- <Flexbox align={'center'} className={styles.emptyHero} gap={12}>- <span className={styles.heroIcon}>- <Icon icon={isWorkspace ? ServerIcon : MonitorDownIcon} size={28} />- </span>- <Text style={{ fontSize: 18, fontWeight: 600 }}>- {t(isWorkspace ? 'workspaceSetting.devices.heroTitle' : 'devices.empty.title')}- </Text>- <Text className={styles.subtitle} style={{ maxWidth: 440 }}>- {t(isWorkspace ? 'workspaceSetting.devices.heroDesc' : 'devices.empty.desc')}- </Text>- </Flexbox>+ <Flexbox className={styles.emptyCard}>+ <Flexbox align={'center'} className={styles.emptyHero} gap={12}>+ <span className={styles.heroIcon}>+ <Icon icon={isWorkspace ? ServerIcon : MonitorDownIcon} size={28} />+ </span>+ <Text style={{ fontSize: 18, fontWeight: 600 }}>+ {t(isWorkspace ? 'workspaceSetting.devices.heroTitle' : 'devices.empty.title')}+ </Text>+ <Text className={styles.subtitle} style={{ maxWidth: 440 }}>+ {t(isWorkspace ? 'workspaceSetting.devices.heroDesc' : 'devices.empty.desc')}+ </Text>+ </Flexbox>- <div className={isWorkspace ? undefined : styles.optionGrid}>- {!isWorkspace && (- <ConnectOption- badge={t('devices.empty.methodDesktop.badge')}- desc={t('devices.empty.methodDesktop.desc')}- icon={MonitorDownIcon}- title={t('devices.empty.methodDesktop.title')}- onClick={() => onConnect('desktop')}- />- )}+ <div className={isWorkspace ? undefined : styles.optionGrid}>+ {!isWorkspace && (<ConnectOption- desc={t('devices.empty.methodCli.desc')}- icon={TerminalIcon}- title={t('devices.empty.methodCli.title')}- onClick={() => onConnect('cli')}+ badge={t('devices.empty.methodDesktop.badge')}+ desc={t('devices.empty.methodDesktop.desc')}+ icon={MonitorDownIcon}+ title={t('devices.empty.methodDesktop.title')}+ onClick={() => onConnect('desktop')}/>- </div>- </Flexbox>-- <Capabilities />+ )}+ <ConnectOption+ desc={t('devices.empty.methodCli.desc')}+ icon={TerminalIcon}+ title={t('devices.empty.methodCli.title')}+ onClick={() => onConnect('cli')}+ />+ </div></Flexbox>);}@@ -298,31 +462,56 @@ const DeviceManager = memo<DeviceManagerProps>(({ onConnect, scope }) => {const isCurrent = (id: string) => !!currentDeviceId && id === currentDeviceId;return (- <Flexbox horizontal align={'flex-start'} gap={16}>- <Flexbox className={styles.listCol} flex={1} padding={4}>- {devices.map((device) => (- <DeviceItem- device={device}- isCurrent={isCurrent(device.deviceId)}- key={device.deviceId}- selected={device.deviceId === selectedId}- onSelect={() =>- setSelectedId((prev) => (prev === device.deviceId ? undefined : device.deviceId))- }- />- ))}- </Flexbox>- {selected && (- <Flexbox className={styles.detailCol} flex={1}>- {/* keyed on deviceId so the form state resets when the selection changes */}- <DeviceDetailPanel- device={selected}- isCurrent={isCurrent(selected.deviceId)}- key={selected.deviceId}- onClose={() => setSelectedId(undefined)}- />+ <Flexbox gap={20}>+ <DeviceOverview scope={scope} />++ <div className={styles.managerGrid}>+ <Flexbox className={styles.listCol} padding={4}>+ <Flexbox+ horizontal+ align={'center'}+ className={styles.listHeader}+ distribution={'space-between'}+ gap={12}+ >+ <Text style={{ fontSize: 12, fontWeight: 500 }} type={'secondary'}>+ {t('tab.devices')} · {devices.length}+ </Text>+ <Button+ icon={<Icon icon={MonitorUpIcon} />}+ size={'small'}+ type={'text'}+ onClick={() => onConnect()}+ >+ {t('devices.actions.connectAnother')}+ </Button>+ </Flexbox>+ {devices.map((device) => (+ <DeviceItem+ device={device}+ isCurrent={isCurrent(device.deviceId)}+ key={device.deviceId}+ selected={device.deviceId === selectedId}+ onSelect={() =>+ setSelectedId((prev) => (prev === device.deviceId ? undefined : device.deviceId))+ }+ />+ ))}+ </Flexbox>+ <Flexbox className={styles.detailCol}>+ {selected ? (+ /* keyed on deviceId so the form state resets when the selection changes */+ <DeviceDetailPanel+ device={selected}+ isCurrent={isCurrent(selected.deviceId)}+ key={selected.deviceId}+ onClose={() => setSelectedId(undefined)}+ />+ ) : (+ <DetailPlaceholder scope={scope} />+ )}</Flexbox>- )}+ </div></Flexbox>);});diff --git a/src/helpers/executionTarget.test.ts b/src/helpers/executionTarget.test.tsindex 3f4e5f1abde..c2f09b1897f 100644--- a/src/helpers/executionTarget.test.ts+++ b/src/helpers/executionTarget.test.ts@@ -45,19 +45,19 @@ describe('resolveExecutionTarget', () => {).toBe('local');});- it('routes hetero desktop-local bindings to the bound device on web', () => {+ it('routes desktop-local bindings to the bound device on web', () => {expect(resolveExecutionTarget(cfg({ boundDeviceId: 'device-a', executionTarget: 'local' }), {clientExecutionAvailable: false,- isHetero: true,}),).toBe('device');expect(resolveExecutionTarget(cfg({ boundDeviceId: 'device-a', executionTarget: 'local' }), {clientExecutionAvailable: false,+ isHetero: true,}),- ).toBe('sandbox');+ ).toBe('device');});it('keeps `device` on web (a bound device is reachable from anywhere)', () => {@@ -139,9 +139,9 @@ describe('resolveExecutionTarget', () => {}});- it('does not resurrect a device on web — `local` still coerces to sandbox first', () => {- // the web→sandbox coercion runs before the bot rule, so a web `local`- // never becomes auto (there is no in-process local on web anyway).+ it('does not auto-activate an unbound local target on web', () => {+ // the web→sandbox coercion runs before the bot rule, so an unbound web+ // `local` never becomes auto (there is no in-process local on web anyway).expect(resolveExecutionTarget(cfg({ executionTarget: 'local' }), {clientExecutionAvailable: false,@@ -188,7 +188,7 @@ describe('resolveRuntimeMode', () => {});it('applies the web `local`→`sandbox` coercion before mapping to runtime mode', () => {- // executionTarget=local synced from desktop, resolved on web → sandbox → cloud+ // unbound executionTarget=local synced from desktop, resolved on web → sandbox → cloudexpect(resolveRuntimeMode(cfg({ executionTarget: 'local' }), false)).toBe('cloud');});});@@ -660,12 +660,11 @@ describe('resolveExecutionPlan', () => {).toEqual({ kind: 'device-unrouted', reason: 'no-bound-device', target: 'device' });});- it('uses the bound desktop device for hetero local runs entered from web', () => {+ it('uses the bound desktop device for local runs entered from web', () => {expect(resolveExecutionPlan({agencyConfig: cfg({ boundDeviceId: 'device-a', executionTarget: 'local' }),clientExecutionAvailable: false,- isHetero: true,}),).toEqual({ deviceId: 'device-a', kind: 'device', target: 'device' });});diff --git a/src/helpers/executionTarget.ts b/src/helpers/executionTarget.tsindex 61b07306325..287e222f0b9 100644--- a/src/helpers/executionTarget.ts+++ b/src/helpers/executionTarget.ts@@ -68,18 +68,17 @@ export interface ResolveExecutionTargetOptions {* - `sandbox` → server cloud sandbox* - `device` → remote device (dispatched to `boundDeviceId`)*- * `local` and `device` stay DISTINCT even when the bound device is this very- * machine: `device` dispatches through the server gateway, so progress streams- * to every client (mobile/web can follow the run); `local` is the faster- * in-process IPC path whose run lives only in this desktop session. Which one- * to use is the user's observability/latency trade-off — never auto-collapse- * `device(currentDeviceId)` into the in-process path.+ * `local` and `device` are transport-distinct even if the bound device is this+ * very machine: an explicit `device` target is server-dispatched, while `local`+ * is the desktop in-process path. Do not collapse a stored `device` target into+ * `local`; the UI can still choose to show the current machine only once as an+ * execution location.** Defaults: desktop → `local`, web → `none`. On web `local` isn't available- * (no local filesystem), so a stored `local` (synced from desktop) usually- * resolves to `sandbox`. For heterogeneous CLI agents, a desktop `local`- * selection that has already been bound to that desktop's `deviceId` resolves- * to `device` on web, so the same machine can execute through `lh connect`.+ * (no local filesystem), so an unbound stored `local` (synced from desktop)+ * resolves to `sandbox`. A desktop `local` selection that has already been+ * bound to that desktop's `deviceId` resolves to `device` on web, so the same+ * machine remains the selected execution environment through Device Connection.** Bot triggers (`trigger === bot`) upgrade a `local` target (a bot has no UI* to pick a device and `local` in-process IPC is unreachable from the cloud@@ -93,7 +92,7 @@ export const resolveExecutionTarget = (): DeviceExecutionTarget => {const stored = agencyConfig?.executionTarget;let effective = stored ?? (clientExecutionAvailable ? 'local' : 'none');- if (isHetero && !clientExecutionAvailable && stored === 'local' && agencyConfig?.boundDeviceId) {+ if (!clientExecutionAvailable && stored === 'local' && agencyConfig?.boundDeviceId) {return 'device';}if (isHetero && effective === 'none') effective = clientExecutionAvailable ? 'local' : 'sandbox';diff --git a/src/routes/(main)/[workspaceSlug]/settings/devices/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/devices/index.tsxindex d5293aa0b97..c8e29b614cc 100644--- a/src/routes/(main)/[workspaceSlug]/settings/devices/index.tsx+++ b/src/routes/(main)/[workspaceSlug]/settings/devices/index.tsx@@ -1,7 +1,5 @@'use client';-import { Button, Icon } from '@lobehub/ui';-import { MonitorUpIcon } from 'lucide-react';import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -14,14 +12,7 @@ const WorkspaceDevicesSetting = memo(() => {return (<>- <SettingHeader- title={t('tab.devices')}- extra={- <Button icon={<Icon icon={MonitorUpIcon} />} size={'small'} onClick={() => setOpen(true)}>- {t('devices.connectWizard.button')}- </Button>- }- />+ <SettingHeader title={t('tab.devices')} /><DeviceManager scope={'workspace'} onConnect={() => setOpen(true)} />diff --git a/src/routes/(main)/settings/devices/index.tsx b/src/routes/(main)/settings/devices/index.tsxindex 8f48b966f59..4227472084e 100644--- a/src/routes/(main)/settings/devices/index.tsx+++ b/src/routes/(main)/settings/devices/index.tsx@@ -1,7 +1,5 @@'use client';-import { Button, Icon } from '@lobehub/ui';-import { MonitorUpIcon } from 'lucide-react';import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -20,18 +18,7 @@ const Page = memo(() => {return (<>- <SettingHeader- title={t('devices.title')}- extra={- <Button- icon={<Icon icon={MonitorUpIcon} />}- size={'small'}- onClick={() => handleConnect()}- >- {t('devices.connectWizard.button')}- </Button>- }- />+ <SettingHeader title={t('devices.title')} /><DeviceManager scope={'personal'} onConnect={handleConnect} />diff --git a/src/routes/(main)/settings/hooks/useCategory.test.tsx b/src/routes/(main)/settings/hooks/useCategory.test.tsxindex d940ec2cf48..32334185ab8 100644--- a/src/routes/(main)/settings/hooks/useCategory.test.tsx+++ b/src/routes/(main)/settings/hooks/useCategory.test.tsx@@ -7,7 +7,7 @@ import { SettingsTabs } from '@/store/global/initialState';import { initServerConfigStore, Provider } from '@/store/serverConfig/store';import { useUserStore } from '@/store/user';-import { useCategory } from './useCategory';+import { SettingsGroupKey, useCategory } from './useCategory';vi.hoisted(() => {Object.defineProperty(globalThis, 'localStorage', {@@ -75,4 +75,16 @@ describe('settings useCategory', () => {expect(keys).not.toContain(SettingsTabs.Provider);});++ it('places Devices under Agent settings instead of General settings', () => {+ const { result } = renderHook(() => useCategory(), {+ wrapper: createWrapper(true),+ });++ const general = result.current.find((group) => group.key === SettingsGroupKey.General);+ const agent = result.current.find((group) => group.key === SettingsGroupKey.Agent);++ expect(general?.items.map((item) => item.key)).not.toContain(SettingsTabs.Devices);+ expect(agent?.items.map((item) => item.key)).toContain(SettingsTabs.Devices);+ });});diff --git a/src/routes/(main)/settings/hooks/useCategory.tsx b/src/routes/(main)/settings/hooks/useCategory.tsxindex d739d4936a2..7374c303b91 100644--- a/src/routes/(main)/settings/hooks/useCategory.tsx+++ b/src/routes/(main)/settings/hooks/useCategory.tsx@@ -100,11 +100,6 @@ export const useCategory = () => {key: SettingsTabs.Appearance,label: t('tab.appearance'),},- {- icon: MonitorSmartphoneIcon,- key: SettingsTabs.Devices,- label: t('tab.devices'),- },!mobile && {icon: KeyboardIcon,key: SettingsTabs.Hotkey,@@ -156,6 +151,11 @@ export const useCategory = () => {key: SettingsTabs.ServiceModel,label: t('tab.serviceModel'),},+ {+ icon: MonitorSmartphoneIcon,+ key: SettingsTabs.Devices,+ label: t('tab.devices'),+ },{icon: SkillsIcon,key: SettingsTabs.Skill,diff --git a/src/store/agent/selectors/chatConfigByIdSelectors.test.ts b/src/store/agent/selectors/chatConfigByIdSelectors.test.tsindex 4dffd194978..96b75d8e507 100644--- a/src/store/agent/selectors/chatConfigByIdSelectors.test.ts+++ b/src/store/agent/selectors/chatConfigByIdSelectors.test.ts@@ -510,6 +510,18 @@ describe('chatConfigByIdSelectors', () => {expect(chatConfigByIdSelectors.getRuntimeModeById('agent-1')(state)).toBe('cloud');});+ it('should gate a desktop-local bound device to "none" on web (device tools route separately)', () => {+ const state = createState({+ agentMap: {+ 'agent-1': {+ agencyConfig: { boundDeviceId: 'device-a', executionTarget: 'local' },+ },+ },+ });++ expect(chatConfigByIdSelectors.getRuntimeModeById('agent-1')(state)).toBe('none');+ });+it('should gate device target to "none" (device tools are routed separately)', () => {const state = createState({agentMap: {