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.

💄 style(workspace): polish workspace tabs and browser surface (#17470)

Arvin Xu95b8d214c5d6
diff --git a/apps/desktop/src/main/controllers/BrowserSidebarCtr.ts b/apps/desktop/src/main/controllers/BrowserSidebarCtr.ts
index cdf9ba388f0..aa0d1512458 100644
--- a/apps/desktop/src/main/controllers/BrowserSidebarCtr.ts
+++ b/apps/desktop/src/main/controllers/BrowserSidebarCtr.ts
@@ -451,6 +451,7 @@ export default class BrowserSidebarCtr extends ControllerModule {
canGoBack: webContents?.canGoBack() ?? false,
canGoForward: webContents?.canGoForward() ?? false,
error: page?.error,
+ faviconUrl: page?.faviconUrl || discarded?.faviconUrl,
isLoading: webContents?.isLoading() ?? page?.isLoading ?? false,
sessionId,
title: webContents?.getTitle() || page?.title || discarded?.title || '',
diff --git a/apps/desktop/src/main/modules/browser/BrowserPagePool.ts b/apps/desktop/src/main/modules/browser/BrowserPagePool.ts
index e6aa61a1431..dda23bf461f 100644
--- a/apps/desktop/src/main/modules/browser/BrowserPagePool.ts
+++ b/apps/desktop/src/main/modules/browser/BrowserPagePool.ts
@@ -45,6 +45,7 @@ const SWEEP_MS = 30_000;
export interface BrowserPage {
error?: string;
+ faviconUrl?: string;
/**
* The window currently showing this page. `undefined` means it sits in the
* parking window — never "attached to nothing", which would kill the surface.
@@ -98,7 +99,7 @@ export class BrowserPagePool {
* page (the panel still shows its address), and the next use rebuilds the view
* on the same URL — a reload, not a silent reset to blank.
*/
- private discarded = new Map<string, { title: string; url: string }>();
+ private discarded = new Map<string, { faviconUrl?: string; title: string; url: string }>();
private sweepTimer?: NodeJS.Timeout;
constructor(private options: BrowserPagePoolOptions) {}
@@ -108,7 +109,9 @@ export class BrowserPagePool {
}
/** Where a page discarded by the cap left off, so the panel can still show it. */
- discardedRecord(sessionId: string): { title: string; url: string } | undefined {
+ discardedRecord(
+ sessionId: string,
+ ): { faviconUrl?: string; title: string; url: string } | undefined {
return this.discarded.get(sessionId);
}
@@ -145,6 +148,7 @@ export class BrowserPagePool {
this.discarded.delete(sessionId);
const page: BrowserPage = {
+ faviconUrl: restored?.faviconUrl,
isLoading: false,
lastUsedAt: Date.now(),
sessionId,
@@ -210,7 +214,11 @@ export class BrowserPagePool {
}
logger.debug(`Discarding cold browser page ${coldest.sessionId} (${coldest.url})`);
- this.discarded.set(coldest.sessionId, { title: coldest.title, url: coldest.url });
+ this.discarded.set(coldest.sessionId, {
+ faviconUrl: coldest.faviconUrl,
+ title: coldest.title,
+ url: coldest.url,
+ });
this.close(coldest.sessionId);
this.options.onPageChanged(coldest.sessionId);
}
@@ -396,6 +404,10 @@ export class BrowserPagePool {
});
webContents.on('page-title-updated', changed);
+ webContents.on('page-favicon-updated', (_event, favicons) => {
+ page.faviconUrl = favicons[0];
+ changed();
+ });
webContents.on('did-navigate', changed);
webContents.on('did-navigate-in-page', changed);
webContents.on('did-redirect-navigation', changed);
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index c960351652b..239732c5a23 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -1555,17 +1555,16 @@
"workingPanel.overview.changes.clean": "No working tree changes",
"workingPanel.overview.changes.files_one": "{{count}} file modified",
"workingPanel.overview.changes.files_other": "{{count}} files modified",
+ "workingPanel.overview.documents.desc": "Documents available to this agent",
"workingPanel.overview.empty": "Workspace activity and outputs will appear here as the agent works.",
"workingPanel.overview.emptyTitle": "Ready to work",
"workingPanel.overview.environment": "Environment",
"workingPanel.overview.environmentError": "Could not load the repository status",
"workingPanel.overview.execution.device": "Connected device",
"workingPanel.overview.execution.local": "This device",
- "workingPanel.overview.manage": "Manage",
"workingPanel.overview.outputs": "Outputs",
"workingPanel.overview.resources": "Resources",
- "workingPanel.overview.resources.desc": "Documents and skills available to this agent",
- "workingPanel.overview.resources.title": "Agent resources",
+ "workingPanel.overview.skills.desc": "Skills available to this agent",
"workingPanel.overview.title": "Overview",
"workingPanel.overview.viewAll": "View all",
"workingPanel.overview.workspace.empty": "No workspace selected",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 80fcbdc2d24..612efdaeb16 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -1555,17 +1555,16 @@
"workingPanel.overview.changes.clean": "工作树没有变更",
"workingPanel.overview.changes.files_one": "已修改 {{count}} 个文件",
"workingPanel.overview.changes.files_other": "已修改 {{count}} 个文件",
+ "workingPanel.overview.documents.desc": "此 Agent 可用的文档",
"workingPanel.overview.empty": "Agent 开始工作后,工作区活动和产物会显示在这里。",
"workingPanel.overview.emptyTitle": "准备就绪",
"workingPanel.overview.environment": "环境",
"workingPanel.overview.environmentError": "无法加载仓库状态",
"workingPanel.overview.execution.device": "已连接设备",
"workingPanel.overview.execution.local": "此设备",
- "workingPanel.overview.manage": "管理",
"workingPanel.overview.outputs": "产物",
"workingPanel.overview.resources": "资源",
- "workingPanel.overview.resources.desc": "此 Agent 可用的文档和技能",
- "workingPanel.overview.resources.title": "Agent 资源",
+ "workingPanel.overview.skills.desc": "此 Agent 可用的技能",
"workingPanel.overview.title": "概览",
"workingPanel.overview.viewAll": "查看全部",
"workingPanel.overview.workspace.empty": "尚未选择工作区",
diff --git a/packages/electron-client-ipc/src/types/browserSidebar.ts b/packages/electron-client-ipc/src/types/browserSidebar.ts
index fa9882431f9..1f53243e509 100644
--- a/packages/electron-client-ipc/src/types/browserSidebar.ts
+++ b/packages/electron-client-ipc/src/types/browserSidebar.ts
@@ -33,6 +33,7 @@ export interface BrowserSidebarState {
canGoBack: boolean;
canGoForward: boolean;
error?: string;
+ faviconUrl?: string;
isLoading: boolean;
sessionId: string;
title: string;
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 3ff3166af9d..218e08b3d4c 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -1627,12 +1627,11 @@ export default {
'workingPanel.overview.environment': 'Environment',
'workingPanel.overview.environmentError': 'Could not load the repository status',
'workingPanel.overview.execution.device': 'Connected device',
+ 'workingPanel.overview.documents.desc': 'Documents available to this agent',
'workingPanel.overview.execution.local': 'This device',
- 'workingPanel.overview.manage': 'Manage',
'workingPanel.overview.outputs': 'Outputs',
'workingPanel.overview.resources': 'Resources',
- 'workingPanel.overview.resources.desc': 'Documents and skills available to this agent',
- 'workingPanel.overview.resources.title': 'Agent resources',
+ 'workingPanel.overview.skills.desc': 'Skills available to this agent',
'workingPanel.overview.title': 'Overview',
'workingPanel.overview.viewAll': 'View all',
'workingPanel.overview.workspace.empty': 'No workspace selected',
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/index.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/index.tsx
index 13743d66f9b..84d2a2a3f75 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/index.tsx
@@ -32,6 +32,7 @@ import {
buildScreenshotFileName,
createElementContext,
dataUrlToFile,
+ getBrowserViewportRect,
normalizeBrowserUrl,
} from './utils';
@@ -91,7 +92,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
width: 100%;
min-height: 0;
- background: ${cssVar.colorBgLayout};
+ background: ${cssVar.colorBgContainer};
`,
toolbar: css`
position: relative;
@@ -153,10 +154,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
interface BrowserPaneProps {
/** The conversation the chat input belongs to — screenshots are attached there. */
agentId?: string;
+ onMetadataChange?: (metadata: { faviconUrl?: string; title: string; url: string }) => void;
sessionId: string;
}
-const BrowserPane = memo<BrowserPaneProps>(({ agentId, sessionId }) => {
+const BrowserPane = memo<BrowserPaneProps>(({ agentId, onMetadataChange, sessionId }) => {
const { t } = useTranslation('chat');
const state = useBrowserSidebarState(sessionId);
const [address, setAddress] = useState('');
@@ -177,6 +179,10 @@ const BrowserPane = memo<BrowserPaneProps>(({ agentId, sessionId }) => {
// navigated it — including an agent the user has never watched.
const hasPage = state.attached || (!!state.url && state.url !== 'about:blank');
+ useEffect(() => {
+ onMetadataChange?.({ faviconUrl: state.faviconUrl, title: state.title, url: state.url });
+ }, [onMetadataChange, state.faviconUrl, state.title, state.url]);
+
// The overlay is drawn inside the page (a WebContentsView paints above all
// renderer DOM, so it can't be drawn here any more) — hand the copy over.
useEffect(() => {
@@ -201,7 +207,7 @@ const BrowserPane = memo<BrowserPaneProps>(({ agentId, sessionId }) => {
const tick = () => {
const element = viewportRef.current;
if (element) {
- const rect = element.getBoundingClientRect();
+ const rect = getBrowserViewportRect(element.getBoundingClientRect());
const visible = rect.width >= 1 && rect.height >= 1;
// devicePixelRatio tracks the app zoom level, and the main process turns
// this CSS rect into DIP with the zoom factor. Without it in the key, a
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.test.ts b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.test.ts
index c24ce40b487..c862032372e 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.test.ts
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.test.ts
@@ -4,9 +4,30 @@ import {
buildScreenshotFileName,
createElementContext,
dataUrlToFile,
+ getBrowserViewportRect,
normalizeBrowserUrl,
} from './utils';
+describe('getBrowserViewportRect', () => {
+ it('leaves the sidebar resize handle outside the native browser viewport', () => {
+ expect(getBrowserViewportRect({ height: 640, width: 480, x: 900, y: 80 })).toEqual({
+ height: 640,
+ width: 472,
+ x: 908,
+ y: 80,
+ });
+ });
+
+ it('never reports a negative viewport width for a collapsed panel', () => {
+ expect(getBrowserViewportRect({ height: 0, width: 0, x: 1200, y: 80 })).toEqual({
+ height: 0,
+ width: 0,
+ x: 1208,
+ y: 80,
+ });
+ });
+});
+
describe('normalizeBrowserUrl', () => {
it('keeps explicit http URLs', () => {
expect(normalizeBrowserUrl('https://lobehub.com')).toBe('https://lobehub.com');
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.ts b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.ts
index a637ee6a02b..0fb03006f4f 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.ts
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Browser/utils.ts
@@ -4,6 +4,22 @@ import { DEFAULT_BROWSER_URL } from './const';
const HTTP_URL_PATTERN = /^https?:\/\//i;
const LOCAL_URL_PATTERN = /^(?:localhost|127(?:\.\d{1,3}){3}|\[?::1\]?)(?::\d+)?(?:[/?#].*)?$/i;
+const VIEWPORT_RESIZE_GUTTER = 8;
+
+interface BrowserViewportRect {
+ height: number;
+ width: number;
+ x: number;
+ y: number;
+}
+
+/** Keep the native WebContentsView clear of the sidebar's left resize handle. */
+export const getBrowserViewportRect = (rect: BrowserViewportRect): BrowserViewportRect => ({
+ height: rect.height,
+ width: Math.max(0, rect.width - VIEWPORT_RESIZE_GUTTER),
+ x: rect.x + VIEWPORT_RESIZE_GUTTER,
+ y: rect.y,
+});
export const normalizeBrowserUrl = (value?: string): string => {
const text = value?.trim();
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Overview/index.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Overview/index.tsx
index f14bae0a03c..0ca99440b27 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Overview/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/Overview/index.tsx
@@ -2,13 +2,13 @@
import { Center, Empty, Flexbox, Icon, type IconProps, Skeleton, Tag, Text } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
+import { SkillsIcon } from '@lobehub/ui/icons';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import {
BoxesIcon,
- ChevronRightIcon,
ClipboardListIcon,
+ FileTextIcon,
FolderGit2Icon,
- FolderOpenIcon,
GitBranchIcon,
LaptopIcon,
RefreshCwIcon,
@@ -18,6 +18,8 @@ import { useTranslation } from 'react-i18next';
import { getAllWorkSummaries } from '@/features/Conversation/store/slices/data/workSummaries';
import WorkSummaryCard from '@/features/Work/WorkSummaryCard';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors } from '@/store/agent/selectors';
import { useChatStore } from '@/store/chat';
import { dbMessageSelectors } from '@/store/chat/selectors';
import { useFetchGitAheadBehind, useFetchGitBranch, useReviewPatches } from '@/store/device';
@@ -113,6 +115,7 @@ const OverviewRowLead = ({ children, icon }: { children: ReactNode; icon: IconPr
const Overview = memo<OverviewProps>(
({ active, deviceId, onOpenTab, repoType, workingDirectory }) => {
const { t } = useTranslation('chat');
+ const isHetero = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
const topicId = useChatStore((s) => s.activeTopicId);
const threadId = useChatStore((s) => s.activeThreadId);
const works = useChatStore((s) =>
@@ -199,7 +202,6 @@ const Overview = memo<OverviewProps>(
</Text>
</Flexbox>
</OverviewRowLead>
- {workingDirectory && <Icon icon={ChevronRightIcon} size={14} />}
</Flexbox>
{repoType && workingDirectory && isGitLoading ? (
@@ -259,7 +261,6 @@ const Overview = memo<OverviewProps>(
<span className={styles.changeDeletions}>−{changeStats.deletions}</span>
</Flexbox>
)}
- <Icon icon={ChevronRightIcon} size={14} />
</Flexbox>
</>
) : null}
@@ -294,27 +295,41 @@ const Overview = memo<OverviewProps>(
justify={'space-between'}
>
<span className={styles.sectionTitle}>{t('workingPanel.overview.resources')}</span>
- <Button size={'small'} type={'text'} onClick={() => onOpenTab('resources')}>
- {t('workingPanel.overview.manage')}
- </Button>
</Flexbox>
<Flexbox
horizontal
align={'flex-start'}
className={styles.row}
gap={10}
- onClick={() => onOpenTab('resources')}
+ onClick={() => onOpenTab('skills')}
>
- <OverviewRowLead icon={FolderOpenIcon}>
+ <OverviewRowLead icon={SkillsIcon}>
<Flexbox flex={1}>
- <Text weight={500}>{t('workingPanel.overview.resources.title')}</Text>
+ <Text weight={500}>{t('workingPanel.resources.filter.skills')}</Text>
<Text color={cssVar.colorTextTertiary} fontSize={12}>
- {t('workingPanel.overview.resources.desc')}
+ {t('workingPanel.overview.skills.desc')}
</Text>
</Flexbox>
</OverviewRowLead>
- <Icon icon={ChevronRightIcon} size={14} />
</Flexbox>
+ {!isHetero && (
+ <Flexbox
+ horizontal
+ align={'flex-start'}
+ className={styles.row}
+ gap={10}
+ onClick={() => onOpenTab('documents')}
+ >
+ <OverviewRowLead icon={FileTextIcon}>
+ <Flexbox flex={1}>
+ <Text weight={500}>{t('workingPanel.resources.filter.documents')}</Text>
+ <Text color={cssVar.colorTextTertiary} fontSize={12}>
+ {t('workingPanel.overview.documents.desc')}
+ </Text>
+ </Flexbox>
+ </OverviewRowLead>
+ </Flexbox>
+ )}
</Flexbox>
{!topicId && visibleWorks.length === 0 && !workingDirectory && (
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
index 180bbed7308..1ca44d880aa 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/AgentDocumentsGroup.tsx
@@ -44,7 +44,7 @@ import UserLevelSkills, { useUserSkills } from './UserLevelSkills';
dayjs.extend(relativeTime);
-type ResourceFilter = 'skills' | 'documents' | 'web';
+export type ResourceFilter = 'skills' | 'documents' | 'web';
type DocumentOpenMode = 'portal' | 'route';
const styles = createStaticStyles(({ css, cssVar }) => ({
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/index.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/index.tsx
index cb6de20782d..1a0a6afc952 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/ResourcesSection/index.tsx
@@ -5,21 +5,23 @@ import { useEffectiveWorkingDirectory } from '@/hooks/useEffectiveWorkingDirecto
import { useAgentStore } from '@/store/agent';
import { agentSelectors } from '@/store/agent/selectors';
-import AgentDocumentsGroup from './AgentDocumentsGroup';
+import AgentDocumentsGroup, { type ResourceFilter } from './AgentDocumentsGroup';
import SkillsGroup from './SkillsGroup';
interface ResourcesSectionProps {
/** Bound remote device id (device mode); skills are then scanned over RPC. */
deviceId?: string;
/**
- * Whether this pane is actually visible (panel open + resources tab active).
+ * Whether this pane is actually visible (panel open + this tab active).
* Gates the agent-document fetch so a collapsed sidebar doesn't pull the full
* list on conversation enter.
*/
enabled?: boolean;
+ /** Which resource kind this pane shows — skills / documents / web are separate tabs. */
+ filter: ResourceFilter;
}
-const ResourcesSection = memo<ResourcesSectionProps>(({ deviceId, enabled = true }) => {
+const ResourcesSection = memo<ResourcesSectionProps>(({ deviceId, enabled = true, filter }) => {
const isHetero = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
const activeAgentId = useAgentStore((s) => s.activeAgentId);
// Resolve the cwd the same way the runtime bar / WorkingSidebar do
@@ -31,20 +33,22 @@ const ResourcesSection = memo<ResourcesSectionProps>(({ deviceId, enabled = true
return (
<Flexbox
- data-testid="workspace-resources"
+ data-testid={`workspace-${filter}`}
flex={1}
gap={16}
paddingBlock={8}
paddingInline={'8px 12px'}
style={{ minHeight: 0 }}
>
- {isHetero && workingDirectory && (
+ {isHetero && workingDirectory && filter === 'skills' && (
<SkillsGroup deviceId={deviceId} workingDirectory={workingDirectory} />
)}
{!isHetero && (
<AgentDocumentsGroup
+ activeFilter={filter}
deviceId={deviceId}
enabled={enabled}
+ showFilterTabs={false}
style={{ flex: 1, minHeight: 0 }}
workingDirectory={workingDirectory}
/>
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/WorkspaceTab.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/WorkspaceTab.tsx
index 2258429204a..2445dfc250d 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/WorkspaceTab.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/WorkspaceTab.tsx
@@ -24,8 +24,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
color: ${cssVar.colorTextTertiary};
+ opacity: 0;
background: transparent;
+ transition: opacity 0.15s;
+
&:hover {
color: ${cssVar.colorText};
background: ${cssVar.colorFillSecondary};
@@ -45,6 +48,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
&:hover {
background: ${cssVar.colorFillSecondary};
}
+
+ &:hover [data-tab-close],
+ &:focus-within [data-tab-close] {
+ opacity: 1;
+ }
`,
containerActive: css`
background: ${cssVar.colorFillTertiary};
@@ -62,6 +70,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
color: ${cssVar.colorTextSecondary};
`,
+ label: css`
+ overflow: hidden;
+ max-width: 160px;
+ text-overflow: ellipsis;
+ `,
tab: css`
cursor: pointer;
@@ -81,9 +94,12 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
&:hover {
color: ${cssVar.colorText};
}
- `,
- tabActive: css`
- color: ${cssVar.colorText};
+
+ /* attribute selector outranks the base class so the active color can't lose
+ to stylesheet ordering */
+ &[aria-pressed='true'] {
+ color: ${cssVar.colorText};
+ }
`,
tabClosable: css`
padding-inline-end: 30px;
@@ -101,6 +117,7 @@ interface WorkspaceTabProps {
contextMenuItems?: ContextMenuItem[];
fixed?: boolean;
icon: IconProps['icon'];
+ iconNode?: ReactNode;
label: ReactNode;
onClose?: () => void;
onSelect: () => void;
@@ -116,6 +133,7 @@ const WorkspaceTab = memo<WorkspaceTabProps>(
contextMenuItems,
fixed,
icon,
+ iconNode,
label,
onClose,
onSelect,
@@ -130,14 +148,14 @@ const WorkspaceTab = memo<WorkspaceTabProps>(
>
<button
aria-pressed={active}
- className={`${styles.tab} ${active ? styles.tabActive : ''} ${!fixed && (onClose || pinned) ? styles.tabClosable : ''}`}
+ className={`${styles.tab} ${!fixed && (onClose || pinned) ? styles.tabClosable : ''}`}
data-tab-key={tabKey}
type="button"
onClick={onSelect}
>
<span className={styles.trigger}>
- <Icon icon={icon} size={14} />
- {label}
+ {iconNode ?? <Icon icon={icon} size={14} />}
+ <span className={styles.label}>{label}</span>
</span>
</button>
{!fixed && pinned ? (
@@ -145,7 +163,13 @@ const WorkspaceTab = memo<WorkspaceTabProps>(
<Icon icon={PinIcon} size={12} />
</span>
) : !fixed && onClose ? (
- <button aria-label={closeLabel} className={styles.close} type="button" onClick={onClose}>
+ <button
+ data-tab-close
+ aria-label={closeLabel}
+ className={styles.close}
+ type="button"
+ onClick={onClose}
+ >
<Icon icon={XIcon} size={12} />
</button>
) : null}
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
index 507a4e1c802..90e70805aec 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
@@ -53,12 +53,20 @@ const paramsSectionState = vi.hoisted(() => ({
suspend: false,
}));
+const browserPanes = vi.hoisted(() => ({
+ current: [] as {
+ onMetadataChange?: (metadata: { faviconUrl?: string; title: string; url: string }) => void;
+ sessionId: string;
+ }[],
+}));
+
const localStorageState = vi.hoisted(() => ({
openTabsByContext: {} as Record<string, string[]>,
pinnedTabsByAgent: {} as Record<string, string[]>,
}));
const dropdownMenuState = vi.hoisted(() => ({
+ items: [] as any[],
onOpenChangeComplete: undefined as ((open: boolean) => void) | undefined,
}));
@@ -100,6 +108,12 @@ vi.mock('../ParamsSection', () => ({
},
}));
vi.mock('../WorksSection', () => ({ default: () => <div /> }));
+vi.mock('../Browser', () => ({
+ default: (props: (typeof browserPanes.current)[number]) => {
+ browserPanes.current.push(props);
+ return <div data-testid={`browser-pane-${props.sessionId}`} />;
+ },
+}));
vi.mock('../Overview', () => ({
default: ({ onOpenTab }: { onOpenTab: (tab: string) => void }) => (
<button type="button" onClick={() => onOpenTab('review')}>
@@ -181,6 +195,11 @@ vi.mock('@/helpers/executionTarget', () => ({
) => (options.workspaceScoped ? 'device' : (agencyConfig?.executionTarget ?? 'local')),
}));
vi.mock('@/helpers/gatewayMode', () => ({ useIsGatewayModeEnabled: () => false }));
+vi.mock('@/const/version', () => ({ isDesktop: true }));
+vi.mock('@/store/user', () => ({ useUserStore: () => true }));
+vi.mock('@/store/user/selectors', () => ({
+ labPreferSelectors: { enableInAppBrowser: () => true },
+}));
vi.mock('react-i18next', () => ({
useTranslation: () => ({ t: (key: string) => key }),
@@ -231,6 +250,7 @@ vi.mock('@lobehub/ui/base-ui', async () => {
}) => {
const [open, setOpen] = useState(false);
const menuItems = items.flatMap((item) => item.children ?? []);
+ dropdownMenuState.items = items;
dropdownMenuState.onOpenChangeComplete = onOpenChangeComplete;
return (
@@ -258,6 +278,7 @@ beforeEach(() => {
return 1;
});
businessTabs.current = [];
+ browserPanes.current = [];
paramsSectionState.suspend = false;
localStorageState.openTabsByContext = { 'draft:default:none': ['params'] };
localStorageState.pinnedTabsByAgent = {};
@@ -272,6 +293,7 @@ beforeEach(() => {
reviewState.showTree = false;
reviewState.workingDirectory = undefined;
dropdownMenuState.onOpenChangeComplete = undefined;
+ dropdownMenuState.items = [];
globalStore.status.workingSidebarWidth = 360;
globalStore.status.showRightPanel = true;
globalStore.status.workingSidebarTab = 'params';
@@ -545,7 +567,7 @@ describe('AgentWorkingSidebar — tab strip', () => {
'true',
);
expect(
- screen.queryByRole('button', { name: 'workingPanel.resources' }),
+ screen.queryByRole('button', { name: 'workingPanel.resources.filter.skills' }),
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', { name: 'workingPanel.works.title' }),
@@ -637,7 +659,7 @@ describe('AgentWorkingSidebar — tab strip', () => {
it('preserves agent-pinned tabs when closing other tabs', () => {
agentStore.activeAgentId = 'agent';
localStorageState.openTabsByContext = {
- 'draft:agent:none': ['resources', 'works', 'params'],
+ 'draft:agent:none': ['skills', 'works', 'params'],
};
localStorageState.pinnedTabsByAgent = { agent: ['works'] };
globalStore.status.workingSidebarTab = 'params';
@@ -648,7 +670,7 @@ describe('AgentWorkingSidebar — tab strip', () => {
expect(screen.getByRole('button', { name: 'workingPanel.works.title' })).toBeInTheDocument();
expect(
- screen.queryByRole('button', { name: 'workingPanel.resources' }),
+ screen.queryByRole('button', { name: 'workingPanel.resources.filter.skills' }),
).not.toBeInTheDocument();
expect(
screen.getByRole('button', { name: 'settingModel.params.panel.tab' }),
@@ -672,6 +694,64 @@ describe('AgentWorkingSidebar — tab strip', () => {
expect(globalStore.setWorkingSidebarTab).toHaveBeenCalledWith('review');
});
+ it('creates an independent browser tab every time Browser is chosen', async () => {
+ localStorageState.openTabsByContext = {};
+ globalStore.status.workingSidebarTab = 'overview';
+
+ const { container } = render(<AgentWorkingSidebar />);
+ fireEvent.click(screen.getByRole('button', { name: 'workingPanel.openMenu.title' }));
+ fireEvent.click(screen.getByRole('button', { name: 'workingPanel.browser.title' }));
+ await waitFor(() => {
+ expect(container.querySelectorAll('button[data-tab-key^="browser"]')).toHaveLength(1);
+ });
+ fireEvent.click(
+ screen
+ .getAllByRole('button', { name: 'workingPanel.browser.title' })
+ .find((button) => !button.hasAttribute('aria-pressed'))!,
+ );
+
+ await waitFor(() => {
+ expect(container.querySelectorAll('button[data-tab-key^="browser"]')).toHaveLength(2);
+ });
+ const sessionIds = [...new Set(browserPanes.current.map((pane) => pane.sessionId))];
+ expect(sessionIds).toHaveLength(2);
+ expect(sessionIds).toContain('draft-agent:default');
+ expect(sessionIds.find((id) => id !== 'draft-agent:default')).toMatch(
+ /^draft-agent:default:tab:/,
+ );
+ });
+
+ it('uses browser page metadata for the tab title and favicon', async () => {
+ localStorageState.openTabsByContext = { 'draft:default:none': ['browser'] };
+ globalStore.status.workingSidebarTab = 'browser';
+
+ const { container } = render(<AgentWorkingSidebar />);
+ await waitFor(() => expect(browserPanes.current.at(-1)).toBeDefined());
+ act(() => {
+ browserPanes.current.at(-1)?.onMetadataChange?.({
+ faviconUrl: 'https://example.com/favicon.ico',
+ title: 'Example Domain',
+ url: 'https://example.com',
+ });
+ });
+
+ expect(screen.getByRole('button', { name: 'Example Domain' })).toBeInTheDocument();
+ expect(
+ container.querySelector('img[src="https://example.com/favicon.ico"]'),
+ ).toBeInTheDocument();
+ });
+
+ it('preserves natural casing for grouped menu labels', () => {
+ render(<AgentWorkingSidebar />);
+
+ const groups = dropdownMenuState.items.filter((item) => item.type === 'group');
+
+ expect(groups.length).toBeGreaterThan(0);
+ for (const group of groups) {
+ expect(group.label.props.style).toEqual({ textTransform: 'none' });
+ }
+ });
+
it('moves focus to a tab opened from the grouped menu', async () => {
localStorageState.openTabsByContext = {};
globalStore.status.workingSidebarTab = 'overview';
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/index.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/index.tsx
index eb95edae2f1..b3a17148cef 100644
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/index.tsx
@@ -1,13 +1,16 @@
-import { ActionIcon, Flexbox, Icon, Skeleton } from '@lobehub/ui';
+import { nanoid } from '@lobechat/utils';
+import { ActionIcon, Flexbox, Icon, type IconProps, Skeleton } from '@lobehub/ui';
import { type ContextMenuItem, type DropdownItem, DropdownMenu } from '@lobehub/ui/base-ui';
+import { SkillsIcon } from '@lobehub/ui/icons';
import { createStaticStyles } from 'antd-style';
import {
BoxesIcon,
CheckIcon,
ClipboardListIcon,
FilesIcon,
- FolderOpenIcon,
+ FileTextIcon,
Globe2Icon,
+ GlobeIcon,
LayoutDashboardIcon,
PanelRightCloseIcon,
PanelsTopLeftIcon,
@@ -86,13 +89,21 @@ const styles = createStaticStyles(({ css }) => ({
width: 100%;
padding: 16px;
`,
+ add: css`
+ flex-shrink: 0;
+ `,
+ favicon: css`
+ width: 14px;
+ height: 14px;
+ border-radius: 2px;
+ object-fit: contain;
+ `,
tabs: css`
overflow-anchor: none;
scrollbar-width: none;
overflow-x: auto;
display: flex;
- flex: 1;
gap: 4px;
align-items: center;
@@ -102,6 +113,15 @@ const styles = createStaticStyles(({ css }) => ({
display: none;
}
`,
+ /* keeps the add button glued to the last tab while the strip itself scrolls */
+ tabsArea: css`
+ display: flex;
+ flex: 1;
+ gap: 4px;
+ align-items: center;
+
+ min-width: 0;
+ `,
}));
const REVIEW_TREE_STORAGE_KEY = 'lobechat-review-tree';
@@ -112,11 +132,22 @@ const MAX_PANEL_WIDTH = 1200;
const TWO_PANE_MIN_WIDTH = 560;
interface SidebarTabDescriptor {
- icon: typeof LayoutDashboardIcon;
+ icon: IconProps['icon'];
+ iconNode?: ReactNode;
key: string;
label: ReactNode;
}
+interface BrowserTabMetadata {
+ faviconUrl?: string;
+ title: string;
+ url: string;
+}
+
+const BROWSER_TAB_KEY = 'browser';
+const BROWSER_TAB_PREFIX = 'browser:';
+const isBrowserTab = (tab: string) => tab === BROWSER_TAB_KEY || tab.startsWith(BROWSER_TAB_PREFIX);
+
const AgentWorkingSidebar = memo(() => {
const { t } = useTranslation(['chat', 'setting']);
const [
@@ -196,11 +227,26 @@ const AgentWorkingSidebar = memo(() => {
const browserSessionId = topicId
? `topic:${topicId}`
: `draft-agent:${activeAgentId ?? 'default'}`;
+ const [browserTabMetadata, setBrowserTabMetadata] = useState<Record<string, BrowserTabMetadata>>(
+ {},
+ );
const businessTabs = useBusinessWorkingSidebarTabs({ activeAgentId, topicId });
const tabDescriptors = useMemo<SidebarTabDescriptor[]>(
() => [
- { icon: FolderOpenIcon, key: 'resources', label: t('workingPanel.resources') },
+ { icon: SkillsIcon, key: 'skills', label: t('workingPanel.resources.filter.skills') },
+ // Documents / web resources are agent-document features — heterogeneous
+ // agents only carry filesystem skills, so hide both tabs there.
+ ...(isHetero
+ ? []
+ : [
+ {
+ icon: FileTextIcon,
+ key: 'documents',
+ label: t('workingPanel.resources.filter.documents'),
+ },
+ { icon: GlobeIcon, key: 'web', label: t('workingPanel.resources.filter.web') },
+ ]),
{ icon: BoxesIcon, key: 'works', label: t('workingPanel.works.title') },
...(reviewAvailable
? [{ icon: ClipboardListIcon, key: 'review', label: t('workingPanel.review.title') }]
@@ -226,13 +272,17 @@ const AgentWorkingSidebar = memo(() => {
label: tab.label,
})),
],
- [browserAvailable, businessTabs, filesAvailable, paramsAvailable, reviewAvailable, t],
+ [browserAvailable, businessTabs, filesAvailable, isHetero, paramsAvailable, reviewAvailable, t],
);
const availableTabs = useMemo(
() => new Map(tabDescriptors.map((tab) => [tab.key, tab])),
[tabDescriptors],
);
const availableTabsSignature = JSON.stringify(tabDescriptors.map((tab) => tab.key));
+ const isAvailableTab = useCallback(
+ (tab: string) => availableTabs.has(tab) || (browserAvailable && isBrowserTab(tab)),
+ [availableTabs, browserAvailable],
+ );
const openTabsContextKey = topicId
? `topic:${topicId}`
: `draft:${activeAgentId ?? 'default'}:${workingDirectory ?? 'none'}`;
@@ -250,18 +300,21 @@ const AgentWorkingSidebar = memo(() => {
tabRequest &&
lastTabRequestRef.current !== tabRequest.nonce &&
tabRequest.tab !== 'overview' &&
- availableTabs.has(tabRequest.tab)
+ isAvailableTab(tabRequest.tab)
? tabRequest.tab
: undefined;
const pinnedTabs = useMemo(
- () => (pinnedTabsByAgent[pinnedTabsAgentKey] ?? []).filter((tab) => availableTabs.has(tab)),
- [availableTabs, pinnedTabsAgentKey, pinnedTabsByAgent],
+ () =>
+ (pinnedTabsByAgent[pinnedTabsAgentKey] ?? []).filter(
+ (tab) => !isBrowserTab(tab) && isAvailableTab(tab),
+ ),
+ [isAvailableTab, pinnedTabsAgentKey, pinnedTabsByAgent],
);
const pinnedTabsSet = useMemo(() => new Set(pinnedTabs), [pinnedTabs]);
const openedTabs = Array.from(
new Set([
...pinnedTabs,
- ...(openTabsByContext[openTabsContextKey] ?? []).filter((tab) => availableTabs.has(tab)),
+ ...(openTabsByContext[openTabsContextKey] ?? []).filter(isAvailableTab),
...(requestedTab ? [requestedTab] : []),
]),
);
@@ -289,15 +342,31 @@ const AgentWorkingSidebar = memo(() => {
const openTab = useCallback(
(tab: string) => {
- if (tab !== 'overview' && !availableTabs.has(tab)) return;
+ if (tab !== 'overview' && !isAvailableTab(tab)) return;
if (tab !== 'overview') {
updateOpenedTabs((current) => (current.includes(tab) ? current : [...current, tab]));
}
setWorkingSidebarTab(tab);
},
- [availableTabs, setWorkingSidebarTab, updateOpenedTabs],
+ [isAvailableTab, setWorkingSidebarTab, updateOpenedTabs],
);
+ const openBrowserTab = useCallback(() => {
+ if (!browserAvailable) return undefined;
+ const currentBrowserTabs = (openTabsByContext[openTabsContextKey] ?? []).filter(isBrowserTab);
+ const tab =
+ currentBrowserTabs.length === 0 ? BROWSER_TAB_KEY : `${BROWSER_TAB_PREFIX}${nanoid(8)}`;
+ updateOpenedTabs((current) => [...current, tab]);
+ setWorkingSidebarTab(tab);
+ return tab;
+ }, [
+ browserAvailable,
+ openTabsByContext,
+ openTabsContextKey,
+ setWorkingSidebarTab,
+ updateOpenedTabs,
+ ]);
+
const activeTab: string =
storedTab && (storedTab === 'overview' || openedTabs.includes(storedTab))
? storedTab
@@ -305,7 +374,7 @@ const AgentWorkingSidebar = memo(() => {
useEffect(() => {
if (!tabRequest || lastTabRequestRef.current === tabRequest.nonce) return;
- if (tabRequest.tab !== 'overview' && !availableTabs.has(tabRequest.tab)) return;
+ if (tabRequest.tab !== 'overview' && !isAvailableTab(tabRequest.tab)) return;
lastTabRequestRef.current = tabRequest.nonce;
if (tabRequest.tab !== 'overview') {
@@ -313,11 +382,11 @@ const AgentWorkingSidebar = memo(() => {
current.includes(tabRequest.tab) ? current : [...current, tabRequest.tab],
);
}
- }, [availableTabs, availableTabsSignature, tabRequest, updateOpenedTabs]);
+ }, [availableTabsSignature, isAvailableTab, tabRequest, updateOpenedTabs]);
const pinTab = useCallback(
(tab: string) => {
- if (!availableTabs.has(tab)) return;
+ if (!availableTabs.has(tab) || isBrowserTab(tab)) return;
updateOpenedTabs((current) => (current.includes(tab) ? current : [...current, tab]));
updatePinnedTabs((current) => (current.includes(tab) ? current : [...current, tab]));
},
@@ -348,7 +417,20 @@ const AgentWorkingSidebar = memo(() => {
const closeTab = useCallback((tab: string) => closeTabs([tab]), [closeTabs]);
const displayedTabs = openedTabs
- .map((tab) => availableTabs.get(tab))
+ .map((tab): SidebarTabDescriptor | undefined => {
+ if (!isBrowserTab(tab)) return availableTabs.get(tab);
+ const metadata = browserTabMetadata[`${openTabsContextKey}:${tab}`];
+ const fallbackLabel = t('workingPanel.browser.title');
+ const label = metadata?.title?.trim() || fallbackLabel;
+ return {
+ icon: Globe2Icon,
+ iconNode: metadata?.faviconUrl ? (
+ <img alt="" className={styles.favicon} src={metadata.faviconUrl} />
+ ) : undefined,
+ key: tab,
+ label,
+ };
+ })
.filter((tab): tab is SidebarTabDescriptor => Boolean(tab));
const createTabContextMenuItems = useCallback(
(tab: string, index: number): ContextMenuItem[] => {
@@ -359,13 +441,17 @@ const AgentWorkingSidebar = memo(() => {
const hasClosable = (tabs: string[]) => tabs.some((item) => !pinnedTabsSet.has(item));
return [
- {
- icon: pinned ? PinOffIcon : PinIcon,
- key: pinned ? 'unpin' : 'pin',
- label: t(pinned ? 'workingPanel.tabs.unpin' : 'workingPanel.tabs.pin'),
- onClick: () => (pinned ? unpinTab(tab) : pinTab(tab)),
- },
- { type: 'divider' },
+ ...(!isBrowserTab(tab)
+ ? [
+ {
+ icon: pinned ? PinOffIcon : PinIcon,
+ key: pinned ? 'unpin' : 'pin',
+ label: t(pinned ? 'workingPanel.tabs.unpin' : 'workingPanel.tabs.pin'),
+ onClick: () => (pinned ? unpinTab(tab) : pinTab(tab)),
+ } as ContextMenuItem,
+ { type: 'divider' as const },
+ ]
+ : []),
{
disabled: pinned,
icon: XIcon,
@@ -487,12 +573,6 @@ const AgentWorkingSidebar = memo(() => {
REVIEW_TREE_STORAGE_KEY,
false,
);
- // Mount the browser pane on first activation only (no eager page load), then
- // keep it mounted-but-hidden so the page survives tab switches.
- const [browserActivated, setBrowserActivated] = useState(false);
- useEffect(() => {
- if (activeTab === 'browser') setBrowserActivated(true);
- }, [activeTab]);
const reviewTwoPane = activeTab === 'review' && reviewAvailable && showReviewTree;
const displayWidth = reviewTwoPane ? Math.max(storedWidth, TWO_PANE_MIN_WIDTH) : storedWidth;
const openMenuItems = useMemo<DropdownItem[]>(() => {
@@ -500,6 +580,18 @@ const AgentWorkingSidebar = memo(() => {
const tab = availableTabs.get(key);
if (!tab) return undefined;
+ if (key === BROWSER_TAB_KEY) {
+ return {
+ icon: <Icon icon={tab.icon} size={14} />,
+ key,
+ label: tab.label,
+ onClick: () => {
+ const browserTab = openBrowserTab();
+ if (browserTab) requestTabFocus(browserTab);
+ },
+ };
+ }
+
return {
icon: <Icon icon={openedTabs.includes(key) ? CheckIcon : tab.icon} size={14} />,
key,
@@ -510,16 +602,21 @@ const AgentWorkingSidebar = memo(() => {
},
};
};
+ const groupLabel = (label: string) => <span style={{ textTransform: 'none' }}>{label}</span>;
const group = (key: string, label: string, keys: string[]): DropdownItem | undefined => {
const children = keys.map(itemOf).filter((item): item is DropdownItem => Boolean(item));
- return children.length ? { children, key, label, type: 'group' } : undefined;
+ return children.length
+ ? { children, key, label: groupLabel(label), type: 'group' }
+ : undefined;
};
const workspaceGroup = group('workspace', t('workingPanel.openMenu.workspace'), [
'review',
'files',
'works',
- 'resources',
+ 'skills',
+ 'documents',
+ 'web',
...businessTabs.map((tab) => tab.key),
]);
const toolChildren = [itemOf('browser')].filter((item): item is DropdownItem => Boolean(item));
@@ -535,7 +632,7 @@ const AgentWorkingSidebar = memo(() => {
? {
children: toolChildren,
key: 'tools',
- label: t('workingPanel.openMenu.tools'),
+ label: groupLabel(t('workingPanel.openMenu.tools')),
type: 'group' as const,
}
: undefined;
@@ -551,6 +648,7 @@ const AgentWorkingSidebar = memo(() => {
}, [
availableTabs,
businessTabs,
+ openBrowserTab,
openTab,
openedTabs,
requestTabFocus,
@@ -585,47 +683,51 @@ const AgentWorkingSidebar = memo(() => {
justify={'space-between'}
paddingInline={4}
>
- <div className={styles.tabs} ref={tabsRef}>
- <WorkspaceTab
- fixed
- active={activeTab === 'overview'}
- contextMenuItems={overviewContextMenuItems}
- icon={LayoutDashboardIcon}
- label={t('workingPanel.overview.title')}
- tabKey={'overview'}
- onSelect={() => openTab('overview')}
- />
- {displayedTabs.map((tab, index) => (
+ <div className={styles.tabsArea}>
+ <div className={styles.tabs} ref={tabsRef}>
<WorkspaceTab
- active={activeTab === tab.key}
- closeLabel={t('workingPanel.tabs.close')}
- contextMenuItems={createTabContextMenuItems(tab.key, index)}
- icon={tab.icon}
- key={tab.key}
- label={tab.label}
- pinned={pinnedTabsSet.has(tab.key)}
- pinnedLabel={t('workingPanel.tabs.pinned')}
- tabKey={tab.key}
- onClose={pinnedTabsSet.has(tab.key) ? undefined : () => closeTab(tab.key)}
- onSelect={() => openTab(tab.key)}
+ fixed
+ active={activeTab === 'overview'}
+ contextMenuItems={overviewContextMenuItems}
+ icon={LayoutDashboardIcon}
+ label={t('workingPanel.overview.title')}
+ tabKey={'overview'}
+ onSelect={() => openTab('overview')}
+ />
+ {displayedTabs.map((tab, index) => (
+ <WorkspaceTab
+ active={activeTab === tab.key}
+ closeLabel={t('workingPanel.tabs.close')}
+ contextMenuItems={createTabContextMenuItems(tab.key, index)}
+ icon={tab.icon}
+ iconNode={tab.iconNode}
+ key={tab.key}
+ label={tab.label}
+ pinned={pinnedTabsSet.has(tab.key)}
+ pinnedLabel={t('workingPanel.tabs.pinned')}
+ tabKey={tab.key}
+ onClose={pinnedTabsSet.has(tab.key) ? undefined : () => closeTab(tab.key)}
+ onSelect={() => openTab(tab.key)}
+ />
+ ))}
+ </div>
+ <DropdownMenu
+ items={openMenuItems}
+ placement={'bottomRight'}
+ onOpenChangeComplete={(open) => {
+ if (open) return;
+ if (pendingTabFocusRef.current) focusPendingTab();
+ else scrollActiveTabIntoView();
+ }}
+ >
+ <ActionIcon
+ className={styles.add}
+ icon={PlusIcon}
+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}
+ title={t('workingPanel.openMenu.title')}
/>
- ))}
+ </DropdownMenu>
</div>
- <DropdownMenu
- items={openMenuItems}
- placement={'bottomRight'}
- onOpenChangeComplete={(open) => {
- if (open) return;
- if (pendingTabFocusRef.current) focusPendingTab();
- else scrollActiveTabIntoView();
- }}
- >
- <ActionIcon
- icon={PlusIcon}
- size={DESKTOP_HEADER_ICON_SMALL_SIZE}
- title={t('workingPanel.openMenu.title')}
- />
- </DropdownMenu>
<ActionIcon
className={styles.close}
icon={PanelRightCloseIcon}
@@ -675,18 +777,35 @@ const AgentWorkingSidebar = memo(() => {
<Files deviceId={remoteDeviceId} workingDirectory={workingDirectory} />
</Flexbox>
)}
- {browserAvailable && browserActivated && (
- <Flexbox className={activeTab === 'browser' ? styles.pane : styles.paneHidden}>
- {/* Keyed by session: the pane holds per-session local state (webview,
- address bar), so an agent switch must remount it rather than leak the
- previous agent's page into the new agent's session. */}
- <BrowserPane
- agentId={activeAgentId}
- key={browserSessionId}
- sessionId={browserSessionId}
- />
- </Flexbox>
- )}
+ {browserAvailable &&
+ openedTabs.filter(isBrowserTab).map((tab) => {
+ const sessionId =
+ tab === BROWSER_TAB_KEY
+ ? browserSessionId
+ : `${browserSessionId}:tab:${tab.slice(BROWSER_TAB_PREFIX.length)}`;
+
+ return (
+ <Flexbox
+ className={activeTab === tab ? styles.pane : styles.paneHidden}
+ key={sessionId}
+ >
+ <BrowserPane
+ agentId={activeAgentId}
+ sessionId={sessionId}
+ onMetadataChange={(metadata) => {
+ const metadataKey = `${openTabsContextKey}:${tab}`;
+ setBrowserTabMetadata((current) =>
+ current[metadataKey]?.faviconUrl === metadata.faviconUrl &&
+ current[metadataKey]?.title === metadata.title &&
+ current[metadataKey]?.url === metadata.url
+ ? current
+ : { ...current, [metadataKey]: metadata },
+ );
+ }}
+ />
+ </Flexbox>
+ );
+ })}
{businessTabs.map((tab) => (
<Flexbox
className={activeTab === tab.key ? styles.pane : styles.paneHidden}
@@ -695,15 +814,19 @@ const AgentWorkingSidebar = memo(() => {
{tab.pane}
</Flexbox>
))}
- <Flexbox
- className={activeTab === 'resources' ? styles.pane : styles.paneHidden}
- width={'100%'}
- >
- <ResourcesSection
- deviceId={remoteDeviceId}
- enabled={showRightPanel && activeTab === 'resources'}
- />
- </Flexbox>
+ {['skills', ...(isHetero ? [] : ['documents', 'web'])].map((resourceTab) => (
+ <Flexbox
+ className={activeTab === resourceTab ? styles.pane : styles.paneHidden}
+ key={resourceTab}
+ width={'100%'}
+ >
+ <ResourcesSection
+ deviceId={remoteDeviceId}
+ enabled={showRightPanel && activeTab === resourceTab}
+ filter={resourceTab as 'skills' | 'documents' | 'web'}
+ />
+ </Flexbox>
+ ))}
<Flexbox className={activeTab === 'works' ? styles.pane : styles.paneHidden}>
<WorksSection active={showRightPanel && activeTab === 'works'} />
</Flexbox>
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 379700127db..ca4aec9545a 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -39,7 +39,15 @@ export enum GroupSettingsTabs {
// business builds may register extra sidebar tabs, so any string key is accepted
export type WorkingSidebarTab =
- 'browser' | 'files' | 'overview' | 'params' | 'resources' | 'review' | (string & {});
+ | 'browser'
+ | 'documents'
+ | 'files'
+ | 'overview'
+ | 'params'
+ | 'review'
+ | 'skills'
+ | 'web'
+ | (string & {});
export const DEFAULT_RESOURCE_MANAGER_COLUMN_WIDTHS = {
date: 160,