@lobehub/lobehub 2.0.0-next.47 → 2.0.0-next.49

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 (311) hide show
  1. package/.env.example +11 -0
  2. package/CHANGELOG.md +50 -0
  3. package/README.md +1 -1
  4. package/README.zh-CN.md +1 -1
  5. package/apps/desktop/src/main/controllers/AuthCtr.ts +27 -2
  6. package/apps/desktop/src/main/core/infrastructure/ProtocolManager.ts +9 -4
  7. package/changelog/v1.json +17 -0
  8. package/docs/development/database-schema.dbml +2 -0
  9. package/docs/self-hosting/environment-variables/basic.mdx +49 -3
  10. package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +49 -4
  11. package/locales/ar/chat.json +1 -0
  12. package/locales/ar/discover.json +45 -0
  13. package/locales/ar/marketAuth.json +42 -0
  14. package/locales/ar/setting.json +94 -1
  15. package/locales/ar/topic.json +1 -0
  16. package/locales/bg-BG/chat.json +1 -0
  17. package/locales/bg-BG/discover.json +45 -0
  18. package/locales/bg-BG/marketAuth.json +42 -0
  19. package/locales/bg-BG/setting.json +94 -1
  20. package/locales/bg-BG/topic.json +1 -0
  21. package/locales/de-DE/chat.json +1 -0
  22. package/locales/de-DE/discover.json +45 -0
  23. package/locales/de-DE/marketAuth.json +42 -0
  24. package/locales/de-DE/setting.json +94 -1
  25. package/locales/de-DE/topic.json +1 -0
  26. package/locales/en-US/chat.json +1 -0
  27. package/locales/en-US/discover.json +45 -0
  28. package/locales/en-US/marketAuth.json +42 -0
  29. package/locales/en-US/setting.json +94 -1
  30. package/locales/en-US/topic.json +1 -0
  31. package/locales/es-ES/chat.json +1 -0
  32. package/locales/es-ES/discover.json +45 -0
  33. package/locales/es-ES/marketAuth.json +42 -0
  34. package/locales/es-ES/setting.json +94 -1
  35. package/locales/es-ES/topic.json +1 -0
  36. package/locales/fa-IR/chat.json +1 -0
  37. package/locales/fa-IR/discover.json +45 -0
  38. package/locales/fa-IR/marketAuth.json +42 -0
  39. package/locales/fa-IR/setting.json +94 -1
  40. package/locales/fa-IR/topic.json +1 -0
  41. package/locales/fr-FR/chat.json +1 -0
  42. package/locales/fr-FR/discover.json +45 -0
  43. package/locales/fr-FR/marketAuth.json +42 -0
  44. package/locales/fr-FR/setting.json +94 -1
  45. package/locales/fr-FR/topic.json +1 -0
  46. package/locales/it-IT/chat.json +1 -0
  47. package/locales/it-IT/discover.json +45 -0
  48. package/locales/it-IT/marketAuth.json +42 -0
  49. package/locales/it-IT/setting.json +94 -1
  50. package/locales/it-IT/topic.json +1 -0
  51. package/locales/ja-JP/chat.json +1 -0
  52. package/locales/ja-JP/discover.json +45 -0
  53. package/locales/ja-JP/marketAuth.json +42 -0
  54. package/locales/ja-JP/setting.json +94 -1
  55. package/locales/ja-JP/topic.json +1 -0
  56. package/locales/ko-KR/chat.json +1 -0
  57. package/locales/ko-KR/discover.json +45 -0
  58. package/locales/ko-KR/marketAuth.json +42 -0
  59. package/locales/ko-KR/setting.json +94 -1
  60. package/locales/ko-KR/topic.json +1 -0
  61. package/locales/nl-NL/chat.json +1 -0
  62. package/locales/nl-NL/discover.json +45 -0
  63. package/locales/nl-NL/marketAuth.json +42 -0
  64. package/locales/nl-NL/setting.json +94 -1
  65. package/locales/nl-NL/topic.json +1 -0
  66. package/locales/pl-PL/chat.json +1 -0
  67. package/locales/pl-PL/discover.json +45 -0
  68. package/locales/pl-PL/marketAuth.json +42 -0
  69. package/locales/pl-PL/setting.json +94 -1
  70. package/locales/pl-PL/topic.json +1 -0
  71. package/locales/pt-BR/chat.json +1 -0
  72. package/locales/pt-BR/discover.json +45 -0
  73. package/locales/pt-BR/marketAuth.json +42 -0
  74. package/locales/pt-BR/setting.json +94 -1
  75. package/locales/pt-BR/topic.json +1 -0
  76. package/locales/ru-RU/chat.json +1 -0
  77. package/locales/ru-RU/discover.json +45 -0
  78. package/locales/ru-RU/marketAuth.json +42 -0
  79. package/locales/ru-RU/setting.json +94 -1
  80. package/locales/ru-RU/topic.json +1 -0
  81. package/locales/tr-TR/chat.json +1 -0
  82. package/locales/tr-TR/discover.json +45 -0
  83. package/locales/tr-TR/marketAuth.json +42 -0
  84. package/locales/tr-TR/setting.json +94 -1
  85. package/locales/tr-TR/topic.json +1 -0
  86. package/locales/vi-VN/chat.json +1 -0
  87. package/locales/vi-VN/discover.json +45 -0
  88. package/locales/vi-VN/marketAuth.json +42 -0
  89. package/locales/vi-VN/setting.json +94 -1
  90. package/locales/vi-VN/topic.json +1 -0
  91. package/locales/zh-CN/chat.json +1 -0
  92. package/locales/zh-CN/discover.json +45 -0
  93. package/locales/zh-CN/marketAuth.json +42 -0
  94. package/locales/zh-CN/setting.json +94 -1
  95. package/locales/zh-CN/topic.json +1 -0
  96. package/locales/zh-TW/chat.json +1 -0
  97. package/locales/zh-TW/discover.json +45 -0
  98. package/locales/zh-TW/marketAuth.json +42 -0
  99. package/locales/zh-TW/setting.json +94 -1
  100. package/locales/zh-TW/topic.json +1 -0
  101. package/package.json +34 -27
  102. package/packages/agent-runtime/src/core/InterventionChecker.ts +5 -16
  103. package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +27 -80
  104. package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +32 -13
  105. package/packages/agent-runtime/src/core/runtime.ts +7 -3
  106. package/packages/agent-runtime/src/types/event.ts +2 -1
  107. package/packages/agent-runtime/src/types/generalAgent.ts +1 -0
  108. package/packages/agent-runtime/src/types/instruction.ts +3 -2
  109. package/packages/agent-runtime/src/types/state.ts +3 -1
  110. package/packages/const/src/url.ts +1 -0
  111. package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +4 -1
  112. package/packages/database/migrations/0044_add_tool_intervention.sql +1 -0
  113. package/packages/database/migrations/0044_high_toxin.sql +1 -0
  114. package/packages/database/migrations/0045_add_tool_intervention.sql +1 -0
  115. package/packages/database/migrations/meta/0039_snapshot.json +1 -1
  116. package/packages/database/migrations/meta/0044_snapshot.json +7813 -0
  117. package/packages/database/migrations/meta/0045_snapshot.json +8431 -0
  118. package/packages/database/migrations/meta/_journal.json +14 -0
  119. package/packages/database/src/core/migrations.json +36 -7
  120. package/packages/database/src/models/message.ts +4 -1
  121. package/packages/database/src/models/session.ts +42 -1
  122. package/packages/database/src/schemas/agent.ts +1 -0
  123. package/packages/database/src/schemas/message.ts +5 -8
  124. package/packages/electron-client-ipc/src/events/index.ts +6 -1
  125. package/packages/electron-client-ipc/src/events/remoteServer.ts +8 -0
  126. package/packages/fetch-sse/package.json +29 -0
  127. package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/fetchSSE.test.ts +4 -4
  128. package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/parseError.test.ts +7 -4
  129. package/packages/{utils/src/fetch → fetch-sse/src}/fetchSSE.ts +2 -2
  130. package/packages/{utils/src/fetch → fetch-sse/src}/parseError.ts +3 -3
  131. package/packages/model-bank/src/aiModels/mistral.ts +2 -1
  132. package/packages/model-runtime/src/core/contextBuilders/anthropic.test.ts +17 -11
  133. package/packages/model-runtime/src/core/contextBuilders/anthropic.ts +1 -1
  134. package/packages/model-runtime/src/core/contextBuilders/google.test.ts +1 -1
  135. package/packages/model-runtime/src/core/contextBuilders/google.ts +3 -6
  136. package/packages/model-runtime/src/core/contextBuilders/openai.test.ts +4 -2
  137. package/packages/model-runtime/src/core/contextBuilders/openai.ts +1 -1
  138. package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts +1 -1
  139. package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +1 -1
  140. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +3 -6
  141. package/packages/model-runtime/src/core/streams/openai/responsesStream.test.ts +1 -1
  142. package/packages/model-runtime/src/helpers/mergeChatMethodOptions.ts +2 -1
  143. package/packages/model-runtime/src/providers/aihubmix/index.test.ts +1 -1
  144. package/packages/model-runtime/src/providers/anthropic/generateObject.test.ts +1 -1
  145. package/packages/model-runtime/src/providers/anthropic/index.test.ts +1 -1
  146. package/packages/model-runtime/src/providers/baichuan/index.test.ts +1 -1
  147. package/packages/model-runtime/src/providers/bedrock/index.test.ts +1 -1
  148. package/packages/model-runtime/src/providers/bfl/createImage.test.ts +4 -4
  149. package/packages/model-runtime/src/providers/bfl/createImage.ts +1 -1
  150. package/packages/model-runtime/src/providers/cloudflare/index.test.ts +1 -1
  151. package/packages/model-runtime/src/providers/cohere/index.test.ts +1 -1
  152. package/packages/model-runtime/src/providers/google/createImage.test.ts +2 -2
  153. package/packages/model-runtime/src/providers/google/createImage.ts +1 -1
  154. package/packages/model-runtime/src/providers/google/generateObject.test.ts +1 -1
  155. package/packages/model-runtime/src/providers/google/index.test.ts +1 -4
  156. package/packages/model-runtime/src/providers/groq/index.test.ts +1 -1
  157. package/packages/model-runtime/src/providers/hunyuan/index.test.ts +1 -1
  158. package/packages/model-runtime/src/providers/minimax/createImage.test.ts +1 -1
  159. package/packages/model-runtime/src/providers/mistral/index.test.ts +1 -1
  160. package/packages/model-runtime/src/providers/moonshot/index.test.ts +1 -1
  161. package/packages/model-runtime/src/providers/novita/index.test.ts +1 -1
  162. package/packages/model-runtime/src/providers/ollama/index.test.ts +43 -32
  163. package/packages/model-runtime/src/providers/ollama/index.ts +31 -7
  164. package/packages/model-runtime/src/providers/openrouter/index.test.ts +1 -1
  165. package/packages/model-runtime/src/providers/perplexity/index.test.ts +1 -1
  166. package/packages/model-runtime/src/providers/ppio/index.test.ts +1 -1
  167. package/packages/model-runtime/src/providers/qwen/createImage.test.ts +1 -1
  168. package/packages/model-runtime/src/providers/search1api/index.test.ts +1 -1
  169. package/packages/model-runtime/src/providers/siliconcloud/createImage.ts +1 -1
  170. package/packages/model-runtime/src/providers/taichu/index.test.ts +1 -1
  171. package/packages/model-runtime/src/providers/wenxin/index.test.ts +1 -1
  172. package/packages/model-runtime/src/providers/zhipu/index.test.ts +1 -1
  173. package/packages/model-runtime/src/utils/errorResponse.test.ts +1 -1
  174. package/packages/obervability-otel/src/node.ts +15 -1
  175. package/packages/ssrf-safe-fetch/index.browser.ts +14 -0
  176. package/packages/ssrf-safe-fetch/package.json +8 -1
  177. package/packages/types/src/discover/assistants.ts +16 -0
  178. package/packages/types/src/index.ts +1 -0
  179. package/packages/types/src/message/common/base.ts +2 -2
  180. package/packages/types/src/message/common/tools.ts +16 -0
  181. package/packages/types/src/message/db/item.ts +15 -1
  182. package/packages/types/src/message/ui/chat.ts +7 -1
  183. package/packages/types/src/message/ui/params.ts +15 -1
  184. package/packages/types/src/meta.ts +4 -0
  185. package/packages/types/src/session/agentSession.ts +2 -0
  186. package/packages/types/src/tool/intervention.ts +2 -3
  187. package/packages/types/src/user/settings/tool.ts +15 -28
  188. package/packages/utils/src/imageToBase64.ts +17 -10
  189. package/packages/utils/src/index.ts +1 -1
  190. package/renovate.json +28 -11
  191. package/src/app/(backend)/market/agent/[[...segments]]/route.ts +153 -0
  192. package/src/app/(backend)/market/oidc/[[...segments]]/route.ts +207 -0
  193. package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +1 -0
  194. package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +4 -2
  195. package/src/app/[variants]/(main)/chat/components/topic/features/Topic/TopicListContent/TopicItem/TopicContent.tsx +1 -1
  196. package/src/app/[variants]/(main)/chat/session/features/SessionListContent/List/Item/Actions.tsx +1 -1
  197. package/src/app/[variants]/(main)/chat/settings/features/AgentInfoDescription/index.tsx +349 -0
  198. package/src/app/[variants]/(main)/chat/settings/features/HeaderContent.tsx +2 -2
  199. package/src/app/[variants]/(main)/chat/settings/features/PublishResultModal/index.tsx +64 -0
  200. package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishButton.tsx +196 -0
  201. package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishModal.tsx +358 -0
  202. package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/index.tsx +75 -0
  203. package/src/app/[variants]/(main)/discover/(detail)/assistant/AssistantDetailPage.tsx +11 -2
  204. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/Client.tsx +12 -1
  205. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Nav.tsx +19 -12
  206. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/TagList.tsx +14 -5
  207. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/index.tsx +2 -0
  208. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Related/index.tsx +14 -5
  209. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/TagList.tsx +14 -5
  210. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/index.tsx +43 -29
  211. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Versions/index.tsx +137 -0
  212. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/index.tsx +2 -0
  213. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Header.tsx +9 -10
  214. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/ActionButton/AddAgent.tsx +105 -14
  215. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/Related/index.tsx +20 -6
  216. package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/StatusPage/index.tsx +113 -0
  217. package/src/app/[variants]/(main)/discover/(detail)/features/Breadcrumb.tsx +4 -3
  218. package/src/app/[variants]/(main)/discover/(list)/_layout/Desktop/Nav.tsx +3 -1
  219. package/src/app/[variants]/(main)/discover/(list)/assistant/AssistantPage.tsx +4 -1
  220. package/src/app/[variants]/(main)/discover/(list)/assistant/Client.tsx +6 -2
  221. package/src/app/[variants]/(main)/discover/(list)/assistant/features/Category/index.tsx +7 -3
  222. package/src/app/[variants]/(main)/discover/(list)/assistant/features/List/Item.tsx +13 -2
  223. package/src/app/[variants]/(main)/discover/(list)/assistant/features/MarketSourceSwitch.tsx +64 -0
  224. package/src/app/[variants]/(main)/discover/(list)/features/SortButton/index.tsx +26 -7
  225. package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +10 -10
  226. package/src/app/[variants]/(main)/settings/_layout/type.ts +1 -1
  227. package/src/app/[variants]/(main)/settings/agent/index.tsx +11 -10
  228. package/src/app/[variants]/(main)/settings/common/index.tsx +1 -1
  229. package/src/app/[variants]/(main)/settings/page.tsx +13 -10
  230. package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Item.tsx +35 -36
  231. package/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx +5 -5
  232. package/src/app/[variants]/(main)/settings/provider/_layout/Desktop/Container.tsx +10 -4
  233. package/src/app/market-auth-callback/layout.tsx +15 -0
  234. package/src/app/market-auth-callback/page.tsx +196 -0
  235. package/src/features/AgentSetting/AgentPrompt/TokenTag.tsx +3 -2
  236. package/src/features/AgentSetting/AgentTTS/SelectWithTTSPreview.tsx +1 -1
  237. package/src/features/AgentSetting/store/action.ts +1 -1
  238. package/src/features/ChatInput/ActionBar/STT/browser.tsx +1 -1
  239. package/src/features/ChatInput/ActionBar/STT/openai.tsx +1 -1
  240. package/src/features/Conversation/Messages/Group/GroupChildren.tsx +20 -15
  241. package/src/features/Conversation/Messages/Group/GroupContext.tsx +15 -0
  242. package/src/features/Conversation/Messages/Group/Tool/Inspector/BuiltinPluginTitle.tsx +2 -4
  243. package/src/features/Conversation/Messages/Group/Tool/Inspector/ToolTitle.tsx +3 -5
  244. package/src/features/Conversation/Messages/Group/Tool/Inspector/index.tsx +19 -7
  245. package/src/features/Conversation/Messages/Group/Tool/Render/Arguments/index.tsx +14 -12
  246. package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ApprovalActions.tsx +143 -0
  247. package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/KeyValueEditor.tsx +213 -0
  248. package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ModeSelector.tsx +134 -0
  249. package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/index.tsx +99 -0
  250. package/src/features/Conversation/Messages/Group/Tool/Render/RejectedResponse.tsx +45 -0
  251. package/src/features/Conversation/Messages/Group/Tool/Render/index.tsx +23 -1
  252. package/src/features/Conversation/Messages/Group/Tool/index.tsx +42 -18
  253. package/src/features/Conversation/Messages/Group/Tools.tsx +3 -1
  254. package/src/features/Conversation/components/Extras/TTS/InitPlayer.tsx +1 -1
  255. package/src/features/PluginTag/PluginStatus.tsx +1 -1
  256. package/src/hooks/useAgentOwnershipCheck.ts +143 -0
  257. package/src/instrumentation.node.ts +3 -2
  258. package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +364 -0
  259. package/src/layout/AuthProvider/MarketAuth/errors.ts +75 -0
  260. package/src/layout/AuthProvider/MarketAuth/index.ts +2 -0
  261. package/src/layout/AuthProvider/MarketAuth/oidc.ts +382 -0
  262. package/src/layout/AuthProvider/MarketAuth/types.ts +64 -0
  263. package/src/layout/AuthProvider/index.tsx +17 -4
  264. package/src/locales/default/chat.ts +22 -0
  265. package/src/locales/default/common.ts +1 -0
  266. package/src/locales/default/discover.ts +46 -0
  267. package/src/locales/default/index.ts +2 -0
  268. package/src/locales/default/marketAuth.ts +42 -0
  269. package/src/locales/default/setting.ts +94 -1
  270. package/src/locales/default/topic.ts +1 -0
  271. package/src/server/globalConfig/genServerAiProviderConfig.test.ts +5 -5
  272. package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
  273. package/src/server/routers/lambda/market/index.ts +36 -14
  274. package/src/server/routers/lambda/message.ts +6 -3
  275. package/src/server/services/discover/index.test.ts +153 -11
  276. package/src/server/services/discover/index.ts +339 -40
  277. package/src/server/services/message/index.ts +13 -0
  278. package/src/server/sitemap.ts +49 -35
  279. package/src/services/_url.ts +15 -1
  280. package/src/services/chat/chat.test.ts +5 -5
  281. package/src/services/chat/clientModelRuntime.test.ts +1 -1
  282. package/src/services/chat/index.ts +6 -6
  283. package/src/services/chat/types.ts +1 -2
  284. package/src/services/discover.ts +16 -5
  285. package/src/services/electron/remoteServer.ts +8 -1
  286. package/src/services/marketApi.ts +124 -0
  287. package/src/services/message/index.ts +17 -2
  288. package/src/services/models.ts +2 -1
  289. package/src/store/chat/agents/GeneralChatAgent.ts +141 -24
  290. package/src/store/chat/agents/__tests__/GeneralChatAgent.test.ts +605 -0
  291. package/src/store/chat/agents/createAgentExecutors.ts +144 -26
  292. package/src/store/chat/agents/createToolEngine.ts +22 -0
  293. package/src/store/chat/slices/aiChat/actions/conversationControl.ts +106 -0
  294. package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +54 -26
  295. package/src/store/chat/slices/message/reducer.ts +2 -1
  296. package/src/store/chat/slices/plugin/actions/optimisticUpdate.ts +26 -1
  297. package/src/store/discover/slices/assistant/action.ts +20 -7
  298. package/src/store/user/slices/settings/action.ts +15 -0
  299. package/{packages/utils/src → src/utils}/electron/desktopRemoteRPCFetch.ts +1 -1
  300. package/{packages/utils/src → src/utils/server}/parseModels.ts +1 -2
  301. package/vitest.config.mts +2 -0
  302. package/packages/model-runtime/src/utils/imageToBase64.test.ts +0 -91
  303. package/packages/model-runtime/src/utils/imageToBase64.ts +0 -62
  304. package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +0 -98
  305. package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/index.tsx +0 -35
  306. package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/style.ts +0 -47
  307. /package/packages/{utils/src/fetch → fetch-sse/src}/headers.ts +0 -0
  308. /package/packages/{utils/src/fetch → fetch-sse/src}/index.ts +0 -0
  309. /package/packages/{utils/src/fetch → fetch-sse/src}/request.ts +0 -0
  310. /package/{packages/utils/src → src/utils/server}/__snapshots__/parseModels.test.ts.snap +0 -0
  311. /package/{packages/utils/src → src/utils/server}/parseModels.test.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.47",
