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(client): 显示 Beta 渠道标识 (#3395)

guyong-zapoe5372685c44e
diff --git a/apps/desktop/src/renderer/__tests__/useBetaChannelSettings.test.tsx b/apps/desktop/src/renderer/__tests__/useBetaChannelSettings.test.tsx
new file mode 100644
index 0000000000..c10d525bb8
--- /dev/null
+++ b/apps/desktop/src/renderer/__tests__/useBetaChannelSettings.test.tsx
@@ -0,0 +1,61 @@
+// @vitest-environment jsdom
+
+import { act, cleanup, renderHook, waitFor } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { useBetaChannelSettings } from '@/hooks/useBetaChannelSettings';
+
+type ChannelSettings = {
+ enableBeta: boolean;
+ isCustomized?: boolean;
+};
+
+describe('useBetaChannelSettings', () => {
+ let persisted: ChannelSettings;
+
+ beforeEach(() => {
+ persisted = { enableBeta: false, isCustomized: false };
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: {
+ getUpdateChannelSettings: vi.fn(async () => persisted),
+ setUpdateChannelSettings: vi.fn(async ({ enableBeta }: { enableBeta: boolean }) => {
+ persisted = { enableBeta, isCustomized: true };
+ return persisted;
+ }),
+ resetUpdateChannelSettings: vi.fn(async () => {
+ persisted = { enableBeta: false, isCustomized: false };
+ return persisted;
+ }),
+ onUpdateChannelSettings: vi.fn(() => vi.fn()),
+ } as unknown as Window['electronAPI'],
+ });
+ });
+
+ afterEach(() => {
+ cleanup();
+ Reflect.deleteProperty(window, 'electronAPI');
+ });
+
+ it('keeps the switch and sidebar consumers aligned after each successful toggle', async () => {
+ const switchConsumer = renderHook(() => useBetaChannelSettings());
+ const badgeConsumer = renderHook(() => useBetaChannelSettings());
+
+ await waitFor(() => {
+ expect(switchConsumer.result.current.state.loading).toBe(false);
+ expect(badgeConsumer.result.current.state.loading).toBe(false);
+ });
+
+ await act(async () => {
+ await switchConsumer.result.current.setEnableBeta(true);
+ });
+ expect(switchConsumer.result.current.state.enableBeta).toBe(true);
+ expect(badgeConsumer.result.current.state.enableBeta).toBe(true);
+
+ await act(async () => {
+ await switchConsumer.result.current.setEnableBeta(false);
+ });
+ expect(switchConsumer.result.current.state.enableBeta).toBe(false);
+ expect(badgeConsumer.result.current.state.enableBeta).toBe(false);
+ });
+});
diff --git a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
index dd91d53cc8..559ce8c72d 100644
--- a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
@@ -23,7 +23,12 @@ const source = readFileSync(sourcePath, 'utf8');
const localePath = resolve(__dirname, '..', 'i18n', 'locales', 'zh-CN', 'common.json');
const locale = JSON.parse(readFileSync(localePath, 'utf8')) as {
sidebar: {
- user: { settingsLink: string; canaryBadge: string; downloadMobile: string };
+ user: {
+ settingsLink: string;
+ settingsLinkBeta: string;
+ canaryBadge: string;
+ downloadMobile: string;
+ };
mobileDownload: { title: string };
};
};
@@ -80,6 +85,17 @@ describe('UserInfoSection — version label', () => {
expect(source).toContain('{appVersionLabel}');
expect(source).toContain('title={appVersionLabelDetail}');
});
+
+ it('shows the Beta badge only after the persisted channel state has loaded', () => {
+ expect(source).toContain("import { useBetaChannelSettings } from '@/hooks/useBetaChannelSettings';");
+ expect(source).toContain(
+ 'const showBetaBadge = !betaChannelState.loading && betaChannelState.enableBeta;',
+ );
+ expect(source).toContain('data-testid="sidebar-beta-channel-badge"');
+ expect(source).toContain('bg-[var(--beta-channel-badge-bg)]');
+ expect(source).toContain('text-[var(--beta-channel-badge-fg)]');
+ expect(source).toContain("t('settings.betaChannel.badge')");
+ });
});
describe('UserInfoSection — Canary avatar badge', () => {
@@ -194,6 +210,16 @@ describe('UserInfoSection — inner main button no longer owns hover background'
expect(source).toContain('aria-label={settingsLinkLabel}');
expect(locale.sidebar.user.settingsLink).toBe('设置,当前用户:{{name}}');
});
+
+ it('announces the enabled Beta channel from the expanded settings link', () => {
+ expect(source).toContain(
+ "? t('sidebar.user.settingsLinkBeta', { name: displayName })",
+ );
+ expect(source).toContain('aria-label={settingsLinkAriaLabel}');
+ expect(locale.sidebar.user.settingsLinkBeta).toBe(
+ '设置,当前用户:{{name}},Beta 测试渠道已开启',
+ );
+ });
});
// ── 改动 3: Flame button 加 .flame-btn 标识 class ────────────────────────
diff --git a/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx b/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx
index 21f2f2006a..3d16bf6ce1 100644
--- a/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionMobileDownload.test.tsx
@@ -3,7 +3,8 @@
import { cleanup, fireEvent, render, screen } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-const { navigate } = vi.hoisted(() => ({
+const { betaChannelState, navigate } = vi.hoisted(() => ({
+ betaChannelState: { enableBeta: false, isCustomized: false, loading: false },
navigate: vi.fn(),
}));
@@ -34,6 +35,10 @@ vi.mock('@/hooks/useUpdateBannerDismiss', () => ({
useUpdateBannerDismiss: () => ({ dismissed: false, restore: vi.fn() }),
}));
+vi.mock('@/hooks/useBetaChannelSettings', () => ({
+ useBetaChannelSettings: () => ({ state: betaChannelState }),
+}));
+
vi.mock('@/components/sidebar/MobileDownloadDialog', () => ({
MobileDownloadDialog: ({
open,
@@ -63,6 +68,8 @@ import { UserInfoSection } from '@/components/sidebar/UserInfoSection';
beforeEach(() => {
navigate.mockClear();
+ betaChannelState.enableBeta = false;
+ betaChannelState.loading = false;
Object.defineProperty(window, 'electronAPI', {
configurable: true,
value: {
@@ -75,6 +82,18 @@ beforeEach(() => {
afterEach(cleanup);
describe('UserInfoSection mobile download entry', () => {
+ it('shows the Beta badge beside the expanded app version when the channel is enabled', () => {
+ betaChannelState.enableBeta = true;
+ render(<UserInfoSection isCollapsed={false} />);
+
+ expect(screen.getByTestId('sidebar-beta-channel-badge').textContent).toBe(
+ 'settings.betaChannel.badge',
+ );
+ expect(
+ screen.getByRole('link', { name: 'sidebar.user.settingsLinkBeta' }),
+ ).toBeTruthy();
+ });
+
it.each([
['expanded', false],
['collapsed', true],
diff --git a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
index 79f51c887b..6450d4bfe6 100644
--- a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
@@ -7,6 +7,7 @@ import { cn } from '@/lib/utils';
import { useAuth } from '@/contexts/AuthContext';
import { useUpdateStatus } from '@/hooks/useUpdateStatus';
import { useUpdateBannerDismiss } from '@/hooks/useUpdateBannerDismiss';
+import { useBetaChannelSettings } from '@/hooks/useBetaChannelSettings';
import { Tip } from '@/components/ui/tooltip';
import { CURRENT_CINDY_REGION } from '../../../shared/brandRegion';
import { shouldLabelRegion } from '../../../shared/regionCode';
@@ -32,14 +33,19 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
// (更新历史入口暂时让位,banner 再次出现后关掉才会回到"历史入口"模式)。
const { status } = useUpdateStatus();
const { dismissed, restore } = useUpdateBannerDismiss();
+ const { state: betaChannelState } = useBetaChannelSettings();
const hasPendingUpdate = status === 'ready' || status === 'superseding';
const isFlameReopen = hasPendingUpdate && dismissed;
+ const showBetaBadge = !betaChannelState.loading && betaChannelState.enableBeta;
// 头像地址变化(设置页改头像 / 服务端资料更新)时重置加载失败标记,
// 让新地址有机会渲染,而不是永远停在首字母兜底。
const isLocal = mode === 'local';
const displayName = user?.name ?? (isLocal ? t('settings.userProfile.local.name') : '');
const settingsLinkLabel = t('sidebar.user.settingsLink', { name: displayName });
+ const settingsLinkAriaLabel = showBetaBadge
+ ? t('sidebar.user.settingsLinkBeta', { name: displayName })
+ : settingsLinkLabel;
const avatarUrl = user?.avatar ?? null;
useEffect(() => {
setAvatarError(false);
@@ -187,7 +193,7 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
<button
onClick={handleClick}
role="link"
- aria-label={settingsLinkLabel}
+ aria-label={settingsLinkAriaLabel}
className={cn('flex min-w-0 flex-1 items-center gap-[10px]', 'text-left')}
>
{/* Avatar — admin 用户加 1.5px 反色描边 + 右下角盾牌角标 */}
@@ -246,10 +252,18 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
</p>
{/* 2px gap 与同栏 userNameContainer 保持一致。 */}
<p
- className="truncate text-10 leading-[1.3] text-[var(--sidebar-user-card-text)] opacity-80"
+ className="flex min-w-0 items-center gap-1 text-10 leading-[1.3] text-[var(--sidebar-user-card-text)]"
title={appVersionLabelDetail}
>
- {appVersionLabel}
+ <span className="truncate opacity-80">{appVersionLabel}</span>
+ {showBetaBadge ? (
+ <span
+ className="shrink-0 select-none rounded-full bg-[var(--beta-channel-badge-bg)] px-1 font-medium text-[var(--beta-channel-badge-fg)]"
+ data-testid="sidebar-beta-channel-badge"
+ >
+ {t('settings.betaChannel.badge')}
+ </span>
+ ) : null}
</p>
</div>
</button>
diff --git a/apps/desktop/src/renderer/hooks/useBetaChannelSettings.ts b/apps/desktop/src/renderer/hooks/useBetaChannelSettings.ts
index ff47da7af0..8c12da2452 100644
--- a/apps/desktop/src/renderer/hooks/useBetaChannelSettings.ts
+++ b/apps/desktop/src/renderer/hooks/useBetaChannelSettings.ts
@@ -25,6 +25,18 @@ function normalize(payload: BetaChannelSettingsPayload): BetaChannelSettingsStat
};
}
+type StateSubscriber = (payload: BetaChannelSettingsPayload) => void;
+
+// 设置页开关与侧栏徽标位于同一 renderer,但会各自调用一次 hook。
+// 写入成功后只在 renderer 内同步这份 UI 状态,不让纯展示逻辑侵入更新服务。
+const stateSubscribers = new Set<StateSubscriber>();
+
+function publishState(payload: BetaChannelSettingsPayload): void {
+ for (const subscriber of stateSubscribers) {
+ subscriber(payload);
+ }
+}
+
/**
* beta 测试渠道(设备级)开关的状态与写操作。
* 语义与 auto-update-settings 一致:默认值 + override,恢复默认只删 override。
@@ -39,6 +51,12 @@ export function useBetaChannelSettings(): {
useEffect(() => {
let cancelled = false;
let latestSeq = 0;
+ const applyPayload = (payload: BetaChannelSettingsPayload) => {
+ if (cancelled) return;
+ latestSeq += 1;
+ setState(normalize(payload));
+ };
+ stateSubscribers.add(applyPayload);
void window.electronAPI
.getUpdateChannelSettings()
.then((payload) => {
@@ -49,13 +67,10 @@ export function useBetaChannelSettings(): {
if (cancelled || latestSeq !== 0) return;
setState((current) => ({ ...current, loading: false }));
});
- const unsubscribe = window.electronAPI.onUpdateChannelSettings((payload) => {
- if (cancelled) return;
- latestSeq += 1;
- setState(normalize(payload));
- });
+ const unsubscribe = window.electronAPI.onUpdateChannelSettings(applyPayload);
return () => {
cancelled = true;
+ stateSubscribers.delete(applyPayload);
unsubscribe();
};
}, []);
@@ -64,12 +79,12 @@ export function useBetaChannelSettings(): {
const payload = await window.electronAPI.setUpdateChannelSettings({
enableBeta: enabled,
});
- setState(normalize(payload));
+ publishState(payload);
}, []);
const reset = useCallback(async () => {
const payload = await window.electronAPI.resetUpdateChannelSettings();
- setState(normalize(payload));
+ publishState(payload);
}, []);
return { state, setEnableBeta, reset };
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 16202c7bbb..dbf426fbb4 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -1956,6 +1956,7 @@
},
"betaChannel": {
"title": "Beta channel",
+ "badge": "Beta",
"description": "Join the beta channel to receive upcoming client updates early. Takes effect after restart.",
"toggleAria": "Beta channel toggle",
"restartTitle": "Restart Cindy",
@@ -6365,6 +6366,7 @@
},
"user": {
"settingsLink": "Settings, current user: {{name}}",
+ "settingsLinkBeta": "Settings, current user: {{name}}, Beta channel enabled",
"canaryBadge": "Canary user",
"regionCodeCn": "CN",
"regionCodeDev": "Dev",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 4668ef542f..7422342c6d 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -1955,6 +1955,7 @@
},
"betaChannel": {
"title": "Beta チャンネル",
+ "badge": "Beta",
"description": "Beta チャンネルに参加すると、今後のクライアント更新を先行して受け取れます。再起動後に反映されます。",
"toggleAria": "Beta チャンネルの切り替え",
"restartTitle": "クライアントを再起動",
@@ -6363,6 +6364,7 @@
},
"user": {
"settingsLink": "設定, 現在のユーザー: {{name}}",
+ "settingsLinkBeta": "設定, 現在のユーザー: {{name}}, Beta チャンネル有効",
"canaryBadge": "Canary ユーザー",
"regionCodeCn": "CN",
"regionCodeDev": "Dev",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 5093449c03..54cb7b8b17 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -1955,6 +1955,7 @@
},
"betaChannel": {
"title": "베타 채널",
+ "badge": "Beta",
"description": "베타 채널에 참여하면 출시 예정인 클라이언트 업데이트를 먼저 받을 수 있습니다. 재시작 후 적용됩니다.",
"toggleAria": "베타 채널 토글",
"restartTitle": "클라이언트 재시작",
@@ -6363,6 +6364,7 @@
},
"user": {
"settingsLink": "설정, 현재 사용자: {{name}}",
+ "settingsLinkBeta": "설정, 현재 사용자: {{name}}, 베타 채널 활성화됨",
"canaryBadge": "Canary 사용자",
"regionCodeCn": "CN",
"regionCodeDev": "Dev",
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 38119ef2f2..9563bbeb5b 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -1947,6 +1947,7 @@
},
"betaChannel": {
"title": "Beta 测试渠道",
+ "badge": "Beta",
"description": "加入 Beta 测试渠道,提前接收即将发布的客户端更新。开启后需重启客户端生效。",
"toggleAria": "Beta 测试渠道开关",
"restartTitle": "重启客户端",
@@ -6355,6 +6356,7 @@
},
"user": {
"settingsLink": "设置,当前用户:{{name}}",
+ "settingsLinkBeta": "设置,当前用户:{{name}},Beta 测试渠道已开启",
"canaryBadge": "灰度用户",
"regionCodeCn": "CN",
"regionCodeDev": "Dev",
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 64d76b0123..736afb4aae 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -1947,6 +1947,7 @@
},
"betaChannel": {
"title": "Beta 測試管道",
+ "badge": "Beta",
"description": "加入 Beta 測試管道,提前接收即將發布的客戶端更新。開啟後需重新啟動客戶端生效。",
"toggleAria": "Beta 測試管道開關",
"restartTitle": "重新啟動客戶端",
@@ -6355,6 +6356,7 @@
},
"user": {
"settingsLink": "設定,當前使用者:{{name}}",
+ "settingsLinkBeta": "設定,當前使用者:{{name}},Beta 測試管道已開啟",
"canaryBadge": "灰度使用者",
"regionCodeCn": "CN",
"regionCodeDev": "Dev",
diff --git a/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts b/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts
index 9ca5f1a017..8c7c21d5d1 100644
--- a/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts
+++ b/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts
@@ -400,6 +400,7 @@ export const RED_EXCEPTION_ALLOWED_IDS = [
'brand-login-bg',
'brand-login-error-border',
'brand-login-error-text',
+ 'beta-channel-badge-bg', // 用户指定 Beta 状态徽标红底,2026-08-25
// hover/soft token(中性,但 token 名保留在 allowed 防误报)
'accent-soft',
'accent-hover',
diff --git a/apps/desktop/src/renderer/themes/__tests__/tokenRegistry.test.ts b/apps/desktop/src/renderer/themes/__tests__/tokenRegistry.test.ts
index b8ce60aa4d..79248252cd 100644
--- a/apps/desktop/src/renderer/themes/__tests__/tokenRegistry.test.ts
+++ b/apps/desktop/src/renderer/themes/__tests__/tokenRegistry.test.ts
@@ -64,6 +64,16 @@ describe('主题注册表 · 资源用量进程图标', () => {
});
});
+describe('主题注册表 · Beta 渠道状态徽标', () => {
+ it.each([
+ ['beta-channel-badge-bg', '#DF0C27'],
+ ['beta-channel-badge-fg', '#FFFFFF'],
+ ] as const)('"%s" 使用 light / dark 同值的专用语义色', (id, hex) => {
+ expect(colorRegistry.resolveDefault(id, 'light')).toBe(hex);
+ expect(colorRegistry.resolveDefault(id, 'dark')).toBe(hex);
+ });
+});
+
describe('主题注册表 · Plan 操作卡文字语义', () => {
it.each(['plan-action-approve-text', 'plan-action-fb-text'])(
'"%s" 使用卡片强调正文而非反相按钮文字',
diff --git a/apps/desktop/src/renderer/themes/colors.ts b/apps/desktop/src/renderer/themes/colors.ts
index ed80d50c73..0ee2943f84 100644
--- a/apps/desktop/src/renderer/themes/colors.ts
+++ b/apps/desktop/src/renderer/themes/colors.ts
@@ -380,6 +380,14 @@ registerColor('destructive', {
light: '0 84% 60%',
dark: '0 72% 63%',
}, 'Titlebar — Ollama layer system (Light)');
+registerColor('beta-channel-badge-bg', {
+ light: '#DF0C27',
+ dark: '#DF0C27',
+}, 'Beta 测试渠道已开启徽标底色(用户指定红底,2026-08-25;跨主题固定品牌红)');
+registerColor('beta-channel-badge-fg', {
+ light: '#FFFFFF',
+ dark: '#FFFFFF',
+}, 'Beta 测试渠道已开启徽标文字(× #DF0C27 = 4.98:1)');
// confirm-dialog
registerColor('confirm-bg', {
diff --git a/apps/mobile/app/settings.tsx b/apps/mobile/app/settings.tsx
index b140138645..26e24734e7 100644
--- a/apps/mobile/app/settings.tsx
+++ b/apps/mobile/app/settings.tsx
@@ -147,6 +147,7 @@ export default function SettingsScreen() {
// beta 测试渠道(设备级)开关。真相在 betaChannelStore;hydrate 完成前禁用,避免对陈旧值取反。
const { enabled: betaEnabled, ready: betaReady, setEnabled: setBetaEnabled } = useBetaChannel();
const [betaBusy, setBetaBusy] = useState(false);
+ const showBetaBadge = betaReady && betaEnabled;
const updateCheckInFlightRef = useRef(false);
// 语音词典:手机只读展示被控桌面的词典快照(正本在桌面,手机不参与合并)。
const [dictionaryScreenOpen, setDictionaryScreenOpen] = useState(false);
@@ -858,7 +859,14 @@ export default function SettingsScreen() {
<View key="version" style={styles.versionRow} testID="settings.version">
<View style={styles.versionTexts}>
<Text style={styles.rowLabel}>{t('settings.version.currentLabel')}</Text>
- <Text style={styles.versionValue} numberOfLines={1}>{t('settings.version.bundleVersion', { version: appVersion })}</Text>
+ <View style={styles.versionValueRow}>
+ <Text style={styles.versionValue} numberOfLines={1}>{t('settings.version.bundleVersion', { version: appVersion })}</Text>
+ {showBetaBadge ? (
+ <View style={styles.betaChannelBadge} testID="settings.betaChannelBadge">
+ <Text style={styles.betaChannelBadgeText}>{t('settings.betaChannel.badge')}</Text>
+ </View>
+ ) : null}
+ </View>
<Text style={styles.rowDetail} numberOfLines={1} testID="settings.otaVersion">{t('settings.version.otaVersion', { version: otaVersion })}</Text>
{/* 二级版本号:自建线打包所配对的桌面产品线版本(0.0.x),不是在线电脑的实时版本;仅自建线且已注入时显示 */}
{IS_OTA_SELFHOST && DESKTOP_PACKAGE_VERSION ? (
@@ -1619,7 +1627,20 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
paddingVertical: spacing.md,
},
versionTexts: { flex: 1, gap: 2, minWidth: 0 },
- versionValue: { color: colors.textPrimary, fontSize: typeScale.body, fontWeight: fontWeight.semibold },
+ versionValueRow: { alignItems: 'center', flexDirection: 'row', gap: spacing.sm },
+ versionValue: { color: colors.textPrimary, flexShrink: 1, fontSize: typeScale.body, fontWeight: fontWeight.semibold },
+ betaChannelBadge: {
+ backgroundColor: colors.betaChannelBadgeBackground,
+ borderRadius: radius.pill,
+ flexShrink: 0,
+ paddingHorizontal: spacing.sm,
+ paddingVertical: 1,
+ },
+ betaChannelBadgeText: {
+ color: colors.betaChannelBadgeForeground,
+ fontSize: typeScale.micro,
+ fontWeight: fontWeight.semibold,
+ },
versionButton: { flexShrink: 0, minWidth: 84 },
// —— 可复制行 ——
copyRow: {
diff --git a/apps/mobile/docs/mobile-design-guide.md b/apps/mobile/docs/mobile-design-guide.md
index 4881596412..b1e8dd5ed7 100644
--- a/apps/mobile/docs/mobile-design-guide.md
+++ b/apps/mobile/docs/mobile-design-guide.md
@@ -11,7 +11,7 @@
承接桌面:**灰度为主、零阴影、pill 几何、字重克制**。在此之上叠加移动端约束:
- **iOS 优先**,触控优先,跟随系统 light / dark 自动切换(`useColorScheme`)。
-- **灰度环境**:除品牌 teal(就绪态)和 Heart Orange(运行/thinking 态)两个语义色外,界面全是黑白之间的灰阶。不引入任何品牌蓝 / 绿 / 红等装饰色。
+- **灰度环境**:除品牌 teal(就绪态)、Heart Orange(运行/thinking 态)和已登记的 Beta 渠道红色状态徽标外,界面全是黑白之间的灰阶。不引入任何品牌蓝 / 绿 / 红等装饰色。
- **圆角走四档阶梯**(与 `src/theme/tokens.ts` 的 `radius` 一致,守护测试拦截阶梯外值):`micro`(4,缩略图内 chip、勾选指示器等微元素)/ `control`(8,卡片内层控件)/ `container`(12,卡片 / 容器)/ `pill`(9999,交互元素)。**禁止**阶梯外中间值(0 / 3 / 6 / 28 等)与字面量圆角。根规范 `docs/design-rules/DESIGN.md` §5 的三档制约束的是桌面 surface;其「Mobile」节明确把 §15.13 / §16 之外的 mobile 布局细节委托给 `apps/mobile` 的实现,mobile 圆角阶梯以 `tokens.ts` 为准。
- **零阴影**:层次靠背景色差 + 1px 边框,不用 `shadow*` / `elevation`。
- **字重克制**:只用 400 / 500,极少量大写微标签可用 600。**UI chrome 无 700+**。唯一例外是根规范 `docs/design-rules/DESIGN.md` §3「排版豁免登记表」已登记的域——原生 Markdown strong(`src/session/MessageRenderer.tsx` 的 `markdownStrong` → `fontWeight.bold`)与登录品牌画布(`app/(auth)/login.tsx`、`src/components/LoginSkinControls.tsx`、`src/auth/loginSkinLayout.ts`)。这些是用户内容语义与品牌画布,不算 chrome;chrome 本身的上限仍是 600。
@@ -42,13 +42,15 @@
| `homeListFab` | `#262626` | `#ECEDEF` | 素雅新建对话 FAB:dark 用柔白而非纯白 cta,避免主入口在深底上过跳 |
| `statusReady` | `#00D9C5` | `#00D9C5` | 就绪 / 在线点(品牌 teal,**语义不变**) |
| `statusAccent` | `#ff6600` | `#ff6600` | 运行 / thinking + 完全访问权限(Heart Orange,**语义不变**) |
+| `betaChannelBadgeBackground` | `#DF0C27` | `#DF0C27` | Beta 渠道开关已打开时,当前版本旁的状态徽标底色 |
+| `betaChannelBadgeForeground` | `#FFFFFF` | `#FFFFFF` | Beta 渠道状态徽标文字,与底色对比度 4.98:1 |
| `permAutoAccent` | `#000050` | `#00D9C5` | 自动审批权限模式强调(对齐桌面 `--perm-auto-selected-text`) |
| `errorText` | `#262626` | `#d4d4d4` | 错误文字(跟随 textPrimary) |
| `errorBorder` | `#a3a3a3` | `#525252` | 错误边框(跟随 borderStrong) |
| `overlay` | rgba(38,38,38,.24) | rgba(0,0,0,.45) | modal / lightbox 背板 |
**规则:**
-- **语义不变色**(`statusReady` / `statusAccent`)跨 light / dark 一致——它们是状态语义,不随主题漂移。
+- **语义不变色**(`statusReady` / `statusAccent` / `betaChannelBadgeBackground` / `betaChannelBadgeForeground`)跨 light / dark 一致——它们是状态语义,不随主题漂移。Beta 红色只用于设置页当前版本旁的渠道徽标,不得扩展为装饰色、错误色或 CTA。
- **CTA 在 dark 反相为白**:`cta` 白底 + `ctaText` 深字。注意别让白 pill 看起来像 disabled——新增主操作 / 选中态后在 dark 下目检。
- **Home 对话列表用 base token**:列表背景 / 分隔 / 文字使用 `surface` / `border` / `text*`,菜单选中用 `surfaceChip`,不另起暗色调色板;菜单 / FAB 只用 1px `border` 分层、零阴影,保持桌面「单一 flat Surface + 1px Board」哲学。
- 不要在组件里硬编码 hex / rgba;找不到合适 token 时跟维护者确认是否新增,而不是写死。
diff --git a/apps/mobile/src/__tests__/mobileSettings.test.ts b/apps/mobile/src/__tests__/mobileSettings.test.ts
index b8d92ecd48..677d7c6c42 100644
--- a/apps/mobile/src/__tests__/mobileSettings.test.ts
+++ b/apps/mobile/src/__tests__/mobileSettings.test.ts
@@ -250,6 +250,11 @@ describe('mobile settings overview', () => {
expect(source).toContain("testID=\"settings.testFlightUpdateHint\"");
expect(source).toContain("{t('settings.version.testFlightUpdateManaged')}");
expect(source).toContain("{t('settings.version.bundleVersion', { version: appVersion })}");
+ expect(source).toContain('const showBetaBadge = betaReady && betaEnabled;');
+ expect(source).toContain('testID="settings.betaChannelBadge"');
+ expect(source).toContain("{t('settings.betaChannel.badge')}");
+ expect(source).toContain('backgroundColor: colors.betaChannelBadgeBackground');
+ expect(source).toContain('color: colors.betaChannelBadgeForeground');
expect(source).toContain(
"testID=\"settings.otaVersion\">{t('settings.version.otaVersion', { version: otaVersion })}",
);
diff --git a/apps/mobile/src/__tests__/themeTokens.test.ts b/apps/mobile/src/__tests__/themeTokens.test.ts
index 9ff8b3987e..a18d08f860 100644
--- a/apps/mobile/src/__tests__/themeTokens.test.ts
+++ b/apps/mobile/src/__tests__/themeTokens.test.ts
@@ -182,6 +182,17 @@ describe('theme tokens', () => {
expect(darkColors.cta).not.toBe(darkColors.brandSplashBackground);
});
+ it('Beta 渠道状态徽标使用跨主题固定红底白字,且小字对比度 ≥4.5:1', () => {
+ expect(lightColors.betaChannelBadgeBackground).toBe('#DF0C27');
+ expect(darkColors.betaChannelBadgeBackground).toBe('#DF0C27');
+ expect(lightColors.betaChannelBadgeForeground).toBe('#FFFFFF');
+ expect(darkColors.betaChannelBadgeForeground).toBe('#FFFFFF');
+ expect(contrastRatio(
+ lightColors.betaChannelBadgeForeground,
+ lightColors.betaChannelBadgeBackground,
+ )).toBeGreaterThanOrEqual(4.5);
+ });
+
it('typeScale 严格单调递增', () => {
const sizes = Object.values(typeScale);
for (let i = 1; i < sizes.length; i += 1) {
diff --git a/apps/mobile/src/i18n/locales/en/settings.json b/apps/mobile/src/i18n/locales/en/settings.json
index 75e6d87548..baa2911103 100644
--- a/apps/mobile/src/i18n/locales/en/settings.json
+++ b/apps/mobile/src/i18n/locales/en/settings.json
@@ -39,6 +39,7 @@
},
"betaChannel": {
"title": "Beta channel",
+ "badge": "Beta",
"description": "Join the beta channel to receive upcoming client updates early.",
"restartHint": "The beta channel takes effect after restarting the app. Please restart to apply.",
"ok": "Got it",
diff --git a/apps/mobile/src/i18n/locales/ja/settings.json b/apps/mobile/src/i18n/locales/ja/settings.json
index 80f1638b2b..b626ff3028 100644
--- a/apps/mobile/src/i18n/locales/ja/settings.json
+++ b/apps/mobile/src/i18n/locales/ja/settings.json
@@ -39,6 +39,7 @@
},
"betaChannel": {
"title": "Beta チャンネル",
+ "badge": "Beta",
"description": "Beta チャンネルに参加すると、今後のクライアント更新を先行して受け取れます。",
"restartHint": "Beta チャンネルは再起動後に反映されます。アプリを再起動してください。",
"ok": "わかりました",
diff --git a/apps/mobile/src/i18n/locales/ko/settings.json b/apps/mobile/src/i18n/locales/ko/settings.json
index c2cf61bd04..c61fc48637 100644
--- a/apps/mobile/src/i18n/locales/ko/settings.json
+++ b/apps/mobile/src/i18n/locales/ko/settings.json
@@ -39,6 +39,7 @@
},
"betaChannel": {
"title": "베타 채널",
+ "badge": "Beta",
"description": "베타 채널에 참여하면 출시 예정인 클라이언트 업데이트를 먼저 받을 수 있습니다.",
"restartHint": "베타 채널은 앱을 재시작해야 적용됩니다. 앱을 다시 시작해 주세요.",
"ok": "확인",
diff --git a/apps/mobile/src/i18n/locales/zh-CN/settings.json b/apps/mobile/src/i18n/locales/zh-CN/settings.json
index 6f643476c5..7a8b89c66c 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/settings.json
+++ b/apps/mobile/src/i18n/locales/zh-CN/settings.json
@@ -39,6 +39,7 @@
},
"betaChannel": {
"title": "Beta 测试渠道",
+ "badge": "Beta",
"description": "加入 Beta 测试渠道,提前接收即将发布的客户端更新。",
"restartHint": "Beta 测试渠道需要重启客户端后才能生效,请重启应用。",
"ok": "我知道了",
diff --git a/apps/mobile/src/i18n/locales/zh-TW/settings.json b/apps/mobile/src/i18n/locales/zh-TW/settings.json
index 86adee983b..10654f28f8 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/settings.json
+++ b/apps/mobile/src/i18n/locales/zh-TW/settings.json
@@ -39,6 +39,7 @@
},
"betaChannel": {
"title": "Beta 測試管道",
+ "badge": "Beta",
"description": "加入 Beta 測試管道,提前接收即將發布的客戶端更新。",
"restartHint": "Beta 測試管道需要重新啟動客戶端後才能生效,請重新啟動應用。",
"ok": "我知道了",
diff --git a/apps/mobile/src/theme/tokens.ts b/apps/mobile/src/theme/tokens.ts
index 49bb8048b1..ab331b93ce 100644
--- a/apps/mobile/src/theme/tokens.ts
+++ b/apps/mobile/src/theme/tokens.ts
@@ -89,6 +89,10 @@ export interface ThemeColors {
brandSplashForeground: string;
/** App 内品牌 splash 二级文案 */
brandSplashMuted: string;
+ /** Beta 测试渠道已开启徽标红底(用户指定,跨主题不变) */
+ betaChannelBadgeBackground: string;
+ /** Beta 测试渠道已开启徽标白字(与红底对比度 4.98:1) */
+ betaChannelBadgeForeground: string;
/** Chip / pill / 选中行填充 */
surfaceChip: string;
/** 1px 分隔线 / 边框(桌面 Board) */
@@ -394,6 +398,8 @@ export const lightColors: ThemeColors = {
brandSplashBackground: '#DF0C27',
brandSplashForeground: '#FFFFFF',
brandSplashMuted: 'rgba(255, 255, 255, 0.82)',
+ betaChannelBadgeBackground: '#DF0C27',
+ betaChannelBadgeForeground: '#FFFFFF',
surfaceChip: '#F1F1F1',
border: '#C6C9CE', // 试穿 B 档(原 #DCDFE3,light 对 #EDEDED 仅 1.14:1 太弱 → 1.42:1)
borderTranslucent: 'rgba(198, 201, 206, 0.62)',
@@ -466,6 +472,8 @@ export const darkColors: ThemeColors = {
brandSplashBackground: '#DF0C27',
brandSplashForeground: '#FFFFFF',
brandSplashMuted: 'rgba(255, 255, 255, 0.82)',
+ betaChannelBadgeBackground: '#DF0C27',
+ betaChannelBadgeForeground: '#FFFFFF',
surfaceChip: '#2F2D2D',
border: '#434343',
borderTranslucent: 'rgba(67, 67, 67, 0.62)',
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 51950fe352..78a6f882b9 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -474,6 +474,12 @@ Theme switching: `useTheme.ts` provides `theme` (System / Light / Dark mode) plu
| `--file-badge-pdf/-doc/-sheet/-slide/-code` + `--file-badge-fg` | `#B23A26` / `#2C5CA8` / `#2E7D4F` / `#A25A12` / `#5B49A8`, fg `#FFFFFF` | same | File-type badges on the self-drawn attachment icon (2026-07-27). Bound to _what the file is_, not to the theme, so both modes share one value. Each accent is picked for ≥4.5:1 against `--file-badge-fg` (5.96 / 6.56 / 5.05 / 5.24 / 7.09) — the badge label renders at 10px (Micro Label floor, §3), so AA small-text applies. `--file-badge-fg` is a standalone white: `--accent-pure-cta-fg` flips to black in Dark and cannot be borrowed. |
| `--process-agent-task-icon`, `--process-agent-service-icon`, `--process-main-icon`, `--process-renderer-icon`, `--process-gpu-icon`, `--process-utility-icon` | `#2563EB` / `#7C3AED` / `#DB2777` / `#0891B2` / `#D97706` / `#059669` | `#60A5FA` / `#A78BFA` / `#F472B6` / `#22D3EE` / `#F59E0B` / `#34D399` | Resource Usage 14px process-category glyphs only (2026-08-06). Category cue, not status; all surrounding UI stays neutral. Protected from automatic external-theme import so category identity does not drift. |
+`--beta-channel-badge-bg/-fg` (mobile `betaChannelBadgeBackground/Foreground`) are the
+cross-theme fixed pair `#DF0C27` / `#FFFFFF`. They are limited to the enabled Beta-channel
+badge beside the installed app version (desktop sidebar + mobile Settings), explicitly requested
+2026-08-25. This is a persistent channel-state cue, not an error or CTA; white text contrast is
+4.98:1.
+
Never freestyle these semantic colors as hardcoded hex — always go through the corresponding token.
### Built-in Themes
@@ -1142,7 +1148,7 @@ The splash wordmark is a separate asset pair (`assets/splash/wordmark.png`, whit
### 15.10 Red-System Boundary & Neutral CTAs — current state(E1D 红色边界)
- Ordinary primary actions never use brand red — they are neutral-inverse. **Neutral button four states**: light bg `#3C3F43` / text `#FCFCFC`, hover `#2E3237`, pressed `#25282C`; dark bg `#EEEEEE` / text `#151515` (2026-08: inverse dark text shifted with the darker ramp, was `#252222`), hover `#E2E2E2`, pressed `#D4D4D4` (WCAG 10.32/15.74:1).
-- Red is confined to semantic exceptions: `destructive`/delete, `error-*`, warning, diff red, status dots — plus the login brand accent via `--login-brand-accent` (§16). The older `brand-login-*` tokens were retired with the wave4 white-canvas login and survive only as whitelist strings in `cindyDecisionData.ts` (harmless — the whitelist permits, it does not require).
+- Red is confined to semantic exceptions: `destructive`/delete, `error-*`, warning, diff red, status dots, and the explicit Beta-channel state badge (`--beta-channel-badge-bg/-fg`, user decision 2026-08-25) — plus the login brand accent via `--login-brand-accent` (§16). The older `brand-login-*` tokens were retired with the wave4 white-canvas login and survive only as whitelist strings in `cindyDecisionData.ts` (harmless — the whitelist permits, it does not require).
- **send-btn family**: `send-btn-bg/-icon/-hover-bg/-pressed-bg/-disabled-bg/-disabled-icon` — CINDY overrides the whole family to the neutral four states + disabled grays (light `#444242`/`#585555` unchanged; dark shifted 2026-08 to `#323232`/`#464646`); defaults keep `--accent-cta-bg` with the opacity-85 hover. Whole family sits in `cindyDecisionData` REQUIRED_IDS + CINDY_EXPECTED, guarded by assertion ③.
- **Sidebar color hierarchy** (same set for light/dark):
- Body (session titles) = `text-foreground` (= `text-primary`: light `#3C3F43` / dark `#D4D4D4`).
@@ -1274,7 +1280,7 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the
登录页是**黑白反色**体系(亮色 = 白底墨字 / 深色 = 深底米字),与编辑器主界面解耦,亮 / 深两模式镜像同构:
- **面板 / 控件走墨黑–米白反色,深色镜像反相**:亮色白面板 `#FBFBFB` + 米白控件 `#EEEEEE` + 墨黑主按钮 `#2A2828`;深色反相为深面板 `#312F2F` + 深控件 `#2C2A2A` + 白主按钮 `#EEEEEE`。**两模式的面板 / 控件底色与文字都不出现纯黑 `#000` 或纯白 `#fff`**(`figma-component-spec §1.1`);细描边例外——暗色主按钮 / 圆钮的 `#FFFFFF` 白边为 figma `white_button` 实测值,不受此限。
-- **品牌红 `#DF0C27` 只用于区域徽标(旧称 Global pill,见 §16.3)与字标红元素等品牌 accent,跨模式不变**;**禁止作页面背景**(wave4 改判,见 `token-decision-table §3` 对 `#df0c27` 的语义判定),不渗入面板内部(呼应 §15.10 红色边界)。画布底走 `--login-bg-base`(亮 `#EDEDED` / 深 `#1F1F1E`),红只经 `--login-brand-accent` 消费。错误红 `#D91F37` 同样跨模式不变(语义豁免,呼应 §10 豁免族)。
+- **品牌红 `#DF0C27` 在登录画布内只用于区域徽标(旧称 Global pill,见 §16.3)与字标红元素等品牌 accent,跨模式不变**;画布外仅有 §15.10 登记的 Beta 渠道状态徽标例外。**禁止作页面背景**(wave4 改判,见 `token-decision-table §3` 对 `#df0c27` 的语义判定),不渗入面板内部(呼应 §15.10 红色边界)。画布底走 `--login-bg-base`(亮 `#EDEDED` / 深 `#1F1F1E`),红只经 `--login-brand-accent` 消费。错误红 `#D91F37` 同样跨模式不变(语义豁免,呼应 §10 豁免族)。
- **`--login-*` 调色板双态目标值** —— token 已注册于 `apps/desktop/src/renderer/themes/colors.ts`(dark 槽位当前为 light 占位值)。下表为深色实现的目标规格,经 Figma 组件库 Dark symbol 逐个核验;实现 PR 须将 dark 槽位更新为本表 dark 列的值:
| token | light | dark | 核验源 |