🤯 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
📝 docs: Update src directory structure to be more comprehensive (#12016)
Arvin Xu338df4baf908
diff --git a/docs/development/basic/folder-structure.mdx b/docs/development/basic/folder-structure.mdxindex 2ab570e552e..6a822ccb6cc 100644--- a/docs/development/basic/folder-structure.mdx+++ b/docs/development/basic/folder-structure.mdx@@ -17,20 +17,29 @@ The directory structure of LobeHub is as follows:```bashsrc-├── app # Next.js App Router implementation with route groups and API routes-├── components # Reusable UI components-├── config # Application configuration files, including client-side and server-side environment variables-├── features # Function modules related to business functions, such as agent settings, plugin development pop-ups, etc.-├── hooks # Custom utility hooks reused throughout the application-├── layout # Application layout components, such as navigation bars, sidebars, etc.-├── libs # Third-party integrations (analytics, OIDC, etc.)-├── locales # Internationalization language files-├── server # Server-side modules and services-├── services # Encapsulated backend service interfaces, such as HTTP requests-├── store # Zustand store for state management-├── styles # Global styles and CSS-in-JS configurations-├── types # TypeScript type definition files-└── utils # Common utility functions+├── app # Next.js App Router implementation with route groups and API routes+├── business # Business logic modules (client and server)+├── components # Reusable UI components+├── config # Application configuration files, including client-side and server-side environment variables+├── const # Application constants and enums+├── envs # Environment variable definitions and validation (analytics, auth, llm, etc.)+├── features # Function modules related to business functions, such as agent settings, plugin development pop-ups, etc.+├── helpers # Utility helpers for tool engineering, placeholder parsing, etc.+├── hooks # Custom utility hooks reused throughout the application+├── layout # Application layout components, such as navigation bars, sidebars, etc.+├── libs # Third-party integrations (analytics, OIDC, etc.)+├── locales # Internationalization language files+├── server # Server-side modules and services+├── services # Encapsulated backend service interfaces, such as HTTP requests+├── store # Zustand store for state management+├── styles # Global styles and CSS-in-JS configurations+├── tools # Built-in tools (artifacts, inspectors, interventions, etc.)+├── types # TypeScript type definition files+├── utils # Common utility functions+├── auth.ts # Authentication configuration (Better Auth)+├── instrumentation.ts # Application monitoring and telemetry setup+├── instrumentation.node.ts # Node.js-specific instrumentation+└── proxy.ts # Next.js middleware proxy configuration```## appdiff --git a/docs/development/basic/folder-structure.zh-CN.mdx b/docs/development/basic/folder-structure.zh-CN.mdxindex bb2cb0e4345..6a46bc05ddd 100644--- a/docs/development/basic/folder-structure.zh-CN.mdx+++ b/docs/development/basic/folder-structure.zh-CN.mdx@@ -15,20 +15,29 @@ LobeHub 的文件夹目录架构如下:```bashsrc-├── app # Next.js App Router 实现,包含路由组和 API 路由-├── components # 可复用的 UI 组件-├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量-├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等-├── hooks # 全应用复用自定义的工具 Hooks-├── layout # 应用的布局组件,如导航栏、侧边栏等-├── libs # 第三方集成(分析、OIDC 等)-├── locales # 国际化的语言文件-├── server # 服务端模块和服务-├── services # 封装的后端服务接口,如 HTTP 请求-├── store # 用于状态管理的 zustand store-├── styles # 全局样式和 CSS-in-JS 配置-├── types # TypeScript 的类型定义文件-└── utils # 通用的工具函数+├── app # Next.js App Router 实现,包含路由组和 API 路由+├── business # 业务逻辑模块(客户端和服务端)+├── components # 可复用的 UI 组件+├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量+├── const # 应用常量和枚举+├── envs # 环境变量定义和校验(分析、认证、LLM 等)+├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等+├── helpers # 工具辅助函数,用于工具工程、占位符解析等+├── hooks # 全应用复用自定义的工具 Hooks+├── layout # 应用的布局组件,如导航栏、侧边栏等+├── libs # 第三方集成(分析、OIDC 等)+├── locales # 国际化的语言文件+├── server # 服务端模块和服务+├── services # 封装的后端服务接口,如 HTTP 请求+├── store # 用于状态管理的 zustand store+├── styles # 全局样式和 CSS-in-JS 配置+├── tools # 内置工具(artifacts、inspectors、interventions 等)+├── types # TypeScript 的类型定义文件+├── utils # 通用的工具函数+├── auth.ts # 认证配置(Better Auth)+├── instrumentation.ts # 应用监控和遥测设置+├── instrumentation.node.ts # Node.js 专用的 instrumentation+└── proxy.ts # Next.js 中间件代理配置```## appdiff --git a/docs/development/start.mdx b/docs/development/start.mdxindex 0497c9e2586..0c7e7379b98 100644--- a/docs/development/start.mdx+++ b/docs/development/start.mdx@@ -34,18 +34,25 @@ The folder directory structure of LobeHub is as follows:```bashsrc-├── app # Code related to the main logic and state management of the application-├── components # Reusable UI components-├── config # Application configuration files, including client and server environment variables-├── const # Used to define constants, such as action types, route names, etc.-├── features # Business-related feature modules, such as Agent settings, plugin development pop-ups, etc.-├── hooks # Custom utility Hooks reusable across the application-├── layout # Application layout components, such as navigation bars, sidebars, etc.-├── locales # Language files for internationalization-├── services # Encapsulated backend service interfaces, such as HTTP requests-├── store # Zustand store for state management-├── types # TypeScript type definition files-└── utils # General utility functions+├── app # Next.js App Router implementation with route groups and API routes+├── business # Business logic modules (client and server)+├── components # Reusable UI components+├── config # Application configuration files, including client and server environment variables+├── const # Application constants and enums+├── envs # Environment variable definitions and validation (analytics, auth, llm, etc.)+├── features # Business-related feature modules, such as Agent settings, plugin development pop-ups, etc.+├── helpers # Utility helpers for tool engineering, placeholder parsing, etc.+├── hooks # Custom utility Hooks reusable across the application+├── layout # Application layout components, such as navigation bars, sidebars, etc.+├── libs # Third-party integrations (analytics, OIDC, etc.)+├── locales # Language files for internationalization+├── server # Server-side modules and services+├── services # Encapsulated backend service interfaces, such as HTTP requests+├── store # Zustand store for state management+├── styles # Global styles and CSS-in-JS configurations+├── tools # Built-in tools (artifacts, inspectors, interventions, etc.)+├── types # TypeScript type definition files+└── utils # General utility functions```For a detailed introduction to the directory structure, see: [Folder Directory Structure](/docs/development/basic/folder-structure)diff --git a/docs/development/start.zh-CN.mdx b/docs/development/start.zh-CN.mdxindex 2fc4725e8c7..560c1fdcf6e 100644--- a/docs/development/start.zh-CN.mdx+++ b/docs/development/start.zh-CN.mdx@@ -32,18 +32,25 @@ LobeHub 的文件夹目录架构如下:```bashsrc-├── app # 应用主要逻辑和状态管理相关的代码-├── components # 可复用的 UI 组件-├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量-├── const # 用于定义常量,如 action 类型、路由名等-├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等-├── hooks # 全应用复用自定义的工具 Hooks-├── layout # 应用的布局组件,如导航栏、侧边栏等-├── locales # 国际化的语言文件-├── services # 封装的后端服务接口,如 HTTP 请求-├── store # 用于状态管理的 zustand store-├── types # TypeScript 的类型定义文件-└── utils # 通用的工具函数+├── app # Next.js App Router 实现,包含路由组和 API 路由+├── business # 业务逻辑模块(客户端和服务端)+├── components # 可复用的 UI 组件+├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量+├── const # 应用常量和枚举+├── envs # 环境变量定义和校验(分析、认证、LLM 等)+├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等+├── helpers # 工具辅助函数,用于工具工程、占位符解析等+├── hooks # 全应用复用自定义的工具 Hooks+├── layout # 应用的布局组件,如导航栏、侧边栏等+├── libs # 第三方集成(分析、OIDC 等)+├── locales # 国际化的语言文件+├── server # 服务端模块和服务+├── services # 封装的后端服务接口,如 HTTP 请求+├── store # 用于状态管理的 zustand store+├── styles # 全局样式和 CSS-in-JS 配置+├── tools # 内置工具(artifacts、inspectors、interventions 等)+├── types # TypeScript 的类型定义文件+└── utils # 通用的工具函数```有关目录架构的详细介绍,详见: [文件夹目录架构](/zh/docs/development/basic/folder-structure)diff --git a/e2e/src/steps/home/sidebarAgent.steps.ts b/e2e/src/steps/home/sidebarAgent.steps.tsindex 84096641053..1969e5eaa56 100644--- a/e2e/src/steps/home/sidebarAgent.steps.ts+++ b/e2e/src/steps/home/sidebarAgent.steps.ts@@ -150,69 +150,99 @@ Given('用户在 Home 页面有一个 Agent', async function (this: CustomWorld)console.log(` ✅ 找到 Agent: ${agentLabel}, id: ${agentId}`);});-Given('该 Agent 未被置顶', async function (this: CustomWorld) {+Given('该 Agent 未被置顶', { timeout: 30_000 }, async function (this: CustomWorld) {console.log(' 📍 Step: 检查 Agent 未被置顶...');// Check if the agent has a pin icon - if so, unpin it firstconst targetItem = this.page.locator(this.testContext.targetItemSelector).first();- const pinIcon = targetItem.locator('svg.lucide-pin');+ // Pin icon uses lucide-react which adds class "lucide lucide-pin"+ const pinIcon = targetItem.locator('svg[class*="lucide-pin"]');if ((await pinIcon.count()) > 0) {+ console.log(' 📍 Agent 已置顶,开始取消置顶操作...');// Unpin it first- await targetItem.click({ button: 'right' });- await this.page.waitForTimeout(300);+ await targetItem.hover();+ await this.page.waitForTimeout(200);+ await targetItem.click({ button: 'right', force: true });+ await this.page.waitForTimeout(500);const unpinOption = this.page.getByRole('menuitem', { name: /取消置顶|unpin/i });+ await unpinOption.waitFor({ state: 'visible', timeout: 5000 }).catch(() => {+ console.log(' ⚠️ 取消置顶选项未找到');+ });if ((await unpinOption.count()) > 0) {await unpinOption.click();await this.page.waitForTimeout(500);}// Close menu if still open- await this.page.click('body', { position: { x: 10, y: 10 } });+ await this.page.keyboard.press('Escape');+ await this.page.waitForTimeout(300);}console.log(' ✅ Agent 未被置顶');});-Given('该 Agent 已被置顶', async function (this: CustomWorld) {+Given('该 Agent 已被置顶', { timeout: 30_000 }, async function (this: CustomWorld) {console.log(' 📍 Step: 确保 Agent 已被置顶...');// Check if the agent has a pin icon - if not, pin it firstconst targetItem = this.page.locator(this.testContext.targetItemSelector).first();- const pinIcon = targetItem.locator('svg.lucide-pin');+ // Pin icon uses lucide-react which adds class "lucide lucide-pin"+ const pinIcon = targetItem.locator('svg[class*="lucide-pin"]');if ((await pinIcon.count()) === 0) {- // Pin it first- await targetItem.click({ button: 'right' });- await this.page.waitForTimeout(300);+ console.log(' 📍 Agent 未置顶,开始置顶操作...');+ // Pin it first - right-click on the NavItem Block inside the Link+ // The ContextMenuTrigger is attached to the Block component inside the Link+ await targetItem.hover();+ await this.page.waitForTimeout(200);+ await targetItem.click({ button: 'right', force: true });+ await this.page.waitForTimeout(500);++ // Debug: check menu visibility+ const menuItems = await this.page.locator('[role="menuitem"]').count();+ console.log(` 📍 Debug: 发现 ${menuItems} 个菜单项`);+const pinOption = this.page.getByRole('menuitem', { name: /置顶|pin/i });+ await pinOption.waitFor({ state: 'visible', timeout: 5000 }).catch(() => {+ console.log(' ⚠️ 置顶选项未找到');+ });if ((await pinOption.count()) > 0) {await pinOption.click();await this.page.waitForTimeout(500);+ console.log(' ✅ 已点击置顶选项');}// Close menu if still open- await this.page.click('body', { position: { x: 10, y: 10 } });+ await this.page.keyboard.press('Escape');+ await this.page.waitForTimeout(300);}- console.log(' ✅ Agent 已被置顶');+ // Verify pin is now visible+ await this.page.waitForTimeout(500);+ const pinIconAfter = targetItem.locator('svg[class*="lucide-pin"]');+ const isPinned = (await pinIconAfter.count()) > 0;+ console.log(` ✅ Agent 已被置顶: ${isPinned}`);});// ============================================// When Steps// ============================================-When('用户右键点击该 Agent', async function (this: CustomWorld) {+When('用户右键点击该 Agent', { timeout: 30_000 }, async function (this: CustomWorld) {console.log(' 📍 Step: 右键点击 Agent...');const targetItem = this.page.locator(this.testContext.targetItemSelector).first();- // Right-click on the inner content (the NavItem Block component)- // The ContextMenuTrigger wraps the Block, not the Link- const innerBlock = targetItem.locator('> div').first();- if ((await innerBlock.count()) > 0) {- await innerBlock.click({ button: 'right' });- } else {- await targetItem.click({ button: 'right' });- }+ // Hover first to ensure element is interactive+ await targetItem.hover();+ await this.page.waitForTimeout(200);++ // Right-click with force option to ensure it triggers+ await targetItem.click({ button: 'right', force: true });+ await this.page.waitForTimeout(500);- await this.page.waitForTimeout(800);+ // Wait for context menu to appear+ const menuItem = this.page.locator('[role="menuitem"]').first();+ await menuItem.waitFor({ state: 'visible', timeout: 5000 }).catch(() => {+ console.log(' ⚠️ 菜单未出现,重试右键点击...');+ });// Debug: check what menus are visibleconst menuItems = await this.page.locator('[role="menuitem"]').count();@@ -339,7 +369,8 @@ Then('Agent 应该显示置顶图标', async function (this: CustomWorld) {await this.page.waitForTimeout(500);const targetItem = this.page.locator(this.testContext.targetItemSelector).first();- const pinIcon = targetItem.locator('svg.lucide-pin');+ // Pin icon uses lucide-react which adds class "lucide lucide-pin"+ const pinIcon = targetItem.locator('svg[class*="lucide-pin"]');await expect(pinIcon).toBeVisible({ timeout: 5000 });console.log(' ✅ 置顶图标已显示');@@ -350,7 +381,8 @@ Then('Agent 不应该显示置顶图标', async function (this: CustomWorld) {await this.page.waitForTimeout(500);const targetItem = this.page.locator(this.testContext.targetItemSelector).first();- const pinIcon = targetItem.locator('svg.lucide-pin');+ // Pin icon uses lucide-react which adds class "lucide lucide-pin"+ const pinIcon = targetItem.locator('svg[class*="lucide-pin"]');await expect(pinIcon).not.toBeVisible({ timeout: 5000 });console.log(' ✅ 置顶图标未显示');diff --git a/src/server/routers/lambda/__tests__/integration/aiAgent/execAgent.integration.test.ts b/src/server/routers/lambda/__tests__/integration/aiAgent/execAgent.integration.test.tsindex 7e7f4b63e0f..9c9fd69487f 100644--- a/src/server/routers/lambda/__tests__/integration/aiAgent/execAgent.integration.test.ts+++ b/src/server/routers/lambda/__tests__/integration/aiAgent/execAgent.integration.test.ts@@ -232,14 +232,15 @@ describe('execAgent', () => {}).returning();- const [thread] = await serverDB+ const threadResult = (await serverDB.insert(threads).values({topicId: topic.id,type: 'standalone',userId,})- .returning();+ .returning()) as { id: string }[];+ const thread = threadResult[0];const caller = aiAgentRouter.createCaller(createTestContext());