3
+ "version": "2.0.0-next.49",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -123,6 +123,9 @@
123
123
  "eslint --fix"
124
124
  ]
125
125
  },
126
+ "overrides": {
127
+ "eta": "4.0.1"
128
+ },
126
129
  "dependencies": {
127
130
  "@ant-design/icons": "^5.6.1",
128
131
  "@ant-design/pro-components": "^2.8.10",
@@ -133,17 +136,17 @@
133
136
  "@azure-rest/ai-inference": "1.0.0-beta.5",
134
137
  "@azure/core-auth": "^1.10.1",
135
138
  "@cfworker/json-schema": "^4.1.1",
136
- "@clerk/localizations": "^3.26.4",
137
- "@clerk/nextjs": "^6.34.1",
138
- "@clerk/themes": "^2.4.30",
139
+ "@clerk/localizations": "^3.27.2",
140
+ "@clerk/nextjs": "^6.35.0",
141
+ "@clerk/themes": "^2.4.35",
139
142
  "@codesandbox/sandpack-react": "^2.20.0",
140
143
  "@cyntler/react-doc-viewer": "^1.17.1",
141
144
  "@electric-sql/pglite": "0.2.17",
142
145
  "@emotion/react": "^11.14.0",
143
146
  "@fal-ai/client": "^1.7.2",
144
147
  "@formkit/auto-animate": "^0.9.0",
145
- "@google/genai": "^1.28.0",
146
- "@huggingface/inference": "^4.13.0",
148
+ "@google/genai": "^1.29.0",
149
+ "@huggingface/inference": "^4.13.2",
147
150
  "@icons-pack/react-simple-icons": "^13.8.0",
148
151
  "@khmyznikov/pwa-install": "0.3.9",
149
152
  "@langchain/community": "^0.3.57",
@@ -154,6 +157,7 @@
154
157
  "@lobechat/database": "workspace:*",
155
158
  "@lobechat/electron-client-ipc": "workspace:*",
156
159
  "@lobechat/electron-server-ipc": "workspace:*",
160
+ "@lobechat/fetch-sse": "workspace:*",
157
161
  "@lobechat/file-loaders": "workspace:*",
158
162
  "@lobechat/model-runtime": "workspace:*",
159
163
  "@lobechat/observability-otel": "workspace:*",
@@ -165,12 +169,12 @@
165
169
  "@lobehub/charts": "^2.1.2",
166
170
  "@lobehub/chat-plugin-sdk": "^1.32.4",
167
171
  "@lobehub/chat-plugins-gateway": "^1.9.0",
168
- "@lobehub/editor": "^1.21.2",
172
+ "@lobehub/editor": "^1.22.0",
169
173
  "@lobehub/icons": "^2.43.1",
170
- "@lobehub/market-sdk": "^0.22.7",
174
+ "@lobehub/market-sdk": "^0.23.0",
171
175
  "@lobehub/tts": "^2.0.1",
172
- "@lobehub/ui": "^2.13.5",
173
- "@modelcontextprotocol/sdk": "^1.20.2",
176
+ "@lobehub/ui": "^2.13.8",
177
+ "@modelcontextprotocol/sdk": "^1.21.1",
174
178
  "@neondatabase/serverless": "^1.0.2",
175
179
  "@next/third-parties": "^16.0.1",
176
180
  "@opentelemetry/exporter-jaeger": "^2.2.0",
@@ -180,19 +184,19 @@
180
184
  "@saintno/comfyui-sdk": "^0.2.49",
181
185
  "@serwist/next": "^9.2.1",
182
186
  "@t3-oss/env-nextjs": "^0.13.8",
183
- "@tanstack/react-query": "^5.90.6",
187
+ "@tanstack/react-query": "^5.90.7",
184
188
  "@trpc/client": "^11.7.1",
185
189
  "@trpc/next": "^11.7.1",
186
190
  "@trpc/react-query": "^11.7.1",
187
191
  "@trpc/server": "^11.7.1",
188
192
  "@vercel/analytics": "^1.5.0",
189
193
  "@vercel/edge-config": "^1.4.3",
190
- "@vercel/functions": "^3.1.4",
194
+ "@vercel/functions": "^3.3.0",
191
195
  "@vercel/speed-insights": "^1.2.0",
192
196
  "@virtuoso.dev/masonry": "^1.3.5",
193
197
  "@xterm/xterm": "^5.5.0",
194
198
  "ahooks": "^3.9.6",
195
- "antd": "^5.28.0",
199
+ "antd": "^5.28.1",
196
200
  "antd-style": "^3.7.1",
197
201
  "brotli-wasm": "^3.0.1",
198
202
  "chroma-js": "^3.1.2",
@@ -207,11 +211,11 @@
207
211
  "epub2": "^3.0.2",
208
212
  "fast-deep-equal": "^3.1.3",
209
213
  "fflate": "^0.8.2",
210
- "file-type": "^21.0.0",
214
+ "file-type": "^21.1.0",
211
215
  "framer-motion": "^12.23.24",
212
216
  "gray-matter": "^4.0.3",
213
217
  "html-to-text": "^9.0.5",
214
- "i18next": "^25.6.0",
218
+ "i18next": "^25.6.2",
215
219
  "i18next-browser-languagedetector": "^8.2.0",
216
220
  "i18next-resources-to-backend": "^1.2.1",
217
221
  "idb-keyval": "^6.2.2",
@@ -227,7 +231,7 @@
227
231
  "lucide-react": "^0.548.0",
228
232
  "mammoth": "^1.11.0",
229
233
  "markdown-to-txt": "^2.0.1",
230
- "marked": "^16.4.1",
234
+ "marked": "^16.4.2",
231
235
  "mdast-util-to-markdown": "^2.1.2",
232
236
  "model-bank": "workspace:*",
233
237
  "modern-screenshot": "^4.6.6",
@@ -238,7 +242,7 @@
238
242
  "nextjs-toploader": "^3.9.17",
239
243
  "node-machine-id": "^1.1.12",
240
244
  "numeral": "^2.0.6",
241
- "nuqs": "^2.7.2",
245
+ "nuqs": "^2.7.3",
242
246
  "officeparser": "5.1.1",
243
247
  "oidc-provider": "^9.5.2",
244
248
  "ollama": "^0.6.2",
@@ -279,15 +283,15 @@
279
283
  "resolve-accept-language": "^3.1.13",
280
284
  "rtl-detect": "^1.1.2",
281
285
  "semver": "^7.7.3",
282
- "sharp": "^0.34.4",
283
- "shiki": "^3.14.0",
286
+ "sharp": "^0.34.5",
287
+ "shiki": "^3.15.0",
284
288
  "ssrf-safe-fetch": "workspace:*",
285
289
  "stripe": "^17.7.0",
286
290
  "superjson": "^2.2.5",
287
291
  "svix": "^1.81.0",
288
292
  "swr": "^2.3.6",
289
293
  "systemjs": "^6.15.1",
290
- "tokenx": "^1.2.0",
294
+ "tokenx": "^1.2.1",
291
295
  "ts-md5": "^2.0.1",
292
296
  "ua-parser-js": "^1.0.41",
293
297
  "unstructured-client": "^0.19.0",
@@ -304,7 +308,7 @@
304
308
  "devDependencies": {
305
309
  "@commitlint/cli": "^19.8.1",
306
310
  "@edge-runtime/vm": "^5.0.0",
307
- "@huggingface/tasks": "^0.19.61",
311
+ "@huggingface/tasks": "^0.19.63",
308
312
  "@lobechat/types": "workspace:*",
309
313
  "@lobehub/i18n-cli": "^1.25.1",
310
314
  "@lobehub/lint": "^1.26.2",
@@ -327,7 +331,7 @@
327
331
  "@types/json-schema": "^7.0.15",
328
332
  "@types/lodash": "^4.17.20",
329
333
  "@types/lodash-es": "^4.17.12",
330
- "@types/node": "^24.10.0",
334
+ "@types/node": "^24.10.1",
331
335
  "@types/numeral": "^2.0.5",
332
336
  "@types/oidc-provider": "^9.5.0",
333
337
  "@types/pdfkit": "^0.17.3",
@@ -355,7 +359,7 @@
355
359
  "drizzle-kit": "^0.31.6",
356
360
  "eslint": "^8.57.1",
357
361
  "eslint-plugin-mdx": "^3.6.2",
358
- "fake-indexeddb": "^6.2.4",
362
+ "fake-indexeddb": "^6.2.5",
359
363
  "fs-extra": "^11.3.2",
360
364
  "glob": "^11.0.3",
361
365
  "happy-dom": "^20.0.10",
@@ -370,7 +374,7 @@
370
374
  "node-fetch": "^3.3.2",
371
375
  "node-gyp": "^11.5.0",
372
376
  "openapi-typescript": "^7.10.1",
373
- "p-map": "^7.0.3",
377
+ "p-map": "^7.0.4",
374
378
  "prettier": "^3.6.2",
375
379
  "remark-cli": "^12.0.1",
376
380
  "remark-frontmatter": "^5.0.0",
@@ -381,11 +385,11 @@
381
385
  "serwist": "^9.2.1",
382
386
  "stylelint": "^15.11.0",
383
387
  "tsx": "^4.20.6",
384
- "type-fest": "^5.1.0",
388
+ "type-fest": "^5.2.0",
385
389
  "typescript": "^5.9.3",
386
390
  "unified": "^11.0.5",
387
391
  "unist-util-visit": "^5.0.0",
388
- "vite": "^7.1.12",
392
+ "vite": "^7.2.2",
389
393
  "vitest": "^3.2.4"
390
394
  },
391
395
  "packageManager": "pnpm@10.20.0",
@@ -396,6 +400,9 @@
396
400
  "pnpm": {
397
401
  "onlyBuiltDependencies": [
398
402
  "@vercel/speed-insights"
399
- ]
403
+ ],
404
+ "overrides": {
405
+ "eta": "4.0.1"
406
+ }
400
407
  }
