Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(login): 跳过登录入口取代游客登录,登录面板增高至 500 并适配全端 (#697)
Praisee2173a4a7445
diff --git a/apps/desktop/src/main/__tests__/analyticsConsentMigrationGuards.test.ts b/apps/desktop/src/main/__tests__/analyticsConsentMigrationGuards.test.tsnew file mode 100644index 0000000000..1761e98660--- /dev/null+++ b/apps/desktop/src/main/__tests__/analyticsConsentMigrationGuards.test.ts@@ -0,0 +1,122 @@+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';+import { describe, expect, it } from 'vitest';++/**+ * 存量同意迁移「关窗」链路的回归守卫。+ *+ * 为什么用源码守卫:`authManager.ts` 依赖 Electron(safeStorage / app),无法在 node+ * 测试环境直接 import 执行(沿用 authSessionExpiredDetection.test.ts 的既有模式);+ * 而 analyticsSettingsService.test.ts 里 authManager 是被 mock 掉的 —— 那边只能验证+ * 「假设探测结果是 X 时下游怎么走」,验证不到真实实现本身。这个文件补上后半截。+ *+ * 守护的契约(2026-07-28 review,两个方向都是隐私红线):+ * 1. 关窗判据必须区分「凭证确定不存在」与「暂时探不出来」。探不出来时保留窗口,+ * 否则 realm 清单不可用 / refresh 瞬态失败(两处都刻意保留 token)的真存量用户+ * 会被永久误判、永远拿不到同意迁移。+ * 2. 用户主动进入本地模式(跳过登录)是**无歧义**的确定性事件,必须绕过探测直接封窗。+ * 否则密钥链恰好不可用的那一刻,跳过登录用户探不出「凭证已删」→ 不关窗 → 之后+ * 走免协议 SSO 时会被静默迁移成「已同意」,等于未经同意打开采集。+ */+describe('legacy consent migration window guards', () => {+ const authSource = readFileSync(resolve(process.cwd(), 'src/main/authManager.ts'), 'utf8').replace(+ /\r\n/g,+ '\n',+ );+ const serviceSource = readFileSync(+ resolve(process.cwd(), 'src/main/analyticsSettingsService.ts'),+ 'utf8',+ ).replace(/\r\n/g, '\n');++ it('hasNoPersistedAuthCredentials 覆盖 initialize 会消费的两个凭证 key', () => {+ const start = authSource.indexOf('export function hasNoPersistedAuthCredentials(): boolean {');+ expect(start).toBeGreaterThan(-1);+ const body = authSource.slice(start, authSource.indexOf('\n}\n', start));++ // initialize() 恢复登录时读的就是这两个:原子记录 + 旧格式 token(见+ // readPersistedAuthSession 与 initialize 里的 legacyToken 分支)。其余 LEGACY_*+ // key 只被 removeSafe 清理、从不读回,不影响「还能不能恢复登录」的判定。+ expect(body).toContain('isPersistedSecretAbsent(AUTH_SESSION_KEY)');+ expect(body).toContain('isPersistedSecretAbsent(LEGACY_RESOURCE_REFRESH_TOKEN_KEY)');+ // 必须两者同时缺席才算「没有凭证」。+ expect(body).toContain('&&');+ });++ it('hasNoPersistedAuthCredentials 复用 isPersistedSecretAbsent,不自造 existsSync 判定', () => {+ const start = authSource.indexOf('export function hasNoPersistedAuthCredentials(): boolean {');+ const body = authSource.slice(start, authSource.indexOf('\n}\n', start));++ // existsSync 对 EPERM/EACCES 同样返回 false,会把「没权限读」误判成「已删除」;+ // 也不得直接 readSafe(它把加密不可用/解密失败都折叠成 null = 看着像没凭证)。+ expect(body).not.toContain('existsSync');+ expect(body).not.toContain('readSafe');+ expect(body).not.toContain('readPersistedAuthSession');+ });++ it('冷启动关窗必须先过凭证闸,探测失败时保留窗口', () => {+ const start = serviceSource.indexOf('function closeMigrationWindowOrLog(): void {');+ expect(start).toBeGreaterThan(-1);+ const body = serviceSource.slice(start, serviceSource.indexOf('\n}\n', start));++ expect(body).toContain('if (!authManager.hasNoPersistedAuthCredentials())');+ // 闸不通过 = 直接 return,不得落盘。+ expect(body.indexOf('hasNoPersistedAuthCredentials')).toBeLessThan(+ body.indexOf('sealMigrationWindowOrLog()'),+ );+ // 探测自身抛错(密钥链异常)也按「结论不明确」处理,同样保留窗口。+ expect(body).toContain('keeping migration window open');+ });++ it('进入本地模式时直接封窗,不经过凭证探测闸', () => {+ const start = serviceSource.indexOf('export function initAnalyticsSettingsService(): void {');+ const body = serviceSource.slice(start, serviceSource.indexOf('ipcMain.handle(', start));++ // 用户主动跳过登录无歧义:调 seal(无条件),不是 close(带探测闸)。+ expect(body).toContain('if (authManager.isLocalMode()) sealMigrationWindowOrLog();');+ expect(body).not.toContain('closeMigrationWindowOrLog');+ // 封窗要发生在广播之前:广播出去的 allowed 必须已经反映本地模式。+ expect(body.indexOf('sealMigrationWindowOrLog()')).toBeLessThan(+ body.indexOf('broadcastSettingsChange()'),+ );+ });++ it('上报结论叠加本地模式运行时闸,且不写盘', () => {+ const start = serviceSource.indexOf('function isReportingAllowedNow(): boolean {');+ expect(start).toBeGreaterThan(-1);+ const body = serviceSource.slice(start, serviceSource.indexOf('\n}\n', start));++ expect(body).toContain('isAnalyticsAllowed()');+ expect(body).toContain('!authManager.isLocalMode()');+ // 闸是运行时的:不得在这里写 store(那会篡改用户的同意与开关这两个持久真相)。+ expect(body).not.toContain('setAnalyticsEnabled');+ expect(body).not.toContain('writePatch');++ // payload 必须消费这道闸,而不是裸的 isAnalyticsAllowed()。+ const payloadStart = serviceSource.indexOf(+ 'export function analyticsSettingsPayload(): AnalyticsSettingsPayload {',+ );+ const payloadBody = serviceSource.slice(+ payloadStart,+ serviceSource.indexOf('\n}\n', payloadStart),+ );+ expect(payloadBody).toContain('allowed: isReportingAllowedNow()');+ });++ it('auth 订阅在 quit 与测试重置时都会退订', () => {+ expect(serviceSource).toContain('unsubscribeAuthState = authManager.onAuthStateChange(');++ const quitStart = serviceSource.indexOf("onQuit('analytics-settings', () => {");+ const quitBody = serviceSource.slice(quitStart, serviceSource.indexOf('});', quitStart));+ expect(quitBody).toContain('unsubscribeAuthState?.();');+ expect(quitBody).toContain('unsubscribeAuthState = null;');++ const resetStart = serviceSource.indexOf('resetForTests(): void {');+ const resetBody = serviceSource.slice(resetStart, serviceSource.indexOf('},', resetStart));+ expect(resetBody).toContain('unsubscribeAuthState?.();');++ // 订阅必须在 ipcRegistered 早返回之后 —— 否则二次 init 会重复订阅、重复广播。+ expect(serviceSource.indexOf('ipcRegistered = true;')).toBeLessThan(+ serviceSource.indexOf('unsubscribeAuthState = authManager.onAuthStateChange('),+ );+ });+});diff --git a/apps/desktop/src/main/__tests__/analyticsSettingsService.test.ts b/apps/desktop/src/main/__tests__/analyticsSettingsService.test.tsindex 11f296c1fd..3a81f1bc9a 100644--- a/apps/desktop/src/main/__tests__/analyticsSettingsService.test.ts+++ b/apps/desktop/src/main/__tests__/analyticsSettingsService.test.ts@@ -1,17 +1,35 @@/*** analyticsSettingsService.test.ts —— 存量同意迁移的触发边界。*- * 这个边界是本次改动最容易被改坏的地方:迁移只能认**冷启动恢复出来的**登录态。- * 如果放宽成「任何时候看到登录就算同意」,新的企业 SSO 登录会被误判为已同意——- * 而登录页的协议门恰恰豁免了 SSO 入口,那些用户从没点过「同意」。+ * 这个边界是本次改动最容易被改坏的地方,三条都不能放宽:+ * 1. 迁移只能认**冷启动恢复出来的**登录态。放宽成「任何时候看到登录就算同意」,+ * 新的企业 SSO 登录会被误判为已同意——登录页的协议门恰恰豁免了 SSO 入口。+ * 2. 只有**真实账号**算已登录。本地模式(跳过登录)同样免协议门,把它算成已登录+ * 等于给从未同意隐私协议的用户静默打开采集。+ * 3. 「无存量登录态」的冷启动结论必须**落盘**(2026-07-28 review P1):否则+ * 「跳过登录 → 从本地模式走登录入口 → 完成 SSO」之后的下一次冷启动会看到+ * 「真实账号 + 零记录」,与真存量账号无法区分,被静默迁移。异常/未决不落盘。*/import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+/** 广播到 renderer 的 payload 序列 —— 本地模式的 opt-out 必须真的被重播出去。 */+const broadcasts: Array<Record<string, unknown>> = [];vi.mock('electron', () => ({app: { getPath: () => '/tmp/analytics-service-test' },ipcMain: { handle: vi.fn() },- BrowserWindow: { getAllWindows: () => [] },+ BrowserWindow: {+ getAllWindows: () => [+ {+ isDestroyed: () => false,+ webContents: {+ send: (_channel: string, payload: Record<string, unknown>) => {+ broadcasts.push(payload);+ },+ },+ },+ ],+ },}));vi.mock('../logger', () => ({createLogger: () => ({ info: () => {}, warn: () => {}, error: () => {} }),@@ -22,20 +40,62 @@ vi.mock('../security/trustedAppRenderer.js', () => ({}));const isLocalMode = vi.fn(() => false);+/**+ * 「本机确定没有持久登录凭证」。默认 true(= 干净新装/已清凭证),需要模拟+ * 「有账号但本次冷启动瞬态失败仍保留 token」的机器时置 false。+ */+const hasNoPersistedAuthCredentials = vi.fn(() => true);+let authStateListener: (() => void) | null = null;vi.mock('../authManager', () => ({isLocalMode: () => isLocalMode(),+ hasNoPersistedAuthCredentials: () => hasNoPersistedAuthCredentials(),getAuthState: () => ({ isAuthenticated: false }),- onAuthStateChange: () => () => {},+ onAuthStateChange: (listener: () => void) => {+ authStateListener = listener;+ return () => {+ authStateListener = null;+ };+ },}));-const migrateExistingLoginAsConsented = vi.fn((_signedIn: boolean) => true);+/**+ * 盘上那份 analytics-settings.json 的内存替身。+ *+ * 迁移替身会真的往里写 privacyConsentAccepted,这样「有没有被静默开启采集」可以按+ * 落盘结果断言,而不是只看函数被调了几次——隐私红线要看结果。+ * legacyConsentMigrationClosed 同理:它是**持久**标记,替身跨 importService(= 跨+ * 「重启」)存活,skip → SSO 链路的回归必须按「下次冷启动还认不认」断言。+ */+const fakeSettings = {+ privacyConsentAccepted: false,+ analyticsEnabled: true,+ legacyConsentMigrationClosed: false,+};+function migrateIntoFakeSettings(signedIn: boolean): boolean {+ if (!signedIn) return false;+ if (fakeSettings.privacyConsentAccepted) return false;+ if (fakeSettings.legacyConsentMigrationClosed) return false;+ fakeSettings.privacyConsentAccepted = true;+ return true;+}+const migrateExistingLoginAsConsented = vi.fn(migrateIntoFakeSettings);+function closeIntoFakeSettings(): boolean {+ if (fakeSettings.legacyConsentMigrationClosed) return false;+ fakeSettings.legacyConsentMigrationClosed = true;+ return true;+}+const closeLegacyConsentMigration = vi.fn(closeIntoFakeSettings);vi.mock('../analytics-settings-store', () => ({- migrateExistingLoginAsConsented: (signedIn: boolean) =>- migrateExistingLoginAsConsented(signedIn),+ migrateExistingLoginAsConsented: (signedIn: boolean) => migrateExistingLoginAsConsented(signedIn),+ closeLegacyConsentMigration: () => closeLegacyConsentMigration(),acceptPrivacyConsent: vi.fn(),setAnalyticsEnabled: vi.fn(),- isAnalyticsAllowed: () => false,- readAnalyticsSettings: () => ({ privacyConsentAccepted: false, analyticsEnabled: true }),+ clearAnalyticsEnabledOverride: vi.fn(),+ // store 侧的真实语义(构建闸在真实实现里另算,这里按已同意 && 开关开启放行),+ // 这样「本地模式闸」是否生效可以被独立断言。+ isAnalyticsAllowed: () => fakeSettings.privacyConsentAccepted && fakeSettings.analyticsEnabled,+ isAnalyticsEnabledCustomized: () => false,+ readAnalyticsSettings: () => ({ ...fakeSettings }),}));async function importService() {@@ -45,8 +105,18 @@ async function importService() {beforeEach(() => {isLocalMode.mockReturnValue(false);+ hasNoPersistedAuthCredentials.mockReturnValue(true);+ authStateListener = null;+ fakeSettings.privacyConsentAccepted = false;+ fakeSettings.analyticsEnabled = true;+ fakeSettings.legacyConsentMigrationClosed = false;migrateExistingLoginAsConsented.mockClear();- migrateExistingLoginAsConsented.mockReturnValue(true);+ // mockClear 只清调用记录、**不还原 implementation**:用例里注入的 throw 替身若不在+ // 这里恢复,会泄漏到后续用例,把「不该关窗 / 不该迁移」的断言变成假绿(异常被吞掉,+ // 看着像没执行)。两个替身都必须显式复位。+ migrateExistingLoginAsConsented.mockImplementation(migrateIntoFakeSettings);+ closeLegacyConsentMigration.mockClear();+ closeLegacyConsentMigration.mockImplementation(closeIntoFakeSettings);});afterEach(() => {@@ -60,15 +130,131 @@ describe('cold-start consent migration', () => {service.noteAuthColdStartState({ isAuthenticated: true }, null);expect(migrateExistingLoginAsConsented).toHaveBeenCalledTimes(1);+ expect(fakeSettings.privacyConsentAccepted).toBe(true);});- it('migrates a restored local-mode (guest) session too', async () => {+ // 「跳过登录」= 不创建账号、不上报数据(2026-07-27 拍板),刻意免协议门。把它当成+ // 已登录会在下一次冷启动静默写入 privacyConsentAccepted,等于未经同意开启采集。+ it('never migrates a restored local-mode (skip-login) session', async () => {isLocalMode.mockReturnValue(true);const service = await importService();service.noteAuthColdStartState({ isAuthenticated: false }, null);- expect(migrateExistingLoginAsConsented).toHaveBeenCalledTimes(1);+ expect(migrateExistingLoginAsConsented).not.toHaveBeenCalled();+ expect(fakeSettings.privacyConsentAccepted).toBe(false);+ });++ it('never migrates when the pending cold start settles into local mode', async () => {+ isLocalMode.mockReturnValue(true);+ const service = await importService();++ const pending = Promise.resolve({ isAuthenticated: false });+ service.noteAuthColdStartState({ isAuthenticated: false }, pending);+ await pending;+ await Promise.resolve();++ expect(migrateExistingLoginAsConsented).not.toHaveBeenCalled();+ expect(fakeSettings.privacyConsentAccepted).toBe(false);+ });++ // 2026-07-28 review P1:本地模式冷启动 = 本机确定不是「改版前存量账号」,这个结论+ // **落盘**、永久有效。用户之后从本地模式走登录入口完成企业 SSO(免协议门、零同意+ // 记录),下一次冷启动恢复出「真实账号 + 零记录」——与真存量账号长得一模一样,若+ // 窗口没关死就会被静默迁移成已同意。个人账号登录不受影响:协议门放行那刻已写入+ // 真同意(acceptPrivacyConsent),根本轮不到迁移。+ it('never migrates on a later cold start once a skip-login cold start closed the window (skip → SSO)', async () => {+ isLocalMode.mockReturnValue(true);+ const localOnly = await importService();+ localOnly.noteAuthColdStartState({ isAuthenticated: false }, null);+ expect(fakeSettings.privacyConsentAccepted).toBe(false);+ expect(fakeSettings.legacyConsentMigrationClosed).toBe(true);++ // 新进程:模块级 guard 重置,这次冷启动恢复出的是(经免协议 SSO 建立的)真实账号。+ isLocalMode.mockReturnValue(false);+ const signedIn = await importService();+ signedIn.noteAuthColdStartState({ isAuthenticated: true }, null);++ // migrate 可以被调(第三道闸在 store 内),但绝不允许写入同意。+ expect(fakeSettings.privacyConsentAccepted).toBe(false);+ });++ it('also closes the window persistently on a plain signed-out cold start (pure-SSO new install)', async () => {+ const first = await importService();+ first.noteAuthColdStartState({ isAuthenticated: false }, null);+ expect(fakeSettings.legacyConsentMigrationClosed).toBe(true);++ // 纯 SSO 新装:之后 SSO 登录成功,下次冷启动恢复出真实账号,同样不得迁移。+ const restarted = await importService();+ restarted.noteAuthColdStartState({ isAuthenticated: true }, null);+ expect(fakeSettings.privacyConsentAccepted).toBe(false);+ });++ it('closes the window when the pending cold start settles into signed-out', async () => {+ const service = await importService();++ const pending = Promise.resolve({ isAuthenticated: false });+ service.noteAuthColdStartState({ isAuthenticated: false }, pending);+ await pending;+ await Promise.resolve();++ expect(fakeSettings.legacyConsentMigrationClosed).toBe(true);+ });++ it('does NOT persist the closure when the pending cold start rejects — verdict unclear', async () => {+ // 弱网存量用户:refresh 异常 ≠「确定没有存量登录态」。落盘会把真存量用户永久误判。+ const service = await importService();++ service.noteAuthColdStartState({ isAuthenticated: false }, Promise.reject(new Error('boom')));+ await new Promise((resolve) => setTimeout(resolve, 0));++ expect(fakeSettings.legacyConsentMigrationClosed).toBe(false);++ // 下一次冷启动(新进程)恢复出真实账号:窗口仍开,存量用户照常迁移。+ const restarted = await importService();+ restarted.noteAuthColdStartState({ isAuthenticated: true }, null);+ expect(fakeSettings.privacyConsentAccepted).toBe(true);+ });++ it('never lets a failing window-closure break authentication', async () => {+ closeLegacyConsentMigration.mockImplementation(() => {+ throw new Error('EROFS: read-only file system');+ });+ isLocalMode.mockReturnValue(true);+ const service = await importService();++ expect(() => service.noteAuthColdStartState({ isAuthenticated: false }, null)).not.toThrow();+ });++ // 2026-07-28 review 追加(P2):`initialize()` 在对端区域清单不可用 / cold-start+ // refresh 瞬态失败时会**保留 refresh token** 并以未登录放行 UI(pendingCompletion+ // === null)。那种机器下一次冷启动就是真实的存量账号,绝不能因为这一次的「未登录」+ // 被永久关窗 —— 否则存量用户永远拿不到本该有的同意迁移。+ it('keeps the window open when a signed-out cold start still holds persisted credentials', async () => {+ hasNoPersistedAuthCredentials.mockReturnValue(false);+ const transient = await importService();++ transient.noteAuthColdStartState({ isAuthenticated: false }, null);++ expect(closeLegacyConsentMigration).not.toHaveBeenCalled();+ expect(fakeSettings.legacyConsentMigrationClosed).toBe(false);++ // 下一次冷启动 refresh 成功,恢复出真实的存量账号:迁移照常发生。+ const recovered = await importService();+ recovered.noteAuthColdStartState({ isAuthenticated: true }, null);+ expect(fakeSettings.privacyConsentAccepted).toBe(true);+ });++ it('keeps the window open when the pending cold start settles signed-out with credentials intact', async () => {+ hasNoPersistedAuthCredentials.mockReturnValue(false);+ const service = await importService();++ const pending = Promise.resolve({ isAuthenticated: false });+ service.noteAuthColdStartState({ isAuthenticated: false }, pending);+ await pending;+ await Promise.resolve();++ expect(fakeSettings.legacyConsentMigrationClosed).toBe(false);});it('does not migrate a signed-out cold start', async () => {@@ -77,6 +263,7 @@ describe('cold-start consent migration', () => {service.noteAuthColdStartState({ isAuthenticated: false }, null);expect(migrateExistingLoginAsConsented).not.toHaveBeenCalled();+ expect(fakeSettings.privacyConsentAccepted).toBe(false);});it('ignores logins that happen after the cold-start verdict (e.g. enterprise SSO)', async () => {@@ -133,7 +320,9 @@ describe('cold-start consent migration', () => {expect(migrateExistingLoginAsConsented).toHaveBeenCalledTimes(1);});- it('closes the migration window when the pending cold start rejects', async () => {+ it('still seals the in-process verdict when the pending cold start rejects', async () => {+ // 异常只关**本进程**的窗(migrationEvaluated),不落盘 —— 持久语义见上面的+ // "does NOT persist the closure" 用例。同进程内稍后的登录(如 SSO)不得迁移。const service = await importService();service.noteAuthColdStartState({ isAuthenticated: false }, Promise.reject(new Error('boom')));@@ -143,3 +332,104 @@ describe('cold-start consent migration', () => {expect(migrateExistingLoginAsConsented).not.toHaveBeenCalled();});});++/**+ * 本地模式(跳过登录)期间的上报闸 —— 2026-07-28 review P1。+ *+ * 同意事实是本机级的:此前登录过(或被存量迁移过)的用户盘上已有+ * privacyConsentAccepted: true。他点「跳过登录」进入本地模式后,若 allowed 仍为真,+ * TapDB 会继续发设备级事件(authManager 只清 accountId,不 opt-out),违反+ * 2026-07-27「跳过登录 = 不上报数据」的拍板。闸是运行时的:不写盘、不改用户真相。+ */+describe('local-mode reporting gate', () => {+ it('refuses to report while in local mode even when consent is on disk', async () => {+ fakeSettings.privacyConsentAccepted = true;+ fakeSettings.analyticsEnabled = true;+ const service = await importService();++ expect(service.analyticsSettingsPayload().allowed).toBe(true);++ isLocalMode.mockReturnValue(true);+ const inLocalMode = service.analyticsSettingsPayload();+ expect(inLocalMode.allowed).toBe(false);+ // 闸不得篡改用户的持久真相(退出本地模式后要原样恢复)。+ expect(inLocalMode.privacyConsentAccepted).toBe(true);+ expect(inLocalMode.analyticsEnabled).toBe(true);+ expect(fakeSettings.privacyConsentAccepted).toBe(true);+ expect(fakeSettings.analyticsEnabled).toBe(true);+ });++ it('lets reporting resume once local mode is left', async () => {+ fakeSettings.privacyConsentAccepted = true;+ isLocalMode.mockReturnValue(true);+ const service = await importService();+ expect(service.analyticsSettingsPayload().allowed).toBe(false);++ isLocalMode.mockReturnValue(false);+ expect(service.analyticsSettingsPayload().allowed).toBe(true);+ });++ // gate 只有一半:renderer 的 TapDB 已 init 时不会自己 opt-out,必须收到重播。+ it('rebroadcasts the verdict on auth state change so an initialized SDK opts out', async () => {+ fakeSettings.privacyConsentAccepted = true;+ const service = await importService();+ service.initAnalyticsSettingsService();+ broadcasts.length = 0;++ isLocalMode.mockReturnValue(true);+ authStateListener?.();++ expect(broadcasts.at(-1)).toMatchObject({ allowed: false, privacyConsentAccepted: true });+ });++ it('unsubscribes from auth state on quit teardown', async () => {+ const service = await importService();+ service.initAnalyticsSettingsService();+ expect(authStateListener).not.toBeNull();++ service.__testing.resetForTests();+ expect(authStateListener).toBeNull();+ });++ // 2026-07-28 review 追加:用户主动点「跳过登录」是无歧义事件,封窗不得依赖凭证探测。+ // 密钥链恰好不可用时探测会返回「可能还有凭证」,若那时不封窗,之后的免协议 SSO 就会+ // 被静默迁移成已同意 —— 正是本轮要堵的洞。+ it('seals the migration window on entering local mode even when the credential probe is inconclusive', async () => {+ hasNoPersistedAuthCredentials.mockReturnValue(false);+ const service = await importService();+ service.initAnalyticsSettingsService();++ isLocalMode.mockReturnValue(true);+ authStateListener?.();++ expect(fakeSettings.legacyConsentMigrationClosed).toBe(true);++ // 之后从本地模式走免协议 SSO,下一次冷启动恢复出真实账号:不得写入同意。+ isLocalMode.mockReturnValue(false);+ const restarted = await importService();+ restarted.noteAuthColdStartState({ isAuthenticated: true }, null);+ expect(fakeSettings.privacyConsentAccepted).toBe(false);+ });++ it('does not seal the window on ordinary sign-in state changes', async () => {+ const service = await importService();+ service.initAnalyticsSettingsService();++ isLocalMode.mockReturnValue(false);+ authStateListener?.();++ expect(closeLegacyConsentMigration).not.toHaveBeenCalled();+ expect(fakeSettings.legacyConsentMigrationClosed).toBe(false);+ });++ it('never lets a failing seal break the auth state change path', async () => {+ closeLegacyConsentMigration.mockImplementation(() => {+ throw new Error('EROFS: read-only file system');+ });+ const service = await importService();+ service.initAnalyticsSettingsService();++ isLocalMode.mockReturnValue(true);+ expect(() => authStateListener?.()).not.toThrow();+ });+});diff --git a/apps/desktop/src/main/__tests__/analyticsSettingsStore.test.ts b/apps/desktop/src/main/__tests__/analyticsSettingsStore.test.tsindex 532e784192..caa3779a0d 100644--- a/apps/desktop/src/main/__tests__/analyticsSettingsStore.test.ts+++ b/apps/desktop/src/main/__tests__/analyticsSettingsStore.test.ts@@ -63,6 +63,7 @@ describe('analytics settings store', () => {expect(store.readAnalyticsSettings()).toEqual({privacyConsentAccepted: false,analyticsEnabled: true,+ legacyConsentMigrationClosed: false,});expect(store.isAnalyticsAllowed()).toBe(false);expect(fs.existsSync(settingsFile())).toBe(false);@@ -92,6 +93,7 @@ describe('analytics settings store', () => {expect(store.readAnalyticsSettings()).toEqual({privacyConsentAccepted: true,analyticsEnabled: false,+ legacyConsentMigrationClosed: false,});expect(store.isAnalyticsAllowed()).toBe(false);@@ -145,15 +147,25 @@ describe('analytics settings store', () => {expect(store.__testing.normalize(null)).toEqual({privacyConsentAccepted: false,analyticsEnabled: true,+ legacyConsentMigrationClosed: false,});// 字符串 'true' 不是布尔,不得被当成同意。expect(store.__testing.normalize({ privacyConsentAccepted: 'true' })).toEqual({privacyConsentAccepted: false,analyticsEnabled: true,+ legacyConsentMigrationClosed: false,});expect(store.__testing.normalize({ analyticsEnabled: 0 })).toEqual({privacyConsentAccepted: false,analyticsEnabled: true,+ legacyConsentMigrationClosed: false,+ });+ // 字符串 'true' 同样不得把迁移窗口当成已关闭(损坏内容一律回到默认 false,+ // 后续由冷启动判定重新落盘;fail open 到「可迁移」侧的风险由 probe 闸兜底)。+ expect(store.__testing.normalize({ legacyConsentMigrationClosed: 'true' })).toEqual({+ privacyConsentAccepted: false,+ analyticsEnabled: true,+ legacyConsentMigrationClosed: false,});});@@ -229,6 +241,66 @@ describe('analytics settings store', () => {});});+/**+ * 存量迁移窗口的持久关闭 —— 2026-07-28 review P1。+ *+ * 攻击链:「跳过登录」与企业 SSO 都被协议门刻意豁免、一份记录都不写,于是+ * 「跳过登录 → 从本地模式走登录入口 → 完成 SSO」之后的那次冷启动会看到+ * 「真实账号 + 零记录」,与真正的改版前存量账号无法区分,被静默迁移成已同意。+ * 防线:冷启动一旦明确判定「无存量登录态」,就把结论落盘,本机永久退出迁移窗口。+ */+describe('legacy consent migration window closure', () => {+ it('blocks migration on the next cold start after the window is closed (skip → SSO chain)', async () => {+ // ① 首次冷启动:跳过登录(本地模式),service 判定「无存量登录态」→ 关窗落盘。+ const first = await importStore();+ expect(first.closeLegacyConsentMigration()).toBe(true);++ // ② 用户随后从本地模式走登录入口完成企业 SSO(免协议门,依然零同意记录)。+ // ③ 下一次冷启动恢复出真实账号:重新加载模块 = 模拟重启,结论必须从磁盘恢复。+ const restarted = await importStore();+ expect(restarted.migrateExistingLoginAsConsented(true)).toBe(false);+ expect(restarted.isAnalyticsAllowed()).toBe(false);+ expect(+ JSON.parse(fs.readFileSync(settingsFile(), 'utf-8')) as Record<string, unknown>,+ ).not.toHaveProperty('privacyConsentAccepted', true);+ });++ it('is idempotent and does not touch consent or the toggle', async () => {+ const store = await importStore();++ expect(store.closeLegacyConsentMigration()).toBe(true);+ expect(store.closeLegacyConsentMigration()).toBe(false);++ // 关窗是内部标记,不是同意、也不是用户动过开关。+ expect(store.readAnalyticsSettings()).toEqual({+ privacyConsentAccepted: false,+ analyticsEnabled: true,+ legacyConsentMigrationClosed: true,+ });+ expect(store.isAnalyticsAllowed()).toBe(false);+ expect(store.isAnalyticsEnabledCustomized()).toBe(false);+ });++ it('does not affect a genuine legacy user whose window was never closed', async () => {+ // 真存量用户:改版后第一次冷启动就恢复出真实账号,从未经历「无登录态」冷启动。+ const store = await importStore();++ expect(store.migrateExistingLoginAsConsented(true)).toBe(true);+ expect(store.isAnalyticsAllowed()).toBe(true);+ });++ it('keeps blocking even if a later write rewrites the record file', async () => {+ // 关窗后用户在设置里动了开关 —— 文件被重写,标记必须还在。+ const first = await importStore();+ first.closeLegacyConsentMigration();+ first.setAnalyticsEnabled(false);++ const restarted = await importStore();+ expect(restarted.migrateExistingLoginAsConsented(true)).toBe(false);+ expect(restarted.readAnalyticsSettings().legacyConsentMigrationClosed).toBe(true);+ });+});+/*** 构建闸 —— dev 构建绝不上报。*@@ -248,6 +320,7 @@ describe('analytics build gate', () => {expect(store.readAnalyticsSettings()).toEqual({privacyConsentAccepted: true,analyticsEnabled: true,+ legacyConsentMigrationClosed: false,});expect(JSON.parse(fs.readFileSync(settingsFile(), 'utf-8'))).toMatchObject({privacyConsentAccepted: true,diff --git a/apps/desktop/src/main/analytics-settings-store.ts b/apps/desktop/src/main/analytics-settings-store.tsindex b70d003222..f6701ecc33 100644--- a/apps/desktop/src/main/analytics-settings-store.ts+++ b/apps/desktop/src/main/analytics-settings-store.ts@@ -33,11 +33,27 @@ export interface AnalyticsSettings {privacyConsentAccepted: boolean;/** 同意后的统计开关(opt-out)。默认开启。 */analyticsEnabled: boolean;+ /**+ * 存量同意迁移的窗口是否已在本机**永久关闭**(持久标记,非用户偏好)。+ *+ * 存在的理由(2026-07-28 review P1):迁移的语义是「改版**之前**就已登录的账号视为+ * 已同意」,而它唯一的判据是「本机还没有 analytics-settings.json」。问题在于改版+ * **之后**新建的会话也可能一份记录都不写——「跳过登录」(本地模式)与企业 SSO 都被+ * 协议门刻意豁免。于是「跳过登录 → 从本地模式走登录入口 → 完成 SSO」这条链路走完,+ * 下一次冷启动会恢复出一个真实账号 + 零记录,和真正的存量账号长得一模一样,被静默+ * 写入 privacyConsentAccepted —— 未经同意打开采集(隐私红线)。纯 SSO 新装用户同理。+ *+ * 所以「本次冷启动确定没有存量登录态」这个结论必须**落盘**:一旦某次冷启动看到的是+ * 未登录 / 本地模式,本机就再也不是「存量账号」,窗口永久关闭。只有结论明确时才写+ * (冷启动结果异常 / 未决时不写,免得把真存量用户的窗口误关)。+ */+ legacyConsentMigrationClosed: boolean;}const DEFAULTS: AnalyticsSettings = {privacyConsentAccepted: false,analyticsEnabled: true,+ legacyConsentMigrationClosed: false,};function settingsFilePath(): string {@@ -54,6 +70,10 @@ function normalize(raw: unknown): AnalyticsSettings {: DEFAULTS.privacyConsentAccepted,analyticsEnabled:typeof r.analyticsEnabled === 'boolean' ? r.analyticsEnabled : DEFAULTS.analyticsEnabled,+ legacyConsentMigrationClosed:+ typeof r.legacyConsentMigrationClosed === 'boolean'+ ? r.legacyConsentMigrationClosed+ : DEFAULTS.legacyConsentMigrationClosed,};}@@ -169,9 +189,10 @@ export function isAnalyticsAllowed(): boolean {/*** 记录用户明示同意《隐私政策》。幂等。*- * 调用点是登录页协议门放行的那一刻(手机号/邮箱/验证码/社交/游客),- * 即用户已勾选或在弹窗里点了「同意」并继续使用。企业 SSO 入口被协议门豁免,- * 因此走 SSO 的用户不会到达这里,也就不会被采集——这是刻意的。+ * 调用点是登录页协议门放行的那一刻(手机号/邮箱/验证码/社交等个人**账号**登录),+ * 即用户已勾选或在弹窗里点了「同意」并继续使用。企业 SSO 入口与「跳过登录」+ * (本地模式,2026-07-27 拍板免协议门)都被协议门豁免,因此这两类用户不会到达这里,+ * 也就不会被采集——这是刻意的。*/export function acceptPrivacyConsent(): AnalyticsSettings {probeRecordOnce();@@ -209,11 +230,33 @@ export function migrateExistingLoginAsConsented(isSignedIn: boolean): boolean {if (probeRecordOnce() !== 'none') return false;const state = store.readState();if (state.isCustomized) return false;+ // 本机曾经历过「无存量登录态」的冷启动 = 之后出现的账号都是改版后新建的,不可迁移+ // (见 legacyConsentMigrationClosed 注释;标记本身会让上面两道闸也命中,这里显式+ // 再判一次,免得将来有人改动探针/override 语义时静默失守)。+ if (state.value.legacyConsentMigrationClosed) return false;store.writePatch({ privacyConsentAccepted: true });log.info('existing signed-in user migrated as consented');return true;}+/**+ * 永久关闭本机的存量同意迁移窗口(幂等)。+ *+ * 由 `analyticsSettingsService` 在冷启动**明确**判定「没有存量登录态」(未登录 /+ * 本地模式)时调用。写的是一个内部持久标记,不是用户偏好:它不出现在+ * `analyticsSettingsPayload`、不影响 `analyticsEnabled` 的 customized 判定,+ * 也不会让 `isAnalyticsAllowed` 变 true —— 唯一作用是让后续冷启动不再迁移。+ */+export function closeLegacyConsentMigration(): boolean {+ probeRecordOnce();+ const current = store.read();+ if (current.legacyConsentMigrationClosed) return false;+ // true ≠ 默认值 false,override 会被保留(无需 preserveDefaults)。+ store.writePatch({ legacyConsentMigrationClosed: true });+ log.info('legacy consent migration window closed for this machine');+ return true;+}+/** enabled 是否被用户显式设置过(即盘上有这条 override)。 */export function isAnalyticsEnabledCustomized(): boolean {probeRecordOnce();diff --git a/apps/desktop/src/main/analyticsSettingsService.ts b/apps/desktop/src/main/analyticsSettingsService.tsindex 2b50136cf9..7fdfbac501 100644--- a/apps/desktop/src/main/analyticsSettingsService.ts+++ b/apps/desktop/src/main/analyticsSettingsService.ts@@ -18,6 +18,7 @@ import * as authManager from './authManager';import {acceptPrivacyConsent,clearAnalyticsEnabledOverride,+ closeLegacyConsentMigration,isAnalyticsAllowed,isAnalyticsEnabledCustomized,migrateExistingLoginAsConsented,@@ -38,6 +39,8 @@ const log = createLogger('analytics-settings');let ipcRegistered = false;/** 存量迁移只评估一次;评估过就不再看任何后续登录。 */let migrationEvaluated = false;+/** auth 状态订阅的退订句柄(进出本地模式要重播上报结论,见 initAnalyticsSettingsService)。 */+let unsubscribeAuthState: (() => void) | null = null;/*** 落盘失败翻译成统一 IPC 错误协议。@@ -59,13 +62,32 @@ function writeOrThrowIpcError(write: () => void, context: string): void {}}+/**+ * 本地模式(跳过登录)期间一律不放行上报 —— 运行时闸,和构建闸(isReportingBuild)同款:+ * **不写盘、不碰 privacyConsentAccepted / analyticsEnabled 这两个用户持久真相**。+ *+ * 为什么需要(2026-07-28 review P1):「跳过登录」= 不创建账号、不上报数据(2026-07-27+ * 拍板),但同意事实是**本机级**的 —— 一个此前登录过(或被存量迁移过)的用户,盘上已经+ * 有 privacyConsentAccepted: true;他退出登录后点「跳过登录」进入本地模式时,+ * `isAnalyticsAllowed()` 仍然恒真,TapDB 会继续发设备级事件(authManager 只在身份变化时+ * 清 accountId,不 opt-out)。那正是本条产品拍板明确不要的行为。+ *+ * 放在这里而不是 store:store 是纯持久层(不依赖 authManager),而 `allowed` 是给+ * renderer 的**运行时结论**;renderer 的 tapdbClient 完全由这个字段驱动+ * (allowed=false → optOutTracking),所以在 payload 处加闸即可全链路生效。+ * 退出本地模式后闸自动松开,用户原有的同意与开关一字未动。+ */+function isReportingAllowedNow(): boolean {+ return isAnalyticsAllowed() && !authManager.isLocalMode();+}+export function analyticsSettingsPayload(): AnalyticsSettingsPayload {const value = readAnalyticsSettings();return {privacyConsentAccepted: value.privacyConsentAccepted,analyticsEnabled: value.analyticsEnabled,analyticsEnabledCustomized: isAnalyticsEnabledCustomized(),- allowed: isAnalyticsAllowed(),+ allowed: isReportingAllowedNow(),};}@@ -89,8 +111,21 @@ function broadcastSettingsChange(): void {* 会被误判成已同意。冷启动恢复出来的登录态则不同——那是本次改动之前就存在的* 会话,属于产品拍板(2026-07-25)的"不再二次打扰"范围。*+ * 为什么本地模式(跳过登录)**不算**已登录:冷启动可能恢复出三种状态——+ * 1. 真实账号(cloud):经登录页进入,链路一直带《用户协议》《隐私政策》表述 → 可迁移+ * 2. 本地模式(跳过登录):2026-07-27 拍板「不创建账号、不上报数据」,刻意免协议门,+ * 这类用户从未同意过隐私协议 → 绝不可迁移+ * 3. 完全未登录:新装 → 不迁移+ * 把 2 当成 1 会让「跳过登录」的用户在下一次冷启动被静默写入 privacyConsentAccepted,+ * 等于未经同意打开采集(隐私红线)。+ ** 迁移本身还有第二道闸:store 里已经有 override 时一律跳过(见* analytics-settings-store.migrateExistingLoginAsConsented)。+ *+ * 第三道闸是**持久**的:本函数一旦明确判定「没有存量登录态」(情形 2 / 3),就把结论落盘+ * (`legacyConsentMigrationClosed`)。否则「跳过登录 → 从本地模式登录 → 企业 SSO」这类+ * 全程免协议门的链路会在下一次冷启动伪装成情形 1(真实账号 + 零记录)被静默迁移+ * (2026-07-28 review P1)。*//*** 迁移是 best-effort 的埋点工作,**绝不能把登录拖下水**。@@ -107,13 +142,64 @@ function migrateOrLog(): void {}}+/**+ * 冷启动**明确**判定「本机没有存量登录态」时,把这个结论落盘,永久关闭迁移窗口。+ *+ * 为什么必须持久化(2026-07-28 review P1):模块级 `migrationEvaluated` 只活一个进程,+ * 下次冷启动窗口照常打开。而「跳过登录」与企业 SSO 都被协议门刻意豁免、一份记录都不写,+ * 于是「跳过登录 → 从本地模式走登录入口 → 完成 SSO」之后的那次冷启动会看到「真实账号 ++ * 零记录」,与真正的存量账号无法区分,被静默迁移成已同意 —— 未经同意打开采集。纯 SSO+ * 新装用户同理。落盘之后,本机就再也不满足「改版前存量账号」的定义。+ *+ * 全程 best-effort:写不进去绝不能把登录拖下水(下次冷启动 / 下次进本地模式还有机会)。+ */+function sealMigrationWindowOrLog(): void {+ try {+ closeLegacyConsentMigration();+ } catch (err) {+ log.warn('closing legacy consent migration window failed (non-fatal)', err);+ }+}++/**+ * 冷启动判出「未登录」时的关窗 —— 必须先过一道**凭证闸**(2026-07-28 review 追加)。+ *+ * 「冷启动未登录」是有歧义的:`authManager.initialize()` 在对端区域清单不可用、或+ * cold-start refresh 瞬态失败时会**保留 refresh token** 并以未登录放行 UI+ * (`pendingCompletion === null`)。那种机器下一次冷启动就会恢复成真实的存量账号,+ * 若在这里关了窗,它永远拿不到本该有的同意迁移。所以只有+ * `hasNoPersistedAuthCredentials()` 为真(只认 ENOENT 为真缺席,密钥链抖动 / EPERM+ * 一律按「可能还有凭证」)才落盘。+ *+ * 注意这道闸**只用于冷启动这条歧义路径**:用户主动点「跳过登录」时没有任何歧义,+ * 走的是 `sealMigrationWindowOrLog()`(见 initAnalyticsSettingsService 的 auth 订阅)。+ * 否则密钥链恰好不可用的那一刻,跳过登录用户会因为「探不出凭证已删」而不关窗,给+ * 之后的免协议 SSO 留下被静默迁移的缺口 —— 那正是本轮要堵的洞。+ */+function closeMigrationWindowOrLog(): void {+ try {+ if (!authManager.hasNoPersistedAuthCredentials()) {+ log.info('legacy consent migration window kept open — persisted credentials still present');+ return;+ }+ } catch (err) {+ // 探测本身失败 = 结论不明确,保守保留窗口(不误伤存量用户)。+ log.warn('persisted credential probe failed; keeping migration window open', err);+ return;+ }+ sealMigrationWindowOrLog();+}+export function noteAuthColdStartState(state: { isAuthenticated: boolean },pendingCompletion: Promise<{ isAuthenticated: boolean }> | null,): void {if (migrationEvaluated) return;- const signedIn = state.isAuthenticated || authManager.isLocalMode();+ // `!isLocalMode()` 在当前实现下是冗余的(local 会话拿不到 isAuthenticated),但这里+ // 保留它做 fail closed:哪天本地模式改成也带 canEnterApp / authenticated 语义,+ // 也不会静默把免协议门的用户迁移成「已同意」。+ const signedIn = state.isAuthenticated && !authManager.isLocalMode();if (signedIn) {migrationEvaluated = true;migrateOrLog();@@ -127,17 +213,24 @@ export function noteAuthColdStartState(.then((finalState) => {if (migrationEvaluated) return;migrationEvaluated = true;- const finalSignedIn = finalState.isAuthenticated || authManager.isLocalMode();+ const finalSignedIn = finalState.isAuthenticated && !authManager.isLocalMode();if (finalSignedIn) migrateOrLog();+ // 明确判定「没有存量登录态」→ 落盘关窗(见 closeMigrationWindowOrLog)。+ else closeMigrationWindowOrLog();}).catch(() => {+ // 结果异常 = 结论不明确:只关本进程的窗,不落盘(否则弱网存量用户会被永久误判)。migrationEvaluated = true;});return;}- // 冷启动确定未登录 = 新装用户,不迁移;此后只有登录页的协议门能写入同意。+ // 冷启动确定没有真实账号(未登录 / 跳过登录的本地模式)= 不迁移,并把这个结论**落盘**:+ // 本机从此不再是「改版前存量账号」,后续冷启动即便恢复出真实账号也不迁移。此后只有登录页+ // 的协议门能写入同意——本地模式用户之后真登录走的就是那道门,与新装用户一致(企业 SSO 被+ // 协议门豁免,那类用户就是不采集,这是刻意的)。migrationEvaluated = true;+ closeMigrationWindowOrLog();}export function initAnalyticsSettingsService(): void {@@ -147,6 +240,20 @@ export function initAnalyticsSettingsService(): void {}ipcRegistered = true;+ // 进出本地模式要**即时**改变上报结论(见 isReportingAllowedNow):renderer 的+ // tapdbClient 只在收到广播或首次读取时更新,已经 init 过的 SDK 不会自己 opt-out。+ // 订阅顺带覆盖登录 / 登出(同意事实不变,结论也不变,applyReportingAllowed 自带+ // 同值早返回,不会造成无用功);notifyAuthListeners 只在登录 / 登出 / 身份或 realm+ // 切换时触发,周期性 refresh 不触发,无广播风暴。+ unsubscribeAuthState = authManager.onAuthStateChange(() => {+ // 进入本地模式 = 用户主动点了「跳过登录」,这一刻**毫无歧义**:本机不是「改版前+ // 就已登录的存量账号」。所以在这里直接封窗,不走冷启动那条路径的凭证探测闸——+ // 那道闸在密钥链暂不可用时会保守地拒绝关窗,而此处的确定性不依赖任何探测。+ // 幂等(closeLegacyConsentMigration 自带 no-op 早返回),不写用户偏好。+ if (authManager.isLocalMode()) sealMigrationWindowOrLog();+ broadcastSettingsChange();+ });+ipcMain.handle('analytics:settings-get', (event) => {assertTrustedAppRendererEvent(event);return analyticsSettingsPayload();@@ -182,6 +289,8 @@ export function initAnalyticsSettingsService(): void {onQuit('analytics-settings', () => {ipcRegistered = false;+ unsubscribeAuthState?.();+ unsubscribeAuthState = null;});}@@ -189,6 +298,8 @@ export const __testing = {resetForTests(): void {ipcRegistered = false;migrationEvaluated = false;+ unsubscribeAuthState?.();+ unsubscribeAuthState = null;},broadcastSettingsChange,};diff --git a/apps/desktop/src/main/authManager.ts b/apps/desktop/src/main/authManager.tsindex f38cce4777..3223fbdb51 100644--- a/apps/desktop/src/main/authManager.ts+++ b/apps/desktop/src/main/authManager.ts@@ -1448,6 +1448,29 @@ export function isLocalMode(): boolean {return getActiveAppSession().mode === 'local';}+/**+ * 本机是否**确定**没有任何可用于恢复登录的持久凭证(只读判定:不解密、不轮换、不写盘)。+ *+ * 唯一消费者是 analytics 的存量同意迁移关窗判定(见+ * analyticsSettingsService.noteAuthColdStartState)。它必须区分两种「冷启动未登录」:+ * - 真的没有账号(新装 / 跳过登录已清凭证)→ 本机不是存量账号,可以永久关窗;+ * - 有账号但本次 initialize() **刻意保留了 token**:对端区域清单暂不可用、或+ * cold-start refresh 瞬态失败(见本文件那两处 `keeping ... token, starting+ * logged out`)。这类用户下一次冷启动就会恢复成真实的存量账号,一旦被关窗就+ * 永远拿不到本该有的同意迁移。+ *+ * 判定复用 `isPersistedSecretAbsent`(只认 ENOENT 为真缺席,密钥链不可用 / EPERM /+ * 解密失败一律按瞬时故障),所以任何不确定都会让本函数返回 false = 「可能还有凭证」+ * → 调用方不关窗。取舍方向是刻意的:宁可让一台机器多留一次迁移机会,也不要把真存量+ * 用户永久误判(未同意侧另有 probe / override / 协议门三道闸兜底)。+ */+export function hasNoPersistedAuthCredentials(): boolean {+ return (+ isPersistedSecretAbsent(AUTH_SESSION_KEY) &&+ isPersistedSecretAbsent(LEGACY_RESOURCE_REFRESH_TOKEN_KEY)+ );+}+/** Enter the account-free local session after the host has torn down old runtime state. */export function enterLocalMode(): AuthState {browserAuthorizationSlot.cancelActive();diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.tsindex 6ad6f7c805..4fad767399 100644--- a/apps/desktop/src/preload/preload.ts+++ b/apps/desktop/src/preload/preload.ts@@ -1358,7 +1358,7 @@ contextBridge.exposeInMainWorld('electronAPI', {/** 恢复默认:删掉开关 override,同意事实保留。 */resetAnalyticsEnabled: (): Promise<AnalyticsSettingsPayload> =>ipcRenderer.invoke('analytics:settings-reset-enabled'),- /** 登录页协议门放行时调用一次(含游客);幂等。 */+ /** 登录页协议门放行时调用一次(个人账号登录链路;SSO 与跳过登录豁免不调用);幂等。 */acceptPrivacyConsent: (): Promise<AnalyticsSettingsPayload> =>ipcRenderer.invoke('analytics:consent-accept'),onAnalyticsSettingsChange: (diff --git a/apps/desktop/src/renderer/assets/login/icons/guest-dark.svg b/apps/desktop/src/renderer/assets/login/icons/guest-dark.svgdeleted file mode 100644index 5b0bade8ed..0000000000--- a/apps/desktop/src/renderer/assets/login/icons/guest-dark.svg+++ /dev/null@@ -1,7 +0,0 @@-<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">-<g id="Property 1=游客">-<g id="mdi:user">-<path id="Vector" d="M24 8C26.1217 8 28.1566 8.84285 29.6569 10.3431C31.1571 11.8434 32 13.8783 32 16C32 18.1217 31.1571 20.1566 29.6569 21.6569C28.1566 23.1571 26.1217 24 24 24C21.8783 24 19.8434 23.1571 18.3431 21.6569C16.8429 20.1566 16 18.1217 16 16C16 13.8783 16.8429 11.8434 18.3431 10.3431C19.8434 8.84285 21.8783 8 24 8ZM24 28C32.84 28 40 31.58 40 36V40H8V36C8 31.58 15.16 28 24 28Z" fill="#2A2828"/>-</g>-</g>-</svg>diff --git a/apps/desktop/src/renderer/assets/login/icons/guest.svg b/apps/desktop/src/renderer/assets/login/icons/guest.svgdeleted file mode 100644index 444666ae11..0000000000--- a/apps/desktop/src/renderer/assets/login/icons/guest.svg+++ /dev/null@@ -1,7 +0,0 @@-<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">-<g id="Property 1=游客">-<g id="mdi:user">-<path id="Vector" d="M24 8C26.1217 8 28.1566 8.84285 29.6569 10.3431C31.1571 11.8434 32 13.8783 32 16C32 18.1217 31.1571 20.1566 29.6569 21.6569C28.1566 23.1571 26.1217 24 24 24C21.8783 24 19.8434 23.1571 18.3431 21.6569C16.8429 20.1566 16 18.1217 16 16C16 13.8783 16.8429 11.8434 18.3431 10.3431C19.8434 8.84285 21.8783 8 24 8ZM24 28C32.84 28 40 31.58 40 36V40H8V36C8 31.58 15.16 28 24 28Z" fill="#EEEEEE"/>-</g>-</g>-</svg>diff --git a/apps/desktop/src/renderer/components/login/LoginControls.tsx b/apps/desktop/src/renderer/components/login/LoginControls.tsxindex 63efb6422e..87f49d254d 100644--- a/apps/desktop/src/renderer/components/login/LoginControls.tsx+++ b/apps/desktop/src/renderer/components/login/LoginControls.tsx@@ -15,6 +15,7 @@ import {METHOD_ROW,PANEL,REGION_PILL,+ SKIP_ENTRY,SOCIAL,SPINNER,SUBTITLE,@@ -40,15 +41,29 @@ const overlayBase = cn('after:opacity-0 after:transition-opacity after:content-[""]',);-/** 面板(680×440 r36 #FBFBFB + wave4 1px inside 描边 368:1383)。 */-export function LoginPanel({ children, testId }: { children: ReactNode; testId?: string }) {+/**+ * 面板(680×500 r36 + wave4 1px inside 描边 368:1383)。+ *+ * height 默认取 PANEL.height(登录全步骤共用,恒定不跳变);仅 Splash 借用本组件时+ * 传 SPLASH_PANEL.height 保持 440(见 loginDesignTokens SPLASH_PANEL 注释)。+ */+export function LoginPanel({+ children,+ testId,+ height = PANEL.height,+}: {+ children: ReactNode;+ testId?: string;+ /** 面板高度覆写(设计px);仅 Splash 使用,登录侧一律用默认值。 */+ height?: number;+}) {return (<divdata-testid={testId ?? 'login-panel'}className="absolute left-0 top-0 overflow-hidden"style={{width: PANEL.width,- height: PANEL.height,+ height,borderRadius: PANEL.radius,background: LOGIN_COLORS.panelBg,boxShadow: `inset 0 0 0 1px ${LOGIN_COLORS.panelBorder}`,@@ -392,8 +407,9 @@ function LoginSpinnerGlyph({ size }: { size: number }) {}/**- * 第三方圆钮行(§4.5:80×80 r50 #2A2828/#434343,icon 48,gap 70,y=480;- * 行内水平居中 = demo socialRow left 公式)。SSO = 行内最后一颗(329:243)。+ * 第三方圆钮行(§4.5:80×80 r50 #2A2828/#434343,icon 48,gap 70,y=540 = 面板底 +40;+ * 行内水平居中 = demo socialRow left 公式)。SSO = 行内最后一颗(游客圆钮已随+ * 「跳过登录」文字入口移入面板内而删除)。*/export function LoginSocialRow({ children, count }: { children: ReactNode; count: number }) {const left = Math.max(@@ -540,6 +556,9 @@ export function LoginBackButton({* - countdown/info 变体:#D4D4D4 无 underline 不可交互(247:1614);* binding code 子态「验证码已发送至 X」提示复用本变体(demo bindingPanel)。* 色变全走 CSS 类(hover:/active:),不改布局(design §2.3-1)。+ *+ * ⚠ 与「跳过登录」文字**按钮**(LoginSkipEntry)是两种组件:本组件是文字**链接**+ * (hover/pressed 变色 link 族语义),跳过登录不变色、自适应热区,不要混用。*/export function LoginTextLink({children,@@ -596,6 +615,73 @@ export function LoginTextLink({);}+/**+ * 「跳过登录」文字按钮(新稿容器 705:1068/700:910;用户拍板 2026-07-27)。+ *+ * **与 LoginTextLink 是两种组件**:那个是文字链接(link 族 hover/pressed 变色),+ * 本组件是文字按钮——颜色 light/dark 统一 `--login-secondary-text`(#6F6F6F 双模同值),+ * hover/pressed **不变色**,只靠下划线与指针形状给反馈。+ *+ * 热区(用户拍板):**不全宽**。680×60(SKIP_ENTRY)只是布局容器且自身不可点+ * (pointer-events:none),真正可点的是内层 button = 当前语言实际文字渲染宽度+ * + 左右各 30 设计px(hitPaddingX,shrink-to-fit 随语言自适应),高度占满 60 槽;+ * 文字仍相对 680 容器水平居中(容器 justify-center + button 左右 padding 对称)。+ */+export function LoginSkipEntry({+ children,+ onClick,+ disabled,+ testId,+}: {+ children: ReactNode;+ onClick: () => void;+ disabled?: boolean;+ testId?: string;+}) {+ return (+ <div+ data-testid="login-skip-entry-slot"+ className="absolute flex items-center justify-center"+ style={{+ left: SKIP_ENTRY.x,+ top: SKIP_ENTRY.y,+ width: SKIP_ENTRY.width,+ height: SKIP_ENTRY.height,+ // 容器只负责居中定位,不承接点击:热区收敛到内层 button(用户拍板 2026-07-27)+ pointerEvents: 'none',+ }}+ >+ <button+ data-testid={testId ?? 'login-skip-entry'}+ type="button"+ disabled={disabled}+ onClick={onClick}+ className={cn(+ 'flex items-center justify-center overflow-hidden whitespace-nowrap',+ 'border-0 bg-transparent underline',+ 'cursor-pointer disabled:cursor-not-allowed',+ )}+ style={{+ // 宽度不写死:shrink-to-fit 文字宽 + 左右 hitPaddingX,随语言自适应+ height: SKIP_ENTRY.height,+ // 防御性上界(非设计许可,DESIGN.md 单行槽兜底):按钮含 padding 不越 680 容器,+ // 避免超长译文两侧被面板 overflow-hidden 静默裁掉。可见截断 = 文案 bug,改文案不改布局。+ maxWidth: SKIP_ENTRY.width,+ paddingLeft: SKIP_ENTRY.hitPaddingX,+ paddingRight: SKIP_ENTRY.hitPaddingX,+ fontSize: SKIP_ENTRY.fontSize,+ fontWeight: 400,+ color: LOGIN_COLORS.secondaryText,+ textOverflow: 'ellipsis',+ pointerEvents: 'auto',+ }}+ >+ {children}+ </button>+ </div>+ );+}+/* ── 协议同意族(consent PR;figma wave5 radiobutton 600:627 + 弹窗 602:822) ── */export type LegalSegment = { kind: 'text' | 'terms' | 'privacy'; text: string };diff --git a/apps/desktop/src/renderer/components/login/LoginPage.tsx b/apps/desktop/src/renderer/components/login/LoginPage.tsxindex b757a1456e..17f39f95d7 100644--- a/apps/desktop/src/renderer/components/login/LoginPage.tsx+++ b/apps/desktop/src/renderer/components/login/LoginPage.tsx@@ -26,8 +26,6 @@ import googleIcon from '@/assets/login/icons/google.svg';import wechatIcon from '@/assets/login/icons/wechat.svg';import ssoIcon from '@/assets/login/icons/sso.svg';import ssoIconDark from '@/assets/login/icons/sso-dark.svg';-import guestIcon from '@/assets/login/icons/guest.svg';-import guestIconDark from '@/assets/login/icons/guest-dark.svg';import { LoginStage } from './LoginStage';import {@@ -40,6 +38,7 @@ import {LoginMethodRow,LoginPanel,LoginPrimaryButton,+ LoginSkipEntry,LoginSocialButton,LoginSocialRow,LoginTextLink,@@ -88,8 +87,8 @@ const REGION_PILL_KEY: Partial<Record<typeof CURRENT_CINDY_REGION, string>> = {* 渲染与本地格式校验。覆盖全部登录步骤:identifier 主视图 / ssoOrgMode 子视图* (含 sso-org-list = method-choice 的 SSO 入口来源变体)/ method-choice /* verification-code / account-selection / binding / preparing / error,以及- * 协议同意链路(radio + 拦截弹窗)与游客入口。倒计时契约、Text_link 全态、- * 错误码映射均已落地(历史施工批次见 git log,不再在注释中引用)。+ * 协议同意链路(radio + 拦截弹窗)与面板内「跳过登录」入口。倒计时契约、+ * Text_link 全态、错误码映射均已落地(历史施工批次见 git log,不再在注释中引用)。*/export function LoginPage() {const {@@ -118,6 +117,13 @@ export function LoginPage() {const isMac = window.electronAPI?.platform === 'darwin';const [localModePending, setLocalModePending] = useState(false);+ /**+ * 进入本地模式(「跳过登录」入口 + error 步逃生入口共用)。+ *+ * 不过协议门(产品拍板 2026-07-27,推翻同年 07-24「游客也先同意协议」):跳过登录+ * 不创建账号、不上报任何数据,radio 未勾选也直接进主界面。因此这里也不调+ * persistPrivacyConsent——没有明示同意就保持采集闸关闭。+ */const openLocalMode = async () => {if (isLoading || localModePending || !window.electronAPI?.authEnterLocal) return;setLocalModePending(true);@@ -138,11 +144,12 @@ export function LoginPage() {/* ── 协议同意链路(consent PR):radio 状态 + 未勾选拦截弹窗 + 同意后续接。过门点(产品拍板 2026-07-24 二次):手机号提交、邮箱提交(discover 前)、- method-choice 个人行发码、社交圆钮(Apple/Google/未来微信)、游客——个人+ method-choice 个人行发码、社交圆钮(Apple/Google/未来微信)——个人**账号**登录一律先同意协议再发起,包括仅触发方式查询的 email discover(拍板压过- 审查侧「discover 无副作用可放行」的建议)。豁免仅限显式企业 SSO 入口:- SSO 圆钮、组织标识提交、method-choice sso 行。pending 动作只存 renderer- 本地(不进 main loginFlowState;规则 9:分支全部代码状态机化)。 ── */+ 审查侧「discover 无副作用可放行」的建议)。豁免:显式企业 SSO 入口+ (SSO 圆钮、组织标识提交、method-choice sso 行)+ 跳过登录/本地模式+ (2026-07-27 拍板,见 openLocalMode)。pending 动作只存 renderer 本地+ (不进 main loginFlowState;规则 9:分支全部代码状态机化)。 ── */const [consentAccepted, setConsentAccepted] = useState(false);const [consentDialogOpen, setConsentDialogOpen] = useState(false);// pending 带开门时刻快照,同意时复验防陈旧续接(codex 审查 P1;consentGate 单测)@@ -221,8 +228,8 @@ export function LoginPage() {reportLoginPanelMounted();return () => reportLoginPanelUnmounted();}, [reportLoginPanelMounted, reportLoginPanelUnmounted]);- // 游客入口已移入第三方圆钮行(identifier 视图人形圆钮);footer 仅保留 error 步- // 的「跳过登录」逃生入口——登录服务不可用时用户仍能进入本地模式(既有产品保证)。+ // 「跳过登录」常驻入口在面板内(identifier 视图 SKIP_ENTRY 文字链);footer 仅保留+ // error 步的逃生入口——登录服务不可用时用户仍能进入本地模式(既有产品保证)。const showLocalModeFooter = loginState?.step === 'error';// 面板底部预留恒取全流程最大值(footer 124;协议行 48 被其覆盖):step 切换时// 面板/品牌层零跳位(规则 7,codex 审查 P1)。browser-redirect/completed 维持 0,@@ -390,7 +397,7 @@ export function LoginPage() {void dispatch({ type: 'discover-sso-org', org: value });};- /* ── identifier 主视图(680×560 组:面板 + 第三方圆钮行) ── */+ /* ── identifier 主视图(680×620 组:面板 680×500 + 第三方圆钮行) ── */const renderIdentifier = () => {if (!loginState || loginState.step !== 'identifier') return null;const providers = loginState.providers;@@ -445,8 +452,19 @@ export function LoginPage() {</LoginErrorText>)}</form>+ {/* 「跳过登录」= 面板内文字按钮(新稿 705:1068 容器 680×60 @y430,取代旧游客+ 圆钮;LoginSkipEntry ≠ LoginTextLink,见该组件注释):接既有 local mode+ 链路,不过协议门(2026-07-27 拍板)。槽位在 error_text(380..430)之下、+ 与其首尾相接,两者同时可见互不重叠;error 出现不推移本入口(均 absolute)。 */}+ <LoginSkipEntry+ testId="login-skip-entry"+ disabled={isLoading || localModePending}+ onClick={() => void openLocalMode()}+ >+ {t('login.localModeEntry')}+ </LoginSkipEntry></LoginPanel>- <LoginSocialRow count={providers.social.length + 2}>+ <LoginSocialRow count={providers.social.length + 1}>{providers.social.map((provider) => (<LoginSocialButtonkey={provider}@@ -489,21 +507,8 @@ export function LoginPage() {><SsoGlyph /></LoginSocialButton>- {/* 游客登录 = 行内最后一颗人形圆钮(figma 379:680 mdi:user),接既有- local mode;属个人链路,过协议门(同意后直接进主界面,产品拍板)。 */}- <LoginSocialButton- testId="login-social-guest"- label={t('login.localModeEntry')}- isLoading={isLoading || localModePending}- onClick={() => {- if (isLoading || localModePending) return;- requireConsent(() => void openLocalMode());- }}- >- <GuestGlyph />- </LoginSocialButton></LoginSocialRow>- {/* 协议同意行(figma 600:660:圆钮行下方 22 设计px,组坐标 y=582;+ {/* 协议同意行(figma 700:807:圆钮行下方 22 设计px,组坐标 y=642;渲染门 = 所在 identifier 主视图分支,面板底部预留恒定已含其区间) */}<LoginConsentRowchecked={consentAccepted}@@ -516,7 +521,7 @@ export function LoginPage() {);};- /* ── 企业 SSO 入口子视图(sso-org empty/filled;680×440) ── */+ /* ── 企业 SSO 入口子视图(sso-org empty/filled;面板 680×500,无跳过入口) ── */const renderSsoOrg = () => (<LoginPanel testId="login-panel-sso-org"><form onSubmit={submitSsoOrg} noValidate>@@ -572,8 +577,8 @@ export function LoginPage() {const renderMethodChoice = () => {if (loginState?.step !== 'method-choice') return null;const ssoMethods = loginState.methods.filter((method) => method.type === 'sso');- // demo 呈现仲裁(methodChoicePanel):多 connection(≥2)时抑制个人行——- // 面板 440 高只容两行(158/278),第三行 y=398+100 会溢出;ssoRequired 同样抑制。+ // demo 呈现仲裁(methodChoicePanel):多 connection(≥2)时抑制个人行——方式行+ // 只排两行(158/278),第三行 y=398 底边会贴到面板底;ssoRequired 同样抑制。const emailAllowed =loginState.methods.some((method) => method.type === 'email_code') &&!ssoMethods.some((method) => method.ssoRequired) &&@@ -962,7 +967,7 @@ export function LoginPage() {data-testid="login-local-mode"type="button"disabled={localModePending || isLoading}- onClick={() => requireConsent(() => void openLocalMode())}+ onClick={() => void openLocalMode()}aria-describedby="login-local-mode-description"className="select-none rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-6 py-2.5 text-13 font-medium text-[var(--text-primary)] transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)] disabled:cursor-not-allowed disabled:opacity-60"style={{ minHeight: 40 }}@@ -1229,18 +1234,3 @@ function SsoGlyph() {/>);}--// 游客人形图标(figma 379:753 mdi:user):单色随圆钮底反相(亮色深圆浅标 #EEEEEE /-// 暗色白圆墨标 #2A2828),与 Apple 单色图标同规则。-function GuestGlyph() {- const isDark = useIsDarkMode();- return (- <img- src={isDark ? guestIconDark : guestIcon}- alt=""- aria-hidden- draggable={false}- className="h-full w-full object-contain"- />- );-}diff --git a/apps/desktop/src/renderer/components/login/LoginStage.tsx b/apps/desktop/src/renderer/components/login/LoginStage.tsxindex 690121d885..5ac8f829ea 100644--- a/apps/desktop/src/renderer/components/login/LoginStage.tsx+++ b/apps/desktop/src/renderer/components/login/LoginStage.tsx@@ -14,7 +14,7 @@ import { LOGIN_GROUP, LOGIN_LOCAL_MODE } from './loginDesignTokens';* - 面板恒定 0.5 缩放(用户拍板 2026-07-23,design.md §11):文字/输入框在任何窗口* 保持设计标准大小;垂直锚点跟随品牌层 desktopScale 画布 + 品牌避让/视口 clamp* (公式见 loginScale.panelPlacement),不再与品牌层共用整画布缩放;- * - children 渲染在登录整体组坐标系内(680×560 设计px);+ * - children 渲染在登录整体组坐标系内(680×620 设计px:面板 500 + gap 40 + 圆钮 80);* - 本层自身 z-auto:LoginPage 根建立 z-[9990] stacking context 整体压过品牌* overlay(LoginBrandStage z-[9980]),内部与窗框描边(z-30)/拖拽条(z-40)* 沿 PR2a 相对层序。@@ -56,7 +56,7 @@ export function LoginStage({className="fixed inset-0 overflow-hidden"data-testid="login-panel-stage-root">- {/* 登录整体组(680×560 设计px):恒定 0.5 缩放,垂直锚点跟随品牌画布并+ {/* 登录整体组(680×620 设计px):恒定 0.5 缩放,垂直锚点跟随品牌画布并做品牌避让/视口 clamp(用户拍板 2026-07-23,design.md §11) */}<divdata-testid="login-stage"diff --git a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.consent.test.tsx b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.consent.test.tsxindex c50cc7df02..89c42d54a9 100644--- a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.consent.test.tsx+++ b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.consent.test.tsx@@ -216,23 +216,29 @@ describe('consent guard(未勾选拦截个人登录链路)', () => {});});- it('游客圆钮未勾选 → 弹窗;同意 → 进入本地模式(authEnterLocal)', async () => {+ // 2026-07-27 拍板(推翻同年 07-24「游客也先过协议门」):跳过登录不创建账号、不上报+ // 数据,radio 未勾选也直接进本地模式,不弹协议弹窗。旧游客圆钮入口已删除。+ it('「跳过登录」未勾选也豁免协议门 → 无弹窗,直接进入本地模式(authEnterLocal)', async () => {mount(await identifierState('providers:cn-social'));- fireEvent.click(screen.getByTestId('login-social-guest'));- expect(screen.getByTestId('login-consent-dialog')).toBeTruthy();- expect(authEnterLocal).not.toHaveBeenCalled();+ expect(screen.getByTestId('login-consent-radio').getAttribute('aria-checked')).toBe('false');await act(async () => {- fireEvent.click(screen.getByTestId('login-consent-agree'));+ fireEvent.click(screen.getByTestId('login-skip-entry'));});+ expect(screen.queryByTestId('login-consent-dialog')).toBeNull();expect(authEnterLocal).toHaveBeenCalledTimes(1);});- it('游客圆钮不同意 → 停在登录主界面,不进本地模式', async () => {+ it('「跳过登录」不写入「已同意隐私政策」记录(未明示同意 → 采集闸保持关闭)', async () => {mount(await identifierState('providers:cn-social'));- fireEvent.click(screen.getByTestId('login-social-guest'));- fireEvent.click(screen.getByTestId('login-consent-disagree'));- expect(authEnterLocal).not.toHaveBeenCalled();- expect(screen.getByTestId('login-panel-identifier')).toBeTruthy();+ await act(async () => {+ fireEvent.click(screen.getByTestId('login-skip-entry'));+ });+ expect(acceptPrivacyConsent).not.toHaveBeenCalled();+ });++ it('旧游客圆钮入口已删除(圆钮行不再渲染 login-social-guest)', async () => {+ mount(await identifierState('providers:cn-social'));+ expect(screen.queryByTestId('login-social-guest')).toBeNull();});it('企业 SSO 入口豁免:未勾选点 SSO 圆钮 → 直接进组织标识子视图,无弹窗', async () => {diff --git a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.harness.test.tsx b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.harness.test.tsxindex e28471b5ed..6ad8252af9 100644--- a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.harness.test.tsx+++ b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.harness.test.tsx@@ -143,7 +143,8 @@ describe('wave4 stage 视觉', () => {expect(panel.style.boxShadow).toContain('inset 0 0 0 1px var(--login-panel-border)');expect(panel.style.borderRadius).toBe('36px');expect(panel.style.width).toBe('680px');- expect(panel.style.height).toBe('440px');+ // 面板 440 → 500(新稿 700:791):增高 60 = 面板内「跳过登录」容器高+ expect(panel.style.height).toBe('500px');});it('字标为 wave4 黑红版内层几何 423×145 @(698,1046)(368:1381)', async () => {@@ -186,20 +187,74 @@ describe('identifier 态(附录 A providers 场景)', () => {expect(screen.getByTestId('login-social-row')).toBeTruthy();});- it('identifier 视图:协议行挂在登录组内(y=582),游客圆钮取代 footer 入口', async () => {+ it('identifier 视图:协议行挂在登录组内(y=642),「跳过登录」文字链在面板内 y=430', async () => {mount(await identifierState('providers:both'));- // 协议同意行(consent PR):登录组坐标 y=582(圆钮行下方 22 设计px),radio 初始未勾选+ // 协议同意行(consent PR):登录组坐标 y=642(面板 500 后圆钮行下方 22 设计px),radio 初始未勾选const row = screen.getByTestId('login-consent-row');expect(screen.getByTestId('login-group').contains(row)).toBe(true);- expect(row.style.top).toBe('582px');+ expect(row.style.top).toBe('642px');expect(screen.getByTestId('login-consent-radio').getAttribute('aria-checked')).toBe('false');- // 游客入口 = 社交行最后一颗人形圆钮;identifier 步不再渲染 footer(仅 error 步保留逃生入口)- const socialRow = screen.getByTestId('login-social-row');- expect(socialRow.lastElementChild).toBe(screen.getByTestId('login-social-guest'));+ // 「跳过登录」= 面板内文字按钮(新稿 705:1068 布局槽 680×60 @y430,文本 24px 下划线),+ // 取代旧游客圆钮。槽负责居中定位,按钮承接点击(热区断言见下一条用例)。+ const slot = screen.getByTestId('login-skip-entry-slot');+ const skip = screen.getByTestId('login-skip-entry');+ expect(screen.getByTestId('login-panel-identifier').contains(slot)).toBe(true);+ expect(slot.contains(skip)).toBe(true);+ expect(slot.style.left).toBe('0px');+ expect(slot.style.top).toBe('430px');+ expect(slot.style.width).toBe('680px');+ expect(slot.style.height).toBe('60px');+ expect(skip.style.fontSize).toBe('24px');+ expect(skip.className).toContain('underline');+ // 圆钮行不再有游客圆钮;identifier 步不渲染 footer(仅 error 步保留逃生入口)+ expect(screen.queryByTestId('login-social-guest')).toBeNull();expect(screen.queryByTestId('login-stage-footer')).toBeNull();expect(screen.queryByTestId('login-local-mode')).toBeNull();});+ it('「跳过登录」槽与错误提示槽首尾相接且不重叠(error 出现不推移跳过入口)', async () => {+ mount(await identifierState('providers:both'), { errorCode: 'NETWORK_ERROR' });+ const error = screen.getByTestId('login-error-text');+ const slot = screen.getByTestId('login-skip-entry-slot');+ // error_text 680×50 @y380(新稿 705:1067)→ 底 430 = 跳过槽顶,零重叠+ expect(error.style.top).toBe('380px');+ expect(error.style.height).toBe('50px');+ expect(slot.style.top).toBe('430px');+ expect(parseFloat(error.style.top) + parseFloat(error.style.height)).toBe(+ parseFloat(slot.style.top),+ );+ });++ it('「跳过登录」= 文字按钮:统一 #6F6F6F 不随 hover/pressed 变色(用户拍板 2026-07-27)', async () => {+ mount(await identifierState('providers:both'));+ const skip = screen.getByTestId('login-skip-entry');+ // 颜色走 --login-secondary-text(双模同值 #6F6F6F),不是 link 族 --login-link-text+ const style = skip.getAttribute('style') ?? '';+ expect(style).toContain('--login-secondary-text');+ expect(style).not.toContain('--login-link-text');+ // 文字按钮 ≠ 文字链接:不带 link 族 hover/pressed 变色类+ expect(skip.className).not.toContain('--login-link-hover');+ expect(skip.className).not.toContain('--login-link-pressed');+ // 反馈只保留下划线 + 指针形状+ expect(skip.className).toContain('underline');+ expect(skip.className).toContain('cursor-pointer');+ });++ it('「跳过登录」热区 = 文字宽 + 左右各 30 设计px,680×60 容器本身不可点', async () => {+ mount(await identifierState('providers:both'));+ const slot = screen.getByTestId('login-skip-entry-slot');+ const skip = screen.getByTestId('login-skip-entry');+ // 容器只做居中布局,不接点击+ expect(slot.style.pointerEvents).toBe('none');+ expect(slot.className).toContain('justify-center');+ // 按钮承接点击:宽度不写死(shrink-to-fit 随语言),靠左右 padding 30 扩热区,高占满槽+ expect(skip.style.pointerEvents).toBe('auto');+ expect(skip.style.width).toBe('');+ expect(skip.style.paddingLeft).toBe('30px');+ expect(skip.style.paddingRight).toBe('30px');+ expect(skip.style.height).toBe('60px');+ });+it('providers:phone-only → 无 tabs,placeholder 为手机号', async () => {mount(await identifierState('providers:phone-only'));expect(screen.queryByTestId('login-id-tabs')).toBeNull();@@ -216,14 +271,15 @@ describe('identifier 态(附录 A providers 场景)', () => {);});- it('providers:cn-social → 圆钮行 = Apple + SSO + 游客(游客恒为行内最后一颗,SSO 次末)', async () => {+ it('providers:cn-social → 圆钮行 = Apple + SSO(SSO 恒为行内最后一颗,游客圆钮已删)', async () => {mount(await identifierState('providers:cn-social'));const row = screen.getByTestId('login-social-row');expect(screen.getByTestId('login-social-apple')).toBeTruthy();expect(screen.queryByTestId('login-social-google')).toBeNull();- // consent PR:游客人形圆钮追加为行内最后一颗(figma 600:655 顺序 Apple→SSO→游客)- expect(row.lastElementChild).toBe(screen.getByTestId('login-social-guest'));- expect(row.children[row.children.length - 2]).toBe(screen.getByTestId('login-social-sso'));+ // 新稿(700:796)圆钮行只剩 Apple + SSO 两颗:游客圆钮由面板内「跳过登录」文字链取代+ expect(row.children.length).toBe(2);+ expect(row.firstElementChild).toBe(screen.getByTestId('login-social-apple'));+ expect(row.lastElementChild).toBe(screen.getByTestId('login-social-sso'));});it('providers:global-social → 圆钮行 = Apple + Google + SSO,region=global(不冒充构建区域)', async () => {diff --git a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.pr2a.harness.test.tsx b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.pr2a.harness.test.tsxindex fabd7b0b78..7a7181c932 100644--- a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.pr2a.harness.test.tsx+++ b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.pr2a.harness.test.tsx@@ -143,7 +143,7 @@ describe('method-choice', () => {expect(screen.getByTestId('login-back-button')).toBeTruthy();});- it('多 connection:双企业行 158/278,个人行按 demo 仲裁抑制(440 面板仅容两行)', async () => {+ it('多 connection:双企业行 158/278,个人行按 demo 仲裁抑制(方式行只排两行)', async () => {mount(await methodChoiceState('sso:multi'));expect(screen.getByTestId('login-method-sso-scenario-conn-1').style.top).toBe('158px');expect(screen.getByTestId('login-method-sso-scenario-conn-2').style.top).toBe('278px');diff --git a/apps/desktop/src/renderer/components/login/__tests__/LoginPage.region.harness.test.tsx b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.region.harness.test.tsxnew file mode 100644index 0000000000..2938c111c6--- /dev/null+++ b/apps/desktop/src/renderer/components/login/__tests__/LoginPage.region.harness.test.tsx@@ -0,0 +1,170 @@+// @vitest-environment jsdom++import { act, cleanup, fireEvent, render, screen } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { CindyAuthClient, reduceAuthFlow, type AuthFlowState } from '@cindy/auth-client';+import { createScenarioFetch } from '@cindy/auth-client/fixtures';++/**+ * Global(国际区)构建变体的登录皮回归。+ *+ * 为什么单开一份:仓内其余登录单测一律把构建区域 mock 成 `cn`+ * (`LoginPage.harness.test.tsx` / `LoginPage.consent.test.tsx` /+ * `LoginPage.pr2a.harness.test.tsx` 的 `CURRENT_CINDY_REGION: 'cn'`),+ * `providers:global-social` 场景只换服务端 provider 组合、不冒充构建区域。+ * 本文件把 `CURRENT_CINDY_REGION` 与 `VITE_CINDY_AUTH_REGION` 双双置为 global,+ * 锁住「登录面板改版四件事(面板 500 / 删游客圆钮 / 面板内跳过登录 / 跳过免协议门)+ * 在国际区同样生效」——即区域分支只影响 identifier 形态、区域徽标、协议 URL+ * 与服务端 social 组合,不影响面板几何与本地模式入口。+ */++const loginHook = vi.hoisted(() => ({+ value: {+ isLoading: false,+ errorCode: null as string | null,+ loginState: null as unknown,+ dispatch: vi.fn(async () => true),+ clearError: vi.fn(),+ },+}));++// 协议文案 key 还原为真实 tagged 文案(链接段解析依赖标记),其余 key 原样返回+const CONSENT_TEXT: Record<string, string> = {+ 'login.consentStatement':+ 'I have read and agree to the <terms>Terms</terms> and <privacy>Privacy</privacy>',+};++vi.mock('react-i18next', () => ({+ useTranslation: () => ({ t: (key: string) => CONSENT_TEXT[key] ?? key }),+}));+// 构建区域 = global(LEGAL_LINKS 亦随之解析为 protocol.xd.com 系)+vi.mock('../../../../shared/brandRegion', () => ({+ CURRENT_CINDY_REGION: 'global',+ CURRENT_APP_ID: 'com.xd.cindy',+}));+vi.mock('@/hooks/useLogin', () => ({ useLogin: () => loginHook.value }));+vi.mock('@/components/title-bar/WindowControls', () => ({ WindowControls: () => null }));++import { LoginPage } from '../LoginPage';++const GLOBAL_TERMS_URL = 'https://protocol.xd.com/cindy/agreement-1.0.html';+const GLOBAL_PRIVACY_URL = 'https://protocol.xd.com/cindy/privacy.html';++async function globalIdentifierState(scenario = 'providers:global-social'): Promise<AuthFlowState> {+ const client = new CindyAuthClient({+ baseUrl: 'https://auth.scenario.invalid',+ region: 'global',+ deviceId: 'region-harness',+ clientType: 'desktop',+ fetch: createScenarioFetch(scenario, { region: 'global' })!,+ });+ const providers = await client.getProviders();+ return reduceAuthFlow(null, { type: 'providers-loaded', providers });+}++function mount(state: AuthFlowState | null, extra?: Partial<typeof loginHook.value>) {+ loginHook.value = {+ isLoading: false,+ errorCode: null,+ loginState: state,+ dispatch: vi.fn(async () => true),+ clearError: vi.fn(),+ ...extra,+ };+ return render(<LoginPage />);+}++const openExternal = vi.fn(async () => ({ success: true }));+const authEnterLocal = vi.fn(async () => ({ mode: 'local' }));+const acceptPrivacyConsent = vi.fn(async () => ({+ privacyConsentAccepted: true,+ analyticsEnabled: true,+ allowed: true,+}));++beforeEach(() => {+ // isGlobalBuild 在渲染时读 import.meta.env,必须在 render 前置好+ vi.stubEnv('VITE_CINDY_AUTH_REGION', 'global');+ openExternal.mockClear();+ authEnterLocal.mockClear();+ acceptPrivacyConsent.mockClear();+ Object.defineProperty(window, 'electronAPI', {+ configurable: true,+ value: { platform: 'darwin', openExternal, authEnterLocal, acceptPrivacyConsent },+ });+});++afterEach(() => {+ cleanup();+ vi.unstubAllEnvs();+ vi.clearAllMocks();+});++describe('Global 构建变体:登录改版四件事同样生效', () => {+ it('确实处于 Global 变体(不挂区域徽标 + 邮箱 identifier + 协议链接走 protocol.xd.com)', async () => {+ mount(await globalIdentifierState());+ // global 构建不挂徽标(#554 起的产品叙事硬规则,DESIGN.md §16.3:不得回退);+ // cn / dev 才标注。徽标的三档区域映射本身由 LoginPage.regionPill.test 覆盖,+ // 这里只用「无徽标」为 global 变体做一处正向确认。+ expect(screen.queryByTestId('login-region-pill')).toBeNull();+ expect((screen.getByTestId('login-input') as HTMLInputElement).placeholder).toBe(+ 'login.emailPlaceholder',+ );+ fireEvent.click(screen.getByTestId('login-consent-terms-link'));+ expect(openExternal).toHaveBeenCalledWith(GLOBAL_TERMS_URL);+ fireEvent.click(screen.getByTestId('login-consent-privacy-link'));+ expect(openExternal).toHaveBeenCalledWith(GLOBAL_PRIVACY_URL);+ });++ it('面板 680×500,「跳过登录」文字按钮在面板内 680×60 槽 @y430(24px 下划线 #6F6F6F)', async () => {+ mount(await globalIdentifierState());+ const panel = screen.getByTestId('login-panel-identifier');+ expect(panel.style.width).toBe('680px');+ expect(panel.style.height).toBe('500px');+ const slot = screen.getByTestId('login-skip-entry-slot');+ const skip = screen.getByTestId('login-skip-entry');+ expect(panel.contains(slot)).toBe(true);+ expect(slot.style.left).toBe('0px');+ expect(slot.style.top).toBe('430px');+ expect(slot.style.width).toBe('680px');+ expect(slot.style.height).toBe('60px');+ expect(skip.style.fontSize).toBe('24px');+ expect(skip.className).toContain('underline');+ // 颜色与热区口径在 Global 变体同样生效(用户拍板 2026-07-27)+ expect(skip.getAttribute('style') ?? '').toContain('--login-secondary-text');+ expect(slot.style.pointerEvents).toBe('none');+ expect(skip.style.paddingLeft).toBe('30px');+ expect(skip.style.paddingRight).toBe('30px');+ });++ it('圆钮行 = Apple + Google + SSO 三颗(游客圆钮已删,count 随 providers 动态)', async () => {+ mount(await globalIdentifierState());+ const row = screen.getByTestId('login-social-row');+ expect(screen.queryByTestId('login-social-guest')).toBeNull();+ expect(row.children.length).toBe(3);+ expect(row.firstElementChild).toBe(screen.getByTestId('login-social-apple'));+ expect(row.children[1]).toBe(screen.getByTestId('login-social-google'));+ expect(row.lastElementChild).toBe(screen.getByTestId('login-social-sso'));+ // 协议行随面板增高整体下移到组坐标 y=642+ expect(screen.getByTestId('login-consent-row').style.top).toBe('642px');+ });++ it('未勾选点「跳过登录」→ 无协议弹窗,直接进本地模式,且不写同意记录', async () => {+ mount(await globalIdentifierState());+ expect(screen.getByTestId('login-consent-radio').getAttribute('aria-checked')).toBe('false');+ await act(async () => {+ fireEvent.click(screen.getByTestId('login-skip-entry'));+ });+ expect(screen.queryByTestId('login-consent-dialog')).toBeNull();+ expect(authEnterLocal).toHaveBeenCalledTimes(1);+ expect(acceptPrivacyConsent).not.toHaveBeenCalled();+ });++ it('其它个人登录链路的协议门未被误摘:未勾选点 Apple 圆钮仍先弹协议弹窗', async () => {+ mount(await globalIdentifierState());+ fireEvent.click(screen.getByTestId('login-social-apple'));+ expect(screen.getByTestId('login-consent-dialog')).toBeTruthy();+ expect(loginHook.value.dispatch).not.toHaveBeenCalled();+ });+});diff --git a/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts b/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.tsindex 81d80c7aed..1c10707f29 100644--- a/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts+++ b/apps/desktop/src/renderer/components/login/__tests__/loginScale.test.ts@@ -58,24 +58,26 @@ describe('panelPlacement(面板恒定 1x,用户拍板 2026-07-23,design.md §11)expect(panelPlacement(4000, 4000, 1229).scale).toBe(PANEL_FIXED_SCALE);});- it('(1280, 800) 品牌避让主导:top = 立绘底(400+160×0.3813)+24 ≈ 485.01', () => {- const { topY } = panelPlacement(1280, 800, 1229);- expect(topY).toBeCloseTo(400 + 160 * (800 / 2098) + 24, 2);+ // 组高 620(面板 500 + gap 40 + 圆钮 80)→ 屏幕 310;各 clamp 锚点随之下调 30 屏幕 px。+ // 品牌避让档取 (1280,900):组高 620 后 (1280,800) 的视口底 clamp(466)已压过品牌避让(485)。+ it('(1280, 900) 品牌避让主导:top = 立绘底(450+160×0.4290)+24 ≈ 542.64', () => {+ const { topY } = panelPlacement(1280, 900, 1229);+ expect(topY).toBeCloseTo(450 + 160 * (900 / 2098) + 24, 2);});- it('(800, 600) 视口底 clamp 主导(功能优先压过品牌避让):top = 600-24-280 = 296', () => {- expect(panelPlacement(800, 600, 1229).topY).toBe(296);+ it('(800, 600) 视口底 clamp 主导(功能优先压过品牌避让):top = 600-24-310 = 266', () => {+ expect(panelPlacement(800, 600, 1229).topY).toBe(266);});it('底部有本地模式操作区时,视口 clamp 为 footer 预留安全空间', () => {const placement = panelPlacement(800, 600, 1229, 124);- expect(placement.topY).toBe(172);- expect(placement.topY + 560 * placement.scale + 124).toBe(576);+ expect(placement.topY).toBe(142);+ expect(placement.topY + 620 * placement.scale + 124).toBe(576);});- it('高窗时锚点主导(不触发任何 clamp):(1300, 1400) top = 锚点中心-140', () => {+ it('高窗时锚点主导(不触发任何 clamp):(1300, 1400) top = 锚点中心-155', () => {const s14 = 1400 / 2098;- const anchorTop = 700 + (1229 + 280 - 1049) * s14 - 140;+ const anchorTop = 700 + (1229 + 310 - 1049) * s14 - 155;expect(panelPlacement(1300, 1400, 1229).topY).toBeCloseTo(anchorTop, 2);});@@ -85,38 +87,43 @@ describe('panelPlacement(面板恒定 1x,用户拍板 2026-07-23,design.md §11)});describe('brandPlacement(品牌块整体让位,用户拍板 2026-07-23 第二轮,design.md §11)', () => {- it('① 常态(1280,800):块底 461 < 面板顶 485-12,零让位 = v3.1 原值', () => {- const r = brandPlacement(1280, 800);- expect(r.scale).toBe(desktopScale(1280, 800).scale);+ // 组高 560→620 后面板顶整体上移 30 屏幕 px,各档触发窗口随之收紧:+ // 常态档取 (1280,1000)(原 (1280,800) 现已落进上移档),上移档取 (800,700)+ // (原 (800,600) 现已落进压缩档);公式与守恒式不变。+ it('① 常态(1280,1000):块底 576 < 面板顶 600-12,零让位 = v3.1 原值', () => {+ const r = brandPlacement(1280, 1000);+ expect(r.scale).toBe(desktopScale(1280, 1000).scale);expect(r.translateY).toBe(0);});- it('② 上移档(800,600):面板顶 296,块底 300+160×s 越界 → 整块上移,不压缩', () => {- const s6 = 600 / 2098;- const r = brandPlacement(800, 600);- expect(r.scale).toBe(s6); // 不压缩- expect(r.translateY).toBeCloseTo(-(300 + 160 * s6 - (296 - 12)), 2);+ it('② 上移档(800,700):面板顶 366,块底 350+160×s 越界 → 整块上移,不压缩', () => {+ const s7 = 700 / 2098;+ const r = brandPlacement(800, 700);+ expect(r.scale).toBe(s7); // 不压缩+ expect(r.translateY).toBeCloseTo(-(350 + 160 * s7 - (366 - 12)), 2);});it('③ 压缩档(800,500):上移到顶仍不够 → 块高压进 [12, 面板顶-12]', () => {const r = brandPlacement(800, 500);- const limit = 500 - 24 - 280 - 12; // 面板顶(视口底 clamp) - gap = 184+ const limit = 500 - 24 - 310 - 12; // 面板顶(视口底 clamp) - gap = 154expect(r.scale).toBeCloseTo((limit - 12) / 934, 6);const blockTop2 = 250 + (275 - 1049) * r.scale;expect(r.translateY).toBeCloseTo(12 - blockTop2, 2);});it('让位后块底恰好贴面板顶-12(上移档守恒式)', () => {- const s6 = 600 / 2098;- const r = brandPlacement(800, 600);- const blockBottomAfter = 300 + 160 * s6 + r.translateY;- expect(blockBottomAfter).toBeCloseTo(296 - 12, 2);+ const s7 = 700 / 2098;+ const r = brandPlacement(800, 700);+ const blockBottomAfter = 350 + 160 * s7 + r.translateY;+ expect(blockBottomAfter).toBeCloseTo(366 - 12, 2);});it('品牌让位与登录 footer 使用同一 bottom reserve,避免面板上移后再次遮挡品牌', () => {const panelTop = panelPlacement(800, 600, 1229, 124).topY;const r = brandPlacement(800, 600, 124);const blockBottomAfter = 300 + 160 * r.scale + r.translateY;- expect(blockBottomAfter).toBeLessThanOrEqual(panelTop - 12);+ // 组高 620 后本组合落进压缩档:块底代数上恰好等于 limit(= panelTop-12),+ // 浮点余量 1e-9(压缩档 scale = (limit-12)/934,乘回 934 未必位精确;实测误差 ~1e-13)。+ expect(blockBottomAfter).toBeLessThanOrEqual(panelTop - 12 + 1e-9);});});diff --git a/apps/desktop/src/renderer/components/login/loginDesignTokens.ts b/apps/desktop/src/renderer/components/login/loginDesignTokens.tsindex b0331a2a6a..2aef91fab4 100644--- a/apps/desktop/src/renderer/components/login/loginDesignTokens.ts+++ b/apps/desktop/src/renderer/components/login/loginDesignTokens.ts@@ -28,13 +28,19 @@ export const SLOGAN = {height: 129.12,} as const;-/** 登录整体组(figma §5.1:x=570;sso-org 族 y=1227,其余 1229——demo loginY())。 */+/**+ * 登录整体组(figma §5.1:x=570;sso-org 族 y=1227,其余 1229——demo loginY())。+ *+ * height = 面板 500 + gap 40 + 第三方圆钮 80 = 620(新稿 700:783;旧稿 560 = 面板 440+ * 时代)。面板增高 60 后组内面板外元素整体下移 60(SOCIAL.y 480→540、+ * CONSENT_ROW.y 582→642),组高随之 +60。+ */export const LOGIN_GROUP = {x: 570,yDefault: 1229,ySsoOrg: 1227,width: 680,- height: 560,+ height: 620,} as const;/**@@ -75,8 +81,17 @@ export const LOGIN_LOCAL_MODE = {descriptionLineHeight: 18,} as const;-/** 面板与面板内组件几何(figma §5.1/§4;wave4 面板描边 1px inside 368:1383)。 */-export const PANEL = { width: 680, height: 440, radius: 36 } as const;+/**+ * 面板与面板内组件几何(figma §5.1/§4;wave4 面板描边 1px inside 368:1383)。+ *+ * height 440 → 500(新稿三端一致 680×500:桌面 700:791 / 长屏 705:886 / 短屏 705:1062):+ * 增的 60 恰好是面板内新增的「跳过登录」容器高(SKIP_ENTRY),面板内其余元素+ * (标题 31 / 副标题 75 / 输入框 158 / 主按钮 300 / error 380)坐标一律不动。+ * 本常量供 LoginPage 全部步骤共用——面板高度在步骤间必须恒定,否则 identifier↔验证码+ * 等切换会出现 30 CSS px 的高度跳变(规则 7:杜绝视觉跳变);Splash 借用面板时不跟随+ * 500,见 SPLASH_PANEL.height。+ */+export const PANEL = { width: 680, height: 500, radius: 36 } as const;export const TITLE = { y: 31, height: 38, fontSize: 32 } as const;/** 副标题:540@70 ≤2 行顶对齐,槽高 = 行高 × 最大行数(DESIGN.md §16.2,2026-07-24 拍板)。 */export const SUBTITLE = { x: 70, y: 75, width: 540, fontSize: 20, lineHeight: 23, maxLines: 2 } as const;@@ -105,10 +120,16 @@ export const CONTROL = {textPadLeft: 31, // §4.1 文本 x=31} as const;export const SPINNER = { size: 24, x: 487, y: 27 } as const; // 247:1546 @load-export const SOCIAL = { y: 480, size: 80, gap: 70, radius: 50, iconSize: 48 } as const; // §4.5+// §4.5;y 480 → 540(面板 440→500,圆钮行距面板底恒 40:新稿容器 y=540)+export const SOCIAL = { y: 540, size: 80, gap: 70, radius: 50, iconSize: 48 } as const;export const BACK = { x: 20, y: 20, size: 60, radius: 40 } as const; // §4.6-// 错误提示:占满主按钮底(380)→面板底(440)整段,文案垂直居中(2026-07-24 拍板;原 h50 偏上)-export const ERROR_TEXT = { y: 380, width: 680, height: 60, fontSize: 20 } as const;+/**+ * 错误提示:占满主按钮底(380)→「跳过登录」容器顶(430)整段,文案垂直居中。+ * 新稿 error_text 容器 680×50 @y380(705:1067),y 不因面板增高/新增跳过入口而移动;+ * 高度回到 50(2026-07-24 的 h60「占满到面板底」是面板 440 时代的等价写法)。+ * 与 SKIP_ENTRY 首尾相接、同时可见互不重叠(文案视觉间距 ≈30 设计px)。+ */+export const ERROR_TEXT = { y: 380, width: 680, height: 50, fontSize: 20 } as const;export const METHOD_ROW = {x: 70,width: 540,@@ -122,17 +143,40 @@ export const METHOD_ROW = {} as const; // §4.9 + demo method-rowexport const LOADING_RING = { x: 308, yBrowser: 158, yPreparing: 193, size: 64 } as const; // §5.2export const TEXT_LINK = { x: 70, y: 238, width: 540, height: 50, fontSize: 20 } as const; // §4.7+/**+ * 「跳过登录」文字**按钮**(新稿容器 705:1068 / 700:910:面板内 680×60 @y430;+ * 文本 96×29 @(292,15) Regular 24 下划线,水平+垂直居中——文本中心 340 = 容器中心)。+ * 组件 = LoginSkipEntry(**不是** LoginTextLink:文字按钮与文字链接是两种组件,+ * 前者不做 hover/pressed 变色;用户拍板 2026-07-27)。+ *+ * 槽位 430..490,面板底余 10(= 500 - 490,新稿下内边距);上接 ERROR_TEXT(380..430),+ * 两者同时可见时首尾相接不重叠。字号取稿值 24(≠ TEXT_LINK 的 20,故单列常量);+ * 颜色走 --login-secondary-text(#6F6F6F 双模同值,与稿一致)。+ *+ * width 680 / height 60 是**布局容器**,容器自身不可点;hitPaddingX = 可点区在实际+ * 文字渲染宽度基础上左右各扩的设计px(热区随语言自适应,zh 4 字与 en「Skip Sign-In」+ * 宽度不同;用户拍板 2026-07-27)。+ */+export const SKIP_ENTRY = {+ x: 0,+ y: 430,+ width: 680,+ height: 60,+ fontSize: 24,+ hitPaddingX: 30,+} as const;/** sso-org 帮助行:顶对齐 ≤2 行,y=输入框底 238+6,两行至 290 < 主按钮 300(DESIGN.md §16.2 折行分级 2)。 */export const SSO_ORG_HINT = { x: 70, y: 244, width: 540, fontSize: 20, lineHeight: 23, maxLines: 2 } as const;/*** 协议同意行(figma 600:660「服务条款」行:680×40,radio 24 @x156 + 文字 20 @x186.5)。- * 行顶相对登录组顶 = 帧内 y1811 - 组 y1229 = 582(即组底 560 下方 22 设计px);+ * 行顶相对登录组顶 = 642(新稿 700:807 帧内 y1871 - 组 y1229;即组底 620 下方 22 设计px,+ * 面板 440→500 后整行随组下移 60,与圆钮行的 22 间距不变);* 行内容(radio + 声明文字)水平居中,radio 与文字间距 = 186.5 - (156+24) = 6.5。* 文字宽随语言变化,落码用 flex 居中而非固定 x(几何语义与稿等价)。*/export const CONSENT_ROW = {- y: 582,+ y: 642,width: 680,height: 40,gap: 6.5,@@ -169,10 +213,18 @@ export const RESEND_COUNTDOWN_MS = 42_000;/*** Splash 统一面板(wave4 五帧 379:581/525/607/633/655 实测,figma §10.3;- * design.md §8.1 条 5)。面板本体 = 登录同款白面板(680×440 r36 @570,1229,- * PANEL/LOGIN_GROUP 复用);以下为面板内 Splash 专属元素几何(面板内坐标)。+ * design.md §8.1 条 5)。面板本体 = 登录同款白面板(680×440 r36 @570,1229,复用+ * LoginPanel 组件 + LOGIN_GROUP 落位,高度自持见下);以下为面板内 Splash 专属元素+ * 几何(面板内坐标)。*/export const SPLASH_PANEL = {+ /**+ * 面板高度 440:**不跟随登录面板的 500**。登录面板增的 60 只为承载面板内的+ * 「跳过登录」入口(SKIP_ENTRY),Splash 五帧没有该入口、设计稿也未改版,跟随会+ * 在启动态凭空多出 50 CSS px 空白。Splash 与登录面板不同 stage、不同缩放+ * (desktopScale vs PANEL_FIXED_SCALE),尺寸本就不重合,拆开不破坏 handoff 连续性。+ */+ height: 440,/** spinner 64×64 @面板内(308,188),内弧 #6F6F6F(login-secondary-text) */spinner: { x: 308, y: 188, size: 64 },/** 更新/下载进度条 轨 501×16 r12 @(90,346)(379:580) */diff --git a/apps/desktop/src/renderer/components/login/loginScale.ts b/apps/desktop/src/renderer/components/login/loginScale.tsindex 54125f3816..36127b2e36 100644--- a/apps/desktop/src/renderer/components/login/loginScale.ts+++ b/apps/desktop/src/renderer/components/login/loginScale.ts@@ -11,6 +11,8 @@* (1280, 800) → ≈0.3813;(800, 600) → ≈0.2860;宽度拉伸不改 scale。*/+import { LOGIN_GROUP } from './loginDesignTokens';+/** 设计画布尺寸(figma §5.1 桌面通用画板 1819×2098)。 */export const LOGIN_STAGE_WIDTH = 1819;export const LOGIN_STAGE_HEIGHT = 2098;@@ -52,8 +54,8 @@ export interface PanelPlacement {/*** 面板定位(用户拍板 2026-07-23,design.md §11):- * - 尺寸恒定 0.5(登录整体组 680×560 设计px → 340×280 逻辑px);- * - 垂直锚点跟随品牌层 desktopScale 画布(组中心 y=groupY+280 映射到屏幕),+ * - 尺寸恒定 0.5(登录整体组 680×620 设计px → 340×310 逻辑px);+ * - 垂直锚点跟随品牌层 desktopScale 画布(组中心 y=groupY+310 映射到屏幕),* 再依次 clamp:① 品牌避让——面板顶 ≥ 立绘底(设计 y=1209,figma §4.11)+24;* ② 功能优先——面板底 ≤ 视口底-24(压过品牌避让,小窗允许叠上立绘渐隐区,* 面板层 z-[9990] 本就盖品牌层 z-[9980]);额外底部内容通过 bottomReserve@@ -67,8 +69,10 @@ export function panelPlacement(bottomReserve = 0,): PanelPlacement {const { scale: brandScale } = desktopScale(w, h);- const panelHeight = 560 * PANEL_FIXED_SCALE; // 登录整体组高 560(figma §5.1)- const anchorCenterY = h / 2 + (groupY + 280 - LOGIN_STAGE_HEIGHT / 2) * brandScale;+ // 登录整体组高(figma §5.1;面板 500 + gap 40 + 圆钮 80 = 620,面板增高后同步跟随)+ const panelHeight = LOGIN_GROUP.height * PANEL_FIXED_SCALE;+ const anchorCenterY =+ h / 2 + (groupY + LOGIN_GROUP.height / 2 - LOGIN_STAGE_HEIGHT / 2) * brandScale;const brandBottomY = h / 2 + (1209 - LOGIN_STAGE_HEIGHT / 2) * brandScale;let topY = anchorCenterY - panelHeight / 2;topY = Math.max(topY, brandBottomY + 24);diff --git a/apps/desktop/src/renderer/components/splash/SplashScreen.tsx b/apps/desktop/src/renderer/components/splash/SplashScreen.tsxindex f0945b89ec..57e6ff9223 100644--- a/apps/desktop/src/renderer/components/splash/SplashScreen.tsx+++ b/apps/desktop/src/renderer/components/splash/SplashScreen.tsx@@ -27,7 +27,8 @@ import {* 所有权(v4/v6.12):品牌视觉(白底体系背景/立绘/字标/Slogan)已整体迁入* `LoginBrandStage`(唯一渲染者,z-[9980],本组件透过透明根透出它);本组件退化为* loading/tips/进度层——登录同款白面板(680×440 r36 @570,1229,与登录帧同坐标系- * 同 desktopScale 缩放)承载全部 Splash 状态。+ * 同 desktopScale 缩放)承载全部 Splash 状态。面板高 440 由 SPLASH_PANEL.height 固定,+ * 不跟随登录面板 2026-07-27 的 500(增高只为登录面板内的「跳过登录」入口)。** 状态机零删改:useSplash 14-phase 与动作映射未动,本组件只消费。* 帧↔状态映射(design.md §8.1 / figma §10.3):@@ -226,7 +227,10 @@ export function SplashScreen() {transformOrigin: '50% 50%',}}>- {/* 统一白面板:登录同款(680×440 r36 @570,1229,wave4 五帧同位) */}+ {/* 统一白面板:登录同款(680×440 r36 @570,1229,wave4 五帧同位)。+ no-drag 盒高度取 SPLASH_PANEL.height 而非 LOGIN_GROUP.height:登录组高+ (620,含圆钮行)与 Splash 无关,跟着它会把面板底下的空白也划成不可拖拽区。+ 盒 = 面板本体,语义即「只有面板内容不参与窗口拖拽」。 */}<divclassName="absolute"style={@@ -234,12 +238,14 @@ export function SplashScreen() {left: LOGIN_GROUP.x,top: LOGIN_GROUP.yDefault,width: LOGIN_GROUP.width,- height: LOGIN_GROUP.height,+ height: SPLASH_PANEL.height,WebkitAppRegion: 'no-drag',} as React.CSSProperties}>- <LoginPanel testId="splash-panel">+ {/* height 显式取 SPLASH_PANEL.height(440):登录面板 2026-07-27 增高到 500 是为+ 承载面板内「跳过登录」入口,Splash 五帧无该入口、设计稿未改版,故不跟随 */}+ <LoginPanel testId="splash-panel" height={SPLASH_PANEL.height}>{title !== null && (<LoginTitleBlocktitle={title}diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex f40b10c6b9..915c97283f 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -3123,7 +3123,6 @@"ssoEntry": "Sign in with enterprise SSO","localModeEntry": "Skip Sign-In","localModeOpening": "Opening local mode…",- "returnToLocalMode": "Return to local mode","localModeDescription": "No Cindy account required. Data stays on this device; cloud models, cross-device access, and marketplace services are unavailable.","consentStatement": "I have read and agree to the <terms>Terms of Service</terms> and <privacy>Privacy Policy</privacy>","consentDialog": {diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 0a2124ef7e..3fb54a134a 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -3122,7 +3122,6 @@"ssoEntry": "企業 SSO でサインイン","localModeEntry": "ログインをスキップ","localModeOpening": "ローカルモードを開いています…",- "returnToLocalMode": "ローカルモードに戻る","localModeDescription": "Cindy アカウントは不要です。データはこのデバイスに保存され、クラウドモデル、デバイス間アクセス、マーケットサービスは利用できません。","consentStatement": "<terms>利用規約</terms>と<privacy>プライバシーポリシー</privacy>を読み、同意します","consentDialog": {diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 2dfe5a2746..56b9093d4e 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -3122,7 +3122,6 @@"ssoEntry": "기업 SSO로 로그인","localModeEntry": "로그인 건너뛰기","localModeOpening": "로컬 모드를 여는 중…",- "returnToLocalMode": "로컬 모드로 돌아가기","localModeDescription": "Cindy 계정이 필요하지 않습니다. 데이터는 이 기기에 저장되며 클라우드 모델, 기기 간 연결 및 마켓 서비스는 사용할 수 없습니다.","consentStatement": "<terms>서비스 이용약관</terms> 및 <privacy>개인정보 처리방침</privacy>을 읽고 동의합니다","consentDialog": {diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 7e177e2e77..abe744fdbf 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -3122,7 +3122,6 @@"ssoEntry": "使用企业 SSO 登录","localModeEntry": "跳过登录","localModeOpening": "正在打开本地模式…",- "returnToLocalMode": "返回本地模式","localModeDescription": "无需 Cindy 账号,数据保存在本机。云模型、跨设备与市场服务不可用。","consentStatement": "我已阅读并同意 <terms>服务条款</terms> 和 <privacy>隐私协议</privacy>","consentDialog": {diff --git a/apps/mobile/src/auth/__tests__/loginSkinLayout.test.ts b/apps/mobile/src/auth/__tests__/loginSkinLayout.test.tsindex dfb24c21d5..4fdfb39808 100644--- a/apps/mobile/src/auth/__tests__/loginSkinLayout.test.ts+++ b/apps/mobile/src/auth/__tests__/loginSkinLayout.test.ts@@ -45,29 +45,38 @@ describe('loginSkin 750 stage 布局引擎', () => {expect(resolveLoginStage(750, 2000).designHeight).toBe(1800);});- it('短屏档 1334:cindy/slogan/word/loginY 逐字段等于 wave3.5 旧表(2026-07-24 拍板整体上移 40 设计px,hero 不动)', () => {+ it('短屏档 1334:品牌簇逐字段等于登录改版新稿 figma 705:915 实测值;loginY 仍是 main 的 694', () => {const layout = resolveLoginStage(375, 667); // scale 0.5 → dh 1334expect(layout.designHeight).toBe(1334);- expectBox(layout.cindy, { x: 75, y: 107, w: 599, h: 720 });- expectBox(layout.slogan, { x: 462.55, y: 440.33, w: 254.01, h: 72.8 });- expectBox(layout.word, { x: 199, y: 554.48, w: 352.93, h: 120.54 });+ // 立绘 599×720 @(75,60)(新稿 hero y=87,2026-07-27 用户拍板方案 B 再上移 27 避脸)+ expectBox(layout.cindy, { x: 75, y: 60, w: 599, h: 720 });+ // slogan 可见图形框 = 容器 @(385,387) + vector(77.55,21.37);尺寸稿内未变+ expectBox(layout.slogan, { x: 462.55, y: 408.37, w: 254.01, h: 72.8 });+ // 字标图像框 = 主容器 @(35,422) + WORD_MARK 内字标 @(173,65) = (208,487),335×115+ expectBox(layout.word, { x: 208, y: 487, w: 335, h: 115 });+ // 功能区落位不随本轮视觉改版变化(面板几何 = main:组高 560 + 底距,2026-07-24 拍板)expect(layout.loginY).toBe(694);});- it('长屏档 1624:双区统一 y=116 的 long 表逐字段命中(2026-07-24 拍板整体上移 40 设计px,hero 不动)', () => {+ it('长屏档 1624:新稿 figma 705:799 品牌簇逐字段命中(hero y=106);loginY 仍是 main 的 933', () => {const layout = resolveLoginStage(375, 812); // scale 0.5 → dh 1624expect(layout.designHeight).toBe(1624);- expectBox(layout.cindy, { x: 0, y: 116, w: 750, h: 902 });- expectBox(layout.slogan, { x: 387, y: 646, w: 321, h: 92 });- expectBox(layout.word, { x: 175, y: 774, w: 401, h: 137 });+ expectBox(layout.cindy, { x: 0, y: 106, w: 750, h: 902 });+ // slogan 可见图形框 = 容器 @(362.57,545.32) + vector(82.33,22.68),269.66×77.29+ // (2026-07-27 用户审 demo 拍板:slogan 下移避脸,inner y 536.68 → 568,距字标 24px)+ expectBox(layout.slogan, { x: 444.9, y: 568, w: 269.66, h: 77.29 });+ // 字标 = 主容器 @(35,627) + 字标 @(147,42.17) = (182,669.17),387×132.18+ expectBox(layout.word, { x: 182, y: 669.17, w: 387, h: 132.18 });expect(layout.loginY).toBe(933);});it('两档间 lerp:designHeight=1479 中点全字段线性插值(含 loginY)', () => {const layout = resolveLoginStage(750, 1479); // scale 1 → dh 1479,t=0.5- expectBox(layout.cindy, { x: 37.5, y: 111.5, w: 674.5, h: 811 });- expectBox(layout.slogan, { x: 424.775, y: 543.165, w: 287.505, h: 82.4 });- expectBox(layout.word, { x: 187, y: 664.24, w: 376.965, h: 128.77 });+ // 立绘 y 中点 = (60 + 106)/2(短屏档上移 27 后)+ expectBox(layout.cindy, { x: 37.5, y: 83, w: 674.5, h: 811 });+ // slogan y 中点 = (408.37 + 568)/2(2026-07-27 LONG 档下移避脸后)+ expectBox(layout.slogan, { x: 453.725, y: 488.185, w: 261.835, h: 75.045 });+ expectBox(layout.word, { x: 195, y: 578.085, w: 361, h: 123.59 });expect(layout.loginY).toBeCloseTo(813.5, 6);});@@ -86,16 +95,51 @@ describe('loginSkin 750 stage 布局引擎', () => {expect(layout.loginY).toBe(360);expectBox(layout.cindy, {x: 211.51226158038146,- y: 58.31062670299727,+ y: 32.697547683923706,w: 326.43051771117164,h: 392.3705722070845,});// v 下限 0.25:dh=600 时 v=max(0.25, 0)=0.25,loginY=0const floor = resolveLoginStage(750, 600);expect(floor.loginY).toBe(0);- expectBox(floor.cindy, { x: 300, y: 26.75, w: 149.75, h: 180 });+ expectBox(floor.cindy, { x: 300, y: 15, w: 149.75, h: 180 });// 短屏表仍是压缩基准(锚定回归:防有人把基准换成 long 表)- expect(LOGIN_STAGE_SHORT.cindy).toEqual({ x: 75, y: 107, w: 599, h: 720 });+ expect(LOGIN_STAGE_SHORT.cindy).toEqual({ x: 75, y: 60, w: 599, h: 720 });+ });++ it('品牌簇不重叠不变式:字标框底不压面板顶、slogan 不压字标(两档)', () => {+ // 字标可见框底 < 面板顶:两档都留正间距(面板不透明,压上去会盖住字标)+ expect(LOGIN_STAGE_SHORT.word.y + LOGIN_STAGE_SHORT.word.h).toBeLessThan(+ LOGIN_STAGE_SHORT.loginY,+ );+ expect(LOGIN_STAGE_LONG.word.y + LOGIN_STAGE_LONG.word.h).toBeLessThan(+ LOGIN_STAGE_LONG.loginY,+ );+ // slogan 可见框与字标框不重叠(inner vector 口径下两档均无交叠)+ expect(LOGIN_STAGE_SHORT.slogan.y + LOGIN_STAGE_SHORT.slogan.h).toBeLessThan(+ LOGIN_STAGE_SHORT.word.y,+ );+ expect(LOGIN_STAGE_LONG.slogan.y + LOGIN_STAGE_LONG.slogan.h).toBeLessThan(+ LOGIN_STAGE_LONG.word.y,+ );+ // 2026-07-27 用户审 demo 拍板:LONG 档 slogan 下移避脸后,底↔字标顶 ≈24 设计px+ // (钉住下限,防后续再往下挪撞字标)+ expect(+ LOGIN_STAGE_LONG.word.y - (LOGIN_STAGE_LONG.slogan.y + LOGIN_STAGE_LONG.slogan.h),+ ).toBeCloseTo(23.88, 2);+ });++ it('避脸不变式(2026-07-27 方案 B):短屏立绘上移 27 且可见发顶仍在 Status Bar 下沿之下', () => {+ // 上移量固定:稿值 87 → 60。像素级实测依据 = 上移后 dh ≤1450 全段 slogan ink ∩ 脸 = 0+ expect(LOGIN_STAGE_SHORT.cindy.y).toBe(60);+ // hero 资产(750×902)不透明内容起于 y=86(上方是透明留白),contain 缩放 720/902+ const heroScale = LOGIN_STAGE_SHORT.cindy.h / 902;+ const visibleHairTop = LOGIN_STAGE_SHORT.cindy.y + 86 * heroScale;+ expect(visibleHairTop).toBeCloseTo(128.65, 2);+ // Status Bar 高 115.67(见 LOGIN_DELETION_BUBBLE 注释的同一权威值):发顶不侵入状态栏+ expect(visibleHairTop).toBeGreaterThan(115.67);+ // 长屏档立绘不跟着动(新稿实测值)+ expect(LOGIN_STAGE_LONG.cindy.y).toBe(106);});});@@ -170,7 +214,11 @@ describe('loginSkin §3.6 平板/横竖屏 surface 构图(PR4b Step 5b.3;adaptatexpect(s.offsetX).toBeCloseTo(0, 6);expect(s.offsetY).toBeCloseTo(0, 6);expect(s.loginGroupScale).toBeCloseTo(0.794117, 6);+ // pad 帧未参与本轮视觉改版(新稿没有 pad frame):品牌簇与登录组几何、splash 偏移+ // 全部保持 main 原值。expect(s.splashOffset).toBe(158);+ // 组底(含协议行溢出 62)落 1114.94,在 stage 1133 内 → 消费端安全区抬升不被触发+ expect(s.loginY + 622 * s.loginGroupScale).toBeCloseTo(1114.94, 2);expect(s.phone).toBeNull();// 更矮视口按高度等比缩(w 定 744,h=1000<1133 → scale=min(1,0.8826)=0.8826)const tall = resolveLoginSurface(744, 1000);@@ -185,6 +233,8 @@ describe('loginSkin §3.6 平板/横竖屏 surface 构图(PR4b Step 5b.3;adaptatexpect(base.scale).toBeCloseTo(1, 10);expect(base.loginGroupScale).toBeCloseTo(0.655357, 6);expect(base.splashOffset).toBe(0);+ // 横屏组底(含协议行溢出)仍在 stage 820 内 → 几何原值不动+ expect(base.loginY + 622 * base.loginGroupScale).toBeLessThan(820);expect(base.phone).toBeNull();// raw<0.85 → 钳到 0.85 下限(§3.6 条3 仅下限;w≥1000∧h≥690∧landscape 命中 pad-landscape 但 raw<0.85)const floor = resolveLoginSurface(1100, 690); // min(1100/1180,690/820)=min(0.9322,0.8415)=0.8415@@ -321,3 +371,4 @@ describe('loginSkin 注销提示气泡浮层布局(figma 678:1075;**stage 设计expect(frame.top).toBeCloseTo(57.7, 6);});});+diff --git a/apps/mobile/src/auth/loginSkinLayout.ts b/apps/mobile/src/auth/loginSkinLayout.tsindex 958112e4af..188df8d372 100644--- a/apps/mobile/src/auth/loginSkinLayout.ts+++ b/apps/mobile/src/auth/loginSkinLayout.ts@@ -48,29 +48,55 @@ export const LOGIN_STAGE_MIN_DESIGN_HEIGHT = 600;export const LOGIN_STAGE_MAX_DESIGN_HEIGHT = 1800;/**- * 短屏档(designHeight=1334;inner 几何 347:2884 实测,wave3.5 旧表)。- * 2026-07-24 用户拍板:协议行距屏幕底过近,视觉+功能区整体上移 40 设计px(hero 不动)——- * slogan.y 480.33→440.33、word.y 594.48→554.48、loginY 734→694。+ * 短屏档(designHeight=1334)。+ *+ * 品牌簇(cindy 立绘 / slogan / 字标)换**登录改版新稿 figma 705:915+ * 「Log in_iPhone_750x1334」逐字段实测值**(2026-07-28 视觉改版):+ * - cindy(立绘)599×720 @(75,60);+ * - slogan 取容器内 Vector 可见图形框:容器 @(385,387) + vector(77.55,21.37)+ * → (462.55, 408.37);尺寸 254.01×72.8 稿内未变;+ * - word 取字标图像框:主容器 @(35,422) + WORD_MARK 容器内字标 @(173,65)+ * → (208,487),335×115(旧 352.93×120.54)。+ *+ * ⚠ 立绘 y 60 是「避脸方案 B」(2026-07-27 用户审 demo 拍板):本档 slogan 没有下移+ * 余量(底 481.17 距字标顶 487 仅 5.83 设计px,再移即压字标),故改为把立绘整体上移。+ * 像素级实测(hero 资产脸部 skin 连通域 x402..552 / y315..475,slogan 资产 ink 5244px,+ * 双方按各自 contain 折算到 stage 后求交):改前 dh=1334 slogan ink ∩ 脸 = 91px+ * (= 用户看到的压脸),改后 dh ≤1450 全段 = 0;顶部不裁切(可见发顶+ * = 60 + 86×0.79823 = 128.6,仍在 Status Bar 下沿 115.67 之下 12.9 设计px)。+ *+ * **loginY(功能区落位)保持 694 不动** —— 它由「功能区 680×560 + 协议行溢出 + 底距」+ * 锚定底部推出(2026-07-24 拍板整体上移 40 设计px 的结果),与面板几何同源;本轮只换+ * 品牌簇视觉,功能区几何不动。*/export const LOGIN_STAGE_SHORT = {designHeight: 1334,- cindy: { x: 75, y: 107, w: 599, h: 720 },- slogan: { x: 462.55, y: 440.33, w: 254.01, h: 72.8 },- word: { x: 199, y: 554.48, w: 352.93, h: 120.54 },+ cindy: { x: 75, y: 60, w: 599, h: 720 },+ slogan: { x: 462.55, y: 408.37, w: 254.01, h: 72.8 },+ word: { x: 208, y: 487, w: 335, h: 115 },loginY: 694,} as const;/**- * 长屏档(designHeight=1624;358:434 实测)。立绘 y=116 双区统一- * (〔已拍板 2026-07-19〕国区 116 vs 国际区旧帧 96 为设计稿内部不一致,取最新批次帧)。- * 2026-07-24 用户拍板:协议行距屏幕底过近,视觉+功能区整体上移 40 设计px(hero 不动)——- * slogan.y 686→646、word.y 814→774、loginY 973→933。+ * 长屏档(designHeight=1624)。+ *+ * 品牌簇换**新稿 figma 705:799「Log in_iPhone_750x1624」逐字段实测值**(2026-07-28):+ * - cindy 750×902 @(0,106)(立绘 y 双区统一口径沿用〔已拍板 2026-07-19〕取最新批次帧);+ * - slogan 可见图形框 = 容器 @(362.57,545.32) + vector(82.33,22.68) → (444.9,568),+ * 269.66×77.29(= 旧 321×92 的 0.84x,与新稿 slogan 容器同比例);+ * - word 字标图像框 = 主容器 @(35,627) + 字标 @(147,42.17) → (182,669.17),387×132.18。+ *+ * ⚠ slogan 下移避脸(2026-07-27 用户审 demo 拍板,距字标 24px):新稿实测 slogan inner+ * y=536.68 时顶边落在立绘下巴线(390×844 帧下巴 ≈ stage y 540.7),文字压脸;故 inner y+ * 536.68 → 568(下移 31.32,容器同量平移),slogan 底 645.29 距字标框顶 669.17 留 23.88。+ *+ * **loginY(功能区落位)保持 933 不动**(理由同 LOGIN_STAGE_SHORT:功能区几何本轮不动)。*/export const LOGIN_STAGE_LONG = {designHeight: 1624,- cindy: { x: 0, y: 116, w: 750, h: 902 },- slogan: { x: 387, y: 646, w: 321, h: 92 },- word: { x: 175, y: 774, w: 401, h: 137 },+ cindy: { x: 0, y: 106, w: 750, h: 902 },+ slogan: { x: 444.9, y: 568, w: 269.66, h: 77.29 },+ word: { x: 182, y: 669.17, w: 387, h: 132.18 },loginY: 933,} as const;diff --git a/docs/design-previews/deletion-banner-repro/extract.mjs b/docs/design-previews/deletion-banner-repro/extract.mjsindex 9ca981924f..62b9da9ea9 100644--- a/docs/design-previews/deletion-banner-repro/extract.mjs+++ b/docs/design-previews/deletion-banner-repro/extract.mjs@@ -28,7 +28,7 @@// 横幅 tailwind 类 → px 的解析在提取器内完成(spacing 1 单位 = 4px 为框架事实),// locator 记录源 class 串,可复核。-import { execFileSync } from 'node:child_process';+import { spawnSync } from 'node:child_process';import { createHash } from 'node:crypto';import { mkdirSync, rmSync, writeFileSync } from 'node:fs';import { dirname, join, resolve } from 'node:path';@@ -59,13 +59,52 @@ function leaf(value, srcRelRepo, locator) {},};}-/** 从 pinned commit 读源码文本(git show;不读工作区)。 */+/**+ * 启动前置断言:pinned commit 必须在本地 git 对象库里。+ *+ * 本 demo 的每一条真值都来自 `git show ${PINNED_SHA}:<path>`,**完全不读工作区**。+ * 因此唯一的真实失败模式不是"产品侧删了某个资产",而是"本地拿不到这个历史 commit"+ * (shallow clone / 未 fetch)。这里一次性给出可操作错误,而不是让后面每个文件各自+ * 抛 git 的裸错(2026-07-28 review 加固:把失败原因说清,消除误诊空间)。+ */+function assertPinnedCommitAvailable() {+ const probe = spawnSync('git', ['cat-file', '-e', `${PINNED_SHA}^{commit}`], {+ cwd: repoRoot,+ encoding: 'utf8',+ });+ if (probe.error || probe.status !== 0) {+ throw new Error(+ `pinned commit ${PINNED_SHA} 不在本地 git 对象库里。本 demo 的真值全部来自该历史 ` ++ `commit(git show ${PINNED_SHA}:<path>),不读工作区;shallow clone 请先跑 ` ++ `\`git fetch --unshallow\`(或 \`git fetch origin ${PINNED_SHA}\`)后重跑。` ++ (probe.error ? ` 底层错误:${probe.error.message}` : ''),+ );+ }+}++/**+ * 从 pinned commit 读源码文本(git show;不读工作区)。+ *+ * 失败时给出显式诊断(2026-07-28 review 加固):`git show <sha>:<path>` 的裸错很容易被+ * 误读成"产品仓里这个文件被删了所以提取器会挂"。事实相反 —— 只要该路径在 pinned commit+ * 里存在,提取器就恒定成功;**工作区 / HEAD 里这个文件还在不在,与本 demo 无关**+ * (例如 login 改版删掉了 guest 图标资产,pinned 基线里那两个 svg 仍然读得到)。+ */function readSrc(p) {- return execFileSync('git', ['show', `${PINNED_SHA}:${p}`], {+ const shown = spawnSync('git', ['show', `${PINNED_SHA}:${p}`], {cwd: repoRoot,encoding: 'utf8',maxBuffer: 32 * 1024 * 1024,});+ if (shown.error || shown.status !== 0 || typeof shown.stdout !== 'string') {+ throw new Error(+ `读不到 pinned 源文件 ${PINNED_SHA}:${p}。该路径必须在 pinned commit 里存在;` ++ `工作区 / HEAD 是否仍有此文件与本 demo 无关(本提取器只读 git 历史)。` ++ `若确因基线迁移导致路径变更,请同步 PINNED_SHA 与路径常量并重新复核 truth。` ++ `底层输出:${(shown.stderr || shown.error?.message || `exit ${shown.status}`).toString().trim()}`,+ );+ }+ return shown.stdout;}/** 把本轮读到的全部 pinned 源文件落盘到 _pinned/(先清空再写,保证目录与提取严格一致)。* 本地缓存副作用说明(lead 裁决 A,2026-07-26):内容由 PINNED_SHA 经 git show 确定性再生,@@ -123,6 +162,9 @@ function extractThemeColorPair(src, key) {return { light: hits[0], dark: hits[1] };}+// 任何提取之前先确认 pinned commit 可达(见 assertPinnedCommitAvailable 注)。+assertPinnedCommitAvailable();+/* ══ desk ══ */const P = {tokens: 'apps/desktop/src/renderer/components/login/loginDesignTokens.ts',diff --git a/docs/design-previews/login-flow-hifi/extract.mjs b/docs/design-previews/login-flow-hifi/extract.mjsindex 4f9d69b68f..6b45b8b154 100644--- a/docs/design-previews/login-flow-hifi/extract.mjs+++ b/docs/design-previews/login-flow-hifi/extract.mjs@@ -42,15 +42,22 @@ const SCALE_TS = 'apps/desktop/src/renderer/components/login/loginScale.ts';const METHOD_TS = 'apps/desktop/src/shared/loginIdentifierMethod.ts';let tokens, scaleMod, methodMod;try {- for (const [src, out] of [+ for (const [src, out, transform] of [[TOKENS_TS, 'tokens.mjs'],- [SCALE_TS, 'scale.mjs'],+ // loginScale.ts 自 2026-07-27 改版起 import LOGIN_GROUP(组高单一来源):+ // 临时目录里文件名被扁平化,把相对 import 重定向到同批编译的 tokens.mjs+ [+ SCALE_TS,+ 'scale.mjs',+ (code) => code.replace(/from\s*['"]\.\/loginDesignTokens['"]/g, "from './tokens.mjs'"),+ ],[METHOD_TS, 'method.mjs'],]) {- const code = esbuild.transformSync(readFileSync(R(src), 'utf8'), {+ let code = esbuild.transformSync(readFileSync(R(src), 'utf8'), {loader: 'ts',format: 'esm',}).code;+ if (transform) code = transform(code);writeFileSync(join(tmp, out), code);}tokens = await import(pathToFileURL(join(tmp, 'tokens.mjs')).href);@@ -255,7 +262,8 @@ const icons = {google: { light: svgAsset('google'), dark: svgAsset('google') },wechat: { light: svgAsset('wechat'), dark: svgAsset('wechat') },sso: { light: svgAsset('sso'), dark: svgAsset('sso-dark') },- guest: { light: svgAsset('guest'), dark: svgAsset('guest-dark') },+ // guest 圆钮入口已退役(游客入口改为文本链接),对应 icons/guest{,-dark}.svg 已从产品删除,+ // 故此处不再提取 guest 叶子。本 demo 的 index.html 仍按其内嵌 truth 快照渲染历史 UI。paths: {backChevron: backChevronD,consentCheck: pathsOf('ConsentCheckGlyph')[0],diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 6b5bb2d25d..b341ffa4bf 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -836,19 +836,40 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the| 常量 | 值 | 引用 ||---|---|---|-| 面板 | 680×440,r36,`#FBFBFB` + inset 1px `--login-panel-border` | figma §4 / §5.1 |+| 登录整体组 | 680×**620**(面板 500 + gap 40 + 圆钮行 80)——2026-07-27 面板增高改版,原 560 作废 | figma §5.1(新稿 `700:783`) |+| 面板 | 680×**500**,r36,`#FBFBFB` + inset 1px `--login-panel-border` —— 2026-07-27 改版,原 440 作废;增的 60 = 面板内新增的「跳过登录」槽,**面板内其余元素 y 坐标一律不动**。面板高度对登录全步骤恒定(步骤间不得跳变);**Splash 借用同款面板时保持 440**(无该入口,见 §16.3 `LoginPanel`) | figma §4 / §5.1(新稿 `700:791` / `705:886` / `705:1062`) || 输入框 / 主按钮 | 540×80,r40,@(70, 158 / 300) | figma §4.1 / §4.3 || 方式行 | 540×100,r60,@(70, 158 / 278),左图标 24@(27,37),右图标 @(490,40) | figma §4.9 || 返回钮 | 60×60,r40,@(20,20) | figma §4.6 || 重发 / Text_link 槽 | 540×50,20px,@(70,238) | figma §4.7 |-| 错误文本 | 680×50,20px,@(0,380),`--login-error-fg` | figma §4.8 |-| 第三方圆钮行 | y=480,80×80,r50,icon 48,gap 70 | figma §4.5 |+| 错误文本 | 680×50,20px,@(0,380),`--login-error-fg` —— 槽顶不随面板增高移动;槽底 430 与下方「跳过登录」槽**首尾相接(间距 0)**,两者同时可见互不重叠(文案视觉间距 ≈30) | figma §4.8(新稿 `705:1067`) |+| 「跳过登录」文字按钮槽 | 680×60,@(0,430)(槽底 490,距面板底 10 = 新稿下内边距);文字 24px Regular + 下划线、`--login-secondary-text`,相对 680 水平居中、槽内垂直居中。**680×60 只是布局容器、本身不可点**,命中区 = 当前语言实际文字渲染宽度 + 左右各扩(桌面 30 / 移动 50 设计px)、高度占满 60 槽 —— 详见 §16.3「登录文字按钮」 | figma 新稿 `705:1068`(文本 `705:1069`)/ `700:910` + 2026-07-27 拍板 |+| 第三方圆钮行 | y=**540**(面板底 500 + gap 40;2026-07-27 随面板增高由 480 顺移 60),80×80,r50,icon 48,gap 70。**行内不再有游客圆钮**(CN = Apple + SSO 两颗 / Global = Apple + Google + SSO 三颗,`count` 按 provider 动态) | figma §4.5(新稿 `700:796` / `705:1070`) |+| 协议同意行 | 680×40,@(0,**642**)(= 组底 620 下方 22;2026-07-27 随面板增高由 582 顺移 60,行底 682 溢出组底 62) | figma 新稿 `700:807` / `705:1075` || 标题 / 副标题 | 标题 y=31 h=38 32 Bold;副标题 x=70 y=75 w=540 20 Regular ≤2 行顶对齐(2026-07-24 拍板:宽度对齐控件列,原 figma 单行几何 599@41 作废) | figma §5.1 + 2026-07-24 拍板 |桌面 `loginDesignTokens.ts`(1819×2098 画布)、手机 `loginSkinLayout.ts`(750 设计 px,键名用 `font` / `radius` 避开 typography 守护扫描)。两端面板内坐标同源同值,手机由外层统一 `transform` 缩放。**平台差异**:桌面 = Web renderer(Electron,Win / Mac 同套);手机 = React Native(iOS / Android,含 phone / pad-portrait / pad-landscape)。两端同参数源、同 token 语义(手机 `loginColors` 与桌面 `LOGIN_COLORS` 同名同值),仅实现宿主不同(RN 用 `StyleSheet` + `Animated`,桌面用 CSS + Tailwind)。+**移动端 stage 几何(2026-07-27 换品牌簇基准;2026-07-28 勘误后仅品牌簇生效)**:手机的**品牌簇**(立绘 / SLOGAN / 字标)按新稿逐字段更新,**功能区落位 `loginY` 与面板派生几何保持 main 原值不动**(手机端跳过登录已于 2026-07-28 整体剥离,面板仍 440、组仍 560,见本节末勘误)。短屏 / 长屏两档之间仍走既有线性插值体系(`loginSkinLayout.resolveLoginStage`),**不另造缩放规则**。下表为设计单位(750 设计px 基准),消费时一律 × `surface.scale`(设计单位 ≠ 物理 pt,见 §16.4「几何」条):++| 档 | 立绘 | SLOGAN(可见图形框) | 字标(图像框) | 登录组顶 `loginY` | 溯源 |+|---|---|---|---|---|---|+| 短屏 `designHeight=1334` | 599×720 @(75,**60**) | 254.01×72.8 @(462.55,408.37) | 335×115 @(208,487) | **694**(组高 560 + 协议行溢出 62 → 组底 622,距屏底 18;= main 原值,本轮不动。~~新稿 622~~ 随跳过登录剥离作废) | 品牌簇 = 新稿 `705:915` + 避脸拍板;`loginY` = 2026-07-24 拍板 |+| 长屏 `designHeight=1624` | 750×902 @(0,106) | 269.66×77.29 @(444.9,**568**) | 387×132.18 @(182,669.17) | **933**(组底 1555,距屏底 69;= main 原值,本轮不动。~~新稿 827~~ 同上作废) | 品牌簇 = 新稿 `705:799` + 避脸拍板;`loginY` = 2026-07-24 拍板 |++- **SLOGAN 避脸(2026-07-27 用户审 demo 两次拍板)**:新稿原值下 SLOGAN 压在立绘脸上(像素级实测:立绘脸部 skin 连通域 x402..552 / y315..475,SLOGAN 资产 ink 5244px,双方按各自 `contain` 折算到 stage 求交 —— 长屏原值 `y=536.68` 时 ink ∩ 脸 = 290px、短屏 = 91px、中段 dh≈1400 最高 113px)。两档分别处理:+ - **长屏**:SLOGAN 下移 31.32(inner `y` 536.68 → **568**,容器 y 514 → 545.32;x / 宽高不动),底 645.29 距字标框顶 669.17 留 **23.88 ≈ 24 设计px** —— 24px 是这一档的**硬上限**,再下移即撞字标。+ - **短屏**:SLOGAN 在本档没有下移余量(底 481.17 距字标顶 487 仅 5.83),改为**立绘整体上移 27**(`y` 87 → **60**)。改后 dh ≤1450 全段 ink ∩ 脸 = **0**;dh 1500..1624 残留 3..9px(仅下巴尖,由长屏档自身落位 + 上面那条 24px 上限共同决定)。+ - **边界核对**:立绘资产不透明内容起于 y=86(上方为透明留白),短屏 `contain` 缩放 720/902 → 可见发顶 = 60 + 86×0.79823 = **128.65**,仍在 Status Bar 下沿(115.67)之下 12.98,**不侵入状态栏、无顶部裁切**;底部可见内容止于资产 y=696 且是淡出渐隐(alpha 69→21),上移后尾部由「藏在面板下 20.6」变成「露出面板上 6.4」——长屏本来就露 25,同款观感,无硬切边。++- **短屏以下(dh<1334)**:视觉区(立绘 / slogan / 字标)继续按 `v=max(0.25,(dh-600)/734)` 以 (375,0) 为锚连续压缩;功能区 680×**560** 不缩放、锚定底部,锚常量 **`dh-640`**(= 组底 622 + 底距 18),在 dh=1334 处与短屏档 `loginY=694` 连续 —— **均为 main 原值**。〔~~随面板 440→500 改为 `dh-712`~~ 已于 2026-07-28 作废,见本节末勘误〕+- **2026-07-24「视觉 + 功能区整体上移 40 设计px」拍板对功能区仍然有效**(`loginY` 694 / 933 / `dh-640` 就是它的结果)〔~~由本次新稿取代~~ 2026-07-28 更正:跳过登录剥离后功能区回 main,该拍板未被取代;本轮只有品牌簇换成新稿基准〕。+- **~~pad 竖屏(stage 744×1133)为推导值,无 figma 源~~〔整段已作废 2026-07-28:面板不再增高,pad 竖屏几何与 `splashOffset` 全部保持 main 原值(`loginY` 621 / `splashOffset` 158),无需上移、无推导值〕**:新稿没有 pad 帧。面板增高后组底会从 1114.94 推到 1162.59 > stage 1133、触发安全区抬升压住字标,故把品牌簇与登录组**一起上移 60 × 0.794117 = 47.647 设计px**(`loginY` 621→573.353,立绘 / slogan / 字标同量上移;`splashOffset` 158→206 保持 splash 期簇位不变),三条不变量 = ① 组底仍落 1114.94、② 字标框底↔面板顶间距仍 14.84、③ splash 期簇位不变。**该值为推导,非设计源;用户 2026-07-27 接受推导,竖屏几何待设计侧回看确认**。pad 横屏(1180×820)组底 774.95 仍在 stage 内,几何原值不动。++**~~键盘停靠锚 = error 槽底(2026-07-27 拍板,移动端)~~〔已作废 2026-07-28:手机端跳过登录整体剥离,停靠锚仍为面板底,见本节末勘误〕**:停靠贴附锚由**面板底**改为**面板内 y=430(error 槽底)**——面板 440→500 后若继续用面板底,每次停靠会比改版前多顶 60 设计px(短屏更容易触发 clamped-fallback、把品牌层与标题挤掉)。**取舍**:键盘弹起时「跳过登录」槽(430..490)允许被遮挡——它不是输入链路的必需元素,收起键盘即可见;停靠引擎本身(10px 贴附 + safe-top 上限 + clamped-fallback 兜底)与悬浮相交判定锚(输入框 ∪ 主按钮)均不变。+**交互态**:hover(仅桌面)/ pressed(双端)/ disabled / loading 五态。态叠层挂伪元素(桌面 `::after`)/ overlay View(手机),**不动图标 / 文本子节点**;disabled 叠层走 `--login-disabled-button-overlay` token。hover / pressed 叠层**暗色落地前**为 figma 实测 rgba 字面值(亮色 as-built 现状);**暗色 PR 起 token 化为 `--login-overlay-*` 二态 token**(叠层方向随模式反转,见 §16.5),此后组件内禁止新增字面 rgba 叠层。态系细则见设计阶段工作文件 `DESIGN-login §2`(不入仓库)。**常驻动画 compositor-only**:spinner / loading 环动画挂 HTML(桌面)/ `Animated.View`(手机)外层 wrapper,SVG 图形保持静态(呼应 §14.4);`prefers-reduced-motion` 直落静止。面板入场 handoff 动画是 §14.4 容器形变的窄变体(双端冻结 420ms 升起 + 渐显,`LOGIN_HANDOFF_TIMINGS.panelMs` / `panelInMs`)。@@ -859,7 +880,7 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the**多语言长文本与翻译长度预算(2026-07-24 拍板)**:-- **原则:登录链路里截断与省略号不可作为可见结果**。登录面板是 680×440 冻结几何、槽位不撑高,长文案没有退路——所以约束加在**文案侧**:所有 `login.*` 文案(含 agent 代写 / 补翻的四语文本)必须言简意赅、按槽位长度预算写作。线上出现可见省略号 = 该语言文案超预算 = **文案 bug(P1,修文案,不改布局)**。+- **原则:登录链路里截断与省略号不可作为可见结果**。登录面板是 680×500 冻结几何(2026-07-27 改版后值)、槽位不撑高,长文案没有退路——所以约束加在**文案侧**:所有 `login.*` 文案(含 agent 代写 / 补翻的四语文本)必须言简意赅、按槽位长度预算写作。线上出现可见省略号 = 该语言文案超预算 = **文案 bug(P1,修文案,不改布局)**。- **长度预算自检**(写 / 翻文案时逐语言过一遍):估宽公式——汉字 / 假名 / 谚文 ≈ 1×字号 px,拉丁字母 / 数字 / 空格 ≈ 0.5×字号 px;估宽 ≤ 槽宽 × 0.95 才算过。常用槽预算:| 槽 | 宽×字号 | ≈汉字上限 | ≈拉丁字符上限 |@@ -867,6 +888,7 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the| 标题 | 680 @32 Bold(徽标变体为 inline 组:标题 shrink-to-fit + 2px 间隔 + 区域徽标,徽标宽随文案自适应,按现役最宽的 `Dev`(实测 51.7,非本表估宽公式的 46——公式是文案自检用的保守估算,徽标宽度以实测为准)算可用宽 680−54=626;v3 2026-07-27,原「固定 70px 徽标」几何随 Global 徽标撤除一并作废) | 20(徽标变体 18) | 40(徽标变体 37) || 副标题(≤2 行,2026-07-24 拍板) | 540 @20 × 2 行 | 50 | 102 || Text_link / hint / 倒计时 | 540 @20 | 25 | 51 |+ | 「跳过登录」文字按钮(2026-07-27) | 620 @24(= 槽 680 − 双侧 30 命中区扩张;移动端命中区扩 50 时可用宽 580) | 24(移动 22) | 49(移动 45) || 主按钮 CTA | 448 @24 Bold(540 − 双侧 46 padding) | 17 | 35 || 方式行标题 / 副题 | 409 @24 / @20 | 16 / 19 | 32 / 38 |@@ -882,22 +904,38 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the| 组件 | 端 | 用途 | 关键 props | token / 几何 ||---|---|---|---|---|-| `LoginPanel` | 双 | 白面板容器 | `children`, `testId` | 680×440 r36 `--login-panel-bg` + inset 1px border;桌面由 `LoginStage` 承载缩放 |-| `LoginStage` | 桌面 | 1819×2098 画布「面板宿主」层,等比缩放 + z 序 | `children`, `ssoOrgGroupY`, `groupStyle` | 登录组 @(570, 1229 / 1227) 680×560;品牌层在 `LoginBrandStage` |+| `LoginPanel` | 双 | 白面板容器 | `children`, `testId`, `height?`(**桌面,仅 Splash 使用**) | 680×**500** r36 `--login-panel-bg` + inset 1px border;桌面由 `LoginStage` 承载缩放。`height` 默认 = 面板 500 且登录侧一律用默认值;**Splash 五帧传 440**(无「跳过登录」入口、设计稿未改版,跟随 500 会在启动态凭空多出 50 CSS px 空白;两者不同 stage、不同缩放,拆开不破坏 handoff 连续性) |+| `LoginStage` | 桌面 | 1819×2098 画布「面板宿主」层,等比缩放 + z 序 | `children`, `ssoOrgGroupY`, `groupStyle` | 登录组 @(570, 1229 / 1227) 680×**620**;品牌层在 `LoginBrandStage` || `LoginTitleBlock` | 双 | 标题 + 副标题 | `title`, `subtitle`, `regionPill?`(桌面) | 标题 y=31 h=38 32 Bold `--login-title-text`;副标题 @(70,75) 540 宽 ≤2 行顶对齐 20 Regular `--login-secondary-text`(2026-07-24 拍板,原 599×23 单行作废)。区域徽标见下方专条 || `LoginInput` / `LoginSkinInput` | 桌 / 手 | 通用输入框 | `value`, `onChange`, `placeholder`, `center?`, `error?`, `prefix?` | @(70,158) 540×80 r40 `--login-control-bg`;边 placeholder→active;`center`=验证码居中变体 || `LoginSkinPhoneInput` | 手机 | 手机号 + 固定国家码前缀 | `prefix`, … | 同 `LoginSkinInput` 几何,前缀不可点 || `LoginPrimaryButton` | 双 | 主按钮(五态) | `label / children`, `onClick / onPress`, `disabled`, `loading / busy` | @(70,300) 540×80 r40 `--login-primary-button-bg / -border / -text`;disabled 白 70% 叠层 + 边 `--login-control-border-disabled` + 文字 opacity 0.8;loading spinner 24@(487,27) |-| `LoginSocialRow` | 双 | 第三方圆钮行 | `children`, `count` | y=480 行内水平居中,80×80 gap 70 |+| `LoginSocialRow` | 双 | 第三方圆钮行 | `children`, `count` | y=**540** 行内水平居中,80×80 gap 70;`count` 随 provider 动态(**不含游客圆钮**,2026-07-27 起该入口改为面板内文字按钮) || `LoginSocialButton` | 双 | 第三方 / SSO 圆钮 | `label`, `onClick`, `children`, `isLoading / busy` | 80×80 r50 `--login-primary-button-bg / -border`;icon 48 居中;仅 normal + hover(桌面)+ pressed,**无 disabled / loading 视觉态** || `LoginSocialGlyph` | 手机 | 社交图标矢量(Apple / Google / WeChat / SSO;**apple 分支仅非 iOS 场景**——iOS 走官方按钮不进圆钮行,见 §16.2) | 内部 | Google / WeChat 品牌色不变;Apple / SSO 单色随圆钮底反相(暗色白圆上 `#2A2828`) || `LoginBackButton` | 双 | 返回 | `label`, `onClick`, `disabled` | @(20,20) 60×60 r40 `--login-action-control-bg` / `--login-back-border`;chevron 24 |-| `LoginTextLink`(桌)/ `LoginTextLinkSlot`(手) | 桌 / 手 | 重发链接 / 提示文案 | `variant`(link / countdown,桌), `tone`, `children` | @(70,238) 540×50 20;link 变体 `--login-link-text` 下划线可点;countdown / slot `--login-control-placeholder` 不可点 |+| `LoginTextLink`(桌)/ `LoginTextLinkSlot`(手) | 桌 / 手 | 重发链接 / 提示文案(**文字链接**,不承载「跳过登录」) | `variant`(link / countdown,桌), `tone`, `children` | @(70,238) 540×50 20;link 变体 `--login-link-text` 下划线可点、hover / pressed 变色;countdown / slot `--login-control-placeholder` 不可点 |+| `LoginSkipEntry`(桌)/ `LoginSkipLoginLink`(手) | 桌 / 手 | 「跳过登录」入口(**文字按钮**,与上一行的文字链接是两种组件) | 桌:`children`, `onClick`, `disabled`, `testId`;手:`label`, `onPress`, `testID` | 槽 @(0,430) 680×60,文字 24 Regular + 下划线、`--login-secondary-text`(双模同值),**hover / pressed 不变色**;命中区 = 文字实宽 + 左右各扩(桌 30 / 手 50 设计px)、高占满 60 槽,容器不可点 —— 逐条口径见下方「登录文字按钮」 || `LoginResendCountdown` | 手机 | 验证码重发(倒计时 / 重发二态) | `deadline`, `countdownTemplate`, `resendLabel`, `onResend` | @(70,238);`deadline=null` → 常驻可点无倒计时(SSO 验证码屏用) || `LoginMethodRow` | 双 | 方式选择行(企业 / 个人) | `top`, `title`, `subtitle`, `icon`(enterprise / person), `onClick` | 540×100 r60 `--login-action-control-bg` / `--login-control-border`;左图标 24@(27,37) / person 18×20@(30,39);右 share 18@(490,40);文字 @(67) 垂直居中 || `LoginErrorText` | 双 | 错误提示 | `children` | @(0,380) 680×50 20 `--login-error-fg` || `LoginLoadingRing` | 双 | 大 loading 环(浏览器 / 准备态) | `y`, `label` | 64×64 @(308, 158 / 193);轨道 `--login-loading-ring-track`,内弧 `--login-primary-button-bg`(Splash 转圈环 64×64@(308,188) 同轨道 token,内弧为 `--login-secondary-text`) |+**登录文字按钮(新组件类别,2026-07-27 拍板)**:登录域现在有**两种**纯文字操作组件,语义与视觉都不通用,**不得互相复用**:++| | **文字链接**(`LoginTextLink` / `LoginTextLinkSlot`) | **文字按钮**(`LoginSkipEntry` / `LoginSkipLoginLink`) |+|---|---|---|+| 语义 | 链接:跳转 / 重试 / 次要说明(重发验证码、sso-org 帮助行) | 按钮:触发一次产品级动作(跳过登录 → 进入本地模式) |+| 色 | `--login-link-text` 族(light `#2A2828` / dark `#EEEEEE`) | `--login-secondary-text`(`#6F6F6F`,**light / dark 同值**,零新增 token) |+| hover / pressed | 变色(`--login-link-hover` / `-pressed`) | **不变色**——只靠下划线常显 + 指针形状(桌面 `cursor:pointer`)给反馈 |+| 字号 / 槽 | 20,槽 540×50 @(70,238) | 24,槽 680×60 @(0,430) |+| 命中区 | 槽内整块 | **文字实宽 + 左右各扩**(桌面 30 / 移动 50 设计px),高度占满 60 槽;680×60 容器只做居中定位、自身不可点(桌面 `pointer-events:none` + 内层 button `auto`;移动 `pointerEvents="box-none"` + 内层 `Pressable`) |++- **为什么命中区随语言自适应**:文字实际渲染宽度按语言不同(zh「跳过登录」96 设计px vs en `Skip Sign-In` 更宽),固定宽热区会在某些语言下偏窄或越界;扩张量固定、宽度 shrink-to-fit,热区随语言同步。+- **为什么放大 bounds 而不是用 hitSlop**:RN 的 `hitSlop` 不越父 View 边界(Android 界外触摸不派发),与协议 radio 同一套仓内约定(§16.4 hitSlop clamp 契约)。移动端命中区高度占满 60 槽(phone ~0.5 缩放 ≈30pt,与返回钮 60 设计px 同档),向上不侵入主按钮下沿、向下不越面板底。+- **防御性截断**:内层按钮 `maxWidth = 680` + `nowrap` + `ellipsis`(移动 `numberOfLines={1}`)仅为防极端 locale 把两侧撑出面板 `overflow:hidden` 被静默裁掉,**不是设计许可**——线上出现可见省略号 = 该语言文案超预算 = 文案 bug(P1,改文案不改布局,见 §16.2 长度预算表「跳过登录」行)。+- **focus ring**:当前与登录域其它按钮一致(未单独实现 focus 可见环),随登录域 focus 态统一处理时一并补。+**区域徽标(`LoginTitleBlock` 的 `regionPill`,桌面;figma §4.10 胶囊 h30 r40,2026-07-27 改判)**:标题右侧品牌红胶囊,`--login-brand-accent` 底 + `--login-inverted-button-border` 白字 16 Bold,inline 组内 gap 2、垂直居中于 38 行框。- **挂哪些区域**:`cn` → `CN`;`dev` → `Dev`;**`global` 不挂**。这是产品叙事的硬规则而非视觉遗漏——Cindy 是「天生全球」的产品,默认版本不给自己贴标签自证是全球版,只有为特定法规单独构建的版本才被标注(不对称命名)。旧实现给 global 挂 `Global` 徽标,读出来反而是「存在一个本土主场版、这是它的出口型号」,与叙事相反。**给 global 恢复徽标即回退该决策,不得回退。**@@ -906,7 +944,7 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the- **文案不翻译**:四语同文的区域代号(承袭旧 `login.globalRegion` 的做法),但仍走 i18n(`login.regionPill.*`),以便日后改判为「中国大陆版」这类可译文案时不必回改组件。- **手机端无此变体**:`apps/mobile` 的 `LoginTitleBlock` 不接 `regionPill`(移动端未做区域徽标)。-**组件库新增(2026-07-24,目标规格,随游客登录 / 协议 UI 实现 PR 落地)**:+**组件库新增(2026-07-24 登记;协议 UI 已随 consent PR 落地,游客圆钮方案已由上述「跳过登录」文字按钮取代)**:- **协议勾选 radio**(figma `radiobutton 600:627`,四态双模式):24×24 命中区,圈 20×20 r9 + 2px 描边,选中为**对勾**(非圆点)。亮:未选 `#F1F0F1` 底 / `#434343` 边 → 选中 `#2A2828` 实底 + 白勾;暗:未选 `#2A2828` 底 / `#F1F0F1` 边 → 选中 `#F1F0F1` 底 + `#2A2828` 勾——选中反色与登录黑白反色体系同构。用于登录页 `服务条款` 协议行。- **服务条款弹窗小按钮**(figma `light_button_*` / `Dark_button_*` 四母版,`602:846/863/1297/1311`):260×80 r40 文字 Bold 24;强调钮 = 模式反色(亮强调深底 `#2A2828`、暗强调浅底 `#EEEEEE`),暗模式普通钮引入新灰 `#434141` 底 / `#565454` 边。逐态值见 `figma-component-spec §11.3`。- 既有组件扩容:`SSO 登录_企业` 与 `back` 均扩为含 Dark 三态的六态集(值已并入 §16.1 `--login-action-control-bg` / `--login-back-border` 口径),`white_button` 增 loading 五态。@@ -917,7 +955,7 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the| 屏(step) | 职责 | 关键组件 ||---|---|---|-| `identifier` | 输入手机号 / 邮箱(国区 phone / 国际区 email),含 social 圆钮行 + SSO 入口 | `LoginInput` / `LoginSkinPhoneInput` + `LoginPrimaryButton` + `LoginSocialRow` |+| `identifier` | 输入手机号 / 邮箱(国区 phone / 国际区 email),含 social 圆钮行(Apple / Google / SSO,**无游客圆钮**)+ SSO 入口 + 协议同意行;**面板内常驻「跳过登录」入口**(2026-07-27 起,**仅桌面**;手机端 2026-07-28 剥离) | `LoginInput` / `LoginSkinPhoneInput` + `LoginPrimaryButton` + `LoginSocialRow` + `LoginConsentRow` + `LoginSkipEntry` / `LoginSkipLoginLink` || `method-choice` | 命中企业域名时选企业 SSO / 个人邮箱验证码 | `LoginMethodRow`×2(top 158 / 278)+ `LoginTitleBlock`(`chooseMethod`) || `verification-code` | 输入 6 位验证码,42s 重发倒计时 | `LoginInput`(center) / `CodeInput` + `LoginTextLink` / `LoginResendCountdown` + `LoginPrimaryButton` || `sso-verification` | SSO 登录后验证企业联系方式,两子态(`codeRequested` false = 只发码 / true = 输码 + 常驻重发,**无倒计时**) | `LoginPrimaryButton`(sendCode) → `LoginInput`(center) + `LoginPrimaryButton`(completeSignIn / signIn) + `LoginTextLink` / `LoginResendCountdown`(deadline=null) |@@ -926,7 +964,18 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the| `binding` | 身份未绑 membership,补绑 phone / email(`codeRequested` 两子态;**无重发钮**,桌面 harness 锁定) | `LoginInput` / `LoginSkinPhoneInput` → `LoginInput`(center) + `LoginPrimaryButton` || `account-deletion`(状态浮层) | 账号删除**状态展示**(发起流程在 Settings 的 `AccountDeletionSection`;登录页仅在存在删除回执时以**根层浮层气泡**展示 status,非主状态机 step;详见下方「注销状态浮层气泡」) | `AccountDeletionStatusPanel`(**登录皮容器外**的根层浮层,非面板内) || `browser-redirect` | 社交 / SSO 跳浏览器验证,等待回调 | `LoginLoadingRing` + `LoginPrimaryButton`(取消)+ `LoginTitleBlock` |-| `completed` / `error` | 登录成功 / 失败(含 browser 回调终态页) | 成功无面板(进主界面);error = `LoginTitleBlock` + `LoginPrimaryButton`(重试)+ `LoginErrorText`;browser 回调页 `oauthResultPage`(系统浏览器独立 HTML,main 侧内联常量,色值与 `--login-callback-*` token 同源——renderer CSS var 不可达,改值需两处同步) |+| `completed` / `error` | 登录成功 / 失败(含 browser 回调终态页);`error` 步桌面另有面板下方 footer 的「跳过登录」**逃生入口**(登录服务不可用时仍能进本地模式,同样不过协议门) | 成功无面板(进主界面);error = `LoginTitleBlock` + `LoginPrimaryButton`(重试)+ `LoginErrorText` + footer 本地模式按钮(桌面);browser 回调页 `oauthResultPage`(系统浏览器独立 HTML,main 侧内联常量,色值与 `--login-callback-*` token 同源——renderer CSS var 不可达,改值需两处同步) |++**~~配置错误屏同样承载「跳过登录」逃生入口(移动端)~~〔已作废 2026-07-28:手机端整体剥离,配置错误屏无该入口〕**:`getMobileConfigIssues()` 命中(如 auth base URL 非法)时面板切到 config 提示态,该面板内仍渲染同一个 `LoginSkipLoginLink`(同槽 @(0,430)、同 handler、同 in-flight 门)——跳过登录不发任何网络请求,配置坏掉时恰恰最需要这个入口。++**协议门(consent gate)过门点与豁免(2026-07-27 更新)**:`identifier` 屏的协议同意行是一道**发起前拦截**——未勾选时点过门入口先弹服务条款 / 隐私协议弹窗,同意后续接原动作;同意即写入统计采集同意。++| | 入口 |+|---|---|+| **过门**(个人**账号**登录一律先同意) | 手机号提交、邮箱提交(含仅查方式的 discover)、`method-choice` 个人行发码、社交圆钮(Apple / Google / 未来微信) |+| **豁免** | ① 显式企业 SSO 入口(SSO 圆钮、组织标识提交、`method-choice` sso 行);② **「跳过登录」/ 本地模式**(面板内常驻入口 + 桌面 `error` 步 footer 逃生口)——2026-07-27 拍板 |++「跳过登录」豁免的口径:不创建账号、不上报数据,因此 **radio 未勾选也直接进主界面,且不写入统计采集同意**(没有明示同意就保持采集闸关闭)。除此之外其它个人链路的协议门与协议 UI(radio 四态、弹窗小按钮)**均不变**;企业 SSO 豁免同样不变。**注销状态浮层气泡(figma 678:1075「注销状态」组件集,2026-07-26 定形)**:账号注销状态**不在登录面板内**,而是登录屏根容器的 absolute 浮层——历史实现曾把它放在登录皮容器(`LoginStage`)的文档流首子位置,被 `absolute; top:0` 的不透明登录面板 100% 覆盖(`pending` / `processing` / `completed` 三态全中,修复前证据见 `docs/design-previews/deletion-banner-repro/`);**改回面板内即重现该缺陷,不得回退**。@@ -962,4 +1011,20 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the**主题跟随(产品逻辑)**:用户**首次**打开 Cindy → **亮色**登录界面(默认);**第二次起** → 登录界面跟随用户上一次使用的 **light / dark 模式**(登录页只认 light / dark,不随具体扩展主题,见 §16.2)。这需要持久化「上次登录模式」+ 首次默认逻辑,超出纯 token 补范围,是一段状态逻辑,在暗色实现 PR 内一并落地。-**决策记录(2026-07-23 已定)**:(1) `--login-*`「跨主题恒定 → light / dark 二态」前提变更 + 新增 `--login-overlay-*` 二态 token——**已采纳**;(2) 深色落点 = **跟随编辑器 light / dark mode** + 上述主题跟随逻辑——**已采纳**;(3) 立绘 / 社交图标深色版——已核验(立绘两模式同资产,社交深色白圆 + 品牌色图标,见 §16.1);本节原 ※推导值(splash 进度条 / 链接 hover / pressed)已经 Figma 组件库核验确认,§16.1 表已回填目标值。**(2026-07-24 增补)画布渐变定稿**:暗色帧红晕层(532:588/589)按 1:1 几何落地后,经实机走查拍板去除——两模式画布纯平(亮色撤渐变 = PR#104 拍板,两条决策相互独立、结论一致);`--login-bg-gradient-*` token 保留 override 锚、值恒 `none`,红晕如需恢复须以该走查结论为基线重新与设计确认。**(2026-07-24 增补)组件库状态扩充**:hover 统一「叠白变亮」改判(本节 (1) 已按新口径改写,旧「白底钮 hover 叠黑 5%」作废);新增协议勾选 radio 与服务条款弹窗小按钮目标规格(见 §16.3 尾注);`SSO 登录_企业` / `back` Dark 三态、`white_button` loading 五态入库(权威逐参数 = `figma-component-spec §11`)。游客登录(跳过登录)样式为独立实现任务,不在本节展开。**(2026-07-24 增补·二)多语言长文本口径**:登录链路禁止以截断 / 省略号作为可见结果,文案侧按槽位长度预算约束(含 agent 翻译硬约束),说明类文本折行 ≤2 行 + 顶对齐 + 只向下伸展——规则全文见 §16.2「多语言长文本与翻译长度预算」。同日二次拍板:**副标题改判入说明类**(禁省略号、完整展示 ≤2 行,几何 540@70 对齐控件列,原 figma 单行 599@41 作废),双端已落码(桌面 `LoginTitleBlock` + 手机 `LOGIN_SUBTITLE`)。+**决策记录(2026-07-23 已定)**:(1) `--login-*`「跨主题恒定 → light / dark 二态」前提变更 + 新增 `--login-overlay-*` 二态 token——**已采纳**;(2) 深色落点 = **跟随编辑器 light / dark mode** + 上述主题跟随逻辑——**已采纳**;(3) 立绘 / 社交图标深色版——已核验(立绘两模式同资产,社交深色白圆 + 品牌色图标,见 §16.1);本节原 ※推导值(splash 进度条 / 链接 hover / pressed)已经 Figma 组件库核验确认,§16.1 表已回填目标值。**(2026-07-24 增补)画布渐变定稿**:暗色帧红晕层(532:588/589)按 1:1 几何落地后,经实机走查拍板去除——两模式画布纯平(亮色撤渐变 = PR#104 拍板,两条决策相互独立、结论一致);`--login-bg-gradient-*` token 保留 override 锚、值恒 `none`,红晕如需恢复须以该走查结论为基线重新与设计确认。**(2026-07-24 增补)组件库状态扩充**:hover 统一「叠白变亮」改判(本节 (1) 已按新口径改写,旧「白底钮 hover 叠黑 5%」作废);新增协议勾选 radio 与服务条款弹窗小按钮目标规格(见 §16.3 尾注);`SSO 登录_企业` / `back` Dark 三态、`white_button` loading 五态入库(权威逐参数 = `figma-component-spec §11`)。~~游客登录(跳过登录)样式为独立实现任务,不在本节展开~~〔**已回收(2026-07-27)**:该规格缺口已由本次改版关闭——入口定形为面板内「跳过登录」**文字按钮**(新组件类别,规格见 §16.3「登录文字按钮」;几何见 §16.2 表),游客圆钮方案与其图标资产一并退役〕。**(2026-07-24 增补·二)多语言长文本口径**:登录链路禁止以截断 / 省略号作为可见结果,文案侧按槽位长度预算约束(含 agent 翻译硬约束),说明类文本折行 ≤2 行 + 顶对齐 + 只向下伸展——规则全文见 §16.2「多语言长文本与翻译长度预算」。同日二次拍板:**副标题改判入说明类**(禁省略号、完整展示 ≤2 行,几何 540@70 对齐控件列,原 figma 单行 599@41 作废),双端已落码(桌面 `LoginTitleBlock` + 手机 `LOGIN_SUBTITLE`)。++**决策记录(2026-07-27 登录改版,拍板人 = 用户;依据 = figma 新稿 `705:915` / `705:799` / `700:783`)**:(1) **面板 440→500、登录组 560→620**,增的 60 全部给面板内新增的「跳过登录」槽(430..490),面板内其余元素坐标不动;圆钮行 480→540、协议行 582→642 随组顺移;error 槽回到 680×50 @380 与跳过槽首尾相接。(2) **游客圆钮退役 → 面板内「跳过登录」文字按钮**(新组件类别,见 §16.3),图标资产删除;圆钮行 `count` 动态。(3) **跳过登录 / 本地模式免协议门**(推翻 2026-07-24「个人登录一律先同意、含游客」),且不写统计同意;其它入口协议门不变(见 §16.4)。(4) **手机端新增跳过入口与无账号通路**(推翻 2026-07-24「手机 / pad 必须有账号、不加游客登录」)。(5) 移动端**键盘停靠锚改为 error 槽底**,键盘态允许遮挡跳过槽(见 §16.2)。(6) 手机短屏 / 长屏几何整档换新稿基准,短屏以下锚常量 `dh-640`→`dh-712`;**pad 竖屏为推导值(无 figma 源,用户接受推导,待设计回看)**。(7) **Splash 面板不跟随 500,保持 440**(拆出独立常量)。逐条落点见 §16.2 / §16.3 / §16.4 与 `design-decision-log.md`「2026-07-27」条。++> **⚠ 勘误(2026-07-28,拍板人 = 用户):「跳过登录」仅桌面端落地,手机端整体剥离。**+> 上条 2026-07-27 决策记录的 (4)(5)(6) 与本节所有涉及**手机 / 移动 / 双端**的「跳过登录」+> 落地口径**一并作废**:手机端在 main 基线上从来没有游客 / 无账号功能,且 2026-07-24+> 产品拍板「手机 / pad 为远程连接客户端、必须有账号、不加游客登录」**仍然有效**(原判它被+> 07-27 推翻,经复核该推翻缺产品侧确认)。因此手机端本轮只保留**纯视觉改版**(品牌簇换新稿+> 基准 + 避脸方案),功能与几何回到 main 等价:**面板仍 440、登录组仍 560、圆钮行仍 480、+> 协议行仍 582、error 槽仍 680×60 @380、无「跳过登录」槽、键盘停靠锚仍是面板底、+> 无配置错误屏逃生入口、无 `LoginSkipLoginLink` 组件与 `skipLogin` 文案 key**。+> 本节表格里的 **500 / 620 / 540 / 642 / error 50 / 跳过槽 430..490 与命中区扩张 30**+> 均只对**桌面**成立;一切标注「移动 50」「双端」「手机端」的跳过登录口径读作**未落地**。+> **(6) 需拆开读**:手机短屏 / 长屏的**品牌簇**(立绘 / SLOGAN / 字标)新稿基准与避脸落值**保留生效**(本轮唯一落地的手机改动);同条里的**功能区落位**(`loginY` 622 / 827、锚常量 `dh-712`)与 **pad 竖屏推导值**(`loginY` 573.353 / `splashOffset` 206)**作废**,回 main 原值 694 / 933 / `dh-640` / 621 / 158 —— 上方 §16.2 表格与条目已就地标注。+> 手机端保持无游客 / 无账号行为不变。详见+> [`design-decision-log.md`](./design-decision-log.md)「2026-07-28」条。diff --git a/docs/design-rules/cindy-design-system.md b/docs/design-rules/cindy-design-system.mdindex 1fbcdede45..2ee0dab98e 100644--- a/docs/design-rules/cindy-design-system.md+++ b/docs/design-rules/cindy-design-system.md@@ -8,7 +8,7 @@| 文档 | 内容 | 角色 ||---|---|---|| [`DESIGN.md`](./DESIGN.md) | 权威视觉规范全文:视觉语言(§1)、颜色(§2)、排版(§3)、组件(§4)、布局(§5)、交互约定与 Motion token(§14)、主题系统与 Token 参考(§10)、CINDY 皮肤族(§15)、登录链路(§16) | **权威正本**(原仓库根文件,根目录 `DESIGN.md` 保留为跳转入口) |-| [`figma-component-spec.md`](./figma-component-spec.md) | 登录链路 Figma 组件与色彩速查手册:全组件逐态参数、nodeId 溯源、wave1–wave5 读取记录 | 权威(登录域逐参数) |+| [`figma-component-spec.md`](./figma-component-spec.md) | 登录链路 Figma 组件与色彩速查手册:全组件逐态参数、nodeId 溯源、wave1–wave6 读取记录 | 权威(登录域逐参数) || [`token-decision-table.md`](./token-decision-table.md) | 登录链路色值 / 尺寸 → token 决策记录(新增 / 复用 / 豁免的判定理由 + 各 wave 增补台账) | 决策记录(现行 token 清单与值以 `DESIGN.md §16.1` + `colors.ts` 为准) || [`design-decision-log.md`](./design-decision-log.md) | 全局设计决策史台账:被推翻的方案、勘误过程、backlog(已收录原 `DESIGN.md §13` G1–G4 归档与 §15 决策史全量) | 决策台账(只增不改;与 `DESIGN.md` 冲突时以 `DESIGN.md` 为准) || [`README.md`](./README.md) | 本目录使用规则 | 说明 |@@ -16,6 +16,8 @@## 版本记录- **2026-07-28**:`DESIGN.md §2` 语义色清单新增警告橙合法消费者「workflow agent 状态方块条的运行中格子」(8×8px 方块,后台任务面板详情 + workflow 聊天卡;done/failed/queued 各走自己的语义 token),并明确「不引入新 token 的消费者由 §2 清单登记即可、需要新 token 才必须先进 §10 豁免表」;`DESIGN.md §5` 新增小例外「status micro-cells(2px)」——≤8px 的非交互状态方块保留 2px 圆角(方块条格子与 SystemCard 分类方块),档位圆角在该尺寸会把方块变成圆点、丢掉大编队一眼总览的「方块条」读法,范围严格限定非交互 / ≤8px / 仅状态,按钮·标签·行·徽章·容器一律仍走三档。+- **2026-07-28(勘误:手机端跳过登录剥离)**:手机端「跳过登录」与无账号通路整体从登录改版中剥离(2026-07-24「手机 / pad 必须有账号」拍板仍有效,07-27 的推翻缺产品侧确认);手机端只保留纯视觉改版(品牌簇新稿基准 + 避脸),面板 / 组高 / 圆钮行 / 协议行 / error 槽 / 键盘停靠锚全部回到 main 等价值。`DESIGN.md §16` 末尾新增勘误块界定「哪些值只对桌面成立」,详情与依据归档至 [`design-decision-log.md`](./design-decision-log.md)「2026-07-28」条。+- **2026-07-27(登录改版:面板 500 + 跳过登录)**:`DESIGN.md §16` 几何表换新值(面板 440→500、登录组 560→620、圆钮行 y 480→540、协议行 y 582→642、error 槽回 680×50@380、新增「跳过登录」槽 680×60@430)+ 新增 §16.3「登录文字按钮」组件规格 + §16.4 协议门过门点与豁免表 + §16.2 移动端 stage 几何与键盘停靠锚;`figma-component-spec.md` 新增 §12(wave6 新稿 `700:783` / `705:799` / `705:915` 读取记录、跳过登录逐值规格、新旧稿差异、UNKNOWN 清单);`token-decision-table.md` §3/§4 改值并登记跳过登录尺寸族(色源复用 `--login-secondary-text`,零新增颜色 token);被推翻的两条 2026-07-24 产品拍板(游客过协议门 / 手机必须有账号)与 pad 竖屏推导值归档至 [`design-decision-log.md`](./design-decision-log.md)「2026-07-27」条。- **2026-07-26**:`DESIGN.md §10` 新增「External Theme Import (VSCode / Obsidian)」小节——外部主题导入只映射从 7 个人工移植社区主题抽出的 91-token 模板、语义豁免族(`--login-*` / 危险红 / 警告橙 / 焦点蓝 / `--diff-*`)不参与导入、`-hsl` token 精确换算、新增 `--md-h1-fg`…`--md-h6-fg` / `--md-strong-fg`(默认 `inherit`,内置主题观感不变)、本地主题可选 `family` 字段。决策理由与取舍见 [`design-decision-log.md`](./design-decision-log.md) 2026-07-26 条。- **2026-07-24(梳理批次 1)**:`DESIGN.md` 整体梳理第一批落地——去除 Ollama 官网叙事(标题改 `Cindy Design System`,§1/§4/§5/§8/§9 重写或删除官网内容);focus ring 文档追平代码(`#3b82f6` → `#417CDD`);§2/§9 二级三级文字与 chip 双 slot 表述按 `colors.ts` 修正;§10 移除写死 token 计数与过时豁免行;§12 结构化规格并入 §4(§12 编号留占位);§13 G1–G4 归档至新建 [`design-decision-log.md`](./design-decision-log.md);§14/§15/§16 若干失效指向修正。- **2026-07-24**:目录整编(设计 md 统一归位 `docs/design-rules/`,本文件升级为索引)。同步 Figma 组件库更新:hover 统一「叠白变亮」口径(旧「白底钮 hover 叠黑」作废)、新增协议勾选 `radiobutton` 四态与双色模式小按钮四母版、`SSO 登录_企业` / `back` 扩 Dark 三态、`white_button` 增 loading 五态(`figma-component-spec §11`、`DESIGN.md §16.5`)。`figma-component-spec.md` / `token-decision-table.md` 自迁移前仓库最后版本恢复并更新至 wave5。diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.mdindex 6c335a5826..2bd8ecda5d 100644--- a/docs/design-rules/design-decision-log.md+++ b/docs/design-rules/design-decision-log.md@@ -12,6 +12,99 @@## 2026-07+- **07-28** **手机端「跳过登录」与无账号通路整体剥离(拍板人 = 用户)**——本条**修正**下方+ 两条 07-27 记录(「手机端新增跳过登录入口与无账号通路」及其连带的移动端键盘锚 / 配置错误屏+ 逃生口 / 移动命中区 50),07-27 那两条**作废但保留在册**(决策轨迹不删)。背景:本轮 PR 的+ 任务边界是「登录页只改 UI」;独立核实确认 (a) 手机端在 main 基线(`55e3eac2b`)**从无**+ 游客 / 无账号功能,(b) 2026-07-24 产品拍板「手机 / pad 为远程连接客户端、必须有账号、+ 不加游客登录」**仍然有效**——07-27 的「推翻」缺产品侧确认,且 `loginConsent.test.ts` 里+ 锁死该拍板的反向断言当时被改写掉了。故手机端跳过登录属越界新增功能,整体剥离。+ **剥离范围**:删 `localModeStore` / `skipLoginGate` / `homeRemoteSyncGate` /+ `authGeneration` 及其测试;`AuthContext` 回 main 等价(无 `isLocalMode` / `enterLocalMode` /+ 冷启动恢复 / 账号优先清标记,`clearLocalSession` 回裸 generation bump,+ `acceptOutcome` / `completeOAuthCallback` 的 `expectedGeneration` 一并回退——它是跳过登录+ review 引出的改动,越界不留);登录页删入口挂载与协议门豁免、路由门回 `isAuthenticated`、+ 首页回 main 行为、删 `LoginSkipLoginLink` 组件与 `skipLogin` 四语 key;几何回 main+ (面板 440、组 560、圆钮行 480、协议行 582、error 槽 680×60 @380、删 `LOGIN_SKIP_LOGIN` 与+ 键盘停靠锚常量、pad 竖屏推导值回原值);`loginConsent.test.ts` 恢复 2026-07-24 三条反向断言。+ **保留的手机端视觉改版**(与跳过登录无关,本轮唯一保留项):短屏 / 长屏品牌簇换新稿+ `705:915` / `705:799` 逐字段基准(cindy / slogan / word),含 07-27 拍板的避脸落值+ (长屏 slogan 下移 31.32 距字标 24px、短屏立绘上移至 y=60);功能区落位 `loginY`+ (694 / 933 / `dh-640`)与面板几何同源,**保持 main 原值不动**。+ **桌面端不动**:桌面本来就有 local-mode 能力,UI 换成「跳过登录」文字按钮合法,+ 07-27 的桌面侧决策继续有效。手机端保持无游客 / 无账号行为不变。+ (→ `DESIGN.md §16` 末尾勘误块 / `cindy-design-system.md` 变更史 2026-07-28 行)+- **07-27** 登录页改版:**「跳过登录」取代游客圆钮入口,且免协议门**(拍板人 = 用户;+ 依据 = figma 新稿 `705:915` / `705:799` / `700:783` + 本轮任务指令)。第三方圆钮行+ 删除游客人形圆钮(guest 图标资产一并删除,`count` 按 provider 动态:CN = Apple+SSO+ 2 颗 / Global = Apple+Google+SSO 3 颗),入口改为**面板内「跳过登录」文字按钮**+ (新稿容器 `705:1068` / `700:910` 680×60 @面板内 y430)。同时**推翻 2026-07-24+ 「个人登录一律先同意协议再发起(含游客)」**:跳过登录 / 本地模式(含桌面 `error`+ 步 footer 逃生口)不过 `requireConsent`、radio 未勾选也直接进主界面,**且不写入统计+ 采集同意**(不创建账号、不上报数据,没有明示同意就保持采集闸关闭);其余个人链路协议门+ 与企业 SSO 豁免均不变。(→ §16.2 几何表 / §16.3 组件表 / §16.4 协议门过门点与豁免 /+ §16.5 决策记录;`figma-component-spec §12.1`)+- **07-27** **手机端新增「跳过登录」入口与无账号通路**(拍板人 = 用户;依据同上,新稿+ 手机帧已画出该入口)——**推翻 2026-07-24「手机 / pad 为远程连接客户端、必须有账号、+ 不加游客登录」**。落点:`AuthContext.isLocalMode` 与登录态**正交**(本态下无 token /+ user,业务请求仍 UNAUTHENTICATED,只有路由门「有账号 ∨ 已跳过」并列放行),标记跨重启+ 保留(AsyncStorage `cindy.mobile.auth.localMode`,非凭证不占安全存储);账号优先——+ 真正登录成功即清标记,登出 / 会话终止一并清除回登录页。原锁死该拍板的测试断言+ (mobile 登录源码不得出现 localMode 入口)随之改写。(→ §16.3 组件表 / §16.4 逐屏表)+- **07-27** **面板 440→500、登录组 560→620**(拍板人 = 用户;依据 = 新稿三端一致+ 680×500,`700:791` / `705:886` / `705:1062`,同文件旧稿对照 440)。增的 60 全部给面板内+ 新增的「跳过登录」槽(430..490,槽底距面板底 10),**面板内其余元素 y 坐标一律不动**+ (标题 31 / 副标题 75 / 输入框 158 / 主按钮 300 / error 380);error 槽由 h60 回到+ **680×50 @380**(2026-07-24 的「占满到面板底 h60」是面板 440 时代的等价写法),与跳过槽+ 首尾相接、同时可见不重叠;圆钮行 480→**540**、协议行 582→**642** 随组顺移(圆钮行距+ 面板底恒 40、协议行距组底恒 22 均不变)。**Splash 借用登录面板时不跟随 500,保持 440**+ (拆出 `SPLASH_PANEL.height`:Splash 五帧无该入口、设计稿未改版,跟随会在启动态凭空多+ 50 CSS px 空白;同批把 Splash 的 `no-drag` 盒高度从登录组高 620 收到面板高 440——盒语义+ 是「只有面板内容不参与窗口拖拽」,跟着组高会把面板下方空白也划成不可拖拽区)。+ (→ §16.2 / §16.3 `LoginPanel`;`token-decision-table §4`)+- **07-27** **「登录文字按钮」定性为新组件类别,与「文字链接」分家**(拍板人 = 用户)。+ `LoginSkipEntry`(桌)/ `LoginSkipLoginLink`(手)**不是** `LoginTextLink`:色走+ `--login-secondary-text`(`#6F6F6F`,light / dark 同值,**零新增 token**、不走+ `--login-link-*` 族),**hover / pressed 不变色**(只靠常显下划线 + 指针形状反馈),+ 字号取稿值 24(≠ Text_link 的 20);**热区 = 当前语言实际文字渲染宽度 + 左右各扩+ (桌面 30 / 移动 50 设计px)、高度占满 60 槽**,680×60 仅布局容器且自身不可点+ (桌面 `pointer-events:none` + 内层 button;移动 `box-none` + 内层 `Pressable`+ 放大 bounds——不用 `hitSlop`,它不越父 View 边界、Android 界外触摸不派发);超长译文靠+ `maxWidth 680` + 单行 + ellipsis 防御兜底,**可见截断 = 文案 bug**(改文案不改布局)。+ 文案复用既有 `login.localModeEntry`(四语齐全,mobile 影子 catalog 新增同译法+ `skipLogin` key;孤儿 key `login.returnToLocalMode` 四语删除)。+ (→ §16.3「登录文字按钮」/ §16.2 长度预算表;`figma-component-spec §12.1`)+- **07-27** **移动端键盘停靠锚由「面板底」改为「error 槽底」(面板坐标 y=430)**+ (拍板人 = 用户)。背景:面板 440→500 后若继续拿面板底当停靠锚,每次停靠会比改版前多顶+ 60 设计px,短屏更容易触发 clamped-fallback 把品牌层 / 标题挤掉。**取舍**:键盘弹起时+ 「跳过登录」槽(430..490)允许被遮挡——它不是输入链路必需元素,收起键盘即可见;停靠引擎+ (10px 贴附 + safe-top 上限 + clamped-fallback)与悬浮相交判定锚(输入框 ∪ 主按钮)不变。+ (→ §16.2「键盘停靠锚」)+- **07-27** **SLOGAN 避脸:长屏 slogan 下移 31.32(距字标留 24px)+ 短屏立绘上移 27**+ (拍板人 = 用户,审 demo 两次拍板:先「slogan 下移不挡脸也不压字标」,再「短屏走方案 B+ 立绘上移」)。判据是**像素级实测**而非目测:立绘脸部 skin 连通域 x402..552 / y315..475、+ slogan 资产 ink 5244px,双方按各自 `contain` 折算到 stage 求交——长屏原值 `y=536.68`+ 时 ink ∩ 脸 = 290px、短屏 = 91px、中段 dh≈1400 最高 113px。落值:长屏 slogan inner+ `y` 536.68→**568**(容器 514→545.32,x / 宽高不动),底 645.29 距字标顶 669.17 = **23.88**+ (该档硬上限,再下移撞字标);短屏无下移余量(底距字标顶仅 5.83),改为立绘 `y` 87→**60**,+ 改后 dh ≤1450 全段 ink ∩ 脸 = **0**,dh 1500..1624 残留 3..9px(仅下巴尖,受长屏 24px+ 上限约束)。边界:可见发顶 = 60 + 86×0.79823 = 128.65,仍在 Status Bar 下沿 115.67 之下+ 12.98(资产 y<86 是透明留白),**不侵入状态栏、无顶部裁切**;底部淡出渐隐,上移后尾部由+ 「藏在面板下 20.6」变成「露出面板上 6.4」(长屏本来就露 25,同款观感)。+ (→ §16.2「移动端 stage 几何」/「SLOGAN 避脸」)+- **07-27** 手机 stage 几何**整档换新稿基准**(依据 = 新稿 `705:915` / `705:799` 逐字段+ 实测;其中立绘 / slogan 的 y 随同日「避脸」拍板再修正,见上一条):短屏 dh=1334+ (立绘 599×720@(75,60)、slogan 254.01×72.8@(462.55,408.37)、+ 字标 335×115@(208,487)、loginY 622)、长屏 dh=1624(立绘 750×902@(0,106)、+ slogan 269.66×77.29@(444.9,568)、字标 387×132.18@(182,669.17)、loginY 827);+ 短屏以下锚常量 `dh-640`→**`dh-712`**(= 组底 682 + 新稿底距 30,在 dh=1334 处与+ loginY=622 连续)。**2026-07-24「视觉+功能区整体上移 40 设计px」拍板由本次新稿取代**+ (那条是为修旧稿协议行溢出,新稿自带 30 底距,不再叠加)。**pad 竖屏无 figma 新稿**:+ 按「组底仍落 1114.94 / 字标框底↔面板顶仍 14.84 / splash 期簇位不变」三条不变量,把品牌簇+ 与登录组一起上移 `60 × 0.794117 = 47.647` 设计px(`loginY` 621→573.353,`splashOffset`+ 158→206)——**该值为推导、非设计源,用户 2026-07-27 接受推导,竖屏几何待设计侧回看确认**;+ pad 横屏组底 774.95 仍在 stage 820 内,几何原值不动。(→ §16.2「移动端 stage 几何」;+ `figma-component-spec §5.4`)- **07-26** 外部主题导入(VSCode / Obsidian)落地,同批引入 Markdown 文字色 token。两条关键决策:① **转换模板不新设计,取自已有的人工移植成果**。diff --git a/docs/design-rules/figma-component-spec.md b/docs/design-rules/figma-component-spec.mdindex c183745ca3..9173cdc6b2 100644--- a/docs/design-rules/figma-component-spec.md+++ b/docs/design-rules/figma-component-spec.md@@ -26,6 +26,7 @@| wave3 追加 · 2026-07-19 | `247:1613`, `358:792`, `247:1539`, `358:689`, `358:711`, `358:733`, `358:473`, `358:833`, `358:434`, `347:3223`, `347:3244`, `347:3247` | Text_link hover、log_in_button 5 态、企业 SSO 新桌面帧、iPad 竖/横屏、WeChat 三圆钮行均已读取;企业 SSO 第一排 `358:511` / `358:601` / `358:631` 与第二排参数一致 || wave4 追加 · 2026-07-20(白底体系) | `368:1375`(含 children `368:1376`-`368:1398`), `379:518`, `379:520`, `368:1377`, `368:1381`, `368:1394`, `368:1383`; Splash 五帧 `379:581`, `379:525`, `379:607`, `379:633`, `379:655` | 白底体系六新帧读取记录见 §10;**立绘 child 层裁定**:wave4 登录帧内立绘为 `CINDY_Client` 组件 instance(`368:1378`,443,275,934×934,与旧帧几何一致),**无独立新图层/新资产**——立绘复用旧 source(桌面 `347:971` / 移动 `347:2707`),背景渐变由代码绘制(默认路径成立,implementation-plan Step 0 资产硬约束③) || wave5 追加 · 2026-07-24(组件库状态扩充 + hover 统一口径) | `600:627`, `602:846`, `602:863`, `602:1297`, `602:1311`, `347:2526`, `247:1539`, `247:1636`, `549:765`(变体 `549:766`/`779`/`792`/`850`/`865`/`882`)| radiobutton 四态、双色模式小按钮四母版、white_button 增 loading 五态、`SSO 登录_企业` 与 `back` 扩为含 Dark 三态的六态集、**全按钮族 hover 统一为「normal 底上叠白变亮」**(旧「白底钮 hover 叠黑」口径作废)——详见 §11 |+| wave6 追加 · 2026-07-27(登录改版:面板 500 + 跳过登录) | 桌面 `700:783`(面板 `700:791`、跳过登录容器 `700:910` / 文本 `700:911`、圆钮行 `700:796`、服务条款行 `700:807`);手机长屏 `705:799`(面板 `705:886`);手机短屏 `705:915`(主容器 `705:1057`、面板 `705:1062`、error `705:1067`、跳过登录容器 `705:1068` / 文本 `705:1069`、圆钮行 `705:1070`、服务条款行 `705:1075`);旧版同文件对照帧 `678:750` / `678:914` / `347:2662` | 三端面板一致 **680×500**(旧 440,+60 = 新增「跳过登录」容器高);面板内其余元素坐标未动;圆钮行随面板底顺移到 y=540、服务条款行到组内 y=642;短屏立绘 / 字标 / slogan 换新基准。`get_variable_defs` 对三帧仍返回 `{}`(无变量绑定,颜色硬编码)——详见 §12 |## 1. Color System@@ -263,8 +264,9 @@ wave5 追加 · 2026-07-24:`get_design_context(347:2526)` 复核,组件集| 地区 | nodeId | 容器 | 子项 ||---|---|---|---|-| 国区桌面 / 移动 | `347:1284`, `347:2646`, `347:2684` | x=225 y=480,230 x 80;gap=70 | Apple x=0;SSO x=150 |-| 国际区桌面 / 移动 | `347:1493`, `347:2879`, `347:2906` | x=150 y=480,380 x 80;gap=70 | Apple x=0;Google x=150;SSO x=300 |+| 国区桌面 / 移动 | `347:1284`, `347:2646`, `347:2684` | x=225 y=480,230 x 80;gap=70〔y 值已作废,见下 wave6 行〕 | Apple x=0;SSO x=150 |+| 国际区桌面 / 移动 | `347:1493`, `347:2879`, `347:2906` | x=150 y=480,380 x 80;gap=70〔y 值已作废,见下 wave6 行〕 | Apple x=0;Google x=150;SSO x=300 |+| **wave6 · 2026-07-27(新稿三端)** | `700:796`(桌面), `705:1070`(短屏), `705:894`(长屏) | x=225 **y=540**(= 面板底 500 + gap 40),230 x 80;gap=70 | Apple x=0;SSO x=150(新稿仅这两颗可见,另两个 instance hidden)。国际区三钮行沿用 x=150 w=380、y 同改 540;**行内不再有游客圆钮**——该入口改为面板内「跳过登录」文字按钮(§12.1),落码 `count` 按 provider 动态(CN 2 / Global 3) |wave3 追加 · 2026-07-19:`LOG IN_手机登录_默认` 新帧 `347:3223` 已实测为 Apple / WeChat / SSO 三圆钮行。第三方入口容器 `347:3244` x=150 y=480 w=380 h=80,gap 70;Apple `347:3245` x=0、WeChat `347:3247` x=150、SSO `347:3248` x=300,三者均 80 x 80、radius 50、fill `#2A2828`、stroke `#434343`。WeChat icon 使用组件 `247:1724`;`get_design_context` 未暴露 icon vector fill,`get_screenshot(347:3247)` 80x80 像素统计中主绿为 `#00C70A`(576 个不透明像素),作为图标主色记录。@@ -297,6 +299,8 @@ wave5 追加 · 2026-07-24:组件集扩为六态(新增 Dark 三态)。亮页面位置:验证码页面板内 x=71 y=238,540 x 50。+⚠️ **本组件不承载「跳过登录」**(wave6 · 2026-07-27):`Text_link` 是**文字链接**(20px、link 色族、hover 变色);「跳过登录」是独立的**文字按钮**(24px、`#6F6F6F` 双模同值、hover / pressed 不变色、命中区随语言自适应),规格见 §12.1,两者不得互相复用。+### 4.8 `error_text`Symbol `247:2158`,尺寸 680 x 50。@@ -367,14 +371,17 @@ wave3 追加 · 2026-07-19:桌面 `LOG IN_企业 SSO 登录` 两排同名帧| Cindy 立绘 | x=443 y=275,934 x 934 | `347:1273`, `347:1482` || CINDY 字标外框 | x=570 y=1029,680 x 180 | `347:1274`, `347:1483` || SLOGAN | x=1191 y=863,460 x 134 | `347:1276`, `347:1485` |-| 登录整体组 | x=570 y=1229;常规 680 x 560;验证码/准备/错误 680 x 440 | `347:1278`, `347:1794`, `347:1963` |-| 面板 | 680 x 440;fill `#FBFBFB`;radius 36;overflow clip | `347:1279`, `347:1488`, `347:1964` |+| 登录整体组 | x=570 y=1229;常规 680 x **620**(wave6 · 2026-07-27,原 560 作废);无圆钮行的子视图(验证码 / 准备 / 错误)= 面板本体 680 x **500** | `700:783`(新稿);旧值 `347:1278`, `347:1794`, `347:1963` |+| 面板 | 680 x **500**;fill `#FBFBFB`;radius 36;overflow clip(wave6 · 2026-07-27,原 440 作废;+60 = 新增「跳过登录」容器高,面板内其余元素坐标未动) | `700:791`, `705:886`, `705:1062`(新稿);旧值 `347:1279`, `347:1488`, `347:1964` |+| 「跳过登录」文字按钮 | 容器 680 x 60 @面板内 (0,430);文本 96 x 29 @容器 (292,15),Inter Regular 24,`#6F6F6F`,underline(from-font),文本中心 340 = 容器中心(wave6 · 2026-07-27 新增) | 容器 `700:910` / 文本 `700:911`(桌面);`705:1068` / `705:1069`(短屏)——详见 §12.1 |+| error_text 与跳过登录的垂直关系 | error 容器 680 x 50 @(0,380)、跳过登录容器 @(0,430):**首尾相接、间距 0**,同时可见互不重叠(文本视觉间距 ≈30);error 出现不推移跳过入口。跳过容器底 490 距面板底 500 = 下内边距 10 | `705:1067` + `705:1068` || 标题 | y=31,高 38;国区标题 x=222 w=236;国际 title group x=0 w=680 | `347:1001`, `347:1491` || 副标题 | x=41 y=75,599 x 23 | `347:1002`, `347:1492` || 输入框 | x=70 y=158,540 x 80 | `347:1280`, `347:1489` || 主按钮 | x=70 y=300,540 x 80 | `347:1281`, `347:1490` || 输入到按钮 gap | 输入 bottom 238 到按钮 top 300,gap=62 | `347:1280`, `347:1281` |-| 面板到第三方入口 gap | 面板 bottom 440 到第三方 y=480,gap=40 | `347:1278`, `347:1493` |+| 面板到第三方入口 gap | 面板 bottom **500** 到第三方 **y=540**,gap=40(wave6 · 2026-07-27;gap 值不变,两端各 +60) | `700:791`, `700:796` |+| 服务条款行 | 680 x 40 @登录组内 y=642(帧内 y=1871;= 组底 620 下方 22。wave6 · 2026-07-27 由组内 582 顺移 60) | `700:807` |### 5.2 国区桌面状态帧@@ -416,6 +423,10 @@ wave3 追加 · 2026-07-19:桌面 `LOG IN_企业 SSO 登录` 两排同名帧| 国区短屏 | `347:2662` | 750 x 1334,bg `#DF0C27` | x=75 y=107,599 x 720 | x=385 y=458.965,364 x 106.035 | x=45 y=576,660 x 158.4 | x=35 y=734,680 x 560 || 国际长屏 | `347:2857` | 750 x 1624,bg `#DF0C27` | x=0 y=96,750 x 902 | x=289 y=659,460 x 134 | x=0 y=793,750 x 180 | x=35 y=973,680 x 560 || 国际短屏 | `347:2884` | 750 x 1334,bg `#DF0C27` | x=75 y=107,599 x 720 | x=385 y=458.965,364 x 106.035 | x=45 y=576,660 x 158.4 | x=35 y=734,680 x 560 |+| **wave6 长屏(新稿)** | `705:799` | 750 x 1624,bg `#1F1F1E` | x=0 y=106,750 x 902 | 容器 x=362.57 y=514,386.43 x 112.57(内层 vector +82.33,+22.68,269.66 x 77.29) | 容器 680 x 180 @主容器 (35,627),字标图 x=147 y=42.17,387 x 132.18 | x=35 y=**827**,680 x **620** |+| **wave6 短屏(新稿)** | `705:915` | 750 x 1334,bg `#1F1F1E` | x=75 y=87,599 x 720 | 容器 x=385 y=387,364 x 106.03(内层 vector +77.55,+21.37,254.01 x 72.8) | 容器 680 x 180 @主容器 (35,422),字标图 x=173 y=65,335 x 115 | x=35 y=**622**,680 x **620** |++wave6 追加 · 2026-07-27(登录改版新稿手机帧):两帧共用主容器 `Frame 1312316986` 680 x 882(= 字标 180 + Log_in 620 @y200 + 服务条款 40 @y842),左右各距屏 35;面板 680 x 500 与面板内坐标**与桌面完全一致**(同组件树)。旧帧的红底 `#DF0C27` 已随 wave4 白底 / 深底体系作废,新稿帧底为 `#1F1F1E`(dark)。短屏相对长屏的缩放:立绘 ≈0.80x、字标 ≈0.87x、slogan ≈0.94x,**面板与面板内元素 1.0x 不缩放**(沿用「移动适配优先保护输入面板尺寸」原则,§7.2)。落码消费点 = `apps/mobile/src/auth/loginSkinLayout.ts` 的 `LOGIN_STAGE_SHORT` / `LOGIN_STAGE_LONG`(其中 slogan / 字标取上表**内层可见图形框**的绝对坐标,口径同 wave3.5)。**无 iPad 新稿帧**——pad 竖屏几何为推导值,见 `DESIGN.md §16.2`。移动端固定项:@@ -482,7 +493,7 @@ wave3 追加 · 2026-07-19:桌面 `LOG IN_企业 SSO 登录` 两排同名帧| 项 | 桌面端 | 移动端 | 结论 ||---|---|---|---|-| 核心组件尺寸 | input 540 x 80,button 540 x 80,panel 680 x 440,round button 80 x 80 | 同 Figma px 尺寸 | 双端共用组件尺寸 |+| 核心组件尺寸 | input 540 x 80,button 540 x 80,panel 680 x **500**(wave6 · 2026-07-27,原 440),round button 80 x 80 | 同 Figma px 尺寸 | 双端共用组件尺寸 || 画板 | 1819 x 2098 | 750 x 1624 / 750 x 1334 | 外层布局不同,组件不缩放 || 顶部系统元素 | 桌面窗口三色点 | iPhone Status Bar mock | 平台壳不同 || hover | 可实现 | 不实现 | hover 仅桌面端 |@@ -575,7 +586,7 @@ wave3 追加 · 2026-07-19:桌面 `LOG IN_企业 SSO 登录` 两排同名帧## 11. wave5 追加 · 2026-07-24(组件库状态扩充 + hover 统一口径)-> 本节为 2026-07-24 组件库更新的 Figma MCP 读取记录与新组件规格。读取方式:`get_design_context` 按母版 nodeId 逐个读取;radiobutton 圈体颜色经导出 SVG 源码核对(fill/stroke 直读,非截图目测)。同批更新的登录页游客登录(跳过登录)样式属独立实现任务,不在本文档范围。+> 本节为 2026-07-24 组件库更新的 Figma MCP 读取记录与新组件规格。读取方式:`get_design_context` 按母版 nodeId 逐个读取;radiobutton 圈体颜色经导出 SVG 源码核对(fill/stroke 直读,非截图目测)。~~同批更新的登录页游客登录(跳过登录)样式属独立实现任务,不在本文档范围~~〔**已回收(2026-07-27)**:新稿已给出该入口的完整帧规格,见 §12.1;游客圆钮方案退役〕。### 11.1 hover / pressed 统一口径(全按钮族)@@ -628,3 +639,54 @@ wave3 追加 · 2026-07-19:桌面 `LOG IN_企业 SSO 登录` 两排同名帧- **`SSO 登录_企业`**:权威组件集迁移为六态 `549:765`(§4.9);Light Hover 值更新、新增 Dark 三态。- **`back`**:扩为六态,新增 Dark 三态 `549:897`/`904`/`913`(§4.6)。- **迁移弹窗族**(`567:599` 等六帧)与本次小按钮共库:服务条款弹窗面板(`602:822`)按钮即 `light_button_*` instance(`602:883`/`884`)。++## 12. wave6 追加 · 2026-07-27(登录改版:面板 500 + 「跳过登录」)++> **勘误(2026-07-28)**:本节是 figma 新稿的**读取记录**(设计文件里确实画了手机帧的「跳过登录」),但**实现侧手机端已整体剥离**:手机只落地品牌簇视觉基准,面板仍 440、无跳过槽、无 `LoginSkipLoginLink`。本节 12.1 的落码口径仅对桌面成立,手机侧读作「设计已出稿、实现未落地」(见 `design-decision-log.md`「2026-07-28」条)。++> 读取口径:`get_metadata`(结构树)+ `get_design_context`(样式)+ `get_screenshot`(像素采样交叉验证)+ `get_variable_defs`(三帧均返回 `{}`,颜色仍为硬编码)。新稿三帧 = 桌面 `700:783`「LOG IN_桌面端_dark」1819×2098 / 长屏 `705:799`「Log in_iPhone_750x1624」/ 短屏 `705:915`「Log in_iPhone_750x1334」;同文件内旧版对照帧 `678:750` / `678:914` / `347:2662`(非代码基线推断)。几何逐值已回写 §5.1 / §5.4 / §4.5。++### 12.1 「跳过登录」文字按钮(新组件类别)++| 项 | 值 | nodeId |+|---|---|---|+| 容器 | 面板内 680 x 60 @(0,430);槽底 490 距面板底 500 = 下内边距 10 | `705:1068`(短屏)/ `700:910`(桌面) |+| 文本 | 96 x 29 @容器 (292,15)(水平居中:文本中心 340 = 容器中心;垂直居中);Inter Regular 24;`#6F6F6F`;underline(`decoration-solid`,`underline-position: from-font`) | `705:1069` / `700:911` |+| 与 error_text 关系 | error 容器 680 x 50 @(0,380) → 跳过容器 @(0,430):**首尾相接(间距 0)**、同时可见互不重叠;error 出现不推移跳过入口(两者各占固定位) | `705:1067` + `705:1068` |+| 三端一致性 | 桌面 / 长屏 / 短屏三帧的容器与文本参数逐值相同(同组件树) | — |++稿内未给出、由 2026-07-27 用户拍板补齐的实现口径(**不是**从稿内目测推的):++| 缺口 | 拍板结论 |+|---|---|+| 下划线粗细 | 稿为 `from-font`(跟随字体度量),无 px 值 → 实现沿用浏览器 / RN 默认下划线,不写死粗细 |+| 可点热区 | 稿内 680 x 60 只是布局容器、**无热区语义** → 容器本身不可点;命中区 = 当前语言实际文字渲染宽度 + 左右各扩(桌面 30 / 移动 50 设计px)、高度占满 60 槽 |+| 交互态 | 定性为**文字按钮**(非文字链接):hover / pressed **不变色**,只靠常显下划线 + 指针形状反馈;色 `#6F6F6F` = `--login-secondary-text`,light / dark 同值,零新增 token |+| 超长译文 | `maxWidth = 680` + 单行 + ellipsis 仅作防御兜底;可见截断 = 文案 bug(改文案不改布局) |++组件契约与「文字链接 vs 文字按钮」的分界见 `DESIGN.md §16.3`「登录文字按钮」。++### 12.2 新稿 vs 旧稿差异(同文件内对照)++| 项 | 旧稿(`678:914` 长屏 / `678:750` 桌面 / `347:2662` 短屏) | 新稿(`705:799` / `700:783` / `705:915`) |+|---|---|---|+| 面板高 | 440 | **500**(+60 = 跳过登录容器高) |+| error_text | y=380 h=50(报错稿 `347:1019` 即此位) | 同位置,未移动 |+| 跳过登录 | 无 | 新增,y=430–490 |+| 结构 | 字标 / 面板 / 服务条款分散定位(桌面服务条款独立 @(570,1811)) | 收拢进主容器 `Frame 1312316986` 680×882(服务条款 @容器 y=842) |+| 圆钮行 | y=480;桌面 x=150 w=380(3 颗可见) | y=**540**;桌面 x=225 w=230(Apple + SSO 两颗可见,另两 instance hidden) |+| 长屏字标 / SLOGAN | 350×120 / 460×134 @(289,589) | 387×132.18(1.11x)/ 386.43×112.57 @(362.57,514)(0.84x) |+| 短屏字标 / SLOGAN | 352.93×120.54 / 364×106.03 @(385,458.97) | 335×115(0.95x)/ 364×106.03 @(385,387)(尺寸同、上移 72) |+| 立绘 | 长屏 @(0,116) / 短屏 @(75,107) | 长屏 @(0,106)(上移 10)/ 短屏 @(75,87)(上移 20) |+| 短屏服务条款行 | 无 | 新增(组内 y=842,距屏底 30) |++### 12.3 本轮 UNKNOWN(未从稿内取到,勿目测补值)++| 项 | 说明 |+|---|---|+| 行高 px | `get_design_context` 全部输出 `leading-[normal]`,figma 未暴露数值(跳过登录的行框 29 取自文本节点高度) |+| letter-spacing | 生成代码未出现,推断为默认 0,未获 figma 侧确认 |+| 下划线粗细 / 热区 / 交互态 | 稿内无标注 —— 已由 §12.1 拍板表补齐 |+| error 显隐时布局是否变化 | 新稿只有「error 与跳过登录同时可见」一帧,无「无 error」对照帧;实现取「两者各占固定位、互不推移」(与旧报错稿的 error y=380 一致) |+| iPad 新稿 | **无 pad 帧** —— pad 竖屏几何为推导值(`DESIGN.md §16.2`,用户 2026-07-27 接受推导,待设计回看) |+| light 主题手机帧 | 仍只有桌面 `_white` 系列,无 iPhone 尺寸 light 稿(沿 wave5 现状) |diff --git a/docs/design-rules/token-decision-table.md b/docs/design-rules/token-decision-table.mdindex e08680c5da..5debd38658 100644--- a/docs/design-rules/token-decision-table.md+++ b/docs/design-rules/token-decision-table.md@@ -42,7 +42,7 @@| `#2a2828` | 主按钮 / 社交按钮背景、active 边框、Dark 回调页面底、Dark CTA 文本 | 新增别名分语义 | `login-primary-button-bg`、`login-control-border-active`、`login-inverted-button-text`、`login-result-page-bg` dark、`login-link-text` | `#2a2828`,HSL `0 2.4% 16.1%` | 全主题保持;CINDY dark `surface` 同值但语义不同 || `#434343` | 主按钮 / 社交按钮边框、Dark 回调卡片边框 | 新增 | `login-primary-button-border`、`login-panel-border` dark | `#434343`,HSL `0 0% 26.3%` | 全主题保持;可由 CINDY dark `border-default` 提供但 login alias 更稳 || `#252222` | 标题、输入已填文本 | 新增 | `login-title-text`、`login-control-text` | `#252222`,HSL `0 4.2% 13.9%` | 全主题保持;不复用 `text-primary`,因为 default light 是 `#262626`、CINDY light 是 `#3c3f43` |-| `#6f6f6f` | 副标题、回调正文 | 新增 | `login-secondary-text` | `#6f6f6f`,HSL `0 0% 43.5%` | 全主题保持;CINDY dark `text-secondary` 同值,light 不同 |+| `#6f6f6f` | 副标题、回调正文、**「跳过登录」文字按钮**(2026-07-27 新增消费点) | 新增 | `login-secondary-text` | `#6f6f6f`,HSL `0 0% 43.5%`;light / dark **同值** | 全主题保持;CINDY dark `text-secondary` 同值,light 不同。**「跳过登录」文字按钮走本 token、不走 `login-link-*` 族**(文字按钮 ≠ 文字链接:不做 hover / pressed 变色),故本次改版**零新增颜色 token** || `#ffffff` | Global 文字、返回按钮边框、Dark 回调按钮边框、状态栏变量 | 语义豁免或 alias | `login-inverted-button-border`;Global text 可用 `login-inverted-button-border` 或 dedicated constant | `#ffffff`,HSL `0 0% 100%` | 白色在这些场景是设计稿固定高对比值;不走 `surface-elevated`,避免主题污染 || `#d91f37` | 错误原因文字 | 复用现有名并改默认 / override | `login-error-text` / existing component alias | 建议把旧 `login-error-text` 从 `error-flat(#ef4444)` 调整为 `#d91f37`,HSL `352.3 75% 48.6%` | 全主题保持;错误色是登录设计稿专用,不应和通用 destructive 混同 || `#b4b4b4` | disabled 按钮边框 | 新增 | `login-control-border-disabled` / component alias | `#b4b4b4`,HSL `0 0% 70.6%` | 全主题保持 |@@ -73,8 +73,10 @@| `680` | 桌面登录组宽、WORD_MARK 宽、回调卡片尺寸 | 新增 | `login-panel-width`、`login-wordmark-frame-width`、`login-result-card-size` | 语义不同,不建议只留一个 magic number || `180` | 桌面 / 移动 WORD_MARK frame 高 | 新增 | `login-wordmark-frame-height` | 字标外框高度,不等于内部实际图片高度 || `460 x 134` | SLOGAN frame | 新增 | `login-slogan-width`、`login-slogan-height` | 短屏移动端会缩放该 frame,但设计基准仍需保留 |-| `560` | 登录整体高度含第三方入口 | 新增 | `login-flow-height` | 面板 `440` + gap `40` + social `80` |-| `440` | 登录面板高度 | 新增 | `login-panel-height` | 浏览器等待 / 准备 / 错误态也用 |+| `620` | 登录整体高度含第三方入口 | 新增 | `login-flow-height` | 面板 `500` + gap `40` + social `80`。**2026-07-27 登录改版由 `560` 改 `620`**(面板增高 60 随之);双端落码 = 桌面 `LOGIN_GROUP.height` / 手机 `loginSizes.flowHeight` + `LOGIN_GROUP.height` |+| `500` | 登录面板高度 | 新增 | `login-panel-height` | 浏览器等待 / 准备 / 错误态也用(登录全步骤恒定,步骤间不得跳变)。**2026-07-27 登录改版由 `440` 改 `500`**——增的 60 = 面板内新增「跳过登录」槽(`figma 700:791` / `705:886` / `705:1062`)。**Splash 借用登录面板时不跟随,仍为 `440`**(`SPLASH_PANEL.height` 独立常量:Splash 五帧无该入口、设计稿未改版) |+| `680 x 60` | 「跳过登录」文字按钮槽(面板内 @y430) | 新增 | `login-skip-entry-*`(槽 680×60、字号 24 / 行框 29、命中区左右扩张 桌面 30 / 移动 50) | **2026-07-27 新增**(`figma 705:1068` 容器 / `705:1069` 文本 / 桌面 `700:910`)。槽仅作布局容器、本身不可点;字号取稿值 24,**≠** Text_link 的 20,故单列不复用 `login-code-link-*`;命中区 = 当前语言实际文字渲染宽度 + 左右各扩(用户拍板),移动端用**放大 `Pressable` bounds**、不用 `hitSlop`(slop 不越父 View 边界,Android 界外触摸不派发)。落码 = 桌面 `SKIP_ENTRY` / 手机 `LOGIN_SKIP_LOGIN` |+| `y=540` | 圆钮行落位(= 面板底 500 + gap 40) | 复用推导 | 由 `login-panel-height + 40` 推导,不新增 token | **2026-07-27 由 `480` 改 `540`**;协议行同理由 `582` 改 `642`(= 组高 620 + 22);error 槽保持 `680×50 @y380` 不随之移动 || `36` | 面板 / 回调卡片圆角 | 新增 | `login-panel-radius` | 不复用 mobile `radius.container=12` || `540` | 输入框 / 按钮宽 | 新增 | `login-control-width` | 面板左右边距 70 推导,但以节点值为准 || `80` | 输入、按钮、社交圆钮高度 | 新增 | `login-control-height`、`login-social-size` | 控件和社交语义不同 |@@ -90,6 +92,10 @@| `1334` | 移动 short 画板高 | 新增 | `login-mobile-short-height` | 对应约 667pt || `115.672` | 状态栏 mock 高 | 不进产品 token | 无 | 只是 Figma iOS mock;真实 RN 走 safe-area |+> **勘误(2026-07-28)**:「跳过登录」**仅桌面落地**,手机端整体剥离(见 `design-decision-log.md`「2026-07-28」条)。故本表 §4 里 `login-panel-height` 的 `440→500`、`login-skip-entry-*` 尺寸族与「命中区移动端扩 50 / 落码手机 `LOGIN_SKIP_LOGIN`」均只对桌面成立;手机端 `loginSizes.panelHeight` 仍为 `440`、无 `LOGIN_SKIP_LOGIN` 常量。++**「跳过登录」文字按钮的色源(2026-07-27)**:文字色 = `--login-secondary-text`(`#6F6F6F`,light / dark 同值,见 §3 对应行),**不走 `--login-link-*` 族**——文字按钮与文字链接是两种组件,前者不做 hover / pressed 变色,因此本次改版没有新增任何颜色 token。+尺寸新增清单中不包含可由其它 token稳定推导的值(例如社交半径 `80/2`、输入左右边距 `(680-540)/2`)。若实现希望所有数值全命名,可额外补 `login-panel-horizontal-padding=70`、`login-panel-title-y=31`、`login-panel-subtitle-y=75` 等布局常量,但它们更适合在组件局部用结构化对象表达。## 5. 桌面 token 落地建议diff --git a/scripts/hardcoded-color-exemptions.json b/scripts/hardcoded-color-exemptions.jsonindex 5d3e3154cd..2e7827c86d 100644--- a/scripts/hardcoded-color-exemptions.json+++ b/scripts/hardcoded-color-exemptions.json@@ -199,16 +199,6 @@"reason": "注释引用暗色 SLOGAN 资产固有色(#FBFBFB),消费走 -dark 资产与 colors.login","owner": "login-dark"},- {- "glob": "apps/desktop/src/renderer/assets/login/icons/guest.svg",- "reason": "亮色深圆上的浅色游客图标资产固有色(mdi:user 单色,#EEEEEE;与其它登录图标同口径)",- "owner": "login-consent"- },- {- "glob": "apps/desktop/src/renderer/assets/login/icons/guest-dark.svg",- "reason": "暗色白圆上的深色游客图标资产固有色(mdi:user 单色,#2A2828;与其它 *-dark 图标同口径)",- "owner": "login-consent"- },{"glob": "apps/mobile/src/auth/__tests__/loginConsent.test.ts","reason": "consent 双态色板守卫单测(token 期望 hex/rgba,同 tokenRegistry.test.ts 先例)",