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。

feat(desktop): enable beta channel on Linux x64 (#3853)

guyong-zapo15d33101ebb8
diff --git a/apps/desktop/src/main/__tests__/manifestService.test.ts b/apps/desktop/src/main/__tests__/manifestService.test.ts
index c66657ddd9..3d7113255b 100644
--- a/apps/desktop/src/main/__tests__/manifestService.test.ts
+++ b/apps/desktop/src/main/__tests__/manifestService.test.ts
@@ -4,6 +4,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { TEST_CDN_BASE_URL } from '../../test/vitest/clientEndpointsFixture';
+const originalPlatform = process.platform;
+const originalArch = process.arch;
const netRequest = vi.hoisted(() => vi.fn());
const canaryRead = vi.hoisted(() => vi.fn(() => false));
const isBetaChannelEnabled = vi.hoisted(() => vi.fn(() => false));
@@ -59,6 +61,22 @@ const RELEASE_MANIFEST = JSON.stringify({
app: { version: '0.0.65' },
});
+const LINUX_BETA_MANIFEST = {
+ app: {
+ version: '0.0.66',
+ installer: {
+ file: 'app/linux-x64/cindy-0.0.66-amd64.deb',
+ sha256: 'a'.repeat(64),
+ size: 123,
+ },
+ },
+};
+
+function setRuntime(platform: NodeJS.Platform, arch: string): void {
+ Object.defineProperty(process, 'platform', { value: platform, configurable: true });
+ Object.defineProperty(process, 'arch', { value: arch, configurable: true });
+}
+
describe('manifestService cache channel identity', () => {
beforeEach(() => {
netRequest.mockReset();
@@ -112,19 +130,98 @@ describe('probeBetaManifest', () => {
});
afterEach(async () => {
+ setRuntime(originalPlatform, originalArch);
const { clearCachedManifest } = await import('../manifestService');
clearCachedManifest();
});
it('rejects an HTTP 200 body that is not a usable beta manifest', async () => {
+ setRuntime('win32', 'x64');
mockManifestResponse('<html>error</html>');
const service = await import('../manifestService');
await expect(service.probeBetaManifest()).resolves.toBe(false);
});
- it('accepts a parseable beta manifest', async () => {
+ it('keeps accepting a parseable beta manifest outside Linux', async () => {
+ setRuntime('win32', 'x64');
mockManifestResponse(RELEASE_MANIFEST);
const service = await import('../manifestService');
await expect(service.probeBetaManifest()).resolves.toBe(true);
});
+
+ it('rejects a beta manifest whose app version is not valid SemVer', async () => {
+ setRuntime('linux', 'x64');
+ mockManifestResponse(
+ JSON.stringify({
+ ...LINUX_BETA_MANIFEST,
+ app: { ...LINUX_BETA_MANIFEST.app, version: 'not-semver' },
+ }),
+ );
+ const service = await import('../manifestService');
+
+ await expect(service.probeBetaManifest()).resolves.toBe(false);
+ });
+
+ it('accepts a Linux x64 beta manifest with a complete .deb installer', async () => {
+ setRuntime('linux', 'x64');
+ mockManifestResponse(JSON.stringify(LINUX_BETA_MANIFEST));
+ const service = await import('../manifestService');
+
+ await expect(service.probeBetaManifest()).resolves.toBe(true);
+ expect(String(netRequest.mock.calls[0]?.[0])).toContain('manifest-linux-x64-beta.json');
+ });
+
+ it.each([
+ ['a missing installer', { app: { version: '0.0.66' } }],
+ [
+ 'a non-deb installer',
+ {
+ app: {
+ ...LINUX_BETA_MANIFEST.app,
+ installer: { ...LINUX_BETA_MANIFEST.app.installer, file: 'cindy.rpm' },
+ },
+ },
+ ],
+ [
+ 'a malformed SHA-256',
+ {
+ app: {
+ ...LINUX_BETA_MANIFEST.app,
+ installer: { ...LINUX_BETA_MANIFEST.app.installer, sha256: 'abc' },
+ },
+ },
+ ],
+ [
+ 'a zero installer size',
+ {
+ app: {
+ ...LINUX_BETA_MANIFEST.app,
+ installer: { ...LINUX_BETA_MANIFEST.app.installer, size: 0 },
+ },
+ },
+ ],
+ [
+ 'a non-numeric installer size',
+ {
+ app: {
+ ...LINUX_BETA_MANIFEST.app,
+ installer: { ...LINUX_BETA_MANIFEST.app.installer, size: '123' },
+ },
+ },
+ ],
+ ])('rejects a Linux x64 beta manifest with %s', async (_case, manifest) => {
+ setRuntime('linux', 'x64');
+ mockManifestResponse(JSON.stringify(manifest));
+ const service = await import('../manifestService');
+
+ await expect(service.probeBetaManifest()).resolves.toBe(false);
+ });
+
+ it('does not probe the beta channel on Linux arm64', async () => {
+ setRuntime('linux', 'arm64');
+ const service = await import('../manifestService');
+
+ await expect(service.probeBetaManifest()).resolves.toBe(false);
+ expect(netRequest).not.toHaveBeenCalled();
+ });
});
diff --git a/apps/desktop/src/main/__tests__/updateChannelStore.test.ts b/apps/desktop/src/main/__tests__/updateChannelStore.test.ts
index 20e5e4447c..c88e9ce210 100644
--- a/apps/desktop/src/main/__tests__/updateChannelStore.test.ts
+++ b/apps/desktop/src/main/__tests__/updateChannelStore.test.ts
@@ -95,19 +95,41 @@ describe('tryEnableUncustomizedBetaAtomic', () => {
});
});
-describe('Linux beta channel gate', () => {
+describe('Beta channel build capability', () => {
const originalPlatform = process.platform;
+ const originalArch = process.arch;
afterEach(() => {
Object.defineProperty(process, 'platform', { value: originalPlatform, configurable: true });
+ Object.defineProperty(process, 'arch', { value: originalArch, configurable: true });
});
- it('keeps Linux on the release channel even when disk says beta is on', async () => {
+ it('allows Linux x64 to use a persisted beta setting', async () => {
Object.defineProperty(process, 'platform', { value: 'linux', configurable: true });
+ Object.defineProperty(process, 'arch', { value: 'x64', configurable: true });
+ const store = await loadStore();
+ await store.writeEnableBeta(true);
+
+ expect(store.readUpdateChannelSettings().enableBeta).toBe(true);
+ expect(store.isBetaChannelEnabled()).toBe(true);
+ });
+
+ it('keeps Linux arm64 on the release channel even when disk says beta is on', async () => {
+ Object.defineProperty(process, 'platform', { value: 'linux', configurable: true });
+ Object.defineProperty(process, 'arch', { value: 'arm64', configurable: true });
const store = await loadStore();
await store.writeEnableBeta(true);
expect(store.readUpdateChannelSettings().enableBeta).toBe(true);
expect(store.isBetaChannelEnabled()).toBe(false);
});
+
+ it('keeps the existing beta behavior on non-Linux builds', async () => {
+ Object.defineProperty(process, 'platform', { value: 'darwin', configurable: true });
+ Object.defineProperty(process, 'arch', { value: 'arm64', configurable: true });
+ const store = await loadStore();
+ await store.writeEnableBeta(true);
+
+ expect(store.isBetaChannelEnabled()).toBe(true);
+ });
});
diff --git a/apps/desktop/src/main/__tests__/updateService.test.ts b/apps/desktop/src/main/__tests__/updateService.test.ts
index 564a504603..a1ac71a965 100644
--- a/apps/desktop/src/main/__tests__/updateService.test.ts
+++ b/apps/desktop/src/main/__tests__/updateService.test.ts
@@ -5,6 +5,7 @@ import path from 'node:path';
import { TEST_CDN_BASE_URL as CDN_EXTERNAL_BASE_URL } from '../../test/vitest/clientEndpointsFixture';
const originalPlatform = process.platform;
+const originalArch = process.arch;
let TEST_ROOT: string;
let TEST_USER_DATA: string;
let TEST_EXE: string;
@@ -170,9 +171,14 @@ function setPlatform(value: NodeJS.Platform): void {
Object.defineProperty(process, 'platform', { value, configurable: true });
}
-async function freshUpdateService(platform: NodeJS.Platform) {
+function setArch(value: string): void {
+ Object.defineProperty(process, 'arch', { value, configurable: true });
+}
+
+async function freshUpdateService(platform: NodeJS.Platform, arch: string = originalArch) {
vi.resetModules();
setPlatform(platform);
+ setArch(arch);
return import('../updateService');
}
@@ -251,6 +257,7 @@ afterEach(() => {
vi.clearAllTimers();
vi.useRealTimers();
setPlatform(originalPlatform);
+ setArch(originalArch);
});
function updateManifest(version = '0.0.65', hotfixFile?: string) {
@@ -327,7 +334,7 @@ describe('checkForUpdate Linux installer flow', () => {
fs.writeFileSync(targetPath, 'deb');
return { path: targetPath, size: 123 };
});
- const { checkForUpdate, getUpdateStatus } = await freshUpdateService('linux');
+ const { checkForUpdate, getUpdateStatus } = await freshUpdateService('linux', 'x64');
const result = await checkForUpdate(linuxInstallerManifest('9.9.9'));
@@ -341,7 +348,7 @@ describe('checkForUpdate Linux installer flow', () => {
});
it('ignores a Linux hotfix zip and stays idle without an installer', async () => {
- const { checkForUpdate, getUpdateStatus } = await freshUpdateService('linux');
+ const { checkForUpdate, getUpdateStatus } = await freshUpdateService('linux', 'x64');
const result = await checkForUpdate({
app: {
@@ -367,13 +374,74 @@ describe('checkForUpdate Linux installer flow', () => {
});
});
- it('refuses the xd org beta default on Linux without writing to disk', async () => {
+ it('allows the xd org beta default on Linux x64', async () => {
+ tryEnableUncustomizedBetaAtomic.mockReset();
+ tryEnableUncustomizedBetaAtomic.mockResolvedValue(true);
+ const { enableUncustomizedBetaChannel } = await freshUpdateService('linux', 'x64');
+
+ await expect(enableUncustomizedBetaChannel()).resolves.toBe(true);
+ expect(tryEnableUncustomizedBetaAtomic).toHaveBeenCalledOnce();
+ });
+
+ it('refuses the xd org beta default on Linux arm64 without writing to disk', async () => {
tryEnableUncustomizedBetaAtomic.mockReset();
- const { enableUncustomizedBetaChannel } = await freshUpdateService('linux');
+ const { enableUncustomizedBetaChannel } = await freshUpdateService('linux', 'arm64');
await expect(enableUncustomizedBetaChannel()).resolves.toBe(false);
expect(tryEnableUncustomizedBetaAtomic).not.toHaveBeenCalled();
});
+
+ it('allows the beta channel setting to be written on Linux x64', async () => {
+ const service = await freshUpdateService('linux', 'x64');
+ service.initUpdateService();
+ try {
+ const setHandler = ipcHandlers.get('update-channel-settings-set');
+ expect(setHandler).toBeTypeOf('function');
+
+ await expect(
+ setHandler?.({ sender: { id: 1 } }, { enableBeta: true }),
+ ).resolves.toBeDefined();
+ expect(writeEnableBeta).toHaveBeenCalledWith(true);
+ } finally {
+ service.stopUpdateService();
+ }
+ });
+
+ it('rejects beta channel setting writes on Linux arm64', async () => {
+ const service = await freshUpdateService('linux', 'arm64');
+ service.initUpdateService();
+ try {
+ const setHandler = ipcHandlers.get('update-channel-settings-set');
+ expect(setHandler).toBeTypeOf('function');
+
+ await expect(
+ setHandler?.({ sender: { id: 1 } }, { enableBeta: true }),
+ ).rejects.toThrow('This build does not support the beta update channel');
+ expect(writeEnableBeta).not.toHaveBeenCalled();
+ } finally {
+ service.stopUpdateService();
+ }
+ });
+
+ it.each([
+ { arch: 'x64', expected: true },
+ { arch: 'arm64', expected: false },
+ ])('reports a persisted beta setting correctly on Linux $arch', async ({ arch, expected }) => {
+ readUpdateChannelSettings.mockReturnValue({
+ enableBeta: true,
+ orgDefaultEnableBeta: false,
+ });
+ const service = await freshUpdateService('linux', arch);
+ service.initUpdateService();
+ try {
+ const getHandler = ipcHandlers.get('update-channel-settings-get');
+ expect(getHandler).toBeTypeOf('function');
+
+ expect(getHandler?.({ sender: { id: 1 } })).toMatchObject({ enableBeta: expected });
+ } finally {
+ service.stopUpdateService();
+ }
+ });
});
describe('checkForUpdate 版本无关(占位 0.0.0)打包豁免', () => {
diff --git a/apps/desktop/src/main/__tests__/updateVersionPolicy.test.ts b/apps/desktop/src/main/__tests__/updateVersionPolicy.test.ts
index 7c872af35e..59a57ca58b 100644
--- a/apps/desktop/src/main/__tests__/updateVersionPolicy.test.ts
+++ b/apps/desktop/src/main/__tests__/updateVersionPolicy.test.ts
@@ -1,6 +1,14 @@
import { describe, expect, it } from 'vitest';
-import { compareAppUpdateVersions } from '../updateVersionPolicy';
+import { compareAppUpdateVersions, parseAppUpdateVersion } from '../updateVersionPolicy';
+
+describe('parseAppUpdateVersion', () => {
+ it('normalizes valid SemVer and rejects malformed input', () => {
+ expect(parseAppUpdateVersion('1.2.3')).toBe('1.2.3');
+ expect(parseAppUpdateVersion('not-semver')).toBeNull();
+ expect(parseAppUpdateVersion(null)).toBeNull();
+ });
+});
describe('compareAppUpdateVersions', () => {
it.each([
diff --git a/apps/desktop/src/main/manifestService.ts b/apps/desktop/src/main/manifestService.ts
index 5777b020b3..a1c019a22d 100644
--- a/apps/desktop/src/main/manifestService.ts
+++ b/apps/desktop/src/main/manifestService.ts
@@ -19,9 +19,11 @@ import * as canaryFlagStore from './canaryFlagStore';
import { resolveUpdateChannel, type UpdateChannel } from '@cindy/maker-shared/update-channel';
+import { supportsBetaUpdateChannel } from '../shared/updateChannelCapability';
import { createLogger } from './logger';
import { getClientEndpoint } from './clientEndpointsService';
import { isBetaChannelEnabled } from './updateChannelStore';
+import { parseAppUpdateVersion } from './updateVersionPolicy';
const log = createLogger('manifestService');
@@ -278,10 +280,29 @@ export function clearCachedManifest(): void {
* 「manifest 之后才判 isInstalled」顺序)——所以「能不能开」必须提前探明,
* 而不是等用户重启后才发现坏了。
*
- * HTTP 200 之后还要能解析出 app.version。截断 JSON / 错误页不能当成渠道可用。
+ * HTTP 200 之后还要能解析出 app.version;Linux 还必须带完整可信的 .deb 元数据。
+ * 截断 JSON / 错误页 / 不完整安装清单都不能当成渠道可用。
* 不写 cache、不改当前发布通道。dev 不联网,直接返回 true。
*/
+function isUsableBetaManifest(manifest: Manifest): boolean {
+ if (!parseAppUpdateVersion(manifest.app?.version)) return false;
+ if (process.platform !== 'linux') return true;
+
+ const installer = manifest.app.installer;
+ return Boolean(
+ installer &&
+ typeof installer.file === 'string' &&
+ installer.file.endsWith('.deb') &&
+ typeof installer.sha256 === 'string' &&
+ /^[a-f0-9]{64}$/i.test(installer.sha256) &&
+ typeof installer.size === 'number' &&
+ Number.isFinite(installer.size) &&
+ installer.size > 0,
+ );
+}
+
export function probeBetaManifest(timeoutMs = 8_000): Promise<boolean> {
+ if (!supportsBetaUpdateChannel(process.platform, process.arch)) return Promise.resolve(false);
if (isDev()) return Promise.resolve(true);
const url = `${getBaseUrl()}/manifest-${getPlatformKey()}-beta.json?t=${Date.now()}`;
return new Promise<boolean>((resolve) => {
@@ -311,7 +332,7 @@ export function probeBetaManifest(timeoutMs = 8_000): Promise<boolean> {
response.on('end', () => {
try {
const json = JSON.parse(body) as Manifest;
- finish(typeof json.app?.version === 'string' && json.app.version.length > 0);
+ finish(isUsableBetaManifest(json));
} catch {
finish(false);
}
diff --git a/apps/desktop/src/main/updateChannelStore.ts b/apps/desktop/src/main/updateChannelStore.ts
index d2e06bffe6..ebc11cfeaf 100644
--- a/apps/desktop/src/main/updateChannelStore.ts
+++ b/apps/desktop/src/main/updateChannelStore.ts
@@ -22,6 +22,7 @@
import { app } from 'electron';
import path from 'node:path';
+import { supportsBetaUpdateChannel } from '../shared/updateChannelCapability';
import { desktopMakerLogger } from './maker-host/logger-adapter.js';
import {
createOverrideSettingsFile,
@@ -148,8 +149,9 @@ export async function resetUpdateChannelSettings(): Promise<UpdateChannelSetting
/** manifestService 消费的单一读取入口:返回是否启用 beta(设备级)。 */
export function isBetaChannelEnabled(): boolean {
- // Linux 没有 beta 清单 / 热更 zip;隐藏开关后仍读落盘值会把客户端钉在不可达渠道。
- if (process.platform === 'linux') return false;
+ // Linux 目前仅 x64 发布 beta .deb。能力不支持时忽略落盘值,避免客户端被钉在
+ // 不可达渠道;同时保留值,用户回到支持的构建后仍沿用设备级选择。
+ if (!supportsBetaUpdateChannel(process.platform, process.arch)) return false;
return readUpdateChannelSettings().enableBeta;
}
diff --git a/apps/desktop/src/main/updateService.ts b/apps/desktop/src/main/updateService.ts
index aaacdc3ef7..9133218525 100644
--- a/apps/desktop/src/main/updateService.ts
+++ b/apps/desktop/src/main/updateService.ts
@@ -34,6 +34,7 @@ import {
} from '@cindy/maker-core/pi-subagent-runs';
import { BRAND_IDENTITY } from '@cindy/maker-shared/brand-identity';
+import { supportsBetaUpdateChannel } from '../shared/updateChannelCapability';
import { fetchManifest, getBaseUrl, isDev, probeBetaManifest, clearCachedManifest } from './manifestService';
import type { Manifest } from './manifestService';
import { download, DownloadError } from './downloader/index';
@@ -214,7 +215,7 @@ function broadcastStatus(payload: UpdateStatusPayload): void {
function channelSettingsWire() {
return {
- enableBeta: process.platform === 'linux' ? false : readUpdateChannelSettings().enableBeta,
+ enableBeta: readObservedEnableBetaFromDisk(),
isCustomized: isEnableBetaUserCustomized(),
};
}
@@ -647,7 +648,7 @@ function checkExistingPatch(): { action: 'relaunch' | 'check' | 'none'; version?
return { action: 'check' };
}
- const currentEnableBeta = readUpdateChannelSettings().enableBeta;
+ const currentEnableBeta = readObservedEnableBetaFromDisk();
if (typeof patchInfo.enableBeta === 'boolean' && patchInfo.enableBeta !== currentEnableBeta) {
log.info(
'discarding staged patch v%s from another update channel (patch=%s current=%s)',
@@ -735,7 +736,10 @@ function invalidateInFlightChannelDownloads(): void {
}
function readObservedEnableBetaFromDisk(): boolean {
- return readUpdateChannelSettings().enableBeta;
+ return (
+ supportsBetaUpdateChannel(process.platform, process.arch) &&
+ readUpdateChannelSettings().enableBeta
+ );
}
function restoreObservedEnableBetaFromDisk(): boolean {
@@ -2030,8 +2034,8 @@ export function initUpdateService(): void {
ipcMain.handle('update-channel-settings-set', async (event, payload: unknown) => {
assertTrustedAppRendererEvent(event);
- if (process.platform === 'linux') {
- throwIpcError('INVALID_PARAMS', 'Linux does not support the beta update channel');
+ if (!supportsBetaUpdateChannel(process.platform, process.arch)) {
+ throwIpcError('INVALID_PARAMS', 'This build does not support the beta update channel');
}
if (!payload || typeof payload !== 'object') {
throwIpcError('INVALID_PARAMS', 'update channel settings payload required');
@@ -2311,7 +2315,7 @@ export function initUpdateService(): void {
}, POLL_INTERVAL_MS);
}, FIRST_CHECK_DELAY_MS);
- observedEnableBeta = readUpdateChannelSettings().enableBeta;
+ observedEnableBeta = readObservedEnableBetaFromDisk();
log.info('Initialized — first check in 10s, polling every 30min');
}
@@ -2323,8 +2327,8 @@ export function initUpdateService(): void {
export async function enableUncustomizedBetaChannel(
shouldWrite: () => boolean = () => true,
): Promise<boolean> {
- // Linux 没有 beta 清单,组织默认打开只会把客户端钉在不可达渠道。
- if (process.platform === 'linux') return false;
+ // Linux 目前仅 x64 发布 beta .deb;arm64 等不支持构建不得写入组织默认。
+ if (!supportsBetaUpdateChannel(process.platform, process.arch)) return false;
const wasBeta = readUpdateChannelSettings().enableBeta;
// 先拦住 apply 再等落盘。身份守卫拒绝或写入失败时,旧补丁还得能用。
if (!wasBeta) {
diff --git a/apps/desktop/src/main/updateVersionPolicy.ts b/apps/desktop/src/main/updateVersionPolicy.ts
index 895ef3090c..96ef812696 100644
--- a/apps/desktop/src/main/updateVersionPolicy.ts
+++ b/apps/desktop/src/main/updateVersionPolicy.ts
@@ -9,6 +9,11 @@ const semver = createRequire(import.meta.url)('semver') as SemverApi;
export type AppUpdateVersionRelation = 'newer' | 'same' | 'older' | 'invalid';
+/** Normalize a strict app-update SemVer value, or fail closed for malformed input. */
+export function parseAppUpdateVersion(version: unknown): string | null {
+ return typeof version === 'string' ? semver.valid(version) : null;
+}
+
/**
* App updates are forward-only. Versions must be valid SemVer values; malformed
* versions fail closed instead of being coerced into an installable target.
@@ -17,12 +22,8 @@ export function compareAppUpdateVersions(
targetVersion: unknown,
currentVersion: unknown,
): AppUpdateVersionRelation {
- if (typeof targetVersion !== 'string' || typeof currentVersion !== 'string') {
- return 'invalid';
- }
-
- const target = semver.valid(targetVersion);
- const current = semver.valid(currentVersion);
+ const target = parseAppUpdateVersion(targetVersion);
+ const current = parseAppUpdateVersion(currentVersion);
if (!target || !current) return 'invalid';
const comparison = semver.compare(target, current);
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index d1abcc41c5..d8e100d1c9 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -5,6 +5,7 @@ import type {
CustomProviderUpdateOptions,
CustomProviderUpdateResult,
} from '../shared/customProviderUpdate';
+import { supportsBetaUpdateChannel } from '../shared/updateChannelCapability';
import {
isWindowsBackdropMaterial,
readWindowBackdropMaterialFromArgv,
@@ -942,6 +943,7 @@ type CindyMediaPreferenceKind = {
contextBridge.exposeInMainWorld('electronAPI', {
platform: process.platform,
+ supportsBetaUpdateChannel: supportsBetaUpdateChannel(process.platform, process.arch),
windowBackdropMaterial: readWindowBackdropMaterialFromArgv(process.argv),
onWindowBackdropMaterialChanged: (
cb: (material: import('../shared/windowBackdrop').WindowsBackdropMaterial) => void,
diff --git a/apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx b/apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx
index 81ebddbccf..cdfd5943cb 100644
--- a/apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx
@@ -23,6 +23,8 @@ import { BetaChannelCell } from './BetaChannelCell';
export function ExperimentalSection() {
const { t } = useTranslation();
+ const betaChannelSupported =
+ window.electronAPI?.supportsBetaUpdateChannel ?? window.electronAPI?.platform !== 'linux';
return (
<div className="flex flex-col gap-[14px]">
@@ -32,7 +34,7 @@ export function ExperimentalSection() {
<div className="flex flex-col gap-3">
<LspBetaCell />
- {window.electronAPI?.platform !== 'linux' ? <BetaChannelCell /> : null}
+ {betaChannelSupported ? <BetaChannelCell /> : null}
{EXPERIMENTAL_FEATURES.map((feature) => (
<ExperimentalFeatureRow key={feature.key} feature={feature} />
))}
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/linuxUpdateSettings.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/linuxUpdateSettings.test.tsx
index 34e13c59f9..41dffb1b07 100644
--- a/apps/desktop/src/renderer/components/settings/__tests__/linuxUpdateSettings.test.tsx
+++ b/apps/desktop/src/renderer/components/settings/__tests__/linuxUpdateSettings.test.tsx
@@ -47,8 +47,13 @@ describe('Linux update settings', () => {
afterEach(() => cleanup());
beforeEach(() => {
- (window as unknown as { electronAPI: { platform: string } }).electronAPI = {
+ (
+ window as unknown as {
+ electronAPI: { platform: string; supportsBetaUpdateChannel?: boolean };
+ }
+ ).electronAPI = {
platform: 'linux',
+ supportsBetaUpdateChannel: true,
};
});
@@ -70,7 +75,22 @@ describe('Linux update settings', () => {
expect(screen.queryByText('settings.about.linuxUpdateDescription')).toBeNull();
});
- it('hides the beta channel card on Linux', () => {
+ it('shows the beta channel card on Linux x64', () => {
+ render(<ExperimentalSection />);
+
+ expect(screen.getByText('lsp-beta-cell')).toBeTruthy();
+ expect(screen.getByText('beta-channel-cell')).toBeTruthy();
+ });
+
+ it('hides the beta channel card on Linux arm64', () => {
+ (
+ window as unknown as {
+ electronAPI: { platform: string; supportsBetaUpdateChannel?: boolean };
+ }
+ ).electronAPI = {
+ platform: 'linux',
+ supportsBetaUpdateChannel: false,
+ };
render(<ExperimentalSection />);
expect(screen.getByText('lsp-beta-cell')).toBeTruthy();
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 3f4b56bd0c..3734626ad5 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -754,7 +754,7 @@
"description": "Linux currently ships as a .deb for Ubuntu 22.04 / 24.04. When a newer build is available, the app downloads it and asks for your system password to install.",
"item1": "First install with sudo apt install ./cindy-<version>-<arch>.deb (amd64 on x64, arm64 on arm64).",
"item2": "In-app updates download the .deb. After you choose Update, a system prompt installs it over the current package.",
- "item3": "Linux does not offer the beta channel or idle auto-install, because installing requires your password."
+ "item3": "Linux x64 supports the Beta channel; arm64 does not yet. Neither architecture supports idle auto-install because installation requires system authorization."
},
"qnaTitle": "Ask directly",
"qnaDescription": "If the overview does not cover your question, ask what you want to do and I will point you to the right path.",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index dcfcd18b6e..3ed2c2e6e0 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -754,7 +754,7 @@
"description": "Linux は現在 Ubuntu 22.04 / 24.04 向けの .deb として提供されます。新しいビルドがある場合、アプリがダウンロードし、インストール時にシステムパスワードを求めます。",
"item1": "初回は sudo apt install ./cindy-<バージョン>-<アーキテクチャ>.deb でインストールします(x64 は amd64、arm64 は arm64)。",
"item2": "アプリ内更新は .deb をダウンロードします。更新を選ぶと、システム権限の確認後に上書きインストールします。",
- "item3": "インストールにパスワードが必要なため、Linux では Beta チャネルとアイドル時の自動インストールは提供しません。"
+ "item3": "Linux x64 では Beta チャネルを利用できますが、arm64 は現時点で利用できません。インストールにはシステム認証が必要なため、どちらもアイドル時の自動インストールには対応していません。"
},
"qnaTitle": "そのまま質問する",
"qnaDescription": "overview に載っていない内容でも、やりたいことを聞けば次に開く場所や進め方を案内します。",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 428b5e9cae..3daa757567 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -754,7 +754,7 @@
"description": "Linux는 현재 Ubuntu 22.04 / 24.04용 .deb로 제공됩니다. 새 빌드가 있으면 앱이 다운로드하고, 설치할 때 시스템 비밀번호를 묻습니다.",
"item1": "처음 설치할 때는 sudo apt install ./cindy-<버전>-<아키텍처>.deb 를 사용하세요(x64는 amd64, arm64는 arm64).",
"item2": "앱 안 업데이트는 .deb를 다운로드합니다. 업데이트를 선택하면 시스템 권한 확인 후 덮어써 설치합니다.",
- "item3": "설치에 비밀번호가 필요하므로 Linux에서는 Beta 채널과 유휴 상태 자동 설치를 제공하지 않습니다."
+ "item3": "Linux x64에서는 Beta 채널을 사용할 수 있지만 arm64는 아직 지원하지 않습니다. 설치에는 시스템 권한 승인이 필요하므로 두 아키텍처 모두 유휴 상태 자동 설치를 지원하지 않습니다."
},
"qnaTitle": "바로 질문하기",
"qnaDescription": "overview 에 없는 내용이라도 하고 싶은 일을 물어보면 다음에 열어야 할 곳이나 진행 방법을 안내합니다.",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 2b79262b11..a8c0aa6186 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -754,7 +754,7 @@
"description": "Linux 目前提供 Ubuntu 22.04 / 24.04 的 .deb 包。有新版本时,应用会下载安装包,安装时需要系统密码。",
"item1": "首次安装用 sudo apt install ./cindy-<版本>-<架构>.deb(x64 为 amd64,arm64 为 arm64)。",
"item2": "应用内更新会下载 .deb,点更新后通过系统权限提示覆盖安装。",
- "item3": "Linux 暂不提供 Beta 渠道和空闲时自动安装,因为安装需要输入密码。"
+ "item3": "Linux x64 支持 Beta 渠道,arm64 暂不支持。两种架构都不支持空闲时自动安装,因为安装需要系统授权。"
},
"qnaTitle": "直接提问",
"qnaDescription": "如果 overview 里没有覆盖到你的问题,可以直接问我该怎么做。",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index cda643d292..3a1d2af044 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -754,7 +754,7 @@
"description": "Linux 目前提供 Ubuntu 22.04 / 24.04 的 .deb 套件。有新版本時,應用程式會下載安裝包,安裝時需要系統密碼。",
"item1": "首次安裝用 sudo apt install ./cindy-<版本>-<架構>.deb(x64 為 amd64,arm64 為 arm64)。",
"item2": "應用程式內更新會下載 .deb,點更新後透過系統權限提示覆蓋安裝。",
- "item3": "Linux 暫不提供 Beta 渠道和空閒時自動安裝,因為安裝需要輸入密碼。"
+ "item3": "Linux x64 支援 Beta 渠道,arm64 暫不支援。兩種架構都不支援閒置時自動安裝,因為安裝需要系統授權。"
},
"qnaTitle": "直接提問",
"qnaDescription": "如果 overview 裡沒有覆蓋到你的問題,可以直接問我該怎麼做。",
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index 3ce362ac53..5805ce161a 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -1142,6 +1142,8 @@ type CindyMediaPreferenceKind = {
interface ElectronAPI {
platform: string;
+ /** 当前 Desktop 构建是否具备 Beta 更新渠道。 */
+ supportsBetaUpdateChannel?: boolean;
windowBackdropMaterial: import('../shared/windowBackdrop').WindowsBackdropMaterial;
onWindowBackdropMaterialChanged?: (
cb: (material: import('../shared/windowBackdrop').WindowsBackdropMaterial) => void,
diff --git a/apps/desktop/src/shared/updateChannelCapability.ts b/apps/desktop/src/shared/updateChannelCapability.ts
new file mode 100644
index 0000000000..4f9d3b4db5
--- /dev/null
+++ b/apps/desktop/src/shared/updateChannelCapability.ts
@@ -0,0 +1,7 @@
+/**
+ * Beta update-channel availability is a build capability, not a renderer-only
+ * visibility choice. Keep every caller on the same platform/architecture rule.
+ */
+export function supportsBetaUpdateChannel(platform: string, arch: string): boolean {
+ return platform !== 'linux' || arch === 'x64';
+}