Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): report staged updates without refetching
Cindy5ea07fc0a367
diff --git a/apps/desktop/src/main/__tests__/updateService.test.ts b/apps/desktop/src/main/__tests__/updateService.test.tsindex fe5a502902..fedaaa0b23 100644--- a/apps/desktop/src/main/__tests__/updateService.test.ts+++ b/apps/desktop/src/main/__tests__/updateService.test.ts@@ -347,6 +347,32 @@ describe('agent-facing managed app update check', () => {}});+ it('reports an already staged update while offline or when the manifest changes', async () => {+ fetchManifest.mockResolvedValue(updateManifest());+ download.mockImplementation(async ({ targetPath }: { targetPath: string }) => {+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });+ fs.writeFileSync(targetPath, 'update');+ return { path: targetPath, size: 123 };+ });+ const service = await freshUpdateService('darwin');+ try {+ expect(await service.checkForUpdate()).toBe('ready');+ expect(download).toHaveBeenCalledTimes(1);+ fetchManifest.mockResolvedValueOnce(null).mockResolvedValue(updateManifest('0.0.64'));+ for (let i = 0; i < 2; i += 1) {+ expect(await service.checkAppUpdateForAgent()).toMatchObject({+ status: 'ready', currentVersion: '0.0.64', targetVersion: '0.0.65',+ });+ }+ expect(fetchManifest).toHaveBeenCalledTimes(1);+ expect(download).toHaveBeenCalledTimes(1);+ expect(spawnProcess).not.toHaveBeenCalled();+ expect(appQuit).not.toHaveBeenCalled();+ } finally {+ service.stopUpdateService();+ }+ });+it('rejects a translocated macOS app without staging a patch', async () => {fetchManifest.mockResolvedValue(updateManifest());const service = await freshUpdateService('darwin');diff --git a/apps/desktop/src/main/updateService.ts b/apps/desktop/src/main/updateService.tsindex ffa0c3310d..4f23950a28 100644--- a/apps/desktop/src/main/updateService.ts+++ b/apps/desktop/src/main/updateService.ts@@ -2114,6 +2114,9 @@ export async function checkAppUpdateForAgent(): Promise<{if (currentStatus === 'downloading' || currentStatus === 'superseding') {return { status: 'downloading', currentVersion, targetVersion: readyVersion };}+ if (currentStatus === 'ready' && readyVersion) {+ return { status: 'ready', currentVersion, targetVersion: readyVersion };+ }// An Agent check must not stage a patch: checkForUpdate() downloads it and// enables the existing auto-relaunch-on-idle path. Read only the manifest;// the user can download and install through the built-in update action.