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): 排序的「优先级」补 hover 说明

Dashb7a6fc09e99d
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
index 6a40dd879b..784a1d2614 100644
--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
@@ -203,6 +203,22 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
);
});
+ // 2026-08-13 用户裁决:「优先级」光看标签猜不出排序依据,需要 hover 说明。
+ it('排序的「优先级」有 hover 说明,自解释的档位不加', () => {
+ const filterSource = read('features', 'cc-agent', 'sidebar', 'SidebarFilterPopover.tsx');
+ // 说明挂在选项表上(与 labelKey / Icon 同源),不在渲染处硬编码文案。
+ expect(filterSource).toMatch(
+ /value: 'priority',\s*\n\s*labelKey: 'ccAgent\.sidebar\.filterSortBy\.priority',\s*\n\s*tipKey: 'ccAgent\.sidebar\.filterSortByTip\.priority',/,
+ );
+ // recency / manual 名字自解释,不配说明——菜单不该变成说明书。
+ expect(filterSource).not.toMatch(/filterSortBy\.recency',\s*\n?\s*tipKey/);
+ expect(filterSource).not.toMatch(/filterSortBy\.manual',\s*\n?\s*tipKey/);
+ // side="right":菜单贴侧栏右缘,提示往上下会压住相邻选项。
+ expect(filterSource).toContain('<Tip text={tip} side="right">');
+ // 渲染处从选项表取,tipKey 缺省时传 undefined(Tip 据此透明透传、不挂 tooltip)。
+ expect(filterSource).toContain('tip={option.tipKey ? t(option.tipKey) : undefined}');
+ });
+
// 设计文档 §3.3 定稿 + 2026-08-12 用户重申:筛选不作用于置顶区。
it('置顶区不受项目 / Agent / 最近活跃筛选影响(归档仍按状态隐藏)', () => {
// 置顶会话:直接用 allGroups.pinned,不再套 vendor / project 过滤。
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 5cded4268d..8b7118272c 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
@@ -82,6 +82,12 @@ type Option<T extends string> = {
* 这类图标能真正帮上忙的段——分组与排序是抽象策略,硬配图标反而增噪,留空。
*/
Icon?: LucideIcon;
+ /**
+ * hover 说明(2026-08-13 用户裁决)。只给「光看标签猜不出排序依据」的选项——
+ * 「优先级」不说清按什么排,用户无从判断它和「按时间排序」的差别;
+ * 「按时间排序」「手动排序」名字自解释,不加提示避免菜单变成说明书。
+ */
+ tipKey?: string;
};
const STATUS_OPTIONS: ReadonlyArray<Option<FilterStatus>> = [
@@ -107,7 +113,11 @@ const LAST_ACTIVITY_OPTIONS: ReadonlyArray<Option<FilterLastActivity>> = [
/** 「最早优先」(旧 time)2026-08-12 用户裁决删除;时间排序只保留最近活动在前一档。 */
const FLAT_SORT_BY_OPTIONS: ReadonlyArray<Option<FilterSortBy>> = [
{ value: 'recency', labelKey: 'ccAgent.sidebar.filterSortBy.recency' },
- { value: 'priority', labelKey: 'ccAgent.sidebar.filterSortBy.priority' },
+ {
+ value: 'priority',
+ labelKey: 'ccAgent.sidebar.filterSortBy.priority',
+ tipKey: 'ccAgent.sidebar.filterSortByTip.priority',
+ },
];
/** manual(手动排序)只管项目行(设计文档 §9.3 收窄),平铺模式下无意义不展示。 */
@@ -228,12 +238,15 @@ function SelectMenuItem({
selected,
onSelect,
Icon,
+ tip,
keepOpen = false,
}: {
label: string;
selected: boolean;
onSelect: () => void;
Icon?: LucideIcon;
+ /** 可选 hover 说明(见 Option.tipKey);为空时 Tip 透明透传,不挂 tooltip。 */
+ tip?: string;
/**
* 选中后保持菜单打开(2026-08-12 用户裁决)。给筛选的各维度用:筛选常要连着
* 调好几项(状态 + Agent + 最近活跃),每选一次就整棵菜单收掉、得从段头重新点开
@@ -243,19 +256,24 @@ function SelectMenuItem({
keepOpen?: boolean;
}) {
return (
- <DropdownMenuItem
- onSelect={(event) => {
- if (keepOpen) event.preventDefault();
- onSelect();
- }}
- className={MENU_ITEM_CLASS}
- >
- <MenuItemIcon Icon={Icon} />
- <span className="truncate">{label}</span>
- {selected && (
- <Check size={15} className="ml-auto shrink-0 text-[var(--msg-assistant-text)]" />
- )}
- </DropdownMenuItem>
+ // side="right":菜单本身贴着侧栏右缘,提示往上/下会压住相邻选项,往右才有空间
+ // (与项目多选行的远程 Tip 同侧)。Tip 在 text 为空时直接透传 children,
+ // 无提示的选项零额外开销、也不会多包一层影响 Radix 的键盘导航。
+ <Tip text={tip} side="right">
+ <DropdownMenuItem
+ onSelect={(event) => {
+ if (keepOpen) event.preventDefault();
+ onSelect();
+ }}
+ className={MENU_ITEM_CLASS}
+ >
+ <MenuItemIcon Icon={Icon} />
+ <span className="truncate">{label}</span>
+ {selected && (
+ <Check size={15} className="ml-auto shrink-0 text-[var(--msg-assistant-text)]" />
+ )}
+ </DropdownMenuItem>
+ </Tip>
);
}
@@ -476,6 +494,7 @@ export function SidebarFilterPopover({
label={t(option.labelKey)}
selected={effectiveSortBy === option.value}
onSelect={() => setSortBy(option.value)}
+ tip={option.tipKey ? t(option.tipKey) : undefined}
/>
))}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 1d1c20090d..52925d0970 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -7019,6 +7019,9 @@
"manual": "Manual",
"priority": "Priority"
},
+ "filterSortByTip": {
+ "priority": "Unread or waiting on you first, then running, then by time"
+ },
"filterStatusHeading": "Status",
"filterAgentHeading": "Agent",
"filterLastActivityHeading": "Last activity",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index aacd9eb9b4..9d2f4c583f 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -7007,6 +7007,9 @@
"manual": "手動",
"priority": "優先度"
},
+ "filterSortByTip": {
+ "priority": "未読・要対応を最上位に、次に実行中、残りは時間順"
+ },
"filterStatusHeading": "ステータス",
"filterAgentHeading": "エージェント",
"filterLastActivityHeading": "最終アクティビティ",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index cab5035f0e..49d1cf180e 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -7007,6 +7007,9 @@
"manual": "수동",
"priority": "우선순위"
},
+ "filterSortByTip": {
+ "priority": "읽지 않았거나 확인이 필요한 항목 먼저, 다음 실행 중, 나머지는 시간순"
+ },
"filterStatusHeading": "상태",
"filterAgentHeading": "에이전트",
"filterLastActivityHeading": "최근 활동",
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 62743200f3..43f63ecc2d 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -7003,6 +7003,9 @@
"manual": "手动排序",
"priority": "优先级"
},
+ "filterSortByTip": {
+ "priority": "有未读或等你处理的排在最前,然后是运行中的,其余按时间"
+ },
"filterStatusHeading": "状态",
"filterAgentHeading": "Agent",
"filterLastActivityHeading": "最近活跃",
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 be31994a52..3c7f93735a 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -7006,6 +7006,9 @@
"manual": "手動排序",
"priority": "優先級"
},
+ "filterSortByTip": {
+ "priority": "有未讀或等你處理的排在最前,然後是執行中的,其餘按時間"
+ },
"filterStatusHeading": "狀態",
"filterAgentHeading": "Agent",
"filterLastActivityHeading": "最近活躍",
diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.md
index a8bc91ce1f..76e00088c1 100644
--- a/docs/product-rules/sidebar-redesign-plan.md
+++ b/docs/product-rules/sidebar-redesign-plan.md
@@ -104,7 +104,7 @@
| 选项 | 默认 | 行为 |
|---|---|---|
| 按时间排序 | **是** | 顶层条目按组内最新活动时间倒序(最近的在前);组内同。排序时钟 = `userSendAt ?? updatedAt`(以用户最近一次按下发送为主键,agent 回复只 bump `updatedAt` 不重排) |
-| 优先级 | | 等待确认 > 运行中 > 其余按最近活动;权重复用 `sidebarRightStatus.ts` 的 `error > awaiting > running` 优先级函数 |
+| 优先级 | | 需你处理(未读 / 等待确认)> 运行中 > 其余按最近活动;同档内仍按最近活动 |
| 手动排序 | | 顶层条目可拖拽,顺序持久;新条目进顶部 |
「按名称排序」(现状 alphabetic)删除。**「最早优先」(旧 `time`)2026-08-12 用户
@@ -114,6 +114,25 @@
默认保持按时间而非优先级,原因见 §6.2(列表跳动),切默认是一行改动、留待实机
体验后决定。
+**「优先级」带 hover 说明(2026-08-13 用户裁决)**:标签本身说不出「按什么排」,
+用户无从判断它与「按时间排序」的差别。文案如实描述实现的三档:「有未读或等你
+处理的排在最前,然后是运行中的,其余按时间」。`recency` / `manual` 名字自解释,
+不配说明——菜单不该变成说明书。说明挂在选项表的 `tipKey` 上(与 `labelKey` /
+`Icon` 同源),`side="right"`(菜单贴侧栏右缘,提示往上下会压住相邻选项)。
+
+实现口径的两点澄清(与本表措辞对齐):
+- **第一档的真实语义是「有未读角标」,不只是「等待确认」**。`attentionSessionIds`
+ 喂进来的是侧栏未读集合,含三种 kind:`awaiting`(等你回复 / 授权 / 审阅计划)、
+ `error`(出错未处理)、`done`(跑完还没点开)。所以**跑完没看的任务也会被顶到
+ 最前**——这是有意的(它同样"需要你处理一下"),但与"等待确认"的字面理解不同,
+ 故文案写「有未读或等你处理的」而非「等待确认」。三种 kind 在排序上**不再分级**
+ (都是 rank 0),`sidebarRightStatus.ts` 的 `error > awaiting > done` 只决定右侧
+ 状态槽的**颜色**,不参与排序——原表述说「权重复用该优先级函数」不准确,已更正。
+- **未读是内存态,重启即失**(`sessionAttentionStore` 不落盘)。重启后只有两类点
+ 会由 `usePendingAlertAttention` 从 DB 重建:未收尾的中断、未处置的错误尾行。
+ 「跑完没看」的绿点不重建。因此**重启后优先级排序的结果会明显不同于重启前**,
+ 多数任务落回按时间排。这是既有架构的性质,不是本次排序引入的缺陷。
+
### 3.3 筛选 —— 一级只占一行,展开二级菜单
一级行右侧显示摘要(「无」/「N 项生效」)。二级菜单四维度 + 「重置筛选」,
@@ -209,7 +228,12 @@ More/Archive,复用 `TimeActionsSlot`),行 2 = 固定 1 行预览;整行恒两
同级固定段、排序不复用 project manual order」被本方案有意推翻。实现 D 期时
必须同步改注释与测试,不留矛盾文档。
2. **优先级排序的列表跳动**:任务状态变化引起行移位、可能误点。缓解:重排位置
- 动画 / 悬停冻结;默认值保持「最近活动」(定稿)。
+ 动画 / 悬停冻结;默认值保持「最近活动」(定稿)。**缓解措施均未实现**
+ (2026-08-13 复查):当前既无重排动画也无悬停冻结,状态一变行就瞬移。最容易
+ 撞上的是**点击自己会导致重排**——点开一个未读任务会清掉它的未读标记,该行
+ 立刻从顶部掉回时间位置,其下所有行上移;连点两条时第二次点击很可能落到已经
+ 换了位置的行上。默认值不是优先级,所以只影响主动选了这一档的用户。是否补
+ 动画 / 冻结留待实机体验后决定。
3. **手动排序范围**:散排对话可能数百条,全量进 manual order 会膨胀且被新任务
冲乱。实现时收窄:手动排序只管顶层分组行与少量散排条目,组内仍按最近活动
(与原型有偏差,已在 2026-08-12 沟通中说明)。