Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(login): 「本地模式」改称未登录,跳过登录恢复协议门,协议行整行可点 (#907)

Dash5491c691eccd
diff --git a/README.md b/README.md
index 8d8884b433..c6d1093d0d 100644
--- a/README.md
+++ b/README.md
@@ -71,7 +71,7 @@ repository and is not part of this monorepo.
| Mode | Account requirement | Availability |
| --- | --- | --- |
| Hosted service | Cindy cloud account | Use Cindy's full hosted service. See [pricing](https://cindy.app/#pricing). |
-| Local mode | No Cindy sign-in required | Choose “Local mode” on the login screen to use local agents. Server-backed capabilities are unavailable in this mode. |
+| Skip Sign-In | No Cindy sign-in required | Choose “Skip Sign-In” on the login screen to use local agents; the app then shows the account state as “Not signed in”. Server-backed capabilities are unavailable in this state. |
## Prerequisites
@@ -113,9 +113,9 @@ for Mainland China accounts and `global` for everyone else; do not rely
on the internal default. Full desktop, mobile, data-isolation, and validation
workflows are in [`CONTRIBUTING.en.md`](CONTRIBUTING.en.md).
-“Local mode” on the login screen is an unauthenticated local-agent mode, not a
-connection to a local server. Server-backed capabilities are unavailable in this
-mode.
+“Skip Sign-In” on the login screen runs local agents without a Cindy account
+(shown in the app as “Not signed in”), not a connection to a local server.
+Server-backed capabilities are unavailable in this state.
**About the default servers:** the client connects to Cindy's official cloud
services by default (endpoint manifests in
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 65cb4999e5..edcb4f4d4f 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -69,7 +69,7 @@ monorepo 组织。
| 使用方式 | 账号要求 | 可用范围 |
| --- | --- | --- |
| 远程托管 | Cindy 云端账号 | 使用 Cindy 的完整托管服务;[中国大陆定价](https://cindy.cn/#pricing) · [国际版定价](https://cindy.app/#pricing)。 |
-| 本地模式 | 无需登录 Cindy 账号 | 在登录页选择「本地模式」即可使用本机 agent 功能。依赖服务端的能力在该模式下不可用。 |
+| 跳过登录 | 无需登录 Cindy 账号 | 在登录页选择「跳过登录」即可使用本机 agent 功能,应用内显示为「未登录」。依赖服务端的能力在该状态下不可用。 |
## 前置要求
@@ -107,8 +107,8 @@ Remote 开发会使用你自己的 Cindy 云端账号和现有登录态,因此
中国大陆账号必须使用 `cn`,国际版账号必须使用 `global`,不要依赖内部默认值。完整的
桌面端、手机端、数据隔离和验证流程见 [`CONTRIBUTING.md`](CONTRIBUTING.md)。
-登录页的「本地模式」不是连接本地服务端,而是无需登录 Cindy 账号即可使用本机
-agent 的模式。依赖服务端的能力在该模式下不可用。
+登录页的「跳过登录」不是连接本地服务端,而是无需登录 Cindy 账号即可使用本机
+agent;进入后应用内的账号状态显示为「未登录」。依赖服务端的能力在该状态下不可用。
**关于默认服务器:** 客户端默认连接 Cindy 官方云服务(端点清单见
[`config/endpoint.json`](config/endpoint.json) 与
diff --git a/apps/desktop/src/main/mcp-integrations/ghost.ts b/apps/desktop/src/main/mcp-integrations/ghost.ts
index ea152dfb1d..1fe0f0bd99 100644
--- a/apps/desktop/src/main/mcp-integrations/ghost.ts
+++ b/apps/desktop/src/main/mcp-integrations/ghost.ts
@@ -611,7 +611,11 @@ export function getCindyGhostsMcpDeps(sessionCtx?: LiziMcpSessionContext): Cindy
return {
ok: false,
errorCode: 'GHOST_NOT_FOUND',
- message: '该插件需要 Cindy 账号,本地模式不可用;不要重试,改用本地可用方式。',
+ // 这条 message 是 model-visible 的 tool result,会被模型读到并可能回显进对话,
+ // 所以按用户可见口径写「未登录」而不是已废弃的「本地模式」(见
+ // i18n/glossary.json 的 not-signed-in 条目)。句尾的「本地可用方式」保留:
+ // 那个「本地」描述的是能力落在本机,不是账号状态名。
+ message: '该插件需要 Cindy 账号,未登录状态不可用;不要重试,改用本地可用方式。',
};
}
// 用户图片过户:attachments 里的地址逐张落媒体总仓 + 记
diff --git a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
index fda5c5f909..4a08b95277 100644
--- a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
@@ -84,7 +84,9 @@ describe('UserInfoSection — version label', () => {
describe('UserInfoSection — Canary avatar badge', () => {
it('shows only the shield decoration when isCanary is true', () => {
- expect(source).toContain("import { Flame, Shield, Smartphone } from 'lucide-react';");
+ expect(source).toContain(
+ "import { Flame, Shield, Smartphone, UserRound } from 'lucide-react';",
+ );
expect(source).toContain('const { user, mode, isCanary } = useAuth();');
expect(source).toContain('{isCanary && (');
expect(source).toContain("aria-label={t('sidebar.user.canaryBadge')}");
@@ -94,9 +96,33 @@ describe('UserInfoSection — Canary avatar badge', () => {
});
});
+describe('UserInfoSection — 未登录态头像兜底', () => {
+ it('未登录(跳过登录)态用中性人形图标,不拿状态文案取首字', () => {
+ // 状态名四语各不相同(未登录 / Not signed in / 未ログイン / 로그인하지 않음),
+ // 取首字会渲染成「未」/「N」这类无意义字符,所以这里必须走图标分支。
+ expect(source).toContain('const showNotSignedInGlyph = !user && isLocal;');
+ // 折叠 rail(36px 圆)与展开胶囊(27px 圆)两处兜底都要接上
+ expect(source).toMatch(
+ /showNotSignedInGlyph \? \(\s*\n\s*<UserRound aria-hidden="true" size=\{18\}/,
+ );
+ expect(source).toMatch(
+ /showNotSignedInGlyph \? \(\s*\n\s*<UserRound aria-hidden="true" size=\{15\}/,
+ );
+ });
+
+ it('已登录用户仍使用姓名首字兜底', () => {
+ expect(source).toContain(
+ "const displayName = user?.name ?? (isLocal ? t('settings.userProfile.local.name') : '');",
+ );
+ expect(source).toContain('const initial = displayName.charAt(0).toUpperCase();');
+ });
+});
+
describe('UserInfoSection — mobile download entry', () => {
it('uses the local Lucide Smartphone icon in a matching 22x22 capsule action', () => {
- expect(source).toContain("import { Flame, Shield, Smartphone } from 'lucide-react';");
+ expect(source).toContain(
+ "import { Flame, Shield, Smartphone, UserRound } from 'lucide-react';",
+ );
expect(source).toMatch(/'mobile-download-btn',\s*\n\s*'flex h-\[22px\] w-\[22px\]/);
expect(source).toContain("!isCollapsed && 'mr-1'");
expect(source).toContain('<Smartphone className="h-3 w-3" aria-hidden="true" />');
diff --git a/apps/desktop/src/renderer/components/login/LoginControls.tsx b/apps/desktop/src/renderer/components/login/LoginControls.tsx
index 87f49d254d..4402bbf949 100644
--- a/apps/desktop/src/renderer/components/login/LoginControls.tsx
+++ b/apps/desktop/src/renderer/components/login/LoginControls.tsx
@@ -777,6 +777,14 @@ function ConsentCheckGlyph() {
* radio(24 命中区,圈 20 r9 + 2px 描边,选中态对勾)+ 声明文字 20 Regular
* (login-control-text 双态),「服务条款」「隐私协议」为 Bold underline 内联链接。
* radio 态切换只变圈色(transition-colors ≤150ms,规则 7:无布局跳变)。
+ *
+ * **整行热区**(2026-07-29 拍板):680×40 整行都能点,点声明文字与行内空白都等于
+ * 点 radio——原来只有 24px 圈体可点,鼠标要瞄准一个小圆点。两类元素例外:
+ * 「服务条款」/「隐私协议」两个内联链接各自 stopPropagation(点它们只开链接,
+ * 不切勾选态),radio 自己也 stopPropagation(否则冒泡到行容器会二次 toggle,
+ * 净效果为不变)。行容器刻意不加 role/tabIndex:radio 仍是唯一的无障碍交互点
+ * (role="checkbox" + aria-labelledby 指向声明文字),整行点击只是鼠标增强,
+ * 不给读屏用户制造第二个语义相同的可聚焦节点。
*/
export function LoginConsentRow({
checked,
@@ -795,12 +803,15 @@ export function LoginConsentRow({
return (
<div
data-testid="login-consent-row"
- className="absolute left-0 flex items-center justify-center"
+ // select-none:整行可点后,连点会选中声明文字,拖选也会盖住勾选反馈
+ className="absolute left-0 flex select-none items-center justify-center"
+ onClick={onToggle}
style={{
top: CONSENT_ROW.y,
width: CONSENT_ROW.width,
height: CONSENT_ROW.height,
gap: CONSENT_ROW.gap,
+ cursor: 'pointer',
}}
>
<button
@@ -809,7 +820,11 @@ export function LoginConsentRow({
role="checkbox"
aria-checked={checked}
aria-labelledby="login-consent-statement"
- onClick={onToggle}
+ onClick={(event) => {
+ // 行容器已接同一个 onToggle:不拦住冒泡会切两次,视觉上等于点不动
+ event.stopPropagation();
+ onToggle();
+ }}
className="grid shrink-0 place-items-center border-0 bg-transparent p-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]"
style={{ width: hitSize, height: hitSize, cursor: 'pointer' }}
>
diff --git a/apps/desktop/src/renderer/components/login/LoginPage.tsx b/apps/desktop/src/renderer/components/login/LoginPage.tsx
index eb34f18b30..27730968f7 100644
--- a/apps/desktop/src/renderer/components/login/LoginPage.tsx
+++ b/apps/desktop/src/renderer/components/login/LoginPage.tsx
@@ -13,6 +13,7 @@ import type { AccountDeletionStatus, SocialProvider, VerificationKind } from '@c
import { isValidEmail } from '@cindy/auth-client';
import { cn } from '@/lib/utils';
+import { createLogger } from '@/lib/logger';
import { WindowControls } from '@/components/title-bar/WindowControls';
import { useLogin } from '@/hooks/useLogin';
import { endLoginFirstLaunchLightGate, loginFirstLaunchLightActive } from '@/hooks/useTheme';
@@ -88,6 +89,8 @@ const REGION_PILL_KEY: Partial<Record<typeof CURRENT_CINDY_REGION, string>> = {
dev: 'login.regionPill.dev',
};
+const log = createLogger('LoginPage');
+
/**
* LoginPage — 桌面登录(wave4 白底体系 + figma §4 组件库)。
*
@@ -124,24 +127,44 @@ export function LoginPage() {
}, []);
const isMac = window.electronAPI?.platform === 'darwin';
const [localModePending, setLocalModePending] = useState(false);
+ /* 会话切换进行中的**真值来源**。`localModePending` state 只用于按钮 disabled 视觉;
+ guard 一律读这个 ref —— 点击可能落在 setState 与 re-render 之间,那时事件处理器
+ 闭包里的 state 还是旧的 false,ref 不受渲染时机影响。 */
+ const localModePendingRef = useRef(false);
+ const markLocalModeTransition = (pending: boolean) => {
+ localModePendingRef.current = pending;
+ setLocalModePending(pending);
+ };
/**
- * 进入本地模式(「跳过登录」入口 + error 步逃生入口共用)。
+ * 进入未登录状态(「跳过登录」入口 + error 步逃生入口共用)。
*
- * 不过协议门(产品拍板 2026-07-27,推翻同年 07-24「游客也先同意协议」):跳过登录
- * 不创建账号、不上报任何数据,radio 未勾选也直接进主界面。因此这里也不调
- * persistPrivacyConsent——没有明示同意就保持采集闸关闭。
+ * **过协议门**(产品拍板 2026-07-29,推翻同年 07-27「跳过登录免协议门」):跳过登录
+ * 虽然不创建账号,用户仍在使用 Cindy 客户端,因此与个人账号登录同口径——radio
+ * 未勾选时先弹协议弹窗,同意后才进主界面。调用方一律用
+ * `requireConsent(..., { deferConsentPersist: true })` 包裹:同意记录由**本函数**
+ * 在会话切过去之后落,不能由 requireConsent 提前落(竞态原因见那里的注释)。
*/
const openLocalMode = async () => {
- if (isLoading || localModePending || !window.electronAPI?.authEnterLocal) return;
- setLocalModePending(true);
+ if (isLoading || localModePendingRef.current || !window.electronAPI?.authEnterLocal) return;
+ markLocalModeTransition(true);
try {
await window.electronAPI.authEnterLocal();
+ // 顺序是硬要求:先 enter-local(main 侧 isLocalMode() 转真)再落同意,这样
+ // acceptPrivacyConsent 广播出来的 allowed 恒为 false,TapDB 不会被拉起来发
+ // device_login。反过来会开出一个真实的上报窗口(codex 审查 P1,#907)。
+ persistPrivacyConsent();
// The auth state event normally redirects through GuestRoute. Keep the
// transition deterministic when the IPC response wins that race.
window.location.hash = '#/';
+ } catch (error) {
+ // 两个调用点都是 requireConsent(() => void openLocalMode()):抛出去没人接,
+ // 会变成 unhandled rejection。IPC 失败(main 未就绪/通道异常)时停在登录页
+ // 就是正确兜底——用户可重试或改走正常登录;这里只记日志,不自造错误 UI
+ // (登录页的 errorCode 归 main 的 loginFlowState 所有,renderer 不旁路写)。
+ log.error('enter not-signed-in session failed', error);
} finally {
- setLocalModePending(false);
+ markLocalModeTransition(false);
}
};
@@ -152,18 +175,21 @@ export function LoginPage() {
/* ── 协议同意链路(consent PR):radio 状态 + 未勾选拦截弹窗 + 同意后续接。
过门点(产品拍板 2026-07-24 二次):手机号提交、邮箱提交(discover 前)、
- method-choice 个人行发码、社交圆钮(Apple/Google/未来微信)——个人**账号**
- 登录一律先同意协议再发起,包括仅触发方式查询的 email discover(拍板压过
- 审查侧「discover 无副作用可放行」的建议)。豁免:显式企业 SSO 入口
- (SSO 圆钮、组织标识提交、method-choice sso 行)+ 跳过登录/本地模式
- (2026-07-27 拍板,见 openLocalMode)。pending 动作只存 renderer 本地
- (不进 main loginFlowState;规则 9:分支全部代码状态机化)。 ── */
+ method-choice 个人行发码、社交圆钮(Apple/Google/未来微信),以及**跳过登录**
+ (面板内文字按钮 + error 步逃生入口;2026-07-29 拍板恢复,推翻 07-27 的免门
+ 结论,见 openLocalMode)——个人链路一律先同意协议再发起,包括仅触发方式
+ 查询的 email discover(拍板压过审查侧「discover 无副作用可放行」的建议)。
+ 豁免仅限显式企业 SSO 入口(SSO 圆钮、组织标识提交、method-choice sso 行)。
+ pending 动作只存 renderer 本地(不进 main loginFlowState;规则 9:分支全部
+ 代码状态机化)。 ── */
const [consentAccepted, setConsentAccepted] = useState(false);
const [consentDialogOpen, setConsentDialogOpen] = useState(false);
// pending 带开门时刻快照,同意时复验防陈旧续接(codex 审查 P1;consentGate 单测)
const pendingConsentAction = useRef<{
action: () => void;
stamp: ConsentStamp;
+ // true = 同意时不在弹窗回调里落同意记录,由 action 自己落(见 requireConsent)
+ deferConsentPersist: boolean;
} | null>(null);
/* 把「用户明示同意《隐私政策》」这个事实落到 main。
@@ -180,15 +206,39 @@ export function LoginPage() {
}
};
- const requireConsent = (action: () => void) => {
+ /**
+ * @param options.deferConsentPersist
+ * true = 本次放行**不**在这里落同意记录,交给 action 自己在恰当时刻落。
+ * 目前只有跳过登录用它,原因是一条真实竞态(codex 审查 P1,#907):
+ * `acceptPrivacyConsent` 的 IPC handler 会同步 broadcastSettingsChange(),而
+ * `allowed = isAnalyticsAllowed() && !authManager.isLocalMode()`。若在
+ * `auth:enter-local` 之前落同意,那一刻 isLocalMode() 还是 false → 广播
+ * allowed:true → renderer 的 tapdbClient 立即 initSdk()(isInitDeviceLogin
+ * 会当场发出 device_login),等 enter-local 完成再广播 allowed:false 已经晚了。
+ * 于是「未登录态不上报」这条承诺在正式包上会被破一个窗口。让 openLocalMode
+ * 先切会话、再落同意即可关掉这个窗口(此时 allowed 恒为 false)。
+ */
+ const requireConsent = (action: () => void, options?: { deferConsentPersist?: boolean }) => {
+ /* 会话切换进行中一律不接新的过门动作(codex 审查 P1 第二条,#907)。
+ `auth:enter-local` 的 handler 要 await waitForSessionInvalidation() 与
+ teardownAuthAccountBoundary(),这是一个真实可观测的窗口;窗口里 isLoading
+ 仍为 false(enter-local 不走 loginFlow),而弹窗已关、consentAccepted 已为 true,
+ 于是邮箱 / 社交等入口仍可点 —— 它们走的是 deferConsentPersist=false 分支,会在
+ main 还没转成 local 时立刻 persist,再次把 allowed:true 广播给 TapDB。
+ 在这里单点收口而不是给每个控件补 disabled:窗口通常只有几十毫秒,给全部控件
+ 加 disabled 视觉会换来一次可见闪变(§规则 7:无视觉跳变),而行为层 guard 已经
+ 杜绝了 persist 与派发 —— 会话都在切了,任何登录动作本来就该作废。 */
+ if (localModePendingRef.current) return;
+ const deferConsentPersist = options?.deferConsentPersist === true;
if (consentAccepted) {
- persistPrivacyConsent();
+ if (!deferConsentPersist) persistPrivacyConsent();
action();
return;
}
pendingConsentAction.current = {
action,
stamp: makeConsentStamp(loginState?.step, isLoading, loginState?.step === 'completed'),
+ deferConsentPersist,
};
setConsentDialogOpen(true);
};
@@ -196,10 +246,13 @@ export function LoginPage() {
// 同意 = 自动勾选 radio + 续接用户刚才点的那条登录链路(产品拍板)
setConsentAccepted(true);
setConsentDialogOpen(false);
- // 点了弹窗上的「同意」即为明示同意,与下面 pending 是否还能续接无关。
- persistPrivacyConsent();
const pending = pendingConsentAction.current;
pendingConsentAction.current = null;
+ // 点了弹窗上的「同意」即为明示同意,与下面 pending 是否还能续接无关——唯一例外
+ // 是 deferConsentPersist 的链路(跳过登录):它必须等会话切过去再落,否则会开出
+ // 上面注释里的上报窗口。代价是 pending 因状态漂移被丢弃时这次同意不落盘,
+ // 属安全一侧(漏记 = 不采集),且 radio 已勾选,下次任一过门入口会补上。
+ if (!pending?.deferConsentPersist) persistPrivacyConsent();
if (!pending) return;
// 复验:弹窗期间 auth 状态被异步推进(登录完成/步骤切换/in-flight)则丢弃动作
const current = makeConsentStamp(loginState?.step, isLoading, loginState?.step === 'completed');
@@ -364,6 +417,9 @@ export function LoginPage() {
}, [errorCode, t]);
const reset = () => {
+ // error 步的「重试」与 back 都走这里,而 error 步同时挂着跳过登录逃生入口:
+ // 会话已经在切了就别再把状态机拨回去(同 requireConsent 里那道 guard 的理由)。
+ if (localModePendingRef.current) return;
clearError();
setIdentifierFormatError(null);
void dispatch({ type: 'reset' });
@@ -402,6 +458,9 @@ export function LoginPage() {
const submitSsoOrg = (event: FormEvent) => {
event.preventDefault();
+ // 企业 SSO 豁免协议门,所以拿不到 requireConsent 里那道会话切换 guard;它会真的
+ // 派发,切换期间必须自己挡住(否则 main 会同时处理 enter-local 与 SSO 登录)。
+ if (localModePendingRef.current) return;
const value = ssoOrg.trim();
if (!value) return;
// 组织区域先静默发现;仅当结果与安装包区域不一致时,main 状态机进入
@@ -466,12 +525,14 @@ export function LoginPage() {
</form>
{/* 「跳过登录」= 面板内文字按钮(新稿 705:1068 容器 680×60 @y430,取代旧游客
圆钮;LoginSkipEntry ≠ LoginTextLink,见该组件注释):接既有 local mode
- 链路,不过协议门(2026-07-27 拍板)。槽位在 error_text(380..430)之下、
+ 链路,过协议门(2026-07-29 拍板)。槽位在 error_text(380..430)之下、
与其首尾相接,两者同时可见互不重叠;error 出现不推移本入口(均 absolute)。 */}
<LoginSkipEntry
testId="login-skip-entry"
disabled={isLoading || localModePending}
- onClick={() => void openLocalMode()}
+ onClick={() =>
+ requireConsent(() => void openLocalMode(), { deferConsentPersist: true })
+ }
>
{t('login.localModeEntry')}
</LoginSkipEntry>
@@ -511,8 +572,9 @@ export function LoginPage() {
isLoading={isLoading}
onClick={() => {
// SC-SOC-7: in-flight 期间 no-op(行为层 guard,无 disabled 视觉回填)。
- // 企业 SSO 豁免协议门(产品拍板),不过 requireConsent。
- if (isLoading) return;
+ // 企业 SSO 豁免协议门(产品拍板),不过 requireConsent —— 所以会话切换
+ // 期间要自己挡:那道 guard 在 requireConsent 里,这条路径绕过了它。
+ if (isLoading || localModePendingRef.current) return;
clearError();
setSsoOrgMode(true);
}}
@@ -979,7 +1041,8 @@ export function LoginPage() {
data-testid="login-local-mode"
type="button"
disabled={localModePending || isLoading}
- onClick={() => void openLocalMode()}
+ // error 步逃生入口与面板内文字按钮同口径:过协议门(2026-07-29 拍板)
+ onClick={() => requireConsent(() => void openLocalMode(), { deferConsentPersist: true })}
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 }}
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.tsx
index 89c42d54a9..ed00c3b4a6 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
@@ -142,6 +142,27 @@ describe('协议同意行', () => {
expect(radio.getAttribute('aria-checked')).toBe('false');
});
+ // 2026-07-29:热区从 24px 圈体扩到 680×40 整行(点小圆点太难瞄)
+ it('点整行(声明文字所在容器)同样切换勾选态,且只切一次', async () => {
+ mount(await identifierState('providers:cn-social'));
+ const row = screen.getByTestId('login-consent-row');
+ const radio = screen.getByTestId('login-consent-radio');
+ expect(radio.getAttribute('aria-checked')).toBe('false');
+ fireEvent.click(row);
+ expect(radio.getAttribute('aria-checked')).toBe('true');
+ fireEvent.click(row);
+ expect(radio.getAttribute('aria-checked')).toBe('false');
+ });
+
+ it('点 radio 不会因冒泡到行容器而二次 toggle(净效果必须是切换)', async () => {
+ mount(await identifierState('providers:cn-social'));
+ const radio = screen.getByTestId('login-consent-radio');
+ // radio 是行容器的子节点:少了 stopPropagation 就会 toggle 两次、看起来点不动
+ expect(screen.getByTestId('login-consent-row').contains(radio)).toBe(true);
+ fireEvent.click(radio);
+ expect(radio.getAttribute('aria-checked')).toBe('true');
+ });
+
it('行内「服务条款」「隐私协议」链接 → openExternal 打开国内区 URL,且不切换 radio', async () => {
mount(await identifierState('providers:cn-social'));
fireEvent.click(screen.getByTestId('login-consent-terms-link'));
@@ -216,24 +237,165 @@ describe('consent guard(未勾选拦截个人登录链路)', () => {
});
});
- // 2026-07-27 拍板(推翻同年 07-24「游客也先过协议门」):跳过登录不创建账号、不上报
- // 数据,radio 未勾选也直接进本地模式,不弹协议弹窗。旧游客圆钮入口已删除。
- it('「跳过登录」未勾选也豁免协议门 → 无弹窗,直接进入本地模式(authEnterLocal)', async () => {
+ // 2026-07-29 拍板(推翻同年 07-27「跳过登录免协议门」):不登录账号也是在用 Cindy
+ // 客户端,跳过登录与个人账号登录同口径先过协议门。旧游客圆钮入口已删除。
+ it('「跳过登录」未勾选 → 弹窗且不进本地模式;同意 → 续接 authEnterLocal', async () => {
+ mount(await identifierState('providers:cn-social'));
+ expect(screen.getByTestId('login-consent-radio').getAttribute('aria-checked')).toBe('false');
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-skip-entry'));
+ });
+ expect(screen.getByTestId('login-consent-dialog')).toBeTruthy();
+ expect(authEnterLocal).not.toHaveBeenCalled();
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-consent-agree'));
+ });
+ expect(authEnterLocal).toHaveBeenCalledTimes(1);
+ });
+
+ it('「跳过登录」不同意 → 停在登录页,不进本地模式', async () => {
mount(await identifierState('providers:cn-social'));
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-skip-entry'));
+ });
+ fireEvent.click(screen.getByTestId('login-consent-disagree'));
+ expect(screen.queryByTestId('login-consent-dialog')).toBeNull();
+ expect(authEnterLocal).not.toHaveBeenCalled();
expect(screen.getByTestId('login-consent-radio').getAttribute('aria-checked')).toBe('false');
+ });
+
+ it('已勾选后点「跳过登录」→ 直接进本地模式并写入「已同意隐私政策」记录', async () => {
+ mount(await identifierState('providers:cn-social'));
+ fireEvent.click(screen.getByTestId('login-consent-radio'));
await act(async () => {
fireEvent.click(screen.getByTestId('login-skip-entry'));
});
expect(screen.queryByTestId('login-consent-dialog')).toBeNull();
expect(authEnterLocal).toHaveBeenCalledTimes(1);
+ expect(acceptPrivacyConsent).toHaveBeenCalled();
+ });
+
+ /* 顺序回归(codex 审查 P1,#907):同意记录必须落在 auth:enter-local **之后**。
+ acceptPrivacyConsent 的 handler 会同步广播 allowed,而 allowed 的算式是
+ isAnalyticsAllowed() && !isLocalMode() —— 提前落同意时 isLocalMode() 还是
+ false,广播 allowed:true 会让 tapdbClient 当场 initSdk() 并发出 device_login,
+ 与「未登录态不上报」直接冲突。两个入口、勾选与弹窗两条路径都要锁。 */
+ const expectConsentPersistedAfterEnterLocal = () => {
+ expect(authEnterLocal).toHaveBeenCalledTimes(1);
+ expect(acceptPrivacyConsent).toHaveBeenCalledTimes(1);
+ expect(authEnterLocal.mock.invocationCallOrder[0]).toBeLessThan(
+ acceptPrivacyConsent.mock.invocationCallOrder[0],
+ );
+ };
+
+ it('已勾选 + 面板内入口:同意记录落在 enter-local 之后(不给 TapDB 开窗口)', async () => {
+ mount(await identifierState('providers:cn-social'));
+ fireEvent.click(screen.getByTestId('login-consent-radio'));
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-skip-entry'));
+ });
+ expectConsentPersistedAfterEnterLocal();
});
- it('「跳过登录」不写入「已同意隐私政策」记录(未明示同意 → 采集闸保持关闭)', async () => {
+ it('弹窗同意 + 面板内入口:同意记录同样落在 enter-local 之后', async () => {
mount(await identifierState('providers:cn-social'));
await act(async () => {
fireEvent.click(screen.getByTestId('login-skip-entry'));
});
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-consent-agree'));
+ });
+ expectConsentPersistedAfterEnterLocal();
+ });
+
+ /* 并发窗口回归(codex 审查 P1 第二条,#907):auth:enter-local 的 handler 要 await
+ waitForSessionInvalidation() + teardownAuthAccountBoundary(),这段窗口里 isLoading
+ 仍是 false、弹窗已关、consentAccepted 已为 true,于是邮箱 / 社交等入口仍可点。
+ 它们走 deferConsentPersist=false 分支,会在 main 还没转成 local 时立刻 persist,
+ 把 allowed:true 广播给 TapDB —— 必须一个都不放过。 */
+ it('会话切换窗口内点社交圆钮 → 不派发、不落同意;切换完成后只落 skip 自己那一次', async () => {
+ let releaseEnterLocal: () => void = () => undefined;
+ authEnterLocal.mockImplementationOnce(
+ () =>
+ new Promise((resolve) => {
+ releaseEnterLocal = () => resolve({ mode: 'local' });
+ }),
+ );
+ mount(await identifierState('providers:cn-social'));
+ fireEvent.click(screen.getByTestId('login-consent-radio'));
+ // 不 await:enter-local 故意悬挂在窗口里
+ fireEvent.click(screen.getByTestId('login-skip-entry'));
+ expect(authEnterLocal).toHaveBeenCalledTimes(1);
+ expect(acceptPrivacyConsent).not.toHaveBeenCalled();
+
+ // 窗口内点其它过门入口:一律作废
+ fireEvent.click(screen.getByTestId('login-social-apple'));
+ expect(loginHook.value.dispatch).not.toHaveBeenCalled();
expect(acceptPrivacyConsent).not.toHaveBeenCalled();
+ // 豁免协议门的企业 SSO 圆钮同样不该在切换中把视图拨走
+ fireEvent.click(screen.getByTestId('login-social-sso'));
+ expect(screen.queryByTestId('login-panel-sso-org')).toBeNull();
+
+ await act(async () => {
+ releaseEnterLocal();
+ });
+ // 只有 skip 自己那一次同意记录,且它落在 enter-local 之后
+ expect(acceptPrivacyConsent).toHaveBeenCalledTimes(1);
+ expect(authEnterLocal.mock.invocationCallOrder[0]).toBeLessThan(
+ acceptPrivacyConsent.mock.invocationCallOrder[0],
+ );
+ });
+
+ it('其它个人链路不受影响:社交圆钮仍在派发前先落同意记录', async () => {
+ mount(await identifierState('providers:cn-social'));
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-social-apple'));
+ });
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-consent-agree'));
+ });
+ // 账号登录链路登录后 isLocalMode() 为 false、allowed 本就该为真,顺序无需延后
+ expect(acceptPrivacyConsent).toHaveBeenCalledTimes(1);
+ expect(authEnterLocal).not.toHaveBeenCalled();
+ });
+
+ /* error 步 footer 的逃生入口(login-local-mode)与面板内入口共用 openLocalMode,
+ 但它是「登录服务不可用时的唯一出路」,协议门接错会把这条路堵死。error 步不渲染
+ 协议行(radio 只在 identifier 主视图),所以这里只能靠弹窗断言。 */
+ const errorState = {
+ step: 'error',
+ code: 'NETWORK_ERROR',
+ recoverTo: 'identifier',
+ } as unknown as AuthFlowState;
+
+ it('error 步逃生入口未勾选 → 弹协议弹窗;同意 → 进本地模式并写同意记录', async () => {
+ mount(errorState, { errorCode: 'NETWORK_ERROR' });
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-local-mode'));
+ });
+ expect(screen.getByTestId('login-consent-dialog')).toBeTruthy();
+ expect(authEnterLocal).not.toHaveBeenCalled();
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-consent-agree'));
+ });
+ expect(authEnterLocal).toHaveBeenCalledTimes(1);
+ expect(acceptPrivacyConsent).toHaveBeenCalledTimes(1);
+ // 顺序同面板内入口:先切会话再落同意(见下方顺序回归组的注释)
+ expect(authEnterLocal.mock.invocationCallOrder[0]).toBeLessThan(
+ acceptPrivacyConsent.mock.invocationCallOrder[0],
+ );
+ });
+
+ it('error 步逃生入口不同意 → 关弹窗、留在 error 屏,不进本地模式', async () => {
+ mount(errorState, { errorCode: 'NETWORK_ERROR' });
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-local-mode'));
+ });
+ fireEvent.click(screen.getByTestId('login-consent-disagree'));
+ expect(screen.queryByTestId('login-consent-dialog')).toBeNull();
+ expect(authEnterLocal).not.toHaveBeenCalled();
+ // 逃生入口本身必须还在(不同意不等于把这条唯一出路关掉)
+ expect(screen.getByTestId('login-local-mode')).toBeTruthy();
});
it('旧游客圆钮入口已删除(圆钮行不再渲染 login-social-guest)', async () => {
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.tsx
index 2938c111c6..b4b4d88e9e 100644
--- 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.tsx
@@ -150,15 +150,21 @@ describe('Global 构建变体:登录改版四件事同样生效', () => {
expect(screen.getByTestId('login-consent-row').style.top).toBe('642px');
});
- it('未勾选点「跳过登录」→ 无协议弹窗,直接进本地模式,且不写同意记录', async () => {
+ // 2026-07-29 拍板:跳过登录恢复过协议门(Global 构建同口径,不按区域分流)
+ 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(screen.getByTestId('login-consent-dialog')).toBeTruthy();
+ expect(authEnterLocal).not.toHaveBeenCalled();
expect(acceptPrivacyConsent).not.toHaveBeenCalled();
+ await act(async () => {
+ fireEvent.click(screen.getByTestId('login-consent-agree'));
+ });
+ expect(authEnterLocal).toHaveBeenCalledTimes(1);
+ expect(acceptPrivacyConsent).toHaveBeenCalled();
});
it('其它个人登录链路的协议门未被误摘:未勾选点 Apple 圆钮仍先弹协议弹窗', async () => {
diff --git a/apps/desktop/src/renderer/components/settings/UserProfileCard.tsx b/apps/desktop/src/renderer/components/settings/UserProfileCard.tsx
index 64babc885a..0d73944461 100644
--- a/apps/desktop/src/renderer/components/settings/UserProfileCard.tsx
+++ b/apps/desktop/src/renderer/components/settings/UserProfileCard.tsx
@@ -1,6 +1,6 @@
import { useEffect, useId, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { Building2, Copy, Pencil } from 'lucide-react';
+import { Building2, Copy, Pencil, UserRound } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
import { cn } from '@/lib/utils';
@@ -66,8 +66,10 @@ export function UserProfileCard() {
'border border-[var(--settings-profile-card-border)]',
)}
>
- <div className="flex h-[52px] w-[52px] shrink-0 items-center justify-center rounded-full border border-[var(--settings-profile-card-border)] bg-[var(--settings-profile-avatar-bg)] text-18 font-medium text-[var(--settings-profile-avatar-text)]">
- L
+ {/* 未登录态没有身份可展示:用中性人形图标,不取文案首字(会渲染成「未」/「N」
+ 这类无意义字符,且四语各不相同)。 */}
+ <div className="flex h-[52px] w-[52px] shrink-0 items-center justify-center rounded-full border border-[var(--settings-profile-card-border)] bg-[var(--settings-profile-avatar-bg)] text-[var(--settings-profile-avatar-text)]">
+ <UserRound aria-hidden="true" size={22} strokeWidth={1.75} />
</div>
<div className="min-w-0 flex-1">
<p className="text-18 font-medium text-[var(--settings-profile-name)]">
diff --git a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
index 75438cd1c7..b0f4c76d2f 100644
--- a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
-import { Flame, Shield, Smartphone } from 'lucide-react';
+import { Flame, Shield, Smartphone, UserRound } from 'lucide-react';
import { cn } from '@/lib/utils';
import { useAuth } from '@/contexts/AuthContext';
@@ -46,6 +46,9 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
if (!user && !isLocal) return null;
const initial = displayName.charAt(0).toUpperCase();
+ // 未登录(跳过登录)态没有身份可展示:头像兜底用中性人形图标,而不是拿状态文案
+ // 取首字——那会渲染成「未」/「N」这类无意义字符,且四语各不相同。
+ const showNotSignedInGlyph = !user && isLocal;
const appDisplayVersion = window.electronAPI.appDisplayVersion;
const appDisplayVersionDetail = window.electronAPI.appDisplayVersionDetail;
// 版本行的区域前缀。「哪些区域要标」只有 CINDY_REGION_CODE 一个事实源(issue
@@ -131,7 +134,11 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
'border border-sidebar-border bg-sidebar-item-hover text-base font-medium text-foreground',
)}
>
- {initial}
+ {showNotSignedInGlyph ? (
+ <UserRound aria-hidden="true" size={18} strokeWidth={1.75} />
+ ) : (
+ initial
+ )}
</div>
)}
{isCanary && (
@@ -199,7 +206,11 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
'border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] text-[14px] font-medium text-[var(--sidebar-user-card-text)]',
)}
>
- {initial}
+ {showNotSignedInGlyph ? (
+ <UserRound aria-hidden="true" size={15} strokeWidth={1.75} />
+ ) : (
+ initial
+ )}
</div>
)}
{isCanary && (
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 95d39f5a3b..c8a98eb7bf 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -582,11 +582,11 @@
"fallbackName": "User",
"avatarAlt": "{{name}} avatar",
"local": {
- "exitFailed": "Failed to exit local mode, please try again",
- "name": "Local mode",
+ "exitFailed": "Failed to exit the not-signed-in state, please try again",
+ "name": "Not signed in",
"description": "Data stays on this device without Cindy account services",
"signIn": "Sign in to Cindy",
- "exit": "Exit local mode"
+ "exit": "Exit the not-signed-in state"
},
"copyUserId": {
"action": "Copy user ID",
@@ -756,7 +756,7 @@
"serviceSource": {
"label": "Voice service",
"hint": "Uses the Cindy voice service by default. You can instead connect a realtime ASR service with separate voice credentials.",
- "localHint": "Local mode does not use Cindy account services; connect a realtime ASR service with separate voice credentials.",
+ "localHint": "Cindy account services are unavailable while not signed in; connect a realtime ASR service with separate voice credentials.",
"ariaLabel": "Voice service source",
"options": {
"cindy": "Cindy official service",
@@ -3137,7 +3137,7 @@
"ssoRequired": "This organization requires SSO sign-in",
"ssoEntry": "Sign in with enterprise SSO",
"localModeEntry": "Skip Sign-In",
- "localModeOpening": "Opening local mode…",
+ "localModeOpening": "Skipping sign-in…",
"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.json
index fb4e86734e..7ad5af3030 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -582,11 +582,11 @@
"fallbackName": "ユーザー",
"avatarAlt": "{{name}} のアバター",
"local": {
- "exitFailed": "ローカルモードの終了に失敗しました。もう一度お試しください",
- "name": "ローカルモード",
+ "exitFailed": "未ログイン状態の終了に失敗しました。もう一度お試しください",
+ "name": "未ログイン",
"description": "データはこの端末だけに保存され、Cindy アカウントサービスは使用しません",
"signIn": "Cindy にログイン",
- "exit": "ローカルモードを終了"
+ "exit": "未ログイン状態を終了"
},
"copyUserId": {
"action": "ユーザー ID をコピー",
@@ -756,7 +756,7 @@
"serviceSource": {
"label": "音声サービス",
"hint": "既定では Cindy 音声サービスを使用します。リアルタイム ASR 対応サービスと専用の音声認証情報に切り替えることもできます。",
- "localHint": "ローカルモードでは Cindy アカウントサービスを使用しません。リアルタイム ASR 対応サービスと専用の音声認証情報を設定してください。",
+ "localHint": "未ログイン状態では Cindy アカウントサービスを使用しません。リアルタイム ASR 対応サービスと専用の音声認証情報を設定してください。",
"ariaLabel": "音声サービスソースの選択",
"options": {
"cindy": "Cindy 公式サービス",
@@ -3136,7 +3136,7 @@
"ssoRequired": "この組織は SSO ログインが必要です",
"ssoEntry": "企業 SSO でサインイン",
"localModeEntry": "ログインをスキップ",
- "localModeOpening": "ローカルモードを開いています…",
+ "localModeOpening": "ログインをスキップしています…",
"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.json
index 60f33208f8..c0c454cc7d 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -582,11 +582,11 @@
"fallbackName": "사용자",
"avatarAlt": "{{name}} 아바타",
"local": {
- "exitFailed": "로컬 모드를 종료하지 못했습니다. 다시 시도해 주세요",
- "name": "로컬 모드",
+ "exitFailed": "로그인하지 않은 상태를 종료하지 못했습니다. 다시 시도해 주세요",
+ "name": "로그인하지 않음",
"description": "데이터는 이 기기에만 저장되며 Cindy 계정 서비스를 사용하지 않습니다",
"signIn": "Cindy 로그인",
- "exit": "로컬 모드 종료"
+ "exit": "로그인하지 않은 상태 종료"
},
"copyUserId": {
"action": "사용자 ID 복사",
@@ -756,7 +756,7 @@
"serviceSource": {
"label": "음성 서비스",
"hint": "기본적으로 Cindy 음성 서비스를 사용합니다. 실시간 ASR 지원 서비스와 별도의 음성 인증 정보로 전환할 수도 있습니다.",
- "localHint": "로컬 모드에서는 Cindy 계정 서비스를 사용하지 않습니다. 실시간 ASR 지원 서비스와 별도의 음성 인증 정보를 설정하세요.",
+ "localHint": "로그인하지 않은 상태에서는 Cindy 계정 서비스를 사용하지 않습니다. 실시간 ASR 지원 서비스와 별도의 음성 인증 정보를 설정하세요.",
"ariaLabel": "음성 서비스 소스 선택",
"options": {
"cindy": "Cindy 공식 서비스",
@@ -3136,7 +3136,7 @@
"ssoRequired": "이 조직은 SSO 로그인이 필요합니다",
"ssoEntry": "기업 SSO로 로그인",
"localModeEntry": "로그인 건너뛰기",
- "localModeOpening": "로컬 모드를 여는 중…",
+ "localModeOpening": "로그인을 건너뛰는 중…",
"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.json
index 18444bd36d..b997982fa0 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -582,11 +582,11 @@
"fallbackName": "用户",
"avatarAlt": "{{name}} 的头像",
"local": {
- "exitFailed": "退出本地模式失败,请重试",
- "name": "本地模式",
+ "exitFailed": "退出未登录状态失败,请重试",
+ "name": "未登录",
"description": "数据仅保存在本机,不使用 Cindy 账号服务",
"signIn": "登录 Cindy",
- "exit": "退出本地模式"
+ "exit": "退出未登录状态"
},
"copyUserId": {
"action": "复制用户 ID",
@@ -756,7 +756,7 @@
"serviceSource": {
"label": "语音服务",
"hint": "默认使用 Cindy 语音服务;也可以连接支持实时 ASR 的服务,并使用独立的语音凭证。",
- "localHint": "本地模式不使用 Cindy 账号服务;请连接支持实时 ASR 的服务并配置独立语音凭证。",
+ "localHint": "未登录状态不使用 Cindy 账号服务;请连接支持实时 ASR 的服务并配置独立语音凭证。",
"ariaLabel": "语音服务来源选择",
"options": {
"cindy": "Cindy 官方服务",
@@ -3136,7 +3136,7 @@
"ssoRequired": "该企业要求通过 SSO 登录",
"ssoEntry": "使用企业 SSO 登录",
"localModeEntry": "跳过登录",
- "localModeOpening": "正在打开本地模式…",
+ "localModeOpening": "正在跳过登录…",
"localModeDescription": "无需 Cindy 账号,数据保存在本机。云模型、跨设备与市场服务不可用。",
"consentStatement": "我已阅读并同意 <terms>服务条款</terms> 和 <privacy>隐私协议</privacy>",
"consentDialog": {
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 41098f80e4..2fbfc25988 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -983,18 +983,24 @@ 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` 步桌面另有面板下方 footer 的「跳过登录」**逃生入口**(登录服务不可用时仍能进本地模式,同样不过协议门) | 成功无面板(进主界面);error = `LoginTitleBlock` + `LoginPrimaryButton`(重试)+ `LoginErrorText` + footer 本地模式按钮(桌面);browser 回调页 `oauthResultPage`(系统浏览器独立 HTML,main 侧内联常量,色值与 `--login-callback-*` token 同源——renderer CSS var 不可达,改值需两处同步) |
+| `completed` / `error` | 登录成功 / 失败(含 browser 回调终态页);`error` 步桌面另有面板下方 footer 的「跳过登录」**逃生入口**(登录服务不可用时仍能进未登录状态,与面板内入口同口径**过协议门**——2026-07-29 拍板) | 成功无面板(进主界面);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` 屏的协议同意行是一道**发起前拦截**——未勾选时点过门入口先弹服务条款 / 隐私协议弹窗,同意后续接原动作;同意即写入统计采集同意。
+**协议门(consent gate)过门点与豁免(2026-07-29 更新)**:`identifier` 屏的协议同意行是一道**发起前拦截**——未勾选时点过门入口先弹服务条款 / 隐私协议弹窗,同意后续接原动作;同意即写入统计采集同意。
| | 入口 |
|---|---|
-| **过门**(个人**账号**登录一律先同意) | 手机号提交、邮箱提交(含仅查方式的 discover)、`method-choice` 个人行发码、社交圆钮(Apple / Google / 未来微信) |
-| **豁免** | ① 显式企业 SSO 入口(SSO 圆钮、组织标识提交、`method-choice` sso 行);② **「跳过登录」/ 本地模式**(面板内常驻入口 + 桌面 `error` 步 footer 逃生口)——2026-07-27 拍板 |
+| **过门**(个人链路一律先同意) | 手机号提交、邮箱提交(含仅查方式的 discover)、`method-choice` 个人行发码、社交圆钮(Apple / Google / 未来微信)、**「跳过登录」**(面板内常驻入口 + 桌面 `error` 步 footer 逃生口)——2026-07-29 拍板 |
+| **豁免** | 显式企业 SSO 入口(SSO 圆钮、组织标识提交、`method-choice` sso 行) |
-「跳过登录」豁免的口径:不创建账号、不上报数据,因此 **radio 未勾选也直接进主界面,且不写入统计采集同意**(没有明示同意就保持采集闸关闭)。除此之外其它个人链路的协议门与协议 UI(radio 四态、弹窗小按钮)**均不变**;企业 SSO 豁免同样不变。
+「跳过登录」过门的口径(2026-07-29 拍板,**推翻 07-27 的免门结论**):不登录账号也是在使用 Cindy 客户端,因此与个人账号登录同口径——未勾选时先弹协议弹窗,同意后才进未登录状态,并写入统计采集同意(是否真的上报另由 main 侧闸决定:`analyticsSettingsService` 对本地会话一律 `!isLocalMode()` 不放行)。协议 UI(radio 四态、弹窗小按钮)与企业 SSO 豁免均不变。
+
+> **实现约束(合规,勿改顺序)**:这条链路上「同意记录」必须落在 `auth:enter-local` **之后**,与其它过门点(放行时刻即落)不同。原因是 `acceptPrivacyConsent` 的 IPC handler 会同步广播 `allowed = isAnalyticsAllowed() && !isLocalMode()`——提前落同意时 `isLocalMode()` 尚为 false,广播出的 `allowed:true` 会让 renderer 的 TapDB 当场 `initSdk()` 并发出 `device_login`,等 `enter-local` 完成再广播 `allowed:false` 已经晚了,「未登录态不上报」在正式包上就被破了一个窗口。落码为 `requireConsent(action, { deferConsentPersist: true })` + `openLocalMode` 自己在会话切换后落同意;顺序由 `LoginPage.consent.test.tsx` 的 `invocationCallOrder` 断言锁住(面板内入口与 `error` 步逃生口、勾选与弹窗两条路径都覆盖)。
+>
+> 同一条合规约束还要求**切换窗口内不接任何新动作**:`auth:enter-local` 的 handler 要 await `waitForSessionInvalidation()` 与 `teardownAuthAccountBoundary()`,这段窗口里 `isLoading` 仍为 false、协议弹窗已关且 radio 已勾选,邮箱 / 社交等入口仍可点——它们走「放行即落同意」分支,会在 main 还没转成 local 时再次广播 `allowed:true`。收口点是 `requireConsent` 顶部的 `localModePendingRef` guard(豁免协议门的企业 SSO 入口与 `error` 步 `reset` 另行自挡,因为它们绕过 `requireConsent`)。用**行为层 guard 而不是给每个控件加 disabled**:窗口通常只有几十毫秒,全量 disabled 会换来一次可见闪变(规则 7:无视觉跳变),而行为 guard 已杜绝 persist 与派发。guard 读 ref 而非 state——点击可能落在 `setState` 与 re-render 之间,那时闭包里的 state 还是旧值。
+
+**协议同意行整行热区(2026-07-29 拍板)**:命中区由 radio 的 24px 圈体扩到**整行 680×40**——点声明文字或行内空白都等于点 radio。例外两类:行内「服务条款」/「隐私协议」链接各自 `stopPropagation`(只开链接、不切勾选态),radio 自身也 `stopPropagation`(否则冒泡到行容器二次 toggle,净效果为点不动)。行容器不加 `role` / `tabIndex`:radio 仍是唯一无障碍交互点(`role="checkbox"` + `aria-labelledby` 指向声明文字),整行点击只是鼠标增强;整行 `select-none`,避免连点选中文字盖住勾选反馈。
**注销状态浮层气泡(figma 678:1075「注销状态」组件集,2026-07-26 定形)**:账号注销状态**不在登录面板内**,而是登录屏根容器的 absolute 浮层——历史实现曾把它放在登录皮容器(`LoginStage`)的文档流首子位置,被 `absolute; top:0` 的不透明登录面板 100% 覆盖(`pending` / `processing` / `completed` 三态全中,修复前证据见 `docs/design-previews/deletion-banner-repro/`);**改回面板内即重现该缺陷,不得回退**。
diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.md
index 6e8dd4c5a0..ca070bd162 100644
--- a/docs/design-rules/design-decision-log.md
+++ b/docs/design-rules/design-decision-log.md
@@ -12,6 +12,32 @@
## 2026-07
+- **07-29** **「跳过登录」恢复过协议门 + 协议行整行热区 + 未登录态命名(拍板人 = 用户)**——
+ 本条**推翻** 07-27 记录里的「跳过登录免协议门」(桌面侧;那条其余内容——入口形态换文字按钮、
+ 面板 440→500、圆钮行删游客——继续有效)。三项决策:
+ (1) **跳过登录过协议门**:不登录账号也是在使用 Cindy 客户端,面板内「跳过登录」文字按钮与
+ 桌面 `error` 步 footer 逃生口都改回经 `requireConsent`——未勾选先弹服务条款 / 隐私协议弹窗,
+ 同意后才进未登录状态,并写入统计采集同意。是否真的上报仍由 main 侧闸决定
+ (`analyticsSettingsService` 对本地会话一律 `!isLocalMode()` 不放行,该逻辑不动)。
+ ⚠️ 合规实现约束(#907 review 引出,勿改顺序):这条链路的同意记录必须落在
+ `auth:enter-local` **之后**——`acceptPrivacyConsent` 会同步广播 `allowed`,提前落时
+ `isLocalMode()` 还是 false,`allowed:true` 会让 TapDB 当场 init 并发 `device_login`,
+ 把「未登录态不上报」破一个窗口。落码 = `deferConsentPersist` 选项 + `openLocalMode`
+ 自己落同意,顺序由 consent 测试的 `invocationCallOrder` 断言锁住。同批还要求切换窗口内
+ 不接任何新动作(`requireConsent` 顶部 `localModePendingRef` guard;企业 SSO 入口与
+ `error` 步 `reset` 因绕过 requireConsent 另行自挡),否则窗口里点邮箱 / 社交会走
+ 「放行即落同意」分支再次广播 `allowed:true`。取舍:用行为层 guard 而非给全部控件加
+ disabled(窗口只有几十毫秒,全量 disabled 会换来可见闪变)。
+ (2) **协议同意行整行可点**:热区由 radio 的 24px 圈体扩到整行 680×40(原来要瞄准一个小圆点);
+ 两个内联链接与 radio 自身 `stopPropagation`(前者只开链接,后者防冒泡二次 toggle),
+ 行容器不加 role / tabIndex(radio 仍是唯一无障碍交互点),整行 `select-none`。
+ (3) **未登录态改名**:应用内不再出现「本地模式」这个说法——账号状态名统一为「未登录」
+ (侧边栏账号胶囊、设置页资料卡、语音服务提示四语同步),动作名沿用「跳过登录」;
+ 未登录态头像不再取状态文案首字(会渲染成「未」/「N」)或写死「L」,改中性人形图标。
+ 代码内部标识(`AuthState mode='local'`、`authEnterLocal` IPC、data owner)不受影响,仍用 local。
+ 术语已登记 `not-signed-in` / `skip-sign-in` 两条 proposed(`i18n/glossary.json`)。
+ (→ `DESIGN.md §16` 协议门表 + 协议行整行热区条 / `LoginPage.consent.test.tsx`
+ 与 `LoginPage.region.harness.test.tsx` 的过门断言 / `userInfoSectionHover.test.ts` 头像契约)
- **07-29** **手机端功能区落位改回新稿标注值(拍板人 = 用户,依据 = 实机比例对照图)**——
本条**修正**下方 07-28 记录里「功能区落位保持 main 原值不动」那一句(该句作废,原记录
保留在册)。**背景**:07-28 剥离手机端跳过登录时,把功能区落位一并退回 main
diff --git a/docs/dev-rules/desktop-development.md b/docs/dev-rules/desktop-development.md
index 50975ec59e..52abdb7c24 100644
--- a/docs/dev-rules/desktop-development.md
+++ b/docs/dev-rules/desktop-development.md
@@ -15,7 +15,8 @@ pnpm restart:desktop:remote --region=cn
```
Desktop 连接的是你自己的 Cindy 云端账号(remote)。这与登录页中免 Cindy 账号的
-「本地模式」(无需账号即可使用本机 agent)不是同一个概念。Agent 不得自行改用
+「跳过登录」(应用内显示为「未登录」,无需账号即可使用本机 agent;代码内部标识仍为
+`local` mode)不是同一个概念。Agent 不得自行改用
`pnpm dev:desktop` 或 `pnpm dev:desktop:remote` 绕过包装脚本。
启动包装可能停止已有 Desktop dev 进程。必须尊重宿主提供的并行或保活工作流;如果
diff --git a/i18n/GLOSSARY.md b/i18n/GLOSSARY.md
index e9ee43d23d..46a3b145cd 100644
--- a/i18n/GLOSSARY.md
+++ b/i18n/GLOSSARY.md
@@ -156,6 +156,10 @@ OAuth 2.0 Device Authorization Grant 中由用户在另一设备验证页输入
灵动岛角色皮肤名(设置页「图标皮肤」列表)。角色专名,四语统一保留拉丁原词,不做音译(避免「艾莉卡 / エリカ / 에리카」多套写法)。
+### Not signed in
+
+跳过登录后应用内的账号状态名(侧边栏账号胶囊、设置页资料卡、语音服务提示,以及 main 侧不走 locale 的 model-visible 文案——已知 mcp-integrations/ghost.ts 的 GHOST_NOT_FOUND tool result,它会被模型读到并可能回显进对话,#907 review 补上)。**约束范围不限于 locale JSON**:guard 只扫 locale 文件,这类硬编码文案要人工找(见 engineering-conventions §5.1「Slack / IM 侧的文案不在任何 locale 文件里」同类问题)。2026-07-29 产品口径:面向用户只说「未登录」,不再叫「本地模式」——后者听起来像另一种服务端连接方式,实际只是没有登录 Cindy 账号。「本地」仅用于描述数据落在本机(如资料卡副文案「数据仅保存在本机」),不作为状态名。代码内部标识(AuthState mode='local'、authEnterLocal IPC、data owner)不受本条约束,仍用 local。en 侧统一走 not signed in 一种说法(含 settings.userProfile.local 的 exit / exitFailed 两条当前无引用的文案:the not-signed-in state),不与 unauthenticated 混用——PR #907 review 指出过同一状态两种英文说法会让日后启用这些文案时 UI 自相矛盾。status 仍为 proposed:Not signed in 作为状态名尚未与设计侧正式过一遍。
+
### OpenClaw
腾讯授权页可能展示的外部产品名称,客户端仅按原品牌名展示;先登记为 proposed,待产品术语评审后再决定是否固化。
@@ -180,6 +184,10 @@ dev 版登录页区域徽标上的标签值(DESIGN.md §16.3),四语同值
已确定禁用:`开发版(仅当英文含 Dev)`(zh-CN)、`開発版(仅当英文含 Dev)`(ja)、`개발판(仅当英文含 Dev)`(ko)
+### Skip Sign-In
+
+登录页免账号入口的动作名(面板内文字按钮 + 登录服务不可用时的 error 步逃生按钮,#697 起取代原游客圆钮)。与 not-signed-in 成对:动作叫「跳过登录」,进入后的状态叫「未登录」。历史说法「本地模式」「游客登录」已废弃——前者暗示另一种服务端连接方式,后者在本产品里没有对应的 guest 账号概念(代码里 GuestRoute 等内部标识不受本条约束)。先登记 proposed:en 的 Title Case 形态(Skip Sign-In)与本仓其它按钮的句首大写风格不一致,待随登录页文案统一时裁决。
+
### Voice dictionary
语音输入的用户自定义术语表(人名、产品名、代号与其常见误识别写法),在同账号的电脑之间自动同步、手机只读查看。当前先采用四语直译并登记为待讨论术语,避免与「自定义词典」「术语表」「用户词库」等说法混用。
diff --git a/i18n/glossary.json b/i18n/glossary.json
index ee52267560..75806af53f 100644
--- a/i18n/glossary.json
+++ b/i18n/glossary.json
@@ -557,6 +557,28 @@
},
"note": "灵动岛角色皮肤名(设置页「图标皮肤」列表)。角色专名,四语统一保留拉丁原词,不做音译(避免「艾莉卡 / エリカ / 에리카」多套写法)。"
},
+ {
+ "id": "not-signed-in",
+ "status": "proposed",
+ "en": "Not signed in",
+ "translations": {
+ "zh-CN": "未登录",
+ "ja": "未ログイン",
+ "ko": "로그인하지 않음"
+ },
+ "note": "跳过登录后应用内的账号状态名(侧边栏账号胶囊、设置页资料卡、语音服务提示,以及 main 侧不走 locale 的 model-visible 文案——已知 mcp-integrations/ghost.ts 的 GHOST_NOT_FOUND tool result,它会被模型读到并可能回显进对话,#907 review 补上)。**约束范围不限于 locale JSON**:guard 只扫 locale 文件,这类硬编码文案要人工找(见 engineering-conventions §5.1「Slack / IM 侧的文案不在任何 locale 文件里」同类问题)。2026-07-29 产品口径:面向用户只说「未登录」,不再叫「本地模式」——后者听起来像另一种服务端连接方式,实际只是没有登录 Cindy 账号。「本地」仅用于描述数据落在本机(如资料卡副文案「数据仅保存在本机」),不作为状态名。代码内部标识(AuthState mode='local'、authEnterLocal IPC、data owner)不受本条约束,仍用 local。en 侧统一走 not signed in 一种说法(含 settings.userProfile.local 的 exit / exitFailed 两条当前无引用的文案:the not-signed-in state),不与 unauthenticated 混用——PR #907 review 指出过同一状态两种英文说法会让日后启用这些文案时 UI 自相矛盾。status 仍为 proposed:Not signed in 作为状态名尚未与设计侧正式过一遍。"
+ },
+ {
+ "id": "skip-sign-in",
+ "status": "proposed",
+ "en": "Skip Sign-In",
+ "translations": {
+ "zh-CN": "跳过登录",
+ "ja": "ログインをスキップ",
+ "ko": "로그인 건너뛰기"
+ },
+ "note": "登录页免账号入口的动作名(面板内文字按钮 + 登录服务不可用时的 error 步逃生按钮,#697 起取代原游客圆钮)。与 not-signed-in 成对:动作叫「跳过登录」,进入后的状态叫「未登录」。历史说法「本地模式」「游客登录」已废弃——前者暗示另一种服务端连接方式,后者在本产品里没有对应的 guest 账号概念(代码里 GuestRoute 等内部标识不受本条约束)。先登记 proposed:en 的 Title Case 形态(Skip Sign-In)与本仓其它按钮的句首大写风格不一致,待随登录页文案统一时裁决。"
+ },
{
"id": "plugin",
"status": "decided",