Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(devices): keep mobile targets closed

Zhao Dengfeng30f2537c977a
diff --git a/packages/maker-shared/src/__tests__/deviceList.test.ts b/packages/maker-shared/src/__tests__/deviceList.test.ts
index f5a2173f3a..2ea6e84092 100644
--- a/packages/maker-shared/src/__tests__/deviceList.test.ts
+++ b/packages/maker-shared/src/__tests__/deviceList.test.ts
@@ -5,6 +5,7 @@ import {
deviceDisplayName,
isControllableDevice,
platformLabel,
+ toDeviceListItem,
toDeviceListItems,
type DeviceListDeviceLike,
visibleDeviceListItems,
@@ -54,6 +55,15 @@ describe('shared device list presentation model', () => {
expect(deviceAccessState(device({ isSelf: true }))).toBe('self');
});
+ // Regression: the singular projection must reuse controllability so ready mobile clients cannot be opened.
+ // Minimal unit inputs: online, remote-enabled iOS/Android; desktop ready/busy retain their existing projection.
+ it('keeps ready mobile clients closed while preserving desktop ready and busy projections', () => {
+ expect(toDeviceListItem(device({ platform: 'ios' }))).toMatchObject({ state: 'ready', canOpen: false });
+ expect(toDeviceListItem(device({ platform: 'android' }))).toMatchObject({ state: 'ready', canOpen: false });
+ expect(toDeviceListItem(device())).toMatchObject({ state: 'ready', canOpen: true });
+ expect(toDeviceListItem(device({ busy: true }))).toMatchObject({ state: 'busy', canOpen: true });
+ });
+
it('omits the current mobile device and other mobile clients while keeping unavailable peers with actionable details', () => {
const now = new Date('2026-01-01T00:10:00.000Z').getTime();
const items = toDeviceListItems([
diff --git a/packages/maker-shared/src/deviceList.ts b/packages/maker-shared/src/deviceList.ts
index 7fd688229a..774a12f9f5 100644
--- a/packages/maker-shared/src/deviceList.ts
+++ b/packages/maker-shared/src/deviceList.ts
@@ -144,7 +144,7 @@ export function toDeviceListItem<TDevice extends DeviceListDeviceLike>(
return {
device,
state,
- canOpen: state === 'ready' || state === 'busy',
+ canOpen: isControllableDevice(device) && (state === 'ready' || state === 'busy'),
statusLabel: deviceStatusLabel(state, localizer),
statusDetail: deviceStatusDetail(device, state, now, localizer),
};