Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(layout): Codex-style rail layout behind the im_layout flag (#22003)

Arvin Xuafab0ab634fa
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index b03f26c3e3c..31f220609b3 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -3524,6 +3524,7 @@
"workingPanel.overview.ports.revoked": "Sharing stopped",
"workingPanel.overview.ports.title": "Ports",
"workingPanel.overview.ports.unavailable": "Can't read this device's ports right now",
+ "workingPanel.overview.profile.view": "View profile",
"workingPanel.overview.subagents": "Subagents",
"workingPanel.overview.subtopics": "Subtopics",
"workingPanel.overview.sync.ahead_one": "{{count}} commit ahead",
@@ -3634,6 +3635,11 @@
"workingPanel.pr.status.ready": "Ready to merge",
"workingPanel.pr.status.unstable": "Some checks were not successful",
"workingPanel.pr.status.waiting": "Waiting for checks",
+ "workingPanel.profile.description": "About",
+ "workingPanel.profile.model": "Model",
+ "workingPanel.profile.noDescription": "No description yet",
+ "workingPanel.profile.tabs.detail": "Details",
+ "workingPanel.profile.tabs.workspace": "Workspace",
"workingPanel.progress": "Progress",
"workingPanel.progress.allCompleted": "All tasks completed",
"workingPanel.resources": "Resources",
diff --git a/locales/en-US/common.json b/locales/en-US/common.json
index 50a823f53c2..396382c2738 100644
--- a/locales/en-US/common.json
+++ b/locales/en-US/common.json
@@ -183,6 +183,9 @@
"cmdk.video": "AI Video",
"confirm": "Confirm",
"contact": "Contact Us",
+ "contacts.create": "New agent",
+ "contacts.empty": "None yet",
+ "contacts.groups": "Groups",
"continue": "Continue",
"copy": "Copy",
"copyFail": "Copy failed",
@@ -346,6 +349,10 @@
"makePrivate.error": "Failed to make private",
"makePrivate.success": "Made private",
"manageOnlyCreator": "Only the creator or a workspace owner can do this",
+ "messageList.empty": "No conversations yet",
+ "messageList.newChat": "New conversation",
+ "messageList.running": "Running…",
+ "messageList.search": "Search",
"messengerBanner.dismiss": "Dismiss",
"messengerBanner.title": "Talk to Lobe AI on your favorite messaging apps",
"more": "More",
@@ -475,6 +482,7 @@
"tab.audio": "Audio",
"tab.chat": "Chat",
"tab.community": "Community",
+ "tab.contacts": "Contacts",
"tab.create": "Create",
"tab.dashboard": "Dashboards",
"tab.discover": "Discover",
@@ -488,7 +496,10 @@
"tab.marketplace": "Marketplace",
"tab.me": "Me",
"tab.memory": "Memory",
+ "tab.messages": "Messages",
+ "tab.more": "More",
"tab.pages": "Pages",
+ "tab.projects": "Projects",
"tab.resource": "Docs",
"tab.search": "Search",
"tab.setting": "Settings",
@@ -506,6 +517,8 @@
"taskDock.status.running": "In progress",
"taskDock.status.success": "All done",
"taskDock.totalCount": "{{count}} items",
+ "taskNav.all": "All tasks",
+ "taskNav.noProjects": "No projects yet",
"taskTemplate.action.connect.button": "Connect {{provider}}",
"taskTemplate.action.connect.error": "Connection failed, please try again.",
"taskTemplate.action.connect.popupBlocked": "Connection popup blocked. Allow popups in your browser to continue.",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index f12d227565f..1f0b330774c 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -3524,6 +3524,7 @@
"workingPanel.overview.ports.revoked": "已停止共享",
"workingPanel.overview.ports.title": "端口",
"workingPanel.overview.ports.unavailable": "暂时无法读取这台设备的端口",
+ "workingPanel.overview.profile.view": "查看资料",
"workingPanel.overview.subagents": "子代理",
"workingPanel.overview.subtopics": "子话题",
"workingPanel.overview.sync.ahead_one": "领先 {{count}} 个提交",
@@ -3634,6 +3635,11 @@
"workingPanel.pr.status.ready": "可以合并",
"workingPanel.pr.status.unstable": "部分检查未通过",
"workingPanel.pr.status.waiting": "等待检查完成",
+ "workingPanel.profile.description": "简介",
+ "workingPanel.profile.model": "模型",
+ "workingPanel.profile.noDescription": "暂无简介",
+ "workingPanel.profile.tabs.detail": "详情",
+ "workingPanel.profile.tabs.workspace": "工作区",
"workingPanel.progress": "进度",
"workingPanel.progress.allCompleted": "所有任务已完成",
"workingPanel.resources": "资源",
diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json
index b24fc9d8d4b..42f4b62984e 100644
--- a/locales/zh-CN/common.json
+++ b/locales/zh-CN/common.json
@@ -183,6 +183,9 @@
"cmdk.video": "AI 视频",
"confirm": "确认",
"contact": "联系我们",
+ "contacts.create": "新建助理",
+ "contacts.empty": "暂无",
+ "contacts.groups": "群组",
"continue": "继续",
"copy": "复制",
"copyFail": "复制失败",
@@ -346,6 +349,10 @@
"makePrivate.error": "改为私有失败",
"makePrivate.success": "已改为私有",
"manageOnlyCreator": "仅创建者或工作区 Owner 可操作",
+ "messageList.empty": "还没有会话",
+ "messageList.newChat": "新建会话",
+ "messageList.running": "执行中…",
+ "messageList.search": "搜索",
"messengerBanner.dismiss": "关闭",
"messengerBanner.title": "在你喜爱的聊天应用中,与 Lobe AI 畅聊",
"more": "更多",
@@ -475,6 +482,7 @@
"tab.audio": "音频",
"tab.chat": "会话",
"tab.community": "社区",
+ "tab.contacts": "通讯录",
"tab.create": "创建",
"tab.dashboard": "看板",
"tab.discover": "发现",
@@ -488,7 +496,10 @@
"tab.marketplace": "市场",
"tab.me": "我",
"tab.memory": "记忆",
+ "tab.messages": "消息",
+ "tab.more": "更多",
"tab.pages": "文稿",
+ "tab.projects": "项目",
"tab.resource": "云文档",
"tab.search": "搜索",
"tab.setting": "设置",
@@ -506,6 +517,8 @@
"taskDock.status.running": "进行中",
"taskDock.status.success": "已完成",
"taskDock.totalCount": "{{count}} 项",
+ "taskNav.all": "全部任务",
+ "taskNav.noProjects": "还没有项目",
"taskTemplate.action.connect.button": "连接 {{provider}}",
"taskTemplate.action.connect.error": "连接失败,请重试。",
"taskTemplate.action.connect.popupBlocked": "连接弹出窗口被阻止。请在浏览器中允许弹出窗口以继续。",
diff --git a/packages/app-config/src/featureFlags/schema.test.ts b/packages/app-config/src/featureFlags/schema.test.ts
index 07b426a09fc..c773852ece9 100644
--- a/packages/app-config/src/featureFlags/schema.test.ts
+++ b/packages/app-config/src/featureFlags/schema.test.ts
@@ -232,6 +232,17 @@ describe('mapFeatureFlagsEnvToState', () => {
expect(mapFeatureFlagsEnvToState(config).enableDashboard).toBe(false);
});
+ it('should keep the rail layout off by default and enable it per user or globally', () => {
+ expect(DEFAULT_FEATURE_FLAGS.im_layout).toBe(false);
+ expect(mapFeatureFlagsEnvToState(DEFAULT_FEATURE_FLAGS, 'user-1').enableImLayout).toBe(false);
+
+ expect(mapFeatureFlagsEnvToState({ im_layout: true }).enableImLayout).toBe(true);
+
+ const config = { im_layout: ['user-123'] };
+ expect(mapFeatureFlagsEnvToState(config, 'user-123').enableImLayout).toBe(true);
+ expect(mapFeatureFlagsEnvToState(config, 'user-456').enableImLayout).toBe(false);
+ });
+
it('should keep Channels off by default and enable them per user or globally', () => {
expect(DEFAULT_FEATURE_FLAGS.channel).toBe(false);
expect(mapFeatureFlagsEnvToState(DEFAULT_FEATURE_FLAGS, 'user-1').enableChannels).toBe(false);
diff --git a/packages/app-config/src/featureFlags/schema.ts b/packages/app-config/src/featureFlags/schema.ts
index acce4f3072e..2a889008b3a 100644
--- a/packages/app-config/src/featureFlags/schema.ts
+++ b/packages/app-config/src/featureFlags/schema.ts
@@ -64,6 +64,15 @@ export const FeatureFlagsSchema = z.object({
*/
dashboard: FeatureFlagValue.optional(),
+ /**
+ * Trial gate for the rail layout: icon rail + one wrapped list column and
+ * content, the IM-style Messages list (Lobe AI opens by default), Contacts,
+ * the Tasks scope list and the agent profile side panel. Off keeps the
+ * current sidebar layout untouched. Array values are user ids, so it can be
+ * tried by an allowlist before anyone else sees it.
+ */
+ im_layout: FeatureFlagValue.optional(),
+
/**
* Multi-agent Channels: the sidebar section, Channel pages and every Channel API, including
* Agent history reads (`lobe-channel`, `lh channel`). Off: none of it is reachable. Work that
@@ -145,6 +154,9 @@ export const DEFAULT_FEATURE_FLAGS: IFeatureFlags = {
// Off until an admin publishes a user allowlist or flips it to true.
dashboard: false,
+ // Off: a personal-trial layout, enabled per user id.
+ im_layout: false,
+
// Off until an admin publishes a user allowlist or flips it to true.
channel: false,
@@ -185,6 +197,7 @@ export const mapFeatureFlagsEnvToState = (
enableGatewayMuxMobile: evaluateFeatureFlag(config.agent_gateway_mux_mobile, userId),
enableLlmRelay: evaluateFeatureFlag(config.agent_llm_relay, userId),
enableDashboard: evaluateFeatureFlag(config.dashboard, userId),
+ enableImLayout: evaluateFeatureFlag(config.im_layout, userId),
enableChannels: evaluateFeatureFlag(config.channel, userId),
enableTopicPreview: evaluateFeatureFlag(config.topic_preview, userId),
showProvider: evaluateFeatureFlag(config.provider_settings, userId),
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 9bd7f6db651..3b84d8a8f9a 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -3713,6 +3713,12 @@ export default {
'workingPanel.overview.empty':
'Workspace activity and outputs will appear here as the agent works.',
'workingPanel.overview.emptyTitle': 'Ready to work',
+ 'workingPanel.overview.profile.view': 'View profile',
+ 'workingPanel.profile.description': 'About',
+ 'workingPanel.profile.model': 'Model',
+ 'workingPanel.profile.noDescription': 'No description yet',
+ 'workingPanel.profile.tabs.detail': 'Details',
+ 'workingPanel.profile.tabs.workspace': 'Workspace',
'workingPanel.overview.deviceError': 'Could not load the device status',
'workingPanel.overview.environmentError': 'Could not load the repository status',
'workingPanel.overview.execution.device': 'Connected device',
diff --git a/packages/locales/src/default/common.ts b/packages/locales/src/default/common.ts
index b7c1f6627d8..7f87201fc55 100644
--- a/packages/locales/src/default/common.ts
+++ b/packages/locales/src/default/common.ts
@@ -431,6 +431,15 @@ export default {
'addNew': 'Add new',
'gotIt': 'Got it',
'more': 'More',
+ 'contacts.create': 'New agent',
+ 'contacts.empty': 'None yet',
+ 'contacts.groups': 'Groups',
+ 'messageList.empty': 'No conversations yet',
+ 'messageList.newChat': 'New conversation',
+ 'messageList.running': 'Running…',
+ 'messageList.search': 'Search',
+ 'taskNav.all': 'All tasks',
+ 'taskNav.noProjects': 'No projects yet',
'navPanel.agent': 'Agents',
'navPanel.bottomDivider': 'Items below anchor to bottom',
'navPanel.customizeSidebar': 'Customize Sidebar',
@@ -599,6 +608,10 @@ export default {
'tab.image': 'Image',
'tab.audio': 'Audio',
'tab.chat': 'Chat',
+ 'tab.contacts': 'Contacts',
+ 'tab.messages': 'Messages',
+ 'tab.more': 'More',
+ 'tab.projects': 'Projects',
'recents': 'Recents',
'tab.community': 'Community',
'tab.dashboard': 'Dashboards',
diff --git a/packages/types/src/serverConfig.ts b/packages/types/src/serverConfig.ts
index 3e74aa17bb9..22c63796d11 100644
--- a/packages/types/src/serverConfig.ts
+++ b/packages/types/src/serverConfig.ts
@@ -38,6 +38,12 @@ export type IFeatureFlagsState = {
*/
enableDashboard: boolean | undefined;
enableDevDock: boolean | undefined;
+ /**
+ * Rail layout trial (`im_layout`): icon rail, IM-style Messages list,
+ * Contacts, Tasks scope list and the agent profile side panel. Off keeps the
+ * current sidebar layout.
+ */
+ enableImLayout: boolean | undefined;
/**
* LobeHub Mobile rollout gate for the multiplexed gateway socket and
* protocol-v2 payloads. Web follows `GlobalServerConfig.agentGatewayProtocol`.
diff --git a/src/features/AgentTasks/AgentTaskList/TasksTabPage.tsx b/src/features/AgentTasks/AgentTaskList/TasksTabPage.tsx
new file mode 100644
index 00000000000..43613f646fc
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskList/TasksTabPage.tsx
@@ -0,0 +1,23 @@
+'use client';
+
+import { memo } from 'react';
+import { useSearchParams } from 'react-router';
+
+import { TASK_PROJECT_PARAM } from '@/features/TaskNav/taskScope';
+
+import AgentTasksPage from './AgentTasksPage';
+
+/**
+ * `/tasks` page. A project picked in the Tasks tab list column scopes the list
+ * through `?project=<id>`; without it the page lists every task as before.
+ */
+const TasksTabPage = memo(() => {
+ const [searchParams] = useSearchParams();
+ const projectId = searchParams.get(TASK_PROJECT_PARAM) || undefined;
+
+ return <AgentTasksPage key={projectId ?? 'all'} projectId={projectId} />;
+});
+
+TasksTabPage.displayName = 'TasksTabPage';
+
+export default TasksTabPage;
diff --git a/src/features/AgentViewAll/AgentViewAllPage.tsx b/src/features/AgentViewAll/AgentViewAllPage.tsx
index 79b72caa19c..ac88c551000 100644
--- a/src/features/AgentViewAll/AgentViewAllPage.tsx
+++ b/src/features/AgentViewAll/AgentViewAllPage.tsx
@@ -37,6 +37,7 @@ import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvi
import { useSidebarItemVisibility } from '@/features/HomeSidebar/Body/Agent/useSidebarItemVisibility';
import { useCreateMenuItems } from '@/features/HomeSidebar/hooks';
import NavHeader from '@/features/NavHeader';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import WideScreenContainer from '@/features/WideScreenContainer';
import { useFetchAgentLabels } from '@/hooks/useFetchAgentLabels';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
@@ -450,6 +451,10 @@ const AgentViewAllPage = memo(() => {
},
[isSidebarItemVisible, setSidebarItemVisible, t],
);
+ // The `im_layout` rail has no agent sidebar, so its "in sidebar" curation
+ // (the section and every per-item toggle) does not apply there.
+ const imLayout = useImLayout();
+ const toggleSidebar = imLayout ? undefined : handleToggleSidebar;
const renderCard = useCallback(
(item: SidebarAgentItem) => (
@@ -458,10 +463,10 @@ const AgentViewAllPage = memo(() => {
key={item.id}
owner={showAuthor && item.userId ? authorByUserId.get(item.userId) : undefined}
sidebarHidden={!isSidebarItemVisible(item)}
- onToggleSidebar={handleToggleSidebar}
+ onToggleSidebar={toggleSidebar}
/>
),
- [showAuthor, authorByUserId, handleToggleSidebar, isSidebarItemVisible],
+ [showAuthor, authorByUserId, toggleSidebar, isSidebarItemVisible],
);
const renderRow = useCallback(
@@ -472,10 +477,10 @@ const AgentViewAllPage = memo(() => {
key={item.id}
showAuthor={showAuthor}
sidebarHidden={!isSidebarItemVisible(item)}
- onToggleSidebar={handleToggleSidebar}
+ onToggleSidebar={toggleSidebar}
/>
),
- [showAuthor, authorByUserId, handleToggleSidebar, isSidebarItemVisible],
+ [showAuthor, authorByUserId, toggleSidebar, isSidebarItemVisible],
);
const { allowed: canCreate, reason: createBlockedReason } = usePermission('create_content');
@@ -540,8 +545,8 @@ const AgentViewAllPage = memo(() => {
paddingInline={16}
wrapperStyle={{ flex: 1, overflowY: 'auto' }}
>
- {!isInit && !keyword.trim() && <AgentViewAllSidebarSectionSkeleton />}
- {isInit && !keyword.trim() && sidebarItems.length > 0 && (
+ {!imLayout && !isInit && !keyword.trim() && <AgentViewAllSidebarSectionSkeleton />}
+ {!imLayout && isInit && !keyword.trim() && sidebarItems.length > 0 && (
<SidebarAgentsSection items={sidebarItems} onToggleSidebar={handleToggleSidebar} />
)}
<Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>
diff --git a/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx b/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx
new file mode 100644
index 00000000000..db10f512263
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/ActionToolbar.test.tsx
@@ -0,0 +1,79 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { render, screen } from '@testing-library/react';
+import { createElement, type ReactNode } from 'react';
+import { describe, expect, it, vi } from 'vitest';
+
+import { ActionBarContext } from './context';
+import ActionToolbar from './index';
+
+vi.mock('../ActionBar/config', async () => {
+ const { useActionBarContext } = await import('./context');
+ const ContextProbe = () => {
+ const { actionSize, borderRadius } = useActionBarContext();
+ return createElement('div', {
+ 'data-border-radius': String(borderRadius),
+ 'data-size': actionSize ? `${actionSize.blockSize}/${actionSize.size}` : 'none',
+ 'data-testid': 'probe',
+ });
+ };
+ return { actionMap: { search: ContextProbe } };
+});
+
+vi.mock('@lobehub/editor/react', () => ({
+ ChatInputActions: ({ items }: { items: { children?: ReactNode; key: string }[] }) =>
+ createElement(
+ 'div',
+ {},
+ items.map((item) => createElement('div', { key: item.key }, item.children)),
+ ),
+}));
+
+vi.mock('@/store/global', () => ({
+ useGlobalStore: (selector: (state: object) => unknown) =>
+ selector({ toggleExpandInputActionbar: vi.fn() }),
+}));
+
+vi.mock('@/store/global/selectors', () => ({
+ systemStatusSelectors: { expandInputActionbar: () => false },
+}));
+
+vi.mock('@/store/user', () => ({
+ useUserStore: (selector: (state: object) => unknown) => selector({}),
+}));
+
+vi.mock('@/store/user/slices/preference/selectors', () => ({
+ labPreferSelectors: { enableInputMarkdown: () => false },
+}));
+
+vi.mock('../hooks/useChatInputResourceAccess', () => ({
+ useChatInputResourceAccess: () => ({ canConfigureResource: true, canShowControls: true }),
+}));
+
+vi.mock('../store', () => ({
+ useChatInputStore: (selector: (state: object) => unknown) =>
+ selector({ leftActions: ['search'], mobile: false }),
+}));
+
+describe('ActionToolbar', () => {
+ it('keeps the action size from an outer ActionBarContext', () => {
+ render(
+ createElement(
+ ActionBarContext,
+ { value: { actionSize: { blockSize: 28, size: 16 } } },
+ createElement(ActionToolbar, { borderRadius: 12 }),
+ ),
+ );
+
+ const probe = screen.getByTestId('probe');
+ expect(probe.dataset.size).toBe('28/16');
+ expect(probe.dataset.borderRadius).toBe('12');
+ });
+
+ it('leaves the action size unset without an outer context', () => {
+ render(createElement(ActionToolbar));
+
+ expect(screen.getByTestId('probe').dataset.size).toBe('none');
+ });
+});
diff --git a/src/features/ChatInput/ActionBar/index.tsx b/src/features/ChatInput/ActionBar/index.tsx
index 2e2359ea5a7..02028eaa66d 100644
--- a/src/features/ChatInput/ActionBar/index.tsx
+++ b/src/features/ChatInput/ActionBar/index.tsx
@@ -12,7 +12,7 @@ import { actionMap } from '../ActionBar/config';
import { useChatInputResourceAccess } from '../hooks/useChatInputResourceAccess';
import { useChatInputStore } from '../store';
import { type DropdownPlacement } from './context';
-import { ActionBarContext } from './context';
+import { ActionBarContext, useActionBarContext } from './context';
import { filterChatOnlyActions } from './filterChatOnlyActions';
const mapActionToItem = (actionKey: ActionKey) => {
@@ -78,9 +78,12 @@ const ActionToolbar = memo<ActionToolbarProps>(
[disableCollapse, extraActionItems, leftActions],
);
+ // Keep an outer action size (e.g. the compact composer preset) instead of
+ // resetting it for the toolbar's own items.
+ const { actionSize } = useActionBarContext();
const contextValue = useMemo(
- () => ({ borderRadius, dropdownPlacement }),
- [borderRadius, dropdownPlacement],
+ () => ({ actionSize, borderRadius, dropdownPlacement }),
+ [actionSize, borderRadius, dropdownPlacement],
);
if (!canShowControls) return null;
diff --git a/src/features/ContactList/index.test.tsx b/src/features/ContactList/index.test.tsx
new file mode 100644
index 00000000000..a1601bceb1c
--- /dev/null
+++ b/src/features/ContactList/index.test.tsx
@@ -0,0 +1,53 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { fireEvent, render, screen } from '@testing-library/react';
+import { createElement } from 'react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { ContactListBody } from './index';
+
+const fetch = vi.hoisted(() => ({ error: undefined as unknown, mutate: vi.fn() }));
+
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
+ useActiveWorkspaceSlug: () => null,
+}));
+vi.mock('@/hooks/useActiveLocation', () => ({ useActiveLocation: () => ({ pathname: '/' }) }));
+vi.mock('@/hooks/useFetchAgentList', () => ({ useFetchAgentList: () => fetch }));
+vi.mock('@/store/home', () => ({
+ useHomeStore: (selector: (state: object) => unknown) => selector({}),
+}));
+vi.mock('@/store/home/selectors', () => ({
+ homeAgentListSelectors: { allAgents: () => [], isAgentListInit: () => false },
+}));
+vi.mock('@/features/NavPanel/components/SkeletonList', () => ({
+ default: () => createElement('div', {}, 'Loading contacts'),
+}));
+vi.mock('@/components/AsyncError', () => ({
+ default: ({ onRetry }: { onRetry?: () => void }) =>
+ createElement('button', { onClick: onRetry, type: 'button' }, 'Retry contacts'),
+}));
+
+beforeEach(() => {
+ fetch.error = undefined;
+ fetch.mutate.mockReset();
+});
+
+describe('ContactListBody', () => {
+ it('shows the skeleton while the first load is in flight', () => {
+ render(createElement(ContactListBody));
+
+ expect(screen.getByText('Loading contacts')).toBeInTheDocument();
+ });
+
+ it('shows a retryable error when the first load fails', () => {
+ fetch.error = new Error('network');
+
+ render(createElement(ContactListBody));
+
+ expect(screen.queryByText('Loading contacts')).not.toBeInTheDocument();
+ fireEvent.click(screen.getByText('Retry contacts'));
+ expect(fetch.mutate).toHaveBeenCalled();
+ });
+});
diff --git a/src/features/ContactList/index.tsx b/src/features/ContactList/index.tsx
new file mode 100644
index 00000000000..15982bcb707
--- /dev/null
+++ b/src/features/ContactList/index.tsx
@@ -0,0 +1,203 @@
+'use client';
+
+import { DEFAULT_AVATAR } from '@lobechat/const';
+import { agentDisplayName, type SidebarAgentItem } from '@lobechat/types';
+import {
+ AccordionHeader,
+ AccordionItem,
+ AccordionPanel,
+ AccordionRoot,
+ AccordionTrigger,
+ ActionIcon,
+ DropdownMenu,
+ Flexbox,
+ Text,
+} from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import isEqual from 'fast-deep-equal';
+import { UserRoundPlusIcon } from 'lucide-react';
+import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
+import AsyncError from '@/components/AsyncError';
+import Avatar from '@/components/Avatar';
+import { DESKTOP_HEADER_ICON_SMALL_SIZE } from '@/const/layoutTokens';
+import AgentGroupAvatar from '@/features/AgentGroupAvatar';
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
+import { useCreateMenuItems } from '@/features/HomeSidebar/hooks';
+import { AVATAR_SIZE, ConversationRow, ListHeader } from '@/features/MessageList';
+import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import { NavPanelPortal } from '@/features/NavPanel/NavPanelPortal';
+import { NAV_PANEL_CONTACTS_KEY } from '@/features/NavPanel/railRouteKey';
+import SideBarLayout from '@/features/NavPanel/SideBarLayout';
+import { useActiveLocation } from '@/hooks/useActiveLocation';
+import { useFetchAgentList } from '@/hooks/useFetchAgentList';
+import { useHomeStore } from '@/store/home';
+import { homeAgentListSelectors } from '@/store/home/selectors';
+
+import { styles } from './style';
+
+const byTitle = (fallback: string) => (a: SidebarAgentItem, b: SidebarAgentItem) =>
+ agentDisplayName(a, fallback).localeCompare(agentDisplayName(b, fallback), 'zh-Hans-CN');
+
+const useActiveRouteId = () => {
+ const { pathname } = useActiveLocation();
+ const slug = useActiveWorkspaceSlug();
+ const segments = pathname.split('/').filter(Boolean);
+ const [root, id] = slug && segments[0] === slug ? segments.slice(1) : segments;
+
+ return root === 'agent' || root === 'group' ? id : undefined;
+};
+
+const Contact = memo<{ active: boolean; item: SidebarAgentItem }>(({ active, item }) => {
+ const { t } = useTranslation('chat');
+ const isGroup = item.type === 'group';
+ const title = isGroup
+ ? item.title || t('untitledAgent')
+ : agentDisplayName(item, t('untitledAgent'));
+ const customAvatar = typeof item.avatar === 'string' ? item.avatar : undefined;
+
+ return (
+ <ConversationRow
+ active={active}
+ preview={item.description || undefined}
+ title={title}
+ url={isGroup ? `/group/${item.id}/profile` : `/agent/${item.id}/profile`}
+ avatar={
+ isGroup ? (
+ <AgentGroupAvatar
+ avatar={customAvatar}
+ backgroundColor={item.backgroundColor || undefined}
+ memberAvatars={Array.isArray(item.avatar) ? item.avatar : []}
+ size={AVATAR_SIZE}
+ />
+ ) : (
+ <Avatar
+ emojiScaleWithBackground
+ avatar={customAvatar || DEFAULT_AVATAR}
+ background={item.backgroundColor || undefined}
+ name={title}
+ shape={'square'}
+ size={AVATAR_SIZE}
+ />
+ )
+ }
+ />
+ );
+});
+
+Contact.displayName = 'Contact';
+
+const Body = memo(() => {
+ const { t } = useTranslation('common');
+ const { t: tChat } = useTranslation('chat');
+ const { error, mutate } = useFetchAgentList();
+ const isInit = useHomeStore(homeAgentListSelectors.isAgentListInit);
+ const items = useHomeStore(homeAgentListSelectors.allAgents, isEqual);
+ const activeRouteId = useActiveRouteId();
+
+ const { agents, groups } = useMemo(() => {
+ const unique = [...new Map(items.map((item) => [item.id, item])).values()];
+ const sort = byTitle(tChat('untitledAgent'));
+ return {
+ agents: unique.filter((item) => item.type !== 'group').sort(sort),
+ groups: unique.filter((item) => item.type === 'group').sort(sort),
+ };
+ }, [items, tChat]);
+
+ if (!isInit && items.length === 0)
+ return error ? (
+ <AsyncError error={error} variant="inline" onRetry={() => void mutate()} />
+ ) : (
+ <SkeletonList paddingBlock={8} />
+ );
+
+ const sections = [
+ // Groups first: there are few, and they would sink below every agent.
+ { items: groups, key: 'groups', title: t('contacts.groups') },
+ { items: agents, key: 'agents', title: t('navPanel.agent') },
+ ];
+
+ // The standard sidebar accordion (same as the home sidebar sections), so
+ // each section collapses independently with the shared header styling.
+ return (
+ <Flexbox paddingBlock={'4px 12px'} paddingInline={4}>
+ <AccordionRoot
+ defaultValue={sections.map((section) => section.key)}
+ indicatorPlacement={'inline'}
+ style={{ gap: 8 }}
+ >
+ {sections.map((section) => (
+ <AccordionItem key={section.key} value={section.key}>
+ <AccordionHeader>
+ <AccordionTrigger style={{ paddingBlock: 4, paddingInline: '8px 4px' }}>
+ <Flexbox horizontal align={'center'} gap={4}>
+ <Text ellipsis fontSize={12} type={'secondary'} weight={500}>
+ {section.title}
+ </Text>
+ <Text fontSize={11} type={'secondary'}>
+ {section.items.length}
+ </Text>
+ </Flexbox>
+ </AccordionTrigger>
+ </AccordionHeader>
+ <AccordionPanel>
+ <Flexbox gap={1} paddingBlock={1} paddingInline={2}>
+ {section.items.length === 0 ? (
+ <div {...stylex.props(styles.empty)}>{t('contacts.empty')}</div>
+ ) : (
+ section.items.map((item) => (
+ <Contact active={item.id === activeRouteId} item={item} key={item.id} />
+ ))
+ )}
+ </Flexbox>
+ </AccordionPanel>
+ </AccordionItem>
+ ))}
+ </AccordionRoot>
+ </Flexbox>
+ );
+});
+
+Body.displayName = 'ContactListBody';
+
+export { Body as ContactListBody };
+
+const Header = memo(() => {
+ const { t } = useTranslation('common');
+ const { createTopLevelMenuItems, isLoading } = useCreateMenuItems();
+ const createItems = useMemo(() => createTopLevelMenuItems(), [createTopLevelMenuItems]);
+
+ return (
+ <ListHeader
+ title={t('tab.contacts')}
+ actions={
+ <DropdownMenu items={createItems}>
+ <ActionIcon
+ icon={UserRoundPlusIcon}
+ loading={isLoading}
+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}
+ title={t('contacts.create')}
+ />
+ </DropdownMenu>
+ }
+ />
+ );
+});
+
+Header.displayName = 'ContactListHeader';
+
+/**
+ * Contacts tab list column: every agent and group, alphabetically. A row opens
+ * the profile (`/agent/:id/profile`), which is the agent's edit surface.
+ */
+const ContactListPortal = () => (
+ <NavPanelPortal navKey={NAV_PANEL_CONTACTS_KEY}>
+ <AgentModalProvider>
+ <SideBarLayout body={<Body />} header={<Header />} />
+ </AgentModalProvider>
+ </NavPanelPortal>
+);
+
+export default ContactListPortal;
diff --git a/src/features/ContactList/style.ts b/src/features/ContactList/style.ts
new file mode 100644
index 00000000000..c3693997efb
--- /dev/null
+++ b/src/features/ContactList/style.ts
@@ -0,0 +1,11 @@
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+
+export const styles = stylex.create({
+ empty: {
+ paddingBlock: '8px',
+ paddingInline: '10px',
+ fontSize: '12px',
+ color: cssVar.colorTextQuaternary,
+ },
+});
diff --git a/src/features/Conversation/ChatInput/index.tsx b/src/features/Conversation/ChatInput/index.tsx
index b4ef00c75ed..a864435aeb6 100644
--- a/src/features/Conversation/ChatInput/index.tsx
+++ b/src/features/Conversation/ChatInput/index.tsx
@@ -2,7 +2,10 @@
import { type VoiceMessageRecording } from '@lobechat/types';
import { type SlashOptions } from '@lobehub/editor';
-import { type ChatInputActionsProps } from '@lobehub/editor/react';
+import {
+ type ChatInputActionsProps,
+ type ChatInputProps as EditorChatInputProps,
+} from '@lobehub/editor/react';
import { Alert, type DropdownItem, Flexbox, toast } from '@lobehub/ui';
import { type ReactNode } from 'react';
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
@@ -111,6 +114,10 @@ export interface ChatInputProps {
* Chat input capability switches. Omitted capabilities keep the default enabled state.
*/
feature?: ChatInputFeature;
+ /**
+ * Props forwarded to the editor's input container (e.g. a smaller default height)
+ */
+ inputContainerProps?: EditorChatInputProps;
/**
* Swap the action bar and send area for skeleton placeholders while
* the underlying agent/session config is still hydrating. The editor
@@ -183,6 +190,7 @@ const ChatInput = memo<ChatInputProps>(
disableQueue,
disableSend,
feature,
+ inputContainerProps,
leftActions = [],
leftContent,
rightActions = [],
@@ -528,6 +536,7 @@ const ChatInput = memo<ChatInputProps>(
controlBarSlot={controlBarSlot}
extraActionItems={extraActionItems}
hidden={hasPendingInterventions}
+ inputContainerProps={inputContainerProps}
isConfigLoading={isConfigLoading}
leftContent={leftContent}
placeholderVariant={placeholderVariant}
diff --git a/src/features/Conversation/WorkingSidebar/Overview/AgentProfilePanel.tsx b/src/features/Conversation/WorkingSidebar/Overview/AgentProfilePanel.tsx
new file mode 100644
index 00000000000..b7f25291c01
--- /dev/null
+++ b/src/features/Conversation/WorkingSidebar/Overview/AgentProfilePanel.tsx
@@ -0,0 +1,164 @@
+'use client';
+
+import { DEFAULT_AVATAR } from '@lobechat/const';
+import { agentDisplayName, agentSecondaryDisplayName } from '@lobechat/types';
+import { ActionIcon, Flexbox, Segmented, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { SquareArrowOutUpRightIcon } from 'lucide-react';
+import { memo, type ReactNode, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import Avatar from '@/components/Avatar';
+import { ModelIcon } from '@/components/LobeIcons';
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors } from '@/store/agent/selectors';
+
+const styles = stylex.create({
+ description: {
+ fontSize: '13px',
+ lineHeight: '20px',
+ color: cssVar.colorTextSecondary,
+ whiteSpace: 'pre-wrap',
+ },
+ detail: {
+ paddingBlock: '16px',
+ paddingInline: '16px',
+ },
+ hero: {
+ position: 'relative',
+ paddingBlockStart: '28px',
+ paddingBlockEnd: '12px',
+ paddingInline: '40px',
+ textAlign: 'center',
+ },
+ role: {
+ overflow: 'hidden',
+ fontSize: '12px',
+ lineHeight: '18px',
+ color: cssVar.colorTextTertiary,
+ maxWidth: '100%',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
+ label: {
+ fontSize: '12px',
+ color: cssVar.colorTextTertiary,
+ },
+ model: {
+ display: 'inline-flex',
+ gap: '6px',
+ alignItems: 'center',
+ maxWidth: '100%',
+ fontSize: '13px',
+ color: cssVar.colorText,
+ },
+ placeholder: {
+ fontSize: '13px',
+ color: cssVar.colorTextQuaternary,
+ },
+ tabs: {
+ paddingBlockEnd: '8px',
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: 'solid',
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ },
+});
+
+type ProfileTab = 'detail' | 'workspace';
+
+interface AgentProfilePanelProps {
+ agentId: string;
+ /** The existing working-panel overview (workspace, outputs, Portal entries). */
+ workspace: ReactNode;
+}
+
+/**
+ * The conversation's right panel opens as the agent's profile, like an IM
+ * contact card: centered avatar, title and role (profile link in the corner), then
+ * Details and the Workspace (the former overview, with Portal entries) as tabs.
+ */
+const AgentProfilePanel = memo<AgentProfilePanelProps>(({ agentId, workspace }) => {
+ const { t } = useTranslation('chat');
+ const navigate = useWorkspaceAwareNavigate();
+ const meta = useAgentStore(agentSelectors.getAgentMetaById(agentId));
+ const model = useAgentStore(agentSelectors.currentAgentModel);
+ const [tab, setTab] = useState<ProfileTab>('detail');
+ const slug = useAgentStore((s) => s.agentMap[agentId]?.slug);
+ const title = agentDisplayName(meta, t('untitledAgent'));
+ // Same identity line as the profile page: role (when the agent has its own
+ // name) and the @handle.
+ const roleLine = [agentSecondaryDisplayName(meta), slug ? `@${slug}` : undefined]
+ .filter(Boolean)
+ .join(' · ');
+
+ return (
+ <Flexbox>
+ <Flexbox align={'center'} gap={6} {...stylex.props(styles.hero)}>
+ {/* The profile entry sits in the header corner, not in the Details tab. */}
+ <ActionIcon
+ icon={SquareArrowOutUpRightIcon}
+ size={'small'}
+ style={{ insetBlockStart: 10, insetInlineEnd: 10, position: 'absolute' }}
+ title={t('workingPanel.overview.profile.view')}
+ onClick={() => navigate(`/agent/${agentId}/profile`)}
+ />
+ <Avatar
+ emojiScaleWithBackground
+ avatar={meta.avatar || DEFAULT_AVATAR}
+ background={meta.backgroundColor || undefined}
+ name={title}
+ shape={'square'}
+ size={64}
+ />
+ <Text ellipsis fontSize={17} style={{ maxWidth: '100%' }} weight={600}>
+ {title}
+ </Text>
+ {roleLine && <span {...stylex.props(styles.role)}>{roleLine}</span>}
+ </Flexbox>
+ <Flexbox align={'center'} {...stylex.props(styles.tabs)}>
+ <Segmented
+ size={'small'}
+ // Segmented pins itself to the start; center it under the identity.
+ style={{ alignSelf: 'center' }}
+ value={tab}
+ options={[
+ { label: t('workingPanel.profile.tabs.detail'), value: 'detail' },
+ { label: t('workingPanel.profile.tabs.workspace'), value: 'workspace' },
+ ]}
+ onChange={(value) => setTab(value as ProfileTab)}
+ />
+ </Flexbox>
+ {tab === 'detail' ? (
+ <Flexbox gap={16} {...stylex.props(styles.detail)}>
+ <Flexbox gap={6}>
+ <span {...stylex.props(styles.label)}>{t('workingPanel.profile.description')}</span>
+ {meta.description ? (
+ <span {...stylex.props(styles.description)}>{meta.description}</span>
+ ) : (
+ <span {...stylex.props(styles.placeholder)}>
+ {t('workingPanel.profile.noDescription')}
+ </span>
+ )}
+ </Flexbox>
+ {model && (
+ <Flexbox gap={6}>
+ <span {...stylex.props(styles.label)}>{t('workingPanel.profile.model')}</span>
+ <span {...stylex.props(styles.model)}>
+ <ModelIcon model={model} size={14} />
+ <Text ellipsis>{model}</Text>
+ </span>
+ </Flexbox>
+ )}
+ </Flexbox>
+ ) : (
+ workspace
+ )}
+ </Flexbox>
+ );
+});
+
+AgentProfilePanel.displayName = 'AgentProfilePanel';
+
+export default AgentProfilePanel;
diff --git a/src/features/Conversation/WorkingSidebar/Overview/index.tsx b/src/features/Conversation/WorkingSidebar/Overview/index.tsx
index 9fe51d2481c..a9c93eceed9 100644
--- a/src/features/Conversation/WorkingSidebar/Overview/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/Overview/index.tsx
@@ -41,6 +41,7 @@ import { TopicBackgroundActivity } from '@/features/BackgroundActivity/TopicSect
import BranchSwitcher from '@/features/ChatInput/ControlBar/BranchSwitcher';
import WorktreeSwitcher from '@/features/ChatInput/ControlBar/WorktreeSwitcher';
import { getAllWorkSummaries } from '@/features/Conversation/store/slices/data/workSummaries';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import WorkSummaryCard from '@/features/Work/WorkSummaryCard';
import { gitService } from '@/services/git';
import { useAgentStore } from '@/store/agent';
@@ -58,6 +59,7 @@ import { labPreferSelectors } from '@/store/user/selectors';
import GoalSection from '../GoalSection';
import ProgressSection from '../ProgressSection';
+import AgentProfilePanel from './AgentProfilePanel';
import DeviceStatusSection from './DeviceStatusSection';
import {
collectChangeStats,
@@ -117,6 +119,7 @@ const Overview = memo<OverviewProps>(
const { t: tDevice } = useTranslation('device');
const { t: tCommon } = useTranslation('common');
const isHetero = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
+ const imLayout = useImLayout();
const tunnelsEnabled = useUserStore(labPreferSelectors.enableDeviceTunnel);
const topicId = useChatStore((s) => s.activeTopicId);
const threadId = useChatStore((s) => s.activeThreadId);
@@ -443,8 +446,8 @@ const Overview = memo<OverviewProps>(
)
) : null;
- return (
- <Flexbox className={styles.body}>
+ const workspaceBody = (
+ <Flexbox>
{hasWorkspace && (
<>
<OverviewHeader
@@ -556,6 +559,18 @@ const Overview = memo<OverviewProps>(
</Flexbox>
</Flexbox>
);
+
+ // `im_layout`: with an agent, the panel opens as its profile and this
+ // overview becomes the profile's Workspace tab.
+ return (
+ <Flexbox className={styles.body}>
+ {imLayout && agentId ? (
+ <AgentProfilePanel agentId={agentId} key={agentId} workspace={workspaceBody} />
+ ) : (
+ workspaceBody
+ )}
+ </Flexbox>
+ );
},
);
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/filesColdStart.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/filesColdStart.test.tsx
index e4a56b29f92..4798365f256 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/filesColdStart.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/filesColdStart.test.tsx
@@ -15,6 +15,9 @@ import {
reviewState,
} from './harness';
+// The `im_layout` trial reads the server-config store; these tests cover the default layout.
+vi.mock('@/features/NavRail/useImLayout', () => ({ useImLayout: () => false }));
+
// The first frame is what the cold start is about: the deferred follow-up pass
// that gates the other panes has not run yet. Most cases assert the settled
// state; the cold-mount case flips this to false.
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
index b8b3f6b96e2..f19bbb0c59b 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
@@ -26,6 +26,9 @@ import {
workspace,
} from './harness';
+// The `im_layout` trial reads the server-config store; these tests cover the default layout.
+vi.mock('@/features/NavRail/useImLayout', () => ({ useImLayout: () => false }));
+
// Loaded after the mock harness so module mocks are registered first.
let AgentWorkingSidebar: ComponentType<{ availableWidth?: number }>;
diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsx
index ba342a01c4a..39b66ed803d 100644
--- a/src/features/Conversation/WorkingSidebar/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/index.tsx
@@ -4,6 +4,7 @@ import {
ActionIcon,
createStaticStyles,
cssVar,
+ cx,
type DropdownItem,
DropdownMenu,
Flexbox,
@@ -49,6 +50,7 @@ import {
PR_STATE_VISUAL,
} from '@/features/AgentSidebar/Topic/List/Item/metaCardData';
import { useRepoType } from '@/features/ChatInput/ControlBar/useRepoType';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import { getPortalViewWidth } from '@/features/Portal/portalWidth';
import TopicCommentsSidebar from '@/features/Portal/TopicComments/Sidebar';
import RightPanel from '@/features/RightPanel';
@@ -151,6 +153,18 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorBgContainer};
box-shadow: ${cssVar.boxShadowTertiary};
`,
+ // `im_layout`: docked as a full-height right column (the agent's profile),
+ // not a floating card, so it reads as the conversation's side panel.
+ overviewPanelDocked: css`
+ max-height: none;
+ height: 100%;
+ margin: 0;
+ border: none;
+ border-inline-start: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: 0;
+
+ box-shadow: none;
+ `,
overviewSlot: css`
overflow: hidden;
display: flex;
@@ -208,6 +222,7 @@ interface AgentWorkingSidebarProps {
const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth }) => {
const { t } = useTranslation(['chat', 'setting']);
+ const imLayout = useImLayout();
// Keep the panel frame + tabs on the navigation commit; the pane contents
// mount in a deferred follow-up pass behind a skeleton.
const contentReady = useDeferredMount();
@@ -942,13 +957,15 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
toggleTerminalPanel,
]);
- const overviewWidth = Math.min(OVERVIEW_PANEL_WIDTH, widthBudget - 32);
+ // The floating card keeps a 16px margin on each side; the docked panel has none.
+ const overviewGutter = imLayout ? 0 : 32;
+ const overviewWidth = Math.min(OVERVIEW_PANEL_WIDTH, widthBudget - overviewGutter);
const overviewPanel = (
<OverviewSlot>
<AnimatePresence initial={false}>
{showWorkingOverview && overviewFits && (
<m.div
- animate={{ width: overviewWidth + 32 }}
+ animate={{ width: overviewWidth + overviewGutter }}
className={styles.overviewSlot}
exit={{ transition: overviewExitTransition, width: 0 }}
initial={{ width: 0 }}
@@ -956,7 +973,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })
>
<m.div
animate={{ opacity: 1, x: 0 }}
- className={styles.overviewPanel}
+ className={cx(styles.overviewPanel, imLayout && styles.overviewPanelDocked)}
exit={{ opacity: 0, transition: overviewExitTransition, x: 12 }}
initial={{ opacity: 0, x: 12 }}
role={'complementary'}
diff --git a/src/features/DesktopLayoutContainer/index.tsx b/src/features/DesktopLayoutContainer/index.tsx
index 80bfb5a5d0c..b7c3e2fb9d3 100644
--- a/src/features/DesktopLayoutContainer/index.tsx
+++ b/src/features/DesktopLayoutContainer/index.tsx
@@ -1,4 +1,4 @@
-import { Flexbox } from '@lobehub/ui';
+import { cx, Flexbox } from '@lobehub/ui';
import { type FC, type PropsWithChildren } from 'react';
import { useEffect, useMemo, useRef } from 'react';
@@ -10,7 +10,15 @@ import { getInnerCssVariables, getOuterCssVariables } from './cssVariables';
import { LayoutContainerContext } from './LayoutContainerContext';
import { styles } from './style';
-const DesktopLayoutContainer: FC<PropsWithChildren> = ({ children }) => {
+interface DesktopLayoutContainerProps extends PropsWithChildren {
+ /**
+ * Fill the parent edge to edge, with no outer padding or own border: the
+ * `im_layout` rail wrap already draws the rounded border around it.
+ */
+ flush?: boolean;
+}
+
+const DesktopLayoutContainer: FC<DesktopLayoutContainerProps> = ({ children, flush }) => {
const innerContainerRef = useRef<HTMLDivElement>(null);
const isDarkMode = useIsDark();
const [expand] = useGlobalStore((s) => [systemStatusSelectors.showLeftPanel(s)]);
@@ -38,14 +46,14 @@ const DesktopLayoutContainer: FC<PropsWithChildren> = ({ children }) => {
return (
<Flexbox
- className={styles.outerContainer}
+ className={cx(styles.outerContainer, flush && styles.outerFlush)}
height={'100%'}
- padding={8}
- style={outerCssVariables}
+ padding={flush ? 0 : 8}
+ style={flush ? undefined : outerCssVariables}
width={'100%'}
>
<Flexbox
- className={styles.innerContainer}
+ className={cx(styles.innerContainer, flush && styles.innerFlush)}
height={'100%'}
ref={innerContainerRef}
style={innerCssVariables}
diff --git a/src/features/DesktopLayoutContainer/style.ts b/src/features/DesktopLayoutContainer/style.ts
index 6187735622e..2790860c36c 100644
--- a/src/features/DesktopLayoutContainer/style.ts
+++ b/src/features/DesktopLayoutContainer/style.ts
@@ -19,6 +19,12 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
background: ${cssVar.colorBgContainer};
`,
+ // `flush`: the rail wrap owns border, radius and spacing.
+ innerFlush: css`
+ border: none;
+ border-radius: 0;
+ `,
+
// Outer container
outerContainer: css`
position: relative;
@@ -30,4 +36,10 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
background: ${isDesktop ? 'transparent' : cssVar.colorBgLayout};
`,
+
+ outerFlush: css`
+ min-width: 0;
+ padding: 0;
+ background: transparent;
+ `,
}));
diff --git a/src/features/Electron/titlebar/NavigationBar.test.tsx b/src/features/Electron/titlebar/NavigationBar.test.tsx
index c4c892380a7..d5efe3f5282 100644
--- a/src/features/Electron/titlebar/NavigationBar.test.tsx
+++ b/src/features/Electron/titlebar/NavigationBar.test.tsx
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import NavigationBar from './NavigationBar';
const mocks = vi.hoisted(() => ({
+ imLayout: false,
isMac: false,
handlers: new Map<string, () => void>(),
leftPanelVisible: false,
@@ -13,6 +14,8 @@ const mocks = vi.hoisted(() => ({
openAllAgentsDrawer: vi.fn(),
}));
+vi.mock('@/features/NavRail/useImLayout', () => ({ useImLayout: () => mocks.imLayout }));
+
vi.mock('@lobechat/electron-client-ipc', () => ({
useWatchBroadcast: (event: string, handler: () => void) => mocks.handlers.set(event, handler),
}));
@@ -64,6 +67,7 @@ vi.mock('./TrayMenu/useTrayMenuSync', () => ({ useTrayMenuSync: vi.fn() }));
describe('NavigationBar tray broadcasts', () => {
beforeEach(() => {
mocks.handlers.clear();
+ mocks.imLayout = false;
mocks.isMac = false;
mocks.leftPanelVisible = false;
mocks.leftPanelWidth = 0;
@@ -102,6 +106,16 @@ describe('NavigationBar tray broadcasts', () => {
expect(expanded.container.querySelector('.root')).toHaveStyle({ width: '268px' });
});
+ it('spans the icon rail too under the im_layout trial', () => {
+ mocks.imLayout = true;
+ mocks.leftPanelVisible = true;
+ mocks.leftPanelWidth = 280;
+ const { container } = render(<NavigationBar />);
+
+ // Icon rail (48) plus the list column, minus the 12px gutter.
+ expect(container.querySelector('.root')).toHaveStyle({ width: '316px' });
+ });
+
it('follows the sidebar width without a transition while it is being resized', () => {
mocks.leftPanelVisible = true;
mocks.leftPanelWidth = 280;
diff --git a/src/features/Electron/titlebar/NavigationBar.tsx b/src/features/Electron/titlebar/NavigationBar.tsx
index 9ef37d87c8d..7c5228921f5 100644
--- a/src/features/Electron/titlebar/NavigationBar.tsx
+++ b/src/features/Electron/titlebar/NavigationBar.tsx
@@ -7,6 +7,8 @@ import { memo, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import ToggleLeftPanelButton from '@/features/NavPanel/ToggleLeftPanelButton';
+import { RAIL_WIDTH } from '@/features/NavRail/const';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { electronSystemService } from '@/services/electron/system';
import { useElectronStore } from '@/store/electron';
@@ -39,7 +41,11 @@ const navPanelSelector = (s: GlobalState) => {
};
const useNavPanelWidth = () => {
- return useGlobalStore(navPanelSelector);
+ const width = useGlobalStore(navPanelSelector);
+ // Under `im_layout` the list column starts after the icon rail, so the
+ // titlebar spans both.
+ const imLayout = useImLayout();
+ return imLayout && width > 0 ? width + RAIL_WIDTH : width;
};
const styles = createStaticStyles(({ css, cssVar }) => ({
diff --git a/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
index a9996e6216c..80dc41db8d8 100644
--- a/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
+++ b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
@@ -318,6 +318,26 @@ describe('useAgentDropdownMenu', () => {
expect(mocks.setSidebarItemVisible).toHaveBeenCalledWith('agent-1', false);
});
+ it('omits the hide action for lists that ignore the sidebar preference', () => {
+ const { result } = renderHook(() =>
+ useAgentDropdownMenu({
+ group: undefined,
+ id: 'agent-1',
+ openCreateGroupModal: vi.fn(),
+ pinned: false,
+ sidebarVisibilityEnabled: false,
+ title: 'Public Agent',
+ userId: 'member-1',
+ visibility: 'public',
+ }),
+ );
+
+ const keys = (result.current() ?? []).map((item) =>
+ item && typeof item === 'object' && 'key' in item ? item.key : undefined,
+ );
+ expect(keys).not.toContain('hideFromSidebar');
+ });
+
it('tells the user to wait when delete is refused by a pending history migration', async () => {
// Regression: a 409 TRANSFER_IN_PROGRESS used to fall through to the
// generic "operation failed, please try again", which invited immediate
diff --git a/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx
index bf1b4c2ac93..432476f1d02 100644
--- a/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx
+++ b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx
@@ -69,6 +69,12 @@ interface UseAgentDropdownMenuParams {
name?: string | null;
openCreateGroupModal: () => void;
pinned: boolean;
+ /**
+ * Offer "Remove from sidebar". Off for lists that ignore the sidebar
+ * visibility preference (the `im_layout` Messages list), where it would
+ * change nothing visible. Defaults to on.
+ */
+ sidebarVisibilityEnabled?: boolean;
slug?: string | null;
title: string;
userId?: string | null;
@@ -85,6 +91,7 @@ export const useAgentDropdownMenu = ({
name,
openCreateGroupModal,
pinned,
+ sidebarVisibilityEnabled = true,
slug,
title,
userId,
@@ -142,7 +149,8 @@ export const useAgentDropdownMenu = ({
const activeWorkspaceId = useActiveWorkspaceId();
const currentUserId = useUserStore(userProfileSelectors.userId);
const { isSidebarItemVisible, setSidebarItemVisible } = useSidebarItemVisibility();
- const isShownInSidebar = isSidebarItemVisible({ id, slug, type: 'agent', userId });
+ const isShownInSidebar =
+ sidebarVisibilityEnabled && isSidebarItemVisible({ id, slug, type: 'agent', userId });
const isPrivate = visibility === 'private';
const isBuiltin = !!slug && BUILTIN_SLUGS.has(slug);
const showPublishAction = Boolean(activeWorkspaceId) && isPrivate;
diff --git a/src/features/HomeSidebar/Footer/index.test.tsx b/src/features/HomeSidebar/Footer/index.test.tsx
index e19c12b5e30..51c10ab3516 100644
--- a/src/features/HomeSidebar/Footer/index.test.tsx
+++ b/src/features/HomeSidebar/Footer/index.test.tsx
@@ -132,6 +132,8 @@ const renderFooter = async ({
return selector(mockServerConfigState);
}
vi.doMock('@/store/serverConfig', () => ({
+ // `useActiveNavKey` reads the `im_layout` flag through these.
+ featureFlagsSelectors: () => ({}),
serverConfigSelectors: {
enableBusinessFeatures: (s: Record<string, unknown>) => !!s.enableBusinessFeatures,
},
diff --git a/src/features/MessageList/AgentConversation.tsx b/src/features/MessageList/AgentConversation.tsx
new file mode 100644
index 00000000000..dccfe348184
--- /dev/null
+++ b/src/features/MessageList/AgentConversation.tsx
@@ -0,0 +1,85 @@
+'use client';
+
+import { DEFAULT_AVATAR } from '@lobechat/const';
+import { agentDisplayName } from '@lobechat/types';
+import { memo, useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import Avatar from '@/components/Avatar';
+import { useAgentDropdownMenu } from '@/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu';
+import { usePreservedAgentUrl } from '@/features/HomeSidebar/Body/Agent/List/usePreservedAgentUrl';
+import { useAgentModal } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
+import { usePrefetchAgent } from '@/hooks/usePrefetchAgent';
+import { useChatStore } from '@/store/chat';
+import { operationSelectors } from '@/store/chat/selectors';
+
+import ConversationRow from './ConversationRow';
+import { type Conversation } from './conversations';
+import { AVATAR_SIZE } from './style';
+
+interface AgentConversationProps {
+ active: boolean;
+ conversation: Conversation;
+}
+
+const AgentConversation = memo<AgentConversationProps>(({ active, conversation }) => {
+ const { item, preview, activeAt } = conversation;
+ const { id, avatar, backgroundColor, pinned, slug, userId, visibility } = item;
+ const { t } = useTranslation('chat');
+ const { openCreateGroupModal } = useAgentModal();
+ const prefetchAgent = usePrefetchAgent();
+ const running = useChatStore(operationSelectors.isAgentVisiblyRunning(id));
+ const url = usePreservedAgentUrl(id);
+ const title = agentDisplayName(item, t('untitledAgent'));
+ const avatarSrc = typeof avatar === 'string' ? avatar : undefined;
+
+ const handleOpenCreateGroupModal = useCallback(
+ () => openCreateGroupModal(id, visibility),
+ [id, openCreateGroupModal, visibility],
+ );
+
+ const contextMenuItems = useAgentDropdownMenu({
+ avatar: avatarSrc,
+ backgroundColor: backgroundColor || undefined,
+ group: undefined,
+ id,
+ name: item.name,
+ openCreateGroupModal: handleOpenCreateGroupModal,
+ pinned: pinned ?? false,
+ // The Messages list ignores the sidebar visibility preference.
+ sidebarVisibilityEnabled: false,
+ slug,
+ title,
+ userId,
+ visibility,
+ });
+
+ return (
+ <ConversationRow
+ active={active}
+ activeAt={activeAt}
+ contextMenuItems={contextMenuItems}
+ pinned={!!pinned}
+ preview={preview}
+ running={running}
+ title={title}
+ unread={item.unreadCount}
+ url={url}
+ avatar={
+ <Avatar
+ emojiScaleWithBackground
+ avatar={avatarSrc || DEFAULT_AVATAR}
+ background={backgroundColor || undefined}
+ name={title}
+ shape={'square'}
+ size={AVATAR_SIZE}
+ />
+ }
+ onMouseEnter={() => prefetchAgent(id)}
+ />
+ );
+});
+
+AgentConversation.displayName = 'AgentConversation';
+
+export default AgentConversation;
diff --git a/src/features/MessageList/Body.test.tsx b/src/features/MessageList/Body.test.tsx
new file mode 100644
index 00000000000..e4015b77a00
--- /dev/null
+++ b/src/features/MessageList/Body.test.tsx
@@ -0,0 +1,135 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { render, screen } from '@testing-library/react';
+import { createElement } from 'react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import Body from './Body';
+
+const home = vi.hoisted(() => ({
+ error: undefined as unknown,
+ isInit: false,
+ items: [] as unknown[],
+ mutate: () => {},
+ recents: [] as unknown[],
+}));
+
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+
+vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
+ useActiveWorkspaceSlug: () => null,
+}));
+vi.mock('@/hooks/useActiveLocation', () => ({ useActiveLocation: () => ({ pathname: '/' }) }));
+vi.mock('@/hooks/useFetchAgentList', () => ({
+ useFetchAgentList: () => ({ error: home.error, mutate: home.mutate }),
+}));
+vi.mock('@/components/AsyncError', () => ({
+ default: () => createElement('div', {}, 'Agents failed'),
+}));
+vi.mock('@/features/AgentRoute/useResolvedAgentRouteId', () => ({
+ resolveInboxAgentRouteId: (id: string) => id,
+}));
+
+vi.mock('@/store/home', () => ({
+ useHomeStore: (selector: (state: object) => unknown) =>
+ selector({ useFetchConversationRecents: () => {} }),
+}));
+vi.mock('@/store/home/selectors', () => ({
+ homeAgentListSelectors: { allAgents: () => home.items, isAgentListInit: () => home.isInit },
+ homeRecentSelectors: { conversationRecents: () => () => home.recents },
+}));
+vi.mock('@/store/agent', () => ({
+ useAgentStore: (selector: (state: object) => unknown) => selector({ agentMap: {} }),
+}));
+vi.mock('@/store/agent/selectors', () => ({
+ agentSelectors: { getAgentMetaById: () => () => ({ title: 'Lobe AI' }) },
+ builtinAgentSelectors: { inboxAgentId: () => 'inbox' },
+}));
+
+vi.mock('@/features/Channels/ChannelList', () => ({
+ default: () => createElement('div', {}, 'Channels'),
+}));
+vi.mock('@/features/NavPanel/components/SkeletonList', () => ({
+ default: () => createElement('div', {}, 'Loading agents'),
+}));
+vi.mock('./InboxConversation', () => ({
+ default: () => createElement('div', {}, 'Lobe AI row'),
+}));
+vi.mock('./AgentConversation', () => ({
+ default: ({ conversation }: { conversation: { item: { title: string } } }) =>
+ createElement('div', {}, conversation.item.title),
+}));
+vi.mock('./GroupConversation', () => ({ default: () => null }));
+
+beforeEach(() => {
+ home.error = undefined;
+ home.isInit = false;
+ home.items = [];
+ home.recents = [];
+});
+
+describe('MessageList Body', () => {
+ it('keeps Lobe AI and Channels visible while the agent list is unresolved', () => {
+ render(createElement(Body));
+
+ expect(screen.getByText('Lobe AI row')).toBeInTheDocument();
+ expect(screen.getByText('Channels')).toBeInTheDocument();
+ expect(screen.getByText('Loading agents')).toBeInTheDocument();
+ });
+
+ it('replaces the agent skeleton with an error, keeping Lobe AI and Channels', () => {
+ home.error = new Error('network');
+
+ render(createElement(Body));
+
+ expect(screen.getByText('Agents failed')).toBeInTheDocument();
+ expect(screen.queryByText('Loading agents')).not.toBeInTheDocument();
+ expect(screen.getByText('Lobe AI row')).toBeInTheDocument();
+ expect(screen.getByText('Channels')).toBeInTheDocument();
+ });
+
+ it('drops the agent skeleton once the list arrives', () => {
+ home.isInit = true;
+ home.items = [
+ { id: 'a', pinned: false, title: 'Agent A', type: 'agent', updatedAt: new Date() },
+ ];
+
+ render(createElement(Body));
+
+ expect(screen.getByText('Agent A')).toBeInTheDocument();
+ expect(screen.queryByText('Loading agents')).not.toBeInTheDocument();
+ expect(screen.getByText('Channels')).toBeInTheDocument();
+ });
+});
+
+describe('MessageList Body ordering', () => {
+ const row = (id: string, updatedAt: string) => ({
+ id,
+ pinned: false,
+ title: id,
+ type: 'agent',
+ updatedAt: new Date(updatedAt),
+ });
+ const topic = (agentId: string, updatedAt: string) => ({
+ agentId,
+ icon: '',
+ id: agentId + updatedAt,
+ routePath: `/agent/${agentId}`,
+ status: null,
+ title: 'topic',
+ type: 'topic',
+ updatedAt: new Date(updatedAt),
+ });
+
+ it('moves Lobe AI up by its latest conversation, not its configuration time', () => {
+ home.items = [row('a', '2026-10-01')];
+ home.recents = [topic('inbox', '2026-10-06'), topic('a', '2026-10-03')];
+
+ const { container } = render(createElement(Body));
+ const text = container.textContent ?? '';
+
+ expect(text).toContain('Lobe AI row');
+ expect(text.indexOf('Lobe AI row')).toBeLessThan(text.indexOf('a'));
+ });
+});
diff --git a/src/features/MessageList/Body.tsx b/src/features/MessageList/Body.tsx
new file mode 100644
index 00000000000..9b7f7bac56c
--- /dev/null
+++ b/src/features/MessageList/Body.tsx
@@ -0,0 +1,140 @@
+'use client';
+
+import { agentDisplayName } from '@lobechat/types';
+import { Flexbox } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import isEqual from 'fast-deep-equal';
+import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
+import AsyncError from '@/components/AsyncError';
+import { resolveInboxAgentRouteId } from '@/features/AgentRoute/useResolvedAgentRouteId';
+import ChannelList from '@/features/Channels/ChannelList';
+import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import { useActiveLocation } from '@/hooks/useActiveLocation';
+import { useFetchAgentList } from '@/hooks/useFetchAgentList';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
+import { useHomeStore } from '@/store/home';
+import { homeAgentListSelectors, homeRecentSelectors } from '@/store/home/selectors';
+import { ALL_RECENTS_LIMIT } from '@/store/home/slices/recent/action';
+import { createConversationRecentQueryKey } from '@/store/home/slices/recent/projection';
+
+import AgentConversation from './AgentConversation';
+import {
+ buildConversationEntries,
+ buildConversationSections,
+ type Conversation,
+ latestActivity,
+ latestTopicOf,
+} from './conversations';
+import GroupConversation from './GroupConversation';
+import InboxConversation from './InboxConversation';
+import { useMessageSearch } from './SearchContext';
+import { styles } from './style';
+
+const RECENTS_QUERY_KEY = createConversationRecentQueryKey(ALL_RECENTS_LIMIT);
+
+/** `/agent/:id/...` or `/group/:id/...` → the routed conversation id. */
+const useActiveRouteId = () => {
+ const { pathname } = useActiveLocation();
+ const slug = useActiveWorkspaceSlug();
+ const segments = pathname.split('/').filter(Boolean);
+ const [root, id] = slug && segments[0] === slug ? segments.slice(1) : segments;
+
+ return root === 'agent' || root === 'group' ? id : undefined;
+};
+
+const ConversationItem = memo<{ activeRouteId?: string; conversation: Conversation }>(
+ ({ activeRouteId, conversation }) => {
+ const active = conversation.item.id === activeRouteId;
+
+ return conversation.item.type === 'group' ? (
+ <GroupConversation active={active} conversation={conversation} />
+ ) : (
+ <AgentConversation active={active} conversation={conversation} />
+ );
+ },
+);
+
+ConversationItem.displayName = 'ConversationItem';
+
+const Body = memo(() => {
+ const { t } = useTranslation('common');
+ const { error: agentsError, mutate: retryAgents } = useFetchAgentList();
+ const isInit = useHomeStore(homeAgentListSelectors.isAgentListInit);
+ useHomeStore((s) => s.useFetchConversationRecents)(ALL_RECENTS_LIMIT);
+
+ const items = useHomeStore(homeAgentListSelectors.allAgents, isEqual);
+ const recents = useHomeStore(homeRecentSelectors.conversationRecents(RECENTS_QUERY_KEY));
+ const activeRouteId = useActiveRouteId();
+
+ const { query } = useMessageSearch();
+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
+ const inboxUpdatedAt = useAgentStore((s) =>
+ inboxAgentId ? s.agentMap[inboxAgentId]?.updatedAt : undefined,
+ );
+ const inboxTitle = useAgentStore((s) =>
+ agentDisplayName(
+ agentSelectors.getAgentMetaById(resolveInboxAgentRouteId(inboxAgentId))(s),
+ 'Lobe AI',
+ ),
+ );
+
+ // The inbox is not one of the sidebar rows, so its position comes from its
+ // own latest topic rather than from the agent's configuration timestamp.
+ const inboxTopic = useMemo(
+ () => latestTopicOf(recents, inboxAgentId ?? undefined),
+ [recents, inboxAgentId],
+ );
+
+ const entries = useMemo(
+ () =>
+ buildConversationEntries(
+ buildConversationSections(items, recents),
+ { activeAt: latestActivity(inboxUpdatedAt, inboxTopic), title: inboxTitle },
+ query,
+ ),
+ [items, recents, inboxUpdatedAt, inboxTitle, inboxTopic, query],
+ );
+
+ // Only the agent rows wait on the agent list: Lobe AI and Channels load on
+ // their own, so a slow or failed agent-list request must not hide them.
+ const agentsLoading = !isInit && items.length === 0;
+
+ return (
+ <Flexbox gap={1} paddingBlock={'0 12px'} paddingInline={6}>
+ {entries.map((entry) =>
+ entry.type === 'inbox' ? (
+ <InboxConversation activeRouteId={activeRouteId} key={'inbox'} />
+ ) : (
+ <ConversationItem
+ activeRouteId={activeRouteId}
+ conversation={entry}
+ key={entry.item.id}
+ />
+ ),
+ )}
+ {agentsLoading ? (
+ agentsError ? (
+ <AsyncError error={agentsError} variant="inline" onRetry={() => void retryAgents()} />
+ ) : (
+ <SkeletonList paddingBlock={8} />
+ )
+ ) : (
+ entries.length === 0 && (
+ <div {...stylex.props(styles.empty)}>
+ {query ? t('navPanel.searchResultEmpty') : t('messageList.empty')}
+ </div>
+ )
+ )}
+ {/* Non-project Channels (and their create entry) have no other home in the rail layout. */}
+ <ChannelList />
+ </Flexbox>
+ );
+});
+
+Body.displayName = 'MessageListBody';
+
+export default Body;
diff --git a/src/features/MessageList/ConversationRow.tsx b/src/features/MessageList/ConversationRow.tsx
new file mode 100644
index 00000000000..484e87b17b4
--- /dev/null
+++ b/src/features/MessageList/ConversationRow.tsx
@@ -0,0 +1,98 @@
+'use client';
+
+import { ContextMenuTrigger, Flexbox, Spin } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import { type ComponentProps, memo, type ReactNode, type Ref } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
+
+import { formatConversationTime } from './conversations';
+import { styles } from './style';
+
+export interface ConversationRowProps {
+ active?: boolean;
+ activeAt?: Date;
+ avatar: ReactNode;
+ contextMenuItems?: ComponentProps<typeof ContextMenuTrigger>['items'];
+ onMouseEnter?: () => void;
+ /** Pinned rows keep a tinted background, like WeChat's 置顶. */
+ pinned?: boolean;
+ preview?: string;
+ /** The row element, e.g. the anchor for an inline rename popover. */
+ ref?: Ref<HTMLElement>;
+ running?: boolean;
+ title: string;
+ unread?: number;
+ url: string;
+}
+
+const ConversationRow = memo<ConversationRowProps>(
+ ({
+ active,
+ activeAt,
+ avatar,
+ contextMenuItems,
+ onMouseEnter,
+ pinned,
+ preview,
+ ref,
+ running,
+ title,
+ unread,
+ url,
+ }) => {
+ const { t } = useTranslation('common');
+
+ const row = (
+ <WorkspaceLink
+ aria-current={active ? 'page' : undefined}
+ aria-label={title}
+ ref={ref}
+ {...stylex.props(styles.row, pinned && styles.rowPinned, active && styles.rowActive)}
+ to={url}
+ onMouseEnter={onMouseEnter}
+ >
+ <span {...stylex.props(styles.avatar)}>
+ {avatar}
+ {!!unread && unread > 0 && (
+ <span {...stylex.props(styles.unread)}>{unread > 99 ? '99+' : unread}</span>
+ )}
+ </span>
+ <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <span {...stylex.props(styles.title)}>{title}</span>
+ {activeAt && (
+ <span {...stylex.props(styles.time)}>{formatConversationTime(activeAt)}</span>
+ )}
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8}>
+ {running ? (
+ <Flexbox
+ horizontal
+ align={'center'}
+ {...stylex.props(styles.preview, styles.running)}
+ gap={4}
+ >
+ <Spin size={10} style={{ color: 'inherit' }} />
+ {t('messageList.running')}
+ </Flexbox>
+ ) : (
+ <span {...stylex.props(styles.preview)}>{preview || ' '}</span>
+ )}
+ </Flexbox>
+ </Flexbox>
+ </WorkspaceLink>
+ );
+
+ return contextMenuItems ? (
+ <ContextMenuTrigger items={contextMenuItems}>{row}</ContextMenuTrigger>
+ ) : (
+ row
+ );
+ },
+);
+
+ConversationRow.displayName = 'ConversationRow';
+
+export default ConversationRow;
diff --git a/src/features/MessageList/GroupConversation.test.tsx b/src/features/MessageList/GroupConversation.test.tsx
new file mode 100644
index 00000000000..f98c5803741
--- /dev/null
+++ b/src/features/MessageList/GroupConversation.test.tsx
@@ -0,0 +1,40 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { render, waitFor } from '@testing-library/react';
+import { createElement } from 'react';
+import { describe, expect, it, vi } from 'vitest';
+
+import GroupConversation from './GroupConversation';
+
+const menu = vi.hoisted(() => ({ anchors: [] as (HTMLElement | null)[] }));
+
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('@/features/AgentGroupAvatar', () => ({ default: () => null }));
+vi.mock('@/features/HomeSidebar/Body/Agent/List/AgentGroupItem/useDropdownMenu', () => ({
+ useGroupDropdownMenu: ({ anchor }: { anchor: HTMLElement | null }) => {
+ menu.anchors.push(anchor);
+ return () => [];
+ },
+}));
+vi.mock('@/features/Workspace/WorkspaceLink', () => ({
+ default: ({ ref, to: _to, ...rest }: { ref?: (el: HTMLElement | null) => void; to: string }) =>
+ createElement('a', { ...rest, ref }),
+}));
+
+describe('GroupConversation', () => {
+ it('anchors the row menu (inline rename) on the row element', async () => {
+ const { container } = render(
+ createElement(GroupConversation, {
+ active: false,
+ conversation: {
+ activeAt: new Date(),
+ item: { id: 'cg_1', pinned: false, title: 'Group', type: 'group', updatedAt: new Date() },
+ } as never,
+ }),
+ );
+
+ const row = container.querySelector('a');
+ await waitFor(() => expect(menu.anchors.at(-1)).toBe(row));
+ });
+});
diff --git a/src/features/MessageList/GroupConversation.tsx b/src/features/MessageList/GroupConversation.tsx
new file mode 100644
index 00000000000..46411ae8654
--- /dev/null
+++ b/src/features/MessageList/GroupConversation.tsx
@@ -0,0 +1,66 @@
+'use client';
+
+import { GROUP_CHAT_URL } from '@lobechat/const';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import AgentGroupAvatar from '@/features/AgentGroupAvatar';
+import { useGroupDropdownMenu } from '@/features/HomeSidebar/Body/Agent/List/AgentGroupItem/useDropdownMenu';
+
+import ConversationRow from './ConversationRow';
+import { type Conversation } from './conversations';
+import { AVATAR_SIZE } from './style';
+
+interface GroupConversationProps {
+ active: boolean;
+ conversation: Conversation;
+}
+
+const GroupConversation = memo<GroupConversationProps>(({ active, conversation }) => {
+ const { item, preview, activeAt } = conversation;
+ const { id, avatar, backgroundColor, description, pinned, userId } = item;
+ const { t } = useTranslation('chat');
+ const title = item.title || t('untitledAgent');
+ const customAvatar = typeof avatar === 'string' ? avatar : undefined;
+ const memberAvatars = Array.isArray(avatar) ? avatar : [];
+ // Rename opens an inline popover anchored on the row.
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
+
+ const contextMenuItems = useGroupDropdownMenu({
+ anchor,
+ avatar: customAvatar,
+ backgroundColor: backgroundColor || undefined,
+ description,
+ id,
+ memberAvatars,
+ pinned: pinned ?? false,
+ title,
+ userId,
+ });
+
+ return (
+ <ConversationRow
+ active={active}
+ activeAt={activeAt}
+ contextMenuItems={contextMenuItems}
+ pinned={!!pinned}
+ preview={preview}
+ ref={setAnchor}
+ title={title}
+ unread={item.unreadCount}
+ url={GROUP_CHAT_URL(id)}
+ avatar={
+ <AgentGroupAvatar
+ avatar={customAvatar}
+ backgroundColor={backgroundColor || undefined}
+ memberAvatars={memberAvatars}
+ size={AVATAR_SIZE}
+ />
+ }
+ />
+ );
+});
+
+GroupConversation.displayName = 'GroupConversation';
+
+export default GroupConversation;
diff --git a/src/features/MessageList/Header.tsx b/src/features/MessageList/Header.tsx
new file mode 100644
index 00000000000..dbcbd1fd004
--- /dev/null
+++ b/src/features/MessageList/Header.tsx
@@ -0,0 +1,77 @@
+'use client';
+
+import { ActionIcon, DropdownMenu, Flexbox, SearchBar, Text } from '@lobehub/ui';
+import { PlusIcon } from 'lucide-react';
+import { memo, type ReactNode, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { DESKTOP_HEADER_ICON_SMALL_SIZE } from '@/const/layoutTokens';
+import { useCreateMenuItems } from '@/features/HomeSidebar/hooks';
+
+import { useMessageSearch } from './SearchContext';
+
+interface ListHeaderProps {
+ actions?: ReactNode;
+ title: string;
+}
+
+/** List column header: tab title on the left, column actions on the right. */
+export const ListHeader = memo<ListHeaderProps>(({ title, actions }) => (
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={4}
+ justify={'space-between'}
+ paddingBlock={12}
+ paddingInline={'14px 10px'}
+ >
+ <Text ellipsis fontSize={15} weight={600}>
+ {title}
+ </Text>
+ <Flexbox horizontal align={'center'} gap={2}>
+ {actions}
+ </Flexbox>
+ </Flexbox>
+));
+
+ListHeader.displayName = 'ListHeader';
+
+const Header = memo(() => {
+ const { t } = useTranslation('common');
+ const { query, setQuery } = useMessageSearch();
+ const { createTopLevelMenuItems, isLoading } = useCreateMenuItems();
+ const createItems = useMemo(() => createTopLevelMenuItems(), [createTopLevelMenuItems]);
+
+ // WeChat-style header: a search box that filters the list, and one "+" entry.
+ return (
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={6}
+ paddingBlock={'12px 8px'}
+ paddingInline={'10px 8px'}
+ >
+ <SearchBar
+ allowClear
+ placeholder={t('messageList.search')}
+ size={'small'}
+ style={{ flex: 1 }}
+ value={query}
+ variant={'filled'}
+ onChange={(e) => setQuery(e.target.value)}
+ />
+ <DropdownMenu items={createItems}>
+ <ActionIcon
+ icon={PlusIcon}
+ loading={isLoading}
+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}
+ title={t('messageList.newChat')}
+ />
+ </DropdownMenu>
+ </Flexbox>
+ );
+});
+
+Header.displayName = 'MessageListHeader';
+
+export default Header;
diff --git a/src/features/MessageList/InboxConversation.tsx b/src/features/MessageList/InboxConversation.tsx
new file mode 100644
index 00000000000..a678bf9aa3a
--- /dev/null
+++ b/src/features/MessageList/InboxConversation.tsx
@@ -0,0 +1,56 @@
+'use client';
+
+import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { agentDisplayName } from '@lobechat/types';
+import { Avatar } from '@lobehub/ui';
+import { memo } from 'react';
+
+import { resolveInboxAgentRouteId } from '@/features/AgentRoute/useResolvedAgentRouteId';
+import { usePreservedAgentUrl } from '@/features/HomeSidebar/Body/Agent/List/usePreservedAgentUrl';
+import { usePrefetchAgent } from '@/hooks/usePrefetchAgent';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
+import { useChatStore } from '@/store/chat';
+import { operationSelectors } from '@/store/chat/selectors';
+
+import ConversationRow from './ConversationRow';
+import { AVATAR_SIZE } from './style';
+
+/** The built-in Lobe AI conversation, always first in the list. */
+const InboxConversation = memo<{ activeRouteId?: string; preview?: string }>(
+ ({ activeRouteId, preview }) => {
+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
+ const routeId = resolveInboxAgentRouteId(inboxAgentId);
+ const meta = useAgentStore(agentSelectors.getAgentMetaById(routeId));
+ const running = useChatStore(
+ inboxAgentId ? operationSelectors.isAgentVisiblyRunning(inboxAgentId) : () => false,
+ );
+ const prefetchAgent = usePrefetchAgent();
+ const url = usePreservedAgentUrl(routeId);
+ const title = agentDisplayName(meta, 'Lobe AI');
+ const active = !!activeRouteId && (activeRouteId === routeId || activeRouteId === inboxAgentId);
+
+ return (
+ <ConversationRow
+ active={active}
+ preview={preview || meta.description || undefined}
+ running={running}
+ title={title}
+ url={url}
+ avatar={
+ <Avatar
+ emojiScaleWithBackground
+ avatar={meta.avatar || DEFAULT_INBOX_AVATAR}
+ shape={'square'}
+ size={AVATAR_SIZE}
+ />
+ }
+ onMouseEnter={() => inboxAgentId && prefetchAgent(inboxAgentId)}
+ />
+ );
+ },
+);
+
+InboxConversation.displayName = 'InboxConversation';
+
+export default InboxConversation;
diff --git a/src/features/MessageList/SearchContext.tsx b/src/features/MessageList/SearchContext.tsx
new file mode 100644
index 00000000000..45a5940789e
--- /dev/null
+++ b/src/features/MessageList/SearchContext.tsx
@@ -0,0 +1,20 @@
+'use client';
+
+import { createContext, type PropsWithChildren, use, useMemo, useState } from 'react';
+
+interface MessageSearchState {
+ query: string;
+ setQuery: (query: string) => void;
+}
+
+const MessageSearchContext = createContext<MessageSearchState>({ query: '', setQuery: () => {} });
+
+/** Shares the list header's search box with the conversation rows below it. */
+export const MessageSearchProvider = ({ children }: PropsWithChildren) => {
+ const [query, setQuery] = useState('');
+ const value = useMemo(() => ({ query, setQuery }), [query]);
+
+ return <MessageSearchContext value={value}>{children}</MessageSearchContext>;
+};
+
+export const useMessageSearch = () => use(MessageSearchContext);
diff --git a/src/features/MessageList/conversations.test.ts b/src/features/MessageList/conversations.test.ts
new file mode 100644
index 00000000000..e10c7f8165c
--- /dev/null
+++ b/src/features/MessageList/conversations.test.ts
@@ -0,0 +1,179 @@
+import type { RecentItem, SidebarAgentItem } from '@lobechat/types';
+import { describe, expect, it } from 'vitest';
+
+import {
+ buildConversationEntries,
+ buildConversationSections,
+ formatConversationTime,
+ latestActivity,
+ latestTopicOf,
+} from './conversations';
+
+const agent = (id: string, updatedAt: string, extra: Partial<SidebarAgentItem> = {}) =>
+ ({
+ id,
+ pinned: false,
+ title: id,
+ type: 'agent',
+ updatedAt: new Date(updatedAt),
+ ...extra,
+ }) as SidebarAgentItem;
+
+const topic = (extra: Partial<RecentItem> & { updatedAt: string }) =>
+ ({
+ icon: '',
+ id: Math.random().toString(),
+ routePath: '/',
+ status: null,
+ title: 'topic',
+ type: 'topic',
+ ...extra,
+ updatedAt: new Date(extra.updatedAt),
+ }) as RecentItem;
+
+describe('buildConversationSections', () => {
+ it('orders by latest activity, pinned first, with the latest topic as preview', () => {
+ const { pinned, recent } = buildConversationSections(
+ [
+ agent('a', '2026-10-01'),
+ agent('b', '2026-10-02'),
+ agent('p', '2026-09-01', { pinned: true }),
+ agent('g', '2026-09-01', { type: 'group' }),
+ ],
+ [
+ topic({ agentId: 'a', lastAssistantMessage: 'old', updatedAt: '2026-10-03' }),
+ topic({ agentId: 'a', lastAssistantMessage: 'newest\n reply', updatedAt: '2026-10-05' }),
+ topic({ routePath: '/group/g/tpc_1', title: 'group topic', updatedAt: '2026-10-04' }),
+ topic({ agentId: 'b', type: 'document', updatedAt: '2026-10-09' }),
+ ],
+ );
+
+ expect(pinned.map((c) => c.item.id)).toEqual(['p']);
+ expect(recent.map((c) => c.item.id)).toEqual(['a', 'g', 'b']);
+ expect(recent[0].preview).toBe('newest reply');
+ expect(recent[1].preview).toBe('group topic');
+ // Documents are not conversation activity.
+ expect(recent[2].activeAt).toEqual(new Date('2026-10-02'));
+ });
+
+ it('attributes a group topic that also carries the supervisor agentId to the group', () => {
+ const { recent } = buildConversationSections(
+ [agent('sup', '2026-09-01'), agent('g', '2026-09-01', { type: 'group' })],
+ [
+ topic({
+ agentId: 'sup',
+ lastAssistantMessage: 'group reply',
+ routePath: '/group/g/tpc_2',
+ updatedAt: '2026-10-05',
+ }),
+ ],
+ );
+
+ expect(recent.map((c) => c.item.id)).toEqual(['g', 'sup']);
+ expect(recent[0].preview).toBe('group reply');
+ // The supervisor only keeps its own timestamp and never shows the group's reply.
+ expect(recent[1].activeAt).toEqual(new Date('2026-09-01'));
+ expect(recent[1].preview).toBeUndefined();
+ });
+
+ it('drops duplicate ids and falls back to the description', () => {
+ const { recent } = buildConversationSections(
+ [agent('a', '2026-10-01', { description: 'helps' }), agent('a', '2026-10-01')],
+ undefined,
+ );
+
+ expect(recent).toHaveLength(1);
+ expect(recent[0].preview).toBe('helps');
+ });
+});
+
+describe('formatConversationTime', () => {
+ const now = new Date(2026, 9, 26, 15, 0);
+
+ it.each([
+ [new Date(2026, 9, 26, 9, 5), '09:05'],
+ [new Date(2026, 9, 25, 23, 59), '10/25'],
+ [new Date(2025, 0, 2), '2025/1/2'],
+ ])('formats %s as %s', (date, expected) => {
+ expect(formatConversationTime(date, now)).toBe(expected);
+ });
+});
+
+describe('buildConversationEntries', () => {
+ const sections = buildConversationSections(
+ [
+ agent('a', '2026-10-05', { title: 'Alpha' }),
+ agent('b', '2026-10-01', { title: 'Beta' }),
+ agent('p', '2026-09-01', { pinned: true, title: 'Pinned' }),
+ ],
+ undefined,
+ );
+ const ids = (entries: ReturnType<typeof buildConversationEntries>) =>
+ entries.map((e) => (e.type === 'inbox' ? 'inbox' : e.item.id));
+
+ it('places Lobe AI by its own activity instead of pinning it on top', () => {
+ expect(
+ ids(
+ buildConversationEntries(sections, { activeAt: new Date('2026-10-03'), title: 'Lobe AI' }),
+ ),
+ ).toEqual(['p', 'a', 'inbox', 'b']);
+ });
+
+ it('puts Lobe AI last until its activity is known', () => {
+ expect(ids(buildConversationEntries(sections, { title: 'Lobe AI' }))).toEqual([
+ 'p',
+ 'a',
+ 'b',
+ 'inbox',
+ ]);
+ });
+
+ it('filters every row, Lobe AI included, by title', () => {
+ expect(ids(buildConversationEntries(sections, { title: 'Lobe AI' }, 'bet'))).toEqual(['b']);
+ expect(ids(buildConversationEntries(sections, { title: 'Lobe AI' }, 'lobe'))).toEqual([
+ 'inbox',
+ ]);
+ });
+
+ it('matches the personal name shown on the row, not only the role title', () => {
+ const named = {
+ pinned: [],
+ recent: [
+ {
+ activeAt: new Date('2026-01-01'),
+ item: agent('n', '2026-01-01', { name: 'Alice', title: 'Health Assistant' }),
+ },
+ ],
+ };
+
+ expect(ids(buildConversationEntries(named, undefined, 'alice'))).toEqual(['n']);
+ expect(ids(buildConversationEntries(named, undefined, 'health'))).toEqual(['n']);
+ });
+});
+
+describe('latestTopicOf', () => {
+ it("takes one owner's newest topic and leaves other owners alone", () => {
+ const recents = [
+ topic({ agentId: 'inbox', updatedAt: '2026-10-03' }),
+ topic({ agentId: 'inbox', lastAssistantMessage: 'newest', updatedAt: '2026-10-06' }),
+ topic({ agentId: 'a', updatedAt: '2026-10-09' }),
+ ];
+
+ expect(latestTopicOf(recents, 'inbox')?.lastAssistantMessage).toBe('newest');
+ expect(latestTopicOf(recents, 'missing')).toBeUndefined();
+ // No owner id (inbox unresolved) must not match every topic.
+ expect(latestTopicOf(recents, undefined)).toBeUndefined();
+ });
+});
+
+describe('latestActivity', () => {
+ it('uses the later of the own timestamp and the latest topic', () => {
+ expect(latestActivity('2026-10-02', topic({ updatedAt: '2026-10-05' }))).toEqual(
+ new Date('2026-10-05'),
+ );
+ expect(latestActivity('2026-10-07', topic({ updatedAt: '2026-10-05' }))).toEqual(
+ new Date('2026-10-07'),
+ );
+ expect(latestActivity(undefined, undefined)).toBeUndefined();
+ });
+});
diff --git a/src/features/MessageList/conversations.ts b/src/features/MessageList/conversations.ts
new file mode 100644
index 00000000000..91cf73983ce
--- /dev/null
+++ b/src/features/MessageList/conversations.ts
@@ -0,0 +1,142 @@
+import type { RecentItem, SidebarAgentItem } from '@lobechat/types';
+
+export interface Conversation {
+ /** Latest activity: the newer of the item itself and its latest topic. */
+ activeAt: Date;
+ item: SidebarAgentItem;
+ /** One-line preview from the latest topic (assistant reply, else title). */
+ preview?: string;
+}
+
+export interface ConversationSections {
+ pinned: Conversation[];
+ recent: Conversation[];
+}
+
+const recentOwnerId = (recent: RecentItem): string | undefined => {
+ if (recent.type !== 'topic') return;
+ // Group topics created by `execGroupAgent` persist the supervisor's `agentId`
+ // *and* the group route, so the route decides ownership: reading `agentId`
+ // first credits the group's replies to the supervisor and the group row never
+ // picks up its own activity.
+ const groupId = recent.routePath.match(/\/group\/([^/?#]+)/)?.[1];
+ return groupId ?? recent.agentId ?? undefined;
+};
+
+const toTime = (value: Date | string) => new Date(value).getTime();
+
+/** Newest topic per owner (agent id, or the group named by the topic route). */
+const topicsByOwner = (recents: RecentItem[] | undefined): Map<string, RecentItem> => {
+ const latest = new Map<string, RecentItem>();
+ for (const recent of recents ?? []) {
+ const owner = recentOwnerId(recent);
+ if (!owner) continue;
+ const current = latest.get(owner);
+ if (!current || toTime(recent.updatedAt) > toTime(current.updatedAt)) latest.set(owner, recent);
+ }
+ return latest;
+};
+
+/**
+ * One owner's latest topic. The inbox row is not part of `items`, so it asks
+ * for its own activity instead of going through the sections builder.
+ */
+export const latestTopicOf = (
+ recents: RecentItem[] | undefined,
+ ownerId: string | undefined,
+): RecentItem | undefined => (ownerId ? topicsByOwner(recents).get(ownerId) : undefined);
+
+/** The newer of an entity's own timestamp and its latest topic. */
+export const latestActivity = (
+ own: Date | string | undefined,
+ topic: RecentItem | undefined,
+): Date | undefined => {
+ const ownTime = own ? toTime(own) : 0;
+ const topicTime = topic ? toTime(topic.updatedAt) : 0;
+ if (!ownTime && !topicTime) return undefined;
+ return new Date(Math.max(ownTime, topicTime));
+};
+
+/**
+ * Turn the sidebar agent/group list into IM-style conversations: each row
+ * carries a preview of its latest topic and is ordered by latest activity,
+ * pinned rows first.
+ */
+export const buildConversationSections = (
+ items: SidebarAgentItem[],
+ recents: RecentItem[] | undefined,
+): ConversationSections => {
+ const latestByOwner = topicsByOwner(recents);
+
+ const seen = new Set<string>();
+ const conversations: Conversation[] = [];
+ for (const item of items) {
+ if (seen.has(item.id)) continue;
+ seen.add(item.id);
+
+ const latest = latestByOwner.get(item.id);
+ const itemTime = toTime(item.updatedAt);
+ const latestTime = latest ? toTime(latest.updatedAt) : 0;
+
+ conversations.push({
+ activeAt: new Date(Math.max(itemTime, latestTime)),
+ item,
+ preview:
+ (latest?.lastAssistantMessage || latest?.title || item.description || '')
+ .replaceAll(/\s+/g, ' ')
+ .trim() || undefined,
+ });
+ }
+
+ conversations.sort((a, b) => b.activeAt.getTime() - a.activeAt.getTime());
+
+ return {
+ pinned: conversations.filter((c) => c.item.pinned),
+ recent: conversations.filter((c) => !c.item.pinned),
+ };
+};
+
+export type ConversationEntry =
+ { activeAt: Date; type: 'inbox' } | (Conversation & { type: 'item' });
+
+/**
+ * One IM list like WeChat's: pinned rows first, then everything else by latest
+ * activity. Lobe AI is an ordinary row placed by its own activity, not pinned
+ * to the top; a name / title filter narrows the whole list.
+ */
+export const buildConversationEntries = (
+ { pinned, recent }: ConversationSections,
+ inbox: { activeAt?: Date; title: string } | undefined,
+ query = '',
+): ConversationEntry[] => {
+ const keyword = query.trim().toLowerCase();
+ const matches = (...names: (string | null | undefined)[]) =>
+ !keyword || names.some((name) => (name ?? '').toLowerCase().includes(keyword));
+
+ // Rows show the personal name when set (`agentDisplayName`), so match it as
+ // well as the role title.
+ const items = (list: Conversation[]): ConversationEntry[] =>
+ list
+ .filter((c) => matches(c.item.name, c.item.title))
+ .map((c) => ({ ...c, type: 'item' as const }));
+
+ const rest = items(recent);
+ if (inbox && matches(inbox.title)) {
+ const activeAt = inbox.activeAt ?? new Date(0);
+ const index = rest.findIndex((entry) => entry.activeAt.getTime() < activeAt.getTime());
+ rest.splice(index === -1 ? rest.length : index, 0, { activeAt, type: 'inbox' });
+ }
+
+ return [...items(pinned), ...rest];
+};
+
+/** IM-style timestamp: time today, weekday this week, date otherwise. */
+export const formatConversationTime = (date: Date, now: Date = new Date()): string => {
+ const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
+ const time = date.getTime();
+ const pad = (n: number) => String(n).padStart(2, '0');
+
+ if (time >= startOfToday) return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
+ if (date.getFullYear() === now.getFullYear()) return `${date.getMonth() + 1}/${date.getDate()}`;
+ return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
+};
diff --git a/src/features/MessageList/index.tsx b/src/features/MessageList/index.tsx
new file mode 100644
index 00000000000..15ffe75baae
--- /dev/null
+++ b/src/features/MessageList/index.tsx
@@ -0,0 +1,31 @@
+'use client';
+
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
+import { NavPanelPortal } from '@/features/NavPanel/NavPanelPortal';
+import { NAV_PANEL_MESSAGES_KEY } from '@/features/NavPanel/railRouteKey';
+import SideBarLayout from '@/features/NavPanel/SideBarLayout';
+
+import Body from './Body';
+import Header from './Header';
+import { MessageSearchProvider } from './SearchContext';
+
+export { default as ConversationRow } from './ConversationRow';
+export { ListHeader } from './Header';
+export { AVATAR_SIZE } from './style';
+
+/**
+ * Messages tab list column: the IM-style conversation list (Lobe AI, agents
+ * and groups by latest activity). Owned by the shell so it stays mounted
+ * across chats. Each row opens its conversation as a channel.
+ */
+const MessageListPortal = () => (
+ <NavPanelPortal navKey={NAV_PANEL_MESSAGES_KEY}>
+ <AgentModalProvider>
+ <MessageSearchProvider>
+ <SideBarLayout body={<Body />} header={<Header />} />
+ </MessageSearchProvider>
+ </AgentModalProvider>
+ </NavPanelPortal>
+);
+
+export default MessageListPortal;
diff --git a/src/features/MessageList/style.ts b/src/features/MessageList/style.ts
new file mode 100644
index 00000000000..1541c06ed8a
--- /dev/null
+++ b/src/features/MessageList/style.ts
@@ -0,0 +1,86 @@
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+
+export const AVATAR_SIZE = 28;
+
+export const styles = stylex.create({
+ avatar: {
+ position: 'relative',
+ display: 'inline-flex',
+ flex: 'none',
+ },
+ empty: {
+ paddingBlock: '8px',
+ paddingInline: '10px',
+ fontSize: '12px',
+ color: cssVar.colorTextQuaternary,
+ },
+ preview: {
+ overflow: 'hidden',
+ minWidth: 0,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ flex: '1',
+ fontSize: '12px',
+ lineHeight: '16px',
+ color: cssVar.colorTextTertiary,
+ },
+ row: {
+ cursor: 'pointer',
+ userSelect: 'none',
+ display: 'flex',
+ gap: '10px',
+ alignItems: 'center',
+ paddingBlock: '8px',
+ paddingInline: '8px',
+ borderRadius: cssVar.borderRadiusLG,
+ color: { default: cssVar.colorText, ':hover': cssVar.colorText },
+ textDecoration: 'none',
+ backgroundColor: { default: null, ':hover': cssVar.colorFillTertiary },
+ transition: 'background-color 0.15s',
+ },
+ rowPinned: {
+ backgroundColor: { default: cssVar.colorFillQuaternary, ':hover': cssVar.colorFillTertiary },
+ },
+ rowActive: {
+ backgroundColor: { default: cssVar.colorFillSecondary, ':hover': cssVar.colorFillSecondary },
+ },
+ running: {
+ color: cssVar.colorSuccess,
+ },
+ time: {
+ flex: 'none',
+ fontSize: '11px',
+ lineHeight: '18px',
+ color: cssVar.colorTextQuaternary,
+ },
+ title: {
+ overflow: 'hidden',
+ minWidth: 0,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ flex: '1',
+ fontSize: '13px',
+ fontWeight: 500,
+ lineHeight: '18px',
+ },
+ unread: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ insetBlockStart: '-5px',
+ insetInlineEnd: '-6px',
+ minWidth: '16px',
+ height: '16px',
+ paddingInline: '4px',
+ borderWidth: '1.5px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBgContainer,
+ borderRadius: '999px',
+ fontSize: '10px',
+ fontWeight: 600,
+ lineHeight: '13px',
+ color: '#fff',
+ textAlign: 'center',
+ backgroundColor: cssVar.colorError,
+ },
+});
diff --git a/src/features/NavHeader/useNavPanelDrawerContent.test.ts b/src/features/NavHeader/useNavPanelDrawerContent.test.ts
index 60d197e64f5..9b9911aa7a9 100644
--- a/src/features/NavHeader/useNavPanelDrawerContent.test.ts
+++ b/src/features/NavHeader/useNavPanelDrawerContent.test.ts
@@ -10,14 +10,18 @@ import {
import { useNavPanelDrawerContent } from './useNavPanelDrawerContent';
-const mocks = vi.hoisted(() => ({ navKey: 'memory' }));
+const mocks = vi.hoisted(() => ({ pathname: '/memory' }));
-vi.mock('@/features/NavPanel/useActiveNavKey', () => ({
- useActiveNavKey: () => mocks.navKey,
+vi.mock('@/hooks/useActiveLocation', () => ({
+ useActiveLocation: () => ({ pathname: mocks.pathname }),
+}));
+
+vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
+ useActiveWorkspaceSlug: () => null,
}));
beforeEach(() => {
- mocks.navKey = 'memory';
+ mocks.pathname = '/memory';
clearNavPanelRegistry();
});
@@ -46,14 +50,24 @@ describe('useNavPanelDrawerContent', () => {
// home route's registered sidebar is the agent list mobile already renders
// as the page itself.
it('skips the home route sidebar while serving other routes from the same registry', () => {
- mocks.navKey = 'home';
+ mocks.pathname = '/';
registerNavPanelContent('home', Symbol('home-sidebar'), 'agent list');
registerNavPanelContent('memory', Symbol('memory-sidebar'), 'memory sections');
expect(renderHook(() => useNavPanelDrawerContent()).result.current).toBeUndefined();
// The same registry still serves another route's sidebar.
- mocks.navKey = 'memory';
+ mocks.pathname = '/memory';
expect(renderHook(() => useNavPanelDrawerContent()).result.current).toBe('memory sections');
});
+
+ // The desktop rail folds agent chats into the conversation list (`home`);
+ // mobile has no rail, so the agent route must keep serving its own sidebar.
+ it('serves the agent sidebar on an agent chat route', () => {
+ mocks.pathname = '/agent/agent-1';
+ registerNavPanelContent('home', Symbol('home-sidebar'), 'agent list');
+ registerNavPanelContent('agent', Symbol('agent-sidebar'), 'agent topics');
+
+ expect(renderHook(() => useNavPanelDrawerContent()).result.current).toBe('agent topics');
+ });
});
diff --git a/src/features/NavHeader/useNavPanelDrawerContent.ts b/src/features/NavHeader/useNavPanelDrawerContent.ts
index 6f5f4c858e7..0b520161939 100644
--- a/src/features/NavHeader/useNavPanelDrawerContent.ts
+++ b/src/features/NavHeader/useNavPanelDrawerContent.ts
@@ -1,18 +1,24 @@
import { type ReactNode, useSyncExternalStore } from 'react';
+import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import {
getNavPanelRegistrySnapshot,
subscribeNavPanelRegistry,
} from '@/features/NavPanel/registry';
-import { useActiveNavKey } from '@/features/NavPanel/useActiveNavKey';
+import { resolveNavPanelKey } from '@/features/NavPanel/routeKey';
+import { useActiveLocation } from '@/hooks/useActiveLocation';
/**
* The sidebar the active route registered through `NavPanelPortal`, for the
* mobile drawer. `home` is the desktop agent list, which mobile already shows
* as its home page, so it never opens as a drawer.
+ *
+ * Mobile keeps the per-route sidebars (agent topics, group members), so it
+ * resolves with the legacy mapping rather than the desktop rail one.
*/
export const useNavPanelDrawerContent = (): ReactNode | undefined => {
- const navKey = useActiveNavKey();
+ const { pathname } = useActiveLocation();
+ const navKey = resolveNavPanelKey(pathname, useActiveWorkspaceSlug());
const getContent = () =>
navKey === 'home' ? undefined : getNavPanelRegistrySnapshot().get(navKey)?.node;
diff --git a/src/features/NavPanel/Shell.tsx b/src/features/NavPanel/Shell.tsx
index bf67dcfef2d..983c7add0fc 100644
--- a/src/features/NavPanel/Shell.tsx
+++ b/src/features/NavPanel/Shell.tsx
@@ -1,6 +1,10 @@
'use client';
+import ContactListPortal from '@/features/ContactList';
import HomeNavPanelPortal from '@/features/HomeSidebar';
+import MessageListPortal from '@/features/MessageList';
+import { useImLayout } from '@/features/NavRail/useImLayout';
+import TaskNavPortal from '@/features/TaskNav';
import NavPanel from './index';
@@ -10,11 +14,26 @@ import NavPanel from './index';
// Home layout only mounts inside a home tab — and `Activity` unmounts effects
// for inactive tabs. Registering from the route layout leaves those tabs with
// no `home` entry at all, so the panel is stuck on the loading skeleton.
-const NavPanelShell = () => (
- <>
- <HomeNavPanelPortal />
- <NavPanel />
- </>
-);
+//
+// Under the `im_layout` trial, `home` is the Messages conversation list and
+// Contacts / the Tasks scope list are shell-owned for the same reason.
+const NavPanelShell = () => {
+ const imLayout = useImLayout();
+
+ return (
+ <>
+ {imLayout ? (
+ <>
+ <MessageListPortal />
+ <ContactListPortal />
+ <TaskNavPortal />
+ </>
+ ) : (
+ <HomeNavPanelPortal />
+ )}
+ <NavPanel />
+ </>
+ );
+};
export default NavPanelShell;
diff --git a/src/features/NavPanel/components/NavPanelDraggable.tsx b/src/features/NavPanel/components/NavPanelDraggable.tsx
index 620d4884c45..5883ed13434 100644
--- a/src/features/NavPanel/components/NavPanelDraggable.tsx
+++ b/src/features/NavPanel/components/NavPanelDraggable.tsx
@@ -1,6 +1,6 @@
'use client';
-import { createStaticStyles, cssVar, DraggablePanel } from '@lobehub/ui';
+import { createStaticStyles, cssVar, cx, DraggablePanel } from '@lobehub/ui';
import { type ReactNode } from 'react';
import { Activity, memo, Suspense, useMemo, useRef } from 'react';
@@ -10,6 +10,8 @@ import { MAC_VIBRANCY_BACKGROUND } from '@/features/Electron/system/macWindowFul
import Footer from '@/features/HomeSidebar/Footer';
import { USER_DROPDOWN_ICON_ID } from '@/features/NavPanel/constants';
import { TOGGLE_BUTTON_ID } from '@/features/NavPanel/ToggleLeftPanelButton';
+import { LIST_COLUMN_BACKGROUND } from '@/features/NavRail/const';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import { useGlobalStore } from '@/store/global';
import {
NAV_PANEL_MAX_WIDTH,
@@ -22,6 +24,11 @@ import { useNavPanelSizeChangeHandler } from '../hooks/useNavPanel';
import { BACK_BUTTON_ID } from './BackButton';
const draggableStyles = createStaticStyles(({ css, cssVar }) => ({
+ // `im_layout`: the list column inside the rail wrap, divided from the content.
+ imPanel: css`
+ border-inline-end: 1px solid ${cssVar.colorBorderSecondary};
+ background: ${LIST_COLUMN_BACKGROUND};
+ `,
content: css`
position: relative;
@@ -128,12 +135,17 @@ export const NavPanelDraggable = memo<NavPanelDraggableProps>(({ activeContent,
defaultWidthRef.current = systemStatusSelectors.leftPanelWidth(useGlobalStore.getState());
}
+ const imLayout = useImLayout();
const styles = useMemo(
() => ({
- background: isDesktop && isMacOS() ? MAC_VIBRANCY_BACKGROUND : cssVar.colorBgLayout,
+ background: imLayout
+ ? LIST_COLUMN_BACKGROUND
+ : isDesktop && isMacOS()
+ ? MAC_VIBRANCY_BACKGROUND
+ : cssVar.colorBgLayout,
zIndex: 11,
}),
- [],
+ [imLayout],
);
if (defaultWidthRef.current === 0) {
@@ -146,7 +158,7 @@ export const NavPanelDraggable = memo<NavPanelDraggableProps>(({ activeContent,
return (
<DraggablePanel
- className={draggableStyles.panel}
+ className={cx(draggableStyles.panel, imLayout && draggableStyles.imPanel)}
classNames={classNames}
defaultSize={defaultSize}
expand={expand}
@@ -182,9 +194,12 @@ export const NavPanelDraggable = memo<NavPanelDraggableProps>(({ activeContent,
<Suspense fallback={null}>
<NavPanelUpgradeEntry />
</Suspense>
- <Suspense>
- <Footer />
- </Suspense>
+ {/* The rail owns settings and help under `im_layout`. */}
+ {!imLayout && (
+ <Suspense>
+ <Footer />
+ </Suspense>
+ )}
</DraggablePanel>
);
});
diff --git a/src/features/NavPanel/index.test.tsx b/src/features/NavPanel/index.test.tsx
index 66df232e0ab..4c530075c2a 100644
--- a/src/features/NavPanel/index.test.tsx
+++ b/src/features/NavPanel/index.test.tsx
@@ -1,6 +1,6 @@
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import type { ReactNode } from 'react';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import NavPanel from './index';
import { NavPanelPortal } from './NavPanelPortal';
@@ -59,6 +59,24 @@ vi.mock('@/features/HomeSidebar/Content', () => ({
default: () => <div>Home sidebar</div>,
}));
+const layout = vi.hoisted(() => ({ imLayout: false }));
+
+vi.mock('@/features/NavRail/useImLayout', () => ({ useImLayout: () => layout.imLayout }));
+
+// Under `im_layout` the shell registers the Messages list as `home` instead.
+vi.mock('@/features/MessageList', async () => {
+ const { NavPanelPortal } = await import('./NavPanelPortal');
+ return {
+ default: () => (
+ <NavPanelPortal navKey="home">
+ <div>Messages list</div>
+ </NavPanelPortal>
+ ),
+ };
+});
+vi.mock('@/features/ContactList', () => ({ default: () => null }));
+vi.mock('@/features/TaskNav', () => ({ default: () => null }));
+
describe('NavPanel', () => {
beforeEach(() => {
pathname = '/lobe-team/settings/general';
@@ -282,3 +300,34 @@ describe('SideBarLayout scroll restoration', () => {
expect(getViewport(second.container).scrollTop).toBe(0);
});
});
+
+describe('NavPanel under the im_layout trial', () => {
+ beforeEach(() => {
+ clearNavPanelRegistry();
+ layout.imLayout = true;
+ });
+
+ afterEach(() => {
+ layout.imLayout = false;
+ });
+
+ it('renders no list column on the full-page project index', () => {
+ pathname = '/projects';
+ registerNavPanelContent('home', Symbol('home'), <div>Home sidebar</div>);
+
+ render(<NavPanel />);
+
+ expect(screen.queryByTestId('nav-panel')).not.toBeInTheDocument();
+ });
+
+ it('registers the Messages list as the home entry', async () => {
+ pathname = '/';
+
+ render(<NavPanelShell />);
+
+ await waitFor(() => {
+ expect(screen.getByText('Messages list')).toBeInTheDocument();
+ });
+ expect(screen.queryByText('Home sidebar')).not.toBeInTheDocument();
+ });
+});
diff --git a/src/features/NavPanel/index.tsx b/src/features/NavPanel/index.tsx
index ff971eacbae..17bf2af0cf6 100644
--- a/src/features/NavPanel/index.tsx
+++ b/src/features/NavPanel/index.tsx
@@ -9,6 +9,7 @@ import {
NavSideBarSkeleton,
} from './components/SideBarSkeleton';
import { NAV_PANEL_RIGHT_DRAWER_ID } from './constants';
+import { NAV_PANEL_HIDDEN_KEY } from './railRouteKey';
import { getNavPanelRegistrySnapshot, subscribeNavPanelRegistry } from './registry';
import { useActiveNavKey } from './useActiveNavKey';
@@ -34,9 +35,12 @@ const NavPanel = memo(() => {
getHomeContent,
);
+ // Full-page tabs (tasks, goals, project index) render without a list column.
+ const hidden = activeNavKey === NAV_PANEL_HIDDEN_KEY;
+
return (
<>
- <NavPanelDraggable activeContent={activeContent} homeContent={homeContent} />
+ {!hidden && <NavPanelDraggable activeContent={activeContent} homeContent={homeContent} />}
<div
id={NAV_PANEL_RIGHT_DRAWER_ID}
style={{
diff --git a/src/features/NavPanel/railRouteKey.test.ts b/src/features/NavPanel/railRouteKey.test.ts
new file mode 100644
index 00000000000..d04ed31b812
--- /dev/null
+++ b/src/features/NavPanel/railRouteKey.test.ts
@@ -0,0 +1,53 @@
+import { describe, expect, it } from 'vitest';
+
+import { isRailContactsRoute, resolveRailNavPanelKey } from './railRouteKey';
+
+describe('resolveRailNavPanelKey', () => {
+ it.each([
+ ['/', null, 'home'],
+ ['/lobe-team', 'lobe-team', 'home'],
+ // Agent / group routes keep their own workbench sidebar.
+ ['/agent/agent-1', null, 'agent'],
+ ['/agent/agent-1/tpc_1', null, 'agent'],
+ ['/lobe-team/agent/agent-1', 'lobe-team', 'agent'],
+ ['/agent/agent-1/profile', null, 'agent'],
+ ['/agent/agent-1/tasks', null, 'agent'],
+ ['/agent/agent-1/goal/goal-1', null, 'agent'],
+ ['/agent/agent-1/docs/doc-1', null, 'agent-docs'],
+ ['/group/group-1', null, 'group'],
+ ['/group/group-1/tpc_1', null, 'group'],
+ // The all-agents page shows the Contacts list.
+ ['/agents', null, 'contacts'],
+ ['/lobe-team/agents', 'lobe-team', 'contacts'],
+ // Tasks and goals share the task scope list; the project index is full-page.
+ ['/tasks', null, 'tasks'],
+ ['/goals', null, 'tasks'],
+ ['/lobe-team/task/task-1', 'lobe-team', 'tasks'],
+ ['/goal/goal-1', null, 'tasks'],
+ ['/projects', null, 'none'],
+ // Everything else keeps its route-owned sidebar.
+ ['/project/project-1', null, 'project'],
+ ['/resource', null, 'resource'],
+ ['/resource/library/kb-1', null, 'resourceLibrary'],
+ ['/community', null, 'discover'],
+ ['/settings/profile', null, 'settings'],
+ ])('maps %s to %s', (pathname, activeWorkspaceSlug, expected) => {
+ expect(resolveRailNavPanelKey(pathname, activeWorkspaceSlug)).toBe(expected);
+ });
+});
+
+describe('isRailContactsRoute', () => {
+ it.each([
+ ['/agents', null, true],
+ ['/agent/agent-1/profile', null, true],
+ ['/lobe-team/agent/agent-1/channel/discord', 'lobe-team', true],
+ ['/agent/agent-1/self-evolving/domain-1', null, true],
+ ['/group/group-1/profile', null, true],
+ ['/agent/agent-1', null, false],
+ ['/agent/agent-1/tpc_1', null, false],
+ ['/agent/agent-1/tasks', null, false],
+ ['/group/group-1', null, false],
+ ])('%s → %s', (pathname, activeWorkspaceSlug, expected) => {
+ expect(isRailContactsRoute(pathname, activeWorkspaceSlug)).toBe(expected);
+ });
+});
diff --git a/src/features/NavPanel/railRouteKey.ts b/src/features/NavPanel/railRouteKey.ts
new file mode 100644
index 00000000000..615789b4ba1
--- /dev/null
+++ b/src/features/NavPanel/railRouteKey.ts
@@ -0,0 +1,85 @@
+import { resolveNavPanelKey } from './routeKey';
+
+/**
+ * Nav key for routes whose page owns the whole wrap (no list column). The rail
+ * still highlights their tab; NavPanel renders nothing for this key.
+ */
+export const NAV_PANEL_HIDDEN_KEY = 'none';
+
+/** The IM-style conversation list (agents + groups) behind the Messages tab. */
+export const NAV_PANEL_MESSAGES_KEY = 'home';
+
+/** The task scope list (all tasks, goals, projects) behind the Tasks tab. */
+export const NAV_PANEL_TASKS_KEY = 'tasks';
+
+/** The contacts list (agents + groups) behind the Contacts tab. */
+export const NAV_PANEL_CONTACTS_KEY = 'contacts';
+
+/**
+ * Agent sub-pages that edit or describe the agent itself. The rail highlights
+ * Contacts for them (profile → edit); the list column stays the agent sidebar.
+ */
+const AGENT_CONTACT_PAGES = new Set([
+ 'channel',
+ 'permission',
+ 'profile',
+ 'self-evolving',
+ 'self-learning',
+ 'share',
+ 'statistics',
+ 'stats',
+]);
+
+const GROUP_CONTACT_PAGES = new Set(['permission', 'profile']);
+
+const TASK_ROOTS = new Set(['goal', 'goals', 'task', 'tasks']);
+
+const FULL_PAGE_ROOTS = new Set(['projects']);
+
+const splitRoute = (pathname: string, activeWorkspaceSlug: string | null) => {
+ const segments = pathname.split('/').filter(Boolean);
+ const isWorkspaceRoute =
+ !!activeWorkspaceSlug && segments.length > 0 && segments[0] === activeWorkspaceSlug;
+ return isWorkspaceRoute ? segments.slice(1) : segments;
+};
+
+/**
+ * Whether the rail highlights Contacts for this route: the all-agents page and
+ * agent / group profile and config pages.
+ */
+export const isRailContactsRoute = (
+ pathname: string,
+ activeWorkspaceSlug: string | null,
+): boolean => {
+ const [rootSegment, , pageSegment] = splitRoute(pathname, activeWorkspaceSlug);
+ if (rootSegment === 'agents') return true;
+ if (!pageSegment) return false;
+ if (rootSegment === 'agent') return AGENT_CONTACT_PAGES.has(pageSegment);
+ if (rootSegment === 'group') return GROUP_CONTACT_PAGES.has(pageSegment);
+ return false;
+};
+
+/**
+ * Nav key for the rail layout (rail + list column + content). Builds on the
+ * legacy `resolveNavPanelKey`, which the mobile drawer still uses unchanged:
+ * - agent / group routes keep their own workbench sidebar (topics, profile,
+ * goals, tasks), same as the sidebar layout;
+ * - the all-agents page shows the Contacts list;
+ * - tasks and goals share the task scope list (all tasks, goals, projects);
+ * - the project index renders without a list column.
+ */
+export const resolveRailNavPanelKey = (
+ pathname: string,
+ activeWorkspaceSlug: string | null,
+): string => {
+ const legacyKey = resolveNavPanelKey(pathname, activeWorkspaceSlug);
+ const [rootSegment] = splitRoute(pathname, activeWorkspaceSlug);
+
+ if (legacyKey === 'home') {
+ if (rootSegment === 'agents') return NAV_PANEL_CONTACTS_KEY;
+ if (rootSegment && TASK_ROOTS.has(rootSegment)) return NAV_PANEL_TASKS_KEY;
+ if (rootSegment && FULL_PAGE_ROOTS.has(rootSegment)) return NAV_PANEL_HIDDEN_KEY;
+ }
+
+ return legacyKey;
+};
diff --git a/src/features/NavPanel/useActiveNavKey.desktop.test.ts b/src/features/NavPanel/useActiveNavKey.desktop.test.ts
index a0972230e3d..7100caf73c9 100644
--- a/src/features/NavPanel/useActiveNavKey.desktop.test.ts
+++ b/src/features/NavPanel/useActiveNavKey.desktop.test.ts
@@ -6,6 +6,10 @@ import { useElectronStore } from '@/store/electron';
import { useActiveNavKey } from './useActiveNavKey.desktop';
+const layout = vi.hoisted(() => ({ imLayout: false }));
+
+vi.mock('@/features/NavRail/useImLayout', () => ({ useImLayout: () => layout.imLayout }));
+
vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
useActiveWorkspaceSlug: () => null,
}));
@@ -13,6 +17,7 @@ vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
const tab = (id: string, url: string) => ({ id, lastVisited: 0, url });
afterEach(() => {
+ layout.imLayout = false;
useElectronStore.setState({ activeTabId: null, tabs: [] });
useDisplayedTabStore.setState({ tabId: null });
});
@@ -49,4 +54,16 @@ describe('useActiveNavKey (desktop)', () => {
expect(result.current).toBe('discover');
});
+
+ // The rail moves the all-agents page to the Contacts list under `im_layout`.
+ it('resolves with the rail mapping under the im_layout trial', () => {
+ layout.imLayout = true;
+ useElectronStore.setState({ activeTabId: 'only', tabs: [tab('only', '/agents')] });
+ useDisplayedTabStore.setState({ tabId: 'only' });
+
+ expect(renderHook(() => useActiveNavKey()).result.current).toBe('contacts');
+
+ layout.imLayout = false;
+ expect(renderHook(() => useActiveNavKey()).result.current).toBe('home');
+ });
});
diff --git a/src/features/NavPanel/useActiveNavKey.desktop.ts b/src/features/NavPanel/useActiveNavKey.desktop.ts
index 8dfa57184a6..45868bdf2fa 100644
--- a/src/features/NavPanel/useActiveNavKey.desktop.ts
+++ b/src/features/NavPanel/useActiveNavKey.desktop.ts
@@ -1,6 +1,8 @@
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import { useDisplayedTabUrl } from '@/features/Electron/TabHost/displayedTab';
+import { useImLayout } from '@/features/NavRail/useImLayout';
+import { resolveRailNavPanelKey } from './railRouteKey';
import { resolveNavPanelKey } from './routeKey';
// The route-owned panel registers from inside the tab's layout, so keying the
@@ -11,5 +13,9 @@ export const useActiveNavKey = () => {
const activeWorkspaceSlug = useActiveWorkspaceSlug();
const pathname = url.split(/[#?]/)[0] || '/';
- return resolveNavPanelKey(pathname, activeWorkspaceSlug);
+ // The `im_layout` rail folds chats into the conversation list and adds the
+ // Contacts / Tasks list columns; off keeps the per-route sidebars.
+ const imLayout = useImLayout();
+
+ return (imLayout ? resolveRailNavPanelKey : resolveNavPanelKey)(pathname, activeWorkspaceSlug);
};
diff --git a/src/features/NavPanel/useActiveNavKey.ts b/src/features/NavPanel/useActiveNavKey.ts
index 9669e41a170..c72d1842b91 100644
--- a/src/features/NavPanel/useActiveNavKey.ts
+++ b/src/features/NavPanel/useActiveNavKey.ts
@@ -1,11 +1,17 @@
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import { useActiveLocation } from '@/hooks/useActiveLocation';
+import { resolveRailNavPanelKey } from './railRouteKey';
import { resolveNavPanelKey } from './routeKey';
export const useActiveNavKey = () => {
const { pathname } = useActiveLocation();
const activeWorkspaceSlug = useActiveWorkspaceSlug();
- return resolveNavPanelKey(pathname, activeWorkspaceSlug);
+ // The `im_layout` rail folds chats into the conversation list and adds the
+ // Contacts / Tasks list columns; off keeps the per-route sidebars.
+ const imLayout = useImLayout();
+
+ return (imLayout ? resolveRailNavPanelKey : resolveNavPanelKey)(pathname, activeWorkspaceSlug);
};
diff --git a/src/features/NavRail/MoreMenu.test.tsx b/src/features/NavRail/MoreMenu.test.tsx
new file mode 100644
index 00000000000..713d30e4592
--- /dev/null
+++ b/src/features/NavRail/MoreMenu.test.tsx
@@ -0,0 +1,96 @@
+import { cleanup, render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({
+ t: (key: string) =>
+ ({
+ 'changelog': 'Changelog',
+ 'tab.more': 'More',
+ 'userPanel.docs': 'Docs',
+ 'userPanel.feedback': 'Feedback',
+ })[key] || key,
+ }),
+}));
+
+vi.mock('./style', () => ({
+ RAIL_ICON_SIZE: 20,
+ styles: { item: {}, itemActive: {} },
+}));
+
+interface MockItem {
+ key: string;
+ label?: ReactNode;
+ type?: string;
+}
+
+vi.mock('@lobehub/ui', async (importOriginal) => {
+ const actual = await importOriginal<Record<string, unknown>>();
+
+ return {
+ ...actual,
+ DropdownMenu: ({ children, items }: { children: ReactNode; items: MockItem[] }) => (
+ <div>
+ {children}
+ <ul data-testid={'menu'}>
+ {items
+ .filter((item) => item.type !== 'divider')
+ .map((item) => (
+ <li data-testid={`item-${item.key}`} key={item.key}>
+ {item.label}
+ </li>
+ ))}
+ </ul>
+ </div>
+ ),
+ };
+});
+
+vi.mock('@/components/ChangelogModal', () => ({
+ default: () => null,
+ openChangelogModal: vi.fn(),
+}));
+
+vi.mock('@/components/FeedbackModal', () => ({
+ default: () => null,
+ openFeedbackModal: vi.fn(),
+}));
+
+vi.mock('@/business/client/hooks/useHelpMenuBugReportItem', () => ({
+ useHelpMenuBugReportItem: () => null,
+}));
+
+vi.mock('@/features/Workspace/useWorkspaceAwareNavigate', () => ({
+ useWorkspaceAwareNavigate: () => vi.fn(),
+}));
+
+const mockNavItems = {
+ bottomMenuItems: [],
+ topNavItems: [{ hidden: false, icon: 'icon', key: 'dashboard', title: 'Dashboard', url: '/dashboard' }],
+};
+
+vi.mock('@/hooks/useNavLayout', () => ({
+ useNavLayout: () => mockNavItems,
+}));
+
+describe('NavRail MoreMenu', () => {
+ afterEach(() => {
+ cleanup();
+ });
+
+ it('keeps the footer Help entries reachable from the rail layout', async () => {
+ const { default: MoreMenu } = await import('./MoreMenu');
+
+ render(<MoreMenu />);
+
+ // The rail replaces the sidebar footer, so docs / feedback / changelog must
+ // stay in this menu instead of disappearing with the footer.
+ expect(screen.getByTestId('item-docs')).toBeTruthy();
+ expect(screen.getByTestId('item-feedback')).toBeTruthy();
+ expect(screen.getByTestId('item-changelog')).toBeTruthy();
+
+ // Routes without their own rail tab keep their entry.
+ expect(screen.getByTestId('item-dashboard')).toBeTruthy();
+ });
+});
diff --git a/src/features/NavRail/MoreMenu.tsx b/src/features/NavRail/MoreMenu.tsx
new file mode 100644
index 00000000000..4146ad7e481
--- /dev/null
+++ b/src/features/NavRail/MoreMenu.tsx
@@ -0,0 +1,95 @@
+'use client';
+
+import { type DropdownItem, DropdownMenu, Icon, Tooltip } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import { Book, EllipsisIcon, Feather, FileClockIcon } from 'lucide-react';
+import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useHelpMenuBugReportItem } from '@/business/client/hooks/useHelpMenuBugReportItem';
+import { openChangelogModal } from '@/components/ChangelogModal';
+import { openFeedbackModal } from '@/components/FeedbackModal';
+import { DOCUMENTS_REFER_URL } from '@/const/url';
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { useNavLayout } from '@/hooks/useNavLayout';
+
+import { RAIL_ICON_SIZE, styles } from './style';
+
+/** Routes that have no rail tab of their own (generation, memory, dashboards). */
+const MORE_NAV_KEYS = ['dashboard', 'image', 'memory'];
+
+/**
+ * The rail replaces the sidebar footer under `im_layout`, so the Help entries
+ * that used to live there (docs, report a bug, feedback, changelog) move to the
+ * end of this menu — otherwise they would be unreachable from the rail layout.
+ */
+const MoreMenu = memo<{ active?: boolean }>(({ active }) => {
+ const { t } = useTranslation('common');
+ const navigate = useWorkspaceAwareNavigate();
+ const { topNavItems, bottomMenuItems } = useNavLayout();
+ const bugReportItem = useHelpMenuBugReportItem();
+
+ const items = useMemo<DropdownItem[]>(() => {
+ const navItems: DropdownItem[] = [...topNavItems, ...bottomMenuItems]
+ .filter((item) => !item.hidden && item.url && MORE_NAV_KEYS.includes(item.key))
+ .map((item) => ({
+ icon: <Icon icon={item.icon} />,
+ key: item.key,
+ label: item.title,
+ onClick: () => navigate(item.url!),
+ }));
+
+ const helpItems: DropdownItem[] = [
+ {
+ icon: <Icon icon={Book} />,
+ key: 'docs',
+ label: (
+ <a href={DOCUMENTS_REFER_URL} rel="noopener noreferrer" target="_blank">
+ {t('userPanel.docs')}
+ </a>
+ ),
+ },
+ ...(bugReportItem ? [bugReportItem as DropdownItem] : []),
+ {
+ icon: <Icon icon={Feather} />,
+ key: 'feedback',
+ label: t('userPanel.feedback'),
+ onClick: () => {
+ openFeedbackModal();
+ },
+ },
+ {
+ icon: <Icon icon={FileClockIcon} />,
+ key: 'changelog',
+ label: t('changelog'),
+ onClick: () => {
+ openChangelogModal();
+ },
+ },
+ ];
+
+ if (navItems.length === 0) return helpItems;
+
+ return [...navItems, { type: 'divider' as const }, ...helpItems];
+ }, [bottomMenuItems, bugReportItem, navigate, t, topNavItems]);
+
+ if (items.length === 0) return null;
+
+ return (
+ <DropdownMenu items={items} placement={'rightTop'}>
+ <Tooltip placement={'right'} title={t('tab.more')}>
+ <div
+ aria-label={t('tab.more')}
+ {...stylex.props(styles.item, active && styles.itemActive)}
+ role={'button'}
+ >
+ <Icon icon={EllipsisIcon} size={RAIL_ICON_SIZE} />
+ </div>
+ </Tooltip>
+ </DropdownMenu>
+ );
+});
+
+MoreMenu.displayName = 'MoreMenu';
+
+export default MoreMenu;
diff --git a/src/features/NavRail/RailItem.tsx b/src/features/NavRail/RailItem.tsx
new file mode 100644
index 00000000000..6dbc00b130c
--- /dev/null
+++ b/src/features/NavRail/RailItem.tsx
@@ -0,0 +1,49 @@
+'use client';
+
+import { Icon, Tooltip } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import { type LucideIcon } from 'lucide-react';
+import { memo } from 'react';
+
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
+import { isModifierClick } from '@/utils/navigation';
+
+import { RAIL_ICON_SIZE, styles } from './style';
+
+interface RailItemProps {
+ active?: boolean;
+ badge?: number;
+ icon: LucideIcon;
+ title: string;
+ url: string;
+}
+
+const RailItem = memo<RailItemProps>(({ active, badge, icon, title, url }) => {
+ const navigate = useWorkspaceAwareNavigate();
+
+ return (
+ <Tooltip placement={'right'} title={title}>
+ <WorkspaceLink
+ aria-current={active ? 'page' : undefined}
+ aria-label={title}
+ {...stylex.props(styles.item, active && styles.itemActive)}
+ to={url}
+ onClick={(e) => {
+ if (isModifierClick(e)) return;
+ e.preventDefault();
+ navigate(url);
+ }}
+ >
+ <Icon icon={icon} size={RAIL_ICON_SIZE} />
+ {!!badge && badge > 0 && (
+ <span {...stylex.props(styles.badge)}>{badge > 99 ? '99+' : badge}</span>
+ )}
+ </WorkspaceLink>
+ </Tooltip>
+ );
+});
+
+RailItem.displayName = 'RailItem';
+
+export default RailItem;
diff --git a/src/features/NavRail/const.ts b/src/features/NavRail/const.ts
new file mode 100644
index 00000000000..814c554166f
--- /dev/null
+++ b/src/features/NavRail/const.ts
@@ -0,0 +1,12 @@
+import { cssVar } from '@lobehub/ui';
+
+// Kept dependency-free: the boot skeleton (entry chunk) mirrors these.
+
+/** Icon rail width; the list column and content sit in the wrap to its right. */
+export const RAIL_WIDTH = 48;
+
+/**
+ * The list column sits inside the wrap: a half step between the window
+ * background (rail) and the content surface, like Codex's middle column.
+ */
+export const LIST_COLUMN_BACKGROUND = `color-mix(in srgb, ${cssVar.colorBgContainer} 55%, ${cssVar.colorBgLayout})`;
diff --git a/src/features/NavRail/index.tsx b/src/features/NavRail/index.tsx
new file mode 100644
index 00000000000..2de049b24bc
--- /dev/null
+++ b/src/features/NavRail/index.tsx
@@ -0,0 +1,119 @@
+'use client';
+
+import { AGENT_CHAT_URL } from '@lobechat/const';
+import { cssVar, Flexbox } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import {
+ CompassIcon,
+ FolderKanbanIcon,
+ LibraryBigIcon,
+ ListTodoIcon,
+ MessageCircleIcon,
+ Settings2Icon,
+ UsersRoundIcon,
+} from 'lucide-react';
+import { memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
+import { isDesktop } from '@/const/version';
+import { resolveInboxAgentRouteId } from '@/features/AgentRoute/useResolvedAgentRouteId';
+import { MAC_VIBRANCY_BACKGROUND } from '@/features/Electron/system/macWindowFullscreen';
+import InboxButton from '@/features/HomeSidebar/Header/components/InboxButton';
+import User from '@/features/HomeSidebar/Header/components/User';
+import { useActiveLocation } from '@/hooks/useActiveLocation';
+import { useAgentStore } from '@/store/agent';
+import { builtinAgentSelectors } from '@/store/agent/selectors';
+import { useHomeStore } from '@/store/home';
+import { homeAgentListSelectors } from '@/store/home/selectors';
+import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
+import { isMacOS } from '@/utils/platform';
+
+import MoreMenu from './MoreMenu';
+import RailItem from './RailItem';
+import { resolveRailTab } from './railTab';
+import { RAIL_GAP, styles } from './style';
+
+// macOS Electron shows the window vibrancy through the rail, like the old sidebar.
+const railBackground = {
+ background: isDesktop && isMacOS() ? MAC_VIBRANCY_BACKGROUND : cssVar.colorBgLayout,
+};
+
+const useMessagesUnread = () =>
+ useHomeStore((s) =>
+ homeAgentListSelectors.allAgents(s).reduce((sum, item) => sum + (item.unreadCount ?? 0), 0),
+ );
+
+/**
+ * Global icon rail (column ①). Tabs own a list column (column ②) registered
+ * through `NavPanelPortal`, or render full-width inside the wrap.
+ */
+const NavRail = memo(() => {
+ const { t } = useTranslation('common');
+ const { pathname } = useActiveLocation();
+ const activeWorkspaceSlug = useActiveWorkspaceSlug();
+ const { showMarket } = useServerConfigStore(featureFlagsSelectors);
+ const unread = useMessagesUnread();
+
+ const activeTab = resolveRailTab(pathname, activeWorkspaceSlug);
+
+ // Messages opens straight into the Lobe AI conversation, like an IM app's
+ // default channel; the conversation list sits in the list column.
+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
+ const messagesUrl = AGENT_CHAT_URL(resolveInboxAgentRouteId(inboxAgentId), false);
+
+ // Tab order follows the product IA: messages, contacts, docs, tasks, projects.
+ const topItems = useMemo(
+ () => [
+ { icon: MessageCircleIcon, key: 'messages', title: t('tab.messages'), url: messagesUrl },
+ { icon: UsersRoundIcon, key: 'contacts', title: t('tab.contacts'), url: '/agents' },
+ { icon: LibraryBigIcon, key: 'resource', title: t('tab.resource'), url: '/resource' },
+ { icon: ListTodoIcon, key: 'tasks', title: t('tab.tasks'), url: '/tasks' },
+ { icon: FolderKanbanIcon, key: 'projects', title: t('tab.projects'), url: '/projects' },
+ ],
+ [messagesUrl, t],
+ );
+
+ return (
+ <Flexbox className={stylex.props(styles.rail).className} gap={12} style={railBackground}>
+ <User lite />
+ <Flexbox align={'center'} gap={RAIL_GAP}>
+ {topItems.map((item) => (
+ <RailItem
+ active={activeTab === item.key}
+ badge={item.key === 'messages' ? unread : undefined}
+ icon={item.icon}
+ key={item.key}
+ title={item.title}
+ url={item.url}
+ />
+ ))}
+ </Flexbox>
+ <div style={{ flex: 1 }} />
+ <Flexbox align={'center'} gap={RAIL_GAP}>
+ {/* The rail replaces the Home sidebar header, which used to own the only
+ entry point to the notification inbox modal. */}
+ <InboxButton />
+ <MoreMenu active={activeTab === 'more'} />
+ {showMarket && (
+ <RailItem
+ active={activeTab === 'discover'}
+ icon={CompassIcon}
+ title={t('tab.discover')}
+ url={'/community'}
+ />
+ )}
+ <RailItem
+ active={activeTab === 'settings'}
+ icon={Settings2Icon}
+ title={t('tab.setting')}
+ url={'/settings'}
+ />
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+NavRail.displayName = 'NavRail';
+
+export default NavRail;
diff --git a/src/features/NavRail/layoutHint.test.ts b/src/features/NavRail/layoutHint.test.ts
new file mode 100644
index 00000000000..4eb89da635f
--- /dev/null
+++ b/src/features/NavRail/layoutHint.test.ts
@@ -0,0 +1,19 @@
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { IM_LAYOUT_HINT_KEY, readImLayoutHint, writeImLayoutHint } from './layoutHint';
+
+afterEach(() => localStorage.removeItem(IM_LAYOUT_HINT_KEY));
+
+describe('im_layout boot hint', () => {
+ it('is off until the rail layout has rendered once', () => {
+ expect(readImLayoutHint()).toBe(false);
+ });
+
+ it('follows the last rendered layout', () => {
+ writeImLayoutHint(true);
+ expect(readImLayoutHint()).toBe(true);
+
+ writeImLayoutHint(false);
+ expect(readImLayoutHint()).toBe(false);
+ });
+});
diff --git a/src/features/NavRail/layoutHint.ts b/src/features/NavRail/layoutHint.ts
new file mode 100644
index 00000000000..59e282f130b
--- /dev/null
+++ b/src/features/NavRail/layoutHint.ts
@@ -0,0 +1,24 @@
+// Dependency-free: the boot skeleton (entry chunk) reads this before any store.
+
+/**
+ * The boot skeleton paints before the per-user `im_layout` flag is known, so
+ * the last layout the app rendered is remembered here and mirrored.
+ */
+export const IM_LAYOUT_HINT_KEY = 'LOBE_IM_LAYOUT';
+
+export const readImLayoutHint = (): boolean => {
+ try {
+ return localStorage.getItem(IM_LAYOUT_HINT_KEY) === '1';
+ } catch {
+ return false;
+ }
+};
+
+export const writeImLayoutHint = (enabled: boolean) => {
+ try {
+ if (enabled) localStorage.setItem(IM_LAYOUT_HINT_KEY, '1');
+ else localStorage.removeItem(IM_LAYOUT_HINT_KEY);
+ } catch {
+ // Storage may be unavailable (private mode); the skeleton then shows the default.
+ }
+};
diff --git a/src/features/NavRail/railTab.test.ts b/src/features/NavRail/railTab.test.ts
new file mode 100644
index 00000000000..823cb7ec154
--- /dev/null
+++ b/src/features/NavRail/railTab.test.ts
@@ -0,0 +1,29 @@
+import { describe, expect, it } from 'vitest';
+
+import { resolveRailTab } from './railTab';
+
+describe('resolveRailTab', () => {
+ it.each([
+ ['/', null, 'messages'],
+ ['/agent/agent-1', null, 'messages'],
+ ['/lobe-team/group/group-1/tpc_1', 'lobe-team', 'messages'],
+ ['/agents', null, 'contacts'],
+ ['/agent/agent-1/profile', null, 'contacts'],
+ ['/lobe-team/group/group-1/profile', 'lobe-team', 'contacts'],
+ // Goals are merged into the Tasks tab.
+ ['/tasks', null, 'tasks'],
+ ['/goals', null, 'tasks'],
+ ['/goal/goal-1', null, 'tasks'],
+ ['/lobe-team/task/task-1/fix', 'lobe-team', 'tasks'],
+ ['/projects', null, 'projects'],
+ ['/project/project-1/tasks', null, 'projects'],
+ ['/resource/library/kb-1', null, 'resource'],
+ ['/page/page-1/permission', null, 'resource'],
+ ['/community/agent/slug', null, 'discover'],
+ ['/settings/provider/openai', null, 'settings'],
+ ['/memory', null, 'more'],
+ ['/image', null, 'more'],
+ ])('maps %s to %s', (pathname, activeWorkspaceSlug, expected) => {
+ expect(resolveRailTab(pathname, activeWorkspaceSlug)).toBe(expected);
+ });
+});
diff --git a/src/features/NavRail/railTab.ts b/src/features/NavRail/railTab.ts
new file mode 100644
index 00000000000..e5989d33085
--- /dev/null
+++ b/src/features/NavRail/railTab.ts
@@ -0,0 +1,40 @@
+import { isRailContactsRoute } from '@/features/NavPanel/railRouteKey';
+
+export type RailTabKey =
+ 'contacts' | 'discover' | 'messages' | 'more' | 'projects' | 'resource' | 'settings' | 'tasks';
+
+const TAB_BY_ROOT: Record<string, RailTabKey> = {
+ community: 'discover',
+ dashboard: 'more',
+ eval: 'more',
+ goal: 'tasks',
+ goals: 'tasks',
+ image: 'more',
+ memory: 'more',
+ page: 'resource',
+ project: 'projects',
+ projects: 'projects',
+ resource: 'resource',
+ settings: 'settings',
+ task: 'tasks',
+ tasks: 'tasks',
+ video: 'more',
+};
+
+/**
+ * The rail tab a pathname belongs to. Agent / group chats and the home page
+ * are Messages; their profile and config pages are Contacts.
+ */
+export const resolveRailTab = (
+ pathname: string,
+ activeWorkspaceSlug: string | null,
+): RailTabKey => {
+ if (isRailContactsRoute(pathname, activeWorkspaceSlug)) return 'contacts';
+
+ const segments = pathname.split('/').filter(Boolean);
+ const isWorkspaceRoute =
+ !!activeWorkspaceSlug && segments.length > 0 && segments[0] === activeWorkspaceSlug;
+ const [rootSegment] = isWorkspaceRoute ? segments.slice(1) : segments;
+
+ return (rootSegment && TAB_BY_ROOT[rootSegment]) || 'messages';
+};
diff --git a/src/features/NavRail/style.ts b/src/features/NavRail/style.ts
new file mode 100644
index 00000000000..0d919f73a69
--- /dev/null
+++ b/src/features/NavRail/style.ts
@@ -0,0 +1,56 @@
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+
+// 48px rail; review settled the glyph between 13px (too small) and 18px (too
+// large): 16px at 1.5 stroke inside a 30px hit area, 10px apart.
+export const RAIL_ICON_SIZE = { size: 16, strokeWidth: 1.5 };
+export const RAIL_GAP = 10;
+
+export const styles = stylex.create({
+ badge: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ insetBlockStart: '-5px',
+ insetInlineEnd: '-6px',
+ minWidth: '15px',
+ height: '15px',
+ paddingInline: '4px',
+ borderWidth: '1.5px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBgLayout,
+ borderRadius: '999px',
+ fontSize: '9px',
+ fontWeight: 600,
+ lineHeight: '12px',
+ color: cssVar.colorBgContainer,
+ textAlign: 'center',
+ backgroundColor: cssVar.colorText,
+ },
+ item: {
+ cursor: 'pointer',
+ position: 'relative',
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '30px',
+ height: '30px',
+ borderRadius: cssVar.borderRadius,
+ color: { default: cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ backgroundColor: { default: null, ':hover': cssVar.colorFillTertiary },
+ transition: 'color 0.15s, background-color 0.15s',
+ },
+ itemActive: {
+ color: cssVar.colorText,
+ backgroundColor: { default: cssVar.colorFillSecondary, ':hover': cssVar.colorFillSecondary },
+ },
+ rail: {
+ userSelect: 'none',
+ flex: 'none',
+ alignItems: 'center',
+ // Keep in sync with RAIL_WIDTH (./const): StyleX only compiles local literals.
+ width: '48px',
+ height: '100%',
+ paddingBlock: '10px',
+ },
+});
diff --git a/src/features/NavRail/useImLayout.ts b/src/features/NavRail/useImLayout.ts
new file mode 100644
index 00000000000..8176248aad7
--- /dev/null
+++ b/src/features/NavRail/useImLayout.ts
@@ -0,0 +1,14 @@
+import { useEffect } from 'react';
+
+import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
+
+import { writeImLayoutHint } from './layoutHint';
+
+/** Runtime flag `im_layout`: the rail layout trial. Off keeps the sidebar layout. */
+export const useImLayout = (): boolean =>
+ useServerConfigStore((s) => !!featureFlagsSelectors(s).enableImLayout);
+
+/** Remember the rendered layout so the next boot skeleton matches it. */
+export const useSyncImLayoutHint = (enabled: boolean) => {
+ useEffect(() => writeImLayoutHint(enabled), [enabled]);
+};
diff --git a/src/features/NavRail/wrapStyle.ts b/src/features/NavRail/wrapStyle.ts
new file mode 100644
index 00000000000..08d188628db
--- /dev/null
+++ b/src/features/NavRail/wrapStyle.ts
@@ -0,0 +1,26 @@
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+
+export const wrapStyles = stylex.create({
+ // The wrap right of the rail: list column + content share one rounded,
+ // bordered surface (Codex-style); the rail stays on the window background.
+ wrap: {
+ position: 'relative',
+ overflow: 'hidden',
+ flex: '1',
+ minWidth: 0,
+ marginBlockStart: '8px',
+ marginBlockEnd: '8px',
+ marginInlineEnd: '8px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: '12px',
+ backgroundColor: cssVar.colorBgContainer,
+ boxShadow: '0 1px 2px rgb(0 0 0 / 3%)',
+ },
+ // Electron: the title bar already sits above the wrap.
+ wrapDesktop: {
+ marginBlockStart: 0,
+ },
+});
diff --git a/src/features/TaskNav/index.test.tsx b/src/features/TaskNav/index.test.tsx
new file mode 100644
index 00000000000..fd718b7cf58
--- /dev/null
+++ b/src/features/TaskNav/index.test.tsx
@@ -0,0 +1,101 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { fireEvent, render, screen } from '@testing-library/react';
+import { createElement } from 'react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { TaskNavBody } from './index';
+
+const projectStore = vi.hoisted(() => ({
+ fetch: {
+ error: undefined as unknown,
+ isHydrated: true,
+ isValidating: false,
+ revalidate: vi.fn(),
+ },
+ projects: undefined as { id: string; name: string }[] | undefined,
+}));
+
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({
+ useActiveWorkspaceSlug: () => null,
+}));
+vi.mock('@/hooks/useActiveLocation', () => ({
+ useActiveLocation: () => ({ pathname: '/tasks', search: '' }),
+}));
+vi.mock('@/store/project', () => ({
+ useLoadedProjectList: () => projectStore.projects,
+ useProjectStore: (selector: (state: object) => unknown) =>
+ selector({ useFetchProjectList: () => projectStore.fetch }),
+}));
+vi.mock('@/store/user', () => ({
+ useUserStore: (selector: (state: object) => unknown) => selector({}),
+}));
+vi.mock('@/store/user/selectors', () => ({
+ labPreferSelectors: { enableGoals: () => false, enableProjects: () => true },
+}));
+vi.mock('@/features/HomeSidebar/Body/Project/ProjectItem', () => ({ projectIcon: () => null }));
+vi.mock('@/features/MessageList', () => ({
+ ListHeader: ({ title }: { title: string }) => createElement('div', {}, title),
+}));
+vi.mock('@/features/NavPanel/components/NavItem', () => ({
+ default: ({ title }: { title: string }) => createElement('div', {}, title),
+}));
+vi.mock('@/features/NavPanel/components/SkeletonList', () => ({
+ default: () => createElement('div', {}, 'Loading projects'),
+}));
+vi.mock('@/features/Workspace/WorkspaceLink', () => ({
+ default: ({ children }: { children: React.ReactNode }) => createElement('div', {}, children),
+}));
+vi.mock('@/features/Workspace/useWorkspaceAwareNavigate', () => ({
+ useWorkspaceAwareNavigate: () => () => {},
+}));
+vi.mock('@/components/AsyncError', () => ({
+ default: ({ onRetry }: { onRetry?: () => void }) =>
+ createElement('button', { onClick: onRetry, type: 'button' }, 'Retry projects'),
+}));
+
+beforeEach(() => {
+ projectStore.fetch.error = undefined;
+ projectStore.fetch.isHydrated = true;
+ projectStore.fetch.isValidating = false;
+ projectStore.fetch.revalidate.mockReset();
+ projectStore.projects = undefined;
+});
+
+describe('TaskNavBody', () => {
+ it('shows the skeleton while the first project load is in flight', () => {
+ projectStore.fetch.isHydrated = false;
+
+ render(createElement(TaskNavBody));
+
+ expect(screen.getByText('Loading projects')).toBeInTheDocument();
+ });
+
+ it('shows a retryable error when the first project load fails', () => {
+ projectStore.fetch.error = new Error('network');
+
+ render(createElement(TaskNavBody));
+
+ expect(screen.queryByText('Loading projects')).not.toBeInTheDocument();
+ fireEvent.click(screen.getByText('Retry projects'));
+ expect(projectStore.fetch.revalidate).toHaveBeenCalled();
+ });
+
+ it('lists the projects once they load', () => {
+ projectStore.projects = [{ id: 'p1', name: 'Alpha' }];
+
+ render(createElement(TaskNavBody));
+
+ expect(screen.getByText('Alpha')).toBeInTheDocument();
+ });
+
+ it('shows the empty hint when the workspace has no project', () => {
+ projectStore.projects = [];
+
+ render(createElement(TaskNavBody));
+
+ expect(screen.getByText('taskNav.noProjects')).toBeInTheDocument();
+ });
+});
diff --git a/src/features/TaskNav/index.tsx b/src/features/TaskNav/index.tsx
new file mode 100644
index 00000000000..24b651b29ba
--- /dev/null
+++ b/src/features/TaskNav/index.tsx
@@ -0,0 +1,150 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { ListTodoIcon, TargetIcon } from 'lucide-react';
+import { type ComponentProps, memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
+import AsyncError from '@/components/AsyncError';
+import { projectIcon } from '@/features/HomeSidebar/Body/Project/ProjectItem';
+import { ListHeader } from '@/features/MessageList';
+import NavItem from '@/features/NavPanel/components/NavItem';
+import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import { NavPanelPortal } from '@/features/NavPanel/NavPanelPortal';
+import { NAV_PANEL_TASKS_KEY } from '@/features/NavPanel/railRouteKey';
+import SideBarLayout from '@/features/NavPanel/SideBarLayout';
+import { resolveProjectListState } from '@/features/Projects/projectListState';
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
+import { useActiveLocation } from '@/hooks/useActiveLocation';
+import { useLoadedProjectList, useProjectStore } from '@/store/project';
+import { useUserStore } from '@/store/user';
+import { labPreferSelectors } from '@/store/user/selectors';
+import { isModifierClick } from '@/utils/navigation';
+
+import { resolveTaskScope, taskScopeUrl } from './taskScope';
+
+const styles = stylex.create({
+ empty: {
+ paddingBlock: '8px',
+ paddingInline: '10px',
+ fontSize: '12px',
+ color: cssVar.colorTextQuaternary,
+ },
+ sectionTitle: {
+ paddingBlockStart: '12px',
+ paddingBlockEnd: '4px',
+ paddingInline: '10px',
+ fontSize: '12px',
+ color: cssVar.colorTextTertiary,
+ },
+});
+
+interface EntryProps {
+ active: boolean;
+ icon: ComponentProps<typeof NavItem>['icon'];
+ title: string;
+ url: string;
+}
+
+const Entry = memo<EntryProps>(({ active, icon, title, url }) => {
+ const navigate = useWorkspaceAwareNavigate();
+
+ return (
+ <WorkspaceLink
+ aria-current={active ? 'page' : undefined}
+ aria-label={title}
+ to={url}
+ onClick={(e) => {
+ if (isModifierClick(e)) return;
+ e.preventDefault();
+ navigate(url);
+ }}
+ >
+ <NavItem active={active} icon={icon} title={title} />
+ </WorkspaceLink>
+ );
+});
+
+Entry.displayName = 'TaskNavEntry';
+
+export const TaskNavBody = memo(() => {
+ const { t } = useTranslation('common');
+ const { pathname, search } = useActiveLocation();
+ const activeSlug = useActiveWorkspaceSlug();
+ const enableGoals = useUserStore(labPreferSelectors.enableGoals);
+ const enableProjects = useUserStore(labPreferSelectors.enableProjects);
+ const projects = useLoadedProjectList();
+ const { error, isHydrated, isValidating, revalidate } = useProjectStore(
+ (s) => s.useFetchProjectList,
+ )(enableProjects);
+ const projectListState = resolveProjectListState({ error, isHydrated, isValidating, projects });
+
+ const scope = resolveTaskScope(pathname, search ?? '', activeSlug);
+
+ return (
+ <Flexbox gap={1} paddingBlock={'0 12px'} paddingInline={6}>
+ <Entry
+ active={scope.type === 'all'}
+ icon={ListTodoIcon}
+ title={t('taskNav.all')}
+ url={taskScopeUrl()}
+ />
+ {enableGoals && (
+ <Entry
+ active={scope.type === 'goals'}
+ icon={TargetIcon}
+ title={t('tab.goals')}
+ url="/goals"
+ />
+ )}
+ {enableProjects && (
+ <>
+ <div {...stylex.props(styles.sectionTitle)}>{t('tab.projects')}</div>
+ {projectListState === 'error' ? (
+ <AsyncError error={error} variant="inline" onRetry={() => revalidate()} />
+ ) : projectListState === 'loading' ? (
+ <SkeletonList rows={3} />
+ ) : projectListState === 'empty' ? (
+ <div {...stylex.props(styles.empty)}>{t('taskNav.noProjects')}</div>
+ ) : (
+ projects?.map((project) => (
+ <Entry
+ active={scope.type === 'project' && scope.projectId === project.id}
+ icon={projectIcon(project)}
+ key={project.id}
+ title={project.name}
+ url={taskScopeUrl(project.id)}
+ />
+ ))
+ )}
+ </>
+ )}
+ </Flexbox>
+ );
+});
+
+TaskNavBody.displayName = 'TaskNavBody';
+
+const Header = memo(() => {
+ const { t } = useTranslation('common');
+ return <ListHeader title={t('tab.tasks')} />;
+});
+
+Header.displayName = 'TaskNavHeader';
+
+/**
+ * Tasks tab list column: every task, goals, then one entry per project. A
+ * project entry scopes the task list in place (`/tasks?project=<id>`), so the
+ * user stays in the Tasks tab instead of jumping into the project workbench.
+ */
+const TaskNavPortal = () => (
+ <NavPanelPortal navKey={NAV_PANEL_TASKS_KEY}>
+ <SideBarLayout body={<TaskNavBody />} header={<Header />} />
+ </NavPanelPortal>
+);
+
+export default TaskNavPortal;
diff --git a/src/features/TaskNav/taskScope.test.ts b/src/features/TaskNav/taskScope.test.ts
new file mode 100644
index 00000000000..281842d38a4
--- /dev/null
+++ b/src/features/TaskNav/taskScope.test.ts
@@ -0,0 +1,25 @@
+import { describe, expect, it } from 'vitest';
+
+import { resolveTaskScope, taskScopeUrl } from './taskScope';
+
+describe('resolveTaskScope', () => {
+ it.each([
+ ['/tasks', '', null, { type: 'all' }],
+ ['/task/T-1/slug', '', null, { type: 'all' }],
+ ['/tasks', '?project=prj_1', null, { projectId: 'prj_1', type: 'project' }],
+ ['/team/tasks', '?project=prj_1&x=1', 'team', { projectId: 'prj_1', type: 'project' }],
+ ['/goals', '', null, { type: 'goals' }],
+ ['/team/goal/g-1', '', 'team', { type: 'goals' }],
+ // The project param only scopes the task list itself.
+ ['/goals', '?project=prj_1', null, { type: 'goals' }],
+ ])('maps %s%s', (pathname, search, slug, expected) => {
+ expect(resolveTaskScope(pathname, search, slug)).toEqual(expected);
+ });
+});
+
+describe('taskScopeUrl', () => {
+ it('builds the scoped task list url', () => {
+ expect(taskScopeUrl()).toBe('/tasks');
+ expect(taskScopeUrl('prj 1')).toBe('/tasks?project=prj%201');
+ });
+});
diff --git a/src/features/TaskNav/taskScope.ts b/src/features/TaskNav/taskScope.ts
new file mode 100644
index 00000000000..e3fa6070459
--- /dev/null
+++ b/src/features/TaskNav/taskScope.ts
@@ -0,0 +1,29 @@
+/** Query param the Tasks tab uses to scope `/tasks` to one project. */
+export const TASK_PROJECT_PARAM = 'project';
+
+export type TaskScope =
+ { type: 'all' } | { type: 'goals' } | { projectId: string; type: 'project' };
+
+/**
+ * Which Tasks-tab list entry a location belongs to: a project scope
+ * (`/tasks?project=<id>`), the goals pages, or every other task route.
+ */
+export const resolveTaskScope = (
+ pathname: string,
+ search: string,
+ activeWorkspaceSlug: string | null,
+): TaskScope => {
+ const segments = pathname.split('/').filter(Boolean);
+ const [root] =
+ activeWorkspaceSlug && segments[0] === activeWorkspaceSlug ? segments.slice(1) : segments;
+
+ if (root === 'goals' || root === 'goal') return { type: 'goals' };
+
+ const projectId = new URLSearchParams(search).get(TASK_PROJECT_PARAM);
+ if (root === 'tasks' && projectId) return { projectId, type: 'project' };
+
+ return { type: 'all' };
+};
+
+export const taskScopeUrl = (projectId?: string) =>
+ projectId ? `/tasks?${TASK_PROJECT_PARAM}=${encodeURIComponent(projectId)}` : '/tasks';
diff --git a/src/routes/(main)/_layout/authMount.test.ts b/src/routes/(main)/_layout/authMount.test.ts
index 43c96b8fc54..371d0b4a2da 100644
--- a/src/routes/(main)/_layout/authMount.test.ts
+++ b/src/routes/(main)/_layout/authMount.test.ts
@@ -43,6 +43,12 @@ vi.mock('@/features/Electron/titlebar/TabBar/TabCacheBridges', nullComponent);
vi.mock('@/features/Electron/titlebar/TitleBar', nullComponent);
vi.mock('@/features/HotkeyHelperPanel', nullComponent);
vi.mock('@/features/NavPanel/Shell', nullComponent);
+vi.mock('@/features/NavRail', nullComponent);
+vi.mock('@/features/NavRail/wrapStyle', () => ({ wrapStyles: {} }));
+vi.mock('@/features/NavRail/useImLayout', () => ({
+ useImLayout: () => false,
+ useSyncImLayoutHint: () => {},
+}));
vi.mock('@/layout/GlobalProvider/CmdkLazy', nullComponent);
vi.mock('./GatewayMuxWarmup', nullComponent);
vi.mock('./ClientLlmWaitResume', nullComponent);
diff --git a/src/routes/(main)/_layout/index.desktop.tsx b/src/routes/(main)/_layout/index.desktop.tsx
index dcb9e89eeb0..563565b86da 100644
--- a/src/routes/(main)/_layout/index.desktop.tsx
+++ b/src/routes/(main)/_layout/index.desktop.tsx
@@ -32,6 +32,9 @@ import TitleBar from '@/features/Electron/titlebar/TitleBar';
import WorkspaceMentionNotifier from '@/features/Electron/WorkspaceMentionNotifier';
import HotkeyHelperPanel from '@/features/HotkeyHelperPanel';
import NavPanelShell from '@/features/NavPanel/Shell';
+import NavRail from '@/features/NavRail';
+import { useImLayout, useSyncImLayoutHint } from '@/features/NavRail/useImLayout';
+import { wrapStyles } from '@/features/NavRail/wrapStyle';
import { DndContextWrapper } from '@/features/ResourceManager/DndContextWrapper';
import { usePlatform } from '@/hooks/usePlatform';
import CmdkLazy from '@/layout/GlobalProvider/CmdkLazy';
@@ -52,6 +55,9 @@ const tabHostContainer: CSSProperties = { position: 'relative' };
const Layout: FC = () => {
const { isPWA } = usePlatform();
const { showCloudPromotion } = useServerConfigStore(featureFlagsSelectors);
+ // `im_layout` trial: icon rail + wrapped list column; off keeps this layout.
+ const imLayout = useImLayout();
+ useSyncImLayoutHint(imLayout);
useSeedTabsOnBoot();
useWindowUrlMirror();
@@ -89,12 +95,28 @@ const Layout: FC = () => {
stylex.props(isPWA ? styles.mainContainerPWA : styles.mainContainer).className
}
>
- <NavPanelShell />
- <DesktopLayoutContainer>
- <Flexbox height={'100%'} style={tabHostContainer} width={'100%'}>
- <TabHost />
- </Flexbox>
- </DesktopLayoutContainer>
+ {imLayout ? (
+ <>
+ <NavRail />
+ <Flexbox horizontal {...stylex.props(wrapStyles.wrap, wrapStyles.wrapDesktop)}>
+ <NavPanelShell />
+ <DesktopLayoutContainer flush>
+ <Flexbox height={'100%'} style={tabHostContainer} width={'100%'}>
+ <TabHost />
+ </Flexbox>
+ </DesktopLayoutContainer>
+ </Flexbox>
+ </>
+ ) : (
+ <>
+ <NavPanelShell />
+ <DesktopLayoutContainer>
+ <Flexbox height={'100%'} style={tabHostContainer} width={'100%'}>
+ <TabHost />
+ </Flexbox>
+ </DesktopLayoutContainer>
+ </>
+ )}
</Flexbox>
</DndContextWrapper>
<Suspense fallback={null}>
diff --git a/src/routes/(main)/_layout/index.tsx b/src/routes/(main)/_layout/index.tsx
index 9be706e4572..63cdf067a8c 100644
--- a/src/routes/(main)/_layout/index.tsx
+++ b/src/routes/(main)/_layout/index.tsx
@@ -16,6 +16,9 @@ import DesktopLayoutContainer from '@/features/DesktopLayoutContainer';
import AuthRequiredModal from '@/features/Electron/AuthRequiredModal';
import HotkeyHelperPanel from '@/features/HotkeyHelperPanel';
import NavPanelShell from '@/features/NavPanel/Shell';
+import NavRail from '@/features/NavRail';
+import { useImLayout, useSyncImLayoutHint } from '@/features/NavRail/useImLayout';
+import { wrapStyles } from '@/features/NavRail/wrapStyle';
import { DndContextWrapper } from '@/features/ResourceManager/DndContextWrapper';
import { RouteMetaBridge } from '@/features/RouteMeta';
import { usePlatform } from '@/hooks/usePlatform';
@@ -40,6 +43,9 @@ const GlobalApprovalNotification = dynamic(() => import('@/features/GlobalApprov
const Layout: FC = () => {
const { isPWA } = usePlatform();
const { showCloudPromotion } = useServerConfigStore(featureFlagsSelectors);
+ // `im_layout` trial: icon rail + wrapped list column; off keeps this layout.
+ const imLayout = useImLayout();
+ useSyncImLayoutHint(imLayout);
return (
<HotkeysProvider initiallyActiveScopes={[HotkeyScopeEnum.Global]}>
@@ -57,15 +63,38 @@ const Layout: FC = () => {
stylex.props(isPWA ? styles.mainContainerPWA : styles.mainContainer).className
}
>
- <NavPanelShell />
- <DesktopLayoutContainer>
- <DesktopHomeLayout>
- <DesktopHome />
- </DesktopHomeLayout>
- <Suspense fallback={<RouteSegmentSkeleton />}>
- <Outlet />
- </Suspense>
- </DesktopLayoutContainer>
+ {imLayout ? (
+ <>
+ <NavRail />
+ <Flexbox
+ horizontal
+ {...stylex.props(wrapStyles.wrap, isDesktop && wrapStyles.wrapDesktop)}
+ >
+ <NavPanelShell />
+ <DesktopLayoutContainer flush>
+ {/* `/` stays the home dashboard; the Messages tab opens Lobe AI. */}
+ <DesktopHomeLayout>
+ <DesktopHome />
+ </DesktopHomeLayout>
+ <Suspense fallback={<RouteSegmentSkeleton />}>
+ <Outlet />
+ </Suspense>
+ </DesktopLayoutContainer>
+ </Flexbox>
+ </>
+ ) : (
+ <>
+ <NavPanelShell />
+ <DesktopLayoutContainer>
+ <DesktopHomeLayout>
+ <DesktopHome />
+ </DesktopHomeLayout>
+ <Suspense fallback={<RouteSegmentSkeleton />}>
+ <Outlet />
+ </Suspense>
+ </DesktopLayoutContainer>
+ </>
+ )}
</Flexbox>
</DndContextWrapper>
<Suspense fallback={null}>
diff --git a/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx b/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx
index b4b86e814ce..f2ebcccb5cd 100644
--- a/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/MainChatInput/index.tsx
@@ -3,8 +3,15 @@
import { memo, useMemo } from 'react';
import { type ActionKeys } from '@/features/ChatInput';
+import { ActionBarContext } from '@/features/ChatInput/ActionBar/context';
+import {
+ COMPACT_ACTION_BAR_CONTEXT,
+ COMPACT_ACTION_BAR_STYLE,
+ COMPACT_SEND_BUTTON_PROPS,
+} from '@/features/ChatInput/compactPreset';
import { ChatInput } from '@/features/Conversation';
import { contextSelectors, useConversationStore } from '@/features/Conversation/store';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import { useModelSupportImageOutput } from '@/hooks/useModelSupportImageOutput';
import { useAgentStore } from '@/store/agent';
import { agentByIdSelectors } from '@/store/agent/selectors';
@@ -15,6 +22,9 @@ import { userGeneralSettingsSelectors } from '@/store/user/selectors';
import AgentConfigError from './AgentConfigError';
import { useSendMenuItems } from './useSendMenuItems';
+// Single-row editor for the channel composer; it still grows with content.
+const SLIM_INPUT_PROPS = { defaultHeight: 36 };
+
const contextWindowRightActions: ActionKeys[] = ['model', 'voiceMessage', 'contextWindow'];
const promptTransformRightActions: ActionKeys[] = [
'model',
@@ -47,23 +57,41 @@ const MainChatInput = memo(() => {
// The model chip lives on the right, next to Send (see rightActions); the
// left bar keeps the "+" menu, dictation and the expand toggle.
const leftActions: ActionKeys[] = useMemo(() => ['plus', 'voiceDictation'], []);
+ // `im_layout` opens conversations as channels: the slim composer preset of
+ // the side panels (small actions and send button, no control bar).
+ const imLayout = useImLayout();
+
+ const input = (
+ <ChatInput
+ skipScrollMarginWithList
+ actionBarStyle={imLayout ? COMPACT_ACTION_BAR_STYLE : undefined}
+ inputContainerProps={imLayout ? SLIM_INPUT_PROPS : undefined}
+ isConfigLoading={isAgentConfigLoading}
+ leftActions={leftActions}
+ rightActions={rightActions}
+ showControlBar={!imLayout}
+ {...(isDevMode
+ ? { sendMenu: { items: sendMenuItems } }
+ : {
+ sendButtonProps: imLayout
+ ? { ...COMPACT_SEND_BUTTON_PROPS, shape: 'round' }
+ : { shape: 'round' },
+ })}
+ onEditorReady={(instance) => {
+ // Sync to global ChatStore for compatibility with other features
+ useChatStore.setState({ mainInputEditor: instance });
+ }}
+ />
+ );
return (
<>
<AgentConfigError />
- <ChatInput
- skipScrollMarginWithList
- isConfigLoading={isAgentConfigLoading}
- leftActions={leftActions}
- rightActions={rightActions}
- {...(isDevMode
- ? { sendMenu: { items: sendMenuItems } }
- : { sendButtonProps: { shape: 'round' } })}
- onEditorReady={(instance) => {
- // Sync to global ChatStore for compatibility with other features
- useChatStore.setState({ mainInputEditor: instance });
- }}
- />
+ {imLayout ? (
+ <ActionBarContext value={COMPACT_ACTION_BAR_CONTEXT}>{input}</ActionBarContext>
+ ) : (
+ input
+ )}
</>
);
});
diff --git a/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx b/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx
index 22d0a824659..b44b46c10a5 100644
--- a/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx
+++ b/src/routes/(main)/group/features/Conversation/MainChatInput/index.tsx
@@ -3,11 +3,21 @@
import { memo } from 'react';
import { type ActionKeys } from '@/features/ChatInput';
+import { ActionBarContext } from '@/features/ChatInput/ActionBar/context';
+import {
+ COMPACT_ACTION_BAR_CONTEXT,
+ COMPACT_ACTION_BAR_STYLE,
+ COMPACT_SEND_BUTTON_PROPS,
+} from '@/features/ChatInput/compactPreset';
import { ChatInput } from '@/features/Conversation';
+import { useImLayout } from '@/features/NavRail/useImLayout';
import { useChatStore } from '@/store/chat';
import { useSendMenuItems } from './useSendMenuItems';
+// Single-row editor for the channel composer; it still grows with content.
+const SLIM_INPUT_PROPS = { defaultHeight: 36 };
+
const leftActions: ActionKeys[] = [
'search',
'memory',
@@ -31,18 +41,30 @@ const rightActions: ActionKeys[] = ['model', 'voiceMessage', 'contextWindow'];
const MainChatInput = memo(() => {
const sendMenuItems = useSendMenuItems();
- return (
+ // `im_layout` opens conversations as channels: the slim composer preset of
+ // the side panels (small actions and send button, no control bar).
+ const imLayout = useImLayout();
+
+ const input = (
<ChatInput
skipScrollMarginWithList
+ actionBarStyle={imLayout ? COMPACT_ACTION_BAR_STYLE : undefined}
+ inputContainerProps={imLayout ? SLIM_INPUT_PROPS : undefined}
leftActions={leftActions}
rightActions={rightActions}
+ sendButtonProps={imLayout ? COMPACT_SEND_BUTTON_PROPS : undefined}
sendMenu={{ items: sendMenuItems }}
+ showControlBar={!imLayout}
onEditorReady={(instance) => {
// Sync to global ChatStore for compatibility with other features
useChatStore.setState({ mainInputEditor: instance });
}}
/>
);
+
+ if (!imLayout) return input;
+
+ return <ActionBarContext value={COMPACT_ACTION_BAR_CONTEXT}>{input}</ActionBarContext>;
});
MainChatInput.displayName = 'MainChatInput';
diff --git a/src/routes/(main)/tasks/index.tsx b/src/routes/(main)/tasks/index.tsx
index fcab089ad03..41fce28559c 100644
--- a/src/routes/(main)/tasks/index.tsx
+++ b/src/routes/(main)/tasks/index.tsx
@@ -1,3 +1,3 @@
'use client';
-export { default } from '@/features/AgentTasks/AgentTaskList/AgentTasksPage';
+export { default } from '@/features/AgentTasks/AgentTaskList/TasksTabPage';
diff --git a/src/services/recent/index.ts b/src/services/recent/index.ts
index 5280e909e1b..6ccd4053a3b 100644
--- a/src/services/recent/index.ts
+++ b/src/services/recent/index.ts
@@ -7,6 +7,12 @@ export const RECENT_SIDEBAR_TYPES = [
'task',
] as const satisfies readonly RecentItem['type'][];
+/**
+ * The IM conversation list only needs topics: each agent / group row takes its
+ * activity time and preview from that owner's latest topic.
+ */
+export const RECENT_CONVERSATION_TYPES = ['topic'] as const satisfies readonly RecentItem['type'][];
+
class RecentService {
getAll = (
limit?: number,
diff --git a/src/spa/BootShell/AppShellSkeleton.tsx b/src/spa/BootShell/AppShellSkeleton.tsx
index 59059c694f7..b4fbdc1edaa 100644
--- a/src/spa/BootShell/AppShellSkeleton.tsx
+++ b/src/spa/BootShell/AppShellSkeleton.tsx
@@ -1,7 +1,7 @@
'use client';
import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
-import { Flexbox } from '@lobehub/ui';
+import { cx, Flexbox } from '@lobehub/ui';
import { LobeHub } from '@lobehub/ui/brand';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
@@ -15,6 +15,9 @@ import {
getOuterCssVariables,
} from '@/features/DesktopLayoutContainer/cssVariables';
import { styles as containerStyles } from '@/features/DesktopLayoutContainer/style';
+import { LIST_COLUMN_BACKGROUND, RAIL_WIDTH } from '@/features/NavRail/const';
+import { readImLayoutHint } from '@/features/NavRail/layoutHint';
+import { wrapStyles as layoutStyles } from '@/features/NavRail/wrapStyle';
import { electronStylish } from '@/styles/electron';
import { sx } from '@/styles/sx';
@@ -113,9 +116,71 @@ interface AppShellSkeletonProps {
const AppShellSkeleton = memo<AppShellSkeletonProps>(({ id }) => {
const { isDark, navPanelBackground, navPanelWidth, showLeftPanel } = readBootShellGeometry();
const hint = useLoadingHint();
+ const imLayout = readImLayoutHint();
useLayoutEffect(retainSkeleton, []);
+ const brand = (
+ <div {...stylex.props(styles.contentBrand)}>
+ <div {...stylex.props(styles.brand)}>
+ <LobeHub size={40} type={'text'} />
+ {hint && <LoadingHint enter={hint === 'enter'} />}
+ </div>
+ </div>
+ );
+
+ // `im_layout`: icon rail + one rounded wrap (list column + content).
+ if (imLayout)
+ return (
+ <div aria-hidden id={id} {...sx(styles.root, CSS_VAR_CLASS)}>
+ {isDesktop && (
+ <div
+ {...sx([styles.dragRegion], electronStylish.draggable, { height: TITLE_BAR_HEIGHT })}
+ />
+ )}
+ <Flexbox
+ horizontal
+ height={isDesktop ? `calc(100% - ${TITLE_BAR_HEIGHT}px)` : '100%'}
+ width={'100%'}
+ >
+ <div
+ style={{
+ background: navPanelBackground,
+ flexShrink: 0,
+ height: '100%',
+ width: RAIL_WIDTH,
+ }}
+ />
+ <Flexbox
+ horizontal
+ style={getInnerCssVariables({ isDark })}
+ className={
+ stylex.props(layoutStyles.wrap, isDesktop && layoutStyles.wrapDesktop).className
+ }
+ >
+ {showLeftPanel && (
+ <div
+ style={{
+ background: LIST_COLUMN_BACKGROUND,
+ borderInlineEnd: `1px solid ${cssVar.colorBorderSecondary}`,
+ flexShrink: 0,
+ height: '100%',
+ width: navPanelWidth,
+ }}
+ />
+ )}
+ <Flexbox
+ className={cx(containerStyles.innerContainer, containerStyles.innerFlush)}
+ height={'100%'}
+ width={'100%'}
+ >
+ {brand}
+ </Flexbox>
+ </Flexbox>
+ </Flexbox>
+ </div>
+ );
+
return (
<div aria-hidden id={id} {...sx(styles.root, CSS_VAR_CLASS)}>
{isDesktop && (
@@ -151,12 +216,7 @@ const AppShellSkeleton = memo<AppShellSkeletonProps>(({ id }) => {
style={getInnerCssVariables({ isDark })}
width={'100%'}
>
- <div {...stylex.props(styles.contentBrand)}>
- <div {...stylex.props(styles.brand)}>
- <LobeHub size={40} type={'text'} />
- {hint && <LoadingHint enter={hint === 'enter'} />}
- </div>
- </div>
+ {brand}
</Flexbox>
</Flexbox>
</Flexbox>
diff --git a/src/store/home/slices/recent/action.test.ts b/src/store/home/slices/recent/action.test.ts
index 480ea032646..d80ab4f7179 100644
--- a/src/store/home/slices/recent/action.test.ts
+++ b/src/store/home/slices/recent/action.test.ts
@@ -19,7 +19,11 @@ import { fileService } from '@/services/file';
import { recentService } from '@/services/recent';
import { taskService } from '@/services/task';
import { useHomeStore } from '@/store/home';
-import { createRecentQueryKey, initialRecentState } from '@/store/home/slices/recent/initialState';
+import {
+ createConversationRecentQueryKey,
+ createRecentQueryKey,
+ initialRecentState,
+} from '@/store/home/slices/recent/initialState';
import { docsHomeListResource, recentListResource } from '@/store/home/slices/recent/projection';
import { homeRecentSelectors } from '@/store/home/slices/recent/selectors';
@@ -117,6 +121,23 @@ describe('recents replica', () => {
expect(result.current.isValidating).toBe(true);
});
+ it('fetches topic recents with previews for the conversation list', async () => {
+ const getAll = vi
+ .spyOn(recentService, 'getAll')
+ .mockImplementation(async () => [item('t1', 'Topic', 'topic')]);
+ const conversations = createConversationRecentQueryKey(50);
+
+ renderHook(() => useHomeStore((s) => s.useFetchConversationRecents)(50), { wrapper });
+
+ await waitFor(() =>
+ expect(
+ homeRecentSelectors.conversationRecents(conversations)(useHomeStore.getState()),
+ ).toHaveLength(1),
+ );
+ // Topics with previews: the IM rows show the latest reply, not the title.
+ expect(getAll).toHaveBeenCalledWith(50, ['topic'], true);
+ });
+
it('does not fetch while logged out', () => {
const getAll = vi.spyOn(recentService, 'getAll');
renderHook(() => useHomeStore((s) => s.useFetchRecents)(false, 10), { wrapper });
diff --git a/src/store/home/slices/recent/action.ts b/src/store/home/slices/recent/action.ts
index 7c45fdec4b5..e2d7fa6be96 100644
--- a/src/store/home/slices/recent/action.ts
+++ b/src/store/home/slices/recent/action.ts
@@ -9,7 +9,7 @@ import {
} from '@/libs/replica';
import { documentService } from '@/services/document';
import { fileService } from '@/services/file';
-import { RECENT_SIDEBAR_TYPES, recentService } from '@/services/recent';
+import { RECENT_CONVERSATION_TYPES, RECENT_SIDEBAR_TYPES, recentService } from '@/services/recent';
import { taskService } from '@/services/task';
import { topicService } from '@/services/topic';
import type { HomeStore } from '@/store/home/store';
@@ -18,6 +18,7 @@ import { setNamespace } from '@/utils/storeDebug';
import { type RecentEntityRef, toRecentEntityRef } from './initialState';
import {
+ conversationRecentResource,
DOCS_HOME_LIMIT,
docsHomeListResource,
type DocsHomeRow,
@@ -69,9 +70,10 @@ export class RecentActionImpl {
readonly #set: Setter;
/** Server writes per entity run in order; the newest optimistic title stays on top. */
readonly #renameQueues = new Map<RecentEntityRef, Promise<unknown>>();
+ readonly #conversationRecents;
+ readonly #docsHome;
readonly #recentList;
readonly #recents;
- readonly #docsHome;
constructor(set: Setter, get: () => HomeStore, _api?: unknown) {
void _api;
@@ -85,7 +87,17 @@ export class RecentActionImpl {
stateKey: 'recentListReplica',
view: recordLens<HomeStore, RecentItem[]>('recentListMap'),
});
- this.#recents = linkReplicaEntity<RecentItem>([this.#recentList]);
+ this.#conversationRecents = createReplicaSlice(conversationRecentResource, {
+ actionPrefix: n('conversationRecents'),
+ entity: recentEntity,
+ // Topics only, with previews: the IM list shows the latest reply per row.
+ fetcher: ({ limit }) => recentService.getAll(limit, RECENT_CONVERSATION_TYPES, true),
+ get,
+ set,
+ stateKey: 'conversationRecentReplica',
+ view: recordLens<HomeStore, RecentItem[]>('conversationRecentMap'),
+ });
+ this.#recents = linkReplicaEntity<RecentItem>([this.#recentList, this.#conversationRecents]);
this.#docsHome = createReplicaSlice(docsHomeListResource, {
actionPrefix: n('docsHome'),
fetcher: async ({ tab }) =>
@@ -124,7 +136,7 @@ export class RecentActionImpl {
/** Revalidate every recents query of the active identity. */
refreshRecents = async (): Promise<void> => {
- await this.#recentList.revalidate();
+ await Promise.all([this.#recentList.revalidate(), this.#conversationRecents.revalidate()]);
};
/**
@@ -152,6 +164,13 @@ export class RecentActionImpl {
useFetchAllRecents = (open: boolean): ReplicaSyncResult =>
this.#recentList.useSync({ limit: ALL_RECENTS_LIMIT }, { enabled: open });
+ /**
+ * Latest topic per owner for the IM conversation list. Read the rows with
+ * `homeRecentSelectors.conversationRecents`.
+ */
+ useFetchConversationRecents = (limit: number = ALL_RECENTS_LIMIT): ReplicaSyncResult =>
+ this.#conversationRecents.useSync({ limit }, { enabled: true });
+
/** Refetch every loaded Docs home tab, e.g. after a page or file was added. */
refreshDocsHome = async (): Promise<void> => {
await this.#docsHome.revalidate();
diff --git a/src/store/home/slices/recent/initialState.ts b/src/store/home/slices/recent/initialState.ts
index 805512ed96f..04c9b93200a 100644
--- a/src/store/home/slices/recent/initialState.ts
+++ b/src/store/home/slices/recent/initialState.ts
@@ -4,7 +4,7 @@ import { createReplicaState, type ReplicaState } from '@/libs/replica';
import type { DocsHomeRow } from './projection';
-export { createRecentQueryKey } from './projection';
+export { createConversationRecentQueryKey, createRecentQueryKey } from './projection';
/** `${type}:${id}`: ids of different entity types can collide. */
export type RecentEntityRef = `${RecentItem['type']}:${string}`;
@@ -14,6 +14,10 @@ export const toRecentEntityRef = (item: Pick<RecentItem, 'id' | 'type'>): Recent
export interface RecentState {
allRecentsDrawerOpen: boolean;
+ /** Latest topics per owner, the view of the `conversationRecent` replica. */
+ conversationRecentMap: Record<string, RecentItem[]>;
+ /** Replica bookkeeping for `conversationRecentMap`. */
+ conversationRecentReplica: ReplicaState<RecentItem[]>;
/** Docs home list per tab, the view of the `docsHomeList` replica. */
docsHomeMap: Record<string, DocsHomeRow[]>;
docsHomeReplica: ReplicaState<DocsHomeRow[]>;
@@ -25,6 +29,8 @@ export interface RecentState {
export const initialRecentState: RecentState = {
allRecentsDrawerOpen: false,
+ conversationRecentMap: {},
+ conversationRecentReplica: createReplicaState(),
docsHomeMap: {},
docsHomeReplica: createReplicaState(),
recentListMap: {},
diff --git a/src/store/home/slices/recent/projection.ts b/src/store/home/slices/recent/projection.ts
index bf70abc8bf9..420043d414e 100644
--- a/src/store/home/slices/recent/projection.ts
+++ b/src/store/home/slices/recent/projection.ts
@@ -22,6 +22,21 @@ export const recentListResource = defineReplica<RecentListParams, RecentItem[]>(
version: 1,
});
+/** Entry key of one conversation-recents query (`conversationRecentMap[limit:N]`). */
+export const createConversationRecentQueryKey = (limit: number): string => `limit:${limit}`;
+
+/**
+ * Latest topics per owner, for the IM conversation list. Kept apart from
+ * `recentListResource`: the sidebar and the drawer want documents and tasks,
+ * while this list needs topics with their reply previews.
+ */
+export const conversationRecentResource = defineReplica<RecentListParams, RecentItem[]>({
+ key: ({ limit }) => createConversationRecentQueryKey(limit),
+ name: 'conversationRecent',
+ storage: 'localStorage',
+ version: 1,
+});
+
export type DocsHomeTab = 'mine' | 'recent' | 'shared';
export interface DocsHomeParams {
diff --git a/src/store/home/slices/recent/selectors.ts b/src/store/home/slices/recent/selectors.ts
index f887948a566..f118d41dba9 100644
--- a/src/store/home/slices/recent/selectors.ts
+++ b/src/store/home/slices/recent/selectors.ts
@@ -6,6 +6,10 @@ import type { DocsHomeTab } from './projection';
/** Items of one recents query; `undefined` until it is hydrated or fetched. */
const query = (queryKey: string) => (s: HomeStore) => s.recentListMap[queryKey];
+/** Latest topics per owner for the IM conversation list. */
+const conversationRecents = (queryKey: string) => (s: HomeStore) =>
+ s.conversationRecentMap[queryKey];
+
const item = (queryKey: string, ref: RecentEntityRef) => (s: HomeStore) =>
s.recentListMap[queryKey]?.find((recent) => toRecentEntityRef(recent) === ref);
@@ -13,6 +17,7 @@ const item = (queryKey: string, ref: RecentEntityRef) => (s: HomeStore) =>
const docsHome = (tab: DocsHomeTab) => (s: HomeStore) => s.docsHomeMap[tab];
export const homeRecentSelectors = {
+ conversationRecents,
docsHome,
item,
query,