🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(marketplace): Lobot's Agents catalog and Agent page (#23685)
Lobehub Coder4014db207b0c
diff --git a/e2e/src/features/community/interactions.feature b/e2e/src/features/community/interactions.featureindex 9ea4d86f61d..fa4cbddb49f 100644--- a/e2e/src/features/community/interactions.feature+++ b/e2e/src/features/community/interactions.feature@@ -11,14 +11,14 @@ Feature: Discover Interactions@COMMUNITY-INTERACT-001 @P1Scenario: Search for assistants- Given I navigate to "/marketplace/agent"+ Given I navigate to "/marketplace/agent?tab=public"When I type "developer" in the search barAnd I wait for the search results to loadThen I should see only "Code Assistant" in the assistant catalog@COMMUNITY-INTERACT-002 @P1Scenario: Filter assistants by category- Given I navigate to "/marketplace/agent"+ Given I navigate to "/marketplace/agent?tab=public"When I open the assistant category "programming"And I wait for the filtered results to loadThen I should see only "Code Assistant" in the assistant catalog@@ -26,7 +26,7 @@ Feature: Discover Interactions@COMMUNITY-INTERACT-003 @P1Scenario: Navigate to next page of assistants- Given I navigate to "/marketplace/agent"+ Given I navigate to "/marketplace/agent?tab=public"When I open the recommended assistantsAnd I click the next page buttonThen I should be navigated to "/marketplace/agent?sort=recommended&page=2"@@ -34,7 +34,7 @@ Feature: Discover Interactions@COMMUNITY-INTERACT-004 @P1Scenario: Navigate to assistant detail page- Given I navigate to "/marketplace/agent"+ Given I navigate to "/marketplace/agent?tab=public"When I click on the first assistant cardThen I should be navigated to the assistant detail pageAnd I should see the assistant detail contentdiff --git a/e2e/src/features/community/smoke.feature b/e2e/src/features/community/smoke.featureindex 70dcf199c2d..63b90df6a7c 100644--- a/e2e/src/features/community/smoke.feature+++ b/e2e/src/features/community/smoke.feature@@ -17,6 +17,12 @@ Feature: Community Smoke TestsThen the page should load without errorsAnd I should see the page bodyAnd I should see the search bar+ And I should see assistant cards++ @COMMUNITY-SMOKE-006 @P0+ Scenario: Load the community Agents under Public+ Given I navigate to "/marketplace/agent?tab=public"+ Then the page should load without errorsAnd I should see the assistant category "programming"And I should see assistant cardsdiff --git a/e2e/src/mocks/community/data.ts b/e2e/src/mocks/community/data.tsindex c796348b17c..a658cef0a6b 100644--- a/e2e/src/mocks/community/data.ts+++ b/e2e/src/mocks/community/data.ts@@ -129,6 +129,35 @@ export const mockAssistantItems: DiscoverAssistantItem[] = [},];+/**+ * LobeHub's curated Agents (`market.agent.getOnboardingFull`), keyed by+ * category: the Agents page's "All" and "Verified" tabs.+ */+export const mockOnboardingAgents = {+ 'engineering': [+ {+ author: { name: 'LobeHub' },+ avatar: '🧑💻',+ description: 'Reviews pull requests and points out risky changes.',+ forkCount: 120,+ identifier: 'agent-template-code-reviewer',+ name: 'Code Reviewer',+ pluginCount: 1,+ },+ ],+ 'product-management': [+ {+ author: { name: 'LobeHub' },+ avatar: '📋',+ description: 'Turns rough ideas into a dated scope document.',+ forkCount: 300,+ identifier: 'agent-template-release-planner',+ name: 'Release Planner',+ pluginCount: 0,+ },+ ],+};+export const mockAssistantList: AssistantListResponse = {currentPage: 1,items: mockAssistantItems,diff --git a/e2e/src/mocks/community/handlers.ts b/e2e/src/mocks/community/handlers.tsindex 507e8570990..404044980a2 100644--- a/e2e/src/mocks/community/handlers.ts+++ b/e2e/src/mocks/community/handlers.ts@@ -16,6 +16,7 @@ import {mockModelDetails,mockModelItems,mockModelList,+ mockOnboardingAgents,mockProviderDetails,mockProviderItems,mockProviderList,@@ -244,6 +245,10 @@ const findByIdentifier = <T extends { identifier: string }>(items: T[], input: uconst getMockResponse = (procedure: string, input: unknown): unknown => {switch (procedure) {+ case 'market.agent.getOnboardingFull': {+ return mockOnboardingAgents;+ }+case 'market.getAssistantCategories': {return getAssistantCategories(input);}diff --git a/locales/en-US/discover.json b/locales/en-US/discover.jsonindex 9582eb39efa..bfc51add96a 100644--- a/locales/en-US/discover.json+++ b/locales/en-US/discover.json@@ -251,6 +251,36 @@"isFeatured": "Featured","isOfficial": "Officially Verified","like": "Like",+ "marketplaceAgents.add": "Add",+ "marketplaceAgents.addFailed": "Couldn't add it. Please try again.",+ "marketplaceAgents.added": "Added",+ "marketplaceAgents.by": "by {{name}}",+ "marketplaceAgents.community": "Community",+ "marketplaceAgents.detail.add": "Add Agent",+ "marketplaceAgents.detail.author": "Author",+ "marketplaceAgents.detail.category": "Category",+ "marketplaceAgents.detail.copyLink": "Copy link",+ "marketplaceAgents.detail.info": "Information",+ "marketplaceAgents.detail.message": "Message",+ "marketplaceAgents.detail.notAdded": "Not added",+ "marketplaceAgents.detail.noticeCommunity": "Made by community member {{author}}, not reviewed by LobeHub. Once added, it can take actions for you.",+ "marketplaceAgents.detail.noticeVerified": "Made by {{author}} and reviewed by LobeHub before listing. Once added, it can take actions for you.",+ "marketplaceAgents.detail.showAll": "Show all",+ "marketplaceAgents.detail.showLess": "Show less",+ "marketplaceAgents.detail.skills": "Skills",+ "marketplaceAgents.detail.source": "Source",+ "marketplaceAgents.detail.sourceCommunity": "Community",+ "marketplaceAgents.detail.sourceVerified": "Reviewed by LobeHub",+ "marketplaceAgents.detail.updatedAt": "Updated",+ "marketplaceAgents.detail.version": "Version",+ "marketplaceAgents.emptySearch": "No matching Agents",+ "marketplaceAgents.featured": "Featured",+ "marketplaceAgents.installed": "Added {{name}} to your Agents",+ "marketplaceAgents.noDescription": "No description",+ "marketplaceAgents.skillCount": "{{count}} skills",+ "marketplaceAgents.tabs.all": "All",+ "marketplaceAgents.tabs.public": "Public",+ "marketplaceAgents.tabs.verified": "Verified","mcp.categories.all.description": "All MCP Servers","mcp.categories.all.name": "All","mcp.categories.business.description": "Business and Enterprise Services",diff --git a/locales/zh-CN/discover.json b/locales/zh-CN/discover.jsonindex 413cbdbf17c..efb410ebb17 100644--- a/locales/zh-CN/discover.json+++ b/locales/zh-CN/discover.json@@ -251,6 +251,36 @@"isFeatured": "推荐","isOfficial": "官方认证","like": "喜欢",+ "marketplaceAgents.add": "添加",+ "marketplaceAgents.addFailed": "添加失败,请重试。",+ "marketplaceAgents.added": "已添加",+ "marketplaceAgents.by": "作者:{{name}}",+ "marketplaceAgents.community": "社区",+ "marketplaceAgents.detail.add": "添加助理",+ "marketplaceAgents.detail.author": "作者",+ "marketplaceAgents.detail.category": "分类",+ "marketplaceAgents.detail.copyLink": "复制链接",+ "marketplaceAgents.detail.info": "信息",+ "marketplaceAgents.detail.message": "发消息",+ "marketplaceAgents.detail.notAdded": "未添加",+ "marketplaceAgents.detail.noticeCommunity": "由社区用户 {{author}} 创建,未经 LobeHub 审核。添加后,它可以代表你执行操作。",+ "marketplaceAgents.detail.noticeVerified": "由 {{author}} 创建,上线前已经 LobeHub 审核。添加后,它可以代表你执行操作。",+ "marketplaceAgents.detail.showAll": "展开全部",+ "marketplaceAgents.detail.showLess": "收起",+ "marketplaceAgents.detail.skills": "技能",+ "marketplaceAgents.detail.source": "来源",+ "marketplaceAgents.detail.sourceCommunity": "社区",+ "marketplaceAgents.detail.sourceVerified": "经 LobeHub 审核",+ "marketplaceAgents.detail.updatedAt": "更新时间",+ "marketplaceAgents.detail.version": "版本",+ "marketplaceAgents.emptySearch": "没有匹配的助理",+ "marketplaceAgents.featured": "精选",+ "marketplaceAgents.installed": "已将 {{name}} 添加到你的助理",+ "marketplaceAgents.noDescription": "暂无简介",+ "marketplaceAgents.skillCount": "{{count}} 个技能",+ "marketplaceAgents.tabs.all": "全部",+ "marketplaceAgents.tabs.public": "公开",+ "marketplaceAgents.tabs.verified": "已验证","mcp.categories.all.description": "全部 MCP Servers","mcp.categories.all.name": "全部","mcp.categories.business.description": "商业与企业服务",diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.test.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.test.tsindex bf317dcbd50..a34e3ea95d3 100644--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.test.ts+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.test.ts@@ -46,6 +46,21 @@ describe('getTemplatesByCategories', () => {});describe('normalizeAgentTemplate', () => {+ it('keeps the author name, add count and skill count when the API has them', () => {+ expect(+ normalizeAgentTemplate(+ {+ author: { name: 'LobeHub' },+ forkCount: 12,+ identifier: 'agent-template-release-manager',+ name: 'Release Manager',+ pluginCount: 2,+ },+ 'product-management',+ ),+ ).toMatchObject({ author: 'LobeHub', forkCount: 12, pluginCount: 2 });+ });+it('maps an onboarding-full item using the outer category key', () => {const result = normalizeAgentTemplate({diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.tsindex 4349d371222..84e9e355fba 100644--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.ts+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/data/agent-templates.ts@@ -4,10 +4,13 @@ import { MARKETPLACE_CATEGORY_VALUES } from '../types';const MARKETPLACE_CATEGORY_SET = new Set<string>(MARKETPLACE_CATEGORY_VALUES);export interface RawAgentTemplate {+ author?: { name?: string } | string;avatar?: string;description?: string;+ forkCount?: number;identifier?: string;name?: string;+ pluginCount?: number;}/** API response shape: top-level keys are MarketplaceCategory slugs. */@@ -19,11 +22,15 @@ export const normalizeAgentTemplate = (): AgentTemplate | undefined => {if (!item.identifier || !item.name) return undefined;if (!MARKETPLACE_CATEGORY_SET.has(category)) return undefined;+ const author = typeof item.author === 'string' ? item.author : item.author?.name;return {+ ...(author ? { author } : {}),avatar: item.avatar,category: category as MarketplaceCategory,description: item.description,+ ...(typeof item.forkCount === 'number' ? { forkCount: item.forkCount } : {}),id: item.identifier,+ ...(typeof item.pluginCount === 'number' ? { pluginCount: item.pluginCount } : {}),title: item.name,};};diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/types.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/types.tsindex 6ddeecc9f3f..db2b3ac3c4f 100644--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/types.ts+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/types.ts@@ -24,13 +24,19 @@ export const MARKETPLACE_CATEGORY_VALUES = Object.values(MarketplaceCategory);* A single agent template shown in the marketplace picker.*/export interface AgentTemplate {+ /** Who published it in the marketplace (LobeHub for the curated set). */+ author?: string;/** Optional emoji or image URL — falls back to a category default in the UI. */avatar?: string;category: MarketplaceCategory;/** Optional one-line capability summary. Upstream marketplace API may omit this. */description?: string;+ /** Times it was added; orders the Marketplace's featured picks. */+ forkCount?: number;/** Marketplace identifier (e.g. 'agent-template-copywriter'). */id: string;+ /** Skills and tools it ships with. */+ pluginCount?: number;/** Human-readable title (English Title Case). */title: string;}diff --git a/packages/locales/src/default/discover.ts b/packages/locales/src/default/discover.tsindex 39e675b5db4..7316e6ead23 100644--- a/packages/locales/src/default/discover.ts+++ b/packages/locales/src/default/discover.ts@@ -140,6 +140,38 @@ export default {'apps.summary.tool.zendesk': 'Create and track support tickets','apps.toolCapability': 'Agent tools','apps.unavailable': 'This app is unavailable.',+ 'marketplaceAgents.add': 'Add',+ 'marketplaceAgents.addFailed': "Couldn't add it. Please try again.",+ 'marketplaceAgents.added': 'Added',+ 'marketplaceAgents.by': 'by {{name}}',+ 'marketplaceAgents.community': 'Community',+ 'marketplaceAgents.detail.add': 'Add Agent',+ 'marketplaceAgents.detail.author': 'Author',+ 'marketplaceAgents.detail.category': 'Category',+ 'marketplaceAgents.detail.copyLink': 'Copy link',+ 'marketplaceAgents.detail.info': 'Information',+ 'marketplaceAgents.detail.message': 'Message',+ 'marketplaceAgents.detail.notAdded': 'Not added',+ 'marketplaceAgents.detail.noticeCommunity':+ 'Made by community member {{author}}, not reviewed by LobeHub. Once added, it can take actions for you.',+ 'marketplaceAgents.detail.noticeVerified':+ 'Made by {{author}} and reviewed by LobeHub before listing. Once added, it can take actions for you.',+ 'marketplaceAgents.detail.showAll': 'Show all',+ 'marketplaceAgents.detail.showLess': 'Show less',+ 'marketplaceAgents.detail.skills': 'Skills',+ 'marketplaceAgents.detail.source': 'Source',+ 'marketplaceAgents.detail.sourceCommunity': 'Community',+ 'marketplaceAgents.detail.sourceVerified': 'Reviewed by LobeHub',+ 'marketplaceAgents.detail.updatedAt': 'Updated',+ 'marketplaceAgents.detail.version': 'Version',+ 'marketplaceAgents.emptySearch': 'No matching Agents',+ 'marketplaceAgents.featured': 'Featured',+ 'marketplaceAgents.installed': 'Added {{name}} to your Agents',+ 'marketplaceAgents.noDescription': 'No description',+ 'marketplaceAgents.skillCount': '{{count}} skills',+ 'marketplaceAgents.tabs.all': 'All',+ 'marketplaceAgents.tabs.public': 'Public',+ 'marketplaceAgents.tabs.verified': 'Verified','tab.apps': 'Apps','tab.mcp': 'MCP Servers','catalog.add': 'Add',diff --git a/src/features/Marketplace/Agents/AgentDetail.tsx b/src/features/Marketplace/Agents/AgentDetail.tsxnew file mode 100644index 00000000000..1b5aef72808--- /dev/null+++ b/src/features/Marketplace/Agents/AgentDetail.tsx@@ -0,0 +1,340 @@+'use client';++import { AGENT_CHAT_URL, AGENTS_OFFICIAL_URL } from '@lobechat/const';+import { Avatar, Button, copyToClipboard, Flexbox, Icon, Markdown, Text, toast } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { ChevronRight, Puzzle, UsersRound } from 'lucide-react';+import { memo, type ReactNode, useState } from 'react';+import { useTranslation } from 'react-i18next';+import urlJoin from 'url-join';++import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useDiscoverStore } from '@/store/discover';+import { skillSelectors } from '@/store/discover/selectors';+import type { DiscoverAssistantDetail } from '@/types/discover';++import { catalogStyles } from '../Catalog/styles';+import { useCatalogDetailNavigate } from '../Catalog/useCatalogDetailNavigate';+import { MARKETPLACE_SKILL_PATH } from '../paths';+import { AgentRowSkeleton } from './AgentSkeleton';+import IconTile from './IconTile';+import MarketAgentAvatar from './MarketAgentAvatar';+import MarketCard from './MarketCard';+import { useMarketAgentInstall } from './useMarketAgentInstall';++const styles = stylex.create({+ actions: {+ display: 'flex',+ flex: 'none',+ gap: 8,+ },+ clamp: {+ position: 'relative',+ overflow: 'hidden',+ maxHeight: 220,+ maskImage: 'linear-gradient(to bottom, black 70%, transparent)',+ },+ facts: {+ display: 'grid',+ gridTemplateColumns: '120px minmax(0, 1fr)',+ rowGap: 12,+ },+ link: {+ alignSelf: 'flex-start',+ padding: 0,+ borderWidth: 0,+ font: 'inherit',+ fontSize: 13,+ color: {+ 'default': cssVar.colorTextTertiary,+ ':hover': cssVar.colorTextSecondary,+ },+ backgroundColor: 'transparent',+ cursor: 'pointer',+ },+ list: {+ margin: -16,+ },+ skill: {+ display: 'flex',+ alignItems: 'center',+ gap: 12,+ minWidth: 0,+ paddingBlock: 12,+ paddingInline: 16,+ borderBlockStartWidth: {+ 'default': 1,+ ':first-child': 0,+ },+ borderBlockStartStyle: 'solid',+ borderBlockStartColor: cssVar.colorFillSecondary,+ },+ skillLink: {+ cursor: 'pointer',+ backgroundColor: {+ 'default': 'transparent',+ ':hover': cssVar.colorFillQuaternary,+ },+ },+ status: {+ display: 'inline-flex',+ flex: 'none',+ alignItems: 'center',+ paddingBlock: 2,+ paddingInline: 8,+ borderRadius: 999,+ fontSize: 12,+ lineHeight: '18px',+ color: cssVar.colorTextSecondary,+ backgroundColor: cssVar.colorFillTertiary,+ },+ statusAdded: {+ color: cssVar.colorSuccess,+ backgroundColor: cssVar.colorSuccessBg,+ },+ text: {+ display: 'flex',+ flex: '1',+ flexDirection: 'column',+ minWidth: 0,+ },+ title: {+ marginBlock: 0,+ fontSize: 18,+ fontWeight: 600,+ lineHeight: 1.4,+ },+});++const Section = ({ children, title }: { children: ReactNode; title: string }) => (+ <Flexbox gap={8}>+ <Text as={'h2'} fontSize={14} weight={600}>+ {title}+ </Text>+ {children}+ </Flexbox>+);++/**+ * One plugin the Agent ships with. A Market skill shows as one (icon, name,+ * blurb) and opens its page; anything else (an MCP server, a built-in tool)+ * shows its identifier.+ */+const PluginRow = memo<{ identifier: string }>(({ identifier }) => {+ const navigate = useCatalogDetailNavigate();+ const useFetchSkillDetail = useDiscoverStore((s) => s.useFetchSkillDetail);+ const { isLoading, queryKey } = useFetchSkillDetail({ identifier });+ const skill = useDiscoverStore(skillSelectors.skillDetail(queryKey));++ if (isLoading && !skill) return <AgentRowSkeleton />;++ if (!skill)+ return (+ <div {...stylex.props(styles.skill)}>+ <IconTile size={36}>+ <Icon color={cssVar.colorTextSecondary} icon={Puzzle} size={18} />+ </IconTile>+ <Text ellipsis type={'secondary'}>+ {identifier}+ </Text>+ </div>+ );++ return (+ <div+ {...stylex.props(styles.skill, styles.skillLink)}+ onClick={() => navigate(urlJoin(MARKETPLACE_SKILL_PATH, identifier))}+ >+ <IconTile size={36}>+ <Avatar avatar={skill.icon || skill.name} shape={'square'} size={24} />+ </IconTile>+ <span {...stylex.props(styles.text)}>+ <Text ellipsis weight={500}>+ {skill.name}+ </Text>+ <Text ellipsis fontSize={12} type={'secondary'}>+ {skill.description}+ </Text>+ </span>+ <Icon color={cssVar.colorTextTertiary} icon={ChevronRight} size={16} />+ </div>+ );+});++PluginRow.displayName = 'MarketplaceAgentPluginRow';++/** The instructions, clamped to a few paragraphs until "Show all". */+const Instructions = memo<{ content: string }>(({ content }) => {+ const { t } = useTranslation('discover');+ const [open, setOpen] = useState(false);+ const long = content.length > 600;++ return (+ <Flexbox gap={8}>+ <div {...stylex.props(long && !open && styles.clamp)}>+ <Markdown fontSize={14} variant={'chat'}>+ {content}+ </Markdown>+ </div>+ {long && (+ <button type={'button'} {...stylex.props(styles.link)} onClick={() => setOpen(!open)}>+ {t(open ? 'marketplaceAgents.detail.showLess' : 'marketplaceAgents.detail.showAll')}+ </button>+ )}+ </Flexbox>+ );+});++Instructions.displayName = 'MarketplaceAgentInstructions';++/**+ * A Marketplace Agent's page: whether I have it, who made it and whether+ * LobeHub reviewed it, the skills it ships with, its instructions and facts.+ * "Add Agent" forks a copy into mine; once added, "Message" opens its chat.+ */+const AgentDetail = memo<{ detail: Partial<DiscoverAssistantDetail>; mobile?: boolean }>(+ ({ detail, mobile }) => {+ const { t, i18n } = useTranslation(['discover', 'common']);+ const navigate = useWorkspaceAwareNavigate();+ const identifier = detail.identifier ?? '';+ const title = detail.title || identifier;+ const { add, added, canCreate, localId, pending } = useMarketAgentInstall(identifier, title);++ const verified = !!detail.isValidated;+ // `user.*` are the author's private plugins: nothing anyone else can open or install.+ const plugins = (detail.config?.plugins ?? [])+ .map((entry) =>+ typeof entry === 'string' ? entry : (entry as { identifier: string }).identifier,+ )+ .filter((id) => !!id && !id.startsWith('user.'));+ const updatedAt = detail.updatedAt ?? detail.createdAt;+ const systemRole = detail.config?.systemRole;++ const openChat = (agentId: string) => navigate(AGENT_CHAT_URL(agentId, mobile));++ return (+ <div {...stylex.props(catalogStyles.frame)} data-testid={'assistant-detail-content'}>+ <Flexbox gap={24}>+ <Flexbox horizontal align={'flex-start'} gap={16} wrap={'wrap'}>+ <MarketAgentAvatar avatar={detail.avatar} size={56} title={title} />+ <Flexbox flex={1} gap={4} style={{ minWidth: 200 }}>+ <Flexbox horizontal align={'center'} gap={8}>+ <h1 {...stylex.props(styles.title)}>{title}</h1>+ <span {...stylex.props(styles.status, added && styles.statusAdded)}>+ {t(added ? 'marketplaceAgents.added' : 'marketplaceAgents.detail.notAdded')}+ </span>+ </Flexbox>+ <Text ellipsis={{ rows: 2 }} type={'secondary'}>+ {[+ detail.description,+ detail.author && t('marketplaceAgents.by', { name: detail.author }),+ ]+ .filter(Boolean)+ .join(' · ')}+ </Text>+ </Flexbox>+ <div {...stylex.props(styles.actions)}>+ <Button+ type={'fill'}+ onClick={async () => {+ await copyToClipboard(urlJoin(AGENTS_OFFICIAL_URL, identifier));+ toast.success(t('copySuccess', { ns: 'common' }));+ }}+ >+ {t('marketplaceAgents.detail.copyLink')}+ </Button>+ {added && localId ? (+ <Button type={'primary'} onClick={() => openChat(localId)}>+ {t('marketplaceAgents.detail.message')}+ </Button>+ ) : (+ <Button+ disabled={!canCreate}+ loading={pending}+ type={'primary'}+ onClick={() => void add()}+ >+ {t('marketplaceAgents.detail.add')}+ </Button>+ )}+ </div>+ </Flexbox>+ <Flexbox horizontal align={'center'} gap={8}>+ <Icon color={cssVar.colorTextTertiary} icon={UsersRound} size={14} />+ <Text fontSize={13} type={'secondary'}>+ {t(+ verified+ ? 'marketplaceAgents.detail.noticeVerified'+ : 'marketplaceAgents.detail.noticeCommunity',+ { author: detail.author },+ )}+ </Text>+ </Flexbox>+ {plugins.length > 0 && (+ <Section title={t('marketplaceAgents.detail.skills')}>+ <MarketCard gap={0}>+ <div {...stylex.props(styles.list)}>+ {plugins.map((id) => (+ <PluginRow identifier={id} key={id} />+ ))}+ </div>+ </MarketCard>+ </Section>+ )}+ <Section title={t('marketplaceAgents.detail.info')}>+ <MarketCard gap={16}>+ {systemRole && <Instructions content={systemRole} />}+ <div {...stylex.props(styles.facts)}>+ {detail.author && (+ <>+ <Text type={'secondary'}>{t('marketplaceAgents.detail.author')}</Text>+ <Text>{detail.author}</Text>+ </>+ )}+ <Text type={'secondary'}>{t('marketplaceAgents.detail.source')}</Text>+ <Text>+ {t(+ verified+ ? 'marketplaceAgents.detail.sourceVerified'+ : 'marketplaceAgents.detail.sourceCommunity',+ )}+ </Text>+ {detail.category && (+ <>+ <Text type={'secondary'}>{t('marketplaceAgents.detail.category')}</Text>+ <Text>+ {t(`category.assistant.${detail.category}`, {+ defaultValue: detail.category,+ })}+ </Text>+ </>+ )}+ {detail.currentVersion && (+ <>+ <Text type={'secondary'}>{t('marketplaceAgents.detail.version')}</Text>+ <Text>{detail.currentVersion}</Text>+ </>+ )}+ {updatedAt && (+ <>+ <Text type={'secondary'}>{t('marketplaceAgents.detail.updatedAt')}</Text>+ <Text>+ {new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(+ new Date(updatedAt),+ )}+ </Text>+ </>+ )}+ </div>+ </MarketCard>+ </Section>+ </Flexbox>+ </div>+ );+ },+);++AgentDetail.displayName = 'MarketplaceAgentDetail';++export default AgentDetail;diff --git a/src/features/Marketplace/Agents/AgentSection.tsx b/src/features/Marketplace/Agents/AgentSection.tsxnew file mode 100644index 00000000000..60e0f6f8827--- /dev/null+++ b/src/features/Marketplace/Agents/AgentSection.tsx@@ -0,0 +1,121 @@+import { Flexbox, Icon, Text } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { ChevronRight } from 'lucide-react';+import { memo, type ReactNode, type RefObject, useId } from 'react';+import { useTranslation } from 'react-i18next';++import WorkspaceLink from '@/features/Workspace/WorkspaceLink';+import type { AssistantMarketSource } from '@/types/discover';++import type { MarketAgentSummary } from './marketAgentCatalog';+import MarketAgentRow from './MarketAgentRow';++export const agentGridStyles = stylex.create({+ cards: {+ display: 'grid',+ gridTemplateColumns: {+ 'default': 'repeat(3, minmax(0, 1fr))',+ '@media (max-width: 720px)': 'minmax(0, 1fr)',+ },+ gap: 12,+ },+ divider: {+ height: 1,+ backgroundColor: cssVar.colorBorderSecondary,+ },+ grid: {+ display: 'grid',+ gridTemplateColumns: {+ 'default': 'repeat(2, minmax(0, 1fr))',+ '@media (max-width: 720px)': 'minmax(0, 1fr)',+ },+ columnGap: 16,+ rowGap: 4,+ },+});++const styles = stylex.create({+ more: {+ display: 'flex',+ alignItems: 'center',+ gap: 2,+ padding: 0,+ borderWidth: 0,+ font: 'inherit',+ fontSize: 13,+ color: {+ 'default': cssVar.colorTextTertiary,+ ':hover': cssVar.colorTextSecondary,+ },+ backgroundColor: 'transparent',+ cursor: 'pointer',+ },+});++/**+ * A titled block: a rule, the title with its count, and "View all" when there+ * is more — a button (`onMore`) or a link to the full list (`to`).+ */+export const AgentSection = ({+ children,+ count,+ onMore,+ sectionRef,+ title,+ to,+}: {+ children: ReactNode;+ count?: number;+ onMore?: () => void;+ sectionRef?: RefObject<HTMLElement | null>;+ title: string;+ to?: string;+}) => {+ const { t } = useTranslation('discover');+ const id = useId();+ const more = (+ <>+ {t('catalog.viewAll')}+ <Icon icon={ChevronRight} size={14} />+ </>+ );+ return (+ <Flexbox aria-labelledby={id} as={'section'} gap={8} ref={sectionRef}>+ <div {...stylex.props(agentGridStyles.divider)} />+ <Flexbox horizontal align={'center'} justify={'space-between'} paddingBlock={8}>+ <Flexbox horizontal align={'baseline'} gap={8}>+ <Text as={'h2'} fontSize={14} id={id} weight={600}>+ {title}+ </Text>+ {count !== undefined && <Text type={'secondary'}>{count}</Text>}+ </Flexbox>+ {to ? (+ <WorkspaceLink to={to} {...stylex.props(styles.more)}>+ {more}+ </WorkspaceLink>+ ) : (+ onMore && (+ <button type={'button'} {...stylex.props(styles.more)} onClick={onMore}>+ {more}+ </button>+ )+ )}+ </Flexbox>+ {children}+ </Flexbox>+ );+};++/** Agent rows in the two-column grid every Marketplace Agent list uses. */+export const AgentGrid = memo<{ agents: MarketAgentSummary[]; source?: AssistantMarketSource }>(+ ({ agents, source }) => (+ <div {...stylex.props(agentGridStyles.grid)}>+ {agents.map((agent) => (+ <MarketAgentRow agent={agent} key={agent.id} source={source} />+ ))}+ </div>+ ),+);++AgentGrid.displayName = 'MarketplaceAgentGrid';diff --git a/src/features/Marketplace/Agents/AgentSkeleton.tsx b/src/features/Marketplace/Agents/AgentSkeleton.tsxnew file mode 100644index 00000000000..707c66e7de2--- /dev/null+++ b/src/features/Marketplace/Agents/AgentSkeleton.tsx@@ -0,0 +1,95 @@+import { Flexbox } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import { memo } from 'react';++import { SkeletonBar } from '@/components/Skeleton';++import { agentGridStyles } from './AgentSection';+import MarketCard from './MarketCard';++const styles = stylex.create({+ row: {+ display: 'flex',+ alignItems: 'center',+ gap: 12,+ minWidth: 0,+ paddingBlock: 8,+ paddingInline: 8,+ },+ text: {+ display: 'flex',+ flex: '1',+ flexDirection: 'column',+ gap: 6,+ minWidth: 0,+ },+});++/** Text widths vary per row so a column of skeletons does not read as one block. */+const NAME_WIDTHS = ['46%', '58%', '38%', '52%'];+const BLURB_WIDTHS = ['82%', '70%', '90%', '64%'];++/** One list row: picture tile, name and blurb lines, and the "+" at the end. */+export const AgentRowSkeleton = memo<{ index?: number }>(({ index = 0 }) => (+ <div {...stylex.props(styles.row)}>+ <SkeletonBar height={40} radius={10} width={40} />+ <span {...stylex.props(styles.text)}>+ <SkeletonBar height={14} width={NAME_WIDTHS[index % NAME_WIDTHS.length]} />+ <SkeletonBar height={12} width={BLURB_WIDTHS[index % BLURB_WIDTHS.length]} />+ </span>+ <SkeletonBar height={24} radius={6} width={24} />+ </div>+));++AgentRowSkeleton.displayName = 'MarketplaceAgentRowSkeleton';++/** Rows in the two-column grid. */+export const AgentGridSkeleton = memo<{ count?: number }>(({ count = 4 }) => (+ <div {...stylex.props(agentGridStyles.grid)}>+ {Array.from({ length: count }, (_, index) => (+ <AgentRowSkeleton index={index} key={index} />+ ))}+ </div>+));++AgentGridSkeleton.displayName = 'MarketplaceAgentGridSkeleton';++/** A category block: its rule, a title, and its rows. */+export const AgentSectionSkeleton = memo<{ count?: number }>(({ count = 4 }) => (+ <Flexbox gap={8}>+ <div {...stylex.props(agentGridStyles.divider)} />+ <Flexbox horizontal align={'center'} justify={'space-between'} paddingBlock={8}>+ <SkeletonBar height={16} width={96} />+ <SkeletonBar height={14} width={56} />+ </Flexbox>+ <AgentGridSkeleton count={count} />+ </Flexbox>+));++AgentSectionSkeleton.displayName = 'MarketplaceAgentSectionSkeleton';++/** The featured cards: picture, name, author and a two-line blurb. */+export const FeaturedSkeleton = memo(() => (+ <Flexbox gap={8}>+ <div {...stylex.props(agentGridStyles.divider)} />+ <Flexbox paddingBlock={8}>+ <SkeletonBar height={16} width={64} />+ </Flexbox>+ <div {...stylex.props(agentGridStyles.cards)}>+ {Array.from({ length: 3 }, (_, index) => (+ <MarketCard gap={8} key={index}>+ <Flexbox horizontal justify={'space-between'}>+ <SkeletonBar height={48} radius={12} width={48} />+ <SkeletonBar height={24} radius={6} width={24} />+ </Flexbox>+ <SkeletonBar height={14} width={NAME_WIDTHS[index]} />+ <SkeletonBar height={12} width={'32%'} />+ <SkeletonBar height={12} width={'92%'} />+ <SkeletonBar height={12} width={BLURB_WIDTHS[index]} />+ </MarketCard>+ ))}+ </div>+ </Flexbox>+));++FeaturedSkeleton.displayName = 'MarketplaceFeaturedSkeleton';diff --git a/src/features/Marketplace/Agents/FeaturedAgentCard.tsx b/src/features/Marketplace/Agents/FeaturedAgentCard.tsxnew file mode 100644index 00000000000..b97537de8ec--- /dev/null+++ b/src/features/Marketplace/Agents/FeaturedAgentCard.tsx@@ -0,0 +1,61 @@+import { Flexbox, Text } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import MarketAgentAction from './MarketAgentAction';+import MarketAgentAvatar from './MarketAgentAvatar';+import type { MarketAgentSummary } from './marketAgentCatalog';+import MarketCard from './MarketCard';+import { useOpenAgent } from './useOpenAgent';++const styles = stylex.create({+ action: { display: 'flex' },+ blurb: { minHeight: 40 },+ head: { marginBlockEnd: 4 },+});++/** A featured Agent: a Surface card with its picture and "+", name, author, blurb and skills. */+const FeaturedAgentCard = memo<{ agent: MarketAgentSummary }>(({ agent }) => {+ const { t } = useTranslation('discover');+ const openAgent = useOpenAgent('new');+ const open = () => openAgent(agent.id);++ return (+ <MarketCard gap={8} onClick={open}>+ <Flexbox+ horizontal+ align={'flex-start'}+ justify={'space-between'}+ {...stylex.props(styles.head)}+ >+ <MarketAgentAvatar avatar={agent.avatar} size={48} title={agent.title} />+ <span {...stylex.props(styles.action)} onClick={(event) => event.stopPropagation()}>+ <MarketAgentAction id={agent.id} title={agent.title} onAdded={open} />+ </span>+ </Flexbox>+ <Flexbox gap={2}>+ <Text ellipsis weight={600}>+ {agent.title}+ </Text>+ {agent.author && (+ <Text ellipsis fontSize={12} type={'secondary'}>+ {t('marketplaceAgents.by', { name: agent.author })}+ </Text>+ )}+ </Flexbox>+ <Text ellipsis={{ rows: 2 }} fontSize={13} type={'secondary'} {...stylex.props(styles.blurb)}>+ {agent.description || t('marketplaceAgents.noDescription')}+ </Text>+ {!!agent.pluginCount && agent.pluginCount > 0 && (+ <Text fontSize={12} type={'secondary'}>+ {t('marketplaceAgents.skillCount', { count: agent.pluginCount })}+ </Text>+ )}+ </MarketCard>+ );+});++FeaturedAgentCard.displayName = 'MarketplaceFeaturedAgentCard';++export default FeaturedAgentCard;diff --git a/src/features/Marketplace/Agents/IconTile.tsx b/src/features/Marketplace/Agents/IconTile.tsxnew file mode 100644index 00000000000..a6a142d4786--- /dev/null+++ b/src/features/Marketplace/Agents/IconTile.tsx@@ -0,0 +1,24 @@+import { Center } from '@lobehub/ui';+import { Surface } from '@lobehub/ui/dashboard';+import { memo, type ReactNode } from 'react';++/** The Surface tile an Agent's picture, or a skill without one, sits on. */+const IconTile = memo<{ children: ReactNode; size: number }>(({ children, size }) => (+ <Surface+ style={{+ borderRadius: Math.round(size * 0.25),+ flex: 'none',+ height: size,+ overflow: 'hidden',+ width: size,+ }}+ >+ <Center height={'100%'} width={'100%'}>+ {children}+ </Center>+ </Surface>+));++IconTile.displayName = 'MarketplaceIconTile';++export default IconTile;diff --git a/src/features/Marketplace/Agents/MarketAgentAction.tsx b/src/features/Marketplace/Agents/MarketAgentAction.tsxnew file mode 100644index 00000000000..c04f44a749c--- /dev/null+++ b/src/features/Marketplace/Agents/MarketAgentAction.tsx@@ -0,0 +1,53 @@+import { Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { CheckIcon } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { RowAddAction } from '@/features/Settings/skill/features/RowActions';++import { useMarketAgentInstall } from './useMarketAgentInstall';++const styles = stylex.create({+ added: {+ display: 'inline-flex',+ flex: 'none',+ alignItems: 'center',+ gap: 4,+ paddingInline: 8,+ fontSize: 13,+ color: cssVar.colorTextTertiary,+ },+});++/** "+" that adds a Marketplace Agent to mine, or "Added" once I have it. */+const MarketAgentAction = memo<{ id: string; onAdded?: () => void; title: string }>(+ ({ id, onAdded, title }) => {+ const { t } = useTranslation('discover');+ const { add, added, canCreate, pending } = useMarketAgentInstall(id, title);++ if (added)+ return (+ <span {...stylex.props(styles.added)}>+ <Icon icon={CheckIcon} size={14} />+ {t('marketplaceAgents.added')}+ </span>+ );++ return (+ <RowAddAction+ disabled={!canCreate}+ label={t('marketplaceAgents.add')}+ loading={pending}+ onClick={async () => {+ if ((await add()) && onAdded) onAdded();+ }}+ />+ );+ },+);++MarketAgentAction.displayName = 'MarketplaceAgentAction';++export default MarketAgentAction;diff --git a/src/features/Marketplace/Agents/MarketAgentAvatar.tsx b/src/features/Marketplace/Agents/MarketAgentAvatar.tsxnew file mode 100644index 00000000000..e711f55d493--- /dev/null+++ b/src/features/Marketplace/Agents/MarketAgentAvatar.tsx@@ -0,0 +1,23 @@+import { Avatar } from '@lobehub/ui';+import { memo } from 'react';++import IconTile from './IconTile';++/** A Marketplace Agent's picture (illustration, emoji or image) on the Surface tile. */+const MarketAgentAvatar = memo<{ avatar?: string; size: number; title: string }>(+ ({ avatar, size, title }) => (+ <IconTile size={size}>+ <Avatar+ alt={title}+ avatar={avatar || title.slice(0, 1)}+ background={'transparent'}+ shape={'square'}+ size={Math.round(size * 0.78)}+ />+ </IconTile>+ ),+);++MarketAgentAvatar.displayName = 'MarketplaceAgentAvatar';++export default MarketAgentAvatar;diff --git a/src/features/Marketplace/Agents/MarketAgentRow.tsx b/src/features/Marketplace/Agents/MarketAgentRow.tsxnew file mode 100644index 00000000000..0eda2005343--- /dev/null+++ b/src/features/Marketplace/Agents/MarketAgentRow.tsx@@ -0,0 +1,89 @@+import { Tag, Text } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import type { AssistantMarketSource } from '@/types/discover';++import MarketAgentAction from './MarketAgentAction';+import MarketAgentAvatar from './MarketAgentAvatar';+import type { MarketAgentSummary } from './marketAgentCatalog';+import { useOpenAgent } from './useOpenAgent';++const styles = stylex.create({+ action: {+ display: 'flex',+ flex: 'none',+ },+ author: {+ marginInlineStart: 6,+ },+ row: {+ display: 'flex',+ alignItems: 'center',+ gap: 12,+ minWidth: 0,+ paddingBlock: 8,+ paddingInline: 8,+ borderRadius: cssVar.borderRadiusLG,+ cursor: 'pointer',+ backgroundColor: {+ 'default': 'transparent',+ ':hover': cssVar.colorFillQuaternary,+ },+ },+ text: {+ display: 'flex',+ flex: '1',+ flexDirection: 'column',+ minWidth: 0,+ },+});++/**+ * One Marketplace Agent: picture, name with its author, blurb, and "+". It opens+ * its page, as does adding it.+ */+const MarketAgentRow = memo<{ agent: MarketAgentSummary; source?: AssistantMarketSource }>(+ ({ agent, source }) => {+ const { t } = useTranslation('discover');+ const openAgent = useOpenAgent(source);+ const open = () => openAgent(agent.id, agent.isGroup);++ return (+ <div+ {...stylex.props(styles.row)}+ data-agent-type={agent.isGroup ? 'agent-group' : 'agent'}+ data-testid={'assistant-item'}+ onClick={open}+ >+ <MarketAgentAvatar avatar={agent.avatar} size={40} title={agent.title} />+ <span {...stylex.props(styles.text)}>+ <Text ellipsis weight={500}>+ {agent.title}+ {agent.author && (+ <Text as={'span'} fontSize={12} type={'secondary'} {...stylex.props(styles.author)}>+ {t('marketplaceAgents.by', { name: agent.author })}+ </Text>+ )}+ </Text>+ <Text ellipsis fontSize={12} type={'secondary'}>+ {agent.description || t('marketplaceAgents.noDescription')}+ </Text>+ </span>+ <span {...stylex.props(styles.action)} onClick={(event) => event.stopPropagation()}>+ {agent.isGroup ? (+ <Tag size={'small'}>{t('groupAgents.tag')}</Tag>+ ) : (+ <MarketAgentAction id={agent.id} title={agent.title} onAdded={open} />+ )}+ </span>+ </div>+ );+ },+);++MarketAgentRow.displayName = 'MarketplaceAgentRow';++export default MarketAgentRow;diff --git a/src/features/Marketplace/Agents/MarketCard.tsx b/src/features/Marketplace/Agents/MarketCard.tsxnew file mode 100644index 00000000000..6e1bd13d3d7--- /dev/null+++ b/src/features/Marketplace/Agents/MarketCard.tsx@@ -0,0 +1,26 @@+import { Surface } from '@lobehub/ui/dashboard';+import * as stylex from '@stylexjs/stylex';+import { memo, type ReactNode } from 'react';++const styles = stylex.create({+ body: (gap: number) => ({+ display: 'flex',+ flexDirection: 'column',+ gap,+ minWidth: 0,+ padding: 16,+ }),+});++/** Every content block on a Marketplace Agent page (featured picks, skills, information): a Surface. */+const MarketCard = memo<{ children: ReactNode; gap?: number; onClick?: () => void }>(+ ({ children, gap = 12, onClick }) => (+ <Surface style={onClick ? { cursor: 'pointer' } : undefined} onClick={onClick}>+ <div {...stylex.props(styles.body(gap))}>{children}</div>+ </Surface>+ ),+);++MarketCard.displayName = 'MarketplaceAgentCard';++export default MarketCard;diff --git a/src/features/Marketplace/Agents/marketAgentCatalog.test.ts b/src/features/Marketplace/Agents/marketAgentCatalog.test.tsnew file mode 100644index 00000000000..3c71bf659bd--- /dev/null+++ b/src/features/Marketplace/Agents/marketAgentCatalog.test.ts@@ -0,0 +1,64 @@+import {+ type AgentTemplate,+ MarketplaceCategory,+} from '@lobechat/builtin-tool-web-onboarding/agentMarketplace';+import { describe, expect, it } from 'vitest';++import {+ fromCommunity,+ groupTemplates,+ isMarketplaceCategory,+ matchAgent,+ pickFeatured,+} from './marketAgentCatalog';++const template = (+ id: string,+ category: MarketplaceCategory,+ forkCount = 0,+ description = '',+): AgentTemplate => ({ category, description, forkCount, id, title: id });++describe('marketAgentCatalog', () => {+ const templates = [+ template('chef', MarketplaceCategory.PersonalLife, 50),+ template('release', MarketplaceCategory.ProductManagement, 900),+ template('roadmap', MarketplaceCategory.ProductManagement, 800),+ template('reviewer', MarketplaceCategory.Engineering, 700, 'finds bugs in code'),+ template('notes', MarketplaceCategory.Operations, 10),+ ];++ it('groups by category with work first and life last, skipping empty categories', () => {+ expect(groupTemplates(templates).map((group) => group.category)).toEqual([+ MarketplaceCategory.ProductManagement,+ MarketplaceCategory.Operations,+ MarketplaceCategory.Engineering,+ MarketplaceCategory.PersonalLife,+ ]);+ });++ it('features the most-added assistants, one per category', () => {+ expect(pickFeatured(templates).map((agent) => agent.id)).toEqual([+ 'release',+ 'reviewer',+ 'chef',+ ]);+ });++ it('matches the name or the description', () => {+ const [reviewer] = groupTemplates([templates[3]])[0].items;+ expect(matchAgent(reviewer, 'BUGS')).toBe(true);+ expect(matchAgent(reviewer, 'review')).toBe(true);+ expect(matchAgent(reviewer, 'chef')).toBe(false);+ });++ it('names a community agent by its identifier when it has no title', () => {+ expect(fromCommunity({ identifier: 'abc' } as any)).toMatchObject({ id: 'abc', title: 'abc' });+ });++ it('tells a curated category from a community one', () => {+ expect(isMarketplaceCategory('engineering')).toBe(true);+ expect(isMarketplaceCategory('programming')).toBe(false);+ expect(isMarketplaceCategory(undefined)).toBe(false);+ });+});diff --git a/src/features/Marketplace/Agents/marketAgentCatalog.ts b/src/features/Marketplace/Agents/marketAgentCatalog.tsnew file mode 100644index 00000000000..91ad504126d--- /dev/null+++ b/src/features/Marketplace/Agents/marketAgentCatalog.ts@@ -0,0 +1,98 @@+import {+ type AgentTemplate,+ MarketplaceCategory,+} from '@lobechat/builtin-tool-web-onboarding/agentMarketplace';++import type { DiscoverAssistantItem } from '@/types/discover';++/** What an assistant row or card shows; LobeHub's picks and community agents both map onto it. */+export interface MarketAgentSummary {+ author?: string;+ avatar?: string;+ backgroundColor?: string;+ category?: string;+ description?: string;+ /** Market identifier; adding forks it and the copy remembers it as `forkedFromIdentifier`. */+ id: string;+ /** A group of Agents: it opens the group page and has no "+" (groups are not forked here). */+ isGroup?: boolean;+ pluginCount?: number;+ title: string;+}++/** Order of LobeHub's categories on the page: work first, life last. */+export const AGENT_CATEGORY_ORDER: MarketplaceCategory[] = [+ MarketplaceCategory.ProductManagement,+ MarketplaceCategory.Operations,+ MarketplaceCategory.Engineering,+ MarketplaceCategory.ContentCreation,+ MarketplaceCategory.Marketing,+ MarketplaceCategory.DesignCreative,+ MarketplaceCategory.LearningResearch,+ MarketplaceCategory.BusinessStrategy,+ MarketplaceCategory.SalesCustomer,+ MarketplaceCategory.FinanceLegal,+ MarketplaceCategory.PeopleHR,+ MarketplaceCategory.CreatorEconomy,+ MarketplaceCategory.PersonalLife,+];++/** Featured cards at the top of "All". */+export const FEATURED_COUNT = 3;+/** Rows a category previews (two two-column lines) before "View all". */+export const AGENT_PREVIEW_COUNT = 4;++export const isMarketplaceCategory = (value?: string): value is MarketplaceCategory =>+ !!value && (AGENT_CATEGORY_ORDER as string[]).includes(value);++export const fromTemplate = (template: AgentTemplate): MarketAgentSummary => ({+ author: template.author,+ avatar: template.avatar,+ category: template.category,+ description: template.description,+ id: template.id,+ pluginCount: template.pluginCount,+ title: template.title,+});++export const fromCommunity = (item: DiscoverAssistantItem): MarketAgentSummary => ({+ author: item.author,+ avatar: item.avatar,+ backgroundColor: item.backgroundColor,+ category: item.category,+ description: item.description,+ id: item.identifier,+ isGroup: item.type === 'agent-group',+ pluginCount: item.pluginCount,+ title: item.title || item.identifier,+});++/** Case-insensitive match on the name and the description. */+export const matchAgent = (agent: MarketAgentSummary, query: string) => {+ const keyword = query.trim().toLowerCase();+ if (!keyword) return true;+ return [agent.title, agent.description ?? ''].some((text) =>+ text.toLowerCase().includes(keyword),+ );+};++/** LobeHub's picks by category, in `AGENT_CATEGORY_ORDER`, skipping empty ones. */+export const groupTemplates = (templates: AgentTemplate[]) =>+ AGENT_CATEGORY_ORDER.map((category) => ({+ category,+ items: templates.filter((template) => template.category === category).map(fromTemplate),+ })).filter((group) => group.items.length > 0);++/** The most-added picks, one per category so the row is not three of a kind. */+export const pickFeatured = (templates: AgentTemplate[], count = FEATURED_COUNT) => {+ const seen = new Set<string>();+ return templates+ .toSorted((a, b) => (b.forkCount ?? 0) - (a.forkCount ?? 0))+ .filter((template) => {+ if (seen.has(template.category)) return false;+ seen.add(template.category);+ return true;+ })+ .slice(0, count)+ .map(fromTemplate);+};diff --git a/src/features/Marketplace/Agents/useMarketAgentInstall.ts b/src/features/Marketplace/Agents/useMarketAgentInstall.tsnew file mode 100644index 00000000000..cb287b565f0--- /dev/null+++ b/src/features/Marketplace/Agents/useMarketAgentInstall.ts@@ -0,0 +1,59 @@+import { toast } from '@lobehub/ui';+import { useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { usePermission } from '@/hooks/usePermission';+import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';+import { installMarketplaceAgents } from '@/services/installMarketplaceAgents';+import { useHomeStore } from '@/store/home';+import { homeAgentListSelectors } from '@/store/home/selectors';++/**+ * Whether I already have a copy of a Marketplace Agent, and the action that adds+ * one. Adding forks it the way onboarding does (`installMarketplaceAgents`, which+ * also installs the Market skills it ships with); the copy keeps the source as+ * `forkedFromIdentifier`, which is how "added" is known. In a workspace the copy+ * starts private, as the old Fork & Chat did, so teammates do not see it before+ * it has been vetted.+ */+export const useMarketAgentInstall = (id: string, name: string) => {+ const { t } = useTranslation('discover');+ const { allowed: canCreate } = usePermission('create_content');+ const { isAuthenticated, signIn } = useMarketAuth();+ const localId = useHomeStore(+ (s) =>+ homeAgentListSelectors.allAgents(s).find((agent) => agent.forkedFromIdentifier === id)?.id,+ );+ const added = !!localId;+ const [pending, setPending] = useState(false);++ /** Resolves `true` once I have a copy. */+ const add = useCallback(async () => {+ if (pending || added || !canCreate) return added;+ if (!isAuthenticated) {+ try {+ await signIn();+ } catch {+ return false;+ }+ }+ setPending(true);+ try {+ const result = await installMarketplaceAgents([id], { visibility: 'private' });+ if (result.installedAgentIds.length > 0 || result.skippedAgentIds.length > 0) {+ toast.success(t('marketplaceAgents.installed', { name }));+ return true;+ }+ toast.error(t('marketplaceAgents.addFailed'));+ return false;+ } catch (error) {+ console.error('[Marketplace] Failed to add an Agent', error);+ toast.error(t('marketplaceAgents.addFailed'));+ return false;+ } finally {+ setPending(false);+ }+ }, [added, canCreate, id, isAuthenticated, name, pending, signIn, t]);++ return { add, added, canCreate, localId, pending };+};diff --git a/src/features/Marketplace/Agents/useOpenAgent.ts b/src/features/Marketplace/Agents/useOpenAgent.tsnew file mode 100644index 00000000000..36ed6ddb9bb--- /dev/null+++ b/src/features/Marketplace/Agents/useOpenAgent.ts@@ -0,0 +1,20 @@+import urlJoin from 'url-join';++import { discoverService } from '@/services/discover';+import type { AssistantMarketSource } from '@/types/discover';++import { buildCatalogListUrl } from '../Catalog/sections';+import { useCatalogDetailNavigate } from '../Catalog/useCatalogDetailNavigate';+import { MARKETPLACE_AGENT_PATH, MARKETPLACE_PATH } from '../paths';++/** Opens a Marketplace Agent's page, remembering the catalog view it was opened from. */+export const useOpenAgent = (source?: AssistantMarketSource) => {+ const navigate = useCatalogDetailNavigate();+ return (identifier: string, isGroup = false) => {+ discoverService+ .reportAgentEvent({ event: 'click', identifier, source: location.pathname })+ .catch(() => {});+ const base = isGroup ? `${MARKETPLACE_PATH}/group_agent` : MARKETPLACE_AGENT_PATH;+ navigate(buildCatalogListUrl(urlJoin(base, identifier), { source }));+ };+};diff --git a/src/features/Marketplace/Catalog/AgentCatalog.tsx b/src/features/Marketplace/Catalog/AgentCatalog.tsxindex eefad7451b9..19bb157f51c 100644--- a/src/features/Marketplace/Catalog/AgentCatalog.tsx+++ b/src/features/Marketplace/Catalog/AgentCatalog.tsx@@ -1,20 +1,17 @@'use client';-import { Button, Tag } from '@lobehub/ui';+import { Center, Tabs, Text } from '@lobehub/ui';import * as stylex from '@stylexjs/stylex';+import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';+import { useSearchParams } from 'react-router';-import AsyncBoundary from '@/components/AsyncBoundary';-import Avatar from '@/components/Avatar';-import { CatalogRowsSkeleton } from '@/components/Skeleton/MarketplaceCatalog';+import AsyncError from '@/components/AsyncError';import { buildAssistantListQuery } from '@/features/CommunityAgentList/assistantListQuery';-import SkillListRow from '@/features/Settings/skill/features/SkillListRow';+import { CATEGORY_LABEL_KEYS } from '@/features/Onboarding/steps/AgentPickerStep/categoryLabels';+import { useOnboardingAgentTemplates } from '@/hooks/useOnboardingAgentTemplates';import { useQuery } from '@/hooks/useQuery';import Pagination from '@/routes/(main)/community/(list)/features/Pagination';-import SortButton from '@/routes/(main)/community/(list)/features/SortButton';-import AssistantEmpty from '@/routes/(main)/community/features/AssistantEmpty';-import { discoverService } from '@/services/discover';import { useDiscoverStore } from '@/store/discover';import { assistantSelectors } from '@/store/discover/selectors';import {@@ -22,12 +19,22 @@ import {type AssistantMarketSource,type AssistantQueryParams,AssistantSorts,- type DiscoverAssistantItem,} from '@/types/discover';-import { MARKETPLACE_AGENT_PATH, MARKETPLACE_PATH } from '../paths';-import CatalogListView from './CatalogListView';-import CatalogSection, { useSeenOnce } from './CatalogSection';+import { AgentGrid, agentGridStyles, AgentSection } from '../Agents/AgentSection';+import { AgentGridSkeleton, AgentSectionSkeleton, FeaturedSkeleton } from '../Agents/AgentSkeleton';+import FeaturedAgentCard from '../Agents/FeaturedAgentCard';+import {+ AGENT_PREVIEW_COUNT,+ fromCommunity,+ fromTemplate,+ groupTemplates,+ isMarketplaceCategory,+ matchAgent,+ pickFeatured,+} from '../Agents/marketAgentCatalog';+import { MARKETPLACE_AGENT_PATH } from '../paths';+import { useSeenOnce } from './CatalogSection';import DiscoverCatalogHeader from './DiscoverCatalogHeader';import {buildCatalogListUrl,@@ -37,89 +44,53 @@ import {orderCategoriesByCount,} from './sections';import { catalogStyles } from './styles';-import { useCatalogDetailNavigate } from './useCatalogDetailNavigate';-const BROWSE_CATEGORIES = Object.values(AssistantCategory).filter(- (category) => category !== AssistantCategory.All && category !== AssistantCategory.Discover,-);+type AgentsTab = 'all' | 'public' | 'verified';-const AgentCatalogRow = ({- item,- source,-}: {- item: DiscoverAssistantItem;- source?: AssistantMarketSource;-}) => {- const { t } = useTranslation('discover');- const navigate = useCatalogDetailNavigate();- const { avatar, backgroundColor, description, identifier, title, type = 'agent' } = item;- const isGroup = type === 'agent-group';- const name = title || identifier;- const label = t('assistants.detail');-- const openDetail = () => {- const path = urlJoin(- isGroup ? `${MARKETPLACE_PATH}/group_agent` : MARKETPLACE_AGENT_PATH,- identifier,- );- discoverService- .reportAgentEvent({ event: 'click', identifier, source: location.pathname })- .catch(() => {});- navigate(buildCatalogListUrl(path, { source }));- };+const TABS: AgentsTab[] = ['all', 'verified', 'public'];- return (- <SkillListRow- agentType={type}- summary={description}- testId={'assistant-item'}- title={name}- extra={- <>- {isGroup && <Tag size={'small'}>{t('groupAgents.tag')}</Tag>}- <Button- aria-label={t('catalog.rowAction', { action: label, name })}- size={'small'}- onClick={(event) => {- event.stopPropagation();- openDetail();- }}- >- {label}- </Button>- </>- }- icon={() => (- <Avatar avatar={avatar || name} background={backgroundColor} shape={'square'} size={32} />- )}- onClick={openDetail}- />- );+const isAgentsTab = (value: string | null): value is AgentsTab => TABS.includes(value as AgentsTab);++/** The Agents page URL for a tab (omitted for "All"), keeping the search and source. */+const agentTabUrl = (tab: AgentsTab, query: { q?: string; source?: string }) => {+ const params = new URLSearchParams();+ if (query.q) params.set('q', query.q);+ if (query.source) params.set('source', query.source);+ if (tab !== 'all') params.set('tab', tab);+ const search = params.toString();+ return search ? `${MARKETPLACE_AGENT_PATH}?${search}` : MARKETPLACE_AGENT_PATH;};-const useCatalogAgents = (query: AssistantQueryParams, enabled = true) => {+const useCategoryName = () => {+ const { t } = useTranslation('tool');+ return (category: string) =>+ isMarketplaceCategory(category) ? t(CATEGORY_LABEL_KEYS[category]) : category;+};++/** Community categories browsed in "Public", in the community's own order. */+const COMMUNITY_CATEGORIES = Object.values(AssistantCategory).filter(+ (category) => category !== AssistantCategory.All && category !== AssistantCategory.Discover,+);++const useCommunityAgents = (query: AssistantQueryParams, enabled = true) => {const useAssistantList = useDiscoverStore((s) => s.useFetchAssistantList);const { queryKey, ...state } = useAssistantList(buildAssistantListQuery(query), { enabled });- return { ...state, data: useDiscoverStore(assistantSelectors.assistantList(queryKey)) };+ const data = useDiscoverStore(assistantSelectors.assistantList(queryKey));+ const agents = useMemo(() => (data?.items ?? []).map(fromCommunity), [data]);+ return { ...state, agents, data };};-const AgentCatalogGroup = ({- category,- count,- eager,- label,- q,- source,-}: {+/** One community category's preview; it loads once scrolled near. */+const CommunityCategory = memo<{category: AssistantCategory;count: number;eager: boolean;- label: string;q?: string;source?: AssistantMarketSource;-}) => {+}>(({ category, count, eager, q, source }) => {+ const { t } = useTranslation('discover');const [sectionRef, seen] = useSeenOnce(eager);- const { data, error, mutate } = useCatalogAgents(+ const { agents, data, error, mutate } = useCommunityAgents({ category, includeCategoryCounts: false, pageSize: CATALOG_SECTION_SIZE, q, source },seen,);@@ -127,25 +98,36 @@ const AgentCatalogGroup = ({if (data?.items.length === 0) return null;return (- <CatalogSection+ <AgentSectioncount={data?.totalCount ?? count}- error={data ? undefined : error}- label={label}- loading={!data}sectionRef={sectionRef}- to={buildCatalogListUrl(MARKETPLACE_AGENT_PATH, { category, q, source })}- onRetry={() => void mutate()}+ title={t(`category.assistant.${category}`)}+ to={+ (data?.totalCount ?? count) > CATALOG_SECTION_SIZE+ ? buildCatalogListUrl(MARKETPLACE_AGENT_PATH, { category, q, source })+ : undefined+ }>- {data?.items.slice(0, CATALOG_SECTION_SIZE).map((item) => (- <AgentCatalogRow item={item} key={item.identifier} source={source} />- ))}- </CatalogSection>+ {error && !data ? (+ <AsyncError error={error} variant={'inline'} onRetry={() => void mutate()} />+ ) : !data ? (+ <AgentGridSkeleton count={CATALOG_SECTION_SIZE} />+ ) : (+ <AgentGrid agents={agents} source={source} />+ )}+ </AgentSection>);-};+});++CommunityCategory.displayName = 'MarketplaceCommunityCategory';-const AgentCatalogGroups = ({ q, source }: Pick<AssistantQueryParams, 'q' | 'source'>) => {+/**+ * LobeHub Market's community Agents: the recommended ones, then each category+ * with a preview whose "View all" opens the whole, paged category.+ */+const CommunityAgents = memo<{ q?: string; source?: AssistantMarketSource }>(({ q, source }) => {const { t } = useTranslation('discover');- const { data, error, isLoading, mutate } = useCatalogAgents({+ const { agents, data, error, isLoading, mutate } = useCommunityAgents({includeCategoryCounts: true,pageSize: CATALOG_SECTION_SIZE,q,@@ -155,109 +137,290 @@ const AgentCatalogGroups = ({ q, source }: Pick<AssistantQueryParams, 'q' | 'souconst { queryKey } = useAssistantCategories({ q, source }, { enabled: !data?.categoryCounts });const fallbackCounts = useDiscoverStore(assistantSelectors.assistantCategories(queryKey));const groups = orderCategoriesByCount(- BROWSE_CATEGORIES.map((key) => ({ key, label: t(`category.assistant.${key}`) })),+ COMMUNITY_CATEGORIES.map((key) => ({ key, label: key })),data?.categoryCounts ?? fallbackCounts,);+ if (error && !data)+ return <AsyncError error={error} variant={'inline'} onRetry={() => void mutate()} />;+ if (isLoading && !data)+ return (+ <>+ <AgentSectionSkeleton count={CATALOG_SECTION_SIZE} />+ <AgentSectionSkeleton />+ </>+ );+ if (agents.length === 0 && groups.length === 0)+ return (+ <Center paddingBlock={48}>+ <Text type={'secondary'}>{t('marketplaceAgents.emptySearch')}</Text>+ </Center>+ );+return (- <div {...stylex.props(catalogStyles.sections)}>- <AsyncBoundary- data={data}- empty={<AssistantEmpty search={Boolean(q)} />}- error={error}- isEmpty={data?.items.length === 0 && groups.length === 0}- isLoading={isLoading}- loading={<CatalogRowsSkeleton />}- onRetry={() => void mutate()}- >- {data && data.items.length > 0 && (!q || groups.length === 0) && (- <CatalogSection- count={data.totalCount}- label={t(q ? 'catalog.allAgents' : 'catalog.recommended')}- loading={false}- to={buildCatalogListUrl(MARKETPLACE_AGENT_PATH, {- q,- sort: AssistantSorts.Recommended,- source,- })}- >- {data.items.slice(0, CATALOG_SECTION_SIZE).map((item) => (- <AgentCatalogRow item={item} key={item.identifier} source={source} />- ))}- </CatalogSection>+ <>+ {agents.length > 0 && (!q || groups.length === 0) && (+ <AgentSection+ count={data?.totalCount}+ title={t(q ? 'catalog.allAgents' : 'catalog.recommended')}+ to={+ (data?.totalCount ?? 0) > CATALOG_SECTION_SIZE+ ? buildCatalogListUrl(MARKETPLACE_AGENT_PATH, {+ q,+ sort: AssistantSorts.Recommended,+ source,+ })+ : undefined+ }+ >+ <AgentGrid agents={agents} source={source} />+ </AgentSection>+ )}+ {groups.map(({ count, key }, index) => (+ <CommunityCategory+ category={key}+ count={count}+ eager={index < 2}+ key={key}+ q={q}+ source={source}+ />+ ))}+ </>+ );+});++CommunityAgents.displayName = 'MarketplaceCommunityAgents';++/**+ * LobeHub's own Agents (all reviewed), by category. "All" leads with the+ * featured cards.+ */+const VerifiedAgents = memo<{ all: boolean; onMore: (category: string) => void; q: string }>(+ ({ all, onMore, q }) => {+ const { t } = useTranslation('discover');+ const categoryName = useCategoryName();+ const { data: templates, error, isLoading, mutate } = useOnboardingAgentTemplates();+ const searching = q.length > 0;++ const groups = useMemo(+ () =>+ groupTemplates(templates ?? [])+ .map((group) => ({ ...group, items: group.items.filter((a) => matchAgent(a, q)) }))+ .filter((group) => group.items.length > 0),+ [q, templates],+ );+ const featured = useMemo(() => pickFeatured(templates ?? []), [templates]);++ if (isLoading && !templates)+ return (+ <>+ {all && !searching && <FeaturedSkeleton />}+ <AgentSectionSkeleton />+ <AgentSectionSkeleton />+ </>+ );++ if (error && !templates)+ return <AsyncError error={error} variant={'inline'} onRetry={() => void mutate()} />;++ return (+ <>+ {all && !searching && featured.length > 0 && (+ <AgentSection title={t('marketplaceAgents.featured')}>+ <div {...stylex.props(agentGridStyles.cards)}>+ {featured.map((agent) => (+ <FeaturedAgentCard agent={agent} key={agent.id} />+ ))}+ </div>+ </AgentSection>)}- {groups.map(({ count, key, label }, index) => (- <AgentCatalogGroup- category={key}- count={count}- eager={index < 2}- key={key}- label={label}- q={q}- source={source}- />- ))}- </AsyncBoundary>- </div>+ {groups.length === 0 && searching ? (+ <Center paddingBlock={48}>+ <Text type={'secondary'}>{t('marketplaceAgents.emptySearch')}</Text>+ </Center>+ ) : (+ groups.map(({ category, items }) => (+ <AgentSection+ count={items.length}+ key={category}+ title={categoryName(category)}+ onMore={+ !searching && items.length > AGENT_PREVIEW_COUNT+ ? () => onMore(category)+ : undefined+ }+ >+ <AgentGrid+ agents={searching ? items : items.slice(0, AGENT_PREVIEW_COUNT)}+ source={'new'}+ />+ </AgentSection>+ ))+ )}+ </>+ );+ },+);++VerifiedAgents.displayName = 'MarketplaceVerifiedAgents';++/** One LobeHub category's own page: every Agent in it. */+const AgentGroupPage = memo<{ category: string; q: string }>(({ category, q }) => {+ const { data: templates, isLoading } = useOnboardingAgentTemplates();+ const agents = useMemo(+ () =>+ (templates ?? [])+ .filter((item) => item.category === category)+ .map(fromTemplate)+ .filter((agent) => matchAgent(agent, q)),+ [category, q, templates],);-};-const AgentCatalogList = ({ query }: { query: AssistantQueryParams }) => {- const { data, error, isLoading, mutate } = useCatalogAgents({- ...query,- includeCategoryCounts: false,- pageSize: CATALOG_LIST_PAGE_SIZE,- });+ if (isLoading && !templates) return <AgentGridSkeleton count={8} />;+ return <AgentGrid agents={agents} source={'new'} />;+});++AgentGroupPage.displayName = 'MarketplaceAgentGroupPage';++/**+ * A community category or sort from an older link (`?category=`, `?sort=`,+ * `?page=`): the full, paged community list in the Agent rows.+ */+const CommunityListPage = memo<{ query: AssistantQueryParams }>(({ query }) => {+ const { t } = useTranslation('discover');+ const useAssistantList = useDiscoverStore((s) => s.useFetchAssistantList);+ const { error, isLoading, mutate, queryKey } = useAssistantList(+ buildAssistantListQuery({+ ...query,+ includeCategoryCounts: false,+ pageSize: CATALOG_LIST_PAGE_SIZE,+ }),+ );+ const data = useDiscoverStore(assistantSelectors.assistantList(queryKey));+ const agents = useMemo(() => (data?.items ?? []).map(fromCommunity), [data]);+ // A response missing a paging field reads as a single page.+ const paging = {+ currentPage: data?.currentPage ?? 1,+ pageSize: data?.pageSize ?? agents.length,+ totalCount: data?.totalCount ?? agents.length,+ totalPages: data?.totalPages ?? 0,+ };++ if (error && !data)+ return <AsyncError error={error} variant={'inline'} onRetry={() => void mutate()} />;+ if (isLoading && !data) return <AgentGridSkeleton count={8} />;+ if (agents.length === 0)+ return (+ <Center paddingBlock={48}>+ <Text type={'secondary'}>{t('marketplaceAgents.emptySearch')}</Text>+ </Center>+ );return (- <CatalogListView- empty={<AssistantEmpty search={Boolean(query.q)} />}- error={error}- hasData={Boolean(data)}- isEmpty={!data?.items.length}- loading={isLoading}- pagination={- data &&- data.totalPages > 1 && (- <Pagination- currentPage={data.currentPage}- pageSize={data.pageSize}- path={MARKETPLACE_AGENT_PATH}- total={data.totalCount}- />- )- }- onRetry={() => void mutate()}- >- {data?.items.map((item) => (- <AgentCatalogRow item={item} key={item.identifier} source={query.source} />- ))}- </CatalogListView>+ <>+ <AgentGrid agents={agents} source={query.source} />+ {paging.totalPages > 1 && (+ <Pagination+ currentPage={paging.currentPage}+ pageSize={paging.pageSize}+ path={MARKETPLACE_AGENT_PATH}+ total={paging.totalCount}+ />+ )}+ </>);-};+});++CommunityListPage.displayName = 'MarketplaceCommunityListPage';+/**+ * The Agents page: ready-made Agents with their own instructions and skills.+ * "Verified" is LobeHub's own set by category; "Public" is the LobeHub Market+ * community; "All" is the verified set with featured picks on top. "+" adds a+ * copy to my Agents. The tab (`?tab=`), a category page (`?group=`) and the+ * search (`?q=`) live in the URL, so Back returns to the same view.+ */export const AgentCatalog = () => {const { t } = useTranslation('discover');- const query = useQuery() as AssistantQueryParams;- const { category, q, sort, source } = query;- const isGroup = isCatalogListView(query);- const categoryLabel = BROWSE_CATEGORIES.find((key) => key === category);- const title = categoryLabel- ? t(`category.assistant.${categoryLabel}`)- : t(sort === AssistantSorts.Recommended && !q ? 'catalog.recommended' : 'catalog.allAgents');+ const categoryName = useCategoryName();+ const query = useQuery() as AssistantQueryParams & { group?: string; tab?: string };+ const [params, setParams] = useSearchParams();+ const q = query.q?.trim() ?? '';+ const tabParam = params.get('tab');+ const tab: AgentsTab = isAgentsTab(tabParam) ? tabParam : 'all';+ const group = isMarketplaceCategory(query.group) ? query.group : undefined;+ const legacyList = !group && isCatalogListView(query);++ const setTab = (next: AgentsTab) => {+ const nextParams = new URLSearchParams(params);+ for (const key of ['category', 'group', 'page', 'sort']) nextParams.delete(key);+ if (next === 'all') nextParams.delete('tab');+ else nextParams.set('tab', next);+ setParams(nextParams);+ };++ const openGroup = (category: string) => {+ const nextParams = new URLSearchParams(params);+ nextParams.set('group', category);+ nextParams.delete('q');+ setParams(nextParams);+ };++ // A curated category page returns to the tab it was opened from.+ const backTo = agentTabUrl(tab, { source: query.source });+ const legacyCategory = Object.values(AssistantCategory).find((key) => key === query.category);+ const legacyTitle = legacyCategory+ ? t(`category.assistant.${legacyCategory}`)+ : t(+ query.sort === AssistantSorts.Recommended && !q+ ? 'catalog.recommended'+ : 'catalog.allAgents',+ );++ const header = group ? (+ <DiscoverCatalogHeader group={{ backTo, title: categoryName(group) }} kind={'agent'} />+ ) : legacyList ? (+ <DiscoverCatalogHeader+ kind={'agent'}+ group={{+ // Community categories and sorts live under "Public".+ backTo: agentTabUrl('public', { q, source: query.source }),+ title: legacyTitle,+ }}+ />+ ) : (+ <DiscoverCatalogHeader+ kind={'agent'}+ titleExtra={+ <Tabs+ activeKey={tab}+ size={'small'}+ variant={'square'}+ items={TABS.map((value) => ({+ key: value,+ label: t(`marketplaceAgents.tabs.${value}`),+ }))}+ onChange={(key) => setTab(key as AgentsTab)}+ />+ }+ />+ );return (- <div {...stylex.props(catalogStyles.frame, isGroup && catalogStyles.groupFrame)}>- <DiscoverCatalogHeader- kind={'agent'}- sortControl={<SortButton resetPage />}- group={- isGroup- ? { backTo: buildCatalogListUrl(MARKETPLACE_AGENT_PATH, { q, source }), title }- : undefined- }- />- {isGroup ? <AgentCatalogList query={query} /> : <AgentCatalogGroups q={q} source={source} />}+ <div {...stylex.props(catalogStyles.frame, (group || legacyList) && catalogStyles.groupFrame)}>+ {header}+ <div {...stylex.props(catalogStyles.sections)}>+ {group ? (+ <AgentGroupPage category={group} q={q} />+ ) : legacyList ? (+ <CommunityListPage query={query} />+ ) : tab === 'public' ? (+ <CommunityAgents q={q || undefined} source={query.source} />+ ) : (+ <VerifiedAgents all={tab === 'all'} q={q} onMore={openGroup} />+ )}+ </div></div>);};diff --git a/src/routes/(main)/community/(detail)/agent/features/AgentForkTag.tsx b/src/routes/(main)/community/(detail)/agent/features/AgentForkTag.tsxdeleted file mode 100644index 1afb85aaaa4..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/AgentForkTag.tsx+++ /dev/null@@ -1,53 +0,0 @@-'use client';--import { Icon, Tag } from '@lobehub/ui';-import { GitFork } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';--import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';-import { useDiscoverStore } from '@/store/discover';-import { marketSelectors } from '@/store/discover/selectors';--import { useDetailContext } from './DetailProvider';--/**- * Agent Fork Tag Component- * Displays fork source information if the agent is forked from another agent- */-const AgentForkTag = memo(() => {- const { t } = useTranslation('discover');- const navigate = useWorkspaceAwareNavigate();- const { identifier, forkedFromAgentId } = useDetailContext();-- const useAgentForkSource = useDiscoverStore((s) => s.useAgentForkSource);- const { queryKey } = useAgentForkSource(identifier, !!forkedFromAgentId);- const source = useDiscoverStore(marketSelectors.agentForkSource(queryKey));-- if (!source) return null;-- const handleClick = () => {- if (source?.identifier) {- navigate(urlJoin('/marketplace/agent', source.identifier));- }- };-- return (- <Tag- color="default"- icon={<Icon icon={GitFork} />}- style={{ cursor: 'pointer' }}- title={t('fork.forkedFrom', {- defaultValue: `Forked from ${source.name}`,- })}- onClick={handleClick}- >- {t('fork.forkedFrom')}: {source.name}- </Tag>- );-});--AgentForkTag.displayName = 'AgentForkTag';--export default AgentForkTag;diff --git a/src/routes/(main)/community/(detail)/agent/features/DetailProvider.tsx b/src/routes/(main)/community/(detail)/agent/features/DetailProvider.tsxdeleted file mode 100644index d7d58f3b77f..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/DetailProvider.tsx+++ /dev/null@@ -1,20 +0,0 @@-'use client';--import { type ReactNode } from 'react';-import { createContext, memo, use } from 'react';--import { type DiscoverAssistantDetail } from '@/types/discover';--export type DetailContextConfig = Partial<DiscoverAssistantDetail>;--export const DetailContext = createContext<DetailContextConfig>({});--export const DetailProvider = memo<{ children: ReactNode; config?: DetailContextConfig }>(- ({ children, config = {} }) => {- return <DetailContext value={config}>{children}</DetailContext>;- },-);--export const useDetailContext = () => {- return use(DetailContext);-};diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Block.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Block.tsxdeleted file mode 100644index 997bea56a57..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Block.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { Flexbox, Tag } from '@lobehub/ui';-import { type ReactNode } from 'react';-import { memo } from 'react';--import Title from '../../../../../features/Title';--interface BlockProps {- children?: ReactNode;- count: number;- desc: string;- id?: string;- title: string;-}--const Block = memo<BlockProps>(({ title, count, desc, children, id }) => {- return (- <Flexbox gap={8}>- <Title id={id} tag={<Tag>{count}</Tag>}>- {title}- </Title>- <p style={{ marginBottom: 24 }}>{desc}</p>- {children}- </Flexbox>- );-});--export default Block;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Knowledge.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Knowledge.tsxdeleted file mode 100644index 9f9cd43864e..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Knowledge.tsx+++ /dev/null@@ -1,38 +0,0 @@-import { Block, Empty, Flexbox } from '@lobehub/ui';-import { BookOpen } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useDetailContext } from '../../DetailProvider';-import KnowledgeItem from './KnowledgeItem';--const Knowledge = memo(() => {- const { t } = useTranslation('discover');- const { config } = useDetailContext();-- if (!config?.knowledgeBases?.length)- return (- <Block variant={'outlined'}>- <Empty- description={t('assistants.details.capabilities.knowledge.desc')}- descriptionProps={{ fontSize: 14 }}- icon={BookOpen}- />- </Block>- );-- return (- <Flexbox gap={8}>- {config?.knowledgeBases.map((item) => (- <KnowledgeItem- avatar={item.avatar || item.id}- description={item?.description || ''}- key={item.id}- title={item.name}- />- ))}- </Flexbox>- );-});--export default Knowledge;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/KnowledgeItem.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/KnowledgeItem.tsxdeleted file mode 100644index e9369093824..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/KnowledgeItem.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { Avatar, Block, Flexbox, Text } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import { memo } from 'react';--import { densityTokens } from '@/styles/density.stylex';--const styles = stylex.create({- desc: {- flex: '1',- margin: '0',- fontSize: densityTokens['--lobe-density-font-size'],- color: cssVar.colorTextSecondary,- },- title: {- margin: '0',- fontSize: densityTokens['--lobe-density-font-size'],- fontWeight: 500,- color: { 'default': null, ':hover': cssVar.colorLink },- },-});--const KnowledgeItem = memo<{ avatar?: string; description?: string; title: string }>(- ({ avatar, title, description }) => {- return (- <Block horizontal gap={12} padding={12} variant={'outlined'}>- <Avatar avatar={avatar} shape={'square'} size={40} style={{ flex: 'none' }} />- <Flexbox- flex={1}- gap={6}- style={{- overflow: 'hidden',- }}- >- <Text ellipsis as={'h2'} className={stylex.props(styles.title).className}>- {title}- </Text>- <Text- as={'p'}- className={stylex.props(styles.desc).className}- ellipsis={{- rows: 2,- }}- >- {description}- </Text>- </Flexbox>- </Block>- );- },-);--export default KnowledgeItem;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.test.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.test.tsxdeleted file mode 100644index 20b4466056f..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.test.tsx+++ /dev/null@@ -1,89 +0,0 @@-/**- * @vitest-environment happy-dom- */-import { render, screen } from '@testing-library/react';-import type { ReactNode } from 'react';-import { beforeEach, describe, expect, it, vi } from 'vitest';--import { useDiscoverStore } from '@/store/discover';-import { pluginDetailQueryKey } from '@/store/discover/slices/plugin/projection';-import { globalHelpers } from '@/store/global/helpers';--import PluginItem from './PluginItem';--// The marketplace read is the only thing faked: the store slice, its replica-// and the component are the real ones. `getPluginDetail` rejects outright so a-// rendered title can only come from the replica view, not the network.-vi.mock('@/services/discover', () => ({- discoverService: {- getPluginCategories: vi.fn(),- getPluginDetail: vi.fn(() => Promise.reject(new Error('offline'))),- getPluginIdentifiers: vi.fn(),- getPluginList: vi.fn(),- },-}));--vi.mock('react-i18next', () => ({- useTranslation: () => ({ t: (key: string) => key }),-}));--vi.mock('@lobechat/builtin-tools', () => ({ builtinTools: [] }));--vi.mock('@lobehub/ui', () => ({- Avatar: () => null,- Block: ({ children }: { children?: ReactNode }) => <div>{children}</div>,- Flexbox: ({ children }: { children?: ReactNode }) => <div>{children}</div>,- Icon: () => null,- Image: () => null,- Skeleton: { Text: () => <div data-testid="skeleton" /> },- Tag: ({ children }: { children?: ReactNode }) => <span>{children}</span>,- Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,-}));--const IDENTIFIER = 'weather-plugin';--const seedDetail = () =>- useDiscoverStore.setState({- pluginDetailMap: {- [pluginDetailQueryKey({ identifier: IDENTIFIER, locale: 'en-US', withManifest: false })]: {- author: 'LobeHub',- avatar: '',- createdAt: '',- description: 'Weather lookups for the agent',- homepage: 'https://lobehub.com',- identifier: IDENTIFIER,- manifest: undefined,- related: [],- schemaVersion: 1,- source: 'builtin',- tags: ['weather'],- title: 'Weather Plugin',- } as any,- },- });--beforeEach(() => {- vi.clearAllMocks();- vi.spyOn(globalHelpers, 'getCurrentLanguage').mockReturnValue('en-US');- useDiscoverStore.setState({ pluginDetailMap: {} });-});--describe('PluginItem (replica-backed plugin detail)', () => {- it('paints the plugin title from the replica even though the network fetch fails', async () => {- seedDetail();-- render(<PluginItem identifier={IDENTIFIER} />);-- // The title can only come from the seeded replica view: the only faked- // dependency (getPluginDetail) rejects, so the network path yields nothing.- expect(await screen.findByText('Weather Plugin')).toBeTruthy();- expect(screen.queryByTestId('skeleton')).toBeNull();- expect(screen.getByText('Weather lookups for the agent')).toBeTruthy();- });-- it('shows the loading skeleton while the entry is still empty', () => {- render(<PluginItem identifier={IDENTIFIER} />);-- expect(screen.getByTestId('skeleton')).toBeTruthy();- });-});diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsxdeleted file mode 100644index e82c2c4fea7..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx+++ /dev/null@@ -1,276 +0,0 @@-import { builtinTools } from '@lobechat/builtin-tools';-import {- COMPOSIO_APP_TYPES,- type ComposioAppType,- getLobehubSkillProviderById,- type LobehubSkillProviderType,- OFFICIAL_SITE,-} from '@lobechat/const';-import { type DiscoverPluginDetail, type PluginSource } from '@lobechat/types';-import { Avatar, Block, Flexbox, Icon, Image, Skeleton, Tag, Text } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import { memo, useMemo } from 'react';-import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';--import WorkspaceLink from '@/features/Workspace/WorkspaceLink';-import { useDiscoverStore } from '@/store/discover';-import { pluginSelectors } from '@/store/discover/selectors';-import { densityTokens } from '@/styles/density.stylex';--/**- * Icon component for built-in tools (Composio & LobehubSkill)- * For string type icon, use Image component to render- * For IconType type icon, use Icon component to render with theme fill color- */-const BuiltinToolIcon = memo<Pick<ComposioAppType | LobehubSkillProviderType, 'icon' | 'label'>>(- ({ icon, label }) => {- if (typeof icon === 'string') {- return <Image alt={label} height={40} src={icon} style={{ flex: 'none' }} width={40} />;- }-- // Use theme color fill, automatically adapts in dark mode- return <Icon fill={cssVar.colorText} icon={icon} size={40} />;- },-);--BuiltinToolIcon.displayName = 'BuiltinToolIcon';--const styles = stylex.create({- clickable: { cursor: 'pointer' },- desc: {- flex: '1',- margin: '0',- fontSize: densityTokens['--lobe-density-font-size'],- color: cssVar.colorTextSecondary,- },- noLink: { cursor: 'default' },- tag: { flexShrink: 0 },- title: {- margin: '0',- fontSize: densityTokens['--lobe-density-font-size'],- fontWeight: 500,- color: { default: null, [stylex.when.ancestor(':hover')]: cssVar.colorLink },- },- titleRow: { display: 'flex', gap: '8px', alignItems: 'center' },-});--interface PluginItemProps {- identifier: string;-}--const PluginItem = memo<PluginItemProps>(({ identifier }) => {- const { t } = useTranslation('discover');- const usePluginDetail = useDiscoverStore((s) => s.useFetchPluginDetail);- const { isLoading, queryKey } = usePluginDetail({ identifier, withManifest: false });- // The replica view of this identifier; the sync hook only reports the fetch flags.- const apiData = useDiscoverStore(pluginSelectors.pluginDetail(queryKey));-- // Try to get Composio tool info if API returns no data- const composioTool = useMemo(() => {- return COMPOSIO_APP_TYPES.find((tool) => tool.identifier === identifier);- }, [identifier]);-- // Try to get LobehubSkill info if API returns no data- const lobehubSkill = useMemo(() => {- return getLobehubSkillProviderById(identifier);- }, [identifier]);-- // Try to get builtin tool info if API returns no data- const builtinTool = useMemo(() => {- return builtinTools.find((tool) => tool.identifier === identifier);- }, [identifier]);-- // Convert built-in tools to plugin detail format- const data: DiscoverPluginDetail | undefined = useMemo(() => {- if (apiData) return apiData;-- // Check Composio tools- if (composioTool) {- return {- author: 'Composio',- avatar: '', // Avatar will be rendered by BuiltinToolIcon component- category: undefined,- createdAt: '',- description: `LobeHub Mcp Server: ${composioTool.label}`,- homepage: 'https://composio.dev',- identifier: composioTool.identifier,- manifest: undefined,- related: [],- schemaVersion: 1,- source: 'builtin' as const,- tags: ['composio', 'mcp'],- title: composioTool.label,- };- }-- // Check LobehubSkill providers- if (lobehubSkill) {- return {- author: lobehubSkill.author,- avatar: '', // Avatar will be rendered by BuiltinToolIcon component- category: undefined,- createdAt: '',- description: lobehubSkill.description,- homepage: lobehubSkill.authorUrl || OFFICIAL_SITE,- identifier: lobehubSkill.id,- manifest: undefined,- related: [],- schemaVersion: 1,- source: 'builtin' as const,- tags: ['lobehub-skill'],- title: lobehubSkill.label,- };- }-- // Check builtin tools (like lobe-cloud-sandbox, lobe-memory, etc.)- if (builtinTool) {- return {- author: 'LobeHub',- avatar: builtinTool.avatar || '',- category: undefined,- createdAt: '',- description: builtinTool.description || '',- homepage: OFFICIAL_SITE,- identifier: builtinTool.identifier,- manifest: undefined,- related: [],- schemaVersion: 1,- source: 'builtin' as const,- tags: builtinTool.tags || ['builtin-tool'],- title: builtinTool.title || builtinTool.identifier,- };- }-- return undefined;- }, [apiData, composioTool, lobehubSkill, builtinTool]);-- const sourceConfig = useMemo(() => {- const source: PluginSource = data?.source || 'market';-- switch (source) {- case 'builtin': {- return {- clickable: false,- href: undefined,- isExternal: false,- tagColor: 'geekblue' as const,- tagText: t('plugins.builtinTag'),- };- }- case 'legacy': {- return {- clickable: true,- href: data?.homepage,- isExternal: true,- tagColor: 'orange' as const,- tagText: t('plugins.legacyTag'),- };- }- // eslint-disable-next-line unicorn/no-useless-switch-case- case 'market':- default: {- return {- clickable: true,- href: urlJoin('/marketplace/mcp', identifier),- isExternal: false,- tagColor: undefined,- tagText: undefined,- };- }- }- }, [data?.source, data?.homepage, identifier, t]);-- if (isLoading)- return (- <Block horizontal gap={12} key={identifier} padding={12} variant={'outlined'}>- <Skeleton.Text rows={1} />- </Block>- );-- // If loading is complete but no data found, don't render anything- if (!data) return null;-- // Render avatar - use BuiltinToolIcon for built-in tools, Avatar for others- const renderAvatar = () => {- if (composioTool) {- return <BuiltinToolIcon icon={composioTool.icon} label={composioTool.label} />;- }- if (lobehubSkill) {- return <BuiltinToolIcon icon={lobehubSkill.icon} label={lobehubSkill.label} />;- }- return <Avatar avatar={data.avatar} shape={'square'} size={40} style={{ flex: 'none' }} />;- };-- const content = (- <Block- horizontal- gap={12}- key={identifier}- padding={12}- variant={'outlined'}- className={- stylex.props(- sourceConfig.clickable ? [styles.clickable, stylex.defaultMarker()] : styles.noLink,- ).className- }- >- {renderAvatar()}- <Flexbox- flex={1}- gap={6}- style={{- overflow: 'hidden',- }}- >- <div {...stylex.props(styles.titleRow)}>- <Text ellipsis as={'h2'} className={stylex.props(styles.title).className}>- {data.title}- </Text>- {sourceConfig.tagText && (- <Tag- className={stylex.props(styles.tag).className}- color={sourceConfig.tagColor}- size={'small'}- >- {sourceConfig.tagText}- </Tag>- )}- </div>- <Text- as={'p'}- className={stylex.props(styles.desc).className}- ellipsis={{- rows: 2,- }}- >- {data.description}- </Text>- </Flexbox>- </Block>- );-- // For builtin plugins, no link wrapper- if (!sourceConfig.clickable) {- return content;- }-- // For external links (legacy plugins), use <a> tag- if (sourceConfig.isExternal && sourceConfig.href) {- return (- <a href={sourceConfig.href} rel="noopener noreferrer" target="_blank">- {content}- </a>- );- }-- // For internal links (market plugins), use Link component- if (sourceConfig.href) {- return <WorkspaceLink to={sourceConfig.href}>{content}</WorkspaceLink>;- }-- return content;-});--export default PluginItem;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Plugins.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Plugins.tsxdeleted file mode 100644index 643b35a3407..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/Plugins.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { Block, Empty, Flexbox } from '@lobehub/ui';-import { BlocksIcon } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useDetailContext } from '../../DetailProvider';-import PluginItem from './PluginItem';--const Plugin = memo(() => {- const { t } = useTranslation('discover');- const { config } = useDetailContext();-- if (!config?.plugins?.length)- return (- <Block variant={'outlined'}>- <Empty- description={t('assistants.details.capabilities.plugin.desc')}- descriptionProps={{ fontSize: 14 }}- icon={BlocksIcon}- />- </Block>- );-- return (- <Flexbox gap={8}>- {config?.plugins.map((item) => {- const identifier =- typeof item === 'string' ? item : (item as { identifier: string }).identifier;-- return <PluginItem identifier={identifier} key={identifier} />;- })}- </Flexbox>- );-});--export default Plugin;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/index.tsxdeleted file mode 100644index c15ff3ca5f5..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/index.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { Flexbox } from '@lobehub/ui';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useDetailContext } from '../../DetailProvider';-import Block from './Block';-import Knowledge from './Knowledge';-import Plugins from './Plugins';--const Capabilities = memo(() => {- const { t } = useTranslation('discover');- const { pluginCount, knowledgeCount } = useDetailContext();-- return (- <Flexbox gap={64}>- <Block- count={pluginCount || 0}- desc={t('assistants.details.capabilities.plugin.desc')}- id={'tools'}- title={t('assistants.details.capabilities.plugin.title')}- >- <Plugins />- </Block>-- <Block- count={knowledgeCount || 0}- desc={t('assistants.details.capabilities.knowledge.desc')}- id={'prompts'}- title={t('assistants.details.capabilities.knowledge.title')}- >- <Knowledge />- </Block>- </Flexbox>- );-});--export default Capabilities;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsxdeleted file mode 100644index 304c962a591..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsx+++ /dev/null@@ -1,130 +0,0 @@-'use client';--import { SOCIAL_URL } from '@lobechat/business-const';-import { Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import {- BookOpenIcon,- HistoryIcon,- LayersIcon,- ListIcon,- SquareArrowOutUpRight,- SquareUserIcon,-} from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { AssistantNavKey } from '@/types/discover';--import { useDetailContext } from '../DetailProvider';--const styles = stylex.create({- link: {- display: 'inline-flex',- gap: '4px',- alignItems: 'center',- color: { 'default': cssVar.colorTextDescription, ':hover': cssVar.colorInfo },- },- nav: {- borderBlockEndWidth: '1px',- borderBlockEndStyle: 'solid',- borderBlockEndColor: cssVar.colorBorder,- },- tabsWrapper: {- 'scrollbarWidth': 'none',- 'overflowX': 'auto',- 'overscrollBehaviorX': 'none',- 'flex': '1',- 'minWidth': '0',- '::-webkit-scrollbar': { display: 'none' },- },-});-interface NavProps {- activeTab?: AssistantNavKey;- mobile?: boolean;- setActiveTab?: (tab: AssistantNavKey) => void;-}--const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = AssistantNavKey.Overview }) => {- const { t } = useTranslation('discover');- const { pluginCount, knowledgeCount } = useDetailContext();-- const capabilitiesCount = Number(pluginCount) + Number(knowledgeCount);-- const nav = (- <Tabs- activeKey={activeTab}- variant="square"- items={[- {- icon: <Icon icon={BookOpenIcon} size={16} />,- key: AssistantNavKey.Overview,- label: t('assistants.details.overview.title'),- },- {- icon: <Icon icon={SquareUserIcon} size={16} />,- key: AssistantNavKey.SystemRole,- label: t('assistants.details.systemRole.title'),- },- {- icon: <Icon icon={LayersIcon} size={16} />,- key: AssistantNavKey.Capabilities,- label:- capabilitiesCount > 1 ? (- <Flexbox- horizontal- align={'center'}- gap={6}- style={{- display: 'inline-flex',- }}- >- {t('assistants.details.capabilities.title')}- <Tag>{capabilitiesCount}</Tag>- </Flexbox>- ) : (- t('assistants.details.capabilities.title')- ),- },- {- icon: <Icon icon={HistoryIcon} size={16} />,- key: AssistantNavKey.Version,- label: t('assistants.details.version.title'),- },- {- icon: <Icon icon={ListIcon} size={16} />,- key: AssistantNavKey.Related,- label: t('assistants.details.related.title'),- },- ]}- onChange={(key) => setActiveTab?.(key as AssistantNavKey)}- />- );-- return mobile ? (- nav- ) : (- <Flexbox- horizontal- align={'center'}- className={stylex.props(styles.nav).className}- justify={'space-between'}- >- <div {...stylex.props(styles.tabsWrapper)}>{nav}</div>- <Flexbox horizontal flex="none" gap={12} style={{ marginInlineStart: 12 }}>- <a- {...stylex.props(styles.link)}- href={SOCIAL_URL.discord}- rel="noreferrer"- target="_blank"- >- {t('mcp.details.nav.needHelp')}- <Icon icon={SquareArrowOutUpRight} size={12} />- </a>- </Flexbox>- </Flexbox>- );-});--export default Nav;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Overview/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Overview/index.tsxdeleted file mode 100644index 5780caafa59..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Overview/index.tsx+++ /dev/null@@ -1,95 +0,0 @@-import { BRANDING_NAME } from '@lobechat/business-const';-import { Accordion, Block, Flexbox, useTheme } from '@lobehub/ui';-import { ChatList } from '@lobehub/ui/chat';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';-import { useUserStore } from '@/store/user';-import { authSelectors, userProfileSelectors } from '@/store/user/selectors';--import Title from '../../../../../features/Title';-import { useDetailContext } from '../../DetailProvider';--const Overview = memo(() => {- const [userAvatar, username] = useUserStore((s) => [- userProfileSelectors.userAvatar(s),- userProfileSelectors.username(s),- ]);-- const isSignedIn = useUserStore(authSelectors.isLogin);- const { t } = useTranslation('discover');- const theme = useTheme();- const {- examples = [],- description,- summary,- avatar,- title,- backgroundColor,- config,- } = useDetailContext();-- const data: any = [- {- content: config?.openingMessage,- role: 'assistant',- },- ...examples,- ].map((item, index) => {- let meta = {- avatar,- backgroundColor: backgroundColor || 'transparent',- title,- };- if (item.role === 'user') {- meta = {- avatar: isSignedIn && !!userAvatar ? userAvatar : DEFAULT_USER_AVATAR_URL,- backgroundColor: 'transparent',- title: isSignedIn && !!username ? username : BRANDING_NAME,- };- }-- return {- extra: {},- id: index,- ...item,- meta,- };- });-- return (- <Flexbox gap={16}>- <Accordion- defaultValue={['summary']}- indicatorPlacement={'end'}- styles={{ content: { padding: '12px 16px' } }}- variant={'outlined'}- items={[- {- children: summary || description,- key: 'summary',- title: t('assistants.details.summary.title'),- },- ]}- />- <Title>{t('assistants.details.overview.example')}</Title>- <Block- variant={'outlined'}- style={{- background: theme.colorBgContainerSecondary,- }}- >- <ChatList- data={data}- style={{ width: '100%' }}- renderMessages={{- default: ({ id, editableContent }) => <div id={id}>{editableContent}</div>,- }}- />- </Block>- </Flexbox>- );-});--export default Overview;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Related/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Related/index.tsxdeleted file mode 100644index b7736cf20a2..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Related/index.tsx+++ /dev/null@@ -1,40 +0,0 @@-import { Flexbox } from '@lobehub/ui';-import qs from 'query-string';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useQuery } from '@/hooks/useQuery';-import { type AssistantMarketSource } from '@/types/discover';--import McpList from '../../../../../(list)/agent/features/List';-import Title from '../../../../../features/Title';-import { useDetailContext } from '../../DetailProvider';--const Related = memo(() => {- const { t } = useTranslation('discover');- const { related, category } = useDetailContext();- const { source } = useQuery() as { source?: AssistantMarketSource };- const marketSource = source === 'legacy' ? 'legacy' : undefined;- return (- <Flexbox gap={16}>- <Title- more={t('assistants.details.related.more')}- moreLink={qs.stringifyUrl(- {- query: {- category,- source: marketSource,- },- url: '/marketplace/agent',- },- { skipNull: true },- )}- >- {t('assistants.details.related.listTitle')}- </Title>- <McpList data={related} />- </Flexbox>- );-});--export default Related;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/SystemRole/TagList.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/SystemRole/TagList.tsxdeleted file mode 100644index 3c4830ae92f..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/SystemRole/TagList.tsx+++ /dev/null@@ -1,53 +0,0 @@-'use client';--import { Flexbox, Tag } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import qs from 'query-string';-import { memo } from 'react';--import WorkspaceLink from '@/features/Workspace/WorkspaceLink';-import { useQuery } from '@/hooks/useQuery';-import { densityTokens } from '@/styles/density.stylex';-import { type AssistantMarketSource } from '@/types/discover';--const styles = stylex.create({- tag: {- margin: '0',- paddingBlock: '4px',- paddingInline: densityTokens['--lobe-density-content-gap'],- borderRadius: '16px',- color: cssVar.colorTextSecondary,- },-});--const TagList = memo<{ tags: string[] }>(({ tags }) => {- const { source } = useQuery() as { source?: AssistantMarketSource };- const marketSource = source === 'legacy' ? 'legacy' : undefined;- const showTags = Boolean(tags?.length && tags?.length > 0);- return (- showTags && (- <Flexbox horizontal gap={8} wrap={'wrap'}>- {tags.map((tag) => (- <WorkspaceLink- key={tag}- to={qs.stringifyUrl(- {- query: {- q: tag,- source: marketSource,- },- url: '/marketplace/agent',- },- { skipNull: true },- )}- >- <Tag className={stylex.props(styles.tag).className}>{tag}</Tag>- </WorkspaceLink>- ))}- </Flexbox>- )- );-});--export default TagList;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/SystemRole/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/SystemRole/index.tsxdeleted file mode 100644index ab5e89d3c98..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/SystemRole/index.tsx+++ /dev/null@@ -1,65 +0,0 @@-import { Block, cssVar, Flexbox, Icon, Tag } from '@lobehub/ui';-import { MessageCircleHeartIcon, MessageCircleQuestionIcon } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import TokenTag from '../../../../../(list)/agent/features/List/TokenTag';-import Title from '../../../../../features/Title';-import MarkdownRender from '../../../../features/MakedownRender';-import { useDetailContext } from '../../DetailProvider';-import TagList from './TagList';--const Overview = memo(() => {- const { t } = useTranslation('discover');- const { tokenUsage, tags = [], config } = useDetailContext();-- const { systemRole, openingMessage, openingQuestions } = config || {};- return (- <Flexbox gap={16}>- {systemRole && (- <>- <Title tag={tokenUsage && <TokenTag tokenUsage={tokenUsage} />}>- {t('assistants.details.systemRole.title')}- </Title>- <Block gap={16} padding={16} variant={'outlined'}>- {<MarkdownRender>{systemRole.trimEnd()}</MarkdownRender>}- <TagList tags={tags} />- </Block>- </>- )}- {openingMessage && (- <>- <Title>{t('assistants.details.systemRole.openingMessage')}</Title>- <Block horizontal align={'flex-start'} gap={12} padding={16} variant={'outlined'}>- <Icon- color={cssVar.colorError}- icon={MessageCircleHeartIcon}- size={20}- style={{- marginTop: 4,- }}- />- <MarkdownRender>{openingMessage?.trimEnd()}</MarkdownRender>- </Block>- </>- )}- {openingQuestions && (- <>- <Title tag={<Tag>{openingQuestions?.length}</Tag>}>- {t('assistants.details.systemRole.openingQuestions')}- </Title>- <Flexbox gap={8}>- {openingQuestions?.map((item, key) => (- <Block horizontal gap={12} key={key} padding={16} variant={'outlined'}>- <Icon color={cssVar.colorWarning} icon={MessageCircleQuestionIcon} size={20} />- <MarkdownRender>{item}</MarkdownRender>- </Block>- ))}- </Flexbox>- </>- )}- </Flexbox>- );-});--export default Overview;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Versions/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Versions/index.tsxdeleted file mode 100644index 1f08f203fdb..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/Versions/index.tsx+++ /dev/null@@ -1,132 +0,0 @@-import { Block, cssVar, Flexbox, Icon, Tag } from '@lobehub/ui';-import { CheckIcon, MinusIcon } from 'lucide-react';-import qs from 'query-string';-import { memo, useMemo } from 'react';-import { useTranslation } from 'react-i18next';--import InlineTable from '@/components/InlineTable';-import PublishedTime from '@/components/PublishedTime';-import Link from '@/libs/router/Link';-import { usePathname, useQuery } from '@/libs/router/navigation';-import { type AssistantMarketSource } from '@/types/discover';-import { AssistantNavKey } from '@/types/discover';--import Title from '../../../../../features/Title';-import { useDetailContext } from '../../DetailProvider';--const Versions = memo(() => {- const { t } = useTranslation('discover');- const pathname = usePathname();- const { versions = [], currentVersion } = useDetailContext();- const { source } = useQuery() as { source?: AssistantMarketSource };- const marketSource = source === 'legacy' ? 'legacy' : undefined;-- const statusTagMap = useMemo(- () => ({- archived: {- color: 'default' as const,- label: t('assistants.details.version.status.archived'),- },- deprecated: {- color: 'warning' as const,- label: t('assistants.details.version.status.deprecated'),- },- }),- [t],- );-- const disableClickStatuses = useMemo(- () => new Set<keyof typeof statusTagMap>(['archived', 'deprecated']),- [],- );-- if (!versions.length) {- return (- <Flexbox gap={16}>- <Title>{t('assistants.details.version.title')}</Title>- <Block padding={24} variant={'outlined'}>- {t('assistants.details.version.empty')}- </Block>- </Flexbox>- );- }-- return (- <Flexbox gap={16}>- <Title>{t('assistants.details.version.title')}</Title>- <Block variant={'outlined'}>- <InlineTable- dataSource={versions}- rowKey={'version'}- size={'middle'}- columns={[- {- dataIndex: 'version',- render: (_: any, record: any) =>- (() => {- const statusKey =- record.status &&- Object.prototype.hasOwnProperty.call(statusTagMap, record.status)- ? (record.status as keyof typeof statusTagMap)- : undefined;- const statusMeta = statusKey ? statusTagMap[statusKey] : undefined;- const content = (- <Flexbox horizontal align={'center'} gap={8}>- <code style={{ fontSize: 14 }}>{record.version}</code>- {(record.isLatest || record.version === currentVersion) && (- <Tag color={'info'}>{t('assistants.details.version.table.isLatest')}</Tag>- )}- {statusMeta && <Tag color={statusMeta.color}>{statusMeta.label}</Tag>}- </Flexbox>- );-- if (statusKey && disableClickStatuses.has(statusKey)) return content;-- return (- <Link- style={{ color: 'inherit' }}- href={qs.stringifyUrl(- {- query: {- activeTab: AssistantNavKey.Version,- source: marketSource,- version: record.version,- },- url: pathname,- },- { skipNull: true },- )}- >- {content}- </Link>- );- })(),- title: t('assistants.details.version.table.version'),- },- {- align: 'center',- dataIndex: 'isValidated',- render: (_: any, record: any) => (- <Icon- color={record.isValidated ? cssVar.colorSuccess : cssVar.colorTextDescription}- icon={record.isValidated ? CheckIcon : MinusIcon}- />- ),- title: t('assistants.details.version.table.isValidated'),- },- {- align: 'right',- dataIndex: 'createdAt',- render: (_: any, record: any) => <PublishedTime date={record.createdAt} />,- title: t('assistants.details.version.table.publishAt'),- },- ]}- />- </Block>- </Flexbox>- );-});--Versions.displayName = 'AssistantVersions';--export default Versions;diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/index.tsxdeleted file mode 100644index f65f525ceaa..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Details/index.tsx+++ /dev/null@@ -1,50 +0,0 @@-'use client';--import { Flexbox, useResponsive } from '@lobehub/ui';-import { memo } from 'react';--import { useQueryState } from '@/hooks/useQueryParam';-import { AssistantNavKey } from '@/types/discover';--import Sidebar from '../Sidebar';-import Capabilities from './Capabilities';-import Nav from './Nav';-import Overview from './Overview';-import Related from './Related';-import SystemRole from './SystemRole';-import Versions from './Versions';--const Details = memo<{ mobile?: boolean }>(({ mobile: isMobile }) => {- const { mobile = isMobile } = useResponsive();- const [activeTab, setActiveTab] = useQueryState('activeTab', {- clearOnDefault: true,- defaultValue: AssistantNavKey.Overview,- });-- return (- <Flexbox gap={24}>- <Nav activeTab={activeTab as AssistantNavKey} mobile={mobile} setActiveTab={setActiveTab} />- <Flexbox- gap={48}- horizontal={!mobile}- style={mobile ? { flexDirection: 'column-reverse' } : undefined}- >- <Flexbox- width={'100%'}- style={{- overflow: 'hidden',- }}- >- {activeTab === AssistantNavKey.Overview && <Overview />}- {activeTab === AssistantNavKey.SystemRole && <SystemRole />}- {activeTab === AssistantNavKey.Capabilities && <Capabilities />}- {activeTab === AssistantNavKey.Version && <Versions />}- {activeTab === AssistantNavKey.Related && <Related />}- </Flexbox>- <Sidebar mobile={mobile} />- </Flexbox>- </Flexbox>- );-});--export default Details;diff --git a/src/routes/(main)/community/(detail)/agent/features/Header.tsx b/src/routes/(main)/community/(detail)/agent/features/Header.tsxdeleted file mode 100644index 51fe7357846..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Header.tsx+++ /dev/null@@ -1,235 +0,0 @@-'use client';--import { MCP } from '@lobehub/icons';-import {- ActionIcon,- Button,- Flexbox,- Icon,- Tag,- Text,- toast,- Tooltip,- TooltipGroup,- useResponsive,-} from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import {- BookmarkCheckIcon,- BookmarkIcon,- BookTextIcon,- CoinsIcon,- DotIcon,- GitBranchIcon,-} from 'lucide-react';-import qs from 'query-string';-import { memo, useState } from 'react';-import { useTranslation } from 'react-i18next';--import Avatar from '@/components/Avatar';-import PublishedTime from '@/components/PublishedTime';-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';-import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';-import { socialService } from '@/services/social';-import { useDiscoverStore } from '@/store/discover';-import { socialSelectors } from '@/store/discover/selectors';-import { formatIntergerNumber } from '@/utils/format';--import { useCategory } from '../../../(list)/agent/features/Category/useCategory';-import { resolveCommunityProfileLink } from '../../utils/profileLink';-import AgentForkTag from './AgentForkTag';-import { useDetailContext } from './DetailProvider';--const styles = stylex.create({ time: { fontSize: '12px', color: cssVar.colorTextDescription } });--const Header = memo<{ mobile?: boolean }>(({ mobile: isMobile }) => {- const { t } = useTranslation('discover');-- const {- author,- identifier,- createdAt,- category,- avatar,- title,- tokenUsage,- pluginCount,- knowledgeCount,- userName,- ownerType,- forkCount,- } = useDetailContext();- const { mobile = isMobile } = useResponsive();- const { isAuthenticated, signIn, session } = useMarketAuth();- const [favoriteLoading, setFavoriteLoading] = useState(false);-- // Set access token for social service- if (session?.accessToken) {- socialService.setAccessToken(session.accessToken);- }-- const useFavoriteStatus = useDiscoverStore((s) => s.useFavoriteStatus);- const { queryKey: favoriteKey } = useFavoriteStatus('agent', identifier, isAuthenticated);- const favoriteStatus = useDiscoverStore(socialSelectors.favoriteStatus(favoriteKey));- const setFavorite = useDiscoverStore((s) => s.setFavorite);-- const isFavorited = favoriteStatus?.isFavorited ?? false;-- const handleFavoriteClick = async () => {- if (!isAuthenticated) {- await signIn();- return;- }-- if (!identifier) return;-- setFavoriteLoading(true);- try {- await setFavorite('agent', identifier, !isFavorited);- toast.success(t(isFavorited ? 'assistant.unfavoriteSuccess' : 'assistant.favoriteSuccess'));- } catch (error) {- console.error('Favorite action failed:', error);- toast.error(t('assistant.favoriteFailed'));- } finally {- setFavoriteLoading(false);- }- };-- const categories = useCategory();- const cate = categories.find((c) => c.key === category);-- const cateButton = (- <WorkspaceLink- to={qs.stringifyUrl({- query: { category: cate?.key },- url: '/marketplace/agent',- })}- >- <Button icon={cate?.icon} size={'middle'}>- {cate?.label}- </Button>- </WorkspaceLink>- );-- return (- <Flexbox gap={12}>- <Flexbox horizontal align={'flex-start'} gap={16} width={'100%'}>- <Avatar avatar={avatar} shape={'square'} size={mobile ? 48 : 64} />- <Flexbox- flex={1}- gap={4}- style={{- overflow: 'hidden',- }}- >- <Flexbox- horizontal- align={'center'}- gap={8}- justify={'space-between'}- style={{- overflow: 'hidden',- position: 'relative',- }}- >- <Flexbox- horizontal- align={'center'}- flex={1}- gap={12}- style={{- overflow: 'hidden',- position: 'relative',- }}- >- <Text- ellipsis- as={'h1'}- style={{ fontSize: mobile ? 18 : 24, margin: 0 }}- title={identifier}- >- {title}- </Text>- </Flexbox>- <Tooltip title={isFavorited ? t('assistant.unfavorite') : t('assistant.favorite')}>- <ActionIcon- icon={isFavorited ? BookmarkCheckIcon : BookmarkIcon}- loading={favoriteLoading}- variant={isFavorited ? 'outlined' : undefined}- onClick={handleFavoriteClick}- />- </Tooltip>- </Flexbox>- <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>- {author && userName ? (- <WorkspaceLink- style={{ color: 'inherit' }}- to={resolveCommunityProfileLink(userName, ownerType)}- >- {author}- </WorkspaceLink>- ) : (- author- )}- <Icon icon={DotIcon} />- <PublishedTime date={createdAt as string} xstyle={styles.time} />- <AgentForkTag />- {!!forkCount && forkCount > 0 && (- <Tag color="default" icon={<Icon icon={GitBranchIcon} />}>- {forkCount} {t('fork.forks')}- </Tag>- )}- </Flexbox>- </Flexbox>- </Flexbox>- <TooltipGroup>- <Flexbox- horizontal- align={'center'}- gap={mobile ? 12 : 24}- style={{- color: cssVar.colorTextSecondary,- }}- >- {!mobile && cateButton}- {Boolean(tokenUsage) && (- <Tooltip- styles={{ root: { pointerEvents: 'none' } }}- title={t('assistants.tokenUsage')}- >- <Flexbox horizontal align={'center'} gap={6}>- <Icon icon={CoinsIcon} />- {formatIntergerNumber(tokenUsage)}- </Flexbox>- </Tooltip>- )}- {Boolean(pluginCount) && (- <Tooltip- styles={{ root: { pointerEvents: 'none' } }}- title={t('assistants.withPlugin')}- >- <Flexbox horizontal align={'center'} gap={6}>- <Icon fill={cssVar.colorTextSecondary} icon={MCP} />- {pluginCount}- </Flexbox>- </Tooltip>- )}- {Boolean(knowledgeCount) && (- <Tooltip- styles={{ root: { pointerEvents: 'none' } }}- title={t('assistants.withKnowledge')}- >- <Flexbox horizontal align={'center'} gap={6}>- <Icon icon={BookTextIcon} />- {knowledgeCount}- </Flexbox>- </Tooltip>- )}- </Flexbox>- </TooltipGroup>- </Flexbox>- );-});--export default Header;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/ForkAndChat.test.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/ForkAndChat.test.tsxdeleted file mode 100644index 9ee32ce94d3..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/ForkAndChat.test.tsx+++ /dev/null@@ -1,129 +0,0 @@-/**- * @vitest-environment happy-dom- */-import { fireEvent, render, screen, waitFor } from '@testing-library/react';-import type * as I18nextModule from 'i18next';-import type { ReactNode } from 'react';-import { beforeEach, describe, expect, it, vi } from 'vitest';--import { agentService } from '@/services/agent';-import { marketApiService } from '@/services/marketApi';-import { agentSkillService } from '@/services/skill';-import { useToolStore } from '@/store/tool';--import ForkAndChat from './ForkAndChat';--const mocks = vi.hoisted(() => ({- createAgent: vi.fn(),- navigate: vi.fn(),- refreshAgentList: vi.fn(),- toast: { error: vi.fn(), info: vi.fn(), success: vi.fn(), warning: vi.fn() },-}));--vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));-vi.mock('i18next', async (importOriginal) => ({- ...(await importOriginal<typeof I18nextModule>()),- t: (key: string, options?: { skills?: string }) => `${key}: ${options?.skills}`,-}));-vi.mock('@lobehub/ui', async (importOriginal) => ({- ...(await importOriginal<object>()),- Button: ({ children, onClick }: { children: ReactNode; onClick?: () => void }) => (- <button onClick={onClick}>{children}</button>- ),- Flexbox: ({ children }: { children: ReactNode }) => <div>{children}</div>,- Select: () => null,- toast: mocks.toast,-}));-vi.mock('@/business/client/hooks/useActiveWorkspaceId', () => ({- getActiveWorkspaceId: () => null,- useActiveWorkspaceId: () => null,-}));-vi.mock('@/features/Workspace/useWorkspaceAwareNavigate', () => ({- useWorkspaceAwareNavigate: () => mocks.navigate,-}));-vi.mock('@/hooks/usePermission', () => ({ usePermission: () => ({ allowed: true }) }));-vi.mock('@/layout/AuthProvider/MarketAuth', () => ({- useMarketAuth: () => ({ isAuthenticated: true, signIn: vi.fn() }),-}));-vi.mock('@/services/discover', () => ({ discoverService: { reportAgentEvent: vi.fn() } }));-vi.mock('@/store/agent', () => ({- useAgentStore: (selector: (s: object) => unknown) => selector({ createAgent: mocks.createAgent }),-}));-vi.mock('@/store/home', () => ({- useHomeStore: (selector: (s: object) => unknown) =>- selector({ refreshAgentList: mocks.refreshAgentList }),-}));-vi.mock('../../DetailProvider', () => ({- useDetailContext: () => ({- config: { params: {}, plugins: ['skill-a', { identifier: 'skill-b', mode: 'disabled' }] },- identifier: 'source-agent',- title: 'Source Agent',- }),-}));--describe('ForkAndChat market skills', () => {- beforeEach(() => {- vi.restoreAllMocks();- Object.values(mocks.toast).forEach((fn) => fn.mockReset());- mocks.navigate.mockReset();- mocks.createAgent.mockReset().mockResolvedValue({ agentId: 'new-agent' });- mocks.refreshAgentList.mockReset().mockResolvedValue(undefined);- vi.spyOn(agentService, 'getAgentByForkedFromIdentifier').mockResolvedValue(null);- vi.spyOn(marketApiService, 'forkAgent').mockResolvedValue([- { data: { agent: { identifier: 'forked', name: 'Forked' } }, success: true },- ] as any);- vi.spyOn(useToolStore, 'getState').mockReturnValue({- ...useToolStore.getState(),- refreshAgentSkills: vi.fn().mockResolvedValue(undefined),- });- });-- const fork = async () => {- render(<ForkAndChat />);- fireEvent.click(screen.getByText('fork.forkAndChat'));- await waitFor(() => expect(mocks.navigate).toHaveBeenCalled());- };-- it('installs the referenced skills after creating the agent, without warning on success', async () => {- const ensure = vi.spyOn(agentSkillService, 'ensureFromMarket').mockResolvedValue([- { identifier: 'skill-a', status: 'installed' },- { identifier: 'skill-b', status: 'notSkill' },- ]);-- await fork();-- expect(ensure).toHaveBeenCalledWith(['skill-a', 'skill-b']);- expect(ensure.mock.invocationCallOrder[0]).toBeGreaterThan(- mocks.createAgent.mock.invocationCallOrder[0],- );- expect(mocks.toast.warning).not.toHaveBeenCalled();- expect(mocks.toast.success).toHaveBeenCalledWith('fork.success');- });-- it('still reports success and navigates when installing skills fails outright', async () => {- vi.spyOn(agentSkillService, 'ensureFromMarket').mockRejectedValue(new Error('network down'));-- await fork();-- expect(mocks.navigate).toHaveBeenCalledWith(expect.stringContaining('new-agent'));- expect(mocks.toast.success).toHaveBeenCalledWith('fork.success');- expect(mocks.toast.error).not.toHaveBeenCalled();- expect(mocks.toast.warning).toHaveBeenCalledTimes(1);- expect(mocks.toast.warning.mock.calls[0][0]).toContain('skill-a');- });-- it('warns only about failed skills, not about notSkill ones', async () => {- vi.spyOn(agentSkillService, 'ensureFromMarket').mockResolvedValue([- { identifier: 'skill-a', reason: 'download', status: 'failed' },- { identifier: 'skill-b', status: 'notSkill' },- ]);-- await fork();-- expect(mocks.toast.warning).toHaveBeenCalledTimes(1);- const message = mocks.toast.warning.mock.calls[0][0] as string;- expect(message).toContain('skill-a');- expect(message).not.toContain('skill-b');- expect(mocks.toast.error).not.toHaveBeenCalled();- });-});diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/ForkAndChat.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/ForkAndChat.tsxdeleted file mode 100644index c6cb553462a..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/ForkAndChat.tsx+++ /dev/null@@ -1,275 +0,0 @@-'use client';--import { AGENT_CHAT_URL } from '@lobechat/const';-import { Button, Flexbox, Select, toast } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import { customAlphabet } from 'nanoid/non-secure';-import { memo, useState } from 'react';-import { useTranslation } from 'react-i18next';--import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';-import { usePermission } from '@/hooks/usePermission';-import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';-import { lambdaClient } from '@/libs/trpc/client';-import { agentService } from '@/services/agent';-import { discoverService } from '@/services/discover';-import { ensureAgentMarketSkillsAndWarn } from '@/services/ensureAgentMarketSkills';-import { marketApiService } from '@/services/marketApi';-import { useAgentStore } from '@/store/agent';-import { useHomeStore } from '@/store/home';--import { useDetailContext } from '../../DetailProvider';--const styles = stylex.create({- buttonGroup: { width: '100%' },- forkButton: {- flex: '1',- width: 'unset',- borderStartStartRadius: '0',- borderEndStartRadius: '0',- },- // Match Button type="primary" on the right so the two halves read as one- // pill. (colorPrimary bg + colorBgLayout text) auto-flips with the theme:- // dark bg + near-white text in light theme, white bg + near-black text- // in dark theme. We use colorBgLayout directly instead of the- // semantically-named colorTextLightSolid because the cssVar proxy doesn't- // pick up LobeHub's JS-level override of that token.- visibilitySelect: {- width: '130px',- borderColor: cssVar.colorPrimary,- borderInlineEndWidth: '0',- borderStartEndRadius: '0',- borderEndEndRadius: '0',- color: cssVar.colorBgLayout,- backgroundColor: cssVar.colorPrimary,- backgroundImage: 'none',- },- // Hover / active feedback; skipped while the select is disabled.- visibilitySelectInteractive: {- borderColor: {- 'default': cssVar.colorPrimary,- ':hover': cssVar.colorPrimaryHover,- ':active': cssVar.colorPrimaryActive,- },- backgroundColor: {- 'default': cssVar.colorPrimary,- ':hover': cssVar.colorPrimaryHover,- ':active': cssVar.colorPrimaryActive,- },- },-});--/**- * Generate a market identifier (8-character lowercase alphanumeric string)- */-const generateMarketIdentifier = () => {- const alphabet = '0123456789abcdefghijklmnopqrstuvwxyz';- const generate = customAlphabet(alphabet, 8);- return generate();-};--type ForkTarget = 'private' | 'public';--const ForkAndChat = memo<{ mobile?: boolean }>(({ mobile }) => {- const { identifier, title, config, avatar, backgroundColor, description, tags, editorData } =- useDetailContext();- const [isLoading, setIsLoading] = useState(false);- const createAgent = useAgentStore((s) => s.createAgent);- const refreshAgentList = useHomeStore((s) => s.refreshAgentList);-- const navigate = useWorkspaceAwareNavigate();- const { t } = useTranslation('discover');- const { isAuthenticated, signIn } = useMarketAuth();- const { allowed: canCreate } = usePermission('create_content');- const activeWorkspaceId = useActiveWorkspaceId();- const [visibility, setVisibility] = useState<ForkTarget>('private');-- const meta = {- avatar,- backgroundColor,- description,- marketIdentifier: identifier,- tags,- title,- };-- // `target` only matters in workspace mode. Personal-mode forks ignore it- // (every row there is implicitly owner-private). Default = Private so- // newly-grabbed agents don't surface to teammates before the user has- // had a chance to vet them.- const handleForkAndChat = async (target: ForkTarget = 'private') => {- if (!canCreate || isLoading) return;- // Check if user is authenticated- if (!isAuthenticated) {- try {- await signIn();- } catch {- return;- }- }-- try {- setIsLoading(true);-- // Step 1: Check if user has already forked this agent- const existingAgentId = await agentService.getAgentByForkedFromIdentifier(identifier!);-- if (existingAgentId) {- // User has already forked this agent, navigate to existing fork- toast.info(t('fork.alreadyForked'));- navigate(AGENT_CHAT_URL(existingAgentId, mobile));- return;- }-- // Generate a unique identifier for the forked agent- const newIdentifier = generateMarketIdentifier();-- // Workspace mode forks must be attributed to the workspace's Market- // organization mirror — the per-user trust token always carries the- // workspaceId, so Market rejects the request without- // `x-lobe-owner-account-id` (403). Whether the local agent ends up- // private or public is independent of this market-side ownership.- //- // Freshly created workspaces get the Market org provisioned upfront in- // `workspace.create` / the Stripe webhook. `autoProvision: true` is a- // best-effort backfill for historical workspaces that predate that- // change; if the caller isn't the owner it silently falls through and- // the fork surfaces the failure as the usual `fork.failed` toast.- let actAs: number | undefined;- if (activeWorkspaceId) {- const { marketAccountId } = await lambdaClient.workspace.ensureMarketOrganization.mutate({- autoProvision: true,- });- actAs = marketAccountId;- }-- // Step 2: Fork the agent via Market API (single-item batch)- const [forkOutcome] = await marketApiService.forkAgent([- {- actAs,- identifier: newIdentifier,- name: title,- sourceIdentifier: identifier!,- status: 'published',- visibility: 'public',- },- ]);-- if (!forkOutcome.success) {- throw new Error(forkOutcome.error?.message || 'Forking failed');- }-- const forkResult = forkOutcome.data;-- // Step 3: Create agent config with forked data- if (!config) throw new Error('Agent config is missing');-- const agentData = {- config: {- ...config,- editorData,- ...meta,- marketIdentifier: forkResult.agent.identifier,- params: {- ...config.params,- forkedFromIdentifier: identifier, // Store the source agent identifier- },- title: forkResult.agent.name,- },- };-- // Step 4: Add to local agent list. `target` decides where it lands —- // Private bucket (only the creator sees it) or workspace-shared- // (visible to every member). In personal mode `visibility` is left- // unset and the column defaults to `public` (no-op).- const result = await createAgent({- ...agentData,- ...(activeWorkspaceId ? { visibility: target } : {}),- });- await refreshAgentList();-- // Step 5: Report fork event (using 'add' event type)- discoverService.reportAgentEvent({- event: 'add',- identifier: forkResult.agent.identifier,- source: location.pathname,- });-- toast.success(t('fork.success'));-- // Step 6: Install the Market skills the agent references. The agent already- // exists, so this never throws and only ever adds a non-blocking warning.- await ensureAgentMarketSkillsAndWarn(config.plugins);-- // Step 7: Navigate to chat- navigate(AGENT_CHAT_URL(result!.agentId, mobile));- } catch (error: any) {- console.error('Fork failed:', error);- toast.error(t('fork.failed'));- } finally {- setIsLoading(false);- }- };-- // Personal mode has no Private/Public split — render the plain primary- // button so users don't see a meaningless dropdown.- if (!activeWorkspaceId) {- return (- <Button- block- className={stylex.props(styles.buttonGroup).className}- disabled={!canCreate}- loading={isLoading}- size={'large'}- type={'primary'}- onClick={() => handleForkAndChat('private')}- >- {t('fork.forkAndChat')}- </Button>- );- }-- // Workspace mode: Select on the left chooses Private (default) vs Public,- // primary button on the right runs the fork. Keeping the choice next to- // the action makes the target visibility explicit at click time.- const visibilityOptions = [- { label: t('fork.visibilityPrivate'), value: 'private' },- { label: t('fork.visibilityPublic'), value: 'public' },- ];-- const isVisibilityDisabled = !canCreate || isLoading;-- return (- <Flexbox horizontal className={stylex.props(styles.buttonGroup).className} gap={0}>- <Select- disabled={isVisibilityDisabled}- options={visibilityOptions}- size={'large'}- suffixIconProps={{ color: cssVar.colorBgLayout }}- value={visibility}- className={- stylex.props(- styles.visibilitySelect,- !isVisibilityDisabled && styles.visibilitySelectInteractive,- ).className- }- onChange={(v) => setVisibility(v as ForkTarget)}- />- <Button- block- className={stylex.props(styles.forkButton).className}- disabled={!canCreate}- loading={isLoading}- size={'large'}- type={'primary'}- onClick={() => handleForkAndChat(visibility)}- >- {t('fork.forkAndChat')}- </Button>- </Flexbox>- );-});--export default ForkAndChat;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/index.tsxdeleted file mode 100644index 4b4749d315b..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/index.tsx+++ /dev/null@@ -1,31 +0,0 @@-'use client';--import { Flexbox } from '@lobehub/ui';-import { memo } from 'react';-import urlJoin from 'url-join';--import { AGENTS_OFFICIAL_URL } from '@/const/url';--import ShareButton from '../../../../features/ShareButton';-import { useDetailContext } from '../../DetailProvider';-import ForkAndChat from './ForkAndChat';--const ActionButton = memo<{ mobile?: boolean }>(({ mobile }) => {- const { avatar, description, tags, title, identifier } = useDetailContext();- return (- <Flexbox horizontal align={'center'} gap={8}>- <ForkAndChat mobile={mobile} />- <ShareButton- meta={{- avatar,- desc: description,- hashtags: tags,- title,- url: urlJoin(AGENTS_OFFICIAL_URL, identifier as string),- }}- />- </Flexbox>- );-});--export default ActionButton;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/Related/Item.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/Related/Item.tsxdeleted file mode 100644index 63e8078948b..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/Related/Item.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { Block, Flexbox, Text } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import { memo } from 'react';--import Avatar from '@/components/Avatar';-import { densityTokens } from '@/styles/density.stylex';-import { type DiscoverAssistantItem } from '@/types/discover';--const styles = stylex.create({- desc: {- flex: '1',- margin: '0',- fontSize: densityTokens['--lobe-density-font-size'],- color: cssVar.colorTextSecondary,- },- title: {- margin: '0',- fontSize: densityTokens['--lobe-density-font-size'],- fontWeight: 500,- color: { 'default': null, ':hover': cssVar.colorLink },- },-});--const RelatedItem = memo<DiscoverAssistantItem>(({ avatar, title, description, identifier }) => {- return (- <Block horizontal gap={12} key={identifier} padding={12} variant={'outlined'}>- <Avatar avatar={avatar} shape={'square'} size={40} style={{ flex: 'none' }} />- <Flexbox- flex={1}- gap={6}- style={{- overflow: 'hidden',- }}- >- <Text ellipsis as={'h2'} className={stylex.props(styles.title).className}>- {title}- </Text>- <Text- as={'p'}- className={stylex.props(styles.desc).className}- ellipsis={{- rows: 2,- }}- >- {description}- </Text>- </Flexbox>- </Block>- );-});--export default RelatedItem;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/Related/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/Related/index.tsxdeleted file mode 100644index 7e8297eadca..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/Related/index.tsx+++ /dev/null@@ -1,58 +0,0 @@-import { Flexbox } from '@lobehub/ui';-import qs from 'query-string';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import urlJoin from 'url-join';--import WorkspaceLink from '@/features/Workspace/WorkspaceLink';-import { useQuery } from '@/hooks/useQuery';-import { type AssistantMarketSource } from '@/types/discover';--import Title from '../../../../../features/Title';-import { useDetailContext } from '../../DetailProvider';-import Item from './Item';--const Related = memo(() => {- const { t } = useTranslation('discover');- const { related, category } = useDetailContext();- const { source } = useQuery() as { source?: AssistantMarketSource };- const marketSource = source === 'legacy' ? 'legacy' : undefined;-- return (- <Flexbox gap={16}>- <Title- more={t('assistants.details.related.more')}- moreLink={qs.stringifyUrl(- {- query: {- category,- source: marketSource,- },- url: '/marketplace/agent',- },- { skipNull: true },- )}- >- {t('assistants.details.related.listTitle')}- </Title>- <Flexbox gap={8}>- {related?.map((item, index) => {- const link = qs.stringifyUrl(- {- query: marketSource ? { source: marketSource } : undefined,- url: urlJoin('/marketplace/agent', item.identifier),- },- { skipNull: true },- );- return (- <WorkspaceLink key={index} style={{ color: 'inherit', overflow: 'hidden' }} to={link}>- <Item {...item} />- </WorkspaceLink>- );- })}- </Flexbox>- </Flexbox>- );-});--export default Related;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/Summary/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/Summary/index.tsxdeleted file mode 100644index 31f68b97b78..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/Summary/index.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { Accordion, cssVar } from '@lobehub/ui';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useDetailContext } from '../../DetailProvider';--const Summary = memo(() => {- const { description, summary } = useDetailContext();- const { t } = useTranslation('discover');- return (- <Accordion- defaultValue={['summary']}- indicatorPlacement={'end'}- styles={{ trigger: { paddingInline: 0 } }}- variant={'borderless'}- items={[- {- children: (- <p- style={{- color: cssVar.colorTextSecondary,- margin: 0,- }}- >- {summary || description}- </p>- ),- key: 'summary',- title: t('assistants.details.summary.title'),- },- ]}- />- );-});--export default Summary;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/TocList/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/TocList/index.tsxdeleted file mode 100644index 46fd4ef7666..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/TocList/index.tsx+++ /dev/null@@ -1,41 +0,0 @@-'use client';--import { Flexbox } from '@lobehub/ui';-import { type AnchorProps } from '@lobehub/ui';-import { memo, useMemo } from 'react';-import { useTranslation } from 'react-i18next';--import { useQuery } from '@/hooks/useQuery';-import { useToc } from '@/routes/(main)/community/(detail)/features/Toc/useToc';-import { AssistantNavKey } from '@/types/discover';--import Title from '../../../../../features/Title';-import Toc from '../../../../features/Toc';--const TocList = memo(() => {- const { t } = useTranslation('discover');- const { toc = [] } = useToc();- const { activeTab = AssistantNavKey.Overview } = useQuery() as { activeTab: AssistantNavKey };-- const items: AnchorProps['items'] | undefined = useMemo(() => {- switch (activeTab) {- case AssistantNavKey.SystemRole: {- return toc;- }- default: {- return undefined;- }- }- }, [activeTab, toc]);-- if (!items || items.length === 0) return null;-- return (- <Flexbox gap={16}>- <Title>{t('assistants.details.sidebar.toc')}</Title>- <Toc items={items} />- </Flexbox>- );-});--export default TocList;diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/index.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/index.tsxdeleted file mode 100644index 1bd7eb3b061..00000000000--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/index.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { Flexbox, ScrollShadow } from '@lobehub/ui';-import { memo } from 'react';--import { useQuery } from '@/hooks/useQuery';-import { AssistantNavKey } from '@/types/discover';--import ActionButton from './ActionButton';-import Related from './Related';-import Summary from './Summary';-import TocList from './TocList';--const Sidebar = memo<{ mobile?: boolean }>(({ mobile }) => {- const { activeTab = AssistantNavKey.Overview } = useQuery() as { activeTab: AssistantNavKey };-- if (mobile) {- return (- <Flexbox gap={32}>- <ActionButton mobile />- </Flexbox>- );- }-- return (- <ScrollShadow- hideScrollBar- flex={'none'}- gap={32}- size={4}- width={360}- style={{- maxHeight: 'calc(100vh - 76px)',- paddingBottom: 24,- position: 'sticky',- top: 16,- }}- >- <ActionButton />- {activeTab !== AssistantNavKey.Overview && <Summary />}- {activeTab === AssistantNavKey.SystemRole && <TocList />}- {activeTab !== AssistantNavKey.Related && <Related />}- </ScrollShadow>- );-});--export default Sidebar;diff --git a/src/routes/(main)/community/(detail)/agent/index.tsx b/src/routes/(main)/community/(detail)/agent/index.tsxindex 2d5388807b4..1f50a543999 100644--- a/src/routes/(main)/community/(detail)/agent/index.tsx+++ b/src/routes/(main)/community/(detail)/agent/index.tsx@@ -1,21 +1,17 @@'use client';-import { Flexbox } from '@lobehub/ui';import { memo } from 'react';import { useParams } from 'react-router';import AsyncError from '@/components/AsyncError';import { RouteLoading } from '@/components/Skeleton/RouteSegment';+import AgentDetail from '@/features/Marketplace/Agents/AgentDetail';import { useQuery } from '@/hooks/useQuery';import { useDiscoverStore } from '@/store/discover';import { assistantSelectors } from '@/store/discover/selectors';import { type AssistantMarketSource } from '@/types/discover';import NotFound from '../components/NotFound';-import { TocProvider } from '../features/Toc/useToc';-import { DetailProvider } from './features/DetailProvider';-import Details from './features/Details';-import Header from './features/Header';import StatusPage from './features/StatusPage';interface AssistantDetailPageProps {@@ -45,16 +41,7 @@ const AssistantDetailPage = memo<AssistantDetailPageProps>(({ mobile }) => {return <StatusPage status={status} />;}- return (- <TocProvider>- <DetailProvider config={data}>- <Flexbox data-testid="assistant-detail-content" gap={16}>- <Header mobile={mobile} />- <Details mobile={mobile} />- </Flexbox>- </DetailProvider>- </TocProvider>- );+ return <AgentDetail detail={data} mobile={mobile} />;});export const MobileDiscoverAssistantDetailPage = (_props: { mobile?: boolean }) => {