@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.
Files changed (237) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/changelog/v1.json +18 -0
  3. package/locales/ar/chat.json +7 -0
  4. package/locales/ar/models.json +2 -3
  5. package/locales/ar/plugin.json +22 -1
  6. package/locales/bg-BG/chat.json +7 -0
  7. package/locales/bg-BG/models.json +3 -3
  8. package/locales/bg-BG/plugin.json +22 -1
  9. package/locales/de-DE/chat.json +7 -0
  10. package/locales/de-DE/models.json +3 -4
  11. package/locales/de-DE/plugin.json +22 -1
  12. package/locales/en-US/chat.json +7 -0
  13. package/locales/en-US/models.json +5 -5
  14. package/locales/en-US/plugin.json +22 -1
  15. package/locales/es-ES/chat.json +7 -0
  16. package/locales/es-ES/models.json +3 -4
  17. package/locales/es-ES/plugin.json +22 -1
  18. package/locales/fa-IR/chat.json +7 -0
  19. package/locales/fa-IR/models.json +3 -4
  20. package/locales/fa-IR/plugin.json +22 -1
  21. package/locales/fr-FR/chat.json +7 -0
  22. package/locales/fr-FR/models.json +50 -3
  23. package/locales/fr-FR/plugin.json +22 -1
  24. package/locales/it-IT/chat.json +7 -0
  25. package/locales/it-IT/models.json +3 -3
  26. package/locales/it-IT/plugin.json +22 -1
  27. package/locales/ja-JP/chat.json +7 -0
  28. package/locales/ja-JP/models.json +43 -4
  29. package/locales/ja-JP/plugin.json +22 -1
  30. package/locales/ko-KR/chat.json +7 -0
  31. package/locales/ko-KR/models.json +3 -4
  32. package/locales/ko-KR/plugin.json +22 -1
  33. package/locales/nl-NL/chat.json +7 -0
  34. package/locales/nl-NL/models.json +51 -3
  35. package/locales/nl-NL/plugin.json +22 -1
  36. package/locales/pl-PL/chat.json +7 -0
  37. package/locales/pl-PL/models.json +3 -3
  38. package/locales/pl-PL/plugin.json +22 -1
  39. package/locales/pt-BR/chat.json +7 -0
  40. package/locales/pt-BR/models.json +3 -4
  41. package/locales/pt-BR/plugin.json +22 -1
  42. package/locales/ru-RU/chat.json +7 -0
  43. package/locales/ru-RU/models.json +3 -4
  44. package/locales/ru-RU/plugin.json +22 -1
  45. package/locales/tr-TR/chat.json +7 -0
  46. package/locales/tr-TR/models.json +3 -4
  47. package/locales/tr-TR/plugin.json +22 -1
  48. package/locales/vi-VN/chat.json +7 -0
  49. package/locales/vi-VN/models.json +3 -3
  50. package/locales/vi-VN/plugin.json +22 -1
  51. package/locales/zh-CN/chat.json +7 -0
  52. package/locales/zh-CN/models.json +54 -4
  53. package/locales/zh-CN/plugin.json +22 -1
  54. package/locales/zh-TW/chat.json +7 -0
  55. package/locales/zh-TW/models.json +43 -4
  56. package/locales/zh-TW/plugin.json +22 -1
  57. package/package.json +2 -2
  58. package/packages/builtin-tool-agent-builder/package.json +1 -0
  59. package/packages/builtin-tool-agent-builder/src/client/Inspector/GetAvailableModels/index.tsx +66 -0
  60. package/packages/builtin-tool-agent-builder/src/client/Inspector/InstallPlugin/index.tsx +63 -0
  61. package/packages/builtin-tool-agent-builder/src/client/Inspector/SearchMarketTools/index.tsx +64 -0
  62. package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdateConfig/index.tsx +94 -0
  63. package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdatePrompt/index.tsx +96 -0
  64. package/packages/builtin-tool-agent-builder/src/client/Inspector/index.ts +29 -0
  65. package/packages/builtin-tool-agent-builder/src/client/index.ts +13 -0
  66. package/packages/builtin-tool-agent-builder/src/executor.ts +132 -0
  67. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx +5 -14
  68. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx +5 -13
  69. package/packages/builtin-tool-group-agent-builder/package.json +7 -1
  70. package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +331 -87
  71. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +110 -0
  72. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/CreateAgent/index.tsx +72 -0
  73. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/InviteAgent/index.tsx +57 -0
  74. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/RemoveAgent/index.tsx +57 -0
  75. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/SearchAgent/index.tsx +66 -0
  76. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateAgentPrompt/index.tsx +120 -0
  77. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +87 -0
  78. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroupPrompt/index.tsx +99 -0
  79. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/index.ts +52 -0
  80. package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +103 -0
  81. package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateAgentPrompt/index.tsx +36 -0
  82. package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateGroupPrompt/index.tsx +36 -0
  83. package/packages/builtin-tool-group-agent-builder/src/client/Render/index.ts +16 -0
  84. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/BatchCreateAgents/index.tsx +88 -0
  85. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateAgentPrompt/index.tsx +37 -0
  86. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateGroupPrompt/index.tsx +35 -0
  87. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/index.ts +22 -0
  88. package/packages/builtin-tool-group-agent-builder/src/client/index.ts +26 -0
  89. package/packages/builtin-tool-group-agent-builder/src/executor.ts +284 -0
  90. package/packages/builtin-tool-group-agent-builder/src/index.ts +1 -14
  91. package/packages/builtin-tool-group-agent-builder/src/manifest.ts +160 -15
  92. package/packages/builtin-tool-group-agent-builder/src/systemRole.ts +232 -46
  93. package/packages/builtin-tool-group-agent-builder/src/types.ts +191 -41
  94. package/packages/builtin-tool-group-management/src/client/Inspector/Broadcast/index.tsx +2 -2
  95. package/packages/builtin-tool-group-management/src/manifest.ts +1 -1
  96. package/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx +5 -11
  97. package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +3 -9
  98. package/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx +6 -15
  99. package/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx +3 -9
  100. package/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx +6 -17
  101. package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +3 -9
  102. package/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx +3 -9
  103. package/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx +3 -9
  104. package/packages/builtin-tool-knowledge-base/src/client/Inspector/ReadKnowledge/index.tsx +4 -16
  105. package/packages/builtin-tool-knowledge-base/src/client/Inspector/SearchKnowledgeBase/index.tsx +5 -16
  106. package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +4 -12
  107. package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +5 -13
  108. package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +5 -16
  109. package/packages/builtin-tool-local-system/src/client/Inspector/ListLocalFiles/index.tsx +5 -16
  110. package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +5 -16
  111. package/packages/builtin-tool-local-system/src/client/Inspector/RenameLocalFile/index.tsx +5 -11
  112. package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +5 -13
  113. package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +5 -16
  114. package/packages/builtin-tool-local-system/src/client/Inspector/WriteLocalFile/index.tsx +6 -15
  115. package/packages/builtin-tool-notebook/src/client/Inspector/CreateDocument/index.tsx +7 -15
  116. package/packages/builtin-tool-page-agent/src/client/Inspector/EditTitle/index.tsx +5 -14
  117. package/packages/builtin-tool-page-agent/src/client/Inspector/GetPageContent/index.tsx +7 -8
  118. package/packages/builtin-tool-page-agent/src/client/Inspector/InitPage/index.tsx +4 -10
  119. package/packages/builtin-tool-page-agent/src/client/Inspector/ModifyNodes/index.tsx +3 -9
  120. package/packages/builtin-tool-page-agent/src/client/Inspector/ReplaceText/index.tsx +5 -11
  121. package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlMultiPages/index.tsx +6 -15
  122. package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlSinglePage/index.tsx +6 -15
  123. package/packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx +4 -15
  124. package/packages/database/src/models/chatGroup.ts +1 -1
  125. package/packages/model-bank/src/aiModels/aihubmix.ts +2 -1
  126. package/packages/model-bank/src/aiModels/google.ts +2 -1
  127. package/packages/model-bank/src/aiModels/infiniai.ts +9 -6
  128. package/packages/model-bank/src/aiModels/minimax.ts +9 -5
  129. package/packages/model-bank/src/aiModels/ollamacloud.ts +4 -2
  130. package/packages/model-bank/src/aiModels/vertexai.ts +2 -1
  131. package/packages/types/src/agentGroup/index.ts +8 -0
  132. package/patches/@upstash__qstash.patch +13 -1
  133. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
  134. package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +4 -3
  135. package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +1 -1
  136. package/src/app/[variants]/(main)/agent/profile/features/store/action.ts +18 -21
  137. package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +8 -6
  138. package/src/app/[variants]/(main)/group/_layout/GroupIdSync.tsx +6 -1
  139. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +29 -21
  140. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMember.tsx +1 -0
  141. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMemberItem.tsx +35 -18
  142. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/AddTopicButon.tsx +2 -10
  143. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +10 -2
  144. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/index.tsx +1 -2
  145. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +1 -0
  146. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +15 -9
  147. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +12 -6
  148. package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor/AgentHeader.tsx → GroupProfile/GroupHeader.tsx} +22 -29
  149. package/src/app/[variants]/(main)/group/profile/features/GroupProfile/index.tsx +96 -0
  150. package/src/app/[variants]/(main)/group/profile/features/Header/AgentBuilderToggle.tsx +3 -4
  151. package/src/app/[variants]/(main)/group/profile/features/Header/AutoSaveHint.tsx +11 -7
  152. package/src/app/[variants]/(main)/group/profile/features/Header/ChromeTabs/index.tsx +147 -0
  153. package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +104 -13
  154. package/src/app/[variants]/(main)/group/profile/features/MemberProfile/AgentHeader.tsx +222 -0
  155. package/src/app/[variants]/(main)/group/profile/features/MemberProfile/index.tsx +155 -0
  156. package/src/app/[variants]/(main)/group/profile/features/ProfileHydration.tsx +63 -5
  157. package/src/app/[variants]/(main)/group/profile/index.tsx +34 -37
  158. package/src/app/[variants]/(main)/settings/proxy/features/ProxyForm.tsx +156 -253
  159. package/src/app/[variants]/(main)/settings/proxy/index.tsx +1 -3
  160. package/src/app/[variants]/(mobile)/(home)/_layout/SessionHydration.tsx +1 -1
  161. package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx +1 -1
  162. package/src/features/AgentBuilder/index.tsx +16 -1
  163. package/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx +3 -2
  164. package/src/features/Conversation/Messages/User/useMarkdown.tsx +1 -0
  165. package/src/features/EditorCanvas/EditorCanvas.test.tsx +206 -0
  166. package/src/features/EditorCanvas/EditorDataMode.tsx +53 -19
  167. package/src/features/EditorModal/index.tsx +2 -2
  168. package/src/features/NavPanel/components/SessionHydration.tsx +1 -1
  169. package/src/features/PageEditor/EditorCanvas/useAskCopilotItem.tsx +10 -6
  170. package/src/features/PageEditor/Header/index.tsx +12 -10
  171. package/src/features/PageEditor/Header/useMenu.tsx +45 -48
  172. package/src/features/RightPanel/ToggleRightPanelButton.tsx +3 -1
  173. package/src/features/ShareModal/ShareImage/ChatList/index.tsx +1 -1
  174. package/src/features/ShareModal/SharePdf/index.tsx +1 -1
  175. package/src/hooks/useBidirectionalQuerySync.ts +112 -0
  176. package/src/locales/default/chat.ts +10 -0
  177. package/src/locales/default/plugin.ts +22 -1
  178. package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +45 -45
  179. package/src/server/modules/KeyVaultsEncrypt/index.ts +6 -6
  180. package/src/server/modules/S3/index.ts +1 -1
  181. package/src/server/routers/lambda/agent.ts +24 -0
  182. package/src/server/routers/lambda/agentGroup.ts +39 -0
  183. package/src/services/agent.ts +22 -0
  184. package/src/services/chatGroup/index.ts +14 -0
  185. package/src/store/agent/selectors/selectors.ts +3 -0
  186. package/src/store/agentGroup/initialState.ts +6 -0
  187. package/src/store/agentGroup/selectors/byId.ts +3 -1
  188. package/src/store/agentGroup/selectors/current.ts +2 -2
  189. package/src/store/agentGroup/slices/lifecycle.ts +18 -0
  190. package/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockStore.ts +1 -1
  191. package/src/store/chat/slices/aiAgent/actions/__tests__/agentGroup.test.ts +4 -1
  192. package/src/store/chat/slices/aiAgent/actions/agentGroup.ts +1 -1
  193. package/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts +65 -0
  194. package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -1
  195. package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +1 -1
  196. package/src/store/chat/slices/builtinTool/actions/index.ts +1 -6
  197. package/src/store/chat/slices/message/action.test.ts +5 -5
  198. package/src/store/chat/slices/message/actions/publicApi.ts +5 -5
  199. package/src/store/chat/slices/message/initialState.ts +0 -5
  200. package/src/store/chat/slices/message/selectors/displayMessage.test.ts +4 -4
  201. package/src/store/chat/slices/plugin/action.test.ts +54 -19
  202. package/src/store/chat/slices/plugin/actions/pluginTypes.ts +15 -21
  203. package/src/store/chat/slices/topic/action.test.ts +74 -24
  204. package/src/store/chat/slices/topic/action.ts +21 -13
  205. package/src/store/chat/slices/topic/selectors.test.ts +1 -1
  206. package/src/store/global/initialState.ts +10 -0
  207. package/src/store/global/selectors/systemStatus.ts +5 -0
  208. package/src/store/groupProfile/action.ts +168 -0
  209. package/src/store/groupProfile/index.ts +16 -0
  210. package/src/{app/[variants]/(main)/group/profile/features/store → store/groupProfile}/initialState.ts +17 -0
  211. package/src/store/groupProfile/selectors.ts +13 -0
  212. package/src/store/tool/slices/builtin/executors/index.ts +4 -0
  213. package/src/styles/text.ts +16 -0
  214. package/src/tools/inspectors.ts +13 -0
  215. package/src/tools/renders.ts +3 -0
  216. package/src/tools/streamings.ts +8 -0
  217. package/tests/mocks/lru_map.ts +40 -0
  218. package/vitest.config.mts +9 -1
  219. package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/TypoBar.tsx +0 -129
  220. package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/index.tsx +0 -138
  221. package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/useSlashItems.tsx +0 -139
  222. package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/index.tsx +0 -82
  223. package/src/app/[variants]/(main)/group/profile/features/ProfileProvider.tsx +0 -20
  224. package/src/app/[variants]/(main)/group/profile/features/StoreUpdater.tsx +0 -24
  225. package/src/app/[variants]/(main)/group/profile/features/store/action.ts +0 -163
  226. package/src/app/[variants]/(main)/group/profile/features/store/index.ts +0 -23
  227. package/src/app/[variants]/(main)/group/profile/features/store/selectors.ts +0 -7
  228. package/src/features/EditorModal/EditorCanvas.tsx +0 -84
  229. package/src/features/EditorModal/Typobar.tsx +0 -139
  230. package/src/store/chat/slices/builtinTool/actions/agentBuilder.ts +0 -192
  231. package/src/store/chat/slices/builtinTool/actions/groupAgentBuilder.ts +0 -242
  232. package/src/tools/executionRuntimes.ts +0 -14
  233. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/AgentTool.tsx +0 -0
  234. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/MentionDropdown.tsx +0 -0
  235. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/index.tsx +0 -0
  236. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/types.ts +0 -0
  237. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/useMentionItems.tsx +0 -0
