@lobehub/lobehub 2.0.0-next.305 → 2.0.0-next.307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +18 -3
- package/CHANGELOG.md +53 -0
- package/changelog/v1.json +18 -0
- package/e2e/src/steps/community/detail-pages.steps.ts +3 -1
- package/e2e/src/steps/community/interactions.steps.ts +4 -4
- package/package.json +2 -2
- package/packages/builtin-agents/src/agents/group-supervisor/index.ts +1 -7
- package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +29 -0
- package/packages/builtin-tool-group-agent-builder/src/executor.ts +18 -0
- package/packages/builtin-tool-group-agent-builder/src/manifest.ts +17 -0
- package/packages/builtin-tool-group-agent-builder/src/types.ts +10 -0
- package/packages/builtin-tool-group-management/src/executor.test.ts +0 -12
- package/packages/builtin-tool-group-management/src/executor.ts +8 -47
- package/packages/builtin-tool-group-management/src/manifest.ts +0 -17
- package/packages/builtin-tool-group-management/src/systemRole.ts +1 -8
- package/packages/builtin-tool-group-management/src/types.ts +0 -10
- package/packages/builtin-tool-local-system/src/ExecutionRuntime/index.ts +70 -31
- package/packages/builtin-tool-local-system/src/executor/index.ts +94 -60
- package/packages/context-engine/src/processors/GroupMessageFlatten.ts +9 -6
- package/packages/context-engine/src/processors/__tests__/GroupMessageFlatten.test.ts +103 -0
- package/packages/context-engine/src/providers/GroupAgentBuilderContextInjector.ts +18 -31
- package/packages/context-engine/src/providers/__tests__/GroupAgentBuilderContextInjector.test.ts +307 -0
- package/packages/database/src/repositories/agentGroup/index.ts +23 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandOutput.test.ts +61 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandOutput.ts +21 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts +87 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandResult.ts +35 -0
- package/packages/prompts/src/prompts/fileSystem/formatEditResult.test.ts +57 -0
- package/packages/prompts/src/prompts/fileSystem/formatEditResult.ts +17 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileContent.test.ts +59 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileContent.ts +14 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileList.test.ts +62 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileList.ts +13 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileSearchResults.test.ts +34 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileSearchResults.ts +12 -0
- package/packages/prompts/src/prompts/fileSystem/formatGlobResults.test.ts +64 -0
- package/packages/prompts/src/prompts/fileSystem/formatGlobResults.ts +23 -0
- package/packages/prompts/src/prompts/fileSystem/formatGrepResults.test.ts +85 -0
- package/packages/prompts/src/prompts/fileSystem/formatGrepResults.ts +24 -0
- package/packages/prompts/src/prompts/fileSystem/formatKillResult.test.ts +30 -0
- package/packages/prompts/src/prompts/fileSystem/formatKillResult.ts +9 -0
- package/packages/prompts/src/prompts/fileSystem/formatMoveResults.test.ts +37 -0
- package/packages/prompts/src/prompts/fileSystem/formatMoveResults.ts +20 -0
- package/packages/prompts/src/prompts/fileSystem/formatMultipleFiles.test.ts +54 -0
- package/packages/prompts/src/prompts/fileSystem/formatMultipleFiles.ts +9 -0
- package/packages/prompts/src/prompts/fileSystem/formatRenameResult.test.ts +35 -0
- package/packages/prompts/src/prompts/fileSystem/formatRenameResult.ts +17 -0
- package/packages/prompts/src/prompts/fileSystem/formatWriteResult.test.ts +30 -0
- package/packages/prompts/src/prompts/fileSystem/formatWriteResult.ts +11 -0
- package/packages/prompts/src/prompts/fileSystem/index.ts +13 -0
- package/packages/prompts/src/prompts/index.ts +1 -0
- package/packages/prompts/src/prompts/userMemory/__snapshots__/index.test.ts.snap +14 -38
- package/packages/prompts/src/prompts/userMemory/index.ts +5 -24
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/Actions.tsx +4 -3
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/useDropdownMenu.tsx +12 -2
- package/src/app/[variants]/(main)/community/(detail)/assistant/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx +69 -17
- package/src/app/[variants]/(main)/community/(detail)/mcp/index.tsx +1 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/Actions.tsx +4 -3
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/useDropdownMenu.tsx +12 -2
- package/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/index.tsx +2 -2
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +13 -3
- package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +26 -3
- package/src/features/Conversation/Messages/Supervisor/index.tsx +2 -1
- package/src/features/Conversation/Messages/components/ContentLoading.tsx +8 -2
- package/src/features/ResourceManager/components/Header/AddButton.tsx +20 -3
- package/src/server/routers/lambda/__tests__/agentGroup.test.ts +1 -0
- package/src/server/routers/lambda/agentGroup.ts +22 -0
- package/src/services/chat/index.ts +1 -0
- package/src/services/chat/mecha/agentConfigResolver.test.ts +62 -45
- package/src/services/chat/mecha/agentConfigResolver.ts +77 -10
- package/src/services/chat/mecha/modelParamsResolver.test.ts +211 -0
- package/src/services/chatGroup/index.ts +14 -0
- package/src/store/agentGroup/action.ts +30 -0
- package/src/store/agentGroup/slices/lifecycle.test.ts +77 -18
- package/src/store/agentGroup/slices/lifecycle.ts +7 -9
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +6 -2
- package/src/store/chat/slices/operation/__tests__/selectors.test.ts +124 -0
- package/src/store/chat/slices/operation/selectors.ts +22 -0
package/.vscode/settings.json
CHANGED
|
@@ -26,9 +26,24 @@
|
|
|
26
26
|
],
|
|
27
27
|
"npm.packageManager": "pnpm",
|
|
28
28
|
"search.exclude": {
|
|
29
|
-
"**/node_modules": true
|
|
30
|
-
// useless to search this big folder
|
|
31
|
-
|
|
29
|
+
"**/node_modules": true,
|
|
30
|
+
// useless to search this big folder, exclude all locales except en-US and zh-CN
|
|
31
|
+
"locales/ar/**": true,
|
|
32
|
+
"locales/bg-BG/**": true,
|
|
33
|
+
"locales/de-DE/**": true,
|
|
34
|
+
"locales/es-ES/**": true,
|
|
35
|
+
"locales/fa-IR/**": true,
|
|
36
|
+
"locales/fr-FR/**": true,
|
|
37
|
+
"locales/it-IT/**": true,
|
|
38
|
+
"locales/ja-JP/**": true,
|
|
39
|
+
"locales/ko-KR/**": true,
|
|
40
|
+
"locales/nl-NL/**": true,
|
|
41
|
+
"locales/pl-PL/**": true,
|
|
42
|
+
"locales/pt-BR/**": true,
|
|
43
|
+
"locales/ru-RU/**": true,
|
|
44
|
+
"locales/tr-TR/**": true,
|
|
45
|
+
"locales/vi-VN/**": true,
|
|
46
|
+
"locales/zh-TW/**": true
|
|
32
47
|
},
|
|
33
48
|
"stylelint.validate": [
|
|
34
49
|
"css",
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.307](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.306...v2.0.0-next.307)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2026-01-18**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **upload**: Resolve file upload button unresponsive issue.
|
|
12
|
+
- **misc**: Fixed the createGroupWithSupervisor function test, slove when use copy & install group from market, the member system Role is lost.
|
|
13
|
+
|
|
14
|
+
<br/>
|
|
15
|
+
|
|
16
|
+
<details>
|
|
17
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
18
|
+
|
|
19
|
+
#### What's fixed
|
|
20
|
+
|
|
21
|
+
- **upload**: Resolve file upload button unresponsive issue, closes [#11588](https://github.com/lobehub/lobe-chat/issues/11588) ([76fd478](https://github.com/lobehub/lobe-chat/commit/76fd478))
|
|
22
|
+
- **misc**: Fixed the createGroupWithSupervisor function test, closes [#11590](https://github.com/lobehub/lobe-chat/issues/11590) ([83bb343](https://github.com/lobehub/lobe-chat/commit/83bb343))
|
|
23
|
+
- **misc**: Slove when use copy & install group from market, the member system Role is lost, closes [#11585](https://github.com/lobehub/lobe-chat/issues/11585) ([9b73ad7](https://github.com/lobehub/lobe-chat/commit/9b73ad7))
|
|
24
|
+
|
|
25
|
+
</details>
|
|
26
|
+
|
|
27
|
+
<div align="right">
|
|
28
|
+
|
|
29
|
+
[](#readme-top)
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
## [Version 2.0.0-next.306](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.305...v2.0.0-next.306)
|
|
34
|
+
|
|
35
|
+
<sup>Released on **2026-01-18**</sup>
|
|
36
|
+
|
|
37
|
+
#### 🐛 Bug Fixes
|
|
38
|
+
|
|
39
|
+
- **misc**: Fix supervisor id issue.
|
|
40
|
+
|
|
41
|
+
<br/>
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
45
|
+
|
|
46
|
+
#### What's fixed
|
|
47
|
+
|
|
48
|
+
- **misc**: Fix supervisor id issue, closes [#11584](https://github.com/lobehub/lobe-chat/issues/11584) ([c097584](https://github.com/lobehub/lobe-chat/commit/c097584))
|
|
49
|
+
|
|
50
|
+
</details>
|
|
51
|
+
|
|
52
|
+
<div align="right">
|
|
53
|
+
|
|
54
|
+
[](#readme-top)
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
|
|
5
58
|
## [Version 2.0.0-next.305](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.304...v2.0.0-next.305)
|
|
6
59
|
|
|
7
60
|
<sup>Released on **2026-01-18**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"fixes": [
|
|
5
|
+
"Fixed the createGroupWithSupervisor function test, slove when use copy & install group from market, the member system Role is lost."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2026-01-18",
|
|
9
|
+
"version": "2.0.0-next.307"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {
|
|
13
|
+
"fixes": [
|
|
14
|
+
"Fix supervisor id issue."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"date": "2026-01-18",
|
|
18
|
+
"version": "2.0.0-next.306"
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"children": {},
|
|
4
22
|
"date": "2026-01-18",
|
|
@@ -8,7 +8,9 @@ import { CustomWorld } from '../../support/world';
|
|
|
8
8
|
// ============================================
|
|
9
9
|
|
|
10
10
|
Given('I wait for the page to fully load', async function (this: CustomWorld) {
|
|
11
|
-
|
|
11
|
+
// Use domcontentloaded instead of networkidle to avoid hanging on persistent connections
|
|
12
|
+
await this.page.waitForLoadState('domcontentloaded', { timeout: 10_000 });
|
|
13
|
+
// Short wait for React hydration
|
|
12
14
|
await this.page.waitForTimeout(1000);
|
|
13
15
|
});
|
|
14
16
|
|
|
@@ -446,8 +446,8 @@ Then('I should be navigated to the assistant detail page', async function (this:
|
|
|
446
446
|
Then('I should see the assistant detail content', async function (this: CustomWorld) {
|
|
447
447
|
await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
|
|
448
448
|
|
|
449
|
-
// Look for detail page
|
|
450
|
-
const detailContent = this.page.locator('[data-testid="detail-content"]
|
|
449
|
+
// Look for assistant detail page content
|
|
450
|
+
const detailContent = this.page.locator('[data-testid="assistant-detail-content"]');
|
|
451
451
|
await expect(detailContent).toBeVisible({ timeout: 30_000 });
|
|
452
452
|
});
|
|
453
453
|
|
|
@@ -561,8 +561,8 @@ Then('I should be navigated to the MCP detail page', async function (this: Custo
|
|
|
561
561
|
Then('I should see the MCP detail content', async function (this: CustomWorld) {
|
|
562
562
|
await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
|
|
563
563
|
|
|
564
|
-
// Look for detail page
|
|
565
|
-
const detailContent = this.page.locator('[data-testid="detail-content"]
|
|
564
|
+
// Look for MCP detail page content
|
|
565
|
+
const detailContent = this.page.locator('[data-testid="mcp-detail-content"]');
|
|
566
566
|
await expect(detailContent).toBeVisible({ timeout: 30_000 });
|
|
567
567
|
});
|
|
568
568
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.307",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"@lobehub/icons": "^4.0.2",
|
|
208
208
|
"@lobehub/market-sdk": "0.29.0",
|
|
209
209
|
"@lobehub/tts": "^4.0.2",
|
|
210
|
-
"@lobehub/ui": "^4.
|
|
210
|
+
"@lobehub/ui": "^4.22.0",
|
|
211
211
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
212
212
|
"@neondatabase/serverless": "^1.0.2",
|
|
213
213
|
"@next/third-parties": "^16.1.1",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GroupAgentBuilderIdentifier } from '@lobechat/builtin-tool-group-agent-builder';
|
|
2
2
|
import { GroupManagementIdentifier } from '@lobechat/builtin-tool-group-management';
|
|
3
|
-
import { GTDIdentifier } from '@lobechat/builtin-tool-gtd';
|
|
4
3
|
|
|
5
4
|
import type { BuiltinAgentDefinition } from '../../types';
|
|
6
5
|
import { BUILTIN_AGENT_SLUGS } from '../../types';
|
|
@@ -41,12 +40,7 @@ export const GROUP_SUPERVISOR: BuiltinAgentDefinition = {
|
|
|
41
40
|
chatConfig: {
|
|
42
41
|
enableHistoryCount: false,
|
|
43
42
|
},
|
|
44
|
-
plugins: [
|
|
45
|
-
GroupManagementIdentifier,
|
|
46
|
-
GroupAgentBuilderIdentifier,
|
|
47
|
-
GTDIdentifier,
|
|
48
|
-
...(ctx.plugins || []),
|
|
49
|
-
],
|
|
43
|
+
plugins: [GroupManagementIdentifier, GroupAgentBuilderIdentifier, ...(ctx.plugins || [])],
|
|
50
44
|
systemRole: resolveSystemRole(groupSupervisorContext),
|
|
51
45
|
};
|
|
52
46
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatAgentProfile } from '@lobechat/prompts';
|
|
1
2
|
import type { BuiltinServerRuntimeOutput } from '@lobechat/types';
|
|
2
3
|
|
|
3
4
|
import { agentService } from '@/services/agent';
|
|
@@ -11,6 +12,7 @@ import type {
|
|
|
11
12
|
BatchCreateAgentsState,
|
|
12
13
|
CreateAgentParams,
|
|
13
14
|
CreateAgentState,
|
|
15
|
+
GetAgentInfoParams,
|
|
14
16
|
InviteAgentParams,
|
|
15
17
|
InviteAgentState,
|
|
16
18
|
RemoveAgentParams,
|
|
@@ -30,6 +32,33 @@ import type {
|
|
|
30
32
|
* Extends AgentBuilder functionality with group-specific operations
|
|
31
33
|
*/
|
|
32
34
|
export class GroupAgentBuilderExecutionRuntime {
|
|
35
|
+
// ==================== Agent Info ====================
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get detailed information about a specific agent
|
|
39
|
+
*/
|
|
40
|
+
async getAgentInfo(
|
|
41
|
+
groupId: string | undefined,
|
|
42
|
+
args: GetAgentInfoParams,
|
|
43
|
+
): Promise<BuiltinServerRuntimeOutput> {
|
|
44
|
+
if (!groupId) {
|
|
45
|
+
return {
|
|
46
|
+
content: 'No group context available',
|
|
47
|
+
success: false,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const state = getChatGroupStoreState();
|
|
52
|
+
const agent = agentGroupSelectors.getAgentByIdFromGroup(groupId, args.agentId)(state);
|
|
53
|
+
|
|
54
|
+
if (!agent) {
|
|
55
|
+
return { content: `Agent "${args.agentId}" not found in this group`, success: false };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Return formatted agent profile for the supervisor
|
|
59
|
+
return { content: formatAgentProfile(agent), state: agent, success: true };
|
|
60
|
+
}
|
|
61
|
+
|
|
33
62
|
// ==================== Group Member Management ====================
|
|
34
63
|
|
|
35
64
|
/**
|
|
@@ -16,6 +16,7 @@ import { GroupAgentBuilderExecutionRuntime } from './ExecutionRuntime';
|
|
|
16
16
|
import {
|
|
17
17
|
type BatchCreateAgentsParams,
|
|
18
18
|
type CreateAgentParams,
|
|
19
|
+
type GetAgentInfoParams,
|
|
19
20
|
GroupAgentBuilderApiName,
|
|
20
21
|
GroupAgentBuilderIdentifier,
|
|
21
22
|
type InviteAgentParams,
|
|
@@ -34,6 +35,23 @@ class GroupAgentBuilderExecutor extends BaseExecutor<typeof GroupAgentBuilderApi
|
|
|
34
35
|
readonly identifier = GroupAgentBuilderIdentifier;
|
|
35
36
|
protected readonly apiEnum = GroupAgentBuilderApiName;
|
|
36
37
|
|
|
38
|
+
// ==================== Agent Info ====================
|
|
39
|
+
|
|
40
|
+
getAgentInfo = async (
|
|
41
|
+
params: GetAgentInfoParams,
|
|
42
|
+
ctx: BuiltinToolContext,
|
|
43
|
+
): Promise<BuiltinToolResult> => {
|
|
44
|
+
const result = await groupAgentBuilderRuntime.getAgentInfo(ctx.groupId, params);
|
|
45
|
+
return {
|
|
46
|
+
content: result.content,
|
|
47
|
+
error: result.error
|
|
48
|
+
? { body: result.error, message: String(result.error), type: 'RuntimeError' }
|
|
49
|
+
: undefined,
|
|
50
|
+
state: result.state,
|
|
51
|
+
success: result.success,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
37
55
|
// ==================== Group Member Management ====================
|
|
38
56
|
|
|
39
57
|
searchAgent = async (params: SearchAgentParams): Promise<BuiltinToolResult> => {
|
|
@@ -5,6 +5,23 @@ import { GroupAgentBuilderApiName, GroupAgentBuilderIdentifier } from './types';
|
|
|
5
5
|
|
|
6
6
|
export const GroupAgentBuilderManifest: BuiltinToolManifest = {
|
|
7
7
|
api: [
|
|
8
|
+
// ==================== Agent Info ====================
|
|
9
|
+
{
|
|
10
|
+
description:
|
|
11
|
+
'Get detailed information about a specific agent, including their capabilities, available tools, and configuration. Use this to check if an agent has tools before deciding between speak vs executeAgentTask.',
|
|
12
|
+
name: GroupAgentBuilderApiName.getAgentInfo,
|
|
13
|
+
parameters: {
|
|
14
|
+
properties: {
|
|
15
|
+
agentId: {
|
|
16
|
+
description: 'The ID of the agent to get information about.',
|
|
17
|
+
type: 'string',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ['agentId'],
|
|
21
|
+
type: 'object',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
|
|
8
25
|
// ==================== Group Member Management ====================
|
|
9
26
|
{
|
|
10
27
|
description:
|
|
@@ -14,6 +14,9 @@ export const GroupAgentBuilderApiName = {
|
|
|
14
14
|
batchCreateAgents: 'batchCreateAgents',
|
|
15
15
|
createAgent: 'createAgent',
|
|
16
16
|
|
|
17
|
+
// Agent info
|
|
18
|
+
getAgentInfo: 'getAgentInfo',
|
|
19
|
+
|
|
17
20
|
// Read operations (inherited from AgentBuilder)
|
|
18
21
|
getAvailableModels: 'getAvailableModels',
|
|
19
22
|
|
|
@@ -40,6 +43,13 @@ export type GroupAgentBuilderApiNameType =
|
|
|
40
43
|
|
|
41
44
|
// ============== Group-specific Parameter Types ==============
|
|
42
45
|
|
|
46
|
+
export interface GetAgentInfoParams {
|
|
47
|
+
/**
|
|
48
|
+
* The ID of the agent to get information about
|
|
49
|
+
*/
|
|
50
|
+
agentId: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
export interface SearchAgentParams {
|
|
44
54
|
/**
|
|
45
55
|
* Maximum number of results to return
|
|
@@ -271,18 +271,6 @@ describe('GroupManagementExecutor', () => {
|
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
-
describe('getAgentInfo', () => {
|
|
275
|
-
it('should return error when no groupId in context', async () => {
|
|
276
|
-
const ctx = createMockContext();
|
|
277
|
-
|
|
278
|
-
const result = await groupManagementExecutor.getAgentInfo({ agentId: 'agent-1' }, ctx);
|
|
279
|
-
|
|
280
|
-
// No groupId means we can't get agent info
|
|
281
|
-
expect(result.success).toBe(false);
|
|
282
|
-
expect(result.stop).toBeUndefined();
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
274
|
describe('executeAgentTask', () => {
|
|
287
275
|
beforeEach(() => {
|
|
288
276
|
vi.clearAllMocks();
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
CreateWorkflowParams,
|
|
12
12
|
DelegateParams,
|
|
13
13
|
ExecuteTaskParams,
|
|
14
|
-
GetAgentInfoParams,
|
|
15
14
|
GroupManagementApiName,
|
|
16
15
|
GroupManagementIdentifier,
|
|
17
16
|
InterruptParams,
|
|
@@ -19,43 +18,12 @@ import {
|
|
|
19
18
|
SummarizeParams,
|
|
20
19
|
VoteParams,
|
|
21
20
|
} from '@lobechat/builtin-tool-group-management';
|
|
22
|
-
import { formatAgentProfile } from '@lobechat/prompts';
|
|
23
21
|
import { BaseExecutor, type BuiltinToolContext, type BuiltinToolResult } from '@lobechat/types';
|
|
24
22
|
|
|
25
|
-
import { agentGroupSelectors, useAgentGroupStore } from '@/store/agentGroup';
|
|
26
|
-
|
|
27
23
|
class GroupManagementExecutor extends BaseExecutor<typeof GroupManagementApiName> {
|
|
28
24
|
readonly identifier = GroupManagementIdentifier;
|
|
29
25
|
protected readonly apiEnum = GroupManagementApiName;
|
|
30
26
|
|
|
31
|
-
// ==================== Agent Info ====================
|
|
32
|
-
|
|
33
|
-
getAgentInfo = async (
|
|
34
|
-
params: GetAgentInfoParams,
|
|
35
|
-
ctx: BuiltinToolContext,
|
|
36
|
-
): Promise<BuiltinToolResult> => {
|
|
37
|
-
const { groupId } = ctx;
|
|
38
|
-
|
|
39
|
-
if (!groupId) {
|
|
40
|
-
return {
|
|
41
|
-
content: JSON.stringify({ error: 'No group context available', success: false }),
|
|
42
|
-
success: false,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const agent = agentGroupSelectors.getAgentByIdFromGroup(
|
|
47
|
-
groupId,
|
|
48
|
-
params.agentId,
|
|
49
|
-
)(useAgentGroupStore.getState());
|
|
50
|
-
|
|
51
|
-
if (!agent) {
|
|
52
|
-
return { content: `Agent "${params.agentId}" not found in this group`, success: false };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Return formatted agent profile for the supervisor
|
|
56
|
-
return { content: formatAgentProfile(agent), state: agent, success: true };
|
|
57
|
-
};
|
|
58
|
-
|
|
59
27
|
// ==================== Communication Coordination ====================
|
|
60
28
|
|
|
61
29
|
speak = async (params: SpeakParams, ctx: BuiltinToolContext): Promise<BuiltinToolResult> => {
|
|
@@ -225,12 +193,12 @@ class GroupManagementExecutor extends BaseExecutor<typeof GroupManagementApiName
|
|
|
225
193
|
_ctx: BuiltinToolContext,
|
|
226
194
|
): Promise<BuiltinToolResult> => {
|
|
227
195
|
// TODO: Implement conversation summarization
|
|
196
|
+
const focusInfo = params.focus ? ` with focus on "${params.focus}"` : '';
|
|
197
|
+
const preserveInfo = params.preserveRecent
|
|
198
|
+
? ` (preserving ${params.preserveRecent} recent messages)`
|
|
199
|
+
: '';
|
|
228
200
|
return {
|
|
229
|
-
content:
|
|
230
|
-
focus: params.focus,
|
|
231
|
-
message: 'Summarization not yet implemented',
|
|
232
|
-
preserveRecent: params.preserveRecent,
|
|
233
|
-
}),
|
|
201
|
+
content: `Summarization not yet implemented${focusInfo}${preserveInfo}`,
|
|
234
202
|
success: true,
|
|
235
203
|
};
|
|
236
204
|
};
|
|
@@ -243,23 +211,16 @@ class GroupManagementExecutor extends BaseExecutor<typeof GroupManagementApiName
|
|
|
243
211
|
): Promise<BuiltinToolResult> => {
|
|
244
212
|
// TODO: Implement workflow creation
|
|
245
213
|
return {
|
|
246
|
-
content:
|
|
247
|
-
message: 'Workflow creation not yet implemented',
|
|
248
|
-
name: params.name,
|
|
249
|
-
steps: params.steps,
|
|
250
|
-
}),
|
|
214
|
+
content: `Workflow creation not yet implemented for "${params.name}" with ${params.steps.length} steps`,
|
|
251
215
|
success: true,
|
|
252
216
|
};
|
|
253
217
|
};
|
|
254
218
|
|
|
255
219
|
vote = async (params: VoteParams, _ctx: BuiltinToolContext): Promise<BuiltinToolResult> => {
|
|
256
220
|
// TODO: Implement voting mechanism
|
|
221
|
+
const optionLabels = params.options.map((o) => o.label).join(', ');
|
|
257
222
|
return {
|
|
258
|
-
content:
|
|
259
|
-
message: 'Voting not yet implemented',
|
|
260
|
-
options: params.options,
|
|
261
|
-
question: params.question,
|
|
262
|
-
}),
|
|
223
|
+
content: `Voting not yet implemented for question: "${params.question}" with options: ${optionLabels}`,
|
|
263
224
|
success: true,
|
|
264
225
|
};
|
|
265
226
|
};
|
|
@@ -8,23 +8,6 @@ export const GroupManagementIdentifier = 'lobe-group-management';
|
|
|
8
8
|
export const GroupManagementManifest: BuiltinToolManifest = {
|
|
9
9
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
10
10
|
api: [
|
|
11
|
-
// ==================== Agent Info ====================
|
|
12
|
-
{
|
|
13
|
-
description:
|
|
14
|
-
'Get detailed information about a specific agent, including their capabilities, available tools, and configuration. Use this to check if an agent has tools before deciding between speak vs executeAgentTask.',
|
|
15
|
-
name: GroupManagementApiName.getAgentInfo,
|
|
16
|
-
parameters: {
|
|
17
|
-
properties: {
|
|
18
|
-
agentId: {
|
|
19
|
-
description: 'The ID of the agent to get information about.',
|
|
20
|
-
type: 'string',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
required: ['agentId'],
|
|
24
|
-
type: 'object',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
|
|
28
11
|
// ==================== Communication Coordination ====================
|
|
29
12
|
{
|
|
30
13
|
description:
|
|
@@ -150,9 +150,6 @@ When a user's request is broad or unclear, ask 1-2 focused questions to understa
|
|
|
150
150
|
<core_capabilities>
|
|
151
151
|
## Tool Categories
|
|
152
152
|
|
|
153
|
-
**Agent Info:**
|
|
154
|
-
- **getAgentInfo**: Get agent details including their tools and capabilities - **Use this to check if an agent has tools before deciding speak vs executeAgentTask**
|
|
155
|
-
|
|
156
153
|
**Speaking (Shared Context, No Tools):**
|
|
157
154
|
- **speak**: Single agent responds synchronously in group context
|
|
158
155
|
- **broadcast**: Multiple agents respond in parallel in group context
|
|
@@ -241,9 +238,6 @@ Action: executeAgentTasks({
|
|
|
241
238
|
</workflow_patterns>
|
|
242
239
|
|
|
243
240
|
<tool_usage_guidelines>
|
|
244
|
-
**Agent Info:**
|
|
245
|
-
- getAgentInfo: \`agentId\` - **Use this to check if an agent has tools before deciding speak vs executeAgentTask**
|
|
246
|
-
|
|
247
241
|
**Speaking:**
|
|
248
242
|
- speak: \`agentId\`, \`instruction\` (optional guidance)
|
|
249
243
|
- broadcast: \`agentIds\` (array), \`instruction\` (optional shared guidance)
|
|
@@ -259,8 +253,7 @@ Action: executeAgentTasks({
|
|
|
259
253
|
</tool_usage_guidelines>
|
|
260
254
|
|
|
261
255
|
<best_practices>
|
|
262
|
-
1. **
|
|
263
|
-
2. **Don't over-engineer**: Simple questions → speak; Complex tasks requiring tools → executeAgentTask
|
|
256
|
+
1. **Don't over-engineer**: Simple questions → speak; Complex tasks requiring tools → executeAgentTask
|
|
264
257
|
3. **Parallel when possible**: Use broadcast for opinions, parallel executeAgentTask for independent work
|
|
265
258
|
4. **Sequential when dependent**: Use speak chain when each response builds on previous
|
|
266
259
|
5. **Be explicit with task instructions**: For executeAgentTask, clearly describe expected deliverables
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
* are handled by group-agent-builder tool. This tool focuses on orchestration.
|
|
8
8
|
*/
|
|
9
9
|
export const GroupManagementApiName = {
|
|
10
|
-
// ==================== Agent Info ====================
|
|
11
|
-
/** Get detailed information about an agent */
|
|
12
|
-
getAgentInfo: 'getAgentInfo',
|
|
13
|
-
|
|
14
10
|
// ==================== Communication Coordination ====================
|
|
15
11
|
/** Let a specific agent speak (synchronous, immediate response) */
|
|
16
12
|
speak: 'speak',
|
|
@@ -41,12 +37,6 @@ export const GroupManagementApiName = {
|
|
|
41
37
|
export type GroupManagementApiNameType =
|
|
42
38
|
(typeof GroupManagementApiName)[keyof typeof GroupManagementApiName];
|
|
43
39
|
|
|
44
|
-
// ==================== Agent Info Params ====================
|
|
45
|
-
|
|
46
|
-
export interface GetAgentInfoParams {
|
|
47
|
-
agentId: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
40
|
// ==================== Communication Params ====================
|
|
51
41
|
|
|
52
42
|
export interface SpeakParams {
|