Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(desktop): 伙伴并入侧栏第一层,与任务列表并存 (#5943)
Chris Zhang2ce5ab565e5f
diff --git a/apps/desktop/src/renderer/__tests__/sessionTitleProjectionOutlets.test.ts b/apps/desktop/src/renderer/__tests__/sessionTitleProjectionOutlets.test.tsindex 624327b1cf..878041b9d5 100644--- a/apps/desktop/src/renderer/__tests__/sessionTitleProjectionOutlets.test.ts+++ b/apps/desktop/src/renderer/__tests__/sessionTitleProjectionOutlets.test.ts@@ -122,6 +122,9 @@ describe('desktop 会话标题投影出口', () => {// /review Reviewer tasks are checked first: they never notify on their own.expect(sidebarUpper).toContain('if (await isReviewSessionNotificationTarget(sessionId)) return;');expect(sidebarUpper).toContain('const botTitle = await botOwnedSessionNotificationTitle(sessionId);');+ // The task sidebar is the only notification owner, also on /bots routes: group+ // lanes never notify (docs/product-rules/bot-group-chat.md §3).+ expect(sidebarUpper).toContain('if (botTitle === BOT_GROUP_LANE_SESSION) return;');expect(sidebarUpper).toContain('sendSessionEventNotification(sessionId, botTitle ?? unnamedLabelRef.current, kind);',);diff --git a/apps/desktop/src/renderer/components/layout/__tests__/MainEntryRedirect.test.tsx b/apps/desktop/src/renderer/components/layout/__tests__/MainEntryRedirect.test.tsxindex 6b1debefad..8b795fcc8b 100644--- a/apps/desktop/src/renderer/components/layout/__tests__/MainEntryRedirect.test.tsx+++ b/apps/desktop/src/renderer/components/layout/__tests__/MainEntryRedirect.test.tsx@@ -8,7 +8,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'viteimport { MainViewHistoryProvider } from '@/contexts/MainViewHistoryContext';import { readMainEntryRoute, rememberMainEntry } from '@/lib/mainEntryPreference';import { useActiveMainView } from '@/hooks/useActiveMainView';-import { BotsListView } from '@/features/bots/BotsListView';import en from '@/i18n/locales/en/common.json';import { MainEntryRedirect, useRememberMainEntry } from '../MainEntryRedirect';@@ -28,7 +27,8 @@ function Layout() {function launch(path = '/') {const router = createMemoryRouter([{ element: <Layout />, children: [{ path: '/', element: <MainEntryRedirect /> },- { path: '/bots', children: [{ path: 'list', element: <BotsListView /> }] },+ // Stand-in for BotsHomeView: /bots resolves the last-viewed teammate (else Cindy).+ { path: '/bots', children: [{ index: true, element: <div data-testid="teammate-entry" /> }] },{ path: '*', element: <div /> },] }], { initialEntries: [path] });const tree = () => <I18nextProvider i18n={i18n}><MainViewHistoryProvider ownerKey={auth.dataOwnerId ?? 'signed-out'} locationKey={router.state.location.key}>@@ -46,26 +46,26 @@ beforeEach(() => {afterEach(() => { cleanup(); vi.unstubAllGlobals(); });describe('main entry startup', () => {- it('reopens the partner list after closing a partner chat, without restoring its id', async () => {+ it('reopens the teammate entry after closing a partner chat, without restoring its id', async () => {const app = launch();await act(() => app.router.navigate('/bots/private-bot/session/private-task'));cleanup();launch();- expect(screen.getByTestId('route').textContent).toBe('/bots/list');- expect(screen.getByRole('main').textContent).toBe(en.bots.list.selectChat);+ expect(screen.getByTestId('route').textContent).toBe('/bots');+ expect(screen.getByTestId('teammate-entry')).toBeTruthy();expect(screen.queryByRole('dialog')).toBeNull();expect(JSON.stringify(localStorage)).not.toContain('private-bot');expect(JSON.stringify(localStorage)).not.toContain('private-task');});- it('opens the unselected partner list after restarting from tasks', () => {+ it('opens the teammate entry resolver after restarting from tasks', () => {launch('/bots/dash/session/dash-main');fireEvent.click(screen.getByText('Tasks'));expect(screen.getByTestId('route').textContent).toBe('/cc-agent');cleanup();launch();fireEvent.click(screen.getByText('Partners'));- expect(screen.getByTestId('route').textContent).toBe('/bots/list');- expect(screen.getByRole('main').textContent).toBe(en.bots.list.selectChat);+ expect(screen.getByTestId('route').textContent).toBe('/bots');+ expect(screen.getByTestId('teammate-entry')).toBeTruthy();});it('returns to the selected partner when switching areas without restarting', () => {launch('/bots/dash/session/dash-main');@@ -79,24 +79,24 @@ describe('main entry startup', () => {app.rerender();await act(() => app.router.navigate('/cc-agent'));fireEvent.click(screen.getByText('Partners'));- expect(screen.getByTestId('route').textContent).toBe('/bots/list');+ expect(screen.getByTestId('route').textContent).toBe('/bots');});it('keeps the task index behavior for no record and after returning to tasks', async () => {const app = launch();expect(screen.getByTestId('route').textContent).toBe('/cc-agent');- await act(() => app.router.navigate('/bots/list'));+ await act(() => app.router.navigate('/bots'));await act(() => app.router.navigate('/cc-agent/task-a'));cleanup();launch();expect(screen.getByTestId('route').textContent).toBe('/cc-agent');});it.each(['/cc-agent/target?message=one', '/bots/target/session/chat', '/settings'])('preserves explicit startup route %s', (path) => {- rememberMainEntry('account-a', '/bots/list');+ rememberMainEntry('account-a', '/bots');launch(path);expect(screen.getByTestId('route').textContent).toBe(path);});it('never redirects a notification arriving after restoration back to the list', async () => {- rememberMainEntry('account-a', '/bots/list');+ rememberMainEntry('account-a', '/bots');const app = launch();await act(() => app.router.navigate('/cc-agent/notification-target'));expect(screen.getByTestId('route').textContent).toBe('/cc-agent/notification-target');@@ -111,10 +111,10 @@ describe('main entry startup', () => {auth.dataOwnerId = 'account-a';app.rerender();await act(() => app.router.navigate('/'));- expect(screen.getByTestId('route').textContent).toBe('/bots/list');+ expect(screen.getByTestId('route').textContent).toBe('/bots');});it('keeps signed-out and invalid preferences on the existing default', () => {- rememberMainEntry(null, '/bots/list');+ rememberMainEntry(null, '/bots');expect(readMainEntryRoute(null)).toBe('/cc-agent');localStorage.setItem('cindy.mainEntry.v1.owner.account-a', '/bots/specific');expect(readMainEntryRoute('account-a')).toBe('/cc-agent');diff --git a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsxindex 315e1beb5e..b2ec3fc4f4 100644--- a/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx+++ b/apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx@@ -1,12 +1,13 @@/*** SidebarTopNav —— 侧栏顶部常驻动作/导航列表(取代原 HorizontalTabbar)。* ---------------------------------------------------------------------------- * 一条同级、等权的列表行:新建固定;自动任务 / Plugins / 伙伴 / 搜索与带主视图的插件+ * 一条同级、等权的列表行:新建固定;自动任务 / Plugins / 搜索与带主视图的插件* 按用户偏好排序与显示(插件的显隐沿用其「在侧边栏显示」开关);未勾选的进「更多」。* 最小化插件面板恢复入口仍按需出现。* - 新建 / 自动任务:项目(cc-agent)视图的动作 —— 在任意视图点击都跳回项目视图并执行。* - Plugins:主视图切换(navigateToView),命中当前视图时高亮。- * - 伙伴:原位切换为「返回任务」动作,随目标更换文案和图标,不显示选中高亮。+ * - 伙伴 2026-10-13 起不再是导航行:它是侧栏第一层的「伙伴」段(置顶上方),+ * 与任务列表并存,不再整栏切换(见 features/bots/TeammatesSection)。* - 搜索(SidebarInlineSearch):静息态与其余行同款「🔍 搜索」;hover / 聚焦* 就地展开成搜索框,结果由下方功能槽(CCAgentSidebarUpper)替换列表绘制。搜索状态经* ConversationSearchProvider 的 context 共享(行在此、结果在功能槽,两者是兄弟子树)。@@ -19,13 +20,12 @@* 与 Shell"不感知路由"的原则:本组件是原 HorizontalTabbar 的同位替代,封装了* 自身的路由 / cc-agent 数据,Shell 仍只负责把它渲染在顶行(见 Sidebar.tsx)。*- * rail(收窄)态:任务视图用 SidebarRailNavigation;其它 Feature 的 rail 只由- * section="rail" 补一个伙伴入口。+ * rail(收窄)态:任务视图用 SidebarRailNavigation;其它 Feature 的 rail 不再补入口+ * (伙伴的 rail 入口由 CollapsedView 提供)。*/import { Fragment, useCallback, useEffect, useRef, useState } from 'react';import {- ArrowLeft,CirclePlus,Ellipsis,SlidersHorizontal,@@ -35,7 +35,6 @@ import { useLocation, useNavigate, useMatch } from 'react-router-dom';import { useTranslation } from 'react-i18next';import { cn } from '@/lib/utils';-import { useNavigationAttention } from '@/lib/navigationAttentionStore';import { NavigationCountBadge } from '@/components/sidebar/NavigationCountBadge';import { useAuth } from '@/contexts/AuthContext';import { AttentionDot, type DotTone } from '@/components/sidebar/AttentionDot';@@ -121,21 +120,12 @@ function useSidebarNavigationActions(): Record<SidebarNavigationItemId, SidebarNavigationAction> {const { t } = useTranslation();const navigate = useNavigate();- const location = useLocation();const { activeKey, navigateToView } = useActiveMainView();const onScheduleMatch = useMatch('/cc-agent/scheduled');// 任一插件有未读 → 入口行尾一颗**静态**绿点(聚合入口按 AttentionDot 规范不呼吸,// 呼吸留给单条卡片;见 AttentionDot 头部的形态规范)。const hasRetirementUnread = useInstalledGhosts().some((ghost) => ghost.retirement?.unread);const hasGhostUnread = useAnyGhostUnread() || hasRetirementUnread;- // `activeKey` is intentionally sticky for the other navigation rows, but this- // action must describe the actual destination. Settings and other auxiliary- // routes should continue to offer entry to Teammates, not a stale return.- const isBotsView = isBotsPath(location.pathname);- // The teammate entry counts what waits at its destination: unread teammate- // messages, or tasks needing attention once it has become "back to tasks".- const navigationCounts = useNavigationAttention();- const botsCount = isBotsView ? navigationCounts.tasks : navigationCounts.teammates;return {automations: {label: t('ccAgent.layout.automations'),@@ -152,17 +142,6 @@ function useSidebarNavigationActions(showDot: hasGhostUnread,dotTone: hasRetirementUnread ? 'awaiting' : 'done',},- bots: {- label: t(isBotsView ? 'sidebar.backToSessions' : 'sidebar.tabs.bots'),- icon: isBotsView ? ArrowLeft : SIDEBAR_NAVIGATION_ITEM_ICONS.bots,- onSelect: () => navigateToView(isBotsView ? 'cc-agent' : 'bots'),- active: false,- showDot: false,- count: {- value: botsCount,- label: t(isBotsView ? 'sidebar.taskAttentionCount' : 'sidebar.teammateUnreadCount', { count: botsCount }),- },- },search: {label: t('sidebar.navigation.items.search'),icon: SIDEBAR_NAVIGATION_ITEM_ICONS.search,@@ -173,10 +152,6 @@ function useSidebarNavigationActions(};}-function isBotsPath(pathname: string): boolean {- return pathname === '/bots' || pathname.startsWith('/bots/');-}-/*** Built-in entries and plugin main views in one saved order. A plugin takes part* only while its own "show in sidebar" switch is on; Customize then decides whether@@ -465,7 +440,6 @@ export function SidebarTopNav({const { navigateToView } = useActiveMainView();const { search, allKnownProjects, openSignal } = useConversationSearchContext();const { dataOwnerId } = useAuth();- const navigationPrefs = useSidebarNavigationPrefs(dataOwnerId);const entries = useSidebarNavigationEntries();const [customizing, setCustomizing] = useState(false);const [showHiddenSearch, setShowHiddenSearch] = useState(false);@@ -482,28 +456,18 @@ export function SidebarTopNav({// 搜索结果 overlay 只在 cc-agent 视图(CCAgentSidebarUpper)绘制;本行却在所有非 rail 视图都渲染。// 用户在 plugins / 设置等视图输入搜索时,先切回 cc-agent 视图,结果才有处显示(同视图为 no-op)。- const ensureConversationView = useCallback(() => navigateToView('cc-agent'), [navigateToView]);+ // 伙伴页与任务共用同一侧栏(结果就地显示),搜索时不必离开正在看的伙伴聊天。+ const onBotsRoute = location.pathname === '/bots' || location.pathname.startsWith('/bots/');+ const ensureConversationView = useCallback(() => {+ if (!onBotsRoute) navigateToView('cc-agent');+ }, [navigateToView, onBotsRoute]);const showPinned = section !== 'scrollable' && section !== 'rail';const showScrollable = section !== 'pinned' && section !== 'rail';const pinSearch = section === 'scrollable' && search.query.trim().length > 0;- if (section === 'rail') {- // Other features' rails only borrow the teammate tile; the task rail renders- // the full navigation itself. The bots feature owns the tile on its route.- const bots = actions.bots;- if (isBotsPath(location.pathname) || !navigationPrefs.visible.includes('bots')) return <></>;- return (- <div className="flex shrink-0 justify-center px-2 pt-2 pb-1">- <SidebarIconButton- icon={bots.icon}- label={bots.label}- aria-description={bots.count?.value ? bots.count.label : undefined}- badge={<EntryCountBadge count={bots.count} />}- onClick={bots.onSelect}- />- </div>- );- }+ // 其它 Feature 的 rail 过去只借这里补一个伙伴入口;伙伴并入侧栏后 rail 入口由+ // 任务侧栏的 CollapsedView 提供,这里不再渲染内容。+ if (section === 'rail') return <></>;const renderActionRow = (id: Exclude<SidebarNavigationItemId, 'search'>) => {const action = actions[id];const Icon = action.icon;diff --git a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsxindex 6a5f4f9d14..5c7e3e0333 100644--- a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx+++ b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx@@ -70,8 +70,8 @@ vi.mock('react-i18next', () => ({}));const defaults = () => ({- order: ['automations', 'plugins', 'bots', 'search'] as const,- visible: ['automations', 'plugins', 'bots', 'search'] as const,+ order: ['automations', 'plugins', 'search'] as const,+ visible: ['automations', 'plugins', 'search'] as const,});beforeEach(() => {@@ -100,22 +100,20 @@ describe('sidebar navigation customization', () => {render(<SidebarNavigationCustomize onDone={() => {}} />);// Rows drag from anywhere except the checkbox, which stays a plain toggle.expect(sortableMock.props?.filter).toBe("[role='checkbox']");- act(() => sortableMock.props!.onReorder(['plugins', 'bots', 'search', 'automations']));+ act(() => sortableMock.props!.onReorder(['plugins', 'search', 'automations']));expect(order()).toEqual(['sidebar.navigation.items.plugins',- 'sidebar.navigation.items.bots','sidebar.navigation.items.search','sidebar.navigation.items.automations',]);fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER).order).toEqual(['plugins',- 'bots','search','automations',]);expect(JSON.parse(localStorage.getItem(PREFS_KEY)!)).toEqual({- order: ['plugins', 'bots', 'search', 'automations'],+ order: ['plugins', 'search', 'automations'],});});@@ -129,14 +127,14 @@ describe('sidebar navigation customization', () => {act(() =>setSidebarNavigationPrefs(OWNER, {order: [...defaults().order],- visible: ['automations', 'plugins', 'search'],+ visible: ['plugins', 'search'],}),);expect(order()[0]).toBe('sidebar.navigation.items.plugins');fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER)).toEqual({- order: ['plugins', 'automations', 'bots', 'search'],- visible: ['automations', 'plugins'],+ order: ['plugins', 'automations', 'search'],+ visible: ['plugins'],appsAtTop: [],});});@@ -147,14 +145,14 @@ describe('sidebar navigation customization', () => {});setSidebarNavigationPrefs(OWNER, {order: [...defaults().order],- visible: ['automations', 'plugins', 'bots'],+ visible: ['automations', 'plugins'],});expect(getSidebarNavigationPrefs(OWNER).visible).not.toContain('search');});it('clears overrides when resetting to the product defaults', () => {setSidebarNavigationPrefs(OWNER, {- order: ['bots', 'search', 'plugins', 'automations'],+ order: ['search', 'plugins', 'automations'],visible: ['search'],});render(<SidebarNavigationCustomize onDone={() => {}} />);@@ -168,28 +166,29 @@ describe('sidebar navigation customization', () => {expect(JSON.parse(localStorage.getItem(PREFS_KEY)!)).toEqual({});});- it('drops the retired Issue entry from saved v2 preferences', () => {+ it('drops the retired Issue and Teammates entries from saved v2 preferences', () => {localStorage.setItem(PREFS_KEY,JSON.stringify({- order: ['plugins', 'issues', 'automations', 'bots'],- visibility: { issues: true, plugins: false },+ order: ['plugins', 'issues', 'bots', 'automations'],+ visibility: { issues: true, bots: false, plugins: false },}),);act(() => window.dispatchEvent(new StorageEvent('storage', { key: PREFS_KEY })));expect(getSidebarNavigationPrefs(OWNER)).toEqual({- order: ['plugins', 'automations', 'bots', 'search'],- visible: ['automations', 'bots', 'search'],+ order: ['plugins', 'automations', 'search'],+ visible: ['automations', 'search'],appsAtTop: [],});render(<SidebarNavigationCustomize onDone={() => {}} />);expect(order()).not.toContain('sidebar.navigation.items.issues');+ expect(order()).not.toContain('sidebar.navigation.items.bots');});it('keeps edits made after choosing reset', () => {setSidebarNavigationPrefs(OWNER, {- order: ['bots', 'automations', 'plugins', 'search'],- visible: ['bots'],+ order: ['plugins', 'automations', 'search'],+ visible: ['plugins'],});render(<SidebarNavigationCustomize onDone={() => {}} />);fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.reset' }));@@ -197,7 +196,7 @@ describe('sidebar navigation customization', () => {fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER)).toEqual({order: [...defaults().order],- visible: ['automations', 'plugins', 'bots'],+ visible: ['automations', 'plugins'],appsAtTop: [],});});@@ -205,15 +204,14 @@ describe('sidebar navigation customization', () => {mainViewsMock.routeCapable = [SITES];mainViewsMock.sidebarVisible = [SITES];setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],appsAtTop: ['app:xd-sites'],});render(<SidebarNavigationCustomize onDone={() => {}} />);expect(order()).toEqual(['sidebar.navigation.items.automations','sidebar.navigation.items.plugins',- 'sidebar.navigation.items.bots','sidebar.navigation.items.search','站点',]);@@ -232,7 +230,6 @@ describe('sidebar navigation customization', () => {expect(getSidebarNavigationPrefs(OWNER).order).toEqual(['automations','plugins',- 'bots','app:xd-sites','search',]);@@ -272,13 +269,13 @@ describe('sidebar navigation customization', () => {it('leaves out plugins switched off in their own settings and keeps their saved place', () => {mainViewsMock.routeCapable = [SITES];setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],appsAtTop: ['app:xd-sites'],});render(<SidebarNavigationCustomize onDone={() => {}} />);expect(screen.queryByRole('checkbox', { name: '站点' })).toBeNull();- fireEvent.click(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.bots' }));+ fireEvent.click(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.search' }));fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER).appsAtTop).toEqual(['app:xd-sites']);});@@ -288,7 +285,7 @@ describe('sidebar navigation customization', () => {mainViewsMock.routeCapable = [SITES, off];mainViewsMock.sidebarVisible = [SITES];setSidebarNavigationPrefs(OWNER, {- order: ['app:xd-sites', 'automations', 'plugins', 'bots', 'search'],+ order: ['app:xd-sites', 'automations', 'plugins', 'search'],visible: ['automations', 'plugins'],appsAtTop: ['app:xd-sites', 'app:off'],});@@ -302,8 +299,8 @@ describe('sidebar navigation customization', () => {);fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER)).toEqual({- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],appsAtTop: [],});// No overrides remain, so later product defaults keep applying.@@ -322,20 +319,20 @@ describe('sidebar navigation customization', () => {it('toggles from anywhere in the row except the drag handle', () => {render(<SidebarNavigationCustomize onDone={() => {}} />);- const bots = screen.getByRole('checkbox', { name: 'sidebar.navigation.items.bots' });- expect(bots.getAttribute('aria-checked')).toBe('true');- fireEvent.click(screen.getByText('sidebar.navigation.items.bots'));- expect(bots.getAttribute('aria-checked')).toBe('false');- fireEvent.click(bots.parentElement!);- expect(bots.getAttribute('aria-checked')).toBe('true');- fireEvent.click(bots);- expect(bots.getAttribute('aria-checked')).toBe('false');+ const plugins = screen.getByRole('checkbox', { name: 'sidebar.navigation.items.plugins' });+ expect(plugins.getAttribute('aria-checked')).toBe('true');+ fireEvent.click(screen.getByText('sidebar.navigation.items.plugins'));+ expect(plugins.getAttribute('aria-checked')).toBe('false');+ fireEvent.click(plugins.parentElement!);+ expect(plugins.getAttribute('aria-checked')).toBe('true');+ fireEvent.click(plugins);+ expect(plugins.getAttribute('aria-checked')).toBe('false');fireEvent.click(screen.getByRole('button', {- name: 'sidebar.navigation.customize.reorder: sidebar.navigation.items.bots',+ name: 'sidebar.navigation.customize.reorder: sidebar.navigation.items.plugins',}),);- expect(bots.getAttribute('aria-checked')).toBe('false');+ expect(plugins.getAttribute('aria-checked')).toBe('false');});it('shows each entry with the icon it uses in the sidebar', () => {mainViewsMock.routeCapable = [SITES];@@ -346,13 +343,14 @@ describe('sidebar navigation customization', () => {rowOf('sidebar.navigation.items.automations').querySelector('.lucide-timer'),).not.toBeNull();expect(rowOf('sidebar.navigation.items.plugins').querySelector('.lucide-plug')).not.toBeNull();- expect(rowOf('sidebar.navigation.items.bots').querySelector('.lucide-bot')).not.toBeNull();+ // Teammates are a sidebar section of their own now, not a customizable entry.+ expect(screen.queryByRole('checkbox', { name: 'sidebar.navigation.items.bots' })).toBeNull();expect(rowOf('sidebar.navigation.items.search').querySelector('.lucide-search')).not.toBeNull();expect(rowOf('站点').querySelector('.lucide-globe')).not.toBeNull();});it('keeps a separate layout for each account', () => {setSidebarNavigationPrefs(OWNER, {- order: ['search', 'automations', 'plugins', 'bots'],+ order: ['search', 'automations', 'plugins'],visible: ['search'],});expect(getSidebarNavigationPrefs('owner-2')).toEqual({@@ -371,18 +369,17 @@ describe('sidebar navigation customization', () => {it('keeps a switched-off plugin at its place when other entries are reordered', () => {mainViewsMock.routeCapable = [SITES];setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'app:xd-sites', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'app:xd-sites', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],});render(<SidebarNavigationCustomize onDone={() => {}} />);expect(order()).not.toContain('站点');- act(() => sortableMock.props!.onReorder(['plugins', 'automations', 'bots', 'search']));+ act(() => sortableMock.props!.onReorder(['plugins', 'automations', 'search']));fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER).order).toEqual(['plugins','automations','app:xd-sites',- 'bots','search',]);});@@ -391,36 +388,34 @@ describe('sidebar navigation customization', () => {mainViewsMock.routeCapable = [SITES];mainViewsMock.sidebarVisible = [SITES];setSidebarNavigationPrefs(OWNER, {- order: ['app:xd-sites', 'automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['app:xd-sites', 'automations', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],});const view = render(<SidebarNavigationCustomize onDone={() => {}} />);mainViewsMock.sidebarVisible = [];view.rerender(<SidebarNavigationCustomize onDone={() => {}} />);- fireEvent.click(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.bots' }));+ fireEvent.click(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.search' }));fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER).order).toEqual(['app:xd-sites','automations','plugins',- 'bots','search',]);});it('keeps a reorder made after choosing reset', () => {setSidebarNavigationPrefs(OWNER, {- order: ['search', 'bots', 'plugins', 'automations'],+ order: ['search', 'plugins', 'automations'],visible: ['search'],});render(<SidebarNavigationCustomize onDone={() => {}} />);fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.reset' }));- act(() => sortableMock.props!.onReorder(['bots', 'automations', 'plugins', 'search']));+ act(() => sortableMock.props!.onReorder(['plugins', 'automations', 'search']));fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));expect(getSidebarNavigationPrefs(OWNER).order).toEqual([- 'bots',- 'automations','plugins',+ 'automations','search',]);});diff --git a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.bots.test.tsx b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsxsimilarity index 78%rename from apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.bots.test.tsxrename to apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsxindex 9ce869d88b..d4f841c425 100644--- a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.bots.test.tsx+++ b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsx@@ -4,7 +4,6 @@ import { act, cleanup, fireEvent, render, screen, within } from '@testing-librarimport { MemoryRouter, useLocation, useNavigate } from 'react-router-dom';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { MainViewHistoryProvider } from '@/contexts/MainViewHistoryContext';-import { publishNavigationAttention } from '@/lib/navigationAttentionStore';import { SidebarRailNavigation, SidebarTopNav, type SidebarRailSearchOptions } from '../SidebarTopNav';import {__testing as navigationTesting,@@ -30,9 +29,7 @@ const SITES: MainViewMock = {vi.mock('react-i18next', () => ({useTranslation: () => ({- t: (key: string, vars?: { name?: string }) =>- ({ 'sidebar.tabs.bots': '伙伴', 'sidebar.backToSessions': '返回任务' })[key] ??- (vars?.name ? `${key}: ${vars.name}` : key),+ t: (key: string, vars?: { name?: string }) => (vars?.name ? `${key}: ${vars.name}` : key),}),}));const unreadMock = vi.hoisted(() => ({ ordinary: false }));@@ -51,14 +48,17 @@ vi.mock('../GhostMainViewNavEntries', () => ({MAIN_VIEW_ICONS: { globe: () => null },}));vi.mock('@/features/cc-agent/sidebar/SidebarInlineSearch', () => ({- SidebarInlineSearch: ({ openSignal, onFocusLeave }: { openSignal: number; onFocusLeave?: () => void }) =>- <button aria-label="Search row" data-open-signal={openSignal} onBlur={onFocusLeave}>Search row</button>,+ // Clicking stands in for typing a query: the real row reports that search became active.+ SidebarInlineSearch: ({ openSignal, onFocusLeave, onSearchActive }: {+ openSignal: number; onFocusLeave?: () => void; onSearchActive?: () => void;+ }) =>+ <button aria-label="Search row" data-open-signal={openSignal} onBlur={onFocusLeave} onClick={onSearchActive}>Search row</button>,}));vi.mock('@/features/cc-agent/sidebar/conversationSearchContext', () => ({useConversationSearchContext: () => ({ search: searchMock, allKnownProjects: [], openSignal: 0 }),}));-afterEach(() => { cleanup(); publishNavigationAttention({ tasks: 0, teammates: 0 }); });+afterEach(() => { cleanup(); });/** Pretend the owner's first run already happened, so plugins keep their default (More). */function seedKnownPlugins(ids: string[]) {@@ -76,8 +76,8 @@ beforeEach(() => {localStorage.removeItem('sidebar-navigation:apps:v1');navigationTesting.resetArrivals();setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],});});@@ -115,8 +115,8 @@ describe('Retirement attention across sidebar navigation placements', () => {const inMore = placement.endsWith('more');if (inMore) {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'search'],});}const ui = () => (@@ -155,72 +155,44 @@ describe('Retirement attention across sidebar navigation placements', () => {);});-describe('Sidebar teammate return action', () => {+describe('Sidebar navigation rows and More', () => {const openMore = () => {fireEvent.pointerDown(screen.getByRole('button', { name: 'sidebar.navigation.more' }), {button: 0,ctrlKey: false,});};+ const activateSearch = () => fireEvent.click(screen.getByRole('button', { name: 'Search row' }));- it('shows the destination count, preserves it when switching sections, hides zero and reuses 99+ overflow', () => {- publishNavigationAttention({ tasks: 4, teammates: 105 });+ it('no longer offers Teammates as a navigation entry or a More item', () => {render(<Harness initialPath="/cc-agent" />);- expect(screen.getByRole('button', { name: '伙伴' }).textContent).toBe('伙伴99+');- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- expect(screen.getByRole('button', { name: '返回任务' }).textContent).toBe('返回任务4');- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));- expect(screen.getByRole('button', { name: '伙伴' }).textContent).toBe('伙伴99+');- act(() => publishNavigationAttention({ tasks: 4, teammates: 0 }));- expect(screen.getByRole('button', { name: '伙伴' }).textContent).toBe('伙伴');- });-- it('keeps the teammate count on its More item and narrow rail tile', () => {- publishNavigationAttention({ tasks: 0, teammates: 3 });- setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'search'],- });- render(<Harness initialPath="/cc-agent" />);- fireEvent.pointerDown(screen.getByRole('button', { name: 'sidebar.navigation.more' }), { button: 0, ctrlKey: false });- expect(screen.getByRole('menuitem', { name: /伙伴/ }).textContent).toBe('伙伴3');- cleanup();- setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],- });- render(<MainViewHistoryProvider><MemoryRouter initialEntries={['/cc-agent']}>- <SidebarRailNavigation renderSearch={() => null} />- </MemoryRouter></MainViewHistoryProvider>);- expect(screen.getByRole('button', { name: '伙伴' }).textContent).toBe('3');+ expect(screen.queryByRole('button', { name: 'sidebar.tabs.bots' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'sidebar.backToSessions' })).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Open teammate' }));+ // On a teammate chat the same rows stay; there is no "back to tasks" swap.+ expect(screen.queryByRole('button', { name: 'sidebar.backToSessions' })).toBeNull();+ expect(screen.getByRole('button', { name: 'sidebar.tabs.plugins' })).toBeTruthy();+ openMore();+ expect(screen.queryByRole('menuitem', { name: /sidebar\.tabs\.bots|sidebar\.backToSessions/ })).toBeNull();});it('moves every unchecked entry into More and opens the same destination', () => {setSidebarNavigationPrefs(OWNER, {- order: ['bots', 'plugins', 'search', 'automations'],+ order: ['plugins', 'search', 'automations'],visible: [],});render(<Harness initialPath="/cc-agent/session-1" />);expect(screen.queryByRole('button', { name: 'ccAgent.layout.automations' })).toBeNull();expect(screen.queryByRole('button', { name: 'sidebar.tabs.plugins' })).toBeNull();- expect(screen.queryByRole('button', { name: '伙伴' })).toBeNull();expect(screen.queryByRole('button', { name: 'Search row' })).toBeNull();openMore();- const hidden = ['伙伴', 'sidebar.tabs.plugins', 'sidebar.navigation.items.search', 'ccAgent.layout.automations'];+ const hidden = ['sidebar.tabs.plugins', 'sidebar.navigation.items.search', 'ccAgent.layout.automations'];const items = hidden.map((name) => screen.getByRole('menuitem', { name }));expect(items.every((item, index) =>index === 0 || Boolean(items[index - 1].compareDocumentPosition(item) & Node.DOCUMENT_POSITION_FOLLOWING),)).toBe(true);fireEvent.click(items[0]);- expect(screen.getByTestId('location').textContent).toBe('/bots/list');-- openMore();- fireEvent.click(screen.getByRole('menuitem', { name: '返回任务' }));- expect(screen.getByTestId('location').textContent).toBe('/cc-agent/session-1');-- openMore();- fireEvent.click(screen.getByRole('menuitem', { name: 'sidebar.tabs.plugins' }));expect(screen.getByTestId('location').textContent).toBe('/plugins');openMore();@@ -230,8 +202,8 @@ describe('Sidebar teammate return action', () => {it('opens an unchecked Search from More without changing its saved visibility', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins'],});render(<Harness initialPath="/cc-agent" />);expect(screen.queryByRole('button', { name: 'Search row' })).toBeNull();@@ -249,7 +221,7 @@ describe('Sidebar teammate return action', () => {vi.useFakeTimers();try {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],visible: ['automations', 'search'],});render(<Harness initialPath="/cc-agent" />);@@ -282,7 +254,7 @@ describe('Sidebar teammate return action', () => {it('still moves focus into More when it is opened from the keyboard', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],visible: ['automations', 'search'],});render(<Harness initialPath="/cc-agent" />);@@ -295,7 +267,7 @@ describe('Sidebar teammate return action', () => {it('keeps checked entries out of More', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],visible: ['automations', 'search'],});render(<Harness initialPath="/cc-agent" />);@@ -303,13 +275,12 @@ describe('Sidebar teammate return action', () => {expect(screen.queryByRole('menuitem', { name: 'ccAgent.layout.automations' })).toBeNull();expect(screen.queryByRole('menuitem', { name: 'sidebar.navigation.items.search' })).toBeNull();expect(screen.getByRole('menuitem', { name: 'sidebar.tabs.plugins' })).toBeTruthy();- expect(screen.getByRole('menuitem', { name: '伙伴' })).toBeTruthy();});it('places Search in the saved order and does not add an Issue entry', () => {setSidebarNavigationPrefs(OWNER, {- order: ['search', 'plugins', 'automations', 'bots'],- visible: ['search', 'plugins', 'automations', 'bots'],+ order: ['search', 'plugins', 'automations'],+ visible: ['search', 'plugins', 'automations'],});render(<Harness initialPath="/cc-agent" />);const search = screen.getByRole('button', { name: 'Search row' });@@ -320,8 +291,8 @@ describe('Sidebar teammate return action', () => {it('hides Search until an active query needs its input again', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins'],});const view = render(<Harness initialPath="/cc-agent" />);expect(screen.queryByRole('button', { name: 'Search row' })).toBeNull();@@ -337,22 +308,21 @@ describe('Sidebar teammate return action', () => {it('keeps entries after a mid-list Search reachable while a query is pinned', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'search', 'plugins', 'bots'],- visible: ['automations', 'search', 'plugins', 'bots'],+ order: ['automations', 'search', 'plugins'],+ visible: ['automations', 'search', 'plugins'],});searchMock.query = 'needle';render(<Harness initialPath="/cc-agent" />);const search = screen.getByRole('button', { name: 'Search row' });const plugins = screen.getByRole('button', { name: 'sidebar.tabs.plugins' });expect(search.compareDocumentPosition(plugins) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();- expect(screen.getByRole('button', { name: '伙伴' })).toBeTruthy();expect(screen.getByRole('button', { name: 'sidebar.navigation.more' })).toBeTruthy();});it('keeps a hidden Search accessible for a project-scoped search', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins'],});searchMock.lockedProjectKey = 'project-1';render(<Harness initialPath="/cc-agent" />);@@ -362,8 +332,8 @@ describe('Sidebar teammate return action', () => {mainViewsMock.routeCapable = [SITES];mainViewsMock.sidebarVisible = [SITES];setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'app:xd-sites', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'app:xd-sites', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],});render(<Harness initialPath="/cc-agent" />);const automations = screen.getByRole('button', { name: 'ccAgent.layout.automations' });@@ -387,8 +357,8 @@ describe('Sidebar teammate return action', () => {render(<Harness initialPath="/cc-agent" />);expect(screen.getByRole('button', { name: '站点' })).toBeTruthy();act(() => setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins', 'search'],appsAtTop: [],}));expect(screen.queryByRole('button', { name: '站点' })).toBeNull();@@ -437,42 +407,49 @@ describe('Sidebar teammate return action', () => {expect(screen.getAllByRole('menuitem').map((item) => item.textContent)).toEqual(['sidebar.navigation.customize.title']);});- it('respects hidden teammate navigation in the narrow rail', () => {- setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins'],- });- render(<MainViewHistoryProvider><MemoryRouter initialEntries={['/cc-agent']}>+ it('renders nothing in the rail slot other features borrow', () => {+ // Teammates used to lend other features' rails a tile here; the task rail's+ // CollapsedView owns that entry now.+ const view = render(<MainViewHistoryProvider><MemoryRouter initialEntries={['/plugins']}><SidebarTopNav section="rail" /></MemoryRouter></MainViewHistoryProvider>);- expect(screen.queryByRole('button', { name: '伙伴' })).toBeNull();- act(() => setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots', 'search'],- }));+ expect(view.container.childElementCount).toBe(0);});- it('keeps the previous task when visiting automations before teammates', () => {++ it('keeps the previous task when visiting automations before plugins', () => {const sessionPath = '/cc-agent/session-1?remoteHostId=host-1#message-2';render(<Harness initialPath={sessionPath} />);fireEvent.click(screen.getByRole('button', { name: 'ccAgent.layout.automations' }));expect(screen.getByRole('button', { name: 'ccAgent.layout.automations' }).getAttribute('aria-current')).toBe('page');- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));+ fireEvent.click(screen.getByRole('button', { name: 'sidebar.tabs.plugins' }));+ expect(screen.getByTestId('location').textContent).toBe('/plugins');+ // Searching outside the task view returns to it, where the results are drawn.+ activateSearch();expect(screen.getByTestId('location').textContent).toBe(sessionPath);expect(screen.getByRole('button', { name: 'ccAgent.layout.automations' }).hasAttribute('aria-current')).toBe(false);});it.each(['/cc-agent/scheduled', '/cc-agent/scheduled/?filter=enabled#schedule-1'])(- 'returns to the task index after entering teammates from %s without a previous task',+ 'returns to the task index after entering plugins from %s without a previous task',(initialPath) => {render(<Harness initialPath={initialPath} />);- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));+ fireEvent.click(screen.getByRole('button', { name: 'sidebar.tabs.plugins' }));+ activateSearch();expect(screen.getByTestId('location').textContent).toBe('/cc-agent');expect(screen.getByRole('button', { name: 'ccAgent.layout.automations' }).hasAttribute('aria-current')).toBe(false);},);+ it('keeps a teammate chat open when search becomes active on it', () => {+ // Teammates share the task sidebar, so results show in place instead of leaving the chat.+ render(<Harness initialPath="/bots/teammate-2" />);+ activateSearch();+ expect(screen.getByTestId('location').textContent).toBe('/bots/teammate-2');+ fireEvent.click(screen.getByRole('button', { name: 'Open plugins' }));+ activateSearch();+ expect(screen.getByTestId('location').textContent).toBe('/cc-agent');+ });+it('does not seed a new owner from the unchanged router entry', () => {const oldPath = '/cc-agent/old-owner-session?remoteHostId=old-host#message-2';function OwnerRouter({ owner }: { owner: string }) {@@ -489,56 +466,23 @@ describe('Sidebar teammate return action', () => {const view = render(<PersistentRouter owner="one" />);view.rerender(<PersistentRouter owner="two" />);expect(screen.getByTestId('location').textContent).toBe(oldPath);- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));+ fireEvent.click(screen.getByRole('button', { name: 'sidebar.tabs.plugins' }));+ activateSearch();expect(screen.getByTestId('location').textContent).toBe('/cc-agent');const newPath = '/cc-agent/new-owner-session?remoteHostId=new-host#message-3';fireEvent.click(screen.getByRole('button', { name: 'Open task' }));view.rerender(<PersistentRouter owner="two" />);- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));+ fireEvent.click(screen.getByRole('button', { name: 'sidebar.tabs.plugins' }));+ activateSearch();expect(screen.getByTestId('location').textContent).toBe(newPath);});- it('changes the existing entry and restores both destinations across sidebar remounts', () => {- const sessionPath = '/cc-agent/session-1?remoteHostId=host-1#message-2';- render(<Harness initialPath={sessionPath} />);- const initialButtonCount = screen.getAllByRole('button').length;- const entry = screen.getByRole('button', { name: '伙伴' });- expect(entry.querySelector('.lucide-bot')).not.toBeNull();- fireEvent.click(entry);-- const back = screen.getByRole('button', { name: '返回任务' });- expect(back.textContent).toBe('返回任务');- expect(back.querySelector('.lucide-arrow-left')).not.toBeNull();- expect(back.hasAttribute('aria-current')).toBe(false);- expect(back.hasAttribute('aria-pressed')).toBe(false);- expect(back.className).not.toContain('bg-sidebar-item-active');- expect(screen.queryByRole('button', { name: '伙伴' })).toBeNull();- expect(screen.getAllByRole('button')).toHaveLength(initialButtonCount);-- fireEvent.click(screen.getByRole('button', { name: 'Open teammate' }));- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));- expect(screen.getByTestId('location').textContent).toBe(sessionPath);- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- expect(screen.getByTestId('location').textContent).toBe('/bots/teammate-2');- });-- it('returns a direct teammate entry to the session index, even after visiting plugins', () => {- render(<Harness initialPath="/bots/teammate-2" />);- fireEvent.click(screen.getByRole('button', { name: 'Open plugins' }));- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- expect(screen.getByTestId('location').textContent).toBe('/bots/teammate-2');- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));- expect(screen.getByTestId('location').textContent).toBe('/cc-agent');- });-it('discards remembered destinations when the account scope changes', () => {const view = render(<Harness initialPath="/cc-agent/private-session" />);- fireEvent.click(screen.getByRole('button', { name: '伙伴' }));- view.rerender(<Harness initialPath="/bots" owner="two" />);- fireEvent.click(screen.getByRole('button', { name: '返回任务' }));+ fireEvent.click(screen.getByRole('button', { name: 'sidebar.tabs.plugins' }));+ view.rerender(<Harness initialPath="/plugins" owner="two" />);+ activateSearch();expect(screen.getByTestId('location').textContent).toBe('/cc-agent');});});@@ -578,11 +522,11 @@ describe('Narrow rail navigation', () => {it('lays out checked entries in the saved order', () => {setSidebarNavigationPrefs(OWNER, {- order: ['search', 'bots', 'automations', 'plugins'],- visible: ['search', 'bots', 'automations', 'plugins'],+ order: ['search', 'plugins', 'automations'],+ visible: ['search', 'plugins', 'automations'],});renderRail();- const names = ['Rail search', '伙伴', 'ccAgent.layout.automations', 'sidebar.tabs.plugins'];+ const names = ['Rail search', 'sidebar.tabs.plugins', 'ccAgent.layout.automations'];const tiles = names.map((name) => screen.getByRole('button', { name }));expect(tiles.every((tile, index) =>index === 0 || Boolean(tiles[index - 1].compareDocumentPosition(tile) & Node.DOCUMENT_POSITION_FOLLOWING),@@ -593,8 +537,8 @@ describe('Narrow rail navigation', () => {renderRail();expect(screen.queryByRole('button', { name: 'sidebar.navigation.more' })).toBeNull();act(() => setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'search'],}));openMore();expect(screen.getByRole('menuitem', { name: 'sidebar.tabs.plugins' })).toBeTruthy();@@ -607,8 +551,8 @@ describe('Narrow rail navigation', () => {mainViewsMock.routeCapable = [SITES, other, off];mainViewsMock.sidebarVisible = [SITES, other];setSidebarNavigationPrefs(OWNER, {- order: ['app:xd-sites', 'automations', 'plugins', 'bots', 'search', 'app:other', 'app:off'],- visible: ['automations', 'plugins', 'bots', 'search'],+ order: ['app:xd-sites', 'automations', 'plugins', 'search', 'app:other', 'app:off'],+ visible: ['automations', 'plugins', 'search'],appsAtTop: ['app:xd-sites'],});renderRail();@@ -626,13 +570,12 @@ describe('Narrow rail navigation', () => {it('moves unchecked entries into More and opens the same destination', () => {setSidebarNavigationPrefs(OWNER, {- order: ['plugins', 'automations', 'bots', 'search'],+ order: ['plugins', 'automations', 'search'],visible: ['search'],});renderRail();expect(screen.queryByRole('button', { name: 'sidebar.tabs.plugins' })).toBeNull();expect(screen.queryByRole('button', { name: 'ccAgent.layout.automations' })).toBeNull();- expect(screen.queryByRole('button', { name: '伙伴' })).toBeNull();openMore();expect(screen.queryByRole('menuitem', { name: 'sidebar.navigation.items.search' })).toBeNull();@@ -643,16 +586,12 @@ describe('Narrow rail navigation', () => {openMore();fireEvent.click(screen.getByRole('menuitem', { name: 'sidebar.tabs.plugins' }));expect(screen.getByTestId('location').textContent).toBe('/plugins');-- openMore();- fireEvent.click(screen.getByRole('menuitem', { name: '伙伴' }));- expect(screen.getByTestId('location').textContent).toBe('/bots/list');});it('opens an unchecked Search from More and hides it again once closed', async () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins'],});renderRail();expect(screen.queryByRole('button', { name: 'Rail search' })).toBeNull();@@ -666,8 +605,8 @@ describe('Narrow rail navigation', () => {it('keeps a hidden Search for a project-scoped search request', () => {setSidebarNavigationPrefs(OWNER, {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'plugins', 'bots'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations', 'plugins'],});renderRail({ forceSearch: true });expect(screen.getByRole('button', { name: 'Rail search' }).getAttribute('data-default-open'))@@ -760,7 +699,7 @@ describe('Plugins joining the sidebar', () => {it('shows each account its own navigation layout', () => {setSidebarNavigationPrefs('owner-2', {- order: ['automations', 'plugins', 'bots', 'search'],+ order: ['automations', 'plugins', 'search'],visible: ['automations'],});const view = renderNav();@@ -788,13 +727,14 @@ describe('Plugins joining the sidebar', () => {it('starts a fresh Customize draft when the account changes while it is open', () => {setSidebarNavigationPrefs('owner-2', {- order: ['automations', 'plugins', 'bots', 'search'],- visible: ['automations', 'search'],+ order: ['automations', 'plugins', 'search'],+ visible: ['automations'],});const view = renderNav();openMore();fireEvent.click(screen.getByRole('menuitem', { name: 'sidebar.navigation.customize.title' }));- // Account A unchecks Plugins in the draft, then the account switches before Done.+ // Account A unchecks Plugins in the draft (Search stays checked), then the account+ // switches before Done.fireEvent.click(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.plugins' }));authMock.owner = 'owner-2';view.rerender(@@ -804,10 +744,10 @@ describe('Plugins joining the sidebar', () => {</MemoryRouter></MainViewHistoryProvider>,);- expect(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.bots' }).getAttribute('aria-checked'))+ expect(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.search' }).getAttribute('aria-checked')).toBe('false');fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' }));- expect(getSidebarNavigationPrefs('owner-2').visible).toEqual(['automations', 'search']);- expect(getSidebarNavigationPrefs(OWNER).visible).toEqual(['automations', 'plugins', 'bots', 'search']);+ expect(getSidebarNavigationPrefs('owner-2').visible).toEqual(['automations']);+ expect(getSidebarNavigationPrefs(OWNER).visible).toEqual(['automations', 'plugins', 'search']);});});diff --git a/apps/desktop/src/renderer/components/sidebar/sidebarNavigationPrefs.ts b/apps/desktop/src/renderer/components/sidebar/sidebarNavigationPrefs.tsindex 6a4e8dadf2..fbc3235cdc 100644--- a/apps/desktop/src/renderer/components/sidebar/sidebarNavigationPrefs.ts+++ b/apps/desktop/src/renderer/components/sidebar/sidebarNavigationPrefs.ts@@ -1,15 +1,18 @@import { useSyncExternalStore } from 'react';-import { Bot, Plug, Search, Timer, type LucideIcon } from 'lucide-react';+import { Plug, Search, Timer, type LucideIcon } from 'lucide-react';import { readSidebarOwnerStorage, writeSidebarOwnerStorage } from '@/lib/sidebarOwnerStorage';-/** Stable built-in entries only; installed app entries keep their own visibility settings. */-export type SidebarNavigationItemId = 'automations' | 'plugins' | 'bots' | 'search';+/**+ * Stable built-in entries only; installed app entries keep their own visibility settings.+ * Teammates left this list on 2026-10-13: they live in the sidebar's own section above+ * Pinned. Saved orders and visibility that still name `bots` are dropped on read.+ */+export type SidebarNavigationItemId = 'automations' | 'plugins' | 'search';export const SIDEBAR_NAVIGATION_ITEMS: readonly SidebarNavigationItemId[] = ['automations','plugins',- 'bots','search',];@@ -17,14 +20,12 @@ export const SIDEBAR_NAVIGATION_ITEMS: readonly SidebarNavigationItemId[] = [export const SIDEBAR_NAVIGATION_ITEM_ICONS: Record<SidebarNavigationItemId, LucideIcon> = {automations: Timer,plugins: Plug,- bots: Bot,search: Search,};export const DEFAULT_SIDEBAR_NAVIGATION_VISIBLE: readonly SidebarNavigationItemId[] = ['automations','plugins',- 'bots','search',];diff --git a/apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx b/apps/desktop/src/renderer/features/bots/BotCreateMenu.tsxindex 1cf5756e29..088a8b8bc3 100644--- a/apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx+++ b/apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx@@ -8,7 +8,8 @@ import { BotGroupCreateDialog } from './BotGroupCreateDialog';import { ChatInviteDialog } from './ChatInviteDialog';import { useTranslation } from 'react-i18next';-export function BotCreateMenu({ compact = false, label }: { compact?: boolean; label?: string }) {+/** `header`:侧栏伙伴段头里的 20px 图标钮,与置顶 / 全部任务段头动作同尺寸。 */+export function BotCreateMenu({ variant, label }: { variant?: 'header'; label?: string }) {const { t } = useTranslation();const navigate = useNavigate();const [dialog, setDialog] = useState<'bot' | 'group' | 'join' | null>(null);@@ -33,13 +34,13 @@ export function BotCreateMenu({ compact = false, label }: { compact?: boolean; l<buttonref={trigger}type="button"- className={compact- ? 'flex h-8 w-8 items-center justify-center rounded-full text-[var(--sidebar-nav-text)] hover:bg-sidebar-item-hover'+ className={variant === 'header'+ ? 'flex h-5 w-5 shrink-0 items-center justify-center rounded-lg text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]': 'flex h-7 w-7 items-center justify-center rounded-full text-[var(--sidebar-list-muted)] transition-colors hover:bg-sidebar-item-hover hover:text-[var(--sidebar-nav-text)]'}aria-label={t('bots.list.createMenu')}>- <Plus size={compact ? 16 : 15} />+ <Plus size={variant === 'header' ? 13 : 15} strokeWidth={variant === 'header' ? 2 : undefined} /></button></DropdownMenuTrigger><DropdownMenuContent align="end" onCloseAutoFocus={event => {diff --git a/apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx b/apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsxindex 41a4c06e2f..4c01a7a67a 100644--- a/apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx+++ b/apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx@@ -2,15 +2,18 @@ import { useContext, useEffect, useRef } from 'react';import { MainViewHistoryContext } from '@/contexts/MainViewHistoryContext';import { Outlet, useOutletContext, useParams, useLocation, useNavigate } from 'react-router-dom';-import { useOwnTopNavScrollableRows } from '../feature-context';-import { BotsSidebar } from './BotsSidebar';+import { useRegisterCCAgentSidebar } from '../cc-agent/useRegisterCCAgentSidebar';import { BotSettingsDrawer } from './BotSettingsDrawer';import { BotGroupSettingsDrawer } from './BotGroupSettingsDrawer';import { useBotProfiles } from './botStore';import { useBotGroupSummary } from './botGroupStore';+/**+ * 伙伴路由与任务共用同一个侧栏(伙伴段在置顶上方,2026-10-13 定稿):这里只注册+ * 任务侧栏,不再整栏切换成伙伴列表。设置抽屉仍挂在本布局,按自身路由自判开关。+ */export function BotsFeatureLayout() {- useOwnTopNavScrollableRows(false);+ useRegisterCCAgentSidebar();const history = useContext(MainViewHistoryContext);const { botId, deviceId, groupId } = useParams();const location = useLocation();@@ -52,7 +55,6 @@ export function BotsFeatureLayout() {} | null>();return (<>- <BotsSidebar /><Outlet context={shellContext} /><BotSettingsDrawer /><BotGroupSettingsDrawer />diff --git a/apps/desktop/src/renderer/features/bots/BotsListView.tsx b/apps/desktop/src/renderer/features/bots/BotsListView.tsxindex 3c659e8c9e..4b4e595243 100644--- a/apps/desktop/src/renderer/features/bots/BotsListView.tsx+++ b/apps/desktop/src/renderer/features/bots/BotsListView.tsx@@ -1,9 +1,9 @@import { useTranslation } from 'react-i18next';/**- * BotsFeatureLayout already supplies the partner list in its sidebar. Leave the- * content pane unselected on startup: /bots selects Cindy and /bots/roster opens- * the creation dialog. Neither belongs to passive navigation restoration.+ * The shared sidebar already shows the teammates section. Leave the content pane+ * unselected here (e.g. after closing a paused teammate's settings): /bots selects+ * Cindy and /bots/roster opens the creation dialog.*/export function BotsListView() {const { t } = useTranslation();diff --git a/apps/desktop/src/renderer/features/bots/TeammateSearchResults.tsx b/apps/desktop/src/renderer/features/bots/TeammateSearchResults.tsxnew file mode 100644index 0000000000..3e98683542--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/TeammateSearchResults.tsx@@ -0,0 +1,128 @@+import { Users } from 'lucide-react';+import { useMemo } from 'react';+import { useNavigate } from 'react-router-dom';+import { useTranslation } from 'react-i18next';++import { BotAvatar } from './BotAvatar';+import { useBotGroupList } from './botGroupStore';+import { filterBotRoster, sortBotRoster } from './botRosterDisplay';+import { useBotProfiles } from './botStore';+import { useCompanionCloud } from './companionCloudStore';+import { cloudRemoteBots, withoutShadowedBots } from './companionCloudPresentation';+import { useRemoteBots } from './useRemoteBots';++export interface TeammateSearchMatch {+ key: string;+ kind: 'bot' | 'group';+ name: string;+ /** 已归档的群:段内不再列出,只能从这里找回。 */+ archived?: boolean;+ detail: string;+ route: string;+ avatar: Parameters<typeof BotAvatar>[0]['bot'] | null;+}++/**+ * 侧栏总搜索里的伙伴 / 群聊命中(2026-10-13:伙伴段不再有独立搜索框)。+ * 本机伙伴按名字、简介、技能匹配,含已隐藏、不含已停止;远程伙伴按名字、简介、电脑名;+ * 群聊按群名与成员名,含已归档的群(段内不列出,在这里找回)。只读已有的名册投影,不发起额外查询。+ */+export function useTeammateSearchMatches(rawQuery: string): TeammateSearchMatch[] {+ const cloud = useCompanionCloud();+ const allBots = useBotProfiles();+ const rosterRemoteBots = useRemoteBots();+ // 与伙伴段同一份名册:隐藏已交给别的电脑的本机副本,每个云端伙伴只在主力电脑上列一行。+ const bots = useMemo(() => withoutShadowedBots(allBots, cloud), [allBots, cloud]);+ const remoteBots = useMemo(() => cloudRemoteBots(cloud, rosterRemoteBots), [rosterRemoteBots, cloud]);+ const { groups } = useBotGroupList();+ return useMemo(() => {+ const query = rawQuery.trim().toLocaleLowerCase();+ if (!query) return [];+ const includes = (...values: Array<string | null | undefined>) =>+ values.some((value) => Boolean(value) && value!.toLocaleLowerCase().includes(query));+ const local = filterBotRoster(+ sortBotRoster(bots.filter((bot) => bot.status !== 'archived')),+ query,+ ).map((bot): TeammateSearchMatch => ({+ key: `bot:${bot.id}`,+ kind: 'bot',+ name: bot.name,+ detail: bot.description,+ route: `/bots/${bot.id}`,+ avatar: bot,+ }));+ const remote = remoteBots+ .filter((bot) => includes(bot.name, bot.description, bot.deviceName))+ .map((bot): TeammateSearchMatch => ({+ key: `remote:${bot.deviceId}:${bot.id}`,+ kind: 'bot',+ name: bot.name,+ detail: bot.deviceName,+ route: `/bots/remote/${encodeURIComponent(bot.deviceId)}/${encodeURIComponent(bot.id)}`,+ avatar: bot,+ }));+ const groupMatches = groups+ .filter((group) => includes(group.name, ...group.members.map((member) => member.name)))+ .map((group): TeammateSearchMatch => ({+ key: `group:${group.id}`,+ kind: 'group',+ name: group.name,+ archived: Boolean(group.archived),+ detail: group.members.map((member) => member.name).join('、'),+ route: `/bots/groups/${encodeURIComponent(group.id)}`,+ avatar: group.members[0] ?? null,+ }));+ return [...local, ...remote, ...groupMatches];+ }, [bots, remoteBots, groups, rawQuery]);+}++/** 与会话结果行同几何(rounded-lg、px-3 py-2.5、20px 标记、13 号标题、类型小标签)。 */+export function TeammateSearchResults({+ matches,+ onSelected,+}: {+ matches: readonly TeammateSearchMatch[];+ /** 选中后的附加动作;内联展开态默认保留查询,便于连续点开。 */+ onSelected?: () => void;+}) {+ const { t } = useTranslation();+ const navigate = useNavigate();+ if (matches.length === 0) return null;+ return (+ <div data-teammate-search-results>+ {matches.map((match) => (+ <button+ key={match.key}+ type="button"+ onClick={() => {+ navigate(match.route);+ onSelected?.();+ }}+ className="flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-[var(--cmd-palette-item-hover)]"+ >+ {match.avatar ? (+ <BotAvatar bot={match.avatar} size="xs" className="mt-0.5" />+ ) : (+ <span className="mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--surface-chip)] text-[var(--cmd-palette-item-icon)]">+ <Users size={13} />+ </span>+ )}+ <span className="min-w-0 flex-1">+ <span className="flex min-w-0 items-center gap-2">+ <span className="min-w-0 flex-1 truncate text-13 font-medium text-[var(--text-primary)]">{match.name}</span>+ {match.archived ? (+ <span className="shrink-0 text-10 leading-none text-[var(--text-tertiary)]">{t('bots.archived')}</span>+ ) : null}+ <span className="shrink-0 rounded-full bg-[var(--surface-chip)] px-1.5 py-0.5 text-10 leading-none text-[var(--text-tertiary)]">+ {match.kind === 'group' ? t('bots.groupChat.sidebar.title') : t('bots.title')}+ </span>+ </span>+ {match.detail ? (+ <span className="mt-1 block truncate text-11 leading-none text-[var(--text-tertiary)]">{match.detail}</span>+ ) : null}+ </span>+ </button>+ ))}+ </div>+ );+}diff --git a/apps/desktop/src/renderer/features/bots/BotsSidebar.tsx b/apps/desktop/src/renderer/features/bots/TeammatesSection.tsxsimilarity index 75%rename from apps/desktop/src/renderer/features/bots/BotsSidebar.tsxrename to apps/desktop/src/renderer/features/bots/TeammatesSection.tsxindex f8c9631dae..89ffc5eb61 100644--- a/apps/desktop/src/renderer/features/bots/BotsSidebar.tsx+++ b/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx@@ -1,32 +1,30 @@-import { useNavigationAttention } from '@/lib/navigationAttentionStore';-import { NavigationCountBadge } from '@/components/sidebar/NavigationCountBadge';import { BotGenerationLabel } from './BotGenerationLabel';import { botRosterLabel } from '../../../shared/botCreation';-import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from 'react';+import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode, type RefObject } from 'react';import {AlertTriangle,Archive,ArchiveRestore,- ArrowLeft,- Bot,+ Users,+ ChevronDown,+ ChevronRight,Copy,Eye,EyeOff,Pin,- Search,Settings,Trash2,} from 'lucide-react';import { matchPath, useLocation, useNavigate, useParams } from 'react-router-dom';import { useTranslation } from 'react-i18next';-import { projectDraftSessionTitle } from '@cindy/maker-shared/session-title';import { cn } from '@/lib/utils';+import { useAuth } from '@/contexts/AuthContext';+import { Tip } from '@/components/ui/tooltip';+import { SectionCollapse } from '@/features/cc-agent/sidebar/SectionCollapse';import { useConfirmDialog } from '@/components/ui/confirm-dialog-provider';import { getDataOwnerGeneration, isDataOwnerGenerationCurrent } from '@/contexts/dataOwnerGeneration';import type { BotGroupSummary } from '../../../shared/botGroupChat';-import * as sessionService from '@/lib/sessionService';-import { isOrcaWorkerSession } from '@/lib/orcaSessionIdentity';import {DropdownMenu,DropdownMenuContent,@@ -35,15 +33,6 @@ import {DropdownMenuTrigger,} from '@/components/ui/dropdown-menu';import { useAgentIslandActivityMap } from '@/state/agentIslandActivity';-import { useSessionRunningStatus } from '@/hooks/useSessionRunningStatus';-import { useActiveMainView } from '@/hooks/useActiveMainView';-import {- BOT_GROUP_LANE_SESSION,- botOwnedSessionNotificationTitle,- sendSessionEventNotification,-} from '@/lib/sessionEventNotification';-import { useSidebarCollapsedState, useRegisterSidebarUpper } from '../feature-context';-import { SidebarIconButton } from '@/components/sidebar/SidebarIconButton';import { useRemoteBots } from './useRemoteBots';import { useCompanionCloud } from './companionCloudStore';import { cloudRemoteBots, isCloudHomeOffline, withoutShadowedBots } from './companionCloudPresentation';@@ -59,8 +48,8 @@ import { BotGroupSidebarRow } from './BotGroupSidebarRow';import { refreshBotGroups, useBotGroupList } from './botGroupStore';import { BOT_GROUP_SETTINGS_PARAM } from './botGroupPresentation';import { chatErrorKey } from './chatError';-import { subscribeBotReadState, getBotLastReadAtMap } from './botReadState';-import { isBotGroupLaneSession, withoutBotGroupLanes } from './botGroupLane';+import { subscribeBotReadState, getBotLastReadAtMap, isBotGroupUnread } from './botReadState';+import { withoutBotGroupLanes } from './botGroupLane';import {botListSubtitle,botListTimestampAt,@@ -68,6 +57,7 @@ import {formatBotUnreadBadge,} from './botListDisplay';import { botDeviceLabel, partitionBotRoster } from './botRosterDisplay';+import { readTeammatesSectionCollapsed, writeTeammatesSectionCollapsed } from './teammatesSectionPrefs';import {canonicalBotSessionId,duplicateBotProfile,@@ -89,16 +79,83 @@ const readRevision = () => JSON.stringify(getBotLastReadAtMap());const UNREAD_BADGE_CLASS ='flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-[var(--bot-unread-bg)] px-1 text-10 font-medium tabular-nums leading-none text-[var(--bot-unread-fg)]';-function BotsSidebarContent() {- const { navigateToView } = useActiveMainView();+/** 段头悬停动作:与置顶 / 项目段头同款,鼠标离开后只保留键盘焦点或打开中的菜单。 */+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',+ 'has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100',+ 'has-[[data-state=open]]:pointer-events-auto has-[[data-state=open]]:opacity-100',+);+const HEADER_ICON_BUTTON_CLASS =+ 'flex h-5 w-5 shrink-0 items-center justify-center rounded-lg text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]';++/** 收起态头像行:28px 头像 + 8px 间距。 */+const AVATAR_SLOT_PX = 36;++/**+ * 收起态只占一行:按内容宽度算出能放几个头像(含末尾「+N」),伙伴再多也不换行。+ * 尚未测量(宽度 0,如首帧或测试环境)时不截断。+ */+function useAvatarRowCapacity(ref: RefObject<HTMLDivElement | null>, active: boolean): number {+ const [width, setWidth] = useState(0);+ // 头像行只在收起时挂载:每次收起后重新挂上观察。+ useEffect(() => {+ const element = active ? ref.current : null;+ if (!element || typeof ResizeObserver === 'undefined') return undefined;+ const observer = new ResizeObserver((entries) => {+ setWidth(Math.floor(entries[0]?.contentRect.width ?? 0));+ });+ observer.observe(element);+ return () => observer.disconnect();+ }, [ref, active]);+ return width > 0 ? Math.max(1, Math.floor((width + 8) / AVATAR_SLOT_PX)) : Number.POSITIVE_INFINITY;+}++/** 群聊在头像行里用两位成员叠放,和单聊头像一眼可分。 */+function GroupMiniAvatar({ members }: { members: readonly Parameters<typeof BotAvatar>[0]['bot'][] }) {+ const [first, second] = members;+ if (!first || !second) {+ return (+ <span aria-hidden className="flex h-7 w-7 items-center justify-center rounded-full bg-[var(--surface-chip)] text-[var(--sidebar-list-muted)]">+ <Users size={14} strokeWidth={2} />+ </span>+ );+ }+ return (+ <span aria-hidden className="relative block h-7 w-7">+ <BotAvatar bot={first} size="xs" className="absolute left-0 top-0 h-[18px] w-[18px] text-10" />+ <span className="absolute bottom-0 right-0 flex rounded-full border-[1.5px] border-sidebar">+ <BotAvatar bot={second} size="xs" className="h-[18px] w-[18px] text-10" />+ </span>+ </span>+ );+}++/**+ * 侧栏第一层的「伙伴」段(2026-10-13 定稿):固定在置顶段上方,与置顶、全部任务并存。+ * 点伙伴只切换主区域,左栏不再整栏切换。段名在「展开(行列表)」与「收起成一排头像」+ * 之间切换,默认展开,按账号记住。通知不在这里发 —— 唯一 owner 是任务侧栏。+ */+export function TeammatesSection() {const { t } = useTranslation();const { confirm } = useConfirmDialog();- const navigationCounts = useNavigationAttention();const navigate = useNavigate();const { pathname } = useLocation();- const { botId, sessionId, deviceId, groupId } = useParams();+ const { dataOwnerId } = useAuth();+ const { botId, deviceId, groupId } = useParams();// The registered sidebar slot can sit outside the group's route context.const selectedGroupId = matchPath('/bots/groups/:groupId', pathname)?.params.groupId;+ const [collapsed, setCollapsed] = useState(() => readTeammatesSectionCollapsed(dataOwnerId));+ const avatarRowRef = useRef<HTMLDivElement>(null);+ const avatarCapacity = useAvatarRowCapacity(avatarRowRef, collapsed);+ useEffect(() => {+ setCollapsed(readTeammatesSectionCollapsed(dataOwnerId));+ }, [dataOwnerId]);+ const toggleCollapsed = () => {+ const next = !collapsed;+ setCollapsed(next);+ writeTeammatesSectionCollapsed(dataOwnerId, next);+ };const cloud = useCompanionCloud();const rosterRemoteBots = useRemoteBots();// One row per companion, on its main computer (offline rows for computers never listed here).@@ -117,9 +174,6 @@ function BotsSidebarContent() {const unreadByBotId = useBotUnreadCounts();const rosterBots = bots.filter((bot) => bot.status !== 'archived');const archivedBots = bots.filter((bot) => bot.status === 'archived');- const collapsed = useSidebarCollapsedState();- const [query, setQuery] = useState('');- const [searchFocused, setSearchFocused] = useState(false);const [showHidden, setShowHidden] = useState(false);const [archiveBusy, setArchiveBusy] = useState(false);const archiveBusyRef = useRef(false);@@ -135,7 +189,6 @@ function BotsSidebarContent() {const menuOriginRef = useRef<HTMLButtonElement | null>(null);const menuPointerDownRef = useRef(false);const menuRestoreFocusRef = useRef(true);- const searchInputRef = useRef<HTMLInputElement | null>(null);const sidebarRef = useRef<HTMLDivElement | null>(null);const previousSelectedGroupRef = useRef(groups.find(group => group.id === selectedGroupId));const pendingArchiveFocusRef = useRef<{ groupId: string; archived: boolean; origin: HTMLElement | null } | null>(null);@@ -182,23 +235,7 @@ function BotsSidebarContent() {}};- /*- 「正在输入…」的信号来源:灵动岛活动镜像(state/agentIslandActivity)。- **没有新增 IPC** —— 主进程本来就在广播这份 per-session 快照,任务列表的- SessionCard 用的也是它,这里只是多一个读者。-- 为什么选它而不是 makerChatStore 的全局 running 快照:- - 它是全量推送,主进程持有状态机,窗口在一次 turn 中途冷启动也补得回来;- makerChatStore 的分片要等该会话**下一个**事件到达才materialize,长工具- 调用期间会是空的。- - 它与灵动岛开关无关,非 macOS 上服务也以 headless 方式跑着照常广播- (main/agent-island/service.ts 的 publish 两条分支都会 emit)。- - 依赖轻:只吃 shared 里的类型,不用把整个聊天 store 拖进侧栏。-- 当前侧栏只有一个 owner:进入伙伴页时普通任务侧栏会被这个节点替换,因此这里- 必须接手 useSessionRunningStatus。否则用户停留在伙伴页时,伙伴和普通任务的- 完成、失败、待回复都没有系统通知。- */+ // 「正在输入…」读灵动岛活动镜像(全量推送,与任务列表同源),不新增 IPC。const islandActivity = useAgentIslandActivityMap();const botRunningActivity = (bot: BotProfile) => {// 委派干活发生在子任务,不在主任务。只看 canonical 的话,目标伙伴侧栏会一直是@@ -210,31 +247,20 @@ function BotsSidebarContent() {return withoutBotGroupLanes(bot.sessions).map((session) => islandActivity.get(session.id)).find((activity) => activity?.phase === 'running');};- const roster = partitionBotRoster(rosterBots, { query, showHidden });+ // 伙伴搜索并入侧栏总搜索(TeammateSearchResults),段内不再单独筛选。+ const roster = partitionBotRoster(rosterBots, { query: '', showHidden });const cindyOptions = cindyDeviceOptions(bots, remoteBots, devices ?? [], unreadByBotId, t('bots.devicePicker.local'));const hasMultipleCindys = cindyOptions.length > 1;const routeCindy = cindyOptions.find(option => option.key === cindyDeviceKey({ id: botId ?? '', deviceId }));// Follow the open Cindy chat; otherwise the local-first roster is the default.const currentCindy = routeCindy ?? cindyOptions[0];- const normalizedQuery = query.trim().toLocaleLowerCase();- const showCindy = hasMultipleCindys && currentCindy && (- !normalizedQuery ||- roster.visible.some(bot => cindyOptions.some(option => option.bot === bot)) ||- cindyOptions.some(option =>- `${option.bot.name} ${option.bot.description} ${option.label} ${option.deviceName}`.toLocaleLowerCase().includes(normalizedQuery))- );+ const showCindy = hasMultipleCindys && Boolean(currentCindy);const visibleBots = [...roster.visible.filter(bot => !hasMultipleCindys || !cindyOptions.some(option => option.bot === bot)),- ...remoteBots.filter(bot => (!hasMultipleCindys || !isCindyDeviceBot(bot)) && (!normalizedQuery || `${bot.name} ${bot.description} ${bot.deviceName}`.toLocaleLowerCase().includes(normalizedQuery))),+ ...remoteBots.filter(bot => !hasMultipleCindys || !isCindyDeviceBot(bot)),];- const rosterSize = groups.length + rosterBots.length + remoteBots.length - (hasMultipleCindys ? cindyOptions.length - 1 : 0);- const hasArchivedGroups = groups.some(group => group.archived);- const showSearch = searchFocused || rosterSize >= 8 || normalizedQuery.length > 0 ||- hasArchivedGroups;- const matchesGroup = (group: BotGroupSummary) => !normalizedQuery ||- `${group.name} ${group.members.map(member => member.name).join(' ')}`.toLocaleLowerCase().includes(normalizedQuery);- const visibleGroups = groups.filter(group =>- (!group.archived || normalizedQuery.length > 0) && matchesGroup(group));+ // 已归档的群不在段内列出,经侧栏总搜索找回(TeammateSearchResults)。+ const visibleGroups = groups.filter(group => !group.archived);useEffect(() => {const previous = previousSelectedGroupRef.current;@@ -285,11 +311,11 @@ function BotsSidebarContent() {return;}- // Archived groups disappear from the default list and remain searchable.- // Keep focus on that visible recovery path when the row is removed.+ // Archived groups disappear from the section and stay findable through the+ // sidebar search. Keep focus inside the section when the row is removed.if (pending.archived) {pendingArchiveFocusRef.current = null;- const target = searchInputRef.current ?? sidebarRef.current?.querySelector<HTMLButtonElement>('button');+ const target = sidebarRef.current?.querySelector<HTMLButtonElement>('button');target?.focus();return;}@@ -316,84 +342,6 @@ function BotsSidebarContent() {activityAt: Math.max(...cindyOptions.map(option => 'activityAt' in option.bot ? option.bot.activityAt : option.bot.lastMessageAt ?? option.bot.createdAt)) }] : []),].sort((a, b) => Number(b.pinned) - Number(a.pinned) || b.activityAt - a.activityAt);- const { sessionOwners, groupLaneSessionIds } = useMemo(() => {- const owners = new Map<string, { bot: BotProfile; title: string }>();- const lanes = new Set<string>();- for (const bot of bots) {- for (const session of bot.sessions) {- if (isBotGroupLaneSession(session)) lanes.add(session.id);- else owners.set(session.id, { bot, title: session.title });- }- }- return { sessionOwners: owners, groupLaneSessionIds: lanes };- }, [bots]);- const activeBotSessionId = useMemo(() => {- if (sessionId) return sessionId;- if (deviceId) return remoteBots.find(bot => bot.deviceId === deviceId && bot.id === botId)?.sessionId ?? undefined;- const selectedBot = bots.find((bot) => bot.id === botId);- return selectedBot ? canonicalBotSessionId(selectedBot) : undefined;- }, [botId, bots, deviceId, remoteBots, sessionId]);- const fireSessionNotification = useCallback(- (targetSessionId: string, kind: 'done' | 'error' | 'needs-reply') => {- // 群专线不进系统通知(docs/product-rules/bot-group-chat.md §3);需要确认的操作在群里提示。- if (groupLaneSessionIds.has(targetSessionId)) return;- const owner = sessionOwners.get(targetSessionId);- if (owner) {- const title =- owner.title.trim() && owner.title !== owner.bot.name- ? `${owner.bot.name} · ${owner.title}`- : owner.bot.name;- sendSessionEventNotification(targetSessionId, title, kind);- return;- }- // useSessionRunningStatus observes the shared runtime map, so it also- // keeps ordinary tasks notifying while the user is on the Bots page.- // Resolve their real title lazily instead of exposing an internal id.- void sessionService- .get(targetSessionId)- .then(async (session) => {- if (isOrcaWorkerSession(session)) return;- // 伙伴画像可能还没投影到刚建好的群专线,用库里的最新归属再判一次。- if (- session.source === 'bot' &&- (await botOwnedSessionNotificationTitle(targetSessionId)) === BOT_GROUP_LANE_SESSION- ) {- return;- }- sendSessionEventNotification(- targetSessionId,- projectDraftSessionTitle(session.title, t('ccAgent.common.unnamedSession')),- kind,- );- })- .catch(() => {- sendSessionEventNotification(- targetSessionId,- t('ccAgent.common.unnamedSession'),- kind,- );- });- },- [groupLaneSessionIds, sessionOwners, t],- );- const handleSessionDone = useCallback(- (targetSessionId: string) => fireSessionNotification(targetSessionId, 'done'),- [fireSessionNotification],- );- const handleSessionError = useCallback(- (targetSessionId: string) => fireSessionNotification(targetSessionId, 'error'),- [fireSessionNotification],- );- const handleSessionNeedsReply = useCallback(- (targetSessionId: string) => fireSessionNotification(targetSessionId, 'needs-reply'),- [fireSessionNotification],- );- useSessionRunningStatus(activeBotSessionId, {- onSessionDone: handleSessionDone,- onSessionError: handleSessionError,- onSessionNeedsReply: handleSessionNeedsReply,- });-useEffect(() => {if (roster.visible.length + remoteBots.length + groups.length === 0) return;const timer = setInterval(() => setNow(Date.now()), 30_000);@@ -517,73 +465,133 @@ function BotsSidebarContent() {</BotGroupSidebarRow>);- if (collapsed) {- return (- <div ref={sidebarRef} className="flex flex-col items-center gap-2 px-2 pt-3">- {(pathname === '/bots' || pathname.startsWith('/bots/')) && (- <SidebarIconButton- icon={ArrowLeft}- label={t('sidebar.backToSessions')}- aria-description={navigationCounts.tasks > 0 ? t('sidebar.taskAttentionCount', { count: navigationCounts.tasks }) : undefined}- badge={<NavigationCountBadge count={navigationCounts.tasks} label={t('sidebar.taskAttentionCount', { count: navigationCounts.tasks })} />}- onClick={() => navigateToView('cc-agent')}- />- )}- <BotCreateMenu compact />- </div>- );- }+ const ToggleIcon = collapsed ? ChevronRight : ChevronDown;+ const toggleLabel = collapsed ? t('bots.list.sectionExpand') : t('bots.list.sectionCollapse');+ const openChat = (entry: (typeof visibleChats)[number]) => {+ if (entry.kind === 'group') navigate(`/bots/groups/${encodeURIComponent(entry.group.id)}`);+ else if (entry.kind === 'cindy') { if (currentCindy) navigate(currentCindy.route); }+ else if ('deviceId' in entry.bot) navigate(`/bots/remote/${encodeURIComponent(entry.bot.deviceId)}/${encodeURIComponent(entry.bot.id)}`);+ else navigate(`/bots/${entry.bot.id}`);+ };return (- <div className="flex min-h-0 flex-1 flex-col px-3 pt-2">- {/* 小节头与伙伴行的正文左边缘对齐:容器 12px + 行内 10px = 22px。 */}- <div className="flex items-center justify-between px-2.5 pb-2">- <div className="flex items-center gap-2 text-12 font-medium text-[var(--sidebar-list-muted)]">- <Bot size={14} />- <span>{t('bots.title')}</span>+ <div ref={sidebarRef} className="flex w-full flex-col gap-0.5" data-sidebar-section="teammates">+ {/* 段头与置顶 / 全部任务段头同款:高 24,左 24 / 右 12;动作悬停浮现。 */}+ <div className="group/sidebar-header flex h-6 items-center justify-between pr-3 pl-6">+ <div className="flex min-w-0 items-center gap-1">+ <button+ type="button"+ onClick={toggleCollapsed}+ aria-expanded={!collapsed}+ className="text-sm font-medium text-[var(--sidebar-list-muted)] transition-colors hover:text-[var(--sidebar-nav-text)]"+ >+ {t('bots.title')}+ </button>+ <div className={HEADER_HOVER_ACTION_CLASS}>+ <Tip text={toggleLabel} side="bottom">+ <button type="button" onClick={toggleCollapsed} aria-label={toggleLabel} aria-expanded={!collapsed} className={HEADER_ICON_BUTTON_CLASS}>+ <ToggleIcon size={13} strokeWidth={2} />+ </button>+ </Tip>+ </div></div>- <span className="flex items-center gap-0.5">- {roster.showHiddenSection ? (+ <div className={cn(HEADER_HOVER_ACTION_CLASS, 'flex items-center gap-0.5')}>+ {roster.showHiddenSection && !collapsed ? (<buttontype="button"onClick={() => setShowHidden((value) => !value)}- className="flex h-7 w-7 items-center justify-center rounded-lg text-[var(--sidebar-list-muted)] transition-colors hover:bg-sidebar-item-hover hover:text-[var(--sidebar-nav-text)]"+ className={HEADER_ICON_BUTTON_CLASS}aria-label={t(showHidden ? 'bots.list.hideHidden' : 'bots.list.showHidden')}>- {showHidden ? <EyeOff size={15} /> : <Eye size={15} />}+ {showHidden ? <EyeOff size={13} strokeWidth={2} /> : <Eye size={13} strokeWidth={2} />}</button>) : null}- <BotCreateMenu />- </span>+ <BotCreateMenu variant="header" />+ </div></div>- {showSearch ? (- <label className="relative mb-2 block px-2.5">- <Search- size={13}- aria-hidden="true"- className="pointer-events-none absolute left-5 top-1/2 -translate-y-1/2 text-[var(--sidebar-list-muted)]"- />- <input- ref={searchInputRef}- value={query}- onChange={(event) => setQuery(event.target.value)}- onFocus={() => setSearchFocused(true)}- onBlur={() => setSearchFocused(false)}- placeholder={t('bots.list.searchPlaceholder')}- aria-label={t('bots.list.search')}- className="h-7 w-full rounded-lg border border-[var(--border-default)] bg-transparent pl-7 pr-2 text-11 text-[var(--sidebar-nav-text)] outline-none placeholder:text-[var(--sidebar-list-muted)] focus:border-[var(--focus-ring)]"- />- </label>+ {collapsed ? (+ // 收起:单行头像,未读带点;顺序与展开时一致,放不下的收进末尾「+N」(点开即展开整段)。+ <div ref={avatarRowRef} className="flex flex-nowrap items-center gap-2 overflow-hidden py-1 pr-0 pl-[22px]">+ {(() => {+ const entries = visibleChats.map((entry) => {+ const key = entry.kind === 'group' ? `group:${entry.group.id}`+ : entry.kind === 'cindy' ? 'cindy-devices'+ : 'deviceId' in entry.bot ? remoteBotKey(entry.bot) : entry.bot.id;+ const name = entry.kind === 'group' ? entry.group.name+ : entry.kind === 'cindy' ? currentCindy?.bot.name ?? '' : entry.bot.name;+ const selected = entry.kind === 'group' ? entry.group.id === groupId+ : entry.kind === 'cindy' ? Boolean(routeCindy)+ : 'deviceId' in entry.bot ? entry.bot.id === botId && entry.bot.deviceId === deviceId+ : !deviceId && entry.bot.id === botId;+ const unread = entry.kind === 'group' ? isBotGroupUnread(entry.group)+ : entry.kind === 'cindy' ? cindyOptions.some(option => option.unread)+ : 'deviceId' in entry.bot ? isRemoteBotUnread(entry.bot) : (unreadByBotId[entry.bot.id] ?? 0) > 0;+ return { entry, key, name, selected, unread };+ });+ const overflow = entries.length > avatarCapacity;+ let shown = overflow ? entries.slice(0, Math.max(0, avatarCapacity - 1)) : entries;+ // 正在看的聊天始终留在行内,占最后一个可见位。+ const selectedEntry = entries.find((item) => item.selected);+ if (overflow && selectedEntry && !shown.includes(selectedEntry) && shown.length > 0) {+ shown = [...shown.slice(0, -1), selectedEntry];+ }+ const hidden = entries.filter((item) => !shown.includes(item));+ return (+ <>+ {shown.map(({ entry, key, name, selected, unread }) => (+ <Tip key={key} text={name} side="bottom">+ <button+ type="button"+ onClick={() => openChat(entry)}+ aria-label={unread && !selected ? `${name} · ${t('bots.list.unread', { count: 1 })}` : name}+ aria-current={selected ? 'page' : undefined}+ className={cn(+ 'relative flex h-7 w-7 shrink-0 items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring',+ selected && 'ring-2 ring-[var(--sidebar-nav-text)] ring-offset-2 ring-offset-sidebar',+ )}+ >+ {entry.kind === 'group' ? (+ <GroupMiniAvatar members={entry.group.members} />+ ) : (entry.kind === 'cindy' ? currentCindy?.bot : entry.bot) ? (+ <BotAvatar bot={(entry.kind === 'cindy' ? currentCindy?.bot : entry.bot)!} size="sm" />+ ) : null}+ {unread && !selected ? (+ <span aria-hidden className="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar bg-[var(--bot-unread-bg)]" />+ ) : null}+ </button>+ </Tip>+ ))}+ {hidden.length > 0 ? (+ <Tip text={t('bots.list.sectionExpand')} side="bottom">+ <button+ type="button"+ onClick={toggleCollapsed}+ aria-label={`${t('bots.list.sectionExpand')} · +${hidden.length}`}+ className="relative flex h-7 min-w-7 shrink-0 items-center justify-center rounded-full bg-[var(--surface-chip)] px-1.5 text-11 font-medium tabular-nums text-[var(--sidebar-nav-text)] outline-none hover:bg-sidebar-item-hover focus-visible:ring-2 focus-visible:ring-ring"+ >+ +{hidden.length}+ {hidden.some((item) => item.unread) ? (+ <span aria-hidden className="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar bg-[var(--bot-unread-bg)]" />+ ) : null}+ </button>+ </Tip>+ ) : null}+ </>+ );+ })()}+ </div>) : null}+ <SectionCollapse collapsed={collapsed}>+ <div className="flex flex-col pt-1 pr-0 pl-3">+{archiveError && <p role="alert" className="mb-2 px-2.5 text-12 text-[var(--error-fg)]">{archiveError}</p>}- <div className="min-h-0 flex-1 overflow-y-auto pb-3">+ <div>{roster.visible.length === 0 && roster.hidden.length === 0 && archivedBots.length === 0 && remoteBots.length === 0 && visibleGroups.length === 0 ? (<div className="px-3 py-3">- {normalizedQuery ? <p className="text-12 text-[var(--sidebar-list-muted)]">{t('bots.list.noResults')}</p>- : <BotCreateMenu label={t('bots.add')} />}+ <BotCreateMenu label={t('bots.add')} /></div>) : (<div className="flex flex-col gap-1">@@ -865,6 +873,8 @@ function BotsSidebarContent() {)}</div>+ </div>+ </SectionCollapse><BotDeleteDialogbot={deleteTarget}onOpenChange={(open) => {@@ -881,9 +891,3 @@ function BotsSidebarContent() {</div>);}--export function BotsSidebar() {- const content = useMemo(() => <BotsSidebarContent />, []);- useRegisterSidebarUpper(content);- return null;-}diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botGroupSidebar.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botGroupSidebar.test.tsxindex 5270703fb5..64054801a9 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botGroupSidebar.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/botGroupSidebar.test.tsx@@ -1,7 +1,6 @@// @vitest-environment jsdomimport { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';-import { cloneElement, type ReactElement, type ReactNode } from 'react';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { BotGroupOpenPlanSummary, BotGroupSummary } from '../../../../shared/botGroupChat';@@ -30,17 +29,7 @@ const mocks = vi.hoisted(() => ({groups: [] as BotGroupSummary[],params: {} as { botId?: string; groupId?: string },pathname: '/bots',- collapsed: false,- registered: { node: null as ReactNode },islandActivity: new Map<string, { sessionId: string; phase: string; workingPhase?: string }>(),- runningStatusOptions: null as null | {- onSessionDone: (sessionId: string) => void;- onSessionNeedsReply: (sessionId: string) => void;- },- sendNotification: vi.fn(),- laneSentinel: Symbol('lane'),- ownedTitle: vi.fn(),- getSession: vi.fn(),confirm: vi.fn(),manage: vi.fn(),refreshGroups: vi.fn(),@@ -62,30 +51,12 @@ vi.mock('@/features/device-link/useDeviceLinkDeviceList', () => ({vi.mock('@/state/agentIslandActivity', () => ({useAgentIslandActivityMap: () => mocks.islandActivity,}));-vi.mock('@/hooks/useSessionRunningStatus', () => ({- useSessionRunningStatus: (_sessionId: string | undefined, options: typeof mocks.runningStatusOptions) => {- mocks.runningStatusOptions = options;- return { runningSessionIds: new Set<string>(), notifications: new Set<string>(), clearNotification: vi.fn() };- },-}));-vi.mock('@/lib/sessionEventNotification', () => ({- BOT_GROUP_LANE_SESSION: mocks.laneSentinel,- botOwnedSessionNotificationTitle: (...args: unknown[]) => mocks.ownedTitle(...args),- sendSessionEventNotification: (...args: unknown[]) => mocks.sendNotification(...args),-}));-vi.mock('@/lib/sessionService', () => ({ get: (...args: unknown[]) => mocks.getSession(...args) }));vi.mock('react-router-dom', async importOriginal => ({...await importOriginal<typeof import('react-router-dom')>(),useNavigate: () => mocks.navigate,useLocation: () => ({ pathname: mocks.pathname, search: '', hash: '' }),useParams: () => mocks.params,}));-vi.mock('../../feature-context', () => ({- useSidebarCollapsedState: () => mocks.collapsed,- useRegisterSidebarUpper: (node: ReactNode) => {- mocks.registered.node = node;- },-}));vi.mock('../botStore', () => ({useBotProfiles: () => mocks.profiles,useBotUnreadCounts: () => ({}),@@ -116,7 +87,7 @@ vi.mock('../BotGenerationLabel', () => ({BotGenerationLabel: ({ sessionId }: { sessionId?: string }) => <span>{`generation:${sessionId}`}</span>,}));-import { BotsSidebar } from '../BotsSidebar';+import { TeammatesSection } from '../TeammatesSection';function bot(id: string, name: string, extraSessions: unknown[] = []) {return {@@ -170,27 +141,21 @@ function openPlan(overrides: Partial<BotGroupOpenPlanSummary> = {}): BotGroupOpe}async function renderSidebar() {- render(<BotsSidebar />);- const view = render(<>{mocks.registered.node}</>);+ const view = render(<TeammatesSection />);await waitFor(() => expect(view.container.querySelector('button')).not.toBeNull());return view;}beforeEach(() => {mocks.navigate.mockReset();- mocks.sendNotification.mockReset();- mocks.ownedTitle.mockReset().mockResolvedValue(null);- mocks.getSession.mockReset();mocks.confirm.mockReset().mockResolvedValue(true);mocks.manage.mockReset().mockResolvedValue({ ok: true });mocks.refreshGroups.mockReset();mocks.ownerGeneration = 1;mocks.params = {};mocks.pathname = '/bots';- mocks.collapsed = false;mocks.groups = [];mocks.islandActivity = new Map();- mocks.runningStatusOptions = null;mocks.profiles = [bot('mimi', '咪咪', [{ id: 'lane-mimi', kind: 'group', role: 'group', title: 'group lane' }]),bot('xiaoman', '小满'),@@ -209,100 +174,65 @@ afterEach(() => {vi.restoreAllMocks();});-describe('BotsSidebar group chats', () => {- it('hides archived groups without an archive entry and finds their history through search', async () => {+describe('TeammatesSection group chats', () => {+ // 归档的群不在段内列出,经侧栏总搜索找回(见 teammateSearchResults.test.tsx)。+ it('leaves archived groups out of the section', async () => {mocks.groups = [group(), group({ id: 'saved', name: '已完成的旅行', archived: true })];const view = await renderSidebar();expect(screen.getByText('周末出游')).toBeTruthy();expect(screen.queryByText('已完成的旅行')).toBeNull();- expect(screen.queryByTestId('bot-archived-groups-toggle')).toBeNull();- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- fireEvent.change(input, { target: { value: '已完成的旅行' } });- expect(screen.getByText('bots.archived')).toBeTruthy();- fireEvent.click(screen.getByText('已完成的旅行'));- expect(mocks.navigate).toHaveBeenCalledWith('/bots/groups/saved');- fireEvent.change(input, { target: { value: '' } });- expect(screen.queryByText('已完成的旅行')).toBeNull();+ expect(screen.queryByRole('textbox')).toBeNull();mocks.groups = mocks.groups.map(item => ({ ...item, archived: false }));- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('已完成的旅行')).toBeTruthy();});- it('searches archived group names and members without showing them in the default list', async () => {- mocks.profiles = [];- mocks.groups = Array.from({ length: 8 }, (_, i) => group({ id: 'saved-' + i,- name: '历史群 ' + i, archived: true, members: i === 0 ? group().members : [],- }));- await renderSidebar();- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- fireEvent.change(input, { target: { value: '历史群 0' } });- expect(screen.getByText('历史群 0')).toBeTruthy();- expect(screen.queryByText('历史群 1')).toBeNull();- fireEvent.change(input, { target: { value: '小满' } });- expect(screen.getByText('历史群 0')).toBeTruthy();- fireEvent.change(input, { target: { value: 'missing' } });- expect(screen.queryByText('历史群 0')).toBeNull();- expect(screen.getByText('bots.list.noResults')).toBeTruthy();- });-- it('keeps an empty default list searchable when only one archived group remains and no bots exist', async () => {+ it('shows the add entry when only archived groups remain and no teammates exist', async () => {mocks.profiles = [];- mocks.groups = [group({ archived: true, members: [{ ...group().members[0]!, name: 'Research Lead' }] })];+ mocks.groups = [group({ archived: true })];await renderSidebar();- expect(screen.queryByText('周末出游')).toBeNull();expect(document.querySelector('[data-bot-group-id]')).toBeNull();- expect(screen.queryByTestId('bot-archived-groups-toggle')).toBeNull();- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- fireEvent.change(input, { target: { value: ' RESEARCH ' } });- expect(screen.getByText('周末出游')).toBeTruthy();- expect(screen.getByText('bots.archived')).toBeTruthy();- fireEvent.change(input, { target: { value: ' ' } });- expect(screen.queryByText('周末出游')).toBeNull();+ expect(screen.getByText('bots.add')).toBeTruthy();});const managedGroup = (archived = false) => group({ serverBacked: true, archived, revision: 7,members: [{ ...group().members[0]!, isOwned: true, role: 'owner' }],});- const archiveKey = (archived = false) => 'bots.groupChat.server.settings.' + (archived ? 'unarchive' : 'archive');- async function selectArchive(archived = false) {+ const archiveKey = 'bots.groupChat.server.settings.archive';+ async function selectArchive() {fireEvent.contextMenu(screen.getByText('周末出游').closest('button')!, { clientX: 20, clientY: 30 });- fireEvent.click(await screen.findByRole('menuitem', { name: archiveKey(archived) }));+ fireEvent.click(await screen.findByRole('menuitem', { name: archiveKey }));}+ const firstSectionButton = (container: HTMLElement) =>+ container.querySelector<HTMLButtonElement>('[data-sidebar-section="teammates"] button');- it.each([false, true])('confirms archive change (%s) with the current revision and waits for refresh', async archived => {- mocks.groups = [managedGroup(archived)];+ it('confirms archive with the current revision and drops the row after refresh', async () => {+ mocks.groups = [managedGroup()];const view = await renderSidebar();- if (archived) fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });- await selectArchive(archived);+ await selectArchive();await waitFor(() => expect(mocks.manage).toHaveBeenCalledWith({ groupId: 'g1', action: {- type: 'archive', archived: !archived, expectedRevision: 7,+ type: 'archive', archived: true, expectedRevision: 7,} }));- expect(mocks.confirm).toHaveBeenCalledWith(expect.objectContaining({ title: archiveKey(archived),- confirmText: archiveKey(archived),- description: 'bots.groupChat.server.settings.' + (archived ? 'unarchiveHint' : 'archiveHint'),+ expect(mocks.confirm).toHaveBeenCalledWith(expect.objectContaining({ title: archiveKey,+ confirmText: archiveKey, description: 'bots.groupChat.server.settings.archiveHint',}));expect(mocks.refreshGroups).toHaveBeenCalledOnce();expect(screen.getByText('周末出游')).toBeTruthy();- mocks.groups = [managedGroup(!archived)];- view.rerender(cloneElement(mocks.registered.node as ReactElement));- if (!archived) expect(screen.queryByText('周末出游')).toBeNull();- else expect(screen.getByText('周末出游')).toBeTruthy();+ mocks.groups = [managedGroup(true)];+ view.rerender(<TeammatesSection />);+ expect(screen.queryByText('周末出游')).toBeNull();});- it('restores visible search focus after keyboard archive removes a default row', async () => {- const focus = vi.spyOn(HTMLElement.prototype, 'focus');+ it('keeps focus inside the section after keyboard archive removes the row', async () => {mocks.groups = [managedGroup()];const view = await renderSidebar();const row = screen.getByText('周末出游').closest('button')!;fireEvent.keyDown(row, { key: 'F10', shiftKey: true });- fireEvent.click(await screen.findByRole('menuitem', { name: archiveKey() }));+ fireEvent.click(await screen.findByRole('menuitem', { name: archiveKey }));await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());-mocks.groups = [managedGroup(true)];- view.rerender(cloneElement(mocks.registered.node as ReactElement));- await waitFor(() => expect(document.activeElement).toBe(screen.getByRole('textbox', { name: 'bots.list.search' })));- // Let the browser reveal the search field if needed.- expect(focus).toHaveBeenLastCalledWith();+ view.rerender(<TeammatesSection />);+ await waitFor(() => expect(document.activeElement).toBe(firstSectionButton(view.container)));});it.each([false, true])('recovers focus when settings archives the selected group (route already cleared: %s)', async cleared => {@@ -312,8 +242,8 @@ describe('BotsSidebar group chats', () => {const view = await renderSidebar();mocks.groups = [managedGroup(true)];if (cleared) { mocks.params = {}; mocks.pathname = '/bots/list'; }- view.rerender(cloneElement(mocks.registered.node as ReactElement));- await waitFor(() => expect(document.activeElement).toBe(screen.getByRole('textbox', { name: 'bots.list.search' })));+ view.rerender(<TeammatesSection />);+ await waitFor(() => expect(document.activeElement).toBe(firstSectionButton(view.container)));});it('keeps a new sidebar selection when settings archive finishes', async () => {@@ -326,89 +256,20 @@ describe('BotsSidebar group chats', () => {mocks.groups = [managedGroup(true)];mocks.params = {};mocks.pathname = '/bots/list';- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);await act(async () => { await new Promise(resolve => setTimeout(resolve, 60)); });expect(document.activeElement).toBe(next);});- it('recovers to an existing sidebar button when settings archive finishes with a collapsed sidebar', async () => {- mocks.params = { groupId: 'g1' };- mocks.pathname = '/bots/groups/g1';- mocks.groups = [managedGroup()];- mocks.collapsed = true;- const view = await renderSidebar();- mocks.groups = [managedGroup(true)];- mocks.params = {};- mocks.pathname = '/bots/list';- view.rerender(cloneElement(mocks.registered.node as ReactElement));- await waitFor(() => expect(document.activeElement).toBe(view.container.querySelector('button')));- });-- it('restores focus to the moved group row after keyboard unarchive', async () => {- const focus = vi.spyOn(HTMLElement.prototype, 'focus');- mocks.groups = [managedGroup(true)];- const view = await renderSidebar();- fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });- const row = screen.getByText('周末出游').closest('button')!;- fireEvent.keyDown(row, { key: 'F10', shiftKey: true });- fireEvent.click(await screen.findByRole('menuitem', { name: archiveKey(true) }));- await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());-- mocks.groups = [managedGroup(false)];- view.rerender(cloneElement(mocks.registered.node as ReactElement));- await waitFor(() => expect(document.activeElement).toBe(screen.getByText('周末出游').closest('button')));- expect(focus).toHaveBeenLastCalledWith();- });-- it('keeps the search input focused when its last archived result is restored and the query is cleared', async () => {- mocks.profiles = [];- mocks.groups = [managedGroup(true)];- const view = await renderSidebar();- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- fireEvent.change(input, { target: { value: '周末' } });- await selectArchive(true);- await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());- act(() => input.focus());- mocks.groups = [managedGroup(false)];- view.rerender(cloneElement(mocks.registered.node as ReactElement));- fireEvent.change(input, { target: { value: '' } });- expect(screen.getByRole('textbox', { name: 'bots.list.search' })).toBe(input);- expect(document.activeElement).toBe(input);-- const row = screen.getByText('周末出游').closest('button')!;- act(() => row.focus());- expect(screen.queryByRole('textbox', { name: 'bots.list.search' })).toBeNull();- expect(document.activeElement).toBe(row);- });-- it('does not steal search focus when unarchive moves a filtered-out group', async () => {- mocks.groups = [managedGroup(true)];- const view = await renderSidebar();- fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- await selectArchive(true);- await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());-- fireEvent.change(input, { target: { value: 'missing' } });- input.focus();- mocks.groups = [managedGroup(false)];- view.rerender(cloneElement(mocks.registered.node as ReactElement));- await waitFor(() => expect(document.activeElement).toBe(input));- });-- it.each([false, true])('restores the original row after archive confirmation is cancelled (%s)', async archived => {+ it('restores the original row after archive confirmation is cancelled', async () => {let settle!: (accepted: boolean) => void;mocks.confirm.mockImplementationOnce(() => new Promise<boolean>(resolve => { settle = resolve; }));- mocks.groups = [managedGroup(archived)];+ mocks.groups = [managedGroup()];await renderSidebar();- if (archived) fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });const row = screen.getByText('周末出游').closest('button')!;row.focus();- await selectArchive(archived);+ await selectArchive();await waitFor(() => expect(document.activeElement).toBe(row));-- // Closing the real confirmation leaves body focused because its menu item- // opener has already unmounted. The group row itself still exists.row.blur();await act(async () => { settle(false); });await waitFor(() => expect(document.activeElement).toBe(row));@@ -416,18 +277,15 @@ describe('BotsSidebar group chats', () => {expect(mocks.refreshGroups).not.toHaveBeenCalled();});- it.each([false, true])('restores the original row after archive request failure (%s)', async archived => {+ it('restores the original row and shows the error after an archive request fails', async () => {let settle!: (result: { ok: false; errorCode: string }) => void;mocks.manage.mockImplementationOnce(() => new Promise(resolve => { settle = resolve; }));- mocks.groups = [managedGroup(archived)];+ mocks.groups = [managedGroup()];await renderSidebar();- if (archived) fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });const row = screen.getByText('周末出游').closest('button')!;row.focus();- await selectArchive(archived);+ await selectArchive();await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());- await waitFor(() => expect(document.activeElement).toBe(row));-row.blur();await act(async () => { settle({ ok: false, errorCode: 'REVISION_CONFLICT' }); });await waitFor(() => expect(document.activeElement).toBe(row));@@ -435,34 +293,22 @@ describe('BotsSidebar group chats', () => {expect(mocks.refreshGroups).not.toHaveBeenCalled();});- it('does not steal search focus when unarchive keeps the group visible', async () => {- mocks.groups = [managedGroup(true)];- const view = await renderSidebar();- fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- await selectArchive(true);- await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());-- fireEvent.change(input, { target: { value: '周末' } });- input.focus();- mocks.groups = [managedGroup(false)];- view.rerender(cloneElement(mocks.registered.node as ReactElement));- await waitFor(() => expect(document.activeElement).toBe(input));- });-- it('keeps cancelled archives untouched and blocks old-account confirmations', async () => {+ it('keeps cancelled archives untouched and blocks old-account confirmations and responses', async () => {mocks.groups = [managedGroup()];mocks.confirm.mockResolvedValueOnce(false);await renderSidebar();await selectArchive();await waitFor(() => expect(mocks.confirm).toHaveBeenCalledOnce());expect(mocks.manage).not.toHaveBeenCalled();- expect(screen.getByText('周末出游')).toBeTruthy();mocks.confirm.mockImplementationOnce(async () => { mocks.ownerGeneration += 1; return true; });await selectArchive();await waitFor(() => expect(mocks.confirm).toHaveBeenCalledTimes(2));expect(mocks.manage).not.toHaveBeenCalled();+ mocks.manage.mockImplementationOnce(async () => { mocks.ownerGeneration += 1; return { ok: true }; });+ await selectArchive();+ await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());expect(mocks.refreshGroups).not.toHaveBeenCalled();+ expect(screen.getByText('周末出游')).toBeTruthy();});it('blocks duplicate archive triggers while a confirmation is pending', async () => {@@ -472,7 +318,7 @@ describe('BotsSidebar group chats', () => {await renderSidebar();await selectArchive();fireEvent.contextMenu(screen.getByText('周末出游').closest('button')!);- const action = await screen.findByRole('menuitem', { name: archiveKey() });+ const action = await screen.findByRole('menuitem', { name: archiveKey });expect(action.getAttribute('aria-disabled')).toBe('true');fireEvent.click(action);expect(mocks.confirm).toHaveBeenCalledOnce();@@ -480,34 +326,11 @@ describe('BotsSidebar group chats', () => {await waitFor(() => expect(mocks.manage).toHaveBeenCalledOnce());});- it('shows archived history rather than stale speaking or plan prompts', async () => {- mocks.groups = [group({ archived: true, speakingBotIds: ['mimi'], openPlan: openPlan() })];- await renderSidebar();- fireEvent.change(screen.getByRole('textbox', { name: 'bots.list.search' }), { target: { value: '周末' } });- expect(screen.queryByTestId('bot-group-running')).toBeNull();- expect(screen.queryByText(/sidebar.planStepDone/)).toBeNull();- expect(screen.getByText('bots.groupChat.sidebar.preview:{"name":"阿布","text":"下午 有小概率阵雨"}')).toBeTruthy();- });-- it('keeps failed archives visible and ignores old-account responses', async () => {- mocks.groups = [managedGroup()];- mocks.manage.mockResolvedValueOnce({ ok: false, errorCode: 'REVISION_CONFLICT' });- await renderSidebar();- await selectArchive();- await waitFor(() => expect(screen.getByRole('alert').textContent).toBe('bots.groupChat.server.settings.conflict'));- expect(screen.getByText('周末出游')).toBeTruthy();- expect(mocks.refreshGroups).not.toHaveBeenCalled();- mocks.manage.mockImplementationOnce(async () => { mocks.ownerGeneration += 1; return { ok: true }; });- await selectArchive();- await waitFor(() => expect(mocks.manage).toHaveBeenCalledTimes(2));- expect(mocks.refreshGroups).not.toHaveBeenCalled();- });-it('offers settings but no archive for ordinary members, with keyboard access', async () => {mocks.groups = [group({ serverBacked: true, revision: 1 })];await renderSidebar();fireEvent.keyDown(screen.getByText('周末出游').closest('button')!, { key: 'F10', shiftKey: true });- expect(screen.queryByRole('menuitem', { name: archiveKey() })).toBeNull();+ expect(screen.queryByRole('menuitem', { name: archiveKey })).toBeNull();fireEvent.click(await screen.findByRole('menuitem', { name: 'bots.groupChat.settings.title' }));expect(mocks.navigate).toHaveBeenCalledWith('/bots/groups/g1?groupSettings=1');});@@ -566,7 +389,7 @@ describe('BotsSidebar group chats', () => {.filter(Boolean);expect(order()).toEqual(['小满', '咪咪', '周末出游']);mocks.groups = [group({ lastMessage: { ...group().lastMessage!, createdAt: 30 } })];- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(order()).toEqual(['小满', '周末出游', '咪咪']);});@@ -578,20 +401,6 @@ describe('BotsSidebar group chats', () => {expect(screen.queryByRole('button', { name: 'bots.add' })).toBeNull();});- it('searches both group names and members in the unified list', async () => {- mocks.groups = [group(), ...Array.from({ length: 5 }, (_, i) =>- group({ id: `other-${i}`, name: `其他群 ${i}`, members: [] }))];- await renderSidebar();- const input = screen.getByRole('textbox', { name: 'bots.list.search' });- fireEvent.change(input, { target: { value: '出游' } });- expect(screen.getByRole('button', { name: /周末出游/ })).toBeTruthy();- expect(screen.queryByText('咪咪 private preview')).toBeNull();- expect(screen.queryByRole('button', { name: /其他群/ })).toBeNull();- fireEvent.change(input, { target: { value: '咪咪' } });- expect(screen.getByRole('button', { name: /周末出游/ })).toBeTruthy();- expect(screen.getByText('咪咪 private preview')).toBeTruthy();- });-it('shows the running mark on the group, not on the speaking teammate’s own row', async () => {mocks.groups = [group({ speakingBotIds: ['mimi'] })];mocks.islandActivity = new Map([@@ -670,26 +479,6 @@ describe('BotsSidebar group chats', () => {expect(running.textContent).toContain('咪咪');expect(running.textContent).toContain('bots.groupChat.sidebar.waiting');});-- it('never sends system notifications for group lanes', async () => {- await renderSidebar();- const options = mocks.runningStatusOptions!;- options.onSessionDone('lane-mimi');- options.onSessionNeedsReply('lane-mimi');- expect(mocks.sendNotification).not.toHaveBeenCalled();-- options.onSessionDone('mimi-chat');- expect(mocks.sendNotification).toHaveBeenCalledWith('mimi-chat', '咪咪', 'done');-- // A lane the cached profiles have not caught up with yet is re-checked.- mocks.sendNotification.mockReset();- mocks.getSession.mockResolvedValue({ id: 'lane-new', title: 'lane', source: 'bot' });- mocks.ownedTitle.mockResolvedValue(mocks.laneSentinel);- options.onSessionDone('lane-new');- await waitFor(() => expect(mocks.ownedTitle).toHaveBeenCalledWith('lane-new'));- await new Promise((resolve) => setTimeout(resolve, 0));- expect(mocks.sendNotification).not.toHaveBeenCalled();- });});it('localizes the join preview without presenting its subject as a chat author', async () => {diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botNavigation.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/botNavigation.test.tsindex 1f2860af1f..98057e7ab3 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botNavigation.test.ts+++ b/apps/desktop/src/renderer/features/bots/__tests__/botNavigation.test.ts@@ -109,7 +109,7 @@ describe('Bot canonical Session creation retry', () => {describe('伙伴创建兼容旧创建链接', () => {const router = readFileSync(resolve(__dirname, '..', '..', '..', 'router.tsx'), 'utf8');const home = readFileSync(resolve(__dirname, '..', 'BotsHomeView.tsx'), 'utf8');- const sidebar = readFileSync(resolve(__dirname, '..', 'BotsSidebar.tsx'), 'utf8');+ const sidebar = readFileSync(resolve(__dirname, '..', 'TeammatesSection.tsx'), 'utf8');it('挂在 /bots/roster,且静态段排在 :botId 之前', () => {expect(router).toContain("{ path: 'roster', element: <BotRosterView /> }");@@ -128,8 +128,8 @@ describe('伙伴创建兼容旧创建链接', () => {it('侧栏加号复用同一个创建弹窗入口', () => {expect(sidebar).not.toContain('?add=1');- expect(sidebar).toContain('<BotCreateMenu compact />');- expect(sidebar).toContain('<BotCreateMenu />');+ // 伙伴段头的加号与空态入口都走同一个创建菜单。+ expect(sidebar).toContain('<BotCreateMenu variant="header" />');expect(sidebar).toContain("<BotCreateMenu label={t('bots.add')} />");});});diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.archive.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.archive.test.tsxindex 03a10a28f8..52d488d451 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.archive.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.archive.test.tsx@@ -8,10 +8,10 @@ import { BotsListView } from '../BotsListView';import { refreshBotGroups, resetBotGroupStoreForTests } from '../botGroupStore';vi.mock('../botStore', () => ({ useBotProfiles: () => [] }));-vi.mock('../BotsSidebar', () => ({ BotsSidebar: () => null }));+// The layout registers the shared task sidebar (with the teammates section); not under test here.+vi.mock('../../cc-agent/useRegisterCCAgentSidebar', () => ({ useRegisterCCAgentSidebar: vi.fn() }));vi.mock('../BotSettingsDrawer', () => ({ BotSettingsDrawer: () => null }));vi.mock('../BotGroupSettingsDrawer', () => ({ BotGroupSettingsDrawer: () => null }));-vi.mock('../../feature-context', () => ({ useOwnTopNavScrollableRows: vi.fn() }));let groups: BotGroupSummary[];function group(id = 'room', archived = false): BotGroupSummary {diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.test.tsxindex 134ae6741a..6d1aa45c9a 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/botsFeatureLayout.test.tsx@@ -6,15 +6,20 @@ import { MainViewHistoryContext, type MainViewHistory } from '@/contexts/MainVieimport { useActiveMainView } from '@/hooks/useActiveMainView';import { BotsFeatureLayout } from '../BotsFeatureLayout';-const mocks = vi.hoisted(() => ({ profiles: [{ id: 'one', status: 'active' }] }));+const mocks = vi.hoisted(() => ({+ profiles: [{ id: 'one', status: 'active' }],+ registerTaskSidebar: vi.fn(),+}));vi.mock('../botStore', () => ({refreshBotProfiles: vi.fn(),useBotProfiles: () => mocks.profiles,}));vi.mock('../useRemoteBots', () => ({ useRemoteBotSync: vi.fn() }));-vi.mock('../BotsSidebar', () => ({ BotsSidebar: () => null }));vi.mock('../BotSettingsDrawer', () => ({ BotSettingsDrawer: () => null }));-vi.mock('../../feature-context', () => ({ useOwnTopNavScrollableRows: vi.fn() }));+// Teammate routes share the task sidebar: the layout registers it instead of swapping in its own.+vi.mock('../../cc-agent/useRegisterCCAgentSidebar', () => ({+ useRegisterCCAgentSidebar: mocks.registerTaskSidebar,+}));function Navigation() {const navigate = useNavigate();@@ -61,7 +66,15 @@ function mount(history: { current: MainViewHistory }, initialEntry = '/bots/one/</MainViewHistoryContext.Provider>,);}-afterEach(cleanup);+afterEach(() => {+ cleanup();+ mocks.registerTaskSidebar.mockClear();+});++it('registers the shared task sidebar on teammate routes', () => {+ mount({ current: { lastMatchedKey: 'bots', paths: {} } as MainViewHistory });+ expect(mocks.registerTaskSidebar).toHaveBeenCalled();+});it.each(['/bots/roster', '/bots/roster/?step=avatar#picker'])('returns through the teammate entry resolver after leaving creation at %s',diff --git a/apps/desktop/src/renderer/features/bots/__tests__/teammateSearchResults.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/teammateSearchResults.test.tsxnew file mode 100644index 0000000000..baadd48dd3--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/__tests__/teammateSearchResults.test.tsx@@ -0,0 +1,105 @@+// @vitest-environment jsdom+import { cleanup, fireEvent, render, renderHook, screen } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { TeammateSearchResults, useTeammateSearchMatches } from '../TeammateSearchResults';++const mocks = vi.hoisted(() => ({+ profiles: [] as unknown[],+ remoteBots: [] as unknown[],+ groups: [] as unknown[],+ navigate: vi.fn(),+ cloud: { enabled: false, selfDeviceId: null, humanActorId: null, actors: [], demotedBotIds: [] } as import('../../../../shared/companionCloud').CompanionCloudSnapshot,+}));++vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));+vi.mock('react-router-dom', () => ({ useNavigate: () => mocks.navigate }));+vi.mock('../botStore', () => ({ useBotProfiles: () => mocks.profiles }));+vi.mock('../useRemoteBots', () => ({ useRemoteBots: () => mocks.remoteBots }));+vi.mock('../companionCloudStore', () => ({ useCompanionCloud: () => mocks.cloud }));+vi.mock('../botGroupStore', () => ({ useBotGroupList: () => ({ groups: mocks.groups }) }));+vi.mock('../BotAvatar', () => ({ BotAvatar: () => <span data-testid="avatar" /> }));++function bot(id: string, name: string, extra: Record<string, unknown> = {}) {+ return { id, name, description: '', skills: [], status: 'active', sessions: [], createdAt: 1, ...extra };+}++beforeEach(() => {+ mocks.cloud = { enabled: false, selfDeviceId: null, humanActorId: null, actors: [], demotedBotIds: [] };+ mocks.profiles = [+ bot('steward', 'PR steward', { skills: ['web-research'] }),+ bot('hidden', 'Hidden release steward', { hiddenAt: 2 }),+ bot('stopped', 'Stopped release', { status: 'archived' }),+ bot('writer', 'Writer', { description: '写周报' }),+ ];+ mocks.remoteBots = [+ { id: 'cloud', deviceId: 'mac-mini', deviceName: 'Mac mini', name: 'Cloud helper', description: '', activityAt: 1 },+ ];+ mocks.groups = [+ { id: 'trip', name: '周末出游', members: [{ botId: 'mimi', name: '咪咪', avatar: '', avatarColor: '' }] },+ ];+});+afterEach(() => {+ cleanup();+ mocks.navigate.mockReset();+});++const names = (query: string) =>+ renderHook(() => useTeammateSearchMatches(query)).result.current.map((match) => match.name);++describe('teammates in the sidebar-wide search', () => {+ it('matches nothing for an empty query', () => {+ expect(names(' ')).toEqual([]);+ });++ it('matches names, descriptions and skills, keeps hidden teammates and leaves stopped ones out', () => {+ expect(names('release')).toEqual(['Hidden release steward']);+ expect(names('WEB-RESEARCH')).toEqual(['PR steward']);+ expect(names('周报')).toEqual(['Writer']);+ });++ it('finds archived group chats, which the teammates section no longer lists, and marks them', () => {+ mocks.groups = [+ { id: 'trip', name: '周末出游', members: [] },+ { id: 'saved', name: '已完成的旅行', archived: true, members: [{ botId: 'lead', name: 'Trip Planner', avatar: '', avatarColor: '' }] },+ ];+ expect(names('旅行')).toEqual(['已完成的旅行']);+ expect(names(' PLANNER ')).toEqual(['已完成的旅行']);+ const matches = renderHook(() => useTeammateSearchMatches('旅行')).result.current;+ render(<TeammateSearchResults matches={matches} />);+ expect(screen.getByText('bots.archived')).toBeTruthy();+ fireEvent.click(screen.getByText('已完成的旅行'));+ expect(mocks.navigate).toHaveBeenCalledWith('/bots/groups/saved');+ });++ it('leaves out local copies handed to another computer, like the teammates section', () => {+ mocks.cloud = { ...mocks.cloud, demotedBotIds: ['writer'] };+ expect(names('周报')).toEqual([]);+ });++ it('finds remote teammates by their computer and group chats by member names', () => {+ expect(names('mac mini')).toEqual(['Cloud helper']);+ expect(names('出游')).toEqual(['周末出游']);+ expect(names('咪咪')).toEqual(['周末出游']);+ });++ it('opens the chosen chat and lets the popover close itself', () => {+ const onSelected = vi.fn();+ const { result } = renderHook(() => useTeammateSearchMatches('e'));+ render(<TeammateSearchResults matches={result.current} onSelected={onSelected} />);++ fireEvent.click(screen.getByRole('button', { name: /Cloud helper/ }));+ expect(mocks.navigate).toHaveBeenLastCalledWith('/bots/remote/mac-mini/cloud');+ fireEvent.click(screen.getByRole('button', { name: /Writer/ }));+ expect(mocks.navigate).toHaveBeenLastCalledWith('/bots/writer');+ expect(onSelected).toHaveBeenCalledTimes(2);+ });++ it('labels group chats apart from teammates', () => {+ const { result } = renderHook(() => useTeammateSearchMatches('出游'));+ render(<TeammateSearchResults matches={result.current} />);+ fireEvent.click(screen.getByRole('button', { name: /周末出游/ }));+ expect(mocks.navigate).toHaveBeenLastCalledWith('/bots/groups/trip');+ expect(screen.getByText('bots.groupChat.sidebar.title')).toBeTruthy();+ });+});diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botsSidebar.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/teammatesSection.test.tsxsimilarity index 85%rename from apps/desktop/src/renderer/features/bots/__tests__/botsSidebar.test.tsxrename to apps/desktop/src/renderer/features/bots/__tests__/teammatesSection.test.tsxindex 3746275a94..d06d2170fd 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botsSidebar.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/teammatesSection.test.tsx@@ -6,7 +6,6 @@ vi.mock('@/components/ui/confirm-dialog-provider', () => ({}));import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';-import { cloneElement, type ReactElement, type ReactNode } from 'react';import { afterAll, beforeAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';vi.mock('@/lib/makerChatStore', () => { const running = new Map(); return { makerChatStore: { subscribeAll: () => () => {}, getRunningSnapshot: () => running } }; });@@ -38,14 +37,11 @@ const mocks = vi.hoisted(() => ({health: new Map<string, string>(),unread: {} as Record<string, number>,groupMessages: new Map<string, unknown[]>(),- pathname: '/bots',params: {} as { botId?: string; deviceId?: string },- collapsed: false,refreshBotProfiles: vi.fn(),setBotHidden: vi.fn(async () => undefined),setBotPinned: vi.fn(async () => undefined),duplicateBotProfile: vi.fn(async () => ({ id: 'copy' })),- registered: { node: null as ReactNode },/** 灵动岛活动镜像:sessionId -> phase。侧栏据此显示「正在输入…」。 */islandActivity: new Map<string, { sessionId: string; phase: string; compactDetail?: string }>(),cloud: { enabled: false, selfDeviceId: null, humanActorId: null, actors: [], demotedBotIds: [] } as import('../../../../shared/companionCloud').CompanionCloudSnapshot,@@ -60,6 +56,8 @@ vi.mock('@/features/device-link/useDeviceLinkDeviceList', () => ({vi.mock('@/state/agentIslandActivity', () => ({useAgentIslandActivityMap: () => mocks.islandActivity,}));+// The section must never observe session transitions: the task sidebar is the only+// notification owner (CCAgentSidebarUpper), also on /bots routes.vi.mock('@/hooks/useSessionRunningStatus', () => ({useSessionRunningStatus: (sessionId: string | undefined) => {mocks.observeSession(sessionId);@@ -74,15 +72,9 @@ vi.mock('@/hooks/useSessionRunningStatus', () => ({vi.mock('react-router-dom', async importOriginal => ({...await importOriginal<typeof import('react-router-dom')>(),useNavigate: () => mocks.navigate,- useLocation: () => ({ pathname: mocks.pathname, search: '', hash: '' }),+ useLocation: () => ({ pathname: '/bots', search: '', hash: '' }),useParams: () => mocks.params,}));-vi.mock('../../feature-context', () => ({- useSidebarCollapsedState: () => mocks.collapsed,- useRegisterSidebarUpper: (node: ReactNode) => {- mocks.registered.node = node;- },-}));vi.mock('../botStore', () => ({useBotProfiles: () => mocks.profiles,useBotUnreadCounts: () => mocks.unread,@@ -100,10 +92,10 @@ vi.mock('../BotDeleteDialog', () => ({bot ? <div data-testid="bot-delete-dialog">{bot.name}</div> : null,}));-import { BotsSidebar } from '../BotsSidebar';+import { TeammatesSection } from '../TeammatesSection';import { BotConnectionStatus } from '../BotConnectionStatus';-import { MainViewHistoryContext, type MainViewHistory } from '@/contexts/MainViewHistoryContext';import { markBotRead, resetBotReadStateForTests } from '../botReadState';+import { readTeammatesSectionCollapsed } from '../teammatesSectionPrefs';interface BotFixture {id: string;@@ -134,8 +126,7 @@ function bot(fixture: BotFixture) {let messageListeners: Array<(payload: unknown) => void> = [];async function renderSidebar() {- render(<BotsSidebar />);- const view = render(<>{mocks.registered.node}</>);+ const view = render(<TeammatesSection />);await waitFor(() => expect(view.container.querySelector('button')).not.toBeNull());return view;}@@ -156,13 +147,10 @@ beforeEach(() => {mocks.health = new Map();mocks.unread = {};mocks.groupMessages = new Map();- mocks.pathname = '/bots';mocks.params = {};- mocks.collapsed = false;mocks.profiles = [];mocks.remoteBots = [];mocks.devices = [];- mocks.registered.node = null;mocks.islandActivity = new Map();mocks.cloud = { enabled: false, selfDeviceId: null, humanActorId: null, actors: [], demotedBotIds: [] };Object.defineProperty(window, 'electronAPI', {@@ -206,13 +194,13 @@ describe('one Cindy entry across devices', () => {expect(mocks.navigate).toHaveBeenCalledWith('/bots/cindy-default');mocks.remoteBots = [remote('cloud', 'Cloud', { online: false })];- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getAllByRole('combobox', { name: /bots.devicePicker.switchDevice/ })).toHaveLength(1);expect(screen.getAllByTestId('cindy-device-row')).toHaveLength(1);expect(screen.getByText('Local preview')).toBeTruthy();mocks.remoteBots = [];- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.queryByRole('combobox', { name: /bots.devicePicker.switchDevice/ })).toBeNull();expect(screen.queryByTestId('cindy-device-row')).toBeNull();expect(screen.queryByText('bots.devicePicker.local')).toBeNull();@@ -253,13 +241,12 @@ describe('one Cindy entry across devices', () => {fireEvent.click(cloud);expect(mocks.navigate).toHaveBeenCalledWith('/bots/remote/cloud/cindy-default');mocks.params = { deviceId: 'cloud', botId: 'cindy-default' };- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('Cloud preview')).toBeTruthy();expect(screen.queryByText('Local preview')).toBeNull();expect(screen.getByRole('button', { name: 'Cindy · Cloud' }).getAttribute('aria-current')).toBe('page');- expect(mocks.observeSession).toHaveBeenLastCalledWith('cloud-chat');mocks.params = { botId: 'writer' };- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('Local preview')).toBeTruthy();expect(screen.queryByText('Cloud preview')).toBeNull();const localEntry = screen.getByRole('button', { name: 'Renamed Cindy · bots.devicePicker.local' });@@ -268,27 +255,6 @@ describe('one Cindy entry across devices', () => {expect(mocks.navigate).toHaveBeenLastCalledWith('/bots/cindy-default');});- it('keeps local Skill matches visible after grouping Cindy devices', async () => {- mocks.profiles = [- {- ...bot({ id: 'cindy-default', name: 'Cindy', lastMessagePreview: 'Local preview' }),- skills: ['web-research'],- },- ...Array.from({ length: 7 }, (_, index) => bot({ id: `other-${index}`, name: `Other ${index}` })),- ];- mocks.remoteBots = [remote('cloud', 'Cloud')];- await renderSidebar();-- fireEvent.change(screen.getByLabelText('bots.list.search'), { target: { value: 'WEB-RESEARCH' } });- expect(screen.getAllByTestId('cindy-device-row')).toHaveLength(1);- expect(screen.getByText('Local preview')).toBeTruthy();- fireEvent.click(screen.getByRole('button', { name: 'Cindy · bots.devicePicker.local' }));- expect(mocks.navigate).toHaveBeenLastCalledWith('/bots/cindy-default');-- fireEvent.change(screen.getByLabelText('bots.list.search'), { target: { value: 'unmatched-skill' } });- expect(screen.queryByTestId('cindy-device-row')).toBeNull();- });-it('keeps remote unread discoverable without opening the chat or switching away from local', async () => {mocks.profiles = [bot({ id: 'cindy-default', name: 'Cindy' })];mocks.remoteBots = [remote('cloud', 'Cloud', { lastReplyAt: 20, readAt: 10, online: false })];@@ -308,7 +274,7 @@ describe('one Cindy entry across devices', () => {expect(screen.getByText('Cloud preview')).toBeTruthy();mocks.profiles = [bot({ id: 'cindy-default', name: 'Cindy', lastMessagePreview: 'Local preview' })];- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('Local preview')).toBeTruthy();expect(screen.queryByText('Cloud preview')).toBeNull();expect(screen.getByRole('button', { name: 'Cindy · bots.devicePicker.local' })).toBeTruthy();@@ -322,7 +288,7 @@ describe('one Cindy entry across devices', () => {const view = await renderSidebar();expect(screen.getByText('Cloud preview')).toBeTruthy();mocks.remoteBots = [];- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('Local preview')).toBeTruthy();expect(mocks.navigate).not.toHaveBeenCalled();});@@ -354,7 +320,7 @@ describe('teammate host labels', () => {expect(mocks.navigate).toHaveBeenCalledWith('/bots/remote/remote-device/remote-bot');mocks.remoteBots = mocks.remoteBots.map((bot) => ({ ...bot, online: false, deviceName: ' ' }));- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('bots.remote.offline · remote-device')).toBeTruthy();expect(screen.queryByText('bots.remote.offline · bots.remote.thisDevice')).toBeNull();});@@ -366,7 +332,7 @@ describe('teammate host labels', () => {expect(view.container.innerHTML).not.toContain('bots.remote.thisDevice');expect(view.container.textContent).not.toContain(' · ');mocks.devices = [{ deviceId: 'local-device', name: 'Renamed Mac', isSelf: true }];- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('bots.remote.online')).toBeTruthy();expect(view.container.innerHTML).not.toContain('Renamed Mac');expect(view.container.textContent).not.toContain(' · ');@@ -385,7 +351,7 @@ describe('teammate host labels', () => {expect(screen.getByText('bots.remote.online · Shared Mac (host-b)')).toBeTruthy();expect(view.container.innerHTML).not.toContain('local-device');mocks.remoteBots = mocks.remoteBots.map((entry) => ({ ...entry, deviceName: entry.deviceId === 'host-a' ? 'Studio' : 'Mini' }));- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.getByText('bots.remote.online · Studio')).toBeTruthy();expect(screen.getByText('bots.remote.online · Mini')).toBeTruthy();});@@ -403,7 +369,7 @@ describe('teammate host labels', () => {expect(view.container.textContent).not.toContain(' · ');expect(screen.queryByText('Previous reply')).toBeNull();mocks.islandActivity.clear();- view.rerender(cloneElement(mocks.registered.node as ReactElement));+ view.rerender(<TeammatesSection />);expect(screen.queryByText(compactDetail)).toBeNull();expect(screen.getByText('bots.remote.online')).toBeTruthy();expect(screen.getByText('Previous reply')).toBeTruthy();@@ -426,43 +392,93 @@ describe('teammate host labels', () => {});-describe('BotsSidebar rail return', () => {- it.each(['/plugins', '/settings', '/bots-other'])('hides the retained return entry on %s', async (path) => {- mocks.collapsed = true;- const view = await renderSidebar();- expect(screen.getByRole('button', { name: 'sidebar.backToSessions' })).toBeTruthy();+describe('TeammatesSection header', () => {+ const header = () => screen.getByRole('button', { name: 'bots.title' });- // The slot retains the same element after the bots feature unregisters.- mocks.pathname = path;- view.rerender(<div>{mocks.registered.node}</div>);- expect(screen.queryByRole('button', { name: 'sidebar.backToSessions' })).toBeNull();+ it('starts expanded and collapses into a row of avatars that is remembered per account', async () => {+ mocks.profiles = [+ bot({ id: 'bot-1', name: 'PR steward', lastMessagePreview: 'Two checks are still red' }),+ bot({ id: 'bot-2', name: 'Writer' }),+ ];+ mocks.unread = { 'bot-2': 1 };+ await renderSidebar();+ expect(header().getAttribute('aria-expanded')).toBe('true');+ expect(screen.getByText('Two checks are still red')).toBeTruthy();+ expect(screen.queryByRole('button', { name: 'PR steward' })).toBeNull();+ expect(readTeammatesSectionCollapsed('fixture-owner')).toBe(false);++ fireEvent.click(header());+ expect(header().getAttribute('aria-expanded')).toBe('false');+ expect(readTeammatesSectionCollapsed('fixture-owner')).toBe(true);+ // Collapsed: one avatar per chat; an unread teammate says so in its label.+ fireEvent.click(screen.getByRole('button', { name: 'PR steward' }));+ expect(mocks.navigate).toHaveBeenLastCalledWith('/bots/bot-1');+ expect(screen.getByRole('button', { name: 'Writer · bots.list.unread:{"count":1}' })).toBeTruthy();+ // The full rows leave once the collapse animation has finished.+ await waitFor(() => expect(screen.queryByText('Two checks are still red')).toBeNull());++ // A fresh mount (another route, a relaunch) restores the saved choice.+ cleanup();+ await renderSidebar();+ expect(header().getAttribute('aria-expanded')).toBe('false');+ expect(screen.queryByText('Two checks are still red')).toBeNull();+ expect(screen.getByRole('button', { name: 'PR steward' })).toBeTruthy();++ fireEvent.click(screen.getByRole('button', { name: 'bots.list.sectionExpand' }));+ expect(header().getAttribute('aria-expanded')).toBe('true');+ expect(screen.getByText('Two checks are still red')).toBeTruthy();+ expect(screen.queryByRole('button', { name: 'PR steward' })).toBeNull();+ expect(readTeammatesSectionCollapsed('fixture-owner')).toBe(false);+ expect(window.localStorage.getItem('sidebar.teammatesSection.v1.owner.fixture-owner')).toBe('expanded');+ });++ it('keeps the collapsed row on one line and folds the rest into +N', async () => {+ const original = globalThis.ResizeObserver;+ // 4 slots: 3 avatars + the +N chip (36px per slot, 8px gap).+ globalThis.ResizeObserver = class {+ constructor(private readonly callback: ResizeObserverCallback) {}+ observe() { this.callback([{ contentRect: { width: 136 } } as ResizeObserverEntry], this as unknown as ResizeObserver); }+ disconnect() {}+ unobserve() {}+ } as unknown as typeof ResizeObserver;+ try {+ mocks.profiles = Array.from({ length: 6 }, (_, index) => bot({ id: `bot-${index}`, name: `Mate ${index}` }));+ mocks.unread = { 'bot-5': 1 };+ mocks.params = { botId: 'bot-4' };+ await renderSidebar();+ fireEvent.click(header());+ const avatars = screen.getAllByRole('button', { name: /^Mate \d$/ });+ expect(avatars).toHaveLength(3);+ // The open chat keeps a slot even when it sorts past the cut.+ expect(screen.getByRole('button', { name: 'Mate 4' }).getAttribute('aria-current')).toBe('page');+ const more = screen.getByRole('button', { name: 'bots.list.sectionExpand · +3' });+ fireEvent.click(more);+ expect(header().getAttribute('aria-expanded')).toBe('true');+ } finally {+ globalThis.ResizeObserver = original;+ }});- it.each([- '/cc-agent/session-1?remoteHostId=host-1#message-2',- undefined,- ])('restores the remembered task route %s, falling back to the index', (taskPath) => {- mocks.collapsed = true;- mocks.pathname = '/bots/teammate-2';- const history: { current: MainViewHistory } = {- current: {- lastMatchedKey: 'bots',- paths: taskPath ? { 'cc-agent': taskPath } : {},- },- };- render(<BotsSidebar />);- render(- <MainViewHistoryContext.Provider value={history}>- {mocks.registered.node}- </MainViewHistoryContext.Provider>,- );+ it('marks the open chat in the collapsed avatar row', async () => {+ mocks.profiles = [bot({ id: 'bot-1', name: 'PR steward' }), bot({ id: 'bot-2', name: 'Writer' })];+ mocks.unread = { 'bot-1': 2 };+ mocks.params = { botId: 'bot-1' };+ await renderSidebar();+ fireEvent.click(header());+ // The chat being read is current and does not also advertise its unread replies.+ expect(screen.getByRole('button', { name: 'PR steward' }).getAttribute('aria-current')).toBe('page');+ expect(screen.getByRole('button', { name: 'Writer' }).hasAttribute('aria-current')).toBe(false);+ });- fireEvent.click(screen.getByRole('button', { name: 'sidebar.backToSessions' }));- expect(mocks.navigate).toHaveBeenCalledExactlyOnceWith(taskPath ?? '/cc-agent');+ it('leaves session notifications to the task sidebar', async () => {+ mocks.profiles = [bot({ id: 'bot-1', name: 'PR steward' })];+ mocks.params = { botId: 'bot-1' };+ await renderSidebar();+ expect(mocks.observeSession).not.toHaveBeenCalled();});});-describe('BotsSidebar 「正在输入…」', () => {+describe('TeammatesSection 「正在输入…」', () => {it('回合进行中时第二行让位给「正在输入…」', async () => {mocks.profiles = [bot({@@ -526,7 +542,7 @@ describe('BotsSidebar 「正在输入…」', () => {function UnreadSync() { useBotUnreadSync(); return null; }-describe('BotsSidebar rows', () => {+describe('TeammatesSection rows', () => {it('shows durable Hermes attention without reviving the permissions badge', async () => {mocks.profiles = [bot({ id: 'bot-1', name: 'Needs help', needsAttention: true })];@@ -543,7 +559,7 @@ describe('BotsSidebar rows', () => {expect(screen.getAllByText('Active steward')).toHaveLength(1);});- it('keeps hidden Bots recoverable and reveals a match automatically while searching', async () => {+ it('keeps hidden Bots out of the list without a section search box', async () => {mocks.profiles = [bot({ id: 'visible', name: 'Visible' }),{ ...bot({ id: 'hidden', name: 'Hidden release steward' }), hiddenAt: 2 },@@ -556,10 +572,10 @@ describe('BotsSidebar rows', () => {];await renderSidebar();+ // Search moved to the sidebar-wide search (teammateSearchResults.test); the section+ // keeps hidden teammates out of the list and offers no search box of its own.expect(screen.queryByText('Hidden release steward')).toBeNull();- fireEvent.change(screen.getByLabelText('bots.list.search'), { target: { value: 'release' } });- expect(screen.getByText('Hidden release steward')).toBeTruthy();- expect(screen.queryByText('Other hidden')).toBeNull();+ expect(screen.queryByLabelText('bots.list.search')).toBeNull();});it('shows the latest message and its time instead of a channel label', async () => {@@ -754,8 +770,7 @@ describe('BotsSidebar rows', () => {vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });mocks.profiles = [bot({ id: 'bot-1', name: 'PR steward' })];- render(<><UnreadSync /><BotsSidebar /></>);- render(<>{mocks.registered.node}</>);+ render(<><UnreadSync /><TeammatesSection /></>);await vi.waitFor(() => expect(messageListeners.length).toBe(1));mocks.refreshBotProfiles.mockClear();@@ -772,8 +787,7 @@ describe('BotsSidebar rows', () => {vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });mocks.profiles = [bot({ id: 'bot-1', name: 'PR steward' })];- render(<><UnreadSync /><BotsSidebar /></>);- render(<>{mocks.registered.node}</>);+ render(<><UnreadSync /><TeammatesSection /></>);await vi.waitFor(() => expect(messageListeners.length).toBe(1));mocks.refreshBotProfiles.mockClear();diff --git a/apps/desktop/src/renderer/features/bots/__tests__/teammatesSectionPrefs.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/teammatesSectionPrefs.test.tsnew file mode 100644index 0000000000..e54d875915--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/__tests__/teammatesSectionPrefs.test.ts@@ -0,0 +1,28 @@+// @vitest-environment jsdom+import { beforeEach, describe, expect, it } from 'vitest';++import { readTeammatesSectionCollapsed, writeTeammatesSectionCollapsed } from '../teammatesSectionPrefs';++beforeEach(() => localStorage.clear());++describe('teammates section collapse preference', () => {+ it('defaults to expanded and keeps each account separate', () => {+ expect(readTeammatesSectionCollapsed('owner-a')).toBe(false);+ writeTeammatesSectionCollapsed('owner-a', true);+ expect(readTeammatesSectionCollapsed('owner-a')).toBe(true);+ expect(readTeammatesSectionCollapsed('owner-b')).toBe(false);+ writeTeammatesSectionCollapsed('owner-a', false);+ expect(readTeammatesSectionCollapsed('owner-a')).toBe(false);+ });++ it('stays expanded without an account and never persists for it', () => {+ writeTeammatesSectionCollapsed(null, true);+ expect(readTeammatesSectionCollapsed(null)).toBe(false);+ expect(localStorage.length).toBe(0);+ });++ it('treats unknown stored values as the expanded default', () => {+ localStorage.setItem('sidebar.teammatesSection.v1.owner.owner-a', 'sideways');+ expect(readTeammatesSectionCollapsed('owner-a')).toBe(false);+ });+});diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botsSidebarSpacing.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/teammatesSectionSpacing.test.tssimilarity index 81%rename from apps/desktop/src/renderer/features/bots/__tests__/botsSidebarSpacing.test.tsrename to apps/desktop/src/renderer/features/bots/__tests__/teammatesSectionSpacing.test.tsindex b6d760c514..2968f3d3d0 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botsSidebarSpacing.test.ts+++ b/apps/desktop/src/renderer/features/bots/__tests__/teammatesSectionSpacing.test.ts@@ -18,16 +18,19 @@* .row-prev { font-size:12.5px } → text-12(仓库字号阶梯里最近的一档)* .badge { min-width:16px; height:16px; padding:0 4px; radius:9999 } → h-4 min-w-4 px-1 rounded-full* .av-40 { 40px } → BotAvatar size="md"- * .side-list { padding:0 12px 12px } → 容器 px-3+ * .side-list { padding:0 12px 12px } → 容器 pl-3(伙伴段并入任务侧栏后,+ * 右侧由侧栏滚动区统一留白)** 未读角标依用户的侧栏细化反馈收小,数字采用等宽,预览不再随未读加粗。+ * 2026-10-13 伙伴从整栏切换改为任务侧栏里的「伙伴」段(TeammatesSection):行几何不变,+ * 段头改与置顶 / 全部任务段头同款。*/import { readFileSync } from 'node:fs';import { resolve } from 'node:path';import { describe, expect, it } from 'vitest';-const source = readFileSync(resolve(__dirname, '..', 'BotsSidebar.tsx'), 'utf8').replace(+const source = readFileSync(resolve(__dirname, '..', 'TeammatesSection.tsx'), 'utf8').replace(/\r\n/g,'\n',);@@ -109,13 +112,25 @@ describe('伙伴行的间距基线', () => {'<div className="px-3 py-3">',);expect(source).toContain("<BotCreateMenu label={t('bots.add')} />");- // 小节头与行内正文左边缘对齐:容器 px-3(12px) + 10px。- expect(source).toContain('<div className="flex items-center justify-between px-2.5 pb-2">');expect(source).toContain('mb-1 flex items-center gap-2 px-2.5 text-10 font-medium text-[var(--sidebar-list-muted)]',);- // 列表容器本身:定稿 `.side-list{padding:0 12px 12px}`。- expect(source).toContain('<div className="flex min-h-0 flex-1 flex-col px-3 pt-2">');+ // 列表容器:左 12px 与 `.side-list` 一致;不再自带滚动,随任务侧栏一起滚。+ expect(source).toContain('<div className="flex flex-col pt-1 pr-0 pl-3">');+ expect(code).not.toContain('overflow-y-auto');+ });++ it('段头与置顶 / 全部任务段头同款,收起后的头像行与行内正文左缘对齐', () => {+ // 段头:高 24,左 24 / 右 12,与 PinnedSection 段头一致。+ expect(source).toContain(+ '<div className="group/sidebar-header flex h-6 items-center justify-between pr-3 pl-6">',+ );+ // 头像行起点 = 列表容器 12px + 行内边距 10px。+ expect(source).toContain('<div ref={avatarRowRef} className="flex flex-nowrap items-center gap-2 overflow-hidden py-1 pr-0 pl-[22px]">');+ // 段头动作是 20px 图标钮,与其它段头动作同尺寸。+ expect(source).toContain('<BotCreateMenu variant="header" />');+ // 加入群聊收进「+」菜单的「输入邀请链接…」(#6013),段头不再有单独的加群按钮。+ expect(source).not.toContain('ChatJoinButton');});});diff --git a/apps/desktop/src/renderer/features/bots/__tests__/useViewedBotSessionId.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/useViewedBotSessionId.test.tsxnew file mode 100644index 0000000000..f0d36a34e0--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/__tests__/useViewedBotSessionId.test.tsx@@ -0,0 +1,55 @@+// @vitest-environment jsdom+import { renderHook } from '@testing-library/react';+import type { ReactNode } from 'react';+import { MemoryRouter } from 'react-router-dom';+import { describe, expect, it, vi } from 'vitest';++const mocks = vi.hoisted(() => ({+ profiles: [+ { id: 'writer', sessions: [{ id: 'writer-chat', role: 'canonical' }] },+ { id: 'roster-less', sessions: [] },+ ],+ remoteBots: [+ { id: 'cindy-default', deviceId: 'cloud', sessionId: 'cloud-chat' },+ { id: 'cindy-default', deviceId: 'mac', sessionId: null },+ ],+}));+vi.mock('../botStore', () => ({+ useBotProfiles: () => mocks.profiles,+ canonicalBotSessionId: (bot: { sessions: Array<{ id: string; role?: string }> }) =>+ bot.sessions.find((session) => session.role === 'canonical')?.id,+}));+vi.mock('../useRemoteBots', () => ({ useRemoteBots: () => mocks.remoteBots }));++import { useViewedBotSessionId } from '../useViewedBotSessionId';++function viewedAt(path: string) {+ const wrapper = ({ children }: { children: ReactNode }) =>+ <MemoryRouter initialEntries={[path]}>{children}</MemoryRouter>;+ return renderHook(() => useViewedBotSessionId(), { wrapper }).result.current;+}++describe('useViewedBotSessionId', () => {+ it('uses the session in the route for session and history chats', () => {+ expect(viewedAt('/bots/writer/session/task-7')).toBe('task-7');+ expect(viewedAt('/bots/writer/history/old-chat')).toBe('old-chat');+ });++ it('resolves a teammate route to its canonical chat', () => {+ expect(viewedAt('/bots/writer')).toBe('writer-chat');+ expect(viewedAt('/bots/roster-less')).toBeUndefined();+ });++ it('resolves a remote teammate route through the device roster', () => {+ expect(viewedAt('/bots/remote/cloud/cindy-default')).toBe('cloud-chat');+ expect(viewedAt('/bots/remote/mac/cindy-default')).toBeUndefined();+ expect(viewedAt('/bots/remote/gone/cindy-default')).toBeUndefined();+ });++ it.each(['/bots', '/bots/roster', '/bots/list', '/bots/groups/g1', '/cc-agent/writer-chat', '/plugins'])(+ 'reports nothing being viewed on %s',+ (path) => {+ expect(viewedAt(path)).toBeUndefined();+ },+ );+});diff --git a/apps/desktop/src/renderer/features/bots/teammatesSectionPrefs.ts b/apps/desktop/src/renderer/features/bots/teammatesSectionPrefs.tsnew file mode 100644index 0000000000..724ceccfdc--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/teammatesSectionPrefs.ts@@ -0,0 +1,15 @@+import { readSidebarOwnerStorage, writeSidebarOwnerStorage } from '@/lib/sidebarOwnerStorage';++/**+ * 侧栏「伙伴」段的收起状态,按账号存在本机。默认展开:只有用户点过收起才写入+ * override(`collapsed`);再次展开时写回 `expanded`,不复制默认值以外的状态。+ */+const KEY = 'sidebar.teammatesSection.v1';++export function readTeammatesSectionCollapsed(ownerId: string | null): boolean {+ return readSidebarOwnerStorage(KEY, ownerId) === 'collapsed';+}++export function writeTeammatesSectionCollapsed(ownerId: string | null, collapsed: boolean): void {+ writeSidebarOwnerStorage(KEY, ownerId, collapsed ? 'collapsed' : 'expanded');+}diff --git a/apps/desktop/src/renderer/features/bots/useViewedBotSessionId.ts b/apps/desktop/src/renderer/features/bots/useViewedBotSessionId.tsnew file mode 100644index 0000000000..70ba3a5046--- /dev/null+++ b/apps/desktop/src/renderer/features/bots/useViewedBotSessionId.ts@@ -0,0 +1,28 @@+import { useMatch } from 'react-router-dom';++import { canonicalBotSessionId, useBotProfiles } from './botStore';+import { useRemoteBots } from './useRemoteBots';++/**+ * 当前主区域正在看的伙伴会话。侧栏的通知 owner(任务侧栏)用它判断「正在看」:+ * 用户注视着的伙伴回合完成时不记未读、不发系统通知 —— 与原伙伴侧栏的口径一致。+ * 侧栏渲染在路由元素之外,用 useMatch 而不是 useParams 读取路径。+ */+export function useViewedBotSessionId(): string | undefined {+ const sessionMatch = useMatch('/bots/:botId/session/:sessionId');+ const historyMatch = useMatch('/bots/:botId/history/:sessionId');+ const remoteMatch = useMatch('/bots/remote/:deviceId/:botId');+ const botMatch = useMatch('/bots/:botId');+ const bots = useBotProfiles();+ const remoteBots = useRemoteBots();+ const explicit = sessionMatch?.params.sessionId ?? historyMatch?.params.sessionId;+ if (explicit) return explicit;+ if (remoteMatch) {+ const { deviceId, botId } = remoteMatch.params;+ return remoteBots.find((bot) => bot.deviceId === deviceId && bot.id === botId)?.sessionId ?? undefined;+ }+ const botId = botMatch?.params.botId;+ if (!botId) return undefined;+ const bot = bots.find((candidate) => candidate.id === botId);+ return bot ? canonicalBotSessionId(bot) : undefined;+}diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex 828eef97cf..c42ae8a87c 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -31,6 +31,7 @@ import type { SchedulerEvent } from '@cindy/maker-scheduler';import { createPortal } from 'react-dom';import {Archive,+ Bot,ChevronRight,CircleAlert,CirclePlus,@@ -68,6 +69,12 @@ import { SidebarRailNavigation, SidebarTopNav } from '@/components/sidebar/Sidebimport { SidebarFilterPopover } from './sidebar/SidebarFilterPopover';import { MainListScopeHeader } from './sidebar/MainListScopeHeader';import { SharedTasksSection } from '@/features/device-link/SharedTasksSection';+import { TeammatesSection } from '@/features/bots/TeammatesSection';+import { TeammateSearchResults, useTeammateSearchMatches } from '@/features/bots/TeammateSearchResults';+import { useNavigationAttention } from '@/lib/navigationAttentionStore';+import { useActiveMainView } from '@/hooks/useActiveMainView';+import { NavigationCountBadge } from '@/components/sidebar/NavigationCountBadge';+import { useViewedBotSessionId } from '@/features/bots/useViewedBotSessionId';import { sharedTaskErrorKey } from '@/features/device-link/sharedTaskCompatibility';import { isSharedTaskPeer } from '@cindy/device-link';import { stripTrailingPathSeparators } from '../../../shared/pathText';@@ -520,6 +527,8 @@ export function CCAgentSidebarUpper() {const filesMatch = useMatch('/cc-agent/files/:sessionId');const activeSessionId = orcaMatch?.params.sessionId ?? match?.params.sessionId;const filesSessionId = filesMatch?.params.sessionId;+ // /bots/* 与任务列表共用本侧栏:正在看的伙伴会话同样算「注视中」,不记未读、不发通知。+ const viewedBotSessionId = useViewedBotSessionId();const scheduleSessionIndex = usePublishedAutomationScheduleSessionIndex();const remoteScheduleIndex = useRemoteScheduleIndex();// 侧栏右侧 urgent 红点的"额外"来源:定时任务未读且失败(status != 'success')。@@ -774,6 +783,7 @@ export function CCAgentSidebarUpper() {// 按远程镜像解析)会解析不到,面板豁免/高亮与重定向判定就会丢// (codex review)。id 相等性语义不需要完整 Session 对象。viewedSessionId={activeSessionId ?? filesSessionId}+ attentionSessionId={activeSessionId ?? filesSessionId ?? viewedBotSessionId}filter={filter}hiddenProjects={hiddenProjects}projectAliases={projectAliases}@@ -798,6 +808,7 @@ export function CCAgentSidebarUpper() {hiddenProjectKeys={hiddenProjectKeys}sessions={visibleSessionsWithRemote}activeSessionId={activeSessionId}+ attentionSessionId={activeSessionId ?? filesSessionId ?? viewedBotSessionId}notifications={railNotifications}manualPinnedOrder={filter.manualPinnedOrder}onReorderPinned={handleRailPinnedReorder}@@ -827,6 +838,9 @@ interface ExpandedProps {* 与 activeSessionId 分开传:后者还承担选中高亮与「点击同会话早退」语义,* files 模式下从面板点击该会话仍要能导航回聊天视图。 */viewedSessionId: string | undefined;+ /** 通知与未读的「注视中」会话:viewedSessionId 之外再包含主区域正在看的伙伴会话。+ * 只用于 useSessionRunningStatus,不参与归档重定向与选中高亮。 */+ attentionSessionId: string | undefined;filter: UseSidebarFilterReturn;hiddenProjects: UseHiddenProjectsReturn;projectAliases: ReturnType<typeof useProjectAliases>;@@ -864,6 +878,7 @@ function ExpandedView({navigate,activeSessionId,viewedSessionId,+ attentionSessionId,filter,hiddenProjects,projectAliases,@@ -1214,10 +1229,11 @@ function ExpandedView({const attachedSessionIds = useAttachedSessionIds();// F-SB-7: Session status indicators — running state + attention notifications- // 「active」按 viewedSessionId:files 路由下用户注视的是该会话的文件视图,- // 完成/待回复不能按后台会话记未读、发通知(codex review)。+ // 「active」按注视中的会话:files 路由下用户注视的是该会话的文件视图,+ // 完成/待回复不能按后台会话记未读、发通知(codex review);伙伴聊天页同理。+ // 本侧栏是系统通知的唯一 owner —— /bots 也用它,伙伴段本身不再观察转换。const { runningSessionIds, notifications, clearNotification } = useSessionRunningStatus(- viewedSessionId,+ attentionSessionId,{onSessionDone: handleSessionDone,onSessionError: handleSessionError,@@ -1600,6 +1616,8 @@ function ExpandedView({// 内联会话搜索:输入行在 SidebarTopNav 末行,状态经 ConversationSearchProvider 共享;// query 非空时同一份顶部导航 sticky 钉住,结果替换下方列表,不再用 overlay 盖输入框。const { search, openSignal } = useConversationSearchContext();+ // 伙伴 / 群聊并入侧栏总搜索,命中排在会话结果之前。+ const teammateMatches = useTeammateSearchMatches(search.trimmed);const gcProjectKeys = useMemo(() => projectUniverse.projects.map((p) => p.projectKey),[projectUniverse.projects],@@ -3772,11 +3790,15 @@ function ExpandedView({status={search.status}results={search.results}onSelect={search.handleSelect}+ leading={<TeammateSearchResults matches={teammateMatches} />}+ leadingCount={teammateMatches.length}/></div>) : null}{/* 搜索时原列表只隐藏、不卸载:置顶段折叠等本地 state 才能保住。 */}<div hidden={searchActive} className="flex flex-col gap-2">+ {/* 伙伴段:侧栏第一层,固定在置顶上方(2026-10-13 定稿),/bots 与 /cc-agent 共用。 */}+ <TeammatesSection /><SharedTasksSection activeSessionId={activeSessionId} localSessions={sessions}runningSessionIds={displayRunningSessionIds} attachedSessionIds={attachedSessionIds} notifications={sidebarNotifications}onAction={handleActionClick} onRename={handleRename} onTogglePin={handleTogglePin}@@ -4067,6 +4089,8 @@ interface CollapsedProps {/** rail 数据源——全量可见 sessions(本地 + 远程镜像合并),RailNav 内部切片。 */sessions: Session[];activeSessionId: string | undefined;+ /** 与 ExpandedView 同口径的「注视中」会话(含正在看的伙伴会话),只用于运行状态 hook。 */+ attentionSessionId: string | undefined;/** 未读集 = attention 快照 ∪ 定时任务未读运行——段瓷砖/面板行角标依据。 */notifications: ReadonlySet<string>;/** 与展开态共用的置顶顺序(置顶面板同序)。 */@@ -4088,6 +4112,7 @@ function CollapsedView({hiddenProjectKeys,sessions,activeSessionId,+ attentionSessionId,notifications,manualPinnedOrder,onReorderPinned,@@ -4095,6 +4120,12 @@ function CollapsedView({const location = useLocation();const isCollapsed = useSidebarCollapsedState();const projectFilterRequest = useConversationSearchRequest();+ // 收窄态的伙伴入口:展开态里伙伴是置顶上方的一段,rail 放不下整段,+ // 用一个带未读数的图标直达伙伴(上次看的伙伴,没有则 Cindy)。+ const teammateUnread = useNavigationAttention().teammates;+ // 复用主视图历史:回到上次看的伙伴 / 群聊 / 远程伙伴的完整路径,没有记录才进 /bots。+ const { navigateToView } = useActiveMainView();+ const onBotsRoute = location.pathname === '/bots' || location.pathname.startsWith('/bots/');const selectedMachineId = useEffectiveSelectedMachineId();const switcherDevices = useSwitcherDevices();const searchDevices = useMemo(@@ -4104,7 +4135,9 @@ function CollapsedView({const { t } = useTranslation();// 只读 running 快照——**不传 options**:通知副作用(onSessionDone 等)由// ExpandedView 的实例独家持有,两个视图常驻挂载,双回调会重复发桌面通知。- const { runningSessionIds } = useSessionRunningStatus(activeSessionId);+ // 「注视中」与 ExpandedView 同口径:该 hook 即使不传回调也会写未读,伙伴页上+ // 正在看的伙伴会话不能被这个常驻实例当成后台会话记未读。+ const { runningSessionIds } = useSessionRunningStatus(attentionSessionId);// 瓷砖未读点颜色按 attention kind(done 绿 / awaiting TapTap 蓝 / error 红);组件层// 取一次,renderItem 里查表(renderItem 非组件,不能 per-item 用 hook)。@@ -4145,7 +4178,7 @@ function CollapsedView({label={t('ccAgent.layout.new')}onClick={handleNewCCS}/>- {/* 自动化 / 插件 / 伙伴 / 搜索按「自定义」的顺序与勾选排列,未勾选项收进「更多」+ {/* 自动化 / 插件 / 搜索按「自定义」的顺序与勾选排列,未勾选项收进「更多」(与展开态 SidebarTopNav 同一份偏好)。搜索在 project-menu 锁定请求时临时出现。 */}<SidebarRailNavigationforceSearch={isCollapsed && projectFilterRequest != null}@@ -4165,6 +4198,17 @@ function CollapsedView({)}/>+ <SidebarIconButton+ icon={Bot}+ label={t('sidebar.tabs.bots')}+ active={onBotsRoute}+ aria-description={teammateUnread > 0 ? t('sidebar.teammateUnreadCount', { count: teammateUnread }) : undefined}+ badge={teammateUnread > 0 ? (+ <NavigationCountBadge count={teammateUnread} label={t('sidebar.teammateUnreadCount', { count: teammateUnread })} />+ ) : undefined}+ onClick={() => navigateToView('bots')}+ />+<div className="my-[7px] h-px w-[22px] shrink-0 bg-sidebar-border" aria-hidden />{/* 置顶 / 项目 / 对话 三段导航(hover 出可交互二级面板,项目段三级级联)。 */}diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsxindex e0bb3f5f4d..fe93061e2b 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx@@ -582,6 +582,8 @@ export function SearchResultsBody({results,onSelect,maxHeightClass,+ leading,+ leadingCount = 0,}: {trimmed: string;status: 'idle' | 'searching' | 'done' | 'error';@@ -589,8 +591,35 @@ export function SearchResultsBody({onSelect: (item: ConversationSearchResultItem, hit?: ConversationSearchResultItem['contentHit']) => void;/** 结果列表滚动容器的高度约束(popover 传 max-h,内联铺满时省略)。 */maxHeightClass?: string;+ /** 排在会话结果之前的本地命中(伙伴 / 群聊);有命中时不显示「无结果」。 */+ leading?: React.ReactNode;+ leadingCount?: number;}) {const { t } = useTranslation();+ if (trimmed && leadingCount > 0) {+ return (+ <div className={cn('overflow-y-auto p-2', maxHeightClass)}>+ {leading}+ {status === 'searching' ? (+ <div className="flex items-center justify-center gap-2 px-3 py-4 text-12 text-[var(--cmd-palette-item-meta)]">+ <Spinner size={14} />+ {t('ccAgent.search.searching')}+ </div>+ ) : status === 'error' ? (+ <div className="px-3 py-4 text-center text-12 text-[var(--error-fg)]">{t('ccAgent.search.failed')}</div>+ ) : (+ results.map((item) => (+ <SearchResultRow+ key={conversationSearchResultKey(item)}+ item={item}+ query={trimmed}+ onSelect={onSelect}+ />+ ))+ )}+ </div>+ );+ }if (!trimmed) {return (<div className="px-3 py-6 text-center text-12 text-[var(--cmd-palette-empty)]">diff --git a/apps/desktop/src/renderer/hooks/useActiveMainView.ts b/apps/desktop/src/renderer/hooks/useActiveMainView.tsindex da09c2a27e..1964aa219a 100644--- a/apps/desktop/src/renderer/hooks/useActiveMainView.ts+++ b/apps/desktop/src/renderer/hooks/useActiveMainView.ts@@ -14,7 +14,7 @@* URL 派生由本 hook 维护;各视图最后位置由账号级 MainViewHistoryProvider 共享,* 避免侧栏滚动段卸载后丢失返回位置。未提供 Provider 时使用实例内记忆。* 自动化页保留当前视图归属,但不覆盖任务返回位置。- * 无运行期伙伴位置时进入 /bots/list,不自动选择伙伴。+ * 无运行期伙伴位置时进入 /bots,由入口解析最近有效伙伴(没有则 Cindy)。* 伙伴创建页的返回位置使用 /bots,由入口解析最近有效伙伴,不恢复创建表单。* [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md*/@@ -39,7 +39,7 @@ const VIEWS: ViewDef[] = [{ key: 'cc-agent', to: '/cc-agent', prefixes: ['/cc-agent'] },{ key: 'issues', to: '/issues', prefixes: ['/issues'] },{ key: 'plugins', to: '/plugins', prefixes: ['/plugins', '/skillhub'] },- { key: 'bots', to: '/bots/list', prefixes: ['/bots'] },+ { key: 'bots', to: '/bots', prefixes: ['/bots'] },];const DEFAULT_KEY: MainViewKey = 'cc-agent';diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex abb54529d8..929e65d79e 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -8896,6 +8896,8 @@"needsAttention": "Needs attention","duplicate": "Duplicate teammate","moreActions": "More actions for {{name}}",+ "sectionExpand": "Expand teammates",+ "sectionCollapse": "Collapse teammates","noResults": "No matching teammates or groups"},"cancel": "Cancel",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 5dea0c4fe5..5b68112feb 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -8857,6 +8857,8 @@"needsAttention": "対応が必要","duplicate": "仲間を複製","moreActions": "{{name}} のその他の操作",+ "sectionExpand": "仲間を展開",+ "sectionCollapse": "仲間を折りたたむ","noResults": "一致するパートナーやグループはありません"},"cancel": "キャンセル",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 4da31f1bde..5e1e75aaf6 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -8857,6 +8857,8 @@"needsAttention": "확인 필요","duplicate": "동료 복제","moreActions": "{{name}} 추가 작업",+ "sectionExpand": "동료 펼치기",+ "sectionCollapse": "동료 접기","noResults": "검색과 일치하는 파트너나 그룹이 없어요"},"cancel": "취소",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 40490fa846..01af98dab4 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -8857,6 +8857,8 @@"needsAttention": "需要处理","duplicate": "复制伙伴","moreActions": "{{name}} 的更多操作",+ "sectionExpand": "展开伙伴",+ "sectionCollapse": "收起伙伴","noResults": "没有匹配的伙伴或群聊"},"cancel": "取消",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 2de579a891..a74a4f0351 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -8857,6 +8857,8 @@"needsAttention": "需要處理","duplicate": "複製夥伴","moreActions": "{{name}} 的更多操作",+ "sectionExpand": "展開夥伴",+ "sectionCollapse": "收起夥伴","noResults": "找不到符合的夥伴或群組"},"cancel": "取消",diff --git a/apps/desktop/src/renderer/lib/mainEntryPreference.ts b/apps/desktop/src/renderer/lib/mainEntryPreference.tsindex b975161557..9712331ce6 100644--- a/apps/desktop/src/renderer/lib/mainEntryPreference.ts+++ b/apps/desktop/src/renderer/lib/mainEntryPreference.ts@@ -2,9 +2,13 @@ import { readSidebarOwnerStorage, writeSidebarOwnerStorage } from './sidebarOwneconst KEY = 'cindy.mainEntry.v1';-/** Device-local navigation memory; never retain a partner or task identifier. */-export function readMainEntryRoute(ownerId: string | null): '/bots/list' | '/cc-agent' {- return readSidebarOwnerStorage(KEY, ownerId) === 'bots' ? '/bots/list' : '/cc-agent';+/**+ * Device-local navigation memory; never retain a partner or task identifier.+ * Teammates share the task sidebar, so a remembered bots entry reopens a chat+ * (`/bots` resolves the last-viewed teammate, else Cindy) instead of an empty list pane.+ */+export function readMainEntryRoute(ownerId: string | null): '/bots' | '/cc-agent' {+ return readSidebarOwnerStorage(KEY, ownerId) === 'bots' ? '/bots' : '/cc-agent';}export function rememberMainEntry(ownerId: string | null, pathname: string): void {diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex 1b8645f506..79dd576630 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -18,7 +18,7 @@| `desktop.auth.add-account` | desktop | 添加账号 | hash `/add-account`(ProtectedRoute → AddAccountLoginPage) | AddAccountLoginPage | apps/desktop/src/renderer/components/login/AddAccountLoginPage.tsx, apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/login/LoginCaptchaOverlay.tsx, apps/desktop/src/renderer/components/login/LoginControls.tsx, apps/desktop/src/renderer/components/login/LoginPage.tsx, apps/desktop/src/renderer/components/login/loginDesignTokens.ts | 59 | 0 | 20 || `desktop.auth.legacy-migration` | desktop | 首登数据迁移弹窗 | App 顶层挂载 LegacyMigrationDialog(仅主窗;main 检测到旧版 userData 经 `legacy-migration:state` 驱动) | LegacyMigrationDialog | apps/desktop/src/renderer/components/auth/LegacyMigrationDialog.tsx | 8 | 0 | 2 || `desktop.auth.login` | desktop | 登录页 | hash `/login`(GuestRoute → LoginPage) | LoginBrandStage, LoginCaptchaOverlay, LoginControls, LoginPage | apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/login/LoginCaptchaOverlay.tsx, apps/desktop/src/renderer/components/login/LoginControls.tsx, apps/desktop/src/renderer/components/login/LoginPage.tsx, apps/desktop/src/renderer/components/login/loginDesignTokens.ts | 59 | 0 | 20 |-| `desktop.bots` | desktop | 伙伴(列表 / 对话 / 设置 / 历史 / 伙伴私聊 / 群聊) | hash `/bots`、`/bots/list`、`/bots/:botId`、`/bots/roster` 及伙伴当前/历史任务、伙伴私聊、伙伴群聊路由(BotsFeatureLayout) | BotBasicProfileFields, BotCollaborationCard, BotDirectMessageView, BotGroupChatView, BotGroupCreateDialog, BotGroupSettingsDrawer, BotHistorySessionView, BotLifecycleSettings, BotModelChainEditor, BotRosterView, BotSessionView, BotSettingsDrawer, BotsHomeView, BotsListView, RemoteBotSessionView | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentOnOtherDeviceContext.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AgentTaskLiveDetails.tsx, apps/desktop/src/renderer/components/chat/AnnotationStrokesSvg.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatLoadingImage.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostCardHostPrompts.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageSourceLabels.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/MessageViewport.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserAttachmentChip.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/animateFocusScroll.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/markdownMedia.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageNavigationProjection.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageViewportGeometry.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/observeProgrammaticScroll.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeHighlightShared.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/streamingMessageProjection.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useImageClipboard.ts, apps/desktop/src/renderer/components/chat/useImageLoadFailure.ts, apps/desktop/src/renderer/components/chat/useMessageViewport.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerAttachments.tsx, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupRemoteDesktopButton.tsx, apps/desktop/src/renderer/components/new-chat/PluginWriteAccessRecovery.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/bots/BotAddToGroupMenu.tsx, apps/desktop/src/renderer/features/bots/BotAuthorizationCard.tsx, apps/desktop/src/renderer/features/bots/BotAvatar.tsx, apps/desktop/src/renderer/features/bots/BotBasicProfileFields.tsx, apps/desktop/src/renderer/features/bots/BotCapabilitySettings.tsx, apps/desktop/src/renderer/features/bots/BotCollaborationCard.tsx, apps/desktop/src/renderer/features/bots/BotConnectionStatus.tsx, apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx, apps/desktop/src/renderer/features/bots/BotDeleteDialog.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageCard.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageView.tsx, apps/desktop/src/renderer/features/bots/BotFollowMark.tsx, apps/desktop/src/renderer/features/bots/BotGenerationLabel.tsx, apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx, apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx, apps/desktop/src/renderer/features/bots/BotGroupComposer.tsx, apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx, apps/desktop/src/renderer/features/bots/BotGroupPendingInteraction.tsx, apps/desktop/src/renderer/features/bots/BotGroupPlan.tsx, apps/desktop/src/renderer/features/bots/BotGroupQuote.tsx, apps/desktop/src/renderer/features/bots/BotGroupRuntimeFailureNotice.tsx, apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx, apps/desktop/src/renderer/features/bots/BotHistorySessionView.tsx, apps/desktop/src/renderer/features/bots/BotHomeComputerSetting.tsx, apps/desktop/src/renderer/features/bots/BotImportForm.tsx, apps/desktop/src/renderer/features/bots/BotInvitationWelcome.tsx, apps/desktop/src/renderer/features/bots/BotLearningFooter.tsx, apps/desktop/src/renderer/features/bots/BotLifecycleSettings.tsx, apps/desktop/src/renderer/features/bots/BotMemorySettings.tsx, apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx, apps/desktop/src/renderer/features/bots/BotPortraitPicker.tsx, apps/desktop/src/renderer/features/bots/BotRosterView.tsx, apps/desktop/src/renderer/features/bots/BotRoutines.tsx, apps/desktop/src/renderer/features/bots/BotSessionContentHeader.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskLink.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx, apps/desktop/src/renderer/features/bots/BotSessionView.tsx, apps/desktop/src/renderer/features/bots/BotSettingsBlock.tsx, apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotTaskCardHeader.tsx, apps/desktop/src/renderer/features/bots/BotTaskModelEditor.tsx, apps/desktop/src/renderer/features/bots/BotTodoList.tsx, apps/desktop/src/renderer/features/bots/BotWorkbench.tsx, apps/desktop/src/renderer/features/bots/BotWorkingStatus.tsx, apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx, apps/desktop/src/renderer/features/bots/BotsGlobalSettingsSection.tsx, apps/desktop/src/renderer/features/bots/BotsHomeView.tsx, apps/desktop/src/renderer/features/bots/BotsListView.tsx, apps/desktop/src/renderer/features/bots/BotsSidebar.tsx, apps/desktop/src/renderer/features/bots/ChatBotAccessField.tsx, apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx, apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx, apps/desktop/src/renderer/features/bots/ChatInviteHost.tsx, apps/desktop/src/renderer/features/bots/ChatServerControls.tsx, apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx, apps/desktop/src/renderer/features/bots/CindyDevicePicker.tsx, apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx, apps/desktop/src/renderer/features/bots/CloudCompanionOfflineView.tsx, apps/desktop/src/renderer/features/bots/CompanionShadowBanner.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSessionView.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx, apps/desktop/src/renderer/features/bots/WorkbenchSessionList.tsx, apps/desktop/src/renderer/features/bots/botAvatarIdentity.ts, apps/desktop/src/renderer/features/bots/botCapabilityDefaults.ts, apps/desktop/src/renderer/features/bots/botChatPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationTimeline.ts, apps/desktop/src/renderer/features/bots/botDelegationLive.ts, apps/desktop/src/renderer/features/bots/botFollowScopes.ts, apps/desktop/src/renderer/features/bots/botGeneratedArtifacts.ts, apps/desktop/src/renderer/features/bots/botGroupAttachments.ts, apps/desktop/src/renderer/features/bots/botGroupComposerChrome.ts, apps/desktop/src/renderer/features/bots/botGroupLane.ts, apps/desktop/src/renderer/features/bots/botGroupMentions.ts, apps/desktop/src/renderer/features/bots/botGroupPresentation.ts, apps/desktop/src/renderer/features/bots/botGroupStore.ts, apps/desktop/src/renderer/features/bots/botListDisplay.ts, apps/desktop/src/renderer/features/bots/botNavigation.ts, apps/desktop/src/renderer/features/bots/botPronounContext.tsx, apps/desktop/src/renderer/features/bots/botReadState.ts, apps/desktop/src/renderer/features/bots/botRosterDisplay.ts, apps/desktop/src/renderer/features/bots/botSessionOwners.ts, apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/botStore.ts, apps/desktop/src/renderer/features/bots/botTodo.css, apps/desktop/src/renderer/features/bots/botWelcomeContext.ts, apps/desktop/src/renderer/features/bots/botWorkbenchProjection.ts, apps/desktop/src/renderer/features/bots/chatError.ts, apps/desktop/src/renderer/features/bots/cindyDeviceRoster.ts, apps/desktop/src/renderer/features/bots/companionCloudPresentation.ts, apps/desktop/src/renderer/features/bots/companionCloudStore.ts, apps/desktop/src/renderer/features/bots/remoteBotRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotSettingsData.ts, apps/desktop/src/renderer/features/bots/useBotGeneratedFileDeliveries.ts, apps/desktop/src/renderer/features/bots/useBotGroupMentionPicker.tsx, apps/desktop/src/renderer/features/bots/useBotIslandVisibleSession.ts, apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/useBotUnreadSync.ts, apps/desktop/src/renderer/features/bots/useRemoteBots.ts, apps/desktop/src/renderer/features/bots/useWorkbenchSessionPages.ts, apps/desktop/src/renderer/features/bots/useWorkingStatusCopy.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 277 | 38 | 484 |+| `desktop.bots` | desktop | 伙伴(列表 / 对话 / 设置 / 历史 / 伙伴私聊 / 群聊) | hash `/bots`、`/bots/list`、`/bots/:botId`、`/bots/roster` 及伙伴当前/历史任务、伙伴私聊、伙伴群聊路由(BotsFeatureLayout) | BotBasicProfileFields, BotCollaborationCard, BotDirectMessageView, BotGroupChatView, BotGroupCreateDialog, BotGroupSettingsDrawer, BotHistorySessionView, BotLifecycleSettings, BotModelChainEditor, BotRosterView, BotSessionView, BotSettingsDrawer, BotsHomeView, BotsListView, RemoteBotSessionView | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentOnOtherDeviceContext.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AgentTaskLiveDetails.tsx, apps/desktop/src/renderer/components/chat/AnnotationStrokesSvg.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatLoadingImage.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostCardHostPrompts.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageSourceLabels.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/MessageViewport.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserAttachmentChip.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/animateFocusScroll.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/markdownMedia.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageNavigationProjection.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageViewportGeometry.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/observeProgrammaticScroll.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeHighlightShared.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/streamingMessageProjection.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useImageClipboard.ts, apps/desktop/src/renderer/components/chat/useImageLoadFailure.ts, apps/desktop/src/renderer/components/chat/useMessageViewport.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerAttachments.tsx, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupRemoteDesktopButton.tsx, apps/desktop/src/renderer/components/new-chat/PluginWriteAccessRecovery.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/bots/BotAddToGroupMenu.tsx, apps/desktop/src/renderer/features/bots/BotAuthorizationCard.tsx, apps/desktop/src/renderer/features/bots/BotAvatar.tsx, apps/desktop/src/renderer/features/bots/BotBasicProfileFields.tsx, apps/desktop/src/renderer/features/bots/BotCapabilitySettings.tsx, apps/desktop/src/renderer/features/bots/BotCollaborationCard.tsx, apps/desktop/src/renderer/features/bots/BotConnectionStatus.tsx, apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx, apps/desktop/src/renderer/features/bots/BotDeleteDialog.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageCard.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageView.tsx, apps/desktop/src/renderer/features/bots/BotFollowMark.tsx, apps/desktop/src/renderer/features/bots/BotGenerationLabel.tsx, apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx, apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx, apps/desktop/src/renderer/features/bots/BotGroupComposer.tsx, apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx, apps/desktop/src/renderer/features/bots/BotGroupPendingInteraction.tsx, apps/desktop/src/renderer/features/bots/BotGroupPlan.tsx, apps/desktop/src/renderer/features/bots/BotGroupQuote.tsx, apps/desktop/src/renderer/features/bots/BotGroupRuntimeFailureNotice.tsx, apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx, apps/desktop/src/renderer/features/bots/BotHistorySessionView.tsx, apps/desktop/src/renderer/features/bots/BotHomeComputerSetting.tsx, apps/desktop/src/renderer/features/bots/BotImportForm.tsx, apps/desktop/src/renderer/features/bots/BotInvitationWelcome.tsx, apps/desktop/src/renderer/features/bots/BotLearningFooter.tsx, apps/desktop/src/renderer/features/bots/BotLifecycleSettings.tsx, apps/desktop/src/renderer/features/bots/BotMemorySettings.tsx, apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx, apps/desktop/src/renderer/features/bots/BotPortraitPicker.tsx, apps/desktop/src/renderer/features/bots/BotRosterView.tsx, apps/desktop/src/renderer/features/bots/BotRoutines.tsx, apps/desktop/src/renderer/features/bots/BotSessionContentHeader.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskLink.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx, apps/desktop/src/renderer/features/bots/BotSessionView.tsx, apps/desktop/src/renderer/features/bots/BotSettingsBlock.tsx, apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotTaskCardHeader.tsx, apps/desktop/src/renderer/features/bots/BotTaskModelEditor.tsx, apps/desktop/src/renderer/features/bots/BotTodoList.tsx, apps/desktop/src/renderer/features/bots/BotWorkbench.tsx, apps/desktop/src/renderer/features/bots/BotWorkingStatus.tsx, apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx, apps/desktop/src/renderer/features/bots/BotsGlobalSettingsSection.tsx, apps/desktop/src/renderer/features/bots/BotsHomeView.tsx, apps/desktop/src/renderer/features/bots/BotsListView.tsx, apps/desktop/src/renderer/features/bots/ChatBotAccessField.tsx, apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx, apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx, apps/desktop/src/renderer/features/bots/ChatInviteHost.tsx, apps/desktop/src/renderer/features/bots/ChatServerControls.tsx, apps/desktop/src/renderer/features/bots/ChatThreadPanel.tsx, apps/desktop/src/renderer/features/bots/CindyDevicePicker.tsx, apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx, apps/desktop/src/renderer/features/bots/CloudCompanionOfflineView.tsx, apps/desktop/src/renderer/features/bots/CompanionShadowBanner.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSessionView.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx, apps/desktop/src/renderer/features/bots/TeammateSearchResults.tsx, apps/desktop/src/renderer/features/bots/TeammatesSection.tsx, apps/desktop/src/renderer/features/bots/WorkbenchSessionList.tsx, apps/desktop/src/renderer/features/bots/botAvatarIdentity.ts, apps/desktop/src/renderer/features/bots/botCapabilityDefaults.ts, apps/desktop/src/renderer/features/bots/botChatPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationTimeline.ts, apps/desktop/src/renderer/features/bots/botDelegationLive.ts, apps/desktop/src/renderer/features/bots/botFollowScopes.ts, apps/desktop/src/renderer/features/bots/botGeneratedArtifacts.ts, apps/desktop/src/renderer/features/bots/botGroupAttachments.ts, apps/desktop/src/renderer/features/bots/botGroupComposerChrome.ts, apps/desktop/src/renderer/features/bots/botGroupLane.ts, apps/desktop/src/renderer/features/bots/botGroupMentions.ts, apps/desktop/src/renderer/features/bots/botGroupPresentation.ts, apps/desktop/src/renderer/features/bots/botGroupStore.ts, apps/desktop/src/renderer/features/bots/botListDisplay.ts, apps/desktop/src/renderer/features/bots/botNavigation.ts, apps/desktop/src/renderer/features/bots/botPronounContext.tsx, apps/desktop/src/renderer/features/bots/botReadState.ts, apps/desktop/src/renderer/features/bots/botRosterDisplay.ts, apps/desktop/src/renderer/features/bots/botSessionOwners.ts, apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/botStore.ts, apps/desktop/src/renderer/features/bots/botTodo.css, apps/desktop/src/renderer/features/bots/botWelcomeContext.ts, apps/desktop/src/renderer/features/bots/botWorkbenchProjection.ts, apps/desktop/src/renderer/features/bots/chatError.ts, apps/desktop/src/renderer/features/bots/cindyDeviceRoster.ts, apps/desktop/src/renderer/features/bots/companionCloudPresentation.ts, apps/desktop/src/renderer/features/bots/companionCloudStore.ts, apps/desktop/src/renderer/features/bots/remoteBotRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotSettingsData.ts, apps/desktop/src/renderer/features/bots/teammatesSectionPrefs.ts, apps/desktop/src/renderer/features/bots/useBotGeneratedFileDeliveries.ts, apps/desktop/src/renderer/features/bots/useBotGroupMentionPicker.tsx, apps/desktop/src/renderer/features/bots/useBotIslandVisibleSession.ts, apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/useBotUnreadSync.ts, apps/desktop/src/renderer/features/bots/useRemoteBots.ts, apps/desktop/src/renderer/features/bots/useViewedBotSessionId.ts, apps/desktop/src/renderer/features/bots/useWorkbenchSessionPages.ts, apps/desktop/src/renderer/features/bots/useWorkingStatusCopy.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 277 | 38 | 492 || `desktop.chat.files` | desktop | 工作目录文件浏览 | hash `/cc-agent/files/:sessionId`(WorkdirBrowseRoute) | FileBodyView, FileTreeView, WorkdirBrowseRoute | apps/desktop/src/renderer/features/cc-agent/workdir-browse/DocSearchBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/DrawioPreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileFilterInput.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileTabsBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileTreeView.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FilterResultList.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/ImagePreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/OpenInSystemActions.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/PdfPreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/SessionTabsBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/UnrenderablePlaceholder.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/WorkdirBrowseRoute.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/WorkdirBrowseSidebar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useChatRailCollapsed.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useChatRailResize.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useConfirmSwitchAwayIfDirty.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useDelayedFlag.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useFileContent.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useFileTree.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useOpenTabs.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useProjectFileList.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useRevealFileInTree.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/activeFileBodyHandle.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/docModeSwitchProjects.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/drawioExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/expandedStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileContentCache.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileIcon.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileMeta.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileScrollStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileSelectionParams.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/filterFiles.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/imageExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/markdownAutosave.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/openTabsStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/pdfExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/selectedFileStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchInput.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchPanel.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchResults.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/hooks/useProjectSearch.ts | 17 | 7 | 45 || `desktop.chat.new-draft` | desktop | 新建任务草稿页 | hash `/cc-agent/new`(NewMakerDraftRoute) | NewMakerDraftRoute | apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx | 15 | 0 | 3 || `desktop.chat.orca-workflow` | desktop | Orca 协同工作台 | hash `/cc-agent/orca/:sessionId`(OrcaWorkflowRoute) | CCAgentSessionView, OrcaSplitView, OrcaWorkerPanel, OrcaWorkflowRoute | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentOnOtherDeviceContext.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AgentTaskLiveDetails.tsx, apps/desktop/src/renderer/components/chat/AnnotationStrokesSvg.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatLoadingImage.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostCardHostPrompts.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageSourceLabels.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/MessageViewport.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserAttachmentChip.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/animateFocusScroll.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/markdownMedia.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageNavigationProjection.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageViewportGeometry.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/observeProgrammaticScroll.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeHighlightShared.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/streamingMessageProjection.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useImageClipboard.ts, apps/desktop/src/renderer/components/chat/useImageLoadFailure.ts, apps/desktop/src/renderer/components/chat/useMessageViewport.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerAttachments.tsx, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupRemoteDesktopButton.tsx, apps/desktop/src/renderer/components/new-chat/PluginWriteAccessRecovery.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaSplitView.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaWorkflowRoute.tsx | 252 | 38 | 337 |diff --git a/docs/dev-rules/chat-server-local-test.md b/docs/dev-rules/chat-server-local-test.mdindex 0787c246ca..04e4aed038 100644--- a/docs/dev-rules/chat-server-local-test.md+++ b/docs/dev-rules/chat-server-local-test.md@@ -35,9 +35,9 @@ XDT_CDP_PORT=9239 pnpm restart:desktop:remote --region=global -- --isolated=chat## 操作路径-1. 伙伴侧栏 → 加号 → 新建群聊。可以选择零到六位本机伙伴,建群后再邀请人。+1. 侧栏「伙伴」段头 → 加号 → 新建群聊。可以选择零到六位本机伙伴,建群后再邀请人。2. 群顶栏邀请按钮 → 生成邀请链接 → 复制。群主或管理员可以创建;按服务端响应显示规则:`expiresAt: null` 且 `reusable: true` 才是长期有效、多人重复使用,有到期时间的旧式链接仍按实际日期、单次使用展示。-3. 另一账号:伙伴侧栏标题旁的加入按钮 → 粘贴链接 → 查看邀请 → 接受并加入。预览只展示群名和邀请者,不开放历史;加入后按群的历史策略读取。+3. 另一账号:侧栏「伙伴」段头的加入按钮 → 粘贴链接 → 查看邀请 → 接受并加入。预览只展示群名和邀请者,不开放历史;加入后按群的历史策略读取。4. 每条消息下面可打开回复面板、添加/取消表情回应。消息显示回复数和回应人数,自己的回应有选中状态。伙伴回复 Thread 消息时,结果写回同一 Thread。5. 两个窗口分别发消息、回复和回应;检查实时刷新、不同作者名字及本人标记。退出其中一个 DEV 后,另一个仍能读取历史;重开 DEV 重新从服务器读取。diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 95108a9196..29d127a70d 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -161,7 +161,8 @@## 5. 界面-- 伙伴侧栏在「伙伴」分组下方增加「群聊」分组,带新建按钮;群行显示两位成员的叠放头像、群名与最近一条消息,+- 群聊行与伙伴私聊混排在侧栏「伙伴」段(置顶上方,与任务列表共用一个侧栏,见+ [cindy-bots-runtime.md](cindy-bots-runtime.md#导航未读与系统角标));段头加号提供新建伙伴与新建群聊。群行显示两位成员的叠放头像、群名与最近一条消息,有伙伴正在发言时显示运行中标记。- 群聊页:顶部为成员头像、群名与成员名单,右侧为群设置入口。时间线中用户消息靠右;伙伴消息左侧显示头像、名字与内容。正在发言的伙伴显示运行中状态,同时想时每位各占一行;输入框在本轮进行中提供停止。@@ -373,7 +374,7 @@ Chris 已明确扩展到多人各带伙伴,并选择「主人按群预先授### 群归档与找回(2026-10-14,Issue #6039)- 群主或管理员可从 Desktop 群行右键菜单或群设置归档群;确认框明确归档会对全群停止新消息与伙伴执行,保留群历史。-- 默认侧栏只显示未归档群,不放常驻归档入口。输入群名或成员搜索时,结果包含已归档群并标明归档状态,可直接打开历史;即使没有任何伙伴、只剩归档群,也保留搜索能力。有管理权限的成员可从搜索结果的群行菜单或群设置取消归档,恢复默认列表中的群行与群内使用。+- 侧栏伙伴段只显示未归档群(展开的行列表与收起的头像行都不含),不放常驻归档入口。归档群经侧栏总搜索找回:按群名或成员名搜索时,结果包含已归档群并标明归档状态,可直接打开历史;伙伴段为空、只剩归档群时总搜索照样可用。有管理权限的成员可从伙伴段群行菜单归档,并在打开的历史群的群设置里取消归档,恢复伙伴段中的群行与群内使用。- 当前选中的群归档成功后,右侧回到未选中聊天的空态,居中显示「选择伙伴或群聊,开始对话」,群设置同时关闭;归档其他群不切换当前页面。取消、失败或等待期间已切到其他聊天时保留当前选择。通过搜索主动打开已归档群可继续查看历史,取消归档也不退出历史页。- 只剩当前群主一个成员时,群设置提供归档引导,不再提供要求转让给不存在成员的退出操作。已有多人群的退出与群主转让规则不变。- 归档沿用服务器已有的全群停用语义,不删除群消息或任何群专线 Session。群列表镜像仍保留归档群,隐藏只发生在默认侧栏的展示层。diff --git a/docs/product-rules/cindy-bots-completion-matrix.md b/docs/product-rules/cindy-bots-completion-matrix.mdindex 9348dd064e..118c7a4df1 100644--- a/docs/product-rules/cindy-bots-completion-matrix.md+++ b/docs/product-rules/cindy-bots-completion-matrix.md@@ -21,7 +21,7 @@| 伙伴消息(send_to_agent) | `botDirectMessageService.ts`、`bot_direct_messages` | `botDirectMessageService.test.ts`、消息流投影用例 | 单条异步消息进入双方时间线入口;不建立任务;12 条硬上限、同方连续 2 条上限与冷却共同阻止死循环。 || 后台任务(start_session_task) | `botDelegationService.ts`、`lizi_xdtHelperMcpServer.ts` | `botCanonicalSession.test.ts` 的 Session 任务用例 | 大活开成普通 Cindy 任务,出现在主任务列表、走自己的权限门;check/message/stop 控制同一任务。 || 任务卡与完成信号 | `BotCollaborationCard.tsx`、`botDelegationLive.ts`、`deliverCompletion` | `BotCollaborationCard.test.tsx`、Session 任务完成与重启补投用例 | 父时间线只有一张持久任务卡;完成信号是隐藏指令,带持久送达标记、幂等键、退避重试和重启补投。 |-| 统一通知 | `useSessionRunningStatus.ts`、`sessionEventNotification.ts`、两个任务侧栏 | 侧栏与通知入口测试 | 伙伴页接手统一完成 / 失败 / 待回复观察;沿用全局通道与聚焦去重,通知点击回到伙伴路由。 |+| 统一通知 | `useSessionRunningStatus.ts`、`sessionEventNotification.ts`、两个任务侧栏 | 侧栏与通知入口测试 | 任务侧栏是唯一观察者(伙伴路由共用该侧栏,正在看的伙伴会话视为注视中);沿用全局通道与聚焦去重,通知点击回到伙伴路由。 || 自有技能学习 | `botSkillStore.ts`、`botSkillService.ts`、`save_teammate_skill` | `botSkillStore.test.ts`、`botSkillService.test.ts`、`bot-own-skills-mount.test.ts` | 沉淀真技能、同一聊天安全轮次加载、设置页可见可删。 || Desktop UI | `renderer/features/bots/**` | renderer store 与视图测试、typecheck | 名册、聊天、最小设置(成长/模型/维护);无工程概念暴露。 |diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.mdindex 20debf2188..80c24de107 100644--- a/docs/product-rules/cindy-bots-runtime.md+++ b/docs/product-rules/cindy-bots-runtime.md@@ -807,9 +807,10 @@ Codex 切模型重建时,线程索引里的路径不等于文件已经落盘## 导航未读与系统角标-- 伙伴入口按**有未读的对话数**聚合可见、未归档的伙伴私聊与群聊;私聊行仍显示原有的回复条数,群聊行标记该群未读。生成状态、工具过程、内部私信回执和静默巡检不新增未读。-- 「返回任务」沿用普通任务行的待关注语义(完成未读、等待交互、错误未读),不是消息条数。伙伴来源的主时间线、历史、委派和群专线不重复进入此分区;自动化、学习和 Orca worker 延续原有排除规则。-- 桌面 Dock 的完整投影为本机待关注任务数 + 本机未读伙伴对话数。远程伙伴可以出现在伙伴入口,但不扩大本机 Dock 范围;目录加载前的通知事件兜底仍由既有 appBadgeService 管理,目录覆盖的伙伴底层 Session ID 用于去重。+- 桌面伙伴与任务共用一个侧栏(2026-10-13 定稿):「伙伴」是侧栏第一层的一段,固定在置顶上方,与置顶、全部任务并存;点伙伴只切换主区域,不再整栏切换,也不再有顶部导航的「伙伴 / 返回任务」入口。段名在「展开(行列表)」与「收起成单行头像」之间切换,默认展开,按账号记住;收起时只占一行,放不下的收进末尾「+N」(点开即展开),正在看的聊天始终留在行内,群聊用两位成员叠放头像与单聊区分(`features/bots/TeammatesSection.tsx`、`teammatesSectionPrefs.ts`)。原伙伴列表的新建伙伴 / 群聊、加入群聊、群聊与私聊混排、多设备 Cindy、置顶 / 隐藏 / 复制 / 删除、已隐藏、需要处理的伙伴都留在段内;伙伴不默认置顶。伙伴段没有独立搜索框:侧栏总搜索同时匹配伙伴(名字、简介、技能,含已隐藏、不含已停止)、远程伙伴(含电脑名)与群聊(群名、成员名),命中排在会话结果之前(`TeammateSearchResults`)。侧栏收窄(rail)时由一个带未读数的伙伴图标直达 `/bots`(上次看的伙伴,没有则 Cindy)。+- 系统通知(完成 / 出错 / 待回复)只由任务侧栏一处发出,`/bots` 路由同样由它观察;正在看的伙伴会话按「注视中」处理,不记未读、不发通知(`useViewedBotSessionId`)。群专线仍不通知。+- 伙伴未读按**有未读的对话数**聚合可见、未归档的伙伴私聊与群聊;私聊行仍显示原有的回复条数,群聊行标记该群未读。生成状态、工具过程、内部私信回执和静默巡检不新增未读。收起成头像时以头像角点提示未读,rail 伙伴图标显示聚合数。+- 桌面 Dock 的完整投影为本机待关注任务数 + 本机未读伙伴对话数。远程伙伴可以出现在伙伴段,但不扩大本机 Dock 范围;目录加载前的通知事件兜底仍由既有 appBadgeService 管理,目录覆盖的伙伴底层 Session ID 用于去重。- 分区切换和列表刷新不是已读。只有对应对话前台可见、读到尾部并完成内容同步后,读位才推进到实际显示的回复时间;加载历史、后台窗口、生成过程、失败的远程恢复均不按当前时间清零。普通任务原有已读同步保持不变。- 伙伴读位复用设备本地、账号隔离的持久存储;同机窗口通过 storage 事件更新。它不是跨设备已读协议,手机读过不会清除桌面伙伴角标。群聊复用同样的读位机制,旧工作端缺少回复时间字段时不凭空推断未读。首次建立读位不追溯已有历史,之后列表刷新不重置读位。- 手机在现有首页菜单的「任务/伙伴」切换上显示对应数字,不另造返回按钮。伙伴页仍让任务镜像按现有连接恢复链路同步全部可用电脑;任务页本身的筛选、消息存储和运行行为不变。离线保留已有镜像,重连后重取;解除绑定或删除条目后不再聚合。diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.mdindex b99b1b2d4e..e84da433b6 100644--- a/docs/product-rules/sidebar-redesign-plan.md+++ b/docs/product-rules/sidebar-redesign-plan.md@@ -23,11 +23,18 @@[新建] 固定不滚动─────────── 以下随列表一起滚动 ───────────[顶部导航] 自动任务 / 插件 / 搜索+[伙伴段] 可折叠(展开行列表 / 收起成一排头像,默认展开);伙伴私聊与群聊混排[置顶区] 可折叠;会话与项目混排置顶,共享一份拖拽顺序(现状语义不变)[范围标题▾] 主列表范围下拉,空态 / loading / 连接中也恒在[主列表] 单一混排列表(见 §3);无内容时只留范围标题行```+**伙伴段与任务并存(2026-10-13 用户定稿)**:伙伴不再是顶部导航里整栏切换的入口,而是+侧栏第一层的一段,固定在置顶区上方,不提供位置选项;`/bots/*` 与 `/cc-agent` 共用同一个+任务侧栏(`BotsFeatureLayout` 注册 `useRegisterCCAgentSidebar`),点伙伴只切换主区域。+段的行为与伙伴规则见 [cindy-bots-runtime.md](cindy-bots-runtime.md#导航未读与系统角标);+系统通知仍只由任务侧栏一处观察。旧导航偏好里的 `bots` 条目读取时丢弃。+**「全部任务」段头与设备下拉合并(2026-08-13 用户定稿,新设计,显式推翻两条2026-07 旧定稿)**:- 标题文字反映当前范围,点击标题弹出「所有 / 本机 / 各设备(单选 + 多选)+