Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(sidebar): 任务行 PR 未解决角标,open 绿按表面取
Dashe61d2565e05b
diff --git a/apps/desktop/help-knowledge/sidebar.md b/apps/desktop/help-knowledge/sidebar.mdindex d68bb98ba5..4db4ca7ecf 100644--- a/apps/desktop/help-knowledge/sidebar.md+++ b/apps/desktop/help-knowledge/sidebar.md@@ -37,7 +37,7 @@ The left sidebar lists your sessions. It's the main way to navigate and organize**Display:**- The main list has **Text** (compact single row) and **List** (two-line row with a preview) styles. Fresh installs default to List; installs upgraded from an older version keep Text so the sidebar looks the way it did before the upgrade. This is separate from the Pinned section's style.-- **Session info** — choose what shows at the right edge of each row: **Time** (default), **PR status** (a status icon plus a monospace `#number`; only the icon is colored — green open / gray draft / red closed / accent merged; unknown state shows a gray icon; sessions without a PR show nothing), **Tokens** (compact total like `1.4M`), and **Cost** (`$`/`¥` by currency). Multi-select; items render in the order you selected them.+- **Session info** — choose what shows at the right edge of each row: **Time** (default), **PR status** (a status icon plus a monospace `#number`; only the icon is colored — green open / gray draft / red closed / accent merged; the open green follows the row surface so it stays readable on both the rest background and the inverse selected pill; a small orange dot on the icon means the PR still has unresolved review threads; unknown state shows a gray icon; sessions without a PR show nothing), **Tokens** (compact total like `1.4M`), and **Cost** (`$`/`¥` by currency). Multi-select; items render in the order you selected them.**Pinning:**diff --git a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.tsindex e583a27f66..fa8ad576f2 100644--- a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts+++ b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts@@ -138,7 +138,7 @@ export const HELP_KNOWLEDGE: HelpKnowledgeDoc[] = [id: "sidebar",title: "Finding and organizing sessions",summary: "Browse, group, filter, sort, search, and pin sessions or projects in the left sidebar.",- content: "The left sidebar lists your sessions. It's the main way to navigate and organize. The **Sidebar display settings** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the main list header, from **Sidebar display settings** in the device-scope menu, or by right-clicking any blank area of the sidebar.\n\n**Device scope (the list header itself):**\n\n- The main list header doubles as the device scope switcher. Its text names what you're looking at — **All sessions**, **This device's sessions**, a remote device's name, or **N machines** — and clicking it opens the scope menu: all / this device / each connected remote device (single-click switches; checkboxes multi-select), plus **Remote connection settings** and **Sidebar display settings**.\n- The scope applies to the whole sidebar, including the Pinned section.\n- With no remote devices, the header still shows **All sessions ▾**. Clicking it opens a short menu with only **Remote connection settings** and **Sidebar display settings** — no device list. The header stays visible even when the list is empty, only pinned items remain, remote devices/tasks are loading or failed, or the selected remote device is still connecting. There is no separate device row in the top navigation.\n\n**Grouping (independent checkboxes, freely combinable):**\n\n- **Group by project** (default on) — sessions with a project fold into project rows; project rows and stray chats compete for position on the same timeline (a chat active two minutes ago sorts above a project last touched yesterday). Turn it off for a flat list.\n- **Group by device** (default on) — only appears when a remote device is connected and the scope isn't narrowed to a single machine; splits the list into device sections (this device first), each with a collapsible header showing the device name and online state. When the last remote device disconnects — or the scope is a single machine — the option disappears and the effect is lifted; the saved preference is untouched and comes back automatically.\n- **Group chats together** (default on) — collects projectless sessions into one collapsible **Chat** group instead of interleaving them. With device grouping on, each device section gets its own Chat group with independent collapse state.\n- Grouping **by date** has been removed.\n\n**Sorting:**\n\n- **By time** (default) — one activity timeline for the whole list, most recent first. There is no oldest-first option.\n- **Priority** — four tiers, same as Codex: sessions waiting on you (pending reply / approval / error) first, then finished-unread sessions, then running sessions, then the rest by time. A project row inherits the highest priority among its sessions. Unread state is in-memory: after a restart most sessions fall back to time order.\n- **Manual** — drag project rows to set a persistent custom order. Manual order covers **project rows only**; stray chats and the Chat group always follow by recency. Switch to Manual first to drag; other sort modes do not start a drag.\n- Sorting **alphabetically** and **oldest first** have been removed.\n\n**Filters (one row that opens a submenu):**\n\n- **Status** — active / archived / all.\n- **Project** — multi-select working directories plus **Chat** (projectless sessions), or \"all\". Selecting specific projects hides chats unless **Chat** is also checked; check only **Chat** to see projectless sessions alone.\n- **Agent** — Claude Code / Codex / all.\n- **Recent activity** — last 1 day / 3 days / 7 days / 30 days / all.\n- A **Reset filters** action at the bottom clears all four at once. Filters do **not** apply to the Pinned section, except Status (archived pins stay hidden while Status is Active). The list header does not show a standing “filtered” mark; open Sidebar display settings to see which filters are on.\n\n**Display:**\n\n- The main list has **Text** (compact single row) and **List** (two-line row with a preview) styles. Fresh installs default to List; installs upgraded from an older version keep Text so the sidebar looks the way it did before the upgrade. This is separate from the Pinned section's style.\n- **Session info** — choose what shows at the right edge of each row: **Time** (default), **PR status** (a status icon plus a monospace `#number`; only the icon is colored — green open / gray draft / red closed / accent merged; unknown state shows a gray icon; sessions without a PR show nothing), **Tokens** (compact total like `1.4M`), and **Cost** (`$`/`¥` by currency). Multi-select; items render in the order you selected them.\n\n**Pinning:**\n\n- Right-click a session and pick **Pin** to keep it at the top. There's no cap on the number of pinned sessions; a newly pinned session goes to the **front** of the pin order (most recent pin first).\n- Right-click a pinned session and pick **Unpin** to remove the pin.\n- Open a project's overflow menu and pick **Pin project** to move the whole project into **Pinned**. Project pins are independent from session pins, remain available after a restart or project rename, and can be expanded or collapsed inside **Pinned**.\n- Pinned projects and sessions share one draggable order. Newly pinned items move to the front, while the other pinned items keep their relative order. Use **Unpin project** to return a project to its position under the current project sorting mode.\n- The **Pinned** section keeps its own display style: **Text**, **List**, and **Card** — Card mode is exclusive to Pinned.\n\n**Collapse / expand all groups:**\n\n- The fold button next to the display-settings button collapses or expands every group at once. With both device and project grouping on, it cycles through levels: collapse project groups → collapse device groups → expand all. The tooltip always names the next step.\n\n**Searching:**\n\n- The search box matches against the **session title only** — not message content and not the working directory path. If you can't remember a session's title, browse via project / agent filters instead.\n\n**Right-click actions:**\n\n- On a regular session: **Pin / Unpin**, **Rename**, **Move to project** (submenu), **Copy session link** (a `cindy://session/<id>` deep link), **Open in new window**, **Archive**, **Delete**.\n- On an archived session: **Rename**, **Unarchive**, **Copy session link**, **Delete**.\n\n**Removing a project from the sidebar:**\n\n- Open a local project's overflow menu and choose **Remove Project from Sidebar**. Cindy asks for confirmation, removes the project from the sidebar, and keeps its existing sessions available as projectless chats in the main list. Individually pinned sessions remain in **Pinned**. Those sessions are not archived or stopped, and files on your computer are not deleted.\n- To restore the project, choose **Add Project** and select the same directory again. Cindy restores the existing sessions under their original project grouping instead of creating an empty session.\n\n**Session statuses:**\n\n- Sessions are **active**, **archived**, or **deleted** — there are no other states. Archiving hides a session from the default view without removing it; delete is unrecoverable from the UI.\n\n**Notes:**\n\n- Click the sidebar collapse arrow to shrink it to an icon-only strip — that's purely visual, you don't lose any features.\n- **Pin state, order, hidden projects, project filters, and identity-based collapse/selection state are isolated per Cindy account.** Pin and hidden-project changes sync across open windows for the same account. Display-only preferences (list style, grouping toggles, sorting, session info) remain local to each window, so they don't sync between, say, a dev window and the installed app.",+ content: "The left sidebar lists your sessions. It's the main way to navigate and organize. The **Sidebar display settings** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the main list header, from **Sidebar display settings** in the device-scope menu, or by right-clicking any blank area of the sidebar.\n\n**Device scope (the list header itself):**\n\n- The main list header doubles as the device scope switcher. Its text names what you're looking at — **All sessions**, **This device's sessions**, a remote device's name, or **N machines** — and clicking it opens the scope menu: all / this device / each connected remote device (single-click switches; checkboxes multi-select), plus **Remote connection settings** and **Sidebar display settings**.\n- The scope applies to the whole sidebar, including the Pinned section.\n- With no remote devices, the header still shows **All sessions ▾**. Clicking it opens a short menu with only **Remote connection settings** and **Sidebar display settings** — no device list. The header stays visible even when the list is empty, only pinned items remain, remote devices/tasks are loading or failed, or the selected remote device is still connecting. There is no separate device row in the top navigation.\n\n**Grouping (independent checkboxes, freely combinable):**\n\n- **Group by project** (default on) — sessions with a project fold into project rows; project rows and stray chats compete for position on the same timeline (a chat active two minutes ago sorts above a project last touched yesterday). Turn it off for a flat list.\n- **Group by device** (default on) — only appears when a remote device is connected and the scope isn't narrowed to a single machine; splits the list into device sections (this device first), each with a collapsible header showing the device name and online state. When the last remote device disconnects — or the scope is a single machine — the option disappears and the effect is lifted; the saved preference is untouched and comes back automatically.\n- **Group chats together** (default on) — collects projectless sessions into one collapsible **Chat** group instead of interleaving them. With device grouping on, each device section gets its own Chat group with independent collapse state.\n- Grouping **by date** has been removed.\n\n**Sorting:**\n\n- **By time** (default) — one activity timeline for the whole list, most recent first. There is no oldest-first option.\n- **Priority** — four tiers, same as Codex: sessions waiting on you (pending reply / approval / error) first, then finished-unread sessions, then running sessions, then the rest by time. A project row inherits the highest priority among its sessions. Unread state is in-memory: after a restart most sessions fall back to time order.\n- **Manual** — drag project rows to set a persistent custom order. Manual order covers **project rows only**; stray chats and the Chat group always follow by recency. Switch to Manual first to drag; other sort modes do not start a drag.\n- Sorting **alphabetically** and **oldest first** have been removed.\n\n**Filters (one row that opens a submenu):**\n\n- **Status** — active / archived / all.\n- **Project** — multi-select working directories plus **Chat** (projectless sessions), or \"all\". Selecting specific projects hides chats unless **Chat** is also checked; check only **Chat** to see projectless sessions alone.\n- **Agent** — Claude Code / Codex / all.\n- **Recent activity** — last 1 day / 3 days / 7 days / 30 days / all.\n- A **Reset filters** action at the bottom clears all four at once. Filters do **not** apply to the Pinned section, except Status (archived pins stay hidden while Status is Active). The list header does not show a standing “filtered” mark; open Sidebar display settings to see which filters are on.\n\n**Display:**\n\n- The main list has **Text** (compact single row) and **List** (two-line row with a preview) styles. Fresh installs default to List; installs upgraded from an older version keep Text so the sidebar looks the way it did before the upgrade. This is separate from the Pinned section's style.\n- **Session info** — choose what shows at the right edge of each row: **Time** (default), **PR status** (a status icon plus a monospace `#number`; only the icon is colored — green open / gray draft / red closed / accent merged; the open green follows the row surface so it stays readable on both the rest background and the inverse selected pill; a small orange dot on the icon means the PR still has unresolved review threads; unknown state shows a gray icon; sessions without a PR show nothing), **Tokens** (compact total like `1.4M`), and **Cost** (`$`/`¥` by currency). Multi-select; items render in the order you selected them.\n\n**Pinning:**\n\n- Right-click a session and pick **Pin** to keep it at the top. There's no cap on the number of pinned sessions; a newly pinned session goes to the **front** of the pin order (most recent pin first).\n- Right-click a pinned session and pick **Unpin** to remove the pin.\n- Open a project's overflow menu and pick **Pin project** to move the whole project into **Pinned**. Project pins are independent from session pins, remain available after a restart or project rename, and can be expanded or collapsed inside **Pinned**.\n- Pinned projects and sessions share one draggable order. Newly pinned items move to the front, while the other pinned items keep their relative order. Use **Unpin project** to return a project to its position under the current project sorting mode.\n- The **Pinned** section keeps its own display style: **Text**, **List**, and **Card** — Card mode is exclusive to Pinned.\n\n**Collapse / expand all groups:**\n\n- The fold button next to the display-settings button collapses or expands every group at once. With both device and project grouping on, it cycles through levels: collapse project groups → collapse device groups → expand all. The tooltip always names the next step.\n\n**Searching:**\n\n- The search box matches against the **session title only** — not message content and not the working directory path. If you can't remember a session's title, browse via project / agent filters instead.\n\n**Right-click actions:**\n\n- On a regular session: **Pin / Unpin**, **Rename**, **Move to project** (submenu), **Copy session link** (a `cindy://session/<id>` deep link), **Open in new window**, **Archive**, **Delete**.\n- On an archived session: **Rename**, **Unarchive**, **Copy session link**, **Delete**.\n\n**Removing a project from the sidebar:**\n\n- Open a local project's overflow menu and choose **Remove Project from Sidebar**. Cindy asks for confirmation, removes the project from the sidebar, and keeps its existing sessions available as projectless chats in the main list. Individually pinned sessions remain in **Pinned**. Those sessions are not archived or stopped, and files on your computer are not deleted.\n- To restore the project, choose **Add Project** and select the same directory again. Cindy restores the existing sessions under their original project grouping instead of creating an empty session.\n\n**Session statuses:**\n\n- Sessions are **active**, **archived**, or **deleted** — there are no other states. Archiving hides a session from the default view without removing it; delete is unrecoverable from the UI.\n\n**Notes:**\n\n- Click the sidebar collapse arrow to shrink it to an icon-only strip — that's purely visual, you don't lose any features.\n- **Pin state, order, hidden projects, project filters, and identity-based collapse/selection state are isolated per Cindy account.** Pin and hidden-project changes sync across open windows for the same account. Display-only preferences (list style, grouping toggles, sorting, session info) remain local to each window, so they don't sync between, say, a dev window and the installed app.",},{id: "skills",diff --git a/apps/desktop/src/renderer/__tests__/prStatusIconColor.test.ts b/apps/desktop/src/renderer/__tests__/prStatusIconColor.test.tsnew file mode 100644index 0000000000..42b80fe881--- /dev/null+++ b/apps/desktop/src/renderer/__tests__/prStatusIconColor.test.ts@@ -0,0 +1,45 @@+import { describe, expect, it } from 'vitest';++import {+ prIconSurface,+ prStatusIconColor,+ shouldShowPrUnresolvedDot,+} from '../features/cc-agent/gitContextPrVisuals';++describe('prIconSurface', () => {+ it('未选中跟主题表面走', () => {+ expect(prIconSurface({ themeIsDark: false, isActive: false })).toBe('light');+ expect(prIconSurface({ themeIsDark: true, isActive: false })).toBe('dark');+ });++ it('选中胶囊反相:夜间选中是浅表面,白天选中是深表面', () => {+ expect(prIconSurface({ themeIsDark: true, isActive: true })).toBe('light');+ expect(prIconSurface({ themeIsDark: false, isActive: true })).toBe('dark');+ });+});++describe('prStatusIconColor', () => {+ it('open 按表面取侧栏专用绿,不跟主题 --diff-add-fg', () => {+ expect(prStatusIconColor('open', 'light')).toBe('var(--pr-open-on-light)');+ expect(prStatusIconColor('open', 'dark')).toBe('var(--pr-open-on-dark)');+ });++ it('其它三态与未知态不跟表面走', () => {+ expect(prStatusIconColor('draft', 'light')).toBe('var(--text-tertiary)');+ expect(prStatusIconColor('merged', 'dark')).toBe('var(--focus-ring)');+ expect(prStatusIconColor('closed', 'light')).toBe('var(--error-fg)');+ expect(prStatusIconColor(null, 'dark')).toBe('var(--text-tertiary)');+ });+});++describe('shouldShowPrUnresolvedDot', () => {+ it('只在 open/draft 且 count>0 时打点', () => {+ expect(shouldShowPrUnresolvedDot('open', 3)).toBe(true);+ expect(shouldShowPrUnresolvedDot('draft', 1)).toBe(true);+ expect(shouldShowPrUnresolvedDot('open', 0)).toBe(false);+ expect(shouldShowPrUnresolvedDot('open', null)).toBe(false);+ expect(shouldShowPrUnresolvedDot('merged', 4)).toBe(false);+ expect(shouldShowPrUnresolvedDot('closed', 2)).toBe(false);+ expect(shouldShowPrUnresolvedDot(null, 5)).toBe(false);+ });+});diff --git a/apps/desktop/src/renderer/features/cc-agent/gitContextPrVisuals.ts b/apps/desktop/src/renderer/features/cc-agent/gitContextPrVisuals.tsindex 6356850f8c..9777698f59 100644--- a/apps/desktop/src/renderer/features/cc-agent/gitContextPrVisuals.ts+++ b/apps/desktop/src/renderer/features/cc-agent/gitContextPrVisuals.ts@@ -49,3 +49,34 @@ export const PR_STATUS_COLOR: Record<PrStatusKind, string> = {merged: 'var(--focus-ring)',closed: 'var(--error-fg)',};++/** 侧栏任务行 PR icon 所在表面:选中胶囊是反相底,跟主题名不是一回事。 */+export type PrIconSurface = 'light' | 'dark';++/**+ * 侧栏 open 绿按表面取,不跟当前主题名走(2026-08-17 用户选 B):+ * 浅表面(白天未选中 / 夜间选中白胶囊)→ `--pr-open-on-light` `#2EA043`+ * 深表面(夜间未选中 / 白天选中深胶囊)→ `--pr-open-on-dark` `#3FB950`+ * 顶栏 GitContextBadge / hover tooltip 仍用 PR_STATUS_COLOR(主题 `--diff-add-fg`)。+ */+export function prIconSurface(opts: { themeIsDark: boolean; isActive: boolean }): PrIconSurface {+ if (opts.isActive) return opts.themeIsDark ? 'light' : 'dark';+ return opts.themeIsDark ? 'dark' : 'light';+}++export function prStatusIconColor(kind: PrStatusKind | null, surface: PrIconSurface): string {+ if (kind === 'open') {+ return surface === 'light' ? 'var(--pr-open-on-light)' : 'var(--pr-open-on-dark)';+ }+ if (kind) return PR_STATUS_COLOR[kind];+ return 'var(--text-tertiary)';+}++/** open / draft 且有未解决 review thread 才打角点;merged / closed 当历史噪声。 */+export function shouldShowPrUnresolvedDot(+ kind: PrStatusKind | null,+ unresolvedCount: number | null | undefined,+): boolean {+ if (!unresolvedCount || unresolvedCount <= 0) return false;+ return kind === 'open' || kind === 'draft';+}diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsxindex b651c73dc3..eb34a11e92 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx@@ -10,9 +10,11 @@* - pr:session_pr_refs 的最新一条(lastSeenAt 降序首位),显示「状态 icon +* 等宽 `#号`」,与会话顶栏 GitContextBadge 的 PrChip 同款(2026-08-12 用户* 裁决:仿顶栏,状态颜色只上在 icon 上,`#号` 文字用信息槽常规灰):形状表- * PR_STATUS_ICON + 色表 PR_STATUS_COLOR(色弱友好,四态形状不同);状态- * 未加载 / no-token / 查询失败时 icon 降级 GitPullRequest + tertiary 灰- * (号码本地就有)。文字状态放 hover。+ * PR_STATUS_ICON + 侧栏 open 绿按表面取(prStatusIconColor;浅 `#2EA043` /+ * 深 `#3FB950`);其它三态仍走 PR_STATUS_COLOR。open/draft 且有未解决+ * review thread 时 icon 右上角打 `--status-bar-accent` 静点。状态未加载 /+ * no-token / 查询失败时 icon 降级 GitPullRequest + tertiary 灰(号码本地+ * 就有)。文字状态与未解决条数放 hover。* - tokens:session.totalTokenUsage,formatCompactTokens 缩写(1.4M / 320k),* 无单位后缀(与费用的货币前缀天然区分);0 视为无数据不显示。* - cost:优先 totalMoney(区域币种 $/¥),回退 legacy totalCostUsd;@@ -35,13 +37,19 @@ import { GitPullRequest } from 'lucide-react';import { formatCompactTokens } from '@cindy/maker-shared/usage-format';import { useTranslation } from 'react-i18next';+import { useIsDarkMode } from '@/components/markdown/useIsDarkMode';+import { usePrActions, usePrStatus } from '@/contexts/PrRefsContext';import { cn } from '@/lib/utils';import type { Session } from '@/lib/ccAgent.types';import type { SessionPrRef } from '@/lib/gitContext.types';import { formatMoney, formatUsd } from '@/lib/usageFormat';import { prStatusKey } from '@/lib/prStatus';-import { usePrActions, usePrStatus } from '@/contexts/PrRefsContext';-import { PR_STATUS_COLOR, PR_STATUS_ICON } from '../gitContextPrVisuals';+import {+ PR_STATUS_ICON,+ prIconSurface,+ prStatusIconColor,+ shouldShowPrUnresolvedDot,+} from '../gitContextPrVisuals';import { formatSidebarTime, formatSidebarTimeAbsolute } from '../lib/formatSidebarTime';import type { TaskInfoField } from '../hooks/useTaskInfoFields';@@ -123,10 +131,12 @@ export function buildSessionInfoPieces(* 挂载即请求状态(fetchStatusesForSession 有去重 + main 60s TTL)。* 视觉与顶栏 PrChip 同款:状态 icon(形状 + 颜色双编码)+ 等宽 `#号`;* `#号` 文字继承信息槽前景色(active 让位由父级统一处理),状态颜色只上- * 在 icon 上。状态未加载时 icon 灰色 GitPullRequest 占位;文字状态进 title。+ * 在 icon 上(open 按所在表面取,见 prStatusIconColor)。状态未加载时 icon+ * 灰色 GitPullRequest 占位;文字状态与未解决条数进 title。*/-function PrNumberPiece({ prRef }: { prRef: SessionPrRef }) {+function PrNumberPiece({ prRef, isActive }: { prRef: SessionPrRef; isActive?: boolean }) {const { t } = useTranslation();+ const themeIsDark = useIsDarkMode();// fetch 从恒定的 actions context 拿——经 usePrStatuses 拿会连带订阅整表快照,// 徽标就退化回"任一状态变化全体重渲染"。const { fetchStatusesForSession } = usePrActions();@@ -137,18 +147,35 @@ function PrNumberPiece({ prRef }: { prRef: SessionPrRef }) {// 全部已挂载徽标;usePrStatus 在本 PR 结果未变时快照引用不变、不重渲染。const status = usePrStatus(prStatusKey(prRef));const kind = status?.ok ? status.status : null;+ const unresolvedCount = status?.ok ? status.unresolvedCount : null;+ const showDot = shouldShowPrUnresolvedDot(kind, unresolvedCount);const Icon = kind ? PR_STATUS_ICON[kind] : GitPullRequest;- const title = kind+ const color = prStatusIconColor(kind, prIconSurface({ themeIsDark, isActive: Boolean(isActive) }));+ const baseTitle = kind? `${prRef.owner}/${prRef.repo}#${prRef.prNumber} · ${t(`ccAgent.gitContext.pr.status.${kind}`)}`: `${prRef.owner}/${prRef.repo}#${prRef.prNumber}`;+ const title =+ showDot && unresolvedCount+ ? `${baseTitle} · ${t('ccAgent.gitContext.pr.unresolved', { count: unresolvedCount })}`+ : baseTitle;return (<span className="flex shrink-0 items-center gap-0.5 font-mono" title={title}>- <Icon- size={11}- strokeWidth={1.75}- className="shrink-0"- style={{ color: kind ? PR_STATUS_COLOR[kind] : 'var(--text-tertiary)' }}- />+ <span className="relative shrink-0">+ <Icon size={11} strokeWidth={1.75} className="block" style={{ color }} />+ {showDot ? (+ <span+ aria-hidden+ className="absolute rounded-full bg-[var(--status-bar-accent)]"+ style={{+ width: 5,+ height: 5,+ top: -1.5,+ right: -1.5,+ boxShadow: `0 0 0 1.25px ${isActive ? 'hsl(var(--sidebar-item-active))' : 'hsl(var(--sidebar))'}`,+ }}+ />+ ) : null}+ </span>#{prRef.prNumber}</span>);@@ -183,7 +210,9 @@ export function SessionInfoMeta({>{/* 顺序完全由 pieces 决定(= 用户勾选顺序);'pr' 是占位,这里换成徽标。兼容旧调用:未把 pr 排进 pieces 时(hasPrRef 未传),仍按老样子前置。 */}- {prRef && !pieces.some((piece) => piece.key === 'pr') && <PrNumberPiece prRef={prRef} />}+ {prRef && !pieces.some((piece) => piece.key === 'pr') && (+ <PrNumberPiece prRef={prRef} isActive={isActive} />+ )}{pieces.map((piece, index) => (<span key={piece.key} className="flex shrink-0 items-center gap-1" title={piece.title}>{(index > 0 || (prRef && !pieces.some((p) => p.key === 'pr'))) && (@@ -193,7 +222,7 @@ export function SessionInfoMeta({)}{piece.key === 'pr' ? (prRef ? (- <PrNumberPiece prRef={prRef} />+ <PrNumberPiece prRef={prRef} isActive={isActive} />) : null) : piece.dateTime ? (<time dateTime={piece.dateTime}>{piece.text}</time>diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.tsnew file mode 100644index 0000000000..fd51cf7c98--- /dev/null+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.ts@@ -0,0 +1,124 @@+// @vitest-environment jsdom++import { createElement } from 'react';+import { cleanup, render, screen } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { SessionInfoMeta } from '../SessionInfoMeta';+import type { SessionPrRef } from '@/lib/gitContext.types';+import type { PrStatusResult } from '@/lib/gitContext.types';++let status: PrStatusResult | undefined;++vi.mock('react-i18next', () => ({+ useTranslation: () => ({+ t: (key: string, opts?: { count?: number }) =>+ opts?.count != null ? `${key}:${opts.count}` : key,+ }),+}));++vi.mock('@/contexts/PrRefsContext', () => ({+ usePrActions: () => ({ fetchStatusesForSession: vi.fn() }),+ usePrStatus: () => status,+}));++const prRef: SessionPrRef = {+ id: 'pr-ref-1',+ sessionId: 'session-1',+ owner: 'makecindy',+ repo: 'cindy',+ prNumber: 2818,+ url: 'https://github.com/makecindy/cindy/pull/2818',+ firstSeenAt: 0,+ lastSeenAt: 0,+};++afterEach(() => {+ cleanup();+ status = undefined;+ document.documentElement.classList.remove('dark');+});++beforeEach(() => {+ document.documentElement.classList.add('dark');+});++describe('SessionInfoMeta PR 徽标', () => {+ it('open + 未解决 thread 时打角点,夜间未选中用深表面绿', () => {+ status = {+ ok: true,+ owner: prRef.owner,+ repo: prRef.repo,+ prNumber: prRef.prNumber,+ status: 'open',+ title: 'demo',+ htmlUrl: prRef.url,+ branch: 'feat/demo',+ unresolvedCount: 3,+ };++ const { container } = render(+ createElement(SessionInfoMeta, {+ pieces: [{ key: 'pr', text: '' }],+ prRef,+ isActive: false,+ }),+ );++ expect(screen.getByText('#2818')).toBeTruthy();+ expect(screen.getByTitle(/unresolved:3/)).toBeTruthy();+ const icon = container.querySelector('svg');+ expect(icon).toBeTruthy();+ expect((icon as SVGElement).style.color).toBe('var(--pr-open-on-dark)');+ expect(container.querySelector('[aria-hidden].rounded-full')).toBeTruthy();+ });++ it('夜间选中改走浅表面绿', () => {+ status = {+ ok: true,+ owner: prRef.owner,+ repo: prRef.repo,+ prNumber: prRef.prNumber,+ status: 'open',+ title: 'demo',+ htmlUrl: prRef.url,+ branch: 'feat/demo',+ unresolvedCount: 0,+ };++ const { container } = render(+ createElement(SessionInfoMeta, {+ pieces: [{ key: 'pr', text: '' }],+ prRef,+ isActive: true,+ }),+ );++ const icon = container.querySelector('svg');+ expect((icon as SVGElement).style.color).toBe('var(--pr-open-on-light)');+ expect(container.querySelector('[aria-hidden].rounded-full')).toBeNull();+ });++ it('merged 即使还有 thread 也不打点', () => {+ status = {+ ok: true,+ owner: prRef.owner,+ repo: prRef.repo,+ prNumber: prRef.prNumber,+ status: 'merged',+ title: 'demo',+ htmlUrl: prRef.url,+ branch: 'feat/demo',+ unresolvedCount: 2,+ };++ const { container } = render(+ createElement(SessionInfoMeta, {+ pieces: [{ key: 'pr', text: '' }],+ prRef,+ }),+ );++ expect(container.querySelector('[aria-hidden].rounded-full')).toBeNull();+ });+});diff --git a/apps/desktop/src/renderer/themes/colors.ts b/apps/desktop/src/renderer/themes/colors.tsindex 7052dfaf55..2383afe5fe 100644--- a/apps/desktop/src/renderer/themes/colors.ts+++ b/apps/desktop/src/renderer/themes/colors.ts@@ -1296,6 +1296,14 @@ registerColor('diff-add-fg', {light: '#22863a',dark: '#7ee787',}, 'GitHub Diff Green (Light)');+registerColor('pr-open-on-light', {+ light: '#2EA043',+ dark: '#2EA043',+}, 'Sidebar PR open green on light surfaces (unselected Light / selected Dark pill)');+registerColor('pr-open-on-dark', {+ light: '#3FB950',+ dark: '#3FB950',+}, 'Sidebar PR open green on dark surfaces (unselected Dark / selected Light pill)');registerColor('diff-add-bg', {light: '#f0fff4',dark: '#033a16',diff --git a/apps/desktop/src/shared/__tests__/themeImportPalette.test.ts b/apps/desktop/src/shared/__tests__/themeImportPalette.test.tsindex f19740837f..8ca623bc2e 100644--- a/apps/desktop/src/shared/__tests__/themeImportPalette.test.ts+++ b/apps/desktop/src/shared/__tests__/themeImportPalette.test.ts@@ -179,6 +179,13 @@ describe('theme-import 模板 · key 集合与既有 builtin 主题一致', () =])('资源用量类别色 "%s" 不被外部主题导入改写', (id) => {expect(isProtectedToken(id)).toBe(true);});++ it.each(['pr-open-on-light', 'pr-open-on-dark'])(+ '侧栏 PR open 绿 "%s" 不被外部主题导入改写',+ (id) => {+ expect(isProtectedToken(id)).toBe(true);+ },+ );});describe.each([diff --git a/apps/desktop/src/shared/theme-import/protected-tokens.ts b/apps/desktop/src/shared/theme-import/protected-tokens.tsindex 805bb04758..6eca8a183f 100644--- a/apps/desktop/src/shared/theme-import/protected-tokens.ts+++ b/apps/desktop/src/shared/theme-import/protected-tokens.ts@@ -49,6 +49,9 @@ const PROTECTED_IDS = new Set<string>(['process-renderer-icon','process-gpu-icon','process-utility-icon',+ // 侧栏 PR open 绿(按表面,主题无关;2026-08-17)+ 'pr-open-on-light',+ 'pr-open-on-dark',// 无障碍焦点环与文字选中提示色'focus-ring','focus-ring-soft',diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 1ed3a602b4..ddd9acd7b3 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -73,7 +73,7 @@ Small interactive chips (button backgrounds, tag pills, avatar fills, selected-nThe grayscale rule is near-absolute. The following are the **only** sanctioned non-gray colors in the system — each tightly scoped to a specific surface. New semantic colors must not be introduced without being recorded here first.- **Focus Blue** (`#417CDD` at 50%; tokens `--focus-ring` / `--focus-ring-soft`): the keyboard-accessibility focus ring, finalized 2026-07-17 (replaces Tailwind's default `#3b82f6`). Never visible in normal interaction flow.-- **Thinking / Warning Orange** (`#EA6B17`, finalized 2026-07-17, replaces the frozen `#FF6600`): the shared warning-accent family, identical in both modes. Sanctioned consumers only — the ChatView Running Status Bar (sparkles icon + status text, e.g. `Spelunking...`, no background fill), running-state breathing icons in the sidebar, the collaboration-mode menu row's ON state, the plan-approve icon, the Full Access permission highlight, the settings integration warning, and the workflow agent status strip's running cells (8×8px filled squares in the background-tasks panel detail and the workflow chat card, registered 2026-07-28 — running-state semantics, same family as the sidebar breathing icons; the done/failed/queued cells stay on their own semantic tokens: `--card-status-done` / `--error-fg` / `--surface-chip`) (see the §10 exemption table and §15 for the full token list: `--warning-accent` and its follower tokens). A consumer that introduces no new token — one that reads `--warning-accent` or an existing follower directly, like this strip — is registered by this list alone; a consumer needing a NEW token must be registered in the §10 exemption table first.+- **Thinking / Warning Orange** (`#EA6B17`, finalized 2026-07-17, replaces the frozen `#FF6600`): the shared warning-accent family, identical in both modes. Sanctioned consumers only — the ChatView Running Status Bar (sparkles icon + status text, e.g. `Spelunking...`, no background fill), running-state breathing icons in the sidebar, the collaboration-mode menu row's ON state, the plan-approve icon, the Full Access permission highlight, the settings integration warning, and the workflow agent status strip's running cells (8×8px filled squares in the background-tasks panel detail and the workflow chat card, registered 2026-07-28 — running-state semantics, same family as the sidebar breathing icons; the done/failed/queued cells stay on their own semantic tokens: `--card-status-done` / `--error-fg` / `--surface-chip`), and the sidebar task-info PR unresolved corner dot (registered 2026-08-17 — same `--status-bar-accent` as the session-header unresolved count; static, no breathing) (see the §10 exemption table and §15 for the full token list: `--warning-accent` and its follower tokens). A consumer that introduces no new token — one that reads `--warning-accent` or an existing follower directly, like this strip — is registered by this list alone; a consumer needing a NEW token must be registered in the §10 exemption table first.> **Additional narrowly-scoped exceptions** (documented in their respective component specs, do NOT generalize as system semantic colors):>@@ -82,7 +82,7 @@ The grayscale rule is near-absolute. The following are the **only** sanctioned n> - **ConfirmDialog Danger** — `#EF4444` used ONLY on the confirm button background in the Danger variant. The cancel button and rest of the dialog remain grayscale.> - **Permission Selector Mode Highlights** — selected risky permission modes may color only the option text/icon/checkmark and the collapsed trigger text/icon. The selected row background remains grayscale. Auto Approval uses `#417CDD` in both modes (finalized 2026-07-17, same value light/dark; replaces light #000050 / dark #00D9C5). Full Access uses Heart Orange `#EA6B17` in both modes (auto-follows warning-accent, finalized 2026-07-17). These hex values are the **default-theme palette only** — other themes may override `--perm-auto-selected-text` and `--perm-bypass-selected-text` with their own accent colors, provided both modes remain color-coded, distinguishable from each other, and visually distinct from neutral text. Tokens: `--perm-auto-selected-text` and `--perm-bypass-selected-text` in `apps/desktop/src/renderer/styles/globals.css`.> - **Diff Add Green / Diff Del Red** — GitHub-standard diff syntax colors, used on the `+` / `-` symbol glyph, the changed-line text foreground, **and the full row background** inside code-diff renderings. Applied in three places: (1) the Edit-tool DiffView card (F-MSG-6), (2) markdown ````diff` fenced code blocks in the message stream, and (3) `.diff` / `.patch` files opened in TextLightbox (the document previewer) — there hljs `.hljs-addition` / `.hljs-deletion` are forced `display: block` so the background fills to the right edge instead of stopping at the last glyph. Line-number gutter and ctx (unchanged) lines remain strictly grayscale per the layer system. **Foreground** — Add: `#22863a` Light / `#7ee787` Dark; Del: `#b31d28` Light / `#ff7b72` Dark. **Background** — Add: `#f0fff4` Light / `#033a16` Dark; Del: `#ffeef0` Light / `#67060c` Dark. Tokens: `--diff-add-fg/-bg` and `--diff-del-fg/-bg` in `apps/desktop/src/renderer/styles/globals.css`. Updated 2026-04-21: backgrounds switched from grayscale → GitHub red/green for full-row fill so additions / deletions are unambiguous at a glance.-> - **PR Status Colors (session-git-pr-context / sidebar task-info)** — PR state is encoded by **existing tokens only** (no new token): open = `--diff-add-fg`, closed = `--error-fg`, merged = `--focus-ring`, draft = `--text-tertiary` (single source: `PR_STATUS_COLOR` in `apps/desktop/src/renderer/features/cc-agent/gitContextPrVisuals.ts`). Registered consumers: the session-header GitContextBadge, the sidebar PR hover tooltip, and (registered 2026-08-12, sidebar-redesign C' 期) the sidebar task-info `#number` badge — a monospace PR number whose **color alone** carries the state (text label lives in the hover title; icon-shape redundancy comes from the adjacent tooltip's status icons). Unknown/unloaded status degrades to `--text-tertiary`. Scope is strictly PR-state surfaces; do not generalize these colors to other status systems.+> - **PR Status Colors (session-git-pr-context / sidebar task-info)** — closed = `--error-fg`, merged = `--focus-ring`, draft = `--text-tertiary` (single source: `PR_STATUS_COLOR` in `apps/desktop/src/renderer/features/cc-agent/gitContextPrVisuals.ts`). **Open green is split:** the session-header GitContextBadge and sidebar hover tooltip keep `--diff-add-fg` (theme-following GitHub greens). The sidebar task-info icon (registered 2026-08-17) follows the **surface**, not the theme name, because the selected pill is inverse: light surfaces (Light rest / Dark selected `#EEEEEE`) use `--pr-open-on-light` `#2EA043`; dark surfaces (Dark rest / Light selected `#3C3F43`) use `--pr-open-on-dark` `#3FB950`. Both values are theme-invariant. The `#number` stays on the info-slot foreground. Open/draft PRs with `unresolvedCount > 0` add a 5px static `--status-bar-accent` corner dot on the status icon (not an AttentionDot tone). Unknown/unloaded status degrades to `--text-tertiary`. Scope is strictly PR-state surfaces; do not generalize these colors to other status systems.*Dark Mode text uses softened neutrals to reduce eye strain: **Soft Gray** (`#d4d4d4`) for primary text, **Silver** (`#a3a3a3`) for secondary, **Stone** (`#737373`) for tertiary (per `--text-secondary` / `--text-tertiary` in `colors.ts` — the two swap between modes). Pure White (`#ffffff`) is reserved for button labels and high-contrast UI elements on dark backgrounds.*@@ -462,6 +462,8 @@ Theme switching: `useTheme.ts` provides `theme` (System / Light / Dark mode) plu| `--login-error-fg` | `#D91F37` | `#D91F37` | Login error text/border (see §16.1) || `--error-bg/-border/-fg/-fg-strong` | (red) | (red) | Error alert card subsystem || `--diff-add-fg/-bg`, `--diff-del-fg/-bg` | GitHub palette | GitHub palette | Diff rendering |+| `--pr-open-on-light` | `#2EA043` | `#2EA043` | Sidebar task-info PR open on light surfaces (2026-08-17) |+| `--pr-open-on-dark` | `#3FB950` | `#3FB950` | Sidebar task-info PR open on dark surfaces (2026-08-17) || `--status-bar-accent` | `#EA6B17` | `#EA6B17` | Thinking Orange, theme-invariant (finalized 2026-07-17) || `--plan-action-approve-icon-bg` | `#EA6B17` | `#EA6B17` | Plan approve — same thinking semantics (follows warning-accent, finalized 2026-07-17) || `--perm-bypass-selected-text` | `#EA6B17` | `#EA6B17` | Heart Orange, permission semantics (auto-follows `var(--warning-accent)`, finalized 2026-07-17) |diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.mdindex 2479062480..2837589329 100644--- a/docs/product-rules/sidebar-redesign-plan.md+++ b/docs/product-rules/sidebar-redesign-plan.md@@ -213,7 +213,7 @@| 项 | 默认 | 形态 ||---|---|---|| 最近活动时间 | **勾** | 现状行为 |-| PR 状态 | | 状态 icon + 等宽 `#号`(与顶栏 PrChip 同款,2026-08-12 用户裁决):状态颜色只上在 icon 上(形状 + 颜色双编码,四态见 `gitContextPrVisuals`),`#号` 文字用信息槽常规灰;文字状态放 hover;无 PR 的任务不显示不占位 |+| PR 状态 | | 状态 icon + 等宽 `#号`(与顶栏 PrChip 同款,2026-08-12 用户裁决):状态颜色只上在 icon 上(形状 + 颜色双编码,四态见 `gitContextPrVisuals`;open 绿按表面取 `#2EA043` / `#3FB950`,2026-08-17);`#号` 文字用信息槽常规灰;open/draft 且有未解决 review thread 时 icon 右上角 5px `--status-bar-accent` 静点;文字状态放 hover;无 PR 的任务不显示不占位 || 累计 token | | `1.4M` / `320k` 缩写,无单位 || 费用 | | 按 `totalCostCurrency` 显示 $/¥;无数据(如订阅模式)留空 |