Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(remote-desktop): preserve known diagnostic error codes
Dash0976516e77ad
diff --git a/apps/desktop/src/main/remote-desktop-viewer/__tests__/windows.test.ts b/apps/desktop/src/main/remote-desktop-viewer/__tests__/windows.test.tsindex 8c29a5fd5c..0bbf222074 100644--- a/apps/desktop/src/main/remote-desktop-viewer/__tests__/windows.test.ts+++ b/apps/desktop/src/main/remote-desktop-viewer/__tests__/windows.test.ts@@ -124,7 +124,12 @@ afterEach(() => {const event = (win: any) => ({ sender: win.webContents, senderFrame: win.webContents.mainFrame });const call = (channel: string, win: any, ...args: unknown[]) =>fixture.handlers.get(channel)!(event(win), ...args);-it('records signaling and peer state on a failed request without leaking its payload', async () => {+it.each([+ ['DESKTOP_LEASE_EXPIRED', 'DESKTOP_LEASE_EXPIRED', 'DESKTOP_LEASE_EXPIRED'],+ ['DESKTOP_VIDEO_TIMEOUT', 'DESKTOP_VIDEO_TIMEOUT', 'DESKTOP_VIDEO_TIMEOUT'],+ ['DESKTOP_DISPLAY_MISSING', 'DESKTOP_DISPLAY_MISSING', 'DESKTOP_DISPLAY_MISSING'],+ ['DESKTOP_VIDEO_TIMEOUT private-text', 'UNKNOWN_ERROR', 'DESKTOP_UNAVAILABLE'],+])('records failed request %s without leaking its payload', async (error, code, exposedError) => {const sender: any = { id: 100 };manager = new RemoteDesktopViewerWindows((value) => value === sender);manager.register();@@ -134,21 +139,22 @@ it('records signaling and peer state on a failed request without leaking its paycall(REMOTE_VIEWER.PRESENTED, win);const { generation } = call(REMOTE_VIEWER.STATE, win);await call(REMOTE_VIEWER.REQUEST, win, generation, { op: 'start', displayId: 'screen' });- vi.mocked(remoteInvoke).mockRejectedValueOnce(new Error('DESKTOP_LEASE_EXPIRED'));+ vi.mocked(remoteInvoke).mockRejectedValueOnce(new Error(error));await expect(call(REMOTE_VIEWER.REQUEST, win, generation, { op: 'heartbeat', lease: 'lease-a' }),- ).rejects.toThrow('DESKTOP_LEASE_EXPIRED');+ ).rejects.toThrow(exposedError);expect(fixture.debug).toHaveBeenCalledWith('desktop request failed',expect.objectContaining({operation: 'heartbeat',- code: 'DESKTOP_LEASE_EXPIRED',+ code,signaling: 'online',peerUnresponsive: true,}),);expect(JSON.stringify(fixture.debug.mock.calls)).not.toContain('lease-a');expect(JSON.stringify(fixture.debug.mock.calls)).not.toContain('private computer');+ expect(JSON.stringify(fixture.debug.mock.calls)).not.toContain('private-text');});it.each(['resolve', 'reject'])(diff --git a/apps/desktop/src/shared/remoteDesktopDiagnostics.ts b/apps/desktop/src/shared/remoteDesktopDiagnostics.tsindex 2a7230c4c1..c44b312374 100644--- a/apps/desktop/src/shared/remoteDesktopDiagnostics.ts+++ b/apps/desktop/src/shared/remoteDesktopDiagnostics.ts@@ -35,6 +35,36 @@ const DIAGNOSTIC_CODES = new Set(['DESKTOP_DISABLED','DESKTOP_AUTHENTICATION_REQUIRED','DESKTOP_UNAVAILABLE',+ 'DESKTOP_ACCESSIBILITY_REQUIRED',+ 'DESKTOP_AUDIO_UNAVAILABLE',+ 'DESKTOP_CAPTURE_PENDING',+ 'DESKTOP_CLIPBOARD_BUSY',+ 'DESKTOP_CLIPBOARD_CHANGED',+ 'DESKTOP_CLIPBOARD_COPY_FAILED',+ 'DESKTOP_CLIPBOARD_INVALID',+ 'DESKTOP_CLIPBOARD_UNAVAILABLE',+ 'DESKTOP_CLIPBOARD_WRITE_FAILED',+ 'DESKTOP_DISPLAY_BUSY',+ 'DESKTOP_DISPLAY_MISSING',+ 'DESKTOP_DISPLAY_MODES_UNAVAILABLE',+ 'DESKTOP_DISPLAY_MODE_MISSING',+ 'DESKTOP_HANDOFF_ENDED',+ 'DESKTOP_HANDOFF_UNAVAILABLE',+ 'DESKTOP_HANDOFF_WINDOW_ONLY',+ 'DESKTOP_HOST_MUTE_UNAVAILABLE',+ 'DESKTOP_INPUT_PREPARING',+ 'DESKTOP_LOCKED',+ 'DESKTOP_LOCK_FAILED',+ 'DESKTOP_LOCK_UNAVAILABLE',+ 'DESKTOP_PERMISSIONS_UNAVAILABLE',+ 'DESKTOP_PRIVACY_UNAVAILABLE',+ 'DESKTOP_SCREEN_PERMISSION_REQUIRED',+ 'DESKTOP_SYSTEM_SERVICE_UNAVAILABLE',+ 'DESKTOP_VIDEO_BUSY',+ 'DESKTOP_VIDEO_STOPPED',+ 'DESKTOP_VIDEO_TIMEOUT',+ 'DESKTOP_VIDEO_UNAVAILABLE',+ 'DESKTOP_VIEWER_DISPLAY_UNAVAILABLE','INVOKE_TIMEOUT','BACKPRESSURE','DEVICE_LINK_BUSY',