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.

πŸ› fix(heterogeneous-agents): refine execution target + topic sidebar attention grouping (#15574)

Arvin Xu441e0c5b7c2d
diff --git a/src/features/ChatInput/RuntimeConfig/DirIcon.tsx b/src/features/ChatInput/RuntimeConfig/DirIcon.tsx
new file mode 100644
index 00000000000..b88861787d8
--- /dev/null
+++ b/src/features/ChatInput/RuntimeConfig/DirIcon.tsx
@@ -0,0 +1,26 @@
+import { Github } from '@lobehub/icons';
+import { Icon } from '@lobehub/ui';
+import { cssVar } from 'antd-style';
+import { FolderIcon, GitBranchIcon } from 'lucide-react';
+import { memo } from 'react';
+
+interface DirIconProps {
+ /** Detected repo type β€” drives the glyph: GitHub mark, git branch, or a plain
+ * folder when the type is unknown. */
+ repoType?: 'git' | 'github';
+ size?: number;
+}
+
+/** Directory icon shared by every cwd surface (local / device / settings pickers,
+ * topic rows) so a `github` dir looks the same everywhere. */
+const DirIcon = memo<DirIconProps>(({ repoType, size = 16 }) => {
+ const iconStyle = { color: cssVar.colorTextTertiary, flex: 'none' as const };
+ if (repoType === 'github') return <Github size={size} style={iconStyle} />;
+ return (
+ <Icon icon={repoType === 'git' ? GitBranchIcon : FolderIcon} size={size} style={iconStyle} />
+ );
+});
+
+DirIcon.displayName = 'DirIcon';
+
+export default DirIcon;
diff --git a/src/features/ChatInput/RuntimeConfig/GitStatus.tsx b/src/features/ChatInput/RuntimeConfig/GitStatus.tsx
index 286354541e8..4ebca513022 100644
--- a/src/features/ChatInput/RuntimeConfig/GitStatus.tsx
+++ b/src/features/ChatInput/RuntimeConfig/GitStatus.tsx
@@ -63,6 +63,7 @@ const styles = createStaticStyles(({ css }) => {
cursor: pointer;
display: flex;
+ flex: none;
gap: 4px;
align-items: center;
@@ -72,6 +73,7 @@ const styles = createStaticStyles(({ css }) => {
font-size: 12px;
color: ${cssVar.colorTextSecondary};
+ white-space: nowrap;
transition: background 0.2s;
@@ -81,6 +83,7 @@ const styles = createStaticStyles(({ css }) => {
}
`,
separator: css`
+ flex: none;
width: 1px;
height: 10px;
background: ${cssVar.colorSplit};
@@ -89,6 +92,7 @@ const styles = createStaticStyles(({ css }) => {
cursor: pointer;
display: inline-flex;
+ flex: none;
gap: 2px;
align-items: center;
@@ -118,6 +122,7 @@ const styles = createStaticStyles(({ css }) => {
cursor: pointer;
display: flex;
+ flex: none;
gap: 4px;
align-items: center;
@@ -127,6 +132,7 @@ const styles = createStaticStyles(({ css }) => {
font-size: 12px;
color: ${cssVar.colorTextSecondary};
+ white-space: nowrap;
transition: background 0.2s;
diff --git a/src/features/ChatInput/RuntimeConfig/HeteroDeviceSwitcher.tsx b/src/features/ChatInput/RuntimeConfig/HeteroDeviceSwitcher.tsx
index c2d7f56e423..e958b99886d 100644
--- a/src/features/ChatInput/RuntimeConfig/HeteroDeviceSwitcher.tsx
+++ b/src/features/ChatInput/RuntimeConfig/HeteroDeviceSwitcher.tsx
@@ -31,6 +31,7 @@ const styles = createStaticStyles(({ css }) => ({
cursor: pointer;
display: flex;
+ flex: none;
gap: 6px;
align-items: center;
@@ -40,6 +41,7 @@ const styles = createStaticStyles(({ css }) => ({
font-size: 12px;
color: ${cssVar.colorTextSecondary};
+ white-space: nowrap;
transition: all 0.2s;
@@ -48,6 +50,12 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorFillSecondary};
}
`,
+ buttonLabel: css`
+ overflow: hidden;
+ max-width: 120px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
check: css`
flex: none;
margin-inline-start: auto;
@@ -292,6 +300,12 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {
const storedTarget = agencyConfig?.executionTarget;
const boundDeviceId = agencyConfig?.boundDeviceId;
+ // Heterogeneous agents (Claude Code / Codex β€” remote types already early-return
+ // below) bring their own toolchain and must execute somewhere, so `'none'`
+ // (plain chat, no execution environment) isn't a valid target for them: hide
+ // the option and never fall back to / honour a stale stored `'none'`.
+ const isHetero = !!heteroType;
+
const { data: devices, isLoading } = lambdaQuery.device.listDevices.useQuery(undefined, {
staleTime: 30_000,
});
@@ -303,8 +317,13 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {
const gatewayDeviceInfo = useElectronStore((s) => s.gatewayDeviceInfo);
const currentDeviceId = isDesktop ? gatewayDeviceInfo?.deviceId : undefined;
- // Effective target: falls back to local on desktop, no device on web.
- const executionTarget: DeviceExecutionTarget = storedTarget ?? (isDesktop ? 'local' : 'none');
+ // Effective target: falls back to local on desktop, sandbox for heterogeneous
+ // agents on web (they must execute somewhere), otherwise no device on web. A
+ // hetero agent never resolves to `'none'`, even if one was previously stored.
+ const fallbackTarget: DeviceExecutionTarget = isDesktop ? 'local' : isHetero ? 'sandbox' : 'none';
+ const storedOrFallback = storedTarget ?? fallbackTarget;
+ const executionTarget: DeviceExecutionTarget =
+ isHetero && storedOrFallback === 'none' ? fallbackTarget : storedOrFallback;
const handleSelect = useCallback(
async (target: DeviceExecutionTarget, deviceId?: string) => {
@@ -401,13 +420,15 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {
</a>
)}
</div>
- <OptionRow
- active={isActive('none')}
- desc={t('heteroAgent.executionTarget.noneDesc')}
- icon={<Icon icon={MonitorOffIcon} size={14} />}
- label={t('heteroAgent.executionTarget.none')}
- onClick={() => void handleSelect('none')}
- />
+ {isHetero ? null : (
+ <OptionRow
+ active={isActive('none')}
+ desc={t('heteroAgent.executionTarget.noneDesc')}
+ icon={<Icon icon={MonitorOffIcon} size={14} />}
+ label={t('heteroAgent.executionTarget.none')}
+ onClick={() => void handleSelect('none')}
+ />
+ )}
{isDesktop ? (
<OptionRow
active={isActive('local')}
@@ -468,7 +489,7 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {
>
<div className={styles.button}>
{chipIcon}
- <span>{chipLabel}</span>
+ <span className={styles.buttonLabel}>{chipLabel}</span>
<Icon icon={ChevronDownIcon} size={12} />
</div>
</Popover>
diff --git a/src/features/ChatInput/RuntimeConfig/ModeSelector.tsx b/src/features/ChatInput/RuntimeConfig/ModeSelector.tsx
index 371f4964e2a..65f5ea7b6eb 100644
--- a/src/features/ChatInput/RuntimeConfig/ModeSelector.tsx
+++ b/src/features/ChatInput/RuntimeConfig/ModeSelector.tsx
@@ -45,6 +45,7 @@ const styles = createStaticStyles(({ css }) => ({
cursor: pointer;
display: flex;
+ flex: none;
gap: 6px;
align-items: center;
@@ -54,6 +55,7 @@ const styles = createStaticStyles(({ css }) => ({
font-size: 12px;
color: ${cssVar.colorTextSecondary};
+ white-space: nowrap;
transition: all 0.2s;
diff --git a/src/features/ChatInput/RuntimeConfig/WorkingDirectoryPicker.tsx b/src/features/ChatInput/RuntimeConfig/WorkingDirectoryPicker.tsx
index 7c3a1347042..003a27bcbd9 100644
--- a/src/features/ChatInput/RuntimeConfig/WorkingDirectoryPicker.tsx
+++ b/src/features/ChatInput/RuntimeConfig/WorkingDirectoryPicker.tsx
@@ -28,7 +28,7 @@ import { deviceSelectors, useDeviceStore } from '@/store/device';
import { useElectronStore } from '@/store/electron';
import { openAddWorkingDirModal } from './AddWorkingDirModal';
-import { renderDirIcon } from './dirIcon';
+import DirIcon from './DirIcon';
import { useCommitWorkingDirectory } from './useCommitWorkingDirectory';
import { useMigrateDeviceRecents } from './useMigrateDeviceRecents';
@@ -37,6 +37,7 @@ const styles = createStaticStyles(({ css }) => ({
cursor: pointer;
display: flex;
+ flex: none;
gap: 6px;
align-items: center;
@@ -46,6 +47,7 @@ const styles = createStaticStyles(({ css }) => ({
font-size: 12px;
color: ${cssVar.colorTextSecondary};
+ white-space: nowrap;
transition: background 0.2s;
@@ -53,6 +55,12 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorFillTertiary};
}
`,
+ buttonLabel: css`
+ overflow: hidden;
+ max-width: 140px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
chooseFolderItem: css`
cursor: pointer;
@@ -322,7 +330,7 @@ const WorkingDirectoryPicker = memo<WorkingDirectoryPickerProps>(({ agentId }) =
key={entry.path}
onClick={() => void pick(entry)}
>
- {renderDirIcon(entry.repoType)}
+ <DirIcon repoType={entry.repoType} />
<Flexbox flex={1} style={{ minWidth: 0 }}>
<div className={styles.dirName}>{getDirName(entry.path)}</div>
<div className={styles.dirPath}>{entry.path}</div>
@@ -366,11 +374,11 @@ const WorkingDirectoryPicker = memo<WorkingDirectoryPickerProps>(({ agentId }) =
const trigger = (
<div className={styles.button}>
{selectedDir ? (
- renderDirIcon(recents.find((r) => r.path === selectedDir)?.repoType)
+ <DirIcon repoType={recents.find((r) => r.path === selectedDir)?.repoType} />
) : (
<Icon icon={FolderIcon} size={14} />
)}
- <span>{displayName}</span>
+ <span className={styles.buttonLabel}>{displayName}</span>
<Icon icon={ChevronDownIcon} size={12} />
</div>
);
diff --git a/src/features/ChatInput/RuntimeConfig/dirIcon.tsx b/src/features/ChatInput/RuntimeConfig/dirIcon.tsx
deleted file mode 100644
index 1d9ba329934..00000000000
--- a/src/features/ChatInput/RuntimeConfig/dirIcon.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Github } from '@lobehub/icons';
-import { Icon } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { FolderIcon, GitBranchIcon } from 'lucide-react';
-import type { ReactNode } from 'react';
-
-/** Render the directory icon for a detected repo type: GitHub mark, git branch,
- * or a plain folder when the type is unknown. Shared by every cwd picker so a
- * `github` dir looks the same in the local, device, and settings views. */
-export const renderDirIcon = (repoType?: 'git' | 'github'): ReactNode => {
- const iconStyle = { color: cssVar.colorTextTertiary, flex: 'none' as const };
- if (repoType === 'github') return <Github size={16} style={iconStyle} />;
- return (
- <Icon icon={repoType === 'git' ? GitBranchIcon : FolderIcon} size={16} style={iconStyle} />
- );
-};
diff --git a/src/features/ChatInput/RuntimeConfig/index.tsx b/src/features/ChatInput/RuntimeConfig/index.tsx
index 57266c10ea8..bfdc4a9a77c 100644
--- a/src/features/ChatInput/RuntimeConfig/index.tsx
+++ b/src/features/ChatInput/RuntimeConfig/index.tsx
@@ -17,6 +17,26 @@ const styles = createStaticStyles(({ css }) => ({
padding-block: 0;
padding-inline: 4px;
`,
+ // Left cluster (mode + device + working directory + git) is the variable-width
+ // part. It shrinks first and, once its long labels have truncated as far as
+ // they can, scrolls horizontally instead of wrapping each chip's text. The
+ // scrollbar is hidden β€” trackpad / wheel still works.
+ leftGroup: css`
+ scrollbar-width: none;
+
+ overflow: auto hidden;
+ flex: 1;
+
+ min-width: 0;
+
+ &::-webkit-scrollbar {
+ display: none;
+ }
+ `,
+ // Right cluster (approval mode + context window) stays pinned and intact.
+ rightGroup: css`
+ flex: none;
+ `,
}));
const RuntimeConfig = memo(() => {
@@ -43,12 +63,12 @@ const RuntimeConfig = memo(() => {
return (
<Flexbox horizontal align={'center'} className={styles.bar} justify={'space-between'}>
{/* Left: chat-mode switcher + (agent-only) execution device + working directory */}
- <Flexbox horizontal align={'center'} gap={4}>
+ <Flexbox horizontal align={'center'} className={styles.leftGroup} gap={4}>
<ModeSelector />
{enableAgentMode && <WorkspaceControls agentId={agentId} />}
</Flexbox>
- <Flexbox horizontal align={'center'} gap={4}>
+ <Flexbox horizontal align={'center'} className={styles.rightGroup} gap={4}>
{enableAgentMode && <ApprovalMode />}
{showContextWindow && <ContextWindow />}
</Flexbox>
diff --git a/src/features/NavPanel/components/NavItem.tsx b/src/features/NavPanel/components/NavItem.tsx
index c245fc6a242..7c265c6cfcb 100644
--- a/src/features/NavPanel/components/NavItem.tsx
+++ b/src/features/NavPanel/components/NavItem.tsx
@@ -47,6 +47,12 @@ export interface NavItemProps extends Omit<BlockProps, 'children' | 'title'> {
actions?: ReactNode;
active?: boolean;
contextMenuItems?: GenericItemType[] | (() => GenericItemType[]);
+ /**
+ * Optional second line rendered under the title (e.g. a topic's project
+ * directory). When set, the row grows to fit both lines; when omitted the
+ * layout is byte-identical to a single-line row.
+ */
+ description?: ReactNode;
disabled?: boolean;
extra?: ReactNode;
/**
@@ -58,6 +64,12 @@ export interface NavItemProps extends Omit<BlockProps, 'children' | 'title'> {
loading?: boolean;
slots?: NavItemSlots;
title: ReactNode;
+ /**
+ * Override the title text color. Defaults to colorText when active and
+ * colorTextSecondary otherwise. Pass cssVar.colorText to keep a row's title
+ * fully emphasized regardless of active state (e.g. topic titles).
+ */
+ titleColor?: string;
}
const NavItem = memo<NavItemProps>(
@@ -70,6 +82,8 @@ const NavItem = memo<NavItemProps>(
icon,
iconSize = 18,
title,
+ titleColor,
+ description,
onClick,
disabled,
loading,
@@ -78,7 +92,7 @@ const NavItem = memo<NavItemProps>(
...rest
}) => {
const iconColor = active ? cssVar.colorText : cssVar.colorTextDescription;
- const textColor = active ? cssVar.colorText : cssVar.colorTextSecondary;
+ const textColor = titleColor ?? (active ? cssVar.colorText : cssVar.colorTextSecondary);
const variant = active ? 'filled' : 'borderless';
const { titlePrefix, iconPostfix } = slots || {};
@@ -98,7 +112,8 @@ const NavItem = memo<NavItemProps>(
className={cx(styles.container, className)}
clickable={!disabled}
gap={8}
- height={36}
+ height={description ? undefined : 36}
+ paddingBlock={description ? 4 : undefined}
paddingInline={4}
variant={variant}
onClick={(e) => {
@@ -126,15 +141,24 @@ const NavItem = memo<NavItemProps>(
{iconPostfix}
<Flexbox horizontal align={'center'} flex={1} gap={8} style={{ overflow: 'hidden' }}>
{titlePrefix}
- <Text
- color={textColor}
- style={{ flex: 1 }}
- ellipsis={{
- tooltipWhenOverflow: true,
- }}
- >
- {title}
- </Text>
+ {description ? (
+ <Flexbox flex={1} gap={1} style={{ overflow: 'hidden' }}>
+ <Text color={textColor} ellipsis={{ tooltipWhenOverflow: true }}>
+ {title}
+ </Text>
+ {description}
+ </Flexbox>
+ ) : (
+ <Text
+ color={textColor}
+ style={{ flex: 1 }}
+ ellipsis={{
+ tooltipWhenOverflow: true,
+ }}
+ >
+ {title}
+ </Text>
+ )}
<Flexbox
horizontal
align={'center'}
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
index 8d8e99e8e13..ccf076ca265 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -1,5 +1,5 @@
import type { ChatTopicMetadata, ChatTopicStatus } from '@lobechat/types';
-import { Flexbox, Icon, Skeleton, Tag, Tooltip } from '@lobehub/ui';
+import { Flexbox, Icon, Skeleton, Tag, Text, Tooltip } from '@lobehub/ui';
import { createStaticStyles, cssVar, keyframes, useTheme } from 'antd-style';
import { CheckCircle2, Hand, HashIcon, MessageSquareDashed, TriangleAlert } from 'lucide-react';
import { memo, Suspense, useCallback, useMemo } from 'react';
@@ -9,6 +9,7 @@ import DotsLoading from '@/components/DotsLoading';
import RingLoadingIcon from '@/components/RingLoading';
import { SESSION_CHAT_TOPIC_URL } from '@/const/url';
import { isDesktop } from '@/const/version';
+import DirIcon from '@/features/ChatInput/RuntimeConfig/DirIcon';
import NavItem from '@/features/NavPanel/components/NavItem';
import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
import { useAgentStore } from '@/store/agent';
@@ -83,222 +84,252 @@ const cancelPendingSingleClick = () => {
}
};
+// Last non-empty path segment β€” the folder name. Also yields the repo name for
+// a web github URL (".../owner/repo" β†’ "repo").
+const getDirName = (path: string) => path.split('/').findLast(Boolean) || path;
+
interface TopicItemProps {
active?: boolean;
fav?: boolean;
id?: string;
metadata?: ChatTopicMetadata;
+ /**
+ * Show the topic's project directory as a second line under the title. Used by
+ * the by-status grouping, where the row otherwise carries no project context
+ * (by-project mode already puts the directory in the group header).
+ */
+ showWorkingDirectory?: boolean;
status?: ChatTopicStatus | null;
threadId?: string;
title: string;
}
-const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, metadata, status }) => {
- const { t } = useTranslation('topic');
- const { isDarkMode } = useTheme();
- const activeAgentId = useAgentStore((s) => s.activeAgentId);
- // Heterogeneous agents (Claude Code, Codex, …) don't have the chat-style
- // topic semantics, so skip the default `#` placeholder icon for their rows.
- const isHeterogeneousAgent = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
- const addTab = useElectronStore((s) => s.addTab);
-
- const loadingRingColor = isDarkMode
- ? cssVar.colorWarningBorder
- : `color-mix(in srgb, ${cssVar.colorWarning} 45%, transparent)`;
-
- // Construct href for cmd+click support
- const href = useMemo(() => {
- if (!activeAgentId || !id) return undefined;
- return SESSION_CHAT_TOPIC_URL(activeAgentId, id);
- }, [activeAgentId, id]);
-
- const [editing, isLoading] = useChatStore((s) => [
- id ? s.topicRenamingId === id : false,
- id ? s.topicLoadingIds.includes(id) : false,
- ]);
-
- const isUnreadCompleted = useChatStore(
- id ? operationSelectors.isTopicUnreadCompleted(id) : () => false,
- );
-
- const {
- focusTopicPopup,
- navigateToTopic,
- isInAgentSubRoute,
- isInTopicContextRoute,
- routeTopicId,
- urlTopicId,
- } = useTopicNavigation();
- const isRouteTopicActive = Boolean(id && routeTopicId === id && isInTopicContextRoute);
- const isTopicActive = Boolean(
- (active || isRouteTopicActive) && !threadId && (!isInAgentSubRoute || isRouteTopicActive),
- );
-
- const shouldShowThreadList = Boolean(id && id === urlTopicId);
-
- const toggleEditing = useCallback(
- (visible?: boolean) => {
- useChatStore.setState({ topicRenamingId: visible && id ? id : '' });
- },
- [id],
- );
-
- const handleClick = useCallback(() => {
- if (editing) return;
- if (isDesktop) {
- cancelPendingSingleClick();
- pendingSingleClickTimer = setTimeout(() => {
- pendingSingleClickTimer = null;
+const TopicItem = memo<TopicItemProps>(
+ ({ id, title, fav, active, threadId, metadata, status, showWorkingDirectory }) => {
+ const { t } = useTranslation('topic');
+ const { isDarkMode } = useTheme();
+ const activeAgentId = useAgentStore((s) => s.activeAgentId);
+ // Heterogeneous agents (Claude Code, Codex, …) don't have the chat-style
+ // topic semantics, so skip the default `#` placeholder icon for their rows.
+ const isHeterogeneousAgent = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
+ const addTab = useElectronStore((s) => s.addTab);
+
+ const loadingRingColor = isDarkMode
+ ? cssVar.colorWarningBorder
+ : `color-mix(in srgb, ${cssVar.colorWarning} 45%, transparent)`;
+
+ // Construct href for cmd+click support
+ const href = useMemo(() => {
+ if (!activeAgentId || !id) return undefined;
+ return SESSION_CHAT_TOPIC_URL(activeAgentId, id);
+ }, [activeAgentId, id]);
+
+ const [editing, isLoading] = useChatStore((s) => [
+ id ? s.topicRenamingId === id : false,
+ id ? s.topicLoadingIds.includes(id) : false,
+ ]);
+
+ const isUnreadCompleted = useChatStore(
+ id ? operationSelectors.isTopicUnreadCompleted(id) : () => false,
+ );
+
+ const {
+ focusTopicPopup,
+ navigateToTopic,
+ isInAgentSubRoute,
+ isInTopicContextRoute,
+ routeTopicId,
+ urlTopicId,
+ } = useTopicNavigation();
+ const isRouteTopicActive = Boolean(id && routeTopicId === id && isInTopicContextRoute);
+ const isTopicActive = Boolean(
+ (active || isRouteTopicActive) && !threadId && (!isInAgentSubRoute || isRouteTopicActive),
+ );
+
+ const shouldShowThreadList = Boolean(id && id === urlTopicId);
+
+ const toggleEditing = useCallback(
+ (visible?: boolean) => {
+ useChatStore.setState({ topicRenamingId: visible && id ? id : '' });
+ },
+ [id],
+ );
+
+ const handleClick = useCallback(() => {
+ if (editing) return;
+ if (isDesktop) {
+ cancelPendingSingleClick();
+ pendingSingleClickTimer = setTimeout(() => {
+ pendingSingleClickTimer = null;
+ void navigateToTopic(id);
+ }, 250);
+ } else {
void navigateToTopic(id);
- }, 250);
- } else {
+ }
+ }, [editing, id, navigateToTopic]);
+
+ const handleDoubleClick = useCallback(async () => {
+ if (!id || !activeAgentId || !isDesktop) return;
+ cancelPendingSingleClick();
+ if (await focusTopicPopup(id)) {
+ void navigateToTopic(id, { skipPopupFocus: true });
+ return;
+ }
+ addTab(SESSION_CHAT_TOPIC_URL(activeAgentId, id));
void navigateToTopic(id);
- }
- }, [editing, id, navigateToTopic]);
-
- const handleDoubleClick = useCallback(async () => {
- if (!id || !activeAgentId || !isDesktop) return;
- cancelPendingSingleClick();
- if (await focusTopicPopup(id)) {
- void navigateToTopic(id, { skipPopupFocus: true });
- return;
- }
- addTab(SESSION_CHAT_TOPIC_URL(activeAgentId, id));
- void navigateToTopic(id);
- }, [id, activeAgentId, addTab, focusTopicPopup, navigateToTopic]);
-
- const { dropdownMenu } = useTopicItemDropdownMenu({
- fav,
- id,
- status,
- title,
- });
-
- const isCompleted = status === 'completed';
- const isFailed = status === 'failed';
- const isRunning = status === 'running';
- const isWaitingForHuman = status === 'waitingForHuman';
-
- const hasUnread = id && isUnreadCompleted;
- const unreadIcon = (
- <span className={styles.unreadWrapper}>
- <span className={styles.unreadRipple} />
- <span className={styles.unreadDot} />
- </span>
- );
-
- // For default topic (no id)
- if (!id) {
- return (
- <NavItem
- active={Boolean(active && !isInAgentSubRoute && !isInTopicContextRoute)}
- icon={
- isLoading ? (
- <RingLoadingIcon
- ringColor={loadingRingColor}
- size={14}
- style={{ color: cssVar.colorWarning }}
- />
- ) : (
- <Icon color={cssVar.colorTextDescription} icon={MessageSquareDashed} size={'small'} />
- )
- }
- title={
- <Flexbox horizontal align={'center'} flex={1} gap={6}>
- {t('defaultTitle')}
- <Tag
- size={'small'}
- style={{
- color: cssVar.colorTextDescription,
- fontSize: 10,
- }}
- >
- {t('temp')}
- </Tag>
- </Flexbox>
- }
- onClick={handleClick}
- />
+ }, [id, activeAgentId, addTab, focusTopicPopup, navigateToTopic]);
+
+ const { dropdownMenu } = useTopicItemDropdownMenu({
+ fav,
+ id,
+ status,
+ title,
+ });
+
+ const isCompleted = status === 'completed';
+ const isFailed = status === 'failed';
+ const isRunning = status === 'running';
+ const isWaitingForHuman = status === 'waitingForHuman';
+
+ // By-status grouping mixes topics from different projects, so surface each
+ // topic's working directory as a muted second line. Data is already on the
+ // topic (`metadata.workingDirectory`) β€” no fetch. On web it's a github repo
+ // URL; on desktop a local path shown with a plain folder icon.
+ const workingDirectory = metadata?.workingDirectory;
+ const workingDirectoryNode =
+ showWorkingDirectory && workingDirectory ? (
+ <Flexbox horizontal align={'center'} gap={4} style={{ overflow: 'hidden' }}>
+ <DirIcon repoType={isDesktop ? undefined : 'github'} size={12} />
+ <Text ellipsis fontSize={11} style={{ color: cssVar.colorTextDescription }}>
+ {getDirName(workingDirectory)}
+ </Text>
+ </Flexbox>
+ ) : undefined;
+
+ const hasUnread = id && isUnreadCompleted;
+ const unreadIcon = (
+ <span className={styles.unreadWrapper}>
+ <span className={styles.unreadRipple} />
+ <span className={styles.unreadDot} />
+ </span>
);
- }
- return (
- <Flexbox data-testid="topic-item" style={{ position: 'relative' }}>
- <NavItem
- actions={<Actions dropdownMenu={dropdownMenu} />}
- active={isTopicActive}
- contextMenuItems={dropdownMenu}
- disabled={editing}
- href={href}
- title={title === '...' ? <DotsLoading gap={3} size={4} /> : title}
- icon={(() => {
- if (isWaitingForHuman) {
- return <Icon icon={Hand} size={'small'} style={{ color: cssVar.colorInfo }} />;
- }
- if (isLoading || isRunning) {
- return (
+ // For default topic (no id)
+ if (!id) {
+ return (
+ <NavItem
+ active={Boolean(active && !isInAgentSubRoute && !isInTopicContextRoute)}
+ titleColor={cssVar.colorText}
+ icon={
+ isLoading ? (
<RingLoadingIcon
ringColor={loadingRingColor}
size={14}
style={{ color: cssVar.colorWarning }}
/>
- );
+ ) : (
+ <Icon color={cssVar.colorTextDescription} icon={MessageSquareDashed} size={'small'} />
+ )
}
- if (isFailed) {
- return (
- <Tooltip title={t('failedStatusTip')}>
- <Icon icon={TriangleAlert} size={'small'} style={{ color: cssVar.colorError }} />
- </Tooltip>
- );
+ title={
+ <Flexbox horizontal align={'center'} flex={1} gap={6}>
+ {t('defaultTitle')}
+ <Tag
+ size={'small'}
+ style={{
+ color: cssVar.colorTextDescription,
+ fontSize: 10,
+ }}
+ >
+ {t('temp')}
+ </Tag>
+ </Flexbox>
}
- if (isCompleted) {
+ onClick={handleClick}
+ />
+ );
+ }
+
+ return (
+ <Flexbox data-testid="topic-item" style={{ position: 'relative' }}>
+ <NavItem
+ actions={<Actions dropdownMenu={dropdownMenu} />}
+ active={isTopicActive}
+ contextMenuItems={dropdownMenu}
+ description={workingDirectoryNode}
+ disabled={editing}
+ href={href}
+ title={title === '...' ? <DotsLoading gap={3} size={4} /> : title}
+ titleColor={cssVar.colorText}
+ icon={(() => {
+ if (isWaitingForHuman) {
+ return <Icon icon={Hand} size={'small'} style={{ color: cssVar.colorInfo }} />;
+ }
+ if (isLoading || isRunning) {
+ return (
+ <RingLoadingIcon
+ ringColor={loadingRingColor}
+ size={14}
+ style={{ color: cssVar.colorWarning }}
+ />
+ );
+ }
+ if (isFailed) {
+ return (
+ <Tooltip title={t('failedStatusTip')}>
+ <Icon icon={TriangleAlert} size={'small'} style={{ color: cssVar.colorError }} />
+ </Tooltip>
+ );
+ }
+ if (isCompleted) {
+ return (
+ <Icon
+ icon={CheckCircle2}
+ size={'small'}
+ style={{ color: cssVar.colorTextDescription }}
+ />
+ );
+ }
+ if (hasUnread) return unreadIcon;
+ if (metadata?.bot?.platform) {
+ const ProviderIcon = getPlatformIcon(metadata.bot!.platform);
+ if (ProviderIcon) {
+ return <ProviderIcon color={cssVar.colorTextDescription} size={16} />;
+ }
+ }
return (
<Icon
- icon={CheckCircle2}
+ icon={HashIcon}
size={'small'}
- style={{ color: cssVar.colorTextDescription }}
+ style={{
+ color: cssVar.colorTextDescription,
+ // Heterogeneous agents (Claude Code, Codex, …) have no chat-style
+ // topic semantics, so suppress the `#` glyph while keeping its
+ // box so the title stays aligned with sibling rows.
+ visibility: isHeterogeneousAgent ? 'hidden' : undefined,
+ }}
/>
);
- }
- if (hasUnread) return unreadIcon;
- if (metadata?.bot?.platform) {
- const ProviderIcon = getPlatformIcon(metadata.bot!.platform);
- if (ProviderIcon) {
- return <ProviderIcon color={cssVar.colorTextDescription} size={16} />;
+ })()}
+ onClick={handleClick}
+ onDoubleClick={() => void handleDoubleClick()}
+ />
+ <Editing id={id} title={title} toggleEditing={toggleEditing} />
+ {shouldShowThreadList && (
+ <Suspense
+ fallback={
+ <Flexbox gap={8} paddingBlock={8} paddingInline={24} width={'100%'}>
+ <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
+ <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
+ </Flexbox>
}
- }
- return (
- <Icon
- icon={HashIcon}
- size={'small'}
- style={{
- color: cssVar.colorTextDescription,
- // Heterogeneous agents (Claude Code, Codex, …) have no chat-style
- // topic semantics, so suppress the `#` glyph while keeping its
- // box so the title stays aligned with sibling rows.
- visibility: isHeterogeneousAgent ? 'hidden' : undefined,
- }}
- />
- );
- })()}
- onClick={handleClick}
- onDoubleClick={() => void handleDoubleClick()}
- />
- <Editing id={id} title={title} toggleEditing={toggleEditing} />
- {shouldShowThreadList && (
- <Suspense
- fallback={
- <Flexbox gap={8} paddingBlock={8} paddingInline={24} width={'100%'}>
- <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
- <Skeleton.Button active size={'small'} style={{ height: 18, width: '100%' }} />
- </Flexbox>
- }
- >
- <ThreadList topicId={id} />
- </Suspense>
- )}
- </Flexbox>
- );
-});
+ >
+ <ThreadList topicId={id} />
+ </Suspense>
+ )}
+ </Flexbox>
+ );
+ },
+);
export default TopicItem;
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx
index 6ce1428bfe8..b48cb68c6b1 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ByStatusMode/GroupItem.tsx
@@ -54,6 +54,7 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, activeTopicId, activeT
<Flexbox gap={1} paddingBlock={1}>
{children.map((topic) => (
<TopicItem
+ showWorkingDirectory
active={activeTopicId === topic.id}
fav={topic.favorite}
id={topic.id}
diff --git a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/WorkingDirectoryBar.tsx b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/WorkingDirectoryBar.tsx
index 8f3d4633e1e..e0064134ac2 100644
--- a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/WorkingDirectoryBar.tsx
+++ b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/WorkingDirectoryBar.tsx
@@ -14,6 +14,7 @@ import { agentByIdSelectors } from '@/store/agent/selectors';
const styles = createStaticStyles(({ css }) => ({
bar: css`
+ container: runtimebar / inline-size;
padding-block: 0;
padding-inline: 4px;
`,
@@ -21,6 +22,7 @@ const styles = createStaticStyles(({ css }) => ({
cursor: default;
display: flex;
+ flex: none;
gap: 6px;
align-items: center;
@@ -30,6 +32,27 @@ const styles = createStaticStyles(({ css }) => ({
font-size: 12px;
color: ${cssVar.colorTextSecondary};
+ white-space: nowrap;
+ `,
+ // On a narrow bar the "full access" badge collapses to just its icon β€” the
+ // hover tooltip still spells it out. Saves a chunk of horizontal space that
+ // the truncating workspace cluster can use instead.
+ fullAccessLabel: css`
+ @container runtimebar (width < 600px) {
+ display: none;
+ }
+ `,
+ // Mirror RuntimeConfig: the workspace cluster shrinks then scrolls horizontally
+ // (hidden scrollbar) instead of wrapping each chip's text on narrow screens.
+ leftGroup: css`
+ scrollbar-width: none;
+ overflow: auto hidden;
+ flex: 1;
+ min-width: 0;
+
+ &::-webkit-scrollbar {
+ display: none;
+ }
`,
}));
@@ -46,7 +69,7 @@ const WorkingDirectoryBar = memo(() => {
if (!agentId) return null;
return (
<Flexbox horizontal align={'center'} className={styles.bar} justify={'space-between'}>
- <Flexbox horizontal align={'center'} gap={4}>
+ <Flexbox horizontal align={'center'} className={styles.leftGroup} gap={4}>
<WorkspaceControls alwaysShowWorkspace agentId={agentId} />
</Flexbox>
</Flexbox>
@@ -65,13 +88,13 @@ const WorkingDirectoryBar = memo(() => {
const fullAccessBadge = (
<div className={styles.fullAccess}>
<Icon icon={CircleAlertIcon} size={14} />
- <span>{tChat('heteroAgent.fullAccess.label')}</span>
+ <span className={styles.fullAccessLabel}>{tChat('heteroAgent.fullAccess.label')}</span>
</div>
);
return (
<Flexbox horizontal align={'center'} className={styles.bar} justify={'space-between'}>
- <Flexbox horizontal align={'center'} gap={4}>
+ <Flexbox horizontal align={'center'} className={styles.leftGroup} gap={4}>
<WorkspaceControls alwaysShowWorkspace agentId={agentId} />
</Flexbox>
<Tooltip title={tChat('heteroAgent.fullAccess.tooltip')}>{fullAccessBadge}</Tooltip>
diff --git a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
index dce36e82c4d..4b847232855 100644
--- a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -206,6 +206,7 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, stat
return (
<NavItem
active={active}
+ titleColor={cssVar.colorText}
icon={
isLoading ? (
<Icon spin color={cssVar.colorWarning} icon={Loader2Icon} size={'small'} />
@@ -241,6 +242,7 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, stat
disabled={editing}
href={!editing ? href : undefined}
title={title === '...' ? <DotsLoading gap={3} size={4} /> : title}
+ titleColor={cssVar.colorText}
icon={(() => {
if (isWaitingForHuman) {
return <Icon icon={Hand} size={'small'} style={{ color: cssVar.colorInfo }} />;
diff --git a/src/routes/(main)/settings/devices/features/DeviceDetailPanel.tsx b/src/routes/(main)/settings/devices/features/DeviceDetailPanel.tsx
index 9191f385039..332b9fe7053 100644
--- a/src/routes/(main)/settings/devices/features/DeviceDetailPanel.tsx
+++ b/src/routes/(main)/settings/devices/features/DeviceDetailPanel.tsx
@@ -9,7 +9,7 @@ import { FolderOpenIcon, FolderPlusIcon, XIcon } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { renderDirIcon } from '@/features/ChatInput/RuntimeConfig/dirIcon';
+import DirIcon from '@/features/ChatInput/RuntimeConfig/DirIcon';
import { lambdaQuery } from '@/libs/trpc/client';
import { electronSystemService } from '@/services/electron/system';
import { nextWorkingDirs } from '@/store/device';
@@ -231,7 +231,7 @@ const DeviceDetailPanel = memo<DeviceDetailPanelProps>(({ device, isCurrent, onC
renderItem={(item: { id: string; repoType?: 'git' | 'github' }) => (
<SortableList.Item className={styles.recentItem} id={item.id} variant={'filled'}>
<SortableList.DragHandle />
- {renderDirIcon(item.repoType)}
+ <DirIcon repoType={item.repoType} />
<Text className={styles.path} title={item.id}>
{item.id}
</Text>
diff --git a/src/store/chat/slices/topic/selectors.test.ts b/src/store/chat/slices/topic/selectors.test.ts
index d75f58f5c31..6e5b4be58a7 100644
--- a/src/store/chat/slices/topic/selectors.test.ts
+++ b/src/store/chat/slices/topic/selectors.test.ts
@@ -462,7 +462,7 @@ describe('topicSelectors', () => {
expect(totalChildren).toBe(3);
});
- it('should pin the pending group to the very top, above favorites, in byStatus mode', () => {
+ it('should place the pending group right below favorites in byStatus mode', () => {
const state = createStateWithTopics([
{
id: 'fav',
@@ -492,9 +492,9 @@ describe('topicSelectors', () => {
const grouped = topicSelectors.groupedTopicsForSidebar(20, 'updatedAt', 'byStatus')(state);
- // pending floats above the favorite group; favorite stays above the rest
- expect(grouped.map((g) => g.id)).toEqual(['pending', 'favorite', 'active']);
- expect(grouped[0].children.map((t) => t.id)).toEqual(['failed']);
+ // favorites stay pinned at the top; pending follows right below, then the rest
+ expect(grouped.map((g) => g.id)).toEqual(['favorite', 'pending', 'active']);
+ expect(grouped[1].children.map((t) => t.id)).toEqual(['failed']);
});
});
});
diff --git a/src/store/chat/slices/topic/selectors.ts b/src/store/chat/slices/topic/selectors.ts
index da008bdc688..985ac685a8c 100644
--- a/src/store/chat/slices/topic/selectors.ts
+++ b/src/store/chat/slices/topic/selectors.ts
@@ -153,28 +153,19 @@ const buildGroupedTopics = (
const favTopics = topics.filter((topic) => topic.favorite);
const unfavTopics = topics.filter((topic) => !topic.favorite);
- const groups =
- favTopics.length > 0
- ? [
- {
- children: favTopics,
- id: 'favorite',
- title: t('favorite', { ns: 'topic' }),
- },
- ...groupFn(unfavTopics),
- ]
- : groupFn(topics);
-
- // The "needs attention" bucket (byStatus mode only) is pinned to the very top,
- // even above favorites, so failed / awaiting-input / unread topics are
- // impossible to miss. No-op for other group modes, which have no `pending` id.
- const pendingIndex = groups.findIndex((group) => group.id === 'pending');
- if (pendingIndex > 0) {
- const [pending] = groups.splice(pendingIndex, 1);
- groups.unshift(pending);
- }
-
- return groups;
+ // Favorites stay pinned at the very top. The "needs attention" bucket
+ // (byStatus mode only) follows right below, ahead of the remaining status
+ // groups, since groupTopicsByStatus emits `pending` first (STATUS_GROUP_ORDER).
+ return favTopics.length > 0
+ ? [
+ {
+ children: favTopics,
+ id: 'favorite',
+ title: t('favorite', { ns: 'topic' }),
+ },
+ ...groupFn(unfavTopics),
+ ]
+ : groupFn(topics);
};
const groupedTopicsSelector =