Skip to content

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

💄 style: improve remote device tool UI (#17487)

Arvin Xue126fed6f104
diff --git a/.agents/acceptance/common-mistakes.md b/.agents/acceptance/common-mistakes.md
index 299fde816e9..a18290f428f 100644
--- a/.agents/acceptance/common-mistakes.md
+++ b/.agents/acceptance/common-mistakes.md
@@ -16,6 +16,28 @@
---
+## Case 26 — Treating a device list status badge as a substitute for information hierarchy
+
+**Wrong approach**: rendering a remote-device row with a large generic “Online” badge in the
+right-hand detail position while placing hostname, platform, and scope in a low-emphasis second
+line below the device name; omitting the device icon from the corresponding tool Inspector.
+
+**Why it's wrong**: online state is a compact property of the device identity, while hostname,
+platform, and scope are the details users need to distinguish similar machines. Giving the status
+the entire right edge reverses that hierarchy. The icon omission also makes the collapsed tool
+call harder to scan, and mixed text-component line heights can visibly misalign the Inspector
+count.
+
+**What it breaks**: device rows waste their strongest metadata area on repetitive state, similar
+devices become harder to compare, and the collapsed tool chain looks visually unfinished.
+
+**Correct approach**: put a platform-neutral device icon in the list Inspector; align count text
+with an explicit shared line box; place a semantic status dot plus localized status beside the
+device name; reserve the right-hand column for hostname, platform, and scope. Verify both expanded
+rows and the zero-count Inspector in a real chat screenshot.
+
+---
+
## Case 25 — Building a surface's "twin" without walking the sibling implementation feature-by-feature
**Wrong approach**: when asked to make surface B "consistent with" an existing surface A (a list
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.md
index 13da21a3a3a..81c0c076c03 100644
--- a/.agents/acceptance/probe-mock-patterns.md
+++ b/.agents/acceptance/probe-mock-patterns.md
@@ -1133,7 +1133,7 @@ ingest-report <dir> --subject topic:<id> …` — and verify attachment in the D
inserts into `workspaces` / `workspace_members` / `agents`).
- **Doesn't work:** topics load but `agent.getAgentConfigById` fails FORBIDDEN —
the cloud RBAC middleware reads `rbac_user_roles → roles → role_permissions →
- permissions`, which raw member rows never create. And even after RBAC, a raw
+permissions`, which raw member rows never create. And even after RBAC, a raw
SQL `agents` row renders "助理不可用" (missing real config).
- **Works:** ① provision RBAC with the official util —
`seedWorkspaceRoles(db, wsId)` + `assignWorkspaceRoleToUser(...)` from
@@ -1147,14 +1147,13 @@ ingest-report <dir> --subject topic:<id> …` — and verify attachment in the D
- **Situation:** after a floating-range `pnpm install` (this repo has no
lockfile), `node_modules/.pnpm` can hold two `@lobehub/ui@X` peer-hash
instances. The workspace agent conversation route then dies in the error
- boundary with `Please wrap your app with <ConfigProvider> (or
- <MotionProvider>)` thrown from `TypewriterEffect` — the two instances carry
+ boundary with `Please wrap your app with <ConfigProvider> (or <MotionProvider>)` thrown from `TypewriterEffect` — the two instances carry
two React contexts. The sidebar-only routes may still work, which disguises
the cause; clearing `node_modules/.vite` does NOT fix it.
- **Doesn't work:** clearing the Vite deps cache, restarting the dev server,
`pnpm dedupe @lobehub/ui` (peer sets differ, instances survive).
- **Works:** temporarily add `resolve: { dedupe: ['@lobehub/ui', 'antd-style',
- 'motion', 'react', 'react-dom'] }` to the cloud root `vite.config.ts` +
+'motion', 'react', 'react-dom'] }` to the cloud root `vite.config.ts` +
`rm -rf node_modules/.vite`, and REVERT the config after capturing evidence
(snapshot the file first — it may carry uncommitted edits).
@@ -1265,3 +1264,15 @@ active: true, remoteServerUrl: 'http://localhost:<port>', storageMode: 'selfHost
concurrently from ONE worktree makes both optimizers share `<root>/node_modules/.vite` —
two cold optimizers clobber each other and dynamic imports 504 (`Outdated Optimize Dep`)
indefinitely. Boot them sequentially (let one finish bundling before starting the other).
+
+### Concurrent agent-browser cleanup must stay session-scoped
+
+- **Situation:** A follow-up Web verification starts while unrelated
+ `agent-browser` sessions are also running on the same machine. New sessions
+ may hang if another task is concurrently restarting its browser daemon.
+- **Doesn't work:** Running `agent-browser close --all` or killing every
+ `agent-browser`/Chrome process. That destroys unrelated verification work and
+ can race with another task recreating the daemon.
+- **Works:** Close only the exact session names created by the current run,
+ wait for the competing daemon restart to settle, then create one fresh,
+ uniquely named session and reload the seeded auth state.
diff --git a/.agents/skills/agent-testing/SKILL.md b/.agents/skills/agent-testing/SKILL.md
index fc2031b0bff..5882944cbbf 100644
--- a/.agents/skills/agent-testing/SKILL.md
+++ b/.agents/skills/agent-testing/SKILL.md
@@ -203,10 +203,11 @@ capture session:
caffeinate -dimsu & # prevent display/idle sleep for the run; kill when done
```
-#### Phase 1 approval gate — report environment + plan to the user
+#### Phase 1 approval gate — confirm the first run, continue follow-up rounds autonomously
-At the end of Step 2, always send one user-facing Plan feedback before entering
-Execute. Read and follow [references/plan.md](./references/plan.md). It requires:
+At the end of Step 2 for the **first run of a subject Acceptance**, send one
+user-facing Plan feedback before entering Execute. Read and follow
+[references/plan.md](./references/plan.md). It requires:
- an overall environment verdict with concrete checks and evidence;
- emoji-prefixed status markers in the verdict and every table row
@@ -216,10 +217,33 @@ Execute. Read and follow [references/plan.md](./references/plan.md). It requires
- an explicit statement that nothing is needed from the user when that is true;
- one structured confirmation question after the feedback.
+That first approval remains valid for later iterations attached to the same
+subject Acceptance. When the user gives feedback on an existing Acceptance or
+asks to iterate again:
+
+1. Read the current Acceptance and its non-stale feedback.
+2. Re-check the environment and auth silently, resolving safe agent-owned issues.
+3. Implement the repair, execute the affected checks, and publish a new immutable
+ round to the same Acceptance without asking for another plan confirmation.
+4. Reuse stable check ids and omit user-accepted checks unless the change can
+ regress them.
+
+Ask again only when the follow-up introduces a **material boundary change**:
+
+- a new surface, external system, account, secret, permission, or destructive action;
+- a materially expanded product scope or changed business goal;
+- a user-owned blocker or product choice that cannot be resolved safely;
+- an environment change that invalidates the previously approved evidence strategy.
+
+Routine code changes, fixture refreshes, server restarts, evidence recapture,
+retries, and new immutable Acceptance rounds are not material boundary changes.
+Do not pause after a follow-up fix: verification and publication are part of the
+same approved iteration.
+
Resolve safe, agent-owned environment mechanics before presenting the gate. Ask
the user only for prerequisites that genuinely require their authority, secret,
device action, or product decision. Do not enter Phase 2 until the user approves
-the plan and all blocking user-owned prerequisites are satisfied.
+the first-run plan and all blocking user-owned prerequisites are satisfied.
## Phase 2 — Execute
diff --git a/.agents/skills/agent-testing/references/plan.md b/.agents/skills/agent-testing/references/plan.md
index 526d5f7e6fd..99b7ad0c60c 100644
--- a/.agents/skills/agent-testing/references/plan.md
+++ b/.agents/skills/agent-testing/references/plan.md
@@ -87,9 +87,9 @@ On a follow-up round, seed the plan from
## Confirmation behavior
-After the feedback, use the runtime structured question tool
-(`request_user_input` / ask-user-question equivalent). Do not bury the question
-inside the template text.
+For the first run attached to a subject Acceptance, use the runtime structured
+question tool (`request_user_input` / ask-user-question equivalent) after the
+feedback. Do not bury the question inside the template text.
When the verdict is **Ready** or **Ready with warnings**, use:
@@ -105,3 +105,20 @@ When the verdict is **Blocked**, do not offer Start. Use:
Match button labels to the user's language. Wait for the user's response. If the
user resolves a blocker, re-check the affected environment item and present an
updated gate; do not rely only on the user's statement that it is fixed.
+
+### Follow-up rounds
+
+The first approved plan authorizes later repair-and-reverify iterations on the
+same subject Acceptance. For a follow-up triggered by user feedback or an
+iteration request:
+
+- read `lh acceptance view <subject> --json`;
+- silently re-check environment and auth;
+- repair and re-run the affected stable check ids;
+- publish a new immutable round to the same Acceptance automatically;
+- do not ask the user to approve another routine plan.
+
+Present a new confirmation gate only when scope, business goal, evidence surface,
+external authority, destructiveness, or a user-owned prerequisite materially
+changes. A code revision, local server restart, fixture update, screenshot
+recapture, retry, or automatic follow-up publication does not reset approval.
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index acd2e00ea77..44da2526ee3 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -344,6 +344,18 @@
"builtins.lobe-page-agent.apiName.updateNode": "Update node",
"builtins.lobe-page-agent.apiName.wrapNodes": "Wrap nodes",
"builtins.lobe-page-agent.title": "Page",
+ "builtins.lobe-remote-device.apiName.activateDevice": "Connect device",
+ "builtins.lobe-remote-device.apiName.listOnlineDevices": "Check online devices",
+ "builtins.lobe-remote-device.inspector.onlineCount_one": "{{count}} online",
+ "builtins.lobe-remote-device.inspector.onlineCount_other": "{{count}} online",
+ "builtins.lobe-remote-device.render.activated": "Connected",
+ "builtins.lobe-remote-device.render.activationFailed": "Unable to connect",
+ "builtins.lobe-remote-device.render.noOnlineDevices": "No devices are online",
+ "builtins.lobe-remote-device.render.offline": "Offline",
+ "builtins.lobe-remote-device.render.online": "Online",
+ "builtins.lobe-remote-device.render.scope.personal": "Personal",
+ "builtins.lobe-remote-device.render.scope.workspace": "Workspace",
+ "builtins.lobe-remote-device.title": "Remote Device",
"builtins.lobe-self-feedback-intent.apiName.declareSelfFeedbackIntent": "Record improvement idea",
"builtins.lobe-self-feedback-intent.inspector.gap.proposal": "Suggest improvement",
"builtins.lobe-self-feedback-intent.inspector.memory.write": "Record preference",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index 40a3f169f18..971435139f2 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -344,6 +344,18 @@
"builtins.lobe-page-agent.apiName.updateNode": "更新节点",
"builtins.lobe-page-agent.apiName.wrapNodes": "包装节点",
"builtins.lobe-page-agent.title": "文档",
+ "builtins.lobe-remote-device.apiName.activateDevice": "连接设备",
+ "builtins.lobe-remote-device.apiName.listOnlineDevices": "查看在线设备",
+ "builtins.lobe-remote-device.inspector.onlineCount_one": "{{count}} 台在线",
+ "builtins.lobe-remote-device.inspector.onlineCount_other": "{{count}} 台在线",
+ "builtins.lobe-remote-device.render.activated": "已连接",
+ "builtins.lobe-remote-device.render.activationFailed": "无法连接",
+ "builtins.lobe-remote-device.render.noOnlineDevices": "暂无在线设备",
+ "builtins.lobe-remote-device.render.offline": "离线",
+ "builtins.lobe-remote-device.render.online": "在线",
+ "builtins.lobe-remote-device.render.scope.personal": "个人设备",
+ "builtins.lobe-remote-device.render.scope.workspace": "工作区设备",
+ "builtins.lobe-remote-device.title": "远程设备",
"builtins.lobe-self-feedback-intent.apiName.declareSelfFeedbackIntent": "记录改进想法",
"builtins.lobe-self-feedback-intent.inspector.gap.proposal": "提出改进建议",
"builtins.lobe-self-feedback-intent.inspector.memory.write": "记下偏好",
diff --git a/packages/builtin-tool-remote-device/src/client/Inspector/ActivateDevice/index.tsx b/packages/builtin-tool-remote-device/src/client/Inspector/ActivateDevice/index.tsx
new file mode 100644
index 00000000000..ca95ba4fe2d
--- /dev/null
+++ b/packages/builtin-tool-remote-device/src/client/Inspector/ActivateDevice/index.tsx
@@ -0,0 +1,54 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { createStaticStyles, cx } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { inspectorTextStyles, shinyTextStyles } from '@/styles';
+
+import type { ActivateDeviceParams, ActivateDeviceState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ device: css`
+ overflow: hidden;
+
+ max-width: 240px;
+ padding-block: 2px;
+ padding-inline: 8px;
+ border-radius: ${cssVar.borderRadiusSM};
+
+ font-weight: 500;
+ color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+}));
+
+export const ActivateDeviceInspector = memo<
+ BuiltinInspectorProps<ActivateDeviceParams, ActivateDeviceState>
+>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
+ const { t } = useTranslation('plugin');
+ const device = pluginState?.activatedDevice;
+ const requestedDeviceId = args?.deviceId || partialArgs?.deviceId;
+ const deviceLabel =
+ device?.friendlyName ||
+ device?.hostname ||
+ (requestedDeviceId ? requestedDeviceId.slice(0, 12) : '');
+
+ return (
+ <div
+ className={cx(
+ inspectorTextStyles.root,
+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
+ )}
+ >
+ <span>{t('builtins.lobe-remote-device.apiName.activateDevice')}</span>
+ {deviceLabel && <span className={styles.device}>{deviceLabel}</span>}
+ </div>
+ );
+});
+
+ActivateDeviceInspector.displayName = 'ActivateDeviceInspector';
diff --git a/packages/builtin-tool-remote-device/src/client/Inspector/ListOnlineDevices/index.tsx b/packages/builtin-tool-remote-device/src/client/Inspector/ListOnlineDevices/index.tsx
new file mode 100644
index 00000000000..516f949c32d
--- /dev/null
+++ b/packages/builtin-tool-remote-device/src/client/Inspector/ListOnlineDevices/index.tsx
@@ -0,0 +1,55 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { MonitorIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { inspectorTextStyles, shinyTextStyles } from '@/styles';
+
+import type { ListOnlineDevicesState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ count: css`
+ display: inline-flex;
+ align-items: center;
+
+ height: 20px;
+
+ font-size: ${cssVar.fontSizeSM};
+ line-height: 20px;
+ color: ${cssVar.colorTextDescription};
+ `,
+ icon: css`
+ flex: none;
+ `,
+ root: css`
+ gap: 8px;
+ `,
+}));
+
+export const ListOnlineDevicesInspector = memo<
+ BuiltinInspectorProps<undefined, ListOnlineDevicesState>
+>(({ isArgumentsStreaming, isLoading, pluginState }) => {
+ const { t } = useTranslation('plugin');
+ const isPending = isArgumentsStreaming || isLoading;
+ const deviceCount = pluginState?.devices?.length;
+
+ return (
+ <div
+ className={cx(inspectorTextStyles.root, styles.root, isPending && shinyTextStyles.shinyText)}
+ >
+ <Icon className={styles.icon} icon={MonitorIcon} size={14} />
+ <span>{t('builtins.lobe-remote-device.apiName.listOnlineDevices')}</span>
+ {!isPending && deviceCount !== undefined && (
+ <span className={styles.count}>
+ {t('builtins.lobe-remote-device.inspector.onlineCount', { count: deviceCount })}
+ </span>
+ )}
+ </div>
+ );
+});
+
+ListOnlineDevicesInspector.displayName = 'ListOnlineDevicesInspector';
diff --git a/packages/builtin-tool-remote-device/src/client/Inspector/index.ts b/packages/builtin-tool-remote-device/src/client/Inspector/index.ts
new file mode 100644
index 00000000000..0ca1300fcf6
--- /dev/null
+++ b/packages/builtin-tool-remote-device/src/client/Inspector/index.ts
@@ -0,0 +1,8 @@
+import { RemoteDeviceApiName } from '../../types';
+import { ActivateDeviceInspector } from './ActivateDevice';
+import { ListOnlineDevicesInspector } from './ListOnlineDevices';
+
+export const RemoteDeviceInspectors = {
+ [RemoteDeviceApiName.activateDevice]: ActivateDeviceInspector,
+ [RemoteDeviceApiName.listOnlineDevices]: ListOnlineDevicesInspector,
+};
diff --git a/packages/builtin-tool-remote-device/src/client/Render/ActivateDevice/index.tsx b/packages/builtin-tool-remote-device/src/client/Render/ActivateDevice/index.tsx
index 712c3dd608e..b7be8d7b37d 100644
--- a/packages/builtin-tool-remote-device/src/client/Render/ActivateDevice/index.tsx
+++ b/packages/builtin-tool-remote-device/src/client/Render/ActivateDevice/index.tsx
@@ -5,6 +5,7 @@ import { Icon } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import { AlertTriangleIcon } from 'lucide-react';
import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
import type { ActivateDeviceParams, ActivateDeviceState } from '../../../types';
import DeviceCard from '../DeviceCard';
@@ -18,9 +19,9 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
padding-block: 12px;
padding-inline: 12px;
border: 1px solid ${cssVar.colorWarningBorder};
- border-radius: 10px;
+ border-radius: ${cssVar.borderRadius};
- font-size: 13px;
+ font-size: ${cssVar.fontSize};
color: ${cssVar.colorWarningText};
background: ${cssVar.colorWarningBg};
@@ -29,6 +30,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
const ActivateDevice = memo<BuiltinRenderProps<ActivateDeviceParams, ActivateDeviceState, string>>(
({ pluginState, content }) => {
+ const { t } = useTranslation('plugin');
const device = pluginState?.activatedDevice;
if (device) return <DeviceCard activated device={device} />;
@@ -40,7 +42,9 @@ const ActivateDevice = memo<BuiltinRenderProps<ActivateDeviceParams, ActivateDev
return (
<div className={styles.failure}>
<Icon icon={AlertTriangleIcon} size={14} />
- {content}
+ <span>
+ {t('builtins.lobe-remote-device.render.activationFailed')}: {content}
+ </span>
</div>
);
}
diff --git a/packages/builtin-tool-remote-device/src/client/Render/DeviceCard/index.tsx b/packages/builtin-tool-remote-device/src/client/Render/DeviceCard/index.tsx
index 5da1c09ed41..933091744e4 100644
--- a/packages/builtin-tool-remote-device/src/client/Render/DeviceCard/index.tsx
+++ b/packages/builtin-tool-remote-device/src/client/Render/DeviceCard/index.tsx
@@ -1,9 +1,10 @@
'use client';
import { Flexbox, Icon } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
+import { createStaticStyles, cx } from 'antd-style';
import { CheckCircle2, MonitorIcon } from 'lucide-react';
import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
import type { DeviceAttachment } from '../../../ExecutionRuntime/types';
@@ -19,25 +20,36 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
padding-block: 2px;
padding-inline: 8px;
- border-radius: 6px;
+ border-radius: ${cssVar.borderRadiusSM};
font-size: 12px;
line-height: 16px;
white-space: nowrap;
`,
card: css`
- width: 100%;
- padding-block: 10px;
+ padding-block: 12px;
padding-inline: 12px;
border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 10px;
+ border-radius: ${cssVar.borderRadius};
background: ${cssVar.colorBgContainer};
`,
+ details: css`
+ overflow: hidden;
+
+ max-width: 50%;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: ${cssVar.fontSizeSM};
+ color: ${cssVar.colorTextDescription};
+ text-align: end;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
hostname: css`
overflow: hidden;
- font-size: 14px;
+ font-size: ${cssVar.fontSize};
font-weight: 500;
text-overflow: ellipsis;
white-space: nowrap;
@@ -53,18 +65,36 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
background: ${cssVar.colorFillTertiary};
`,
- meta: css`
- overflow: hidden;
+ listItem: css`
+ padding-block: 10px;
+ padding-inline: 12px;
- font-family: ${cssVar.fontFamilyCode};
- font-size: 12px;
- color: ${cssVar.colorTextDescription};
- text-overflow: ellipsis;
- white-space: nowrap;
+ &:not(:last-child) {
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+ }
`,
- online: css`
+ root: css`
+ width: 100%;
+ `,
+ status: css`
+ display: inline-flex;
+ flex: none;
+ gap: 6px;
+ align-items: center;
+
+ font-size: ${cssVar.fontSizeSM};
color: ${cssVar.colorTextSecondary};
- background: ${cssVar.colorFillTertiary};
+ `,
+ statusDot: css`
+ width: 7px;
+ height: 7px;
+ border: 1px solid ${cssVar.colorTextQuaternary};
+ border-radius: 50%;
+ `,
+ statusDotOnline: css`
+ border: none;
+ background: ${cssVar.colorSuccess};
+ box-shadow: 0 0 0 3px ${cssVar.colorSuccessBg};
`,
}));
@@ -72,29 +102,58 @@ interface DeviceCardProps {
/** Render the activated treatment (check badge) instead of the online badge. */
activated?: boolean;
device: DeviceAttachment;
+ variant?: 'card' | 'listItem';
}
-const DeviceCard = memo<DeviceCardProps>(({ device, activated }) => (
- <Flexbox horizontal align={'center'} className={styles.card} gap={12}>
- <Flexbox align={'center'} className={styles.icon} justify={'center'}>
- <Icon icon={MonitorIcon} size={18} />
- </Flexbox>
- <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
- <span className={styles.hostname}>{device.hostname}</span>
- <span className={styles.meta}>
- {device.platform} · {device.deviceId.slice(0, 12)}
- </span>
+const DeviceCard = memo<DeviceCardProps>(({ device, activated, variant = 'card' }) => {
+ const { t } = useTranslation('plugin');
+ const displayName = device.friendlyName || device.hostname;
+ const scopeLabel = device.scope
+ ? t(`builtins.lobe-remote-device.render.scope.${device.scope}`)
+ : undefined;
+ const details = [device.friendlyName ? device.hostname : undefined, device.platform, scopeLabel]
+ .filter(Boolean)
+ .join(' · ');
+
+ return (
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={cx(styles.root, variant === 'card' ? styles.card : styles.listItem)}
+ gap={12}
+ role={variant === 'listItem' ? 'listitem' : undefined}
+ >
+ <Flexbox align={'center'} className={styles.icon} justify={'center'}>
+ <Icon icon={MonitorIcon} size={18} />
+ </Flexbox>
+ <Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>
+ <span className={styles.hostname}>{displayName}</span>
+ {!activated && (
+ <span className={styles.status}>
+ <span
+ className={[styles.statusDot, device.online ? styles.statusDotOnline : undefined]
+ .filter(Boolean)
+ .join(' ')}
+ />
+ {t(
+ device.online
+ ? 'builtins.lobe-remote-device.render.online'
+ : 'builtins.lobe-remote-device.render.offline',
+ )}
+ </span>
+ )}
+ </Flexbox>
+ {activated ? (
+ <span className={[styles.badge, styles.activated].join(' ')}>
+ <Icon icon={CheckCircle2} size={12} />
+ {t('builtins.lobe-remote-device.render.activated')}
+ </span>
+ ) : (
+ details && <span className={styles.details}>{details}</span>
+ )}
</Flexbox>
- {activated ? (
- <span className={[styles.badge, styles.activated].join(' ')}>
- <Icon icon={CheckCircle2} size={12} />
- Activated
- </span>
- ) : (
- device.online && <span className={[styles.badge, styles.online].join(' ')}>Online</span>
- )}
- </Flexbox>
-));
+ );
+});
DeviceCard.displayName = 'DeviceCard';
diff --git a/packages/builtin-tool-remote-device/src/client/Render/ListDevices/index.tsx b/packages/builtin-tool-remote-device/src/client/Render/ListDevices/index.tsx
index 960bbfe643c..3078e4b0892 100644
--- a/packages/builtin-tool-remote-device/src/client/Render/ListDevices/index.tsx
+++ b/packages/builtin-tool-remote-device/src/client/Render/ListDevices/index.tsx
@@ -4,18 +4,28 @@ import { type BuiltinRenderProps } from '@lobechat/types';
import { Flexbox } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
import type { ListOnlineDevicesState } from '../../../types';
import DeviceCard from '../DeviceCard';
const styles = createStaticStyles(({ css, cssVar }) => ({
+ card: css`
+ overflow: hidden;
+
+ width: 100%;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+
+ background: ${cssVar.colorBgContainer};
+ `,
empty: css`
padding-block: 12px;
padding-inline: 12px;
border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 10px;
+ border-radius: ${cssVar.borderRadius};
- font-size: 13px;
+ font-size: ${cssVar.fontSize};
color: ${cssVar.colorTextDescription};
background: ${cssVar.colorBgContainer};
@@ -24,16 +34,21 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
const ListDevices = memo<BuiltinRenderProps<undefined, ListOnlineDevicesState>>(
({ pluginState }) => {
+ const { t } = useTranslation('plugin');
const devices = pluginState?.devices ?? [];
if (devices.length === 0) {
- return <div className={styles.empty}>No online devices found.</div>;
+ return (
+ <div className={styles.empty}>
+ {t('builtins.lobe-remote-device.render.noOnlineDevices')}
+ </div>
+ );
}
return (
- <Flexbox gap={8} width={'100%'}>
+ <Flexbox className={styles.card} role={'list'}>
{devices.map((device) => (
- <DeviceCard device={device} key={device.deviceId} />
+ <DeviceCard device={device} key={device.deviceId} variant={'listItem'} />
))}
</Flexbox>
);
diff --git a/packages/builtin-tool-remote-device/src/client/index.ts b/packages/builtin-tool-remote-device/src/client/index.ts
index 43ce83541ae..a05d2cc041b 100644
--- a/packages/builtin-tool-remote-device/src/client/index.ts
+++ b/packages/builtin-tool-remote-device/src/client/index.ts
@@ -1,3 +1,4 @@
export { RemoteDeviceManifest } from '../manifest';
export * from '../types';
+export { RemoteDeviceInspectors } from './Inspector';
export { RemoteDeviceRenders } from './Render';
diff --git a/packages/builtin-tools/src/register.ts b/packages/builtin-tools/src/register.ts
index e601422248b..b51be07f693 100644
--- a/packages/builtin-tools/src/register.ts
+++ b/packages/builtin-tools/src/register.ts
@@ -102,6 +102,7 @@ import {
PageAgentStreamings,
} from '@lobechat/builtin-tool-page-agent/client';
import {
+ RemoteDeviceInspectors,
RemoteDeviceManifest,
RemoteDeviceRenders,
} from '@lobechat/builtin-tool-remote-device/client';
@@ -235,6 +236,7 @@ export const registerBuiltinToolSurfaces = (): void => {
[MemoryManifest.identifier]: MemoryInspectors as Record<string, BuiltinInspector>,
[MessageManifest.identifier]: MessageInspectors as Record<string, BuiltinInspector>,
[PageAgentManifest.identifier]: PageAgentInspectors as Record<string, BuiltinInspector>,
+ [RemoteDeviceManifest.identifier]: RemoteDeviceInspectors as Record<string, BuiltinInspector>,
[LobeActivatorManifest.identifier]: LobeActivatorInspectors as Record<string, BuiltinInspector>,
[selfFeedbackIntentManifest.identifier]: SelfFeedbackIntentInspectors as Record<
string,
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index 877ae44ac4b..d86e7277eb8 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -355,6 +355,18 @@ export default {
'builtins.lobe-page-agent.apiName.updateNode': 'Update node',
'builtins.lobe-page-agent.apiName.wrapNodes': 'Wrap nodes',
'builtins.lobe-page-agent.title': 'Page',
+ 'builtins.lobe-remote-device.apiName.activateDevice': 'Connect device',
+ 'builtins.lobe-remote-device.apiName.listOnlineDevices': 'Check online devices',
+ 'builtins.lobe-remote-device.inspector.onlineCount_one': '{{count}} online',
+ 'builtins.lobe-remote-device.inspector.onlineCount_other': '{{count}} online',
+ 'builtins.lobe-remote-device.render.activated': 'Connected',
+ 'builtins.lobe-remote-device.render.activationFailed': 'Unable to connect',
+ 'builtins.lobe-remote-device.render.noOnlineDevices': 'No devices are online',
+ 'builtins.lobe-remote-device.render.offline': 'Offline',
+ 'builtins.lobe-remote-device.render.online': 'Online',
+ 'builtins.lobe-remote-device.render.scope.personal': 'Personal',
+ 'builtins.lobe-remote-device.render.scope.workspace': 'Workspace',
+ 'builtins.lobe-remote-device.title': 'Remote Device',
'builtins.lobe-activator.apiName.activateTools': 'Activate Tools',
'builtins.lobe-activator.inspector.activateTools.notFoundCount': '{{count}} not found',
'builtins.lobe-skill-store.apiName.importFromMarket': 'Import from Market',
diff --git a/src/store/tool/builtinToolRegistry.test.ts b/src/store/tool/builtinToolRegistry.test.ts
index 1b33dd36565..74ef9833951 100644
--- a/src/store/tool/builtinToolRegistry.test.ts
+++ b/src/store/tool/builtinToolRegistry.test.ts
@@ -5,6 +5,7 @@ import {
GroupAgentBuilderIdentifier,
} from '@lobechat/builtin-tool-group-agent-builder';
import { GroupAgentBuilderInspectors } from '@lobechat/builtin-tool-group-agent-builder/client';
+import { RemoteDeviceApiName, RemoteDeviceIdentifier } from '@lobechat/builtin-tool-remote-device';
import { SkillStoreApiName, SkillStoreIdentifier } from '@lobechat/builtin-tool-skill-store';
import { SkillStoreInspectors, SkillStoreRenders } from '@lobechat/builtin-tool-skill-store/client';
import {
@@ -60,6 +61,13 @@ describe('builtin tool registry', () => {
expect(getBuiltinInspector('codex', 'error')).toBeDefined();
});
+ it('registers remote device inspectors and renders', () => {
+ for (const apiName of Object.values(RemoteDeviceApiName)) {
+ expect(getBuiltinInspector(RemoteDeviceIdentifier, apiName)).toBeDefined();
+ expect(getBuiltinRender(RemoteDeviceIdentifier, apiName)).toBeDefined();
+ }
+ });
+
it('includes user interaction and web onboarding in web onboarding runtime plugins', () => {
const runtime =
typeof WEB_ONBOARDING.runtime === 'function'