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(agents): agent list badge wall with avatar pendants (#21815)

Lobehub Coderf9e02baa201a
diff --git a/locales/en-US/common.json b/locales/en-US/common.json
index c530fa3ed75..49bb94892c9 100644
--- a/locales/en-US/common.json
+++ b/locales/en-US/common.json
@@ -20,6 +20,8 @@
"agentViewAll.orderBy.author": "Author",
"agentViewAll.orderBy.title": "Title",
"agentViewAll.orderBy.updatedAt": "Updated at",
+ "agentViewAll.pendant.core": "Core",
+ "agentViewAll.pendant.official": "Official",
"agentViewAll.removeFromSidebar": "Hide from my sidebar",
"agentViewAll.sidebarSection.collapse": "Fold",
"agentViewAll.sidebarSection.expand": "Unfold",
diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json
index 036a011d9df..0a4930d58c3 100644
--- a/locales/zh-CN/common.json
+++ b/locales/zh-CN/common.json
@@ -20,6 +20,8 @@
"agentViewAll.orderBy.author": "作者",
"agentViewAll.orderBy.title": "标题",
"agentViewAll.orderBy.updatedAt": "更新时间",
+ "agentViewAll.pendant.core": "核心",
+ "agentViewAll.pendant.official": "官方",
"agentViewAll.removeFromSidebar": "在我的侧边栏隐藏",
"agentViewAll.sidebarSection.collapse": "收起",
"agentViewAll.sidebarSection.expand": "展开",
diff --git a/packages/locales/src/default/common.ts b/packages/locales/src/default/common.ts
index 2d09adb5390..d5cef1f1ad0 100644
--- a/packages/locales/src/default/common.ts
+++ b/packages/locales/src/default/common.ts
@@ -26,6 +26,8 @@ export default {
'agentViewAll.orderBy.author': 'Author',
'agentViewAll.orderBy.title': 'Title',
'agentViewAll.orderBy.updatedAt': 'Updated at',
+ 'agentViewAll.pendant.core': 'Core',
+ 'agentViewAll.pendant.official': 'Official',
'agentViewAll.removeFromSidebar': 'Hide from my sidebar',
'agentViewAll.sidebarSection.collapse': 'Fold',
'agentViewAll.sidebarSection.expand': 'Unfold',
diff --git a/src/components/Avatar/fallback.ts b/src/components/Avatar/fallback.ts
index 142c94be01c..5d92ed8dcf0 100644
--- a/src/components/Avatar/fallback.ts
+++ b/src/components/Avatar/fallback.ts
@@ -34,7 +34,7 @@ export const getAvatarInitials = (name?: string | null): string => {
*/
const BLANK_BACKGROUNDS = new Set(['transparent', 'rgba(0,0,0,0)', 'none']);
-const usableBackground = (background?: string): string | undefined => {
+export const usableBackground = (background?: string | null): string | undefined => {
const value = background?.trim();
if (!value) return undefined;
diff --git a/src/components/Skeleton/AgentViewAll.tsx b/src/components/Skeleton/AgentViewAll.tsx
index 0bb11bc2a98..d49d6c7f560 100644
--- a/src/components/Skeleton/AgentViewAll.tsx
+++ b/src/components/Skeleton/AgentViewAll.tsx
@@ -77,7 +77,7 @@ export const AgentViewAllSidebarSectionSkeleton = () => {
};
/**
- * Dense `AgentRow`s of the default list view (`agentListViewMode: 'list'`,
+ * Dense `AgentRow`s of the list view (`agentListViewMode: 'list'`,
* `groupBy: 'none'`): padding 8/12, 28px square avatar, then the name / role /
* description columns, then the
* right-aligned 88px update-time column and the 64px eye / "…" action column.
@@ -118,7 +118,7 @@ export const AgentViewAllRowsSkeleton = ({ rows = 8 }: { rows?: number }) => (
* Route-level skeleton for `/agents` (`features/AgentViewAll/AgentViewAllPage.tsx`):
* the 44px header (title left, list-config icon right), then the full-width column
* with the "In sidebar" block and the toolbar (240px-max search left, split
- * create button right) over the default list view's rows.
+ * create button right) over list-view rows (also the loading state of the card view).
*/
const AgentViewAllSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => (
<Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
diff --git a/src/features/AgentViewAll/AgentCard.tsx b/src/features/AgentViewAll/AgentCard.tsx
index a2b7ab4f486..adc28783c8a 100644
--- a/src/features/AgentViewAll/AgentCard.tsx
+++ b/src/features/AgentViewAll/AgentCard.tsx
@@ -1,43 +1,49 @@
'use client';
-import { AGENT_CHAT_URL, DEFAULT_AVATAR, GROUP_CHAT_URL } from '@lobechat/const';
+import { AGENT_CHAT_URL, GROUP_CHAT_URL } from '@lobechat/const';
import type { SidebarAgentItem } from '@lobechat/types';
import { agentDisplayName, agentSecondaryDisplayName } from '@lobechat/types';
import {
- Avatar,
Block,
ContextMenuTrigger,
createStaticStyles,
+ cx,
type DropdownItem,
- Flexbox,
- Tag,
Text,
- Tooltip,
} from '@lobehub/ui';
-import { memo, useCallback, useRef, useState } from 'react';
+import { type CSSProperties, memo, type ReactNode, useCallback, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { type AgentRowAuthor, formatUpdatedAt } from './AgentRow';
+import AgentPendant from './AgentPendant';
import ItemActions from './ItemActions';
-import LabelTags from './LabelTags';
+import { resolveAgentBadge } from './resolveAgentBadge';
import SidebarItemAvatar from './SidebarItemAvatar';
-// Card layout mirrors the agent channel platform cards
-// (src/features/AgentChannel/PlatformGrid.tsx): icon + title + trailing state on
-// one row, a two-line description below, hover lift on the whole card.
+// Badge-wall layout: avatar → name → role chip → two-line description,
+// centered. Every row has a fixed height, so plain and cover badges mixed in
+// one row keep the avatar, the name baseline and the description's first line
+// aligned. The avatar sits at the same y either way: with a cover it straddles
+// the cover's bottom edge, without one the band is just top padding.
+const COVER_HEIGHT = 48;
+const AVATAR_SIZE = 56;
+export const AGENT_GRID_MIN_COLUMN = 260;
+
export const cardStyles = createStaticStyles(({ css, cssVar }) => ({
card: css`
+ position: relative;
+
+ overflow: hidden;
display: flex;
flex-direction: column;
- gap: 8px;
- align-items: stretch;
+ align-items: center;
- min-height: 104px;
- padding-block: 12px;
+ padding-block: ${COVER_HEIGHT - AVATAR_SIZE / 2}px 16px;
padding-inline: 12px;
+ text-align: center;
+
transition:
transform 0.18s,
box-shadow 0.18s,
@@ -45,22 +51,104 @@ export const cardStyles = createStaticStyles(({ css, cssVar }) => ({
&:hover {
transform: translateY(-1px);
- box-shadow: 0 4px 12px rgb(0 0 0 / 6%);
+ box-shadow: ${cssVar.boxShadowTertiary};
}
`,
+ // Identity texture, not artwork: a short straight-edged band tinted from the
+ // agent's avatar background, mixed toward the container color so it stays
+ // calm in both themes, with a faint dot grid on top.
+ cover: css`
+ position: absolute;
+ inset-block-start: 0;
+ inset-inline: 0;
+
+ height: ${COVER_HEIGHT}px;
+
+ background-color: color-mix(in srgb, var(--agent-cover) 72%, ${cssVar.colorBgContainer});
+ background-image: radial-gradient(
+ color-mix(in srgb, ${cssVar.colorBgContainer} 30%, transparent) 1px,
+ transparent 1.5px
+ );
+ background-size: 10px 10px;
+ `,
+ avatarRing: css`
+ position: relative;
+
+ overflow: hidden;
+ display: inline-flex;
+
+ border: 3px solid ${cssVar.colorBgContainer};
+ border-radius: 50%;
+
+ /* Neutral face plate for emoji avatars without a background color;
+ images and colored avatars paint over it. */
+ background: ${cssVar.colorFillTertiary};
+ background-clip: padding-box;
+ `,
+ // Group avatars are a square member grid; a circle would clip its corners.
+ avatarRingGroup: css`
+ border-radius: ${cssVar.borderRadiusLG};
+ `,
+ // Colored avatars already shrink their emoji (emojiScaleWithBackground);
+ // plain ones would fill the whole circle, so give them the same breathing room.
+ avatarPlain: css`
+ & img.lobe-fluent-emoji {
+ transform: scale(0.72);
+ }
+ `,
+ name: css`
+ width: 100%;
+ margin-block-start: 8px;
+
+ font-size: 14px;
+ font-weight: 600;
+ line-height: 22px;
+ `,
+ roleRow: css`
+ display: flex;
+ justify-content: center;
+
+ width: 100%;
+ height: 22px;
+ margin-block-start: 4px;
+ `,
+ role: css`
+ overflow: hidden;
+
+ max-width: 100%;
+ padding-inline: 8px;
+ border-radius: 999px;
+
+ font-size: 12px;
+ line-height: 22px;
+ color: ${cssVar.colorTextSecondary};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ background: ${cssVar.colorFillTertiary};
+ `,
description: css`
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
- line-height: 1.5;
+ width: 100%;
+ height: 36px;
+ margin-block-start: 8px;
+
+ font-size: 12px;
+ line-height: 18px;
+ color: ${cssVar.colorTextSecondary};
+ overflow-wrap: anywhere;
`,
+ // Columns come from the content width: as many 260px+ badges as fit, so a
+ // ~1300px page shows four and an ultra-wide one six, instead of a fixed four
+ // stretching each badge. Shares the min width with SidebarAgentsSection so
+ // the two grids line up.
grid: css`
display: grid;
-
- /* Full-width page: as many 280px+ columns as fit, one column on narrow screens. */
- grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
+ grid-template-columns: repeat(auto-fill, minmax(min(${AGENT_GRID_MIN_COLUMN}px, 100%), 1fr));
gap: 12px;
width: 100%;
@@ -68,12 +156,23 @@ export const cardStyles = createStaticStyles(({ css, cssVar }) => ({
`,
/* Top-right "…" slot, a SIBLING of the card link (absolutely positioned
over it) — nesting an interactive menu trigger inside the <a> would put
- a button inside a link in the accessibility tree. Aligned with the
- card's 12px padding so it sits where the header row used to hold it. */
+ a button inside a link in the accessibility tree. It fades in on hover /
+ focus so the wall stays clean, and is always shown on touch screens. */
actions: css`
position: absolute;
- inset-block-start: 12px;
- inset-inline-end: 12px;
+ inset-block-start: 8px;
+ inset-inline-end: 8px;
+
+ border-radius: ${cssVar.borderRadiusSM};
+
+ opacity: 0;
+ background: color-mix(in srgb, ${cssVar.colorBgContainer} 85%, transparent);
+
+ transition: opacity 0.15s;
+
+ @media (hover: none) {
+ opacity: 1;
+ }
`,
link: css`
display: block;
@@ -85,132 +184,109 @@ export const cardStyles = createStaticStyles(({ css, cssVar }) => ({
position: relative;
min-width: 0;
height: 100%;
- `,
- updatedAt: css`
- flex: none;
- color: ${cssVar.colorTextQuaternary};
+
+ &:hover > [data-card-actions],
+ &:focus-within > [data-card-actions] {
+ opacity: 1;
+ }
`,
}));
+/** Badge-wall grid wrapper. */
+export const AgentCardGrid = memo<{ children: ReactNode }>(({ children }) => (
+ <div className={cardStyles.grid}>{children}</div>
+));
+
+AgentCardGrid.displayName = 'AgentCardGrid';
+
interface AgentCardProps {
- /** Creator profile; rendered only when `showAuthor` is set. */
- author?: AgentRowAuthor | null;
item: SidebarAgentItem;
/** Toggle whether this item appears in the caller's sidebar. */
onToggleSidebar?: (item: SidebarAgentItem) => void;
- /** Whether to render the author info (workspace mode). */
- showAuthor?: boolean;
/** Whether the caller removed this item from their sidebar (default listed). */
sidebarHidden?: boolean;
}
-const AgentCard = memo<AgentCardProps>(
- ({ author, item, onToggleSidebar, showAuthor, sidebarHidden }) => {
- const { t } = useTranslation('common');
- const { description, id, type, updatedAt } = item;
- // Groups have no personal name, so this resolves to their title.
- const displayTitle = agentDisplayName(item, t('agentViewAll.untitled'));
- const roleTag = agentSecondaryDisplayName(item);
- const [anchor, setAnchor] = useState<HTMLElement | null>(null);
-
- // Right-click support — same bridge as AgentRow: the hook-bearing menu
- // mounts on the card's pointer-enter and hands its items back via ref.
- const [menuActivated, setMenuActivated] = useState(false);
- const activateMenu = useCallback(() => setMenuActivated(true), []);
- const menuItemsRef = useRef<(() => DropdownItem[]) | null>(null);
- const handleMenuReady = useCallback((getItems: () => DropdownItem[]) => {
- menuItemsRef.current = getItems;
- }, []);
- const getContextMenuItems = useCallback(() => menuItemsRef.current?.() ?? [], []);
-
- return (
- <ContextMenuTrigger items={getContextMenuItems}>
- <div className={cardStyles.wrapper}>
- <WorkspaceLink
- aria-label={displayTitle}
- className={cardStyles.link}
- ref={setAnchor}
- to={type === 'group' ? GROUP_CHAT_URL(id) : AGENT_CHAT_URL(id, false)}
- onPointerEnter={activateMenu}
- >
- <Block clickable className={cardStyles.card} height={'100%'} variant={'outlined'}>
- {/* Right padding reserves the header slot the absolutely
- positioned "…" sibling overlays. */}
- <Flexbox
- horizontal
- align={'center'}
- gap={8}
- style={{ minWidth: 0, paddingInlineEnd: 28 }}
+const AgentCard = memo<AgentCardProps>(({ item, onToggleSidebar, sidebarHidden }) => {
+ const { t } = useTranslation('common');
+ const { description, id, type } = item;
+ // Groups have no personal name, so this resolves to their title.
+ const displayTitle = agentDisplayName(item, t('agentViewAll.untitled'));
+ const roleTag = agentSecondaryDisplayName(item);
+ const badge = resolveAgentBadge(item);
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
+
+ // Right-click support — same bridge as AgentRow: the hook-bearing menu
+ // mounts on the card's pointer-enter and hands its items back via ref.
+ const [menuActivated, setMenuActivated] = useState(false);
+ const activateMenu = useCallback(() => setMenuActivated(true), []);
+ const menuItemsRef = useRef<(() => DropdownItem[]) | null>(null);
+ const handleMenuReady = useCallback((getItems: () => DropdownItem[]) => {
+ menuItemsRef.current = getItems;
+ }, []);
+ const getContextMenuItems = useCallback(() => menuItemsRef.current?.() ?? [], []);
+
+ return (
+ <ContextMenuTrigger items={getContextMenuItems}>
+ <div className={cardStyles.wrapper}>
+ <WorkspaceLink
+ aria-label={displayTitle}
+ className={cardStyles.link}
+ ref={setAnchor}
+ to={type === 'group' ? GROUP_CHAT_URL(id) : AGENT_CHAT_URL(id, false)}
+ onPointerEnter={activateMenu}
+ >
+ <Block clickable className={cardStyles.card} height={'100%'} variant={'outlined'}>
+ {badge.cover ? (
+ <div
+ className={cardStyles.cover}
+ style={{ '--agent-cover': badge.cover } as CSSProperties}
+ />
+ ) : null}
+ <AgentPendant bottom={badge.bottom} top={badge.top}>
+ <span
+ className={cx(
+ cardStyles.avatarRing,
+ !badge.cover && cardStyles.avatarPlain,
+ type === 'group' && cardStyles.avatarRingGroup,
+ )}
>
- <SidebarItemAvatar item={item} size={24} />
- <Flexbox horizontal align={'center'} flex={1} gap={6} style={{ minWidth: 0 }}>
- <Text ellipsis style={{ minWidth: 0 }} weight={600}>
- {displayTitle}
- </Text>
- {roleTag ? (
- <Tag size={'small'} style={{ flex: 'none' }}>
- {roleTag}
- </Tag>
- ) : null}
- </Flexbox>
- </Flexbox>
- <Text className={cardStyles.description} fontSize={12} type={'secondary'}>
- {description}
- </Text>
- {item.labels?.length ? (
- <Flexbox horizontal align={'center'} gap={6} wrap={'wrap'}>
- <LabelTags labels={item.labels} />
- </Flexbox>
+ <SidebarItemAvatar item={item} shape={'circle'} size={AVATAR_SIZE - 6} />
+ </span>
+ </AgentPendant>
+ <Text ellipsis className={cardStyles.name}>
+ {displayTitle}
+ </Text>
+ <div className={cardStyles.roleRow}>
+ {roleTag ? (
+ <span className={cardStyles.role} title={roleTag}>
+ {roleTag}
+ </span>
) : null}
- <Flexbox
- horizontal
- align={'center'}
- gap={8}
- justify={'space-between'}
- style={{ marginBlockStart: 'auto' }}
- >
- {showAuthor ? (
- <Flexbox horizontal align={'center'} gap={6} style={{ minWidth: 0 }}>
- {author ? (
- <Tooltip title={author.name}>
- <Avatar avatar={author.avatar || DEFAULT_AVATAR} size={18} />
- </Tooltip>
- ) : (
- <Text fontSize={12} type={'secondary'}>
- –
- </Text>
- )}
- </Flexbox>
- ) : (
- <div />
- )}
- <Text className={cardStyles.updatedAt} fontSize={12}>
- {updatedAt ? formatUpdatedAt(updatedAt) : '–'}
- </Text>
- </Flexbox>
- </Block>
- </WorkspaceLink>
- <span className={cardStyles.actions}>
- {/* Visible "…" trigger AND right-click open the same menu — the
- context menu alone proved undiscoverable (the sidebar toggle
- folds into it via includeSidebarToggle). Rendered as a SIBLING
- of the link (not inside it) so the menu button isn't a nested
- interactive control within the card's <a>. */}
- <ItemActions
- includeSidebarToggle
- anchor={anchor}
- forceActivated={menuActivated}
- item={item}
- sidebarHidden={sidebarHidden}
- onMenuReady={handleMenuReady}
- onToggleSidebar={onToggleSidebar}
- />
- </span>
- </div>
- </ContextMenuTrigger>
- );
- },
-);
+ </div>
+ <div className={cardStyles.description}>{description}</div>
+ </Block>
+ </WorkspaceLink>
+ <span data-card-actions className={cardStyles.actions}>
+ {/* Visible "…" trigger AND right-click open the same menu — the
+ context menu alone proved undiscoverable (the sidebar toggle
+ folds into it via includeSidebarToggle). Rendered as a SIBLING
+ of the link (not inside it) so the menu button isn't a nested
+ interactive control within the card's <a>. */}
+ <ItemActions
+ includeSidebarToggle
+ anchor={anchor}
+ forceActivated={menuActivated}
+ item={item}
+ sidebarHidden={sidebarHidden}
+ onMenuReady={handleMenuReady}
+ onToggleSidebar={onToggleSidebar}
+ />
+ </span>
+ </div>
+ </ContextMenuTrigger>
+ );
+});
AgentCard.displayName = 'AgentCard';
diff --git a/src/features/AgentViewAll/AgentPendant.tsx b/src/features/AgentViewAll/AgentPendant.tsx
new file mode 100644
index 00000000000..da92ad02d30
--- /dev/null
+++ b/src/features/AgentViewAll/AgentPendant.tsx
@@ -0,0 +1,102 @@
+'use client';
+
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { memo, type ReactNode } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { AgentBottomPendant, AgentTopPendant } from './resolveAgentBadge';
+
+const styles = stylex.create({
+ // Both pendants are absolutely positioned over the avatar, so wearing one
+ // never changes the card height or shifts the name baseline.
+ root: {
+ display: 'inline-flex',
+ flex: 'none',
+ position: 'relative',
+ },
+ chip: {
+ borderColor: cssVar.colorBgContainer,
+ borderStyle: 'solid',
+ borderWidth: 1.5,
+ boxShadow: cssVar.boxShadowTertiary,
+ color: cssVar.colorTextLightSolid,
+ fontSize: 10,
+ fontWeight: 600,
+ insetInlineStart: '50%',
+ lineHeight: '16px',
+ maxWidth: 'calc(100% + 16px)',
+ overflow: 'hidden',
+ paddingInline: 6,
+ pointerEvents: 'none',
+ position: 'absolute',
+ textOverflow: 'ellipsis',
+ transform: 'translateX(-50%)',
+ whiteSpace: 'nowrap',
+ zIndex: 1,
+ },
+ bottom: {
+ borderRadius: 999,
+ insetBlockEnd: -6,
+ },
+ // Arch cap: rounded top, flatter bottom, sitting on the avatar's crown.
+ top: {
+ borderEndEndRadius: 4,
+ borderEndStartRadius: 4,
+ borderStartEndRadius: 9,
+ borderStartStartRadius: 9,
+ insetBlockStart: -10,
+ },
+ // White 10px text needs a dark enough plate: use the deeper warning shade
+ // and darken free-form label colors (gray / yellow presets) before use.
+ core: {
+ backgroundColor: cssVar.colorWarningActive,
+ },
+ official: {
+ backgroundColor: cssVar.colorPrimary,
+ },
+ event: {
+ backgroundColor: cssVar.colorErrorActive,
+ },
+ eventColor: (color: string) => ({
+ backgroundColor: `color-mix(in srgb, ${color} 62%, black)`,
+ }),
+});
+
+interface AgentPendantProps {
+ bottom?: AgentBottomPendant;
+ children: ReactNode;
+ top?: AgentTopPendant;
+}
+
+/** Avatar pendants: an identity chip on the chin and an event arch on the crown. */
+const AgentPendant = memo<AgentPendantProps>(({ bottom, children, top }) => {
+ const { t } = useTranslation('common');
+
+ return (
+ <span {...stylex.props(styles.root)}>
+ {children}
+ {top ? (
+ <span
+ {...stylex.props(
+ styles.chip,
+ styles.top,
+ styles.event,
+ top.color ? styles.eventColor(top.color) : null,
+ )}
+ >
+ {top.label}
+ </span>
+ ) : null}
+ {bottom ? (
+ <span {...stylex.props(styles.chip, styles.bottom, styles[bottom])}>
+ {t(`agentViewAll.pendant.${bottom}`)}
+ </span>
+ ) : null}
+ </span>
+ );
+});
+
+AgentPendant.displayName = 'AgentPendant';
+
+export default AgentPendant;
diff --git a/src/features/AgentViewAll/AgentViewAllPage.tsx b/src/features/AgentViewAll/AgentViewAllPage.tsx
index 4ec3c28f851..5ed19efe467 100644
--- a/src/features/AgentViewAll/AgentViewAllPage.tsx
+++ b/src/features/AgentViewAll/AgentViewAllPage.tsx
@@ -47,7 +47,7 @@ import { useHomeStore } from '@/store/home';
import { homeAgentListSelectors } from '@/store/home/selectors';
import { useUserStore } from '@/store/user';
-import AgentCard, { cardStyles } from './AgentCard';
+import AgentCard, { AgentCardGrid } from './AgentCard';
import AgentRow, { type AgentRowAuthor } from './AgentRow';
import { flattenAgentBuckets } from './flattenBuckets';
import ListConfig from './ListConfig';
@@ -454,15 +454,13 @@ const AgentViewAllPage = memo(() => {
const renderCard = useCallback(
(item: SidebarAgentItem) => (
<AgentCard
- author={item.userId ? authorByUserId.get(item.userId) : undefined}
item={item}
key={item.id}
- showAuthor={showAuthor}
sidebarHidden={!isSidebarItemVisible(item)}
onToggleSidebar={handleToggleSidebar}
/>
),
- [showAuthor, authorByUserId, handleToggleSidebar, isSidebarItemVisible],
+ [handleToggleSidebar, isSidebarItemVisible],
);
const renderRow = useCallback(
@@ -634,15 +632,13 @@ const AgentViewAllPage = memo(() => {
label={group.label}
onToggle={() => toggleGroupCollapsed(group.key)}
/>
- {!collapsed && (
- <div className={cardStyles.grid}>{group.items.map(renderCard)}</div>
- )}
+ {!collapsed && <AgentCardGrid>{group.items.map(renderCard)}</AgentCardGrid>}
</Flexbox>
);
})}
</Flexbox>
) : (
- <div className={cardStyles.grid}>{filteredItems.map(renderCard)}</div>
+ <AgentCardGrid>{filteredItems.map(renderCard)}</AgentCardGrid>
)
) : (
// Grouped list shares the card branch's wrapper rhythm (outer gap 8,
diff --git a/src/features/AgentViewAll/LabelTags.tsx b/src/features/AgentViewAll/LabelTags.tsx
index 0d52f7246dd..8a66790679c 100644
--- a/src/features/AgentViewAll/LabelTags.tsx
+++ b/src/features/AgentViewAll/LabelTags.tsx
@@ -31,7 +31,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
`,
}));
-/** Pill-style label tags (color dot + name), shared by list rows and cards. */
+/** Pill-style label tags (color dot + name) shown on list rows. */
const LabelTags = memo<{ labels?: SidebarAgentLabel[] }>(({ labels }) => {
if (!labels?.length) return null;
diff --git a/src/features/AgentViewAll/SidebarAgentsSection.tsx b/src/features/AgentViewAll/SidebarAgentsSection.tsx
index 8ce99b5fa93..45e7d97fad7 100644
--- a/src/features/AgentViewAll/SidebarAgentsSection.tsx
+++ b/src/features/AgentViewAll/SidebarAgentsSection.tsx
@@ -13,6 +13,7 @@ import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
+import { AGENT_GRID_MIN_COLUMN } from './AgentCard';
import ItemActions from './ItemActions';
import SidebarItemAvatar from './SidebarItemAvatar';
@@ -68,8 +69,8 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
grid: css`
display: grid;
- /* Full-width page: as many 280px+ columns as fit, one column on narrow screens. */
- grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
+ /* Same column width as the badge wall below, so both grids line up. */
+ grid-template-columns: repeat(auto-fill, minmax(min(${AGENT_GRID_MIN_COLUMN}px, 100%), 1fr));
gap: 12px;
width: 100%;
diff --git a/src/features/AgentViewAll/SidebarItemAvatar.tsx b/src/features/AgentViewAll/SidebarItemAvatar.tsx
index 7b9cfa4e33f..9524f8456e5 100644
--- a/src/features/AgentViewAll/SidebarItemAvatar.tsx
+++ b/src/features/AgentViewAll/SidebarItemAvatar.tsx
@@ -8,11 +8,13 @@ import AgentGroupAvatar from '@/features/AgentGroupAvatar';
interface SidebarItemAvatarProps {
item: SidebarAgentItem;
+ /** Single-agent avatar shape; group avatars keep their stacked layout. */
+ shape?: 'circle' | 'square';
size: number;
}
/** Agent avatar that renders the stacked group variant for group chats. */
-const SidebarItemAvatar = memo<SidebarItemAvatarProps>(({ item, size }) => {
+const SidebarItemAvatar = memo<SidebarItemAvatarProps>(({ item, shape, size }) => {
const { avatar, backgroundColor, id, type } = item;
return type === 'group' ? (
@@ -28,6 +30,7 @@ const SidebarItemAvatar = memo<SidebarItemAvatarProps>(({ item, size }) => {
avatar={typeof avatar === 'string' ? avatar : undefined}
background={backgroundColor || undefined}
name={agentDisplayName(item)}
+ shape={shape}
size={size}
/>
);
diff --git a/src/features/AgentViewAll/resolveAgentBadge.test.ts b/src/features/AgentViewAll/resolveAgentBadge.test.ts
new file mode 100644
index 00000000000..c6240c217bf
--- /dev/null
+++ b/src/features/AgentViewAll/resolveAgentBadge.test.ts
@@ -0,0 +1,58 @@
+import type { SidebarAgentItem } from '@lobechat/types';
+import { describe, expect, it } from 'vitest';
+
+import { resolveAgentBadge } from './resolveAgentBadge';
+
+const agent = (overrides: Partial<SidebarAgentItem> = {}): SidebarAgentItem => ({
+ id: 'agt_1',
+ pinned: false,
+ title: 'Agent',
+ type: 'agent',
+ updatedAt: new Date(0),
+ ...overrides,
+});
+
+describe('resolveAgentBadge', () => {
+ it('keeps a regular agent clean', () => {
+ expect(resolveAgentBadge(agent())).toEqual({});
+ });
+
+ it('adds a cover only when the agent picked an avatar background color', () => {
+ expect(resolveAgentBadge(agent({ backgroundColor: '#3b82f6' })).cover).toBe('#3b82f6');
+ expect(resolveAgentBadge(agent({ backgroundColor: ' ' })).cover).toBeUndefined();
+ expect(resolveAgentBadge(agent({ backgroundColor: null })).cover).toBeUndefined();
+ // The swatch picker's "default" entry stores transparent black.
+ expect(resolveAgentBadge(agent({ backgroundColor: 'rgba(0, 0, 0, 0)' })).cover).toBeUndefined();
+ });
+
+ it('marks builtin agents official before pinned ones core', () => {
+ expect(resolveAgentBadge(agent({ slug: 'inbox' })).bottom).toBe('official');
+ expect(resolveAgentBadge(agent({ pinned: true, slug: 'inbox' })).bottom).toBe('official');
+ expect(resolveAgentBadge(agent({ pinned: true })).bottom).toBe('core');
+ expect(resolveAgentBadge(agent({ slug: 'my-custom-agent' })).bottom).toBeUndefined();
+ });
+
+ it('gives the arch only to agents carrying an event or limited label', () => {
+ const badge = resolveAgentBadge(
+ agent({
+ labels: [
+ { color: '#3b82f6', id: 'l1', name: '研发' },
+ { color: '#8b5cf6', id: 'l2', name: 'Hackathon 2026' },
+ ],
+ }),
+ );
+ expect(badge.top).toEqual({ color: '#8b5cf6', label: 'Hackathon 2026' });
+
+ expect(resolveAgentBadge(agent({ labels: [{ id: 'l3', name: '限定' }] })).top).toEqual({
+ color: undefined,
+ label: '限定',
+ });
+ expect(resolveAgentBadge(agent({ labels: [{ id: 'l1', name: '研发' }] })).top).toBeUndefined();
+ // Whole words only: ordinary labels that merely contain the keywords stay clean.
+ for (const name of ['Unlimited', 'Prevention', 'Eventual'])
+ expect(resolveAgentBadge(agent({ labels: [{ id: 'l4', name }] })).top).toBeUndefined();
+ expect(
+ resolveAgentBadge(agent({ labels: [{ id: 'l5', name: 'Spring Event' }] })).top?.label,
+ ).toBe('Spring Event');
+ });
+});
diff --git a/src/features/AgentViewAll/resolveAgentBadge.ts b/src/features/AgentViewAll/resolveAgentBadge.ts
new file mode 100644
index 00000000000..80995b660b2
--- /dev/null
+++ b/src/features/AgentViewAll/resolveAgentBadge.ts
@@ -0,0 +1,52 @@
+import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';
+import type { SidebarAgentItem } from '@lobechat/types';
+
+import { usableBackground } from '@/components/Avatar/fallback';
+
+const BUILTIN_SLUGS = new Set<string>(Object.values(BUILTIN_AGENT_SLUGS));
+
+/**
+ * Labels that mark an event / limited-time agent. Only these earn the arch
+ * badge above the avatar — regular agents stay clean.
+ */
+const EVENT_LABEL_PATTERN = /\b(?:hackathons?|events?|limited)\b|限定|活动/i;
+
+export type AgentBottomPendant = 'core' | 'official';
+
+export interface AgentTopPendant {
+ color?: string | null;
+ label: string;
+}
+
+export interface AgentBadge {
+ /** Short identity chip pinned to the avatar's bottom edge. */
+ bottom?: AgentBottomPendant;
+ /** Cover band color; absent renders the plain (avatar-only) badge. */
+ cover?: string;
+ /** Arch badge above the avatar, reserved for event / limited agents. */
+ top?: AgentTopPendant;
+}
+
+/**
+ * Data-driven badge decorations for the agent list's badge wall. Most agents
+ * resolve to nothing, so the wall doesn't turn into a sticker board:
+ * - cover: only agents that picked a real (non-transparent) avatar background color;
+ * - bottom chip: builtin agents read "official", pinned agents read "core";
+ * - top arch: only agents carrying an event / limited label.
+ */
+export const resolveAgentBadge = (item: SidebarAgentItem): AgentBadge => {
+ const badge: AgentBadge = {};
+
+ // The swatch picker's "default" entry stores a transparent color, which means
+ // "no color chosen" — same rule as the avatar fallback.
+ const cover = usableBackground(item.backgroundColor);
+ if (cover) badge.cover = cover;
+
+ if (item.slug && BUILTIN_SLUGS.has(item.slug)) badge.bottom = 'official';
+ else if (item.pinned) badge.bottom = 'core';
+
+ const eventLabel = item.labels?.find((label) => EVENT_LABEL_PATTERN.test(label.name));
+ if (eventLabel) badge.top = { color: eventLabel.color, label: eventLabel.name };
+
+ return badge;
+};
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 177d092afc1..f4216b15ffb 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -208,7 +208,7 @@ export interface SystemStatus {
*/
agentListSidebarSectionCollapsed?: boolean;
/**
- * View mode of the agent view-all page (card grid vs table list)
+ * View mode of the agent view-all page (badge-wall card grid vs table list); defaults to card
*/
agentListViewMode?: 'card' | 'list';
/**
@@ -589,7 +589,7 @@ export const INITIAL_STATUS = {
agentBuilderPanelWidth: 360,
agentListExpandedGroupKeys: [] as string[],
agentListSidebarSectionCollapsed: false,
- agentListViewMode: 'list' as const,
+ agentListViewMode: 'card' as const,
agentListViewOptions: {
groupBy: 'none' as const,
orderBy: 'updatedAt' as const,
diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.ts
index 8a752af4d71..609573b5324 100644
--- a/src/store/global/selectors/systemStatus.ts
+++ b/src/store/global/selectors/systemStatus.ts
@@ -456,7 +456,7 @@ const portalWidths = (s: GlobalState) => s.status.portalWidths;
const filePanelWidth = (s: GlobalState) => s.status.filePanelWidth;
const groupAgentBuilderPanelWidth = (s: GlobalState) => s.status.groupAgentBuilderPanelWidth || 360;
const imagePanelWidth = (s: GlobalState) => s.status.imagePanelWidth;
-const agentListViewMode = (s: GlobalState) => s.status.agentListViewMode || 'list';
+const agentListViewMode = (s: GlobalState) => s.status.agentListViewMode || 'card';
const DEFAULT_AGENT_DOCUMENT_SORT: AgentDocumentSort = {
by: 'name',
foldersFirst: true,