Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(ios-simulator): surface live plugin status
JiangJiahaofbe4fadfabec
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.tsindex 9f078369ec..00c61c3c59 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/iosSimulatorHandlers.test.ts@@ -72,8 +72,8 @@ describe('iOS Simulator IPC handlers', () => {data: { reason: 'session-unavailable' },}),getSessionContext: async () => ({ workingDir: '/repo/session-a' }),- getViewerAccess: (_target, sessionId) => ({ sessionId, generation: 1 }),- hasViewerAccess: () => true,+ getViewerAccess: () => null,+ hasViewerAccess: () => false,getStatus,requestSessionAccess,});@@ -170,6 +170,8 @@ describe('iOS Simulator IPC handlers', () => {message: 'safe plugin gate message',data: { reason },}),+ getViewerAccess: () => null,+ hasViewerAccess: () => false,});await expect(@@ -179,6 +181,52 @@ describe('iOS Simulator IPC handlers', () => {).rejects.toMatchObject({ code });});+ it('still requires Viewer access for status when the plugin is available', async () => {+ const harness = new IpcHarness();+ const getPluginAccess = vi.fn(() => ({ allowed: true as const }));+ const getStatus = vi.fn();+ registerTrusted(harness, {+ getPluginAccess,+ getViewerAccess: () => null,+ hasViewerAccess: () => false,+ getStatus,+ });++ await expect(+ harness.invokeFrom(17, MAKER_INVOKE.IOS_SIMULATOR_STATUS, {+ sessionId: 'session-a',+ }),+ ).rejects.toMatchObject({ code: 'PERMISSION_DENIED' });+ expect(getPluginAccess).toHaveBeenCalledWith('/repo/session-a');+ expect(getStatus).not.toHaveBeenCalled();+ });++ it('does not expose plugin access for an unknown session', async () => {+ const harness = new IpcHarness();+ const getPluginAccess = vi.fn(() => ({+ allowed: false as const,+ errorCode: 'IOS_SIMULATOR_PLUGIN_DISABLED' as const,+ message: 'disabled',+ data: { reason: 'disabled' as const },+ }));+ const getStatus = vi.fn();+ registerTrusted(harness, {+ getSessionContext: async () => null,+ getPluginAccess,+ getViewerAccess: () => null,+ hasViewerAccess: () => false,+ getStatus,+ });++ await expect(+ harness.invokeFrom(17, MAKER_INVOKE.IOS_SIMULATOR_STATUS, {+ sessionId: 'missing-session',+ }),+ ).rejects.toMatchObject({ code: 'PERMISSION_DENIED' });+ expect(getPluginAccess).not.toHaveBeenCalled();+ expect(getStatus).not.toHaveBeenCalled();+ });+it('returns the explicit native confirmation result for a manual access request', async () => {const harness = new IpcHarness();let granted = false;diff --git a/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts b/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.tsindex 89f9fdd65a..4ececd3527 100644--- a/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts+++ b/apps/desktop/src/main/maker-ipc/iosSimulatorHandlers.ts@@ -381,6 +381,35 @@ export function registerIOSSimulatorHandlers(}});};+ const callIOSSimulatorHostForViewerStatus = <T>(+ event: unknown,+ sessionId: string,+ call: (assertCurrent: () => void) => T | Promise<T>,+ ): Promise<T> => {+ const sender = readSenderWebContents(event);+ let expectedAccess: IOSSimulatorRendererAccessSnapshot | null = null;+ return callIOSSimulatorHost(resolved, 'status', sessionId, call, () => {+ const currentAccess = resolved.getViewerAccess(sender, sessionId);+ if (!expectedAccess) {+ if (!currentAccess) {+ throwIpcError('PERMISSION_DENIED', 'iOS Simulator access is limited to the current task');+ }+ // Capture only after callIOSSimulatorHost has validated the live+ // plugin gate and owner scope. This lets a trusted panel surface the+ // plugin's concrete unavailable reason after plugin changes cleared+ // its grants, without weakening the Viewer boundary when the plugin+ // remains available.+ expectedAccess = currentAccess;+ return;+ }+ if (+ currentAccess?.sessionId !== expectedAccess.sessionId ||+ currentAccess.generation !== expectedAccess.generation+ ) {+ throwIpcError('PERMISSION_DENIED', 'iOS Simulator viewer access grant expired');+ }+ });+ };handle(MAKER_INVOKE.IOS_SIMULATOR_REQUEST_ACCESS, async (event, payload) => {const sessionId = readSessionId(payload);const sender = readSenderWebContents(event);@@ -397,8 +426,7 @@ export function registerIOSSimulatorHandlers(});handle(MAKER_INVOKE.IOS_SIMULATOR_STATUS, async (event, payload) => {const sessionId = readSessionId(payload);- assertSenderViewerSession(event, sessionId);- return callIOSSimulatorHostForViewerSession(event, sessionId, 'status', () =>+ return callIOSSimulatorHostForViewerStatus(event, sessionId, () =>resolved.getStatus(sessionId),);});