@lobehub/lobehub 2.0.0-next.294 → 2.0.0-next.296

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 (249) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/apps/desktop/src/main/__mocks__/node-mac-permissions.ts +0 -1
  3. package/apps/desktop/src/main/__mocks__/setup.ts +0 -1
  4. package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -4
  5. package/apps/desktop/tsconfig.json +4 -10
  6. package/changelog/v1.json +18 -0
  7. package/e2e/scripts/setup.ts +45 -32
  8. package/locales/en-US/plugin.json +4 -0
  9. package/locales/zh-CN/plugin.json +4 -0
  10. package/package.json +1 -1
  11. package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +5 -5
  12. package/packages/agent-runtime/src/utils/stepContextComputer.test.ts +5 -5
  13. package/packages/builtin-tool-gtd/src/client/Inspector/index.ts +0 -4
  14. package/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx +1 -1
  15. package/packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx +39 -10
  16. package/packages/builtin-tool-gtd/src/client/Render/index.ts +0 -2
  17. package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx +26 -12
  18. package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts +5 -5
  19. package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/store.test.ts +14 -8
  20. package/packages/builtin-tool-gtd/src/executor/index.test.ts +48 -227
  21. package/packages/builtin-tool-gtd/src/executor/index.ts +15 -158
  22. package/packages/builtin-tool-gtd/src/manifest.ts +12 -42
  23. package/packages/builtin-tool-gtd/src/systemRole.ts +14 -8
  24. package/packages/builtin-tool-gtd/src/types.ts +47 -41
  25. package/packages/builtin-tool-memory/package.json +8 -0
  26. package/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsx +60 -0
  27. package/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsx +60 -0
  28. package/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsx +60 -0
  29. package/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsx +60 -0
  30. package/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsx +60 -0
  31. package/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsx +67 -0
  32. package/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsx +60 -0
  33. package/packages/builtin-tool-memory/src/client/Inspector/index.ts +35 -0
  34. package/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsx +17 -0
  35. package/packages/builtin-tool-memory/src/client/Intervention/index.ts +13 -0
  36. package/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsx +17 -0
  37. package/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsx +217 -0
  38. package/packages/builtin-tool-memory/src/client/Render/index.ts +15 -0
  39. package/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsx +17 -0
  40. package/packages/builtin-tool-memory/src/client/Streaming/index.ts +18 -0
  41. package/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsx +231 -0
  42. package/packages/builtin-tool-memory/src/client/components/index.ts +1 -0
  43. package/packages/builtin-tool-memory/src/client/index.ts +27 -0
  44. package/packages/builtin-tool-memory/src/executor/index.ts +9 -1
  45. package/packages/builtin-tool-memory/src/types.ts +61 -0
  46. package/packages/context-engine/src/providers/GTDTodoInjector.ts +15 -7
  47. package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json +4 -0
  48. package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +1 -0
  49. package/packages/database/src/models/__tests__/knowledgeBase.test.ts +1 -1
  50. package/packages/database/src/repositories/knowledge/index.ts +1 -4
  51. package/packages/prompts/src/prompts/gtd/index.test.ts +32 -16
  52. package/packages/prompts/src/prompts/gtd/index.ts +9 -5
  53. package/packages/types/src/discover/assistants.ts +2 -2
  54. package/packages/types/src/stepContext.ts +4 -1
  55. package/scripts/migrate-spa-navigation.ts +129 -0
  56. package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts +112 -109
  57. package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-user-topics/route.ts +125 -113
  58. package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-users/route.ts +74 -65
  59. package/src/app/[variants]/(auth)/auth-error/page.tsx +1 -1
  60. package/src/app/[variants]/(auth)/login/[[...login]]/page.tsx +1 -1
  61. package/src/app/[variants]/(auth)/next-auth/error/AuthErrorPage.tsx +1 -1
  62. package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +1 -1
  63. package/src/app/[variants]/(auth)/oauth/callback/error/page.tsx +1 -1
  64. package/src/app/[variants]/(auth)/oauth/callback/success/page.tsx +1 -1
  65. package/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx +1 -1
  66. package/src/app/[variants]/(auth)/reset-password/layout.tsx +1 -1
  67. package/src/app/[variants]/(auth)/reset-password/page.tsx +2 -2
  68. package/src/app/[variants]/(auth)/signin/layout.tsx +1 -1
  69. package/src/app/[variants]/(auth)/signin/useSignIn.ts +1 -1
  70. package/src/app/[variants]/(auth)/signup/[[...signup]]/BetterAuthSignUpForm.tsx +2 -2
  71. package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +1 -1
  72. package/src/app/[variants]/(auth)/signup/[[...signup]]/useSignUp.tsx +1 -1
  73. package/src/app/[variants]/(auth)/verify-email/layout.tsx +1 -1
  74. package/src/app/[variants]/(auth)/verify-email/page.tsx +2 -2
  75. package/src/app/[variants]/(main)/_layout/index.tsx +1 -1
  76. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/CronTopicGroup.tsx +1 -1
  77. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/AddTopicButon.tsx +1 -1
  78. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
  79. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
  80. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
  81. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useTopicNavigation.ts +1 -1
  82. package/src/app/[variants]/(main)/agent/features/TelemetryNotification.tsx +2 -3
  83. package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Nav.tsx +9 -9
  84. package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Versions/index.tsx +2 -3
  85. package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +1 -2
  86. package/src/app/[variants]/(main)/community/(detail)/features/ShareButton.tsx +2 -3
  87. package/src/app/[variants]/(main)/community/(detail)/features/Toc/Heading.tsx +2 -3
  88. package/src/app/[variants]/(main)/community/(detail)/mcp/features/Details/Versions/index.tsx +2 -2
  89. package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Nav.tsx +12 -11
  90. package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx +2 -3
  91. package/src/app/[variants]/(main)/community/(detail)/provider/features/Details/Nav.tsx +11 -10
  92. package/src/app/[variants]/(main)/community/(detail)/provider/features/Header.tsx +10 -9
  93. package/src/app/[variants]/(main)/community/(list)/(home)/index.tsx +1 -1
  94. package/src/app/[variants]/(main)/community/(list)/assistant/features/Category/useCategory.tsx +1 -1
  95. package/src/app/[variants]/(main)/community/(list)/features/SortButton/index.tsx +2 -3
  96. package/src/app/[variants]/(main)/community/_layout/Sidebar/Header/Nav.tsx +1 -1
  97. package/src/app/[variants]/(main)/community/features/CreateButton/Inner.tsx +1 -1
  98. package/src/app/[variants]/(main)/community/features/CreateButton/index.tsx +1 -1
  99. package/src/app/[variants]/(main)/community/features/Search.tsx +1 -2
  100. package/src/app/[variants]/(main)/community/features/Title.tsx +5 -5
  101. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +1 -1
  102. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
  103. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
  104. package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +1 -1
  105. package/src/app/[variants]/(main)/group/features/TelemetryNotification.tsx +2 -3
  106. package/src/app/[variants]/(main)/home/_layout/Body/Agent/AllAgentsDrawer/index.tsx +1 -1
  107. package/src/app/[variants]/(main)/hooks/useActiveTabKey.ts +6 -11
  108. package/src/app/[variants]/(main)/image/NotSupportClient.tsx +4 -3
  109. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx +1 -1
  110. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx +1 -1
  111. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx +1 -1
  112. package/src/app/[variants]/(main)/memory/(home)/features/RoleTagCloud/index.tsx +1 -1
  113. package/src/app/[variants]/(main)/memory/_layout/Sidebar/Header/Nav.tsx +1 -1
  114. package/src/app/[variants]/(main)/memory/features/SourceLink.tsx +1 -1
  115. package/src/app/[variants]/(main)/page/_layout/Body/AllPagesDrawer/index.tsx +1 -1
  116. package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +4 -2
  117. package/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx +30 -35
  118. package/src/app/[variants]/(main)/resource/library/_layout/Header/index.tsx +9 -11
  119. package/src/app/[variants]/(main)/settings/about/features/ItemCard.tsx +2 -3
  120. package/src/app/[variants]/(main)/settings/about/features/ItemLink.tsx +2 -3
  121. package/src/app/[variants]/(main)/settings/about/features/Version.tsx +6 -7
  122. package/src/app/[variants]/(main)/settings/features/SettingsContent.tsx +1 -1
  123. package/src/app/[variants]/(main)/settings/features/UpgradeAlert.tsx +4 -4
  124. package/src/app/[variants]/(main)/settings/provider/(list)/Footer.tsx +2 -2
  125. package/src/app/[variants]/(main)/settings/provider/detail/index.tsx +1 -1
  126. package/src/app/[variants]/(main)/settings/provider/detail/ollama/CheckError.tsx +1 -1
  127. package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +12 -6
  128. package/src/app/[variants]/(main)/settings/security/index.tsx +1 -1
  129. package/src/app/[variants]/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx +1 -1
  130. package/src/app/[variants]/(main)/settings/stats/features/rankings/AssistantsRank.tsx +1 -1
  131. package/src/app/[variants]/(main)/settings/stats/features/rankings/TopicsRank.tsx +1 -1
  132. package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -1
  133. package/src/app/[variants]/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx +1 -1
  134. package/src/app/[variants]/(mobile)/chat/settings/features/SettingButton.tsx +1 -1
  135. package/src/app/[variants]/(mobile)/router/index.tsx +1 -1
  136. package/src/app/[variants]/page.tsx +1 -1
  137. package/src/app/[variants]/router/index.tsx +1 -1
  138. package/src/components/404/index.tsx +4 -4
  139. package/src/components/Analytics/index.tsx +1 -1
  140. package/src/components/BrandWatermark/index.tsx +4 -4
  141. package/src/components/Branding/ProductLogo/Custom.tsx +1 -1
  142. package/src/components/Error/index.tsx +3 -4
  143. package/src/components/GoBack/index.tsx +2 -2
  144. package/src/components/LabsModal/LabCard.tsx +1 -1
  145. package/src/components/Link.tsx +25 -5
  146. package/src/components/OllamaSetupGuide/index.tsx +5 -4
  147. package/src/components/WebFavicon/index.tsx +1 -1
  148. package/src/components/client/ClientResponsiveContent/index.tsx +1 -1
  149. package/src/components/client/ClientResponsiveLayout.tsx +1 -1
  150. package/src/components/mdx/Image.tsx +1 -1
  151. package/src/components/mdx/Link.tsx +26 -9
  152. package/src/features/AlertBanner/CloudBanner.tsx +2 -3
  153. package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +8 -7
  154. package/src/features/ChatInput/ActionBar/Params/Controls.tsx +1 -3
  155. package/src/features/ChatInput/ActionBar/Token/index.tsx +1 -1
  156. package/src/features/ChatInput/Mobile/index.tsx +1 -1
  157. package/src/features/Conversation/ChatItem/components/MessageContent/index.tsx +1 -1
  158. package/src/features/Conversation/Error/OllamaBizError/index.tsx +1 -1
  159. package/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx +1 -2
  160. package/src/features/Conversation/Error/index.tsx +1 -1
  161. package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/Settings.tsx +1 -1
  162. package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx +11 -17
  163. package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/LoadingPlaceholder/index.tsx +13 -3
  164. package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsx +43 -0
  165. package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsx +59 -0
  166. package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsx +46 -0
  167. package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/index.tsx +13 -19
  168. package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +18 -18
  169. package/src/features/Conversation/Messages/AssistantGroup/index.tsx +1 -1
  170. package/src/features/Conversation/Messages/Tool/Tool/index.tsx +11 -10
  171. package/src/features/Conversation/Messages/components/SearchGrounding.tsx +1 -1
  172. package/src/features/Conversation/TodoProgress/index.tsx +56 -23
  173. package/src/features/DataImporter/Error.tsx +3 -3
  174. package/src/features/DevPanel/CacheViewer/cacheProvider.tsx +2 -1
  175. package/src/features/DevPanel/MetadataViewer/Og.tsx +1 -1
  176. package/src/features/DevPanel/features/FloatPanel.tsx +1 -1
  177. package/src/features/DevPanel/features/Table/TooltipContent.tsx +3 -4
  178. package/src/features/DevPanel/index.tsx +1 -1
  179. package/src/features/EditorCanvas/InlineToolbar.tsx +1 -6
  180. package/src/features/FileViewer/NotSupport/index.tsx +2 -3
  181. package/src/features/Follow/index.tsx +8 -9
  182. package/src/features/LibraryModal/AddFilesToKnowledgeBase/SelectForm.tsx +2 -2
  183. package/src/features/MCP/Scores.tsx +1 -1
  184. package/src/features/MCPPluginDetail/Nav.tsx +8 -8
  185. package/src/features/MCPPluginDetail/Overview/TagList.tsx +1 -1
  186. package/src/features/MobileTabBar/index.tsx +2 -1
  187. package/src/features/OllamaSetupGuide/Desktop.tsx +1 -2
  188. package/src/features/PWAInstall/Install.tsx +1 -1
  189. package/src/features/PWAInstall/index.tsx +1 -1
  190. package/src/features/PluginStore/McpList/index.tsx +1 -1
  191. package/src/features/PluginStore/PluginList/Detail/Header.tsx +6 -6
  192. package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
  193. package/src/features/PluginsUI/Render/MCPType/index.tsx +1 -1
  194. package/src/features/Portal/Artifacts/Body/Renderer/index.tsx +1 -1
  195. package/src/features/ResourceManager/components/ChunkDrawer/index.tsx +1 -1
  196. package/src/features/ResourceManager/components/Explorer/Header/index.tsx +57 -4
  197. package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +6 -4
  198. package/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx +26 -26
  199. package/src/features/ResourceManager/components/Explorer/ListView/index.tsx +16 -5
  200. package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +147 -149
  201. package/src/features/ResourceManager/components/LibraryHierarchy/styles.ts +5 -4
  202. package/src/features/ResourceManager/index.tsx +1 -1
  203. package/src/features/Setting/Footer.tsx +4 -5
  204. package/src/features/User/UserPanel/PanelContent.tsx +1 -1
  205. package/src/hooks/useActiveTabKey.ts +6 -4
  206. package/src/hooks/useIsSingleMode.test.ts +10 -24
  207. package/src/hooks/useIsSingleMode.ts +4 -2
  208. package/src/hooks/useIsSubSlug.ts +2 -1
  209. package/src/hooks/useQuery.ts +5 -5
  210. package/src/layout/GlobalProvider/AppTheme.tsx +2 -2
  211. package/src/layout/GlobalProvider/StyleRegistry.tsx +1 -1
  212. package/src/layout/GlobalProvider/useUserStateRedirect.ts +13 -25
  213. package/src/libs/next/Image.tsx +13 -0
  214. package/src/libs/next/Link.tsx +13 -0
  215. package/src/libs/next/dynamic.tsx +13 -0
  216. package/src/libs/next/index.ts +22 -0
  217. package/src/libs/next/navigation.ts +22 -0
  218. package/src/libs/router/Link.tsx +30 -0
  219. package/src/libs/router/index.ts +18 -0
  220. package/src/libs/router/navigation.ts +72 -0
  221. package/src/locales/default/plugin.ts +1 -0
  222. package/src/server/modules/AgentRuntime/AgentStateManager.ts +5 -1
  223. package/src/store/chat/slices/message/selectors/dbMessage.test.ts +11 -11
  224. package/src/store/chat/slices/portal/selectors.test.ts +5 -15
  225. package/src/store/file/slices/resource/action.ts +4 -2
  226. package/src/store/page/index.ts +1 -1
  227. package/src/store/page/slices/crud/index.ts +1 -1
  228. package/src/tools/inspectors.ts +2 -0
  229. package/src/tools/interventions.ts +2 -0
  230. package/src/tools/renders.ts +3 -1
  231. package/src/tools/streamings.ts +2 -0
  232. package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +0 -52
  233. package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +0 -52
  234. package/src/app/[variants]/(main)/hooks/usePathname.ts +0 -10
  235. package/src/app/[variants]/(main)/hooks/useQuery.ts +0 -12
  236. package/src/app/[variants]/(main)/hooks/useRouter.ts +0 -22
  237. package/src/app/[variants]/(main)/hooks/useSearchParams.ts +0 -11
  238. package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsx +0 -113
  239. package/src/features/Conversation/Messages/Tool/Tool/Render.tsx +0 -47
  240. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/AbortResponse.tsx +0 -0
  241. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Arguments/index.tsx +0 -0
  242. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/ErrorResponse.tsx +0 -0
  243. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ApprovalActions.tsx +0 -0
  244. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/Fallback.tsx +0 -0
  245. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/KeyValueEditor.tsx +0 -0
  246. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ModeSelector.tsx +0 -0
  247. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/index.tsx +0 -0
  248. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/PluginSettings.tsx +0 -0
  249. /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/RejectedResponse.tsx +0 -0
