@lobehub/lobehub 2.0.0-next.273 → 2.0.0-next.275
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/CHANGELOG.md +59 -0
- package/changelog/v1.json +18 -0
- package/locales/ar/chat.json +7 -0
- package/locales/ar/models.json +2 -3
- package/locales/ar/plugin.json +22 -1
- package/locales/bg-BG/chat.json +7 -0
- package/locales/bg-BG/models.json +3 -3
- package/locales/bg-BG/plugin.json +22 -1
- package/locales/de-DE/chat.json +7 -0
- package/locales/de-DE/models.json +3 -4
- package/locales/de-DE/plugin.json +22 -1
- package/locales/en-US/chat.json +7 -0
- package/locales/en-US/models.json +5 -5
- package/locales/en-US/plugin.json +22 -1
- package/locales/es-ES/chat.json +7 -0
- package/locales/es-ES/models.json +3 -4
- package/locales/es-ES/plugin.json +22 -1
- package/locales/fa-IR/chat.json +7 -0
- package/locales/fa-IR/models.json +3 -4
- package/locales/fa-IR/plugin.json +22 -1
- package/locales/fr-FR/chat.json +7 -0
- package/locales/fr-FR/models.json +50 -3
- package/locales/fr-FR/plugin.json +22 -1
- package/locales/it-IT/chat.json +7 -0
- package/locales/it-IT/models.json +3 -3
- package/locales/it-IT/plugin.json +22 -1
- package/locales/ja-JP/chat.json +7 -0
- package/locales/ja-JP/models.json +43 -4
- package/locales/ja-JP/plugin.json +22 -1
- package/locales/ko-KR/chat.json +7 -0
- package/locales/ko-KR/models.json +3 -4
- package/locales/ko-KR/plugin.json +22 -1
- package/locales/nl-NL/chat.json +7 -0
- package/locales/nl-NL/models.json +51 -3
- package/locales/nl-NL/plugin.json +22 -1
- package/locales/pl-PL/chat.json +7 -0
- package/locales/pl-PL/models.json +3 -3
- package/locales/pl-PL/plugin.json +22 -1
- package/locales/pt-BR/chat.json +7 -0
- package/locales/pt-BR/models.json +3 -4
- package/locales/pt-BR/plugin.json +22 -1
- package/locales/ru-RU/chat.json +7 -0
- package/locales/ru-RU/models.json +3 -4
- package/locales/ru-RU/plugin.json +22 -1
- package/locales/tr-TR/chat.json +7 -0
- package/locales/tr-TR/models.json +3 -4
- package/locales/tr-TR/plugin.json +22 -1
- package/locales/vi-VN/chat.json +7 -0
- package/locales/vi-VN/models.json +3 -3
- package/locales/vi-VN/plugin.json +22 -1
- package/locales/zh-CN/chat.json +7 -0
- package/locales/zh-CN/models.json +54 -4
- package/locales/zh-CN/plugin.json +22 -1
- package/locales/zh-TW/chat.json +7 -0
- package/locales/zh-TW/models.json +43 -4
- package/locales/zh-TW/plugin.json +22 -1
- package/package.json +2 -2
- package/packages/builtin-tool-agent-builder/package.json +1 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/GetAvailableModels/index.tsx +66 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/InstallPlugin/index.tsx +63 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/SearchMarketTools/index.tsx +64 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdateConfig/index.tsx +94 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdatePrompt/index.tsx +96 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/index.ts +29 -0
- package/packages/builtin-tool-agent-builder/src/client/index.ts +13 -0
- package/packages/builtin-tool-agent-builder/src/executor.ts +132 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx +5 -14
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx +5 -13
- package/packages/builtin-tool-group-agent-builder/package.json +7 -1
- package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +331 -87
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +110 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/CreateAgent/index.tsx +72 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/InviteAgent/index.tsx +57 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/RemoveAgent/index.tsx +57 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/SearchAgent/index.tsx +66 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateAgentPrompt/index.tsx +120 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +87 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroupPrompt/index.tsx +99 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/index.ts +52 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +103 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateAgentPrompt/index.tsx +36 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateGroupPrompt/index.tsx +36 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/index.ts +16 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/BatchCreateAgents/index.tsx +88 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateAgentPrompt/index.tsx +37 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateGroupPrompt/index.tsx +35 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/index.ts +22 -0
- package/packages/builtin-tool-group-agent-builder/src/client/index.ts +26 -0
- package/packages/builtin-tool-group-agent-builder/src/executor.ts +284 -0
- package/packages/builtin-tool-group-agent-builder/src/index.ts +1 -14
- package/packages/builtin-tool-group-agent-builder/src/manifest.ts +160 -15
- package/packages/builtin-tool-group-agent-builder/src/systemRole.ts +232 -46
- package/packages/builtin-tool-group-agent-builder/src/types.ts +191 -41
- package/packages/builtin-tool-group-management/src/client/Inspector/Broadcast/index.tsx +2 -2
- package/packages/builtin-tool-group-management/src/manifest.ts +1 -1
- package/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx +5 -11
- package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx +6 -15
- package/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx +6 -17
- package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx +3 -9
- package/packages/builtin-tool-knowledge-base/src/client/Inspector/ReadKnowledge/index.tsx +4 -16
- package/packages/builtin-tool-knowledge-base/src/client/Inspector/SearchKnowledgeBase/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +4 -12
- package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +5 -13
- package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/ListLocalFiles/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/RenameLocalFile/index.tsx +5 -11
- package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +5 -13
- package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/WriteLocalFile/index.tsx +6 -15
- package/packages/builtin-tool-notebook/src/client/Inspector/CreateDocument/index.tsx +7 -15
- package/packages/builtin-tool-page-agent/src/client/Inspector/EditTitle/index.tsx +5 -14
- package/packages/builtin-tool-page-agent/src/client/Inspector/GetPageContent/index.tsx +7 -8
- package/packages/builtin-tool-page-agent/src/client/Inspector/InitPage/index.tsx +4 -10
- package/packages/builtin-tool-page-agent/src/client/Inspector/ModifyNodes/index.tsx +3 -9
- package/packages/builtin-tool-page-agent/src/client/Inspector/ReplaceText/index.tsx +5 -11
- package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlMultiPages/index.tsx +6 -15
- package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlSinglePage/index.tsx +6 -15
- package/packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx +4 -15
- package/packages/database/src/models/chatGroup.ts +1 -1
- package/packages/model-bank/src/aiModels/aihubmix.ts +2 -1
- package/packages/model-bank/src/aiModels/google.ts +2 -1
- package/packages/model-bank/src/aiModels/infiniai.ts +9 -6
- package/packages/model-bank/src/aiModels/minimax.ts +9 -5
- package/packages/model-bank/src/aiModels/ollamacloud.ts +4 -2
- package/packages/model-bank/src/aiModels/vertexai.ts +2 -1
- package/packages/types/src/agentGroup/index.ts +8 -0
- package/patches/@upstash__qstash.patch +13 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +4 -3
- package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/profile/features/store/action.ts +18 -21
- package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +8 -6
- package/src/app/[variants]/(main)/group/_layout/GroupIdSync.tsx +6 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +29 -21
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMember.tsx +1 -0
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMemberItem.tsx +35 -18
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/AddTopicButon.tsx +2 -10
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +10 -2
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/index.tsx +1 -2
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +1 -0
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +15 -9
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +12 -6
- package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor/AgentHeader.tsx → GroupProfile/GroupHeader.tsx} +22 -29
- package/src/app/[variants]/(main)/group/profile/features/GroupProfile/index.tsx +96 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/AgentBuilderToggle.tsx +3 -4
- package/src/app/[variants]/(main)/group/profile/features/Header/AutoSaveHint.tsx +11 -7
- package/src/app/[variants]/(main)/group/profile/features/Header/ChromeTabs/index.tsx +147 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +104 -13
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/AgentHeader.tsx +222 -0
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/index.tsx +155 -0
- package/src/app/[variants]/(main)/group/profile/features/ProfileHydration.tsx +63 -5
- package/src/app/[variants]/(main)/group/profile/index.tsx +34 -37
- package/src/app/[variants]/(main)/settings/proxy/features/ProxyForm.tsx +156 -253
- package/src/app/[variants]/(main)/settings/proxy/index.tsx +1 -3
- package/src/app/[variants]/(mobile)/(home)/_layout/SessionHydration.tsx +1 -1
- package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx +1 -1
- package/src/features/AgentBuilder/index.tsx +16 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx +3 -2
- package/src/features/Conversation/Messages/User/useMarkdown.tsx +1 -0
- package/src/features/EditorCanvas/EditorCanvas.test.tsx +206 -0
- package/src/features/EditorCanvas/EditorDataMode.tsx +53 -19
- package/src/features/EditorModal/index.tsx +2 -2
- package/src/features/NavPanel/components/SessionHydration.tsx +1 -1
- package/src/features/PageEditor/EditorCanvas/useAskCopilotItem.tsx +10 -6
- package/src/features/PageEditor/Header/index.tsx +12 -10
- package/src/features/PageEditor/Header/useMenu.tsx +45 -48
- package/src/features/RightPanel/ToggleRightPanelButton.tsx +3 -1
- package/src/features/ShareModal/ShareImage/ChatList/index.tsx +1 -1
- package/src/features/ShareModal/SharePdf/index.tsx +1 -1
- package/src/hooks/useBidirectionalQuerySync.ts +112 -0
- package/src/locales/default/chat.ts +10 -0
- package/src/locales/default/plugin.ts +22 -1
- package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +45 -45
- package/src/server/modules/KeyVaultsEncrypt/index.ts +6 -6
- package/src/server/modules/S3/index.ts +1 -1
- package/src/server/routers/lambda/agent.ts +24 -0
- package/src/server/routers/lambda/agentGroup.ts +39 -0
- package/src/services/agent.ts +22 -0
- package/src/services/chatGroup/index.ts +14 -0
- package/src/store/agent/selectors/selectors.ts +3 -0
- package/src/store/agentGroup/initialState.ts +6 -0
- package/src/store/agentGroup/selectors/byId.ts +3 -1
- package/src/store/agentGroup/selectors/current.ts +2 -2
- package/src/store/agentGroup/slices/lifecycle.ts +18 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockStore.ts +1 -1
- package/src/store/chat/slices/aiAgent/actions/__tests__/agentGroup.test.ts +4 -1
- package/src/store/chat/slices/aiAgent/actions/agentGroup.ts +1 -1
- package/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts +65 -0
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -1
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +1 -1
- package/src/store/chat/slices/builtinTool/actions/index.ts +1 -6
- package/src/store/chat/slices/message/action.test.ts +5 -5
- package/src/store/chat/slices/message/actions/publicApi.ts +5 -5
- package/src/store/chat/slices/message/initialState.ts +0 -5
- package/src/store/chat/slices/message/selectors/displayMessage.test.ts +4 -4
- package/src/store/chat/slices/plugin/action.test.ts +54 -19
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +15 -21
- package/src/store/chat/slices/topic/action.test.ts +74 -24
- package/src/store/chat/slices/topic/action.ts +21 -13
- package/src/store/chat/slices/topic/selectors.test.ts +1 -1
- package/src/store/global/initialState.ts +10 -0
- package/src/store/global/selectors/systemStatus.ts +5 -0
- package/src/store/groupProfile/action.ts +168 -0
- package/src/store/groupProfile/index.ts +16 -0
- package/src/{app/[variants]/(main)/group/profile/features/store → store/groupProfile}/initialState.ts +17 -0
- package/src/store/groupProfile/selectors.ts +13 -0
- package/src/store/tool/slices/builtin/executors/index.ts +4 -0
- package/src/styles/text.ts +16 -0
- package/src/tools/inspectors.ts +13 -0
- package/src/tools/renders.ts +3 -0
- package/src/tools/streamings.ts +8 -0
- package/tests/mocks/lru_map.ts +40 -0
- package/vitest.config.mts +9 -1
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/TypoBar.tsx +0 -129
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/index.tsx +0 -138
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/useSlashItems.tsx +0 -139
- package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/index.tsx +0 -82
- package/src/app/[variants]/(main)/group/profile/features/ProfileProvider.tsx +0 -20
- package/src/app/[variants]/(main)/group/profile/features/StoreUpdater.tsx +0 -24
- package/src/app/[variants]/(main)/group/profile/features/store/action.ts +0 -163
- package/src/app/[variants]/(main)/group/profile/features/store/index.ts +0 -23
- package/src/app/[variants]/(main)/group/profile/features/store/selectors.ts +0 -7
- package/src/features/EditorModal/EditorCanvas.tsx +0 -84
- package/src/features/EditorModal/Typobar.tsx +0 -139
- package/src/store/chat/slices/builtinTool/actions/agentBuilder.ts +0 -192
- package/src/store/chat/slices/builtinTool/actions/groupAgentBuilder.ts +0 -242
- package/src/tools/executionRuntimes.ts +0 -14
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/AgentTool.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/MentionDropdown.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/types.ts +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/useMentionItems.tsx +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo, useMemo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { UpdateAgentConfigParams, UpdateConfigState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const UpdateConfigInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<UpdateAgentConfigParams, UpdateConfigState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const togglePlugin = args?.togglePlugin || partialArgs?.togglePlugin;
|
|
26
|
+
const config = args?.config || partialArgs?.config;
|
|
27
|
+
const meta = args?.meta || partialArgs?.meta;
|
|
28
|
+
|
|
29
|
+
// Build display text
|
|
30
|
+
const displayText = useMemo(() => {
|
|
31
|
+
// If toggling plugin, show that info
|
|
32
|
+
if (togglePlugin?.pluginId) {
|
|
33
|
+
const enabled = togglePlugin.enabled ?? pluginState?.togglePlugin?.enabled;
|
|
34
|
+
const action =
|
|
35
|
+
enabled === true
|
|
36
|
+
? t('builtins.lobe-agent-builder.inspector.enablePlugin')
|
|
37
|
+
: enabled === false
|
|
38
|
+
? t('builtins.lobe-agent-builder.inspector.disablePlugin')
|
|
39
|
+
: t('builtins.lobe-agent-builder.inspector.togglePlugin');
|
|
40
|
+
return `${action} ${togglePlugin.pluginId}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Otherwise show updated fields
|
|
44
|
+
const fields: string[] = [];
|
|
45
|
+
if (config) {
|
|
46
|
+
if (config.model) fields.push('model');
|
|
47
|
+
if (config.provider) fields.push('provider');
|
|
48
|
+
if (config.plugins) fields.push('plugins');
|
|
49
|
+
if (config.params) fields.push('params');
|
|
50
|
+
if (config.chatConfig) fields.push('chatConfig');
|
|
51
|
+
}
|
|
52
|
+
if (meta) {
|
|
53
|
+
if (meta.title) fields.push('title');
|
|
54
|
+
if (meta.description) fields.push('description');
|
|
55
|
+
if (meta.avatar) fields.push('avatar');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return fields.length > 0 ? fields.join(', ') : '';
|
|
59
|
+
}, [togglePlugin, config, meta, pluginState, t]);
|
|
60
|
+
|
|
61
|
+
// Initial streaming state
|
|
62
|
+
if (isArgumentsStreaming && !displayText) {
|
|
63
|
+
return (
|
|
64
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
65
|
+
<span>{t('builtins.lobe-agent-builder.apiName.updateConfig')}</span>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const isSuccess = pluginState?.success;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
className={cx(
|
|
75
|
+
inspectorTextStyles.root,
|
|
76
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
<span>{t('builtins.lobe-agent-builder.apiName.updateConfig')}</span>
|
|
80
|
+
{displayText && (
|
|
81
|
+
<>
|
|
82
|
+
: <span className={highlightTextStyles.primary}>{displayText}</span>
|
|
83
|
+
</>
|
|
84
|
+
)}
|
|
85
|
+
{!isLoading && isSuccess && (
|
|
86
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
UpdateConfigInspector.displayName = 'UpdateConfigInspector';
|
|
93
|
+
|
|
94
|
+
export default UpdateConfigInspector;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { Text } from '@lobehub/ui';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check } from 'lucide-react';
|
|
7
|
+
import { memo, useMemo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import { inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
11
|
+
|
|
12
|
+
import type { UpdatePromptParams, UpdatePromptState } from '../../../types';
|
|
13
|
+
|
|
14
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
15
|
+
statusIcon: css`
|
|
16
|
+
margin-block-end: -2px;
|
|
17
|
+
margin-inline-start: 4px;
|
|
18
|
+
`,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
export const UpdatePromptInspector = memo<
|
|
22
|
+
BuiltinInspectorProps<UpdatePromptParams, UpdatePromptState>
|
|
23
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
24
|
+
const { t } = useTranslation('plugin');
|
|
25
|
+
|
|
26
|
+
const prompt = args?.prompt || partialArgs?.prompt;
|
|
27
|
+
|
|
28
|
+
// Calculate length difference
|
|
29
|
+
const lengthDiff = useMemo(() => {
|
|
30
|
+
if (!pluginState) return null;
|
|
31
|
+
|
|
32
|
+
const newLength = pluginState.newPrompt?.length ?? 0;
|
|
33
|
+
const prevLength = pluginState.previousPrompt?.length ?? 0;
|
|
34
|
+
const diff = newLength - prevLength;
|
|
35
|
+
|
|
36
|
+
return diff;
|
|
37
|
+
}, [pluginState]);
|
|
38
|
+
|
|
39
|
+
// Initial streaming state
|
|
40
|
+
if (isArgumentsStreaming && !prompt) {
|
|
41
|
+
return (
|
|
42
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
43
|
+
<span>{t('builtins.lobe-agent-builder.apiName.updatePrompt')}</span>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Calculate streaming length change
|
|
49
|
+
const streamingLength = prompt?.length ?? 0;
|
|
50
|
+
const isSuccess = pluginState?.success;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
className={cx(
|
|
55
|
+
inspectorTextStyles.root,
|
|
56
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<span>{t('builtins.lobe-agent-builder.apiName.updatePrompt')}</span>
|
|
60
|
+
{/* Show length diff when completed */}
|
|
61
|
+
{!isLoading && !isArgumentsStreaming && lengthDiff !== null && (
|
|
62
|
+
<Text
|
|
63
|
+
as={'span'}
|
|
64
|
+
code
|
|
65
|
+
color={lengthDiff >= 0 ? cssVar.colorSuccess : cssVar.colorError}
|
|
66
|
+
fontSize={12}
|
|
67
|
+
style={{ marginInlineStart: 4 }}
|
|
68
|
+
>
|
|
69
|
+
({lengthDiff >= 0 ? '+' : ''}
|
|
70
|
+
{lengthDiff}
|
|
71
|
+
{t('builtins.lobe-agent-builder.inspector.chars')})
|
|
72
|
+
</Text>
|
|
73
|
+
)}
|
|
74
|
+
{/* Show streaming length */}
|
|
75
|
+
{(isArgumentsStreaming || isLoading) && streamingLength > 0 && (
|
|
76
|
+
<Text
|
|
77
|
+
as={'span'}
|
|
78
|
+
code
|
|
79
|
+
color={cssVar.colorTextDescription}
|
|
80
|
+
fontSize={12}
|
|
81
|
+
style={{ marginInlineStart: 4 }}
|
|
82
|
+
>
|
|
83
|
+
({streamingLength}
|
|
84
|
+
{t('builtins.lobe-agent-builder.inspector.chars')})
|
|
85
|
+
</Text>
|
|
86
|
+
)}
|
|
87
|
+
{!isLoading && !isArgumentsStreaming && isSuccess && (
|
|
88
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
UpdatePromptInspector.displayName = 'UpdatePromptInspector';
|
|
95
|
+
|
|
96
|
+
export default UpdatePromptInspector;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type BuiltinInspector } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
import { AgentBuilderApiName } from '../../types';
|
|
4
|
+
import { GetAvailableModelsInspector } from './GetAvailableModels';
|
|
5
|
+
import { InstallPluginInspector } from './InstallPlugin';
|
|
6
|
+
import { SearchMarketToolsInspector } from './SearchMarketTools';
|
|
7
|
+
import { UpdateConfigInspector } from './UpdateConfig';
|
|
8
|
+
import { UpdatePromptInspector } from './UpdatePrompt';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Agent Builder Inspector Components Registry
|
|
12
|
+
*
|
|
13
|
+
* Inspector components customize the title/header area
|
|
14
|
+
* of tool calls in the conversation UI.
|
|
15
|
+
*/
|
|
16
|
+
export const AgentBuilderInspectors: Record<string, BuiltinInspector> = {
|
|
17
|
+
[AgentBuilderApiName.getAvailableModels]: GetAvailableModelsInspector as BuiltinInspector,
|
|
18
|
+
[AgentBuilderApiName.installPlugin]: InstallPluginInspector as BuiltinInspector,
|
|
19
|
+
[AgentBuilderApiName.searchMarketTools]: SearchMarketToolsInspector as BuiltinInspector,
|
|
20
|
+
[AgentBuilderApiName.updateAgentConfig]: UpdateConfigInspector as BuiltinInspector,
|
|
21
|
+
[AgentBuilderApiName.updatePrompt]: UpdatePromptInspector as BuiltinInspector,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Re-export individual inspectors for reuse in group-agent-builder
|
|
25
|
+
export { GetAvailableModelsInspector } from './GetAvailableModels';
|
|
26
|
+
export { InstallPluginInspector } from './InstallPlugin';
|
|
27
|
+
export { SearchMarketToolsInspector } from './SearchMarketTools';
|
|
28
|
+
export { UpdateConfigInspector } from './UpdateConfig';
|
|
29
|
+
export { UpdatePromptInspector } from './UpdatePrompt';
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
// Inspector components (customized tool call headers)
|
|
2
|
+
export { AgentBuilderInspectors } from './Inspector';
|
|
3
|
+
export {
|
|
4
|
+
GetAvailableModelsInspector,
|
|
5
|
+
InstallPluginInspector,
|
|
6
|
+
SearchMarketToolsInspector,
|
|
7
|
+
UpdateConfigInspector,
|
|
8
|
+
UpdatePromptInspector,
|
|
9
|
+
} from './Inspector';
|
|
10
|
+
|
|
11
|
+
// Intervention components (interactive editing)
|
|
1
12
|
export { AgentBuilderInterventions } from './Intervention';
|
|
13
|
+
|
|
14
|
+
// Render components (read-only snapshots)
|
|
2
15
|
export { AgentBuilderRenders } from './Render';
|
|
3
16
|
|
|
4
17
|
// Re-export types and manifest for convenience
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Builder Executor
|
|
3
|
+
*
|
|
4
|
+
* Handles all agent builder tool calls for configuring and customizing agents.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseExecutor, type BuiltinToolContext, type BuiltinToolResult } from '@lobechat/types';
|
|
7
|
+
|
|
8
|
+
import { AgentBuilderExecutionRuntime } from './ExecutionRuntime';
|
|
9
|
+
import {
|
|
10
|
+
AgentBuilderApiName,
|
|
11
|
+
AgentBuilderIdentifier,
|
|
12
|
+
type GetAvailableModelsParams,
|
|
13
|
+
type InstallPluginParams,
|
|
14
|
+
type SearchMarketToolsParams,
|
|
15
|
+
type UpdateAgentConfigParams,
|
|
16
|
+
type UpdatePromptParams,
|
|
17
|
+
} from './types';
|
|
18
|
+
|
|
19
|
+
const runtime = new AgentBuilderExecutionRuntime();
|
|
20
|
+
|
|
21
|
+
class AgentBuilderExecutor extends BaseExecutor<typeof AgentBuilderApiName> {
|
|
22
|
+
readonly identifier = AgentBuilderIdentifier;
|
|
23
|
+
protected readonly apiEnum = AgentBuilderApiName;
|
|
24
|
+
|
|
25
|
+
// ==================== Read Operations ====================
|
|
26
|
+
|
|
27
|
+
getAvailableModels = async (params: GetAvailableModelsParams): Promise<BuiltinToolResult> => {
|
|
28
|
+
const result = await runtime.getAvailableModels(params);
|
|
29
|
+
return {
|
|
30
|
+
content: result.content,
|
|
31
|
+
error: result.error
|
|
32
|
+
? { body: result.error, message: String(result.error), type: 'RuntimeError' }
|
|
33
|
+
: undefined,
|
|
34
|
+
state: result.state,
|
|
35
|
+
success: result.success,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
searchMarketTools = async (params: SearchMarketToolsParams): Promise<BuiltinToolResult> => {
|
|
40
|
+
const result = await runtime.searchMarketTools(params);
|
|
41
|
+
return {
|
|
42
|
+
content: result.content,
|
|
43
|
+
error: result.error
|
|
44
|
+
? { body: result.error, message: String(result.error), type: 'RuntimeError' }
|
|
45
|
+
: undefined,
|
|
46
|
+
state: result.state,
|
|
47
|
+
success: result.success,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// ==================== Write Operations ====================
|
|
52
|
+
|
|
53
|
+
updateConfig = async (
|
|
54
|
+
params: UpdateAgentConfigParams,
|
|
55
|
+
ctx: BuiltinToolContext,
|
|
56
|
+
): Promise<BuiltinToolResult> => {
|
|
57
|
+
const agentId = ctx.agentId;
|
|
58
|
+
|
|
59
|
+
if (!agentId) {
|
|
60
|
+
return {
|
|
61
|
+
content: 'No active agent found',
|
|
62
|
+
error: { message: 'No active agent found', type: 'NoAgentContext' },
|
|
63
|
+
success: false,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const result = await runtime.updateAgentConfig(agentId, params);
|
|
68
|
+
return {
|
|
69
|
+
content: result.content,
|
|
70
|
+
error: result.error
|
|
71
|
+
? { body: result.error, message: String(result.error), type: 'RuntimeError' }
|
|
72
|
+
: undefined,
|
|
73
|
+
state: result.state,
|
|
74
|
+
success: result.success,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
updatePrompt = async (
|
|
79
|
+
params: UpdatePromptParams,
|
|
80
|
+
ctx: BuiltinToolContext,
|
|
81
|
+
): Promise<BuiltinToolResult> => {
|
|
82
|
+
const agentId = ctx.agentId;
|
|
83
|
+
|
|
84
|
+
if (!agentId) {
|
|
85
|
+
return {
|
|
86
|
+
content: 'No active agent found',
|
|
87
|
+
error: { message: 'No active agent found', type: 'NoAgentContext' },
|
|
88
|
+
success: false,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const result = await runtime.updatePrompt(agentId, {
|
|
93
|
+
streaming: true,
|
|
94
|
+
...params,
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
content: result.content,
|
|
98
|
+
error: result.error
|
|
99
|
+
? { body: result.error, message: String(result.error), type: 'RuntimeError' }
|
|
100
|
+
: undefined,
|
|
101
|
+
state: result.state,
|
|
102
|
+
success: result.success,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
installPlugin = async (
|
|
107
|
+
params: InstallPluginParams,
|
|
108
|
+
ctx: BuiltinToolContext,
|
|
109
|
+
): Promise<BuiltinToolResult> => {
|
|
110
|
+
const agentId = ctx.agentId;
|
|
111
|
+
|
|
112
|
+
if (!agentId) {
|
|
113
|
+
return {
|
|
114
|
+
content: 'No active agent found',
|
|
115
|
+
error: { message: 'No active agent found', type: 'NoAgentContext' },
|
|
116
|
+
success: false,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const result = await runtime.installPlugin(agentId, params);
|
|
121
|
+
return {
|
|
122
|
+
content: result.content,
|
|
123
|
+
error: result.error
|
|
124
|
+
? { body: result.error, message: String(result.error), type: 'RuntimeError' }
|
|
125
|
+
: undefined,
|
|
126
|
+
state: result.state,
|
|
127
|
+
success: result.success,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const agentBuilderExecutor = new AgentBuilderExecutor();
|
|
@@ -6,20 +6,11 @@ import { Check, X } from 'lucide-react';
|
|
|
6
6
|
import { memo } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
9
|
-
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
10
|
|
|
11
11
|
import { type ExecuteCodeState } from '../../../types';
|
|
12
12
|
|
|
13
|
-
const styles = createStaticStyles(({ css
|
|
14
|
-
root: css`
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
display: -webkit-box;
|
|
17
|
-
-webkit-box-orient: vertical;
|
|
18
|
-
-webkit-line-clamp: 1;
|
|
19
|
-
|
|
20
|
-
color: ${cssVar.colorTextSecondary};
|
|
21
|
-
`,
|
|
22
|
-
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
23
14
|
statusIcon: css`
|
|
24
15
|
margin-block-end: -2px;
|
|
25
16
|
margin-inline-start: 4px;
|
|
@@ -42,13 +33,13 @@ export const ExecuteCodeInspector = memo<
|
|
|
42
33
|
if (isArgumentsStreaming) {
|
|
43
34
|
if (!description)
|
|
44
35
|
return (
|
|
45
|
-
<div className={cx(
|
|
36
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
46
37
|
<span>{t('builtins.lobe-cloud-sandbox.apiName.executeCode')}</span>
|
|
47
38
|
</div>
|
|
48
39
|
);
|
|
49
40
|
|
|
50
41
|
return (
|
|
51
|
-
<div className={cx(
|
|
42
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
52
43
|
<span>{t('builtins.lobe-cloud-sandbox.apiName.executeCode')}: </span>
|
|
53
44
|
<span className={highlightTextStyles.gold}>{description}</span>
|
|
54
45
|
</div>
|
|
@@ -56,7 +47,7 @@ export const ExecuteCodeInspector = memo<
|
|
|
56
47
|
}
|
|
57
48
|
|
|
58
49
|
return (
|
|
59
|
-
<div className={cx(
|
|
50
|
+
<div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
60
51
|
<span style={{ marginInlineStart: 2 }}>
|
|
61
52
|
<span>{t('builtins.lobe-cloud-sandbox.apiName.executeCode')}: </span>
|
|
62
53
|
{description && <span className={highlightTextStyles.primary}>{description}</span>}
|
|
@@ -6,19 +6,11 @@ import { Check, X } from 'lucide-react';
|
|
|
6
6
|
import { memo } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
9
|
-
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
10
|
|
|
11
11
|
import { type RunCommandState } from '../../../types';
|
|
12
12
|
|
|
13
|
-
const styles = createStaticStyles(({ css
|
|
14
|
-
root: css`
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
display: -webkit-box;
|
|
17
|
-
-webkit-box-orient: vertical;
|
|
18
|
-
-webkit-line-clamp: 1;
|
|
19
|
-
|
|
20
|
-
color: ${cssVar.colorTextSecondary};
|
|
21
|
-
`,
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
22
14
|
statusIcon: css`
|
|
23
15
|
margin-block-end: -2px;
|
|
24
16
|
margin-inline-start: 4px;
|
|
@@ -41,13 +33,13 @@ export const RunCommandInspector = memo<BuiltinInspectorProps<RunCommandParams,
|
|
|
41
33
|
if (isArgumentsStreaming) {
|
|
42
34
|
if (!description)
|
|
43
35
|
return (
|
|
44
|
-
<div className={cx(
|
|
36
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
45
37
|
<span>{t('builtins.lobe-cloud-sandbox.apiName.runCommand')}</span>
|
|
46
38
|
</div>
|
|
47
39
|
);
|
|
48
40
|
|
|
49
41
|
return (
|
|
50
|
-
<div className={cx(
|
|
42
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
51
43
|
<span>{t('builtins.lobe-cloud-sandbox.apiName.runCommand')}: </span>
|
|
52
44
|
<span className={highlightTextStyles.primary}>{description}</span>
|
|
53
45
|
</div>
|
|
@@ -55,7 +47,7 @@ export const RunCommandInspector = memo<BuiltinInspectorProps<RunCommandParams,
|
|
|
55
47
|
}
|
|
56
48
|
|
|
57
49
|
return (
|
|
58
|
-
<div className={cx(
|
|
50
|
+
<div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
59
51
|
<span style={{ marginInlineStart: 2 }}>
|
|
60
52
|
<span>{t('builtins.lobe-cloud-sandbox.apiName.runCommand')}: </span>
|
|
61
53
|
{description && <span className={highlightTextStyles.primary}>{description}</span>}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
7
|
+
"./client": "./src/client/index.ts",
|
|
8
|
+
"./executor": "./src/executor.ts",
|
|
7
9
|
"./executionRuntime": "./src/ExecutionRuntime/index.ts"
|
|
8
10
|
},
|
|
9
11
|
"main": "./src/index.ts",
|
|
@@ -14,6 +16,10 @@
|
|
|
14
16
|
"@lobechat/types": "workspace:*"
|
|
15
17
|
},
|
|
16
18
|
"peerDependencies": {
|
|
17
|
-
"
|
|
19
|
+
"@lobehub/ui": "^4",
|
|
20
|
+
"antd": "^6",
|
|
21
|
+
"lucide-react": "*",
|
|
22
|
+
"react": "*",
|
|
23
|
+
"react-i18next": "*"
|
|
18
24
|
}
|
|
19
25
|
}
|