@lobehub/lobehub 2.0.0-next.306 → 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 +28 -0
- package/changelog/v1.json +9 -0
- 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/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/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)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx +69 -17
- 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/features/ChatInput/ActionBar/Upload/ServerMode.tsx +13 -3
- package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +26 -3
- 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 +29 -27
- package/src/services/chatGroup/index.ts +14 -0
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +6 -2
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,34 @@
|
|
|
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
|
+
|
|
5
33
|
## [Version 2.0.0-next.306](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.305...v2.0.0-next.306)
|
|
6
34
|
|
|
7
35
|
<sup>Released on **2026-01-18**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
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
|
+
},
|
|
2
11
|
{
|
|
3
12
|
"children": {
|
|
4
13
|
"fixes": [
|
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 {
|
|
@@ -71,8 +71,14 @@ export class LocalSystemExecutionRuntime {
|
|
|
71
71
|
|
|
72
72
|
const state: LocalFileListState = { listResults: result };
|
|
73
73
|
|
|
74
|
+
const fileList = result.map((f) => ` ${f.isDirectory ? '[D]' : '[F]'} ${f.name}`).join('\n');
|
|
75
|
+
const content =
|
|
76
|
+
result.length > 0
|
|
77
|
+
? `Found ${result.length} item(s) in ${args.path}:\n${fileList}`
|
|
78
|
+
: `Directory ${args.path} is empty`;
|
|
79
|
+
|
|
74
80
|
return {
|
|
75
|
-
content
|
|
81
|
+
content,
|
|
76
82
|
state,
|
|
77
83
|
success: true,
|
|
78
84
|
};
|
|
@@ -91,8 +97,11 @@ export class LocalSystemExecutionRuntime {
|
|
|
91
97
|
|
|
92
98
|
const state: LocalReadFileState = { fileContent: result };
|
|
93
99
|
|
|
100
|
+
const lineInfo = args.loc ? ` (lines ${args.loc[0]}-${args.loc[1]})` : '';
|
|
101
|
+
const content = `File: ${args.path}${lineInfo}\n\n${result.content}`;
|
|
102
|
+
|
|
94
103
|
return {
|
|
95
|
-
content
|
|
104
|
+
content,
|
|
96
105
|
state,
|
|
97
106
|
success: true,
|
|
98
107
|
};
|
|
@@ -111,8 +120,11 @@ export class LocalSystemExecutionRuntime {
|
|
|
111
120
|
|
|
112
121
|
const state: LocalReadFilesState = { filesContent: results };
|
|
113
122
|
|
|
123
|
+
const fileContents = results.map((r) => `=== ${r.filename} ===\n${r.content}`).join('\n\n');
|
|
124
|
+
const content = `Read ${results.length} file(s):\n\n${fileContents}`;
|
|
125
|
+
|
|
114
126
|
return {
|
|
115
|
-
content
|
|
127
|
+
content,
|
|
116
128
|
state,
|
|
117
129
|
success: true,
|
|
118
130
|
};
|
|
@@ -131,8 +143,12 @@ export class LocalSystemExecutionRuntime {
|
|
|
131
143
|
|
|
132
144
|
const state: LocalFileSearchState = { searchResults: result };
|
|
133
145
|
|
|
146
|
+
const fileList = result.map((f) => ` ${f.path}`).join('\n');
|
|
147
|
+
const content =
|
|
148
|
+
result.length > 0 ? `Found ${result.length} file(s):\n${fileList}` : 'No files found';
|
|
149
|
+
|
|
134
150
|
return {
|
|
135
|
-
content
|
|
151
|
+
content,
|
|
136
152
|
state,
|
|
137
153
|
success: true,
|
|
138
154
|
};
|
|
@@ -154,14 +170,14 @@ export class LocalSystemExecutionRuntime {
|
|
|
154
170
|
const successCount = results.filter((r) => r.success).length;
|
|
155
171
|
const failedCount = results.length - successCount;
|
|
156
172
|
|
|
157
|
-
let
|
|
173
|
+
let content = '';
|
|
158
174
|
|
|
159
175
|
if (allSucceeded) {
|
|
160
|
-
|
|
176
|
+
content = `Successfully moved ${results.length} item(s).`;
|
|
161
177
|
} else if (someFailed) {
|
|
162
|
-
|
|
178
|
+
content = `Moved ${successCount} item(s) successfully. Failed to move ${failedCount} item(s).`;
|
|
163
179
|
} else {
|
|
164
|
-
|
|
180
|
+
content = `Failed to move all ${results.length} item(s).`;
|
|
165
181
|
}
|
|
166
182
|
|
|
167
183
|
const state: LocalMoveFilesState = {
|
|
@@ -171,7 +187,7 @@ export class LocalSystemExecutionRuntime {
|
|
|
171
187
|
};
|
|
172
188
|
|
|
173
189
|
return {
|
|
174
|
-
content
|
|
190
|
+
content,
|
|
175
191
|
state,
|
|
176
192
|
success: true,
|
|
177
193
|
};
|
|
@@ -197,7 +213,7 @@ export class LocalSystemExecutionRuntime {
|
|
|
197
213
|
};
|
|
198
214
|
|
|
199
215
|
return {
|
|
200
|
-
content:
|
|
216
|
+
content: `Failed to rename file: ${result.error}`,
|
|
201
217
|
state,
|
|
202
218
|
success: false,
|
|
203
219
|
};
|
|
@@ -210,10 +226,7 @@ export class LocalSystemExecutionRuntime {
|
|
|
210
226
|
};
|
|
211
227
|
|
|
212
228
|
return {
|
|
213
|
-
content:
|
|
214
|
-
message: `Successfully renamed file ${args.path} to ${args.newName}.`,
|
|
215
|
-
success: true,
|
|
216
|
-
}),
|
|
229
|
+
content: `Successfully renamed file ${args.path} to ${args.newName}`,
|
|
217
230
|
state,
|
|
218
231
|
success: true,
|
|
219
232
|
};
|
|
@@ -232,20 +245,14 @@ export class LocalSystemExecutionRuntime {
|
|
|
232
245
|
|
|
233
246
|
if (!result.success) {
|
|
234
247
|
return {
|
|
235
|
-
content:
|
|
236
|
-
message: result.error || '写入文件失败',
|
|
237
|
-
success: false,
|
|
238
|
-
}),
|
|
248
|
+
content: `Failed to write file: ${result.error || 'Unknown error'}`,
|
|
239
249
|
error: result.error,
|
|
240
250
|
success: false,
|
|
241
251
|
};
|
|
242
252
|
}
|
|
243
253
|
|
|
244
254
|
return {
|
|
245
|
-
content:
|
|
246
|
-
message: `成功写入文件 ${args.path}`,
|
|
247
|
-
success: true,
|
|
248
|
-
}),
|
|
255
|
+
content: `Successfully wrote to ${args.path}`,
|
|
249
256
|
success: true,
|
|
250
257
|
};
|
|
251
258
|
} catch (error) {
|
|
@@ -301,22 +308,28 @@ export class LocalSystemExecutionRuntime {
|
|
|
301
308
|
try {
|
|
302
309
|
const result: RunCommandResult = await this.localFileService.runCommand(args);
|
|
303
310
|
|
|
304
|
-
|
|
311
|
+
const parts: string[] = [];
|
|
305
312
|
|
|
306
313
|
if (result.success) {
|
|
307
314
|
if (result.shell_id) {
|
|
308
|
-
|
|
315
|
+
parts.push(`Command started in background with shell_id: ${result.shell_id}`);
|
|
309
316
|
} else {
|
|
310
|
-
|
|
317
|
+
parts.push('Command completed successfully.');
|
|
311
318
|
}
|
|
312
319
|
} else {
|
|
313
|
-
|
|
320
|
+
parts.push(`Command failed: ${result.error}`);
|
|
314
321
|
}
|
|
315
322
|
|
|
323
|
+
if (result.stdout) parts.push(`Output:\n${result.stdout}`);
|
|
324
|
+
if (result.stderr) parts.push(`Stderr:\n${result.stderr}`);
|
|
325
|
+
if (result.exit_code !== undefined) parts.push(`Exit code: ${result.exit_code}`);
|
|
326
|
+
|
|
327
|
+
const message = parts[0];
|
|
328
|
+
const content = parts.join('\n\n');
|
|
316
329
|
const state: RunCommandState = { message, result };
|
|
317
330
|
|
|
318
331
|
return {
|
|
319
|
-
content
|
|
332
|
+
content,
|
|
320
333
|
state,
|
|
321
334
|
success: result.success,
|
|
322
335
|
};
|
|
@@ -337,10 +350,14 @@ export class LocalSystemExecutionRuntime {
|
|
|
337
350
|
? `Output retrieved. Running: ${result.running}`
|
|
338
351
|
: `Failed: ${result.error}`;
|
|
339
352
|
|
|
353
|
+
const parts: string[] = [message];
|
|
354
|
+
if (result.output) parts.push(`Output:\n${result.output}`);
|
|
355
|
+
if (result.error) parts.push(`Error: ${result.error}`);
|
|
356
|
+
|
|
340
357
|
const state: GetCommandOutputState = { message, result };
|
|
341
358
|
|
|
342
359
|
return {
|
|
343
|
-
content:
|
|
360
|
+
content: parts.join('\n\n'),
|
|
344
361
|
state,
|
|
345
362
|
success: result.success,
|
|
346
363
|
};
|
|
@@ -364,7 +381,7 @@ export class LocalSystemExecutionRuntime {
|
|
|
364
381
|
const state: KillCommandState = { message, result };
|
|
365
382
|
|
|
366
383
|
return {
|
|
367
|
-
content:
|
|
384
|
+
content: message,
|
|
368
385
|
state,
|
|
369
386
|
success: result.success,
|
|
370
387
|
};
|
|
@@ -389,8 +406,19 @@ export class LocalSystemExecutionRuntime {
|
|
|
389
406
|
|
|
390
407
|
const state: GrepContentState = { message, result };
|
|
391
408
|
|
|
409
|
+
let content = message;
|
|
410
|
+
if (result.success && result.matches.length > 0) {
|
|
411
|
+
const matchList = result.matches
|
|
412
|
+
.slice(0, 20)
|
|
413
|
+
.map((m) => ` ${m}`)
|
|
414
|
+
.join('\n');
|
|
415
|
+
const moreInfo =
|
|
416
|
+
result.matches.length > 20 ? `\n ... and ${result.matches.length - 20} more` : '';
|
|
417
|
+
content = `${message}:\n${matchList}${moreInfo}`;
|
|
418
|
+
}
|
|
419
|
+
|
|
392
420
|
return {
|
|
393
|
-
content
|
|
421
|
+
content,
|
|
394
422
|
state,
|
|
395
423
|
success: result.success,
|
|
396
424
|
};
|
|
@@ -411,8 +439,19 @@ export class LocalSystemExecutionRuntime {
|
|
|
411
439
|
|
|
412
440
|
const state: GlobFilesState = { message, result };
|
|
413
441
|
|
|
442
|
+
let content = message;
|
|
443
|
+
if (result.success && result.files.length > 0) {
|
|
444
|
+
const fileList = result.files
|
|
445
|
+
.slice(0, 50)
|
|
446
|
+
.map((f) => ` ${f}`)
|
|
447
|
+
.join('\n');
|
|
448
|
+
const moreInfo =
|
|
449
|
+
result.files.length > 50 ? `\n ... and ${result.files.length - 50} more` : '';
|
|
450
|
+
content = `${message}:\n${fileList}${moreInfo}`;
|
|
451
|
+
}
|
|
452
|
+
|
|
414
453
|
return {
|
|
415
|
-
content
|
|
454
|
+
content,
|
|
416
455
|
state,
|
|
417
456
|
success: result.success,
|
|
418
457
|
};
|