@@ -13,15 +13,15 @@ import { createStaticStyles, cx, useTheme } from 'antd-style';
13
13
  import 'antd/dist/reset.css';
14
14
  import { AppConfigContext } from 'antd/es/app/context';
15
15
  import * as motion from 'motion/react-m';
16
- import Image from 'next/image';
17
- import Link from 'next/link';
18
16
  import { type ReactNode, memo, useEffect, useMemo, useState } from 'react';
19
17
 
20
18
  import AntdStaticMethods from '@/components/AntdStaticMethods';
19
+ import Link from '@/components/Link';
21
20
  import { LOBE_THEME_NEUTRAL_COLOR, LOBE_THEME_PRIMARY_COLOR } from '@/const/theme';
22
21
  import { isDesktop } from '@/const/version';
23
22
  import { useIsDark } from '@/hooks/useIsDark';
24
23
  import { getUILocaleAndResources } from '@/libs/getUILocaleAndResources';
24
+ import Image from '@/libs/next/Image';
25
25
  import { useGlobalStore } from '@/store/global';
26
26
  import { systemStatusSelectors } from '@/store/global/selectors';
27
27
  import { useUserStore } from '@/store/user';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { StyleProvider } from 'antd-style';
4
- import { useServerInsertedHTML } from 'next/navigation';
4
+ import { useServerInsertedHTML } from '@/libs/next/navigation';
5
5
  import { type PropsWithChildren } from 'react';
