Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 区分侧栏归档对话视觉 (#883)
Kafeifeie85335155889
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsxindex 6d5e39f27e..09b368456c 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionStatusIcon.tsx@@ -99,8 +99,12 @@ export function SessionStatusIcon({{isArchived ? (<Archivesize={size ?? 12}- strokeWidth={1.5}- className={isActive ? 'text-[var(--sidebar-item-active-foreground)]' : 'text-[var(--cmd-palette-item-meta)]'}+ strokeWidth={1.75}+ className={+ isActive+ ? 'text-[var(--sidebar-item-active-foreground)]'+ : 'text-[var(--cmd-palette-item-meta)]'+ }/>) : isOrcaLead ? (// 常驻呼吸动画挂 HTML wrapper,SVG 保持静态(AGENTS 规则 7 SVG 动画红线,PR#226 review)diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.tsindex 773b8d1362..9b0c2dba51 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts@@ -33,6 +33,10 @@ import { SessionAttentionUrgencyProvider } from '../../contexts/SessionAttention// ── mocks:剥离与"渲染隔离"无关的重依赖,只留计数探针 ──────────────────────────const renderCounts = new Map<string, number>();+const sessionStatusIconSource = readFileSync(+ resolve(__dirname, '..', 'SessionStatusIcon.tsx'),+ 'utf8',+);vi.mock('../SessionStatusIcon', () => ({SessionStatusIcon: ({ session }: { session: { id: string } }) => {@@ -88,11 +92,11 @@ import { SessionItem } from '../SessionItem';// ── fixtures ─────────────────────────────────────────────────────────────────-function makeSession(id: string): Session {+function makeSession(id: string, status: Session['status'] | 'idle' = 'idle'): Session {return {id,title: `Session ${id}`,- status: 'idle',+ status,createdAt: '2026-07-01T00:00:00.000Z',updatedAt: '2026-07-01T00:00:00.000Z',userSendAt: '2026-07-01T00:00:00.000Z',@@ -108,10 +112,7 @@ function makeSession(id: string): Session {const noop = () => {};-function rowsElement(- sessions: readonly Session[],- urgentSessionIds: ReadonlySet<string>,-) {+function rowsElement(sessions: readonly Session[], urgentSessionIds: ReadonlySet<string>) {return createElement(SessionAttentionUrgencyProvider, {urgentSessionIds,children: createElement(@@ -167,6 +168,30 @@ describe('SessionItem — memo 包裹', () => {});});+describe('SessionItem — 归档视觉', () => {+ it('标题保留正文色,并用主题感知的 Archive 图标区分归档行', () => {+ const regularSession = makeSession('regular-session');+ const archivedSession = makeSession('archived-session', 'archived');+ const { container } = render(rowsElement([regularSession, archivedSession], new Set()));++ const regularRow = container.querySelector('[data-session-id="regular-session"]');+ const archivedRow = container.querySelector('[data-session-id="archived-session"]');++ expect(regularRow?.className).toContain('text-foreground');+ expect(archivedRow?.className).toContain('text-foreground');+ expect(archivedRow?.className).not.toContain('text-[var(--sidebar-list-muted)]');++ const archivedIconBranch = sessionStatusIconSource.slice(+ sessionStatusIconSource.indexOf('{isArchived ? ('),+ sessionStatusIconSource.indexOf(') : isOrcaLead ? ('),+ );+ expect(archivedIconBranch).toContain('<Archive');+ expect(archivedIconBranch).toContain('text-[var(--sidebar-item-active-foreground)]');+ expect(archivedIconBranch).toContain('strokeWidth={1.75}');+ expect(archivedIconBranch).toContain('text-[var(--cmd-palette-item-meta)]');+ });+});+// ── 不变量 2:attention 变化只惊动自己那一行 ──────────────────────────────────describe('SessionItem — attention 渲染隔离', () => {