Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(sidebar): 搜索保留置顶折叠并给列表版补来源
Dashee435367bdb1
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.tsindex 159f43cca9..59bb3329f4 100644--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts@@ -88,7 +88,8 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不"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).toContain('{searchActive ? (');+ expect(sidebarUpperSource).toContain('<div hidden={searchActive}>');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)]'",diff --git a/apps/desktop/src/renderer/__tests__/pinnedSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/pinnedSidebarSection.test.tsindex 4c7ee0db29..5e446ced94 100644--- a/apps/desktop/src/renderer/__tests__/pinnedSidebarSection.test.ts+++ b/apps/desktop/src/renderer/__tests__/pinnedSidebarSection.test.ts@@ -23,4 +23,9 @@ describe('Pinned sidebar section', () => {expect(titleButtonBlock).not.toContain('text-[var(--text-tertiary)]');expect(titleButtonBlock).not.toContain('hover:text-[var(--text-secondary)]');});++ it('passes source labels to pinned list cards as well as text rows', () => {+ expect(pinnedSectionSource).toContain('sourceLabel={sourceLabelMap.get(session.id)}');+ expect(pinnedSectionSource).toContain('sourceLabel={sourceLabelMap.get(entry.session.id)}');+ });});diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex 6102c48d61..d4420c438b 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -3101,7 +3101,7 @@ function ExpandedView({{/* 顶部导航可滚动段:置于列表最上方,一起滚动。搜索打开时由 TopNav只钉搜索行,输入框保持同一份实例,结果替换下方列表。 */}<SidebarTopNav section="scrollable" />- {search.trimmed ? (+ {searchActive ? (<div data-conversation-search-surface><SearchResultsBodytrimmed={search.trimmed}@@ -3110,7 +3110,10 @@ function ExpandedView({onSelect={search.handleSelect}/></div>- ) : remoteDeviceDirectoryStatus === 'error' && !hasVisibleSidebarContent ? (+ ) : null}+ {/* 搜索时原列表只隐藏、不卸载:置顶段折叠等本地 state 才能保住。 */}+ <div hidden={searchActive}>+ {remoteDeviceDirectoryStatus === 'error' && !hasVisibleSidebarContent ? (<><MainListScopeHeaderfilter={filter}@@ -3307,6 +3310,7 @@ function ExpandedView({/></>)}+ </div></div></div>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 f34b97b8f0..73814ee14e 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@@ -145,9 +145,8 @@ export interface PinnedSectionProps {/** 已按筛选和持久化顺序排好的置顶对话与项目。 */entries: PinnedSidebarEntry[];/**- * 已知项目全集,用于 hover 时把 pinned session 映射到项目 displayName(与- * ProjectNode 表头同口径消歧)。文字模式渲染 SessionItem 时才用到,card / list- * 模式当前不消费。+ * 已知项目全集,用于把 pinned session 映射到项目 displayName(与+ * ProjectNode 表头同口径消歧)。文字 / 列表模式画在标题旁;卡片模式不消费。*/allKnownProjects: readonly ProjectNodeData[];/** 复用 ProjectNode 渲染项目,确保展开/收起和项目操作与普通项目段一致。 */@@ -209,7 +208,7 @@ export function PinnedSection({const slicedEntries = visibleEntries;// 平铺时标题旁的"项目来源"标签(口径见 buildSessionSourceLabelMap)。- // 置顶视图传 visibleSessions;card 变体不画这个标签。+ // 置顶视图传 visibleSessions;文字 / 列表都画,card 变体不画这个标签。const sourceLabelMap = useMemo(() =>buildSessionSourceLabelMap(visibleSessions, allKnownProjects, t('ccAgent.sidebar.dialogues')),@@ -267,6 +266,7 @@ export function PinnedSection({onTogglePin={onTogglePin}onMoveSession={onMoveSession}projectOptions={projectOptions}+ sourceLabel={sourceLabelMap.get(session.id)}/>);},@@ -286,6 +286,7 @@ export function PinnedSection({onTogglePin,onMoveSession,projectOptions,+ sourceLabelMap,],);