6
6
 
7
7
  import { isDesktop } from '@/const/version';
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  import { OFFICIAL_URL } from '@lobechat/const';
4
- import { usePathname } from 'next/navigation';
5
4
  import { useCallback } from 'react';
6
5
 
7
6
  import { getDesktopOnboardingCompleted } from '@/app/[variants]/(desktop)/desktop-onboarding/storage';
@@ -11,20 +10,12 @@ import { useUserStore } from '@/store/user';
11
10
  import { onboardingSelectors } from '@/store/user/selectors';
12
11
  import type { UserInitializationState } from '@/types/user';
13
12
 
14
- const redirectIfNotOn = (currentPath: string | null | undefined, path: string) => {
15
- if (!currentPath?.startsWith(path)) {
13
+ const redirectIfNotOn = (currentPath: string, path: string) => {
14
+ if (!currentPath.startsWith(path)) {
16
15
  window.location.href = path;
17
16
  }
18
17
  };
19
18
 
20
- const useCurrentPathname = () => {
21
- const pathname = usePathname();
22
- return useCallback(() => {
23
- if (typeof window === 'undefined') return pathname;
24
- return window.location.pathname || pathname;
25
- }, [pathname]);
26
- };
27
-
28
19
  export const useDesktopUserStateRedirect = () => {
29
20
  const dataSyncConfig = useElectronStore((s) => s.dataSyncConfig);
30
21
  const logout = useUserStore((s) => s.logout);
@@ -69,25 +60,22 @@ export const useDesktopUserStateRedirect = () => {
69
60
  );
70
61
  };
71
62
 
72
- export const useWebUserStateRedirect = (getCurrentPathname: () => string | null | undefined) =>
73
- useCallback(
74
- (state: UserInitializationState) => {
75
- if (state.isInWaitList === true) {
76
- redirectIfNotOn(getCurrentPathname(), '/waitlist');
77
- return;
78
- }
63
+ export const useWebUserStateRedirect = () =>
64
+ useCallback((state: UserInitializationState) => {
65
+ const pathname = window.location.pathname;
66
+ if (state.isInWaitList === true) {
67
+ redirectIfNotOn(pathname, '/waitlist');
68
+ return;
69
+ }
79
70
 
80
- if (!onboardingSelectors.needsOnboarding(state)) return;
71
+ if (!onboardingSelectors.needsOnboarding(state)) return;
81
72
 
82
- redirectIfNotOn(getCurrentPathname(), '/onboarding');
83
- },
84
- [getCurrentPathname],
85
- );
73
+ redirectIfNotOn(pathname, '/onboarding');
74
+ }, []);
86
75
 
87
76
  export const useUserStateRedirect = () => {
88
- const getCurrentPathname = useCurrentPathname();
89
77
  const desktopRedirect = useDesktopUserStateRedirect();
90
- const webRedirect = useWebUserStateRedirect(getCurrentPathname);
78
+ const webRedirect = useWebUserStateRedirect();
91
79
 
92
80
  return useCallback(
93
81
  (state: UserInitializationState) => {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Image component wrapper for Next.js Image.
3
+ * This module provides a unified interface that can be easily replaced
4
+ * with a generic <img> or custom image component in the future.
5
+ *
6
+ * @see Phase 3.4: LOBE-2991
7
+ */
8
+
9
+ // Re-export the Image component
10
+
11
+ // Re-export types
12
+ export type { ImageProps, StaticImageData } from 'next/image';
13
+ export { default } from 'next/image';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Link component wrapper for Next.js Link.
3
+ * This module provides a unified interface that can be easily replaced
4
+ * with react-router-dom Link in the future.
5
+ *
6
+ * @see Phase 3.2: LOBE-2989
7
+ */
8
+
9
+ // Re-export the Link component
10
+
11
+ // Re-export the type for props
12
+ export type { LinkProps } from 'next/link';
13
+ export { default } from 'next/link';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Dynamic import wrapper for Next.js dynamic.
3
+ * This module provides a unified interface that can be easily replaced
4
+ * with React.lazy + Suspense in the future.
5
+ *
6
+ * @see Phase 3.3: LOBE-2990
7
+ */
8
+
9
+ // Re-export the dynamic function
10
+
11
+ // Re-export types
12
+ export type { DynamicOptions, Loader, LoaderComponent } from 'next/dynamic';
13
+ export { default } from 'next/dynamic';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Next.js wrapper module
3
+ *
4
+ * This module provides unified interfaces for Next.js-specific APIs,
5
+ * making it easier to migrate from Next.js to other frameworks (e.g., Vite + React Router).
6
+ *
7
+ * Usage:
8
+ * - import { useRouter, usePathname } from '@/libs/next/navigation';
9
+ * - import Link from '@/libs/next/Link';
10
+ * - import dynamic from '@/libs/next/dynamic';
11
+ * - import Image from '@/libs/next/Image';
12
+ *
13
+ * @see RFC 147: LOBE-2850 - Phase 3
14
+ */
15
+
16
+ // Navigation exports
17
+ export * from './navigation';
18
+
19
+ // Component exports (re-export as named for convenience)
20
+ export { default as dynamic } from './dynamic';
21
+ export { default as Image } from './Image';
22
+ export { default as Link } from './Link';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Navigation utilities wrapper for Next.js navigation APIs.
3
+ * This module provides a unified interface that can be easily replaced
4
+ * with react-router-dom in the future.
5
+ *
6
+ * @see Phase 3.1: LOBE-2988
7
+ */
8
+
9
+ // Re-export all navigation hooks and utilities from Next.js
10
+ export {
11
+ notFound,
12
+ ReadonlyURLSearchParams,
13
+ redirect,
14
+ useParams,
15
+ usePathname,
16
+ useRouter,
17
+ useSearchParams,
18
+ useServerInsertedHTML,
19
+ } from 'next/navigation';
20
+
21
+ // Re-export types
22
+ export type { RedirectType } from 'next/navigation';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * React Router Link component wrapper.
3
+ * Provides a Next.js-like API (href prop) while using React Router internally.
4
+ *
5
+ * @see RFC 147: LOBE-2850 - Phase 3
6
+ */
7
+
8
+ import React, { memo } from 'react';
9
+ import { Link as ReactRouterLink, type LinkProps as ReactRouterLinkProps } from 'react-router-dom';
10
+
11
+ interface LinkProps extends Omit<ReactRouterLinkProps, 'to'> {
12
+ children?: React.ReactNode;
13
+ href?: string;
14
+ to?: string;
15
+ }
16
+
17
+ /**
18
+ * Link component for React Router.
19
+ * Provides a Next.js-like API (href prop) while using React Router internally.
20
+ */
21
+ const Link = memo<LinkProps>(({ href, to, ...props }) => {
22
+ const linkTo = href || to || '/';
23
+ return <ReactRouterLink {...props} to={linkTo} />;
24
+ });
25
+
26
+ Link.displayName = 'Link';
27
+
28
+ export default Link;
29
+
30
+ export type { LinkProps };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * React Router wrapper module for SPA routing.
3
+ *
4
+ * This module provides unified interfaces for React Router APIs,
5
+ * with a Next.js-like API surface for easier migration.
6
+ *
7
+ * Usage:
8
+ * - import { useRouter, usePathname, useSearchParams } from '@/libs/router';
9
+ * - import Link from '@/libs/router/Link';
10
+ *
11
+ * @see RFC 147: LOBE-2850 - Phase 3
12
+ */
13
+
14
+ // Navigation exports
15
+ export * from './navigation';
16
+
17
+ // Component exports
18
+ export { default as Link } from './Link';
@@ -0,0 +1,72 @@
1
+ /**
2
+ * React Router navigation hooks wrapper.
3
+ * This module provides unified navigation hooks for SPA routing.
4
+ *
5
+ * Usage:
6
+ * - import { useRouter, usePathname, useSearchParams, useQuery } from '@/libs/router/navigation';
7
+ *
8
+ * @see RFC 147: LOBE-2850 - Phase 3
9
+ */
10
+
11
+ import qs from 'query-string';
12
+ import { useMemo } from 'react';
13
+ import {
14
+ useLocation,
15
+ useNavigate,
16
+ useParams as useReactRouterParams,
17
+ useSearchParams as useReactRouterSearchParams,
18
+ } from 'react-router-dom';
19
+
20
+ /**
21
+ * Hook to get router navigation functions.
22
+ * Provides a Next.js-like API using React Router.
23
+ */
24
+ export const useRouter = () => {
25
+ const navigate = useNavigate();
26
+
27
+ return useMemo(
28
+ () => ({
29
+ back: () => navigate(-1),
30
+ forward: () => navigate(1),
31
+ // Note: prefetch is not supported in React Router
32
+ prefetch: () => {},
33
+ push: (href: string) => navigate(href),
34
+ replace: (href: string) => navigate(href, { replace: true }),
35
+ }),
36
+ [navigate]
37
+ );
38
+ };
39
+
40
+ /**
41
+ * Hook to get current pathname.
42
+ */
43
+ export const usePathname = () => {
44
+ const location = useLocation();
45
+ return location.pathname;
46
+ };
47
+
48
+ /**
49
+ * Hook to get search params.
50
+ * Returns [searchParams, setSearchParams] tuple similar to React Router.
51
+ */
52
+ export const useSearchParams = () => {
53
+ return useReactRouterSearchParams();
54
+ };
55
+
56
+ /**
57
+ * Hook to get route params.
58
+ */
59
+ export const useParams = <T extends Record<string, string | undefined> = Record<string, string | undefined>>() => {
60
+ return useReactRouterParams<T>();
61
+ };
62
+
63
+ /**
64
+ * Hook to get query parameters as a parsed object.
65
+ */
66
+ export const useQuery = () => {
67
+ const [searchParams] = useReactRouterSearchParams();
68
+ return useMemo(() => qs.parse(searchParams.toString()), [searchParams]);
69
+ };
70
+
71
+ // Re-export types
72
+ export type { Location, NavigateFunction, Params } from 'react-router-dom';
@@ -174,6 +174,7 @@ export default {
174
174
  'builtins.lobe-user-memory.apiName.removeIdentityMemory': 'Delete identity memory',
175
175
  'builtins.lobe-user-memory.apiName.searchUserMemory': 'Search memory',
176
176
  'builtins.lobe-user-memory.apiName.updateIdentityMemory': 'Update identity memory',
177
+ 'builtins.lobe-user-memory.inspector.noResults': 'No results',
177
178
  'builtins.lobe-user-memory.title': 'Memory',
178
179
  'builtins.lobe-web-browsing.apiName.crawlMultiPages': 'Read multiple pages',
179
180
  'builtins.lobe-web-browsing.apiName.crawlSinglePage': 'Read page content',
@@ -1,4 +1,8 @@
1
- import { type AgentEvent, type AgentRuntimeContext, type AgentState } from '@lobechat/agent-runtime';
1
+ import {
2
+ type AgentEvent,
3
+ type AgentRuntimeContext,
4
+ type AgentState,
5
+ } from '@lobechat/agent-runtime';
2
6
  import debug from 'debug';
3
7
  import type { Redis } from 'ioredis';
4
8
 
@@ -5,7 +5,7 @@ import { selectTodosFromMessages } from './dbMessage';
5
5
 
6
6
  describe('selectTodosFromMessages', () => {
7
7
  const createGTDToolMessage = (todos: {
8
- items: Array<{ text: string; completed: boolean }>;
8
+ items: Array<{ text: string; status: 'todo' | 'processing' | 'completed' }>;
9
9
  updatedAt: string;
10
10
  }): UIChatMessage =>
11
11
  ({
@@ -30,7 +30,7 @@ describe('selectTodosFromMessages', () => {
30
30
  content: 'Create a todo list',
31
31
  } as UIChatMessage,
32
32
  createGTDToolMessage({
33
- items: [{ text: 'Buy milk', completed: false }],
33
+ items: [{ text: 'Buy milk', status: 'todo' }],
34
34
  updatedAt: '2024-06-01T00:00:00.000Z',
35
35
  }),
36
36
  ];
@@ -40,13 +40,13 @@ describe('selectTodosFromMessages', () => {
40
40
  expect(result).toBeDefined();
41
41
  expect(result?.items).toHaveLength(1);
42
42
  expect(result?.items[0].text).toBe('Buy milk');
43
- expect(result?.items[0].completed).toBe(false);
43
+ expect(result?.items[0].status).toBe('todo');
44
44
  });
45
45
 
46
46
  it('should return the most recent todos when multiple GTD messages exist', () => {
47
47
  const messages: UIChatMessage[] = [
48
48
  createGTDToolMessage({
49
- items: [{ text: 'Old task', completed: false }],
49
+ items: [{ text: 'Old task', status: 'todo' }],
50
50
  updatedAt: '2024-01-01T00:00:00.000Z',
51
51
  }),
52
52
  {
@@ -56,8 +56,8 @@ describe('selectTodosFromMessages', () => {
56
56
  } as UIChatMessage,
57
57
  createGTDToolMessage({
58
58
  items: [
59
- { text: 'Old task', completed: true },
60
- { text: 'New task', completed: false },
59
+ { text: 'Old task', status: 'completed' },
60
+ { text: 'New task', status: 'todo' },
61
61
  ],
62
62
  updatedAt: '2024-06-01T00:00:00.000Z',
63
63
  }),
@@ -69,7 +69,7 @@ describe('selectTodosFromMessages', () => {
69
69
  expect(result?.items).toHaveLength(2);
70
70
  // Should be from the latest message
71
71
  expect(result?.items[0].text).toBe('Old task');
72
- expect(result?.items[0].completed).toBe(true);
72
+ expect(result?.items[0].status).toBe('completed');
73
73
  expect(result?.items[1].text).toBe('New task');
74
74
  });
75
75
 
@@ -155,7 +155,7 @@ describe('selectTodosFromMessages', () => {
155
155
  },
156
156
  pluginState: {
157
157
  todos: {
158
- items: [{ text: 'Task', completed: false }],
158
+ items: [{ text: 'Task', status: 'todo' }],
159
159
  // No updatedAt
160
160
  },
161
161
  },
@@ -184,8 +184,8 @@ describe('selectTodosFromMessages', () => {
184
184
  pluginState: {
185
185
  // Legacy format: direct array
186
186
  todos: [
187
- { text: 'Task 1', completed: false },
188
- { text: 'Task 2', completed: true },
187
+ { text: 'Task 1', status: 'todo' },
188
+ { text: 'Task 2', status: 'completed' },
189
189
  ],
190
190
  },
191
191
  } as unknown as UIChatMessage,
@@ -196,6 +196,6 @@ describe('selectTodosFromMessages', () => {
196
196
  expect(result).toBeDefined();
197
197
  expect(result?.items).toHaveLength(2);
198
198
  expect(result?.items[0].text).toBe('Task 1');
199
- expect(result?.items[1].completed).toBe(true);
199
+ expect(result?.items[1].status).toBe('completed');
200
200
  });
201
201
  });
@@ -111,9 +111,7 @@ describe('chatDockSelectors', () => {
111
111
 
112
112
  it('should return the messageId when ToolUI view is on stack', () => {
113
113
  const state = createState({
114
- portalStack: [
115
- { type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' },
116
- ],
114
+ portalStack: [{ type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' }],
117
115
  });
118
116
  expect(chatPortalSelectors.toolMessageId(state)).toBe('test-id');
119
117
  });
@@ -122,9 +120,7 @@ describe('chatDockSelectors', () => {
122
120
  describe('isMessageToolUIOpen', () => {
123
121
  it('should return false when id does not match or showDock is false', () => {
124
122
  const state = createState({
125
- portalStack: [
126
- { type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' },
127
- ],
123
+ portalStack: [{ type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' }],
128
124
  showPortal: false,
129
125
  });
130
126
  expect(chatPortalSelectors.isPluginUIOpen('test-id')(state)).toBe(false);
@@ -133,9 +129,7 @@ describe('chatDockSelectors', () => {
133
129
 
134
130
  it('should return true when id matches and showDock is true', () => {
135
131
  const state = createState({
136
- portalStack: [
137
- { type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' },
138
- ],
132
+ portalStack: [{ type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' }],
139
133
  showPortal: true,
140
134
  });
141
135
  expect(chatPortalSelectors.isPluginUIOpen('test-id')(state)).toBe(true);
@@ -149,9 +143,7 @@ describe('chatDockSelectors', () => {
149
143
 
150
144
  it('should return true when ToolUI view is on stack', () => {
151
145
  const state = createState({
152
- portalStack: [
153
- { type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' },
154
- ],
146
+ portalStack: [{ type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' }],
155
147
  });
156
148
  expect(chatPortalSelectors.showPluginUI(state)).toBe(true);
157
149
  });
@@ -164,9 +156,7 @@ describe('chatDockSelectors', () => {
164
156
 
165
157
  it('should return the identifier when ToolUI view is on stack', () => {
166
158
  const state = createState({
167
- portalStack: [
168
- { type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' },
169
- ],
159
+ portalStack: [{ type: PortalViewType.ToolUI, messageId: 'test-id', identifier: 'test' }],
170
160
  });
171
161
  expect(chatPortalSelectors.toolUIIdentifier(state)).toBe('test');
172
162
  });
@@ -239,9 +239,11 @@ export const createResourceSlice: StateCreator<
239
239
  'deleteResource/optimistic',
240
240
  );
241
241
 
242
- // 2. Enqueue sync (background)
242
+ // 2. Enqueue sync and await completion.
243
+ // Important: if callers revalidate the list immediately, doing so before the server-side
244
+ // deletion finishes can re-introduce the item from a still-stale query response.
243
245
  const syncEngine = getSyncEngine();
244
- syncEngine.enqueue({
246
+ await syncEngine.enqueue({
245
247
  id: `sync-${id}-${Date.now()}`,
246
248
  payload: {},
247
249
  resourceId: id,
@@ -1,2 +1,2 @@
1
1
  export * from './selectors';
2
- export { getPageStoreState, type PageStore,usePageStore } from './store';
2
+ export { getPageStoreState, type PageStore, usePageStore } from './store';
@@ -1,2 +1,2 @@
1
1
  export { createCrudSlice, type CrudAction } from './action';
2
- export { type CrudState,initialCrudState } from './initialState';
2
+ export { type CrudState, initialCrudState } from './initialState';
@@ -23,6 +23,7 @@ import {
23
23
  LocalSystemInspectors,
24
24
  LocalSystemManifest,
25
25
  } from '@lobechat/builtin-tool-local-system/client';
26
+ import { MemoryInspectors, MemoryManifest } from '@lobechat/builtin-tool-memory/client';
26
27
  import { NotebookInspectors, NotebookManifest } from '@lobechat/builtin-tool-notebook/client';
27
28
  import { PageAgentInspectors, PageAgentManifest } from '@lobechat/builtin-tool-page-agent/client';
28
29
  import {
@@ -52,6 +53,7 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =
52
53
  [GTDManifest.identifier]: GTDInspectors as Record<string, BuiltinInspector>,
53
54
  [KnowledgeBaseManifest.identifier]: KnowledgeBaseInspectors as Record<string, BuiltinInspector>,
54
55
  [LocalSystemManifest.identifier]: LocalSystemInspectors as Record<string, BuiltinInspector>,
56
+ [MemoryManifest.identifier]: MemoryInspectors as Record<string, BuiltinInspector>,
55
57
  [NotebookManifest.identifier]: NotebookInspectors as Record<string, BuiltinInspector>,
56
58
  [PageAgentManifest.identifier]: PageAgentInspectors as Record<string, BuiltinInspector>,
57
59
  [WebBrowsingManifest.identifier]: WebBrowsingInspectors as Record<string, BuiltinInspector>,
@@ -13,6 +13,7 @@ import {
13
13
  LocalSystemIdentifier,
14
14
  LocalSystemInterventions,
15
15
  } from '@lobechat/builtin-tool-local-system/client';
16
+ import { MemoryInterventions, MemoryManifest } from '@lobechat/builtin-tool-memory/client';
16
17
  import { NotebookManifest } from '@lobechat/builtin-tool-notebook';
17
18
  import { NotebookInterventions } from '@lobechat/builtin-tool-notebook/client';
18
19
  import { type BuiltinIntervention } from '@lobechat/types';
@@ -28,6 +29,7 @@ export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
28
29
  [GroupManagementManifest.identifier]: GroupManagementInterventions,
29
30
  [GTDManifest.identifier]: GTDInterventions,
30
31
  [LocalSystemIdentifier]: LocalSystemInterventions,
32
+ [MemoryManifest.identifier]: MemoryInterventions,
31
33
  [NotebookManifest.identifier]: NotebookInterventions,
32
34
  };
33
35
 
@@ -15,6 +15,7 @@ import {
15
15
  LocalSystemManifest,
16
16
  LocalSystemRenders,
17
17
  } from '@lobechat/builtin-tool-local-system/client';
18
+ import { MemoryManifest, MemoryRenders } from '@lobechat/builtin-tool-memory/client';
18
19
  import { NotebookManifest, NotebookRenders } from '@lobechat/builtin-tool-notebook/client';
19
20
  import {
20
21
  WebBrowsingManifest,
@@ -32,9 +33,10 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
32
33
  [GroupAgentBuilderManifest.identifier]: GroupAgentBuilderRenders as Record<string, BuiltinRender>,
33
34
  [GroupManagementManifest.identifier]: GroupManagementRenders as Record<string, BuiltinRender>,
34
35
  [GTDManifest.identifier]: GTDRenders as Record<string, BuiltinRender>,
35
- [NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,
36
36
  [KnowledgeBaseManifest.identifier]: KnowledgeBaseRenders as Record<string, BuiltinRender>,
37
37
  [LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,
38
+ [MemoryManifest.identifier]: MemoryRenders as Record<string, BuiltinRender>,
39
+ [NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,
38
40
  [WebBrowsingManifest.identifier]: WebBrowsingRenders as Record<string, BuiltinRender>,
39
41
  };
40
42
 
@@ -15,6 +15,7 @@ import {
15
15
  LocalSystemManifest,
16
16
  LocalSystemStreamings,
17
17
  } from '@lobechat/builtin-tool-local-system/client';
18
+ import { MemoryManifest, MemoryStreamings } from '@lobechat/builtin-tool-memory/client';
18
19
  import { NotebookManifest, NotebookStreamings } from '@lobechat/builtin-tool-notebook/client';
19
20
  import { type BuiltinStreaming } from '@lobechat/types';
20
21
 
@@ -38,6 +39,7 @@ const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> =
38
39
  >,
39
40
  [GTDManifest.identifier]: GTDStreamings as Record<string, BuiltinStreaming>,
40
41
  [LocalSystemManifest.identifier]: LocalSystemStreamings as Record<string, BuiltinStreaming>,
42
+ [MemoryManifest.identifier]: MemoryStreamings as Record<string, BuiltinStreaming>,
41
43
  [NotebookManifest.identifier]: NotebookStreamings as Record<string, BuiltinStreaming>,
42
44
  };
43
45
 
@@ -1,52 +0,0 @@
1
- 'use client';
2
-
3
- import type { BuiltinInspectorProps } from '@lobechat/types';
4
- import { Icon, Text } from '@lobehub/ui';
5
- import { createStaticStyles, cssVar, cx } from 'antd-style';
6
- import { CheckCircle } from 'lucide-react';
7
- import { memo } from 'react';
8
- import { useTranslation } from 'react-i18next';
9
-
10
- import { oneLineEllipsis, shinyTextStyles } from '@/styles';
11
-
12
- import type { CompleteTodosParams, CompleteTodosState } from '../../../types';
13
-
14
- const styles = createStaticStyles(({ css, cssVar }) => ({
15
- title: css`
16
- margin-inline-end: 8px;
17
- color: ${cssVar.colorText};
18
- `,
19
- }));
20
-
21
- export const CompleteTodosInspector = memo<
22
- BuiltinInspectorProps<CompleteTodosParams, CompleteTodosState>
23
- >(({ args, partialArgs, isArgumentsStreaming }) => {
24
- const { t } = useTranslation('plugin');
25
-
26
- const indices = args?.indices || partialArgs?.indices || [];
27
- const count = indices.length;
28
-
29
- if (isArgumentsStreaming && count === 0) {
30
- return (
31
- <div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>
32
- <span>{t('builtins.lobe-gtd.apiName.completeTodos')}</span>
33
- </div>
34
- );
35
- }
36
-
37
- return (
38
- <div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>
39
- <span className={styles.title}>{t('builtins.lobe-gtd.apiName.completeTodos')}</span>
40
- {count > 0 && (
41
- <Text as={'span'} code color={cssVar.colorSuccess} fontSize={12}>
42
- <Icon icon={CheckCircle} size={12} />
43
- {count}
44
- </Text>
45
- )}
46
- </div>
47
- );
48
- });
49
-
50
- CompleteTodosInspector.displayName = 'CompleteTodosInspector';
51
-
52
- export default CompleteTodosInspector;