@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
|
@@ -1,22 +1,65 @@
|
|
|
1
1
|
import { type WriteLocalFileParams } from '@lobechat/electron-client-ipc';
|
|
2
2
|
import { type BuiltinRenderProps } from '@lobechat/types';
|
|
3
|
-
import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
|
|
3
|
+
import { Flexbox, Highlighter, Icon, Markdown, Skeleton } from '@lobehub/ui';
|
|
4
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
5
|
import { ChevronRight } from 'lucide-react';
|
|
5
6
|
import path from 'path-browserify-esm';
|
|
6
7
|
import { memo } from 'react';
|
|
7
8
|
|
|
8
9
|
import { LocalFile, LocalFolder } from '@/features/LocalFile';
|
|
9
10
|
|
|
11
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
12
|
+
container: css`
|
|
13
|
+
padding: 8px;
|
|
14
|
+
border-radius: ${cssVar.borderRadiusLG};
|
|
15
|
+
background: ${cssVar.colorFillQuaternary};
|
|
16
|
+
`,
|
|
17
|
+
previewBox: css`
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
border-radius: 8px;
|
|
20
|
+
background: ${cssVar.colorBgContainer};
|
|
21
|
+
`,
|
|
22
|
+
}));
|
|
23
|
+
|
|
10
24
|
const WriteFile = memo<BuiltinRenderProps<WriteLocalFileParams>>(({ args }) => {
|
|
11
25
|
if (!args) return <Skeleton active />;
|
|
12
26
|
|
|
13
27
|
const { base, dir } = path.parse(args.path);
|
|
28
|
+
const ext = path.extname(args.path).slice(1).toLowerCase();
|
|
29
|
+
|
|
30
|
+
const renderContent = () => {
|
|
31
|
+
if (!args.content) return null;
|
|
32
|
+
|
|
33
|
+
if (ext === 'md' || ext === 'mdx') {
|
|
34
|
+
return (
|
|
35
|
+
<Markdown style={{ maxHeight: 240, overflow: 'auto', padding: '0 8px' }}>
|
|
36
|
+
{args.content}
|
|
37
|
+
</Markdown>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Highlighter
|
|
43
|
+
language={ext || 'text'}
|
|
44
|
+
showLanguage={false}
|
|
45
|
+
style={{ maxHeight: 240, overflow: 'auto' }}
|
|
46
|
+
variant={'borderless'}
|
|
47
|
+
wrap
|
|
48
|
+
>
|
|
49
|
+
{args.content}
|
|
50
|
+
</Highlighter>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
14
53
|
|
|
15
54
|
return (
|
|
16
|
-
<Flexbox
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
55
|
+
<Flexbox className={styles.container} gap={12}>
|
|
56
|
+
<Flexbox align={'center'} horizontal>
|
|
57
|
+
<LocalFolder path={dir} />
|
|
58
|
+
<Icon icon={ChevronRight} />
|
|
59
|
+
<LocalFile name={base} path={args.path} />
|
|
60
|
+
</Flexbox>
|
|
61
|
+
|
|
62
|
+
{args.content && <Flexbox className={styles.previewBox}>{renderContent()}</Flexbox>}
|
|
20
63
|
</Flexbox>
|
|
21
64
|
);
|
|
22
65
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type WriteLocalFileParams } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinStreamingProps } from '@lobechat/types';
|
|
5
|
+
import { Highlighter, Markdown } from '@lobehub/ui';
|
|
6
|
+
import path from 'path-browserify-esm';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
|
|
9
|
+
export const WriteFileStreaming = memo<BuiltinStreamingProps<WriteLocalFileParams>>(({ args }) => {
|
|
10
|
+
const { content, path: filePath } = args || {};
|
|
11
|
+
|
|
12
|
+
// Don't render if no content yet
|
|
13
|
+
if (!content) return null;
|
|
14
|
+
|
|
15
|
+
const ext = path
|
|
16
|
+
.extname(filePath || '')
|
|
17
|
+
.slice(1)
|
|
18
|
+
.toLowerCase();
|
|
19
|
+
|
|
20
|
+
// Use Markdown for .md files, Highlighter for others
|
|
21
|
+
if (ext === 'md' || ext === 'mdx') {
|
|
22
|
+
return <Markdown style={{ overflow: 'auto' }}>{content}</Markdown>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Highlighter
|
|
27
|
+
animated
|
|
28
|
+
language={ext || 'text'}
|
|
29
|
+
showLanguage={false}
|
|
30
|
+
style={{ padding: '4px 8px' }}
|
|
31
|
+
variant={'outlined'}
|
|
32
|
+
wrap
|
|
33
|
+
>
|
|
34
|
+
{content}
|
|
35
|
+
</Highlighter>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
WriteFileStreaming.displayName = 'WriteFileStreaming';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { LocalSystemApiName } from '../..';
|
|
2
2
|
import { RunCommandStreaming } from './RunCommand';
|
|
3
|
+
import { WriteFileStreaming } from './WriteFile';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Local System Streaming Components Registry
|
|
6
7
|
*/
|
|
7
8
|
export const LocalSystemStreamings = {
|
|
8
9
|
[LocalSystemApiName.runCommand]: RunCommandStreaming,
|
|
10
|
+
[LocalSystemApiName.writeLocalFile]: WriteFileStreaming,
|
|
9
11
|
};
|
|
@@ -23,6 +23,21 @@ import type {
|
|
|
23
23
|
RunCommandResult,
|
|
24
24
|
WriteLocalFileParams,
|
|
25
25
|
} from '@lobechat/electron-client-ipc';
|
|
26
|
+
import {
|
|
27
|
+
formatCommandOutput,
|
|
28
|
+
formatCommandResult,
|
|
29
|
+
formatEditResult,
|
|
30
|
+
formatFileContent,
|
|
31
|
+
formatFileList,
|
|
32
|
+
formatFileSearchResults,
|
|
33
|
+
formatGlobResults,
|
|
34
|
+
formatGrepResults,
|
|
35
|
+
formatKillResult,
|
|
36
|
+
formatMoveResults,
|
|
37
|
+
formatMultipleFiles,
|
|
38
|
+
formatRenameResult,
|
|
39
|
+
formatWriteResult,
|
|
40
|
+
} from '@lobechat/prompts';
|
|
26
41
|
import { BaseExecutor, type BuiltinToolResult } from '@lobechat/types';
|
|
27
42
|
|
|
28
43
|
import { localFileService } from '@/services/electron/localFileService';
|
|
@@ -76,8 +91,10 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
76
91
|
|
|
77
92
|
const state: LocalFileListState = { listResults: result };
|
|
78
93
|
|
|
94
|
+
const content = formatFileList(result, params.path);
|
|
95
|
+
|
|
79
96
|
return {
|
|
80
|
-
content
|
|
97
|
+
content,
|
|
81
98
|
state,
|
|
82
99
|
success: true,
|
|
83
100
|
};
|
|
@@ -96,8 +113,14 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
96
113
|
|
|
97
114
|
const state: LocalReadFileState = { fileContent: result };
|
|
98
115
|
|
|
116
|
+
const content = formatFileContent({
|
|
117
|
+
content: result.content,
|
|
118
|
+
lineRange: params.loc,
|
|
119
|
+
path: params.path,
|
|
120
|
+
});
|
|
121
|
+
|
|
99
122
|
return {
|
|
100
|
-
content
|
|
123
|
+
content,
|
|
101
124
|
state,
|
|
102
125
|
success: true,
|
|
103
126
|
};
|
|
@@ -116,8 +139,10 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
116
139
|
|
|
117
140
|
const state: LocalReadFilesState = { filesContent: results };
|
|
118
141
|
|
|
142
|
+
const content = formatMultipleFiles(results);
|
|
143
|
+
|
|
119
144
|
return {
|
|
120
|
-
content
|
|
145
|
+
content,
|
|
121
146
|
state,
|
|
122
147
|
success: true,
|
|
123
148
|
};
|
|
@@ -136,8 +161,10 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
136
161
|
|
|
137
162
|
const state: LocalFileSearchState = { searchResults: result };
|
|
138
163
|
|
|
164
|
+
const content = formatFileSearchResults(result);
|
|
165
|
+
|
|
139
166
|
return {
|
|
140
|
-
content
|
|
167
|
+
content,
|
|
141
168
|
state,
|
|
142
169
|
success: true,
|
|
143
170
|
};
|
|
@@ -154,20 +181,9 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
154
181
|
try {
|
|
155
182
|
const results: LocalMoveFilesResultItem[] = await localFileService.moveLocalFiles(params);
|
|
156
183
|
|
|
157
|
-
const allSucceeded = results.every((r) => r.success);
|
|
158
|
-
const someFailed = results.some((r) => !r.success);
|
|
159
184
|
const successCount = results.filter((r) => r.success).length;
|
|
160
|
-
const failedCount = results.length - successCount;
|
|
161
185
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (allSucceeded) {
|
|
165
|
-
message = `Successfully moved ${results.length} item(s).`;
|
|
166
|
-
} else if (someFailed) {
|
|
167
|
-
message = `Moved ${successCount} item(s) successfully. Failed to move ${failedCount} item(s).`;
|
|
168
|
-
} else {
|
|
169
|
-
message = `Failed to move all ${results.length} item(s).`;
|
|
170
|
-
}
|
|
186
|
+
const content = formatMoveResults(results);
|
|
171
187
|
|
|
172
188
|
const state: LocalMoveFilesState = {
|
|
173
189
|
results,
|
|
@@ -176,7 +192,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
176
192
|
};
|
|
177
193
|
|
|
178
194
|
return {
|
|
179
|
-
content
|
|
195
|
+
content,
|
|
180
196
|
state,
|
|
181
197
|
success: true,
|
|
182
198
|
};
|
|
@@ -202,7 +218,12 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
202
218
|
};
|
|
203
219
|
|
|
204
220
|
return {
|
|
205
|
-
content:
|
|
221
|
+
content: formatRenameResult({
|
|
222
|
+
error: result.error,
|
|
223
|
+
newName: params.newName,
|
|
224
|
+
oldPath: params.path,
|
|
225
|
+
success: false,
|
|
226
|
+
}),
|
|
206
227
|
state,
|
|
207
228
|
success: false,
|
|
208
229
|
};
|
|
@@ -215,8 +236,9 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
215
236
|
};
|
|
216
237
|
|
|
217
238
|
return {
|
|
218
|
-
content:
|
|
219
|
-
|
|
239
|
+
content: formatRenameResult({
|
|
240
|
+
newName: params.newName,
|
|
241
|
+
oldPath: params.path,
|
|
220
242
|
success: true,
|
|
221
243
|
}),
|
|
222
244
|
state,
|
|
@@ -237,8 +259,9 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
237
259
|
|
|
238
260
|
if (!result.success) {
|
|
239
261
|
return {
|
|
240
|
-
content:
|
|
241
|
-
|
|
262
|
+
content: formatWriteResult({
|
|
263
|
+
error: result.error,
|
|
264
|
+
path: params.path,
|
|
242
265
|
success: false,
|
|
243
266
|
}),
|
|
244
267
|
error: { message: result.error || 'Failed to write file', type: 'PluginServerError' },
|
|
@@ -247,8 +270,8 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
247
270
|
}
|
|
248
271
|
|
|
249
272
|
return {
|
|
250
|
-
content:
|
|
251
|
-
|
|
273
|
+
content: formatWriteResult({
|
|
274
|
+
path: params.path,
|
|
252
275
|
success: true,
|
|
253
276
|
}),
|
|
254
277
|
success: true,
|
|
@@ -273,11 +296,12 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
273
296
|
};
|
|
274
297
|
}
|
|
275
298
|
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
299
|
+
const content = formatEditResult({
|
|
300
|
+
filePath: params.file_path,
|
|
301
|
+
linesAdded: result.linesAdded,
|
|
302
|
+
linesDeleted: result.linesDeleted,
|
|
303
|
+
replacements: result.replacements,
|
|
304
|
+
});
|
|
281
305
|
|
|
282
306
|
const state: EditLocalFileState = {
|
|
283
307
|
diffText: result.diffText,
|
|
@@ -287,7 +311,7 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
287
311
|
};
|
|
288
312
|
|
|
289
313
|
return {
|
|
290
|
-
content
|
|
314
|
+
content,
|
|
291
315
|
state,
|
|
292
316
|
success: true,
|
|
293
317
|
};
|
|
@@ -306,22 +330,19 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
306
330
|
try {
|
|
307
331
|
const result: RunCommandResult = await localFileService.runCommand(params);
|
|
308
332
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
} else {
|
|
318
|
-
message = `Command failed: ${result.error}`;
|
|
319
|
-
}
|
|
333
|
+
const content = formatCommandResult({
|
|
334
|
+
error: result.error,
|
|
335
|
+
exitCode: result.exit_code,
|
|
336
|
+
shellId: result.shell_id,
|
|
337
|
+
stderr: result.stderr,
|
|
338
|
+
stdout: result.stdout,
|
|
339
|
+
success: result.success,
|
|
340
|
+
});
|
|
320
341
|
|
|
321
|
-
const state: RunCommandState = { message, result };
|
|
342
|
+
const state: RunCommandState = { message: content.split('\n\n')[0], result };
|
|
322
343
|
|
|
323
344
|
return {
|
|
324
|
-
content
|
|
345
|
+
content,
|
|
325
346
|
state,
|
|
326
347
|
success: result.success,
|
|
327
348
|
};
|
|
@@ -338,14 +359,17 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
338
359
|
try {
|
|
339
360
|
const result: GetCommandOutputResult = await localFileService.getCommandOutput(params);
|
|
340
361
|
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
:
|
|
362
|
+
const content = formatCommandOutput({
|
|
363
|
+
error: result.error,
|
|
364
|
+
output: result.output,
|
|
365
|
+
running: result.running,
|
|
366
|
+
success: result.success,
|
|
367
|
+
});
|
|
344
368
|
|
|
345
|
-
const state: GetCommandOutputState = { message, result };
|
|
369
|
+
const state: GetCommandOutputState = { message: content.split('\n\n')[0], result };
|
|
346
370
|
|
|
347
371
|
return {
|
|
348
|
-
content
|
|
372
|
+
content,
|
|
349
373
|
state,
|
|
350
374
|
success: result.success,
|
|
351
375
|
};
|
|
@@ -362,14 +386,16 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
362
386
|
try {
|
|
363
387
|
const result: KillCommandResult = await localFileService.killCommand(params);
|
|
364
388
|
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
:
|
|
389
|
+
const content = formatKillResult({
|
|
390
|
+
error: result.error,
|
|
391
|
+
shellId: params.shell_id,
|
|
392
|
+
success: result.success,
|
|
393
|
+
});
|
|
368
394
|
|
|
369
|
-
const state: KillCommandState = { message, result };
|
|
395
|
+
const state: KillCommandState = { message: content, result };
|
|
370
396
|
|
|
371
397
|
return {
|
|
372
|
-
content
|
|
398
|
+
content,
|
|
373
399
|
state,
|
|
374
400
|
success: result.success,
|
|
375
401
|
};
|
|
@@ -388,14 +414,17 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
388
414
|
try {
|
|
389
415
|
const result: GrepContentResult = await localFileService.grepContent(params);
|
|
390
416
|
|
|
391
|
-
const
|
|
392
|
-
?
|
|
417
|
+
const content = result.success
|
|
418
|
+
? formatGrepResults({
|
|
419
|
+
matches: result.matches,
|
|
420
|
+
totalMatches: result.total_matches,
|
|
421
|
+
})
|
|
393
422
|
: 'Search failed';
|
|
394
423
|
|
|
395
|
-
const state: GrepContentState = { message, result };
|
|
424
|
+
const state: GrepContentState = { message: content.split('\n')[0], result };
|
|
396
425
|
|
|
397
426
|
return {
|
|
398
|
-
content
|
|
427
|
+
content,
|
|
399
428
|
state,
|
|
400
429
|
success: result.success,
|
|
401
430
|
};
|
|
@@ -412,12 +441,17 @@ class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
|
|
|
412
441
|
try {
|
|
413
442
|
const result: GlobFilesResult = await localFileService.globFiles(params);
|
|
414
443
|
|
|
415
|
-
const
|
|
444
|
+
const content = result.success
|
|
445
|
+
? formatGlobResults({
|
|
446
|
+
files: result.files,
|
|
447
|
+
totalFiles: result.total_files,
|
|
448
|
+
})
|
|
449
|
+
: 'Glob search failed';
|
|
416
450
|
|
|
417
|
-
const state: GlobFilesState = { message, result };
|
|
451
|
+
const state: GlobFilesState = { message: content.split('\n')[0], result };
|
|
418
452
|
|
|
419
453
|
return {
|
|
420
|
-
content
|
|
454
|
+
content,
|
|
421
455
|
state,
|
|
422
456
|
success: result.success,
|
|
423
457
|
};
|
|
@@ -15,8 +15,14 @@ import {
|
|
|
15
15
|
import { LobeChatDatabase } from '../../type';
|
|
16
16
|
|
|
17
17
|
export interface SupervisorAgentConfig {
|
|
18
|
+
avatar?: string;
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
description?: string;
|
|
18
21
|
model?: string;
|
|
22
|
+
params?: any;
|
|
19
23
|
provider?: string;
|
|
24
|
+
systemRole?: string;
|
|
25
|
+
tags?: string[];
|
|
20
26
|
title?: string;
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -164,8 +170,14 @@ export class AgentGroupRepository {
|
|
|
164
170
|
const [supervisorAgent] = await this.db
|
|
165
171
|
.insert(agents)
|
|
166
172
|
.values({
|
|
173
|
+
avatar: supervisorConfig?.avatar,
|
|
174
|
+
backgroundColor: supervisorConfig?.backgroundColor,
|
|
175
|
+
description: supervisorConfig?.description,
|
|
167
176
|
model: supervisorConfig?.model,
|
|
177
|
+
params: supervisorConfig?.params,
|
|
168
178
|
provider: supervisorConfig?.provider,
|
|
179
|
+
systemRole: supervisorConfig?.systemRole,
|
|
180
|
+
tags: supervisorConfig?.tags,
|
|
169
181
|
title: supervisorConfig?.title ?? 'Supervisor',
|
|
170
182
|
userId: this.userId,
|
|
171
183
|
virtual: true,
|
|
@@ -356,7 +368,12 @@ export class AgentGroupRepository {
|
|
|
356
368
|
const [newGroup] = await trx
|
|
357
369
|
.insert(chatGroups)
|
|
358
370
|
.values({
|
|
371
|
+
avatar: sourceGroup.avatar,
|
|
372
|
+
backgroundColor: sourceGroup.backgroundColor,
|
|
359
373
|
config: sourceGroup.config,
|
|
374
|
+
content: sourceGroup.content,
|
|
375
|
+
description: sourceGroup.description,
|
|
376
|
+
editorData: sourceGroup.editorData,
|
|
360
377
|
pinned: sourceGroup.pinned,
|
|
361
378
|
title: newTitle || (sourceGroup.title ? `${sourceGroup.title} (Copy)` : 'Copy'),
|
|
362
379
|
userId: this.userId,
|
|
@@ -368,8 +385,14 @@ export class AgentGroupRepository {
|
|
|
368
385
|
const [newSupervisor] = await trx
|
|
369
386
|
.insert(agents)
|
|
370
387
|
.values({
|
|
388
|
+
avatar: supervisorAgent?.avatar,
|
|
389
|
+
backgroundColor: supervisorAgent?.backgroundColor,
|
|
390
|
+
description: supervisorAgent?.description,
|
|
371
391
|
model: supervisorAgent?.model,
|
|
392
|
+
params: supervisorAgent?.params,
|
|
372
393
|
provider: supervisorAgent?.provider,
|
|
394
|
+
systemRole: supervisorAgent?.systemRole,
|
|
395
|
+
tags: supervisorAgent?.tags,
|
|
373
396
|
title: supervisorAgent?.title || 'Supervisor',
|
|
374
397
|
userId: this.userId,
|
|
375
398
|
virtual: true,
|
|
@@ -78,6 +78,30 @@ const qiniuChatModels: AIChatModelCard[] = [
|
|
|
78
78
|
},
|
|
79
79
|
type: 'chat',
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
abilities: {
|
|
83
|
+
reasoning: true,
|
|
84
|
+
},
|
|
85
|
+
contextWindowTokens: 163_840,
|
|
86
|
+
description:
|
|
87
|
+
'DeepSeek Math V2 is a model that has made significant breakthroughs in mathematical reasoning capabilities. Its core innovation lies in the "self-verification" training mechanism, and it has achieved gold medal levels in several top mathematics competitions.',
|
|
88
|
+
displayName: 'DeepSeek Math V2',
|
|
89
|
+
enabled: true,
|
|
90
|
+
id: 'deepseek/deepseek-math-v2',
|
|
91
|
+
maxOutput: 131_072,
|
|
92
|
+
pricing: {
|
|
93
|
+
currency: 'CNY',
|
|
94
|
+
units: [
|
|
95
|
+
{ name: 'textInput', rate: 4.0, strategy: 'fixed', unit: 'millionTokens' },
|
|
96
|
+
{ name: 'textOutput', rate: 16.0, strategy: 'fixed', unit: 'millionTokens' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
releasedAt: '2025-11-27',
|
|
100
|
+
settings: {
|
|
101
|
+
searchImpl: 'params',
|
|
102
|
+
},
|
|
103
|
+
type: 'chat',
|
|
104
|
+
},
|
|
81
105
|
{
|
|
82
106
|
abilities: {
|
|
83
107
|
functionCall: true,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { formatCommandOutput } from './formatCommandOutput';
|
|
4
|
+
|
|
5
|
+
describe('formatCommandOutput', () => {
|
|
6
|
+
it('should format successful output while running', () => {
|
|
7
|
+
const result = formatCommandOutput({
|
|
8
|
+
running: true,
|
|
9
|
+
success: true,
|
|
10
|
+
});
|
|
11
|
+
expect(result).toMatchInlineSnapshot(`"Output retrieved. Running: true"`);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should format successful output when not running', () => {
|
|
15
|
+
const result = formatCommandOutput({
|
|
16
|
+
running: false,
|
|
17
|
+
success: true,
|
|
18
|
+
});
|
|
19
|
+
expect(result).toMatchInlineSnapshot(`"Output retrieved. Running: false"`);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should format successful output with content', () => {
|
|
23
|
+
const result = formatCommandOutput({
|
|
24
|
+
output: 'Process output here',
|
|
25
|
+
running: true,
|
|
26
|
+
success: true,
|
|
27
|
+
});
|
|
28
|
+
expect(result).toMatchInlineSnapshot(`
|
|
29
|
+
"Output retrieved. Running: true
|
|
30
|
+
|
|
31
|
+
Output:
|
|
32
|
+
Process output here"
|
|
33
|
+
`);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should format failed output', () => {
|
|
37
|
+
const result = formatCommandOutput({
|
|
38
|
+
error: 'Process not found',
|
|
39
|
+
running: false,
|
|
40
|
+
success: false,
|
|
41
|
+
});
|
|
42
|
+
expect(result).toMatchInlineSnapshot(`"Failed: Process not found"`);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should format successful output with error info', () => {
|
|
46
|
+
const result = formatCommandOutput({
|
|
47
|
+
error: 'Warning message',
|
|
48
|
+
output: 'Some output',
|
|
49
|
+
running: false,
|
|
50
|
+
success: true,
|
|
51
|
+
});
|
|
52
|
+
expect(result).toMatchInlineSnapshot(`
|
|
53
|
+
"Output retrieved. Running: false
|
|
54
|
+
|
|
55
|
+
Output:
|
|
56
|
+
Some output
|
|
57
|
+
|
|
58
|
+
Error: Warning message"
|
|
59
|
+
`);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface FormatCommandOutputParams {
|
|
2
|
+
error?: string;
|
|
3
|
+
output?: string;
|
|
4
|
+
running: boolean;
|
|
5
|
+
success: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const formatCommandOutput = ({
|
|
9
|
+
success,
|
|
10
|
+
running,
|
|
11
|
+
output,
|
|
12
|
+
error,
|
|
13
|
+
}: FormatCommandOutputParams): string => {
|
|
14
|
+
const message = success ? `Output retrieved. Running: ${running}` : `Failed: ${error}`;
|
|
15
|
+
|
|
16
|
+
const parts: string[] = [message];
|
|
17
|
+
if (output) parts.push(`Output:\n${output}`);
|
|
18
|
+
if (error && success) parts.push(`Error: ${error}`);
|
|
19
|
+
|
|
20
|
+
return parts.join('\n\n');
|
|
21
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { formatCommandResult } from './formatCommandResult';
|
|
4
|
+
|
|
5
|
+
describe('formatCommandResult', () => {
|
|
6
|
+
it('should format successful command without output', () => {
|
|
7
|
+
const result = formatCommandResult({ success: true });
|
|
8
|
+
expect(result).toMatchInlineSnapshot(`"Command completed successfully."`);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should format successful background command', () => {
|
|
12
|
+
const result = formatCommandResult({
|
|
13
|
+
shellId: 'shell-123',
|
|
14
|
+
success: true,
|
|
15
|
+
});
|
|
16
|
+
expect(result).toMatchInlineSnapshot(
|
|
17
|
+
`"Command started in background with shell_id: shell-123"`,
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should format successful command with stdout', () => {
|
|
22
|
+
const result = formatCommandResult({
|
|
23
|
+
stdout: 'Hello World',
|
|
24
|
+
success: true,
|
|
25
|
+
});
|
|
26
|
+
expect(result).toMatchInlineSnapshot(`
|
|
27
|
+
"Command completed successfully.
|
|
28
|
+
|
|
29
|
+
Output:
|
|
30
|
+
Hello World"
|
|
31
|
+
`);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should format successful command with stderr', () => {
|
|
35
|
+
const result = formatCommandResult({
|
|
36
|
+
stderr: 'Warning: deprecated',
|
|
37
|
+
success: true,
|
|
38
|
+
});
|
|
39
|
+
expect(result).toMatchInlineSnapshot(`
|
|
40
|
+
"Command completed successfully.
|
|
41
|
+
|
|
42
|
+
Stderr:
|
|
43
|
+
Warning: deprecated"
|
|
44
|
+
`);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should format successful command with exit code', () => {
|
|
48
|
+
const result = formatCommandResult({
|
|
49
|
+
exitCode: 0,
|
|
50
|
+
success: true,
|
|
51
|
+
});
|
|
52
|
+
expect(result).toMatchInlineSnapshot(`
|
|
53
|
+
"Command completed successfully.
|
|
54
|
+
|
|
55
|
+
Exit code: 0"
|
|
56
|
+
`);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should format failed command', () => {
|
|
60
|
+
const result = formatCommandResult({
|
|
61
|
+
error: 'Permission denied',
|
|
62
|
+
success: false,
|
|
63
|
+
});
|
|
64
|
+
expect(result).toMatchInlineSnapshot(`"Command failed: Permission denied"`);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should format command with all fields', () => {
|
|
68
|
+
const result = formatCommandResult({
|
|
69
|
+
error: 'Command error',
|
|
70
|
+
exitCode: 1,
|
|
71
|
+
stderr: 'Error occurred',
|
|
72
|
+
stdout: 'Some output',
|
|
73
|
+
success: false,
|
|
74
|
+
});
|
|
75
|
+
expect(result).toMatchInlineSnapshot(`
|
|
76
|
+
"Command failed: Command error
|
|
77
|
+
|
|
78
|
+
Output:
|
|
79
|
+
Some output
|
|
80
|
+
|
|
81
|
+
Stderr:
|
|
82
|
+
Error occurred
|
|
83
|
+
|
|
84
|
+
Exit code: 1"
|
|
85
|
+
`);
|
|
86
|
+
});
|
|
87
|
+
});
|