@lobehub/lobehub 2.0.0-next.287 → 2.0.0-next.289
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.
- package/CHANGELOG.md +50 -0
- package/changelog/v1.json +18 -0
- package/locales/en-US/plugin.json +3 -5
- package/locales/zh-CN/plugin.json +3 -5
- package/locales/zh-CN/tool.json +2 -0
- package/package.json +1 -1
- package/packages/builtin-agents/src/agents/group-supervisor/index.ts +12 -1
- package/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts +0 -7
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/EditLocalFile/index.tsx +93 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/GlobLocalFiles/index.tsx +73 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/GrepContent/index.tsx +69 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ListLocalFiles/index.tsx +68 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ReadLocalFile/index.tsx +74 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/SearchLocalFiles/index.tsx +70 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/WriteLocalFile/index.tsx +57 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/index.ts +14 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx +54 -35
- package/packages/builtin-tool-cloud-sandbox/src/client/components/FilePathDisplay.tsx +52 -0
- package/packages/builtin-tool-group-management/src/client/Inspector/ExecuteTasks/index.tsx +90 -0
- package/packages/builtin-tool-group-management/src/client/Inspector/index.ts +2 -0
- package/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx +237 -0
- package/packages/builtin-tool-group-management/src/client/Intervention/index.ts +4 -1
- package/packages/builtin-tool-group-management/src/client/Render/index.ts +1 -1
- package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTask/index.tsx +69 -0
- package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTasks/index.tsx +87 -0
- package/packages/builtin-tool-group-management/src/client/Streaming/index.ts +4 -0
- package/packages/builtin-tool-group-management/src/executor.test.ts +8 -311
- package/packages/builtin-tool-group-management/src/executor.ts +5 -160
- package/packages/builtin-tool-group-management/src/manifest.ts +50 -94
- package/packages/builtin-tool-group-management/src/systemRole.ts +251 -172
- package/packages/builtin-tool-group-management/src/types.ts +29 -40
- package/packages/context-engine/src/engine/messages/MessagesEngine.ts +22 -4
- package/packages/context-engine/src/engine/messages/types.ts +4 -4
- package/packages/context-engine/src/processors/GroupOrchestrationFilter.ts +211 -0
- package/packages/context-engine/src/processors/GroupRoleTransform.ts +261 -0
- package/packages/context-engine/src/processors/__tests__/GroupOrchestrationFilter.test.ts +770 -0
- package/packages/context-engine/src/processors/__tests__/GroupRoleTransform.test.ts +553 -0
- package/packages/context-engine/src/processors/index.ts +7 -2
- package/packages/context-engine/src/providers/__tests__/GroupContextInjector.test.ts +4 -16
- package/packages/context-engine/src/providers/__tests__/__snapshots__/GroupContextInjector.test.ts.snap +23 -28
- package/packages/prompts/src/prompts/agentGroup/__snapshots__/index.test.ts.snap +0 -7
- package/packages/prompts/src/prompts/agentGroup/groupContext.ts +0 -7
- package/src/app/[variants]/(main)/group/features/Conversation/AgentWelcome/OpeningQuestions.tsx +4 -8
- package/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx +0 -3
- package/src/app/[variants]/(main)/group/features/Conversation/useGroupContext.ts +3 -0
- package/src/features/ChatInput/Desktop/index.tsx +1 -3
- package/src/features/Conversation/store/slices/message/action/crud.ts +2 -2
- package/src/locales/default/plugin.ts +3 -5
- package/src/locales/default/tool.ts +3 -0
- package/src/services/chat/mecha/agentConfigResolver.test.ts +160 -0
- package/src/services/chat/mecha/agentConfigResolver.ts +15 -3
- package/src/services/chat/mecha/contextEngineering.ts +2 -1
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +4 -2
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -0
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +1 -18
- package/src/store/chat/slices/message/selectors/displayMessage.test.ts +24 -0
- package/src/store/chat/slices/message/selectors/displayMessage.ts +6 -1
- package/src/store/chat/slices/topic/action.test.ts +10 -4
- package/src/store/chat/slices/topic/action.ts +3 -2
- package/src/store/document/slices/document/action.ts +8 -0
- package/packages/context-engine/src/processors/GroupMessageSender.ts +0 -138
- package/packages/context-engine/src/processors/__tests__/GroupMessageSender.test.ts +0 -274
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.289](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.288...v2.0.0-next.289)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2026-01-15**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix page content mismatch when switch quickly.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix page content mismatch when switch quickly, closes [#11505](https://github.com/lobehub/lobe-chat/issues/11505) ([0cb1374](https://github.com/lobehub/lobe-chat/commit/0cb1374))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 2.0.0-next.288](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.287...v2.0.0-next.288)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2026-01-15**</sup>
|
|
33
|
+
|
|
34
|
+
#### ✨ Features
|
|
35
|
+
|
|
36
|
+
- **misc**: Improve group prompt context engine and fix group supervisor response issue.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's improved
|
|
44
|
+
|
|
45
|
+
- **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))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 2.0.0-next.287](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.286...v2.0.0-next.287)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2026-01-14**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"fixes": [
|
|
5
|
+
"Fix page content mismatch when switch quickly."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2026-01-15",
|
|
9
|
+
"version": "2.0.0-next.289"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {
|
|
13
|
+
"features": [
|
|
14
|
+
"Improve group prompt context engine and fix group supervisor response issue."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"date": "2026-01-15",
|
|
18
|
+
"version": "2.0.0-next.288"
|
|
19
|
+
},
|
|
2
20
|
{
|
|
3
21
|
"children": {},
|
|
4
22
|
"date": "2026-01-14",
|
|
@@ -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.
|
|
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.
|
|
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": "清除待办",
|
package/locales/zh-CN/tool.json
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "2.0.0-next.289",
|
|
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: [
|
|
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';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cx } from 'antd-style';
|
|
5
|
+
import { memo, useMemo } from 'react';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
|
|
8
|
+
import { inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
9
|
+
|
|
10
|
+
import { type ReadLocalFileState } from '../../../types';
|
|
11
|
+
import { FilePathDisplay } from '../../components/FilePathDisplay';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
lineRange: css`
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
opacity: 0.7;
|
|
18
|
+
`,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
interface ReadLocalFileParams {
|
|
22
|
+
end_line?: number;
|
|
23
|
+
path: string;
|
|
24
|
+
start_line?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ReadLocalFileInspector = memo<
|
|
28
|
+
BuiltinInspectorProps<ReadLocalFileParams, ReadLocalFileState>
|
|
29
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
|
|
30
|
+
const { t } = useTranslation('plugin');
|
|
31
|
+
|
|
32
|
+
const filePath = args?.path || partialArgs?.path || '';
|
|
33
|
+
const startLine = args?.start_line || partialArgs?.start_line;
|
|
34
|
+
const endLine = args?.end_line || partialArgs?.end_line;
|
|
35
|
+
|
|
36
|
+
// Format line range display, e.g., "L1-L200"
|
|
37
|
+
const lineRangeText = useMemo(() => {
|
|
38
|
+
if (startLine === undefined && endLine === undefined) return null;
|
|
39
|
+
const start = startLine ?? 1;
|
|
40
|
+
const end = endLine;
|
|
41
|
+
if (end !== undefined) {
|
|
42
|
+
return `L${start}-L${end}`;
|
|
43
|
+
}
|
|
44
|
+
return `L${start}`;
|
|
45
|
+
}, [startLine, endLine]);
|
|
46
|
+
|
|
47
|
+
// During argument streaming
|
|
48
|
+
if (isArgumentsStreaming) {
|
|
49
|
+
if (!filePath)
|
|
50
|
+
return (
|
|
51
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
52
|
+
<span>{t('builtins.lobe-cloud-sandbox.apiName.readLocalFile')}</span>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
58
|
+
<span>{t('builtins.lobe-cloud-sandbox.apiName.readLocalFile')}: </span>
|
|
59
|
+
<FilePathDisplay filePath={filePath} />
|
|
60
|
+
{lineRangeText && <span className={styles.lineRange}>{lineRangeText}</span>}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
67
|
+
<span>{t('builtins.lobe-cloud-sandbox.apiName.readLocalFile')}: </span>
|
|
68
|
+
<FilePathDisplay filePath={filePath} />
|
|
69
|
+
{lineRangeText && <span className={styles.lineRange}>{lineRangeText}</span>}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
ReadLocalFileInspector.displayName = 'ReadLocalFileInspector';
|
|
@@ -0,0 +1,70 @@
|
|
|
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 SearchLocalFilesState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
interface SearchLocalFilesParams {
|
|
14
|
+
path?: string;
|
|
15
|
+
query: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const SearchLocalFilesInspector = memo<
|
|
19
|
+
BuiltinInspectorProps<SearchLocalFilesParams, SearchLocalFilesState>
|
|
20
|
+
>(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
21
|
+
const { t } = useTranslation('plugin');
|
|
22
|
+
|
|
23
|
+
const query = args?.query || partialArgs?.query || '';
|
|
24
|
+
|
|
25
|
+
// During argument streaming
|
|
26
|
+
if (isArgumentsStreaming) {
|
|
27
|
+
if (!query)
|
|
28
|
+
return (
|
|
29
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
30
|
+
<span>{t('builtins.lobe-cloud-sandbox.apiName.searchLocalFiles')}</span>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
36
|
+
<span>{t('builtins.lobe-cloud-sandbox.apiName.searchLocalFiles')}: </span>
|
|
37
|
+
<span className={highlightTextStyles.primary}>{query}</span>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check if search returned results
|
|
43
|
+
const resultCount = pluginState?.results?.length ?? 0;
|
|
44
|
+
const hasResults = resultCount > 0;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
48
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
49
|
+
<span>{t('builtins.lobe-cloud-sandbox.apiName.searchLocalFiles')}: </span>
|
|
50
|
+
{query && <span className={highlightTextStyles.primary}>{query}</span>}
|
|
51
|
+
{!isLoading &&
|
|
52
|
+
pluginState?.results &&
|
|
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
|
+
</span>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
SearchLocalFilesInspector.displayName = 'SearchLocalFilesInspector';
|