Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(sidebar): 对齐列表标题并避免搜索盖住输入框
Dash01d50495efb2
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.tsindex 26ca8b004b..f77243c21a 100644--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts@@ -83,6 +83,10 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不const scrollableRowsIdx = sidebarUpperSource.indexOf('<SidebarTopNav section="scrollable" />');expect(scrollRefIdx).toBeGreaterThanOrEqual(0);expect(scrollableRowsIdx).toBeGreaterThan(scrollRefIdx);+ // 搜索打开时同一份顶部导航 sticky 钉住,结果替换列表;不再用 overlay 盖住输入框。+ expect(sidebarUpperSource).toContain("search.trimmed && 'sticky top-0 z-30 bg-[var(--cmd-palette-bg)]'");+ expect(sidebarUpperSource).toContain('{search.trimmed ? (');+ expect(sidebarUpperSource).not.toContain('absolute inset-0 z-20');// 声明语义与 useRegisterSidebarUpper 一致:卸载不复位,避免切到 /settings 时闪变。expect(featureContextSource).toContain('export function useOwnTopNavScrollableRows');@@ -214,6 +218,8 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不const cardSource = read('features', 'cc-agent', 'sidebar', 'SessionCard.tsx');expect(cardSource).toContain('sourceLabel,');expect(cardSource).toContain('{sourceLabel ? (');+ const itemSource = read('features', 'cc-agent', 'sidebar', 'SessionItem.tsx');+ expect(itemSource).toContain('{sourceLabel ? (');});// 2026-08-12 用户裁决:筛选各维度选中后菜单不关闭(常要连调几项);排序与显示diff --git a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsxindex 6c386014a1..2b7b2ebdd1 100644--- a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx+++ b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx@@ -5,8 +5,8 @@* - 新建 / 自动任务:项目(cc-agent)视图的动作 —— 在任意视图点击都跳回项目视图并执行。* - Plugins:主视图切换(navigateToView),命中当前视图时高亮。* - 搜索(SidebarInlineSearch):静息态与其余行同款「🔍 搜索」;hover / 聚焦- * 就地展开成搜索框,结果 overlay 由下方功能槽(CCAgentSidebarUpper)绘制。搜索状态经- * ConversationSearchProvider 的 context 共享(行在此、overlay 在功能槽,两者是兄弟子树)。+ * 就地展开成搜索框,结果由下方功能槽(CCAgentSidebarUpper)替换列表绘制。搜索状态经+ * ConversationSearchProvider 的 context 共享(行在此、结果在功能槽,两者是兄弟子树)。* - 远程机器切换 2026-08-13 起不再占行:并入主列表段头标题(「全部任务」即* 范围下拉,见 MachineSwitcherMenu 头注),省一行且标题不再与范围脱节。* 去掉了原来的「项目(Bot)」标签 —— 项目即默认主视图,无单独入口。diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex 1f2813839f..274d67e13b 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -1347,7 +1347,7 @@ function ExpandedView({);// 内联会话搜索:输入行在 SidebarTopNav 的第 4 行,状态经 ConversationSearchProvider 共享;- // 这里只取 search 来渲染下方的结果 overlay(query 非空时盖住置顶 + 项目 + 对话)。+ // query 非空时同一份顶部导航 sticky 钉住,结果替换下方列表,不再用 overlay 盖输入框。const { search } = useConversationSearchContext();const gcProjectKeys = useMemo(() => projectUniverse.projects.map((p) => p.projectKey),@@ -3066,8 +3066,9 @@ function ExpandedView({)}{/* 侧栏内容区:单一滚动容器(顶部导航的可滚动段 + 置顶 + 项目 + 对话一起滚动)。- 外层 relative 承载搜索结果 overlay。「新建」仍固定在 shell 顶部;自动任务 /- 插件 / 搜索 / 远程机器四行随列表滚走(2026-08-12 用户裁决,对齐 Codex)。 */}+ 「新建」仍固定在 shell 顶部;自动任务 / 插件 / 搜索随列表滚走+ (2026-08-12 用户裁决,对齐 Codex)。搜索有查询时同一份顶部导航就地 sticky,+ 结果替换下方列表 —— 输入框不卸载、也不会被结果盖住。 */}<div className="relative flex min-h-0 flex-1 flex-col"><divref={sidebarScrollRef}@@ -3081,7 +3082,7 @@ function ExpandedView({scrollbarGutter: 'stable',// 顶部溢出渐隐:滚动后首行不再紧贴「新建」被硬切(见 topFade 注释)。// 24px 与右栏 TabBar 的横向 fade 同幅度,保持同一套视觉语言。- ...(topFade+ ...(topFade && !search.trimmed? {WebkitMaskImage: 'linear-gradient(to bottom, transparent 0, black 24px)',maskImage: 'linear-gradient(to bottom, transparent 0, black 24px)',@@ -3090,10 +3091,25 @@ function ExpandedView({} as React.CSSProperties}>- {/* 顶部导航可滚动段:置于列表最上方,一起滚动。本组件即展开态视图- (rail 走 CollapsedView 自己的图标入口),无需再判折叠。 */}- <SidebarTopNav section="scrollable" />- {remoteDeviceDirectoryStatus === 'error' && !hasVisibleSidebarContent ? (+ {/* 顶部导航可滚动段:置于列表最上方,一起滚动。搜索打开时 sticky 钉在顶部,+ 输入框保持同一份实例,结果替换下方列表。 */}+ <div+ className={cn(+ search.trimmed && 'sticky top-0 z-30 bg-[var(--cmd-palette-bg)]',+ )}+ >+ <SidebarTopNav section="scrollable" />+ </div>+ {search.trimmed ? (+ <div data-conversation-search-surface>+ <SearchResultsBody+ trimmed={search.trimmed}+ status={search.status}+ results={search.results}+ onSelect={search.handleSelect}+ />+ </div>+ ) : remoteDeviceDirectoryStatus === 'error' && !hasVisibleSidebarContent ? (<><MainListScopeHeaderfilter={filter}@@ -3291,22 +3307,6 @@ function ExpandedView({</>)}</div>- {/* 搜索结果 overlay:query 非空时盖住搜索框下方的全部空间(置顶 + 项目 + 对话)。- data-conversation-search-surface:标记为「搜索界面内部」——Provider 的 outside-pointerdown- 监听据此判定,overlay 内点击 / 滚动都不收起,只有点到本标记以外才收起(见 conversationSearchContext)。 */}- {search.trimmed && (- <div- data-conversation-search-surface- className="absolute inset-0 z-20 overflow-y-auto bg-[var(--cmd-palette-bg)]"- >- <SearchResultsBody- trimmed={search.trimmed}- status={search.status}- results={search.results}- onSelect={search.handleSelect}- />- </div>- )}</div>{/* 空白处右键的整理菜单:与段头 sliders 按钮同一个组件、同一份内容,diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsxindex f6c194343d..19391372e4 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx@@ -715,14 +715,14 @@ export function SessionCard({/>)}<div className="flex items-center gap-1.5">- {/* 标题槽固定沿用常态时间槽的 20px 高度。改名框本身是 24px,编辑时- 绝对定位居中覆盖文字槽位,不参与布局计算,避免整条置顶任务被撑高。+ {/* 标题槽固定 22px,对齐文字模式 14px 标题的一行高。改名框本身是 24px,+ 编辑时绝对定位居中覆盖文字槽位,不参与布局计算,避免整条任务被撑高。状态 / Agent / 自动化图标始终留在文字槽左侧,编辑态也不改变标题起点。 */}<divdata-split-group-drag-handle={splitDragHandleActive ? 'true' : undefined}data-no-drag={splitDragHandleActive ? 'true' : undefined}draggable={splitDragHandleActive}- className="relative flex h-5 min-w-0 flex-1 items-center gap-0"+ className="relative flex h-[22px] min-w-0 flex-1 items-center gap-0"><span className="flex shrink-0 items-center">{titlePrefixNode}</span>{isEditing ? (@@ -738,7 +738,7 @@ export function SessionCard({setIsEditing(false);}}containerClassName="relative min-w-0 flex-1 self-stretch"- inputClassName="absolute inset-x-0 top-1/2 h-6 -translate-y-1/2 text-13 font-semibold text-foreground"+ inputClassName="absolute inset-x-0 top-1/2 h-6 -translate-y-1/2 text-sm font-medium text-foreground"activeForeground={isActive}/>) : (@@ -746,7 +746,7 @@ export function SessionCard({<spanclassName={cn('min-w-0 truncate',- 'text-13 font-semibold leading-[1.3] tracking-[-0.005em]',+ 'text-sm font-medium leading-[1.3]',isActive ? 'text-sidebar-item-active-foreground' : 'text-foreground',)}>@@ -764,20 +764,20 @@ export function SessionCard({{remoteIconKind && (<RemoteProjectIconkind={remoteIconKind}- size={11}+ size={12}strokeWidth={1.8}connectionStatus={remoteIconConnectionStatus}className={isActive? 'text-sidebar-item-active-foreground'- : 'text-[var(--text-tertiary)]'+ : 'text-sidebar-action-icon'}/>)}{sourceLabel ? (<spanclassName={cn(- 'min-w-0 truncate text-11 font-normal',+ 'min-w-0 truncate text-xs font-normal',isActive? 'text-sidebar-item-active-foreground/70': 'text-[var(--cmd-palette-item-meta)]',@@ -825,7 +825,7 @@ export function SessionCard({data-no-drag={splitDragHandleActive ? 'true' : undefined}draggable={splitDragHandleActive}className={cn(- 'mt-1 overflow-hidden text-11 leading-[1.45]',+ 'mt-1 overflow-hidden text-xs leading-[1.45]','[display:-webkit-box] [-webkit-line-clamp:1] [-webkit-box-orient:vertical]',rightStatusKind !== 'time' && 'pr-5',awaitingText@@ -1223,7 +1223,7 @@ function TimeActionsSlot({infoPrRef != null,);return (- <div className="group/slot relative ml-auto flex h-5 shrink-0 items-center justify-end">+ <div className="group/slot relative ml-auto flex h-[22px] shrink-0 items-center justify-end">{/* 默认内容:worktree + 信息槽;hover / 菜单打开 / archivePending 时淡出让位给操作钮。 */}<divclassName={cn(@@ -1240,10 +1240,7 @@ function TimeActionsSlot({pieces={infoPieces}prRef={infoPrRef}isActive={isActive}- className={cn(- 'text-10 font-medium leading-none',- !isActive && 'text-[var(--text-tertiary)]',- )}+ className="leading-none"/></div>diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsxindex 97c34697a3..589fa2625e 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx@@ -250,8 +250,8 @@ export interface SessionItemProps {*/matchIndices?: readonly number[];/**- * hover 时右侧展示的"项目来源"标签(项目 displayName 或"对话")。- * 仅在时间排序视图下由父层注入 —— 项目分组视图里项目名已由 ProjectNode 表头承载,+ * 标题旁的"项目来源"标签(项目 displayName 或"对话")。+ * 仅在平铺视图下由父层注入 —— 项目分组视图里项目名已由 ProjectNode 表头承载,* 无需再在会话行重复显示,因此不传。*/sourceLabel?: string;@@ -966,6 +966,18 @@ export const SessionItem = memo(function SessionItem({)}/>)}+ {sourceLabel ? (+ <span+ className={cn(+ 'min-w-0 truncate text-xs font-normal',+ isActive+ ? 'text-sidebar-item-active-foreground/70'+ : 'text-[var(--cmd-palette-item-meta)]',+ )}+ >+ {sourceLabel}+ </span>+ ) : null}</span>)}@@ -1274,7 +1286,7 @@ export const SessionItem = memo(function SessionItem({// Tooltip——鼠标一到列表项立即显示该对话的 PR 与实时状态(产品要求,// 不等全局 500ms 悬停延迟)。无 PR 的行原样返回,保持本文件"密集列表// 少挂 Tip"的既有取舍。- // 统一 hover 浮层:PR 优先 / 无 PR 时回落到 sourceLabel / 都没有则透传 row。+ // 统一 hover 浮层:PR 优先;来源标签已写在标题旁,不再用浮层重复。// 具体优先级、配色和 orca-lead 回退详见 SessionTooltip.tsx。// 单独 automation-generated 会话(未被 AutomationSessionGroupItem 吸走)在 hover 时// 显示「下次运行倒计时 + 累计运行次数」,与分组头 rowTooltip 同语义。分组内子行@@ -1284,7 +1296,6 @@ export const SessionItem = memo(function SessionItem({<SessionTooltipsessionId={session.id}prRefs={prRefs}- sourceLabel={sourceLabel}isAutomationSession={showAutomationTooltip}>{row}diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.tsindex 86e1fb4000..1d3af90969 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts@@ -524,7 +524,7 @@ describe('SessionCard visual cases', () => {);const listTitleRow = Array.from(listContainer.querySelectorAll<HTMLElement>('div')).find((node) =>- node.classList.contains('h-5') &&+ node.className.includes('h-[22px]') &&node.textContent?.includes('自动化日报巡检') &&node.querySelector('[aria-label="查看自动化任务"]'),);@@ -556,7 +556,7 @@ describe('SessionCard visual cases', () => {const card = container.querySelector<HTMLElement>('[data-sidebar-session-row="true"]')!;const titleRow = Array.from(card.querySelectorAll<HTMLElement>('div')).find((node) =>- node.classList.contains('h-5') && node.textContent?.includes(visualCase.session.title),+ node.className.includes('h-[22px]') && node.textContent?.includes(visualCase.session.title),);expect(titleRow).toBeTruthy();const statusIconSlot = Array.from(titleRow!.querySelectorAll<HTMLElement>('span')).find(diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.tsindex 63e40c04dd..c823ea719e 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts@@ -352,6 +352,32 @@ describe('SessionCard review regressions', () => {expect(automationGroupSource).toContain(": 'text-foreground hover:bg-sidebar-item-hover'");});+ it('matches list-mode title type to the text-mode session row', () => {+ expect(sessionCardSource).toContain("'text-sm font-medium leading-[1.3]'");+ expect(sessionCardSource).toContain(+ 'inputClassName="absolute inset-x-0 top-1/2 h-6 -translate-y-1/2 text-sm font-medium text-foreground"',+ );+ expect(sessionCardSource).toContain("'mt-1 overflow-hidden text-xs leading-[1.45]'");+ expect(sessionCardSource).toContain('className="leading-none"');+ expect(sessionCardSource).not.toContain("'text-13 font-semibold leading-[1.3] tracking-[-0.005em]'");+ expect(sessionItemSource).toContain("'text-left text-sm font-medium'");+ });++ it('keeps list-mode time and remote marks on the text-mode color and size', () => {+ expect(sessionCardSource).toContain('size={12}');+ expect(sessionCardSource).toContain(": 'text-sidebar-action-icon'");+ expect(sessionCardSource).not.toContain("size={11}\n strokeWidth={1.8}");+ expect(sessionItemSource).toContain('size={12}');+ expect(sessionItemSource).toContain(": 'text-sidebar-action-icon'");+ });++ it('shows the project source label inline in both list and text modes', () => {+ expect(sessionCardSource).toContain('{sourceLabel ? (');+ expect(sessionItemSource).toContain('{sourceLabel ? (');+ expect(sessionItemSource).toContain("'min-w-0 truncate text-xs font-normal'");+ expect(sessionItemSource).not.toContain('sourceLabel={sourceLabel}');+ });+it('aligns list automation headers with regular tasks and indents only expanded children', () => {expect(automationGroupSource).toMatch(/sessionVariant === 'list'\s*\? 'px-2\.5'\s*: indented\s*\? 'pl-\[22px\] pr-2'\s*: 'pl-3 pr-2'/,diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/conversationSearchContext.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/conversationSearchContext.tsxindex 3b090def3f..e5098fae52 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/conversationSearchContext.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/conversationSearchContext.tsx@@ -2,11 +2,11 @@* ConversationSearchContext —— 展开侧栏「内联会话搜索」的共享状态。* ---------------------------------------------------------------------------* 搜索输入行现在是 SidebarTopNav 顶部导航列表的第 4 行(新建 / 自动任务 / 技能 / 搜索),- * 而搜索结果 overlay 渲染在其下方的功能槽(CCAgentSidebarUpper.ExpandedView)里——两者+ * 结果由下方功能槽(CCAgentSidebarUpper.ExpandedView)替换列表渲染——两者* 是 Sidebar 外壳下的兄弟子树,不在同一组件内。这里用一个 Provider 在两者的共同祖先* (Sidebar 外壳)处**只实例化一次** useConversationSearch,经 context 同时供:* - SidebarTopNav 的搜索行(输入 / 排序 / 筛选 / hover 展开);- * - ExpandedView 的结果 overlay(读 query / status / results)。+ * - ExpandedView 的结果列表(读 query / status / results)。** allKnownProjects 在此就地计算(与 CCAgentSidebarUpper 的 projectUniverse 同口径:全量* 会话、排除 Orca worker),供筛选面板列举项目与项目内搜索会话集解析。rail 态的搜索是diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsxindex 86784c3404..f34b97b8f0 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/PinnedSection.tsx@@ -208,9 +208,8 @@ export function PinnedSection({// 置顶不做"最多显示 N 条"折叠——置顶是用户主动钉住的,全部显示(三种模式一致)。const slicedEntries = visibleEntries;- // 文字模式 SessionItem hover 时右侧浮层展示的"项目来源"标签(口径见- // buildSessionSourceLabelMap),与时间排序视图同口径。card / list 模式视觉自成一体,- // 当前不注入。置顶视图传 visibleSessions。+ // 平铺时标题旁的"项目来源"标签(口径见 buildSessionSourceLabelMap)。+ // 置顶视图传 visibleSessions;card 变体不画这个标签。const sourceLabelMap = useMemo(() =>buildSessionSourceLabelMap(visibleSessions, allKnownProjects, t('ccAgent.sidebar.dialogues')),diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.mdindex a01dced500..5a7621e3f4 100644--- a/docs/product-rules/sidebar-redesign-plan.md+++ b/docs/product-rules/sidebar-redesign-plan.md@@ -219,6 +219,10 @@More/Archive,复用 `TimeActionsSlot`),行 2 = 固定 1 行预览;整行恒两行高,无第三行;无卡片描边底色,行间浅分割线(hover/选中隐藏)。任务信息多选时共用行 1 信息槽。+列表标题与文字模式同档:`text-sm` / 14px / medium;预览、来源标签与右侧信息槽+用 `text-xs` / 12px。列表右侧时间 / 远程小标与文字模式同一套 token 和尺寸+(`sidebar-action-icon`,远程标 12px)。平铺时两种模式都在标题旁显示项目来源标签;+按项目分组时不重复写。置顶卡片版仍用 12px 标题,不跟这次对齐。## 6. 「展开/收起所有分组」按钮