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。

feat(desktop): 「全部任务」段头与设备下拉合并为范围标题

Dash47c2d923b387
diff --git a/apps/desktop/help-knowledge/sidebar.md b/apps/desktop/help-knowledge/sidebar.md
index ccac96cbd2..a79408c219 100644
--- a/apps/desktop/help-knowledge/sidebar.md
+++ b/apps/desktop/help-knowledge/sidebar.md
@@ -4,12 +4,18 @@ title: Finding and organizing sessions
summary: Browse, group, filter, sort, search, and pin sessions or projects in the left sidebar.
---
-The left sidebar lists your sessions. It's the main way to navigate and organize. The **Organize sidebar** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the **All sessions** header, or right-click any blank area of the sidebar.
+The left sidebar lists your sessions. It's the main way to navigate and organize. The **Organize sidebar** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the main list header, or right-click any blank area of the sidebar.
+
+**Device scope (the list header itself):**
+
+- 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 a **Remote connection settings** entry.
+- The scope applies to the whole sidebar, including the Pinned section.
+- With no remote devices, the header is just a static **All sessions** title — no arrow, nothing to click. There is no separate device row in the top navigation.
**Grouping (independent checkboxes, freely combinable):**
- **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.
-- **Group by device** (default on) — only appears when a remote device is connected; 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, the option disappears and the effect is lifted.
+- **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.
- **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.
- Grouping **by date** has been removed.
diff --git a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts
index 87dcdf82b6..dd3af8853a 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 **Organize sidebar** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the **All sessions** header, or right-click any blank area of the sidebar.\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; 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, the option disappears and the effect is lifted.\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. Dragging a project in any other sort mode automatically switches to Manual.\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 Organize 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 **Organize sidebar** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the main list header, or right-click 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 a **Remote connection settings** entry.\n- The scope applies to the whole sidebar, including the Pinned section.\n- With no remote devices, the header is just a static **All sessions** title — no arrow, nothing to click. 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. Dragging a project in any other sort mode automatically switches to Manual.\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 Organize 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__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
index d7d94f3169..cf6a5e900f 100644
--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
@@ -1,16 +1,15 @@
/**
* machineSwitcherMenu.test.ts
* ---------------------------------------------------------------------------
- * 回归(2026-07):远程机器切换入口(MachineSwitcherMenu)并入 shell 的
- * SidebarTopNav(新建 / 自动任务 / Skill / 搜索)列表作末行,与其同款行样式,
- * 位于置顶段上方、滚动容器之外,不随会话列表滚动;不再挂在「项目」段头 /
- * 日期分组头 / 连接中占位页头(2026-07 用户定稿)。为避免回退:
- * - SidebarTopNav 渲染 MachineSwitcherMenu 作列表末行;
- * - CCAgentSidebarUpper 不再渲染任何机器切换入口(旧整行 MachineSwitcher /
- * 滚动区内的菜单都已移除),三种视图(项目 / 日期 / 连接中占位)都靠顶部
- * 常驻行切回「所有」,不会被困住;
- * - ProjectsSection / DateGroupedSessionsSection 段头不再渲染该菜单;
- * - 组件保留可见性门控 + 设备选择 + 远程连接设置入口。
+ * 2026-08-13 用户定稿(新设计,显式推翻 2026-07 的两条旧定稿):机器范围切换
+ * 与「全部任务」段头**合并**——MachineSwitcherMenu 即主列表段头标题,文字反映
+ * 当前范围(全部任务 / 本机任务 / 设备名 / N 台机器),点击展开范围菜单;
+ * SidebarTopNav 不再有独立的远程机器行。为避免回退:
+ * - ProjectsSection 段头渲染 MachineSwitcherMenu 作标题;SidebarTopNav 不再
+ * import / 渲染它;
+ * - 无远程设备时退化为纯静态标题(段头恒在);
+ * - 点击展开(不再 hover 自动展开);段级收起同时取消;
+ * - 组件保留设备选择(单选 + 多选)+ 远程连接设置入口。
*
* 静态扫描风格(renderer 测试环境无 jsdom),与 sidebarUpperSingleButton.test.ts 一致。
*/
@@ -47,13 +46,11 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(sidebarUpperSource).not.toMatch(/[^t]setSelectedMachineId\(MACHINE_ALL\)/);
});
- it('SidebarTopNav 渲染 MachineSwitcherMenu 作列表末行(与新建 / 搜索同列表)', () => {
- expect(topNavSource).toContain("from '@/features/cc-agent/sidebar/MachineSwitcherMenu'");
- // 末行:出现在 SidebarInlineSearch 之后。
- const searchIdx = topNavSource.indexOf('<SidebarInlineSearch');
- const menuIdx = topNavSource.indexOf('<MachineSwitcherMenu />');
- expect(searchIdx).toBeGreaterThanOrEqual(0);
- expect(menuIdx).toBeGreaterThan(searchIdx);
+ it('SidebarTopNav 不再渲染 MachineSwitcherMenu(2026-08-13 并入段头标题)', () => {
+ expect(topNavSource).not.toContain("from '@/features/cc-agent/sidebar/MachineSwitcherMenu'");
+ expect(topNavSource).not.toContain('<MachineSwitcherMenu />');
+ // 搜索行仍在(顶部导航收敛为 新建 / 自动任务 / 插件 / 搜索 四行)。
+ expect(topNavSource).toContain('<SidebarInlineSearch');
});
// 2026-08-12 用户裁决(对齐 Codex):任务列表向上滚动时,除「新建」外的顶部导航行
@@ -196,7 +193,9 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(source).toMatch(
/if \(isEditing(?:Name)?\) \{\s*\n(?:\s*\/\/[^\n]*\n)*\s*e\.stopPropagation\(\);\s*\n\s*return;/,
);
- expect(source).not.toMatch(/onContextMenu=\{\(e\) => \{\s*\n\s*if \(isEditing(?:Name)?\) return;/);
+ expect(source).not.toMatch(
+ /onContextMenu=\{\(e\) => \{\s*\n\s*if \(isEditing(?:Name)?\) return;/,
+ );
}
});
@@ -304,14 +303,26 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(branch).not.toContain('<MachineSwitcherMenu');
});
- it('项目段头不再渲染 MachineSwitcherMenu(已移到顶部固定行)', () => {
- expect(projectsSectionSource).not.toContain('MachineSwitcherMenu');
+ it('项目段头标题即 MachineSwitcherMenu(2026-08-13 定稿,推翻 2026-07「不挂段头」)', () => {
+ expect(projectsSectionSource).toContain("from '../MachineSwitcherMenu'");
+ expect(projectsSectionSource).toContain('<MachineSwitcherMenu />');
+ // 段头不再渲染硬编码的「全部任务」标题(标题文字由菜单 trigger 按范围决定)。
+ expect(projectsSectionSource).not.toContain("t('ccAgent.sidebar.allSessions')");
+ // 段级收起随合并取消:标题的点击语义让给范围切换。
+ expect(projectsSectionSource).not.toContain('isSectionCollapsed');
});
- it('项目视图:早退条件不再依赖机器切换 hook 保留空段头(入口不在本段头)', () => {
- // E 期的 hasRemoteDevices 是 prop 注入的设备分组开关可见性,与当年段头里
- // 直接消费 useMachineSwitcher 的旧结构无关——断言收窄到 hook 本身。
- expect(projectsSectionSource).not.toContain('useMachineSwitcher');
+ it('项目视图:范围判定走 effective 选择 hook,不再有旧 hasRemoteMachines 结构', () => {
+ // 单机范围下设备分组退场(2026-08-13 用户定稿)——生效与选项可见共用
+ // deviceGroupingAvailable,由 effective 机器选择派生。
+ expect(projectsSectionSource).toContain('useEffectiveSelectedMachineId');
+ expect(projectsSectionSource).toContain(
+ 'const singleMachineScope = selectedMachineId !== MACHINE_ALL && selectedMachineId.length === 1',
+ );
+ expect(projectsSectionSource).toContain(
+ 'const deviceGroupingAvailable = hasRemoteDevices && !singleMachineScope',
+ );
+ expect(projectsSectionSource).toContain('hasRemoteDevices={deviceGroupingAvailable}');
expect(projectsSectionSource).not.toContain('hasRemoteMachines');
});
@@ -330,18 +341,17 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(menuSource).not.toContain('group-hover/sidebar-header');
});
- it('trigger 是 SidebarTopNav 同款文字行(图标 + 范围文字 + 下拉箭头),不是图标按钮', () => {
- // trigger 文案 = 当前范围摘要:所有机器 / 本机 / 设备名 / N 台机器;旁边挂 ChevronDown。
+ it('trigger 是段头标题形态(范围文字 + 小箭头),不再是导航 pill 行(2026-08-13 定稿)', () => {
+ // 标题文字 = 当前范围:全部任务 / 本机任务 / 设备名 / N 台机器。
expect(menuSource).toContain('triggerText');
- // 「所有」态直接复用菜单项同款 allMachines 文案(2026-07 用户定稿,不用「所有机器」)。
- expect(menuSource).toContain("t('ccAgent.sidebar.machineSwitcher.allMachines')");
+ expect(menuSource).toContain("t('ccAgent.sidebar.allSessions')");
+ expect(menuSource).toContain("t('ccAgent.sidebar.scopeLocalSessions')");
expect(menuSource).toMatch(/<span className="truncate[^"]*">\{triggerText\}<\/span>/);
- expect(menuSource).toContain('<ChevronDown');
- // 与 SidebarTopNav ROW_CLASS 同款 pill 行样式;范围文字已表达过滤状态,
- // trigger 不叠常驻高亮底色(常亮易被误读为导航选中态,2026-07 用户定稿)。
- expect(menuSource).toContain('h-8 w-full');
- expect(menuSource).toContain('rounded-full');
- expect(menuSource).toContain('hover:bg-sidebar-item-hover');
+ expect(menuSource).toContain('<ChevronDown size={13}');
+ // 段头标题样式(与原「全部任务」一致:淡灰 + hover 加深),不再是 pill 导航行。
+ expect(menuSource).toContain('SCOPE_TITLE_CLASS');
+ expect(menuSource).not.toContain('h-8 w-full');
+ expect(menuSource).not.toContain('hover:bg-sidebar-item-hover');
expect(menuSource).not.toContain('filterActive');
expect(menuSource).not.toContain('--chat-input-chip-bg');
});
@@ -425,22 +435,21 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
}
});
- it('在机器栏固定显示远程任务读取 loading,不改变文字与下拉箭头间距', () => {
- // 文字与箭头保持原有相邻布局;后台 bootstrap 只占最右侧固定状态槽,
- // 避免列表上下跳动,也避免空槽把下拉箭头推远。
+ it('段头标题固定承载远程任务读取 loading(spinner 附在箭头后,不进会话列表)', () => {
expect(menuSource).toContain('useRemoteSessionBootstrapLoading(selectedDeviceId)');
expect(menuSource).toContain('aria-busy={remoteSessionBootstrapLoading}');
expect(menuSource).toMatch(
- /<span className="truncate leading-none">\{triggerText\}<\/span>\s*<ChevronDown[\s\S]*?<span\s*aria-hidden="true"\s*className="ml-auto flex h-4 w-4 shrink-0 items-center justify-center"\s*>/,
+ /<span className="truncate leading-none">\{triggerText\}<\/span>\s*<ChevronDown[\s\S]*?animate-spinner motion-reduce:animate-none/,
);
- expect(menuSource).toContain(
- '<span className="inline-flex animate-spinner motion-reduce:animate-none">',
- );
- expect(menuSource).toContain('<Loader2 size={14} strokeWidth={1.8} />');
+ expect(menuSource).toContain('<Loader2 size={12} strokeWidth={1.8} />');
});
- it('MachineSwitcherMenu 保留门控 / 设备选择 / 远程设置入口', () => {
- expect(menuSource).toContain('if (!hasRemote) return null');
+ it('MachineSwitcherMenu 保留设备选择 / 远程设置入口;无远程时退化为静态标题', () => {
+ // 段头恒在:无远程设备时渲染纯静态「全部任务」标题,而不是消失(旧 return null)。
+ expect(menuSource).not.toContain('if (!hasRemote) return null');
+ expect(menuSource).toMatch(
+ /if \(!hasRemote\) \{\s*\n\s*return <span className=\{SCOPE_TITLE_CLASS\}>\{t\('ccAgent\.sidebar\.allSessions'\)\}<\/span>;/,
+ );
expect(menuSource).toContain('MACHINE_ALL');
expect(menuSource).toContain('MACHINE_LOCAL');
expect(menuSource).toContain("navigate('/settings?tab=remote-control')");
@@ -468,17 +477,14 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(menuSource).toContain('applyToggle(device.deviceId)');
});
- it('MachineSwitcherMenu hover 自动展开(2026-07-12 产品定稿,推翻早前 Codex P2 点击展开)', () => {
- // 鼠标移到本行短延迟即弹机器菜单、移开即收;受控开合走 useHoverOpenMenu,
- // trigger / content 必须完整接线(triggerRef 供「点击触发按钮不误关」判定)。
- expect(menuSource).toContain('useHoverOpenMenu');
- expect(menuSource).toContain('open={open} onOpenChange={onOpenChange}');
- expect(menuSource).toContain('ref={triggerRef as Ref<HTMLButtonElement>}');
- expect(menuSource).toContain('{...triggerProps}');
- expect(menuSource).toContain('{...contentProps}');
- // hover 展开必须非模态,否则 body pointer-events:none 造成开/关闪烁循环。
+ it('MachineSwitcherMenu 点击展开(2026-08-13 定稿,推翻 2026-07-12 hover 展开)', () => {
+ // 作为段头标题,hover 扫过就弹菜单太吵;hover 机制连同 useHoverOpenMenu
+ // hook 一起下线(该 hook 已无消费方,文件已删)。
+ expect(menuSource).not.toContain('useHoverOpenMenu');
+ expect(menuSource).not.toContain('triggerProps');
+ // 非模态:侧栏是常驻面板,不锁列表滚动。
expect(menuSource).toContain('modal={false}');
- // 菜单在行下方展开、左边贴齐本行左边(2026-07-13 用户定稿,替换 07-12 的右侧飞出)。
+ // 菜单在标题下方展开、左边贴齐标题左边。
expect(menuSource).toContain('side="bottom"');
expect(menuSource).toContain('align="start"');
});
diff --git a/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts
index 472627be79..3b1e1b8710 100644
--- a/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts
@@ -1,10 +1,10 @@
/**
- * projectsSidebarSection — 主列表(全部任务)段头控件不变量。
+ * projectsSidebarSection — 主列表段头控件不变量。
*
- * 侧边栏重设计 D/E 期后本段是混排主列表:段头仍有两类折叠控件——
- * - 标题侧单箭头:收起/展开整段列表;
- * - 右侧折叠按钮(E 期):单层 = 收起所有分组 ↔ 展开;设备+项目双层 =
- * 循环 收项目层 → 收设备层 → 全部展开(foldState 状态机)。
+ * 2026-08-13 用户定稿:段头标题即机器范围下拉(MachineSwitcherMenu,「全部任务」
+ * 与设备下拉合并),段级收起取消;右侧保留折叠按钮(单层 = 收起所有分组 ↔ 展开;
+ * 设备+项目双层 = 循环 收项目层 → 收设备层 → 全部展开,foldState 状态机)与
+ * 整理菜单入口。
*/
import { readFileSync } from 'node:fs';
@@ -18,17 +18,12 @@ const projectsSectionSource = readFileSync(
);
describe('Projects sidebar section', () => {
- it('keeps separate icons and handlers for section collapse vs group fold', () => {
+ it('keeps the group fold state machine (section collapse itself is gone)', () => {
+ // 设备段头仍用单箭头折叠;右侧折叠按钮走三态状态机。
expect(projectsSectionSource).toContain('ChevronDown');
expect(projectsSectionSource).toContain('ChevronRight');
expect(projectsSectionSource).toContain('ChevronsDownUp');
expect(projectsSectionSource).toContain('ChevronsUpDown');
- expect(projectsSectionSource).toContain(
- 'const [isSectionCollapsed, setIsSectionCollapsed] = useState(false)',
- );
- expect(projectsSectionSource).toContain(
- 'const SectionToggleIcon = isSectionCollapsed ? ChevronRight : ChevronDown',
- );
// E 期折叠状态机:三态循环 + 图标随「下一步动作」切换。
expect(projectsSectionSource).toContain(
"'collapse-groups' | 'collapse-devices' | 'expand-all'",
@@ -36,38 +31,20 @@ describe('Projects sidebar section', () => {
expect(projectsSectionSource).toContain(
"const FoldIcon = foldState === 'expand-all' ? ChevronsUpDown : ChevronsDownUp",
);
+ // 段级收起已随「标题 = 范围下拉」取消(2026-08-13 用户定稿)。
+ expect(projectsSectionSource).not.toContain('isSectionCollapsed');
+ expect(projectsSectionSource).not.toContain('SectionToggleIcon');
});
- it('makes the title and adjacent hover arrow collapse the section and keeps fold before filter', () => {
- const titleIndex = projectsSectionSource.indexOf("t('ccAgent.sidebar.allSessions')");
- const titleButtonIndex = projectsSectionSource.lastIndexOf('<button', titleIndex);
- const titleExpandedIndex = projectsSectionSource.indexOf(
- 'aria-expanded={!isSectionCollapsed}',
- titleButtonIndex,
- );
- const hoverToggleIndex = projectsSectionSource.indexOf('<Tip text={sectionToggleLabel}');
- const hoverToggleExpandedIndex = projectsSectionSource.indexOf(
- 'aria-expanded={!isSectionCollapsed}',
- hoverToggleIndex,
- );
- const sectionToggleIndex = projectsSectionSource.indexOf('aria-expanded={!isSectionCollapsed}');
+ it('header order: scope title dropdown → fold → filter', () => {
+ const titleIndex = projectsSectionSource.indexOf('<MachineSwitcherMenu />');
const foldIndex = projectsSectionSource.indexOf('onClick={handleFoldAll}');
const filterIndex = projectsSectionSource.indexOf('<SidebarFilterPopover');
-
expect(titleIndex).toBeGreaterThanOrEqual(0);
- expect(titleButtonIndex).toBeGreaterThanOrEqual(0);
- expect(titleExpandedIndex).toBeLessThan(titleIndex);
- expect(sectionToggleIndex).toBe(titleExpandedIndex);
- expect(hoverToggleIndex).toBeGreaterThan(titleIndex);
- expect(hoverToggleExpandedIndex).toBeGreaterThan(hoverToggleIndex);
- expect(foldIndex).toBeGreaterThan(hoverToggleExpandedIndex);
+ expect(foldIndex).toBeGreaterThan(titleIndex);
expect(filterIndex).toBeGreaterThan(foldIndex);
- });
-
- it('hides the group fold control when the section is collapsed', () => {
- expect(projectsSectionSource).toMatch(
- /\{!isSectionCollapsed && foldState !== null && \(\s*<Tip text=\{foldLabel\}/,
- );
+ // 折叠按钮恒显(不再有段收起时隐藏的分支)。
+ expect(projectsSectionSource).toMatch(/\{foldState !== null && \(\s*<Tip text=\{foldLabel\}/);
});
// 2026-08-12 用户裁决:段头「新建项目」按钮暂时移除(同一动作在新任务页的工作
@@ -93,12 +70,12 @@ describe('Projects sidebar section', () => {
expect(projectsSectionSource).not.toContain(
'group-focus-within/sidebar-header:pointer-events-auto',
);
- expect(projectsSectionSource).toContain('className={HEADER_HOVER_ACTION_CLASS}');
expect(projectsSectionSource).toContain('className={HEADER_ACTIONS_CLASS}');
});
- it('hides the project tree only through the section collapsed state', () => {
- expect(projectsSectionSource).toContain('{!isSectionCollapsed && foldState !== null && (');
+ it('the project tree renders unconditionally (section collapse removed)', () => {
+ // 树不再包 SectionCollapse(设备段 / 对话组内部的仍在);项目行折叠照旧受控。
+ expect(projectsSectionSource).not.toMatch(/<SectionCollapse collapsed=\{isSectionCollapsed\}>/);
expect(projectsSectionSource).toContain('isCollapsed={collapsed.has(project.projectKey)}');
});
@@ -147,7 +124,7 @@ describe('Projects sidebar section', () => {
// collapse-devices 却没有可见效果(派生态以为在设备分组、渲染实际是单段)。
it('deviceGroupingActive excludes manual sort so derived state matches the rendered mode', () => {
expect(projectsSectionSource).toContain(
- "hasRemoteDevices && filter.groupDevice && filter.sortBy !== 'manual'",
+ "deviceGroupingAvailable && filter.groupDevice && filter.sortBy !== 'manual'",
);
});
});
diff --git a/apps/desktop/src/renderer/__tests__/sidebarCollapseResetSource.test.ts b/apps/desktop/src/renderer/__tests__/sidebarCollapseResetSource.test.ts
index ec7fa332fb..42d108f70b 100644
--- a/apps/desktop/src/renderer/__tests__/sidebarCollapseResetSource.test.ts
+++ b/apps/desktop/src/renderer/__tests__/sidebarCollapseResetSource.test.ts
@@ -4,7 +4,10 @@ import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
function readSidebarSource(...parts: string[]) {
- return readFileSync(resolve(__dirname, '..', 'features', 'cc-agent', 'sidebar', ...parts), 'utf8');
+ return readFileSync(
+ resolve(__dirname, '..', 'features', 'cc-agent', 'sidebar', ...parts),
+ 'utf8',
+ );
}
const sessionEntryListSource = readSidebarSource('SessionEntryList.tsx');
@@ -22,15 +25,18 @@ describe('sidebar collapse reset wiring', () => {
it('resets project session showAll on project collapse and on Projects section collapse', () => {
expect(projectNodeSource).toContain('parentSectionCollapsed: boolean');
expect(projectNodeSource).toContain('sectionCollapsed={isCollapsed || parentSectionCollapsed}');
- expect(projectsSectionSource).toContain('parentSectionCollapsed={isSectionCollapsed}');
+ // 2026-08-13 定稿:主列表段级收起随「标题 = 范围下拉」取消,parent 恒为 false
+ //(prop 保留:置顶段等其它宿主仍在用)。
+ expect(projectsSectionSource).toContain('parentSectionCollapsed={false}');
});
it('passes the Dialogue section collapsed state into its collapsible session list', () => {
expect(dialogueSectionSource).toContain('sectionCollapsed={collapsed}');
});
- it('resets the Projects section project-list showAll from the section collapsed state', () => {
- expect(projectsSectionSource).toContain('useCollapsibleShowAll(isSectionCollapsed)');
+ it('Projects section project-list showAll no longer tracks a section collapse (removed)', () => {
+ // 段级收起已取消(2026-08-13 定稿),showAll 不再有段收起复位来源。
+ expect(projectsSectionSource).toContain('useCollapsibleShowAll(false)');
});
it('keeps the reset delay constant in sync with the CSS animation duration', () => {
diff --git a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx
index cc3f15ee50..6c386014a1 100644
--- a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx
@@ -1,14 +1,14 @@
/**
* SidebarTopNav —— 侧栏顶部常驻动作/导航列表(取代原 HorizontalTabbar)。
* ---------------------------------------------------------------------------
- * 一条同级、等权的列表行,按顺序:新建 / 自动任务 / Plugins / 搜索 / 远程机器。
+ * 一条同级、等权的列表行,按顺序:新建 / 自动任务 / Plugins / 搜索。
* - 新建 / 自动任务:项目(cc-agent)视图的动作 —— 在任意视图点击都跳回项目视图并执行。
* - Plugins:主视图切换(navigateToView),命中当前视图时高亮。
* - 搜索(SidebarInlineSearch):静息态与其余行同款「🔍 搜索」;hover / 聚焦
* 就地展开成搜索框,结果 overlay 由下方功能槽(CCAgentSidebarUpper)绘制。搜索状态经
* ConversationSearchProvider 的 context 共享(行在此、overlay 在功能槽,两者是兄弟子树)。
- * - 远程机器(MachineSwitcherMenu):末行,同款行样式的文字下拉,过滤下方会话列表
- * 的机器范围;无任何相关远程机器时组件自身 return null,不占行。
+ * - 远程机器切换 2026-08-13 起不再占行:并入主列表段头标题(「全部任务」即
+ * 范围下拉,见 MachineSwitcherMenu 头注),省一行且标题不再与范围脱节。
* 去掉了原来的「项目(Bot)」标签 —— 项目即默认主视图,无单独入口。
* rail 态的搜索仍是 CollapsedView 里独立的 ConversationSearchBox 图标弹窗(不走本行 / context)。
*
@@ -27,7 +27,6 @@ import { cn } from '@/lib/utils';
import { AttentionDot } from '@/components/sidebar/AttentionDot';
import { useAnyGhostUnread } from '@/cindy-brain/ghostUnreadStore';
import { useActiveMainView } from '@/hooks/useActiveMainView';
-import { MachineSwitcherMenu } from '@/features/cc-agent/sidebar/MachineSwitcherMenu';
import { SidebarInlineSearch } from '@/features/cc-agent/sidebar/SidebarInlineSearch';
import { useConversationSearchContext } from '@/features/cc-agent/sidebar/conversationSearchContext';
@@ -161,10 +160,6 @@ export function SidebarTopNav({
openSignal={openSignal}
onSearchActive={ensureConversationView}
/>
-
- {/* 5. 远程机器 —— 同款行样式的文字下拉(过滤下方会话列表的机器范围);
- 无相关远程机器时组件自身 return null,不占行。 */}
- <MachineSwitcherMenu />
</>
)}
</div>
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
index 7ae0ceb942..98ede89ca0 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@@ -3252,7 +3252,12 @@ function ExpandedView({
<SidebarFilterPopover
filter={filter}
allKnownProjects={visibleProjectUniverse}
- hasRemoteDevices={(remoteDeviceIndex?.size ?? 0) > 0}
+ // 与段头实例同一门控:范围收窄到单台机器时「按设备分组」选项隐藏
+ // (2026-08-13 用户定稿,详见 ProjectsSection.deviceGroupingAvailable)。
+ hasRemoteDevices={
+ (remoteDeviceIndex?.size ?? 0) > 0 &&
+ !(selectedMachineId !== MACHINE_ALL && selectedMachineId.length === 1)
+ }
contextMenuPos={organizeMenuPos}
onContextMenuOpenChange={(open) => {
if (!open) setOrganizeMenuPos(null);
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
index acf69f20a8..7013597752 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
@@ -1,14 +1,19 @@
/**
- * MachineSwitcherMenu — 侧边栏「远程机器切换」下拉入口(device-link 跨设备远程控制)。
+ * MachineSwitcherMenu — 主列表段头标题即「机器范围」下拉(device-link 跨设备远程控制)。
* ---------------------------------------------------------------------------
- * 把「所有 / 本机 / 各远程设备」切换 + 「远程连接设置」入口收进一个下拉,作为 shell
- * SidebarTopNav(新建 / 自动任务 / Skill / 搜索)列表的末行常驻,位于置顶段上方、
- * 滚动容器之外,不随会话列表滚动;不再挂在「项目」段头 / 日期分组头(2026-07 用户定稿)。
- * 下拉 **hover 自动展开**(移上即开、移开即收,点击也可开且不误关,见 useHoverOpenMenu;
- * 2026-07-12 产品定稿恢复,推翻 d5a8d77c9 按 Codex P2 改的「点击展开」)。
+ * 2026-08-13 用户定稿(新设计,显式推翻两条 2026-07 旧定稿):
+ * - 「全部任务」段头与设备下拉**合并**——标题文字反映当前范围(全部任务 /
+ * 本机任务 / 设备名 / N 台机器),点击标题弹出「所有 / 本机 / 各远程设备」
+ * 切换 + 「远程连接设置」入口。顶部导航不再有独立的远程机器行,省一行;
+ * 标题不再撒谎(旧结构下范围收窄后段头仍写「全部任务」)。
+ * (推翻 2026-07 「切换器收进 SidebarTopNav 末行、不挂段头」——当年是段头
+ * 挂配件,现在段头本身就是切换器,语境已不同。)
+ * - **点击展开**,不再 hover 自动展开(推翻 2026-07-12 hover 定稿):作为段头
+ * 标题,hover 扫过就弹菜单太吵;段级收起同时取消,标题的点击语义让给范围切换。
*
- * 本机有 ≥1 台相关远程机器(已连接 / 连接中 / 被拒)时显示;若断网导致设备目录
- * 与远端分片都清空,但 raw 选择仍指向远端,也必须保留入口让用户切回本机。
+ * 无任何相关远程机器时**退化为纯静态标题**「全部任务」(无箭头、不可点)——
+ * 段头恒在,这正是它必须与「全部任务」合并而不是反向合并的原因;若断网导致设备
+ * 目录与远端分片都清空,但 raw 选择仍指向远端,保留下拉让用户切回本机。
*
* 机器选择:**默认单选、多选框另走多选**(2026-07 用户定稿):
* - 「所有」→ 重置回默认(本机 + 全部远程),菜单关闭;
@@ -30,16 +35,15 @@
* - 被拒(对方已撤销本机远程控制) → icon 叠「禁止」标识,点击弹提示(toast),不可选中。
* 勾选后 → 侧边栏会话整体过滤到勾选机器集(逻辑在 CCAgentSidebarUpper 合并点)。
*
- * 形态:文字下拉行,与 SidebarTopNav(新建 / 自动任务 / Skill / 搜索)同款 pill 行
- * 风格(h-8 全宽、图标 15/1.8 meta 灰、文字 foreground、hover 灰底)——trigger 显示
- * 当前范围文字(所有 / 本机 / 设备名 / N 台机器)+ 下拉箭头。范围文字本身已表达
- * 过滤状态,trigger 不再叠常驻高亮底色(常亮易被误读为导航选中态,2026-07 用户定稿)。
- * 无任何相关远程机器且没有悬空远端选择时 return null,列表里不占行。
+ * 形态:段头标题样式(text-sm font-medium、sidebar-list-muted 淡灰,hover 加深,
+ * 与原「全部任务」标题一致)+ 小下拉箭头;远程任务 bootstrap 读取中在标题右侧
+ * 转 spinner(本行仍是远程读取状态的固定承载点,不往会话列表里插 loading 行)。
+ * 范围文字本身已表达过滤状态,trigger 不叠常驻高亮底色(2026-07 用户定稿沿用)。
*
* 颜色全走主题 token(规则 16),文案全走 i18n(规则 18)。
*/
-import { useRef, type ReactNode, type Ref } from 'react';
+import { useRef, type ReactNode } from 'react';
import {
Ban,
Check,
@@ -72,18 +76,18 @@ import {
useRemoteSessionBootstrapLoading,
} from '@/features/device-link/useMachineSwitcher';
import { MENU_CONTENT_CLASS, MENU_ITEM_CLASS, MENU_SEPARATOR_CLASS } from './menuStyles';
-import { useHoverOpenMenu } from './useHoverOpenMenu';
+
+/** 段头标题共用样式:与原「全部任务」标题一致(淡灰、hover 加深)。 */
+const SCOPE_TITLE_CLASS =
+ 'text-sm font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]';
export function MachineSwitcherMenu(): ReactNode {
const { t } = useTranslation();
const navigate = useNavigate();
const { devices, selectedDeviceId, hasRemote, select, toggle } = useMachineSwitcher();
- // 机器栏是远程任务读取状态的固定承载点。后台 bootstrap 时只更新这一行,
+ // 段头标题是远程任务读取状态的固定承载点。后台 bootstrap 时只更新这一行,
// 不再把 loading 提示插入下方会话列表,避免列表整体上下跳动。
const remoteSessionBootstrapLoading = useRemoteSessionBootstrapLoading(selectedDeviceId);
- // 「鼠标移上去就展开」:hover 触发行即开、移开即关(受控开合,详见 useHoverOpenMenu;
- // 2026-07-12 产品确认要 hover 展开,恢复 d5a8d77c9 之前的交互)。
- const { open, onOpenChange, triggerRef, triggerProps, contentProps } = useHoverOpenMenu();
// 本行随 SidebarTopNav 在所有非 rail 视图常驻,但机器过滤只作用于会话列表侧栏——
// 选机器后必须让过滤结果可见(Codex P2):
// - /settings 等非 view 路由 → navigateToView('cc-agent') 切回会话视图
@@ -111,19 +115,22 @@ export function MachineSwitcherMenu(): ReactNode {
ensureConversationListVisible();
};
- // 无任何相关远程机器、也没有需要逃生的悬空远端选择 → 不渲染入口。
- if (!hasRemote) return null;
+ // 无任何相关远程机器、也没有需要逃生的悬空远端选择 → 纯静态标题
+ // (段头恒在;与「按设备分组」选项同一出现条件,本机用户看不到任何设备概念)。
+ if (!hasRemote) {
+ return <span className={SCOPE_TITLE_CLASS}>{t('ccAgent.sidebar.allSessions')}</span>;
+ }
const triggerLabel = t('ccAgent.sidebar.machineSwitcher.menuTrigger');
- // trigger 文案 = 当前范围摘要(手机版首页表头同款「文字 + 下拉箭头」口径):
- // 「所有」→ 与菜单项同文案「所有」;单选 → 机器名(本机 / 设备名);多选 → 「N 台机器」计数。
- let triggerText = t('ccAgent.sidebar.machineSwitcher.allMachines');
+ // 标题文字 = 当前范围(2026-08-13 定稿:标题回答"我正在看什么"):
+ // 「所有」→「全部任务」;本机 →「本机任务」;单设备 → 设备名;多选 → 「N 台机器」。
+ let triggerText = t('ccAgent.sidebar.allSessions');
if (selectedDeviceId !== MACHINE_ALL) {
if (selectedDeviceId.length === 1) {
const only = selectedDeviceId[0];
triggerText =
only === MACHINE_LOCAL
- ? t('ccAgent.sidebar.machineSwitcher.localMachine')
+ ? t('ccAgent.sidebar.scopeLocalSessions')
: (devices.find((device) => device.deviceId === only)?.name ?? triggerLabel);
} else {
triggerText = t('ccAgent.sidebar.machineSwitcher.selectedCount', {
@@ -132,62 +139,40 @@ export function MachineSwitcherMenu(): ReactNode {
}
}
- // hover 自动展开(2026-07-12 产品定稿,推翻早前 Codex P2 的「点击展开」):鼠标移到
- // 本行短延迟即弹机器菜单、移开即收,点击仍可打开且不误关(useHoverOpenMenu)。
- // modal={false} 双重必要:hover 展开时模态的 body pointer-events:none 会让 trigger
- // 不可命中,形成 mouseleave/enter 开关闪烁循环;同时保证展开时复选框的 pointer
- // 事件拦截不被干扰,也允许点击外部 / Esc 关闭。
+ // 点击展开(2026-08-13 定稿,推翻 2026-07-12 的 hover 展开——作为段头标题,
+ // hover 扫过就弹菜单太吵)。modal={false}:侧栏是常驻面板,不锁列表滚动。
return (
- <DropdownMenu open={open} onOpenChange={onOpenChange} modal={false}>
+ <DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<button
type="button"
- ref={triggerRef as Ref<HTMLButtonElement>}
- {...triggerProps}
aria-label={`${triggerLabel}: ${triggerText}`}
aria-busy={remoteSessionBootstrapLoading}
className={cn(
- // 与 SidebarTopNav 的 ROW_CLASS 同款 pill 行:h-8 全宽、图标 meta 灰、
- // 文字 foreground、hover 灰底;truncate 兜住过长设备名。
- 'flex h-8 w-full min-w-0 items-center gap-2.5 rounded-full px-3 text-sm font-normal text-[var(--sidebar-nav-text)]',
- 'transition-colors hover:bg-sidebar-item-hover focus:outline-none',
- // 菜单展开期间保持行高亮(data-state=open):否则鼠标移进下方菜单后本行
- // :hover 即失效、高亮消失,菜单像悬空没了锚点(2026-07-12 用户反馈)。
- // 这是瞬态展开高亮,与「过滤选中态不常驻高亮」的定稿不冲突。
- 'data-[state=open]:bg-sidebar-item-hover',
+ 'flex min-w-0 items-center gap-1 focus:outline-none',
+ SCOPE_TITLE_CLASS,
+ // 菜单展开期间标题保持加深(data-state=open):鼠标移进菜单后 :hover
+ // 失效,标题不能瞬间变淡、菜单像悬空没了锚点。
+ 'data-[state=open]:text-[var(--sidebar-nav-text)]',
)}
>
- <MonitorSmartphone
- size={15}
- strokeWidth={1.8}
- className="shrink-0 text-[var(--sidebar-nav-text)]"
- />
<span className="truncate leading-none">{triggerText}</span>
- <ChevronDown
- size={14}
- strokeWidth={1.8}
- className="shrink-0 text-[var(--sidebar-nav-text)]"
- />
- <span
- aria-hidden="true"
- className="ml-auto flex h-4 w-4 shrink-0 items-center justify-center"
- >
- {remoteSessionBootstrapLoading && (
- <span className="inline-flex animate-spinner motion-reduce:animate-none">
- <Loader2 size={14} strokeWidth={1.8} />
- </span>
- )}
- </span>
+ <ChevronDown size={13} strokeWidth={2} className="shrink-0" />
+ {remoteSessionBootstrapLoading && (
+ <span
+ aria-hidden="true"
+ className="inline-flex shrink-0 animate-spinner motion-reduce:animate-none"
+ >
+ <Loader2 size={12} strokeWidth={1.8} />
+ </span>
+ )}
</button>
</DropdownMenuTrigger>
<DropdownMenuContent
- // 行下方展开、左边贴齐本行左边(2026-07-13 用户定稿,替换 07-12 的「贴行
- // 右侧飞出」——右飞菜单悬在主内容区上方,离行太远);align="start" 让菜单
- // 左边与 hover 行左边对齐,空间不足时 Radix 自动翻到上方。
+ // 标题下方展开、左边贴齐标题左边;空间不足时 Radix 自动翻到上方。
side="bottom"
align="start"
sideOffset={4}
- {...contentProps}
className={cn(MENU_CONTENT_CLASS, 'min-w-48')}
>
<MachineMenuItem
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 dab58f791f..80a0ad0769 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
@@ -21,7 +21,7 @@
* ghost / chosen / drag class 提供视觉。
*/
-import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react';
+import { useCallback, useMemo, useState, type ReactNode } from 'react';
import {
ChevronDown,
ChevronRight,
@@ -35,6 +35,9 @@ import { useTranslation } from 'react-i18next';
import { cn } from '@/lib/utils';
import { Tip } from '@/components/ui/tooltip';
+import { MachineSwitcherMenu } from '../MachineSwitcherMenu';
+import { useEffectiveSelectedMachineId } from '@/features/device-link/useMachineSwitcher';
+import { MACHINE_ALL } from '@/features/device-link/selectedMachineStore';
import { SortableList } from '@/components/sidebar/SortableList';
import { useReducedMotion } from '@/hooks/useReducedMotion';
import { useSidebarMainViewMode } from '@/hooks/useSidebarCardMode';
@@ -243,17 +246,14 @@ export function ProjectsSection({
// 的反直觉体验。
const projectDragEnabled = filter.groupBy === 'project';
const projectKeysForOrderBaseline = allProjectKeysForOrder;
- const [isSectionCollapsed, setIsSectionCollapsed] = useState(false);
- const [showAllProjects, setShowAllProjects] = useCollapsibleShowAll(isSectionCollapsed);
+ // 段级收起已随「全部任务 = 范围下拉」取消(2026-08-13 用户定稿):标题的点击
+ // 语义让给机器范围切换;「想要紧凑」由右侧「收起所有分组」承接。
+ const [showAllProjects, setShowAllProjects] = useCollapsibleShowAll(false);
// 设备段各自的「显示全部」(2026-08-13 复核 P2:共用一个标志会让点任一段的
// 段内按钮把所有段一起展开——按钮看起来是段内操作,作用域也必须是段内)。
- // 段级收起时与全局 showAll 同款复位。
const [expandedDeviceSections, setExpandedDeviceSections] = useState<ReadonlySet<string>>(
new Set(),
);
- useEffect(() => {
- if (isSectionCollapsed) setExpandedDeviceSections(new Set());
- }, [isSectionCollapsed]);
const getProjectId = useCallback((p: ProjectNodeData) => p.projectKey, []);
@@ -280,10 +280,6 @@ export function ProjectsSection({
[filter, projectKeysForOrderBaseline],
);
- const SectionToggleIcon = isSectionCollapsed ? ChevronRight : ChevronDown;
- const sectionToggleLabel = isSectionCollapsed
- ? t('ccAgent.sidebar.projectsSectionToggleExpand')
- : t('ccAgent.sidebar.projectsSectionToggleCollapse');
// toggleDisabled 用 allKnownProjects(不是过滤后的 projects),避免 filter 收窄到 0 时
// 即便没真正可折叠的目标,也保留视觉一致——但禁用按钮以避免无意义点击。
const projectNodesToggleDisabled = allKnownProjects.length === 0;
@@ -419,8 +415,15 @@ export function ProjectsSection({
// 定稿,但此前生效判定没跟着排除——机器标签被藏、批量折叠键按逐设备派生、
// 折叠状态机进入 collapse-devices 却没有可见效果,全是"派生态以为在设备
// 分组、渲染实际是单段"的错位。生效判定必须与实际渲染模式同一份。
+ // 范围收窄到单台机器时同样退场(2026-08-13 用户定稿):只有一台无段可切,
+ // 唯一的段头还会和范围标题重复报同一个设备名;整理菜单的选项行同步隐藏
+ // (deviceGroupingAvailable),偏好照旧不改写、范围放宽自动恢复。
const hasRemoteDevices = (remoteDeviceIndex?.size ?? 0) > 0;
- const deviceGroupingActive = hasRemoteDevices && filter.groupDevice && filter.sortBy !== 'manual';
+ const selectedMachineId = useEffectiveSelectedMachineId();
+ const singleMachineScope = selectedMachineId !== MACHINE_ALL && selectedMachineId.length === 1;
+ const deviceGroupingAvailable = hasRemoteDevices && !singleMachineScope;
+ const deviceGroupingActive =
+ deviceGroupingAvailable && filter.groupDevice && filter.sortBy !== 'manual';
const deviceSections = useMemo<MainListDeviceSection[]>(() => {
if (!deviceGroupingActive) return [{ deviceId: null, entries: [...visibleMixedEntries] }];
// 设备分组:对**全量**条目先切段,折叠上限在渲染时每段独立应用(2026-08-13
@@ -551,7 +554,7 @@ export function ProjectsSection({
project={project}
statusFilter={filter.status}
isCollapsed={collapsed.has(project.projectKey)}
- parentSectionCollapsed={isSectionCollapsed}
+ parentSectionCollapsed={false}
activeSessionId={activeSessionId}
runningSessionIds={runningSessionIds}
attachedSessionIds={attachedSessionIds}
@@ -642,7 +645,7 @@ export function ProjectsSection({
createDisabledReason={
targetDeviceOffline ? t('ccAgent.remoteSession.actionsUnavailable') : undefined
}
- parentSectionCollapsed={isSectionCollapsed}
+ parentSectionCollapsed={false}
disableSessionCollapse={disableSessionCollapse}
activeSessionId={activeSessionId}
runningSessionIds={runningSessionIds}
@@ -670,37 +673,12 @@ export function ProjectsSection({
pr-0:与下方 cells 子容器一样依赖 scrollbar-gutter:stable 预留 12px,
按钮组右边自然对齐 cell 右边。 */}
<div className="group/sidebar-header flex h-6 items-center justify-between pr-0 pl-6">
- {/* 段标题:淡灰(text-tertiary,对齐 Codex 的低对比栏目标题;2026-07 用户定稿,
- 取代原 msg-assistant-text 深色),点击标题即可收起/展开整段(与右侧 hover
- 箭头同一行为,标题是更大的点击目标)。 */}
+ {/* 段标题 = 机器范围下拉(2026-08-13 用户定稿,「全部任务」与设备下拉合并):
+ 标题文字反映当前范围(全部任务 / 本机任务 / 设备名 / N 台机器),点击弹
+ 范围菜单;无远程设备时退化为纯静态标题。段级收起随之取消——标题的点击
+ 语义让给范围切换,「想要紧凑」由右侧「收起所有分组」承接。 */}
<div className="flex min-w-0 items-center gap-1">
- <button
- type="button"
- onClick={() => setIsSectionCollapsed((value) => !value)}
- aria-expanded={!isSectionCollapsed}
- className="text-sm font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]"
- >
- {/* D 期改名:本段已是项目+对话的混排主列表,段头叫「全部任务」。 */}
- {t('ccAgent.sidebar.allSessions')}
- </button>
- <div className={HEADER_HOVER_ACTION_CLASS}>
- <Tip text={sectionToggleLabel} side="bottom">
- <button
- type="button"
- onClick={() => setIsSectionCollapsed((value) => !value)}
- aria-label={sectionToggleLabel}
- aria-expanded={!isSectionCollapsed}
- className={cn(
- 'flex h-5 w-5 shrink-0 items-center justify-center rounded-md',
- // 无灰底 hover(2026-07 用户定稿):纯色加深反馈,与段标题一致。
- 'text-[var(--sidebar-list-muted)]',
- 'transition-colors hover:text-[var(--sidebar-nav-text)]',
- )}
- >
- <SectionToggleIcon size={13} strokeWidth={2} />
- </button>
- </Tip>
- </div>
+ <MachineSwitcherMenu />
</div>
{/* 右侧工具组:ProjectNode Toggle All → Filter → New Project
-mt-px:h-7 按钮在 h-6 行里中心对齐时视觉偏低,上移 1px 与 "Projects" 文字
@@ -710,7 +688,7 @@ export function ProjectsSection({
<div className={HEADER_ACTIONS_CLASS}>
{/* 「展开/收起所有分组」(E 期):单层 = 收起↔展开;设备+项目双层 =
循环 收项目层 → 收设备层 → 全部展开。tooltip 提示下一步动作。 */}
- {!isSectionCollapsed && foldState !== null && (
+ {foldState !== null && (
<Tip text={foldLabel} side="bottom">
<button
type="button"
@@ -732,7 +710,7 @@ export function ProjectsSection({
<SidebarFilterPopover
filter={filter}
allKnownProjects={allKnownProjects}
- hasRemoteDevices={hasRemoteDevices}
+ hasRemoteDevices={deviceGroupingAvailable}
/>
{/* 「新建项目」按钮 2026-08-12 暂时移除(用户裁决):同一动作(选目录 →
预填新任务草稿)在新任务页的工作目录选择器里仍可完成。onCreateProject
@@ -741,31 +719,29 @@ export function ProjectsSection({
</div>
</div>
- {/* 段级收起走 SectionCollapse 高度动画;项目列表「显示全部」在收起动画结束后复位。 */}
- <SectionCollapse collapsed={isSectionCollapsed}>
- {/* Projects Tree — padding [4,0,0,12], gap 4
- pr-0:右侧依赖 scroll body 的 scrollbar-gutter:stable 预留 12px,
- 与左 pl-3 视觉对称;全局滚动条已收窄到 12px 与 pl-3 等宽。 */}
- <div className="relative flex flex-col gap-1 pt-1 pr-0 pl-3">
- <UnclassifiedSection
- sessions={unclassified}
- hidden={unclassifiedHidden}
- activeSessionId={activeSessionId}
- runningSessionIds={runningSessionIds}
- attachedSessionIds={attachedSessionIds}
- notifications={notifications}
- scheduleSessionIndex={scheduleSessionIndex}
- selectedSessionIds={selectedSessionIds}
- onSessionClick={onSessionClick}
- onAction={onAction}
- onRename={onRename}
- onTogglePin={onTogglePin}
- onMoveSession={onMoveSession}
- projectOptions={projectOptions}
- onScheduleAction={onScheduleAction}
- sessionVariant={mainSessionVariant}
- />
- {/* 混排渲染(D / E 期):
+ {/* Projects Tree — padding [4,0,0,12], gap 4(段级收起已取消,树恒渲染)
+ pr-0:右侧依赖 scroll body 的 scrollbar-gutter:stable 预留 12px,
+ 与左 pl-3 视觉对称;全局滚动条已收窄到 12px 与 pl-3 等宽。 */}
+ <div className="relative flex flex-col gap-1 pt-1 pr-0 pl-3">
+ <UnclassifiedSection
+ sessions={unclassified}
+ hidden={unclassifiedHidden}
+ activeSessionId={activeSessionId}
+ runningSessionIds={runningSessionIds}
+ attachedSessionIds={attachedSessionIds}
+ notifications={notifications}
+ scheduleSessionIndex={scheduleSessionIndex}
+ selectedSessionIds={selectedSessionIds}
+ onSessionClick={onSessionClick}
+ onAction={onAction}
+ onRename={onRename}
+ onTogglePin={onTogglePin}
+ onMoveSession={onMoveSession}
+ projectOptions={projectOptions}
+ onScheduleAction={onScheduleAction}
+ sessionVariant={mainSessionVariant}
+ />
+ {/* 混排渲染(D / E 期):
- manual 排序:模型保证项目行连续在前 → 项目段整体走 SortableList 可拖,
其后是散排对话 / 对话组。折叠+溢出时禁用拖拽(PR #246 review 同款),
点「显示全部」展开为完整列表后再拖。设备分组与 manual 不叠加
@@ -773,130 +749,129 @@ export function ProjectsSection({
- 其它排序:按 deviceSections 切段(设备分组开启时),段内项目行与
散排对话按排序口径交错,不可拖(拖动意图请先切「手动排序」;旧
「随手一拖自动切 manual」在交错列表上会产生歧义落点,D 期收窄)。 */}
- {filter.sortBy === 'manual' ? (
- <>
- <SortableList
- items={visibleProjectNodes}
- getId={getProjectId}
- onReorder={handleReorder}
- disabled={!projectDragEnabled || (projectsOverflow && !showAllProjects)}
- reducedMotion={reducedMotion}
- filter="button, input, textarea, select, a, [data-no-drag], [data-project-header]"
- className="flex flex-col gap-1"
- renderItem={(project) => renderProjectNode(project)}
- />
- {visibleMixedEntries
- .filter((entry) => entry.kind !== 'project')
- .map((entry) => renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY))}
- </>
- ) : deviceGroupingActive ? (
- <div className="flex flex-col gap-1">
- {deviceSections.map((section) => {
- const key = deviceSectionKey(section.deviceId);
- const device = section.deviceId
- ? remoteDeviceIndex?.get(section.deviceId)
- : undefined;
- const name = section.deviceId
- ? (device?.name ?? section.deviceId)
- : t('ccAgent.sidebar.deviceGroup.local');
- const online = section.deviceId ? (device?.online ?? false) : true;
- const sectionCollapsed = collapsedDevices.has(key);
- return (
- <div key={key} className="flex flex-col gap-1">
- {/* 设备分组头:可折叠,在线状态点(绿/灰)+ 名称 + 条数。 */}
- <button
- type="button"
- onClick={() => toggleDeviceSection(key)}
- aria-expanded={!sectionCollapsed}
- aria-label={
- sectionCollapsed
- ? t('ccAgent.sidebar.deviceGroup.expand')
- : t('ccAgent.sidebar.deviceGroup.collapse')
- }
+ {filter.sortBy === 'manual' ? (
+ <>
+ <SortableList
+ items={visibleProjectNodes}
+ getId={getProjectId}
+ onReorder={handleReorder}
+ disabled={!projectDragEnabled || (projectsOverflow && !showAllProjects)}
+ reducedMotion={reducedMotion}
+ filter="button, input, textarea, select, a, [data-no-drag], [data-project-header]"
+ className="flex flex-col gap-1"
+ renderItem={(project) => renderProjectNode(project)}
+ />
+ {visibleMixedEntries
+ .filter((entry) => entry.kind !== 'project')
+ .map((entry) => renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY))}
+ </>
+ ) : deviceGroupingActive ? (
+ <div className="flex flex-col gap-1">
+ {deviceSections.map((section) => {
+ const key = deviceSectionKey(section.deviceId);
+ const device = section.deviceId
+ ? remoteDeviceIndex?.get(section.deviceId)
+ : undefined;
+ const name = section.deviceId
+ ? (device?.name ?? section.deviceId)
+ : t('ccAgent.sidebar.deviceGroup.local');
+ const online = section.deviceId ? (device?.online ?? false) : true;
+ const sectionCollapsed = collapsedDevices.has(key);
+ return (
+ <div key={key} className="flex flex-col gap-1">
+ {/* 设备分组头:可折叠,在线状态点(绿/灰)+ 名称 + 条数。 */}
+ <button
+ type="button"
+ onClick={() => toggleDeviceSection(key)}
+ aria-expanded={!sectionCollapsed}
+ aria-label={
+ sectionCollapsed
+ ? t('ccAgent.sidebar.deviceGroup.expand')
+ : t('ccAgent.sidebar.deviceGroup.collapse')
+ }
+ className={cn(
+ 'flex h-6 w-full items-center gap-1.5 rounded-md px-1.5',
+ 'text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]',
+ )}
+ >
+ {sectionCollapsed ? (
+ <ChevronRight size={12} strokeWidth={2} className="shrink-0" />
+ ) : (
+ <ChevronDown size={12} strokeWidth={2} className="shrink-0" />
+ )}
+ <MonitorSmartphone size={13} strokeWidth={2} className="shrink-0" />
+ <span className="min-w-0 truncate text-xs font-medium">{name}</span>
+ <span
+ aria-hidden
className={cn(
- 'flex h-6 w-full items-center gap-1.5 rounded-md px-1.5',
- 'text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]',
+ 'size-1.5 shrink-0 rounded-full',
+ online ? 'bg-[var(--card-status-done)]' : 'bg-[var(--text-tertiary)]',
)}
- >
- {sectionCollapsed ? (
- <ChevronRight size={12} strokeWidth={2} className="shrink-0" />
- ) : (
- <ChevronDown size={12} strokeWidth={2} className="shrink-0" />
- )}
- <MonitorSmartphone size={13} strokeWidth={2} className="shrink-0" />
- <span className="min-w-0 truncate text-xs font-medium">{name}</span>
- <span
- aria-hidden
- className={cn(
- 'size-1.5 shrink-0 rounded-full',
- online ? 'bg-[var(--card-status-done)]' : 'bg-[var(--text-tertiary)]',
- )}
- />
- {/* 条数已去掉(2026-08-12 用户裁决):它数的是顶层条目
+ />
+ {/* 条数已去掉(2026-08-12 用户裁决):它数的是顶层条目
(项目行 + 散排对话 + 对话组),不是任务数,读起来只会误导;
段展开后内容本身就是答案。「离线」接手 ml-auto 保持靠右。 */}
- {!online && (
- <span className="ml-auto shrink-0 text-xs text-[var(--cmd-palette-item-meta)]">
- {t('ccAgent.sidebar.deviceGroup.offline')}
- </span>
- )}
- </button>
- <SectionCollapse collapsed={sectionCollapsed}>
- <div className="flex flex-col gap-1 pl-2">
- {/* 折叠上限每段独立应用(切段在前,见 deviceSections 注释);
+ {!online && (
+ <span className="ml-auto shrink-0 text-xs text-[var(--cmd-palette-item-meta)]">
+ {t('ccAgent.sidebar.deviceGroup.offline')}
+ </span>
+ )}
+ </button>
+ <SectionCollapse collapsed={sectionCollapsed}>
+ <div className="flex flex-col gap-1 pl-2">
+ {/* 折叠上限每段独立应用(切段在前,见 deviceSections 注释);
「显示全部」的作用域同样是段内(expandedDeviceSections)。 */}
- {(() => {
- const sectionView = collapseEntries(
- section.entries,
- expandedDeviceSections.has(key),
- );
- return (
- <>
- {sectionView.visibleEntries.map((entry) =>
- entry.kind === 'project'
- ? renderProjectNode(entry.project)
- : // 本机段 → null(强制本机);远程段 → 该设备。
- renderNonProjectEntry(
- entry,
- key,
- section.deviceId
- ? { deviceId: section.deviceId, deviceName: name }
- : null,
- ),
- )}
- {sectionView.isOverflowing && (
- <ShowAllEntriesButton
- count={sectionView.totalCount}
- onClick={() =>
- setExpandedDeviceSections((prev) => new Set(prev).add(key))
- }
- />
- )}
- </>
- );
- })()}
- </div>
- </SectionCollapse>
- </div>
- );
- })}
- </div>
- ) : (
- <div className="flex flex-col gap-1">
- {visibleMixedEntries.map((entry) =>
- entry.kind === 'project'
- ? renderProjectNode(entry.project)
- : renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY),
- )}
- </div>
- )}
- {/* 全局「显示全部」只属于单段路径(manual / 未按设备分组——manual 已在
+ {(() => {
+ const sectionView = collapseEntries(
+ section.entries,
+ expandedDeviceSections.has(key),
+ );
+ return (
+ <>
+ {sectionView.visibleEntries.map((entry) =>
+ entry.kind === 'project'
+ ? renderProjectNode(entry.project)
+ : // 本机段 → null(强制本机);远程段 → 该设备。
+ renderNonProjectEntry(
+ entry,
+ key,
+ section.deviceId
+ ? { deviceId: section.deviceId, deviceName: name }
+ : null,
+ ),
+ )}
+ {sectionView.isOverflowing && (
+ <ShowAllEntriesButton
+ count={sectionView.totalCount}
+ onClick={() =>
+ setExpandedDeviceSections((prev) => new Set(prev).add(key))
+ }
+ />
+ )}
+ </>
+ );
+ })()}
+ </div>
+ </SectionCollapse>
+ </div>
+ );
+ })}
+ </div>
+ ) : (
+ <div className="flex flex-col gap-1">
+ {visibleMixedEntries.map((entry) =>
+ entry.kind === 'project'
+ ? renderProjectNode(entry.project)
+ : renderNonProjectEntry(entry, DIALOGUE_GROUP_ALL_KEY),
+ )}
+ </div>
+ )}
+ {/* 全局「显示全部」只属于单段路径(manual / 未按设备分组——manual 已在
deviceGroupingActive 定义里排除);设备分组下折叠与 footer 都在段内。 */}
- {!deviceGroupingActive && projectsOverflow && (
- <ShowAllEntriesButton count={projectsTotal} onClick={() => setShowAllProjects(true)} />
- )}
- </div>
- </SectionCollapse>
+ {!deviceGroupingActive && projectsOverflow && (
+ <ShowAllEntriesButton count={projectsTotal} onClick={() => setShowAllProjects(true)} />
+ )}
+ </div>
</div>
);
}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/useHoverOpenMenu.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/useHoverOpenMenu.ts
deleted file mode 100644
index 6f5e181edb..0000000000
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/useHoverOpenMenu.ts
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * useHoverOpenMenu —— 让 Radix DropdownMenu「鼠标移上去就展开」的受控开合 hook。
- * ---------------------------------------------------------------------------
- * Radix 的 DropdownMenu 默认点击才展开。侧栏段头的「整理侧边栏」(SidebarFilterPopover)
- * 与「远程机器切换」(MachineSwitcherMenu)希望 hover 触发按钮即展开、移开即收起。
- *
- * 行为:
- * - hover 触发按钮 → 短延迟后 open(openDelay,防手滑扫过误开);
- * - 移开触发按钮 / 菜单内容 → 短延迟后 close(closeDelay,给「触发按钮→内容」
- * 之间的间隙留出移动时间,进入内容会 cancelClose);
- * - 点击触发按钮**只开不关**:已展开时点击不会把菜单点掉,保持触发态
- * (见 triggerProps.onPointerDown + contentProps.onInteractOutside);未展开时点击照常打开;
- * - 键盘仍可正常开合(走 Radix onOpenChange);
- * - 选中项 / Esc / 点击外部(触发按钮以外) / 移开由 Radix onOpenChange(false) / scheduleClose 正常关闭。
- *
- * 「点击不关闭」为何要两处配合(缺一仍会关):已展开时点击触发按钮,Radix 有**两条**独立关闭路径:
- * 1. 触发按钮自身的 toggle:DropdownMenuTrigger 用
- * `composeEventHandlers(props.onPointerDown, radixToggleHandler)`——我们挂的 onPointerDown 先跑,
- * open 时 preventDefault 会让 composeEventHandlers 跳过 Radix 内部那次 onOpenToggle(会在已开时关闭);
- * 2. 非模态(modal={false})Content 的 DismissableLayer:它在 document 上监听 pointerdown,触发按钮不在
- * Content 的 React 子树里 → 被判为「点击外部」→ onInteractOutside → 未 preventDefault 就 onDismiss →
- * onOpenChange(false) 关闭。故 contentProps.onInteractOutside 在「外部点击目标落在触发按钮内」时
- * preventDefault,掐掉这条 dismiss(react-dismissable-layer:仅当 `!event.defaultPrevented` 才 onDismiss)。
- * 两条都拦住,已展开时点击触发按钮才真正保持展开;未展开时(open=false)两处都放行,点击照常打开。
- * 触发按钮的 DOM 通过 triggerRef 拿到(消费方须把 triggerRef 挂到触发按钮上)。
- *
- * 子菜单(DropdownMenuSub)难点:SubContent 经 Portal 渲染,不在主 Content 的 DOM
- * 子树里,鼠标从主 Content 移入 SubContent 会触发主 Content 的 onMouseLeave → 误关。
- * 解法:把同一套 hoverAreaProps(onMouseEnter=cancelClose / onMouseLeave=scheduleClose)
- * 通过 HoverMenuAreaContext 也挂到每个 SubContent 上——离开主 Content 排的 close 会被
- * SubContent 的 enter 立刻取消,菜单树内移动不会关闭。
- *
- * a11y:hover 展开时 preventDefault 掉 Radix 的 openAutoFocus,避免把焦点/滚动
- * 抢进菜单(纯 hover 不应夺焦);点击 / 键盘展开时保留默认自动聚焦以便方向键导航。
- */
-
-import {
- createContext,
- type PointerEvent as ReactPointerEvent,
- type RefObject,
- useCallback,
- useContext,
- useEffect,
- useRef,
- useState,
-} from 'react';
-
-export interface HoverAreaProps {
- onMouseEnter: () => void;
- onMouseLeave: () => void;
-}
-
-/** 触发按钮专用:在 HoverAreaProps 之上追加 onPointerDown(实现「点击只开不关」)。 */
-export interface HoverTriggerProps extends HoverAreaProps {
- onPointerDown: (event: ReactPointerEvent) => void;
-}
-
-/**
- * Radix DismissableLayer 的 onInteractOutside 事件(PointerDownOutside / FocusOutside)最小形状。
- * 只用到 detail.originalEvent.target(判定点击目标)与 preventDefault(掐掉 dismiss)。
- */
-type OutsideInteractEvent = {
- detail: { originalEvent: { target: EventTarget | null } };
- preventDefault: () => void;
-};
-
-export interface HoverOpenMenu {
- open: boolean;
- onOpenChange: (open: boolean) => void;
- /**
- * 挂在触发按钮上的 ref —— 供 contentProps.onInteractOutside 判定「外部点击」是否落在触发按钮内,
- * 是则掐掉 DismissableLayer 的 dismiss(见文件头「点击不关闭」说明)。消费方必须挂上。
- */
- triggerRef: RefObject<HTMLElement | null>;
- /** 挂在 DropdownMenuTrigger 的子按钮上(含「点击只开不关」的 onPointerDown)。 */
- triggerProps: HoverTriggerProps;
- /** 挂在主 DropdownMenuContent 上(含防夺焦 + 防触发按钮点击 dismiss)。 */
- contentProps: HoverAreaProps & {
- onOpenAutoFocus: (event: Event) => void;
- onCloseAutoFocus: (event: Event) => void;
- onInteractOutside: (event: OutsideInteractEvent) => void;
- };
- /** 挂在每个 DropdownMenuSubContent 上,避免移入子菜单被误关(见文件头说明)。 */
- hoverAreaProps: HoverAreaProps;
-}
-
-/** 供 SubContent 读取 hoverAreaProps(跨 Portal 仍能透传 React context)。 */
-export const HoverMenuAreaContext = createContext<HoverAreaProps | null>(null);
-
-export function useHoverMenuArea(): HoverAreaProps | null {
- return useContext(HoverMenuAreaContext);
-}
-
-export function useHoverOpenMenu(opts?: { openDelay?: number; closeDelay?: number }): HoverOpenMenu {
- const openDelay = opts?.openDelay ?? 90;
- const closeDelay = opts?.closeDelay ?? 160;
-
- const [open, setOpen] = useState(false);
- const triggerRef = useRef<HTMLElement | null>(null);
- const openTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
- const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
- // hover 展开标记:用于在 onOpenAutoFocus 里决定是否 preventDefault(纯 hover 不夺焦)。
- const openedViaHover = useRef(false);
-
- const clearOpenTimer = () => {
- if (openTimer.current) {
- clearTimeout(openTimer.current);
- openTimer.current = null;
- }
- };
- const clearCloseTimer = () => {
- if (closeTimer.current) {
- clearTimeout(closeTimer.current);
- closeTimer.current = null;
- }
- };
-
- // 卸载时清掉挂起的定时器,避免对已卸载组件 setState。
- useEffect(() => () => {
- clearOpenTimer();
- clearCloseTimer();
- }, []);
-
- const scheduleOpen = useCallback(() => {
- clearCloseTimer();
- if (openTimer.current) return;
- openTimer.current = setTimeout(() => {
- openTimer.current = null;
- openedViaHover.current = true;
- setOpen(true);
- }, openDelay);
- }, [openDelay]);
-
- const scheduleClose = useCallback(() => {
- clearOpenTimer();
- if (closeTimer.current) return;
- closeTimer.current = setTimeout(() => {
- closeTimer.current = null;
- setOpen(false);
- }, closeDelay);
- }, [closeDelay]);
-
- const cancelClose = useCallback(() => {
- clearCloseTimer();
- }, []);
-
- const onOpenChange = useCallback((next: boolean) => {
- clearOpenTimer();
- clearCloseTimer();
- // 点击 / 键盘 / 主动关闭走这里:非 hover 开,允许 Radix 默认自动聚焦。
- if (next) openedViaHover.current = false;
- setOpen(next);
- }, []);
-
- // 「点击只开不关」:已展开时,拦掉主键 pointerdown,阻止 Radix Trigger 的 toggle 关闭
- // (见文件头说明)。未展开时放行,让点击照常打开(与 hover 打开互不冲突)。
- const onTriggerPointerDown = useCallback(
- (event: ReactPointerEvent) => {
- if (open && event.button === 0 && !event.ctrlKey) {
- event.preventDefault();
- }
- },
- [open],
- );
-
- // 「点击只开不关」第二条路径:非模态 Content 的 DismissableLayer 会把「点击触发按钮」判为点击外部并
- // 关闭菜单。若外部点击目标落在触发按钮内,preventDefault 掐掉这条 dismiss(见文件头)。点击真正的外部
- // (触发按钮以外)不 preventDefault,仍正常关闭。
- const onInteractOutside = useCallback((event: OutsideInteractEvent) => {
- const target = event.detail.originalEvent.target;
- if (target instanceof Node && triggerRef.current?.contains(target)) {
- event.preventDefault();
- }
- }, []);
-
- const onOpenAutoFocus = useCallback((event: Event) => {
- if (openedViaHover.current) event.preventDefault();
- }, []);
- const onCloseAutoFocus = useCallback((event: Event) => {
- if (openedViaHover.current) event.preventDefault();
- }, []);
-
- const hoverAreaProps: HoverAreaProps = {
- onMouseEnter: cancelClose,
- onMouseLeave: scheduleClose,
- };
-
- return {
- open,
- onOpenChange,
- triggerRef,
- triggerProps: {
- onMouseEnter: scheduleOpen,
- onMouseLeave: scheduleClose,
- onPointerDown: onTriggerPointerDown,
- },
- contentProps: { ...hoverAreaProps, onOpenAutoFocus, onCloseAutoFocus, onInteractOutside },
- hoverAreaProps,
- };
-}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index b7f8bcafee..43b577e3b9 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -1481,7 +1481,11 @@
"confirmTitle": "Confirm overwrites",
"confirmSubtitle": "Choose the fields to copy from {{source}}.",
"source": "Source",
- "columns": { "field": "Field", "source": "Source value", "target": "Current value" },
+ "columns": {
+ "field": "Field",
+ "source": "Source value",
+ "target": "Current value"
+ },
"fields": {
"endpointBundle": "Endpoint and API protocol",
"baseUrl": "Base URL",
@@ -6954,6 +6958,7 @@
},
"showAllSessions": "Show all {{count}}",
"allSessions": "All sessions",
+ "scopeLocalSessions": "This device’s sessions",
"dialogues": "Chat",
"newDialogue": "New session",
"dialoguesToggleExpand": "Expand Chat",
@@ -6971,8 +6976,6 @@
"projects": "Projects",
"newProject": "New project",
"createProjectFailed": "Failed to create project",
- "projectsSectionToggleExpand": "Expand projects",
- "projectsSectionToggleCollapse": "Collapse projects",
"projectsToggleExpand": "Expand all project sessions",
"projectsToggleCollapse": "Collapse all project sessions",
"filterAria": "Organize sidebar (Status: {{status}}, Vendor: {{vendor}}, Last activity: {{lastActivity}}, Group by: {{groupBy}}, Sort by: {{sortBy}}, Projects: {{projects}})",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 86ebed6105..88e14d3562 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -1481,7 +1481,11 @@
"confirmTitle": "上書きを確認",
"confirmSubtitle": "{{source}} からコピーする項目を選択してください。",
"source": "コピー元",
- "columns": { "field": "項目", "source": "コピー元", "target": "現在値" },
+ "columns": {
+ "field": "項目",
+ "source": "コピー元",
+ "target": "現在値"
+ },
"fields": {
"endpointBundle": "エンドポイントと API プロトコル",
"baseUrl": "ベース URL",
@@ -6942,6 +6946,7 @@
},
"showAllSessions": "すべて表示 {{count}} 件",
"allSessions": "すべてのセッション",
+ "scopeLocalSessions": "このデバイスのセッション",
"dialogues": "会話",
"newDialogue": "新規セッション",
"dialoguesToggleExpand": "会話を展開",
@@ -6959,8 +6964,6 @@
"projects": "プロジェクト",
"newProject": "新規プロジェクト",
"createProjectFailed": "プロジェクトの作成に失敗しました",
- "projectsSectionToggleExpand": "プロジェクトを展開",
- "projectsSectionToggleCollapse": "プロジェクトを折りたたむ",
"projectsToggleExpand": "すべてのプロジェクトセッションを展開",
"projectsToggleCollapse": "すべてのプロジェクトセッションを折りたたむ",
"filterAria": "サイドバー整理(ステータス:{{status}}、Agent:{{vendor}}、最終アクティビティ:{{lastActivity}}、グループ:{{groupBy}}、並び替え:{{sortBy}}、プロジェクト:{{projects}})",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 5459ae94db..bae81d23e0 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -1481,7 +1481,11 @@
"confirmTitle": "덮어쓰기 확인",
"confirmSubtitle": "{{source}}에서 복사할 필드를 선택하세요.",
"source": "원본",
- "columns": { "field": "필드", "source": "원본 값", "target": "현재 값" },
+ "columns": {
+ "field": "필드",
+ "source": "원본 값",
+ "target": "현재 값"
+ },
"fields": {
"endpointBundle": "엔드포인트 및 API 프로토콜",
"baseUrl": "기본 URL",
@@ -6942,6 +6946,7 @@
},
"showAllSessions": "모두 표시 {{count}}개",
"allSessions": "모든 세션",
+ "scopeLocalSessions": "이 기기의 세션",
"dialogues": "대화",
"newDialogue": "새 세션",
"dialoguesToggleExpand": "대화 펼치기",
@@ -6959,8 +6964,6 @@
"projects": "프로젝트",
"newProject": "새 프로젝트",
"createProjectFailed": "프로젝트 생성 실패",
- "projectsSectionToggleExpand": "프로젝트 펼치기",
- "projectsSectionToggleCollapse": "프로젝트 접기",
"projectsToggleExpand": "모든 프로젝트 세션 펼치기",
"projectsToggleCollapse": "모든 프로젝트 세션 접기",
"filterAria": "사이드바 정리(상태: {{status}}, Agent: {{vendor}}, 최근 활동: {{lastActivity}}, 그룹: {{groupBy}}, 정렬: {{sortBy}}, 프로젝트: {{projects}})",
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 92423ee724..067878d563 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -1481,7 +1481,11 @@
"confirmTitle": "确认覆盖",
"confirmSubtitle": "选择从 {{source}} 复制的字段。",
"source": "来源",
- "columns": { "field": "字段", "source": "来源值", "target": "当前值" },
+ "columns": {
+ "field": "字段",
+ "source": "来源值",
+ "target": "当前值"
+ },
"fields": {
"endpointBundle": "端点与 API 协议",
"baseUrl": "基础 URL",
@@ -1508,7 +1512,11 @@
"targetReady_other": "可填充 {{count}} 个字段",
"targetIncompatible_one": "{{count}} 个字段不兼容",
"targetIncompatible_other": "{{count}} 个字段不兼容",
- "status": { "needsConfirm": "需要确认", "ready": "可以填充", "incompatible": "不兼容" },
+ "status": {
+ "needsConfirm": "需要确认",
+ "ready": "可以填充",
+ "incompatible": "不兼容"
+ },
"secretIndependent": "复制到 {{target}} 的独立本地密钥",
"overwriteCurrent": "替换当前值",
"fillEmpty": "填充当前空字段",
@@ -6938,6 +6946,7 @@
},
"showAllSessions": "显示全部 {{count}} 项",
"allSessions": "全部任务",
+ "scopeLocalSessions": "本机任务",
"dialogues": "对话",
"newDialogue": "新任务",
"dialoguesToggleExpand": "展开对话",
@@ -6955,8 +6964,6 @@
"projects": "项目",
"newProject": "新建项目",
"createProjectFailed": "新建项目失败",
- "projectsSectionToggleExpand": "展开项目",
- "projectsSectionToggleCollapse": "收起项目",
"projectsToggleExpand": "展开所有项目任务",
"projectsToggleCollapse": "收起所有项目任务",
"filterAria": "整理侧边栏(状态:{{status}},Agent:{{vendor}},最近活跃:{{lastActivity}},分组:{{groupBy}},排序:{{sortBy}},项目:{{projects}})",
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 a12a19480a..3c5b4496fb 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -639,8 +639,8 @@
"zh-CN": "簡體中文",
"en": "English",
"ja": "日本語",
- "ko": "한국어",
- "zh-TW": "繁體中文"
+ "ko": "한국어",
+ "zh-TW": "繁體中文"
}
},
"userProfile": {
@@ -1457,7 +1457,11 @@
"confirmTitle": "確認覆蓋",
"confirmSubtitle": "選擇要從 {{source}} 複製的欄位。",
"source": "來源",
- "columns": { "field": "欄位", "source": "來源值", "target": "目前值" },
+ "columns": {
+ "field": "欄位",
+ "source": "來源值",
+ "target": "目前值"
+ },
"fields": {
"endpointBundle": "端點與 API 協議",
"baseUrl": "基礎 URL",
@@ -1484,7 +1488,11 @@
"targetReady_other": "可填入 {{count}} 個欄位",
"targetIncompatible_one": "{{count}} 個欄位不相容",
"targetIncompatible_other": "{{count}} 個欄位不相容",
- "status": { "needsConfirm": "需要確認", "ready": "可以填入", "incompatible": "不相容" },
+ "status": {
+ "needsConfirm": "需要確認",
+ "ready": "可以填入",
+ "incompatible": "不相容"
+ },
"secretIndependent": "複製到 {{target}} 的獨立本機金鑰",
"overwriteCurrent": "取代目前值",
"fillEmpty": "填入目前空白欄位",
@@ -2317,9 +2325,9 @@
"title": "Codex Subagent 護欄",
"enableHint": "允許 Codex 在執行任務時建立一次性 Subagent。關閉後對舊版(V1)和 Sol / Terra(V2)都生效。",
"enableAria": "允許 Codex 使用 Subagent",
- "cindyPolicyLabel": "使用 Cindy 自定義 Subagent 策略",
- "cindyPolicyHint": "開啟後,Cindy 會注入策略,引導 Codex 在探索型任務中主動使用 Subagent。對於本身已擅長規劃和委派的模型,額外引導可能適得其反;關閉後不再注入,改用 Codex 的原生預設行為。",
- "cindyPolicyAria": "使用 Cindy 自定義 Subagent 策略",
+ "cindyPolicyLabel": "使用 Cindy 自訂 Subagent 策略",
+ "cindyPolicyHint": "開啟後,Cindy 會注入策略,引導 Codex 在探索型任務中主動使用 Subagent。對於本身已擅長規劃與委派的模型,額外引導可能適得其反;關閉後不再注入,改用 Codex 的原生預設行為。",
+ "cindyPolicyAria": "使用 Cindy 自訂 Subagent 策略",
"concurrencyLabel": "Subagent 併發上限",
"concurrencyHint": "同時執行的 Subagent 數量上限。每個 Subagent 都會消耗模型配額,調低更省;Ultra 檔位下併發達到 8 時 Codex 會發出用量警告。",
"concurrencyFollowDefault": "跟隨 Codex 預設(舊版 V1 為 6,Sol / Terra 為 3)",
@@ -2328,9 +2336,6 @@
"nestedLabel": "允許 Subagent 再建立 Subagent",
"nestedHint": "僅舊版 Codex Multi-Agent(V1)生效,Sol / Terra(V2)會忽略此設定。",
"nestedAria": "允許 Subagent 再建立 Subagent",
- "cindyPolicyLabel": "使用 Cindy 自訂 Subagent 策略",
- "cindyPolicyHint": "開啟後,Cindy 會注入策略,引導 Codex 在探索型任務中主動使用 Subagent。對於本身已擅長規劃與委派的模型,額外引導可能適得其反;關閉後不再注入,改用 Codex 的原生預設行為。",
- "cindyPolicyAria": "使用 Cindy 自訂 Subagent 策略",
"localOnlyHint": "以上護欄僅對本機執行的 Codex 生效,SSH 遠端連線的 Codex 不受影響。"
},
"toast": {
@@ -2537,7 +2542,7 @@
},
"android": {
"title": "Android 自動化",
- "description": "讓 Agent 透過 ADB 檢查並操作已連線的 Android 裝置",
+ "description": "讓 Agent 透過 ADB 檢查並操作已連線的 Android 裝置",
"toggleAria": "切換 Android 自動化",
"refresh": "重新檢查",
"toggleHint": "這個全域性開關只對之後新建的 Agent 會話生效;已在執行的 Agent 會話不受影響。",
@@ -6941,6 +6946,7 @@
},
"showAllSessions": "顯示全部 {{count}} 項",
"allSessions": "全部任務",
+ "scopeLocalSessions": "本機任務",
"dialogues": "對話",
"newDialogue": "新任務",
"dialoguesToggleExpand": "展開對話",
@@ -6958,8 +6964,6 @@
"projects": "專案",
"newProject": "新建專案",
"createProjectFailed": "新建專案失敗",
- "projectsSectionToggleExpand": "展開專案",
- "projectsSectionToggleCollapse": "收起專案",
"projectsToggleExpand": "展開所有專案任務",
"projectsToggleCollapse": "收起所有專案任務",
"filterAria": "整理側邊欄(狀態:{{status}},Agent:{{vendor}},最近活躍:{{lastActivity}},分組:{{groupBy}},排序:{{sortBy}},專案:{{projects}})",
diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.md
index 4653ba5a3f..cf21d8f449 100644
--- a/docs/product-rules/sidebar-redesign-plan.md
+++ b/docs/product-rules/sidebar-redesign-plan.md
@@ -15,25 +15,43 @@
1. 所有内容(置顶与主列表)都能选择文字或列表方式显示;
2. 项目与对话不再固定分段,参考手机版的混排方式整合;
3. 分组、排序、筛选、显示设置收敛进一个「整理侧边栏」菜单;
-4. 概念上区分「范围」(设备下拉)、「分组」(复选)、「筛选」(收窄)、「显示」(形态)。
+4. 概念上区分「范围」(段头标题下拉)、「分组」(复选)、「筛选」(收窄)、「显示」(形态)。
## 2. 信息架构
```
-[新建] 固定不滚动
+[新建] 固定不滚动
─────────── 以下随列表一起滚动 ───────────
-[顶部导航] 自动任务 / 插件 / 搜索 / 设备下拉(仅远程连接时出现)
-[置顶区] 可折叠;会话与项目混排置顶,共享一份拖拽顺序(现状语义不变)
-[全部任务] 单一主列表(混排模型,见 §3)
+[顶部导航] 自动任务 / 插件 / 搜索
+[置顶区] 可折叠;会话与项目混排置顶,共享一份拖拽顺序(现状语义不变)
+[范围标题▾] 段头标题即机器范围下拉(全部任务 / 本机任务 / 设备名 / N 台机器)
+[主列表] 单一混排列表(见 §3)
```
+**「全部任务」段头与设备下拉合并(2026-08-13 用户定稿,新设计,显式推翻两条
+2026-07 旧定稿)**:
+- 标题文字反映当前范围,点击标题弹出「所有 / 本机 / 各设备(单选 + 多选)+
+ 远程连接设置」菜单——修掉旧结构的标题撒谎问题(范围收窄后段头仍写「全部任务」),
+ 顶部导航省一行。范围菜单本体(单选/多选/三态/设置入口)沿用原件不变。
+- 无远程设备时标题退化为纯静态「全部任务」(无箭头不可点)——段头恒在,这是
+ 合并方向只能是"下拉并入标题"而非反向的原因。
+- **点击展开**(推翻 2026-07-12 hover 展开定稿:段头标题 hover 扫过就弹菜单太吵);
+ 「切换器收进顶部导航末行、不挂段头」的 2026-07 定稿一并推翻(当年是段头挂配件,
+ 现在段头本身就是切换器)。
+- **段级收起取消**:标题的点击语义让给范围切换;「想要紧凑」由段头右侧的
+ 「收起所有分组」按钮承接。
+- 范围影响整个侧栏(含置顶区)的既有语义**不变**——范围是"我在看谁的数据",
+ 与筛选不同,置顶区豁免筛选但不豁免范围(否则被排除设备的置顶任务会赖着不走)。
+ 范围选择器位于置顶区下方而作用及于上方的空间错位,由标题文字的状态表达兜底
+ (用户裁决:接受,不搬置顶区)。
+
「按日期分组」模式删除(`DateGroupedSessionsSection` 及 `groupBy === 'date'` 分支)。
**只有「新建」固定**(2026-08-12 用户裁决,对齐 Codex):列表向上滚动时,顶部导航
-其余四行跟着滚走,把纵向空间让给任务列表。实现上 `SidebarTopNav` 支持分段渲染
+其余三行跟着滚走,把纵向空间让给任务列表。实现上 `SidebarTopNav` 支持分段渲染
(`pinned` / `scrollable`),Shell 画固定段、任务列表页在自己的滚动容器最上方画可滚动段;
归属由功能槽经 `useOwnTopNavScrollableRows` 声明,**Shell 不判路由**(维持"外壳不感知
-路由"的架构不变量)。没有长列表的视图(插件页等)与 rail 态仍由 Shell 整块渲染五行。
+路由"的架构不变量)。没有长列表的视图(插件页等)与 rail 态仍由 Shell 整块渲染四行。
## 3. 整理侧边栏菜单(定稿结构)
@@ -52,7 +70,7 @@
| 选项 | 默认 | 行为 |
|---|---|---|
| 按项目分组 | **开** | 有项目的任务收进项目行;关闭则平铺、行尾带项目小标签 |
-| 按设备分组 | **开** | 最外层按设备切段,分组头带在线状态、可折叠;**仅有远程设备连接时该选项才出现**(与顶部设备下拉同一出现条件);远程断开时选项消失、效果一并解除——**只解除生效,不改写偏好**(生效 = 有远程设备 ∧ 偏好开,两者分离;断线再重连后按原偏好自动恢复分组。2026-08-13 复查补记:早期原型在断开时直接把偏好写成关,是错误做法,勿照抄) |
+| 按设备分组 | **开** | 最外层按设备切段,分组头带在线状态、可折叠;**仅有远程设备连接时该选项才出现**;远程断开时选项消失、效果一并解除——**只解除生效,不改写偏好**(生效 = 有远程设备 ∧ 偏好开,两者分离;断线再重连后按原偏好自动恢复分组。2026-08-13 复查补记:早期原型在断开时直接把偏好写成关,是错误做法,勿照抄)。**范围收窄到单台机器时同样退场**(2026-08-13 用户定稿):只有一台无段可切,唯一的段头还会与范围标题重复报同一个设备名;选项行同步隐藏、偏好不改写,范围放宽自动恢复 |
| 对话归为一组 | **开** | 无项目任务收进「对话」组(归属分类名,按 task-and-conversation-naming §2.3);关闭则散排。组头右侧有与项目行等位的新建入口。(2026-08-12 用户裁决改默认开,原定稿为关) |
层级方向固定:设备 → 项目/对话组 → 任务。全关 = 纯平铺。