@lobehub/lobehub 2.0.0-next.286 → 2.0.0-next.288

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 (72) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/apps/desktop/src/main/const/theme.ts +0 -3
  3. package/apps/desktop/src/main/core/browser/Browser.ts +1 -1
  4. package/apps/desktop/src/main/core/browser/WindowThemeManager.ts +3 -2
  5. package/apps/desktop/src/main/core/browser/__tests__/Browser.test.ts +0 -1
  6. package/apps/desktop/src/main/core/browser/__tests__/WindowThemeManager.test.ts +8 -5
  7. package/changelog/v1.json +14 -0
  8. package/locales/en-US/plugin.json +3 -5
  9. package/locales/zh-CN/plugin.json +3 -5
  10. package/locales/zh-CN/tool.json +2 -0
  11. package/package.json +1 -1
  12. package/packages/builtin-agents/src/agents/group-supervisor/index.ts +12 -1
  13. package/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts +0 -7
  14. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/EditLocalFile/index.tsx +93 -0
  15. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/GlobLocalFiles/index.tsx +73 -0
  16. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/GrepContent/index.tsx +69 -0
  17. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ListLocalFiles/index.tsx +68 -0
  18. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ReadLocalFile/index.tsx +74 -0
  19. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/SearchLocalFiles/index.tsx +70 -0
  20. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/WriteLocalFile/index.tsx +57 -0
  21. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts +14 -0
  22. package/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx +54 -35
  23. package/packages/builtin-tool-cloud-sandbox/src/client/components/FilePathDisplay.tsx +52 -0
  24. package/packages/builtin-tool-group-management/src/client/Inspector/ExecuteTasks/index.tsx +90 -0
  25. package/packages/builtin-tool-group-management/src/client/Inspector/index.ts +2 -0
  26. package/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx +237 -0
  27. package/packages/builtin-tool-group-management/src/client/Intervention/index.ts +4 -1
  28. package/packages/builtin-tool-group-management/src/client/Render/index.ts +1 -1
  29. package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTask/index.tsx +69 -0
  30. package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTasks/index.tsx +87 -0
  31. package/packages/builtin-tool-group-management/src/client/Streaming/index.ts +4 -0
  32. package/packages/builtin-tool-group-management/src/executor.test.ts +8 -311
  33. package/packages/builtin-tool-group-management/src/executor.ts +5 -160
  34. package/packages/builtin-tool-group-management/src/manifest.ts +50 -94
  35. package/packages/builtin-tool-group-management/src/systemRole.ts +251 -172
  36. package/packages/builtin-tool-group-management/src/types.ts +29 -40
  37. package/packages/context-engine/src/engine/messages/MessagesEngine.ts +6 -4
  38. package/packages/context-engine/src/engine/messages/types.ts +4 -4
  39. package/packages/context-engine/src/processors/GroupRoleTransform.ts +261 -0
  40. package/packages/context-engine/src/processors/__tests__/GroupRoleTransform.test.ts +553 -0
  41. package/packages/context-engine/src/processors/index.ts +2 -2
  42. package/packages/context-engine/src/providers/__tests__/GroupContextInjector.test.ts +4 -16
  43. package/packages/context-engine/src/providers/__tests__/__snapshots__/GroupContextInjector.test.ts.snap +23 -28
  44. package/packages/desktop-bridge/src/index.ts +3 -0
  45. package/packages/prompts/src/prompts/agentGroup/__snapshots__/index.test.ts.snap +0 -7
  46. package/packages/prompts/src/prompts/agentGroup/groupContext.ts +0 -7
  47. package/src/app/[variants]/(main)/group/features/Conversation/AgentWelcome/OpeningQuestions.tsx +4 -8
  48. package/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx +0 -3
  49. package/src/app/[variants]/(main)/group/features/Conversation/useGroupContext.ts +3 -0
  50. package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +15 -2
  51. package/src/features/ChatInput/Desktop/index.tsx +1 -3
  52. package/src/features/Conversation/store/slices/message/action/crud.ts +2 -2
  53. package/src/features/ElectronTitlebar/Connection/ConnectionMode.tsx +2 -2
  54. package/src/features/ElectronTitlebar/SimpleTitleBar.tsx +1 -2
  55. package/src/features/ElectronTitlebar/index.tsx +2 -2
  56. package/src/hooks/useUserAvatar.test.ts +23 -4
  57. package/src/locales/default/plugin.ts +3 -5
  58. package/src/locales/default/tool.ts +3 -0
  59. package/src/services/chat/mecha/agentConfigResolver.test.ts +160 -0
  60. package/src/services/chat/mecha/agentConfigResolver.ts +15 -3
  61. package/src/services/chat/mecha/contextEngineering.ts +2 -1
  62. package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +4 -2
  63. package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -0
  64. package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +1 -18
  65. package/src/store/chat/slices/message/selectors/displayMessage.test.ts +24 -0
  66. package/src/store/chat/slices/message/selectors/displayMessage.ts +6 -1
  67. package/src/store/chat/slices/topic/action.test.ts +10 -4
  68. package/src/store/chat/slices/topic/action.ts +3 -2
  69. package/src/store/electron/selectors/sync.ts +17 -1
  70. package/packages/context-engine/src/processors/GroupMessageSender.ts +0 -138
  71. package/packages/context-engine/src/processors/__tests__/GroupMessageSender.test.ts +0 -274
  72. package/src/features/ElectronTitlebar/const.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.288](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.287...v2.0.0-next.288)
