Skip to content

armgit / cindy

Public Imported from GitHub
0

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

fix(device-link): preserve legacy queue edit fallback

DavidShenb4084af56b99
diff --git a/apps/desktop/src/main/device-link/__tests__/sessionReferenceCompatibility.test.ts b/apps/desktop/src/main/device-link/__tests__/sessionReferenceCompatibility.test.ts
index 856a5b3690..87b2cbe0d9 100644
--- a/apps/desktop/src/main/device-link/__tests__/sessionReferenceCompatibility.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/sessionReferenceCompatibility.test.ts
@@ -228,7 +228,7 @@ describe('device-link target session-reference capability gate', () => {
'client-1',
{ files: [{ path: '/controller/new.png' }] },
]),
- ).rejects.toThrow('[DEVICE_LINK_CHANNEL_NOT_ALLOWED]');
+ ).rejects.toMatchObject({ code: 'DEVICE_LINK_CHANNEL_NOT_ALLOWED' });
expect(rewriteMedia).not.toHaveBeenCalled();
expect(invoke).toHaveBeenCalledTimes(1);
});
diff --git a/apps/desktop/src/main/device-link/ipc.ts b/apps/desktop/src/main/device-link/ipc.ts
index 37e1888507..44620813c1 100644
--- a/apps/desktop/src/main/device-link/ipc.ts
+++ b/apps/desktop/src/main/device-link/ipc.ts
@@ -25,7 +25,7 @@ import {
import { serverApiFetch, ServerApiError } from '../serverApiClient';
import { requireString, throwIpcError } from '../utils/ipcValidate';
import { assertTrustedAppRendererEvent } from '../security/trustedAppRenderer';
-import type { IpcErrorCode } from '../../shared/ipc-errors';
+import { isIpcError, type IpcErrorCode } from '../../shared/ipc-errors';
import { decodeRemoteHistory } from '../../shared/remoteHistoryCache';
import {
DEVICE_LINK_INVOKE,
@@ -684,10 +684,13 @@ export async function handleInvoke(
}
callArgs = await withSharedTaskMedia(peer?.role === 'host' ? peer.sharedTaskId : undefined,
() => existing ? deps.rewriteOutboundMedia!(channel, callArgs, existing) : deps.rewriteOutboundMedia!(channel, callArgs));
- } catch (err) {
- throwIpcError(
- 'DEVICE_LINK_MEDIA_TRANSFER_FAILED',
- err instanceof Error ? err.message : String(err),
+ } catch (err) {
+ if (isIpcError(err) && err.code === 'DEVICE_LINK_CHANNEL_NOT_ALLOWED') {
+ throw err;
+ }
+ throwIpcError(
+ 'DEVICE_LINK_MEDIA_TRANSFER_FAILED',
+ err instanceof Error ? err.message : String(err),
);
}
assertControlTargetEnabled(deps, normalizedDeviceId);