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。

feat(desktop): refine embedded iOS simulator panel (#3865)

JiangJiahao429a16f68374
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts
index 5b3b7f5a36..e33ab562b7 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts
@@ -42,6 +42,7 @@ describe('iOS Simulator IPC handlers', () => {
MAKER_INVOKE.IOS_SIMULATOR_SET_VIEWER_VISIBILITY,
MAKER_INVOKE.IOS_SIMULATOR_RETRY_NATIVE_ROUTE,
MAKER_INVOKE.IOS_SIMULATOR_LATEST_FRAME,
+ MAKER_INVOKE.IOS_SIMULATOR_COPY_SCREENSHOT,
MAKER_INVOKE.IOS_SIMULATOR_SET_STREAM_PROFILE,
MAKER_INVOKE.IOS_SIMULATOR_LIVE_TOUCH,
])('checks the trusted sender before parsing %s', async (channel) => {
@@ -981,6 +982,103 @@ describe('iOS Simulator IPC handlers', () => {
).rejects.toMatchObject({ code: 'INVALID_PARAMS' });
});
+ it('captures an exact simulator route and writes the PNG to the clipboard', async () => {
+ const harness = new IpcHarness();
+ const pngBytes = Buffer.from([0x89, 0x50, 0x4e, 0x47]);
+ const captureScreenshotBytes = vi.fn(async () => pngBytes);
+ const writePngToClipboard = vi.fn();
+ registerTrusted(harness, { captureScreenshotBytes, writePngToClipboard });
+
+ await expect(
+ harness.invokeFrom(17, MAKER_INVOKE.IOS_SIMULATOR_COPY_SCREENSHOT, {
+ sessionId: 'session-a',
+ instanceId: 'instance-a',
+ generation: 3,
+ leaseId: 'lease-a',
+ }),
+ ).resolves.toEqual({ ok: true });
+
+ expect(captureScreenshotBytes).toHaveBeenCalledWith('session-a', {
+ instanceId: 'instance-a',
+ generation: 3,
+ leaseId: 'lease-a',
+ });
+ expect(writePngToClipboard).toHaveBeenCalledWith(pngBytes);
+ });
+
+ it('does not write a screenshot after the exact task grant changes', async () => {
+ const harness = new IpcHarness();
+ let accessGeneration = 1;
+ let releaseCapture: ((png: Buffer) => void) | undefined;
+ const captureScreenshotBytes = vi.fn(
+ () =>
+ new Promise<Buffer>((resolve) => {
+ releaseCapture = resolve;
+ }),
+ );
+ const writePngToClipboard = vi.fn();
+ registerTrusted(harness, {
+ getSessionAccess: () => ({ sessionId: 'session-a', generation: accessGeneration }),
+ captureScreenshotBytes,
+ writePngToClipboard,
+ });
+
+ const request = harness.invokeFrom(17, MAKER_INVOKE.IOS_SIMULATOR_COPY_SCREENSHOT, {
+ sessionId: 'session-a',
+ instanceId: 'instance-a',
+ generation: 3,
+ leaseId: 'lease-a',
+ });
+ await vi.waitFor(() => expect(captureScreenshotBytes).toHaveBeenCalledOnce());
+ accessGeneration = 2;
+ releaseCapture?.(Buffer.from([0x89, 0x50, 0x4e, 0x47]));
+
+ await expect(request).rejects.toMatchObject({ code: 'PERMISSION_DENIED' });
+ expect(writePngToClipboard).not.toHaveBeenCalled();
+ });
+
+ it('validates screenshot routes and reports capture failures without writing clipboard data', async () => {
+ const harness = new IpcHarness();
+ const captureScreenshotBytes = vi.fn(async () => {
+ throw new IOSSimulatorInstanceError(
+ 'SCREENSHOT_CAPTURE_FAILED',
+ 'private simulator capture detail',
+ true,
+ );
+ });
+ const writePngToClipboard = vi.fn();
+ const reportError = vi.fn();
+ registerTrusted(harness, {
+ captureScreenshotBytes,
+ writePngToClipboard,
+ reportError,
+ });
+
+ await expect(
+ harness.invokeFrom(17, MAKER_INVOKE.IOS_SIMULATOR_COPY_SCREENSHOT, {
+ sessionId: 'session-a',
+ instanceId: 'instance-a',
+ generation: 0,
+ leaseId: 'lease-a',
+ }),
+ ).rejects.toMatchObject({ code: 'INVALID_PARAMS' });
+ await expect(
+ harness.invokeFrom(17, MAKER_INVOKE.IOS_SIMULATOR_COPY_SCREENSHOT, {
+ sessionId: 'session-a',
+ instanceId: 'instance-a',
+ generation: 3,
+ leaseId: 'lease-a',
+ }),
+ ).rejects.toMatchObject({
+ code: 'SCREENSHOT_CAPTURE_FAILED',
+ message: expect.not.stringContaining('private simulator capture detail'),
+ });
+
+ expect(captureScreenshotBytes).toHaveBeenCalledOnce();
+ expect(writePngToClipboard).not.toHaveBeenCalled();
+ expect(reportError).toHaveBeenCalledWith('copy-screenshot', expect.any(Error));
+ });
+
it('validates and routes bounded stream profiles', async () => {
const harness = new IpcHarness();
const setViewerStreamProfile = vi.fn(async () => ({ ok: true as const, data: {} }));
diff --git a/apps/desktop/src/main/maker-ipc/channels.ts b/apps/desktop/src/main/maker-ipc/channels.ts
index a33b2ad00d..7df09fed6b 100644
--- a/apps/desktop/src/main/maker-ipc/channels.ts
+++ b/apps/desktop/src/main/maker-ipc/channels.ts
@@ -665,6 +665,7 @@ export const MAKER_INVOKE = {
IOS_SIMULATOR_SET_VIEWER_VISIBILITY: 'maker:ios-simulator:set-viewer-visibility',
IOS_SIMULATOR_RETRY_NATIVE_ROUTE: 'maker:ios-simulator:retry-native-route',
IOS_SIMULATOR_LATEST_FRAME: 'maker:ios-simulator:latest-frame',
+ IOS_SIMULATOR_COPY_SCREENSHOT: 'maker:ios-simulator:copy-screenshot',
IOS_SIMULATOR_SET_STREAM_PROFILE: 'maker:ios-simulator:set-stream-profile',
IOS_SIMULATOR_LIVE_TOUCH: 'maker:ios-simulator:live-touch',
// Local desktop computer-use driver detection for Settings →「电脑使用」
diff --git a/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts b/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts
index c120a2b98f..59a625c994 100644
--- a/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts
+++ b/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts
@@ -1,5 +1,6 @@
import { IOSSimulatorInstanceError } from '@cindy/ios-simulator-runtime';
import type { IOSSimulatorMcpAccessDecision } from '@cindy/mcps';
+import { clipboard, nativeImage } from 'electron';
import type {
IOSSimulatorNativeH264StreamProfileRequest,
@@ -11,6 +12,7 @@ import { IOS_SIMULATOR_RENDERER_TOOL_NAMES } from '../../shared/iosSimulatorIpc.
import { activeOwnerScopeKey, isAppSessionBoundaryPending } from '../appSessionState.js';
import {
callIOSSimulatorHostTool,
+ captureIOSSimulatorScreenshotBytes,
getIOSSimulatorLatestFrame,
getIOSSimulatorSessionStatus,
retryIOSSimulatorNativeRoute,
@@ -49,6 +51,7 @@ type IOSSimulatorIpcOperation =
| 'retry-native-route'
| 'set-mutation-control'
| 'latest-frame'
+ | 'copy-screenshot'
| 'set-stream-profile'
| 'live-touch';
@@ -61,6 +64,7 @@ const IOS_SIMULATOR_SAFE_IPC_MESSAGES: Record<IOSSimulatorIpcOperation, string>
'retry-native-route': 'iOS Simulator Native acceleration could not be restored.',
'set-mutation-control': 'iOS Simulator control state could not be updated.',
'latest-frame': 'iOS Simulator frame is temporarily unavailable.',
+ 'copy-screenshot': 'iOS Simulator screenshot could not be copied.',
'set-stream-profile': 'iOS Simulator stream settings could not be updated.',
'live-touch': 'iOS Simulator input could not be delivered.',
};
@@ -138,6 +142,11 @@ export interface IOSSimulatorHandlerDeps {
route: { instanceId: string; generation: number; leaseId: string },
viewerWebContentsId: number,
): Promise<IOSSimulatorToolResponse>;
+ captureScreenshotBytes(
+ sessionId: string,
+ route: { instanceId: string; generation: number; leaseId: string },
+ ): Promise<Buffer>;
+ writePngToClipboard(pngBytes: Buffer): void;
updateViewerTouch(
sessionId: string,
route: { instanceId: string; generation: number; leaseId: string },
@@ -181,6 +190,18 @@ const defaultDeps: IOSSimulatorHandlerDeps = {
retryNativeRoute: retryIOSSimulatorNativeRoute,
setViewerStreamProfile: setIOSSimulatorViewerStreamProfile,
getLatestFrame: getIOSSimulatorLatestFrame,
+ captureScreenshotBytes: captureIOSSimulatorScreenshotBytes,
+ writePngToClipboard: (pngBytes) => {
+ const image = nativeImage.createFromBuffer(pngBytes);
+ if (image.isEmpty()) {
+ throw new IOSSimulatorInstanceError(
+ 'SCREENSHOT_CAPTURE_FAILED',
+ 'The captured simulator screenshot is empty.',
+ true,
+ );
+ }
+ clipboard.writeImage(image);
+ },
updateViewerTouch: updateIOSSimulatorViewerTouch,
reportError: (operation, error) => {
log.error(`iOS Simulator ${operation} IPC failed`, {
@@ -613,6 +634,21 @@ export function registerIOSSimulatorHandlers(
resolved.getLatestFrame(sessionId, route, viewerWebContentsId),
);
});
+ handle(MAKER_INVOKE.IOS_SIMULATOR_COPY_SCREENSHOT, async (event, payload) => {
+ const record = readRecord(payload);
+ const sessionId = readSessionId(record);
+ assertSenderViewerSession(event, sessionId);
+ const route = readViewerRoute(record);
+ const pngBytes = await callIOSSimulatorHostForSession(event, sessionId, 'copy-screenshot', () =>
+ resolved.captureScreenshotBytes(sessionId, route),
+ );
+ try {
+ resolved.writePngToClipboard(pngBytes);
+ } catch (error) {
+ throwIOSSimulatorIpcError(resolved, 'copy-screenshot', error);
+ }
+ return { ok: true as const };
+ });
handle(MAKER_INVOKE.IOS_SIMULATOR_SET_STREAM_PROFILE, async (event, payload) => {
const record = readRecord(payload);
const sessionId = readSessionId(record);
diff --git a/apps/desktop/src/main/mcp-integrations/__tests__/ios-simulator.test.ts b/apps/desktop/src/main/mcp-integrations/__tests__/ios-simulator.test.ts
index 561e05a3ef..9e9e0f97b9 100644
--- a/apps/desktop/src/main/mcp-integrations/__tests__/ios-simulator.test.ts
+++ b/apps/desktop/src/main/mcp-integrations/__tests__/ios-simulator.test.ts
@@ -7978,6 +7978,15 @@ describe('iOS Simulator host', () => {
source: 'agent',
signal: expect.any(AbortSignal),
});
+ await expect(host.captureScreenshotBytes('session-a', route)).resolves.toEqual(
+ expect.objectContaining({ length: expect.any(Number) }),
+ );
+ await expect(
+ host.captureScreenshotBytes('session-a', {
+ ...route,
+ generation: route.generation + 1,
+ }),
+ ).rejects.toMatchObject({ code: 'STALE_GENERATION' });
const visualBaseline = await host.callTool('capture_visual_baseline', route, {
sessionId: 'session-a',
origin: 'agent',
@@ -8006,6 +8015,10 @@ describe('iOS Simulator host', () => {
simulatorUdid: instance.simulatorUdid,
signal: expect.any(AbortSignal),
});
+ expect(mediaCapture.captureScreenshotBytes).toHaveBeenNthCalledWith(3, {
+ simulatorUdid: instance.simulatorUdid,
+ signal: expect.any(AbortSignal),
+ });
await expect(
host.callTool(
'audit_accessibility',
@@ -8516,7 +8529,7 @@ describe('iOS Simulator host', () => {
await expect(
host.callTool('press_home', route, { sessionId: 'session-a', origin: 'user' }),
).resolves.toMatchObject({ ok: true });
- expect(driver.home).toHaveBeenCalledOnce();
+ expect(driver.home).toHaveBeenCalledWith('wda-session', expect.any(AbortSignal));
await expect(
host.callTool(
'set_orientation',
diff --git a/apps/desktop/src/main/mcp-integrations/ios-simulator.ts b/apps/desktop/src/main/mcp-integrations/ios-simulator.ts
index 6c7ff3bd6c..a71db40d26 100644
--- a/apps/desktop/src/main/mcp-integrations/ios-simulator.ts
+++ b/apps/desktop/src/main/mcp-integrations/ios-simulator.ts
@@ -577,6 +577,11 @@ export interface IOSSimulatorHost {
getStatus(sessionId: string): Promise<IOSSimulatorSessionStatus>;
/** Read-only, redacted plugin projection; never reconciles or renews an ownership lease. */
getPluginStatus(sessionId: string): Promise<GhostIOSSimulatorStatusProbeResult>;
+ /** Capture one exact owned device as PNG bytes without creating a media attachment. */
+ captureScreenshotBytes(
+ sessionId: string,
+ route: Omit<IOSSimulatorMutationRoute, 'sessionId'>,
+ ): Promise<Buffer>;
/** Synchronously retire media/input owned by one exact revoked renderer grant. */
revokeRendererViewer(sessionId: string, viewerWebContentsId: number): number;
callTool(
@@ -4325,6 +4330,40 @@ export function createIOSSimulatorHost(options: IOSSimulatorHostOptions = {}): I
},
getStatus: inspectForSession,
getPluginStatus: inspectForPlugin,
+ async captureScreenshotBytes(sessionId, route) {
+ const sessionAdmissionEpoch = sessionOperationAdmissionEpochs.get(sessionId) ?? 0;
+ const instanceAdmissionEpoch = captureInstanceOperationAdmission(
+ route.instanceId,
+ 'screenshot',
+ );
+ const resolved = await resolveSession(sessionId);
+ if (!resolved.ok) {
+ throw new IOSSimulatorInstanceError(
+ 'INSTANCE_NOT_OWNED',
+ 'The simulator is no longer attached to this task.',
+ true,
+ );
+ }
+ assertHostActive();
+ await reconcilePersistedOwnership();
+ assertHostActive();
+ return runHostMutation(
+ { ...route, sessionId: resolved.sessionId },
+ { sessionId: resolved.sessionId, origin: 'user' },
+ async (instance, signal) => {
+ assertSessionOperationAdmission(instance.sessionId, sessionAdmissionEpoch, 'screenshot');
+ assertInstanceOperationAdmission(
+ instance.instanceId,
+ instanceAdmissionEpoch,
+ 'screenshot',
+ );
+ return mediaCapture.captureScreenshotBytes({
+ simulatorUdid: instance.simulatorUdid,
+ signal,
+ });
+ },
+ );
+ },
revokeRendererViewer(sessionId, viewerWebContentsId) {
const revokedInstanceIds = revokeRendererViewerIntents(sessionId, viewerWebContentsId);
for (const [instanceId, viewer] of [...viewerSessions]) {
@@ -5772,7 +5811,7 @@ export function createIOSSimulatorHost(options: IOSSimulatorHostOptions = {}): I
if (context?.origin !== 'user') {
requireAgentInteractionSnapshot(instance, args);
}
- await running.driver.home(signal);
+ await running.driver.home(running.driverSessionId, signal);
screenMaps.invalidate(instance.instanceId);
return {
backend: 'wda' as const,
@@ -7426,6 +7465,13 @@ export function callIOSSimulatorHostTool(
return initializeIOSSimulatorHost().callTool(name, args, { sessionId, origin: 'user' });
}
+export function captureIOSSimulatorScreenshotBytes(
+ sessionId: string,
+ route: Omit<IOSSimulatorMutationRoute, 'sessionId'>,
+): Promise<Buffer> {
+ return initializeIOSSimulatorHost().captureScreenshotBytes(sessionId, route);
+}
+
export function setIOSSimulatorAgentControlGrant(
sessionId: string,
instanceId: string,
diff --git a/apps/desktop/src/main/right-sidebar-window/__tests__/preload-contract.test.ts b/apps/desktop/src/main/right-sidebar-window/__tests__/preload-contract.test.ts
index 6729163fef..4cbff73804 100644
--- a/apps/desktop/src/main/right-sidebar-window/__tests__/preload-contract.test.ts
+++ b/apps/desktop/src/main/right-sidebar-window/__tests__/preload-contract.test.ts
@@ -315,7 +315,8 @@ describe('sidebar nested namespace contract', () => {
]));
expect(iosSimulatorKeys).toEqual(expect.arrayContaining([
'requestAccess', 'status', 'call', 'setAgentControl', 'setMutationControl',
- 'setViewerVisibility', 'retryNativeRoute', 'latestFrame', 'setStreamProfile', 'liveTouch',
+ 'setViewerVisibility', 'retryNativeRoute', 'latestFrame', 'copyScreenshot',
+ 'setStreamProfile', 'liveTouch',
'onH264Frame', 'onRouteStatus', 'onFocusRequest',
]));
});
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index d8e100d1c9..fe2f494022 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -219,6 +219,8 @@ import type {
import type {
IOSSimulatorAccessRequest,
IOSSimulatorAccessRequestResult,
+ IOSSimulatorCopyScreenshotRequest,
+ IOSSimulatorCopyScreenshotResult,
IOSSimulatorSessionStatus,
IOSSimulatorAgentControlRequest,
IOSSimulatorFocusRequest,
@@ -7109,6 +7111,10 @@ contextBridge.exposeInMainWorld('electronAPI', {
ipcRenderer.invoke('maker:ios-simulator:retry-native-route', request),
latestFrame: (request: IOSSimulatorViewerRouteRequest): Promise<IOSSimulatorToolResponse> =>
ipcRenderer.invoke('maker:ios-simulator:latest-frame', request),
+ copyScreenshot: (
+ request: IOSSimulatorCopyScreenshotRequest,
+ ): Promise<IOSSimulatorCopyScreenshotResult> =>
+ ipcRenderer.invoke('maker:ios-simulator:copy-screenshot', request),
setStreamProfile: (
request: IOSSimulatorStreamProfileRequest,
): Promise<IOSSimulatorToolResponse> =>
diff --git a/apps/desktop/src/preload/sidebarWindowPreload.ts b/apps/desktop/src/preload/sidebarWindowPreload.ts
index b5d887f70b..ebd34c9dc5 100644
--- a/apps/desktop/src/preload/sidebarWindowPreload.ts
+++ b/apps/desktop/src/preload/sidebarWindowPreload.ts
@@ -557,6 +557,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
ipcRenderer.invoke('maker:ios-simulator:retry-native-route', request),
latestFrame: (request: unknown): Promise<unknown> =>
ipcRenderer.invoke('maker:ios-simulator:latest-frame', request),
+ copyScreenshot: (request: unknown): Promise<unknown> =>
+ ipcRenderer.invoke('maker:ios-simulator:copy-screenshot', request),
setStreamProfile: (request: unknown): Promise<unknown> =>
ipcRenderer.invoke('maker:ios-simulator:set-stream-profile', request),
liveTouch: (request: unknown): Promise<unknown> =>
diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx
index a6c13631fd..985b88596a 100644
--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx
+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx
@@ -582,7 +582,7 @@ export function IOSSimulatorInstanceGrid({
<img
src={tile.frameUrl}
alt={instance.simulatorName}
- className={`max-h-full max-w-full touch-none select-none object-contain ${busy ? 'cursor-wait opacity-70' : 'cursor-crosshair'}`}
+ className={`max-h-full max-w-full touch-none select-none object-contain ${busy ? 'cursor-wait opacity-70' : ''}`}
draggable={false}
onPointerDown={(event) => onTilePointerDown(instance, event)}
onPointerUp={(event) => onTilePointerUp(instance, event)}
diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx
index 9001472f9e..3becd5910a 100644
--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx
+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx
@@ -1,14 +1,19 @@
import {
useCallback,
useEffect,
+ useLayoutEffect,
useRef,
useState,
+ type CSSProperties,
type PointerEvent as ReactPointerEvent,
} from 'react';
import {
AlertTriangle,
+ Camera,
CheckCircle2,
ChevronDown,
+ ChevronRight,
+ Ellipsis,
House,
Keyboard,
Loader2,
@@ -21,6 +26,7 @@ import {
Send,
ShieldCheck,
ShieldOff,
+ SlidersHorizontal,
Smartphone,
Square,
Trash2,
@@ -29,6 +35,20 @@ import {
import { useTranslation } from 'react-i18next';
import { ConfirmDialog } from '@/components/ui/confirm-dialog';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
+import { Tip } from '@/components/ui/tooltip';
+import { toast } from '@/lib/toast';
import { cn } from '@/lib/utils';
import { extractIpcError } from '@/utils/ipcError';
import type {
@@ -59,7 +79,8 @@ interface IOSSimulatorTabBodyProps {
shellVisible?: boolean;
}
-type Operation = 'attach' | 'start' | 'stop' | 'delete' | 'detach' | 'grant' | 'control' | null;
+type Operation =
+ 'attach' | 'start' | 'stop' | 'delete' | 'detach' | 'grant' | 'control' | 'screenshot' | null;
type StandardStreamProfileName = 'low' | 'balanced' | 'high';
type StreamProfileName = StandardStreamProfileName | 'experimental60';
type StreamProfile = { framesPerSecond: number; jpegQuality: number; scalingPercent: number };
@@ -73,6 +94,34 @@ type StatusErrorKey =
| 'rightSidebar.iosSimulator.pluginStateChanging'
| 'rightSidebar.iosSimulator.statusInternalError';
+const MIN_FITTED_SCREEN_HEIGHT_PX = 192;
+
+interface SimulatorScreenSize {
+ width: number;
+ height: number;
+}
+
+export function fitSimulatorScreenSize(
+ viewport: Pick<IOSSimulatorPublicViewport, 'width' | 'height'> | null,
+ availableWidth: number,
+ availableHeight: number,
+): SimulatorScreenSize | null {
+ if (
+ !viewport ||
+ viewport.width <= 0 ||
+ viewport.height <= 0 ||
+ availableWidth <= 0 ||
+ availableHeight <= 0
+ ) {
+ return null;
+ }
+ const scale = Math.min(availableWidth / viewport.width, availableHeight / viewport.height);
+ return {
+ width: viewport.width * scale,
+ height: viewport.height * scale,
+ };
+}
+
function statusErrorI18nKey(error: unknown): StatusErrorKey {
switch (extractIpcError(error)?.code) {
case 'IOS_SIMULATOR_PLUGIN_REQUIRED':
@@ -185,6 +234,39 @@ function isRecoverableNativeFallback(status: IOSSimulatorPublicRouteStatus | nul
return status?.nativeRecoveryAvailable === true;
}
+function simulatorScreenCornerRatio(deviceTypeIdentifier: string): number | null {
+ const deviceType = deviceTypeIdentifier.split('.').at(-1) ?? deviceTypeIdentifier;
+ if (/^iPhone-(?:17-Pro|16-Pro)(?:-Max)?$/.test(deviceType)) return 0.2106;
+ if (/^iPhone-(?:15-Pro|14-Pro)(?:-Max)?$/.test(deviceType)) return 0.19;
+ if (/^iPhone-(?:1[2-3])(?:-|$)/.test(deviceType)) return 0.173;
+ if (/^iPhone-(?:1[4-7]|Air)(?:-|$)/.test(deviceType)) return 0.19;
+ if (/^iPhone-(?:11|XR|XS|X)(?:-|$)/.test(deviceType)) return 0.137;
+ if (
+ /^iPad-(?:A16|10th-generation|mini-(?:6th-generation|A17-Pro)|Air-(?:5th-generation|11-inch|13-inch)|Pro-(?:11-inch|12-9-inch|13-inch))/.test(
+ deviceType,
+ )
+ ) {
+ return 0.035;
+ }
+ return null;
+}
+
+function simulatorScreenCornerStyle(
+ deviceTypeIdentifier: string,
+ viewport: IOSSimulatorPublicViewport | null,
+): CSSProperties | undefined {
+ const cornerRatio = simulatorScreenCornerRatio(deviceTypeIdentifier);
+ if (!viewport || !cornerRatio || viewport.width <= 0 || viewport.height <= 0) return undefined;
+ const shortSide = Math.min(viewport.width, viewport.height);
+ const radius = shortSide * cornerRatio;
+ return {
+ borderRadius: `${((radius / viewport.width) * 100).toFixed(2)}% / ${(
+ (radius / viewport.height) *
+ 100
+ ).toFixed(2)}%`,
+ };
+}
+
/** Translate stable discovery codes instead of leaking host-side English guidance into the UI. */
export function setupStepKeys(issue: IOSSimulatorRuntimeErrorCode | null): string[] {
switch (issue) {
@@ -347,6 +429,7 @@ export function IOSSimulatorTabBody({
const [viewerReadyToken, setViewerReadyToken] = useState<string | null>(null);
const [nativeRecoveryPending, setNativeRecoveryPending] = useState(false);
const [nativeRecoveryFailed, setNativeRecoveryFailed] = useState(false);
+ const [fittedScreenSize, setFittedScreenSize] = useState<SimulatorScreenSize | null>(null);
const requestVersionRef = useRef(0);
const nativeRecoveryRequestRef = useRef(0);
const frameSequenceRef = useRef(0);
@@ -377,6 +460,9 @@ export function IOSSimulatorTabBody({
const presentationEpochRef = useRef(0);
const frameFreshnessTimerRef = useRef<number | null>(null);
const currentRouteStatusRef = useRef<IOSSimulatorPublicRouteStatus | null>(null);
+ const panelViewportRef = useRef<HTMLDivElement | null>(null);
+ const viewerSectionRef = useRef<HTMLElement | null>(null);
+ const viewerSlotRef = useRef<HTMLDivElement | null>(null);
const nativeRecoveryGateRef = useRef<NativeRecoveryGate>({
routeKey: null,
attemptCount: 0,
@@ -534,6 +620,9 @@ export function IOSSimulatorTabBody({
}, [ctx.sessionId, refresh]);
const environment = status?.ok ? status.environment : null;
+ const compactXcodeVersion = environment?.ready
+ ? (environment.xcodeVersion?.split(/\r?\n/, 1)[0]?.trim() ?? null)
+ : null;
const instances = status?.ok ? status.instances : [];
const resource = status?.ok ? (status.resource ?? null) : null;
const maxInstancesPerTask = resource?.maxInstancesPerTask ?? 4;
@@ -542,15 +631,24 @@ export function IOSSimulatorTabBody({
const globalHardLimitReached = Boolean(resource && resource.runningCount >= resource.hardLimit);
const attachedInstance =
instances.find((instance) => instance.instanceId === state.instanceId) ?? instances[0] ?? null;
+ const attachedDevice = attachedInstance
+ ? (environment?.devices.find((device) => device.udid === attachedInstance.simulatorUdid) ??
+ null)
+ : null;
const viewerRouteKey = attachedInstance
? `${attachedInstance.instanceId}:${attachedInstance.generation}`
: null;
const routeStatus = viewerRouteKey ? (routeStatuses[viewerRouteKey] ?? null) : null;
currentRouteStatusRef.current = routeStatus;
+ const nativeRecoveryEligible = isRecoverableNativeFallback(routeStatus);
const nativeH264Selected = Boolean(
routeStatus?.stream.adapter === 'native-sidecar' && routeStatus.stream.encoding === 'h264',
);
const nativeH264Active = Boolean(nativeH264Selected && routeStatus?.stream.state === 'active');
+ const screenCornerStyle = simulatorScreenCornerStyle(
+ attachedInstance?.deviceTypeIdentifier ?? '',
+ viewport,
+ );
const showExperimental60 =
nativeH264Active || (nativeH264Selected && streamProfile === 'experimental60');
const grant =
@@ -584,6 +682,7 @@ export function IOSSimulatorTabBody({
const viewerInteractive = Boolean(
viewerVisible && streamState === 'streaming' && presentationMatchesRoute && frameFresh && !busy,
);
+ const screenshotAvailable = Boolean(attachedInstance?.lifecycleState === 'ready' && !busy);
const streamRouteLabel =
routeStatus?.stream.adapter === 'native-sidecar' && routeStatus.stream.encoding === 'h264'
? t('rightSidebar.iosSimulator.route.nativeH264')
@@ -602,6 +701,30 @@ export function IOSSimulatorTabBody({
const inputRouteStateLabel = routeStatus
? t(`rightSidebar.iosSimulator.route.state.${routeStatus.input.state}`)
: t('rightSidebar.iosSimulator.route.state.detecting');
+ const streamRouteStateRedundant = Boolean(
+ routeStatus?.stream.adapter === 'wda' &&
+ (routeStatus.stream.state === 'active' || routeStatus.stream.state === 'fallback'),
+ );
+ const inputRouteStateRedundant = Boolean(
+ routeStatus?.input.adapter === 'wda' &&
+ (routeStatus.input.state === 'active' || routeStatus.input.state === 'fallback'),
+ );
+ const streamProfileLabel =
+ streamProfile === 'low'
+ ? t('rightSidebar.iosSimulator.streamProfiles.low')
+ : streamProfile === 'experimental60'
+ ? t('rightSidebar.iosSimulator.streamProfiles.experimental60')
+ : streamProfile === 'balanced'
+ ? t(
+ nativeH264Active
+ ? 'rightSidebar.iosSimulator.streamProfiles.balancedNative'
+ : 'rightSidebar.iosSimulator.streamProfiles.balanced',
+ )
+ : t(
+ nativeH264Active
+ ? 'rightSidebar.iosSimulator.streamProfiles.highNative'
+ : 'rightSidebar.iosSimulator.streamProfiles.high',
+ );
const formatActionError = useCallback(
(result: Extract<IOSSimulatorToolResponse, { ok: false }>) =>
t(actionErrorI18nKey(result.errorCode), {
@@ -1377,6 +1500,38 @@ export function IOSSimulatorTabBody({
[attachedInstance, ctx.sessionId, formatActionError, refresh, t, viewerInteractive],
);
+ const copyScreenshot = useCallback(async () => {
+ if (!attachedInstance || attachedInstance.lifecycleState !== 'ready' || busy) return;
+ setOperation('screenshot');
+ setActionError(null);
+ const invoke = (instance: IOSSimulatorPublicInstance) =>
+ window.electronAPI.maker.iosSimulator.copyScreenshot({
+ sessionId: ctx.sessionId,
+ ...routeFor(instance),
+ });
+ try {
+ try {
+ await invoke(attachedInstance);
+ } catch (error) {
+ const code = extractIpcError(error)?.code;
+ if (code !== 'LEASE_EXPIRED' && code !== 'STALE_GENERATION') throw error;
+ const nextStatus = await refresh();
+ const refreshedInstance = nextStatus?.ok
+ ? nextStatus.instances.find(
+ (instance) => instance.instanceId === attachedInstance.instanceId,
+ )
+ : null;
+ if (refreshedInstance?.lifecycleState !== 'ready') throw error;
+ await invoke(refreshedInstance);
+ }
+ toast.success(t('rightSidebar.iosSimulator.screenshotCopied'));
+ } catch {
+ toast.error(t('rightSidebar.iosSimulator.screenshotCopyFailed'));
+ } finally {
+ setOperation(null);
+ }
+ }, [attachedInstance, busy, ctx.sessionId, refresh, t]);
+
const pointerRatio = useCallback(
(event: ReactPointerEvent<HTMLImageElement | HTMLCanvasElement>) => {
const bounds = event.currentTarget.getBoundingClientRect();
@@ -1700,6 +1855,84 @@ export function IOSSimulatorTabBody({
[cancelActivePointerGesture],
);
+ useLayoutEffect(() => {
+ if (!active || !shellVisible || attachedInstance?.lifecycleState !== 'ready' || !viewport) {
+ setFittedScreenSize(null);
+ return;
+ }
+
+ const panelViewport = panelViewportRef.current;
+ const viewerSection = viewerSectionRef.current;
+ const viewerSlot = viewerSlotRef.current;
+ if (!panelViewport || !viewerSection || !viewerSlot) return;
+
+ const update = () => {
+ const panelHeight = panelViewport.clientHeight;
+ const slotWidth = viewerSlot.clientWidth;
+ if (panelHeight <= 0 || slotWidth <= 0) {
+ setFittedScreenSize(null);
+ return;
+ }
+
+ const sectionRect = viewerSection.getBoundingClientRect();
+ const slotRect = viewerSlot.getBoundingClientRect();
+ const deviceHeaderHeight = Math.max(0, slotRect.top - sectionRect.top);
+ const availableHeight = Math.max(
+ MIN_FITTED_SCREEN_HEIGHT_PX,
+ panelHeight - deviceHeaderHeight,
+ );
+ const next = fitSimulatorScreenSize(viewport, slotWidth, availableHeight);
+ setFittedScreenSize((current) =>
+ current &&
+ next &&
+ Math.abs(current.width - next.width) < 0.5 &&
+ Math.abs(current.height - next.height) < 0.5
+ ? current
+ : next,
+ );
+ };
+
+ let animationFrame: number | null = null;
+ const scheduleUpdate = () => {
+ if (animationFrame !== null) window.cancelAnimationFrame(animationFrame);
+ animationFrame = window.requestAnimationFrame(() => {
+ animationFrame = null;
+ update();
+ });
+ };
+
+ update();
+ const observer =
+ typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleUpdate);
+ observer?.observe(panelViewport);
+ observer?.observe(viewerSection);
+ observer?.observe(viewerSlot);
+ window.addEventListener('resize', scheduleUpdate);
+ return () => {
+ observer?.disconnect();
+ window.removeEventListener('resize', scheduleUpdate);
+ if (animationFrame !== null) window.cancelAnimationFrame(animationFrame);
+ };
+ }, [
+ actionError,
+ active,
+ agentBusy,
+ attachedInstance?.instanceId,
+ attachedInstance?.lifecycleState,
+ compactXcodeVersion,
+ grant?.agentControl,
+ instances.length,
+ mutation?.agentPaused,
+ mutation?.takeoverPending,
+ nativeRecoveryEligible,
+ nativeRecoveryFailed,
+ nativeRecoveryPending,
+ operation,
+ shellVisible,
+ statusErrorKey,
+ viewport,
+ ]);
+
const sendTextInput = useCallback(async () => {
if (!textInput) return;
if (await runInteraction('type_text', { text: textInput })) setTextInput('');
@@ -1707,6 +1940,8 @@ export function IOSSimulatorTabBody({
return (
<div
+ ref={panelViewportRef}
+ data-testid="ios-simulator-panel-viewport"
className="h-full overflow-y-auto bg-[var(--surface)] text-[var(--text-primary)]"
aria-busy={busy || refreshing || requestingAccess}
>
@@ -1717,8 +1952,29 @@ export function IOSSimulatorTabBody({
<Smartphone size={16} className="shrink-0" aria-hidden="true" />
<h2 className="text-14 font-medium">{t('rightSidebar.iosSimulator.title')}</h2>
</div>
- <p className="mt-1 text-12 leading-relaxed text-[var(--text-secondary)]">
- {t('rightSidebar.iosSimulator.description')}
+ <p className="mt-1 flex min-w-0 items-center gap-2 text-12 leading-relaxed text-[var(--text-secondary)]">
+ {environment?.ready ? (
+ <>
+ {compactXcodeVersion && (
+ <>
+ <Tip text={environment.xcodeVersion ?? compactXcodeVersion} side="bottom">
+ <span className="shrink-0 tabular-nums">{compactXcodeVersion}</span>
+ </Tip>
+ <span
+ aria-hidden="true"
+ className="size-1 shrink-0 rounded-full bg-[var(--text-tertiary)]"
+ />
+ </>
+ )}
+ <span className="min-w-0 truncate">
+ {t('rightSidebar.iosSimulator.readyTitle')}
+ </span>
+ </>
+ ) : (
+ <span className="min-w-0 truncate">
+ {t('rightSidebar.iosSimulator.description')}
+ </span>
+ )}
</p>
</div>
<ActionButton
@@ -1793,7 +2049,7 @@ export function IOSSimulatorTabBody({
</div>
)}
- {operation && (
+ {operation && operation !== 'screenshot' && (
<div
role="status"
aria-live="polite"
@@ -1811,15 +2067,13 @@ export function IOSSimulatorTabBody({
{environment && (
<>
- <StatusCard
- icon={environment.ready ? CheckCircle2 : AlertTriangle}
- title={t(
- environment.ready
- ? 'rightSidebar.iosSimulator.readyTitle'
- : 'rightSidebar.iosSimulator.unavailableTitle',
- )}
- description={environment.xcodeVersion ?? undefined}
- />
+ {!environment.ready && (
+ <StatusCard
+ icon={AlertTriangle}
+ title={t('rightSidebar.iosSimulator.unavailableTitle')}
+ description={environment.xcodeVersion ?? undefined}
+ />
+ )}
{!environment.ready && setupKeys.length > 0 && (
<section className="rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-3">
@@ -1888,19 +2142,231 @@ export function IOSSimulatorTabBody({
)}
{attachedInstance && (
- <section className="rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-3">
+ <section
+ ref={viewerSectionRef}
+ data-testid="ios-simulator-viewer-section"
+ className="rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-3"
+ >
<div className="flex items-start justify-between gap-3">
<div className="min-w-0">
<h3 className="truncate text-12 font-medium">
{attachedInstance.simulatorName}
</h3>
- <p className="mt-1 text-11 text-[var(--text-secondary)]">
- {t('rightSidebar.iosSimulator.attachedDescription')}
- </p>
+ <div className="mt-1 flex min-w-0 items-center gap-2 text-11 text-[var(--text-secondary)]">
+ <span className="truncate">
+ {attachedDevice?.runtimeName ??
+ t('rightSidebar.iosSimulator.attachedDescription')}
+ </span>
+ <span
+ aria-hidden="true"
+ className="size-1 shrink-0 rounded-full bg-[var(--text-tertiary)]"
+ />
+ <span className="shrink-0">
+ {t(
+ `rightSidebar.iosSimulator.lifecycle.${attachedInstance.lifecycleState}`,
+ )}
+ </span>
+ {attachedInstance.lifecycleState === 'ready' && (
+ <>
+ <span
+ aria-hidden="true"
+ className="size-1 shrink-0 rounded-full bg-[var(--text-tertiary)]"
+ />
+ <span className="min-w-0 truncate tabular-nums">
+ {streamFps.toFixed(1)} FPS
+ {viewport ? ` · ${viewport.width}×${viewport.height}` : ''}
+ </span>
+ </>
+ )}
+ </div>
+ </div>
+ <div className="flex shrink-0 items-center gap-1">
+ <SimulatorIconButton
+ label={t('rightSidebar.iosSimulator.pressHome')}
+ disabledLabel={t('rightSidebar.iosSimulator.controlsUnavailable')}
+ icon={House}
+ disabled={!viewerInteractive}
+ onClick={() => void runInteraction('press_home', {})}
+ />
+ <SimulatorIconButton
+ label={t('rightSidebar.iosSimulator.copyScreenshot')}
+ disabledLabel={t(
+ operation === 'screenshot'
+ ? 'rightSidebar.iosSimulator.operations.screenshot'
+ : 'rightSidebar.iosSimulator.controlsUnavailable',
+ )}
+ icon={operation === 'screenshot' ? Loader2 : Camera}
+ spinning={operation === 'screenshot'}
+ disabled={!screenshotAvailable}
+ onClick={() => void copyScreenshot()}
+ />
+ <SimulatorIconButton
+ label={t('rightSidebar.iosSimulator.rotateDevice')}
+ disabledLabel={t('rightSidebar.iosSimulator.controlsUnavailable')}
+ icon={RotateCw}
+ disabled={!viewerInteractive || !viewport}
+ onClick={() =>
+ void runInteraction('set_orientation', {
+ orientation:
+ viewport?.orientation === 'LANDSCAPE' ? 'PORTRAIT' : 'LANDSCAPE',
+ })
+ }
+ />
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Tip text={t('rightSidebar.iosSimulator.moreControls')} side="bottom">
+ <button
+ type="button"
+ aria-label={t('rightSidebar.iosSimulator.moreControls')}
+ className="inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-[var(--border-default)] bg-[var(--surface)] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-hover)] hover:text-[var(--text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] data-[state=open]:bg-[var(--surface-hover)] data-[state=open]:text-[var(--text-primary)]"
+ >
+ <Ellipsis size={14} aria-hidden="true" />
+ </button>
+ </Tip>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="min-w-44">
+ <DropdownMenuItem
+ disabled={!viewerInteractive}
+ onSelect={() => void runInteraction('lock_screen', {})}
+ >
+ <LockKeyhole size={14} className="mr-2 shrink-0" aria-hidden="true" />
+ {t('rightSidebar.iosSimulator.lockScreen')}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ disabled={!viewerInteractive}
+ onSelect={() => void runInteraction('unlock_screen', {})}
+ >
+ <UnlockKeyhole size={14} className="mr-2 shrink-0" aria-hidden="true" />
+ {t('rightSidebar.iosSimulator.unlockScreen')}
+ </DropdownMenuItem>
+ {attachedInstance.lifecycleState === 'ready' && (
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger
+ disabled={busy}
+ aria-label={t('rightSidebar.iosSimulator.streamProfile')}
+ className="gap-2"
+ >
+ <SlidersHorizontal
+ size={14}
+ className="shrink-0"
+ aria-hidden="true"
+ />
+ <span className="min-w-0 flex-1">
+ {t('rightSidebar.iosSimulator.streamProfile')}
+ </span>
+ <span
+ aria-hidden="true"
+ className="max-w-28 truncate text-10 text-[var(--text-secondary)]"
+ >
+ {streamProfileLabel}
+ </span>
+ <ChevronRight
+ size={12}
+ className="shrink-0 text-[var(--text-tertiary)]"
+ aria-hidden="true"
+ />
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent
+ sideOffset={6}
+ collisionPadding={8}
+ className="min-w-48"
+ >
+ <DropdownMenuRadioGroup
+ value={streamProfile}
+ onValueChange={(value) =>
+ void applyStreamProfile(value as StreamProfileName)
+ }
+ >
+ <DropdownMenuRadioItem value="low" disabled={busy}>
+ {t('rightSidebar.iosSimulator.streamProfiles.low')}
+ </DropdownMenuRadioItem>
+ <DropdownMenuRadioItem value="balanced" disabled={busy}>
+ {t(
+ nativeH264Active
+ ? 'rightSidebar.iosSimulator.streamProfiles.balancedNative'
+ : 'rightSidebar.iosSimulator.streamProfiles.balanced',
+ )}
+ </DropdownMenuRadioItem>
+ <DropdownMenuRadioItem value="high" disabled={busy}>
+ {t(
+ nativeH264Active
+ ? 'rightSidebar.iosSimulator.streamProfiles.highNative'
+ : 'rightSidebar.iosSimulator.streamProfiles.high',
+ )}
+ </DropdownMenuRadioItem>
+ {showExperimental60 && (
+ <DropdownMenuRadioItem value="experimental60" disabled={busy}>
+ {t('rightSidebar.iosSimulator.streamProfiles.experimental60')}
+ </DropdownMenuRadioItem>
+ )}
+ </DropdownMenuRadioGroup>
+ <DropdownMenuSeparator />
+ <div
+ aria-hidden="true"
+ className="max-w-56 space-y-1 px-2 py-1 text-10 leading-relaxed text-[var(--text-secondary)]"
+ >
+ <div className="truncate">
+ {streamRouteLabel}
+ {!streamRouteStateRedundant && ` · ${streamRouteStateLabel}`}
+ </div>
+ <div className="truncate">
+ {inputRouteLabel}
+ {!inputRouteStateRedundant && ` · ${inputRouteStateLabel}`}
+ </div>
+ {routeStatus?.input.adapter === 'native-sidecar' &&
+ !routeStatus.input.multiTouch && (
+ <div>
+ {t('rightSidebar.iosSimulator.route.multiTouchUnavailable')}
+ </div>
+ )}
+ </div>
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ )}
+ <DropdownMenuSeparator />
+ {attachedInstance.lifecycleState === 'ready' ? (
+ <DropdownMenuItem
+ disabled={busy}
+ onSelect={() =>
+ void call('stop', 'stop_instance', routeFor(attachedInstance))
+ }
+ >
+ <Square size={14} className="mr-2 shrink-0" aria-hidden="true" />
+ {t('rightSidebar.iosSimulator.stopDevice')}
+ </DropdownMenuItem>
+ ) : (
+ <DropdownMenuItem
+ disabled={busy}
+ onSelect={() =>
+ void call('start', 'start_instance', routeFor(attachedInstance))
+ }
+ >
+ <Play size={14} className="mr-2 shrink-0" aria-hidden="true" />
+ {t('rightSidebar.iosSimulator.startDevice')}
+ </DropdownMenuItem>
+ )}
+ <DropdownMenuItem
+ disabled={busy}
+ onSelect={() =>
+ void call('detach', 'detach_device', routeFor(attachedInstance))
+ }
+ >
+ <Link2Off size={14} className="mr-2 shrink-0" aria-hidden="true" />
+ {t('rightSidebar.iosSimulator.detachDevice')}
+ </DropdownMenuItem>
+ {attachedInstance.creationProvenance === 'cindy' && (
+ <DropdownMenuItem
+ disabled={busy}
+ onSelect={() => setDeleteTarget(attachedInstance)}
+ className="text-[var(--error-fg)] focus:bg-[var(--error-bg)] focus:text-[var(--error-fg-strong)]"
+ >
+ <Trash2 size={14} className="mr-2 shrink-0" aria-hidden="true" />
+ {t('rightSidebar.iosSimulator.deleteDevice')}
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
</div>
- <span className="shrink-0 select-none rounded-full bg-[var(--surface-chip)] px-2 py-1 text-10 text-[var(--text-secondary)]">
- {t(`rightSidebar.iosSimulator.lifecycle.${attachedInstance.lifecycleState}`)}
- </span>
</div>
{attachedInstance.lifecycleState === 'ready' &&
@@ -1939,163 +2405,142 @@ export function IOSSimulatorTabBody({
{attachedInstance.lifecycleState === 'ready' && (
<>
- <div className="mt-3 flex items-center justify-between gap-2 text-11">
- <span className="text-[var(--text-secondary)]">
- {t('rightSidebar.iosSimulator.streamProfile')}
+ <div role="status" aria-live="polite" className="sr-only">
+ <span>
+ <span>{streamRouteLabel}</span>
+ {!streamRouteStateRedundant && <span>{streamRouteStateLabel}</span>}
</span>
- <select
- value={streamProfile}
- disabled={busy}
- onChange={(event) =>
- void applyStreamProfile(event.target.value as StreamProfileName)
- }
- aria-label={t('rightSidebar.iosSimulator.streamProfile')}
- className="h-8 rounded-full border border-[var(--border-default)] bg-[var(--surface)] px-3 text-11 text-[var(--text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]"
- >
- <option value="low">
- {t('rightSidebar.iosSimulator.streamProfiles.low')}
- </option>
- <option value="balanced">
+ <span>
+ <span>{inputRouteLabel}</span>
+ {!inputRouteStateRedundant && <span>{inputRouteStateLabel}</span>}
+ </span>
+ {routeStatus?.input.adapter === 'native-sidecar' &&
+ !routeStatus.input.multiTouch && (
+ <span>{t('rightSidebar.iosSimulator.route.multiTouchUnavailable')}</span>
+ )}
+ </div>
+ {nativeRecoveryEligible && (
+ <div className="mt-2 flex items-center justify-between gap-2 rounded-lg bg-[var(--surface-subtle)] px-2.5 py-2 text-10 text-[var(--text-secondary)]">
+ <span
+ role={nativeRecoveryFailed ? 'alert' : undefined}
+ aria-live={nativeRecoveryFailed ? 'assertive' : 'polite'}
+ className="min-w-0 text-pretty leading-relaxed"
+ >
{t(
- nativeH264Active
- ? 'rightSidebar.iosSimulator.streamProfiles.balancedNative'
- : 'rightSidebar.iosSimulator.streamProfiles.balanced',
+ nativeRecoveryPending
+ ? 'rightSidebar.iosSimulator.nativeRecovery.recovering'
+ : nativeRecoveryFailed
+ ? 'rightSidebar.iosSimulator.nativeRecovery.failed'
+ : 'rightSidebar.iosSimulator.nativeRecovery.available',
)}
- </option>
- <option value="high">
- {t(
- nativeH264Active
- ? 'rightSidebar.iosSimulator.streamProfiles.highNative'
- : 'rightSidebar.iosSimulator.streamProfiles.high',
+ </span>
+ <ActionButton
+ label={t(
+ nativeRecoveryPending
+ ? 'rightSidebar.iosSimulator.nativeRecovery.recoveringAction'
+ : 'rightSidebar.iosSimulator.nativeRecovery.action',
)}
- </option>
- {showExperimental60 && (
- <option value="experimental60">
- {t('rightSidebar.iosSimulator.streamProfiles.experimental60')}
- </option>
- )}
- </select>
- </div>
+ icon={nativeRecoveryPending ? Loader2 : RefreshCw}
+ spinning={nativeRecoveryPending}
+ disabled={nativeRecoveryPending || !viewerReadyToken || controlPaused}
+ onClick={() => void retryNativeRoute()}
+ />
+ </div>
+ )}
<div
- role="status"
- aria-live="polite"
- className="mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-10 text-[var(--text-secondary)] select-none"
+ ref={viewerSlotRef}
+ data-testid="ios-simulator-screen-slot"
+ className="mt-3 flex min-h-48 w-full items-center justify-center"
>
- <span>{streamRouteLabel}</span>
- <span aria-hidden="true">·</span>
- <span>{streamRouteStateLabel}</span>
- <span aria-hidden="true">·</span>
- <span>{inputRouteLabel}</span>
- <span aria-hidden="true">·</span>
- <span>{inputRouteStateLabel}</span>
- {routeStatus?.input.adapter === 'native-sidecar' &&
- !routeStatus.input.multiTouch && (
- <>
- <span aria-hidden="true">·</span>
- <span>
- {t('rightSidebar.iosSimulator.route.multiTouchUnavailable')}
- </span>
- </>
+ <div
+ data-testid="ios-simulator-screen"
+ className={cn(
+ 'overflow-hidden bg-[var(--surface)] [corner-shape:squircle]',
+ fittedScreenSize ? null : 'w-full',
)}
- {isRecoverableNativeFallback(routeStatus) && (
- <>
- <span aria-hidden="true">·</span>
- <span
- role={nativeRecoveryFailed ? 'alert' : undefined}
- aria-live={nativeRecoveryFailed ? 'assertive' : 'polite'}
- className="text-pretty leading-relaxed"
- >
- {t(
- nativeRecoveryPending
- ? 'rightSidebar.iosSimulator.nativeRecovery.recovering'
- : nativeRecoveryFailed
- ? 'rightSidebar.iosSimulator.nativeRecovery.failed'
- : 'rightSidebar.iosSimulator.nativeRecovery.available',
- )}
- </span>
- <ActionButton
- label={t(
- nativeRecoveryPending
- ? 'rightSidebar.iosSimulator.nativeRecovery.recoveringAction'
- : 'rightSidebar.iosSimulator.nativeRecovery.action',
- )}
- icon={nativeRecoveryPending ? Loader2 : RefreshCw}
- spinning={nativeRecoveryPending}
- disabled={nativeRecoveryPending || !viewerReadyToken || controlPaused}
- onClick={() => void retryNativeRoute()}
- />
- </>
- )}
- </div>
- <div className="mt-3 overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface)]">
- <div className="relative flex min-h-48 items-center justify-center p-2">
- {frameUrl && presentationMatchesRoute && (
- <img
- src={frameUrl}
- alt={t('rightSidebar.iosSimulator.streamAlt', {
+ style={{
+ ...screenCornerStyle,
+ ...(fittedScreenSize
+ ? {
+ width: fittedScreenSize.width,
+ height: fittedScreenSize.height,
+ }
+ : null),
+ }}
+ >
+ <div
+ className={cn(
+ 'relative flex h-full w-full items-center justify-center',
+ fittedScreenSize ? null : 'min-h-48',
+ )}
+ >
+ {frameUrl && presentationMatchesRoute && (
+ <img
+ src={frameUrl}
+ alt={t('rightSidebar.iosSimulator.streamAlt', {
+ device: attachedInstance.simulatorName,
+ })}
+ title={t('rightSidebar.iosSimulator.gestureHint')}
+ className={cn(
+ 'block w-full touch-none select-none object-contain',
+ fittedScreenSize ? 'h-full' : 'h-auto',
+ framePresentation === 'jpeg' ? null : 'hidden',
+ busy
+ ? 'cursor-wait opacity-80'
+ : !viewerInteractive
+ ? 'pointer-events-none cursor-default opacity-80'
+ : null,
+ )}
+ draggable={false}
+ onPointerDown={onViewerPointerDown}
+ onPointerMove={onViewerPointerMove}
+ onPointerUp={onViewerPointerUp}
+ onPointerCancel={onViewerPointerCancel}
+ onLostPointerCapture={onViewerLostPointerCapture}
+ />
+ )}
+ <canvas
+ ref={h264CanvasRef}
+ role="img"
+ aria-label={t('rightSidebar.iosSimulator.streamAlt', {
device: attachedInstance.simulatorName,
})}
+ aria-hidden={
+ !(presentationMatchesRoute && framePresentation === 'h264')
+ }
title={t('rightSidebar.iosSimulator.gestureHint')}
className={cn(
- 'block h-auto w-full touch-none select-none object-contain',
- framePresentation === 'jpeg' ? null : 'hidden',
+ 'block w-full touch-none select-none object-contain',
+ fittedScreenSize ? 'h-full' : 'h-auto',
+ presentationMatchesRoute && framePresentation === 'h264'
+ ? null
+ : 'hidden',
busy
? 'cursor-wait opacity-80'
: !viewerInteractive
? 'pointer-events-none cursor-default opacity-80'
- : 'cursor-crosshair',
+ : null,
)}
- draggable={false}
onPointerDown={onViewerPointerDown}
onPointerMove={onViewerPointerMove}
onPointerUp={onViewerPointerUp}
onPointerCancel={onViewerPointerCancel}
onLostPointerCapture={onViewerLostPointerCapture}
/>
- )}
- <canvas
- ref={h264CanvasRef}
- role="img"
- aria-label={t('rightSidebar.iosSimulator.streamAlt', {
- device: attachedInstance.simulatorName,
- })}
- aria-hidden={!(presentationMatchesRoute && framePresentation === 'h264')}
- title={t('rightSidebar.iosSimulator.gestureHint')}
- className={cn(
- 'block h-auto w-full touch-none select-none object-contain',
- presentationMatchesRoute && framePresentation === 'h264'
- ? null
- : 'hidden',
- busy
- ? 'cursor-wait opacity-80'
- : !viewerInteractive
- ? 'pointer-events-none cursor-default opacity-80'
- : 'cursor-crosshair',
+ {!presentationMatchesRoute && (
+ <div className="flex flex-col items-center gap-2 p-8 text-center text-11 text-[var(--text-secondary)]">
+ <Smartphone size={22} aria-hidden="true" />
+ <span className="text-pretty">
+ {t('rightSidebar.iosSimulator.waitingForFrame')}
+ </span>
+ </div>
)}
- onPointerDown={onViewerPointerDown}
- onPointerMove={onViewerPointerMove}
- onPointerUp={onViewerPointerUp}
- onPointerCancel={onViewerPointerCancel}
- onLostPointerCapture={onViewerLostPointerCapture}
- />
- {!presentationMatchesRoute && (
- <div className="flex flex-col items-center gap-2 p-8 text-center text-11 text-[var(--text-secondary)]">
- <Smartphone size={22} aria-hidden="true" />
- <span className="text-pretty">
- {t('rightSidebar.iosSimulator.waitingForFrame')}
- </span>
- </div>
- )}
- <span className="absolute right-2 top-2 rounded-full bg-[var(--surface-chip)] px-2 py-1 text-10 tabular-nums text-[var(--text-secondary)]">
- {streamFps.toFixed(1)} FPS
- {viewport ? ` · ${viewport.width}×${viewport.height}` : ''} ·{' '}
- {t(`rightSidebar.iosSimulator.stream.${streamState}`)}
- </span>
+ </div>
</div>
</div>
- <div className="mt-2 flex flex-wrap items-center gap-2">
- <div className="relative min-w-48 flex-1">
+ <div className="mt-2 flex items-center gap-2">
+ <div className="relative min-w-0 flex-1">
<Keyboard
size={13}
className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-secondary)]"
@@ -2120,41 +2565,17 @@ export function IOSSimulatorTabBody({
className="h-8 w-full rounded-full border border-[var(--border-default)] bg-[var(--surface)] pl-8 pr-3 text-11 text-[var(--text-primary)] placeholder:text-[var(--text-placeholder)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] disabled:opacity-50"
/>
</div>
- <ActionButton
+ <SimulatorIconButton
label={t('rightSidebar.iosSimulator.sendText')}
+ disabledLabel={t(
+ !viewerInteractive
+ ? 'rightSidebar.iosSimulator.controlsUnavailable'
+ : 'rightSidebar.iosSimulator.enterTextBeforeSending',
+ )}
icon={Send}
disabled={!viewerInteractive || !textInput}
onClick={() => void sendTextInput()}
/>
- <ActionButton
- label={t('rightSidebar.iosSimulator.pressHome')}
- icon={House}
- disabled={!viewerInteractive}
- onClick={() => void runInteraction('press_home', {})}
- />
- <ActionButton
- label={t('rightSidebar.iosSimulator.rotateDevice')}
- icon={RotateCw}
- disabled={!viewerInteractive || !viewport}
- onClick={() =>
- void runInteraction('set_orientation', {
- orientation:
- viewport?.orientation === 'LANDSCAPE' ? 'PORTRAIT' : 'LANDSCAPE',
- })
- }
- />
- <ActionButton
- label={t('rightSidebar.iosSimulator.lockScreen')}
- icon={LockKeyhole}
- disabled={!viewerInteractive}
- onClick={() => void runInteraction('lock_screen', {})}
- />
- <ActionButton
- label={t('rightSidebar.iosSimulator.unlockScreen')}
- icon={UnlockKeyhole}
- disabled={!viewerInteractive}
- onClick={() => void runInteraction('unlock_screen', {})}
- />
</div>
<p className="mt-2 text-pretty text-10 leading-relaxed text-[var(--text-secondary)]">
{t('rightSidebar.iosSimulator.gestureHint')}
@@ -2184,40 +2605,6 @@ export function IOSSimulatorTabBody({
</div>
)}
- <div className="mt-3 flex flex-wrap gap-2">
- {attachedInstance.lifecycleState === 'ready' ? (
- <ActionButton
- label={t('rightSidebar.iosSimulator.stopDevice')}
- icon={Square}
- disabled={busy}
- onClick={() => void call('stop', 'stop_instance', routeFor(attachedInstance))}
- />
- ) : (
- <ActionButton
- label={t('rightSidebar.iosSimulator.startDevice')}
- icon={Play}
- disabled={busy}
- onClick={() =>
- void call('start', 'start_instance', routeFor(attachedInstance))
- }
- />
- )}
- <ActionButton
- label={t('rightSidebar.iosSimulator.detachDevice')}
- icon={Link2Off}
- disabled={busy}
- onClick={() => void call('detach', 'detach_device', routeFor(attachedInstance))}
- />
- {attachedInstance.creationProvenance === 'cindy' && (
- <ActionButton
- label={t('rightSidebar.iosSimulator.deleteDevice')}
- icon={Trash2}
- disabled={busy}
- onClick={() => setDeleteTarget(attachedInstance)}
- />
- )}
- </div>
-
{attachedInstance.lifecycleState === 'ready' && (
<div className="mt-3 flex items-center justify-between gap-3 border-t border-[var(--border-default)] pt-3">
<div className="min-w-0">
@@ -2523,6 +2910,65 @@ function ActionButton({
);
}
+function SimulatorIconButton({
+ label,
+ disabledLabel,
+ icon: Icon,
+ disabled,
+ spinning,
+ onClick,
+}: {
+ label: string;
+ disabledLabel?: string;
+ icon: typeof AlertTriangle;
+ disabled?: boolean;
+ spinning?: boolean;
+ onClick(): void;
+}) {
+ const accessibleLabel = disabled && disabledLabel ? `${label} — ${disabledLabel}` : label;
+ const button = (
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={disabled}
+ aria-label={accessibleLabel}
+ aria-hidden={disabled ? true : undefined}
+ aria-busy={spinning || undefined}
+ className={cn(
+ 'inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-[var(--border-default)] bg-[var(--surface)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
+ disabled
+ ? 'text-[var(--text-tertiary)] opacity-50'
+ : 'text-[var(--text-secondary)] hover:bg-[var(--surface-hover)] hover:text-[var(--text-primary)]',
+ )}
+ >
+ <span
+ className={cn('inline-flex', spinning && 'animate-spin motion-reduce:animate-none')}
+ aria-hidden="true"
+ >
+ <Icon size={14} />
+ </span>
+ </button>
+ );
+
+ return (
+ <Tip text={accessibleLabel} side="bottom">
+ {disabled ? (
+ <span
+ role="button"
+ aria-disabled="true"
+ aria-label={accessibleLabel}
+ tabIndex={0}
+ className="inline-flex rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]"
+ >
+ {button}
+ </span>
+ ) : (
+ button
+ )}
+ </Tip>
+ );
+}
+
function StatusCard({
icon: Icon,
title,
diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/__tests__/IOSSimulatorTabBody.test.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/__tests__/IOSSimulatorTabBody.test.tsx
index 7b7d835610..d8c83d1f3c 100644
--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/__tests__/IOSSimulatorTabBody.test.tsx
+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/__tests__/IOSSimulatorTabBody.test.tsx
@@ -23,7 +23,10 @@ vi.mock('react-i18next', () => ({
useTranslation: () => ({ t: (key: string) => key }),
}));
-import { IOSSimulatorTabBody, setupStepKeys } from '../IOSSimulatorTabBody';
+const toastMocks = vi.hoisted(() => ({ success: vi.fn(), error: vi.fn() }));
+vi.mock('@/lib/toast', () => ({ toast: toastMocks }));
+
+import { fitSimulatorScreenSize, IOSSimulatorTabBody, setupStepKeys } from '../IOSSimulatorTabBody';
const ctx: TabKindHostContext = {
tabId: 'tab-a',
@@ -270,6 +273,7 @@ function installStatus(statusValue: IOSSimulatorSessionStatus) {
ok: true,
data: { stream: null },
}));
+ const copyScreenshot = vi.fn(async () => ({ ok: true as const }));
(
window as unknown as {
electronAPI: {
@@ -282,6 +286,7 @@ function installStatus(statusValue: IOSSimulatorSessionStatus) {
setViewerVisibility: typeof setViewerVisibility;
retryNativeRoute: typeof retryNativeRoute;
latestFrame: typeof latestFrame;
+ copyScreenshot: typeof copyScreenshot;
setStreamProfile: typeof setStreamProfile;
liveTouch: typeof liveTouch;
onH264Frame: typeof onH264Frame;
@@ -301,6 +306,7 @@ function installStatus(statusValue: IOSSimulatorSessionStatus) {
setViewerVisibility,
retryNativeRoute,
latestFrame,
+ copyScreenshot,
setStreamProfile,
liveTouch,
onH264Frame,
@@ -317,6 +323,7 @@ function installStatus(statusValue: IOSSimulatorSessionStatus) {
setViewerVisibility,
retryNativeRoute,
latestFrame,
+ copyScreenshot,
setStreamProfile,
liveTouch,
onH264Frame,
@@ -337,7 +344,28 @@ function installStatus(statusValue: IOSSimulatorSessionStatus) {
};
}
+async function openMoreControls(): Promise<void> {
+ const trigger = await screen.findByRole('button', {
+ name: 'rightSidebar.iosSimulator.moreControls',
+ });
+ fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false });
+ await screen.findByRole('menu');
+}
+
+async function openStreamProfileControls(): Promise<void> {
+ await openMoreControls();
+ const trigger = await screen.findByRole('menuitem', {
+ name: 'rightSidebar.iosSimulator.streamProfile',
+ });
+ fireEvent.keyDown(trigger, { key: 'ArrowRight' });
+ await screen.findByRole('menuitemradio', {
+ name: 'rightSidebar.iosSimulator.streamProfiles.low',
+ });
+}
+
beforeEach(() => {
+ toastMocks.success.mockReset();
+ toastMocks.error.mockReset();
let objectUrlSequence = 0;
Object.defineProperty(URL, 'createObjectURL', {
configurable: true,
@@ -375,6 +403,132 @@ afterEach(() => {
});
describe('IOSSimulatorTabBody', () => {
+ it('fits the simulator viewport within both available width and panel height', () => {
+ expect(fitSimulatorScreenSize({ width: 400, height: 800 }, 700, 900)).toEqual({
+ width: 450,
+ height: 900,
+ });
+ expect(fitSimulatorScreenSize({ width: 400, height: 800 }, 300, 900)).toEqual({
+ width: 300,
+ height: 600,
+ });
+ expect(fitSimulatorScreenSize({ width: 800, height: 400 }, 700, 900)).toEqual({
+ width: 700,
+ height: 350,
+ });
+ expect(fitSimulatorScreenSize({ width: 0, height: 800 }, 700, 900)).toBeNull();
+ });
+
+ it('fits only the device header and screen within the panel height', async () => {
+ const instance = readyInstance();
+ const api = installStatus(readyStatus(instance));
+ api.setViewerVisibility.mockResolvedValue(streamingJpegResult());
+ api.latestFrame.mockResolvedValue(streamingJpegResult());
+ vi.stubGlobal(
+ 'requestAnimationFrame',
+ vi.fn((callback: FrameRequestCallback) => {
+ queueMicrotask(() => callback(0));
+ return 1;
+ }),
+ );
+ vi.stubGlobal('cancelAnimationFrame', vi.fn());
+
+ render(
+ <IOSSimulatorTabBody
+ state={{ instanceId: instance.instanceId }}
+ ctx={ctx}
+ active
+ shellVisible
+ />,
+ );
+
+ await screen.findByRole('img', {
+ name: 'rightSidebar.iosSimulator.streamAlt',
+ });
+ const panel = screen.getByTestId('ios-simulator-panel-viewport');
+ const section = screen.getByTestId('ios-simulator-viewer-section');
+ const slot = screen.getByTestId('ios-simulator-screen-slot');
+ const simulatorScreen = screen.getByTestId('ios-simulator-screen');
+ let slotWidth = 700;
+ Object.defineProperty(panel, 'clientHeight', { configurable: true, value: 1_000 });
+ Object.defineProperty(slot, 'clientWidth', {
+ configurable: true,
+ get: () => slotWidth,
+ });
+ vi.spyOn(section, 'getBoundingClientRect').mockReturnValue({
+ top: 80,
+ bottom: 980,
+ } as DOMRect);
+ vi.spyOn(slot, 'getBoundingClientRect').mockImplementation(
+ () =>
+ ({
+ top: 150,
+ bottom: 850,
+ width: slotWidth,
+ }) as DOMRect,
+ );
+
+ fireEvent(window, new Event('resize'));
+ await waitFor(() => {
+ expect(Number.parseFloat(simulatorScreen.style.height)).toBeCloseTo(930);
+ expect(Number.parseFloat(simulatorScreen.style.width)).toBeCloseTo(429.01, 1);
+ });
+
+ slotWidth = 250;
+ fireEvent(window, new Event('resize'));
+ await waitFor(() => {
+ expect(Number.parseFloat(simulatorScreen.style.width)).toBeCloseTo(250);
+ expect(Number.parseFloat(simulatorScreen.style.height)).toBeCloseTo(541.98, 1);
+ });
+ });
+
+ it('copies a screenshot for the exact attached simulator route', async () => {
+ const instance = readyInstance();
+ const api = installStatus(readyStatus(instance));
+ let finishCopy!: () => void;
+ const copyPending = new Promise<void>((resolve) => {
+ finishCopy = resolve;
+ });
+ api.copyScreenshot.mockImplementationOnce(async () => {
+ await copyPending;
+ return { ok: true as const };
+ });
+
+ render(
+ <IOSSimulatorTabBody
+ state={{ instanceId: instance.instanceId }}
+ ctx={ctx}
+ active
+ shellVisible
+ />,
+ );
+
+ fireEvent.click(
+ await screen.findByRole('button', {
+ name: 'rightSidebar.iosSimulator.copyScreenshot',
+ }),
+ );
+
+ await waitFor(() => {
+ expect(api.copyScreenshot).toHaveBeenCalledWith({
+ sessionId: 'session-a',
+ instanceId: instance.instanceId,
+ generation: instance.generation,
+ leaseId: instance.lease.id,
+ });
+ });
+ expect(screen.queryByText('rightSidebar.iosSimulator.operations.screenshot')).toBeNull();
+ const loadingButton = document.querySelector<HTMLButtonElement>('button[aria-busy="true"]');
+ expect(loadingButton).toBeTruthy();
+ expect(loadingButton?.querySelector('.animate-spin')).toBeTruthy();
+
+ await act(async () => finishCopy());
+ await waitFor(() => {
+ expect(toastMocks.success).toHaveBeenCalledWith('rightSidebar.iosSimulator.screenshotCopied');
+ });
+ expect(toastMocks.error).not.toHaveBeenCalled();
+ });
+
it('keeps Viewer status visible while control waits for renewed authorization', async () => {
const pausedStatus = readyStatus();
if (!pausedStatus.ok) throw new Error('Expected a ready simulator status.');
@@ -385,13 +539,16 @@ describe('IOSSimulatorTabBody', () => {
await screen.findByText('rightSidebar.iosSimulator.accessRequiredTitle');
expect(screen.getByText('iPhone 17 Pro')).toBeTruthy();
+ await openMoreControls();
expect(
- (
- screen.getByRole('combobox', {
+ screen
+ .getByRole('menuitem', {
name: 'rightSidebar.iosSimulator.streamProfile',
- }) as HTMLSelectElement
- ).disabled,
- ).toBe(true);
+ })
+ .getAttribute('data-disabled'),
+ ).not.toBeNull();
+ fireEvent.keyDown(screen.getByRole('menu'), { key: 'Escape' });
+ await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
expect(api.requestAccess).not.toHaveBeenCalled();
api.requestAccess.mockImplementationOnce(async () => {
api.setStatusValue({ ...pausedStatus, controlAccess: 'active' });
@@ -553,7 +710,7 @@ describe('IOSSimulatorTabBody', () => {
platform: 'darwin',
supported: true,
ready: true,
- xcodeVersion: 'Xcode 26.4',
+ xcodeVersion: 'Xcode 26.4\nBuild version 17E192',
runtimes: [],
devices: [
{
@@ -577,6 +734,10 @@ describe('IOSSimulatorTabBody', () => {
render(<IOSSimulatorTabBody state={{ instanceId: null }} ctx={ctx} />);
await waitFor(() => expect(screen.getByText('iPhone 17 Pro')).toBeTruthy());
+ const environmentReady = screen.getByText('rightSidebar.iosSimulator.readyTitle');
+ expect(environmentReady.parentElement?.textContent).toContain('Xcode 26.4');
+ expect(screen.getAllByText('rightSidebar.iosSimulator.readyTitle')).toHaveLength(1);
+ expect(screen.queryByText('Build version 17E192')).toBeNull();
expect(screen.getByText(/iOS 26\.4 · Booted/)).toBeTruthy();
expect(screen.getByText('DEVICE-UDID-123')).toBeTruthy();
expect(api.status).toHaveBeenCalledWith({ sessionId: 'session-a' });
@@ -757,7 +918,7 @@ describe('IOSSimulatorTabBody', () => {
expect(screen.getByText('rightSidebar.iosSimulator.route.nativeH264')).toBeTruthy();
expect(screen.getByText('rightSidebar.iosSimulator.route.wdaInput')).toBeTruthy();
expect(screen.getByText('rightSidebar.iosSimulator.route.state.active')).toBeTruthy();
- expect(screen.getByText('rightSidebar.iosSimulator.route.state.fallback')).toBeTruthy();
+ expect(screen.queryByText('rightSidebar.iosSimulator.route.state.fallback')).toBeNull();
});
expect(api.onRouteStatus).toHaveBeenCalledOnce();
@@ -802,6 +963,32 @@ describe('IOSSimulatorTabBody', () => {
await waitFor(() => expect(api.status).toHaveBeenCalledTimes(2));
expect(screen.getByText('rightSidebar.iosSimulator.route.wdaJpeg')).toBeTruthy();
expect(screen.getByText('rightSidebar.iosSimulator.route.nativeHid')).toBeTruthy();
+
+ act(() => {
+ api.emitRouteStatus({
+ ...initialRouteStatus,
+ updatedAt: '2026-08-05T00:00:02.000Z',
+ stream: {
+ adapter: 'wda',
+ encoding: 'jpeg',
+ state: 'active',
+ reasonCode: 'wda-active',
+ },
+ input: {
+ adapter: 'wda',
+ state: 'fallback',
+ continuous: false,
+ multiTouch: false,
+ reasonCode: 'native-capability-unavailable',
+ },
+ });
+ });
+ await waitFor(() => {
+ expect(screen.getByText('rightSidebar.iosSimulator.route.wdaJpeg')).toBeTruthy();
+ expect(screen.getByText('rightSidebar.iosSimulator.route.wdaInput')).toBeTruthy();
+ expect(screen.queryByText('rightSidebar.iosSimulator.route.state.active')).toBeNull();
+ expect(screen.queryByText('rightSidebar.iosSimulator.route.state.fallback')).toBeNull();
+ });
});
it('offers 60 FPS only for active Native H.264 and keeps a 20 FPS WDA fallback', async () => {
@@ -852,28 +1039,32 @@ describe('IOSSimulatorTabBody', () => {
/>,
);
- const profileSelect = await screen.findByRole('combobox');
await waitFor(() => expect(rendered.container.querySelector('img')).toBeTruthy());
+ await openStreamProfileControls();
expect(
- screen.queryByRole('option', {
+ screen.queryByRole('menuitemradio', {
name: 'rightSidebar.iosSimulator.streamProfiles.experimental60',
}),
).toBeNull();
act(() => api.emitRouteStatus(nativeRouteStatus));
await waitFor(() => {
expect(
- screen.getByRole('option', {
+ screen.getByRole('menuitemradio', {
name: 'rightSidebar.iosSimulator.streamProfiles.highNative',
}),
).toBeTruthy();
expect(
- screen.getByRole('option', {
+ screen.getByRole('menuitemradio', {
name: 'rightSidebar.iosSimulator.streamProfiles.experimental60',
}),
).toBeTruthy();
});
- fireEvent.change(profileSelect, { target: { value: 'high' } });
+ fireEvent.click(
+ screen.getByRole('menuitemradio', {
+ name: 'rightSidebar.iosSimulator.streamProfiles.highNative',
+ }),
+ );
await waitFor(() => {
expect(api.setStreamProfile).toHaveBeenCalledWith({
sessionId: 'session-a',
@@ -886,7 +1077,12 @@ describe('IOSSimulatorTabBody', () => {
});
});
- fireEvent.change(profileSelect, { target: { value: 'experimental60' } });
+ await openStreamProfileControls();
+ fireEvent.click(
+ screen.getByRole('menuitemradio', {
+ name: 'rightSidebar.iosSimulator.streamProfiles.experimental60',
+ }),
+ );
await waitFor(() => {
expect(api.setStreamProfile).toHaveBeenCalledWith({
sessionId: 'session-a',
@@ -934,12 +1130,6 @@ describe('IOSSimulatorTabBody', () => {
});
await waitFor(() => {
- expect(
- screen.queryByRole('option', {
- name: 'rightSidebar.iosSimulator.streamProfiles.experimental60',
- }),
- ).toBeNull();
- expect((profileSelect as HTMLSelectElement).value).toBe('high');
expect(api.setStreamProfile).toHaveBeenLastCalledWith({
sessionId: 'session-a',
instanceId: instance.instanceId,
@@ -949,6 +1139,49 @@ describe('IOSSimulatorTabBody', () => {
profile: { framesPerSecond: 20, jpegQuality: 70, scalingPercent: 100 },
});
});
+ await openStreamProfileControls();
+ expect(
+ screen.queryByRole('menuitemradio', {
+ name: 'rightSidebar.iosSimulator.streamProfiles.experimental60',
+ }),
+ ).toBeNull();
+ expect(
+ screen
+ .getByRole('menuitemradio', {
+ name: 'rightSidebar.iosSimulator.streamProfiles.high',
+ })
+ .getAttribute('aria-checked'),
+ ).toBe('true');
+ });
+
+ it('shows stream metrics beside the ready state without covering the viewer or changing its cursor', async () => {
+ const api = installStatus(
+ readyStatus({
+ ...readyInstance(),
+ deviceTypeIdentifier: 'com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro',
+ }),
+ );
+ api.setViewerVisibility.mockResolvedValue(streamingJpegResult());
+ api.latestFrame.mockResolvedValue(streamingJpegResult());
+
+ const rendered = render(
+ <IOSSimulatorTabBody state={{ instanceId: 'instance-a' }} ctx={ctx} active shellVisible />,
+ );
+
+ const metrics = await screen.findByText('0.0 FPS · 393×852');
+ expect(metrics.textContent).not.toContain('rightSidebar.iosSimulator.stream.streaming');
+ const lifecycle = screen.getByText('rightSidebar.iosSimulator.lifecycle.ready');
+ expect(lifecycle.parentElement).toBe(metrics.parentElement);
+ await waitFor(() => expect(rendered.container.querySelector('img')).toBeTruthy());
+ const image = rendered.container.querySelector('img');
+ const canvas = rendered.container.querySelector('canvas');
+ const simulatorScreen = screen.getByTestId('ios-simulator-screen');
+ expect(image?.parentElement?.textContent).not.toContain('FPS');
+ expect(image?.classList.contains('cursor-crosshair')).toBe(false);
+ expect(canvas?.classList.contains('cursor-crosshair')).toBe(false);
+ expect(simulatorScreen.style.borderRadius).toBe('21.06% / 9.71%');
+ expect(simulatorScreen.classList.contains('border')).toBe(false);
+ expect(simulatorScreen.firstElementChild?.classList.contains('p-2')).toBe(false);
});
it('waits for the exact viewer claim before applying its stream profile', async () => {
@@ -1070,7 +1303,12 @@ describe('IOSSimulatorTabBody', () => {
);
expect(api.latestFrame).toHaveBeenCalled();
});
- fireEvent.change(screen.getByRole('combobox'), { target: { value: 'high' } });
+ await openStreamProfileControls();
+ fireEvent.click(
+ screen.getByRole('menuitemradio', {
+ name: 'rightSidebar.iosSimulator.streamProfiles.high',
+ }),
+ );
await waitFor(() => {
expect(api.setStreamProfile).toHaveBeenCalledWith(
expect.objectContaining({
@@ -1674,7 +1912,7 @@ describe('IOSSimulatorTabBody', () => {
});
await waitFor(() => expect(rendered.container.querySelector('img')).toBeTruthy());
const image = rendered.container.querySelector('img');
- expect(image?.className).toContain('w-full');
+ expect(screen.getByTestId('ios-simulator-screen-slot').className).toContain('justify-center');
expect(image?.className).not.toContain('max-h-[520px]');
const textInput = screen.getByLabelText(
'rightSidebar.iosSimulator.textInputLabel',
@@ -2114,11 +2352,8 @@ describe('IOSSimulatorTabBody', () => {
});
expect(rendered.container.querySelector('img')).toBeNull();
expect(
- (
- screen.getByRole('button', {
- name: 'rightSidebar.iosSimulator.pressHome',
- }) as HTMLButtonElement
- ).disabled,
+ (rendered.container.querySelector('.lucide-house')?.closest('button') as HTMLButtonElement)
+ .disabled,
).toBe(true);
});
@@ -2159,7 +2394,10 @@ describe('IOSSimulatorTabBody', () => {
act(() => expireFreshness?.());
- expect(homeButton.disabled).toBe(true);
+ expect(
+ (rendered.container.querySelector('.lucide-house')?.closest('button') as HTMLButtonElement)
+ .disabled,
+ ).toBe(true);
});
it('clears the last frame and keeps only recovery actions after an external shutdown', async () => {
@@ -2256,20 +2494,21 @@ describe('IOSSimulatorTabBody', () => {
expect(screen.getByText('rightSidebar.iosSimulator.viewerStoppedDescription')).toBeTruthy();
});
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:ios-simulator-1');
+ await openMoreControls();
expect(
- screen.getByRole('button', { name: 'rightSidebar.iosSimulator.startDevice' }),
+ screen.getByRole('menuitem', { name: 'rightSidebar.iosSimulator.startDevice' }),
).toBeTruthy();
expect(
- screen.getByRole('button', { name: 'rightSidebar.iosSimulator.detachDevice' }),
+ screen.getByRole('menuitem', { name: 'rightSidebar.iosSimulator.detachDevice' }),
).toBeTruthy();
expect(
- screen.queryByRole('button', { name: 'rightSidebar.iosSimulator.deleteDevice' }),
+ screen.queryByRole('menuitem', { name: 'rightSidebar.iosSimulator.deleteDevice' }),
).toBeNull();
expect(
screen.queryByRole('button', { name: 'rightSidebar.iosSimulator.pressHome' }),
).toBeNull();
expect(
- screen.queryByRole('button', { name: 'rightSidebar.iosSimulator.stopDevice' }),
+ screen.queryByRole('menuitem', { name: 'rightSidebar.iosSimulator.stopDevice' }),
).toBeNull();
expect(screen.queryByText('rightSidebar.iosSimulator.agentControlTitle')).toBeNull();
});
@@ -2286,9 +2525,12 @@ describe('IOSSimulatorTabBody', () => {
render(<IOSSimulatorTabBody state={{ instanceId: instance.instanceId }} ctx={ctx} />);
- const deleteButton = await screen.findByRole('button', {
+ await openMoreControls();
+ const deleteButton = await screen.findByRole('menuitem', {
name: 'rightSidebar.iosSimulator.deleteDevice',
});
+ expect(deleteButton.className).toContain('text-[var(--error-fg)]');
+ expect(deleteButton.className).toContain('focus:bg-[var(--error-bg)]');
fireEvent.click(deleteButton);
expect(screen.getByText('rightSidebar.iosSimulator.deleteDeviceConfirmTitle')).toBeTruthy();
expect(
@@ -2326,8 +2568,9 @@ describe('IOSSimulatorTabBody', () => {
render(<IOSSimulatorTabBody state={{ instanceId: instance.instanceId }} ctx={ctx} />);
+ await openMoreControls();
fireEvent.click(
- await screen.findByRole('button', {
+ await screen.findByRole('menuitem', {
name: 'rightSidebar.iosSimulator.deleteDevice',
}),
);
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 3734626ad5..bc0a3097cc 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -6143,6 +6143,10 @@
"rotateDevice": "Rotate Device",
"lockScreen": "Lock Screen",
"unlockScreen": "Unlock Screen",
+ "copyScreenshot": "Copy Screenshot",
+ "screenshotCopied": "Simulator screenshot copied",
+ "screenshotCopyFailed": "Couldn't copy the simulator screenshot. Try again.",
+ "moreControls": "More Simulator Controls",
"controlsUnavailable": "Simulator controls are temporarily unavailable",
"enterTextBeforeSending": "Enter text before sending",
"agentBusyTitle": "Agent Using This Device",
@@ -6178,7 +6182,7 @@
}
},
"nativeRecovery": {
- "available": "Native acceleration is unavailable. WDA stays active while you try again.",
+ "available": "Native acceleration is unavailable. Frame rates may drop and controls may respond more slowly.",
"action": "Restore Native",
"recovering": "Restoring Native acceleration. The current WDA view and controls stay active.",
"recoveringAction": "Restoring Native…",
@@ -6205,7 +6209,8 @@
"stop": "Stopping device…",
"detach": "Detaching device…",
"grant": "Updating Agent control…",
- "control": "Updating input control…"
+ "control": "Updating input control…",
+ "screenshot": "Copying simulator screenshot…"
},
"setup": {
"localMac": "Open this project in a local Cindy session on a Mac.",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 3ed2c2e6e0..29b9cbc572 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -6141,6 +6141,10 @@
"rotateDevice": "デバイスを回転",
"lockScreen": "画面をロック",
"unlockScreen": "画面をロック解除",
+ "copyScreenshot": "スクリーンショットをコピー",
+ "screenshotCopied": "シミュレータのスクリーンショットをコピーしました",
+ "screenshotCopyFailed": "シミュレータのスクリーンショットをコピーできませんでした。もう一度お試しください。",
+ "moreControls": "その他のシミュレータ操作",
"controlsUnavailable": "シミュレータの操作は一時的に使用できません",
"enterTextBeforeSending": "送信するテキストを入力してください",
"agentBusyTitle": "Agent がこのデバイスを使用中",
@@ -6176,7 +6180,7 @@
}
},
"nativeRecovery": {
- "available": "Native アクセラレーションは現在利用できません。再試行中も WDA の画面と操作は利用できます。",
+ "available": "Native アクセラレーションは現在利用できません。フレームレートが低下し、操作の反応が遅くなる場合があります。",
"action": "Native を復旧",
"recovering": "Native アクセラレーションを復旧しています。現在の WDA の画面と操作は引き続き利用できます。",
"recoveringAction": "Native を復旧中…",
@@ -6203,7 +6207,8 @@
"stop": "デバイスを停止中…",
"detach": "デバイスを切断中…",
"grant": "Agent の操作権限を更新中…",
- "control": "入力制御を更新中…"
+ "control": "入力制御を更新中…",
+ "screenshot": "シミュレータのスクリーンショットをコピー中…"
},
"setup": {
"localMac": "Mac のローカル Cindy セッションでこのプロジェクトを開いてください。",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 3daa757567..250a8475c2 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -6141,6 +6141,10 @@
"rotateDevice": "기기 회전",
"lockScreen": "화면 잠금",
"unlockScreen": "화면 잠금 해제",
+ "copyScreenshot": "스크린샷 복사",
+ "screenshotCopied": "시뮬레이터 스크린샷을 복사했습니다",
+ "screenshotCopyFailed": "시뮬레이터 스크린샷을 복사하지 못했습니다. 다시 시도하세요.",
+ "moreControls": "추가 시뮬레이터 제어",
"controlsUnavailable": "시뮬레이터 제어를 일시적으로 사용할 수 없습니다",
"enterTextBeforeSending": "보낼 텍스트를 먼저 입력하세요",
"agentBusyTitle": "Agent가 이 기기를 사용 중",
@@ -6176,7 +6180,7 @@
}
},
"nativeRecovery": {
- "available": "현재 Native 가속을 사용할 수 없습니다. 다시 시도하는 동안에도 WDA 화면과 제어는 계속 사용할 수 있습니다.",
+ "available": "현재 Native 가속을 사용할 수 없습니다. 프레임 속도가 낮아지고 조작 반응이 느려질 수 있습니다.",
"action": "Native 복구 시도",
"recovering": "Native 가속을 복구하는 중입니다. 현재 WDA 화면과 제어는 계속 사용할 수 있습니다.",
"recoveringAction": "Native 복구 중…",
@@ -6203,7 +6207,8 @@
"stop": "기기 중지 중…",
"detach": "기기 연결 해제 중…",
"grant": "Agent 제어 권한 업데이트 중…",
- "control": "입력 제어 업데이트 중…"
+ "control": "입력 제어 업데이트 중…",
+ "screenshot": "시뮬레이터 스크린샷 복사 중…"
},
"setup": {
"localMac": "Mac의 로컬 Cindy 세션에서 이 프로젝트를 여세요.",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index a8c0aa6186..8b10b15c37 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -6141,6 +6141,10 @@
"rotateDevice": "旋转设备",
"lockScreen": "锁定屏幕",
"unlockScreen": "解锁屏幕",
+ "copyScreenshot": "复制截图",
+ "screenshotCopied": "模拟器截图已复制",
+ "screenshotCopyFailed": "无法复制模拟器截图,请稍后重试",
+ "moreControls": "更多模拟器控制",
"controlsUnavailable": "模拟器控制暂时不可用",
"enterTextBeforeSending": "请先输入要发送的文本",
"agentBusyTitle": "Agent 正在使用此设备",
@@ -6176,7 +6180,7 @@
}
},
"nativeRecovery": {
- "available": "Native 加速当前不可用。重试期间,WDA 画面和控制会保持可用。",
+ "available": "Native 加速当前不可用,画面帧率可能降低,操作延迟可能升高。",
"action": "尝试恢复 Native",
"recovering": "正在恢复 Native 加速,当前 WDA 画面和控制会保持可用。",
"recoveringAction": "正在恢复 Native…",
@@ -6203,7 +6207,8 @@
"stop": "正在停止设备…",
"detach": "正在断开设备…",
"grant": "正在更新 Agent 控制权限…",
- "control": "正在更新输入控制…"
+ "control": "正在更新输入控制…",
+ "screenshot": "正在复制模拟器截图…"
},
"setup": {
"localMac": "请在 Mac 上的本地 Cindy 任务中打开此项目。",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 3a1d2af044..26138881b8 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -6141,6 +6141,10 @@
"rotateDevice": "旋轉裝置",
"lockScreen": "鎖定螢幕",
"unlockScreen": "解鎖螢幕",
+ "copyScreenshot": "複製截圖",
+ "screenshotCopied": "模擬器截圖已複製",
+ "screenshotCopyFailed": "無法複製模擬器截圖,請稍後再試",
+ "moreControls": "更多模擬器控制",
"controlsUnavailable": "模擬器控制暫時不可用",
"enterTextBeforeSending": "請先輸入要傳送的文字",
"agentBusyTitle": "Agent 正在使用此裝置",
@@ -6176,7 +6180,7 @@
}
},
"nativeRecovery": {
- "available": "Native 加速目前無法使用。重試期間,WDA 畫面和控制會保持可用。",
+ "available": "Native 加速目前無法使用,畫面幀率可能降低,操作延遲可能升高。",
"action": "嘗試恢復 Native",
"recovering": "正在恢復 Native 加速,目前的 WDA 畫面和控制會保持可用。",
"recoveringAction": "正在恢復 Native…",
@@ -6203,7 +6207,8 @@
"stop": "正在停止裝置…",
"detach": "正在中斷連線裝置…",
"grant": "正在更新 Agent 控制權限…",
- "control": "正在更新輸入控制…"
+ "control": "正在更新輸入控制…",
+ "screenshot": "正在複製模擬器截圖…"
},
"setup": {
"localMac": "請在 Mac 上的本地 Cindy 任務中開啟此專案。",
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index 5805ce161a..bb8af90319 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -34,6 +34,10 @@ type IOSSimulatorSessionStatus = import('../shared/iosSimulatorIpc').IOSSimulato
type IOSSimulatorAccessRequest = import('../shared/iosSimulatorIpc').IOSSimulatorAccessRequest;
type IOSSimulatorAccessRequestResult =
import('../shared/iosSimulatorIpc').IOSSimulatorAccessRequestResult;
+type IOSSimulatorCopyScreenshotRequest =
+ import('../shared/iosSimulatorIpc').IOSSimulatorCopyScreenshotRequest;
+type IOSSimulatorCopyScreenshotResult =
+ import('../shared/iosSimulatorIpc').IOSSimulatorCopyScreenshotResult;
type IOSSimulatorStatusRequest = import('../shared/iosSimulatorIpc').IOSSimulatorStatusRequest;
type IOSSimulatorToolRequest = import('../shared/iosSimulatorIpc').IOSSimulatorToolRequest;
type IOSSimulatorToolResponse = import('../shared/iosSimulatorIpc').IOSSimulatorToolResponse;
@@ -6369,6 +6373,9 @@ interface ElectronAPI {
request: IOSSimulatorRetryNativeRouteRequest,
) => Promise<IOSSimulatorToolResponse>;
latestFrame: (request: IOSSimulatorViewerRouteRequest) => Promise<IOSSimulatorToolResponse>;
+ copyScreenshot: (
+ request: IOSSimulatorCopyScreenshotRequest,
+ ) => Promise<IOSSimulatorCopyScreenshotResult>;
setStreamProfile: (
request: IOSSimulatorStreamProfileRequest,
) => Promise<IOSSimulatorToolResponse>;
diff --git a/apps/desktop/src/shared/iosSimulatorIpc.ts b/apps/desktop/src/shared/iosSimulatorIpc.ts
index ecd1c9c157..782c0f3837 100644
--- a/apps/desktop/src/shared/iosSimulatorIpc.ts
+++ b/apps/desktop/src/shared/iosSimulatorIpc.ts
@@ -185,6 +185,12 @@ export interface IOSSimulatorViewerRouteRequest {
leaseId: string;
}
+export type IOSSimulatorCopyScreenshotRequest = IOSSimulatorViewerRouteRequest;
+
+export interface IOSSimulatorCopyScreenshotResult {
+ ok: true;
+}
+
export interface IOSSimulatorViewerVisibilityRequest extends IOSSimulatorViewerRouteRequest {
visible: boolean;
/** Identifies one renderer effect lifetime so a stale close cannot stop its replacement. */
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index fa8198b774..4b823fcc18 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -9,7 +9,7 @@
本区块由 `scripts/design-inventory.mjs` 生成,请勿手改。
重新生成:`pnpm design:inventory`;校验:`pnpm check:design-inventory`。
-计数快照日期:2026-09-02。生成命令:`pnpm design:inventory`。裸颜色匹配与 `scripts/hardcoded-color-audit.mjs` 共用 `scripts/shared/hardcoded-color-match.mjs`(HEX / rgb() / rgba() / hsl() / hsla()),台账统计层额外剔除 `var()` 包装与注释(TS/TSX 剥块注释与整行注释)——语义 token 消费与注释引用不是迁移债务;裸圆角为粗粒度(`rounded*` class、`border-radius:` 与 React style 对象的 `borderRadius:`)。Token 计数为样式源里 `var(--token)` / `hsl(var(--token)` 的去重 ID 数。
+计数快照日期:2026-09-03。生成命令:`pnpm design:inventory`。裸颜色匹配与 `scripts/hardcoded-color-audit.mjs` 共用 `scripts/shared/hardcoded-color-match.mjs`(HEX / rgb() / rgba() / hsl() / hsla()),台账统计层额外剔除 `var()` 包装与注释(TS/TSX 剥块注释与整行注释)——语义 token 消费与注释引用不是迁移债务;裸圆角为粗粒度(`rounded*` class、`border-radius:` 与 React style 对象的 `borderRadius:`)。Token 计数为样式源里 `var(--token)` / `hsl(var(--token)` 的去重 ID 数。
登记 surface 数:34。平台本轮仅 Desktop。
@@ -38,7 +38,7 @@
| `desktop.plugins.app-main` | desktop | 插件主视图 | hash `/apps/:ghostId`(GhostMainViewFeatureLayout) | GhostMainViewFeatureLayout, GhostMainViewHost | apps/desktop/src/renderer/features/plugin/GhostMainViewFeatureLayout.tsx, apps/desktop/src/renderer/features/plugin/GhostMainViewHost.tsx | 0 | 0 | 0 |
| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 49 | 0 | 81 |
| `desktop.settings` | desktop | 设置 | hash `/settings`(SettingsView;tab 含 general / personalization / providers / billing / usage / voice-input / im-bot / shortcuts / agent-island / import / remote-control / ghosts / builtin-tools / computer-use / help / about) | SettingsView | apps/desktop/src/renderer/components/settings/AboutSection.tsx, apps/desktop/src/renderer/components/settings/AccountDeletionSection.tsx, apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx, apps/desktop/src/renderer/components/settings/AgentIslandSection.tsx, apps/desktop/src/renderer/components/settings/AgentResourceSection.tsx, apps/desktop/src/renderer/components/settings/AppearanceSection.tsx, apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx, apps/desktop/src/renderer/components/settings/BetaChannelCell.tsx, apps/desktop/src/renderer/components/settings/BrowserBackendSubsection.tsx, apps/desktop/src/renderer/components/settings/BrowserRealProfileSubsection.tsx, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.tsx, apps/desktop/src/renderer/components/settings/ChatEmbeddingCell.tsx, apps/desktop/src/renderer/components/settings/ChipMetricsSection.tsx, apps/desktop/src/renderer/components/settings/CollaborationSection.tsx, apps/desktop/src/renderer/components/settings/CompactionSection.tsx, apps/desktop/src/renderer/components/settings/ComposerSendShortcutSection.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx, apps/desktop/src/renderer/components/settings/ComputerUseSection.tsx, apps/desktop/src/renderer/components/settings/CustomProviderDialog.tsx, apps/desktop/src/renderer/components/settings/CustomProviderRuntimeFillOverlay.tsx, apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx, apps/desktop/src/renderer/components/settings/DingTalkBotSection.tsx, apps/desktop/src/renderer/components/settings/DiscordBotSection.tsx, apps/desktop/src/renderer/components/settings/DownloadMeter.tsx, apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotNotificationSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotSection.tsx, apps/desktop/src/renderer/components/settings/FontFamilyPicker.tsx, apps/desktop/src/renderer/components/settings/GenericGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/GitSafetySection.tsx, apps/desktop/src/renderer/components/settings/HelpAssistantPanel.tsx, apps/desktop/src/renderer/components/settings/HelpSection.tsx, apps/desktop/src/renderer/components/settings/HelpThreadView.tsx, apps/desktop/src/renderer/components/settings/HookConnectionsSection.tsx, apps/desktop/src/renderer/components/settings/HookWorkspacePrefsEditor.tsx, apps/desktop/src/renderer/components/settings/ImBotSection.tsx, apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx, apps/desktop/src/renderer/components/settings/ImDefaultSettingsSection.tsx, apps/desktop/src/renderer/components/settings/ImLifecycleAnnouncementSection.tsx, apps/desktop/src/renderer/components/settings/InputDeviceConnectionStatus.tsx, apps/desktop/src/renderer/components/settings/JoyConGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx, apps/desktop/src/renderer/components/settings/LanguageSection.tsx, apps/desktop/src/renderer/components/settings/LayoutResetControl.tsx, apps/desktop/src/renderer/components/settings/LinkOpenSection.tsx, apps/desktop/src/renderer/components/settings/LocalOllamaInstall.tsx, apps/desktop/src/renderer/components/settings/LocalPackagingTag.tsx, apps/desktop/src/renderer/components/settings/LogoutSection.tsx, apps/desktop/src/renderer/components/settings/LspBetaCell.tsx, apps/desktop/src/renderer/components/settings/McpServerDialog.tsx, apps/desktop/src/renderer/components/settings/McpServersSection.tsx, apps/desktop/src/renderer/components/settings/MemorySection.tsx, apps/desktop/src/renderer/components/settings/MessageNavRailCell.tsx, apps/desktop/src/renderer/components/settings/ModelPriceOverrideDialog.tsx, apps/desktop/src/renderer/components/settings/MyDevicesPanel.tsx, apps/desktop/src/renderer/components/settings/NotificationSection.tsx, apps/desktop/src/renderer/components/settings/OAuthDeviceCodeCard.tsx, apps/desktop/src/renderer/components/settings/OllamaProviderDetail.tsx, apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx, apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/ProfileEditDialog.tsx, apps/desktop/src/renderer/components/settings/ProvidersSection.tsx, apps/desktop/src/renderer/components/settings/RemoteControlSection.tsx, apps/desktop/src/renderer/components/settings/RemoteHostDetail.tsx, apps/desktop/src/renderer/components/settings/RemoteSection.tsx, apps/desktop/src/renderer/components/settings/SessionImportSection.tsx, apps/desktop/src/renderer/components/settings/SessionRuntimeFallbackCell.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.tsx, apps/desktop/src/renderer/components/settings/SettingsSidebarNav.tsx, apps/desktop/src/renderer/components/settings/SettingsTextInput.tsx, apps/desktop/src/renderer/components/settings/SettingsView.tsx, apps/desktop/src/renderer/components/settings/SilentEncryptedRetryCell.tsx, apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx, apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx, apps/desktop/src/renderer/components/settings/StreamFadeSection.tsx, apps/desktop/src/renderer/components/settings/SubagentModelSection.tsx, apps/desktop/src/renderer/components/settings/SwitchProGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/TelegramBehaviorSettings.tsx, apps/desktop/src/renderer/components/settings/TelegramBotSection.tsx, apps/desktop/src/renderer/components/settings/TelegramRemoteDevices.tsx, apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx, apps/desktop/src/renderer/components/settings/TipsSection.tsx, apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx, apps/desktop/src/renderer/components/settings/UserProfileCard.tsx, apps/desktop/src/renderer/components/settings/UserPromptSection.tsx, apps/desktop/src/renderer/components/settings/VisionBridgeSection.tsx, apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx, apps/desktop/src/renderer/components/settings/WechatBotSection.tsx, apps/desktop/src/renderer/components/settings/WecomBotSection.tsx, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeyboardLayout.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeycapGlyphs.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx, apps/desktop/src/renderer/components/settings/XUsageGuide.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx, apps/desktop/src/renderer/components/settings/androidStatusPresentation.ts, apps/desktop/src/renderer/components/settings/billingVisibility.ts, apps/desktop/src/renderer/components/settings/browserOpenForLoginError.ts, apps/desktop/src/renderer/components/settings/computerPermissionFlow.ts, apps/desktop/src/renderer/components/settings/contacts/ContactDetailPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsImportDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsListPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsManagerDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsSection.tsx, apps/desktop/src/renderer/components/settings/contacts/startContactsAiSession.ts, apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts, apps/desktop/src/renderer/components/settings/feishuBotPresentation.ts, apps/desktop/src/renderer/components/settings/fontFamilyValue.ts, apps/desktop/src/renderer/components/settings/gamepadLayoutPrimitives.tsx, apps/desktop/src/renderer/components/settings/gamepadSilhouetteGeom.ts, apps/desktop/src/renderer/components/settings/hookWorkspacePrefsLogic.ts, apps/desktop/src/renderer/components/settings/imBotVisibility.ts, apps/desktop/src/renderer/components/settings/imDefaultSettingsLogic.ts, apps/desktop/src/renderer/components/settings/joyConSilhouette.ts, apps/desktop/src/renderer/components/settings/myDevicesModel.ts, apps/desktop/src/renderer/components/settings/providerAssetModule.ts, apps/desktop/src/renderer/components/settings/realProfilePermissionGuide.ts, apps/desktop/src/renderer/components/settings/switchProSilhouette.ts, apps/desktop/src/renderer/components/settings/ultimateC1Silhouette.ts, apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx, apps/desktop/src/renderer/components/settings/usage/UsageStatRow.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTokenBars.tsx, apps/desktop/src/renderer/components/settings/usage/formatUsagePercent.ts, apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts, apps/desktop/src/renderer/components/settings/usageVisibility.ts, apps/desktop/src/renderer/components/settings/wizardRecommend.ts, apps/desktop/src/renderer/components/settings/workLouderCodexCommandCopy.ts, apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts, apps/desktop/src/renderer/styles/sortable.css | 143 | 121 | 721 |
-| `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/globals.css | 144 | 72 | 282 |
+| `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/globals.css | 145 | 72 | 286 |
| `desktop.skillhub.local` | desktop | SkillHub 本地技能 | hash `/skillhub/local` 及详情 `/skillhub/local/:kind/global/:name`、`/skillhub/local/:kind/project/:projectHash/:name` | InstallTargetPicker, PluginManagementLayout, SkillhubDetailView, SkillhubFeatureLayout, SkillhubHomeView, SkillhubMarketPreviewPanel | apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubFeatureLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketPreviewPanel.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx | 41 | 0 | 71 |
| `desktop.skillhub.market` | desktop | SkillHub 市场 | hash `/skillhub/market`(SkillhubMarketListView) | InstallTargetPicker, MarketCard, MarketInfoEditDialog, SkillhubMarketListView, SkillhubMarketPreviewPanel, VisibilityEditorDialog | apps/desktop/src/renderer/features/skillhub/SkillhubMarketListView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketPreviewPanel.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketInfoEditDialog.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketPreviewTree.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillIcon.tsx, apps/desktop/src/renderer/features/skillhub/components/TeamScopePicker.tsx, apps/desktop/src/renderer/features/skillhub/components/VisibilityEditorDialog.tsx | 43 | 0 | 51 |
| `desktop.window.computer-permission-guide` | desktop | 电脑使用权限引导 | `?view=computer-permission-guide` → ComputerPermissionGuideWindow;backdrop 同文件 | ComputerPermissionBackdrop, ComputerPermissionGuideWindow | apps/desktop/src/main/computer-permission-guide/MacComputerPermissionGuideNativeHost.ts, apps/desktop/src/main/computer-permission-guide/placement.ts, apps/desktop/src/main/computer-permission-guide/request.ts, apps/desktop/src/main/computer-permission-guide/switch-target.ts, apps/desktop/src/main/computer-permission-guide/window.ts, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx | 7 | 2 | 9 |
@@ -46,7 +46,7 @@
| `desktop.window.resource-usage` | desktop | 资源用量窗口 | `?resourceUsageWindow=1` → renderer/resource-usage-entry.tsx(不走 router.tsx) | ResourceUsageWindowLayout, ResourceUsageWindowRoot | apps/desktop/src/main/resource-usage-window/controller.ts, apps/desktop/src/main/resource-usage-window/ipc.ts, apps/desktop/src/main/resource-usage-window/open-sender.ts, apps/desktop/src/main/resource-usage-window/registry.ts, apps/desktop/src/main/resource-usage-window/window.ts, apps/desktop/src/renderer/components/resource-usage/ResourceUsageWindowLayout.tsx, apps/desktop/src/renderer/resource-usage-entry.tsx, apps/desktop/src/renderer/styles/globals.css | 59 | 64 | 14 |
| `desktop.window.review-artifact-confirm` | desktop | Review 成果确认窗 | main/reviewer/reviewArtifactConfirmWindow.ts 内联 HTML/CSS(不走 renderer 路由) | reviewArtifactConfirmWindow | apps/desktop/src/main/reviewer/reviewArtifactConfirmWindow.ts | 8 | 18 | 2 |
| `desktop.window.session-drag-preview` | desktop | 会话拖拽预览 | main/session-drag-preview.ts 透明预览窗 | session-drag-preview | apps/desktop/src/main/session-drag-preview.ts | 0 | 1 | 0 |
-| `desktop.window.sidebar` | desktop | 右侧栏独立窗口 | `?sidebarWindow=1` → renderer/sidebar-window-entry.tsx;hash `/sidebar-window` | RightSidebar, RightSidebarShell, SidebarWindowLayout | apps/desktop/src/main/right-sidebar-window/controller.ts, apps/desktop/src/main/right-sidebar-window/ipc.ts, apps/desktop/src/main/right-sidebar-window/registry.ts, apps/desktop/src/main/right-sidebar-window/resolveHostContext.ts, apps/desktop/src/main/right-sidebar-window/settings-store.ts, apps/desktop/src/main/right-sidebar-window/window.ts, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/sidebar-window-entry.tsx, apps/desktop/src/renderer/styles/globals.css | 99 | 71 | 193 |
+| `desktop.window.sidebar` | desktop | 右侧栏独立窗口 | `?sidebarWindow=1` → renderer/sidebar-window-entry.tsx;hash `/sidebar-window` | RightSidebar, RightSidebarShell, SidebarWindowLayout | apps/desktop/src/main/right-sidebar-window/controller.ts, apps/desktop/src/main/right-sidebar-window/ipc.ts, apps/desktop/src/main/right-sidebar-window/registry.ts, apps/desktop/src/main/right-sidebar-window/resolveHostContext.ts, apps/desktop/src/main/right-sidebar-window/settings-store.ts, apps/desktop/src/main/right-sidebar-window/window.ts, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/sidebar-window-entry.tsx, apps/desktop/src/renderer/styles/globals.css | 100 | 71 | 197 |
| `desktop.window.voice-dictionary-toast` | desktop | 语音词典 Toast 窗 | `?view=voice-input-dictionary-toast` → main-entry.tsx → VoiceInputDictionaryToast | VoiceInputDictionaryToast | apps/desktop/src/renderer/voice-input/VoiceInputDictionaryToast.tsx | 8 | 0 | 3 |
| `desktop.window.voice-overlay` | desktop | 语音输入浮窗 | `?view=voice-input-overlay` → main-entry.tsx → VoiceInputOverlay | VoiceInputOverlay, VoiceInputStatusNotice | apps/desktop/src/main/voice-input/global.ts, apps/desktop/src/renderer/styles/globals.css, apps/desktop/src/renderer/voice-input/VoiceInputOverlay.tsx, apps/desktop/src/renderer/voice-input/VoiceInputStatusNotice.tsx | 67 | 64 | 25 |
diff --git a/packages/ios-simulator-runtime/src/driver.ts b/packages/ios-simulator-runtime/src/driver.ts
index f8fdc8ef5d..204a9ed2d8 100644
--- a/packages/ios-simulator-runtime/src/driver.ts
+++ b/packages/ios-simulator-runtime/src/driver.ts
@@ -282,7 +282,7 @@ export interface IOSSimulatorDiscreteInputDriver extends IOSSimulatorDriverAdapt
text: string,
signal?: AbortSignal,
): Promise<void>;
- home(signal?: AbortSignal): Promise<void>;
+ home(sessionId: string, signal?: AbortSignal): Promise<void>;
lock(sessionId?: string, signal?: AbortSignal): Promise<void>;
unlock(sessionId?: string, signal?: AbortSignal): Promise<void>;
setOrientation(
diff --git a/packages/ios-simulator-runtime/src/wda/client.test.ts b/packages/ios-simulator-runtime/src/wda/client.test.ts
index 827ebf9b4d..fa58581051 100644
--- a/packages/ios-simulator-runtime/src/wda/client.test.ts
+++ b/packages/ios-simulator-runtime/src/wda/client.test.ts
@@ -97,6 +97,7 @@ describe("WdaClient", () => {
await client.tap("SESSION-1", { x: 10, y: 20 });
await client.swipe("SESSION-1", { x: 1, y: 2 }, { x: 3, y: 4 }, 250);
await client.typeText("SESSION-1", "Hi");
+ await client.home("SESSION-1");
await client.lock("SESSION-1");
await client.unlock("SESSION-1");
await client.configureStream("SESSION-1", {
@@ -109,12 +110,15 @@ describe("WdaClient", () => {
"http://127.0.0.1:8100/session/SESSION-1/actions",
"http://127.0.0.1:8100/session/SESSION-1/actions",
"http://127.0.0.1:8100/session/SESSION-1/wda/keys",
+ "http://127.0.0.1:8100/session/SESSION-1/wda/pressButton",
"http://127.0.0.1:8100/session/SESSION-1/wda/lock",
"http://127.0.0.1:8100/session/SESSION-1/wda/unlock",
"http://127.0.0.1:8100/session/SESSION-1/appium/settings",
]);
const typeBody = JSON.parse(String(fetch.mock.calls[2]?.[1]?.body));
expect(typeBody).toEqual({ value: ["H", "i"] });
+ const homeBody = JSON.parse(String(fetch.mock.calls[3]?.[1]?.body));
+ expect(homeBody).toEqual({ name: "home" });
});
it("classifies an app-level rotation refusal without marking WDA unavailable", async () => {
diff --git a/packages/ios-simulator-runtime/src/wda/client.ts b/packages/ios-simulator-runtime/src/wda/client.ts
index d89d2645cf..f5dae6eaa4 100644
--- a/packages/ios-simulator-runtime/src/wda/client.ts
+++ b/packages/ios-simulator-runtime/src/wda/client.ts
@@ -528,10 +528,10 @@ export class WdaClient implements IOSSimulatorAutomationDriver {
);
}
- async home(signal?: AbortSignal): Promise<void> {
+ async home(sessionId: string, signal?: AbortSignal): Promise<void> {
await this.#request(
- "/wda/homescreen",
- { method: "POST", body: "{}" },
+ `/session/${requireSessionId(sessionId)}/wda/pressButton`,
+ { method: "POST", body: JSON.stringify({ name: "home" }) },
signal,
);
}