6
+
7
+ <sup>Released on **2026-01-15**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Improve group prompt context engine and fix group supervisor response issue.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Improve group prompt context engine and fix group supervisor response issue, closes [#11490](https://github.com/lobehub/lobe-chat/issues/11490) ([7d066eb](https://github.com/lobehub/lobe-chat/commit/7d066eb))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ## [Version 2.0.0-next.287](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.286...v2.0.0-next.287)
31
+
32
+ <sup>Released on **2026-01-14**</sup>
33
+
34
+ #### ♻ Code Refactoring
35
+
36
+ - **desktop**: Unify TITLE_BAR_HEIGHT constant to desktop-bridge.
37
+
38
+ #### 🐛 Bug Fixes
39
+
40
+ - **desktop**: Return OFFICIAL_URL in cloud mode for remoteServerUrl selector.
41
+
42
+ <br/>
43
+
44
+ <details>
45
+ <summary><kbd>Improvements and Fixes</kbd></summary>
46
+
47
+ #### Code refactoring
48
+
49
+ - **desktop**: Unify TITLE_BAR_HEIGHT constant to desktop-bridge, closes [#11496](https://github.com/lobehub/lobe-chat/issues/11496) ([e7739e5](https://github.com/lobehub/lobe-chat/commit/e7739e5))
50
+
51
+ #### What's fixed
52
+
53
+ - **desktop**: Return OFFICIAL_URL in cloud mode for remoteServerUrl selector, closes [#11502](https://github.com/lobehub/lobe-chat/issues/11502) ([1d11fac](https://github.com/lobehub/lobe-chat/commit/1d11fac))
54
+
55
+ </details>
56
+
57
+ <div align="right">
58
+
59
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
60
+
61
+ </div>
62
+
5
63
  ## [Version 2.0.0-next.286](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.285...v2.0.0-next.286)
6
64
 
7
65
  <sup>Released on **2026-01-14**</sup>
@@ -4,8 +4,5 @@ export const BACKGROUND_LIGHT = '#f8f8f8';
4
4
  export const SYMBOL_COLOR_DARK = '#ffffff80';
5
5
  export const SYMBOL_COLOR_LIGHT = '#00000080';
6
6
 
7
- // Window dimensions and constraints
8
- export const TITLE_BAR_HEIGHT = 29;
9
-
10
7
  // Default window configuration
11
8
  export const THEME_CHANGE_DELAY = 100;
@@ -1,3 +1,4 @@
1
+ import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
1
2
  import { MainBroadcastEventKey, MainBroadcastParams } from '@lobechat/electron-client-ipc';
2
3
  import {
3
4
  BrowserWindow,
@@ -12,7 +13,6 @@ import { join } from 'node:path';
12
13
  import { preloadDir, resourcesDir } from '@/const/dir';
13
14
  import { isMac } from '@/const/env';
14
15
  import { ELECTRON_BE_PROTOCOL_SCHEME } from '@/const/protocol';
15
- import { TITLE_BAR_HEIGHT } from '@/const/theme';
16
16
  import RemoteServerConfigCtr from '@/controllers/RemoteServerConfigCtr';
17
17
  import { backendProxyProtocolManager } from '@/core/infrastructure/BackendProxyProtocolManager';
18
18
  import { setResponseHeader } from '@/utils/http-headers';
@@ -1,3 +1,4 @@
1
+ import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
1
2
  import { BrowserWindow, nativeTheme } from 'electron';
2
3
  import { join } from 'node:path';
3
4
 
@@ -9,7 +10,6 @@ import {
9
10
  SYMBOL_COLOR_DARK,
10
11
  SYMBOL_COLOR_LIGHT,
11
12
  THEME_CHANGE_DELAY,
12
- TITLE_BAR_HEIGHT,
13
13
  } from '@/const/theme';
14
14
  import { createLogger } from '@/utils/logger';
15
15
 
@@ -91,7 +91,8 @@ export class WindowThemeManager {
91
91
  icon: isDev ? join(buildDir, 'icon-dev.ico') : undefined,
92
92
  titleBarOverlay: {
93
93
  color: isDarkMode ? BACKGROUND_DARK : BACKGROUND_LIGHT,
94
- height: TITLE_BAR_HEIGHT,
94
+ // Reduce 2px to prevent blocking the container border edge
95
+ height: TITLE_BAR_HEIGHT - 2,
95
96
  symbolColor: isDarkMode ? SYMBOL_COLOR_DARK : SYMBOL_COLOR_LIGHT,
96
97
  },
97
98
  titleBarStyle: 'hidden',
@@ -108,7 +108,6 @@ vi.mock('@/const/theme', () => ({
108
108
  SYMBOL_COLOR_DARK: '#ffffff',
109
109
  SYMBOL_COLOR_LIGHT: '#000000',
110
110
  THEME_CHANGE_DELAY: 0,
111
- TITLE_BAR_HEIGHT: 32,
112
111
  }));
113
112
 
114
113
  describe('Browser', () => {
@@ -38,13 +38,16 @@ vi.mock('@/const/env', () => ({
38
38
  isWindows: true,
39
39
  }));
40
40
 
41
+ vi.mock('@lobechat/desktop-bridge', () => ({
42
+ TITLE_BAR_HEIGHT: 38,
43
+ }));
44
+
41
45
  vi.mock('@/const/theme', () => ({
42
46
  BACKGROUND_DARK: '#1a1a1a',
43
47
  BACKGROUND_LIGHT: '#ffffff',
44
48
  SYMBOL_COLOR_DARK: '#ffffff',
45
49
  SYMBOL_COLOR_LIGHT: '#000000',
46
50
  THEME_CHANGE_DELAY: 0,
47
- TITLE_BAR_HEIGHT: 32,
48
51
  }));
49
52
 
50
53
  describe('WindowThemeManager', () => {
@@ -89,7 +92,7 @@ describe('WindowThemeManager', () => {
89
92
  icon: undefined,
90
93
  titleBarOverlay: {
91
94
  color: '#1a1a1a',
92
- height: 32,
95
+ height: 36,
93
96
  symbolColor: '#ffffff',
94
97
  },
95
98
  titleBarStyle: 'hidden',
@@ -106,7 +109,7 @@ describe('WindowThemeManager', () => {
106
109
  icon: undefined,
107
110
  titleBarOverlay: {
108
111
  color: '#ffffff',
109
- height: 32,
112
+ height: 36,
110
113
  symbolColor: '#000000',
111
114
  },
112
115
  titleBarStyle: 'hidden',
@@ -183,7 +186,7 @@ describe('WindowThemeManager', () => {
183
186
  expect(mockBrowserWindow.setBackgroundColor).toHaveBeenCalledWith('#1a1a1a');
184
187
  expect(mockBrowserWindow.setTitleBarOverlay).toHaveBeenCalledWith({
185
188
  color: '#1a1a1a',
186
- height: 32,
189
+ height: 36,
187
190
  symbolColor: '#ffffff',
188
191
  });
189
192
  });
@@ -195,7 +198,7 @@ describe('WindowThemeManager', () => {
195
198
  expect(mockBrowserWindow.setBackgroundColor).toHaveBeenCalledWith('#ffffff');
196
199
  expect(mockBrowserWindow.setTitleBarOverlay).toHaveBeenCalledWith({
197
200
  color: '#ffffff',
198
- height: 32,
201
+ height: 36,
199
202
  symbolColor: '#000000',
200
203
  });
201
204
  });
package/changelog/v1.json CHANGED
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Improve group prompt context engine and fix group supervisor response issue."
6
+ ]
7
+ },
8
+ "date": "2026-01-15",
9
+ "version": "2.0.0-next.288"
10
+ },
11
+ {
12
+ "children": {},
13
+ "date": "2026-01-14",
14
+ "version": "2.0.0-next.287"
15
+ },
2
16
  {
3
17
  "children": {
4
18
  "fixes": [
@@ -61,18 +61,16 @@
61
61
  "builtins.lobe-group-agent-builder.inspector.title": "Title",
62
62
  "builtins.lobe-group-agent-builder.title": "Group Builder Expert",
63
63
  "builtins.lobe-group-management.apiName.broadcast": "All speak",
64
- "builtins.lobe-group-management.apiName.createAgent": "Add group member",
65
64
  "builtins.lobe-group-management.apiName.createWorkflow": "Plan workflow",
66
- "builtins.lobe-group-management.apiName.executeTask": "Execute task",
65
+ "builtins.lobe-group-management.apiName.executeAgentTask": "Execute agent task",
66
+ "builtins.lobe-group-management.apiName.executeAgentTasks": "Execute parallel agent tasks",
67
67
  "builtins.lobe-group-management.apiName.getAgentInfo": "Get member info",
68
68
  "builtins.lobe-group-management.apiName.interrupt": "Interrupt task",
69
- "builtins.lobe-group-management.apiName.inviteAgent": "Invite member",
70
- "builtins.lobe-group-management.apiName.removeAgent": "Remove member",
71
- "builtins.lobe-group-management.apiName.searchAgent": "Find relevant experts",
72
69
  "builtins.lobe-group-management.apiName.speak": "Designated member speaks",
73
70
  "builtins.lobe-group-management.apiName.summarize": "Summarize conversation",
74
71
  "builtins.lobe-group-management.apiName.vote": "Start vote",
75
72
  "builtins.lobe-group-management.inspector.broadcast.title": "Following Agents speak:",
73
+ "builtins.lobe-group-management.inspector.executeAgentTasks.title": "Assigning tasks to:",
76
74
  "builtins.lobe-group-management.inspector.speak.title": "Designated Agent speaks:",
77
75
  "builtins.lobe-group-management.title": "Group Coordinator",
78
76
  "builtins.lobe-gtd.apiName.clearTodos": "Clear todos",
@@ -61,18 +61,16 @@
61
61
  "builtins.lobe-group-agent-builder.inspector.title": "标题",
62
62
  "builtins.lobe-group-agent-builder.title": "群组构建专家",
63
63
  "builtins.lobe-group-management.apiName.broadcast": "所有人发言",
64
- "builtins.lobe-group-management.apiName.createAgent": "添加群组成员",
65
64
  "builtins.lobe-group-management.apiName.createWorkflow": "规划工作流",
66
- "builtins.lobe-group-management.apiName.executeTask": "执行任务",
65
+ "builtins.lobe-group-management.apiName.executeAgentTask": "执行 Agent 任务",
66
+ "builtins.lobe-group-management.apiName.executeAgentTasks": "并行执行 Agent 任务",
67
67
  "builtins.lobe-group-management.apiName.getAgentInfo": "获取成员信息",
68
68
  "builtins.lobe-group-management.apiName.interrupt": "中断任务",
69
- "builtins.lobe-group-management.apiName.inviteAgent": "邀请成员",
70
- "builtins.lobe-group-management.apiName.removeAgent": "移除成员",
71
- "builtins.lobe-group-management.apiName.searchAgent": "寻找相关专家",
72
69
  "builtins.lobe-group-management.apiName.speak": "指定成员发言",
73
70
  "builtins.lobe-group-management.apiName.summarize": "总结对话",
74
71
  "builtins.lobe-group-management.apiName.vote": "发起投票",
75
72
  "builtins.lobe-group-management.inspector.broadcast.title": "以下 Agent 发言:",
73
+ "builtins.lobe-group-management.inspector.executeAgentTasks.title": "分配任务给:",
76
74
  "builtins.lobe-group-management.inspector.speak.title": "指定 Agent 发言:",
77
75
  "builtins.lobe-group-management.title": "群组协调",
78
76
  "builtins.lobe-gtd.apiName.clearTodos": "清除待办",
@@ -15,6 +15,8 @@
15
15
  "agentGroupManagement.executeTask.thread": "线程 ID",
16
16
  "agentGroupManagement.executeTask.timeout": "执行超时",
17
17
  "agentGroupManagement.executeTask.tokens": "令牌使用量",
18
+ "agentGroupManagement.executeTasks.intervention.instructionPlaceholder": "执行此任务的详细指令...",
19
+ "agentGroupManagement.executeTasks.intervention.titlePlaceholder": "任务标题...",
18
20
  "codeInterpreter-legacy.error": "执行出错",
19
21
  "codeInterpreter-legacy.executing": "正在执行...",
20
22
  "codeInterpreter-legacy.files": "文件:",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.286",
3
+ "version": "2.0.0-next.288",
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",
@@ -1,3 +1,4 @@
1
+ import { GroupAgentBuilderIdentifier } from '@lobechat/builtin-tool-group-agent-builder';
1
2
  import { GroupManagementIdentifier } from '@lobechat/builtin-tool-group-management';
2
3
  import { GTDIdentifier } from '@lobechat/builtin-tool-gtd';
3
4
 
@@ -20,6 +21,11 @@ const resolveSystemRole = (ctx: GroupSupervisorContext): string => {
20
21
  * - Strategically coordinating agent participation
21
22
  * - Ensuring natural conversation flow
22
23
  * - Matching user queries to appropriate agent expertise
24
+ *
25
+ * Tools:
26
+ * - GroupManagement: orchestration (speak, broadcast, executeAgentTask, etc.)
27
+ * - GroupAgentBuilder: member management (searchAgent, inviteAgent, createAgent, etc.)
28
+ * - GTD: task tracking
23
29
  */
24
30
  export const GROUP_SUPERVISOR: BuiltinAgentDefinition = {
25
31
  runtime: (ctx) => {
@@ -33,7 +39,12 @@ export const GROUP_SUPERVISOR: BuiltinAgentDefinition = {
33
39
  chatConfig: {
34
40
  enableHistoryCount: false,
35
41
  },
36
- plugins: [GroupManagementIdentifier, GTDIdentifier, ...(ctx.plugins || [])],
42
+ plugins: [
43
+ GroupManagementIdentifier,
44
+ GroupAgentBuilderIdentifier,
45
+ GTDIdentifier,
46
+ ...(ctx.plugins || []),
47
+ ],
37
48
  systemRole: resolveSystemRole(groupSupervisorContext),
38
49
  };
39
50
  },
@@ -46,13 +46,6 @@ export const supervisorSystemRole = `You are LobeAI, an intelligent team coordin
46
46
  - **Efficiency**: Use broadcast for parallel opinions, speak for sequential dependencies.
47
47
  </orchestration_guidelines>
48
48
 
49
- <critical_output_rules>
50
- IMPORTANT: Your responses must contain ONLY your actual reply content.
51
- - Messages in conversation history start with '<speaker name="..." />' - this identifies who sent each message
52
- - NEVER start your response with '<speaker' tag - the system adds this automatically
53
- - Just output your actual response content directly
54
- </critical_output_rules>
55
-
56
49
  <constraints>
57
50
  - Only invoke agents defined in the participants list
58
51
  - Never fabricate agent IDs or capabilities
@@ -0,0 +1,93 @@
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 { Minus, Plus } from 'lucide-react';
7
+ import { type ReactNode, memo } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+
10
+ import { inspectorTextStyles, shinyTextStyles } from '@/styles';
11
+
12
+ import { type EditLocalFileState } from '../../../types';
13
+ import { FilePathDisplay } from '../../components/FilePathDisplay';
14
+
15
+ const styles = createStaticStyles(({ css, cssVar }) => ({
16
+ separator: css`
17
+ margin-inline: 2px;
18
+ color: ${cssVar.colorTextQuaternary};
19
+ `,
20
+ }));
21
+
22
+ interface EditLocalFileParams {
23
+ file_path: string;
24
+ new_string: string;
25
+ old_string: string;
26
+ }
27
+
28
+ export const EditLocalFileInspector = memo<
29
+ BuiltinInspectorProps<EditLocalFileParams, EditLocalFileState>
30
+ >(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
31
+ const { t } = useTranslation('plugin');
32
+
33
+ const filePath = args?.file_path || partialArgs?.file_path || '';
34
+
35
+ // During argument streaming
36
+ if (isArgumentsStreaming) {
37
+ if (!filePath)
38
+ return (
39
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
40
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.editLocalFile')}</span>
41
+ </div>
42
+ );
43
+
44
+ return (
45
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
46
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.editLocalFile')}: </span>
47
+ <FilePathDisplay filePath={filePath} />
48
+ </div>
49
+ );
50
+ }
51
+
52
+ // Build stats parts with colors and icons
53
+ const linesAdded = pluginState?.linesAdded ?? 0;
54
+ const linesDeleted = pluginState?.linesDeleted ?? 0;
55
+
56
+ const statsParts: ReactNode[] = [];
57
+ if (linesAdded > 0) {
58
+ statsParts.push(
59
+ <Text as={'span'} code color={cssVar.colorSuccess} fontSize={12} key="added">
60
+ <Icon icon={Plus} size={12} />
61
+ {linesAdded}
62
+ </Text>,
63
+ );
64
+ }
65
+ if (linesDeleted > 0) {
66
+ statsParts.push(
67
+ <Text as={'span'} code color={cssVar.colorError} fontSize={12} key="deleted">
68
+ <Icon icon={Minus} size={12} />
69
+ {linesDeleted}
70
+ </Text>,
71
+ );
72
+ }
73
+
74
+ return (
75
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
76
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.editLocalFile')}: </span>
77
+ <FilePathDisplay filePath={filePath} />
78
+ {!isLoading && statsParts.length > 0 && (
79
+ <>
80
+ {' '}
81
+ {statsParts.map((part, index) => (
82
+ <span key={index}>
83
+ {index > 0 && <span className={styles.separator}> / </span>}
84
+ {part}
85
+ </span>
86
+ ))}
87
+ </>
88
+ )}
89
+ </div>
90
+ );
91
+ });
92
+
93
+ EditLocalFileInspector.displayName = 'EditLocalFileInspector';
@@ -0,0 +1,73 @@
1
+ 'use client';
2
+
3
+ import { type BuiltinInspectorProps } from '@lobechat/types';
4
+ import { createStaticStyles, cssVar, cx } from 'antd-style';
5
+ import { Check, X } from 'lucide-react';
6
+ import { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
10
+
11
+ import { type GlobFilesState } from '../../../types';
12
+
13
+ const styles = createStaticStyles(({ css }) => ({
14
+ statusIcon: css`
15
+ margin-block-end: -2px;
16
+ margin-inline-start: 4px;
17
+ `,
18
+ }));
19
+
20
+ interface GlobFilesParams {
21
+ path?: string;
22
+ pattern: string;
23
+ }
24
+
25
+ export const GlobLocalFilesInspector = memo<BuiltinInspectorProps<GlobFilesParams, GlobFilesState>>(
26
+ ({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
27
+ const { t } = useTranslation('plugin');
28
+
29
+ const pattern = args?.pattern || partialArgs?.pattern || '';
30
+
31
+ // During argument streaming
32
+ if (isArgumentsStreaming) {
33
+ if (!pattern)
34
+ return (
35
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
36
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.globLocalFiles')}</span>
37
+ </div>
38
+ );
39
+
40
+ return (
41
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
42
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.globLocalFiles')}: </span>
43
+ <span className={highlightTextStyles.primary}>{pattern}</span>
44
+ </div>
45
+ );
46
+ }
47
+
48
+ // Check if glob was successful
49
+ const totalCount = pluginState?.totalCount ?? 0;
50
+ const hasResults = totalCount > 0;
51
+
52
+ return (
53
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
54
+ <span style={{ marginInlineStart: 2 }}>
55
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.globLocalFiles')}: </span>
56
+ {pattern && <span className={highlightTextStyles.primary}>{pattern}</span>}
57
+ {isLoading ? null : pluginState ? (
58
+ hasResults ? (
59
+ <>
60
+ <span style={{ marginInlineStart: 4 }}>({totalCount})</span>
61
+ <Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
62
+ </>
63
+ ) : (
64
+ <X className={styles.statusIcon} color={cssVar.colorError} size={14} />
65
+ )
66
+ ) : null}
67
+ </span>
68
+ </div>
69
+ );
70
+ },
71
+ );
72
+
73
+ GlobLocalFilesInspector.displayName = 'GlobLocalFilesInspector';
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+
3
+ import { type BuiltinInspectorProps } from '@lobechat/types';
4
+ import { Text } from '@lobehub/ui';
5
+ import { cssVar, cx } from 'antd-style';
6
+ import { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
10
+
11
+ import { type GrepContentState } from '../../../types';
12
+
13
+ interface GrepContentParams {
14
+ include?: string;
15
+ path?: string;
16
+ pattern: string;
17
+ }
18
+
19
+ export const GrepContentInspector = memo<
20
+ BuiltinInspectorProps<GrepContentParams, GrepContentState>
21
+ >(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
22
+ const { t } = useTranslation('plugin');
23
+
24
+ const pattern = args?.pattern || partialArgs?.pattern || '';
25
+
26
+ // During argument streaming
27
+ if (isArgumentsStreaming) {
28
+ if (!pattern)
29
+ return (
30
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
31
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.grepContent')}</span>
32
+ </div>
33
+ );
34
+
35
+ return (
36
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
37
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.grepContent')}: </span>
38
+ <span className={highlightTextStyles.primary}>{pattern}</span>
39
+ </div>
40
+ );
41
+ }
42
+
43
+ // Check result count
44
+ const resultCount = pluginState?.totalMatches ?? 0;
45
+ const hasResults = resultCount > 0;
46
+
47
+ return (
48
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
49
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.grepContent')}: </span>
50
+ {pattern && <span className={highlightTextStyles.primary}>{pattern}</span>}
51
+ {!isLoading &&
52
+ pluginState &&
53
+ (hasResults ? (
54
+ <span style={{ marginInlineStart: 4 }}>({resultCount})</span>
55
+ ) : (
56
+ <Text
57
+ as={'span'}
58
+ color={cssVar.colorTextDescription}
59
+ fontSize={12}
60
+ style={{ marginInlineStart: 4 }}
61
+ >
62
+ ({t('builtins.lobe-local-system.inspector.noResults')})
63
+ </Text>
64
+ ))}
65
+ </div>
66
+ );
67
+ });
68
+
69
+ GrepContentInspector.displayName = 'GrepContentInspector';
@@ -0,0 +1,68 @@
1
+ 'use client';
2
+
3
+ import { type BuiltinInspectorProps } from '@lobechat/types';
4
+ import { Text } from '@lobehub/ui';
5
+ import { cssVar, cx } from 'antd-style';
6
+ import { memo } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import { inspectorTextStyles, shinyTextStyles } from '@/styles';
10
+
11
+ import { type ListLocalFilesState } from '../../../types';
12
+ import { FilePathDisplay } from '../../components/FilePathDisplay';
13
+
14
+ interface ListLocalFilesParams {
15
+ path: string;
16
+ }
17
+
18
+ export const ListLocalFilesInspector = memo<
19
+ BuiltinInspectorProps<ListLocalFilesParams, ListLocalFilesState>
20
+ >(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
21
+ const { t } = useTranslation('plugin');
22
+
23
+ const path = args?.path || partialArgs?.path || '';
24
+
25
+ // During argument streaming
26
+ if (isArgumentsStreaming) {
27
+ if (!path)
28
+ return (
29
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
30
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.listLocalFiles')}</span>
31
+ </div>
32
+ );
33
+
34
+ return (
35
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
36
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.listLocalFiles')}: </span>
37
+ <FilePathDisplay filePath={path} isDirectory />
38
+ </div>
39
+ );
40
+ }
41
+
42
+ // Show result count if available
43
+ const resultCount = pluginState?.files?.length ?? 0;
44
+ const hasResults = resultCount > 0;
45
+
46
+ return (
47
+ <div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
48
+ <span>{t('builtins.lobe-cloud-sandbox.apiName.listLocalFiles')}: </span>
49
+ <FilePathDisplay filePath={path} isDirectory />
50
+ {!isLoading &&
51
+ pluginState?.files &&
52
+ (hasResults ? (
53
+ <span style={{ marginInlineStart: 4 }}>({resultCount})</span>
54
+ ) : (
55
+ <Text
56
+ as={'span'}
57
+ color={cssVar.colorTextDescription}
58
+ fontSize={12}
59
+ style={{ marginInlineStart: 4 }}
60
+ >
61
+ ({t('builtins.lobe-local-system.inspector.noResults')})
62
+ </Text>
63
+ ))}
64
+ </div>
65
+ );
66
+ });
67
+
68
+ ListLocalFilesInspector.displayName = 'ListLocalFilesInspector';