Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 筛选不再作用于置顶区(补齐定稿实现)
Dashfa81767b73f2
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.tsindex a126e94eb2..6a40dd879b 100644--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts@@ -203,6 +203,26 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不);});+ // 设计文档 §3.3 定稿 + 2026-08-12 用户重申:筛选不作用于置顶区。+ it('置顶区不受项目 / Agent / 最近活跃筛选影响(归档仍按状态隐藏)', () => {+ // 置顶会话:直接用 allGroups.pinned,不再套 vendor / project 过滤。+ expect(sidebarUpperSource).toMatch(+ /const visiblePinnedSessions = useMemo\(\(\) => \{[\s\S]*?return allGroups\.pinned;\s*\}, \[allGroups\.pinned\]\)/,+ );+ // 置顶项目:仍尊重「从侧栏移除」(用户显式隐藏),但不再按 project / vendor 过滤。+ const pinnedProjectsBlock = sidebarUpperSource.slice(+ sidebarUpperSource.indexOf('const visiblePinnedProjects'),+ sidebarUpperSource.indexOf('const visiblePinnedEntries'),+ );+ expect(pinnedProjectsBlock).toContain('hiddenProjectComparisonKeys');+ expect(pinnedProjectsBlock).toContain('pinnedProjectKeys.has(project.projectKey)');+ expect(pinnedProjectsBlock).not.toContain('vendorPredicate');+ expect(pinnedProjectsBlock).not.toContain('filter.projectsAsSet');+ expect(pinnedProjectsBlock).not.toContain('allowedProjects');+ // 「最近活跃」本就豁免:置顶取 allGroups(未经活跃时间收窄),不是 activityFilteredSessions。+ expect(sidebarUpperSource).toContain('const allGroups = useProjectGroups(sidebarSessions');+ });+// 2026-08-12 用户裁决:任务信息按用户勾选顺序显示(先勾时间再勾费用 → 时间在前)。it('任务信息渲染顺序 = 勾选顺序,不再是固定的 pr → tokens → cost → time', () => {const infoMetaSource = read('features', 'cc-agent', 'sidebar', 'SessionInfoMeta.tsx');diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex e786e30953..7ae0ceb942 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -1474,20 +1474,18 @@ function ExpandedView({);const visiblePinnedSessions = useMemo(() => {- // 置顶段用 allGroups.pinned(未经"最近活跃 N 天"筛选)——置顶内容不受活跃时间过滤影响,- // 久未活跃的置顶会话也始终显示。vendor / project 过滤仍照常生效。- return allGroups.pinned.filter((session) => {- if (vendorPredicate && !vendorPredicate(session)) return false;- const allowedProjects = filter.projectsAsSet;- if (allowedProjects === null) return true;- if (session.workspaceKind === 'dialogue') return false;- const projectKey = projectIdentityKeyForSession(session);- return projectKey != null && allowedProjects.has(projectKey);- });- }, [allGroups.pinned, vendorPredicate, filter.projectsAsSet]);+ // 置顶段用 allGroups.pinned(未经"最近活跃 N 天"筛选)。+ // **筛选一律不作用于置顶区**(设计文档 §3.3 定稿;2026-08-12 用户重申):+ // 状态 / 项目 / Agent / 最近活跃四个维度都不过滤置顶——用户主动置顶就是+ // 「我要一直看见它」,被筛选条件挑走会让人以为置顶丢了。置顶区只跟随设备范围+ // (scopedSidebarSessions 之外的设备切换在上游 allGroups 已收窄)。+ return allGroups.pinned;+ }, [allGroups.pinned]);const visiblePinnedProjects = useMemo(() => {- const allowedProjects = filter.projectsAsSet;+ // 同上:**筛选不作用于置顶区**——项目 / Agent 维度都不过滤置顶项目及其会话+ // (设计文档 §3.3 定稿;2026-08-12 用户重申)。仍然尊重「从侧栏移除项目」,+ // 那不是筛选而是用户对该项目的显式隐藏。return allProjectGroups.projects.flatMap((project) => {if (projectKeyComparisonSetHas(hiddenProjectComparisonKeys, project.projectKey, localPlatform)@@ -1495,29 +1493,17 @@ function ExpandedView({return [];}if (!pinnedProjectKeys.has(project.projectKey)) return [];- if (allowedProjects !== null && !allowedProjects.has(project.projectKey)) return [];-- const matchingSessions = vendorPredicate- ? project.sessions.filter(vendorPredicate)- : project.sessions;- if (vendorPredicate && matchingSessions.length === 0) return [];return [{project,// Individually pinned conversations stay as their own siblings in the// Pinned section; the project container only shows the remainder.- displaySessions: matchingSessions.filter((session) => session.pinnedAt == null),+ displaySessions: project.sessions.filter((session) => session.pinnedAt == null),},];});- }, [- allProjectGroups.projects,- hiddenProjectComparisonKeys,- pinnedProjectKeys,- filter.projectsAsSet,- vendorPredicate,- ]);+ }, [allProjectGroups.projects, hiddenProjectComparisonKeys, localPlatform, pinnedProjectKeys]);const visiblePinnedEntries = useMemo<PinnedSidebarEntry[]>(() => {const entries: PinnedSidebarEntry[] = [diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.mdindex 38c1a1f3fc..a8bc91ce1f 100644--- a/docs/product-rules/sidebar-redesign-plan.md+++ b/docs/product-rules/sidebar-redesign-plan.md@@ -124,8 +124,22 @@- Agent:全部 / Claude Code / Codex- 最近活跃:全部 / 1 / 3 / 7 / 30 天-**筛选不作用于置顶区(定稿)**。置顶区只跟随设备范围。任一筛选生效时-「全部任务」标题旁显示「已筛选」小标。+**筛选不作用于置顶区(定稿;2026-08-12 用户重申并补齐实现)**。用户主动置顶就是+「我要一直看见它」,被筛选条件挑走会让人以为置顶丢了。逐项:++| 维度 | 是否影响置顶区 |+|---|---|+| 项目 | 否 |+| Agent | 否 |+| 最近活跃 | 否(久未活跃的置顶项照常显示) |+| 状态(活跃 / 已归档 / 全部) | **是**——已归档的置顶项在「活跃」下隐藏 |++状态是唯一例外(2026-08-12 用户裁决):归档 = 用户说「这事儿完了」,与置顶语义相反,+不归档就不会受影响;切到「已归档」或「全部」时它会重新出现。置顶区其余只跟随设备+范围。任一筛选生效时「全部任务」标题旁显示「已筛选」小标。++置顶项目行内的会话同样不再按项目 / Agent 过滤;「从侧栏移除项目」仍然生效——那不是+筛选,是用户对该项目的显式隐藏。### 3.4 显示 —— 主列表形态 + 任务信息@@ -212,7 +226,9 @@ More/Archive,复用 `TimeActionsSlot`),行 2 = 固定 1 行预览;整行恒两(聊天顶栏在用),侧栏对远程会话按需补拉引用、状态经远程路由查询(被控端持gh token + main 侧按已提取引用 fail-closed 过滤),不改协议。触发条件:勾选pr 且行实际渲染,每会话一次,数量被 collapse 上限约束。-7. **筛选与置顶**:定稿为不作用于置顶。置顶条目不会因筛选消失。+7. **筛选与置顶**:定稿为不作用于置顶,置顶条目不会因筛选消失。2026-08-12 补齐+ 实现——此前项目 / Agent 两个维度仍在过滤置顶,已移除;唯一例外是状态筛选+ (已归档的置顶项在「活跃」下隐藏),口径见 §3.3 的表。8. **PR 状态色登记**:绿/红对齐 `--diff-add-fg` / `--diff-del-fg`,「侧边栏 PR状态指示」作为新消费场景需在 DESIGN.md §2 登记后方可实现。9. **文案**:新增文案四语落地;「对话」作归属分类名遵循