Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(ui): 统一错误卡片并优化手机恢复操作布局
Dash105544a72f87
diff --git a/apps/desktop/src/renderer/cindy-brain/GhostSettingsWebview.tsx b/apps/desktop/src/renderer/cindy-brain/GhostSettingsWebview.tsxindex ba0aefe732..72cf5afebb 100644--- a/apps/desktop/src/renderer/cindy-brain/GhostSettingsWebview.tsx+++ b/apps/desktop/src/renderer/cindy-brain/GhostSettingsWebview.tsx@@ -1,7 +1,8 @@import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';import { Fragment, useEffect, useRef, useState, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';-import { CircleAlert, LayoutGrid, MoonStar } from 'lucide-react';+import { LayoutGrid, MoonStar } from 'lucide-react';import type { WebviewTag } from 'electron';import { useAuth } from '@/contexts/AuthContext';@@ -111,20 +112,10 @@ function CrashedHint({}): ReactNode {const { t } = useTranslation();return (- <div className="flex flex-col items-center gap-3 px-6 py-9">- <CircleAlert size={20} className="text-[var(--error-fg)]" />- <p- className={cn(- 'text-center text-[var(--text-secondary)]',- appearance === 'plugin' ? 'text-13 leading-5' : 'text-12 leading-relaxed',- )}- >- {t('settings.ghosts.panelError.crashed')}- </p>- <Button variant="secondary" size="sm" compact type="button" onClick={onReload}>+ <ErrorNotice className="m-4" message={t('settings.ghosts.panelError.crashed')}+ actions={<Button size="sm" compact type="button" onClick={onReload}>{t('settings.ghosts.panelError.reload')}- </Button>- </div>+ </Button>} />);}diff --git a/apps/desktop/src/renderer/cindy-brain/PluginTaskPrefs.tsx b/apps/desktop/src/renderer/cindy-brain/PluginTaskPrefs.tsxindex b87163a7a7..5f57e06696 100644--- a/apps/desktop/src/renderer/cindy-brain/PluginTaskPrefs.tsx+++ b/apps/desktop/src/renderer/cindy-brain/PluginTaskPrefs.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';/*** Plugin "Model & tasks" preferences: the plugin's single model field (used by* Cindy quick answers and by the tasks the plugin creates) plus the task@@ -269,7 +270,7 @@ export function PluginTaskPrefs({</>,) : null}- {error ? <p role="alert" className="text-12 leading-5 text-[var(--text-secondary)]">{error}</p> : null}+ {error ? <ErrorNotice role="alert" message={error} /> : null}</fieldset>);}diff --git a/apps/desktop/src/renderer/cindy-brain/ghostPanelBody.tsx b/apps/desktop/src/renderer/cindy-brain/ghostPanelBody.tsxindex 108c345b5b..5fde640c91 100644--- a/apps/desktop/src/renderer/cindy-brain/ghostPanelBody.tsx+++ b/apps/desktop/src/renderer/cindy-brain/ghostPanelBody.tsx@@ -1,7 +1,8 @@import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';-import { CircleAlert, Copy, FolderOpen } from 'lucide-react';+import { Copy, FolderOpen } from 'lucide-react';import type { ContextMenuEvent, WebviewTag } from 'electron';import {@@ -52,15 +53,11 @@ export function GhostPanelError({onReload ?? (() => void window.electronAPI.ghosts.reload(instanceId).catch(() => {}));return (<div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4">- <CircleAlert size={22} className="text-[var(--error-fg)]" />- <p className="text-center text-12 leading-relaxed text-[var(--text-secondary)]">- {t(+ <ErrorNotice className="w-full" message={t(state === 'fused'? 'settings.ghosts.panelError.fused': 'settings.ghosts.panelError.crashed',- )}- </p>- <div className="flex items-center gap-2">+ )} actions={<><Button variant="secondary" size="sm" compacttype="button"onClick={reload}@@ -79,7 +76,7 @@ export function GhostPanelError({>{t('settings.ghosts.panelError.close')}</Button>- </div>+ </>} /></div>);}diff --git a/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx b/apps/desktop/src/renderer/components/chat/ErrorBanner.tsxindex 570d4a8af9..13a81d14a1 100644--- a/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx+++ b/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx@@ -2,6 +2,7 @@ import { remoteAgentLimitErrorKey } from '../../../shared/remoteAgentLimits';import { useCodexRateLimits } from '@/hooks/useCodexRateLimits';import { useCodexRateLimitReset } from '@/hooks/useCodexRateLimitReset';import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';import { isSharedTaskPeer } from '@cindy/device-link';import { isCodexGatewayWireModel, isOpenAiSubscriptionProvider } from '@cindy/model-providers';import { useProviders } from '@/hooks/useProviders';@@ -21,19 +22,14 @@ import { useProviders } from '@/hooks/useProviders';import { useEffect, useRef, useState } from 'react';import { isCodexResumeNotReadyProjectionError } from '@cindy/maker-shared/agent-input-projection';-import { canOfferCodexHistoryRecovery, isCindyGatewayProxyTokenInvalidError, isResponsesLiteParallelToolCallsError, parseAgentErrorCode, redactSensitiveText } from '@cindy/maker-shared/error-redaction';-import { chatRemoteErrorGuidanceKey } from '@/lib/autoReviewUnavailableGuidance';import {- AlertCircle,- Check,- GitFork,- Play,- RotateCcw,- RefreshCw,- Timer,- Wallet,- X,-} from 'lucide-react';+ canOfferCodexHistoryRecovery,+ isCindyGatewayProxyTokenInvalidError,+ isResponsesLiteParallelToolCallsError,+ parseAgentErrorCode,+} from '@cindy/maker-shared/error-redaction';+import { chatRemoteErrorGuidanceKey } from '@/lib/autoReviewUnavailableGuidance';+import { AlertCircle, Check, Split, Play, RotateCcw, RefreshCw, Timer, Wallet } from 'lucide-react';import { useTranslation } from 'react-i18next';import { toast } from '@/lib/toast';import { Spinner } from '@/components/ui/spinner';@@ -417,10 +413,8 @@ export function ErrorBanner({openAiReconnectRequired ||isCodexLocalOAuthAuthMissing;const safeRetryText = !hideRetry && retryText ? retryText : null;- const [showRawNetworkError, setShowRawNetworkError] = useState(false);const [switchingClaudeSubscription, setSwitchingClaudeSubscription] = useState(false);useEffect(() => {- setShowRawNetworkError(false);setSwitchingClaudeSubscription(false);}, [error]);@@ -557,6 +551,16 @@ export function ErrorBanner({hasSpecialGuidance = false;}const showUnwrappedRaw = !hasSpecialGuidance || isResponsesLiteParallelToolCallsError(error);+ const canShowErrorDetails =+ isNetworkishError ||+ isOverloadError ||+ isStreamInterrupted ||+ showUnwrappedRaw ||+ isCodexUsageLimitError ||+ terminalRateLimitRetryProgress ||+ isClaudeGatewayOpusPlanMismatch ||+ isClaudeSubscriptionOpusPlanMismatch ||+ isGatewayProxyTokenInvalid;const handleSwitchToClaudeSubscription = async (): Promise<void> => {if (!onSwitchToClaudeSubscription || switchingClaudeSubscription) return;@@ -660,261 +664,179 @@ export function ErrorBanner({// (本地没 sync 入口, 用户去 codex login 再来; retry 立刻撞同样 401 没意义)。// **API mode 不在 hide 列表里** — gateway key 自动 refresh, retry 大概率成功。return (- <div+ <ErrorNoticeref={bannerRef}- className={cn(- 'mx-auto flex items-start gap-2 border px-3 py-2',- isOpenAiConnectionExpired- ? 'rounded-xl bg-[var(--surface-elevated)] border-[var(--border-default)]'- : 'rounded-lg bg-[var(--error-bg)] border-[var(--error-border)]',- className,- )}+ className={cn('mx-auto', className)}style={style}- >- {openAiConnectionRecoveredSinceError ? (- <Check size={14} className="mt-[2px] shrink-0 text-[var(--text-secondary)]" />- ) : (- <AlertCircle- size={14}- className={cn(- 'mt-[2px] shrink-0',- isOpenAiConnectionExpired- ? 'text-[var(--settings-integration-warning)]'- : 'text-[var(--error-fg)]',- )}- />- )}- <div className="flex-1 min-w-0">- <span- className={cn(- 'block break-all text-xs',- isOpenAiConnectionExpired- ? 'text-[var(--text-secondary)]'- : 'text-[var(--error-fg)]',- )}- >- {displayError}- </span>- {showHistoryRecovery && (- <div className="mt-2 space-y-2">- <p className="text-12 text-[var(--text-secondary)]">- {t('chat.errorBanner.readableHistoryRecoveryDescription')}- </p>- <Button size="sm" compact data-split-pane-route-action=""- loading={forkStripEncryptedRunning}- onClick={() => void onForkStripEncrypted?.()}>- <GitFork size={12} />- {t('chat.errorBanner.readableHistoryRecovery')}- </Button>- </div>- )}- {(isNetworkishError ||- isOverloadError ||- isStreamInterrupted ||- showUnwrappedRaw ||- isCodexUsageLimitError ||- terminalRateLimitRetryProgress ||- isClaudeGatewayOpusPlanMismatch ||- isClaudeSubscriptionOpusPlanMismatch ||- isGatewayProxyTokenInvalid) && (- // 网络类与过载类的原始错误折叠可查:友好文案替换了原文,但排障(端口/URL/- // errno/上游原话)仍需要原文,点击展开。新增控件走 --error-fg token(规则 16;- // 普通错误表面同样消费 error 语义色)。- <>- <button+ message={displayError}+ description={+ (showHistoryRecovery || showInvalidEncryptedContentRecovery) && onForkStripEncrypted+ ? t('chat.errorBanner.readableHistoryRecoveryDescription')+ : undefined+ }+ details={canShowErrorDetails ? error : undefined}+ onDismiss={onCancel}+ icon={+ openAiConnectionRecoveredSinceError ? (+ <Check size={16} className="text-[var(--text-secondary)]" />+ ) : (+ <AlertCircle+ size={16}+ className={cn(+ isOpenAiConnectionExpired+ ? 'text-[var(--settings-integration-warning)]'+ : 'text-[var(--error-fg)]',+ )}+ />+ )+ }+ actions={+ <>+ {openAiReconnectRequired && (+ // 共享凭证直接唤起 ChatGPT App;返回 Cindy 后由 useCodexAuth 自动复检。+ <Button+ size="sm"+ compacttype="button"- onClick={() => setShowRawNetworkError((v) => !v)}- className="mt-0.5 block text-xs underline opacity-70 hover:opacity-50 transition-opacity text-[var(--error-fg)]"+ onClick={() => void handleOpenAiRecovery()}+ disabled={openAiRecoveryBusy}+ title={t(+ codexRecoveryActionKey(+ openAiCredentialScope,+ openAiRecoveryBusy ? 'checking' : openAiRecoveryCheck,+ ),+ )}>- {showRawNetworkError- ? t('chat.errorBanner.networkHideRaw')- : t('chat.errorBanner.networkShowRaw')}- </button>- {showRawNetworkError && (- <span className="mt-0.5 block text-xs break-all opacity-70 text-[var(--error-fg)]">- {redactSensitiveText(error)}- </span>- )}- </>- )}- </div>- {openAiReconnectRequired && (- // 共享凭证直接唤起 ChatGPT App;返回 Cindy 后由 useCodexAuth 自动复检。- <button- type="button"- onClick={() => void handleOpenAiRecovery()}- disabled={openAiRecoveryBusy}- className={cn(- 'shrink-0 flex select-none items-center gap-1 text-xs font-medium',- 'text-[var(--text-primary)]',- 'hover:opacity-70 transition-opacity',- 'disabled:cursor-not-allowed disabled:opacity-50',+ <Spinner icon={RefreshCw} size={12} spinning={openAiRecoveryBusy} />+ {t(+ codexRecoveryActionKey(+ openAiCredentialScope,+ openAiRecoveryBusy ? 'checking' : openAiRecoveryCheck,+ ),+ )}+ </Button>)}- title={t(- codexRecoveryActionKey(- openAiCredentialScope,- openAiRecoveryBusy ? 'checking' : openAiRecoveryCheck,- ),+ {isClaudeGatewayOpusPlanMismatch && onSwitchToClaudeSubscription && (+ <Button+ size="sm"+ compact+ type="button"+ onClick={() => void handleSwitchToClaudeSubscription()}+ disabled={switchingClaudeSubscription}+ title={t('chat.errorBanner.switchClaudeSubscriptionTitle')}+ >+ <Spinner icon={RefreshCw} size={12} spinning={switchingClaudeSubscription} />+ {switchingClaudeSubscription+ ? t('chat.errorBanner.switchingClaudeSubscription')+ : t('chat.errorBanner.switchClaudeSubscription')}+ </Button>)}- >- <Spinner icon={RefreshCw} size={12} spinning={openAiRecoveryBusy} />- {t(- codexRecoveryActionKey(- openAiCredentialScope,- openAiRecoveryBusy ? 'checking' : openAiRecoveryCheck,- ),+ {isGatewayQuotaExhausted && onViewBalance && (+ // 与「切换到 Claude.ai 并重试」同一档低打扰内联恢复动作:不弹窗、不抢焦点。+ <Button+ size="sm"+ compact+ type="button"+ data-split-pane-route-action=""+ onClick={onViewBalance}+ title={t('chat.errorBanner.viewBalanceTitle')}+ >+ <Wallet size={12} />+ {t('chat.errorBanner.viewBalance')}+ </Button>)}- </button>- )}- {isClaudeGatewayOpusPlanMismatch && onSwitchToClaudeSubscription && (- <button- type="button"- onClick={() => void handleSwitchToClaudeSubscription()}- disabled={switchingClaudeSubscription}- className={cn(- 'shrink-0 flex select-none items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg-strong)]',- 'hover:opacity-70 transition-opacity',- 'disabled:cursor-not-allowed disabled:opacity-50',+ {isCodexRemoteAuthMissing && !syncedSinceError && (+ <Button+ size="sm"+ compact+ type="button"+ onClick={handleSyncAuth}+ disabled={syncing}+ title={t('chat.errorBanner.syncAuthTitle')}+ >+ <Spinner icon={RefreshCw} size={12} spinning={syncing} />+ {syncing ? t('chat.errorBanner.syncAuthSyncing') : t('chat.errorBanner.syncAuth')}+ </Button>)}- title={t('chat.errorBanner.switchClaudeSubscriptionTitle')}- >- <Spinner icon={RefreshCw} size={12} spinning={switchingClaudeSubscription} />- {switchingClaudeSubscription- ? t('chat.errorBanner.switchingClaudeSubscription')- : t('chat.errorBanner.switchClaudeSubscription')}- </button>- )}- {isGatewayQuotaExhausted && onViewBalance && (- // 与「切换到 Claude.ai 并重试」同一档低打扰内联恢复动作:不弹窗、不抢焦点。- <button- type="button"- data-split-pane-route-action=""- onClick={onViewBalance}- className={cn(- 'shrink-0 flex select-none items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg-strong)]',- 'hover:opacity-70 transition-opacity',+ {isSilentStopExhausted && onSilentStopContinue && (+ <Button+ size="sm"+ compact+ type="button"+ onClick={onSilentStopContinue}+ title={t('chat.errorBanner.silentStopContinueTitle')}+ >+ <Play size={12} />+ {t('chat.errorBanner.silentStopContinue')}+ </Button>)}- title={t('chat.errorBanner.viewBalanceTitle')}- >- <Wallet size={12} />- {t('chat.errorBanner.viewBalance')}- </button>- )}- {isCodexRemoteAuthMissing && !syncedSinceError && (- <button- type="button"- onClick={handleSyncAuth}- disabled={syncing}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg)]',- 'hover:opacity-70 transition-opacity',- 'disabled:opacity-50 disabled:cursor-not-allowed',+ {usageLimitResumeAt && (+ // 额度重置后自动继续:只是告知,不是按钮;用户仍可重试、换模型或发新消息接手。+ <span+ className="shrink-0 flex select-none items-center gap-1 text-xs text-[var(--text-secondary)]"+ title={t('chat.errorBanner.usageLimitAutoContinueTitle')}+ >+ <Timer size={12} />+ {t('chat.errorBanner.usageLimitAutoContinueAt', { time: usageLimitResumeAt })}+ </span>)}- title={t('chat.errorBanner.syncAuthTitle')}- >- <Spinner icon={RefreshCw} size={12} spinning={syncing} />- {syncing ? t('chat.errorBanner.syncAuthSyncing') : t('chat.errorBanner.syncAuth')}- </button>- )}- {isSilentStopExhausted && onSilentStopContinue && (- <button- type="button"- onClick={onSilentStopContinue}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg)]',- 'hover:opacity-70 transition-opacity',+ {(manualReset.canReset || manualReset.canRetry) && (+ <Button+ size="sm"+ compact+ loading={manualReset.busy}+ onClick={() => void manualReset.reset()}+ >+ {manualReset.canRetry+ ? t('codexResets.retryReset')+ : t('codexResets.limitAction', {+ count: resetSnapshot?.rateLimitResetCredits?.availableCount ?? 0,+ })}+ </Button>)}- title={t('chat.errorBanner.silentStopContinueTitle')}- >- <Play size={12} />- {t('chat.errorBanner.silentStopContinue')}- </button>- )}- {usageLimitResumeAt && (- // 额度重置后自动继续:只是告知,不是按钮;用户仍可重试、换模型或发新消息接手。- <span- className="shrink-0 flex select-none items-center gap-1 text-xs text-[var(--error-fg)]"- title={t('chat.errorBanner.usageLimitAutoContinueTitle')}- >- <Timer size={12} />- {t('chat.errorBanner.usageLimitAutoContinueAt', { time: usageLimitResumeAt })}- </span>- )}- {(manualReset.canReset || manualReset.canRetry) && (- <Button size="sm" compact loading={manualReset.busy} onClick={() => void manualReset.reset()}>- {manualReset.canRetry ? t('codexResets.retryReset') : t('codexResets.limitAction', { count: resetSnapshot?.rateLimitResetCredits?.availableCount ?? 0 })}- </Button>- )}- {usageLimitResumeAt && onCancelUsageLimitWait && (- <button- type="button"- onClick={onCancelUsageLimitWait}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg)]',- 'hover:opacity-70 transition-opacity',+ {usageLimitResumeAt && onCancelUsageLimitWait && (+ <Button+ size="sm"+ compact+ type="button"+ onClick={onCancelUsageLimitWait}+ title={t('chat.errorBanner.usageLimitAutoContinueCancelTitle')}+ >+ {t('chat.errorBanner.usageLimitAutoContinueCancel')}+ </Button>)}- title={t('chat.errorBanner.usageLimitAutoContinueCancelTitle')}- >- {t('chat.errorBanner.usageLimitAutoContinueCancel')}- </button>- )}- {safeRetryText && (- <button- type="button"- disabled={forkStripEncryptedRunning}- onClick={() => onRetry(safeRetryText)}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- isOpenAiConnectionExpired- ? 'text-[var(--text-primary)]'- : 'text-[var(--error-fg)]',- 'enabled:hover:opacity-70 transition-opacity disabled:opacity-60',+ {safeRetryText && (+ <Button+ size="sm"+ compact+ disabled={forkStripEncryptedRunning}+ onClick={() => onRetry(safeRetryText)}+ title={t('chat.errorBanner.retryTitle')}+ >+ <RotateCcw size={12} />+ {t('chat.errorBanner.retry')}+ </Button>)}- title={t('chat.errorBanner.retryTitle')}- >- <RotateCcw size={12} />- {t('chat.errorBanner.retry')}- </button>- )}- {showInvalidEncryptedContentRecovery && onForkStripEncrypted && (- <button- type="button"- data-split-pane-route-action=""- onClick={() => void onForkStripEncrypted()}- disabled={forkStripEncryptedRunning}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg)]',- 'hover:opacity-70 transition-opacity',- 'disabled:opacity-50 disabled:cursor-not-allowed',+ {(showHistoryRecovery || showInvalidEncryptedContentRecovery) && onForkStripEncrypted && (+ <Button+ size="sm"+ compact+ variant="secondary"+ data-split-pane-route-action=""+ onClick={() => void onForkStripEncrypted()}+ loading={forkStripEncryptedRunning}+ title={t('chat.errorBanner.forkStripEncryptedTitle')}+ >+ <Split size={14} strokeWidth={2} />+ {t(+ showHistoryRecovery+ ? 'chat.errorBanner.readableHistoryRecovery'+ : 'chat.errorBanner.forkStripEncrypted',+ )}+ </Button>)}- title={t('chat.errorBanner.forkStripEncryptedTitle')}- >- <GitFork size={12} />- {forkStripEncryptedRunning- ? t('chat.errorBanner.forkStripEncryptedRunning')- : t('chat.errorBanner.forkStripEncrypted')}- </button>- )}- {/* 关闭:纯 X 图标,与 InterruptedTurnBanner / WorktreeRestoreBanner / UpgradeBanner- 的关闭按钮统一(2026-07 统一:输入框上方所有提示条的关闭一律是一个 X,不带- 文字标签)。配色走 --error-fg token,不用本文件存量的硬编码 red(规则 16,- 见上方 349 行注释)。语义由 title 承载,供 hover 与读屏。 */}- {onCancel && (- <button- type="button"- onClick={onCancel}- className="shrink-0 text-[var(--error-fg)] opacity-60 hover:opacity-100 transition-opacity"- title={t('chat.errorBanner.cancelTitle')}- >- <X size={14} />- </button>- )}- </div>+ </>+ }+ />);}diff --git a/apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx b/apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsxindex 8095cabb6d..9af0f8bc79 100644--- a/apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx+++ b/apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx@@ -12,18 +12,17 @@* 脱敏后的技术原文仅在用户展开详情后显示。* 未发送的被拦输入由调用方显式标记,直接展示其面向用户的原因。*- * 视觉:走 `--error-bg` / `--error-border` / `--error-fg` 主题 token(规则 16;- * 错误红属跨主题语义豁免色,token 默认值即语义红,非默认主题可按需 override),- * 与 ErrorBanner 同语义,为随内容的 inline 卡。+ * 视觉与实时错误共用 ErrorNotice,中性底色与正文,红色仅标识状态图标。*/-import { useEffect, useState } from 'react';-import { AlertCircle } from 'lucide-react';+import { ErrorNotice } from '@/components/ui/error-notice';import { useTranslation } from 'react-i18next';-import { isCindyGatewayProxyTokenInvalidError, isResponsesLiteParallelToolCallsError, redactSensitiveText } from '@cindy/maker-shared/error-redaction';import {- isStreamInterruptedErrorMessage,-} from '@/utils/streamInterruptError';+ isCindyGatewayProxyTokenInvalidError,+ isResponsesLiteParallelToolCallsError,+ redactSensitiveText,+} from '@cindy/maker-shared/error-redaction';+import { isStreamInterruptedErrorMessage } from '@/utils/streamInterruptError';import { chatRemoteErrorGuidanceKey } from '../../lib/autoReviewUnavailableGuidance';import { decodeRemoteErrorMessage, remoteErrorI18nKey } from '../../lib/makerChatStore';import { ERROR_REASON_I18N_KEYS } from './errorReasonI18n';@@ -49,7 +48,6 @@ export function ErrorMessageCard({sessionSource?: string | null;}) {const { t, i18n } = useTranslation();- const [showRaw, setShowRaw] = useState(false);const decoded = decodeRemoteErrorMessage(message);const parsedRemoteKey = remoteErrorI18nKey(message);const remoteKey = parsedRemoteKey === 'chat.remoteError.AUTO_REVIEW_UNAVAILABLE'@@ -81,38 +79,13 @@ export function ErrorMessageCard({: localizedReasonError ?? remoteGuidance ?? t('chat.errorBanner.replyFailed');const showRawToggle = kind === 'reply-error' && Boolean(decoded);- useEffect(() => {- setShowRaw(false);- }, [message, reason, kind]);-if (!text) return null;return (- <div- className="flex items-start gap-2 rounded-md px-3 py-2 border bg-[var(--error-bg)] border-[var(--error-border)]"+ <ErrorNotice+ key={`${reason ?? ''}:${kind}`}+ message={text}+ details={showRawToggle ? message : undefined}data-testid="error-message-card"- >- <AlertCircle size={14} className="shrink-0 mt-[2px] text-[var(--error-fg)]" />- <div className="flex-1 min-w-0">- <span className="block min-w-0 text-xs break-all text-[var(--error-fg)]">{text}</span>- {showRawToggle && (- <>- <button- type="button"- onClick={() => setShowRaw((v) => !v)}- className="mt-0.5 block text-xs underline opacity-70 hover:opacity-50 transition-opacity text-[var(--error-fg)]"- >- {showRaw- ? t('chat.errorBanner.networkHideRaw')- : t('chat.errorBanner.networkShowRaw')}- </button>- {showRaw && (- <span className="mt-0.5 block text-xs break-all opacity-70 text-[var(--error-fg)]">- {redactSensitiveText(message)}- </span>- )}- </>- )}- </div>- </div>+ />);}diff --git a/apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx b/apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsxindex 5e1f394376..1c2eba25a8 100644--- a/apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx+++ b/apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx@@ -26,17 +26,18 @@* 告警的派生投影(usePendingAlertAttention 按 main 侧 pending-alerts 查询收敛),* 只有用户点「继续任务」/「忽略」把处置结果落库后才消失。*- * 颜色走主题 token(规则 16):error 语义豁免色 --error-bg / --error-border /- * --error-fg / --error-fg-strong(与 ErrorMessageCard 同组),不硬编码 Tailwind red。+ * 错误横幅统一复用 ErrorNotice 的中性表面与操作布局。*/import { useMemo, useState } from 'react';-import { CirclePause, Play, X } from 'lucide-react';+import { CirclePause, Play } from 'lucide-react';import { useTranslation } from 'react-i18next';import { cn } from '@/lib/utils';import { extractUsageLimitRecoveryHint } from '@/lib/usageLimitRecovery';import type { ToolLoopErrorDetails } from '@cindy/maker-core';import { ErrorBanner } from './ErrorBanner';+import { ErrorNotice } from '@/components/ui/error-notice';+import { Button } from '@/components/ui/button';export function InterruptedTurnBanner({onContinue,@@ -65,46 +66,28 @@ export function InterruptedTurnBanner({};return (- <div- className={cn(- 'mx-auto flex select-none items-start gap-2 rounded-md px-3 py-2',- 'border bg-[var(--error-bg)] border-[var(--error-border)]',- className,- )}+ <ErrorNotice+ className={cn('mx-auto', className)}style={style}data-testid="interrupted-turn-banner"data-banner-kind="interrupted"- >- <CirclePause size={14} className="shrink-0 mt-[2px] text-[var(--error-fg)]" />- <span className="flex-1 min-w-0 text-xs break-all text-[var(--error-fg)]">- {t('chat.interruptedBanner.text')}- </span>- <button- type="button"- onClick={() => void handleContinue()}- disabled={sending}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg-strong)]',- 'hover:opacity-70 transition-opacity',- 'disabled:opacity-50 disabled:cursor-not-allowed',- )}- title={t('chat.interruptedBanner.continueTitle')}- >- <Play size={12} />- {sending- ? t('chat.interruptedBanner.continuing')- : t('chat.interruptedBanner.continueAction')}- </button>- <button- type="button"- onClick={onDismiss}- className="shrink-0 text-[var(--error-fg)] opacity-60 hover:opacity-100 transition-opacity"- title={t('chat.interruptedBanner.dismissTitle')}- >- <X size={14} />- </button>- </div>+ icon={<CirclePause size={16} />}+ message={t('chat.interruptedBanner.text')}+ onDismiss={onDismiss}+ dismissLabel={t('chat.interruptedBanner.dismissTitle')}+ actions={+ <Button+ size="sm"+ compact+ onClick={() => void handleContinue()}+ loading={sending}+ title={t('chat.interruptedBanner.continueTitle')}+ >+ <Play size={12} />+ {t('chat.interruptedBanner.continueAction')}+ </Button>+ }+ />);}diff --git a/apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx b/apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsxindex ee3dcfeae3..c6f6a0dead 100644--- a/apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx+++ b/apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { FileTypeIcon } from '@/components/ui/file-type-icon';import { Button } from '@/components/ui/button';/**@@ -27,7 +28,7 @@ import { Button } from '@/components/ui/button';import { useCallback, useEffect, useState } from 'react';import * as AlertDialog from '@radix-ui/react-alert-dialog';-import { FileText, TriangleAlert, Undo2 } from 'lucide-react';+import { FileText, Undo2 } from 'lucide-react';import { useTranslation } from 'react-i18next';import type { TFunction } from 'i18next';@@ -392,25 +393,7 @@ function BodyDefault({ files }: { files: string[] }) {}function BodyError({ errorText }: { errorText: string }) {- return (- <div- className={cn(- 'rounded-lg p-3',- 'bg-[var(--error-bg)]',- 'border border-[var(--error-border)]',- 'flex items-start gap-2.5',- )}- >- <TriangleAlert- size={16}- strokeWidth={2}- className="mt-0.5 shrink-0 text-[var(--error-fg)]"- />- <div className="font-mono text-13 leading-[1.5] text-[var(--error-fg-strong)]">- {errorText}- </div>- </div>- );+ return <ErrorNotice message={errorText} />;}// ─── helpers ───────────────────────────────────────────────────────────────diff --git a/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx b/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsxindex 102754a30b..c2ae750b4b 100644--- a/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx+++ b/apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx@@ -1,7 +1,6 @@import { useEffect, useState, type CSSProperties } from 'react';-import { AlertCircle, X } from 'lucide-react';import { useTranslation } from 'react-i18next';-import { Tip } from '@/components/ui/tooltip';+import { ErrorNotice } from '@/components/ui/error-notice';import { cn } from '@/lib/utils';import { scheduleFailureMessageKey } from '@cindy/maker-shared/schedule-model';import {@@ -78,30 +77,14 @@ function FailedScheduleNotice({};return (- <div- className={cn(- 'mx-auto flex select-none items-start gap-2 rounded-md px-3 py-2',- 'border bg-[var(--error-bg)] border-[var(--error-border)]',- className,- )}+ <ErrorNotice+ className={cn('mx-auto', className)}style={style}data-testid="unread-failed-schedule-banner"data-banner-kind="unread-failed-schedule"- >- <AlertCircle size={14} className="shrink-0 mt-[2px] text-[var(--error-fg)]" />- <span className="flex-1 min-w-0 text-xs break-all text-[var(--error-fg)]">- {t(`chat.unreadFailedScheduleBanner.${scheduleFailureMessageKey(latestFailedRun)}`)}- </span>- <Tip text={t('chat.unreadFailedScheduleBanner.dismissTitle')}>- <button- type="button"- onClick={dismiss}- aria-label={t('chat.unreadFailedScheduleBanner.dismissTitle')}- className="shrink-0 rounded-full p-0.5 text-[var(--error-fg)] hover:bg-[var(--button-primary-hover)] active:bg-[var(--button-primary-pressed)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--focus-ring)]"- >- <X size={14} aria-hidden="true" />- </button>- </Tip>- </div>+ message={t(`chat.unreadFailedScheduleBanner.${scheduleFailureMessageKey(latestFailedRun)}`)}+ onDismiss={dismiss}+ dismissLabel={t('chat.unreadFailedScheduleBanner.dismissTitle')}+ />);}diff --git a/apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx b/apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsxindex df1928cae8..d86650d35a 100644--- a/apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx+++ b/apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx@@ -1,3 +1,5 @@+import { ErrorNotice } from '@/components/ui/error-notice';+import { Button } from '@/components/ui/button';/*** 「工作区已被回收 / 有未应用快照」恢复横幅(P1,输入框上方,与 InterruptedTurnBanner 同位置)* ---------------------------------------------------------------------------@@ -29,7 +31,7 @@*/import { useCallback, useEffect, useRef, useState } from 'react';-import { FolderX, RefreshCw, X } from 'lucide-react';+import { FolderX, RefreshCw } from 'lucide-react';import { useTranslation } from 'react-i18next';import { toast } from '@/lib/toast';import { cn } from '@/lib/utils';@@ -176,54 +178,35 @@ export function WorktreeRestoreBanner({const pending = variant === 'pending';return (- <div- className={cn(- 'mx-auto flex items-start gap-2 rounded-md px-3 py-2',- 'border bg-[var(--error-bg)] border-[var(--error-border)]',- className,- )}+ <ErrorNotice+ className={cn('mx-auto', className)}style={style}data-testid="worktree-restore-banner"- >- <FolderX size={14} className="shrink-0 mt-[2px] text-[var(--error-fg)]" />- <span className="flex-1 min-w-0 text-xs break-all text-[var(--error-fg)]">- {pending+ icon={<FolderX size={16} />}+ message={+ pending? t('chat.worktreeRestoreBanner.textPendingSnapshot')- : t('chat.worktreeRestoreBanner.text')}- </span>- <button- type="button"- onClick={() => void handleRestore()}- disabled={restoring}- className={cn(- 'shrink-0 flex items-center gap-1 text-xs font-medium',- 'text-[var(--error-fg-strong)]',- 'hover:opacity-70 transition-opacity',- 'disabled:opacity-50 disabled:cursor-not-allowed',- )}- title={t('chat.worktreeRestoreBanner.restoreTitle')}- >- <span className={cn('inline-flex', restoring && 'animate-spin motion-reduce:animate-none')}>+ : t('chat.worktreeRestoreBanner.text')+ }+ onDismiss={() => {+ setPhase('hidden');+ if (sessionId) clearOwnAttentionFor(sessionId);+ }}+ dismissLabel={t('chat.worktreeRestoreBanner.dismissTitle')}+ actions={+ <Button+ size="sm"+ compact+ onClick={() => void handleRestore()}+ loading={restoring}+ title={t('chat.worktreeRestoreBanner.restoreTitle')}+ ><RefreshCw size={12} />- </span>- {restoring- ? t('chat.worktreeRestoreBanner.restoring')- : pending+ {pending? t('chat.worktreeRestoreBanner.applySnapshotAction'): t('chat.worktreeRestoreBanner.restoreAction')}- </button>- <button- type="button"- onClick={() => {- setPhase('hidden');- // 用户主动忽略 = 处置(本视图内),清红点。重开会话自查再命中会重新打上。- if (sessionId) clearOwnAttentionFor(sessionId);- }}- className="shrink-0 text-[var(--error-fg)] opacity-60 hover:opacity-100 transition-opacity"- title={t('chat.worktreeRestoreBanner.dismissTitle')}- >- <X size={14} />- </button>- </div>+ </Button>+ }+ />);}diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsxindex 175a6e1e8d..6c8a2fd3ff 100644--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useCallback, useEffect, useRef, useState } from 'react';import * as Dialog from '@radix-ui/react-dialog';import { useTranslation } from 'react-i18next';@@ -232,9 +233,7 @@ export function CindyMakeContributionDialog({)}{loadError && (<div className="mt-4 flex flex-col gap-4">- <p role="alert" className="text-13 text-[var(--error-fg)]">- {t(`${key}.errors.${loadError}`)}- </p>+ <ErrorNotice role="alert" message={t(`${key}.errors.${loadError}`)} /><div className="flex justify-end"><Dialog.Close asChild><Button type="button" variant="secondary" size="lg" palette="confirmation">@@ -366,9 +365,7 @@ export function CindyMakeContributionDialog({<span>{t(`${key}.dialog.dco`, { name: name.trim(), email: email.trim() })}</span></label>{submitError && (- <p role="alert" className="text-13 text-[var(--error-fg)]">- {t(`${key}.errors.${submitError}`)}- </p>+ <ErrorNotice role="alert" message={t(`${key}.errors.${submitError}`)} />)}<div className="flex flex-wrap justify-end gap-2"><Dialog.Close asChild>diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsxindex 2ff3e04b7d..762aee13e7 100644--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeCreateDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useEffect, useRef, useState } from 'react';import * as Dialog from '@radix-ui/react-dialog';import { useTranslation } from 'react-i18next';@@ -139,9 +140,7 @@ export function CindyMakeCreateDialog({ onOpenChange }: { onOpenChange: (open: b)}</FormField>{failed && (- <p role="alert" className="text-13 text-[var(--error-fg)]">- {t('settings.cindyMake.create.failed')}- </p>+ <ErrorNotice role="alert" message={t('settings.cindyMake.create.failed')} />)}<div className="flex flex-wrap justify-end gap-2"><Dialog.Close asChild>diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakePreflightDialog.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakePreflightDialog.tsxindex 2e20fdef65..57ea098ecd 100644--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakePreflightDialog.tsx+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakePreflightDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useEffect, useRef, useState } from 'react';import * as Dialog from '@radix-ui/react-dialog';import { useTranslation } from 'react-i18next';@@ -218,9 +219,7 @@ export function CindyMakePreflightDialog({/>)}{failed && (- <p role="alert" className="text-13 text-[var(--error-fg)]">- {t('cindyMake.code.preparationFailed')}- </p>+ <ErrorNotice role="alert" message={t('cindyMake.code.preparationFailed')} />)}</div>{report?.status === 'completed' &&diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTasksPanel.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTasksPanel.tsxindex 3757466e61..d273ce9578 100644--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTasksPanel.tsx+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTasksPanel.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useEffect, useRef, useState } from 'react';import { useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';@@ -246,9 +247,7 @@ export function CindyMakeTasksPanel({</div><div className="shrink-0 space-y-3 border-t border-[var(--border-default)] p-4">{failureCode && (- <p role="alert" className="text-12 text-[var(--error-fg)]">- {t('settings.cindyMake.tasks.errors.' + failureCode)}- </p>+ <ErrorNotice role="alert" message={t('settings.cindyMake.tasks.errors.' + failureCode)} />)}<div className="flex flex-wrap gap-2">{selected.task.sessionStatus !== 'deleted' && (diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsxindex f89d7eaa74..8c8d19d0ce 100644--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useEffect, useId, useState, type ReactNode } from 'react';import { ChevronDown, ChevronUp } from 'lucide-react';import { useTranslation } from 'react-i18next';@@ -156,9 +157,7 @@ export function CindyMakeVersionsPanel({</div>)}{versions.error && (- <p role="alert" className="text-12 text-[var(--error-fg)]">- {t('cindyMake.versions.errors.' + versions.error)}- </p>+ <ErrorNotice role="alert" message={t('cindyMake.versions.errors.' + versions.error)} />)}{expanded && !!alternatives.length && (<div id={listId} className="space-y-2 border-t border-[var(--border-default)] pt-3">diff --git a/apps/desktop/src/renderer/components/error/AppCrashScreen.tsx b/apps/desktop/src/renderer/components/error/AppCrashScreen.tsxindex 3b233c9e1e..d5254cd7c2 100644--- a/apps/desktop/src/renderer/components/error/AppCrashScreen.tsx+++ b/apps/desktop/src/renderer/components/error/AppCrashScreen.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Button } from '@/components/ui/button';/*** AppCrashScreen — 渲染崩溃兜底页的纯展示层。@@ -15,7 +16,7 @@ import { Button } from '@/components/ui/button';*/import { useTranslation } from 'react-i18next';-import { TriangleAlert, RotateCcw, House } from 'lucide-react';+import { RotateCcw, House } from 'lucide-react';import { cn } from '@/lib/utils';import { clearLastView } from '@/features/cc-agent/lib/lastViewStore';@@ -54,45 +55,24 @@ export function AppCrashScreen({: 'h-full w-full',)}>- <div className="mx-6 flex w-full max-w-md flex-col items-center gap-4 rounded-xl border border-[var(--border-default)] bg-[var(--surface)] px-8 py-10">- <span className="flex h-10 w-10 items-center justify-center rounded-full bg-[var(--surface-chip)] text-[var(--text-secondary)]">- <TriangleAlert size={20} />- </span>- <div className="flex flex-col items-center gap-1.5 text-center">- <h2 className="text-15 font-medium text-[var(--text-primary)]">- {t('appError.title')}- </h2>- <p className="text-13 leading-relaxed text-[var(--text-secondary)]">- {t('appError.description')}- </p>- </div>- <div className="flex items-center gap-2">- <Button variant="cta" size="md" compact- type="button"- onClick={handleReload}- >- <RotateCcw size={13} />- {t('appError.reload')}- </Button>- <Button variant="secondary" size="md" compact- type="button"- onClick={handleBackHome}- >- <House size={13} />- {t('appError.backHome')}- </Button>- </div>- {(stack ?? message) && (- <details className="w-full">- <summary className="cursor-pointer text-12 text-[var(--text-tertiary)] transition-colors hover:text-[var(--text-secondary)]">- {t('appError.details')}- </summary>- <pre className="mt-2 max-h-48 overflow-auto rounded-lg bg-[var(--surface-chip)] p-3 font-mono text-11 leading-relaxed whitespace-pre-wrap break-all text-[var(--text-secondary)]">- {stack ?? message}- </pre>- </details>- )}- </div>+ <ErrorNotice+ className="mx-6 w-full max-w-md"+ message={t('appError.title')}+ description={t('appError.description')}+ details={stack ?? message}+ actions={+ <>+ <Button size="sm" compact onClick={handleReload}>+ <RotateCcw size={13} />+ {t('appError.reload')}+ </Button>+ <Button variant="secondary" size="sm" compact onClick={handleBackHome}>+ <House size={13} />+ {t('appError.backHome')}+ </Button>+ </>+ }+ /></div>);}diff --git a/apps/desktop/src/renderer/components/error/__tests__/RouteErrorFallback.test.tsx b/apps/desktop/src/renderer/components/error/__tests__/RouteErrorFallback.test.tsxindex e0d0ac1729..49ec6b8e53 100644--- a/apps/desktop/src/renderer/components/error/__tests__/RouteErrorFallback.test.tsx+++ b/apps/desktop/src/renderer/components/error/__tests__/RouteErrorFallback.test.tsx@@ -6,7 +6,7 @@* (标题 / 重新加载 / 回主界面 / 错误详情),而不是 react-router 的* 开发者默认错误页,也不会把错误继续往上抛炸掉整个应用。*/-import { cleanup, render, screen } from '@testing-library/react';+import { cleanup, fireEvent, render, screen } from '@testing-library/react';import { afterEach, describe, expect, it, vi } from 'vitest';import { createMemoryRouter, RouterProvider } from 'react-router-dom';@@ -44,7 +44,8 @@ describe('RouteErrorFallback', () => {expect(screen.getByText('appError.title')).toBeTruthy();expect(screen.getByText('appError.reload')).toBeTruthy();expect(screen.getByText('appError.backHome')).toBeTruthy();- expect(screen.getByText('appError.details')).toBeTruthy();+ expect(screen.queryByText(/boom: element type is invalid/)).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'chat.errorBanner.networkShowRaw' }));// 错误详情里能看到原始 message(给用户复制反馈用)expect(screen.getByText(/boom: element type is invalid/)).toBeTruthy();} finally {diff --git a/apps/desktop/src/renderer/components/error/__tests__/TopLevelErrorBoundary.test.tsx b/apps/desktop/src/renderer/components/error/__tests__/TopLevelErrorBoundary.test.tsxindex cd291135bb..930f6389c5 100644--- a/apps/desktop/src/renderer/components/error/__tests__/TopLevelErrorBoundary.test.tsx+++ b/apps/desktop/src/renderer/components/error/__tests__/TopLevelErrorBoundary.test.tsx@@ -8,7 +8,7 @@* 而不是把错误继续往上抛炸掉 #root(白屏);* 3. 非 Error 抛出物(字符串等)也能正常归一化展示。*/-import { cleanup, render, screen } from '@testing-library/react';+import { cleanup, fireEvent, render, screen } from '@testing-library/react';import { afterEach, describe, expect, it, vi } from 'vitest';// 仓库同款 i18n mock:t 返回 key 本身,断言直接用 key。@@ -51,7 +51,8 @@ describe('TopLevelErrorBoundary', () => {expect(screen.getByText('appError.title')).toBeTruthy();expect(screen.getByText('appError.reload')).toBeTruthy();expect(screen.getByText('appError.backHome')).toBeTruthy();- expect(screen.getByText('appError.details')).toBeTruthy();+ expect(screen.queryByText(/provider boom/)).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'chat.errorBanner.networkShowRaw' }));// 错误详情里能看到原始 message(给用户复制反馈用)expect(screen.getByText(/provider boom/)).toBeTruthy();} finally {@@ -68,6 +69,8 @@ describe('TopLevelErrorBoundary', () => {</TopLevelErrorBoundary>,);expect(screen.getByText('appError.title')).toBeTruthy();+ expect(screen.queryByText(/string boom/)).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'chat.errorBanner.networkShowRaw' }));expect(screen.getByText(/string boom/)).toBeTruthy();} finally {silence.mockRestore();diff --git a/apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx b/apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsxindex 7ee9e2ddf0..86267643d4 100644--- a/apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx+++ b/apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx@@ -1,6 +1,6 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Button } from '@/components/ui/button';import {- CircleAlert,Folder,FolderPlus,Globe,@@ -488,34 +488,26 @@ export function FolderPickerPopover({</div>) : deviceScope?.status === 'error' ? (<>- <div+ <ErrorNoticerole="alert"- className="mx-1 flex items-start gap-2 rounded-[8px] border border-[var(--error-border)] bg-[var(--error-bg)] px-3 py-2"- >- <CircleAlert size={14} className="mt-0.5 shrink-0 text-[var(--error-fg)]" />- <div className="min-w-0 flex-1">- <p className="text-xs leading-[1.45] text-[var(--error-fg)]">- {t('newChat.folderPicker.remoteProjectsLoadFailed', {- device: deviceScope.deviceName,- })}- </p>- {deviceScope.retry && (+ className="mx-1"+ message={t('newChat.folderPicker.remoteProjectsLoadFailed', {+ device: deviceScope.deviceName,+ })}+ actions={+ deviceScope.retry && (<Button- variant="secondary"- size="xs"+ size="sm"compact- tone="danger"- type="button"disabled={selectionPending}onClick={deviceScope.retry}- className="mt-1"><RefreshCw size={12} />{t('newChat.folderPicker.retryRemoteProjects')}</Button>- )}- </div>- </div>+ )+ }+ />{visibleProjectOptions.map(renderProject)}</>) : visibleProjectOptions.length > 0 ? (diff --git a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsxindex 3b75d6a5d0..d2274a4f44 100644--- a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { DisplayPricingDetails } from '@/components/DisplayPricingDetails';import { Button } from '@/components/ui/button';import { localizedModelDescription } from '@/lib/modelDescriptions';@@ -597,32 +598,17 @@ function RemoteModelLoadNotice({);}return (- <div+ <ErrorNoticerole="alert"- className={cn(- 'flex items-start gap-2 border border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-fg)]',- compact ? 'mx-1 rounded-[8px] px-3 py-2' : 'mx-1 rounded-[8px] px-3 py-3',- )}- >- <CircleAlert size={14} className="mt-0.5 shrink-0" />- <div className="min-w-0 flex-1">- <p className={cn(compact ? 'text-11 leading-[1.45]' : 'text-xs leading-[1.45]')}>- {message ?? t('newChat.modelSelector.remoteLoadFailed')}- </p>- <Button- variant="secondary"- tone="danger"- size="xs"- compact- type="button"- onClick={onRetry}- className="mt-1"- >+ className="mx-1"+ message={message ?? t('newChat.modelSelector.remoteLoadFailed')}+ actions={+ <Button size="sm" compact onClick={onRetry}><RefreshCw size={12} />{t('newChat.modelSelector.retryRemoteModels')}</Button>- </div>- </div>+ }+ />);}diff --git a/apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx b/apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsxindex eeacd5c162..a657b06ea1 100644--- a/apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx+++ b/apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Copy, ExternalLink } from 'lucide-react';import { useEffect, useRef, useState, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';@@ -200,9 +201,7 @@ function DeviceCodeView({{t('newChat.pluginSetup.deviceCode.remaining', { time })}</p>{failed ? (- <p role="alert" className="text-13 text-[var(--error-fg)]">- {t('newChat.pluginSetup.deviceCode.actionFailed')}- </p>+ <ErrorNotice role="alert" message={t('newChat.pluginSetup.deviceCode.actionFailed')} />) : null}</>) : (diff --git a/apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx b/apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsxindex 5cc2c0d32f..c1a33436c1 100644--- a/apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx+++ b/apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { AlertCircle, Check, Copy, ExternalLink, LoaderCircle } from 'lucide-react';import { useTranslation } from 'react-i18next';import { Button } from '@/components/ui/button';@@ -208,7 +209,7 @@ function AccountCard({</div>) : null}{!terminal && errorMessage ? (- <p role="alert" className="mt-3 text-13 text-[var(--error-fg)]">{errorMessage}</p>+ <ErrorNotice role="alert" className="mt-3" message={errorMessage} />) : null}{!terminal ? (<div className={`${compact ? 'mt-4' : 'mt-5'} flex flex-wrap items-center gap-2`}>@@ -248,9 +249,7 @@ function AccountCard({</div>) : null}{presentation?.failed ? (- <p role="alert" className="mt-2 text-13 text-[var(--error-fg)]">- {t('newChat.pluginSetup.deviceCode.actionFailed')}- </p>+ <ErrorNotice role="alert" className="mt-2" message={t('newChat.pluginSetup.deviceCode.actionFailed')} />) : null}</section>);diff --git a/apps/desktop/src/renderer/components/settings/LlamaCppProviderDetail.tsx b/apps/desktop/src/renderer/components/settings/LlamaCppProviderDetail.tsxindex 464c30e72d..1185fde704 100644--- a/apps/desktop/src/renderer/components/settings/LlamaCppProviderDetail.tsx+++ b/apps/desktop/src/renderer/components/settings/LlamaCppProviderDetail.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { Button } from '@/components/ui/button';@@ -168,9 +169,7 @@ export function LlamaCppProviderDetail({ onChanged }: { onChanged: () => void })</p>)}{(error || pollError) && !failed && (- <p role="alert" className="text-12" style={{ color: 'var(--error-flat)' }}>- {t('settings.providers.llamacpp.failed')}- </p>+ <ErrorNotice role="alert" message={t('settings.providers.llamacpp.failed')} />)}{(!state?.installed || installing) && (<LocalRuntimeInstallViewdiff --git a/apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx b/apps/desktop/src/renderer/components/settings/VoiceInputSection.tsxindex 7dc3698de0..ad6580a243 100644--- a/apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx+++ b/apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Button } from '@/components/ui/button';import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from 'react';import { useSettingsSearchNavigation } from './SettingsSearchNavigation';@@ -640,15 +641,19 @@ function VoiceInputServiceSourceCard() {/></VoiceInputInlineSettingRow>- {connectionTest.status !== 'idle' ? (+ {connectionTest.status === 'error' ? (+ <ErrorNotice+ role="alert"+ aria-live="polite"+ message={t(VOICE_INPUT_CONNECTION_TEST_FAILURE_KEYS[connectionTest.reason])}+ />+ ) : connectionTest.status !== 'idle' ? (<div- role={connectionTest.status === 'error' ? 'alert' : 'status'}+ role="status"aria-live="polite"className={cn('flex items-center gap-2 rounded-[10px] border px-3 py-2 text-12 leading-[1.4]',- connectionTest.status === 'error'- ? 'border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-fg)]'- : 'border-[var(--settings-input-border)] bg-[var(--settings-input-bg)] text-[var(--settings-section-sublabel)]',+ 'border-[var(--settings-input-border)] bg-[var(--settings-input-bg)] text-[var(--settings-section-sublabel)]',)}>{connectionTest.status === 'success' ? <Check size={13} aria-hidden /> : null}@@ -660,9 +665,7 @@ function VoiceInputServiceSourceCard() {<span>{connectionTest.status === 'testing'? t('settings.voiceInput.serviceSource.connectionTest.testingStatus')- : connectionTest.status === 'success'- ? t('settings.voiceInput.serviceSource.connectionTest.success')- : t(VOICE_INPUT_CONNECTION_TEST_FAILURE_KEYS[connectionTest.reason])}+ : t('settings.voiceInput.serviceSource.connectionTest.success')}</span></div>) : null}@@ -721,12 +724,10 @@ function VoiceInputServiceSourceCard() {/></VoiceInputInlineSettingRow>{customAsrUrlInvalid ? (- <p+ <ErrorNoticerole="alert"- className="rounded-[10px] border border-[var(--error-border)] bg-[var(--error-bg)] px-3 py-2 text-12 leading-[1.4] text-[var(--error-fg)]"- >- {t('settings.voiceInput.serviceSource.customAsr.websocketUrl.invalid')}- </p>+ message={t('settings.voiceInput.serviceSource.customAsr.websocketUrl.invalid')}+ />) : null}<VoiceInputInlineSettingRow@@ -839,28 +840,16 @@ function VoiceInputServiceSourceCard() {</VoiceInputInlineSettingRow>{byokCredentialErrorText ? (- <div- className={cn(- 'flex flex-wrap items-center justify-between gap-2 rounded-[12px] px-3.5 py-2.5',- 'border border-[var(--error-border)] bg-[var(--error-bg)]',- )}- >- <p className="min-w-0 text-12 leading-[1.4] text-[var(--error-fg)]">- {byokCredentialErrorText}- </p>- {!credentialRecoveryInVoiceSettings ? (- <Button- variant="secondary"- size="sm"- compact- type="button"- onClick={openProvidersTab}- className="shrink-0"- >- {t('settings.voiceInput.serviceSource.manageProviders')}- </Button>- ) : null}- </div>+ <ErrorNotice+ message={byokCredentialErrorText}+ actions={+ !credentialRecoveryInVoiceSettings && (+ <Button size="sm" compact onClick={openProvidersTab}>+ {t('settings.voiceInput.serviceSource.manageProviders')}+ </Button>+ )+ }+ />) : null}</>) : null}diff --git a/apps/desktop/src/renderer/components/settings/VoiceSpeakerEnrollmentDialog.tsx b/apps/desktop/src/renderer/components/settings/VoiceSpeakerEnrollmentDialog.tsxindex be31ea7076..741bc1ad92 100644--- a/apps/desktop/src/renderer/components/settings/VoiceSpeakerEnrollmentDialog.tsx+++ b/apps/desktop/src/renderer/components/settings/VoiceSpeakerEnrollmentDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useCallback, useEffect, useRef, useState, type CSSProperties } from 'react';import { useTranslation } from 'react-i18next';import * as Dialog from '@radix-ui/react-dialog';@@ -321,9 +322,7 @@ export function VoiceSpeakerEnrollmentDialog({</div>{errorText ? (- <p role="alert" className="text-12 leading-[1.4] text-[var(--error-fg)]">- {errorText}- </p>+ <ErrorNotice role="alert" message={errorText} />) : null}<div className="flex justify-end gap-2">diff --git a/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx b/apps/desktop/src/renderer/components/settings/WallpaperSection.tsxindex 9e378dc1fa..73796f0f4e 100644--- a/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx+++ b/apps/desktop/src/renderer/components/settings/WallpaperSection.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useTranslation } from 'react-i18next';import { RotateCcw, ImagePlus, Film } from 'lucide-react';import { useEffect, useCallback, useRef, useState } from 'react';@@ -298,9 +299,7 @@ export function WallpaperSection() {</p></div>{(error || (wallpaperId === 'custom' && playbackFailed)) && (- <p role="alert" className="text-12 text-[var(--text-primary)]">- {error || t('settings.appearance.wallpaper.customPlaybackFailed')}- </p>+ <ErrorNotice role="alert" message={error || t('settings.appearance.wallpaper.customPlaybackFailed')} />)}<div className="h-px bg-[var(--settings-input-border)]" />diff --git a/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx b/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsxindex d383b9cef8..4af3a79f4a 100644--- a/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx+++ b/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Slider } from '@/components/ui/slider';import { Button, type ButtonProps } from '@/components/ui/button';import {@@ -966,18 +967,16 @@ export function WorkLouderCodexSettings({</WorkLouderCodexPartEditor>{error && (- <div className="flex items-center justify-between gap-3 rounded-xl border border-[var(--error-border)] bg-[var(--error-bg)] px-4 py-3 text-12 text-[var(--error-fg)]">- <span>{t(workLouderCopyKey(model, `errors.${error}`))}</span>- {error === 'load' && (- <button- type="button"- onClick={() => void reload()}- className="font-medium underline underline-offset-2"- >- {t('settings.shortcuts.workLouderCodex.retry')}- </button>- )}- </div>+ <ErrorNotice+ message={t(workLouderCopyKey(model, `errors.${error}`))}+ actions={+ error === 'load' && (+ <Button size="sm" compact onClick={() => void reload()}>+ {t('settings.shortcuts.workLouderCodex.retry')}+ </Button>+ )+ }+ />)}{state?.device.inputMonitoringPermission === 'denied' && (diff --git a/apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsx b/apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsxindex 4f93d04709..659161e8c6 100644--- a/apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsx+++ b/apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useCallback, useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { Button } from '@/components/ui/button';@@ -46,7 +47,7 @@ export function WorktreeRecycleCard() {<h3 id="settings-search-settings-worktreeRecycle-title" className="text-sm font-medium text-[var(--text-primary)]">{t('settings.worktreeRecycle.title')}</h3><Button variant="secondary" size="md" onClick={() => { void refresh(); }}>{t('settings.worktreeRecycle.refresh')}</Button></div>- {failed ? <p role="alert" className="mt-3 text-sm text-[var(--text-secondary)]">{t('settings.worktreeRecycle.loadFailed')}</p>+ {failed ? <ErrorNotice role="alert" className="mt-3" message={t('settings.worktreeRecycle.loadFailed')} />: rows === null ? null : rows.length === 0 ? <p className="mt-3 text-sm text-[var(--text-secondary)]">{t('settings.worktreeRecycle.empty')}</p>: <ul className="mt-3 divide-y divide-[var(--border-default)]">{rows.map((row) => <li key={`${row.id}:${row.generation}`} className="flex flex-wrap items-center justify-between gap-3 py-3">diff --git a/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx b/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsxindex a30256b6f0..47dc8f495b 100644--- a/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx+++ b/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';/*** UsageHistorySection — 设置 → 用量历史 (issue #2785)。*@@ -290,12 +291,7 @@ export function UsageHistorySection(): React.JSX.Element {<Spinner size={20} /></div>) : loadFailed ? (- <div- className="flex min-h-[176px] items-center justify-center rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] px-4 text-center text-13 text-[var(--error-fg)]"- role="alert"- >- {t('usageHistory.loadFailed')}- </div>+ <ErrorNotice role="alert" message={t('usageHistory.loadFailed')} />) : empty ? (<div className="rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] px-4 py-8 text-center text-13 text-[var(--text-tertiary)]">{t('usageHistory.empty')}diff --git a/apps/desktop/src/renderer/components/ui/error-notice.tsx b/apps/desktop/src/renderer/components/ui/error-notice.tsxnew file mode 100644index 0000000000..df982300dc--- /dev/null+++ b/apps/desktop/src/renderer/components/ui/error-notice.tsx@@ -0,0 +1,99 @@+import {+ forwardRef,+ useEffect,+ useState,+ type ComponentPropsWithoutRef,+ type ReactNode,+} from 'react';+import { AlertCircle, ChevronDown, ChevronRight, X } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import { redactSensitiveText } from '@cindy/maker-shared/error-redaction';+import { cn } from '@/lib/utils';+import { Button } from './button';++interface ErrorNoticeProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {+ message: ReactNode;+ description?: ReactNode;+ actions?: ReactNode;+ details?: string;+ icon?: ReactNode;+ onDismiss?: () => void;+ dismissLabel?: string;+ children?: ReactNode;+}++/** Shared error presentation; callers retain all recovery and dismissal decisions. */+export const ErrorNotice = forwardRef<HTMLDivElement, ErrorNoticeProps>(function ErrorNotice(+ {+ message,+ description,+ actions,+ details,+ icon,+ onDismiss,+ dismissLabel,+ children,+ className,+ ...props+ },+ ref,+) {+ const { t } = useTranslation();+ const [expanded, setExpanded] = useState(false);+ useEffect(() => {+ setExpanded(false);+ }, [details]);+ const closeLabel = dismissLabel ?? t('chat.errorBanner.cancelTitle');+ return (+ <div+ ref={ref}+ className={cn(+ 'flex items-start gap-2 rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-3',+ className,+ )}+ {...props}+ >+ <span className="mt-0.5 inline-flex shrink-0 text-[var(--error-fg)]" aria-hidden="true">+ {icon ?? <AlertCircle size={16} />}+ </span>+ <div className="min-w-0 flex-1">+ <div className="break-words text-13 leading-5 text-[var(--text-primary)]">{message}</div>+ {description && (+ <div className="mt-1 text-12 leading-5 text-[var(--text-secondary)]">{description}</div>+ )}+ {children}+ <div className="mt-2 flex flex-wrap items-center gap-2 empty:hidden">+ {actions}+ {details && (+ <Button+ size="sm"+ compact+ tone="quiet"+ aria-expanded={expanded}+ onClick={() => setExpanded((value) => !value)}+ >+ {expanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />}+ {t(expanded ? 'chat.errorBanner.networkHideRaw' : 'chat.errorBanner.networkShowRaw')}+ </Button>+ )}+ </div>+ {details && expanded && (+ <pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-lg bg-[hsl(var(--surface-hsl))] p-2 text-12 leading-5 text-[var(--text-secondary)]">+ {redactSensitiveText(details)}+ </pre>+ )}+ </div>+ {onDismiss && (+ <button+ type="button"+ onClick={onDismiss}+ aria-label={closeLabel}+ title={closeLabel}+ className="-mt-1 -mr-1 flex size-7 shrink-0 items-center justify-center rounded-full text-[var(--text-secondary)] hover:bg-[var(--surface-hover)] hover:text-[var(--text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] transition-colors"+ >+ <X size={14} />+ </button>+ )}+ </div>+ );+});diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsxindex 3976c9dc6e..4a51891619 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx@@ -5304,7 +5304,6 @@ function CCAgentSessionContent({onContinue={handleErrorTailContinue}onDismiss={handleErrorTailDismiss}style={{ width: inputWidth }}- className="py-1"/>) : (<ErrorTailErrorBanner@@ -5333,7 +5332,6 @@ function CCAgentSessionContent({}forkStripEncryptedRunning={forkStripEncryptedRunning}style={{ width: inputWidth }}- className="py-1"/>))}@@ -5352,7 +5350,6 @@ function CCAgentSessionContent({onContinue={handleSessionInterruptContinue}onDismiss={handleSessionInterruptDismiss}style={{ width: inputWidth }}- className="py-1"/>)}@@ -5411,7 +5408,6 @@ function CCAgentSessionContent({}forkStripEncryptedRunning={forkStripEncryptedRunning}style={{ width: inputWidth }}- className="py-1"/>)}@@ -5422,7 +5418,6 @@ function CCAgentSessionContent({<WorktreeRestoreBannersessionId={sessionId}style={{ width: inputWidth }}- className="py-1"/>)}diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex 77273a7e5a..5d2b2bce29 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -1,4 +1,5 @@import { shouldShowOpenPathError } from '../../../shared/openPathResult';+import { ErrorNotice } from '@/components/ui/error-notice';/*** CCAgentFeature 的 Sidebar 上半内容。* ---------------------------------------------------------------------------@@ -374,17 +375,16 @@ function RemoteSidebarLoadNotice({? 'ccAgent.sidebar.machineSwitcher.tasksPartiallyFailed': 'ccAgent.sidebar.machineSwitcher.tasksLoadFailed': 'ccAgent.sidebar.machineSwitcher.devicesLoading';+ if (alarming) return <ErrorNotice role="alert" className="mx-3" message={t(messageKey, { device: deviceLabel })} />;return (<div- role={alarming ? 'alert' : 'status'}+ role="status"className={cn(quietDeviceLoading? 'mx-3 flex flex-col items-center gap-3 px-4 py-8 text-center text-[var(--text-secondary)]': 'border',!quietDeviceLoading &&- (alarming- ? 'border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-fg)]'- : 'border-[var(--border-default)] bg-[var(--surface-chip)] text-[var(--text-secondary)]'),+ 'border-[var(--border-default)] bg-[var(--surface-chip)] text-[var(--text-secondary)]',!quietDeviceLoading &&(partial? 'mx-3 flex items-start gap-2 rounded-[8px] px-3 py-2'diff --git a/apps/desktop/src/renderer/features/cc-agent/GithubSetupDialog.tsx b/apps/desktop/src/renderer/features/cc-agent/GithubSetupDialog.tsxindex 882896eca1..8823d80529 100644--- a/apps/desktop/src/renderer/features/cc-agent/GithubSetupDialog.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/GithubSetupDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useEffect, useRef, useState } from 'react';import * as Dialog from '@radix-ui/react-dialog';import { Check, Copy } from 'lucide-react';@@ -196,9 +197,7 @@ export function GithubSetupDialog({</div>)}{feedback && (- <p role="alert" className="text-12 text-[var(--error-fg)]">- {copy(feedback)}- </p>+ <ErrorNotice role="alert" message={copy(feedback)} />)}<div className="flex justify-end gap-2 pt-1">{completed || unsupported ? (diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsxindex fe93061e2b..dfd85c876a 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx@@ -1,4 +1,5 @@import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';import {Fragment,useCallback,@@ -606,7 +607,7 @@ export function SearchResultsBody({{t('ccAgent.search.searching')}</div>) : status === 'error' ? (- <div className="px-3 py-4 text-center text-12 text-[var(--error-fg)]">{t('ccAgent.search.failed')}</div>+ <ErrorNotice className="m-3" message={t('ccAgent.search.failed')} />) : (results.map((item) => (<SearchResultRow@@ -637,9 +638,7 @@ export function SearchResultsBody({}if (status === 'error') {return (- <div className="px-3 py-6 text-center text-12 text-[var(--error-fg)]">- {t('ccAgent.search.failed')}- </div>+ <ErrorNotice className="m-3" message={t('ccAgent.search.failed')} />);}if (results.length === 0) {diff --git a/apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsx b/apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsxindex d756a4daa8..e30e45ac11 100644--- a/apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';/*** FileBodyView — middle pane of the workdir-browse view.*@@ -985,18 +986,11 @@ export const FileBodyView = forwardRef<FileBodyHandle, FileBodyViewProps>(functi{/* 保存错误 toast —— 出现在按钮组下方,主动重试或切文件后清掉。 */}{saveError && (- <div+ <ErrorNoticerole="alert"- className={cn(- 'absolute right-[18px] top-[54px] z-10 max-w-[360px]',- 'rounded-md border px-3 py-1.5 text-12',- 'border-red-300/70 bg-red-50/95 text-red-700',- 'dark:border-red-800/60 dark:bg-red-950/80 dark:text-red-300',- 'shadow-sm',- )}- >- {t('ccAgent.workdirBrowse.fileBody.saveFailed', { message: saveError })}- </div>+ className="absolute right-[18px] top-[54px] z-10 max-w-[360px]"+ message={t('ccAgent.workdirBrowse.fileBody.saveFailed', { message: saveError })}+ />)}{diff --git a/apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx b/apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsxindex a543aceac7..cce0da2685 100644--- a/apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx+++ b/apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx@@ -1,4 +1,5 @@import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';/*** 添加插件市场对话框:添加表单(来源 / Git 引用 / 稀疏路径)+ 已添加市场的* 管理入口(新开 MarketplaceSourcesDialog,避免本对话框被列表撑长)。@@ -272,19 +273,12 @@ export function AddMarketplaceDialog({</div>{operationError ? (- <div+ <ErrorNoticerole="alert"- className="mt-3 rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] px-4 py-3"- >- <p className="text-12 leading-5 text-[hsl(var(--destructive))]">- {t(operationError.key)}- </p>- {operationError.detail ? (- <pre className="mt-2 max-h-32 overflow-y-auto whitespace-pre-wrap break-all font-mono text-11 leading-4 text-[var(--text-tertiary)]">- {operationError.detail}- </pre>- ) : null}- </div>+ className="mt-3"+ message={t(operationError.key)}+ details={operationError.detail ?? undefined}+ />) : null}{addedSummary ? (diff --git a/apps/desktop/src/renderer/features/plugin/MarketplaceSourcesDialog.tsx b/apps/desktop/src/renderer/features/plugin/MarketplaceSourcesDialog.tsxindex 3d2ef34b62..5fc3625e80 100644--- a/apps/desktop/src/renderer/features/plugin/MarketplaceSourcesDialog.tsx+++ b/apps/desktop/src/renderer/features/plugin/MarketplaceSourcesDialog.tsx@@ -1,4 +1,5 @@import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';/*** 已添加市场管理对话框:从「添加插件市场」里的入口按钮进入。*@@ -166,19 +167,12 @@ export function MarketplaceSourcesDialog({<div className="mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain">{operationError ? (- <div+ <ErrorNoticerole="alert"- className="mb-3 rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] px-4 py-3"- >- <p className="text-12 leading-5 text-[hsl(var(--destructive))]">- {t(operationError.key)}- </p>- {operationError.detail ? (- <pre className="mt-2 max-h-32 overflow-y-auto whitespace-pre-wrap break-all font-mono text-11 leading-4 text-[var(--text-tertiary)]">- {operationError.detail}- </pre>- ) : null}- </div>+ className="mb-3"+ message={t(operationError.key)}+ details={operationError.detail ?? undefined}+ />) : null}{refreshedSummary ? (diff --git a/apps/desktop/src/renderer/features/provider-share/ProviderShareLinkDialog.tsx b/apps/desktop/src/renderer/features/provider-share/ProviderShareLinkDialog.tsxindex fd572b1604..89809399d2 100644--- a/apps/desktop/src/renderer/features/provider-share/ProviderShareLinkDialog.tsx+++ b/apps/desktop/src/renderer/features/provider-share/ProviderShareLinkDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';/*** 生成分享链接(设计稿场景 3):一次性链接、5 分钟倒计时、过期后可重新生成。* 打开即生成;「重新生成链接」再要一条新的,旧链接仍按自己的 5 分钟过期(不提供撤回)。@@ -107,9 +108,7 @@ export function ProviderShareLinkDialog({<p className="mt-2 text-13 leading-[1.5] text-[var(--confirm-desc)]">{t('providerShare.link.description')}</p>{state.status === 'error' ? (- <p role="alert" className="mt-4 text-13 leading-[1.5] text-[var(--text-danger)]">- {state.message}- </p>+ <ErrorNotice role="alert" className="mt-4" message={state.message} />) : (<><div className="mt-4 flex items-center gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface)] py-1 pl-3 pr-1">diff --git a/apps/desktop/src/renderer/features/provider-share/ProviderUsageSection.tsx b/apps/desktop/src/renderer/features/provider-share/ProviderUsageSection.tsxindex 1e6c5d841b..99b4ef4d04 100644--- a/apps/desktop/src/renderer/features/provider-share/ProviderUsageSection.tsx+++ b/apps/desktop/src/renderer/features/provider-share/ProviderUsageSection.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';/*** 「远程与分享」页的「用量」块(供应商组 §7、§10):与设置 → 用量同一套版式(2026-10-17 用户确认原型)——* 右上筛选(使用方、组内电脑、时间范围与日期),下面依次是概览、按人、近 30 天每日 token、活跃热力图、@@ -390,7 +391,7 @@ export function ProviderUsageSection({{t('providerShare.manage.loading')}</p>) : status === 'failed' && !history ? (- <p role="alert" className="-mt-1 mb-3 text-12 text-[var(--error-fg)]">{t('providerGroup.usage.loadFailed')}</p>+ <ErrorNotice role="alert" className="-mt-1 mb-3" message={t('providerGroup.usage.loadFailed')} />) : legacy ? (<p role="status" className="-mt-1 mb-3 text-12 text-[var(--text-tertiary)]">{t('providerGroup.usage.legacyNote', { device: selfDeviceName ?? t('providerGroup.usage.unknownDevice') })}diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsxindex 6569258595..1a69511c6b 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { FileTypeIcon } from '@/components/ui/file-type-icon';import { SegmentedControl } from '@/components/ui/segmented-control';/**@@ -2905,23 +2906,24 @@ function OperationNotice({const errorDetails = errorLines.slice(1).join('\n').trim();if (!error && failed.length === 0) return null;return (- <div className="mt-2 rounded-[8px] border border-[var(--error-border)] bg-[var(--error-bg)] px-2.5 py-2 text-11 leading-relaxed text-[var(--error-fg)]">- {errorTitle ??+ <ErrorNotice+ className="mt-2"+ message={+ errorTitle ??t('rightSidebar.review.actions.partialFailure', {succeeded: summary?.succeeded.length ?? 0,failed: failed.length,- })}- {errorDetails && (- <div className="mt-1 max-h-24 overflow-auto whitespace-pre-wrap break-words font-mono text-10 text-[var(--error-fg-strong)]">- {errorDetails}- </div>- )}- {failed.length > 0 && (- <div className="mt-1 max-h-24 overflow-auto whitespace-pre-wrap break-words font-mono text-10 text-[var(--error-fg-strong)]">- {failed[0].path}: {failed[0].stderr || failed[0].error}- </div>- )}- </div>+ })+ }+ details={+ [+ errorDetails,+ failed.length > 0 ? `${failed[0].path}: ${failed[0].stderr || failed[0].error}` : '',+ ]+ .filter(Boolean)+ .join('\n') || undefined+ }+ />);}diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsxindex ed146bafd1..ba118e3db5 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Button } from '@/components/ui/button';/*** DetailView — a single Subagent run, read as a conversation.@@ -718,9 +719,7 @@ function PiDurableDetailView({</Tip></div>{controlError ? (- <p role="alert" className="px-2 text-11 text-[var(--error-fg)]">- {t('rightSidebar.subagents.controlFailed')}- </p>+ <ErrorNotice role="alert" message={t('rightSidebar.subagents.controlFailed')} />) : null}</div></div>diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsxindex 448441c7be..708028e75a 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';/*** Small shared chrome for the Subagent panel: status glyph, panel/detail* headers, section titles, centered states, the classified error notice and the@@ -7,7 +8,7 @@import type { ReactNode } from 'react';import { useTranslation } from 'react-i18next';-import { AlertCircle, ArrowLeft, type LucideIcon } from 'lucide-react';+import { ArrowLeft, type LucideIcon } from 'lucide-react';import type {SubagentActivityEntry,SubagentRun,@@ -132,23 +133,11 @@ export function SubagentErrorNotice({ rawError }: { rawError: string }) {const { t } = useTranslation();const kind = classifySubagentError(rawError);return (- <div+ <ErrorNoticedata-subagent-error-kind={kind}- className="rounded-xl border border-[color-mix(in_srgb,var(--error-fg)_28%,var(--border-default))] bg-[color-mix(in_srgb,var(--error-fg)_7%,var(--surface-elevated))] px-3 py-2.5"- >- <div className="flex items-start gap-2 text-13 leading-5 text-[var(--error-fg)]">- <AlertCircle size={15} className="mt-0.5 shrink-0" aria-hidden="true" />- <span>{t(`rightSidebar.subagents.errors.${kind}`)}</span>- </div>- <details className="mt-2 text-11 text-[var(--text-tertiary)]">- <summary className="w-fit cursor-pointer rounded-full hover:text-[var(--text-secondary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]">- {t('rightSidebar.subagents.errors.rawDetails')}- </summary>- <pre className="mt-2 max-h-64 select-text overflow-auto whitespace-pre-wrap break-words rounded-lg bg-[var(--msg-code-block-bg)] p-2 font-mono text-11 leading-4 text-[var(--text-secondary)]">- {rawError}- </pre>- </details>- </div>+ message={t(`rightSidebar.subagents.errors.${kind}`)}+ details={rawError}+ />);}diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/__tests__/SubagentsBody.test.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/__tests__/SubagentsBody.test.tsxindex 033c2685d3..a74b8ddaa4 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/__tests__/SubagentsBody.test.tsx+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/__tests__/SubagentsBody.test.tsx@@ -574,7 +574,11 @@ describe('SubagentsBody', () => {expect(container.querySelector('[data-subagent-error-kind]')?.getAttribute('data-subagent-error-kind')).toBe(kind);expect(screen.queryByTestId('session-assistant-message')).toBeNull();- expect(screen.getByText(rawError).closest('details')?.hasAttribute('open')).toBe(false);+ expect(screen.queryByText(rawError)).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'chat.errorBanner.networkShowRaw' }));+ expect(screen.getByText(rawError)).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: 'chat.errorBanner.networkHideRaw' }));+ expect(screen.queryByText(rawError)).toBeNull();});it('protects a completed child result and offers follow-up instead of steer', async () => {diff --git a/apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx b/apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsxindex f87e06ae23..75d2e7f884 100644--- a/apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx+++ b/apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx@@ -1,4 +1,5 @@import { Button } from '@/components/ui/button';+import { ErrorNotice } from '@/components/ui/error-notice';/*** BrowserTabBody —— web-browser tab 的 TabBody。*@@ -29,7 +30,7 @@ import { Button } from '@/components/ui/button';*/import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';-import { AlertTriangle, Gauge, RotateCw, X } from 'lucide-react';+import { Gauge, RotateCw, X } from 'lucide-react';import { useTranslation } from 'react-i18next';import { normalizePersistableFavicon } from '../../../../../shared/faviconPersistence';@@ -630,12 +631,8 @@ function BrowserCrashBanner({: 'rightSidebar.browser.crash.crashedDesc';return (<div className="modal-scrim absolute inset-0 flex items-center justify-center">- <div className="modal-panel flex max-w-xs flex-col items-center gap-3 px-6 py-5 text-center">- <AlertTriangle size={28} strokeWidth={1.5} className="text-[var(--error-fg)]" />- <div className="text-13 font-medium text-[var(--text-primary)]">{t(titleKey)}</div>- <div className="text-12 text-[var(--text-secondary)]">{t(descKey)}</div>- <div className="mt-1 flex items-center gap-2">- <Button variant="cta" size="sm" compact type="button" onClick={onRecover}>+ <ErrorNotice className="max-w-xs" message={t(titleKey)} description={t(descKey)} actions={<>+ <Button size="sm" compact type="button" onClick={onRecover}><RotateCw size={12} strokeWidth={2.5} />{t('rightSidebar.browser.crash.reload')}</Button>@@ -644,8 +641,7 @@ function BrowserCrashBanner({{t('rightSidebar.browser.crash.forceKill')}</Button>)}- </div>- </div>+ </>} /></div>);}diff --git a/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx b/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsxindex 04419a0c44..5b415216db 100644--- a/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx+++ b/apps/desktop/src/renderer/features/scheduler/components/ScheduleFormDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { useCallback, useEffect, useMemo, useState } from 'react';import { useNavigate } from 'react-router-dom';import * as Dialog from '@radix-ui/react-dialog';@@ -1169,19 +1170,18 @@ export function ScheduleFormDialog({)}/>{hookGenFailure && (- <div+ <ErrorNoticerole="alert"- className="rounded-lg border border-[var(--error-border)] bg-[var(--error-bg)] px-3 py-2.5"+ message={t(+ `scheduler.editor.preRunHook.aiFailure.${hookGenFailure.reason}`,+ )}>- <p className="text-12 leading-[1.45] text-[var(--error-fg-strong)]">- {t(`scheduler.editor.preRunHook.aiFailure.${hookGenFailure.reason}`)}- </p>{hookGenFailure.attempts.length > 0 && (<div className="mt-2">- <p className="text-11 text-[var(--error-fg)]">+ <p className="text-11 text-[var(--text-secondary)]">{t('scheduler.editor.preRunHook.aiFailure.checkedCandidates')}</p>- <ul className="mt-1 space-y-0.5 text-11 leading-[1.4] text-[var(--error-fg)]">+ <ul className="mt-1 space-y-0.5 text-11 leading-[1.4] text-[var(--text-secondary)]">{hookGenFailure.attempts.map((attempt, index) => (<li key={`${attempt.providerId}:${attempt.model}:${index}`}><span className="font-mono">@@ -1212,7 +1212,7 @@ export function ScheduleFormDialog({>{t('scheduler.editor.preRunHook.aiFailure.openProviders')}</Button>- </div>+ </ErrorNotice>)}<div className="flex items-center justify-end gap-2"><Buttondiff --git a/apps/desktop/src/renderer/features/skillhub/ScanResultDialog.tsx b/apps/desktop/src/renderer/features/skillhub/ScanResultDialog.tsxindex ca35ee79c6..db7ef9efea 100644--- a/apps/desktop/src/renderer/features/skillhub/ScanResultDialog.tsx+++ b/apps/desktop/src/renderer/features/skillhub/ScanResultDialog.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ui/error-notice';import { Button } from '@/components/ui/button';/*** ScanResultDialog — hub 安全扫描完成后弹出的独立结果弹窗。@@ -284,40 +285,34 @@ export function ScanResultDialog({ open, onClose, result }: ScanResultDialogProp{(rejectionReason || failedGates.length > 0) && (<div className="min-h-0 flex-1 overflow-y-auto px-6 pb-2">{rejectionReason && (- <section className="mb-3 select-text rounded-xl border border-[var(--error-border)] bg-[var(--error-bg)] p-3">- <h3 className="text-sm font-medium text-[var(--text-primary)]">- {t('skillhub.scanResult.rejectionReason')}- </h3>- <p className="mt-2 whitespace-pre-wrap break-words text-sm leading-relaxed text-[var(--text-secondary)]">- {rejectionReason}- </p>- </section>+ <ErrorNotice+ className="mb-3 select-text"+ message={<h3 className="font-medium">{t('skillhub.scanResult.rejectionReason')}</h3>}+ description={<p className="whitespace-pre-wrap break-words">{rejectionReason}</p>}+ />)}{/* Failed gates with details */}{failedGates.length > 0 && (<div className="flex flex-col gap-2">{failedGates.map((gate) => (- <div+ <ErrorNoticekey={gate.name}- className="rounded-lg border border-[var(--error-border)] bg-[var(--error-bg)] p-3"+ message={+ <div className="flex flex-wrap items-center gap-2">+ <span className="text-sm font-medium text-[var(--msg-assistant-text)]">+ {scanGateLabel(gate, t)}+ </span>+ <span+ className={cn(+ 'ml-auto shrink-0 rounded-full border px-2 py-0.5',+ 'border-[var(--error-border)] text-xs font-medium leading-none text-[var(--error-fg)]',+ )}+ >+ {scanStatusLabel(gate.status, t)}+ </span>+ </div>+ }>- <div className="flex items-center gap-2">- <AlertTriangle- size={14}- className="shrink-0 text-[var(--error-fg-strong)]"- />- <span className="text-sm font-medium text-[var(--msg-assistant-text)]">- {scanGateLabel(gate, t)}- </span>- <span- className={cn(- 'ml-auto shrink-0 rounded-full border px-2 py-0.5',- 'border-[var(--error-border)] text-xs font-medium leading-none text-[var(--error-fg)]',- )}- >- {scanStatusLabel(gate.status, t)}- </span>- </div>{visibleScanIssues(gate, t).length > 0 && (<div className="mt-2 flex flex-col gap-1.5 pl-5">{visibleScanIssues(gate, t).map((issue, i) => (@@ -340,7 +335,7 @@ export function ScanResultDialog({ open, onClose, result }: ScanResultDialogProp))}</div>)}- </div>+ </ErrorNotice>))}</div>)}diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 1e55115dc0..5a060951da 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -11205,7 +11205,7 @@},"errorBanner": {"requestFormatError": "The app sent an invalid request, so this reply could not be completed.",- "replyFailed": "This reply could not be completed. Check the error details for more information.",+ "replyFailed": "Could not complete the reply","retryTitle": "Resend the last message","cancelTitle": "Dismiss error","retry": "Retry",@@ -11241,12 +11241,12 @@"syncAuthSuccess": "Synced — click \"Retry\" to resend","syncAuthFailed": "Sync failed: {{msg}}","syncAuthDaemonRestartFailed": "Credentials pushed, but the old daemon did not restart — reconnect to the remote before retrying",- "invalidEncryptedContent": "Switching providers made the previous encryption unusable. This session can only continue under the original provider, or click Fork to drop the protocol-encrypted content and continue in a new session.",- "readableHistoryRecovery": "New task from readable history",- "readableHistoryRecoveryDescription": "If retry keeps failing, create a new task using readable history. Internal encrypted information is omitted. The original task is kept, and the failed message is not resent automatically.",- "forkStripEncrypted": "Fork and strip",- "forkStripEncryptedRunning": "Forking…",- "forkStripEncryptedTitle": "Fork and strip into a new session",+ "invalidEncryptedContent": "The current provider cannot read part of the history. Switch back to the original provider or continue in a new session.",+ "readableHistoryRecovery": "Continue in a New Session",+ "readableHistoryRecoveryDescription": "Create a new session with your chat history. The original session is kept. Send your last message again once the new session opens.",+ "forkStripEncrypted": "Continue in a New Session",+ "forkStripEncryptedRunning": "Creating session…",+ "forkStripEncryptedTitle": "Create a new session with your chat history","forkStripOversizedHistory": "Slim history and continue","forkStripOversizedHistoryRunning": "Forking…","forkStripOversizedHistoryTitle": "Fork into a new task after removing oversized inline images",@@ -11262,8 +11262,8 @@"overloadBusyNoRetry": "The model service is busy — the upstream has no capacity right now. Try again later, or switch to another model.","streamInterrupted": "The model stream was interrupted. This is usually a temporary upstream issue — click Retry.","streamInterruptedNoRetry": "The model stream was interrupted. This is usually a temporary upstream issue. Try again in a little while.",- "networkShowRaw": "Show raw error",- "networkHideRaw": "Hide raw error",+ "networkShowRaw": "Error Details",+ "networkHideRaw": "Hide Details","gatewayProxyTokenInvalid": "Cindy AI credentials are no longer valid. Click Retry. If it happens again, sign out and sign back in","gatewayProxyTokenInvalidNoRetry": "Cindy AI credentials are no longer valid. If it happens again, sign out and sign back in","modelAccessDenied": "The upstream account cannot access this model. Select another model or check its access with the provider",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 521c170367..8e56e0361a 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -11154,7 +11154,7 @@},"errorBanner": {"requestFormatError": "アプリが送信したリクエストの形式に問題があり、返信を完了できませんでした。",- "replyFailed": "返信を完了できませんでした。原因を確認するには、エラーの詳細をご覧ください。",+ "replyFailed": "返信を完了できませんでした","retryTitle": "最後のメッセージを再送信","cancelTitle": "エラーを閉じる","retry": "再試行",@@ -11190,12 +11190,12 @@"syncAuthSuccess": "同期しました — 「再試行」をクリックして再送信してください","syncAuthFailed": "同期に失敗しました:{{msg}}","syncAuthDaemonRestartFailed": "認証情報はリモートに送信されましたが、古い daemon が再起動されませんでした — リモートに再接続してから再試行してください",- "invalidEncryptedContent": "プロバイダーを変更したため、以前の暗号化が使用できなくなりました。このセッションは元のプロバイダーでのみ続行できます。または Fork をクリックしてプロトコル暗号化コンテンツを破棄し、新しいセッションで続行してください。",- "readableHistoryRecovery": "読み取れる履歴から新しいタスクを作成",- "readableHistoryRecoveryDescription": "再試行しても失敗する場合は、読み取れる履歴から新しいタスクを作成できます。内部の暗号化情報は省略されます。元のタスクは保持され、失敗したメッセージは自動で再送信されません。",- "forkStripEncrypted": "Fork して切り離す",- "forkStripEncryptedRunning": "Fork 中…",- "forkStripEncryptedTitle": "暗号化推論を除いた新しいセッションを Fork で作成",+ "invalidEncryptedContent": "現在のプロバイダーでは履歴の一部を読み取れません。元のプロバイダーに戻すか、新しいセッションで続けてください。",+ "readableHistoryRecovery": "新しいセッションで続ける",+ "readableHistoryRecoveryDescription": "チャット履歴を引き継いで新しいセッションを作成できます。元のセッションは残ります。作成後、直前のメッセージをもう一度送信してください。",+ "forkStripEncrypted": "新しいセッションで続ける",+ "forkStripEncryptedRunning": "セッションを作成中…",+ "forkStripEncryptedTitle": "チャット履歴を引き継いで新しいセッションを作成","forkStripOversizedHistory": "履歴を縮小して続ける","forkStripOversizedHistoryRunning": "Fork 中…","forkStripOversizedHistoryTitle": "過大なインライン画像を除いた新しいタスクへ Fork",@@ -11211,8 +11211,8 @@"overloadBusyNoRetry": "モデルサービスが混雑しています。上流に空き容量がありません。しばらくしてから再試行するか、別のモデルに切り替えてください","streamInterrupted": "モデル出力が途中で中断されました。一時的な上流障害であることが多いので、「再試行」を押してください","streamInterruptedNoRetry": "モデル出力が途中で中断されました。一時的な上流障害であることが多いので、しばらくしてから再試行してください",- "networkShowRaw": "元のエラーを表示",- "networkHideRaw": "元のエラーを隠す",+ "networkShowRaw": "エラーの詳細",+ "networkHideRaw": "詳細を閉じる","gatewayProxyTokenInvalid": "Cindy AI の認証情報が無効になりました。「再試行」をクリックしてください。繰り返す場合はサインアウトしてから再ログインしてください","gatewayProxyTokenInvalidNoRetry": "Cindy AI の認証情報が無効になりました。繰り返す場合はサインアウトしてから再ログインしてください","modelAccessDenied": "接続先のアカウントにはこのモデルへのアクセス権限がありません。別のモデルに切り替えるか、プロバイダーにアクセス権限を確認してください",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 37b6caf5ca..97ff3bc128 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -11154,7 +11154,7 @@},"errorBanner": {"requestFormatError": "앱이 보낸 요청 형식에 문제가 있어 답변을 완료하지 못했습니다.",- "replyFailed": "답변을 완료하지 못했습니다. 오류 세부 정보에서 원인을 확인하세요.",+ "replyFailed": "답변을 완료하지 못했습니다","retryTitle": "마지막 메시지 다시 보내기","cancelTitle": "오류 알림 닫기","retry": "다시 시도",@@ -11190,12 +11190,12 @@"syncAuthSuccess": "동기화되었습니다 — 「다시 시도」를 클릭하여 다시 보내세요","syncAuthFailed": "동기화 실패: {{msg}}","syncAuthDaemonRestartFailed": "자격 증명이 원격에 푸시되었지만 이전 daemon이 재시작되지 않았습니다 — 원격에 다시 연결한 후 재시도하세요",- "invalidEncryptedContent": "제공자 변경으로 이전 암호화를 사용할 수 없습니다. 이 세션은 원래 제공자에서만 계속할 수 있으며, 또는 Fork를 클릭하여 프로토콜 암호화 콘텐츠를 버리고 새 세션에서 계속할 수 있습니다.",- "readableHistoryRecovery": "읽을 수 있는 기록으로 새 작업 만들기",- "readableHistoryRecoveryDescription": "재시도해도 실패하면 읽을 수 있는 기록으로 새 작업을 만들 수 있습니다. 내부 암호화 정보는 제외됩니다. 기존 작업은 유지되며 실패한 메시지는 자동으로 다시 전송되지 않습니다.",- "forkStripEncrypted": "Fork 및 분리",- "forkStripEncryptedRunning": "Fork 중…",- "forkStripEncryptedTitle": "암호화 추론을 제거한 새 세션으로 Fork",+ "invalidEncryptedContent": "현재 제공자가 기록의 일부를 읽을 수 없습니다. 원래 제공자로 돌아가거나 새 세션에서 계속하세요.",+ "readableHistoryRecovery": "새 세션에서 계속하기",+ "readableHistoryRecoveryDescription": "채팅 기록을 이어받아 새 세션을 만들 수 있습니다. 기존 세션은 유지됩니다. 새 세션이 열리면 마지막 메시지를 다시 보내 주세요.",+ "forkStripEncrypted": "새 세션에서 계속하기",+ "forkStripEncryptedRunning": "세션 만드는 중…",+ "forkStripEncryptedTitle": "채팅 기록을 이어받아 새 세션 만들기","forkStripOversizedHistory": "기록을 줄인 뒤 계속","forkStripOversizedHistoryRunning": "Fork 중…","forkStripOversizedHistoryTitle": "과대한 인라인 이미지를 제거한 새 작업으로 Fork",@@ -11211,8 +11211,8 @@"overloadBusyNoRetry": "모델 서비스가 혼잡합니다. 상위 서비스에 여유 용량이 없습니다. 잠시 후 다시 시도하거나 다른 모델로 바꿔 보세요","streamInterrupted": "모델 출력이 중간에 중단되었습니다. 보통은 일시적인 상위 서비스 장애입니다. \"재시도\"를 눌러 주세요","streamInterruptedNoRetry": "모델 출력이 중간에 중단되었습니다. 보통은 일시적인 상위 서비스 장애입니다. 잠시 후 다시 시도해 주세요",- "networkShowRaw": "원본 오류 보기",- "networkHideRaw": "원본 오류 숨기기",+ "networkShowRaw": "오류 상세 정보",+ "networkHideRaw": "상세 정보 접기","gatewayProxyTokenInvalid": "Cindy AI 자격 증명이 더 이상 유효하지 않습니다. 재시도를 클릭하세요. 반복되면 로그아웃 후 다시 로그인하세요","gatewayProxyTokenInvalidNoRetry": "Cindy AI 자격 증명이 더 이상 유효하지 않습니다. 반복되면 로그아웃 후 다시 로그인하세요","modelAccessDenied": "연결된 서비스 계정에 이 모델의 접근 권한이 없습니다. 다른 모델로 전환하거나 제공자에게 모델 접근 권한을 확인하세요",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 75ab7584ca..2405da9531 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -11154,7 +11154,7 @@},"errorBanner": {"requestFormatError": "应用发送的请求格式有误,本次回复未能完成。",- "replyFailed": "本次回复未能完成。请查看错误详情以了解原因。",+ "replyFailed": "回复未完成","retryTitle": "重新发送最后一条消息","cancelTitle": "关闭错误提示","retry": "重试",@@ -11190,12 +11190,12 @@"syncAuthSuccess": "已同步,请点击「重试」重新发送","syncAuthFailed": "同步失败:{{msg}}","syncAuthDaemonRestartFailed": "凭证已推送到远端,但旧 daemon 没重启 — 请重连远端后再点重试",- "invalidEncryptedContent": "由于更换供应商导致加密不可用,本任务只能在原供应商下使用,或点此 Fork 丢弃协议加密内容并在新任务继续。",- "readableHistoryRecovery": "用可读历史新建任务",- "readableHistoryRecoveryDescription": "如果重试仍然失败,可用可读历史新建任务,省略内部加密信息。原任务保留,失败消息不会自动重发。",- "forkStripEncrypted": "Fork 并剥离",- "forkStripEncryptedRunning": "Fork 中…",- "forkStripEncryptedTitle": "Fork 并剥离出新任务(去掉加密推理内容)",+ "invalidEncryptedContent": "当前供应商无法读取部分历史内容。可切回原供应商,或在新任务中继续。",+ "readableHistoryRecovery": "在新任务中继续",+ "readableHistoryRecoveryDescription": "可带上已有对话记录,在新任务中继续。原任务会保留;创建后,请重新发送刚才的消息。",+ "forkStripEncrypted": "在新任务中继续",+ "forkStripEncryptedRunning": "正在创建任务…",+ "forkStripEncryptedTitle": "保留对话记录,创建新任务","forkStripOversizedHistory": "瘦身后继续","forkStripOversizedHistoryRunning": "Fork 中…","forkStripOversizedHistoryTitle": "去掉过大的历史图片后 Fork 成新任务",@@ -11211,8 +11211,8 @@"overloadBusyNoRetry": "模型服务繁忙,上游暂时没有可用容量。可稍后重试,或换一个模型。","streamInterrupted": "模型输出中途中断了。通常是上游暂时故障,可点击「重试」。","streamInterruptedNoRetry": "模型输出中途中断了。通常是上游暂时故障,请稍后重试。",- "networkShowRaw": "查看原始错误",- "networkHideRaw": "收起原始错误",+ "networkShowRaw": "错误详情",+ "networkHideRaw": "收起详情","gatewayProxyTokenInvalid": "Cindy AI 凭据已失效。请点击「重试」。若仍失败,请退出后重新登录","gatewayProxyTokenInvalidNoRetry": "Cindy AI 凭据已失效。若后续仍失败,请退出后重新登录","modelAccessDenied": "当前上游账号无权访问此模型。请切换模型,或向供应商确认模型访问权限",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 6e9cc33e09..fc4a4532fe 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -11153,7 +11153,7 @@},"errorBanner": {"requestFormatError": "應用程式送出的請求格式有誤,本次回覆未能完成。",- "replyFailed": "本次回覆未能完成。請查看錯誤詳情以瞭解原因。",+ "replyFailed": "回覆未完成","retryTitle": "重新傳送最後一條訊息","cancelTitle": "關閉錯誤提示","retry": "重試",@@ -11189,12 +11189,12 @@"syncAuthSuccess": "已同步,請點選「重試」重新傳送","syncAuthFailed": "同步失敗:{{msg}}","syncAuthDaemonRestartFailed": "憑證已推送到遠端,但舊 daemon 沒重啟 — 請重連遠端後再點重試",- "invalidEncryptedContent": "由於更換供應商導致加密不可用,本任務只能在原供應商下使用,或點此 Fork 丟棄協議加密內容並在新任務繼續。",- "readableHistoryRecovery": "用可讀歷史建立新任務",- "readableHistoryRecoveryDescription": "如果重試仍然失敗,可用可讀歷史建立新任務,略過內部加密資訊。原任務會保留,失敗訊息不會自動重新傳送。",- "forkStripEncrypted": "Fork 並剝離",- "forkStripEncryptedRunning": "Fork 中…",- "forkStripEncryptedTitle": "Fork 並剝離出新任務(去掉加密推理內容)",+ "invalidEncryptedContent": "目前的供應商無法讀取部分歷史內容。可切回原供應商,或在新任務中繼續。",+ "readableHistoryRecovery": "在新任務中繼續",+ "readableHistoryRecoveryDescription": "可帶上既有對話記錄,在新任務中繼續。原任務會保留;建立後,請重新傳送剛才的訊息。",+ "forkStripEncrypted": "在新任務中繼續",+ "forkStripEncryptedRunning": "正在建立任務…",+ "forkStripEncryptedTitle": "保留對話記錄,建立新任務","forkStripOversizedHistory": "瘦身後繼續","forkStripOversizedHistoryRunning": "Fork 中…","forkStripOversizedHistoryTitle": "去掉過大的歷史圖片後 Fork 成新任務",@@ -11210,8 +11210,8 @@"overloadBusyNoRetry": "模型服務繁忙,上游暫時沒有可用容量。可稍後重試,或換一個模型。","streamInterrupted": "模型輸出中途中斷了。通常是上游暫時故障,可點選「重試」。","streamInterruptedNoRetry": "模型輸出中途中斷了。通常是上游暫時故障,請稍後重試。",- "networkShowRaw": "檢視原始錯誤",- "networkHideRaw": "收起原始錯誤",+ "networkShowRaw": "錯誤詳情",+ "networkHideRaw": "收起詳情","gatewayProxyTokenInvalid": "Cindy AI 憑據已失效。請點「重試」。若仍失敗,請退出後重新登入","gatewayProxyTokenInvalidNoRetry": "Cindy AI 憑據已失效。若後續仍失敗,請退出後重新登入","modelAccessDenied": "目前上游帳號無權存取此模型。請切換模型,或向供應商確認模型存取權限",diff --git a/apps/mobile/app/devices/manage.tsx b/apps/mobile/app/devices/manage.tsxindex df1f460e59..41a20ef67a 100644--- a/apps/mobile/app/devices/manage.tsx+++ b/apps/mobile/app/devices/manage.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ErrorNotice';import { useIsFocused, useRouter } from 'expo-router';import { useCallback, useEffect, useRef } from 'react';import { ActivityIndicator, StyleSheet, View } from 'react-native';@@ -83,10 +84,7 @@ function DeviceManagementContent() {onBack={() => goBackGuarded(router)}/>{manager.error ? (- <View style={styles.errorBlock}>- <Text accessibilityRole="alert" style={styles.errorText}>- {manager.error}- </Text>+ <ErrorNotice accessibilityRole="alert" style={styles.errorBlock} message={manager.error}><MainWindowActionButtonaction={{busy: manager.loading,@@ -96,7 +94,7 @@ function DeviceManagementContent() {}}style={styles.retryButton}/>- </View>+ </ErrorNotice>) : null}{initialLoading ? (<ActivityIndicator color={colors.textSecondary} style={styles.loading} />@@ -128,7 +126,7 @@ function DeviceManagementContent() {const makeStyles = (colors: ThemeColors) => StyleSheet.create({screen: { backgroundColor: colors.surface, flex: 1 },- errorBlock: { alignItems: 'flex-start', gap: spacing.md, padding: spacing.lg },+ errorBlock: { marginHorizontal: spacing.lg, marginBottom: spacing.md },// 报错说明:13/18 errorText(黑白系)。errorText: { color: colors.errorText, fontSize: typeScale.footnote, fontWeight: fontWeight.regular, lineHeight: lineHeight.caption },retryButton: { alignSelf: 'flex-start' },diff --git a/apps/mobile/app/devices/manage/[deviceId].tsx b/apps/mobile/app/devices/manage/[deviceId].tsxindex 4118556f45..1e9e51584a 100644--- a/apps/mobile/app/devices/manage/[deviceId].tsx+++ b/apps/mobile/app/devices/manage/[deviceId].tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ErrorNotice';import { Host, List, ListItem, Text as NativeText } from '@expo/ui';import { List as SwiftUIList } from '@expo/ui/swift-ui';import { scrollContentBackground } from '@expo/ui/swift-ui/modifiers';@@ -110,10 +111,7 @@ function DeviceInformationContent({ deviceId }: { deviceId: string }) {<ActivityIndicator color={colors.textSecondary} style={styles.loading} />) : null}{manager.error ? (- <View style={styles.errorBlock}>- <Text accessibilityRole="alert" style={styles.errorText}>- {manager.error}- </Text>+ <ErrorNotice accessibilityRole="alert" style={styles.errorBlock} message={manager.error}><MainWindowActionButtonaction={{busy: manager.loading,@@ -123,7 +121,7 @@ function DeviceInformationContent({ deviceId }: { deviceId: string }) {}}style={styles.retryButton}/>- </View>+ </ErrorNotice>) : null}{!device && !manager.loading && !manager.error ? (<Text style={styles.notFound}>@@ -190,7 +188,7 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({host: { backgroundColor: colors.surface, flex: 1 },headerButton: { alignItems: 'center', height: 44, justifyContent: 'center', width: 44 },loading: { paddingVertical: spacing.lg },- errorBlock: { alignItems: 'flex-start', gap: spacing.md, padding: spacing.lg },+ errorBlock: { marginHorizontal: spacing.lg, marginBottom: spacing.md },// 报错说明:13/18 errorText(黑白系)。errorText: { color: colors.errorText, fontSize: typeScale.footnote, fontWeight: fontWeight.regular, lineHeight: lineHeight.caption },retryButton: { alignSelf: 'flex-start' },diff --git a/apps/mobile/app/sessions/new.tsx b/apps/mobile/app/sessions/new.tsxindex 6b3a372a4b..387ff337dc 100644--- a/apps/mobile/app/sessions/new.tsx+++ b/apps/mobile/app/sessions/new.tsx@@ -1,4 +1,5 @@import { useNewSessionHostDefaults } from '@/session/useNewSessionHostDefaults';+import { ErrorNotice } from '@/components/ErrorNotice';import { useNewSessionDefaultSelection } from '@/session/useNewSessionDefaultSelection';import { parseGoalCommand } from '@cindy/maker-shared/goal-command';import { mergeMobileGoalCommand, parseMobileDesktopCommand } from '@/session/desktopSlashCommands';@@ -6313,7 +6314,7 @@ export default function NewRemoteSessionScreen() {{newSessionText('showHiddenDirectories')}</Text></Pressable>- {browseError ? <Text style={styles.errorText}>{browseError}</Text> : null}+ {browseError ? <ErrorNotice message={browseError} /> : null}<FlatListstyle={styles.browseList}contentContainerStyle={styles.browseListContent}@@ -6338,7 +6339,7 @@ export default function NewRemoteSessionScreen() {) : null}{error ? (- <Text style={styles.errorText}>{describeAgentAuthError(error) ?? error}</Text>+ <ErrorNotice message={describeAgentAuthError(error) ?? error} />) : null}{/* 发送前鉴权提示:选中 agent 在被控端无已连接供应商时提前告知;error 已展示(含被门禁拦截的同款文案)时不重复出现。 */}diff --git a/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx b/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsxindex defc972cbb..c4e2745967 100644--- a/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx+++ b/apps/mobile/src/__tests__/AgentErrorLocalization.test.tsx@@ -23,7 +23,7 @@ vi.mock('react-native', async () => {StyleSheet: { create: (s: unknown) => s, hairlineWidth: 1 } };});vi.mock('@/components/AppText', async () => ({ Text: (await import('react-native')).Text }));-vi.mock('lucide-react-native', () => ({ Pause: () => null, Play: () => null }));+vi.mock('lucide-react-native', () => ({ Pause: () => null, Play: () => null, CircleAlert: () => null, Split: () => null, X: () => null, ChevronRight: () => null, ChevronDown: () => null }));vi.mock('@/theme', async () => {const tokens = await import('@/theme/tokens');return { ...tokens, useTheme: () => ({ colors: tokens.lightColors }),@@ -48,12 +48,13 @@ describe.each(SUPPORTED_LOCALES)('mobile errors in %s', locale => {await i18n.changeLanguage(locale);const recover = vi.fn();const retry = vi.fn();+ const dismiss = vi.fn();const error = 'stream disconnected before completion: stream closed before response.completed';const renderBanner = (busy: boolean) => surface === 'live'? <InlineQueueSection projection={{ error, errorRetryText: 'original' } as InputProjection} busy={busy}- onRecoverHistory={recover} onRetryError={retry} onClearError={vi.fn()} onResume={vi.fn()} />+ onRecoverHistory={recover} onRetryError={retry} onClearError={dismiss} onResume={vi.fn()} />: <SessionTailBanner state={{ kind: 'error-tail', text: error, rawError: error, clientId: 'e', continueKind: 'error', retryable: true }}- busy={busy} onRecoverHistory={recover} onContinue={retry} onDismiss={vi.fn()} />;+ busy={busy} onRecoverHistory={recover} onContinue={retry} onDismiss={dismiss} />;await act(async () => root.render(renderBanner(false)));expect(host.textContent).toContain(i18n.t('session.tail.readableHistoryRecoveryDescription'));expect(recover).not.toHaveBeenCalled();@@ -62,9 +63,17 @@ describe.each(SUPPORTED_LOCALES)('mobile errors in %s', locale => {expect(retry).not.toHaveBeenCalled();await act(async () => root.render(renderBanner(true)));const button = host.querySelector<HTMLButtonElement>('[data-testid="session.readableHistoryRecovery"]')!;+ const closeId = surface === 'live' ? 'queue.inline.clearErrorButton' : 'session.tailBanner.dismiss';+ const close = host.querySelector<HTMLButtonElement>(`[data-testid="${closeId}"]`)!;+ expect(close.disabled).toBe(true);+ await act(async () => close.click());+ expect(dismiss).not.toHaveBeenCalled();expect(button.disabled).toBe(true);await act(async () => button.click());expect(recover).toHaveBeenCalledOnce();+ await act(async () => root.render(renderBanner(false)));+ await act(async () => host.querySelector<HTMLButtonElement>(`[data-testid="${closeId}"]`)!.click());+ expect(dismiss).toHaveBeenCalledOnce();});it.each(['live', 'tail'] as const)('localizes %s, preserves retry and switches locale without another request', async surface => {diff --git a/apps/mobile/src/__tests__/pluginNativeViews.test.tsx b/apps/mobile/src/__tests__/pluginNativeViews.test.tsxindex 5475dad4bf..ed73b7bcb5 100644--- a/apps/mobile/src/__tests__/pluginNativeViews.test.tsx+++ b/apps/mobile/src/__tests__/pluginNativeViews.test.tsx@@ -140,12 +140,21 @@ vi.mock("react-native", () => ({TextInput: () => null,Pressable: (p: any) => p.children,ActivityIndicator: () => null,+ AccessibilityInfo: { isReduceMotionEnabled: async () => false, addEventListener: () => ({ remove() {} }) },StyleSheet: { create: (s: any) => s },}));vi.mock("lucide-react-native", () => ({+ CircleAlert: () => null,Puzzle: () => null,Wrench: () => null,}));+vi.mock('@/components/AppText', async () => {+ const native = await import('react-native');+ return { Text: native.Text, TextInput: native.TextInput, MAX_FONT_SIZE_MULTIPLIER: 1.2 };+});+vi.mock('@/components/MobilePrimitives', () => ({+ MainWindowActionButton: ({ action }: any) => createElement('button', { onClick: action.onPress, disabled: action.disabled || action.busy }, action.label),+}));vi.mock("react-i18next", () => ({useTranslation: () => ({ t: (key: string) => key, i18n: { language: "en" } }),}));diff --git a/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx b/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsxindex db4103b73a..86a0dd758c 100644--- a/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx+++ b/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx@@ -49,7 +49,7 @@ vi.mock('@/components/AppText', async () => {vi.mock('react-native-safe-area-context', () => ({ useSafeAreaInsets: () => ({ top: 40, bottom: 20 }) }));vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));vi.mock('lucide-react-native', () => ({- ...Object.fromEntries(['Brain', 'SlidersHorizontal', 'Check', 'Zap', 'LayoutGrid', 'Search', 'X', 'ChevronDown', 'ChevronRight', 'ChevronsUpDown'].map(key => [key, () => null])),+ ...Object.fromEntries(['Brain', 'SlidersHorizontal', 'Check', 'Zap', 'LayoutGrid', 'Search', 'X', 'ChevronDown', 'ChevronRight', 'ChevronsUpDown', 'CircleAlert'].map(key => [key, () => null])),Star: ({ fill, color }: any) => createElement('span', { 'data-star-fill': fill, 'data-star-color': color }),}));vi.mock('@expo/ui/swift-ui', async () => {@@ -65,8 +65,8 @@ vi.mock('@expo/ui/swift-ui', async () => {};});vi.mock('@expo/ui/swift-ui/modifiers', () => ({...Object.fromEntries(- ['accessibilityElement', 'accessibilityHidden', 'opacity', 'scrollDisabled', 'scrollContentBackground', 'presentationDetents', 'presentationDragIndicator', 'interactiveDismissDisabled', 'contentShape', 'accessibilityLabel', 'buttonStyle', 'disabled', 'font', 'foregroundStyle', 'frame', 'pickerStyle', 'progressViewStyle', 'tint', 'tag', 'padding', 'autocorrectionDisabled', 'textInputAutocapitalization', 'lineLimit'].map(key => [key, (value: any) => ({ [key]: value })]),-), shapes:{rectangle:()=>({})}}));+ ['background', 'fixedSize', 'accessibilityElement', 'accessibilityHidden', 'opacity', 'scrollDisabled', 'scrollContentBackground', 'presentationDetents', 'presentationDragIndicator', 'interactiveDismissDisabled', 'contentShape', 'accessibilityLabel', 'buttonStyle', 'disabled', 'font', 'foregroundStyle', 'frame', 'pickerStyle', 'progressViewStyle', 'tint', 'tag', 'padding', 'autocorrectionDisabled', 'textInputAutocapitalization', 'lineLimit'].map(key => [key, (value: any) => ({ [key]: value })]),+), shapes:{rectangle:()=>({}), roundedRectangle:(value: any)=>value}}));vi.mock('@expo/ui', () => ({Host:({children}:any)=>children}));vi.mock('@/session/ComposerSheet', () => import('@/session/ComposerSheet.ios'));vi.mock('@/session/ComposerNativeSection', () => ({ ComposerNativeSection: ({ children, title }: any) => createElement('div', null, title, children) }));diff --git a/apps/mobile/src/components/ErrorNotice.tsx b/apps/mobile/src/components/ErrorNotice.tsxnew file mode 100644index 0000000000..0522556fbc--- /dev/null+++ b/apps/mobile/src/components/ErrorNotice.tsx@@ -0,0 +1,210 @@+import type { ReactNode } from 'react';+import { Pressable, StyleSheet, View, type ViewProps } from 'react-native';+import { CircleAlert, X } from 'lucide-react-native';+import { mobileInteractionStyles } from './mobileInteractionStyles';+import { Text } from '@/components/AppText';+import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';+import {+ fontWeight,+ iconSize,+ iconStroke,+ lineHeight,+ radius,+ spacing,+ typeScale,+} from '@/theme/tokens';++/** Mobile counterpart of the shared desktop error card; recovery stays with the caller. */+export function ErrorNotice({+ message,+ messageTestID,+ description,+ actions,+ icon,+ onDismiss,+ dismissLabel,+ dismissTestID,+ dismissDisabled,+ dismissHint,+ children,+ style,+ ...props+}: ViewProps & {+ message: string;+ messageTestID?: string;+ description?: string;+ actions?: ReactNode;+ icon?: ReactNode;+ onDismiss?: () => void;+ dismissLabel?: string;+ dismissTestID?: string;+ dismissDisabled?: boolean;+ dismissHint?: string;+ children?: ReactNode;+}) {+ const styles = useThemedStyles(makeStyles);+ const { colors } = useTheme();+ return (+ <View style={[styles.card, style]} {...props}>+ <View style={styles.header}>+ <View+ accessibilityElementsHidden+ importantForAccessibility="no-hide-descendants"+ style={styles.icon}+ >+ {icon ?? (+ <CircleAlert+ color={colors.statusError}+ size={iconSize.sm}+ strokeWidth={iconStroke.regular}+ />+ )}+ </View>+ <View style={styles.heading}>+ <Text selectable style={styles.message} testID={messageTestID}>+ {message}+ </Text>+ {description ? (+ <Text style={styles.description}>{description}</Text>+ ) : null}+ </View>+ {onDismiss ? (+ <Pressable+ accessibilityRole="button"+ accessibilityLabel={dismissLabel}+ accessibilityHint={dismissHint}+ accessibilityState={{ disabled: !!dismissDisabled }}+ disabled={dismissDisabled}+ testID={dismissTestID}+ onPress={onDismiss}+ hitSlop={4}+ style={({ pressed }) => [+ styles.close,+ dismissDisabled && styles.disabled,+ pressed && mobileInteractionStyles.pressed,+ ]}+ >+ <X+ color={colors.textSecondary}+ size={iconSize.sm}+ strokeWidth={iconStroke.regular}+ />+ </Pressable>+ ) : null}+ </View>+ {children ? <View style={styles.content}>{children}</View> : null}+ {actions ? <View style={styles.actions}>{actions}</View> : null}+ </View>+ );+}++/** A compact button face with a full-height touch target. */+export function ErrorNoticeAction({+ label,+ icon,+ onPress,+ disabled,+ hint,+ testID,+ primary,+}: {+ label: string;+ icon?: ReactNode;+ onPress(): void;+ disabled?: boolean;+ hint?: string;+ testID?: string;+ primary?: boolean;+}) {+ const styles = useThemedStyles(makeStyles);+ return (+ <Pressable+ accessibilityRole="button"+ accessibilityLabel={label}+ accessibilityHint={hint}+ accessibilityState={{ disabled: !!disabled }}+ disabled={disabled}+ onPress={onPress}+ testID={testID}+ style={({ pressed }) => [+ styles.actionTarget,+ pressed && mobileInteractionStyles.pressed,+ disabled && styles.disabled,+ ]}+ >+ <View style={[styles.actionFace, primary && styles.primaryFace]}>+ {icon}+ <Text style={styles.actionLabel}>{label}</Text>+ </View>+ </Pressable>+ );+}++const makeStyles = (colors: ThemeColors) =>+ StyleSheet.create({+ card: {+ gap: spacing.lg,+ borderRadius: radius.container,+ borderWidth: StyleSheet.hairlineWidth,+ borderColor: colors.border,+ backgroundColor: colors.surfaceElevated,+ padding: spacing.lg,+ },+ header: { flexDirection: 'row', alignItems: 'flex-start', gap: spacing.sm },+ icon: { paddingTop: (lineHeight.caption - iconSize.sm) / 2 },+ heading: { flex: 1, minWidth: 0, gap: spacing.sm },+ close: {+ minWidth: 44,+ minHeight: 44,+ marginTop: -spacing.sm,+ marginRight: -spacing.sm,+ marginBottom: -spacing.sm,+ alignItems: 'center',+ justifyContent: 'center',+ borderRadius: radius.pill,+ },+ content: { minWidth: 0, gap: spacing.sm },+ disabled: { opacity: 0.5 },+ actionTarget: { minHeight: 44, maxWidth: '100%', justifyContent: 'center' },+ actionFace: {+ minHeight: lineHeight.bodySmall + spacing.sm * 2,+ flexDirection: 'row',+ alignItems: 'center',+ justifyContent: 'center',+ gap: spacing.sm,+ paddingHorizontal: spacing.md,+ paddingVertical: spacing.sm,+ borderRadius: radius.pill,+ borderWidth: StyleSheet.hairlineWidth,+ borderColor: colors.border,+ },+ primaryFace: {+ backgroundColor: colors.surfaceChip,+ borderColor: colors.surfaceChip,+ },+ actionLabel: {+ flexShrink: 1,+ color: colors.textPrimary,+ fontSize: typeScale.bodySmall,+ lineHeight: lineHeight.bodySmall,+ fontWeight: fontWeight.medium,+ },+ actions: {+ flexDirection: 'row',+ flexWrap: 'wrap',+ alignItems: 'center',+ gap: spacing.md,+ },+ message: {+ color: colors.textPrimary,+ fontSize: typeScale.footnote,+ lineHeight: lineHeight.caption,+ fontWeight: fontWeight.regular,+ },+ description: {+ color: colors.textSecondary,+ fontSize: typeScale.footnote,+ lineHeight: lineHeight.caption,+ fontWeight: fontWeight.regular,+ },+ });diff --git a/apps/mobile/src/components/NativeErrorNotice.ios.tsx b/apps/mobile/src/components/NativeErrorNotice.ios.tsxnew file mode 100644index 0000000000..9fd9dde1db--- /dev/null+++ b/apps/mobile/src/components/NativeErrorNotice.ios.tsx@@ -0,0 +1,48 @@+import { HStack, RNHostView, Text } from '@expo/ui/swift-ui';+import {+ fixedSize,+ font,+ foregroundStyle,+ frame,+} from '@expo/ui/swift-ui/modifiers';+import { View } from 'react-native';+import { CircleAlert } from 'lucide-react-native';+import { iconSize, iconStroke, spacing, typeScale, useTheme } from '@/theme';++/** Error row inside an existing SwiftUI section; the section owns its card surface. */+export function NativeErrorNotice({+ message,+ testID,+}: {+ message: string;+ testID?: string;+}) {+ const { colors } = useTheme();+ return (+ <HStack alignment="top" spacing={spacing.sm}>+ <RNHostView matchContents>+ <View+ accessibilityElementsHidden+ style={{ width: iconSize.sm, height: iconSize.sm }}+ >+ <CircleAlert+ color={colors.statusError}+ size={iconSize.sm}+ strokeWidth={iconStroke.regular}+ />+ </View>+ </RNHostView>+ <Text+ testID={testID}+ modifiers={[+ font({ size: typeScale.footnote, weight: 'regular' }),+ foregroundStyle(colors.textSecondary),+ fixedSize({ horizontal: false, vertical: true }),+ frame({ maxWidth: Infinity, alignment: 'leading' }),+ ]}+ >+ {message}+ </Text>+ </HStack>+ );+}diff --git a/apps/mobile/src/i18n/locales/en/session.json b/apps/mobile/src/i18n/locales/en/session.jsonindex 61b76d4902..3f81ff24f6 100644--- a/apps/mobile/src/i18n/locales/en/session.json+++ b/apps/mobile/src/i18n/locales/en/session.json@@ -503,15 +503,16 @@"deleteOne": "Delete this message"},"tail": {- "readableHistoryRecovery": "New task from readable history",- "readableHistoryRecoveryDescription": "If retry keeps failing, create a new task using readable history. Internal encrypted information is omitted. The original task is kept, and the failed message is not resent automatically.",+ "readableHistoryRecovery": "Continue in a New Session",+ "readableHistoryRecoveryDescription": "Keep your chat history and original session. Resend your last message in the new session.","requestFormatError": "The app sent an invalid request, so this reply could not be completed.",- "replyFailed": "This reply could not be completed. Check the error details for more information.",- "showErrorDetails": "Show Error Details",- "hideErrorDetails": "Hide Error Details",+ "replyFailed": "Could not complete the reply",+ "showErrorDetails": "Error Details",+ "hideErrorDetails": "Hide Details","interrupted": "The app exited mid-task, so it was interrupted.","continueTask": "Continue Task","retry": "Retry",+ "dismissNotice": "Dismiss notice","ignore": "Ignore","executionResultUnavailable": "Unable to retrieve the execution result. Automatic continuation has stopped. Ask the assistant to check the existing execution result.","outputLimit": "The model reached its output limit, so this response may be incomplete. Send the next message to continue.",diff --git a/apps/mobile/src/i18n/locales/ja/session.json b/apps/mobile/src/i18n/locales/ja/session.jsonindex 668d15aeee..2e0bc4c5bb 100644--- a/apps/mobile/src/i18n/locales/ja/session.json+++ b/apps/mobile/src/i18n/locales/ja/session.json@@ -503,15 +503,16 @@"deleteOne": "このメッセージを削除"},"tail": {- "readableHistoryRecovery": "読み取れる履歴から新しいタスクを作成",- "readableHistoryRecoveryDescription": "再試行しても失敗する場合は、読み取れる履歴から新しいタスクを作成できます。内部の暗号化情報は省略されます。元のタスクは保持され、失敗したメッセージは自動で再送信されません。",+ "readableHistoryRecovery": "新しいセッションで続ける",+ "readableHistoryRecoveryDescription": "チャット履歴を引き継ぎ、元のセッションも残します。新しいセッションで直前のメッセージを再送してください。","requestFormatError": "アプリが送信したリクエストの形式に問題があり、返信を完了できませんでした。",- "replyFailed": "返信を完了できませんでした。原因を確認するには、エラーの詳細をご覧ください。",- "showErrorDetails": "エラーの詳細を表示",- "hideErrorDetails": "エラーの詳細を隠す",+ "replyFailed": "返信を完了できませんでした",+ "showErrorDetails": "エラーの詳細",+ "hideErrorDetails": "詳細を閉じる","interrupted": "タスクの実行中にアプリが終了したため、中断されました。","continueTask": "タスクを続ける","retry": "再試行",+ "dismissNotice": "通知を閉じる","ignore": "無視","executionResultUnavailable": "実行結果を取得できなかったため、自動継続を停止しました。既存の実行結果を確認するようアシスタントに依頼してください。","outputLimit": "モデルが出力上限に達したため、この応答は不完全な可能性があります。次のメッセージを送信して続行できます。",diff --git a/apps/mobile/src/i18n/locales/ko/session.json b/apps/mobile/src/i18n/locales/ko/session.jsonindex a0435eb7ca..cae2b5c0ef 100644--- a/apps/mobile/src/i18n/locales/ko/session.json+++ b/apps/mobile/src/i18n/locales/ko/session.json@@ -499,15 +499,16 @@"deleteOne": "이 메시지 삭제"},"tail": {- "readableHistoryRecovery": "읽을 수 있는 기록으로 새 작업 만들기",- "readableHistoryRecoveryDescription": "재시도해도 실패하면 읽을 수 있는 기록으로 새 작업을 만들 수 있습니다. 내부 암호화 정보는 제외됩니다. 기존 작업은 유지되며 실패한 메시지는 자동으로 다시 전송되지 않습니다.",+ "readableHistoryRecovery": "새 세션에서 계속하기",+ "readableHistoryRecoveryDescription": "대화 기록을 이어받고 기존 세션도 유지합니다. 새 세션에서 마지막 메시지를 다시 보내 주세요.","requestFormatError": "앱이 보낸 요청 형식에 문제가 있어 답변을 완료하지 못했습니다.",- "replyFailed": "답변을 완료하지 못했습니다. 오류 세부 정보에서 원인을 확인하세요.",- "showErrorDetails": "오류 세부 정보 보기",- "hideErrorDetails": "오류 세부 정보 숨기기",+ "replyFailed": "답변을 완료하지 못했습니다",+ "showErrorDetails": "오류 상세 정보",+ "hideErrorDetails": "상세 정보 접기","interrupted": "작업 실행 도중 앱이 종료되어 중단되었습니다.","continueTask": "작업 계속","retry": "다시 시도",+ "dismissNotice": "알림 닫기","ignore": "무시","executionResultUnavailable": "실행 결과를 가져오지 못해 자동 계속 진행을 중단했습니다. 어시스턴트에게 기존 실행 결과를 확인하도록 요청하세요.","outputLimit": "모델이 출력 한도에 도달하여 이번 응답은 불완전할 수 있습니다. 다음 메시지를 보내 계속할 수 있습니다.",diff --git a/apps/mobile/src/i18n/locales/zh-CN/session.json b/apps/mobile/src/i18n/locales/zh-CN/session.jsonindex 75e151e681..60a732272c 100644--- a/apps/mobile/src/i18n/locales/zh-CN/session.json+++ b/apps/mobile/src/i18n/locales/zh-CN/session.json@@ -499,15 +499,16 @@"deleteOne": "删除本条消息"},"tail": {- "readableHistoryRecovery": "用可读历史新建任务",- "readableHistoryRecoveryDescription": "如果重试仍然失败,可用可读历史新建任务,省略内部加密信息。原任务保留,失败消息不会自动重发。",+ "readableHistoryRecovery": "在新任务中继续",+ "readableHistoryRecoveryDescription": "带上对话记录继续,原任务保留。请在新任务中重新发送刚才的消息。","requestFormatError": "应用发送的请求格式有误,本次回复未能完成。",- "replyFailed": "本次回复未能完成。请查看错误详情以了解原因。",- "showErrorDetails": "查看错误详情",- "hideErrorDetails": "收起错误详情",+ "replyFailed": "回复未完成",+ "showErrorDetails": "错误详情",+ "hideErrorDetails": "收起详情","interrupted": "任务执行到一半时应用退出,已被中断。","continueTask": "继续任务","retry": "重试",+ "dismissNotice": "关闭提示","ignore": "忽略","executionResultUnavailable": "未能取回执行结果,已停止自动续接。可以让助手检查已有的执行结果。","outputLimit": "模型已达到输出长度上限,本轮回复可能不完整。可以直接发送下一条消息继续。",diff --git a/apps/mobile/src/i18n/locales/zh-TW/session.json b/apps/mobile/src/i18n/locales/zh-TW/session.jsonindex c5e19adcb8..8c42012c0a 100644--- a/apps/mobile/src/i18n/locales/zh-TW/session.json+++ b/apps/mobile/src/i18n/locales/zh-TW/session.json@@ -503,15 +503,16 @@"deleteOne": "刪除本條訊息"},"tail": {- "readableHistoryRecovery": "用可讀歷史建立新任務",- "readableHistoryRecoveryDescription": "如果重試仍然失敗,可用可讀歷史建立新任務,略過內部加密資訊。原任務會保留,失敗訊息不會自動重新傳送。",+ "readableHistoryRecovery": "在新任務中繼續",+ "readableHistoryRecoveryDescription": "帶上對話記錄繼續,原任務保留。請在新任務中重新傳送剛才的訊息。","requestFormatError": "應用程式送出的請求格式有誤,本次回覆未能完成。",- "replyFailed": "本次回覆未能完成。請查看錯誤詳情以瞭解原因。",- "showErrorDetails": "查看錯誤詳情",- "hideErrorDetails": "收起錯誤詳情",+ "replyFailed": "回覆未完成",+ "showErrorDetails": "錯誤詳情",+ "hideErrorDetails": "收起詳情","interrupted": "任務執行到一半時應用退出,已被中斷。","continueTask": "繼續任務","retry": "重試",+ "dismissNotice": "關閉提示","ignore": "忽略","executionResultUnavailable": "未能取得執行結果,已停止自動接續。可以請助手檢查既有的執行結果。","outputLimit": "模型已達到輸出長度上限,本輪回覆可能不完整。可以直接傳送下一則訊息繼續。",diff --git a/apps/mobile/src/plugins/PluginTaskPickerView.ios.tsx b/apps/mobile/src/plugins/PluginTaskPickerView.ios.tsxindex 3d248fc016..a6161b90b2 100644--- a/apps/mobile/src/plugins/PluginTaskPickerView.ios.tsx+++ b/apps/mobile/src/plugins/PluginTaskPickerView.ios.tsx@@ -1,4 +1,5 @@import { useEffect, useRef } from "react";+import { NativeErrorNotice } from '@/components/NativeErrorNotice.ios';import {Button,HStack,@@ -160,9 +161,7 @@ export function PluginTaskPickerView(p: PluginTaskPickerViewProps) {/>) : p.error ? (<>- <Text modifiers={[foregroundStyle(colors.textSecondary)]}>- {t("plugins.loadFailed")}- </Text>+ <NativeErrorNotice message={t('plugins.loadFailed')} /><ComposerNativeRowtitle={t("plugins.retry")}onPress={p.onRetry}diff --git a/apps/mobile/src/plugins/PluginTaskPickerView.tsx b/apps/mobile/src/plugins/PluginTaskPickerView.tsxindex 56a17a6d54..20410ac3ed 100644--- a/apps/mobile/src/plugins/PluginTaskPickerView.tsx+++ b/apps/mobile/src/plugins/PluginTaskPickerView.tsx@@ -1,4 +1,6 @@import { useEffect, useMemo, useState } from "react";+import { ErrorNotice } from '@/components/ErrorNotice';+import { MainWindowActionButton } from '@/components/MobilePrimitives';import {ActivityIndicator,Pressable,@@ -100,12 +102,7 @@ export function PluginTaskPickerView({{loading ? (<ActivityIndicator color={colors.textSecondary} />) : error ? (- <View style={styles.empty}>- <Text style={styles.note}>{t("plugins.loadFailed")}</Text>- <Pressable style={styles.row} onPress={() => onRetry()}>- <Text style={styles.title}>{t("plugins.retry")}</Text>- </Pressable>- </View>+ <ErrorNotice message={t('plugins.loadFailed')} actions={<MainWindowActionButton action={{ label: t('plugins.retry'), onPress: onRetry }} />} />) : (matches.map((row) => (<Pressablediff --git a/apps/mobile/src/session/AgentErrorDetails.tsx b/apps/mobile/src/session/AgentErrorDetails.tsxindex 8d620dc11c..87a31695f1 100644--- a/apps/mobile/src/session/AgentErrorDetails.tsx+++ b/apps/mobile/src/session/AgentErrorDetails.tsx@@ -1,34 +1,109 @@-import { useEffect, useState } from 'react';+import { useEffect, useState, type ReactNode } from 'react';+import { ChevronDown, ChevronRight } from 'lucide-react-native';import { Pressable, StyleSheet, View } from 'react-native';import { useTranslation } from 'react-i18next';import { redactSensitiveText } from '@cindy/maker-shared/error-redaction';import { Text } from '@/components/AppText';-import { useThemedStyles, type ThemeColors } from '@/theme';+import {+ iconSize,+ iconStroke,+ useTheme,+ useThemedStyles,+ type ThemeColors,+} from '@/theme';+import { mobileInteractionStyles } from '@/components/mobileInteractionStyles';import { lineHeight, radius, spacing, typeScale } from '@/theme/tokens';/** Local disclosure only: never retries a request or changes the persisted error. */-export function AgentErrorDetails({ message }: { message: string }) {+export function AgentErrorDetails({+ message,+ actions,+}: {+ message: string;+ actions?: ReactNode;+}) {const { t } = useTranslation();const styles = useThemedStyles(makeStyles);+ const { colors } = useTheme();const [expanded, setExpanded] = useState(false);- useEffect(() => { setExpanded(false); }, [message]);+ useEffect(() => {+ setExpanded(false);+ }, [message]);return (<View>- <Pressable- accessibilityRole="button"- accessibilityState={{ expanded }}- onPress={() => setExpanded(value => !value)}- style={styles.toggle}- >- <Text style={styles.label}>{t(expanded ? 'session.tail.hideErrorDetails' : 'session.tail.showErrorDetails')}</Text>- </Pressable>- {expanded ? <Text selectable style={styles.detail}>{redactSensitiveText(message)}</Text> : null}+ <View style={styles.actions}>+ {actions}+ <Pressable+ accessibilityRole="button"+ accessibilityState={{ expanded }}+ onPress={() => setExpanded((value) => !value)}+ style={({ pressed }) => [+ styles.toggle,+ pressed && mobileInteractionStyles.pressed,+ ]}+ >+ {expanded ? (+ <ChevronDown+ color={colors.textSecondary}+ size={iconSize.sm}+ strokeWidth={iconStroke.regular}+ />+ ) : (+ <ChevronRight+ color={colors.textSecondary}+ size={iconSize.sm}+ strokeWidth={iconStroke.regular}+ />+ )}+ <Text style={styles.label}>+ {t(+ expanded+ ? 'session.tail.hideErrorDetails'+ : 'session.tail.showErrorDetails',+ )}+ </Text>+ </Pressable>+ </View>+ {expanded ? (+ <Text selectable style={styles.detail}>+ {redactSensitiveText(message)}+ </Text>+ ) : null}</View>);}-const makeStyles = (colors: ThemeColors) => StyleSheet.create({- toggle: { alignSelf: 'flex-start', justifyContent: 'center', minHeight: 44, borderRadius: radius.pill, paddingHorizontal: spacing.sm },- label: { color: colors.textSecondary, fontSize: typeScale.caption, lineHeight: lineHeight.caption },- detail: { color: colors.textSecondary, fontSize: typeScale.caption, lineHeight: lineHeight.caption },-});+const makeStyles = (colors: ThemeColors) =>+ StyleSheet.create({+ actions: {+ flexDirection: 'row',+ flexWrap: 'wrap',+ alignItems: 'center',+ columnGap: spacing.md,+ rowGap: spacing.sm,+ },+ toggle: {+ alignSelf: 'flex-start',+ flexDirection: 'row',+ alignItems: 'center',+ gap: spacing.xs,+ minHeight: 44,+ borderRadius: radius.pill,+ paddingHorizontal: spacing.sm,+ },+ label: {+ flexShrink: 1,+ color: colors.textSecondary,+ fontSize: typeScale.footnote,+ lineHeight: lineHeight.caption,+ },+ detail: {+ marginTop: spacing.sm,+ color: colors.textSecondary,+ fontSize: typeScale.footnote,+ lineHeight: lineHeight.caption,+ backgroundColor: colors.surface,+ padding: spacing.sm,+ borderRadius: radius.control,+ },+ });diff --git a/apps/mobile/src/session/ContextSheet.ios.tsx b/apps/mobile/src/session/ContextSheet.ios.tsxindex 85e18dafa0..038519b7b5 100644--- a/apps/mobile/src/session/ContextSheet.ios.tsx+++ b/apps/mobile/src/session/ContextSheet.ios.tsx@@ -1,5 +1,6 @@import { useNativeGlassButtonStyle } from "@/platform/chrome/nativeGlassButtonStyle.ios";import { iconSize, useTheme } from '@/theme';+import { NativeErrorNotice } from '@/components/NativeErrorNotice.ios';import { ComposerNativeSection as Section } from './ComposerNativeSection';import {createContext,@@ -75,7 +76,7 @@ export function ContextSheet(props: ContextSheetProps) {{props.children}{props.error ? (<Section>- <Text modifiers={[foregroundStyle(colors.errorText)]}>{props.error}</Text>+ <NativeErrorNotice message={props.error} /></Section>) : null}</ComposerSheet>@@ -188,8 +189,9 @@ export function ContextSheetNote({ text, tone = 'secondary', testID }: {testID?: string;}) {const { colors } = useTheme();+ if (tone === 'error') return <NativeErrorNotice message={text} testID={testID} />;return (- <Text testID={testID} modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(tone === 'error' ? colors.errorText : colors.textSecondary)]}>+ <Text testID={testID} modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(colors.textSecondary)]}>{text}</Text>);diff --git a/apps/mobile/src/session/ContextSheet.tsx b/apps/mobile/src/session/ContextSheet.tsxindex 3f1e8aced7..4623d26acd 100644--- a/apps/mobile/src/session/ContextSheet.tsx+++ b/apps/mobile/src/session/ContextSheet.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ErrorNotice';/*** ContextSheet —— + 号弹出的可拖动「上下文」面板。*@@ -117,7 +118,7 @@ export function ContextSheet({>{media}{children}- {error ? <Text style={styles.errorText}>{error}</Text> : null}+ {error ? <ErrorNotice message={error} /> : null}</SheetSurface></SheetModal></DismissAction.Provider>@@ -264,8 +265,9 @@ export function ContextSheetNote({ text, tone = 'secondary', testID }: {testID?: string;}) {const styles = useThemedStyles(makeContextSheetStyles);+ if (tone === 'error') return <ErrorNotice message={text} messageTestID={testID} />;return (- <Text style={[styles.note, tone === 'error' && styles.noteError]} testID={testID}>{text}</Text>+ <Text style={styles.note} testID={testID}>{text}</Text>);}diff --git a/apps/mobile/src/session/ContextSheetGoalView.ios.tsx b/apps/mobile/src/session/ContextSheetGoalView.ios.tsxindex 8a031bc0ae..68b684c110 100644--- a/apps/mobile/src/session/ContextSheetGoalView.ios.tsx+++ b/apps/mobile/src/session/ContextSheetGoalView.ios.tsx@@ -1,3 +1,4 @@+import { NativeErrorNotice } from '@/components/NativeErrorNotice.ios';import { useNativeGlassButtonStyle } from "@/platform/chrome/nativeGlassButtonStyle.ios";import { useState, type ComponentProps } from 'react';import { useTranslation } from 'react-i18next';@@ -46,7 +47,7 @@ export function ContextSheetGoalCreateForm({ busy, disabled = false, disabledHin<LimitPicker label={t('interaction.contextSheet.noProgressLimit')} value={limits.noProgressLimit} presets={[2, 3, 5]} busy={busy} onChange={value => patch({ noProgressLimit: value })} testID="contextSheet.goalNoProgressOptions" /></DisclosureGroup></Section>- {error || (disabled && disabledHint) ? <Section><Text modifiers={[foregroundStyle(error ? colors.errorText : colors.textSecondary)]}>{error || disabledHint}</Text></Section> : null}+ {error ? <Section><NativeErrorNotice message={error} /></Section> : disabled && disabledHint ? <Section><Text modifiers={[foregroundStyle(colors.textSecondary)]}>{disabledHint}</Text></Section> : null}<Section><Button onPress={submit} testID="contextSheet.goalStartButton" modifiers={[...glassStyle, frame({ maxWidth: Infinity, minHeight: 44 }),@@ -92,7 +93,7 @@ export function ContextSheetGoalView(props: ContextSheetGoalViewProps) {<Text modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(colors.textSecondary)]}>{t('interaction.contextSheet.goalMeta', { turns, tokens })}</Text>{reason ? <Text modifiers={[foregroundStyle(colors.textSecondary)]}>{reason}</Text> : null}</Section>- {error ? <Section><Text modifiers={[foregroundStyle(colors.errorText)]}>{error}</Text></Section> : null}+ {error ? <Section><NativeErrorNotice message={error} /></Section> : null}<Section>{goal.status === 'active' ? action(t('interaction.contextSheet.pause'), props.onPauseGoal, 'contextSheet.goalPauseButton') : null}{['paused', 'blocked', 'usageLimited'].includes(goal.status) ? action(t('interaction.contextSheet.resume'), props.onResumeGoal, 'contextSheet.goalResumeButton') : null}diff --git a/apps/mobile/src/session/ContextSheetGoalView.tsx b/apps/mobile/src/session/ContextSheetGoalView.tsxindex 5d359ffafc..95173035f9 100644--- a/apps/mobile/src/session/ContextSheetGoalView.tsx+++ b/apps/mobile/src/session/ContextSheetGoalView.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ErrorNotice';/*** Context 面板的「目标模式」二级视图(对照设计稿 S3)。*@@ -212,7 +213,7 @@ export function ContextSheetGoalCreateForm({</>) : null}{error ? (- <Text style={styles.errorText}>{error}</Text>+ <ErrorNotice message={error} />) : disabled && disabledHint ? (<Text style={styles.hintText} testID="contextSheet.goalDisabledHint">{disabledHint}</Text>) : null}@@ -277,7 +278,7 @@ function GoalStatusView({{t('interaction.contextSheet.goalMeta', { turns: turnsText, tokens: tokensText })}</Text>{reasonText ? <Text style={styles.hintText}>{reasonText}</Text> : null}- {error ? <Text style={styles.errorText}>{error}</Text> : null}+ {error ? <ErrorNotice message={error} /> : null}<View style={styles.actionGroup}>{canPause ? (<GoalActionButton busy={busy} label={t('interaction.contextSheet.pause')} onPress={onPauseGoal} testID="contextSheet.goalPauseButton" />diff --git a/apps/mobile/src/session/FailedScheduleNotice.tsx b/apps/mobile/src/session/FailedScheduleNotice.tsxindex f95334e03d..d7687c33e6 100644--- a/apps/mobile/src/session/FailedScheduleNotice.tsx+++ b/apps/mobile/src/session/FailedScheduleNotice.tsx@@ -1,56 +1,70 @@import AsyncStorage from '@react-native-async-storage/async-storage';-import { compareFailedScheduleRuns, scheduleFailureMessageKey, type FailedScheduleRunSnapshot } from '@cindy/maker-shared/schedule-model';-import { CircleAlert, X } from 'lucide-react-native';+import {+ compareFailedScheduleRuns,+ scheduleFailureMessageKey,+ type FailedScheduleRunSnapshot,+} from '@cindy/maker-shared/schedule-model';import { useEffect, useState } from 'react';-import { Pressable, StyleSheet, View } from 'react-native';import { useTranslation } from 'react-i18next';-import { Text } from '@/components/AppText';-import { mobileInteractionStyles } from '@/components/mobileInteractionStyles';-import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';-import { iconSize, iconStroke, lineHeight, radius, spacing, typeScale } from '@/theme/tokens';+import { ErrorNotice } from '@/components/ErrorNotice';+import { spacing } from '@/theme/tokens';/** Only a local display preference: never writes a run or a read receipt. */-export function FailedScheduleNotice({ source, run }: { source: string; run: FailedScheduleRunSnapshot }) {+export function FailedScheduleNotice({+ source,+ run,+}: {+ source: string;+ run: FailedScheduleRunSnapshot;+}) {const key = `scheduleFailureDismissal:${source}`;const [loaded, setLoaded] = useState(false);- const [dismissed, setDismissed] = useState<FailedScheduleRunSnapshot | null>(null);+ const [dismissed, setDismissed] = useState<FailedScheduleRunSnapshot | null>(+ null,+ );const { t } = useTranslation();- const { colors } = useTheme();- const styles = useThemedStyles(makeStyles);useEffect(() => {let active = true;setLoaded(false);setDismissed(null);- void AsyncStorage.getItem(key).then((raw) => {- if (!active || !raw) return;- try {- const value = JSON.parse(raw);- if (typeof value?.runId === 'string' && typeof value.firedAt === 'number' && Number.isFinite(value.firedAt)) setDismissed(value);- } catch { /* Invalid preferences do not hide history. */ }- }).catch(() => undefined).finally(() => { if (active) setLoaded(true); });- return () => { active = false; };+ void AsyncStorage.getItem(key)+ .then((raw) => {+ if (!active || !raw) return;+ try {+ const value = JSON.parse(raw);+ if (+ typeof value?.runId === 'string' &&+ typeof value.firedAt === 'number' &&+ Number.isFinite(value.firedAt)+ )+ setDismissed(value);+ } catch {+ /* Invalid preferences do not hide history. */+ }+ })+ .catch(() => undefined)+ .finally(() => {+ if (active) setLoaded(true);+ });+ return () => {+ active = false;+ };}, [key]);- if (!loaded || (dismissed && compareFailedScheduleRuns(dismissed, run) >= 0)) return null;+ if (!loaded || (dismissed && compareFailedScheduleRuns(dismissed, run) >= 0))+ return null;const dismiss = () => {setDismissed(run);void AsyncStorage.setItem(key, JSON.stringify(run)).catch(() => undefined);};return (- <View style={styles.box} testID="session.failedScheduleNotice">- <CircleAlert color={colors.errorText} size={iconSize.md} strokeWidth={iconStroke.regular} />- <Text style={styles.text}>{t(`session.failedScheduleNotice.${scheduleFailureMessageKey(run)}`)}</Text>- <Pressable accessibilityRole="button" accessibilityLabel={t('session.failedScheduleNotice.dismissTitle')}- onPress={dismiss} style={({ pressed }) => [styles.close, pressed && styles.pressed]}>- <X color={colors.errorText} size={iconSize.md} strokeWidth={iconStroke.regular} />- </Pressable>- </View>+ <ErrorNotice+ style={{ marginTop: spacing.sm }}+ testID="session.failedScheduleNotice"+ message={t(+ `session.failedScheduleNotice.${scheduleFailureMessageKey(run)}`,+ )}+ onDismiss={dismiss}+ dismissLabel={t('session.failedScheduleNotice.dismissTitle')}+ />);}-const makeStyles = (colors: ThemeColors) => StyleSheet.create({- box: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, marginTop: spacing.sm,- paddingLeft: spacing.md, backgroundColor: colors.surfaceElevated, borderColor: colors.errorBorder,- borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.container },- text: { flex: 1, color: colors.errorText, fontSize: typeScale.footnote, lineHeight: lineHeight.caption, paddingVertical: spacing.sm },- close: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center', borderRadius: radius.pill },- pressed: mobileInteractionStyles.pressed,-});diff --git a/apps/mobile/src/session/InlineQueueSection.tsx b/apps/mobile/src/session/InlineQueueSection.tsxindex 353b3ac6ac..ac7384f449 100644--- a/apps/mobile/src/session/InlineQueueSection.tsx+++ b/apps/mobile/src/session/InlineQueueSection.tsx@@ -11,6 +11,7 @@* 问题,留在 footer 最自然。*/import { AgentErrorDetails } from './AgentErrorDetails';+import { ErrorNotice, ErrorNoticeAction } from '@/components/ErrorNotice';import { ReadableHistoryRecovery } from './ReadableHistoryRecovery';import { useTranslation } from 'react-i18next';import {@@ -100,29 +101,27 @@ export function InlineQueueSection({return (<View style={styles.container} testID="queue.inline.section">{projection.error ? (- <View style={styles.errorBox} testID="queue.inline.error">- {/* 稳定错误 marker 按当前显示端语言翻译;其它错误保留 auth 引导,否则使用本地化摘要。 */}- <Text style={styles.errorText}>{projectionError}</Text>- <AgentErrorDetails message={projection.error} />- {onRecoverHistory ? <ReadableHistoryRecovery onRecover={onRecoverHistory} busy={controlsDisabled} /> : null}- <View style={styles.errorActions}>- {retryable ? <ActionPill- busy={busy}+ <ErrorNotice+ message={projectionError ?? ''}+ testID="queue.inline.error"+ description={onRecoverHistory ? t('session.tail.readableHistoryRecoveryDescription') : undefined}+ onDismiss={onClearError}+ dismissLabel={t('session.tail.dismissNotice')}+ dismissTestID="queue.inline.clearErrorButton"+ dismissDisabled={!!errorDisabledReason}+ dismissHint={errorDisabledReason ?? undefined}+ >+ <AgentErrorDetails message={projection.error} actions={<>+ {retryable ? <ErrorNoticeAction+ primarydisabled={!!retryDisabledReason}- disabledReason={retryDisabledReason}+ hint={retryDisabledReason ?? undefined}label={t('message.queue.retrySend')}onPress={onRetryError}testID="queue.inline.retryButton"/> : null}- <ActionPill- busy={busy}- disabled={!!errorDisabledReason}- disabledReason={errorDisabledReason}- label={t('message.queue.clearError')}- onPress={onClearError}- testID="queue.inline.clearErrorButton"- />- </View>+ {onRecoverHistory ? <ReadableHistoryRecovery onRecover={onRecoverHistory} busy={controlsDisabled} /> : null}+ </>} />{retryable && retryDisabledReason ? (<Text style={styles.disabledHint} testID="queue.inline.errorDisabledReason">{retryDisabledReason}@@ -146,7 +145,7 @@ export function InlineQueueSection({) : null}</View>) : null}- </View>+ </ErrorNotice>) : null}{projection.credentialSwitchWait ? (@@ -268,61 +267,67 @@ function QueueTouchButton({);}-const makeStyles = (colors: ThemeColors) => StyleSheet.create({- container: { gap: spacing.sm, paddingTop: spacing.sm, width: '100%' },- banner: {- alignItems: 'center',- backgroundColor: colors.surfaceElevated,- borderColor: colors.border,- borderRadius: radius.container,- borderWidth: StyleSheet.hairlineWidth,- flexDirection: 'row',- gap: spacing.sm,- paddingHorizontal: spacing.md,- paddingVertical: spacing.sm,- },- bannerText: {- color: colors.textSecondary,- flex: 1,- fontSize: typeScale.footnote,- lineHeight: lineHeight.caption,- minWidth: 0,- },- resumePill: {- alignItems: 'center',- backgroundColor: colors.cta,- borderRadius: radius.pill,- flexDirection: 'row',- gap: 4,- justifyContent: 'center',- minHeight: 30,- paddingHorizontal: spacing.md,- },- resumePillText: { color: colors.ctaText, fontSize: typeScale.caption, lineHeight: lineHeight.caption, fontWeight: fontWeight.medium },- errorBox: {- backgroundColor: colors.surfaceElevated,- borderColor: colors.border,- borderRadius: radius.container,- borderWidth: StyleSheet.hairlineWidth,- gap: spacing.sm,- padding: spacing.md,- },- errorText: { color: colors.errorText, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },- disabledHint: { color: colors.textSecondary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },- errorActions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },- actionPill: {- alignItems: 'center',- backgroundColor: colors.surfaceElevated,- borderColor: colors.border,- borderRadius: radius.pill,- borderWidth: StyleSheet.hairlineWidth,- flexDirection: 'row',- gap: 6,- justifyContent: 'center',- minHeight: 36,- paddingHorizontal: spacing.md,- },- actionPillText: { color: colors.textPrimary, fontSize: typeScale.caption, lineHeight: lineHeight.caption, fontWeight: fontWeight.medium },- pressed: { opacity: 0.72 },- disabled: { opacity: 0.42 },-});+const makeStyles = (colors: ThemeColors) =>+ StyleSheet.create({+ container: { gap: spacing.sm, paddingTop: spacing.sm, width: '100%' },+ banner: {+ alignItems: 'center',+ backgroundColor: colors.surfaceElevated,+ borderColor: colors.border,+ borderRadius: radius.container,+ borderWidth: StyleSheet.hairlineWidth,+ flexDirection: 'row',+ gap: spacing.sm,+ paddingHorizontal: spacing.md,+ paddingVertical: spacing.sm,+ },+ bannerText: {+ color: colors.textSecondary,+ flex: 1,+ fontSize: typeScale.footnote,+ lineHeight: lineHeight.caption,+ minWidth: 0,+ },+ resumePill: {+ alignItems: 'center',+ backgroundColor: colors.cta,+ borderRadius: radius.pill,+ flexDirection: 'row',+ gap: 4,+ justifyContent: 'center',+ minHeight: 30,+ paddingHorizontal: spacing.md,+ },+ resumePillText: {+ color: colors.ctaText,+ fontSize: typeScale.caption,+ lineHeight: lineHeight.caption,+ fontWeight: fontWeight.medium,+ },+ disabledHint: {+ color: colors.textSecondary,+ fontSize: typeScale.footnote,+ lineHeight: lineHeight.caption,+ },+ errorActions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },+ actionPill: {+ alignItems: 'center',+ backgroundColor: colors.surfaceElevated,+ borderColor: colors.border,+ borderRadius: radius.pill,+ borderWidth: StyleSheet.hairlineWidth,+ flexDirection: 'row',+ gap: 6,+ justifyContent: 'center',+ minHeight: 36,+ paddingHorizontal: spacing.md,+ },+ actionPillText: {+ color: colors.textPrimary,+ fontSize: typeScale.caption,+ lineHeight: lineHeight.caption,+ fontWeight: fontWeight.medium,+ },+ pressed: { opacity: 0.72 },+ disabled: { opacity: 0.42 },+ });diff --git a/apps/mobile/src/session/MessageRenderer.tsx b/apps/mobile/src/session/MessageRenderer.tsxindex d2eb1b7d86..8457d2a602 100644--- a/apps/mobile/src/session/MessageRenderer.tsx+++ b/apps/mobile/src/session/MessageRenderer.tsx@@ -7,6 +7,7 @@ import { CompanionLearningFooter } from './CompanionLearningFooter';import { CompanionTaskResultCard } from './CompanionTaskResultCard';import { botTaskResultKey, readBotTaskResults } from '@cindy/maker-shared/botCollaboration';import { AgentErrorDetails } from './AgentErrorDetails';+import { ErrorNotice } from '@/components/ErrorNotice';import { FileTypeIcon } from '@/components/FileTypeIcon';import { CompanionMessageActions } from './CompanionMessageActions';import { useMessageHistoryActive, useMessageHistoryPositioning } from './messageHistoryActivity';@@ -3924,7 +3925,11 @@ function MessageBubble({/>) : null}{attachmentStripNode}- {hasBubbleContent || (!attachmentStripNode && messageQuotes.length === 0) ? bubble : null}+ {item.message.role === 'error' ? (+ <ErrorNotice message={displayBubbleBody}>+ {item.message.rawError ? <AgentErrorDetails key={item.message.key} message={item.message.rawError} /> : null}+ </ErrorNotice>+ ) : hasBubbleContent || (!attachmentStripNode && messageQuotes.length === 0) ? bubble : null}{actions.companion && item.message.kind === 'assistant' && item.message.body.trim() ? (<CompanionLearningFooter receipts={item.message.source.agentMeta?.botLearning}onOpenSettings={actions.onOpenCompanionSettings} />@@ -3935,7 +3940,6 @@ function MessageBubble({deviceId={actions.remoteDeviceId ?? ''} parentSessionId={item.message.source.sessionId}renderMarkdown={text => <CompanionCardMarkdown text={text} actions={actions} />} />)) : null}- {item.message.rawError ? <AgentErrorDetails key={item.message.key} message={item.message.rawError} /> : null}{item.message.kind === 'assistant' && item.message.modelMismatch ? (// 模型降级提示(对齐桌面 AssistantMessage):所选模型本轮被上游静默替换,// 常显在气泡下方,icon 用 warning 橙、文字保持 tertiary 灰阶。diff --git a/apps/mobile/src/session/NewTaskSelectionSheet.android.tsx b/apps/mobile/src/session/NewTaskSelectionSheet.android.tsxindex 29a79aae50..48b086bac9 100644--- a/apps/mobile/src/session/NewTaskSelectionSheet.android.tsx+++ b/apps/mobile/src/session/NewTaskSelectionSheet.android.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ErrorNotice';import { useEffect, useMemo, useRef, useState } from "react";import { ActivityIndicator, View, useWindowDimensions } from "react-native";import { useSafeAreaInsets } from "react-native-safe-area-context";@@ -208,17 +209,7 @@ export function NewTaskSelectionSheet(p: NewTaskSelectionSheetProps) {{p.loading ? (<ActivityIndicator color={colors.textSecondary} />) : null}- {p.error ? (- <Text- style={{- color: colors.errorText,- fontSize: typeScale.footnote,- lineHeight: lineHeight.caption,- }}- >- {p.error}- </Text>- ) : null}+ {p.error ? <ErrorNotice message={p.error} /> : null}{!p.loading && !p.error && !p.entries.length ? (<Textstyle={{diff --git a/apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx b/apps/mobile/src/session/NewTaskSelectionSheet.ios.tsxindex 8289835fae..66179b1345 100644--- a/apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx+++ b/apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx@@ -1,3 +1,4 @@+import { NativeErrorNotice } from '@/components/NativeErrorNotice.ios';import { Button, Image, Picker, ProgressView, Text, Toggle } from '@expo/ui/swift-ui';import { disabled, font, foregroundStyle, frame, pickerStyle, tag, tint } from '@expo/ui/swift-ui/modifiers';import { useTranslation } from 'react-i18next';@@ -77,7 +78,7 @@ export function NewTaskSelectionSheet(p: NewTaskSelectionSheetProps) {onIsOnChange={p.onShowHidden} modifiers={[disabled(p.busy), tint(colors.inputCaret)]} testID="newSession.remoteBrowseShowHidden" /></Section>{p.loading ? <Section><ProgressView /></Section> : null}- {p.error ? <Section><Text modifiers={[foregroundStyle(colors.errorText)]}>{p.error}</Text></Section> : null}+ {p.error ? <Section><NativeErrorNotice message={p.error} /></Section> : null}<Section>{!p.loading && !p.error && p.entries.length === 0 ? <Text>{newSessionText('emptyDirectory')}</Text> : null}{p.entries.map(entry => <ComposerNativeRow key={entry.path} title={entry.name}diff --git a/apps/mobile/src/session/PiSessionTreeSheet.tsx b/apps/mobile/src/session/PiSessionTreeSheet.tsxindex d79deea6d4..387f221b2f 100644--- a/apps/mobile/src/session/PiSessionTreeSheet.tsx+++ b/apps/mobile/src/session/PiSessionTreeSheet.tsx@@ -5,6 +5,8 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';import { useTranslation } from 'react-i18next';import { Text } from '@/components/AppText';+import { ErrorNotice } from '@/components/ErrorNotice';+import { MainWindowActionButton } from '@/components/MobilePrimitives';import type { MobileMakerTransport } from '@/device-link/mobileMakerTransport';import { SheetModal } from '@/session/SheetModal';import { SheetSurface } from '@/session/SheetSurface';@@ -156,10 +158,7 @@ export function PiSessionTreeSheet({>{disabledReason ? <Text style={styles.notice}>{disabledReason}</Text> : null}{error ? (- <Pressable onPress={() => void load()} style={styles.noticeButton}>- <Text style={styles.error}>{error}</Text>- <Text style={styles.retry}>{t('session.screen.retry')}</Text>- </Pressable>+ <ErrorNotice message={error} actions={<MainWindowActionButton action={{ label: t('session.screen.retry'), onPress: () => void load() }} />} />) : null}{loading ? (<View style={styles.loading}><ActivityIndicator color={colors.textSecondary} /></View>diff --git a/apps/mobile/src/session/ReadableHistoryRecovery.tsx b/apps/mobile/src/session/ReadableHistoryRecovery.tsxindex f2a52804c3..742a613d6b 100644--- a/apps/mobile/src/session/ReadableHistoryRecovery.tsx+++ b/apps/mobile/src/session/ReadableHistoryRecovery.tsx@@ -1,29 +1,31 @@-import { Pressable, StyleSheet, View } from 'react-native';+import { Split } from 'lucide-react-native';import { useTranslation } from 'react-i18next';-import { Text } from '@/components/AppText';-import { mobileInteractionStyles } from '@/components/mobileInteractionStyles';-import { fontWeight, lineHeight, useThemedStyles, type ThemeColors } from '@/theme';-import { radius, spacing, typeScale } from '@/theme/tokens';+import { ErrorNoticeAction } from '@/components/ErrorNotice';+import { iconSize, iconStroke, useTheme } from '@/theme';/** Explicit recovery only; never sends a message or interprets the cause of a stream failure. */-export function ReadableHistoryRecovery({ onRecover, busy }: { onRecover(): void; busy?: boolean }) {+export function ReadableHistoryRecovery({+ onRecover,+ busy,+}: {+ onRecover(): void;+ busy?: boolean;+}) {const { t } = useTranslation();- const styles = useThemedStyles(makeStyles);- return <View style={styles.container}>- <Text style={styles.description}>{t('session.tail.readableHistoryRecoveryDescription')}</Text>- <Pressable accessibilityRole="button" disabled={busy}- accessibilityState={{ disabled: !!busy, busy: !!busy }}- onPress={onRecover} testID="session.readableHistoryRecovery"- style={({ pressed }) => [styles.button, pressed && mobileInteractionStyles.pressed, busy && styles.disabled]}>- <Text style={styles.label}>{t('session.tail.readableHistoryRecovery')}</Text>- </Pressable>- </View>;+ const { colors } = useTheme();+ return (+ <ErrorNoticeAction+ label={t('session.tail.readableHistoryRecovery')}+ icon={+ <Split+ color={colors.textPrimary}+ size={iconSize.sm}+ strokeWidth={iconStroke.regular}+ />+ }+ onPress={onRecover}+ disabled={busy}+ testID="session.readableHistoryRecovery"+ />+ );}--const makeStyles = (colors: ThemeColors) => StyleSheet.create({- container: { gap: spacing.sm },- description: { color: colors.textSecondary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption, fontWeight: fontWeight.regular },- button: { minHeight: 44, borderRadius: radius.pill, backgroundColor: colors.surfaceChip, paddingHorizontal: spacing.md, paddingVertical: spacing.sm, alignItems: 'center', justifyContent: 'center', alignSelf: 'flex-start' },- label: { color: colors.textPrimary, fontSize: typeScale.body, lineHeight: lineHeight.body, fontWeight: fontWeight.medium },- disabled: { opacity: 0.5 },-});diff --git a/apps/mobile/src/session/RewindPreviewPanel.tsx b/apps/mobile/src/session/RewindPreviewPanel.tsxindex 89bcb3b6a4..81a7238e02 100644--- a/apps/mobile/src/session/RewindPreviewPanel.tsx+++ b/apps/mobile/src/session/RewindPreviewPanel.tsx@@ -8,6 +8,7 @@ import {import { useTranslation } from 'react-i18next';import type { TFunction } from 'i18next';import { Text } from '@/components/AppText';+import { ErrorNotice } from '@/components/ErrorNotice';import { MainWindowActionGroup } from '@/components/MobilePrimitives';import type { RewindPreviewState } from '@/session/rewindPreview';import { buildRewindPreviewLayout, rewindPreviewMaxHeight } from '@/session/rewindPreviewLayout';@@ -104,7 +105,7 @@ export function RewindPreviewPanel({) : null}{state.kind === 'error' ? (- <Text selectable style={styles.errorText}>{state.errorText}</Text>+ <ErrorNotice message={state.errorText} />) : null}{state.kind !== 'loading' ? (<MainWindowActionGroupdiff --git a/apps/mobile/src/session/SessionTailBanner.tsx b/apps/mobile/src/session/SessionTailBanner.tsxindex 37476f7962..633511bcad 100644--- a/apps/mobile/src/session/SessionTailBanner.tsx+++ b/apps/mobile/src/session/SessionTailBanner.tsx@@ -1,24 +1,22 @@+import { ErrorNotice, ErrorNoticeAction } from '@/components/ErrorNotice';/*** 会话尾部收尾提示条(error-tail / interrupted)—— 对齐桌面 ErrorTailErrorBanner /* InterruptedTurnBanner 的核心语义,状态推导在 sessionTailBanner.ts(纯函数),- * 本组件只渲染 + 回调。视觉沿用 InlineQueueSection 错误框的同款 token(surfaceElevated- * 容器 + errorText 文案 + pill 操作行),渲染位置也在消息列表 footer(队列区上方)。+ * 本组件只渲染 + 回调。与实时、历史错误共用 ErrorNotice 中性卡片,+ * 渲染位置在消息列表 footer(队列区上方)。** 操作语义(与桌面一致):* - 主按钮(重试 / 继续任务)→ 父屏发隐藏续跑指令(带 [UI_ACTION_TRIGGER] 前缀,* 消息流不渲染,用户只看到任务继续跑);- * - 「忽略」→ error-tail 持久化 dismiss / interrupted 写 ack,不再提示。+ * - 右上角关闭 → error-tail 持久化 dismiss / interrupted 写 ack,不再提示。*/import { AgentErrorDetails } from './AgentErrorDetails';import { ReadableHistoryRecovery } from './ReadableHistoryRecovery';-import { Pressable, StyleSheet } from 'react-native';+import { StyleSheet, View } from 'react-native';import { useTranslation } from 'react-i18next';-import { Text } from '@/components/AppText';-import { mobileInteractionStyles } from '@/components/mobileInteractionStyles';-import { View } from 'react-native';import type { SessionTailBannerState } from '@/session/sessionTailBannerModel';-import { fontWeight, lineHeight, useThemedStyles, type ThemeColors } from '@/theme';-import { radius, spacing, typeScale } from '@/theme/tokens';++import { spacing } from '@/theme/tokens';export interface SessionTailBannerProps {state: NonNullable<SessionTailBannerState>;@@ -28,107 +26,69 @@ export interface SessionTailBannerProps {onDismiss(): void;}-export function SessionTailBanner({ state, busy, onContinue, onDismiss, onRecoverHistory }: SessionTailBannerProps) {- const styles = useThemedStyles(makeStyles);+export function SessionTailBanner({+ state,+ busy,+ onContinue,+ onDismiss,+ onRecoverHistory,+}: SessionTailBannerProps) {const { t } = useTranslation();- const isInterrupted = state.kind === 'interrupted' || state.continueKind === 'interrupted';- const text = state.kind === 'error-tail' && state.continueKind === 'error'- ? state.summaryKey ? t(state.summaryKey) : state.text- : t('session.tail.interrupted');+ const isInterrupted =+ state.kind === 'interrupted' || state.continueKind === 'interrupted';+ const text =+ state.kind === 'error-tail' && state.continueKind === 'error'+ ? state.summaryKey+ ? t(state.summaryKey)+ : state.text+ : t('session.tail.interrupted');const showContinue = state.kind === 'interrupted' || state.retryable;- return (- <View style={styles.box} testID="session.tailBanner">- <Text- style={isInterrupted ? styles.infoText : styles.errorText}- testID="session.tailBanner.text"- >- {text}- </Text>- {state.kind === 'error-tail' && state.rawError && !isInterrupted ? <AgentErrorDetails message={state.rawError} /> : null}- {onRecoverHistory ? <ReadableHistoryRecovery onRecover={onRecoverHistory} busy={busy} /> : null}- <View style={styles.actions}>- {showContinue ? (- <TailPill- busy={busy}- cta- label={isInterrupted ? t('session.tail.continueTask') : t('session.tail.retry')}- onPress={onContinue}- testID="session.tailBanner.continue"- />- ) : null}- <TailPill- busy={busy}- label={t('session.tail.ignore')}- onPress={onDismiss}- testID="session.tailBanner.dismiss"+ const actions = (+ <>+ {showContinue ? (+ <ErrorNoticeAction+ primary+ disabled={busy}+ label={+ isInterrupted+ ? t('session.tail.continueTask')+ : t('session.tail.retry')+ }+ onPress={onContinue}+ testID="session.tailBanner.continue"/>- </View>- </View>+ ) : null}+ {onRecoverHistory ? (+ <ReadableHistoryRecovery onRecover={onRecoverHistory} busy={busy} />+ ) : null}+ </>);-}--function TailPill({- busy,- cta,- label,- onPress,- testID,-}: {- busy?: boolean;- cta?: boolean;- label: string;- onPress(): void;- testID?: string;-}) {- const styles = useThemedStyles(makeStyles);return (- <Pressable- accessibilityLabel={label}- accessibilityRole="button"- accessibilityState={{ busy: busy || undefined, disabled: busy || undefined }}- disabled={busy}- onPress={onPress}- style={({ pressed }) => [- styles.pill,- cta && styles.pillCta,- pressed && styles.pressed,- busy && styles.disabled,- ]}- testID={testID}+ <ErrorNotice+ style={styles.box}+ testID="session.tailBanner"+ message={text}+ messageTestID="session.tailBanner.text"+ description={+ onRecoverHistory+ ? t('session.tail.readableHistoryRecoveryDescription')+ : undefined+ }+ onDismiss={onDismiss}+ dismissLabel={t('session.tail.dismissNotice')}+ dismissTestID="session.tailBanner.dismiss"+ dismissDisabled={busy}>- <Text style={[styles.pillText, cta && styles.pillTextCta]}>{label}</Text>- </Pressable>+ {state.kind === 'error-tail' && state.rawError && !isInterrupted ? (+ <AgentErrorDetails message={state.rawError} actions={actions} />+ ) : (+ <View style={styles.actions}>{actions}</View>+ )}+ </ErrorNotice>);}-const makeStyles = (colors: ThemeColors) => StyleSheet.create({- box: {- backgroundColor: colors.surfaceElevated,- borderColor: colors.border,- borderRadius: radius.container,- borderWidth: StyleSheet.hairlineWidth,- gap: spacing.sm,- // 与 InlineQueueSection container 的 paddingTop 同档,footer 区两块内容间距一致。- marginTop: spacing.sm,- padding: spacing.md,- width: '100%',- },- errorText: { color: colors.errorText, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },- infoText: { color: colors.textSecondary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },- actions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },- pill: {- alignItems: 'center',- backgroundColor: colors.surfaceChip,- borderRadius: radius.pill,- flexDirection: 'row',- gap: 4,- justifyContent: 'center',- minHeight: 30,- paddingHorizontal: spacing.md,- },- pillCta: { backgroundColor: colors.cta },- pillText: { color: colors.textSecondary, fontSize: typeScale.caption, lineHeight: lineHeight.caption, fontWeight: fontWeight.medium },- pillTextCta: { color: colors.ctaText },- pressed: mobileInteractionStyles.pressed,- disabled: { opacity: 0.5 },+const styles = StyleSheet.create({+ box: { marginTop: spacing.sm, width: '100%' },+ actions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.md },});diff --git a/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx b/apps/mobile/src/session/UnifiedModelPickerView.ios.tsxindex ad9428c16b..3617bb0da9 100644--- a/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx+++ b/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx@@ -1,3 +1,4 @@+import { NativeErrorNotice } from '@/components/NativeErrorNotice.ios';import {Button,HStack,@@ -166,7 +167,7 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {<>{p.error ? (<Section>- <Text modifiers={[foregroundStyle(colors.errorText)]}>{p.error}</Text>+ <NativeErrorNotice message={p.error} /></Section>) : null}{p.groups.map((group) => (@@ -348,7 +349,7 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {>{p.error ? (<Section>- <Text modifiers={[foregroundStyle(colors.errorText)]}>{p.error}</Text>+ <NativeErrorNotice message={p.error} /></Section>) : null}{page === "sources" ? (diff --git a/apps/mobile/src/session/UnifiedModelPickerView.tsx b/apps/mobile/src/session/UnifiedModelPickerView.tsxindex 77b5bdca62..c34331a1f1 100644--- a/apps/mobile/src/session/UnifiedModelPickerView.tsx+++ b/apps/mobile/src/session/UnifiedModelPickerView.tsx@@ -1,3 +1,4 @@+import { ErrorNotice } from '@/components/ErrorNotice';/*** 统一模型选择器的 Android / 兼容呈现(iOS 见 UnifiedModelPickerView.ios.tsx)。*@@ -811,7 +812,7 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {removeClippedSubviews={false}ListHeaderComponent={p.error ? (- <Text style={styles.error}>{p.error}</Text>+ <ErrorNotice message={p.error} />) : null}ListEmptyComponent={@@ -846,7 +847,7 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {}>{!showSecondary && p.error ? (- <Text style={styles.error}>{p.error}</Text>+ <ErrorNotice message={p.error} />) : null}{listPage}</SheetSurface>@@ -870,7 +871,7 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {testID={p.testID}title={title}>- {p.error ? <Text style={styles.error}>{p.error}</Text> : null}+ {p.error ? <ErrorNotice message={p.error} /> : null}{page === "sources"? sourcesPage: page === "harness" && optionsdiff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 3e0c512db3..54cc432f2d 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -529,6 +529,14 @@ FormField → Select forwards descriptions, required/error semantics, and the seDS-11: short notifications keep their pill frame. When the rendered message or action wraps, the outer frame is a 12px content container (`rounded-xl`, §5), using the same background, border, status icon colors and padding. The whole notification fits within the viewport with 16px gutters; long URLs wrap, source identity stays visible, and action text remains complete. Hover and keyboard focus independently pause auto-dismiss until both have left. This classification follows the user’s 2026-09-15 instruction to prioritize the actual Cindy UI; final visual acceptance is recorded separately.+### Error notices++错误提示统一使用中性浮层底色、默认细边框、12px 圆角和小尺寸红色状态图标;正文使用正常文字颜色,不铺大面积红底。先说明发生了什么,再给出恢复操作,技术错误详情默认折叠。桌面复用 `ErrorNotice`,移动端复用同名组件并保持至少 44pt 的操作热区。表单校验、危险操作与状态徽章保留各自语义色。++独立的加载、保存、执行失败,以及需要用户处理的错误横幅使用卡片;字段校验、列表项状态、消息发送状态、已经有完整容器的内嵌工具结果、短暂 Toast 与系统原生警告保留原有形态,避免卡片套卡片。手机采用紧凑布局:标题下集中放说明,右上角关闭代替重复的「忽略」按钮;重试、Fork 与详情入口共用可换行的操作区。按钮面板操作文字为 15/20、500、`textPrimary`,视觉底板最小 36pt,但点击热区保持至少 44pt。卡片内边距与说明到操作区的间距为 16pt,标题与说明间距为 8pt;按钮内水平留白 12pt、图标到文字 8pt,操作间距 12pt。空间不足时自然换行,不压缩留白来强塞一行。说明与详情入口为 13/18 常规字重、`textSecondary`,红色只用于 `statusError` 图标。iOS 原生表单使用 `NativeErrorNotice`,由现有 Section 提供卡片底色与圆角,不再嵌套第二层边框,保留 SwiftUI 文字换行。错误卡片不自行增加重试、自动恢复或 Fork 的适用范围。++历史恢复操作命名为「在新任务中继续」,说明会保留对话记录与原任务,以及需要重新发送刚才的消息。图标必须与消息 Fork「开启一个新任务」入口一致,使用 `Split`;不使用侧栏新建任务的 `SquarePen`。+### Dialog & ModalReference implementation: `apps/desktop/src/renderer/components/ui/confirm-dialog.tsx` (the shared confirm dialog); new dialogs reuse its structure — do not invent a parallel one.diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.mdindex 1e85ce777e..609a3fe485 100644--- a/docs/design-rules/design-decision-log.md+++ b/docs/design-rules/design-decision-log.md@@ -12,6 +12,18 @@## 2026-10+### 2026-10-18:手机错误卡片增加呼吸空间++用户指出紧凑版按钮和文字太挤:保留操作集中与可换行结构,卡片内边距和说明到操作区改为 16pt,标题与说明间距 8pt;按钮增加内部留白与 12pt 操作间距,视觉高度 36pt、触控区仍至少 44pt。详情保留弱化文字入口,窄屏优先换行。++### 2026-10-18:手机错误卡片进一步紧凑化++用户看过实际截图后选择紧凑卡片:说明集中在标题下,重试/Fork/详情共用换行操作区;关闭入口替代「忽略」,沿用原回调与忙碌/只读门控。按钮缩小视觉底板,保留 44pt 热区。原生表单错误由 Section 承载,移除双层卡片。现行规范见 DESIGN.md「Error notices」。++- **10-18 补齐独立错误卡片,手机改为纵向排版**——用户要求统一整理适合卡片化的错误提示,并优化手机版。补齐文件保存、搜索、插件加载与市场操作、模型与目录选择、任务详情、设备管理及自动任务失败等入口。手机说明与操作分行,操作使用完整宽度与至少 44pt 热区;SwiftUI 表单使用同款原生卡片。字段校验、状态徽标、内嵌工具结果与系统警告不强制卡片化,避免重复容器。恢复与 Fork 判据保持原样。++- **10-18 错误提示统一为中性卡片,历史恢复沿用 Fork 图标**——用户认为原有大面积红底错误提示难看,且「可读历史」「内部加密信息」等文案难懂,要求统一错误提示。错误卡片使用中性底色、细边框、小红色图标和清晰操作,技术详情默认折叠;历史恢复改为「在新任务中继续」。用户特别澄清,图标应与消息 Fork「开启一个新任务」入口一致,使用 `Split`。桌面与移动端分别复用 `ErrorNotice`。示意图用于确认方向,不代表实机视觉验收。+- **10-16 macOS 菜单栏余量面板改为暖色液体(B2)+ Barlow 数字**——用户反馈浅色面板和 Cindy 的配色不搭(系统冷灰毛玻璃加纯黑白液柱),并希望动效更生动、点击有反馈。用户先后看过 HTML 方案 A / B 及降低液柱对比度的 A2 / B2,选定 B2 并指定第二款数字字体(Barlow Condensed)。现行:材质上叠暖色调与左上角极淡的 Heart Orange 光晕,文字与填充改为暖灰;液柱为玻璃槽内的柔和渐变,浅色按用户要求再降一档对比度;数字与 % 号统一用 Barlow,% 约为数值的 60%,只有纯数字用 Barlow,同日用户看测试环境后改判:中英文与数字混排的文字(如「15天12时后重置」「周四 14:13」)整段用系统字体,不再把数字拆出来用窄体;“打开 Cindy”前加 Logo 的红色 `>`。动效按用户裁决只表达“正在消耗”:本机有运行中任务正在使用的来源,液面轻微荡漾,没在用的来源完全平静;不要气泡;推荐光环与低余量光晕保持静止;同日用户裁决把推荐柱的外圈描边从 1.5pt 深色减弱为 1pt 次要灰(液柱变柔和后深色描边成了最强的对比,像“选中”或“出错”),保留淡光晕,由标题前的图标与光晕负责对号入座。同日后续裁决:面板半透明,所有中性色(文字、描边、分割线、卡片、玻璃槽、液体、中性圆环)一律用暖黑 / 暖白加透明度,不再用实色灰;液体去掉渐变,改为单色加透明度;详情页圆环的 Codex 蓝、Claude 橙等品牌色保留;水柱升起时带轻微晃动,停住后再按惯性晃动并平静。同日再裁决:去掉标题前的推荐来源图标(标题文字已写明来源)和推荐柱外的光晕,推荐柱只保留 1pt 次要灰描边;鼠标移到柱子上时液面轻晃一下。被取代:v6 原型的冷灰材质、纯黑白液柱、系统数字字体与 0.5s 液柱填充。落点:DESIGN.md「macOS menu bar quota panel」与 §14.4 菜单栏动效登记;数据:`MenubarSourceCell.active`、`MenubarView.headlineAlert`;测试:`collect.test.ts`、`snapshot.test.ts`。验证为 helper 预览截图(浅 / 深、中文 / 英文、矮屏布局)与逐帧像素对比;未在真实菜单栏点开实测。- **10-13 伙伴私聊与群聊顶栏对齐任务详情:系统返回、两个独立圆钮、渐隐模糊底**——用户指出这两个聊天页的返回按钮、右上两个图标的粗细、以及顶栏下方的“分割线”都和任务详情不同。身份区按用户裁决保持靠左;返回改为与任务详情相同的系统箭头。右上待办、设置一度被合进一个玻璃胶囊并换成系统图标,用户否决:保留两个独立圆钮和原有图标,只把线宽从约 1.5pt 调到约 1.65pt。所谓分割线并不是画出来的线,而是顶栏底色不透明:私聊用实色底盖住了任务页同款的渐隐模糊,群聊顶栏与消息区上下分开,消息在顶栏下沿被直接切断。现在 iOS 上两者都浮在任务页同款的渐隐模糊上,消息从下面滚过。删除了从未接入的 `CompanionBackButton`。同日追加:用户截图指出聊天页模糊开始得太高,名字下方副标题旁的消息文字仍清晰可见。原因是通用模糊从顶栏下沿往上 24pt 开始变淡,而聊天顶栏是两行身份信息,副标题正落在变淡段。聊天顶栏改为整段保持完全模糊,只在下沿以外 16pt 内渐隐;任务页和首页的单行顶栏不变。同日再追加:用户认为设置页(系统柔和滚动边缘)的过渡更柔和。差别在于自绘顶栏只有一层固定强度的模糊,靠透明度淡出,过渡区里清楚的字和模糊的影子叠在一起;系统效果是模糊程度本身逐渐减弱。iOS 所有页面的顶栏模糊改为三层等强度模糊叠加,逐层提前淡出,形成渐进效果,外侧渐隐从 16pt 拉长到 24pt;底部输入框的模糊不变。