Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(sidebar): 搜索只钉搜索行并补来源 title
Dashec74e35a3d6a
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.tsindex f77243c21a..159f43cca9 100644--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts@@ -83,10 +83,16 @@ 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)]'");+ // 搜索打开时只钉搜索行,结果替换列表;打开查询时滚回顶部,不再用 overlay 盖住输入框。+ expect(topNavSource).toContain(+ "section === 'scrollable' &&\n search.query.trim().length > 0 &&\n 'sticky top-0 z-30 -mx-3 bg-[var(--cmd-palette-bg)] px-3'",+ );+ expect(sidebarUpperSource).toContain('sidebarScrollRef.current?.scrollTo({ top: 0 })');expect(sidebarUpperSource).toContain('{search.trimmed ? (');expect(sidebarUpperSource).not.toContain('absolute inset-0 z-20');+ expect(sidebarUpperSource).not.toContain(+ "search.trimmed && 'sticky top-0 z-30 bg-[var(--cmd-palette-bg)]'",+ );// 声明语义与 useRegisterSidebarUpper 一致:卸载不复位,避免切到 /settings 时闪变。expect(featureContextSource).toContain('export function useOwnTopNavScrollableRows');diff --git a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsxindex 2b7b2ebdd1..aa46f1283f 100644--- a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx+++ b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx@@ -153,13 +153,22 @@ export function SidebarTopNav({{hasGhostUnread && <AttentionDot size={6} className="ml-auto mr-0.5" />}</button>- {/* 4. 搜索 —— 静息态与上面三行同款;hover / 聚焦就地展开成搜索框 */}- <SidebarInlineSearch- search={search}- allKnownProjects={allKnownProjects}- openSignal={openSignal}- onSearchActive={ensureConversationView}- />+ {/* 4. 搜索 —— 静息态与上面三行同款;hover / 聚焦就地展开成搜索框。+ 有查询时只钉这一行:自动任务 / 插件仍随结果滚走,输入框不卸载。 */}+ <div+ className={cn(+ section === 'scrollable' &&+ search.query.trim().length > 0 &&+ 'sticky top-0 z-30 -mx-3 bg-[var(--cmd-palette-bg)] px-3',+ )}+ >+ <SidebarInlineSearch+ search={search}+ allKnownProjects={allKnownProjects}+ openSignal={openSignal}+ onSearchActive={ensureConversationView}+ />+ </div></>)}</div>diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex 274d67e13b..6102c48d61 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -1714,6 +1714,13 @@ function ExpandedView({ro?.disconnect();};}, []);+ // 搜索结果替换同一滚动容器里的列表,打开查询时滚回顶部,避免沿用旧 scrollTop+ // 从结果中间开始看。后续改查询字不重复复位。+ const searchActive = Boolean(search.trimmed);+ useEffect(() => {+ if (!searchActive) return;+ sidebarScrollRef.current?.scrollTo({ top: 0 });+ }, [searchActive]);// 含远程会话:device-link 远程行也渲染在可选行里,bulk 选择/归档/删除必须能解析到它们// (否则选中远程行 → 计数加了但 archive/delete 查 sessionsById 落空、静默忽略)。const sessionsById = useMemo(@@ -3067,7 +3074,7 @@ function ExpandedView({{/* 侧栏内容区:单一滚动容器(顶部导航的可滚动段 + 置顶 + 项目 + 对话一起滚动)。「新建」仍固定在 shell 顶部;自动任务 / 插件 / 搜索随列表滚走- (2026-08-12 用户裁决,对齐 Codex)。搜索有查询时同一份顶部导航就地 sticky,+ (2026-08-12 用户裁决,对齐 Codex)。搜索有查询时只钉搜索行,结果替换下方列表 —— 输入框不卸载、也不会被结果盖住。 */}<div className="relative flex min-h-0 flex-1 flex-col"><div@@ -3091,15 +3098,9 @@ function ExpandedView({} as React.CSSProperties}>- {/* 顶部导航可滚动段:置于列表最上方,一起滚动。搜索打开时 sticky 钉在顶部,- 输入框保持同一份实例,结果替换下方列表。 */}- <div- className={cn(- search.trimmed && 'sticky top-0 z-30 bg-[var(--cmd-palette-bg)]',- )}- >- <SidebarTopNav section="scrollable" />- </div>+ {/* 顶部导航可滚动段:置于列表最上方,一起滚动。搜索打开时由 TopNav+ 只钉搜索行,输入框保持同一份实例,结果替换下方列表。 */}+ <SidebarTopNav section="scrollable" />{search.trimmed ? (<div data-conversation-search-surface><SearchResultsBodydiff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsxindex 19391372e4..fc51192783 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx@@ -776,6 +776,7 @@ export function SessionCard({)}{sourceLabel ? (<span+ title={sourceLabel}className={cn('min-w-0 truncate text-xs font-normal',isActivediff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsxindex 589fa2625e..3e07b5f55c 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx@@ -968,6 +968,7 @@ export const SessionItem = memo(function SessionItem({)}{sourceLabel ? (<span+ title={sourceLabel}className={cn('min-w-0 truncate text-xs font-normal',isActivediff --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 c823ea719e..063c5a9fa0 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@@ -374,6 +374,8 @@ describe('SessionCard review regressions', () => {it('shows the project source label inline in both list and text modes', () => {expect(sessionCardSource).toContain('{sourceLabel ? (');expect(sessionItemSource).toContain('{sourceLabel ? (');+ expect(sessionItemSource).toContain('title={sourceLabel}');+ expect(sessionCardSource).toContain('title={sourceLabel}');expect(sessionItemSource).toContain("'min-w-0 truncate text-xs font-normal'");expect(sessionItemSource).not.toContain('sourceLabel={sourceLabel}');});diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.mdindex 5a7621e3f4..9bea3e5e8f 100644--- a/docs/product-rules/sidebar-redesign-plan.md+++ b/docs/product-rules/sidebar-redesign-plan.md@@ -53,7 +53,8 @@「按日期分组」模式删除(`DateGroupedSessionsSection` 及 `groupBy === 'date'` 分支)。**只有「新建」固定**(2026-08-12 用户裁决,对齐 Codex):列表向上滚动时,顶部导航-其余三行跟着滚走,把纵向空间让给任务列表。实现上 `SidebarTopNav` 支持分段渲染+其余三行跟着滚走,把纵向空间让给任务列表。搜索有查询时只额外钉住搜索行,保证+输入框可见;自动任务 / 插件仍随结果滚走。实现上 `SidebarTopNav` 支持分段渲染(`pinned` / `scrollable`),Shell 画固定段、任务列表页在自己的滚动容器最上方画可滚动段;归属由功能槽经 `useOwnTopNavScrollableRows` 声明,**Shell 不判路由**(维持"外壳不感知路由"的架构不变量)。没有长列表的视图(插件页等)与 rail 态仍由 Shell 整块渲染四行。