Skip to content

armgit / cindy

Public Imported from GitHub
0

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

fix(desktop): 项目筛选纳入对话,并在范围标题旁标已筛选

Dashf237b5dfa13b
diff --git a/apps/desktop/help-knowledge/sidebar.md b/apps/desktop/help-knowledge/sidebar.md
index 851aa55a85..591f325d62 100644
--- a/apps/desktop/help-knowledge/sidebar.md
+++ b/apps/desktop/help-knowledge/sidebar.md
@@ -29,10 +29,10 @@ The left sidebar lists your sessions. It's the main way to navigate and organize
**Filters (one row that opens a submenu):**
- **Status** — active / archived / all.
-- **Project** — multi-select working directories, or "all".
+- **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.
- **Agent** — Claude Code / Codex / all.
- **Recent activity** — last 1 day / 3 days / 7 days / 30 days / all.
-- A **Reset filters** action at the bottom clears all four at once. Filters do **not** apply to the Pinned section.
+- 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). When any filter is on, a **Filtered** mark stays next to the list header so a persisted filter cannot hide sessions with no visible explanation.
**Display:**
diff --git a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts
index 3d088a7aa4..71e31715fa 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, or \"all\".\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.\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). When any filter is on, a **Filtered** mark stays next to the list header so a persisted filter cannot hide sessions with no visible explanation.\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.",
},
{
id: "skills",
diff --git a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
index 2749b743eb..4b39ec9bec 100644
--- a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
@@ -8,7 +8,7 @@
* **有意推翻**——对话与项目行在主列表中按同一口径混排(mainListModel),
* 「对话归为一组」成为可选开关。本文件的不变量随之改写:
* - 主列表由 ProjectsSection 统一渲染,dialogues 作为混排输入传入;
- * - 项目筛选不得隐藏对话(散排对话不因 projects 多选被清空);
+ * - 项目筛选含「对话」哨兵:未勾选 DIALOGUE_FILTER_KEY 时隐藏无项目任务;
* - 固定 DialogueSection 段与按日期分组段不再渲染。
*/
@@ -60,8 +60,9 @@ describe('Mixed main list (sidebar-redesign D 期)', () => {
expect(sidebarSource).not.toContain("filter.groupBy === 'date'");
});
- it('does not let project filtering hide dialogues', () => {
- expect(sidebarSource).not.toMatch(/filter\.projectsAsSet\s*!==\s*null\)\s*return\s*\[\]/);
+ it('lets the project filter include or exclude dialogues via DIALOGUE_FILTER_KEY', () => {
+ expect(sidebarSource).toContain('DIALOGUE_FILTER_KEY');
+ expect(sidebarSource).toContain('filter.projectsAsSet.has(DIALOGUE_FILTER_KEY)');
});
it('keeps manual sort scoped to project rows (设计文档 §9.3 收窄)', () => {
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
index f01adcdaa3..596b6436e1 100644
--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
@@ -306,6 +306,8 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(filterSource).toContain('aria-label={valueNode ? value : undefined}');
// 具体维度行配图标(状态 / 项目 / Agent / 最近活跃 / 筛选 / 任务信息)。
expect(filterSource).toContain('Icon={Filter}');
+ expect(filterSource).toContain('toggleProject(DIALOGUE_FILTER_KEY)');
+ expect(filterSource).toContain("t('ccAgent.sidebar.dialogues')");
expect(filterSource).toContain('Icon={CircleDot}');
expect(filterSource).toContain('Icon={Folder}');
expect(filterSource).toContain('Icon={Bot}');
@@ -316,6 +318,8 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
it('空态 / 远程 loading-error / 连接中占位都挂范围标题(2026-08-13 第 4 轮 P1)', () => {
const headerSource = read('features', 'cc-agent', 'sidebar', 'MainListScopeHeader.tsx');
expect(headerSource).toContain('<MachineSwitcherMenu onOpenDisplaySettings=');
+ expect(headerSource).toContain('filter.isSessionContentFiltered');
+ expect(headerSource).toContain("t('ccAgent.sidebar.filterActiveBadge')");
expect(headerSource).toContain('<SidebarFilterPopover');
expect(projectsSectionSource).toContain('<MainListScopeHeader');
expect(projectsSectionSource).toContain('hasMainListContent');
diff --git a/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts b/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts
index 572c564250..8c18304bff 100644
--- a/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts
+++ b/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts
@@ -41,6 +41,7 @@ import {
persistTaskInfoFields,
nextTaskInfoAfterToggle,
persistManualProjectOrder,
+ DIALOGUE_FILTER_KEY,
nextProjectsAfterToggle,
nextSortByAfterGroupByChange,
includeProjectInFilter,
@@ -149,6 +150,11 @@ describe('loadProjects', () => {
expect(loadProjects(OWNER_ID)).toBe('all');
});
+ it('preserves the dialogue sentinel in persisted project filters', () => {
+ persistProjects([DIALOGUE_FILTER_KEY, '/a/b'], OWNER_ID);
+ expect(loadProjects(OWNER_ID)).toEqual([DIALOGUE_FILTER_KEY, 'local:/a/b']);
+ });
+
it('cleans non-string entries from a mixed array', () => {
localStorage.setItem(PROJECTS_KEY, JSON.stringify(['/a/b', 42, null, '/c/d', '']));
expect(loadProjects(OWNER_ID)).toEqual(['local:/a/b', 'local:/c/d']);
@@ -463,6 +469,17 @@ describe('nextProjectsAfterToggle', () => {
nextProjectsAfterToggle(prev, 'local:/proj-c');
expect(prev).toEqual(snapshot);
});
+
+ it("toggles the dialogue sentinel without treating it as a project path", () => {
+ expect(nextProjectsAfterToggle('all', DIALOGUE_FILTER_KEY)).toEqual([DIALOGUE_FILTER_KEY]);
+ expect(nextProjectsAfterToggle([DIALOGUE_FILTER_KEY], 'local:/proj-a')).toEqual([
+ DIALOGUE_FILTER_KEY,
+ 'local:/proj-a',
+ ]);
+ expect(nextProjectsAfterToggle([DIALOGUE_FILTER_KEY, 'local:/proj-a'], DIALOGUE_FILTER_KEY)).toEqual([
+ 'local:/proj-a',
+ ]);
+ });
});
describe('includeProjectInFilter', () => {
@@ -528,6 +545,13 @@ describe('removeProjectsFromFilter', () => {
expect(removeProjectsFromFilter(prev, new Set(['local:/a']), 'linux')).toBe('all');
});
+ it('keeps the dialogue sentinel when hidden-project snapshots arrive', () => {
+ const prev: FilterProjects = [DIALOGUE_FILTER_KEY, 'local:/a'];
+ expect(removeProjectsFromFilter(prev, new Set(['local:/a']), 'linux')).toEqual([
+ DIALOGUE_FILTER_KEY,
+ ]);
+ });
+
it('is idempotent for unrelated and repeated hidden snapshots', () => {
const unrelated: FilterProjects = ['local:/b'];
expect(removeProjectsFromFilter(unrelated, new Set(['local:/a']), 'linux')).toBe(unrelated);
@@ -579,6 +603,15 @@ describe('gcProjectsAgainstActive', () => {
const prev: FilterProjects = ['local:/a'];
expect(gcProjectsAgainstActive(prev, [])).toBe('all');
});
+
+ it('keeps the dialogue sentinel when GC drops stale projects', () => {
+ const prev: FilterProjects = [DIALOGUE_FILTER_KEY, 'local:/gone'];
+ expect(gcProjectsAgainstActive(prev, ['local:/a'])).toEqual([DIALOGUE_FILTER_KEY]);
+ });
+
+ it('keeps dialogue-only filters even when no projects remain', () => {
+ expect(gcProjectsAgainstActive([DIALOGUE_FILTER_KEY], [])).toEqual([DIALOGUE_FILTER_KEY]);
+ });
});
describe('manual project ordering', () => {
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
index 099242b578..1391526035 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@@ -198,7 +198,11 @@ import {
import { getSessionListCollapseView } from './lib/sessionListCollapse';
import { hasSessionSelectionModifier, type SessionClickModifiers } from './sidebar/SessionItem';
import type { SessionMoveTarget } from './sidebar/sessionMoveTarget';
-import { normalizeManualPinnedOrder, mergeVisibleReorder } from './hooks/helpers/sidebarFilterCore';
+import {
+ DIALOGUE_FILTER_KEY,
+ mergeVisibleReorder,
+ normalizeManualPinnedOrder,
+} from './hooks/helpers/sidebarFilterCore';
import {
activePinnedSidebarEntryIds,
pinnedProjectEntryId,
@@ -1550,8 +1554,12 @@ function ExpandedView({
);
const visibleDialogues = useMemo(() => {
- return vendorPredicate ? groups.dialogues.filter(vendorPredicate) : groups.dialogues;
- }, [groups.dialogues, vendorPredicate]);
+ const sessions = vendorPredicate
+ ? groups.dialogues.filter(vendorPredicate)
+ : groups.dialogues;
+ if (filter.projectsAsSet === null) return sessions;
+ return filter.projectsAsSet.has(DIALOGUE_FILTER_KEY) ? sessions : [];
+ }, [groups.dialogues, vendorPredicate, filter.projectsAsSet]);
// 对话段排序状态提升到此处:DialogueSection(展开态)受控消费,rail 对话
// 面板按同一排序渲染——否则折叠后面板的前 N 条/折叠溢出与展开态刚排好的
@@ -3083,6 +3091,7 @@ function ExpandedView({
<MainListScopeHeader
filter={filter}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
hasRemoteDevices={deviceGroupingAvailable}
/>
<RemoteSidebarLoadNotice
@@ -3097,6 +3106,7 @@ function ExpandedView({
<MainListScopeHeader
filter={filter}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
hasRemoteDevices={deviceGroupingAvailable}
/>
<RemoteSidebarLoadNotice
@@ -3111,6 +3121,7 @@ function ExpandedView({
<MainListScopeHeader
filter={filter}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
hasRemoteDevices={deviceGroupingAvailable}
/>
<RemoteSidebarLoadNotice kind="devices" status="loading" partial={false} />
@@ -3120,6 +3131,7 @@ function ExpandedView({
<MainListScopeHeader
filter={filter}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
hasRemoteDevices={deviceGroupingAvailable}
/>
<RemoteSidebarLoadNotice
@@ -3136,6 +3148,7 @@ function ExpandedView({
<MainListScopeHeader
filter={filter}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
hasRemoteDevices={deviceGroupingAvailable}
/>
<div className="flex flex-col items-center justify-center px-3 py-12 text-center">
@@ -3232,6 +3245,7 @@ function ExpandedView({
projects={visibleProjectsWithVendor}
dialogues={visibleDialogues}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
allProjectKeysForOrder={gcProjectKeys}
filter={filter}
collapsed={collapse.collapsed}
@@ -3293,6 +3307,7 @@ function ExpandedView({
<SidebarFilterPopover
filter={filter}
allKnownProjects={visibleProjectUniverse}
+ dialogueCount={allGroups.dialogues.length}
// 与段头实例同一门控:范围收窄到单台机器时「按设备分组」选项隐藏
// (2026-08-13 用户定稿,详见 ProjectsSection.deviceGroupingAvailable)。
hasRemoteDevices={deviceGroupingAvailable}
diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts b/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts
index 84f4f44250..78cdb5cc32 100644
--- a/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts
@@ -43,7 +43,12 @@ export const MANUAL_PROJECT_ORDER_KEY = 'cc-agent.sidebar.filter.manualProjectOr
export const MANUAL_PINNED_ORDER_KEY = 'cc-agent.sidebar.pinnedSessionOrder';
export type FilterStatus = 'active' | 'archived' | 'all';
-/** 'all' 字符串字面量 = 选中"全部";string[] = 仅显示其中的 normalized workingDir。 */
+/**
+ * 项目筛选里的「对话」哨兵 = 无项目归属的任务。不是真实 projectKey,
+ * 不能走路径归一化,也不能被项目 GC 清掉。
+ */
+export const DIALOGUE_FILTER_KEY = 'dialogue';
+/** 'all' 字符串字面量 = 选中"全部";string[] = 勾选的 projectKey 和/或 DIALOGUE_FILTER_KEY。 */
export type FilterProjects = 'all' | string[];
/** M41: vendor filter — 'all' = 全部;'cc' = 仅 Claude;'codex' = 仅 Codex。 */
export type FilterVendor = 'all' | 'cc' | 'codex';
@@ -133,7 +138,7 @@ export function loadProjects(ownerId: string | null): FilterProjects {
}
if (parsed === 'all') return 'all';
if (Array.isArray(parsed)) {
- const cleaned = normalizeProjectKeyList(parsed);
+ const cleaned = normalizeFilterProjectList(parsed);
if (cleaned.length === 0) return 'all';
return cleaned;
}
@@ -172,12 +177,12 @@ export function persistProjects(p: FilterProjects, ownerId: string | null): void
* 实际上本函数总是返回新对象(除非语义无变化才返回 prev)。
*/
export function nextProjectsAfterToggle(prev: FilterProjects, workingDir: string): FilterProjects {
- const projectKey = normalizeProjectKey(workingDir);
+ const projectKey = normalizeFilterEntry(workingDir);
if (!projectKey) return prev;
if (prev === 'all') {
return [projectKey];
}
- const normalizedPrev = normalizeProjectKeyList(prev);
+ const normalizedPrev = normalizeFilterProjectList(prev);
const idx = normalizedPrev.indexOf(projectKey);
if (idx >= 0) {
if (normalizedPrev.length === 1) {
@@ -196,9 +201,9 @@ export function nextProjectsAfterToggle(prev: FilterProjects, workingDir: string
*/
export function includeProjectInFilter(prev: FilterProjects, workingDir: string): FilterProjects {
if (prev === 'all') return prev;
- const projectKey = normalizeProjectKey(workingDir);
+ const projectKey = normalizeFilterEntry(workingDir);
if (!projectKey) return prev;
- const normalizedPrev = normalizeProjectKeyList(prev);
+ const normalizedPrev = normalizeFilterProjectList(prev);
if (normalizedPrev.includes(projectKey)) {
return arraysEqual(normalizedPrev, prev) ? prev : normalizedPrev;
}
@@ -224,8 +229,9 @@ export function removeProjectsFromFilter(
.filter((projectKey): projectKey is string => projectKey != null),
);
if (hiddenComparisonKeys.size === 0) return prev;
- const normalizedPrev = normalizeProjectKeyList(prev);
+ const normalizedPrev = normalizeFilterProjectList(prev);
const filtered = normalizedPrev.filter((projectKey) => {
+ if (projectKey === DIALOGUE_FILTER_KEY) return true;
const comparisonKey = projectKeyComparisonKey(projectKey, localPlatform);
return comparisonKey == null || !hiddenComparisonKeys.has(comparisonKey);
});
@@ -747,14 +753,34 @@ export function gcProjectsAgainstActive(
): FilterProjects {
if (prev === 'all') return prev;
const activeSet = new Set(normalizeProjectKeyList(activeWorkingDirs));
- const normalizedPrev = normalizeProjectKeyList(prev);
- const filtered = normalizedPrev.filter((wd) => activeSet.has(wd));
+ const normalizedPrev = normalizeFilterProjectList(prev);
+ const filtered = normalizedPrev.filter(
+ (wd) => wd === DIALOGUE_FILTER_KEY || activeSet.has(wd),
+ );
if (filtered.length === 0) return 'all';
if (filtered.length === normalizedPrev.length && arraysEqual(normalizedPrev, prev)) return prev;
if (filtered.length === normalizedPrev.length) return normalizedPrev;
return filtered;
}
+function normalizeFilterEntry(raw: unknown): string | null {
+ if (typeof raw !== 'string') return null;
+ if (raw === DIALOGUE_FILTER_KEY) return DIALOGUE_FILTER_KEY;
+ return normalizeProjectKey(raw);
+}
+
+function normalizeFilterProjectList(values: readonly unknown[]): string[] {
+ const seen = new Set<string>();
+ const out: string[] = [];
+ for (const value of values) {
+ const key = normalizeFilterEntry(value);
+ if (!key || seen.has(key)) continue;
+ seen.add(key);
+ out.push(key);
+ }
+ return out;
+}
+
function normalizeProjectKeyList(values: readonly unknown[]): string[] {
const seen = new Set<string>();
const out: string[] = [];
diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/useSidebarFilter.ts b/apps/desktop/src/renderer/features/cc-agent/hooks/useSidebarFilter.ts
index a00f994f72..1168c4c855 100644
--- a/apps/desktop/src/renderer/features/cc-agent/hooks/useSidebarFilter.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/useSidebarFilter.ts
@@ -3,7 +3,7 @@
* ---------------------------------------------------------------------------
* 封装 Status × Project × Vendor × Last activity 筛选状态,以及主列表整理偏好:
* - status : 'active' | 'archived' | 'all' → 由后端通过 query 过滤
- * - projects : 'all' | string[] → 客户端 render 阶段过滤
+ * - projects : 'all' | string[] → 客户端 render 阶段过滤(含对话哨兵)
* - vendor : 'all' | 'cc' | 'codex' → 客户端 render 阶段过滤
* - lastActivity : 'all' | '1d' | ... → 客户端 render 阶段过滤
* - groupBy : 'project' | 'flat' → 客户端 render 阶段切换主列表分组
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
index 80b8310efb..204b2f33b2 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
@@ -8,6 +8,7 @@
*/
import { useState, type ReactNode } from 'react';
import type { LucideIcon } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
import { cn } from '@/lib/utils';
import { Tip } from '@/components/ui/tooltip';
@@ -32,11 +33,13 @@ const HEADER_ACTIONS_CLASS = cn('flex items-center gap-0.5 -mt-px', HEADER_HOVER
export function MainListScopeHeader({
filter,
allKnownProjects,
+ dialogueCount = 0,
hasRemoteDevices,
fold = null,
}: {
filter: UseSidebarFilterReturn;
allKnownProjects: ProjectNodeData[];
+ dialogueCount?: number;
hasRemoteDevices: boolean;
fold?: {
label: string;
@@ -45,11 +48,17 @@ export function MainListScopeHeader({
disabled: boolean;
} | null;
}): ReactNode {
+ const { t } = useTranslation();
const [displaySettingsOpen, setDisplaySettingsOpen] = useState(false);
return (
<div className="group/sidebar-header flex h-6 items-center justify-between pr-0 pl-6">
<div className="flex min-w-0 items-center gap-1">
<MachineSwitcherMenu onOpenDisplaySettings={() => setDisplaySettingsOpen(true)} />
+ {filter.isSessionContentFiltered ? (
+ <span className="shrink-0 select-none text-xs font-medium leading-none text-[var(--sidebar-list-muted)]">
+ {t('ccAgent.sidebar.filterActiveBadge')}
+ </span>
+ ) : null}
</div>
<div className="flex items-center gap-0.5 -mt-px">
<div className={HEADER_ACTIONS_CLASS}>
@@ -74,6 +83,7 @@ export function MainListScopeHeader({
<SidebarFilterPopover
filter={filter}
allKnownProjects={allKnownProjects}
+ dialogueCount={dialogueCount}
hasRemoteDevices={hasRemoteDevices}
open={displaySettingsOpen}
onOpenChange={setDisplaySettingsOpen}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
index 45f5acb4fa..1677f12bfd 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
@@ -65,6 +65,7 @@ import type {
FilterVendor,
UseSidebarFilterReturn,
} from '../hooks/useSidebarFilter';
+import { DIALOGUE_FILTER_KEY } from '../hooks/helpers/sidebarFilterCore';
import { useTaskInfoFields, type TaskInfoField } from '../hooks/useTaskInfoFields';
import {
MENU_CONTENT_CLASS,
@@ -153,6 +154,8 @@ export interface SidebarFilterPopoverProps {
filter: UseSidebarFilterReturn;
/** 用于 Project 多选列表的完整候选集(不受 Last activity 收窄影响)。 */
allKnownProjects: ProjectNodeData[];
+ /** 当前范围内无项目任务数,用来在项目筛选里画「对话」选项。 */
+ dialogueCount?: number;
/**
* 是否有远程设备连接(E 期)。「按设备分组」与顶部设备切换栏同一出现条件:
* 仅远程连接时显示;仅本机时该选项整行隐藏。
@@ -313,6 +316,7 @@ function CheckMenuItem({
export function SidebarFilterPopover({
filter,
allKnownProjects,
+ dialogueCount = 0,
hasRemoteDevices = false,
contextMenuPos,
onContextMenuOpenChange,
@@ -550,10 +554,25 @@ export function SidebarFilterPopover({
<Check size={15} className="ml-auto shrink-0 text-[var(--msg-assistant-text)]" />
)}
</DropdownMenuItem>
- {allKnownProjects.length > 0 && (
- <DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
- )}
+ <DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<div className="max-h-[256px] overflow-y-auto">
+ <DropdownMenuItem
+ onSelect={(event) => {
+ event.preventDefault();
+ toggleProject(DIALOGUE_FILTER_KEY);
+ }}
+ className={MENU_ITEM_CLASS}
+ >
+ <span className="min-w-0 flex-1">
+ <span className="block truncate">{t('ccAgent.sidebar.dialogues')}</span>
+ </span>
+ <span className="shrink-0 text-xs text-[var(--cmd-palette-item-meta)]">
+ {dialogueCount}
+ </span>
+ {(projects === 'all' || (projectsAsSet?.has(DIALOGUE_FILTER_KEY) ?? false)) && (
+ <Check size={15} className="shrink-0 text-[var(--msg-assistant-text)]" />
+ )}
+ </DropdownMenuItem>
{allKnownProjects.map((project) => {
const selected =
projects === 'all' || (projectsAsSet?.has(project.projectKey) ?? false);
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index fac64d4362..bc1eeaa8d3 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -120,6 +120,8 @@ export interface ProjectsSectionProps {
* 用于 SidebarFilterPopover 与来源标签;隐藏项目不能从这些入口泄漏。
*/
allKnownProjects: ProjectNodeData[];
+ /** 项目筛选前的无项目任务数,供菜单「对话」选项用。 */
+ dialogueCount?: number;
/**
* 原始项目全集的规范 key。手动排序以此为 baseline,保证隐藏项目的
* 位置记忆不会因用户拖动其它可见项目而被 GC。
@@ -189,6 +191,7 @@ export function ProjectsSection({
projects,
dialogues,
allKnownProjects,
+ dialogueCount = 0,
allProjectKeysForOrder,
filter,
collapsed,
@@ -676,6 +679,7 @@ export function ProjectsSection({
<MainListScopeHeader
filter={filter}
allKnownProjects={allKnownProjects}
+ dialogueCount={dialogueCount}
hasRemoteDevices={deviceGroupingAvailable}
fold={
hasMainListContent && foldState !== null
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 29bc3d6616..612f6e1f87 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -7036,6 +7036,7 @@
"filterSummaryNone": "None",
"filterSummaryActive": "{{count}} active",
"filterReset": "Reset filters",
+ "filterActiveBadge": "Filtered",
"displayHeading": "Display",
"taskInfoHeading": "Session info",
"taskInfoSummaryNone": "None",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index b24a53e712..2e189df7ca 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -7024,6 +7024,7 @@
"filterSummaryNone": "なし",
"filterSummaryActive": "{{count}} 件適用中",
"filterReset": "フィルターをリセット",
+ "filterActiveBadge": "絞り込み中",
"displayHeading": "表示",
"taskInfoHeading": "セッション情報",
"taskInfoSummaryNone": "なし",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index d9a67188b2..0ccff32d35 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -7024,6 +7024,7 @@
"filterSummaryNone": "없음",
"filterSummaryActive": "{{count}}개 적용 중",
"filterReset": "필터 초기화",
+ "filterActiveBadge": "필터링됨",
"displayHeading": "표시",
"taskInfoHeading": "세션 정보",
"taskInfoSummaryNone": "없음",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 048d2a55f2..1d3cdfca4c 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -7024,6 +7024,7 @@
"filterSummaryNone": "无",
"filterSummaryActive": "{{count}} 项生效",
"filterReset": "重置筛选",
+ "filterActiveBadge": "已筛选",
"displayHeading": "显示",
"taskInfoHeading": "任务信息",
"taskInfoSummaryNone": "无",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 354de9ea93..6930f6d132 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -7024,6 +7024,7 @@
"filterSummaryNone": "無",
"filterSummaryActive": "{{count}} 項生效",
"filterReset": "重設篩選",
+ "filterActiveBadge": "已篩選",
"displayHeading": "顯示",
"taskInfoHeading": "任務資訊",
"taskInfoSummaryNone": "無",