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): 范围标题恒在,并入侧边栏显示设置入口

Dash848bedc3bd63
diff --git a/apps/desktop/help-knowledge/sidebar.md b/apps/desktop/help-knowledge/sidebar.md
index a79408c219..851aa55a85 100644
--- a/apps/desktop/help-knowledge/sidebar.md
+++ b/apps/desktop/help-knowledge/sidebar.md
@@ -4,13 +4,13 @@ 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 main list 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 **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.
**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 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**.
- 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.
+- 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.
**Grouping (independent checkboxes, freely combinable):**
@@ -23,7 +23,7 @@ The left sidebar lists your sessions. It's the main way to navigate and organize
- **By time** (default) — one activity timeline for the whole list, most recent first. There is no oldest-first option.
- **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.
-- **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.
+- **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.
- Sorting **alphabetically** and **oldest first** have been removed.
**Filters (one row that opens a submenu):**
@@ -49,7 +49,7 @@ The left sidebar lists your sessions. It's the main way to navigate and organize
**Collapse / expand all groups:**
-- 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.
+- 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.
**Searching:**
diff --git a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts
index dd3af8853a..3d088a7aa4 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 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.",
+ 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.",
},
{
id: "skills",
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcher.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcher.test.ts
index 5c463f7ec5..e124d47bdd 100644
--- a/apps/desktop/src/renderer/__tests__/machineSwitcher.test.ts
+++ b/apps/desktop/src/renderer/__tests__/machineSwitcher.test.ts
@@ -133,7 +133,9 @@ describe('断网后远端选择的逃生路径', () => {
expect(normalizeSelectedMachineId(raw, stoppedSelectable)).toBe(MACHINE_ALL);
});
- it('目录不可用但仍记着远端选择时保留切换入口,用户可显式切回本机', () => {
+ it('目录不可用但仍记着远端选择时,旧逃生 helper 仍为真;菜单是否画设备列表另看 devices.length', () => {
+ // shouldShowMachineSwitcher 仍给其它调用方用。范围标题恒在后,MachineSwitcherMenu
+ // 不再拿它决定要不要画「所有 / 本机」——目录空了只留两项设置。
expect(shouldShowMachineSwitcher(['dev-a'], [])).toBe(true);
expect(shouldShowMachineSwitcher([MACHINE_LOCAL], [])).toBe(false);
expect(shouldShowMachineSwitcher(MACHINE_ALL, [])).toBe(false);
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
index cf6a5e900f..e79b66d154 100644
--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
@@ -5,11 +5,11 @@
* 与「全部任务」段头**合并**——MachineSwitcherMenu 即主列表段头标题,文字反映
* 当前范围(全部任务 / 本机任务 / 设备名 / N 台机器),点击展开范围菜单;
* SidebarTopNav 不再有独立的远程机器行。为避免回退:
- * - ProjectsSection 段头渲染 MachineSwitcherMenu 作标题;SidebarTopNav 不再
- * import / 渲染它;
- * - 无远程设备时退化为纯静态标题(段头恒在);
+ * - 范围标题由 MainListScopeHeader 渲染,ProjectsSection 与空态/占位分支共用;
+ * SidebarTopNav 不再 import / 渲染它;
+ * - 无远程设备时标题仍带箭头,菜单只留远程连接设置 / 侧边栏显示设置;
* - 点击展开(不再 hover 自动展开);段级收起同时取消;
- * - 组件保留设备选择(单选 + 多选)+ 远程连接设置入口。
+ * - 组件保留设备选择(单选 + 多选)+ 侧边栏显示设置 / 远程连接设置入口。
*
* 静态扫描风格(renderer 测试环境无 jsdom),与 sidebarUpperSingleButton.test.ts 一致。
*/
@@ -32,11 +32,11 @@ const projectsSectionSource = read(
const menuSource = read('features', 'cc-agent', 'sidebar', 'MachineSwitcherMenu.tsx');
describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不滚动)', () => {
- it('CCAgentSidebarUpper 不再渲染任何机器切换入口', () => {
- // 旧整行 MachineSwitcher 与滚动区内的 MachineSwitcherMenu 都已移除,
- // 入口统一在 shell SidebarTopNav 末行。
- expect(sidebarUpperSource).not.toContain('MachineSwitcherMenu');
+ it('CCAgentSidebarUpper 不再渲染旧整行 MachineSwitcher', () => {
+ // 旧整行 MachineSwitcher 已移除;范围标题改由 MainListScopeHeader 在
+ // 空态 / 占位分支恒在,不再假装入口在 SidebarTopNav。
expect(sidebarUpperSource).not.toMatch(/<MachineSwitcher\s*\/>/);
+ expect(sidebarUpperSource).toContain('MainListScopeHeader');
});
it('深链回落「所有」走 Transient(不落盘),不冲掉用户持久化的机器多选集', () => {
@@ -296,16 +296,40 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(filterSource).toContain('Icon={Info}');
});
- it('连接中占位页不再自带 MachineSwitcherMenu(固定行已常驻,不会被困住)', () => {
- const idx = sidebarUpperSource.indexOf('selectedMachineConnecting ?');
- expect(idx).toBeGreaterThanOrEqual(0);
- const branch = sidebarUpperSource.slice(idx, idx + 600);
- expect(branch).not.toContain('<MachineSwitcherMenu');
+ 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('<SidebarFilterPopover');
+ expect(projectsSectionSource).toContain('<MainListScopeHeader');
+ expect(projectsSectionSource).toContain('hasMainListContent');
+ expect(projectsSectionSource).not.toMatch(/if \(\s*allProjectKeysForOrder\.length === 0/);
+ // 连接中 / 全屏 loading-error 不再把范围标题一起摘掉。
+ const connectingIdx = sidebarUpperSource.indexOf('selectedMachineConnecting ?');
+ expect(connectingIdx).toBeGreaterThanOrEqual(0);
+ expect(sidebarUpperSource.slice(connectingIdx, connectingIdx + 900)).toContain(
+ '<MainListScopeHeader',
+ );
+ expect(sidebarUpperSource).toContain('deviceGroupingAvailable');
+ const placeholderMarkers = [
+ "remoteDeviceDirectoryStatus === 'error' && !hasVisibleSidebarContent",
+ 'remoteSessionBootstrapFailures.length > 0 && !hasVisibleSidebarContent',
+ "remoteDeviceDirectoryStatus === 'loading' && !hasVisibleSidebarContent",
+ 'remoteSessionBootstrapLoadingDevices.length > 0 && !hasVisibleSidebarContent',
+ 'selectedMachineConnecting ?',
+ ];
+ for (const marker of placeholderMarkers) {
+ const idx = sidebarUpperSource.indexOf(marker);
+ expect(idx, `缺占位分支 ${marker}`).toBeGreaterThanOrEqual(0);
+ expect(sidebarUpperSource.slice(idx, idx + 700), marker).toContain('<MainListScopeHeader');
+ }
+ // 空账户 / 只剩置顶:ProjectsSection 不再因无内容整段 return null。
+ expect(projectsSectionSource).toContain('const hasMainListContent =');
+ expect(projectsSectionSource).toContain('{hasMainListContent ? (');
});
- it('项目段头标题即 MachineSwitcherMenu(2026-08-13 定稿,推翻 2026-07「不挂段头」)', () => {
- expect(projectsSectionSource).toContain("from '../MachineSwitcherMenu'");
- expect(projectsSectionSource).toContain('<MachineSwitcherMenu />');
+ it('项目段头标题即范围下拉(2026-08-13 定稿,推翻 2026-07「不挂段头」)', () => {
+ expect(projectsSectionSource).toContain("from '../MainListScopeHeader'");
+ expect(projectsSectionSource).toContain('<MainListScopeHeader');
// 段头不再渲染硬编码的「全部任务」标题(标题文字由菜单 trigger 按范围决定)。
expect(projectsSectionSource).not.toContain("t('ccAgent.sidebar.allSessions')");
// 段级收起随合并取消:标题的点击语义让给范围切换。
@@ -370,7 +394,8 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
});
it('MachineSwitcherMenu 展开菜单无标题行、无 trigger tooltip', () => {
- // 「远程机器」标题行已移除(2026-07 用户定稿),菜单直接从「所有」开始;也不包 <Tip>。
+ // 「远程机器」标题行已移除(2026-07 用户定稿);有远程时菜单从「所有」开始,
+ // 无远程时从两个设置入口开始。trigger 也不包 <Tip>。
expect(menuSource).not.toContain('py-1.5 text-xs font-medium');
expect(menuSource).not.toMatch(/<Tip\b/);
expect(menuSource).not.toContain("from '@/components/ui/tooltip'");
@@ -423,15 +448,18 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(menuSource).not.toContain('role="checkbox"');
});
- it('multiSelect / deselect 在全部语言包都存在(规则 18:不留英文回退)', () => {
+ it('multiSelect / deselect / menuTrigger 在全部语言包都存在,且不再叫远程机器', () => {
for (const locale of ['zh-CN', 'zh-TW', 'en', 'ja', 'ko']) {
const json = JSON.parse(read('i18n', 'locales', locale, 'common.json')) as {
ccAgent: { sidebar: { machineSwitcher: Record<string, string> } };
};
- for (const key of ['multiSelect', 'deselect']) {
+ for (const key of ['multiSelect', 'deselect', 'menuTrigger']) {
const value = json.ccAgent.sidebar.machineSwitcher[key];
expect(value, `locale ${locale} 缺 ${key}`).toBeTruthy();
}
+ expect(json.ccAgent.sidebar.machineSwitcher.menuTrigger).not.toMatch(
+ /远程机器|遠端機器|Remote machines|リモートマシン|원격 기기/,
+ );
}
});
@@ -444,16 +472,39 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(menuSource).toContain('<Loader2 size={12} strokeWidth={1.8} />');
});
- it('MachineSwitcherMenu 保留设备选择 / 远程设置入口;无远程时退化为静态标题', () => {
- // 段头恒在:无远程设备时渲染纯静态「全部任务」标题,而不是消失(旧 return null)。
+ it('MachineSwitcherMenu 保留设备选择 / 显示设置 / 远程设置入口;无远程时仍带箭头只留设置项', () => {
+ // 段头恒在:无远程设备时不再退化成不可点的静态标题(旧 return <span>),
+ // 箭头保留,菜单只渲染两个设置入口、不出现设备列表。
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).not.toMatch(
+ /if \(!hasRemote\) \{\s*\n\s*return <span className=\{SCOPE_TITLE_CLASS\}>/,
);
+ // 设备列表只看当前 devices.length,不把「目录已空、raw 仍记远端」当成还有远程。
+ expect(menuSource).toContain('const showDeviceList = devices.length > 0');
+ expect(menuSource).toContain('{showDeviceList ? (');
+ expect(menuSource).toContain('{settingsItems}');
expect(menuSource).toContain('MACHINE_ALL');
expect(menuSource).toContain('MACHINE_LOCAL');
expect(menuSource).toContain("navigate('/settings?tab=remote-control')");
expect(menuSource).toContain('useMachineSwitcher');
+ // 范围菜单底部:远程连接设置在上、侧边栏显示设置在下;点后者后等本菜单关完
+ // 再开段头那份菜单,避免两个 Radix 菜单抢焦点把新开的立刻关掉。
+ expect(menuSource).toContain('onOpenDisplaySettings');
+ expect(menuSource).toContain("t('ccAgent.sidebar.organizeSidebar')");
+ expect(menuSource).toContain('window.setTimeout(() => onOpenDisplaySettings(), 0)');
+ expect(menuSource).toContain('<MonitorCog size={14} strokeWidth={2}');
+ expect(menuSource).toContain('<SlidersHorizontal size={14} strokeWidth={2}');
+ expect(menuSource).not.toContain('EllipsisVertical');
+ // 设置项抽到 settingsItems:有远程时先画设备列表再 separator,再插入该片段;
+ // 无远程时菜单只有这一段。片段内部远程连接设置在上、显示设置在下。
+ const settingsItemsIndex = menuSource.indexOf('{settingsItems}');
+ const separatorIndex = menuSource.indexOf('<DropdownMenuSeparator');
+ expect(settingsItemsIndex).toBeGreaterThan(separatorIndex);
+ const remoteSettingsIndex = menuSource.indexOf(
+ "t('ccAgent.sidebar.machineSwitcher.remoteSettings')",
+ );
+ const displaySettingsIndex = menuSource.indexOf("t('ccAgent.sidebar.organizeSidebar')");
+ expect(displaySettingsIndex).toBeGreaterThan(remoteSettingsIndex);
});
it('非会话视图选机器时切回会话视图(与新建 / 搜索行同惯例,Codex P2)', () => {
@@ -491,7 +542,7 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
it('SidebarFilterPopover 点击展开(2026-08-12 用户裁决,推翻早前的 hover 自动展开)', () => {
const filterSource = read('features', 'cc-agent', 'sidebar', 'SidebarFilterPopover.tsx');
- // 整理菜单改回普通 Radix 点击开合:hover 机制整套摘除(MachineSwitcherMenu 仍保留 hover)。
+ // 显示设置菜单改回普通 Radix 点击开合:hover 机制整套摘除。
// 断言按「是否真的接线」判定,不按字符串出现——文件头注释会提到 useHoverOpenMenu 这个名字。
expect(filterSource).not.toContain("from './useHoverOpenMenu'");
expect(filterSource).not.toMatch(/useHoverOpenMenu\(/);
@@ -512,7 +563,7 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
);
});
- it('整理菜单无自身标题行,且高度按可用空间收口可滚动(2026-08-12 用户裁决)', () => {
+ it('显示设置菜单无自身标题行,且高度按可用空间收口可滚动(2026-08-12 用户裁决)', () => {
const filterSource = read('features', 'cc-agent', 'sidebar', 'SidebarFilterPopover.tsx');
// 标题行去掉节约高度(与 MachineSwitcherMenu 2026-07 的「无标题行」同规);
// organizeSidebar 文案仍被 trigger tooltip 消费,不是孤儿 key(规则 18)。
diff --git a/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts
index 3b1e1b8710..7eea1e8668 100644
--- a/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/projectsSidebarSection.test.ts
@@ -4,7 +4,7 @@
* 2026-08-13 用户定稿:段头标题即机器范围下拉(MachineSwitcherMenu,「全部任务」
* 与设备下拉合并),段级收起取消;右侧保留折叠按钮(单层 = 收起所有分组 ↔ 展开;
* 设备+项目双层 = 循环 收项目层 → 收设备层 → 全部展开,foldState 状态机)与
- * 整理菜单入口。
+ * 侧边栏显示设置入口。
*/
import { readFileSync } from 'node:fs';
@@ -37,14 +37,21 @@ describe('Projects sidebar section', () => {
});
it('header order: scope title dropdown → fold → filter', () => {
- const titleIndex = projectsSectionSource.indexOf('<MachineSwitcherMenu />');
- const foldIndex = projectsSectionSource.indexOf('onClick={handleFoldAll}');
- const filterIndex = projectsSectionSource.indexOf('<SidebarFilterPopover');
+ const titleIndex = projectsSectionSource.indexOf('<MainListScopeHeader');
+ const foldIndex = projectsSectionSource.indexOf('onClick: handleFoldAll');
expect(titleIndex).toBeGreaterThanOrEqual(0);
expect(foldIndex).toBeGreaterThan(titleIndex);
- expect(filterIndex).toBeGreaterThan(foldIndex);
- // 折叠按钮恒显(不再有段收起时隐藏的分支)。
- expect(projectsSectionSource).toMatch(/\{foldState !== null && \(\s*<Tip text=\{foldLabel\}/);
+ expect(projectsSectionSource).toContain('hasMainListContent && foldState !== null');
+ // 只有对话组、没有项目时折叠按钮仍可用;零项目不能把 isAllCollapsed 当成组层已收齐。
+ expect(projectsSectionSource).toContain(
+ 'disabled: projectNodesToggleDisabled && !hasDeviceLayer && !hasGroupLayer',
+ );
+ expect(projectsSectionSource).toContain(
+ "const hasVisibleProjectGroups = mixedEntries.some((entry) => entry.kind === 'project')",
+ );
+ expect(projectsSectionSource).toContain(
+ 'const allGroupsCollapsed = hasVisibleProjectGroups',
+ );
});
// 2026-08-12 用户裁决:段头「新建项目」按钮暂时移除(同一动作在新任务页的工作
@@ -57,20 +64,31 @@ describe('Projects sidebar section', () => {
});
it('only shows project header actions while hovering or focusing the Projects header row', () => {
- expect(projectsSectionSource).toContain('group/sidebar-header flex h-6');
- expect(projectsSectionSource).toContain(
+ const headerSource = readFileSync(
+ resolve(
+ __dirname,
+ '..',
+ 'features',
+ 'cc-agent',
+ 'sidebar',
+ 'MainListScopeHeader.tsx',
+ ),
+ 'utf8',
+ );
+ expect(headerSource).toContain('group/sidebar-header flex h-6');
+ expect(headerSource).toContain(
'pointer-events-none opacity-0 transition-opacity duration-150',
);
- expect(projectsSectionSource).toContain(
+ expect(headerSource).toContain(
'group-hover/sidebar-header:pointer-events-auto group-hover/sidebar-header:opacity-100',
);
- expect(projectsSectionSource).toContain(
+ expect(headerSource).toContain(
'has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100',
);
- expect(projectsSectionSource).not.toContain(
+ expect(headerSource).not.toContain(
'group-focus-within/sidebar-header:pointer-events-auto',
);
- expect(projectsSectionSource).toContain('className={HEADER_ACTIONS_CLASS}');
+ expect(headerSource).toContain('className={HEADER_ACTIONS_CLASS}');
});
it('the project tree renders unconditionally (section collapse removed)', () => {
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
index 98ede89ca0..099242b578 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@@ -64,6 +64,7 @@ import { setSessionOrdinalBadges } from './sidebar/sessionOrdinalBadges';
import { useOwnTopNavScrollableRows, useSidebarCollapsedState } from '../feature-context';
import { SidebarTopNav } from '@/components/sidebar/SidebarTopNav';
import { SidebarFilterPopover } from './sidebar/SidebarFilterPopover';
+import { MainListScopeHeader } from './sidebar/MainListScopeHeader';
import { stripTrailingPathSeparators } from '../../../shared/pathText';
import { useRefreshWorktrees } from '@/contexts/WorktreeContext';
import {
@@ -1641,6 +1642,11 @@ function ExpandedView({
visibleUnclassified.length > 0 ||
visibleProjectsWithVendor.length > 0 ||
visibleDialogues.length > 0;
+ // 与 ProjectsSection.deviceGroupingAvailable 同一门控:范围收窄到单台机器时
+ // 「按设备分组」选项隐藏。占位分支也要挂范围标题,不能各写一份。
+ const deviceGroupingAvailable =
+ (remoteDeviceIndex?.size ?? 0) > 0 &&
+ !(selectedMachineId !== MACHINE_ALL && selectedMachineId.length === 1);
const [selectedSessionIds, setSelectedSessionIds] = useState<Set<string>>(() => new Set());
const [selectionAnchorSessionId, setSelectionAnchorSessionId] = useState<string | null>(null);
@@ -3073,36 +3079,71 @@ function ExpandedView({
(rail 走 CollapsedView 自己的图标入口),无需再判折叠。 */}
<SidebarTopNav section="scrollable" />
{remoteDeviceDirectoryStatus === 'error' && !hasVisibleSidebarContent ? (
- <RemoteSidebarLoadNotice
- kind="devices"
- status="error"
- partial={false}
- onRetry={retryDeviceLinkDeviceList}
- />
+ <>
+ <MainListScopeHeader
+ filter={filter}
+ allKnownProjects={visibleProjectUniverse}
+ hasRemoteDevices={deviceGroupingAvailable}
+ />
+ <RemoteSidebarLoadNotice
+ kind="devices"
+ status="error"
+ partial={false}
+ onRetry={retryDeviceLinkDeviceList}
+ />
+ </>
) : remoteSessionBootstrapFailures.length > 0 && !hasVisibleSidebarContent ? (
- <RemoteSidebarLoadNotice
- kind="tasks"
- status="error"
- deviceLabel={failedRemoteDeviceLabel}
- partial={false}
- />
+ <>
+ <MainListScopeHeader
+ filter={filter}
+ allKnownProjects={visibleProjectUniverse}
+ hasRemoteDevices={deviceGroupingAvailable}
+ />
+ <RemoteSidebarLoadNotice
+ kind="tasks"
+ status="error"
+ deviceLabel={failedRemoteDeviceLabel}
+ partial={false}
+ />
+ </>
) : remoteDeviceDirectoryStatus === 'loading' && !hasVisibleSidebarContent ? (
- <RemoteSidebarLoadNotice kind="devices" status="loading" partial={false} />
+ <>
+ <MainListScopeHeader
+ filter={filter}
+ allKnownProjects={visibleProjectUniverse}
+ hasRemoteDevices={deviceGroupingAvailable}
+ />
+ <RemoteSidebarLoadNotice kind="devices" status="loading" partial={false} />
+ </>
) : remoteSessionBootstrapLoadingDevices.length > 0 && !hasVisibleSidebarContent ? (
- <RemoteSidebarLoadNotice
- kind="tasks"
- status="loading"
- deviceLabel={loadingRemoteDeviceLabel}
- partial={false}
- />
+ <>
+ <MainListScopeHeader
+ filter={filter}
+ allKnownProjects={visibleProjectUniverse}
+ hasRemoteDevices={deviceGroupingAvailable}
+ />
+ <RemoteSidebarLoadNotice
+ kind="tasks"
+ status="loading"
+ deviceLabel={loadingRemoteDeviceLabel}
+ partial={false}
+ />
+ </>
) : selectedMachineConnecting ? (
// 选中机器连接中:会话还没同步,显示「连接中」而非「暂无对话」。
- // 机器切换入口在上方固定行常驻,始终能切回「所有」、不会被困在占位页。
- <div className="flex flex-col items-center justify-center px-3 py-12 text-center">
- <span className="animate-pulse text-xs text-[var(--text-tertiary)]">
- {t('ccAgent.sidebar.machineSwitcher.connecting')}
- </span>
- </div>
+ // 范围标题恒在,可从菜单切回「所有 / 本机」,不会被困在占位页。
+ <>
+ <MainListScopeHeader
+ filter={filter}
+ allKnownProjects={visibleProjectUniverse}
+ hasRemoteDevices={deviceGroupingAvailable}
+ />
+ <div className="flex flex-col items-center justify-center px-3 py-12 text-center">
+ <span className="animate-pulse text-xs text-[var(--text-tertiary)]">
+ {t('ccAgent.sidebar.machineSwitcher.connecting')}
+ </span>
+ </div>
+ </>
) : (
<>
{remoteDeviceDirectoryStatus === 'error' && (
@@ -3254,10 +3295,7 @@ function ExpandedView({
allKnownProjects={visibleProjectUniverse}
// 与段头实例同一门控:范围收窄到单台机器时「按设备分组」选项隐藏
// (2026-08-13 用户定稿,详见 ProjectsSection.deviceGroupingAvailable)。
- hasRemoteDevices={
- (remoteDeviceIndex?.size ?? 0) > 0 &&
- !(selectedMachineId !== MACHINE_ALL && selectedMachineId.length === 1)
- }
+ hasRemoteDevices={deviceGroupingAvailable}
contextMenuPos={organizeMenuPos}
onContextMenuOpenChange={(open) => {
if (!open) setOrganizeMenuPos(null);
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/sidebarInstallVintage.ts b/apps/desktop/src/renderer/features/cc-agent/lib/sidebarInstallVintage.ts
index ff6e8dd98e..41060afcd0 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/sidebarInstallVintage.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/sidebarInstallVintage.ts
@@ -19,7 +19,7 @@
*
* 边界:这是启发式,不是精确考古。误判的代价是有限且对称的——把老用户误判成新装
* (他清过缓存)会让他看到列表视图;把新装误判成老用户(极罕见)会让他看到文字
- * 视图。两者都只是显示密度差异,用户在「整理侧边栏 → 显示」里一键可改,且改完就
+ * 视图。两者都只是显示密度差异,用户在「侧边栏显示设置 → 显示」里一键可改,且改完就
* 落盘、此后与本模块无关。
*/
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 7013597752..3010e97414 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/MachineSwitcherMenu.tsx
@@ -4,16 +4,19 @@
* 2026-08-13 用户定稿(新设计,显式推翻两条 2026-07 旧定稿):
* - 「全部任务」段头与设备下拉**合并**——标题文字反映当前范围(全部任务 /
* 本机任务 / 设备名 / N 台机器),点击标题弹出「所有 / 本机 / 各远程设备」
- * 切换 + 「远程连接设置」入口。顶部导航不再有独立的远程机器行,省一行;
+ * 切换 + 「远程连接设置」/「侧边栏显示设置」入口。顶部导航不再有独立的远程
+ * 机器行,省一行;
* 标题不再撒谎(旧结构下范围收窄后段头仍写「全部任务」)。
* (推翻 2026-07 「切换器收进 SidebarTopNav 末行、不挂段头」——当年是段头
* 挂配件,现在段头本身就是切换器,语境已不同。)
* - **点击展开**,不再 hover 自动展开(推翻 2026-07-12 hover 定稿):作为段头
* 标题,hover 扫过就弹菜单太吵;段级收起同时取消,标题的点击语义让给范围切换。
*
- * 无任何相关远程机器时**退化为纯静态标题**「全部任务」(无箭头、不可点)——
- * 段头恒在,这正是它必须与「全部任务」合并而不是反向合并的原因;若断网导致设备
- * 目录与远端分片都清空,但 raw 选择仍指向远端,保留下拉让用户切回本机。
+ * 无任何相关远程机器时标题仍是「全部任务 ▾」(2026-08-13 用户裁决:箭头保留),
+ * 菜单不出现设备列表,只留「远程连接设置」与「侧边栏显示设置」——单机用户看不到
+ * 设备概念,但仍能从段头进这两项。范围标题恒在后,断网逃生不再靠「假装还有
+ * 远程设备」画出机器列表——目录空了就只留两项设置,用户从「远程连接设置」
+ * 或范围标题本身回到本机。
*
* 机器选择:**默认单选、多选框另走多选**(2026-07 用户定稿):
* - 「所有」→ 重置回默认(本机 + 全部远程),菜单关闭;
@@ -48,10 +51,11 @@ import {
Ban,
Check,
ChevronDown,
- EllipsisVertical,
Loader2,
Monitor,
+ MonitorCog,
MonitorSmartphone,
+ SlidersHorizontal,
} from 'lucide-react';
import { useMatch, useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -81,10 +85,18 @@ import { MENU_CONTENT_CLASS, MENU_ITEM_CLASS, MENU_SEPARATOR_CLASS } from './men
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 {
+export function MachineSwitcherMenu({
+ onOpenDisplaySettings,
+}: {
+ /** 打开段头同一份「侧边栏显示设置」菜单;不传则不渲染该入口。 */
+ onOpenDisplaySettings?: () => void;
+} = {}): ReactNode {
const { t } = useTranslation();
const navigate = useNavigate();
- const { devices, selectedDeviceId, hasRemote, select, toggle } = useMachineSwitcher();
+ const { devices, selectedDeviceId, select, toggle } = useMachineSwitcher();
+ // 设备列表只看当前是否真有可展示的远程设备。hasRemote 还会把「目录已空、
+ // raw 仍记着远端」算进去——那是旧逃生口,标题恒在后会误画出「所有 / 本机」。
+ const showDeviceList = devices.length > 0;
// 段头标题是远程任务读取状态的固定承载点。后台 bootstrap 时只更新这一行,
// 不再把 loading 提示插入下方会话列表,避免列表整体上下跳动。
const remoteSessionBootstrapLoading = useRemoteSessionBootstrapLoading(selectedDeviceId);
@@ -115,17 +127,36 @@ export function MachineSwitcherMenu(): ReactNode {
ensureConversationListVisible();
};
- // 无任何相关远程机器、也没有需要逃生的悬空远端选择 → 纯静态标题
- // (段头恒在;与「按设备分组」选项同一出现条件,本机用户看不到任何设备概念)。
- if (!hasRemote) {
- return <span className={SCOPE_TITLE_CLASS}>{t('ccAgent.sidebar.allSessions')}</span>;
- }
-
const triggerLabel = t('ccAgent.sidebar.machineSwitcher.menuTrigger');
+ const settingsItems = (
+ <>
+ <DropdownMenuItem
+ className={MENU_ITEM_CLASS}
+ onSelect={() => navigate('/settings?tab=remote-control')}
+ >
+ <MonitorCog size={14} strokeWidth={2} className="shrink-0 opacity-70" />
+ <span className="truncate">{t('ccAgent.sidebar.machineSwitcher.remoteSettings')}</span>
+ </DropdownMenuItem>
+ {onOpenDisplaySettings ? (
+ <DropdownMenuItem
+ className={MENU_ITEM_CLASS}
+ onSelect={() => {
+ // 等本菜单关完、当前指针事件走完再开显示设置,避免两个 Radix
+ // 菜单抢焦点、或同一次 click 被新菜单当成点外部而立刻关掉。
+ window.setTimeout(() => onOpenDisplaySettings(), 0);
+ }}
+ >
+ <SlidersHorizontal size={14} strokeWidth={2} className="shrink-0 opacity-70" />
+ <span className="truncate">{t('ccAgent.sidebar.organizeSidebar')}</span>
+ </DropdownMenuItem>
+ ) : null}
+ </>
+ );
+
// 标题文字 = 当前范围(2026-08-13 定稿:标题回答"我正在看什么"):
- // 「所有」→「全部任务」;本机 →「本机任务」;单设备 → 设备名;多选 → 「N 台机器」。
+ // 「所有」/ 无远程 →「全部任务」;本机 →「本机任务」;单设备 → 设备名;多选 → 「N 台机器」。
let triggerText = t('ccAgent.sidebar.allSessions');
- if (selectedDeviceId !== MACHINE_ALL) {
+ if (showDeviceList && selectedDeviceId !== MACHINE_ALL) {
if (selectedDeviceId.length === 1) {
const only = selectedDeviceId[0];
triggerText =
@@ -175,48 +206,46 @@ export function MachineSwitcherMenu(): ReactNode {
sideOffset={4}
className={cn(MENU_CONTENT_CLASS, 'min-w-48')}
>
- <MachineMenuItem
- label={t('ccAgent.sidebar.machineSwitcher.allMachines')}
- selected={selectedDeviceId === MACHINE_ALL}
- onSelect={() => applySelect(MACHINE_ALL)}
- />
- <MachineMenuItem
- icon={<Monitor size={14} strokeWidth={2} />}
- label={t('ccAgent.sidebar.machineSwitcher.localMachine')}
- selected={isMachineSelected(selectedDeviceId, MACHINE_LOCAL)}
- onSelect={() => applySelect([MACHINE_LOCAL])}
- onToggle={() => applyToggle(MACHINE_LOCAL)}
- />
- {devices.map((device) => {
- const rejected = device.status === 'rejected';
- const connecting = device.status === 'connecting';
- return (
+ {showDeviceList ? (
+ <>
<MachineMenuItem
- key={device.deviceId}
- icon={<MonitorSmartphone size={14} strokeWidth={2} />}
- label={device.name}
- selected={isMachineSelected(selectedDeviceId, device.deviceId)}
- shimmer={connecting}
- rejected={rejected}
- // 被拒:不切换,弹提示(菜单保持打开);已连接 / 连接中:单选切换或
- // 多选框勾选(连接中勾上先空、同步完填充)。
- onSelect={
- rejected
- ? () => toast.warning(t('settings.remoteControl.accessRevokedByPeer'))
- : () => applySelect([device.deviceId])
- }
- onToggle={rejected ? undefined : () => applyToggle(device.deviceId)}
+ label={t('ccAgent.sidebar.machineSwitcher.allMachines')}
+ selected={selectedDeviceId === MACHINE_ALL}
+ onSelect={() => applySelect(MACHINE_ALL)}
/>
- );
- })}
- <DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
- <DropdownMenuItem
- className={MENU_ITEM_CLASS}
- onSelect={() => navigate('/settings?tab=remote-control')}
- >
- <EllipsisVertical size={14} strokeWidth={2} className="shrink-0 opacity-70" />
- <span className="truncate">{t('ccAgent.sidebar.machineSwitcher.remoteSettings')}</span>
- </DropdownMenuItem>
+ <MachineMenuItem
+ icon={<Monitor size={14} strokeWidth={2} />}
+ label={t('ccAgent.sidebar.machineSwitcher.localMachine')}
+ selected={isMachineSelected(selectedDeviceId, MACHINE_LOCAL)}
+ onSelect={() => applySelect([MACHINE_LOCAL])}
+ onToggle={() => applyToggle(MACHINE_LOCAL)}
+ />
+ {devices.map((device) => {
+ const rejected = device.status === 'rejected';
+ const connecting = device.status === 'connecting';
+ return (
+ <MachineMenuItem
+ key={device.deviceId}
+ icon={<MonitorSmartphone size={14} strokeWidth={2} />}
+ label={device.name}
+ selected={isMachineSelected(selectedDeviceId, device.deviceId)}
+ shimmer={connecting}
+ rejected={rejected}
+ // 被拒:不切换,弹提示(菜单保持打开);已连接 / 连接中:单选切换或
+ // 多选框勾选(连接中勾上先空、同步完填充)。
+ onSelect={
+ rejected
+ ? () => toast.warning(t('settings.remoteControl.accessRevokedByPeer'))
+ : () => applySelect([device.deviceId])
+ }
+ onToggle={rejected ? undefined : () => applyToggle(device.deviceId)}
+ />
+ );
+ })}
+ <DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
+ </>
+ ) : null}
+ {settingsItems}
</DropdownMenuContent>
</DropdownMenu>
);
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
new file mode 100644
index 0000000000..80b8310efb
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
@@ -0,0 +1,85 @@
+/**
+ * MainListScopeHeader — 主列表范围标题行。
+ * ---------------------------------------------------------------------------
+ * 范围标题必须恒在(2026-08-13 定稿 + 第 4 轮 review P1):空账户、只剩置顶、
+ * 远程目录 / 任务全屏 loading/error、所选设备连接中,都不能把「全部任务 ▾」
+ * 和两项设置入口摘掉。ProjectsSection 有内容时画完整段头(含折叠按钮);
+ * 无内容或父级占位分支只画这一行。
+ */
+import { useState, type ReactNode } from 'react';
+import type { LucideIcon } from 'lucide-react';
+
+import { cn } from '@/lib/utils';
+import { Tip } from '@/components/ui/tooltip';
+import { MachineSwitcherMenu } from './MachineSwitcherMenu';
+import { SidebarFilterPopover } from './SidebarFilterPopover';
+import type { ProjectNode as ProjectNodeData } from '../lib/projectGrouping';
+import type { UseSidebarFilterReturn } from '../hooks/useSidebarFilter';
+
+const HEADER_HOVER_ACTION_CLASS = cn(
+ 'pointer-events-none opacity-0 transition-opacity duration-150',
+ 'group-hover/sidebar-header:pointer-events-auto group-hover/sidebar-header:opacity-100',
+ // Pointer click focus must not pin these hover-only actions after the mouse leaves.
+ // Keyboard focus-visible still reveals them for tab navigation.
+ 'has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100',
+ // 段头内任一菜单(范围下拉 / 侧边栏显示设置)展开时(其 trigger 带 data-state=open),
+ // 整排 action 保持可见——鼠标移进展开的菜单、段头不再 hover 时,其它按钮不该消失。
+ 'group-has-[[data-state=open]]/sidebar-header:pointer-events-auto group-has-[[data-state=open]]/sidebar-header:opacity-100',
+);
+
+const HEADER_ACTIONS_CLASS = cn('flex items-center gap-0.5 -mt-px', HEADER_HOVER_ACTION_CLASS);
+
+export function MainListScopeHeader({
+ filter,
+ allKnownProjects,
+ hasRemoteDevices,
+ fold = null,
+}: {
+ filter: UseSidebarFilterReturn;
+ allKnownProjects: ProjectNodeData[];
+ hasRemoteDevices: boolean;
+ fold?: {
+ label: string;
+ Icon: LucideIcon;
+ onClick: () => void;
+ disabled: boolean;
+ } | null;
+}): ReactNode {
+ 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)} />
+ </div>
+ <div className="flex items-center gap-0.5 -mt-px">
+ <div className={HEADER_ACTIONS_CLASS}>
+ {fold ? (
+ <Tip text={fold.label} side="bottom">
+ <button
+ type="button"
+ onClick={fold.onClick}
+ disabled={fold.disabled}
+ aria-label={fold.label}
+ className={cn(
+ 'flex h-7 w-7 items-center justify-center rounded-md',
+ 'text-[var(--sidebar-list-muted)]',
+ 'transition-colors hover:text-[var(--sidebar-nav-text)]',
+ 'disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent',
+ )}
+ >
+ <fold.Icon size={14} strokeWidth={2} />
+ </button>
+ </Tip>
+ ) : null}
+ <SidebarFilterPopover
+ filter={filter}
+ allKnownProjects={allKnownProjects}
+ hasRemoteDevices={hasRemoteDevices}
+ open={displaySettingsOpen}
+ onOpenChange={setDisplaySettingsOpen}
+ />
+ </div>
+ </div>
+ </div>
+ );
+}
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 8b7118272c..45f5acb4fa 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
@@ -1,5 +1,5 @@
/**
- * SidebarFilterPopover — Sidebar 整理菜单
+ * SidebarFilterPopover — 侧边栏显示设置菜单
* ---------------------------------------------------------------------------
* 菜单分四段语义(侧边栏重设计,docs/product-rules/sidebar-redesign-plan.md §3):
* - 分组:独立复选——按项目分组 / 按设备分组(仅远程连接时出现)/ 对话归为一组
@@ -166,6 +166,12 @@ export interface SidebarFilterPopoverProps {
contextMenuPos?: { x: number; y: number } | null;
/** 受控模式下的关闭回调(点外部 / Esc / 选中项)。 */
onContextMenuOpenChange?: (open: boolean) => void;
+ /**
+ * 段头按钮模式的受控开合。范围菜单里的「侧边栏显示设置」入口用它把同一份
+ * 菜单打开;与 contextMenuPos 互斥——受控光标模式仍走上面那对 prop。
+ */
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
}
function optionLabel<T extends string>(
@@ -310,6 +316,8 @@ export function SidebarFilterPopover({
hasRemoteDevices = false,
contextMenuPos,
onContextMenuOpenChange,
+ open,
+ onOpenChange,
}: SidebarFilterPopoverProps) {
const { t } = useTranslation();
// 受控光标模式 = 调用方传了 contextMenuPos 这个 prop(值为 null 表示"当前关闭",
@@ -402,9 +410,11 @@ export function SidebarFilterPopover({
{...(isContextMode
? {
open: contextMenuPos !== null,
- onOpenChange: (open: boolean) => onContextMenuOpenChange?.(open),
+ onOpenChange: (next: boolean) => onContextMenuOpenChange?.(next),
}
- : null)}
+ : open !== undefined
+ ? { open, onOpenChange }
+ : null)}
>
<DropdownMenuTrigger asChild>
{isContextMode ? (
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 80a0ad0769..825ef55e5e 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
@@ -13,7 +13,8 @@
* · 包含 UnclassifiedSection(若有)+ ProjectNode 列表
*
* ProjectNode 的展开折叠由父层受控;段级收起是本组件内的纯 UI 状态。
- * projects + unclassified 都为空时整段不渲染。
+ * 完全没有 project / 未分类 / 对话时仍渲染范围标题行(2026-08-13 第 4 轮
+ * review P1:段头恒在),列表树不画。
*
* 拖拽:sortBy === 'manual' 时由 SortableList (SortableJS) 接管整行拖拽;
* 其它排序模式 disabled。落定后通过 filter.setManualProjectOrder 写回。
@@ -35,7 +36,6 @@ 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';
@@ -69,7 +69,7 @@ import {
useRemoteSessionActivityRevision,
} from '@/features/device-link/remoteSessionActivityStore';
import type { DialogueDeviceTarget } from '../../lib/dialogueCreateTarget';
-import { SidebarFilterPopover } from '../SidebarFilterPopover';
+import { MainListScopeHeader } from '../MainListScopeHeader';
import { SectionCollapse } from '../SectionCollapse';
import { SessionEntryList } from '../SessionEntryList';
import { useCollapsibleShowAll } from '../hooks/useCollapsibleShowAll';
@@ -85,19 +85,6 @@ import type { Session } from '@/lib/ccAgent.types';
import type { FolderPickerOption } from '@/components/new-chat/FolderPickerPopover';
import type { SessionMoveTarget } from '../sessionMoveTarget';
-const HEADER_HOVER_ACTION_CLASS = cn(
- 'pointer-events-none opacity-0 transition-opacity duration-150',
- 'group-hover/sidebar-header:pointer-events-auto group-hover/sidebar-header:opacity-100',
- // Pointer click focus must not pin these hover-only actions after the mouse leaves.
- // Keyboard focus-visible still reveals them for tab navigation.
- 'has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100',
- // 段头内任一菜单(远程机器 / 整理侧边栏)展开时(其 trigger 带 data-state=open),
- // 整排 action 保持可见——鼠标移进展开的菜单、段头不再 hover 时,其它按钮不该消失。
- 'group-has-[[data-state=open]]/sidebar-header:pointer-events-auto group-has-[[data-state=open]]/sidebar-header:opacity-100',
-);
-
-const HEADER_ACTIONS_CLASS = cn('flex items-center gap-0.5 -mt-px', HEADER_HOVER_ACTION_CLASS);
-
/** 设备段折叠/对话组折叠共用的段 key:本机段 'local',远程段用 deviceId。 */
const deviceSectionKey = (deviceId: string | null) => deviceId ?? 'local';
@@ -481,8 +468,17 @@ export function ProjectsSection({
.filter((section) => section.entries.some((entry) => entry.kind === 'dialogue-group'))
.map((section) => deviceSectionKey(section.deviceId));
}, [deviceGroupingActive, visibleMixedEntries, deviceSections]);
- const allGroupsCollapsed =
- isAllCollapsed && visibleDialogueGroupKeys.every((key) => collapsedDialogueGroups.has(key));
+ const allDialogueGroupsCollapsed =
+ visibleDialogueGroupKeys.length === 0 ||
+ visibleDialogueGroupKeys.every((key) => collapsedDialogueGroups.has(key));
+ // 组层是否收齐必须看**当前范围**有没有项目行。allKnownProjects 是全机器宇宙,
+ // 单机范围下本机只有对话组、远端仍有项目时 length>0;isAllCollapsed 却来自
+ // 当前范围的 activeWorkingDirs,此时为空并恒为 false,foldState 会卡在
+ // collapse-groups。有可见项目行才并上 isAllCollapsed。
+ const hasVisibleProjectGroups = mixedEntries.some((entry) => entry.kind === 'project');
+ const allGroupsCollapsed = hasVisibleProjectGroups
+ ? isAllCollapsed && allDialogueGroupsCollapsed
+ : allDialogueGroupsCollapsed;
const hasDeviceLayer = deviceGroupingActive && deviceSections.length > 0;
const allDevicesCollapsed =
hasDeviceLayer &&
@@ -534,16 +530,14 @@ export function ProjectsSection({
// F-PJ-10:即使 projects 因 filter 收窄到空,也要保留段头供用户切回 Filter。
// 这里用原始 key 全集作为"是否有过任何 project"的判定 — 全部项目都被隐藏时
- // 仍保留段头的 Add Project 入口,用户才能重新选择目录恢复项目。完全没有 project、
- // 未分类与对话 → 整段不渲染。(早退必须在全部 hooks 之后——rules of hooks。)
- if (
- allProjectKeysForOrder.length === 0 &&
- unclassified.length === 0 &&
- dialogues.length === 0 &&
- !filter.isFilterActive
- ) {
- return null;
- }
+ // 仍保留段头,用户才能重新选择目录恢复项目。完全没有 project、未分类与对话
+ // 时仍画范围标题行(2026-08-13 第 4 轮 review P1:段头恒在),不画列表树。
+ // 早退必须在全部 hooks 之后——rules of hooks。
+ const hasMainListContent =
+ allProjectKeysForOrder.length > 0 ||
+ unclassified.length > 0 ||
+ dialogues.length > 0 ||
+ filter.isFilterActive;
// F-PJ-10:未分类区在 projects 为具体多选状态时不渲染(spec 验收第 14 条)
const unclassifiedHidden = filter.projects !== 'all';
@@ -669,59 +663,23 @@ export function ProjectsSection({
return (
<div className="flex flex-col gap-0.5 w-full">
- {/* Section Title — 左侧标题 + 段级收起箭头;右侧保留 ProjectNode 全部折叠 + Filter。
- pr-0:与下方 cells 子容器一样依赖 scrollbar-gutter:stable 预留 12px,
- 按钮组右边自然对齐 cell 右边。 */}
- <div className="group/sidebar-header flex h-6 items-center justify-between pr-0 pl-6">
- {/* 段标题 = 机器范围下拉(2026-08-13 用户定稿,「全部任务」与设备下拉合并):
- 标题文字反映当前范围(全部任务 / 本机任务 / 设备名 / N 台机器),点击弹
- 范围菜单;无远程设备时退化为纯静态标题。段级收起随之取消——标题的点击
- 语义让给范围切换,「想要紧凑」由右侧「收起所有分组」承接。 */}
- <div className="flex min-w-0 items-center gap-1">
- <MachineSwitcherMenu />
- </div>
- {/* 右侧工具组:ProjectNode Toggle All → Filter → New Project
- -mt-px:h-7 按钮在 h-6 行里中心对齐时视觉偏低,上移 1px 与 "Projects" 文字
- 视觉中线对齐 */}
- {/* 右侧:hover 才浮现的工具组(远程机器切换入口已移到侧栏顶部固定行,不在段头)。 */}
- <div className="flex items-center gap-0.5 -mt-px">
- <div className={HEADER_ACTIONS_CLASS}>
- {/* 「展开/收起所有分组」(E 期):单层 = 收起↔展开;设备+项目双层 =
- 循环 收项目层 → 收设备层 → 全部展开。tooltip 提示下一步动作。 */}
- {foldState !== null && (
- <Tip text={foldLabel} side="bottom">
- <button
- type="button"
- onClick={handleFoldAll}
- disabled={projectNodesToggleDisabled && !hasDeviceLayer}
- aria-label={foldLabel}
- className={cn(
- 'flex h-7 w-7 items-center justify-center rounded-md',
- 'text-[var(--sidebar-list-muted)]',
- 'transition-colors hover:text-[var(--sidebar-nav-text)]',
- 'disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent',
- )}
- >
- <FoldIcon size={14} strokeWidth={2} />
- </button>
- </Tip>
- )}
- {/* F-PJ-10:Filter Popover 入口。allKnownProjects 是未过滤前的 Project 全集。 */}
- <SidebarFilterPopover
- filter={filter}
- allKnownProjects={allKnownProjects}
- hasRemoteDevices={deviceGroupingAvailable}
- />
- {/* 「新建项目」按钮 2026-08-12 暂时移除(用户裁决):同一动作(选目录 →
- 预填新任务草稿)在新任务页的工作目录选择器里仍可完成。onCreateProject
- prop 与上游 handleCreateProject 保持接线,恢复入口只需重新渲染按钮。 */}
- </div>
- </div>
- </div>
-
- {/* Projects Tree — padding [4,0,0,12], gap 4(段级收起已取消,树恒渲染)
- pr-0:右侧依赖 scroll body 的 scrollbar-gutter:stable 预留 12px,
- 与左 pl-3 视觉对称;全局滚动条已收窄到 12px 与 pl-3 等宽。 */}
+ {/* 范围标题恒在:无列表内容时仍画这一行,不把设置入口一起摘掉。 */}
+ <MainListScopeHeader
+ filter={filter}
+ allKnownProjects={allKnownProjects}
+ hasRemoteDevices={deviceGroupingAvailable}
+ fold={
+ hasMainListContent && foldState !== null
+ ? {
+ label: foldLabel,
+ Icon: FoldIcon,
+ onClick: handleFoldAll,
+ disabled: projectNodesToggleDisabled && !hasDeviceLayer && !hasGroupLayer,
+ }
+ : null
+ }
+ />
+ {hasMainListContent ? (
<div className="relative flex flex-col gap-1 pt-1 pr-0 pl-3">
<UnclassifiedSection
sessions={unclassified}
@@ -872,6 +830,7 @@ export function ProjectsSection({
<ShowAllEntriesButton count={projectsTotal} onClick={() => setShowAllProjects(true)} />
)}
</div>
+ ) : null}
</div>
);
}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 43b577e3b9..29bc3d6616 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -6938,7 +6938,7 @@
"remoteSettings": "Remote connection settings",
"multiSelect": "Multi-select",
"deselect": "Deselect",
- "menuTrigger": "Remote machines",
+ "menuTrigger": "Session scope",
"selectedCount_one": "{{count}} machine",
"selectedCount_other": "{{count}} machines"
},
@@ -6978,8 +6978,8 @@
"createProjectFailed": "Failed to create project",
"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}})",
- "organizeSidebar": "Organize sidebar",
+ "filterAria": "Sidebar display settings (Status: {{status}}, Vendor: {{vendor}}, Last activity: {{lastActivity}}, Group by: {{groupBy}}, Sort by: {{sortBy}}, Projects: {{projects}})",
+ "organizeSidebar": "Sidebar display settings",
"filterAllText": "all",
"filterSelectedProjects": "{{count}} selected",
"filterStatus": {
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 88e14d3562..b24a53e712 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -6926,7 +6926,7 @@
"remoteSettings": "リモート接続設定",
"multiSelect": "複数選択",
"deselect": "選択を解除",
- "menuTrigger": "リモートマシン",
+ "menuTrigger": "タスク範囲",
"selectedCount_one": "{{count}} 台のマシン",
"selectedCount_other": "{{count}} 台のマシン"
},
@@ -6966,8 +6966,8 @@
"createProjectFailed": "プロジェクトの作成に失敗しました",
"projectsToggleExpand": "すべてのプロジェクトセッションを展開",
"projectsToggleCollapse": "すべてのプロジェクトセッションを折りたたむ",
- "filterAria": "サイドバー整理(ステータス:{{status}}、Agent:{{vendor}}、最終アクティビティ:{{lastActivity}}、グループ:{{groupBy}}、並び替え:{{sortBy}}、プロジェクト:{{projects}})",
- "organizeSidebar": "サイドバー整理",
+ "filterAria": "サイドバー表示設定(ステータス:{{status}}、Agent:{{vendor}}、最終アクティビティ:{{lastActivity}}、グループ:{{groupBy}}、並び替え:{{sortBy}}、プロジェクト:{{projects}})",
+ "organizeSidebar": "サイドバー表示設定",
"filterAllText": "すべて",
"filterSelectedProjects": "{{count}} 件選択",
"filterStatus": {
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index bae81d23e0..d9a67188b2 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -6926,7 +6926,7 @@
"remoteSettings": "원격 연결 설정",
"multiSelect": "다중 선택",
"deselect": "선택 해제",
- "menuTrigger": "원격 기기",
+ "menuTrigger": "세션 범위",
"selectedCount_one": "기기 {{count}}대",
"selectedCount_other": "기기 {{count}}대"
},
@@ -6966,8 +6966,8 @@
"createProjectFailed": "프로젝트 생성 실패",
"projectsToggleExpand": "모든 프로젝트 세션 펼치기",
"projectsToggleCollapse": "모든 프로젝트 세션 접기",
- "filterAria": "사이드바 정리(상태: {{status}}, Agent: {{vendor}}, 최근 활동: {{lastActivity}}, 그룹: {{groupBy}}, 정렬: {{sortBy}}, 프로젝트: {{projects}})",
- "organizeSidebar": "사이드바 정리",
+ "filterAria": "사이드바 표시 설정(상태: {{status}}, Agent: {{vendor}}, 최근 활동: {{lastActivity}}, 그룹: {{groupBy}}, 정렬: {{sortBy}}, 프로젝트: {{projects}})",
+ "organizeSidebar": "사이드바 표시 설정",
"filterAllText": "전체",
"filterSelectedProjects": "{{count}}개 선택됨",
"filterStatus": {
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 067878d563..048d2a55f2 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -6926,7 +6926,7 @@
"remoteSettings": "远程连接设置",
"multiSelect": "多选",
"deselect": "取消勾选",
- "menuTrigger": "远程机器",
+ "menuTrigger": "任务范围",
"selectedCount_one": "{{count}} 台机器",
"selectedCount_other": "{{count}} 台机器"
},
@@ -6966,8 +6966,8 @@
"createProjectFailed": "新建项目失败",
"projectsToggleExpand": "展开所有项目任务",
"projectsToggleCollapse": "收起所有项目任务",
- "filterAria": "整理侧边栏(状态:{{status}},Agent:{{vendor}},最近活跃:{{lastActivity}},分组:{{groupBy}},排序:{{sortBy}},项目:{{projects}})",
- "organizeSidebar": "整理侧边栏",
+ "filterAria": "侧边栏显示设置(状态:{{status}},Agent:{{vendor}},最近活跃:{{lastActivity}},分组:{{groupBy}},排序:{{sortBy}},项目:{{projects}})",
+ "organizeSidebar": "侧边栏显示设置",
"filterAllText": "全部",
"filterSelectedProjects": "已选 {{count}} 个",
"filterStatus": {
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 3c5b4496fb..354de9ea93 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -6926,7 +6926,7 @@
"remoteSettings": "遠端連線設定",
"multiSelect": "多選",
"deselect": "取消勾選",
- "menuTrigger": "遠端機器",
+ "menuTrigger": "任務範圍",
"selectedCount_one": "{{count}} 臺機器",
"selectedCount_other": "{{count}} 臺機器"
},
@@ -6966,8 +6966,8 @@
"createProjectFailed": "新建專案失敗",
"projectsToggleExpand": "展開所有專案任務",
"projectsToggleCollapse": "收起所有專案任務",
- "filterAria": "整理側邊欄(狀態:{{status}},Agent:{{vendor}},最近活躍:{{lastActivity}},分組:{{groupBy}},排序:{{sortBy}},專案:{{projects}})",
- "organizeSidebar": "整理側邊欄",
+ "filterAria": "側邊欄顯示設定(狀態:{{status}},Agent:{{vendor}},最近活躍:{{lastActivity}},分組:{{groupBy}},排序:{{sortBy}},專案:{{projects}})",
+ "organizeSidebar": "側邊欄顯示設定",
"filterAllText": "全部",
"filterSelectedProjects": "已選 {{count}} 個",
"filterStatus": {
diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.md
index cf21d8f449..ac0382e5ac 100644
--- a/docs/product-rules/sidebar-redesign-plan.md
+++ b/docs/product-rules/sidebar-redesign-plan.md
@@ -14,7 +14,7 @@
1. 所有内容(置顶与主列表)都能选择文字或列表方式显示;
2. 项目与对话不再固定分段,参考手机版的混排方式整合;
-3. 分组、排序、筛选、显示设置收敛进一个「整理侧边栏」菜单;
+3. 分组、排序、筛选、显示设置收敛进一个「侧边栏显示设置」菜单;
4. 概念上区分「范围」(段头标题下拉)、「分组」(复选)、「筛选」(收窄)、「显示」(形态)。
## 2. 信息架构
@@ -24,17 +24,22 @@
─────────── 以下随列表一起滚动 ───────────
[顶部导航] 自动任务 / 插件 / 搜索
[置顶区] 可折叠;会话与项目混排置顶,共享一份拖拽顺序(现状语义不变)
-[范围标题▾] 段头标题即机器范围下拉(全部任务 / 本机任务 / 设备名 / N 台机器)
-[主列表] 单一混排列表(见 §3)
+[范围标题▾] 主列表范围下拉,空态 / loading / 连接中也恒在
+[主列表] 单一混排列表(见 §3);无内容时只留范围标题行
```
**「全部任务」段头与设备下拉合并(2026-08-13 用户定稿,新设计,显式推翻两条
2026-07 旧定稿)**:
- 标题文字反映当前范围,点击标题弹出「所有 / 本机 / 各设备(单选 + 多选)+
- 远程连接设置」菜单——修掉旧结构的标题撒谎问题(范围收窄后段头仍写「全部任务」),
- 顶部导航省一行。范围菜单本体(单选/多选/三态/设置入口)沿用原件不变。
-- 无远程设备时标题退化为纯静态「全部任务」(无箭头不可点)——段头恒在,这是
- 合并方向只能是"下拉并入标题"而非反向的原因。
+ 侧边栏显示设置 / 远程连接设置」菜单——修掉旧结构的标题撒谎问题(范围收窄后
+ 段头仍写「全部任务」),顶部导航省一行。范围菜单本体(单选/多选/三态)沿用
+ 原件;底部设置入口并列「远程连接设置」与「侧边栏显示设置」(打开段头同一份菜单)。
+- 无远程设备时标题仍是「全部任务 ▾」(2026-08-13 用户裁决:箭头保留),菜单
+ 不出现设备列表,只留「远程连接设置」与「侧边栏显示设置」——单机用户看不到
+ 设备概念,但仍能从段头进这两项。断网后设备目录清空、raw 选择仍记着远端时
+ 同样只留两项设置,不再假装还有机器列表。段头恒在:空账户、只剩置顶、远程
+ 目录 / 任务全屏 loading/error、所选设备连接中都继续渲染范围标题(2026-08-13
+ 第 4 轮 review P1),这是合并方向只能是"下拉并入标题"而非反向的原因。
- **点击展开**(推翻 2026-07-12 hover 展开定稿:段头标题 hover 扫过就弹菜单太吵);
「切换器收进顶部导航末行、不挂段头」的 2026-07 定稿一并推翻(当年是段头挂配件,
现在段头本身就是切换器)。
@@ -53,9 +58,11 @@
归属由功能槽经 `useOwnTopNavScrollableRows` 声明,**Shell 不判路由**(维持"外壳不感知
路由"的架构不变量)。没有长列表的视图(插件页等)与 rail 态仍由 Shell 整块渲染四行。
-## 3. 整理侧边栏菜单(定稿结构)
+## 3. 侧边栏显示设置菜单(定稿结构)
-入口:「全部任务」段头 hover 出现的整理按钮,**点击展开**(2026-08-12 用户裁决,
+入口有三处:「全部任务」段头 hover 出现的 sliders 按钮;**范围菜单底部**的
+「侧边栏显示设置」行(2026-08-13 用户裁决,排在「远程连接设置」下面);以及侧栏
+空白处右键。前两处打开同一份段头菜单,**点击展开**(2026-08-12 用户裁决,
推翻早前的 hover 自动展开);按钮配色与段头其余按钮同源,hover 只出 tooltip。
菜单**不带自身标题行**(2026-08-12 用户裁决,节约高度;与远程机器菜单同规)——