@lobehub/lobehub 2.0.0-next.306 → 2.0.0-next.308
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 +61 -0
- package/changelog/v1.json +21 -0
- package/locales/ar/agentGroup.json +5 -0
- package/locales/ar/chat.json +26 -0
- package/locales/ar/models.json +43 -5
- package/locales/ar/plugin.json +4 -5
- package/locales/ar/setting.json +11 -0
- package/locales/ar/subscription.json +2 -0
- package/locales/ar/tool.json +2 -0
- package/locales/bg-BG/agentGroup.json +5 -0
- package/locales/bg-BG/chat.json +26 -0
- package/locales/bg-BG/models.json +49 -3
- package/locales/bg-BG/plugin.json +4 -5
- package/locales/bg-BG/setting.json +11 -0
- package/locales/bg-BG/subscription.json +2 -0
- package/locales/bg-BG/tool.json +2 -0
- package/locales/de-DE/agentGroup.json +5 -0
- package/locales/de-DE/chat.json +26 -0
- package/locales/de-DE/models.json +48 -5
- package/locales/de-DE/plugin.json +4 -5
- package/locales/de-DE/setting.json +11 -0
- package/locales/de-DE/subscription.json +2 -0
- package/locales/de-DE/tool.json +2 -0
- package/locales/en-US/models.json +8 -6
- package/locales/en-US/plugin.json +2 -4
- package/locales/en-US/setting.json +10 -11
- package/locales/en-US/tool.json +2 -0
- package/locales/es-ES/agentGroup.json +5 -0
- package/locales/es-ES/chat.json +26 -0
- package/locales/es-ES/models.json +43 -5
- package/locales/es-ES/plugin.json +4 -5
- package/locales/es-ES/setting.json +11 -0
- package/locales/es-ES/subscription.json +2 -0
- package/locales/es-ES/tool.json +2 -0
- package/locales/fa-IR/agentGroup.json +5 -0
- package/locales/fa-IR/chat.json +26 -0
- package/locales/fa-IR/models.json +42 -5
- package/locales/fa-IR/plugin.json +4 -5
- package/locales/fa-IR/setting.json +11 -0
- package/locales/fa-IR/subscription.json +2 -0
- package/locales/fa-IR/tool.json +2 -0
- package/locales/fr-FR/agentGroup.json +5 -0
- package/locales/fr-FR/chat.json +26 -0
- package/locales/fr-FR/models.json +5 -5
- package/locales/fr-FR/plugin.json +4 -5
- package/locales/fr-FR/setting.json +11 -0
- package/locales/fr-FR/subscription.json +2 -0
- package/locales/fr-FR/tool.json +2 -0
- package/locales/it-IT/agentGroup.json +5 -0
- package/locales/it-IT/chat.json +26 -0
- package/locales/it-IT/models.json +1 -3
- package/locales/it-IT/plugin.json +4 -5
- package/locales/it-IT/setting.json +11 -0
- package/locales/it-IT/subscription.json +2 -0
- package/locales/it-IT/tool.json +2 -0
- package/locales/ja-JP/agentGroup.json +5 -0
- package/locales/ja-JP/chat.json +26 -0
- package/locales/ja-JP/models.json +1 -5
- package/locales/ja-JP/plugin.json +4 -5
- package/locales/ja-JP/setting.json +11 -0
- package/locales/ja-JP/subscription.json +2 -0
- package/locales/ja-JP/tool.json +2 -0
- package/locales/ko-KR/agentGroup.json +5 -0
- package/locales/ko-KR/chat.json +26 -0
- package/locales/ko-KR/models.json +1 -3
- package/locales/ko-KR/plugin.json +4 -5
- package/locales/ko-KR/setting.json +11 -0
- package/locales/ko-KR/subscription.json +2 -0
- package/locales/ko-KR/tool.json +2 -0
- package/locales/nl-NL/agentGroup.json +5 -0
- package/locales/nl-NL/chat.json +26 -0
- package/locales/nl-NL/models.json +35 -3
- package/locales/nl-NL/plugin.json +4 -5
- package/locales/nl-NL/setting.json +11 -0
- package/locales/nl-NL/subscription.json +2 -0
- package/locales/nl-NL/tool.json +2 -0
- package/locales/pl-PL/agentGroup.json +5 -0
- package/locales/pl-PL/chat.json +26 -0
- package/locales/pl-PL/models.json +1 -3
- package/locales/pl-PL/plugin.json +4 -5
- package/locales/pl-PL/setting.json +11 -0
- package/locales/pl-PL/subscription.json +2 -0
- package/locales/pl-PL/tool.json +2 -0
- package/locales/pt-BR/agentGroup.json +5 -0
- package/locales/pt-BR/chat.json +26 -0
- package/locales/pt-BR/models.json +50 -5
- package/locales/pt-BR/plugin.json +4 -5
- package/locales/pt-BR/setting.json +11 -0
- package/locales/pt-BR/subscription.json +2 -0
- package/locales/pt-BR/tool.json +2 -0
- package/locales/ru-RU/agentGroup.json +5 -0
- package/locales/ru-RU/chat.json +26 -0
- package/locales/ru-RU/models.json +22 -3
- package/locales/ru-RU/plugin.json +4 -5
- package/locales/ru-RU/setting.json +11 -0
- package/locales/ru-RU/subscription.json +2 -0
- package/locales/ru-RU/tool.json +2 -0
- package/locales/tr-TR/agentGroup.json +5 -0
- package/locales/tr-TR/chat.json +26 -0
- package/locales/tr-TR/models.json +36 -3
- package/locales/tr-TR/plugin.json +4 -5
- package/locales/tr-TR/setting.json +11 -0
- package/locales/tr-TR/subscription.json +2 -0
- package/locales/tr-TR/tool.json +2 -0
- package/locales/vi-VN/agentGroup.json +5 -0
- package/locales/vi-VN/chat.json +26 -0
- package/locales/vi-VN/models.json +1 -1
- package/locales/vi-VN/plugin.json +4 -5
- package/locales/vi-VN/setting.json +11 -0
- package/locales/vi-VN/subscription.json +2 -0
- package/locales/vi-VN/tool.json +2 -0
- package/locales/zh-CN/models.json +52 -5
- package/locales/zh-CN/plugin.json +5 -7
- package/locales/zh-CN/setting.json +10 -11
- package/locales/zh-CN/tool.json +2 -2
- package/locales/zh-TW/agentGroup.json +5 -0
- package/locales/zh-TW/chat.json +26 -0
- package/locales/zh-TW/models.json +54 -5
- package/locales/zh-TW/plugin.json +4 -5
- package/locales/zh-TW/setting.json +11 -0
- package/locales/zh-TW/subscription.json +2 -0
- package/locales/zh-TW/tool.json +2 -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/client/Inspector/ExecuteAgentTask/index.tsx +52 -8
- package/packages/builtin-tool-group-management/src/client/Render/ExecuteTask/index.tsx +2 -21
- package/packages/builtin-tool-group-management/src/executor.test.ts +6 -16
- package/packages/builtin-tool-group-management/src/executor.ts +8 -47
- package/packages/builtin-tool-group-management/src/manifest.ts +5 -18
- package/packages/builtin-tool-group-management/src/systemRole.ts +1 -8
- package/packages/builtin-tool-group-management/src/types.ts +2 -10
- package/packages/builtin-tool-local-system/src/ExecutionRuntime/index.ts +70 -31
- package/packages/builtin-tool-local-system/src/client/Render/WriteFile/index.tsx +48 -5
- package/packages/builtin-tool-local-system/src/client/Streaming/WriteFile/index.tsx +39 -0
- package/packages/builtin-tool-local-system/src/client/Streaming/index.ts +2 -0
- package/packages/builtin-tool-local-system/src/executor/index.ts +94 -60
- package/packages/database/src/repositories/agentGroup/index.ts +23 -0
- package/packages/model-bank/src/aiModels/qiniu.ts +24 -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]/(auth)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(auth)/layout.tsx +0 -2
- package/src/app/[variants]/(auth)/login/[[...login]]/page.tsx +1 -3
- package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +1 -3
- package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/_layout/index.tsx +0 -2
- 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)/agent/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/agent/features/Portal/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx +69 -17
- package/src/app/[variants]/(main)/community/(list)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(list)/assistant/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(list)/mcp/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(list)/model/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/_layout/index.tsx +0 -2
- 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/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/group/features/Conversation/Header/index.tsx +4 -2
- package/src/app/[variants]/(main)/group/features/Portal/index.tsx +0 -2
- package/src/app/[variants]/(main)/home/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/home/index.tsx +0 -2
- package/src/app/[variants]/(main)/image/_layout/Topics/TopicUrlSync.tsx +0 -2
- package/src/app/[variants]/(main)/image/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/memory/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/page/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/(home)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/library/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/library/features/Container.tsx +0 -2
- package/src/app/[variants]/(main)/settings/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/about/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/agent/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/apikey/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/chat-appearance/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/common/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/hotkey/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/image/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/memory/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/provider/(list)/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/proxy/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/security/index.tsx +1 -3
- package/src/app/[variants]/(main)/settings/storage/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/tts/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/(home)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -3
- package/src/app/[variants]/(mobile)/chat/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/chat/settings/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/community/(detail)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/community/(list)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/community/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/router/MobileClientRouter.tsx +0 -2
- package/src/app/[variants]/(mobile)/settings/index.tsx +0 -2
- package/src/app/[variants]/onboarding/_layout/index.tsx +0 -2
- package/src/app/[variants]/router/DesktopClientRouter.tsx +0 -2
- package/src/components/ModelSelect/index.tsx +6 -56
- package/src/components/server/MobileNavLayout.tsx +0 -2
- package/src/components/server/ServerLayout.tsx +0 -2
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +13 -3
- package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +26 -3
- package/src/features/ModelSwitchPanel/components/Footer.tsx +0 -2
- package/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx +0 -1
- package/src/features/ModelSwitchPanel/components/List/SingleProviderModelItem.tsx +0 -1
- package/src/features/ModelSwitchPanel/components/List/VirtualItemRenderer.tsx +0 -1
- package/src/features/ModelSwitchPanel/components/List/index.tsx +15 -13
- package/src/features/ModelSwitchPanel/components/PanelContent.tsx +0 -2
- package/src/features/ModelSwitchPanel/index.tsx +21 -23
- package/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx +0 -2
- package/src/features/ResourceManager/components/Header/AddButton.tsx +20 -3
- package/src/features/User/UserAvatar.tsx +0 -2
- package/src/locales/default/plugin.ts +2 -1
- 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/agents/GroupOrchestration/__tests__/call-supervisor.test.ts +305 -0
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +2 -1
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +6 -2
- package/src/store/chat/slices/plugin/actions/exector.ts +92 -0
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +82 -177
package/packages/builtin-tool-group-management/src/client/Inspector/ExecuteAgentTask/index.tsx
CHANGED
|
@@ -32,6 +32,7 @@ export const ExecuteAgentTaskInspector = memo<BuiltinInspectorProps<ExecuteTaskP
|
|
|
32
32
|
const { t } = useTranslation('plugin');
|
|
33
33
|
|
|
34
34
|
const agentId = args?.agentId || partialArgs?.agentId;
|
|
35
|
+
const taskTitle = args?.title || partialArgs?.title;
|
|
35
36
|
|
|
36
37
|
// Get active group ID and agent from store
|
|
37
38
|
const activeGroupId = useAgentGroupStore(agentGroupSelectors.activeGroupId);
|
|
@@ -42,12 +43,47 @@ export const ExecuteAgentTaskInspector = memo<BuiltinInspectorProps<ExecuteTaskP
|
|
|
42
43
|
);
|
|
43
44
|
const theme = useTheme();
|
|
44
45
|
|
|
45
|
-
if (isArgumentsStreaming
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (isArgumentsStreaming) {
|
|
47
|
+
if (!agent && !taskTitle)
|
|
48
|
+
return (
|
|
49
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
50
|
+
<span>{t('builtins.lobe-group-management.apiName.executeAgentTask')}</span>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
if (agent) {
|
|
54
|
+
return (
|
|
55
|
+
<Flexbox
|
|
56
|
+
align={'center'}
|
|
57
|
+
className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}
|
|
58
|
+
gap={8}
|
|
59
|
+
horizontal
|
|
60
|
+
>
|
|
61
|
+
<span className={styles.title}>
|
|
62
|
+
{t('builtins.lobe-group-management.inspector.executeAgentTask.assignTo')}
|
|
63
|
+
</span>
|
|
64
|
+
{agent && (
|
|
65
|
+
<>
|
|
66
|
+
<Avatar
|
|
67
|
+
avatar={agent.avatar || DEFAULT_AVATAR}
|
|
68
|
+
background={agent.backgroundColor || theme.colorBgContainer}
|
|
69
|
+
shape={'square'}
|
|
70
|
+
size={24}
|
|
71
|
+
title={agent.title || undefined}
|
|
72
|
+
/>
|
|
73
|
+
<span>{agent?.title}</span>
|
|
74
|
+
</>
|
|
75
|
+
)}
|
|
76
|
+
{taskTitle && (
|
|
77
|
+
<>
|
|
78
|
+
<span className={styles.title}>
|
|
79
|
+
{t('builtins.lobe-group-management.inspector.executeAgentTask.task')}
|
|
80
|
+
</span>
|
|
81
|
+
<span className={highlightTextStyles.primary}>{taskTitle}</span>
|
|
82
|
+
</>
|
|
83
|
+
)}
|
|
84
|
+
</Flexbox>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
51
87
|
}
|
|
52
88
|
|
|
53
89
|
const agentName = agent?.title || agentId;
|
|
@@ -60,7 +96,7 @@ export const ExecuteAgentTaskInspector = memo<BuiltinInspectorProps<ExecuteTaskP
|
|
|
60
96
|
horizontal
|
|
61
97
|
>
|
|
62
98
|
<span className={styles.title}>
|
|
63
|
-
{t('builtins.lobe-group-management.inspector.executeAgentTask.
|
|
99
|
+
{t('builtins.lobe-group-management.inspector.executeAgentTask.assignTo')}
|
|
64
100
|
</span>
|
|
65
101
|
{agent && (
|
|
66
102
|
<Avatar
|
|
@@ -71,7 +107,15 @@ export const ExecuteAgentTaskInspector = memo<BuiltinInspectorProps<ExecuteTaskP
|
|
|
71
107
|
title={agent.title || undefined}
|
|
72
108
|
/>
|
|
73
109
|
)}
|
|
74
|
-
{agentName && <span
|
|
110
|
+
{agentName && <span>{agentName}</span>}
|
|
111
|
+
{taskTitle && (
|
|
112
|
+
<>
|
|
113
|
+
<span className={styles.title}>
|
|
114
|
+
{t('builtins.lobe-group-management.inspector.executeAgentTask.task')}
|
|
115
|
+
</span>
|
|
116
|
+
<span className={highlightTextStyles.primary}>{taskTitle}</span>
|
|
117
|
+
</>
|
|
118
|
+
)}
|
|
75
119
|
</Flexbox>
|
|
76
120
|
);
|
|
77
121
|
},
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { BuiltinRenderProps } from '@lobechat/types';
|
|
4
|
-
import {
|
|
4
|
+
import { Flexbox, Text } from '@lobehub/ui';
|
|
5
5
|
import { createStaticStyles } from 'antd-style';
|
|
6
6
|
import { Clock } from 'lucide-react';
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
9
|
|
|
10
|
-
import { useAgentGroupStore } from '@/store/agentGroup';
|
|
11
|
-
import { agentGroupSelectors } from '@/store/agentGroup/selectors';
|
|
12
|
-
|
|
13
10
|
import type { ExecuteTaskParams, ExecuteTaskState } from '../../../types';
|
|
14
11
|
|
|
15
12
|
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
@@ -40,14 +37,6 @@ const ExecuteTaskRender = memo<BuiltinRenderProps<ExecuteTaskParams, ExecuteTask
|
|
|
40
37
|
({ args }) => {
|
|
41
38
|
const { t } = useTranslation('tool');
|
|
42
39
|
|
|
43
|
-
// Get agent info from store
|
|
44
|
-
const activeGroupId = useAgentGroupStore(agentGroupSelectors.activeGroupId);
|
|
45
|
-
const agent = useAgentGroupStore((s) =>
|
|
46
|
-
args?.agentId && activeGroupId
|
|
47
|
-
? agentGroupSelectors.getAgentByIdFromGroup(activeGroupId, args.agentId)(s)
|
|
48
|
-
: undefined,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
40
|
const timeoutMinutes = args?.timeout ? Math.round(args.timeout / 60_000) : 30;
|
|
52
41
|
|
|
53
42
|
return (
|
|
@@ -55,15 +44,7 @@ const ExecuteTaskRender = memo<BuiltinRenderProps<ExecuteTaskParams, ExecuteTask
|
|
|
55
44
|
{/* Header: Agent info + Timeout */}
|
|
56
45
|
<Flexbox align={'center'} gap={12} horizontal justify={'space-between'}>
|
|
57
46
|
<Flexbox align={'center'} flex={1} gap={12} horizontal style={{ minWidth: 0 }}>
|
|
58
|
-
<
|
|
59
|
-
avatar={agent?.avatar || '🤖'}
|
|
60
|
-
background={agent?.backgroundColor || undefined}
|
|
61
|
-
size={24}
|
|
62
|
-
style={{ borderRadius: 8, flexShrink: 0 }}
|
|
63
|
-
/>
|
|
64
|
-
<span className={styles.agentTitle}>
|
|
65
|
-
{agent?.title || t('agentGroupManagement.executeTask.intervention.unknownAgent')}
|
|
66
|
-
</span>
|
|
47
|
+
<span className={styles.agentTitle}>{args?.title}</span>
|
|
67
48
|
</Flexbox>
|
|
68
49
|
<Flexbox align="center" className={styles.timeout} gap={4} horizontal>
|
|
69
50
|
<Clock size={14} />
|
|
@@ -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();
|
|
@@ -292,7 +280,7 @@ describe('GroupManagementExecutor', () => {
|
|
|
292
280
|
const ctx = createMockContext();
|
|
293
281
|
|
|
294
282
|
const result = await groupManagementExecutor.executeAgentTask(
|
|
295
|
-
{ agentId: 'agent-1', task: 'Do something' },
|
|
283
|
+
{ agentId: 'agent-1', task: 'Do something', title: 'Test Task' },
|
|
296
284
|
ctx,
|
|
297
285
|
);
|
|
298
286
|
|
|
@@ -303,6 +291,7 @@ describe('GroupManagementExecutor', () => {
|
|
|
303
291
|
agentId: 'agent-1',
|
|
304
292
|
task: 'Do something',
|
|
305
293
|
timeout: undefined,
|
|
294
|
+
title: 'Test Task',
|
|
306
295
|
type: 'executeAgentTask',
|
|
307
296
|
});
|
|
308
297
|
});
|
|
@@ -326,7 +315,7 @@ describe('GroupManagementExecutor', () => {
|
|
|
326
315
|
);
|
|
327
316
|
|
|
328
317
|
await groupManagementExecutor.executeAgentTask(
|
|
329
|
-
{ agentId: 'agent-1', task: 'Do something', timeout: 30000 },
|
|
318
|
+
{ agentId: 'agent-1', task: 'Do something', timeout: 30000, title: 'Test Task' },
|
|
330
319
|
ctx,
|
|
331
320
|
);
|
|
332
321
|
|
|
@@ -351,7 +340,7 @@ describe('GroupManagementExecutor', () => {
|
|
|
351
340
|
const ctx = createMockContext();
|
|
352
341
|
|
|
353
342
|
const result = await groupManagementExecutor.executeAgentTask(
|
|
354
|
-
{ agentId: 'agent-1', task: 'Do something' },
|
|
343
|
+
{ agentId: 'agent-1', task: 'Do something', title: 'Test Task' },
|
|
355
344
|
ctx,
|
|
356
345
|
);
|
|
357
346
|
|
|
@@ -363,7 +352,7 @@ describe('GroupManagementExecutor', () => {
|
|
|
363
352
|
const ctx = createMockContext();
|
|
364
353
|
|
|
365
354
|
const result = await groupManagementExecutor.executeAgentTask(
|
|
366
|
-
{ agentId: 'agent-1', task: 'Do something', timeout: 60000 },
|
|
355
|
+
{ agentId: 'agent-1', task: 'Do something', timeout: 60000, title: 'Test Task' },
|
|
367
356
|
ctx,
|
|
368
357
|
);
|
|
369
358
|
|
|
@@ -372,6 +361,7 @@ describe('GroupManagementExecutor', () => {
|
|
|
372
361
|
agentId: 'agent-1',
|
|
373
362
|
task: 'Do something',
|
|
374
363
|
timeout: 60000,
|
|
364
|
+
title: 'Test Task',
|
|
375
365
|
type: 'executeAgentTask',
|
|
376
366
|
});
|
|
377
367
|
});
|
|
@@ -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:
|
|
@@ -112,6 +95,10 @@ export const GroupManagementManifest: BuiltinToolManifest = {
|
|
|
112
95
|
description: 'The ID of the agent to execute the task.',
|
|
113
96
|
type: 'string',
|
|
114
97
|
},
|
|
98
|
+
title: {
|
|
99
|
+
description: 'Brief title describing what this task does (shown in UI).',
|
|
100
|
+
type: 'string',
|
|
101
|
+
},
|
|
115
102
|
task: {
|
|
116
103
|
description:
|
|
117
104
|
'Clear description of the task to perform. Be specific about expected deliverables.',
|
|
@@ -130,7 +117,7 @@ export const GroupManagementManifest: BuiltinToolManifest = {
|
|
|
130
117
|
type: 'boolean',
|
|
131
118
|
},
|
|
132
119
|
},
|
|
133
|
-
required: ['agentId', 'task'],
|
|
120
|
+
required: ['agentId', 'title', 'task'],
|
|
134
121
|
type: 'object',
|
|
135
122
|
},
|
|
136
123
|
},
|
|
@@ -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 {
|
|
@@ -90,6 +80,8 @@ export interface ExecuteTaskParams {
|
|
|
90
80
|
skipCallSupervisor?: boolean;
|
|
91
81
|
task: string;
|
|
92
82
|
timeout?: number;
|
|
83
|
+
/** Brief title describing what this task does (shown in UI) */
|
|
84
|
+
title: string;
|
|
93
85
|
}
|
|
94
86
|
|
|
95
87
|
export interface TaskItem {
|
|
@@ -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
|
};
|