401
408
  }
@@ -17,36 +17,25 @@ export class InterventionChecker {
17
17
  * @returns Policy to apply
18
18
  */
19
19
  static shouldIntervene(params: ShouldInterveneParams): HumanInterventionPolicy {
20
- const { config, toolArgs = {}, confirmedHistory = [], toolKey } = params;
20
+ const { config, toolArgs = {} } = params;
21
21
 
22
22
  // No config means never intervene (auto-execute)
23
23
  if (!config) return 'never';
24
24
 
25
25
  // Simple policy string
26
26
  if (typeof config === 'string') {
27
- // For 'first' policy, check if already confirmed
28
- if (config === 'first' && toolKey && confirmedHistory.includes(toolKey)) {
29
- return 'never';
30
- }
31
27
  return config;
32
28
  }
33
29
 
34
30
  // Array of rules - find first matching rule
35
31
  for (const rule of config) {
36
32
  if (this.matchesRule(rule, toolArgs)) {
37
- const policy = rule.policy;
38
-
39
- // For 'first' policy, check if already confirmed
40
- if (policy === 'first' && toolKey && confirmedHistory.includes(toolKey)) {
41
- return 'never';
42
- }
43
-
44
- return policy;
33
+ return rule.policy;
45
34
  }
46
35
  }
47
36
 
48
- // No rule matched - default to always for safety
49
- return 'always';
37
+ // No rule matched - default to require for safety
38
+ return 'require';
50
39
  }
51
40
 
52
41
  /**
@@ -151,7 +140,7 @@ export class InterventionChecker {
151
140
  }
152
141
 
153
142
  /**
154
- * Generate simple hash of arguments for 'once' policy
143
+ * Generate simple hash of arguments for tool tracking
155
144
  *
156
145
  * @param args - Tool call arguments
157
146
  * @returns Hash string
@@ -12,43 +12,16 @@ describe('InterventionChecker', () => {
12
12
 
13
13
  it('should return the policy when config is a simple string', () => {
14
14
  expect(InterventionChecker.shouldIntervene({ config: 'never', toolArgs: {} })).toBe('never');
15
- expect(InterventionChecker.shouldIntervene({ config: 'always', toolArgs: {} })).toBe(
16
- 'always',
15
+ expect(InterventionChecker.shouldIntervene({ config: 'require', toolArgs: {} })).toBe(
16
+ 'require',
17
17
  );
18
- expect(InterventionChecker.shouldIntervene({ config: 'first', toolArgs: {} })).toBe('first');
19
- });
20
-
21
- it('should handle "first" policy with confirmed history', () => {
22
- const toolKey = 'web-browsing/crawlSinglePage';
23
- const confirmedHistory = [toolKey];
24
-
25
- const result = InterventionChecker.shouldIntervene({
26
- config: 'first',
27
- toolArgs: {},
28
- confirmedHistory,
29
- toolKey,
30
- });
31
- expect(result).toBe('never');
32
- });
33
-
34
- it('should require intervention for "first" policy without confirmation', () => {
35
- const toolKey = 'web-browsing/crawlSinglePage';
36
- const confirmedHistory: string[] = [];
37
-
38
- const result = InterventionChecker.shouldIntervene({
39
- config: 'first',
40
- toolArgs: {},
41
- confirmedHistory,
42
- toolKey,
43
- });
44
- expect(result).toBe('first');
45
18
  });
46
19
 
47
20
  it('should match rules in order and return first match', () => {
48
21
  const config: HumanInterventionConfig = [
49
22
  { match: { command: 'ls:*' }, policy: 'never' },
50
- { match: { command: 'git commit:*' }, policy: 'first' },
51
- { policy: 'always' }, // Default rule
23
+ { match: { command: 'git commit:*' }, policy: 'require' },
24
+ { policy: 'require' }, // Default rule
52
25
  ];
53
26
 
54
27
  expect(InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'ls:' } })).toBe(
@@ -56,20 +29,20 @@ describe('InterventionChecker', () => {
56
29
  );
57
30
  expect(
58
31
  InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'git commit:' } }),
59
- ).toBe('first');
32
+ ).toBe('require');
60
33
  expect(
61
34
  InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'rm -rf /' } }),
62
- ).toBe('always');
35
+ ).toBe('require');
63
36
  });
64
37
 
65
- it('should return always as default when no rule matches', () => {
38
+ it('should return require as default when no rule matches', () => {
66
39
  const config: HumanInterventionConfig = [{ match: { command: 'ls:*' }, policy: 'never' }];
67
40
 
68
41
  const result = InterventionChecker.shouldIntervene({
69
42
  config,
70
43
  toolArgs: { command: 'rm -rf /' },
71
44
  });
72
- expect(result).toBe('always');
45
+ expect(result).toBe('require');
73
46
  });
74
47
 
75
48
  it('should handle multiple parameter matching', () => {
@@ -81,7 +54,7 @@ describe('InterventionChecker', () => {
81
54
  },
82
55
  policy: 'never',
83
56
  },
84
- { policy: 'always' },
57
+ { policy: 'require' },
85
58
  ];
86
59
 
87
60
  // Both match
@@ -104,20 +77,20 @@ describe('InterventionChecker', () => {
104
77
  path: '/tmp/file.ts',
105
78
  },
106
79
  }),
107
- ).toBe('always');
80
+ ).toBe('require');
108
81
  });
109
82
 
110
83
  it('should handle default rule without match', () => {
111
84
  const config: HumanInterventionConfig = [
112
85
  { match: { command: 'ls:*' }, policy: 'never' },
113
- { policy: 'first' }, // Default rule
86
+ { policy: 'require' }, // Default rule
114
87
  ];
115
88
 
116
89
  const result = InterventionChecker.shouldIntervene({
117
90
  config,
118
91
  toolArgs: { command: 'anything' },
119
92
  });
120
- expect(result).toBe('first');
93
+ expect(result).toBe('require');
121
94
  });
122
95
  });
123
96
 
@@ -249,10 +222,10 @@ describe('InterventionChecker', () => {
249
222
  it('should handle Bash tool scenario', () => {
250
223
  const config: HumanInterventionConfig = [
251
224
  { match: { command: 'ls:*' }, policy: 'never' },
252
- { match: { command: 'git add:*' }, policy: 'first' },
253
- { match: { command: 'git commit:*' }, policy: 'first' },
254
- { match: { command: 'rm:*' }, policy: 'always' },
255
- { policy: 'always' },
225
+ { match: { command: 'git add:*' }, policy: 'require' },
226
+ { match: { command: 'git commit:*' }, policy: 'require' },
227
+ { match: { command: 'rm:*' }, policy: 'require' },
228
+ { policy: 'require' },
256
229
  ];
257
230
 
258
231
  // Safe commands - never
@@ -260,27 +233,27 @@ describe('InterventionChecker', () => {
260
233
  'never',
261
234
  );
262
235
 
263
- // Git commands - first
236
+ // Git commands - require
264
237
  expect(
265
238
  InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'git add:.' } }),
266
- ).toBe('first');
239
+ ).toBe('require');
267
240
  expect(
268
241
  InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'git commit:-m' } }),
269
- ).toBe('first');
242
+ ).toBe('require');
270
243
 
271
- // Dangerous commands - always
244
+ // Dangerous commands - require
272
245
  expect(InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'rm:-rf' } })).toBe(
273
- 'always',
246
+ 'require',
274
247
  );
275
248
  expect(
276
249
  InterventionChecker.shouldIntervene({ config, toolArgs: { command: 'npm install' } }),
277
- ).toBe('always');
250
+ ).toBe('require');
278
251
  });
279
252
 
280
253
  it('should handle LocalSystem tool scenario', () => {
281
254
  const config: HumanInterventionConfig = [
282
255
  { match: { path: '/Users/project/*' }, policy: 'never' },
283
- { policy: 'first' },
256
+ { policy: 'require' },
284
257
  ];
285
258
 
286
259
  // Project directory - never
@@ -291,44 +264,18 @@ describe('InterventionChecker', () => {
291
264
  }),
292
265
  ).toBe('never');
293
266
 
294
- // Outside project - first
267
+ // Outside project - require
295
268
  expect(
296
269
  InterventionChecker.shouldIntervene({ config, toolArgs: { path: '/tmp/file.ts' } }),
297
- ).toBe('first');
270
+ ).toBe('require');
298
271
  });
299
272
 
300
273
  it('should handle Web Browsing tool with simple policy', () => {
301
- const config: HumanInterventionConfig = 'always';
274
+ const config: HumanInterventionConfig = 'require';
302
275
 
303
276
  expect(
304
277
  InterventionChecker.shouldIntervene({ config, toolArgs: { url: 'https://example.com' } }),
305
- ).toBe('always');
306
- });
307
-
308
- it('should handle first policy with confirmation history', () => {
309
- const config: HumanInterventionConfig = [
310
- { match: { command: 'git add:*' }, policy: 'first' },
311
- { policy: 'always' },
312
- ];
313
-
314
- const toolKey = 'bash/bash#abc123';
315
- const args = { command: 'git add:.' };
316
-
317
- // First time - requires intervention
318
- expect(
319
- InterventionChecker.shouldIntervene({
320
- config,
321
- toolArgs: args,
322
- confirmedHistory: [],
323
- toolKey,
324
- }),
325
- ).toBe('first');
326
-
327
- // After confirmation - never
328
- const confirmedHistory = [toolKey];
329
- expect(
330
- InterventionChecker.shouldIntervene({ config, toolArgs: args, confirmedHistory, toolKey }),
331
- ).toBe('never');
278
+ ).toBe('require');
332
279
  });
333
280
  });
334
281
  });
@@ -1,3 +1,4 @@
1
+ import { ChatToolPayload } from '@lobechat/types';
1
2
  import { describe, expect, it, vi } from 'vitest';
2
3
 
3
4
  import {
@@ -344,9 +345,11 @@ describe('AgentRuntime', () => {
344
345
  type: 'request_human_approve',
345
346
  pendingToolsCalling: [
346
347
  {
348
+ apiName: 'test_tool',
349
+ arguments: '{}',
347
350
  id: 'call_123',
348
- type: 'function',
349
- function: { name: 'test_tool', arguments: '{}' },
351
+ identifier: 'test_tool',
352
+ type: 'default',
350
353
  },
351
354
  ],
352
355
  }),
@@ -357,14 +360,11 @@ describe('AgentRuntime', () => {
357
360
 
358
361
  const result = await runtime.step(state);
359
362
 
360
- expect(result.events).toHaveLength(2);
363
+ expect(result.events).toHaveLength(1);
361
364
  expect(result.events[0]).toMatchObject({
362
365
  type: 'human_approve_required',
363
366
  sessionId: 'test-session',
364
367
  });
365
- expect(result.events[1]).toMatchObject({
366
- type: 'tool_pending',
367
- });
368
368
 
369
369
  expect(result.newState.status).toBe('waiting_for_human');
370
370
  expect(result.newState.pendingToolsCalling).toBeDefined();
@@ -947,12 +947,29 @@ describe('AgentRuntime', () => {
947
947
  case 'llm_result':
948
948
  const llmPayload = context.payload as { result: any; hasToolCalls: boolean };
949
949
  if (llmPayload.hasToolCalls) {
950
+ // Convert OpenAI format tool_calls to ChatToolPayload format
951
+ const pendingToolsCalling = llmPayload.result.tool_calls.map((tc: any) => ({
952
+ apiName: tc.function.name,
953
+ arguments: tc.function.arguments,
954
+ id: tc.id,
955
+ identifier: tc.function.name,
956
+ type: 'default' as const,
957
+ }));
950
958
  return Promise.resolve({
959
+ pendingToolsCalling,
951
960
  type: 'request_human_approve',
952
- pendingToolsCalling: llmPayload.result.tool_calls,
953
961
  });
954
962
  }
955
963
  return Promise.resolve({ type: 'finish', reason: 'completed', reasonDetail: 'Done' });
964
+ case 'human_approved_tool':
965
+ const approvedPayload = context.payload as { approvedToolCall: ChatToolPayload };
966
+ return Promise.resolve({
967
+ payload: {
968
+ parentMessageId: 'user-msg-id',
969
+ toolCalling: approvedPayload.approvedToolCall,
970
+ },
971
+ type: 'call_tool',
972
+ });
956
973
  case 'tool_result':
957
974
  return Promise.resolve({ type: 'call_llm', payload: { messages: state.messages } });
958
975
  default:
@@ -1021,10 +1038,10 @@ describe('AgentRuntime', () => {
1021
1038
  // Step 2: Approve and execute tool call
1022
1039
  const pendingToolCall = result.newState.pendingToolsCalling![0];
1023
1040
  const toolCall = {
1041
+ apiName: pendingToolCall.apiName,
1042
+ arguments: pendingToolCall.arguments,
1024
1043
  id: pendingToolCall.id,
1025
- apiName: pendingToolCall.function.name,
1026
- identifier: pendingToolCall.function.name,
1027
- arguments: pendingToolCall.function.arguments,
1044
+ identifier: pendingToolCall.identifier,
1028
1045
  type: 'default' as const,
1029
1046
  };
1030
1047
  result = await runtime.approveToolCall(result.newState, toolCall);
@@ -1203,9 +1220,11 @@ describe('AgentRuntime', () => {
1203
1220
  {
1204
1221
  pendingToolsCalling: [
1205
1222
  {
1223
+ apiName: 'danger_tool',
1224
+ arguments: '{}',
1206
1225
  id: 'call_danger',
1207
- type: 'function' as const,
1208
- function: { name: 'danger_tool', arguments: '{}' },
1226
+ identifier: 'danger_tool',
1227
+ type: 'default' as const,
1209
1228
  },
1210
1229
  ],
1211
1230
  type: 'request_human_approve' as const,
@@ -1233,7 +1252,7 @@ describe('AgentRuntime', () => {
1233
1252
 
1234
1253
  // Should have pending tool calls
1235
1254
  expect(result.newState.pendingToolsCalling).toHaveLength(1);
1236
- expect(result.newState.pendingToolsCalling![0].function.name).toBe('danger_tool');
1255
+ expect(result.newState.pendingToolsCalling![0].apiName).toBe('danger_tool');
1237
1256
 
1238
1257
  // Should have both tool_result and human_approve_required events
1239
1258
  expect(result.events).toContainEqual(expect.objectContaining({ type: 'tool_result' }));
@@ -85,12 +85,17 @@ export class AgentRuntime {
85
85
 
86
86
  // Handle human approved tool calls
87
87
  if (runtimeContext.phase === 'human_approved_tool') {
88
- const approvedPayload = runtimeContext.payload as { approvedToolCall: ChatToolPayload };
88
+ const approvedPayload = runtimeContext.payload as {
89
+ approvedToolCall: ChatToolPayload;
90
+ parentMessageId: string;
91
+ skipCreateToolMessage: boolean;
92
+ };
89
93
  const toolCalling = approvedPayload.approvedToolCall;
90
94
 
91
95
  rawInstructions = {
92
96
  payload: {
93
- parentMessageId: '', // Not required for approval flow
97
+ parentMessageId: approvedPayload.parentMessageId,
98
+ skipCreateToolMessage: approvedPayload.skipCreateToolMessage,
94
99
  toolCalling,
95
100
  },
96
101
  type: 'call_tool',
@@ -538,7 +543,6 @@ export class AgentRuntime {
538
543
  sessionId: newState.sessionId,
539
544
  type: 'human_approve_required',
540
545
  },
541
- { toolCalls: pendingToolsCalling, type: 'tool_pending' },
542
546
  ];
543
547
 
544
548
  return { events, newState };
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
2
  import type { AgentState, ToolsCalling } from './state';
3
+ import { ChatToolPayload } from '@/types/message';
3
4
 
4
5
  export interface AgentEventInit {
5
6
  type: 'init';
@@ -33,7 +34,7 @@ export interface AgentEventToolResult {
33
34
 
34
35
  export interface AgentEventHumanApproveRequired {
35
36
  type: 'human_approve_required';
36
- pendingToolsCalling: ToolsCalling[];
37
+ pendingToolsCalling: ChatToolPayload[];
37
38
  sessionId: string;
38
39
  }
39
40
 
@@ -18,6 +18,7 @@ export interface GeneralAgentCallLLMResultPayload {
18
18
 
19
19
  export interface GeneralAgentCallingToolInstructionPayload {
20
20
  parentMessageId: string;
21
+ skipCreateToolMessage?: boolean;
21
22
  toolCalling: ChatToolPayload;
22
23
  }
23
24
 
@@ -1,7 +1,7 @@
1
1
  import { ChatToolPayload, ModelUsage } from '@lobechat/types';
2
2
 
3
3
  import type { FinishReason } from './event';
4
- import { AgentState, ToolRegistry, ToolsCalling } from './state';
4
+ import { AgentState, ToolRegistry } from './state';
5
5
  import type { Cost, CostCalculationContext, Usage } from './usage';
6
6
 
7
7
  /**
@@ -137,8 +137,9 @@ export interface AgentInstructionRequestHumanSelect {
137
137
  }
138
138
 
139
139
  export interface AgentInstructionRequestHumanApprove {
140
- pendingToolsCalling: ToolsCalling[];
140
+ pendingToolsCalling: ChatToolPayload[];
141
141
  reason?: string;
142
+ skipCreateToolMessage?: boolean;
142
143
  type: 'request_human_approve';
143
144
  }
144
145
 
@@ -1,4 +1,6 @@
1
1
  /* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */
2
+ import { ChatToolPayload } from '@/types/message';
3
+
2
4
  import type { Cost, CostLimit, Usage } from './usage';
3
5
 
4
6
  /**
@@ -49,7 +51,7 @@ export interface AgentState {
49
51
  * When status is 'waiting_for_human', this stores pending requests
50
52
  * for human-in-the-loop operations.
51
53
  */
52
- pendingToolsCalling?: ToolsCalling[];
54
+ pendingToolsCalling?: ChatToolPayload[];
53
55
  pendingHumanPrompt?: { metadata?: Record<string, unknown>; prompt: string };
54
56
  pendingHumanSelect?: {
55
57
  metadata?: Record<string, unknown>;
@@ -45,6 +45,7 @@ export const MORE_FILE_PREVIEW_REQUEST_URL =
45
45
 
46
46
  export const AGENTS_INDEX_GITHUB = 'https://github.com/lobehub/lobe-chat-agents';
47
47
  export const AGENTS_INDEX_GITHUB_ISSUE = urlJoin(AGENTS_INDEX_GITHUB, 'issues/new');
48
+ export const AGENTS_OFFICIAL_URL = 'https://lobehub.com/agent';
48
49
 
49
50
  export const SESSION_CHAT_URL = (id: string = INBOX_SESSION_ID, mobile?: boolean) =>
50
51
  qs.stringifyUrl({
@@ -427,11 +427,14 @@ export class FlatListBuilder {
427
427
  if (toolMsg.error) result.error = toolMsg.error;
428
428
  if (toolMsg.pluginState) result.state = toolMsg.pluginState;
429
429
 
430
- return {
430
+ const toolWithResult: ChatToolPayloadWithResult = {
431
431
  ...tool,
432
+ intervention: toolMsg.pluginIntervention,
432
433
  result,
433
434
  result_msg_id: toolMsg.id,
434
435
  };
436
+
437
+ return toolWithResult;
435
438
  }
436
439
  return tool;
437
440
  }) || [];