Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 为 Windows 更新器内置 VC++ Runtime 并阻断重试死循环 (#3697)
DavidShenXD36d25a46409b
diff --git a/.gitattributes b/.gitattributesindex 2dbd733eed..5960a042bb 100644--- a/.gitattributes+++ b/.gitattributes@@ -21,6 +21,9 @@ apps/desktop/native/sqlite-vec/**/*.so filter=lfs diff=lfs merge=lfs -text# cindy-updater.exe 不再进 git/LFS——Windows 打包的 prePackage 每次都从# apps/desktop/cindy-updater/ 现场 cargo build 并覆盖 resources/ 下的产物# (见 forge.config.ts buildCindyUpdater);路径已在 .gitignore 中排除。+# Windows updater 的两个 VC Runtime DLL 很小且必须让 release 构建完全离线可复现,+# 因此有意直接入 Git(不走 LFS);来源、版本和 sha256 见同目录 manifest.json。+apps/desktop/resources/cindy-updater-runtime/*.dll -text# Pencil 设计稿(加密二进制,体积大且改动频繁)—— 走 Git LFS*.pen filter=lfs diff=lfs merge=lfs -text# Vendored browser-control-runtime:由 scripts/browser-runtime/sync.mjs 从上游同步生成,非手写源码。diff --git a/apps/desktop/forge.config.ts b/apps/desktop/forge.config.tsindex 0f1398b21f..035872286f 100644--- a/apps/desktop/forge.config.ts+++ b/apps/desktop/forge.config.ts@@ -23,6 +23,10 @@ import { stageMacIOSSimulatorHelper } from './forge-ios-simulator-helper';import { stagePackagedThirdPartyNotices } from './forge-third-party-notices';import { READ_SHEET_RUNTIME_PACKAGES } from '../../packages/lizi-mcps/src/cindy-docs/readSheetRuntimeDeps';import { reviewPdfRuntimePackages } from './src/main/reviewer/reviewPdfRuntimeDeps';+import {+ validateBundledWindowsUpdaterRuntime,+ windowsUpdaterRuntimeExtraResourceForTarget,+} from './src/main/windowsUpdaterPrerequisites';const _require = createRequire(__filename);const DESKTOP_PACKAGE_VERSION = (_require('./package.json') as { version: string }).version;@@ -770,8 +774,13 @@ function extraResourcesForTarget(targetPlatform: string): string[] {'resources/THIRD-PARTY-RESTRICTED.txt',];- if (targetPlatform === 'win32') {- base.unshift(`resources/${UPDATER_EXE}`);+ const windowsUpdaterRuntimeResource =+ windowsUpdaterRuntimeExtraResourceForTarget(targetPlatform);+ if (windowsUpdaterRuntimeResource) {+ base.unshift(+ `resources/${UPDATER_EXE}`,+ windowsUpdaterRuntimeResource,+ );}if (targetPlatform === 'darwin' || targetPlatform === 'mas') {@@ -1487,6 +1496,17 @@ const config: ForgeConfig = {const targetArch = requestedTargetArch();ensureMacIOSSimulatorWdaArchive(platform);if (targetPlatform === 'win32') {+ if (targetArch !== 'x64') {+ throw new Error(+ `[forge] Windows updater app-local Runtime is x64-only; unsupported target arch: ${targetArch}`,+ );+ }+ const runtimeManifest = validateBundledWindowsUpdaterRuntime(+ path.join(__dirname, 'resources'),+ );+ console.log(+ `[forge:prePackage] verified Windows updater app-local Runtime ${runtimeManifest.version} x64`,+ );buildCindyUpdater();}stageRipgrep(targetPlatform, targetArch);diff --git a/apps/desktop/resources/THIRD-PARTY-RESTRICTED.txt b/apps/desktop/resources/THIRD-PARTY-RESTRICTED.txtindex 809c3a7226..291a84c753 100644--- a/apps/desktop/resources/THIRD-PARTY-RESTRICTED.txt+++ b/apps/desktop/resources/THIRD-PARTY-RESTRICTED.txt@@ -12,6 +12,13 @@ Category: proprietaryLicense: LicenseRef-Anthropic-Commercial-TermsSource: https://www.anthropic.com/legal/commercial-terms+------------------------------------------------------------------------------+Microsoft Visual C++ Runtime (Windows updater app-local DLLs)@14.44.35211.0+Category: proprietary+License: LicenseRef-Microsoft-Visual-Studio-Distributable-Code+Source: https://learn.microsoft.com/en-us/visualstudio/releases/2022/redistribution+Compliance note: Bundled only with the Windows x64 updater; not covered by Cindy's Apache-2.0 license. Exact Microsoft source, hashes, sizes and signer identities are recorded in apps/desktop/resources/cindy-updater-runtime/manifest.json.+------------------------------------------------------------------------------@anthropic-ai/[email protected]Category: proprietarydiff --git a/apps/desktop/resources/cindy-updater-runtime/NOTICE.txt b/apps/desktop/resources/cindy-updater-runtime/NOTICE.txtnew file mode 100644index 0000000000..6e289d1bbc--- /dev/null+++ b/apps/desktop/resources/cindy-updater-runtime/NOTICE.txt@@ -0,0 +1,19 @@+Microsoft Visual C++ Runtime — Windows x64 updater dependencies++The DLL files in this directory are Microsoft Distributable Code. They are+bundled only with the Windows x64 Cindy updater and are not licensed under the+Cindy repository's Apache-2.0 license.++Official source:+https://aka.ms/vs/17/release/vc_redist.x64.exe++Redistribution documentation:+https://learn.microsoft.com/en-us/visualstudio/releases/2022/redistribution++Visual Studio license terms:+https://visualstudio.microsoft.com/license-terms/vs2022-ga-community/++The exact source version, installer hash, file hashes, sizes, architecture and+signer identities are recorded in manifest.json. The DLLs were taken from the+official Visual Studio 2022 VC/Redist x64 Microsoft.VC143.CRT directory; they+were not copied from Windows System32.diff --git a/apps/desktop/resources/cindy-updater-runtime/manifest.json b/apps/desktop/resources/cindy-updater-runtime/manifest.jsonnew file mode 100644index 0000000000..dd0bd7a361--- /dev/null+++ b/apps/desktop/resources/cindy-updater-runtime/manifest.json@@ -0,0 +1,30 @@+{+ "schemaVersion": 1,+ "component": "Microsoft Visual C++ Runtime for the Windows updater",+ "version": "14.44.35211.0",+ "architecture": "x64",+ "source": {+ "downloadUrl": "https://aka.ms/vs/17/release/vc_redist.x64.exe",+ "retrievedOn": "2026-08-31",+ "installerVersion": "14.44.35211.0",+ "installerSize": 25635768,+ "installerSha256": "cc0ff0eb1dc3f5188ae6300faef32bf5beeba4bdd6e8e445a9184072096b713b",+ "visualStudioRedistPath": "VC/Redist/MSVC/14.44.35112/x64/Microsoft.VC143.CRT"+ },+ "files": [+ {+ "name": "vcruntime140.dll",+ "size": 124544,+ "sha256": "d5e4d9a3e835fa679450145d6a7d94e36573a509317111904d9b3712c30d9066",+ "fileVersion": "14.44.35211.0",+ "signer": "Microsoft Windows Software Compatibility Publisher"+ },+ {+ "name": "vcruntime140_1.dll",+ "size": 49792,+ "sha256": "1f2d41c4aa5db0bc33ebf7b66d72943a817d7ce6cbe880502a9403823633093f",+ "fileVersion": "14.44.35211.0",+ "signer": "Microsoft Windows Software Compatibility Publisher"+ }+ ]+}diff --git a/apps/desktop/resources/cindy-updater-runtime/vcruntime140.dll b/apps/desktop/resources/cindy-updater-runtime/vcruntime140.dllnew file mode 100644index 0000000000..5786e9386cBinary files /dev/null and b/apps/desktop/resources/cindy-updater-runtime/vcruntime140.dll differdiff --git a/apps/desktop/resources/cindy-updater-runtime/vcruntime140_1.dll b/apps/desktop/resources/cindy-updater-runtime/vcruntime140_1.dllnew file mode 100644index 0000000000..0b660f9b45Binary files /dev/null and b/apps/desktop/resources/cindy-updater-runtime/vcruntime140_1.dll differdiff --git a/apps/desktop/src/main/__tests__/updateService.test.ts b/apps/desktop/src/main/__tests__/updateService.test.tsindex 0d9df51cb4..564a504603 100644--- a/apps/desktop/src/main/__tests__/updateService.test.ts+++ b/apps/desktop/src/main/__tests__/updateService.test.ts@@ -33,6 +33,19 @@ const getBaseUrl = vi.fn(() => CDN_EXTERNAL_BASE_URL);const isDev = vi.fn(() => false);const download = vi.fn();const readAutoUpdateSettings = vi.fn(() => ({ autoRelaunchOnIdle: true }));+const spawnProcess = vi.fn(() => ({+ unref: vi.fn(),+ on: vi.fn(),+}));+const checkWindowsUpdaterPrerequisites = vi.fn<+ () => { satisfied: boolean; missingFiles: string[] }+>(() => ({+ satisfied: true,+ missingFiles: [],+}));+const stageBundledWindowsUpdaterRuntime = vi.fn<+ () => 'staged' | 'fallback-safe' | 'blocked'+>(() => 'staged');const logInfo = vi.fn();const logWarn = vi.fn();@@ -127,13 +140,17 @@ vi.mock('node:child_process', async (importOriginal) => {const actual = await importOriginal<typeof import('node:child_process')>();return {...actual,- spawn: () => ({- unref: vi.fn(),- on: vi.fn(),- }),+ spawn: spawnProcess,};});+vi.mock('../windowsUpdaterPrerequisites', () => ({+ WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE: 'windows_vc_runtime_missing',+ WINDOWS_UPDATER_RUNTIME_FILES: ['vcruntime140.dll', 'vcruntime140_1.dll'],+ checkWindowsUpdaterPrerequisites,+ stageBundledWindowsUpdaterRuntime,+}));+vi.mock('../security/trustedAppRenderer', () => ({assertTrustedAppRendererEvent: vi.fn(),}));@@ -216,6 +233,14 @@ beforeEach(() => {});readAutoUpdateSettings.mockReset();readAutoUpdateSettings.mockReturnValue({ autoRelaunchOnIdle: true });+ spawnProcess.mockClear();+ checkWindowsUpdaterPrerequisites.mockReset();+ checkWindowsUpdaterPrerequisites.mockReturnValue({+ satisfied: true,+ missingFiles: [],+ });+ stageBundledWindowsUpdaterRuntime.mockReset();+ stageBundledWindowsUpdaterRuntime.mockReturnValue('staged');logInfo.mockReset();logWarn.mockReset();logError.mockReset();@@ -1520,6 +1545,195 @@ describe('startup update relaunch safety', () => {});});+describe('Windows updater prerequisites', () => {+ it('defers the first startup relaunch and exposes the prerequisite error', async () => {+ vi.useFakeTimers();+ checkWindowsUpdaterPrerequisites.mockReturnValue({+ satisfied: false,+ missingFiles: ['vcruntime140.dll', 'vcruntime140_1.dll'],+ });+ fetchManifest.mockResolvedValue(updateManifest('0.0.65'));+ 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('win32');+ service.initUpdateService();+ try {+ const startupHandler = ipcHandlers.get('update-check-startup');+ await expect(startupHandler?.()).resolves.toMatchObject({+ hasUpdate: true,+ action: 'none',+ version: '0.0.65',+ });+ expect(ipcHandlers.get('update-get-status')?.()).toMatchObject({+ status: 'ready',+ version: '0.0.65',+ errorCode: 'windows_vc_runtime_missing',+ });+ expect(spawnProcess).not.toHaveBeenCalled();+ expect(service.isUpdateRelaunchImminent()).toBe(false);+ } finally {+ service.stopUpdateService();+ }+ });++ it('keeps Cindy and the staged patch intact when the VC++ Runtime is missing', async () => {+ readAutoUpdateSettings.mockReturnValue({ autoRelaunchOnIdle: false });+ checkWindowsUpdaterPrerequisites.mockReturnValue({+ satisfied: false,+ missingFiles: ['vcruntime140_1.dll'],+ });+ 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('win32');+ const exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => undefined) as never);+ service.initUpdateService();+ try {+ await expect(service.checkForUpdate(updateManifest('0.0.65'))).resolves.toBe('ready');+ const patchInfoPath = path.join(TEST_USER_DATA, 'updates', 'patch-info.json');+ const patchInfoBefore = JSON.parse(fs.readFileSync(patchInfoPath, 'utf-8')) as {+ fileName: string;+ };+ const stagedPatchPath = path.join(TEST_USER_DATA, 'updates', patchInfoBefore.fileName);++ ipcListeners.get('update-relaunch')?.({}, 'dark');++ await vi.waitFor(() => {+ expect(ipcHandlers.get('update-get-status')?.()).toMatchObject({+ status: 'ready',+ version: '0.0.65',+ errorCode: 'windows_vc_runtime_missing',+ });+ });+ const patchInfoAfter = JSON.parse(fs.readFileSync(patchInfoPath, 'utf-8')) as {+ applyAttempts?: number;+ };+ expect(patchInfoAfter.applyAttempts).toBeUndefined();+ expect(fs.existsSync(stagedPatchPath)).toBe(true);+ expect(spawnProcess).not.toHaveBeenCalled();+ expect(exitSpy).not.toHaveBeenCalled();+ expect(service.isUpdateRelaunchImminent()).toBe(false);+ } finally {+ exitSpy.mockRestore();+ service.stopUpdateService();+ }+ });++ it.each([+ { stageResult: 'fallback-safe' as const, prerequisiteChecks: 2 },+ { stageResult: 'blocked' as const, prerequisiteChecks: 1 },+ ])('keeps the patch and retry count when Runtime staging is $stageResult', async ({+ stageResult,+ prerequisiteChecks,+ }) => {+ readAutoUpdateSettings.mockReturnValue({ autoRelaunchOnIdle: false });+ checkWindowsUpdaterPrerequisites+ .mockReturnValueOnce({ satisfied: true, missingFiles: [] })+ .mockReturnValue({+ satisfied: false,+ missingFiles: ['vcruntime140.dll', 'vcruntime140_1.dll'],+ });+ stageBundledWindowsUpdaterRuntime.mockReturnValue(stageResult);+ download.mockImplementation(async ({ targetPath }: { targetPath: string }) => {+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });+ fs.writeFileSync(targetPath, 'update');+ return { path: targetPath, size: 123 };+ });++ const resourcesPath = path.join(TEST_ROOT, 'resources');+ fs.mkdirSync(resourcesPath, { recursive: true });+ fs.writeFileSync(path.join(resourcesPath, 'cindy-updater.exe'), 'updater');+ const resourcesPathDescriptor = Object.getOwnPropertyDescriptor(process, 'resourcesPath');+ Object.defineProperty(process, 'resourcesPath', {+ value: resourcesPath,+ configurable: true,+ });+ const now = 1_700_000_000_000;+ const nowSpy = vi.spyOn(Date, 'now').mockReturnValue(now);+ const updaterWorkDir = path.join(os.tmpdir(), `cindy-update-${now}`);++ const service = await freshUpdateService('win32');+ service.initUpdateService();+ try {+ await expect(service.checkForUpdate(updateManifest('0.0.65'))).resolves.toBe('ready');+ const patchInfoPath = path.join(TEST_USER_DATA, 'updates', 'patch-info.json');+ const patchInfoBefore = JSON.parse(fs.readFileSync(patchInfoPath, 'utf-8')) as {+ fileName: string;+ };+ const stagedPatchPath = path.join(TEST_USER_DATA, 'updates', patchInfoBefore.fileName);++ ipcListeners.get('update-relaunch')?.({}, 'dark');++ await vi.waitFor(() => {+ expect(checkWindowsUpdaterPrerequisites).toHaveBeenCalledTimes(prerequisiteChecks);+ expect(ipcHandlers.get('update-get-status')?.()).toMatchObject({+ status: 'ready',+ version: '0.0.65',+ errorCode: 'windows_vc_runtime_missing',+ });+ });+ if (stageResult === 'fallback-safe') {+ expect(checkWindowsUpdaterPrerequisites).toHaveBeenNthCalledWith(2, undefined, '');+ }+ const patchInfoAfter = JSON.parse(fs.readFileSync(patchInfoPath, 'utf-8')) as {+ applyAttempts?: number;+ };+ expect(patchInfoAfter.applyAttempts).toBeUndefined();+ expect(fs.existsSync(stagedPatchPath)).toBe(true);+ expect(spawnProcess).not.toHaveBeenCalled();+ expect(service.isUpdateRelaunchImminent()).toBe(false);+ } finally {+ service.stopUpdateService();+ nowSpy.mockRestore();+ fs.rmSync(updaterWorkDir, { recursive: true, force: true });+ if (resourcesPathDescriptor) {+ Object.defineProperty(process, 'resourcesPath', resourcesPathDescriptor);+ } else {+ Reflect.deleteProperty(process, 'resourcesPath');+ }+ }+ });++ it('does not repeatedly auto-relaunch a prerequisite-blocked patch', async () => {+ vi.useFakeTimers();+ readAutoUpdateSettings.mockReturnValue({ autoRelaunchOnIdle: true });+ checkWindowsUpdaterPrerequisites.mockReturnValue({+ satisfied: false,+ missingFiles: ['vcruntime140.dll', 'vcruntime140_1.dll'],+ });+ 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('win32');+ service.initUpdateService();+ try {+ await expect(service.checkForUpdate(updateManifest('0.0.65'))).resolves.toBe('ready');+ await vi.waitFor(() => {+ expect(checkWindowsUpdaterPrerequisites).toHaveBeenCalledTimes(1);+ });++ await vi.advanceTimersByTimeAsync(2 * 60 * 1000);++ expect(checkWindowsUpdaterPrerequisites).toHaveBeenCalledTimes(1);+ expect(spawnProcess).not.toHaveBeenCalled();+ expect(service.getUpdateStatus()).toBe('ready');+ expect(service.isUpdateRelaunchImminent()).toBe(false);+ } finally {+ service.stopUpdateService();+ }+ });+});+describe('splash 启动下载 0% 显式广播', () => {interface SentIpc {channel: string;diff --git a/apps/desktop/src/main/__tests__/windowsUpdaterPrerequisites.test.ts b/apps/desktop/src/main/__tests__/windowsUpdaterPrerequisites.test.tsnew file mode 100644index 0000000000..cdfef679cc--- /dev/null+++ b/apps/desktop/src/main/__tests__/windowsUpdaterPrerequisites.test.ts@@ -0,0 +1,194 @@+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import {+ checkWindowsUpdaterPrerequisites,+ stageBundledWindowsUpdaterRuntime,+ validateBundledWindowsUpdaterRuntime,+ WINDOWS_UPDATER_RUNTIME_DIRECTORY,+ WINDOWS_UPDATER_RUNTIME_FILES,+ windowsUpdaterRuntimeExtraResourceForTarget,+} from '../windowsUpdaterPrerequisites';++let testRoot: string;+let systemDirectory: string;+const committedResources = path.resolve(+ __dirname,+ '..',+ '..',+ '..',+ 'resources',+);++beforeEach(() => {+ testRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-updater-prerequisites-'));+ systemDirectory = path.join(testRoot, 'System32');+ fs.mkdirSync(systemDirectory);+});++afterEach(() => {+ fs.rmSync(testRoot, { recursive: true, force: true });+});++function writeSystemRuntime(fileName: string, contents = 'runtime'): void {+ fs.writeFileSync(path.join(systemDirectory, fileName), contents);+}++describe('checkWindowsUpdaterPrerequisites', () => {+ it('prefers the committed, hash-verified app-local Runtime', () => {+ expect(validateBundledWindowsUpdaterRuntime(committedResources)).toMatchObject({+ version: '14.44.35211.0',+ architecture: 'x64',+ });+ expect(checkWindowsUpdaterPrerequisites('', committedResources)).toEqual({+ satisfied: true,+ missingFiles: [],+ });+ });++ it('accepts two non-empty machine-wide fallback DLL files', () => {+ for (const fileName of WINDOWS_UPDATER_RUNTIME_FILES) writeSystemRuntime(fileName);++ expect(checkWindowsUpdaterPrerequisites(testRoot, '')).toEqual({+ satisfied: true,+ missingFiles: [],+ });+ });++ it.each(WINDOWS_UPDATER_RUNTIME_FILES)(+ 'reports %s when that dependency is missing',+ (missingFile) => {+ for (const fileName of WINDOWS_UPDATER_RUNTIME_FILES) {+ if (fileName !== missingFile) writeSystemRuntime(fileName);+ }++ expect(checkWindowsUpdaterPrerequisites(testRoot, '')).toEqual({+ satisfied: false,+ missingFiles: [missingFile],+ });+ },+ );++ it('rejects empty files and directories', () => {+ fs.writeFileSync(path.join(systemDirectory, WINDOWS_UPDATER_RUNTIME_FILES[0]), '');+ fs.mkdirSync(path.join(systemDirectory, WINDOWS_UPDATER_RUNTIME_FILES[1]));++ expect(checkWindowsUpdaterPrerequisites(testRoot, '')).toEqual({+ satisfied: false,+ missingFiles: [...WINDOWS_UPDATER_RUNTIME_FILES],+ });+ });++ it('reports both dependencies when the Windows root is unavailable', () => {+ expect(checkWindowsUpdaterPrerequisites('', '')).toEqual({+ satisfied: false,+ missingFiles: [...WINDOWS_UPDATER_RUNTIME_FILES],+ });+ });++ it('rejects a modified app-local DLL instead of trusting its filename', () => {+ const resourcesPath = path.join(testRoot, 'resources');+ const runtimePath = path.join(resourcesPath, WINDOWS_UPDATER_RUNTIME_DIRECTORY);+ fs.cpSync(+ path.join(committedResources, WINDOWS_UPDATER_RUNTIME_DIRECTORY),+ runtimePath,+ { recursive: true },+ );+ fs.appendFileSync(path.join(runtimePath, WINDOWS_UPDATER_RUNTIME_FILES[0]), 'tampered');++ expect(() => validateBundledWindowsUpdaterRuntime(resourcesPath)).toThrow(/size mismatch/);+ expect(checkWindowsUpdaterPrerequisites('', resourcesPath)).toEqual({+ satisfied: false,+ missingFiles: [...WINDOWS_UPDATER_RUNTIME_FILES],+ });+ });+});++describe('windowsUpdaterRuntimeExtraResourceForTarget', () => {+ it('includes the Runtime only in Windows artifacts', () => {+ expect(windowsUpdaterRuntimeExtraResourceForTarget('win32')).toBe(+ `resources/${WINDOWS_UPDATER_RUNTIME_DIRECTORY}`,+ );+ expect(windowsUpdaterRuntimeExtraResourceForTarget('darwin')).toBeNull();+ expect(windowsUpdaterRuntimeExtraResourceForTarget('mas')).toBeNull();+ expect(windowsUpdaterRuntimeExtraResourceForTarget('linux')).toBeNull();+ });+});++describe('stageBundledWindowsUpdaterRuntime', () => {+ it('copies both verified DLLs beside the temporary updater', () => {+ const destination = path.join(testRoot, 'workdir');+ fs.mkdirSync(destination);++ expect(stageBundledWindowsUpdaterRuntime(committedResources, destination)).toBe('staged');+ for (const fileName of WINDOWS_UPDATER_RUNTIME_FILES) {+ expect(fs.readFileSync(path.join(destination, fileName))).toEqual(+ fs.readFileSync(+ path.join(committedResources, WINDOWS_UPDATER_RUNTIME_DIRECTORY, fileName),+ ),+ );+ }+ });++ it('copies nothing when the bundled Runtime is unavailable', () => {+ const destination = path.join(testRoot, 'workdir');+ fs.mkdirSync(destination);++ expect(stageBundledWindowsUpdaterRuntime('', destination)).toBe('fallback-safe');+ expect(fs.readdirSync(destination)).toEqual([]);+ });++ it('rejects and removes a DLL modified after it is copied', () => {+ const destination = path.join(testRoot, 'workdir');+ fs.mkdirSync(destination);+ const copyFileSync = fs.copyFileSync.bind(fs);+ const copySpy = vi.spyOn(fs, 'copyFileSync').mockImplementation((source, target, mode) => {+ copyFileSync(source, target, mode);+ if (path.basename(String(target)) === WINDOWS_UPDATER_RUNTIME_FILES[0]) {+ fs.appendFileSync(target, 'tampered-after-copy');+ }+ });++ try {+ expect(stageBundledWindowsUpdaterRuntime(committedResources, destination)).toBe(+ 'fallback-safe',+ );+ expect(fs.readdirSync(destination)).toEqual([]);+ } finally {+ copySpy.mockRestore();+ }+ });++ it('blocks fallback when an invalid staged DLL cannot be removed', () => {+ const destination = path.join(testRoot, 'workdir');+ fs.mkdirSync(destination);+ const copyFileSync = fs.copyFileSync.bind(fs);+ const copySpy = vi.spyOn(fs, 'copyFileSync').mockImplementation((source, target, mode) => {+ copyFileSync(source, target, mode);+ if (path.basename(String(target)) === WINDOWS_UPDATER_RUNTIME_FILES[0]) {+ fs.appendFileSync(target, 'tampered-after-copy');+ }+ });+ const rmSync = fs.rmSync.bind(fs);+ const rmSpy = vi.spyOn(fs, 'rmSync').mockImplementation((target, options) => {+ if (path.basename(String(target)) === WINDOWS_UPDATER_RUNTIME_FILES[0]) {+ throw new Error('locked by security software');+ }+ rmSync(target, options);+ });++ try {+ expect(stageBundledWindowsUpdaterRuntime(committedResources, destination)).toBe(+ 'blocked',+ );+ expect(fs.existsSync(path.join(destination, WINDOWS_UPDATER_RUNTIME_FILES[0]))).toBe(+ true,+ );+ } finally {+ rmSpy.mockRestore();+ copySpy.mockRestore();+ }+ });+});diff --git a/apps/desktop/src/main/updateService.ts b/apps/desktop/src/main/updateService.tsindex 09043e83be..aaacdc3ef7 100644--- a/apps/desktop/src/main/updateService.ts+++ b/apps/desktop/src/main/updateService.ts@@ -68,6 +68,12 @@ import { disposeAndroidAdb } from './mcp-integrations/android';import { abortIOSSimulatorOperationsForExit } from './mcp-integrations/ios-simulator-exit';import { getGhostNodeRuntimeBroker } from './cindy-brain/index';import { cleanOldUpdateFiles } from './updateArtifacts';+import {+ checkWindowsUpdaterPrerequisites,+ stageBundledWindowsUpdaterRuntime,+ WINDOWS_UPDATER_RUNTIME_FILES,+ WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE,+} from './windowsUpdaterPrerequisites';const log = createLogger('updateService');@@ -226,11 +232,43 @@ function setStatus(status: UpdateStatus, extra?: Partial<UpdateStatusPayload>):currentStatus = status;lastErrorCode = extra?.errorCode;broadcastStatus({ status, ...extra });- if (status === 'ready' && !startupUpdateCheckInProgress) {+ if (status === 'ready' && !startupUpdateCheckInProgress && !extra?.errorCode) {void evaluateAutoRelaunch('status-ready');}}+function blockWindowsUpdaterForMissingRuntime(missingFiles: readonly string[]): false {+ log.error(+ 'Windows updater prerequisites missing (%s); keeping patch staged',+ missingFiles.join(', '),+ );+ isRelaunching = false;+ autoRelaunchInProgress = false;+ setStatus('ready', {+ version: readyVersion,+ errorCode: WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE,+ });+ return false;+}++function ensureWindowsUpdaterPrerequisites(options?: {+ allowBundledRuntime?: boolean;+}): boolean {+ if (process.platform !== 'win32') return true;++ const resourcesPath = options?.allowBundledRuntime === false+ ? ''+ : process.resourcesPath;+ const result = checkWindowsUpdaterPrerequisites(undefined, resourcesPath);+ if (!result.satisfied) {+ return blockWindowsUpdaterForMissingRuntime(result.missingFiles);+ }+ if (lastErrorCode === WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE) {+ lastErrorCode = undefined;+ }+ return true;+}+function autoUpdateSettingsWire() {const state = readAutoUpdateSettingsState();return {@@ -271,6 +309,7 @@ async function getAutoRelaunchBlockReasonForCurrentState(): Promise<AutoRelaunchif (!readAutoUpdateSettings().autoRelaunchOnIdle) return 'disabled';if (isDev()) return 'dev';if (currentStatus !== 'ready') return 'not-ready';+ if (lastErrorCode === WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE) return 'not-ready';if (isRelaunching || autoRelaunchInProgress) return 'relaunching';const hasBusyTasksNow = await hasBusyTasks();@@ -318,6 +357,7 @@ async function getAutoRelaunchBlockReasonForCurrentState(): Promise<AutoRelaunchasync function getStartupRelaunchBlockReason(): Promise<AutoRelaunchBlockReason | null> {if (isDev()) return 'dev';if (currentStatus !== 'ready') return 'not-ready';+ if (lastErrorCode === WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE) return 'not-ready';if (isRelaunching || autoRelaunchInProgress) return 'relaunching';// pkexec 必须用户在场输入密码,启动时不能自己装。if (process.platform === 'linux') return 'interactive-auth';@@ -335,6 +375,9 @@ async function buildStartupReadyReply(version: string | undefined): Promise<{action: 'relaunch' | 'none';version: string | undefined;}> {+ if (!ensureWindowsUpdaterPrerequisites()) {+ return { hasUpdate: true, action: 'none', version };+ }const blockReason = await getStartupRelaunchBlockReason();if (blockReason) {lastAutoRelaunchBlockReason = blockReason;@@ -503,6 +546,9 @@ export function isUpdateRelaunchImminent(): boolean {if (currentStatus !== 'downloading' && currentStatus !== 'ready') return false;// The native updater replaces the *installed* app; it never runs in dev.if (isDev()) return false;+ // A missing VC++ Runtime requires an explicit user install. Treating that+ // indefinite wait as imminent would keep startup side-effects disabled.+ if (lastErrorCode === WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE) return false;// Linux 安装要 pkexec 密码,不会在空闲/启动时自己装。if (process.platform === 'linux') return false;// Respecting the user's switch: with auto-relaunch off the patch just sits@@ -1396,12 +1442,41 @@ function executeUpdateWindows(zipPath: string, theme: 'light' | 'dark'): void {try {fs.mkdirSync(workDir, { recursive: true });fs.copyFileSync(updaterSrc, updaterRun);+ const runtimeStageResult = stageBundledWindowsUpdaterRuntime(+ process.resourcesPath,+ workDir,+ );+ if (runtimeStageResult === 'blocked') {+ log.error(+ 'Windows updater app-local Runtime could not be staged or safely removed; keeping patch staged',+ );+ blockWindowsUpdaterForMissingRuntime(WINDOWS_UPDATER_RUNTIME_FILES);+ return;+ }+ if (+ runtimeStageResult === 'fallback-safe'+ && !ensureWindowsUpdaterPrerequisites({ allowBundledRuntime: false })+ ) {+ log.error(+ 'Windows updater Runtime became unavailable while preparing the updater; keeping patch staged',+ );+ return;+ }+ log.info(+ 'Windows updater runtime source: %s',+ runtimeStageResult === 'staged' ? 'bundled app-local DLLs' : 'System32 fallback',+ );} catch (err) {log.error('failed to set up updater workdir at %s:', maskPath(workDir), err);handleApplyFailure('workdir_setup_failed');return;}+ // Count the attempt only after the last Runtime check. If security software+ // removes the bundled DLLs between the early guard and this copy, keeping the+ // patch staged must not consume a retry or recreate the relaunch loop.+ incrementApplyAttempts();+// Theme is resolved by the renderer (collapses 'system' via the live DOM// class) and forwarded through the `update-relaunch` IPC, so the updater's// first frame matches the app the user is currently looking at — even when@@ -1823,6 +1898,14 @@ async function executeRelaunchUnguarded(theme: 'light' | 'dark'): Promise<void>return;}+ // The Windows updater is an x64 MSVC binary. Prefer its verified app-local+ // Runtime and keep a machine-wide installation as the legacy/damaged-package+ // fallback. This guard is Windows-only; macOS and Linux keep their existing+ // update executors unchanged. Run it before stopping Subagents, incrementing+ // the durable attempt counter, or spawning anything so a missing Runtime+ // keeps both Cindy and the already-downloaded patch intact.+ if (!ensureWindowsUpdaterPrerequisites()) return;+// Gate *before* the updater is spawned, not inside forceQuit: once the// updater script is running it polls our pid and SIGKILLs us after 120s// (`updateScriptMacOS.ts`), so a late decision not to exit does not keep this@@ -1840,11 +1923,6 @@ async function executeRelaunchUnguarded(theme: 'light' | 'dark'): Promise<void>return;}- // Increment applyAttempts before spawning so that if the updater itself- // crashes (spawn succeeds → forceQuit → updater fails → old version boots),- // the counter persists across restarts and eventually breaks the loop.- incrementApplyAttempts();-log.info('Executing relaunch with file: %s (%s bytes)',maskPath(readyFilePath), fs.statSync(readyFilePath).size,@@ -1855,9 +1933,14 @@ async function executeRelaunchUnguarded(theme: 'light' | 'dark'): Promise<void>executeUpdateWindows(readyFilePath, theme);break;case 'darwin':+ // Increment immediately before starting the platform executor so a+ // failed updater can be bounded across restarts. Windows does this only+ // after its final app-local/System32 Runtime check inside the executor.+ incrementApplyAttempts();executeUpdateMacOS(readyFilePath);break;case 'linux':+ incrementApplyAttempts();executeUpdateLinux(readyFilePath);break;default:diff --git a/apps/desktop/src/main/windowsUpdaterPrerequisites.ts b/apps/desktop/src/main/windowsUpdaterPrerequisites.tsnew file mode 100644index 0000000000..a00f3d196b--- /dev/null+++ b/apps/desktop/src/main/windowsUpdaterPrerequisites.ts@@ -0,0 +1,225 @@+import { createHash } from 'node:crypto';+import fs from 'node:fs';+import path from 'node:path';++export const WINDOWS_UPDATER_RUNTIME_MISSING_ERROR_CODE =+ 'windows_vc_runtime_missing';++export const WINDOWS_UPDATER_RUNTIME_DIRECTORY = 'cindy-updater-runtime';++export const WINDOWS_UPDATER_RUNTIME_FILES = [+ 'vcruntime140.dll',+ 'vcruntime140_1.dll',+] as const;++interface WindowsUpdaterRuntimeManifestFile {+ name: string;+ size: number;+ sha256: string;+ fileVersion: string;+ signer: string;+}++export interface WindowsUpdaterRuntimeManifest {+ schemaVersion: number;+ component: string;+ version: string;+ architecture: string;+ files: WindowsUpdaterRuntimeManifestFile[];+}++export interface WindowsUpdaterPrerequisiteResult {+ satisfied: boolean;+ missingFiles: string[];+}++export type WindowsUpdaterRuntimeStageResult =+ | 'staged'+ | 'fallback-safe'+ | 'blocked';++function isNonEmptyFile(filePath: string): boolean {+ try {+ const stat = fs.statSync(filePath);+ return stat.isFile() && stat.size > 0;+ } catch {+ return false;+ }+}++function sha256File(filePath: string): string {+ return createHash('sha256').update(fs.readFileSync(filePath)).digest('hex');+}++function runtimeDirectory(resourcesPath: string): string {+ return path.join(resourcesPath, WINDOWS_UPDATER_RUNTIME_DIRECTORY);+}++function validateRuntimeFile(+ directory: string,+ entry: WindowsUpdaterRuntimeManifestFile,+): void {+ const filePath = path.join(directory, entry.name);+ const stat = fs.statSync(filePath);+ if (!stat.isFile() || stat.size !== entry.size) {+ throw new Error(+ `${entry.name} size mismatch: expected ${entry.size}, got ${stat.isFile() ? stat.size : 'not a file'}`,+ );+ }+ const actualHash = sha256File(filePath);+ if (actualHash !== entry.sha256.toLowerCase()) {+ throw new Error(+ `${entry.name} sha256 mismatch: expected ${entry.sha256}, got ${actualHash}`,+ );+ }+}++/** Keep the proprietary x64 Runtime out of every non-Windows artifact. */+export function windowsUpdaterRuntimeExtraResourceForTarget(+ targetPlatform: string,+): string | null {+ return targetPlatform === 'win32'+ ? `resources/${WINDOWS_UPDATER_RUNTIME_DIRECTORY}`+ : null;+}++/**+ * Validate the vendored app-local runtime exactly as it will be shipped.+ * Packaging calls this as a fail-closed gate; runtime probing catches the+ * error and can still fall back to a machine-wide VC++ Runtime installation.+ */+export function validateBundledWindowsUpdaterRuntime(+ resourcesPath: string,+): WindowsUpdaterRuntimeManifest {+ const directory = runtimeDirectory(resourcesPath);+ const manifestPath = path.join(directory, 'manifest.json');+ const manifest = JSON.parse(+ fs.readFileSync(manifestPath, 'utf8'),+ ) as WindowsUpdaterRuntimeManifest;++ if (manifest.schemaVersion !== 1) {+ throw new Error(+ `unsupported Windows updater runtime manifest schema: ${manifest.schemaVersion}`,+ );+ }+ if (manifest.architecture !== 'x64') {+ throw new Error(`Windows updater runtime must be x64, got ${manifest.architecture}`);+ }+ if (!manifest.version) {+ throw new Error('Windows updater runtime manifest version is empty');+ }++ const expectedNames = new Set<string>(WINDOWS_UPDATER_RUNTIME_FILES);+ const actualNames = new Set(manifest.files.map((entry) => entry.name));+ if (+ manifest.files.length !== expectedNames.size+ || actualNames.size !== expectedNames.size+ || [...expectedNames].some((name) => !actualNames.has(name))+ ) {+ throw new Error(+ 'Windows updater runtime manifest file set does not match loader dependencies',+ );+ }++ for (const entry of manifest.files) {+ if (!expectedNames.has(entry.name)) {+ throw new Error(`unexpected Windows updater runtime file: ${entry.name}`);+ }+ if (!entry.fileVersion || !entry.signer || !/^[a-f0-9]{64}$/i.test(entry.sha256)) {+ throw new Error(`invalid provenance metadata for ${entry.name}`);+ }+ validateRuntimeFile(directory, entry);+ }++ return manifest;+}++function hasVerifiedBundledRuntime(resourcesPath: string | undefined): boolean {+ if (!resourcesPath) return false;+ try {+ validateBundledWindowsUpdaterRuntime(resourcesPath);+ return true;+ } catch {+ return false;+ }+}++/**+ * Prefer the updater's verified app-local DLLs. A complete machine-wide x64+ * Runtime remains a fallback for damaged/legacy packages so the existing+ * no-retry-loop prompt can still recover the update.+ */+export function checkWindowsUpdaterPrerequisites(+ systemRoot = process.env.SystemRoot ?? process.env.WINDIR,+ resourcesPath = process.resourcesPath,+): WindowsUpdaterPrerequisiteResult {+ if (hasVerifiedBundledRuntime(resourcesPath)) {+ return { satisfied: true, missingFiles: [] };+ }++ if (!systemRoot) {+ return {+ satisfied: false,+ missingFiles: [...WINDOWS_UPDATER_RUNTIME_FILES],+ };+ }++ const systemDirectory = path.join(systemRoot, 'System32');+ const missingFiles = WINDOWS_UPDATER_RUNTIME_FILES.filter(+ (fileName) => !isNonEmptyFile(path.join(systemDirectory, fileName)),+ );++ return {+ satisfied: missingFiles.length === 0,+ missingFiles,+ };+}++/**+ * Copy the verified app-local Runtime beside the timestamped updater executable.+ * `fallback-safe` means no app-local DLL remains and the caller may separately+ * validate System32. `blocked` means a partial DLL could not be removed, so the+ * updater must not start even when a machine-wide Runtime is installed.+ */+export function stageBundledWindowsUpdaterRuntime(+ resourcesPath: string,+ destinationDirectory: string,+): WindowsUpdaterRuntimeStageResult {+ let manifest: WindowsUpdaterRuntimeManifest;+ try {+ manifest = validateBundledWindowsUpdaterRuntime(resourcesPath);+ } catch {+ return 'fallback-safe';+ }++ const sourceDirectory = runtimeDirectory(resourcesPath);+ try {+ for (const entry of manifest.files) {+ fs.copyFileSync(+ path.join(sourceDirectory, entry.name),+ path.join(destinationDirectory, entry.name),+ );+ }+ // Verify the actual loader inputs after the copy. Source verification alone+ // leaves a gap where security software can quarantine or rewrite a target+ // DLL before the updater is spawned.+ for (const entry of manifest.files) {+ validateRuntimeFile(destinationDirectory, entry);+ }+ return 'staged';+ } catch {+ let cleanupFailed = false;+ for (const fileName of WINDOWS_UPDATER_RUNTIME_FILES) {+ try {+ fs.rmSync(path.join(destinationDirectory, fileName), { force: true });+ } catch {+ cleanupFailed = true;+ }+ }+ // A corrupt app-local DLL shadows a valid System32 copy. Never report a+ // safe fallback unless every partial target was actually removed.+ const partialRuntimeRemains = WINDOWS_UPDATER_RUNTIME_FILES.some((fileName) =>+ fs.existsSync(path.join(destinationDirectory, fileName)));+ return cleanupFailed || partialRuntimeRemains ? 'blocked' : 'fallback-safe';+ }+}diff --git a/apps/desktop/src/renderer/__tests__/updateBannerRelaunchEntry.test.tsx b/apps/desktop/src/renderer/__tests__/updateBannerRelaunchEntry.test.tsxindex abd7424782..3db7c650d3 100644--- a/apps/desktop/src/renderer/__tests__/updateBannerRelaunchEntry.test.tsx+++ b/apps/desktop/src/renderer/__tests__/updateBannerRelaunchEntry.test.tsx@@ -18,10 +18,11 @@ import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/reimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';const {- anyActivityBlockingRelaunch, relaunchToUpdate, updateStatus, dismissState,+ anyActivityBlockingRelaunch, relaunchToUpdate, openExternal, updateStatus, dismissState,} = vi.hoisted(() => ({anyActivityBlockingRelaunch: vi.fn<() => Promise<boolean>>(),relaunchToUpdate: vi.fn(),+ openExternal: vi.fn(async () => ({ success: true })),updateStatus: {current: { status: 'ready', version: '1.2.3', errorCode: null } as {status: string;@@ -87,6 +88,7 @@ function deferredProbe(): (busy: boolean) => void {beforeEach(() => {anyActivityBlockingRelaunch.mockReset();relaunchToUpdate.mockReset();+ openExternal.mockClear();updateStatus.current = { status: 'ready', version: '1.2.3', errorCode: null };dismissState.dismissed = false;Object.defineProperty(window, 'electronAPI', {@@ -94,6 +96,7 @@ beforeEach(() => {value: {anyActivityBlockingRelaunch,relaunchToUpdate,+ openExternal,clientEndpoints: { websiteUrl: 'https://cindy.ai' },} as unknown as Window['electronAPI'],});@@ -102,6 +105,42 @@ beforeEach(() => {afterEach(cleanup);describe('UpdateBanner relaunch entry', () => {+ it('prompts for the VC++ Runtime, keeps the banner, and rechecks on demand', async () => {+ updateStatus.current = {+ status: 'ready',+ version: '1.2.3',+ errorCode: 'windows_vc_runtime_missing',+ };+ render(<UpdateBanner isCollapsed={false} />);++ await screen.findByText('update.windowsRuntimeMissing.title');+ expect(screen.getByText('update.windowsRuntimeMissing.description')).toBeTruthy();+ expect(anyActivityBlockingRelaunch).not.toHaveBeenCalled();++ fireEvent.click(screen.getByRole('button', { name: 'update.windowsRuntimeMissing.download' }));+ expect(openExternal).toHaveBeenCalledWith(+ 'https://aka.ms/vs/17/release/vc_redist.x64.exe',+ );+ await waitFor(() => {+ expect(screen.queryByText('update.windowsRuntimeMissing.title')).toBeNull();+ });++ // The downloaded patch remains ready, so the normal update entry stays+ // available and reopens the prerequisite prompt instead of probing tasks.+ fireEvent.click(screen.getByRole('button', { name: 'update.banner.ariaExpanded' }));+ await screen.findByText('update.windowsRuntimeMissing.title');+ expect(anyActivityBlockingRelaunch).not.toHaveBeenCalled();++ fireEvent.click(screen.getByRole('button', { name: 'update.windowsRuntimeMissing.retry' }));+ expect(relaunchToUpdate).toHaveBeenCalledTimes(1);++ fireEvent.click(screen.getByRole('button', { name: 'update.windowsRuntimeMissing.later' }));+ await waitFor(() => {+ expect(screen.queryByText('update.windowsRuntimeMissing.title')).toBeNull();+ });+ expect(screen.getByRole('button', { name: 'update.banner.ariaExpanded' })).toBeTruthy();+ });+it('warns about the interruption instead of relaunching when main reports live activity', async () => {anyActivityBlockingRelaunch.mockResolvedValue(true);render(<UpdateBanner isCollapsed={false} />);diff --git a/apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx b/apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsxindex 126f651dd2..097e8328e5 100644--- a/apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx+++ b/apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx@@ -44,7 +44,7 @@* 下载完成后主进程会把 status 切回 'ready' 且 version 升级到新版,banner 自动刷新。*/-import { useEffect, useRef, useState } from 'react';+import { useEffect, useRef, useState, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';import { Flame, Check, X } from 'lucide-react';import { cn } from '@/lib/utils';@@ -59,6 +59,7 @@ import { fetchReleaseNotes } from '@/release-notes';// 运行期端点清单(dev/packaged 都在启动阻断后有真值,烘焙兜底已退役)const websiteUrl = () => window.electronAPI.clientEndpoints.websiteUrl;+const WINDOWS_VC_RUNTIME_DOWNLOAD_URL = 'https://aka.ms/vs/17/release/vc_redist.x64.exe';interface UpdateBannerProps {isCollapsed: boolean;@@ -106,6 +107,7 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP// 区别于 status 变化等其它导致的复位。const restoreFocusRef = useRef(false);const [showTranslocatedDialog, setShowTranslocatedDialog] = useState(false);+ const [showWindowsRuntimeDialog, setShowWindowsRuntimeDialog] = useState(false);const { t } = useTranslation();const [showSpawnFailedDialog, setShowSpawnFailedDialog] = useState(false);@@ -116,8 +118,14 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP// the app is running from a read-only App Translocation path.const isTranslocated = status === 'error' && errorCode === 'translocated';const isSpawnFailed = status === 'error' && errorCode === 'updater_spawn_failed';+ const isWindowsRuntimeMissing =+ status === 'ready' && errorCode === 'windows_vc_runtime_missing';const isPreparing = status === 'superseding';+ useEffect(() => {+ if (isWindowsRuntimeMissing) setShowWindowsRuntimeDialog(true);+ }, [isWindowsRuntimeMissing]);+useEffect(() => {if (isSpawnFailed) setShowSpawnFailedDialog(true);}, [isSpawnFailed]);@@ -129,11 +137,11 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP// 一旦不再是 ready(如被 superseding 顶掉 / 出错),复位确认态,避免残留一个// 指向旧补丁的「仍要重启」;同时作废在飞的探针 —— 它的结论建立在「当前补丁可装」之上。useEffect(() => {- if (status !== 'ready') {+ if (status !== 'ready' || isWindowsRuntimeMissing) {relaunchEpochRef.current += 1;setConfirming(false);}- }, [status]);+ }, [status, isWindowsRuntimeMissing]);// 卸载时同样作废在飞的探针。卸载后 setConfirming 只是一次无效更新,但 handleRelaunch// 会真的把 app 重启掉 —— 这条 cleanup 不是防 React 警告,是防意外重启。@@ -192,11 +200,6 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerPdismiss(status, version ?? null);};- // Banner is visible for ready (relaunch available), superseding (preparing- // a newer version on top of an already-ready patch), or error fallback- // dialogs. Everything else hides the banner.- if (status !== 'ready' && !isPreparing && !isTranslocated && !isSpawnFailed) return null;-// 展开态的完整横幅:用户关掉、有任务在跑、或探针还没给出「弹出 / 让路」决定时// 都不渲染,避免闪一下再收成火焰。收起态那颗小火焰本身就是最小化提醒,busy// 让路和探针空窗都要留着;只有用户点过 X 才连它一起藏。@@ -207,10 +210,6 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerPconst hideExpandedBanner =hideUntilBusyDecision|| (dismissed && (status === 'ready' || isPreparing));- if (!isCollapsed && hideExpandedBanner) return null;- if (isCollapsed && dismissed && reason === 'user' && (status === 'ready' || isPreparing)) {- return null;- }const handleRelaunch = () => {const theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';@@ -237,6 +236,10 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP// 卸载、已就绪补丁可能被 superseding 顶掉。少了它们,「点了稍后却重启」「装回旧补丁」// 「confirming 残留到下次唤回」三种都会真实发生。const handleRelaunchClick = async (): Promise<void> => {+ if (isWindowsRuntimeMissing) {+ setShowWindowsRuntimeDialog(true);+ return;+ }if (relaunchProbeRef.current) return;relaunchProbeRef.current = true;const epoch = relaunchEpochRef.current;@@ -273,6 +276,16 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerPwindow.open(websiteUrl(), '_blank');};+ const handleWindowsRuntimeDownload = () => {+ setShowWindowsRuntimeDialog(false);+ void window.electronAPI.openExternal(WINDOWS_VC_RUNTIME_DOWNLOAD_URL);+ };++ const handleWindowsRuntimeRetry = () => {+ const theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';+ window.electronAPI.relaunchToUpdate(theme);+ };+// 文字链要显示的版本 —— undefined 即不显示。ready 态之外(superseding / error)没有// 可信版本号,confirming 态则刻意让位给两步确认。hasNotes 已经蕴含「ready + 该版本// 公告可渲染」,这里再显式列出条件,读代码时不必回溯 effect。@@ -288,6 +301,32 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP// nothing because the patch has already been cleared).const isErrorOnly = isTranslocated || isSpawnFailed;+ const withWindowsRuntimeDialog = (content: ReactNode) => (+ <>+ {isWindowsRuntimeMissing && (+ <ConfirmDialog+ open={showWindowsRuntimeDialog}+ onOpenChange={setShowWindowsRuntimeDialog}+ title={t('update.windowsRuntimeMissing.title')}+ description={t('update.windowsRuntimeMissing.description')}+ confirmText={t('update.windowsRuntimeMissing.download')}+ tertiaryText={t('update.windowsRuntimeMissing.retry')}+ cancelText={t('update.windowsRuntimeMissing.later')}+ autoFocusConfirm+ onConfirm={handleWindowsRuntimeDownload}+ onTertiary={handleWindowsRuntimeRetry}+ onCancel={() => setShowWindowsRuntimeDialog(false)}+ />+ )}+ {content}+ </>+ );++ // Banner is visible for ready (relaunch available), superseding (preparing+ // a newer version on top of an already-ready patch), or error fallback+ // dialogs. Everything else hides the banner.+ if (status !== 'ready' && !isPreparing && !isTranslocated && !isSpawnFailed) return null;+if (isErrorOnly) {// onOpenChange is a no-op so the user can't accidentally dismiss the// dialog via ESC / outside-click — banner body is hidden in this state@@ -321,12 +360,20 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP);}+ // The prerequisite dialog must not be suppressed by the normal busy/dismiss+ // rules. After the user chooses "later", the usual banner visibility rules+ // resume and clicking the update entry opens this dialog again.+ if (!isCollapsed && hideExpandedBanner) return withWindowsRuntimeDialog(null);+ if (isCollapsed && dismissed && reason === 'user' && (status === 'ready' || isPreparing)) {+ return withWindowsRuntimeDialog(null);+ }+// ── Collapsed state: icon only ──if (isCollapsed) {// 确认态(仅在有任务在跑时出现):上方 ✓(仍要重启,占据原 Flame 图标位置,鼠标零位移),// 下方 ✕(取消)。收起态没有文案位置,「会打断进行中的任务」只能落在 ✓ 的 tooltip 上。if (confirming && !isPreparing) {- return (+ return withWindowsRuntimeDialog(<div className="flex flex-col items-center gap-0.5 border-t border-sidebar-border py-1.5"><Tip text={t('update.banner.confirmTooltip')} side="right"><button@@ -355,11 +402,11 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP<X className="h-5 w-5" strokeWidth={2} /></button></Tip>- </div>+ </div>,);}- return (+ return withWindowsRuntimeDialog(<div className="flex flex-col items-center border-t border-sidebar-border"><Tiptext={isPreparing@@ -390,12 +437,12 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP</div></button></Tip>- </div>+ </div>,);}// ── Expanded state: full banner ──- return (+ return withWindowsRuntimeDialog(<div className="flex select-none flex-col border-t border-sidebar-border"><div className="relative flex flex-col items-center gap-[10px] px-4 py-3">{/* X dismiss —— 右上角。error 态 body 本就隐藏,superseding 允许 dismiss。@@ -524,6 +571,6 @@ export function UpdateBanner({ isCollapsed, onOpenVersionNotice }: UpdateBannerP</button>)}</div>- </div>+ </div>,);}diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex ae6e30bd74..ec02158032 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -6654,6 +6654,13 @@"move": "Move Now (Recommended)","download": "Download manually"},+ "windowsRuntimeMissing": {+ "title": "Microsoft Visual C++ Runtime Required",+ "description": "This PC is missing the Microsoft Visual C++ Runtime required by the updater. The downloaded update will be kept. Install Microsoft's official x64 Runtime, then check again.",+ "download": "Download Runtime",+ "retry": "Check Again",+ "later": "Install Later"+ },"moveToApplications": {"title": "Move to Applications Folder","message": "Moving {{appName}} to the Applications folder gives you a better experience, including automatic updates.",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 90bcceff53..ceab4c49e1 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -6646,6 +6646,13 @@"move": "今すぐ移動(推奨)","download": "手動でダウンロード"},+ "windowsRuntimeMissing": {+ "title": "Microsoft Visual C++ ランタイムが必要です",+ "description": "この PC にはアップデーターに必要な Microsoft Visual C++ ランタイムがありません。ダウンロード済みの更新は保持されます。Microsoft 公式の x64 ランタイムをインストールしてから、もう一度確認してください。",+ "download": "ランタイムをダウンロード",+ "retry": "もう一度確認",+ "later": "後でインストール"+ },"moveToApplications": {"title": "アプリケーションフォルダに移動","message": "{{appName}} を「アプリケーション」フォルダに移動すると、自動更新を含むより良い体験が得られます。",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 00311052c6..7804aa8058 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -6646,6 +6646,13 @@"move": "지금 이동 (권장)","download": "수동으로 다운로드"},+ "windowsRuntimeMissing": {+ "title": "Microsoft Visual C++ 런타임 필요",+ "description": "이 PC에는 업데이터에 필요한 Microsoft Visual C++ 런타임이 없습니다. 다운로드한 업데이트는 유지됩니다. Microsoft 공식 x64 런타임을 설치한 후 다시 확인해 주세요.",+ "download": "런타임 다운로드",+ "retry": "다시 확인",+ "later": "나중에 설치"+ },"moveToApplications": {"title": "응용 프로그램 폴더로 이동","message": "{{appName}}를 응용 프로그램 폴더로 이동하면 자동 업데이트를 포함한 더 나은 경험을 사용할 수 있습니다.",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 45618269aa..9e9b0c4062 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -6638,6 +6638,13 @@"move": "立即移动(推荐)","download": "手动下载新版本"},+ "windowsRuntimeMissing": {+ "title": "需要安装 Microsoft Visual C++ 运行库",+ "description": "这台电脑缺少更新程序所需的 Microsoft Visual C++ 运行库。已下载的更新包会保留;请安装微软官方 x64 运行库后重新检查。",+ "download": "下载运行库",+ "retry": "重新检查",+ "later": "稍后安装"+ },"moveToApplications": {"title": "移动到应用程序文件夹","message": "将 {{appName}} 移动到「应用程序」文件夹可获得更好的体验,包括自动更新。",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex e09a5e2306..4ebb9f0dc3 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -6638,6 +6638,13 @@"move": "立即移動(推薦)","download": "手動下載新版本"},+ "windowsRuntimeMissing": {+ "title": "需要安裝 Microsoft Visual C++ 執行階段",+ "description": "這台電腦缺少更新程式所需的 Microsoft Visual C++ 執行階段。已下載的更新套件會保留;請安裝 Microsoft 官方 x64 執行階段後重新檢查。",+ "download": "下載執行階段",+ "retry": "重新檢查",+ "later": "稍後安裝"+ },"moveToApplications": {"title": "移動到應用程式資料夾","message": "將 {{appName}} 移動到「應用程式」資料夾可獲得更好的體驗,包括自動更新。",diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.tsindex 50cb4692bc..dbcd15e2ca 100644--- a/apps/desktop/src/renderer/vite-env.d.ts+++ b/apps/desktop/src/renderer/vite-env.d.ts@@ -929,9 +929,9 @@ interface UpdateStatusPayload {status: 'idle' | 'checking' | 'downloading' | 'ready' | 'superseding' | 'error';version?: string;progress?: number;- /** Machine-readable error subtype. 'translocated' = macOS App Translocation- * blocked the relaunch; renderer shows a fallback dialog instead of- * silently quitting into a broken state. */+ /** Machine-readable error subtype. `windows_vc_runtime_missing` keeps a+ * staged patch ready while the renderer prompts for the updater's x64+ * VC++ Runtime; `translocated` is the macOS read-only fallback. */errorCode?: string;}diff --git a/docs/design-previews/windows-updater-runtime-dialog/index.html b/docs/design-previews/windows-updater-runtime-dialog/index.htmlnew file mode 100644index 0000000000..3d63102802--- /dev/null+++ b/docs/design-previews/windows-updater-runtime-dialog/index.html@@ -0,0 +1,335 @@+<!doctype html>+<html lang="zh-CN">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>PR #3697 · Windows 更新器运行库提示 UI 证据</title>+ <style>+ * { box-sizing: border-box; }+ html, body { min-height: 100%; }+ body {+ margin: 0;+ background: #e9e9e4;+ color: #1a1a1a;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;+ -webkit-font-smoothing: antialiased;+ }+ button { font: inherit; }+ .page {+ width: min(1380px, calc(100vw - 64px));+ margin: 0 auto;+ padding: 40px 0 48px;+ }+ .evidence-header {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: 24px;+ margin-bottom: 24px;+ }+ .eyebrow {+ margin: 0 0 7px;+ color: #6b6b67;+ font-size: 12px;+ font-weight: 600;+ letter-spacing: .04em;+ line-height: 16px;+ text-transform: uppercase;+ }+ h1 {+ margin: 0;+ font-size: 24px;+ font-weight: 650;+ letter-spacing: -.02em;+ line-height: 32px;+ }+ .summary {+ max-width: 820px;+ margin: 8px 0 0;+ color: #6b6b67;+ font-size: 13px;+ line-height: 20px;+ }+ .preview-badge {+ flex: 0 0 auto;+ padding: 7px 10px;+ border: 1px solid #c9a751;+ border-radius: 999px;+ background: #fff8df;+ color: #6f5414;+ font-size: 12px;+ font-weight: 600;+ line-height: 16px;+ }+ .comparison {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ overflow: hidden;+ border: 1px solid #d1d1cc;+ border-radius: 18px;+ box-shadow: 0 18px 48px rgba(36, 36, 32, .10);+ }+ .scene {+ position: relative;+ min-width: 0;+ min-height: 600px;+ overflow: hidden;+ color: var(--text-primary);+ }+ .scene + .scene { border-left: 1px solid #d1d1cc; }+ .scene.light {+ --surface: #f2f2ed;+ --surface-elevated: #fdfdf8;+ --surface-hover: #eeeee9;+ --border-default: #e4e4df;+ --text-primary: #1a1a1a;+ --text-secondary: #888883;+ --confirm-bg: #fdfdf8;+ --confirm-title: #1a1a1a;+ --confirm-desc: #6b6b67;+ --confirm-btn-primary-bg: #3c3f43;+ --confirm-btn-primary-text: #fcfcfc;+ --confirm-btn-secondary-border: #e4e4df;+ --confirm-btn-secondary-text: #1a1a1a;+ --overlay: rgba(23, 23, 23, .40);+ --dialog-shadow: 0 24px 60px rgba(36, 36, 32, .22), 0 3px 12px rgba(36, 36, 32, .12);+ background: var(--surface);+ }+ .scene.dark {+ --surface: #181818;+ --surface-elevated: #1f1f1f;+ --surface-hover: #1d1d1d;+ --border-default: #313131;+ --text-primary: #d4d4d4;+ --text-secondary: #6f6f6f;+ --confirm-bg: #1f1f1f;+ --confirm-title: #d4d4d4;+ --confirm-desc: #c1c1c1;+ --confirm-btn-primary-bg: #eeeeee;+ --confirm-btn-primary-text: #151515;+ --confirm-btn-secondary-border: #313131;+ --confirm-btn-secondary-text: #d4d4d4;+ --overlay: rgba(10, 10, 10, .60);+ --dialog-shadow: 0 24px 60px rgba(0, 0, 0, .50), 0 3px 12px rgba(0, 0, 0, .34);+ background: var(--surface);+ }+ .scene-label {+ position: absolute;+ z-index: 3;+ top: 20px;+ left: 24px;+ right: 24px;+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ color: var(--text-secondary);+ font-size: 12px;+ line-height: 16px;+ }+ .scene-label strong {+ color: var(--text-primary);+ font-weight: 600;+ }+ .desktop-shell {+ position: absolute;+ inset: 0;+ display: grid;+ grid-template-columns: 178px 1fr;+ padding-top: 56px;+ }+ .sidebar {+ border-right: 1px solid var(--border-default);+ padding: 22px 16px;+ background: color-mix(in srgb, var(--surface) 94%, transparent);+ }+ .brand {+ margin: 0 0 26px;+ color: var(--text-primary);+ font-size: 15px;+ font-weight: 650;+ letter-spacing: .06em;+ }+ .nav-item {+ height: 30px;+ margin-bottom: 7px;+ border-radius: 8px;+ background: var(--surface-hover);+ }+ .nav-item.short { width: 72%; }+ .content {+ padding: 28px;+ background: var(--surface);+ }+ .content-title {+ width: 42%;+ height: 18px;+ margin-bottom: 26px;+ border-radius: 8px;+ background: var(--surface-hover);+ }+ .content-card {+ height: 88px;+ margin-bottom: 14px;+ border: 1px solid var(--border-default);+ border-radius: 12px;+ background: var(--surface-elevated);+ }+ .overlay {+ position: absolute;+ z-index: 2;+ inset: 0;+ display: grid;+ place-items: center;+ padding: 32px;+ background: var(--overlay);+ }+ .dialog {+ width: min(400px, 100%);+ padding: 16px;+ border-radius: 12px;+ background: var(--confirm-bg);+ box-shadow: var(--dialog-shadow);+ }+ .dialog-title {+ margin: 0;+ color: var(--confirm-title);+ font-size: 18px;+ font-weight: 500;+ line-height: 28px;+ }+ .dialog-description {+ margin: 8px 0 0;+ color: var(--confirm-desc);+ font-size: 16px;+ line-height: 24px;+ }+ .actions {+ display: flex;+ justify-content: flex-end;+ gap: 10px;+ margin-top: 24px;+ }+ .action {+ min-width: 96px;+ padding: 10px 24px;+ border: 1px solid var(--confirm-btn-secondary-border);+ border-radius: 999px;+ background: transparent;+ color: var(--confirm-btn-secondary-text);+ font-size: 13px;+ font-weight: 500;+ line-height: 16px;+ white-space: nowrap;+ }+ .action.primary {+ border-color: var(--confirm-btn-primary-bg);+ background: var(--confirm-btn-primary-bg);+ color: var(--confirm-btn-primary-text);+ outline: 2px solid var(--confirm-btn-primary-bg);+ outline-offset: 2px;+ }+ .evidence-note {+ margin: 18px 2px 0;+ color: #6b6b67;+ font-size: 12px;+ line-height: 18px;+ }+ code {+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;+ font-size: 11px;+ }+ @media (max-width: 1120px) {+ .actions { flex-wrap: wrap; }+ .action { flex: 1 1 calc(50% - 5px); }+ }+ @media (max-width: 900px) {+ .page { width: min(680px, calc(100vw - 32px)); padding-top: 24px; }+ .evidence-header { flex-direction: column; }+ .comparison { grid-template-columns: 1fr; }+ .scene + .scene { border-top: 1px solid #d1d1cc; border-left: 0; }+ }+ @media (max-width: 520px) {+ .scene { min-height: 680px; }+ .desktop-shell { grid-template-columns: 84px 1fr; }+ .sidebar { padding-inline: 12px; }+ .brand { font-size: 12px; }+ .overlay { padding: 16px; }+ .actions { flex-direction: column; }+ .action { width: 100%; }+ }+ </style>+ </head>+ <body>+ <main class="page">+ <header class="evidence-header">+ <div>+ <p class="eyebrow">PR #3697 · UI evidence</p>+ <h1>Windows 更新器缺少 VC++ Runtime 时的提示</h1>+ <p class="summary">复用当前 UpdateBanner 调用的 ConfirmDialog 布局、中文文案和 Cindy Light/Dark token。本页仅用于审核用户可见效果,不是独立产品实现。</p>+ </div>+ <div class="preview-badge">静态预览 · 非 Windows 实机</div>+ </header>++ <section class="comparison" aria-label="Windows 更新器运行库提示的 Light 与 Dark 预览">+ <article class="scene light">+ <div class="scene-label"><strong>Light</strong><span>Windows Desktop · 更新入口</span></div>+ <div class="desktop-shell" aria-hidden="true">+ <aside class="sidebar">+ <p class="brand">CINDY</p>+ <div class="nav-item"></div>+ <div class="nav-item short"></div>+ <div class="nav-item"></div>+ </aside>+ <div class="content">+ <div class="content-title"></div>+ <div class="content-card"></div>+ <div class="content-card"></div>+ </div>+ </div>+ <div class="overlay">+ <section class="dialog" role="alertdialog" aria-labelledby="light-title" aria-describedby="light-description">+ <h2 class="dialog-title" id="light-title">需要安装 Microsoft Visual C++ 运行库</h2>+ <p class="dialog-description" id="light-description">这台电脑缺少更新程序所需的 Microsoft Visual C++ 运行库。已下载的更新包会保留;请安装微软官方 x64 运行库后重新检查。</p>+ <div class="actions">+ <button class="action primary" type="button">下载运行库</button>+ <button class="action" type="button">重新检查</button>+ <button class="action" type="button">稍后安装</button>+ </div>+ </section>+ </div>+ </article>++ <article class="scene dark">+ <div class="scene-label"><strong>Dark</strong><span>Windows Desktop · 更新入口</span></div>+ <div class="desktop-shell" aria-hidden="true">+ <aside class="sidebar">+ <p class="brand">CINDY</p>+ <div class="nav-item"></div>+ <div class="nav-item short"></div>+ <div class="nav-item"></div>+ </aside>+ <div class="content">+ <div class="content-title"></div>+ <div class="content-card"></div>+ <div class="content-card"></div>+ </div>+ </div>+ <div class="overlay">+ <section class="dialog" role="alertdialog" aria-labelledby="dark-title" aria-describedby="dark-description">+ <h2 class="dialog-title" id="dark-title">需要安装 Microsoft Visual C++ 运行库</h2>+ <p class="dialog-description" id="dark-description">这台电脑缺少更新程序所需的 Microsoft Visual C++ 运行库。已下载的更新包会保留;请安装微软官方 x64 运行库后重新检查。</p>+ <div class="actions">+ <button class="action primary" type="button">下载运行库</button>+ <button class="action" type="button">重新检查</button>+ <button class="action" type="button">稍后安装</button>+ </div>+ </section>+ </div>+ </article>+ </section>++ <p class="evidence-note">证据属性:<strong>高保真自包含 HTML 预览,非 Windows 实机截图</strong>。样式依据 <code>UpdateBanner.tsx</code>、<code>confirm-dialog.tsx</code> 与 Cindy Light/Dark 默认主题 token;未新增产品状态、交互或视觉设计。</p>+ </main>+ </body>+</html>diff --git a/docs/legal/notices/THIRD-PARTY-RESTRICTED.txt b/docs/legal/notices/THIRD-PARTY-RESTRICTED.txtindex c72237f50c..5938263404 100644--- a/docs/legal/notices/THIRD-PARTY-RESTRICTED.txt+++ b/docs/legal/notices/THIRD-PARTY-RESTRICTED.txt@@ -12,6 +12,13 @@ Category: proprietaryLicense: LicenseRef-Anthropic-Commercial-TermsSource: https://www.anthropic.com/legal/commercial-terms+------------------------------------------------------------------------------+Microsoft Visual C++ Runtime (Windows updater app-local DLLs)@14.44.35211.0+Category: proprietary+License: LicenseRef-Microsoft-Visual-Studio-Distributable-Code+Source: https://learn.microsoft.com/en-us/visualstudio/releases/2022/redistribution+Compliance note: Bundled only with the Windows x64 updater; not covered by Cindy's Apache-2.0 license. Exact Microsoft source, hashes, sizes and signer identities are recorded in apps/desktop/resources/cindy-updater-runtime/manifest.json.+------------------------------------------------------------------------------WeChat OpenSDK for [email protected]Category: restricted-review-requireddiff --git a/docs/legal/notices/desktop-win-restricted.txt b/docs/legal/notices/desktop-win-restricted.txtindex 453acd6953..72155fd12b 100644--- a/docs/legal/notices/desktop-win-restricted.txt+++ b/docs/legal/notices/desktop-win-restricted.txt@@ -12,6 +12,13 @@ Category: proprietaryLicense: LicenseRef-Anthropic-Commercial-TermsSource: https://www.anthropic.com/legal/commercial-terms+------------------------------------------------------------------------------+Microsoft Visual C++ Runtime (Windows updater app-local DLLs)@14.44.35211.0+Category: proprietary+License: LicenseRef-Microsoft-Visual-Studio-Distributable-Code+Source: https://learn.microsoft.com/en-us/visualstudio/releases/2022/redistribution+Compliance note: Bundled only with the Windows x64 updater; not covered by Cindy's Apache-2.0 license. Exact Microsoft source, hashes, sizes and signer identities are recorded in apps/desktop/resources/cindy-updater-runtime/manifest.json.+------------------------------------------------------------------------------@anthropic-ai/[email protected]Category: proprietarydiff --git a/scripts/__tests__/third-party-notices.test.mjs b/scripts/__tests__/third-party-notices.test.mjsindex 2677c47c5d..5b70b85088 100644--- a/scripts/__tests__/third-party-notices.test.mjs+++ b/scripts/__tests__/third-party-notices.test.mjs@@ -31,6 +31,12 @@ test("generated artifact notices are platform-scoped and disclose restricted comconst windowsRestricted = read("docs/legal/notices/desktop-win-restricted.txt",);+ const macosRestricted = read(+ "docs/legal/notices/desktop-macos-restricted.txt",+ );+ const linuxRestricted = read(+ "docs/legal/notices/desktop-linux-restricted.txt",+ );const iosRestricted = read("docs/legal/notices/mobile-ios-restricted.txt");const androidRestricted = read("docs/legal/notices/mobile-android-restricted.txt",@@ -51,6 +57,9 @@ test("generated artifact notices are platform-scoped and disclose restricted comassert.match(linux, /@img\/sharp-linux-x64@/);assert.doesNotMatch(windowsRestricted, /@codesandbox\/nodebox/);assert.doesNotMatch(windowsRestricted, /Sustainable Use License/);+ assert.match(windowsRestricted, /Microsoft Visual C\+\+ Runtime/);+ assert.doesNotMatch(macosRestricted, /Microsoft Visual C\+\+ Runtime/);+ assert.doesNotMatch(linuxRestricted, /Microsoft Visual C\+\+ Runtime/);assert.match(iosRestricted, /WeChat OpenSDK for iOS@2\.0\.5/);assert.match(iosRestricted, /docs\/legal\/wechat-open-sdk-compliance\.md/);assert.match(iosRestricted, /Mobile_App\/agreement\/sdk\.html/);diff --git a/scripts/generate-third-party-notices.mjs b/scripts/generate-third-party-notices.mjsindex 29cda124cc..5cf4e9cf49 100644--- a/scripts/generate-third-party-notices.mjs+++ b/scripts/generate-third-party-notices.mjs@@ -582,6 +582,23 @@ function readAndroidPlatformToolsVersion() {}}+function readWindowsUpdaterRuntimeVersion() {+ try {+ return readJson(+ path.join(+ REPO_ROOT,+ "apps",+ "desktop",+ "resources",+ "cindy-updater-runtime",+ "manifest.json",+ ),+ ).version;+ } catch {+ return "bundled";+ }+}+function bundledComponent(component) {return { ecosystem: "bundled", ...component };}@@ -1492,6 +1509,16 @@ const projectManual = mergeComponents(auditArtifact("project-aggregate", projectClosure, projectManual);const restrictedManualEntries = [+ {+ ecosystem: "bundled",+ name: "Microsoft Visual C++ Runtime (Windows updater app-local DLLs)",+ version: readWindowsUpdaterRuntimeVersion(),+ license: "LicenseRef-Microsoft-Visual-Studio-Distributable-Code",+ category: "proprietary",+ url: "https://learn.microsoft.com/en-us/visualstudio/releases/2022/redistribution",+ note: "Bundled only with the Windows x64 updater; not covered by Cindy's Apache-2.0 license. Exact Microsoft source, hashes, sizes and signer identities are recorded in apps/desktop/resources/cindy-updater-runtime/manifest.json.",+ artifacts: ["desktop-win"],+ },{ecosystem: "bundled",name: "Claude Code CLI",