@lobehub/lobehub 2.0.0-next.280 → 2.0.0-next.282

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 (42) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/e2e/src/steps/agent/conversation-mgmt.steps.ts +47 -3
  4. package/package.json +1 -1
  5. package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +19 -3
  6. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/BatchCreateAgents/index.tsx +19 -4
  7. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateAgentPrompt/index.tsx +3 -13
  8. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateGroupPrompt/index.tsx +1 -1
  9. package/packages/builtin-tool-group-agent-builder/src/systemRole.ts +83 -121
  10. package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +20 -2
  11. package/packages/observability-otel/src/node.ts +40 -3
  12. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx +9 -1
  13. package/src/app/[variants]/(main)/agent/features/Conversation/ConversationArea.tsx +1 -28
  14. package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +3 -3
  15. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMember.tsx +8 -1
  16. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/Header/Avatar.tsx +2 -13
  17. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Agent/index.tsx +3 -4
  18. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx +17 -8
  19. package/src/app/[variants]/(main)/group/features/Conversation/ConversationArea.tsx +1 -29
  20. package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +0 -2
  21. package/src/app/[variants]/(main)/group/features/GroupAvatar.tsx +17 -9
  22. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +8 -5
  23. package/src/app/[variants]/(main)/group/profile/features/Header/ChromeTabs/index.tsx +20 -2
  24. package/src/app/[variants]/(main)/group/profile/features/MemberProfile/AgentTool.tsx +4 -2
  25. package/src/app/[variants]/(main)/group/profile/features/ProfileHydration.tsx +5 -25
  26. package/src/features/AgentGroupAvatar/index.tsx +38 -0
  27. package/src/features/Conversation/Messages/Supervisor/index.tsx +8 -2
  28. package/src/features/Conversation/Messages/User/useMarkdown.tsx +1 -2
  29. package/src/features/EditorModal/EditorCanvas.tsx +62 -0
  30. package/src/features/EditorModal/TextArea.tsx +30 -0
  31. package/src/features/EditorModal/Typobar.tsx +139 -0
  32. package/src/features/EditorModal/index.tsx +18 -8
  33. package/src/features/NavPanel/components/EmptyNavItem.tsx +2 -2
  34. package/src/features/NavPanel/components/NavItem.tsx +27 -3
  35. package/src/features/ToolTag/index.tsx +167 -0
  36. package/src/server/routers/lambda/topic.ts +8 -1
  37. package/src/services/chat/mecha/contextEngineering.test.ts +1 -1
  38. package/src/services/chat/mecha/contextEngineering.ts +3 -4
  39. package/src/services/chat/mecha/memoryManager.ts +9 -38
  40. package/src/store/agentGroup/initialState.ts +1 -1
  41. package/src/store/agentGroup/slices/lifecycle.ts +15 -2
  42. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/hooks/useTopicNavigation.ts +0 -49
@@ -14,10 +14,16 @@ export interface ChatGroupLifecycleAction {
14
14
  silent?: boolean,
15
15
  ) => Promise<string>;
16
16
  /**
17
+ * @deprecated Use switchTopic(undefined) instead
17
18
  * Switch to a new topic in the group
18
19
  * Clears activeTopicId and navigates to group root
19
20
  */
20
21
  switchToNewTopic: () => void;
22
+ /**
23
+ * Switch to a topic in the group with proper route handling
24
+ * @param topicId - Topic ID to switch to, or undefined/null for new topic
25
+ */
26
+ switchTopic: (topicId?: string | null) => void;
21
27
  }
22
28
 
23
29
  export const chatGroupLifecycleSlice: StateCreator<
@@ -57,13 +63,20 @@ export const chatGroupLifecycleSlice: StateCreator<
57
63
  },
58
64
 
59
65
  switchToNewTopic: () => {
66
+ get().switchTopic(undefined);
67
+ },
68
+
69
+ switchTopic: (topicId) => {
60
70
  const { activeGroupId, router } = get();
61
71
  if (!activeGroupId || !router) return;
62
72
 
63
- useChatStore.setState({ activeTopicId: undefined });
73
+ // Update chat store's activeTopicId
74
+ useChatStore.getState().switchTopic(topicId ?? undefined);
64
75
 
76
+ // Navigate with replace to avoid stale query params
65
77
  router.push(urlJoin('/group', activeGroupId), {
66
- query: { bt: null, tab: null, thread: null, topic: null },
78
+ query: { topic: topicId ?? null },
79
+ replace: true,
67
80
  });
68
81
  },
69
82
  });
@@ -1,49 +0,0 @@
1
- import { usePathname } from 'next/navigation';
2
- import { useCallback } from 'react';
3
- import urlJoin from 'url-join';
4
-
5
- import { useQueryRoute } from '@/hooks/useQueryRoute';
6
- import { useAgentGroupStore } from '@/store/agentGroup';
7
- import { useChatStore } from '@/store/chat';
8
- import { useGlobalStore } from '@/store/global';
9
-
10
- /**
11
- * Hook to handle topic navigation with automatic route detection
12
- * If in agent sub-route (e.g., /agent/:aid/profile), navigate back to chat first
13
- */
14
- export const useTopicNavigation = () => {
15
- const pathname = usePathname();
16
- const activeGroupId = useAgentGroupStore((s) => s.activeGroupId);
17
- const router = useQueryRoute();
18
- const toggleConfig = useGlobalStore((s) => s.toggleMobileTopic);
19
- const switchTopic = useChatStore((s) => s.switchTopic);
20
-
21
- const isInAgentSubRoute = useCallback(() => {
22
- if (!activeGroupId) return false;
23
- const agentBasePath = `/group/${activeGroupId}`;
24
- // If pathname has more segments after /agent/:aid, it's a sub-route
25
- return (
26
- pathname.startsWith(agentBasePath) &&
27
- pathname !== agentBasePath &&
28
- pathname !== `${agentBasePath}/`
29
- );
30
- }, [pathname, activeGroupId]);
31
-
32
- const navigateToTopic = useCallback(
33
- (topicId?: string) => {
34
- // If in agent sub-route, navigate back to agent chat first
35
- if (isInAgentSubRoute() && activeGroupId) {
36
- router.push(urlJoin('/group', activeGroupId as string));
37
- }
38
-
39
- switchTopic(topicId);
40
- toggleConfig(false);
41
- },
42
- [activeGroupId, router, switchTopic, toggleConfig, isInAgentSubRoute],
43
- );
44
-
45
- return {
46
- isInAgentSubRoute: isInAgentSubRoute(),
47
- navigateToTopic,
48
- };
49
- };