@lobehub/lobehub 2.0.0-next.286 → 2.0.0-next.288

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/apps/desktop/src/main/const/theme.ts +0 -3
  3. package/apps/desktop/src/main/core/browser/Browser.ts +1 -1
  4. package/apps/desktop/src/main/core/browser/WindowThemeManager.ts +3 -2
  5. package/apps/desktop/src/main/core/browser/__tests__/Browser.test.ts +0 -1
  6. package/apps/desktop/src/main/core/browser/__tests__/WindowThemeManager.test.ts +8 -5
  7. package/changelog/v1.json +14 -0
  8. package/locales/en-US/plugin.json +3 -5
  9. package/locales/zh-CN/plugin.json +3 -5
  10. package/locales/zh-CN/tool.json +2 -0
  11. package/package.json +1 -1
  12. package/packages/builtin-agents/src/agents/group-supervisor/index.ts +12 -1
  13. package/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts +0 -7
  14. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/EditLocalFile/index.tsx +93 -0
  15. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/GlobLocalFiles/index.tsx +73 -0
  16. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/GrepContent/index.tsx +69 -0
  17. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ListLocalFiles/index.tsx +68 -0
  18. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ReadLocalFile/index.tsx +74 -0
  19. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/SearchLocalFiles/index.tsx +70 -0
  20. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/WriteLocalFile/index.tsx +57 -0
  21. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts +14 -0
  22. package/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx +54 -35
  23. package/packages/builtin-tool-cloud-sandbox/src/client/components/FilePathDisplay.tsx +52 -0
  24. package/packages/builtin-tool-group-management/src/client/Inspector/ExecuteTasks/index.tsx +90 -0
  25. package/packages/builtin-tool-group-management/src/client/Inspector/index.ts +2 -0
  26. package/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx +237 -0
  27. package/packages/builtin-tool-group-management/src/client/Intervention/index.ts +4 -1
  28. package/packages/builtin-tool-group-management/src/client/Render/index.ts +1 -1
  29. package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTask/index.tsx +69 -0
  30. package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTasks/index.tsx +87 -0
  31. package/packages/builtin-tool-group-management/src/client/Streaming/index.ts +4 -0
  32. package/packages/builtin-tool-group-management/src/executor.test.ts +8 -311
  33. package/packages/builtin-tool-group-management/src/executor.ts +5 -160
  34. package/packages/builtin-tool-group-management/src/manifest.ts +50 -94
  35. package/packages/builtin-tool-group-management/src/systemRole.ts +251 -172
  36. package/packages/builtin-tool-group-management/src/types.ts +29 -40
  37. package/packages/context-engine/src/engine/messages/MessagesEngine.ts +6 -4
  38. package/packages/context-engine/src/engine/messages/types.ts +4 -4
  39. package/packages/context-engine/src/processors/GroupRoleTransform.ts +261 -0
  40. package/packages/context-engine/src/processors/__tests__/GroupRoleTransform.test.ts +553 -0
  41. package/packages/context-engine/src/processors/index.ts +2 -2
  42. package/packages/context-engine/src/providers/__tests__/GroupContextInjector.test.ts +4 -16
  43. package/packages/context-engine/src/providers/__tests__/__snapshots__/GroupContextInjector.test.ts.snap +23 -28
  44. package/packages/desktop-bridge/src/index.ts +3 -0
  45. package/packages/prompts/src/prompts/agentGroup/__snapshots__/index.test.ts.snap +0 -7
  46. package/packages/prompts/src/prompts/agentGroup/groupContext.ts +0 -7
  47. package/src/app/[variants]/(main)/group/features/Conversation/AgentWelcome/OpeningQuestions.tsx +4 -8
  48. package/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx +0 -3
  49. package/src/app/[variants]/(main)/group/features/Conversation/useGroupContext.ts +3 -0
  50. package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +15 -2
  51. package/src/features/ChatInput/Desktop/index.tsx +1 -3
  52. package/src/features/Conversation/store/slices/message/action/crud.ts +2 -2
  53. package/src/features/ElectronTitlebar/Connection/ConnectionMode.tsx +2 -2
  54. package/src/features/ElectronTitlebar/SimpleTitleBar.tsx +1 -2
  55. package/src/features/ElectronTitlebar/index.tsx +2 -2
  56. package/src/hooks/useUserAvatar.test.ts +23 -4
  57. package/src/locales/default/plugin.ts +3 -5
  58. package/src/locales/default/tool.ts +3 -0
  59. package/src/services/chat/mecha/agentConfigResolver.test.ts +160 -0
  60. package/src/services/chat/mecha/agentConfigResolver.ts +15 -3
  61. package/src/services/chat/mecha/contextEngineering.ts +2 -1
  62. package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +4 -2
  63. package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -0
  64. package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +1 -18
  65. package/src/store/chat/slices/message/selectors/displayMessage.test.ts +24 -0
  66. package/src/store/chat/slices/message/selectors/displayMessage.ts +6 -1
  67. package/src/store/chat/slices/topic/action.test.ts +10 -4
  68. package/src/store/chat/slices/topic/action.ts +3 -2
  69. package/src/store/electron/selectors/sync.ts +17 -1
  70. package/packages/context-engine/src/processors/GroupMessageSender.ts +0 -138
  71. package/packages/context-engine/src/processors/__tests__/GroupMessageSender.test.ts +0 -274
  72. package/src/features/ElectronTitlebar/const.ts +0 -1
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+
3
+ import { type BuiltinInspectorProps } from '@lobechat/types';
4
+ import { createStaticStyles, cx } from 'antd-style';
5
+ import { memo, useMemo } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
+
8
+ import { inspectorTextStyles, shinyTextStyles } from '@/styles';
9
+
10
+ import { type ReadLocalFileState } from '../../../types';
11
+ import { FilePathDisplay } from '../../components/FilePathDisplay';
12
+
13
+ const styles = createStaticStyles(({ css }) => ({
14
+ lineRange: css`
15
+ flex-shrink: 0;
16
+ margin-inline-start: 4px;
17
+ opacity: 0.7;
18
+ `,
19
+ }));
20
+
21
+ interface ReadLocalFileParams {
22
+ end_line?: number;
23
+ path: string;
24
+ start_line?: number;
25
+ }
26
+
27
+ export const ReadLocalFileInspector = memo<
28
+ BuiltinInspectorProps<ReadLocalFileParams, ReadLocalFileState>
29
+ >(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
30
+ const { t } = useTranslation('plugin');
31
+
32
+ const filePath = args?.path || partialArgs?.path || '';
33
+ const startLine = args?.start_line || partialArgs?.start_line;
34
+ const endLine = args?.end_line || partialArgs?.end_line;
35
+
36
+ // Format line range display, e.g., "L1-L200"
37
+ const lineRangeText = useMemo(() => {
38
+ if (startLine === undefined && endLine === undefined) return null;
39
+ const start = startLine ?? 1;
40
+ const end = endLine;
41
+ if (end !== undefined) {
42
+ return `L${start}-L${end}`;
43
+ }
44
+ return `L${start}`;
45
+ }, [startLine, endLine]);
46
+
47
+ // During argument streaming
48
+ if (isArgumentsStreaming) {
49
+ if (!filePath)
50
+ return (
51
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
52
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.readLocalFile')}</span>
53
+ </div>
54
+ );
55
+
56
+ return (
57
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
58
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.readLocalFile')}: </span>
59
+ <FilePathDisplay filePath={filePath} />
60
+ {lineRangeText && <span className={styles.lineRange}>{lineRangeText}</span>}
61
+ </div>
62
+ );
63
+ }
64
+
65
+ return (
66
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
67
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.readLocalFile')}: </span>
68
+ <FilePathDisplay filePath={filePath} />
69
+ {lineRangeText && <span className={styles.lineRange}>{lineRangeText}</span>}
70
+ </div>
71
+ );
72
+ });
73
+
74
+ ReadLocalFileInspector.displayName = 'ReadLocalFileInspector';
@@ -0,0 +1,70 @@
1
+ 'use client';
2
+
3
+ import { type BuiltinInspectorProps } from '@lobechat/types';
4
+ import { Text } from '@lobehub/ui';
5
+ import { cssVar, cx } from 'antd-style';
6
+ import { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
10
+
11
+ import { type SearchLocalFilesState } from '../../../types';
12
+
13
+ interface SearchLocalFilesParams {
14
+ path?: string;
15
+ query: string;
16
+ }
17
+
18
+ export const SearchLocalFilesInspector = memo<
19
+ BuiltinInspectorProps<SearchLocalFilesParams, SearchLocalFilesState>
20
+ >(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
21
+ const { t } = useTranslation('plugin');
22
+
23
+ const query = args?.query || partialArgs?.query || '';
24
+
25
+ // During argument streaming
26
+ if (isArgumentsStreaming) {
27
+ if (!query)
28
+ return (
29
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
30
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.searchLocalFiles')}</span>
31
+ </div>
32
+ );
33
+
34
+ return (
35
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
36
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.searchLocalFiles')}: </span>
37
+ <span className={highlightTextStyles.primary}>{query}</span>
38
+ </div>
39
+ );
40
+ }
41
+
42
+ // Check if search returned results
43
+ const resultCount = pluginState?.results?.length ?? 0;
44
+ const hasResults = resultCount > 0;
45
+
46
+ return (
47
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
48
+ <span style={{ marginInlineStart: 2 }}>
49
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.searchLocalFiles')}: </span>
50
+ {query && <span className={highlightTextStyles.primary}>{query}</span>}
51
+ {!isLoading &&
52
+ pluginState?.results &&
53
+ (hasResults ? (
54
+ <span style={{ marginInlineStart: 4 }}>({resultCount})</span>
55
+ ) : (
56
+ <Text
57
+ as={'span'}
58
+ color={cssVar.colorTextDescription}
59
+ fontSize={12}
60
+ style={{ marginInlineStart: 4 }}
61
+ >
62
+ ({t('builtins.lobe-local-system.inspector.noResults')})
63
+ </Text>
64
+ ))}
65
+ </span>
66
+ </div>
67
+ );
68
+ });
69
+
70
+ SearchLocalFilesInspector.displayName = 'SearchLocalFilesInspector';
@@ -0,0 +1,57 @@
1
+ 'use client';
2
+
3
+ import { type BuiltinInspectorProps } from '@lobechat/types';
4
+ import { Icon, Text } from '@lobehub/ui';
5
+ import { cssVar, cx } from 'antd-style';
6
+ import { Plus } from 'lucide-react';
7
+ import { memo } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+
10
+ import { inspectorTextStyles, shinyTextStyles } from '@/styles';
11
+
12
+ import { type WriteLocalFileState } from '../../../types';
13
+ import { FilePathDisplay } from '../../components/FilePathDisplay';
14
+
15
+ interface WriteLocalFileParams {
16
+ content: string;
17
+ path: string;
18
+ }
19
+
20
+ export const WriteLocalFileInspector = memo<
21
+ BuiltinInspectorProps<WriteLocalFileParams, WriteLocalFileState>
22
+ >(({ args, partialArgs, isArgumentsStreaming }) => {
23
+ const { t } = useTranslation('plugin');
24
+
25
+ const filePath = args?.path || partialArgs?.path || '';
26
+ const content = args?.content || partialArgs?.content || '';
27
+
28
+ // Calculate lines from content
29
+ const lines = content ? content.split('\n').length : 0;
30
+
31
+ // During argument streaming without path
32
+ if (isArgumentsStreaming && !filePath) {
33
+ return (
34
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
35
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.writeLocalFile')}</span>
36
+ </div>
37
+ );
38
+ }
39
+
40
+ return (
41
+ <div
42
+ className={cx(inspectorTextStyles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}
43
+ >
44
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.writeLocalFile')}: </span>
45
+ <FilePathDisplay filePath={filePath} />
46
+ {lines > 0 && (
47
+ <Text as={'span'} code color={cssVar.colorSuccess} fontSize={12}>
48
+ {' '}
49
+ <Icon icon={Plus} size={12} />
50
+ {lines}
51
+ </Text>
52
+ )}
53
+ </div>
54
+ );
55
+ });
56
+
57
+ WriteLocalFileInspector.displayName = 'WriteLocalFileInspector';
@@ -1,11 +1,25 @@
1
1
  import { CloudSandboxApiName } from '../../types';
2
+ import { EditLocalFileInspector } from './EditLocalFile';
2
3
  import { ExecuteCodeInspector } from './ExecuteCode';
4
+ import { GlobLocalFilesInspector } from './GlobLocalFiles';
5
+ import { GrepContentInspector } from './GrepContent';
6
+ import { ListLocalFilesInspector } from './ListLocalFiles';
7
+ import { ReadLocalFileInspector } from './ReadLocalFile';
3
8
  import { RunCommandInspector } from './RunCommand';
9
+ import { SearchLocalFilesInspector } from './SearchLocalFiles';
10
+ import { WriteLocalFileInspector } from './WriteLocalFile';
4
11
 
5
12
  /**
6
13
  * Code Interpreter Inspector Components Registry
7
14
  */
8
15
  export const CloudSandboxInspectors = {
16
+ [CloudSandboxApiName.editLocalFile]: EditLocalFileInspector,
9
17
  [CloudSandboxApiName.executeCode]: ExecuteCodeInspector,
18
+ [CloudSandboxApiName.globLocalFiles]: GlobLocalFilesInspector,
19
+ [CloudSandboxApiName.grepContent]: GrepContentInspector,
20
+ [CloudSandboxApiName.listLocalFiles]: ListLocalFilesInspector,
21
+ [CloudSandboxApiName.readLocalFile]: ReadLocalFileInspector,
10
22
  [CloudSandboxApiName.runCommand]: RunCommandInspector,
23
+ [CloudSandboxApiName.searchLocalFiles]: SearchLocalFilesInspector,
24
+ [CloudSandboxApiName.writeLocalFile]: WriteLocalFileInspector,
11
25
  };
@@ -1,54 +1,73 @@
1
1
  'use client';
2
2
 
3
- import { CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons';
4
3
  import { type BuiltinRenderProps } from '@lobechat/types';
5
- import { Flexbox, Text } from '@lobehub/ui';
6
- import { createStaticStyles, cssVar } from 'antd-style';
4
+ import { Block, Highlighter } from '@lobehub/ui';
7
5
  import { memo } from 'react';
8
6
 
9
7
  import { type WriteLocalFileState } from '../../../types';
10
8
 
11
- const styles = createStaticStyles(({ css }) => ({
12
- container: css`
13
- overflow: hidden;
14
- padding-inline: 8px 0;
15
- `,
16
- statusIcon: css`
17
- font-size: 12px;
18
- `,
19
- }));
20
-
21
9
  interface WriteLocalFileParams {
22
10
  content: string;
23
11
  createDirectories?: boolean;
24
12
  path: string;
25
13
  }
26
14
 
15
+ /**
16
+ * Get file extension from path
17
+ */
18
+ const getFileExtension = (path: string): string => {
19
+ const parts = path.split('.');
20
+ return parts.length > 1 ? parts.pop()?.toLowerCase() || 'text' : 'text';
21
+ };
22
+
23
+ /**
24
+ * Map file extension to Highlighter language
25
+ */
26
+ const getLanguageFromExtension = (ext: string): string => {
27
+ const languageMap: Record<string, string> = {
28
+ css: 'css',
29
+ go: 'go',
30
+ html: 'html',
31
+ java: 'java',
32
+ js: 'javascript',
33
+ json: 'json',
34
+ jsx: 'jsx',
35
+ md: 'markdown',
36
+ py: 'python',
37
+ rs: 'rust',
38
+ scss: 'scss',
39
+ sh: 'bash',
40
+ sql: 'sql',
41
+ ts: 'typescript',
42
+ tsx: 'tsx',
43
+ xml: 'xml',
44
+ yaml: 'yaml',
45
+ yml: 'yaml',
46
+ };
47
+ return languageMap[ext] || 'text';
48
+ };
49
+
27
50
  const WriteFile = memo<BuiltinRenderProps<WriteLocalFileParams, WriteLocalFileState>>(
28
- ({ args, pluginState }) => {
29
- const isSuccess = pluginState?.success;
51
+ ({ args }) => {
52
+ if (!args?.content) {
53
+ return null;
54
+ }
55
+
56
+ const ext = getFileExtension(args.path);
57
+ const language = getLanguageFromExtension(ext);
30
58
 
31
59
  return (
32
- <Flexbox className={styles.container} gap={8}>
33
- <Flexbox align={'center'} gap={8} horizontal>
34
- {pluginState === undefined ? null : isSuccess ? (
35
- <CheckCircleFilled
36
- className={styles.statusIcon}
37
- style={{ color: cssVar.colorSuccess }}
38
- />
39
- ) : (
40
- <CloseCircleFilled className={styles.statusIcon} style={{ color: cssVar.colorError }} />
41
- )}
42
- <Text as={'span'} code fontSize={12}>
43
- {isSuccess ? `✅ Written to ${args.path}` : `❌ Failed to write ${args.path}`}
44
- </Text>
45
- {pluginState?.bytesWritten !== undefined && (
46
- <Text as={'span'} code fontSize={12} type={'secondary'}>
47
- ({pluginState.bytesWritten} bytes)
48
- </Text>
49
- )}
50
- </Flexbox>
51
- </Flexbox>
60
+ <Block padding={8} variant={'outlined'}>
61
+ <Highlighter
62
+ language={language}
63
+ showLanguage
64
+ style={{ maxHeight: 400, overflow: 'auto' }}
65
+ variant={'borderless'}
66
+ wrap
67
+ >
68
+ {args.content}
69
+ </Highlighter>
70
+ </Block>
52
71
  );
53
72
  },
54
73
  );
@@ -0,0 +1,52 @@
1
+ 'use client';
2
+
3
+ import { MaterialFileTypeIcon } from '@lobehub/ui';
4
+ import { createStaticStyles, cssVar } from 'antd-style';
5
+ import path from 'path-browserify-esm';
6
+ import { memo, useMemo } from 'react';
7
+
8
+ const styles = createStaticStyles(({ css }) => ({
9
+ icon: css`
10
+ flex-shrink: 0;
11
+ margin-inline-end: 4px;
12
+ `,
13
+ text: css`
14
+ color: ${cssVar.colorText};
15
+ `,
16
+ }));
17
+
18
+ interface FilePathDisplayProps {
19
+ filePath: string;
20
+ isDirectory?: boolean;
21
+ }
22
+
23
+ export const FilePathDisplay = memo<FilePathDisplayProps>(({ filePath, isDirectory }) => {
24
+ const { displayPath, name } = useMemo(() => {
25
+ if (!filePath) return { displayPath: '', name: '' };
26
+ const { base, dir } = path.parse(filePath);
27
+ const parentDir = path.basename(dir);
28
+ return {
29
+ displayPath: parentDir ? `${parentDir}/${base}` : base,
30
+ name: base,
31
+ };
32
+ }, [filePath]);
33
+
34
+ if (!filePath) return null;
35
+
36
+ return (
37
+ <>
38
+ {name && (
39
+ <MaterialFileTypeIcon
40
+ className={styles.icon}
41
+ filename={name}
42
+ size={16}
43
+ type={isDirectory ? 'folder' : 'file'}
44
+ variant={'raw'}
45
+ />
46
+ )}
47
+ {displayPath && <span className={styles.text}>{displayPath}</span>}
48
+ </>
49
+ );
50
+ });
51
+
52
+ FilePathDisplay.displayName = 'FilePathDisplay';
@@ -0,0 +1,90 @@
1
+ 'use client';
2
+
3
+ import { DEFAULT_AVATAR } from '@lobechat/const';
4
+ import type { AgentGroupMember, BuiltinInspectorProps } from '@lobechat/types';
5
+ import { Avatar, Flexbox } from '@lobehub/ui';
6
+ import { createStaticStyles, cx, useTheme } from 'antd-style';
7
+ import { memo, useMemo } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+
10
+ import { useAgentGroupStore } from '@/store/agentGroup';
11
+ import { agentGroupSelectors } from '@/store/agentGroup/selectors';
12
+ import { shinyTextStyles } from '@/styles';
13
+
14
+ import type { ExecuteTasksParams } from '../../../types';
15
+
16
+ const styles = createStaticStyles(({ css, cssVar }) => ({
17
+ root: css`
18
+ overflow: hidden;
19
+ display: flex;
20
+ gap: 8px;
21
+ align-items: center;
22
+ `,
23
+ title: css`
24
+ flex-shrink: 0;
25
+ color: ${cssVar.colorTextSecondary};
26
+ white-space: nowrap;
27
+ `,
28
+ }));
29
+
30
+ export const ExecuteTasksInspector = memo<BuiltinInspectorProps<ExecuteTasksParams>>(
31
+ ({ args, partialArgs, isArgumentsStreaming }) => {
32
+ const { t } = useTranslation('plugin');
33
+
34
+ const tasks = args?.tasks || partialArgs?.tasks || [];
35
+ const agentIds = useMemo(() => tasks.map((task) => task.agentId).filter(Boolean), [tasks]);
36
+
37
+ // Get active group ID and agents from store
38
+ const activeGroupId = useAgentGroupStore(agentGroupSelectors.activeGroupId);
39
+ const groupAgents = useAgentGroupStore((s) =>
40
+ activeGroupId ? agentGroupSelectors.getGroupAgents(activeGroupId)(s) : [],
41
+ );
42
+ const theme = useTheme();
43
+
44
+ // Get agent details for the task targets
45
+ const agents = useMemo(() => {
46
+ if (!agentIds.length || !groupAgents.length) return [];
47
+ return agentIds
48
+ .map((id) => groupAgents.find((agent) => agent.id === id))
49
+ .filter((agent): agent is AgentGroupMember => !!agent);
50
+ }, [agentIds, groupAgents]);
51
+
52
+ // Transform agents to Avatar.Group format
53
+ const avatarItems = useMemo(
54
+ () =>
55
+ agents.map((agent) => ({
56
+ avatar: agent.avatar || DEFAULT_AVATAR,
57
+ background: agent.backgroundColor || theme.colorBgContainer,
58
+ key: agent.id,
59
+ title: agent.title || undefined,
60
+ })),
61
+ [agents, theme.colorBgContainer],
62
+ );
63
+
64
+ if (isArgumentsStreaming && agents.length === 0) {
65
+ return (
66
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
67
+ <span>{t('builtins.lobe-group-management.apiName.executeAgentTasks')}</span>
68
+ </div>
69
+ );
70
+ }
71
+
72
+ return (
73
+ <Flexbox
74
+ align={'center'}
75
+ className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}
76
+ gap={8}
77
+ horizontal
78
+ >
79
+ <span className={styles.title}>
80
+ {t('builtins.lobe-group-management.inspector.executeAgentTasks.title')}
81
+ </span>
82
+ {avatarItems.length > 0 && <Avatar.Group items={avatarItems} shape={'circle'} size={24} />}
83
+ </Flexbox>
84
+ );
85
+ },
86
+ );
87
+
88
+ ExecuteTasksInspector.displayName = 'ExecuteTasksInspector';
89
+
90
+ export default ExecuteTasksInspector;
@@ -2,6 +2,7 @@ import { type BuiltinInspector } from '@lobechat/types';
2
2
 
3
3
  import { GroupManagementApiName } from '../../types';
4
4
  import { BroadcastInspector } from './Broadcast';
5
+ import { ExecuteTasksInspector } from './ExecuteTasks';
5
6
  import { SpeakInspector } from './Speak';
6
7
 
7
8
  /**
@@ -12,5 +13,6 @@ import { SpeakInspector } from './Speak';
12
13
  */
13
14
  export const GroupManagementInspectors: Record<string, BuiltinInspector> = {
14
15
  [GroupManagementApiName.broadcast]: BroadcastInspector as BuiltinInspector,
16
+ [GroupManagementApiName.executeAgentTasks]: ExecuteTasksInspector as BuiltinInspector,
15
17
  [GroupManagementApiName.speak]: SpeakInspector as BuiltinInspector,
16
18
  };