@@ -1,242 +0,0 @@
1
- import type {
2
- GetAvailableModelsParams,
3
- InstallPluginParams,
4
- SearchMarketToolsParams,
5
- UpdateAgentConfigParams,
6
- } from '@lobechat/builtin-tool-agent-builder';
7
- import { AgentBuilderExecutionRuntime } from '@lobechat/builtin-tool-agent-builder/executionRuntime';
8
- import type {
9
- InviteAgentParams,
10
- RemoveAgentParams,
11
- UpdateGroupConfigParams,
12
- UpdateGroupPromptParams,
13
- } from '@lobechat/builtin-tool-group-agent-builder';
14
- import { GroupAgentBuilderExecutionRuntime } from '@lobechat/builtin-tool-group-agent-builder/executionRuntime';
15
- import debug from 'debug';
16
- import { type StateCreator } from 'zustand/vanilla';
17
-
18
- import { getAgentStoreState } from '@/store/agent';
19
- import { getChatGroupStoreState } from '@/store/agentGroup';
20
- import { type ChatStore } from '@/store/chat/store';
21
-
22
- const log = debug('lobe-store:builtin-tool:group-agent-builder');
23
-
24
- export interface GroupAgentBuilderAction {
25
- // Inherited operations from AgentBuilder (operate on supervisor agent)
26
- groupAgentBuilder_getAvailableModels: (
27
- id: string,
28
- params: GetAvailableModelsParams,
29
- ) => Promise<boolean>;
30
- groupAgentBuilder_installPlugin: (id: string, params: InstallPluginParams) => Promise<boolean>;
31
- // Group-specific operations
32
- groupAgentBuilder_inviteAgent: (id: string, params: InviteAgentParams) => Promise<boolean>;
33
- groupAgentBuilder_removeAgent: (id: string, params: RemoveAgentParams) => Promise<boolean>;
34
- groupAgentBuilder_searchMarketTools: (
35
- id: string,
36
- params: SearchMarketToolsParams,
37
- ) => Promise<boolean>;
38
- groupAgentBuilder_updateConfig: (id: string, params: UpdateAgentConfigParams) => Promise<boolean>;
39
- groupAgentBuilder_updateGroupConfig: (
40
- id: string,
41
- params: UpdateGroupConfigParams,
42
- ) => Promise<boolean>;
43
- groupAgentBuilder_updatePrompt: (id: string, params: UpdateGroupPromptParams) => Promise<boolean>;
44
- internal_triggerGroupAgentBuilderToolCalling: (
45
- id: string,
46
- apiName: string,
47
- params: any,
48
- ) => Promise<boolean>;
49
- }
50
-
51
- const agentBuilderRuntime = new AgentBuilderExecutionRuntime();
52
- const groupAgentBuilderRuntime = new GroupAgentBuilderExecutionRuntime();
53
-
54
- export const groupAgentBuilderSlice: StateCreator<
55
- ChatStore,
56
- [['zustand/devtools', never]],
57
- [],
58
- GroupAgentBuilderAction
59
- > = (set, get) => ({
60
- // ==================== Inherited Operations (from AgentBuilder) ====================
61
- groupAgentBuilder_getAvailableModels: async (id, params) => {
62
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'getAvailableModels', params);
63
- },
64
-
65
- groupAgentBuilder_installPlugin: async (id, params) => {
66
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'installPlugin', params);
67
- },
68
-
69
- // ==================== Group-specific Operations ====================
70
- groupAgentBuilder_inviteAgent: async (id, params) => {
71
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'inviteAgent', params);
72
- },
73
-
74
- groupAgentBuilder_removeAgent: async (id, params) => {
75
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'removeAgent', params);
76
- },
77
-
78
- groupAgentBuilder_searchMarketTools: async (id, params) => {
79
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'searchMarketTools', params);
80
- },
81
-
82
- groupAgentBuilder_updateConfig: async (id, params) => {
83
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'updateConfig', params);
84
- },
85
-
86
- groupAgentBuilder_updateGroupConfig: async (id, params) => {
87
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'updateGroupConfig', params);
88
- },
89
-
90
- groupAgentBuilder_updatePrompt: async (id, params) => {
91
- return get().internal_triggerGroupAgentBuilderToolCalling(id, 'updatePrompt', params);
92
- },
93
-
94
- // ==================== Internal Helper ====================
95
-
96
- internal_triggerGroupAgentBuilderToolCalling: async (id, apiName, params) => {
97
- // Get parent operationId from messageOperationMap (should be executeToolCall)
98
- const parentOperationId = get().messageOperationMap[id];
99
-
100
- // Create child operation for group agent builder execution
101
- const { operationId, abortController } = get().startOperation({
102
- context: {
103
- messageId: id,
104
- },
105
- metadata: {
106
- apiName,
107
- params,
108
- startTime: Date.now(),
109
- },
110
- parentOperationId,
111
- type: 'builtinToolGroupAgentBuilder',
112
- });
113
-
114
- log(
115
- '[%s] messageId=%s, parentOpId=%s, opId=%s, aborted=%s',
116
- apiName,
117
- id,
118
- parentOperationId,
119
- operationId,
120
- abortController.signal.aborted,
121
- );
122
-
123
- const context = { operationId };
124
-
125
- try {
126
- // Get the active group ID
127
- const groupId = getChatGroupStoreState().activeGroupId;
128
- if (!groupId) {
129
- throw new Error('No active group found');
130
- }
131
-
132
- // Get supervisor agent ID for config/model operations
133
- const agentId = getAgentStoreState().activeAgentId;
134
-
135
- // Execute the runtime method
136
- let result;
137
- switch (apiName) {
138
- // Group-specific operations
139
- case 'inviteAgent': {
140
- result = await groupAgentBuilderRuntime.inviteAgent(groupId, params as InviteAgentParams);
141
- break;
142
- }
143
- case 'removeAgent': {
144
- result = await groupAgentBuilderRuntime.removeAgent(groupId, params as RemoveAgentParams);
145
- break;
146
- }
147
- case 'updatePrompt': {
148
- result = await groupAgentBuilderRuntime.updatePrompt({
149
- streaming: true,
150
- ...params,
151
- } as UpdateGroupPromptParams);
152
- break;
153
- }
154
- case 'updateGroupConfig': {
155
- result = await groupAgentBuilderRuntime.updateGroupConfig(
156
- params as UpdateGroupConfigParams,
157
- );
158
- break;
159
- }
160
- // Inherited operations (use AgentBuilder runtime for supervisor agent)
161
- case 'updateAgentConfig':
162
- case 'updateConfig': {
163
- if (!agentId) throw new Error('No supervisor agent found');
164
- result = await agentBuilderRuntime.updateAgentConfig(
165
- agentId,
166
- params as UpdateAgentConfigParams,
167
- );
168
- break;
169
- }
170
- case 'getAvailableModels': {
171
- result = await agentBuilderRuntime.getAvailableModels(params as GetAvailableModelsParams);
172
- break;
173
- }
174
- case 'searchMarketTools': {
175
- result = await agentBuilderRuntime.searchMarketTools(params as SearchMarketToolsParams);
176
- break;
177
- }
178
- case 'installPlugin': {
179
- if (!agentId) throw new Error('No supervisor agent found');
180
- result = await agentBuilderRuntime.installPlugin(agentId, params as InstallPluginParams);
181
- break;
182
- }
183
- default: {
184
- throw new Error(`Unknown API name: ${apiName}`);
185
- }
186
- }
187
-
188
- const { content, success, error, state } = result;
189
-
190
- // Complete operation
191
- get().completeOperation(operationId);
192
-
193
- // Update message content
194
- await get().optimisticUpdateMessageContent(id, content, undefined, context);
195
-
196
- if (success) {
197
- // Update plugin state with the result
198
- await get().optimisticUpdatePluginState(id, state, context);
199
- } else {
200
- // Update plugin error
201
- await get().optimisticUpdatePluginError(id, error, context);
202
- }
203
-
204
- return true;
205
- } catch (error) {
206
- const err = error as Error;
207
-
208
- log('[%s] Error: messageId=%s, error=%s', apiName, id, err.message);
209
-
210
- // Check if it's an abort error
211
- if (err.message.includes('The user aborted a request.') || err.name === 'AbortError') {
212
- log('[%s] Request aborted: messageId=%s', apiName, id);
213
- // Fail operation for abort
214
- get().failOperation(operationId, {
215
- message: 'User cancelled the request',
216
- type: 'UserAborted',
217
- });
218
- // Don't update error message for user aborts
219
- return true;
220
- }
221
-
222
- // Fail operation for other errors
223
- get().failOperation(operationId, {
224
- message: err.message,
225
- type: 'PluginServerError',
226
- });
227
-
228
- // For other errors, update message
229
- await get().optimisticUpdateMessagePluginError(
230
- id,
231
- {
232
- body: error,
233
- message: err.message,
234
- type: 'PluginServerError',
235
- },
236
- context,
237
- );
238
-
239
- return true;
240
- }
241
- },
242
- });
@@ -1,14 +0,0 @@
1
- import { AgentBuilderManifest } from '@lobechat/builtin-tool-agent-builder';
2
- import { AgentBuilderExecutionRuntime } from '@lobechat/builtin-tool-agent-builder/executionRuntime';
3
- import { GroupAgentBuilderManifest } from '@lobechat/builtin-tool-group-agent-builder';
4
- import { GroupAgentBuilderExecutionRuntime } from '@lobechat/builtin-tool-group-agent-builder/executionRuntime';
5
- import { WebBrowsingManifest } from '@lobechat/builtin-tool-web-browsing';
6
- import { WebBrowsingExecutionRuntime } from '@lobechat/builtin-tool-web-browsing/executionRuntime';
7
-
8
- // Note: KnowledgeBase and LocalSystem now use executor pattern via toolStore/builtin/executors
9
-
10
- export const BuiltinToolServerRuntimes: Record<string, any> = {
11
- [AgentBuilderManifest.identifier]: AgentBuilderExecutionRuntime,
12
- [GroupAgentBuilderManifest.identifier]: GroupAgentBuilderExecutionRuntime,
13
- [WebBrowsingManifest.identifier]: WebBrowsingExecutionRuntime,
14
- };