@lobehub/lobehub 2.0.0-next.183 → 2.0.0-next.184

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 (58) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +1 -1
  4. package/packages/builtin-tool-local-system/package.json +10 -0
  5. package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +81 -0
  6. package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +73 -0
  7. package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +73 -0
  8. package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +81 -0
  9. package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +80 -0
  10. package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +71 -0
  11. package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Inspector/index.ts +1 -2
  12. package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/index.ts +1 -2
  13. package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ListFiles/Result.tsx +2 -1
  14. package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/index.ts +1 -2
  15. package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Streaming/index.ts +1 -2
  16. package/packages/builtin-tool-local-system/src/client/index.ts +20 -0
  17. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/index.tsx +3 -3
  18. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/index.tsx +3 -3
  19. package/src/app/[variants]/(main)/home/_layout/Body/Agent/index.tsx +3 -3
  20. package/src/app/[variants]/(main)/home/features/RecentPage/index.tsx +3 -2
  21. package/src/app/[variants]/(main)/home/features/RecentResource/index.tsx +3 -2
  22. package/src/app/[variants]/(main)/home/features/RecentTopic/index.tsx +3 -3
  23. package/src/components/NeuralNetworkLoading/index.tsx +181 -0
  24. package/src/libs/swr/index.ts +1 -8
  25. package/src/tools/inspectors.ts +6 -5
  26. package/src/tools/interventions.ts +5 -4
  27. package/src/tools/placeholders.ts +9 -7
  28. package/src/tools/renders.ts +5 -3
  29. package/src/tools/streamings.ts +6 -5
  30. package/src/tools/local-system/Inspector/EditLocalFile/index.tsx +0 -55
  31. package/src/tools/local-system/Inspector/GlobLocalFiles/index.tsx +0 -59
  32. package/src/tools/local-system/Inspector/GrepContent/index.tsx +0 -59
  33. package/src/tools/local-system/Inspector/ReadLocalFile/index.tsx +0 -55
  34. package/src/tools/local-system/Inspector/RunCommand/index.tsx +0 -66
  35. package/src/tools/local-system/Inspector/SearchLocalFiles/index.tsx +0 -59
  36. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/EditLocalFile/index.tsx +0 -0
  37. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/MoveLocalFiles/MoveFileItem.tsx +0 -0
  38. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/MoveLocalFiles/index.tsx +0 -0
  39. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/RunCommand/index.tsx +0 -0
  40. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/WriteFile/index.tsx +0 -0
  41. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Placeholder/ListFiles.tsx +0 -0
  42. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Placeholder/SearchFiles.tsx +0 -0
  43. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/EditLocalFile/index.tsx +0 -0
  44. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ListFiles/index.tsx +0 -0
  45. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/MoveLocalFiles/MoveFileItem.tsx +0 -0
  46. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/MoveLocalFiles/index.tsx +0 -0
  47. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ReadLocalFile/ReadFileSkeleton.tsx +0 -0
  48. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ReadLocalFile/ReadFileView.tsx +0 -0
  49. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ReadLocalFile/index.tsx +0 -0
  50. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/RenameLocalFile/index.tsx +0 -0
  51. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/RunCommand/index.tsx +0 -0
  52. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/Result.tsx +0 -0
  53. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/SearchQuery/SearchView.tsx +0 -0
  54. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/SearchQuery/index.tsx +0 -0
  55. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/index.tsx +0 -0
  56. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/WriteFile/index.tsx +0 -0
  57. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Streaming/RunCommand/index.tsx +0 -0
  58. /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/components/FileItem.tsx +0 -0
@@ -1,12 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import { ActionIcon, Dropdown } from '@lobehub/ui';
4
- import { FileTextIcon, Loader2Icon, MoreHorizontal } from 'lucide-react';
4
+ import { FileTextIcon, MoreHorizontal } from 'lucide-react';
5
5
  import { Suspense, memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useNavigate } from 'react-router-dom';
8
8
 
9
9
  import { useResourceManagerStore } from '@/app/[variants]/(main)/resource/features/store';
10
+ import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
10
11
  import { useInitRecentPage } from '@/hooks/useInitRecentPage';
11
12
  import { useHomeStore } from '@/store/home';
12
13
  import { homeRecentSelectors } from '@/store/home/selectors';
@@ -35,7 +36,7 @@ const RecentPage = memo(() => {
35
36
  <GroupBlock
36
37
  action={
37
38
  <>
38
- {isRevalidating && <ActionIcon icon={Loader2Icon} loading size={'small'} />}
39
+ {isRevalidating && <NeuralNetworkLoading size={14} />}
39
40
  <Dropdown
40
41
  menu={{
41
42
  items: [
@@ -1,12 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import { ActionIcon, Dropdown } from '@lobehub/ui';
4
- import { Clock, Loader2Icon, MoreHorizontal } from 'lucide-react';
4
+ import { Clock, MoreHorizontal } from 'lucide-react';
5
5
  import { Suspense, memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useNavigate } from 'react-router-dom';
8
8
 
9
9
  import { useResourceManagerStore } from '@/app/[variants]/(main)/resource/features/store';
10
+ import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
10
11
  import { useInitRecentResource } from '@/hooks/useInitRecentResource';
11
12
  import { useHomeStore } from '@/store/home';
12
13
  import { homeRecentSelectors } from '@/store/home/selectors';
@@ -35,7 +36,7 @@ const RecentResource = memo(() => {
35
36
  <GroupBlock
36
37
  action={
37
38
  <>
38
- {isRevalidating && <ActionIcon icon={Loader2Icon} loading size={'small'} />}
39
+ {isRevalidating && <NeuralNetworkLoading size={14} />}
39
40
  <Dropdown
40
41
  menu={{
41
42
  items: [
@@ -1,8 +1,8 @@
1
- import { ActionIcon } from '@lobehub/ui';
2
- import { BotMessageSquareIcon, Loader2Icon } from 'lucide-react';
1
+ import { BotMessageSquareIcon } from 'lucide-react';
3
2
  import { Suspense, memo } from 'react';
4
3
  import { useTranslation } from 'react-i18next';
5
4
 
5
+ import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
6
6
  import { useInitRecentTopic } from '@/hooks/useInitRecentTopic';
7
7
  import { useHomeStore } from '@/store/home';
8
8
  import { homeRecentSelectors } from '@/store/home/selectors';
@@ -26,7 +26,7 @@ const RecentTopic = memo(() => {
26
26
 
27
27
  return (
28
28
  <GroupBlock
29
- action={isRevalidating && <ActionIcon icon={Loader2Icon} loading size={'small'} />}
29
+ action={isRevalidating && <NeuralNetworkLoading size={14} />}
30
30
  icon={BotMessageSquareIcon}
31
31
  title={t('topic.recent')}
32
32
  >
@@ -0,0 +1,181 @@
1
+ 'use client';
2
+
3
+ import { createStaticStyles, keyframes } from 'antd-style';
4
+ import { CSSProperties, memo } from 'react';
5
+
6
+ const pulseAnim = keyframes`
7
+ 0%, 100% {
8
+ opacity: 0.3;
9
+ }
10
+ 50% {
11
+ opacity: 1;
12
+ }
13
+ `;
14
+
15
+ const flowAnim = keyframes`
16
+ 0% {
17
+ transform: translateX(0);
18
+ opacity: 0.5;
19
+ }
20
+ 50% {
21
+ opacity: 1;
22
+ }
23
+ 100% {
24
+ transform: translateX(var(--flow-distance));
25
+ opacity: 0.5;
26
+ }
27
+ `;
28
+
29
+ const rotateAnim = keyframes`
30
+ 100% {
31
+ transform: rotate(360deg);
32
+ }
33
+ `;
34
+
35
+ const scaleAnim = keyframes`
36
+ 0%, 100% {
37
+ transform: scale(0.8);
38
+ opacity: 0.5;
39
+ }
40
+ 50% {
41
+ transform: scale(1);
42
+ opacity: 1;
43
+ }
44
+ `;
45
+
46
+ const styles = createStaticStyles(({ css, cssVar }) => ({
47
+ center: css`
48
+ fill: ${cssVar.colorTextSecondary};
49
+ animation: ${scaleAnim} 2s infinite;
50
+ `,
51
+
52
+ connection: css`
53
+ opacity: 0.3;
54
+ stroke: ${cssVar.colorTextSecondary};
55
+ stroke-width: 0.5;
56
+ `,
57
+
58
+ container: css`
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ `,
63
+
64
+ node: css`
65
+ fill: ${cssVar.colorTextSecondary};
66
+ animation: ${pulseAnim} 2s infinite;
67
+ `,
68
+
69
+ particle: css`
70
+ fill: ${cssVar.colorTextSecondary};
71
+ animation: ${flowAnim} 2s infinite;
72
+ `,
73
+
74
+ ring: css`
75
+ transform-origin: center;
76
+
77
+ fill: none;
78
+ stroke: ${cssVar.colorFill};
79
+ stroke-dasharray: 0 8;
80
+ stroke-width: 1;
81
+
82
+ animation: ${rotateAnim} 20s infinite linear;
83
+ `,
84
+
85
+ svg: css`
86
+ width: 100%;
87
+ height: 100%;
88
+ `,
89
+ }));
90
+
91
+ interface NeuralNetworkLoadingProps {
92
+ size?: number;
93
+ }
94
+
95
+ const NeuralNetworkLoading = memo<NeuralNetworkLoadingProps>(({ size = 16 }) => {
96
+ const nodeCount = 3;
97
+ const layerCount = 3;
98
+
99
+ // Generate nodes for each layer
100
+ const nodes = [];
101
+ for (let layerIndex = 0; layerIndex < layerCount; layerIndex++) {
102
+ for (let nodeIndex = 0; nodeIndex < nodeCount; nodeIndex++) {
103
+ const x = 25 + layerIndex * 25;
104
+ const y = 25 + nodeIndex * 25;
105
+ const delay = (layerIndex * nodeCount + nodeIndex) * 0.2;
106
+ nodes.push(
107
+ <circle
108
+ className={styles.node}
109
+ cx={x}
110
+ cy={y}
111
+ key={`node-${layerIndex}-${nodeIndex}`}
112
+ r="3"
113
+ style={{ animationDelay: `${delay}s` }}
114
+ />,
115
+ );
116
+ }
117
+ }
118
+
119
+ // Generate connections between layers
120
+ const connections = [];
121
+ for (let layerIndex = 0; layerIndex < layerCount - 1; layerIndex++) {
122
+ for (let nodeIndex = 0; nodeIndex < nodeCount; nodeIndex++) {
123
+ const x1 = 25 + layerIndex * 25;
124
+ const y1 = 25 + nodeIndex * 25;
125
+ for (let targetIndex = 0; targetIndex < nodeCount; targetIndex++) {
126
+ const x2 = 25 + (layerIndex + 1) * 25;
127
+ const y2 = 25 + targetIndex * 25;
128
+ connections.push(
129
+ <line
130
+ className={styles.connection}
131
+ key={`connection-${layerIndex}-${nodeIndex}-${targetIndex}`}
132
+ x1={x1}
133
+ x2={x2}
134
+ y1={y1}
135
+ y2={y2}
136
+ />,
137
+ );
138
+ }
139
+ }
140
+ }
141
+
142
+ // Generate particles
143
+ const particles = [0, 1, 2].map((index) => (
144
+ <circle
145
+ className={styles.particle}
146
+ cx={25}
147
+ cy={50}
148
+ key={`particle-${index}`}
149
+ r="1.5"
150
+ style={
151
+ {
152
+ '--flow-distance': '50px',
153
+ 'animationDelay': `${index * 0.6}s`,
154
+ } as CSSProperties
155
+ }
156
+ />
157
+ ));
158
+
159
+ return (
160
+ <div className={styles.container} style={{ height: size, width: size }}>
161
+ <svg className={styles.svg} viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
162
+ {/* Connections */}
163
+ {connections}
164
+
165
+ {/* Nodes */}
166
+ {nodes}
167
+
168
+ {/* Particles */}
169
+ {particles}
170
+
171
+ {/* Central processing unit */}
172
+ <rect className={styles.center} height="6" width="6" x="47" y="47" />
173
+
174
+ {/* Rotating outer ring */}
175
+ <circle className={styles.ring} cx="50" cy="50" r="40" />
176
+ </svg>
177
+ </div>
178
+ );
179
+ });
180
+
181
+ export default NeuralNetworkLoading;
@@ -1,6 +1,5 @@
1
1
  import useSWR, { type SWRHook } from 'swr';
2
2
 
3
- import { isDesktop } from '@/const/version';
4
3
 
5
4
  /**
6
5
  * This type of request method is relatively flexible data, which will be triggered on the first time
@@ -27,13 +26,7 @@ export const useClientDataSWR: SWRHook = (key, fetch, config) =>
27
26
  // Cause issue like this: https://github.com/lobehub/lobe-chat/issues/532
28
27
  // we need to set it to 0.
29
28
  dedupingInterval: 0,
30
- focusThrottleInterval:
31
- // FIXME: desktop 云同步模式也是走 edge 请求,也应该增大延迟
32
- // desktop 1.5s
33
- isDesktop
34
- ? 1500
35
- : // web 300s
36
- 5 * 60 * 1000,
29
+ focusThrottleInterval: 5 * 60 * 1000,
37
30
  // Custom error retry logic: don't retry on 401 errors
38
31
  onErrorRetry: (error: any, key: any, config: any, revalidate: any, { retryCount }: any) => {
39
32
  // Check if error is marked as non-retryable (e.g., 401 authentication errors)
@@ -7,16 +7,17 @@ import {
7
7
  GroupManagementManifest,
8
8
  } from '@lobechat/builtin-tool-group-management/client';
9
9
  import { GTDInspectors, GTDManifest } from '@lobechat/builtin-tool-gtd/client';
10
- import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
11
- import { PageAgentIdentifier, PageAgentInspectors } from '@lobechat/builtin-tool-page-agent/client';
10
+ import {
11
+ LocalSystemInspectors,
12
+ LocalSystemManifest,
13
+ } from '@lobechat/builtin-tool-local-system/client';
14
+ import { PageAgentInspectors, PageAgentManifest } from '@lobechat/builtin-tool-page-agent/client';
12
15
  import {
13
16
  WebBrowsingInspectors,
14
17
  WebBrowsingManifest,
15
18
  } from '@lobechat/builtin-tool-web-browsing/client';
16
19
  import { type BuiltinInspector } from '@lobechat/types';
17
20
 
18
- import { LocalSystemInspectors } from './local-system/Inspector';
19
-
20
21
  /**
21
22
  * Builtin tools inspector registry
22
23
  * Organized by toolset (identifier) -> API name
@@ -32,7 +33,7 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =
32
33
  >,
33
34
  [GTDManifest.identifier]: GTDInspectors as Record<string, BuiltinInspector>,
34
35
  [LocalSystemManifest.identifier]: LocalSystemInspectors as Record<string, BuiltinInspector>,
35
- [PageAgentIdentifier]: PageAgentInspectors as Record<string, BuiltinInspector>,
36
+ [PageAgentManifest.identifier]: PageAgentInspectors as Record<string, BuiltinInspector>,
36
37
  [WebBrowsingManifest.identifier]: WebBrowsingInspectors as Record<string, BuiltinInspector>,
37
38
  };
38
39
 
@@ -9,13 +9,14 @@ import {
9
9
  GroupManagementManifest,
10
10
  } from '@lobechat/builtin-tool-group-management/client';
11
11
  import { GTDInterventions, GTDManifest } from '@lobechat/builtin-tool-gtd/client';
12
- import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
12
+ import {
13
+ LocalSystemIdentifier,
14
+ LocalSystemInterventions,
15
+ } from '@lobechat/builtin-tool-local-system/client';
13
16
  import { NotebookManifest } from '@lobechat/builtin-tool-notebook';
14
17
  import { NotebookInterventions } from '@lobechat/builtin-tool-notebook/client';
15
18
  import { type BuiltinIntervention } from '@lobechat/types';
16
19
 
17
- import { LocalSystemInterventions } from './local-system/Intervention';
18
-
19
20
  /**
20
21
  * Builtin tools interventions registry
21
22
  * Organized by toolset (identifier) -> API name
@@ -26,7 +27,7 @@ export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
26
27
  [CloudSandboxManifest.identifier]: CloudSandboxInterventions,
27
28
  [GroupManagementManifest.identifier]: GroupManagementInterventions,
28
29
  [GTDManifest.identifier]: GTDInterventions,
29
- [LocalSystemManifest.identifier]: LocalSystemInterventions,
30
+ [LocalSystemIdentifier]: LocalSystemInterventions,
30
31
  [NotebookManifest.identifier]: NotebookInterventions,
31
32
  };
32
33
 
@@ -1,21 +1,23 @@
1
- import { LocalSystemApiName, LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
1
+ import {
2
+ LocalSystemApiName,
3
+ LocalSystemIdentifier,
4
+ LocalSystemListFilesPlaceholder,
5
+ LocalSystemSearchFilesPlaceholder,
6
+ } from '@lobechat/builtin-tool-local-system/client';
2
7
  import {
3
8
  WebBrowsingManifest,
4
9
  WebBrowsingPlaceholders,
5
10
  } from '@lobechat/builtin-tool-web-browsing/client';
6
11
  import { type BuiltinPlaceholder } from '@lobechat/types';
7
12
 
8
- import { ListFiles as LocalSystemListFiles } from './local-system/Placeholder/ListFiles';
9
- import LocalSystemSearchFiles from './local-system/Placeholder/SearchFiles';
10
-
11
13
  /**
12
14
  * Builtin tools placeholders registry
13
15
  * Organized by toolset (identifier) -> API name
14
16
  */
15
17
  export const BuiltinToolPlaceholders: Record<string, Record<string, any>> = {
16
- [LocalSystemManifest.identifier]: {
17
- [LocalSystemApiName.searchLocalFiles]: LocalSystemSearchFiles,
18
- [LocalSystemApiName.listLocalFiles]: LocalSystemListFiles,
18
+ [LocalSystemIdentifier]: {
19
+ [LocalSystemApiName.searchLocalFiles]: LocalSystemSearchFilesPlaceholder,
20
+ [LocalSystemApiName.listLocalFiles]: LocalSystemListFilesPlaceholder,
19
21
  },
20
22
  [WebBrowsingManifest.identifier]: WebBrowsingPlaceholders as Record<string, any>,
21
23
  };
@@ -10,7 +10,10 @@ import { GroupManagementRenders } from '@lobechat/builtin-tool-group-management/
10
10
  // gtd
11
11
  import { GTDManifest, GTDRenders } from '@lobechat/builtin-tool-gtd/client';
12
12
  // local-system
13
- import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
13
+ import {
14
+ LocalSystemIdentifier,
15
+ LocalSystemRenders,
16
+ } from '@lobechat/builtin-tool-local-system/client';
14
17
  import { NotebookManifest, NotebookRenders } from '@lobechat/builtin-tool-notebook/client';
15
18
  // web-browsing
16
19
  import {
@@ -22,7 +25,6 @@ import { type BuiltinRender } from '@lobechat/types';
22
25
  // knowledge-base
23
26
  import { KnowledgeBaseManifest } from './knowledge-base';
24
27
  import { KnowledgeBaseRenders } from './knowledge-base/Render';
25
- import { LocalSystemRenders } from './local-system/Render';
26
28
 
27
29
  /**
28
30
  * Builtin tools renders registry
@@ -35,7 +37,7 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
35
37
  [GTDManifest.identifier]: GTDRenders as Record<string, BuiltinRender>,
36
38
  [NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,
37
39
  [KnowledgeBaseManifest.identifier]: KnowledgeBaseRenders as Record<string, BuiltinRender>,
38
- [LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,
40
+ [LocalSystemIdentifier]: LocalSystemRenders as Record<string, BuiltinRender>,
39
41
  [WebBrowsingManifest.identifier]: WebBrowsingRenders as Record<string, BuiltinRender>,
40
42
  };
41
43
 
@@ -1,5 +1,5 @@
1
1
  import {
2
- CloudSandboxIdentifier,
2
+ CloudSandboxManifest,
3
3
  CloudSandboxStreamings,
4
4
  } from '@lobechat/builtin-tool-cloud-sandbox/client';
5
5
  import {
@@ -7,11 +7,12 @@ import {
7
7
  GroupManagementStreamings,
8
8
  } from '@lobechat/builtin-tool-group-management/client';
9
9
  import { GTDManifest, GTDStreamings } from '@lobechat/builtin-tool-gtd/client';
10
- import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
10
+ import {
11
+ LocalSystemManifest,
12
+ LocalSystemStreamings,
13
+ } from '@lobechat/builtin-tool-local-system/client';
11
14
  import { type BuiltinStreaming } from '@lobechat/types';
12
15
 
13
- import { LocalSystemStreamings } from './local-system/Streaming';
14
-
15
16
  /**
16
17
  * Builtin tools streaming renderer registry
17
18
  * Organized by toolset (identifier) -> API name
@@ -21,7 +22,7 @@ import { LocalSystemStreamings } from './local-system/Streaming';
21
22
  * The component should fetch streaming content from store internally.
22
23
  */
23
24
  const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> = {
24
- [CloudSandboxIdentifier]: CloudSandboxStreamings as Record<string, BuiltinStreaming>,
25
+ [CloudSandboxManifest.identifier]: CloudSandboxStreamings as Record<string, BuiltinStreaming>,
25
26
  [GroupManagementManifest.identifier]: GroupManagementStreamings as Record<
26
27
  string,
27
28
  BuiltinStreaming
@@ -1,55 +0,0 @@
1
- 'use client';
2
-
3
- import { type EditLocalFileState } from '@lobechat/builtin-tool-local-system';
4
- import { type EditLocalFileParams } from '@lobechat/electron-client-ipc';
5
- import { type BuiltinInspectorProps } from '@lobechat/types';
6
- import { Icon } from '@lobehub/ui';
7
- import { createStaticStyles, cx } from 'antd-style';
8
- import { ChevronRight } from 'lucide-react';
9
- import path from 'path-browserify-esm';
10
- import { memo } from 'react';
11
- import { useTranslation } from 'react-i18next';
12
-
13
- import { shinyTextStyles } from '@/styles';
14
-
15
- const styles = createStaticStyles(({ css, cssVar }) => ({
16
- content: css`
17
- font-family: ${cssVar.fontFamilyCode};
18
- `,
19
- root: css`
20
- overflow: hidden;
21
- display: -webkit-box;
22
- -webkit-box-orient: vertical;
23
- -webkit-line-clamp: 1;
24
-
25
- color: ${cssVar.colorTextDescription};
26
- `,
27
- }));
28
-
29
- export const EditLocalFileInspector = memo<
30
- BuiltinInspectorProps<EditLocalFileParams, EditLocalFileState>
31
- >(({ args, isLoading }) => {
32
- const { t } = useTranslation('plugin');
33
-
34
- // Show filename with parent directory for context
35
- let displayPath = '';
36
- if (args?.file_path) {
37
- const { base, dir } = path.parse(args.file_path);
38
- const parentDir = path.basename(dir);
39
- displayPath = parentDir ? `${parentDir}/${base}` : base;
40
- }
41
-
42
- return (
43
- <div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
44
- <span>{t('builtins.lobe-local-system.apiName.editLocalFile')}</span>
45
- {displayPath && (
46
- <>
47
- <Icon icon={ChevronRight} style={{ marginInline: 4 }} />
48
- <span className={styles.content}>{displayPath}</span>
49
- </>
50
- )}
51
- </div>
52
- );
53
- });
54
-
55
- EditLocalFileInspector.displayName = 'EditLocalFileInspector';
@@ -1,59 +0,0 @@
1
- 'use client';
2
-
3
- import { type GlobFilesState } from '@lobechat/builtin-tool-local-system';
4
- import { type GlobFilesParams } from '@lobechat/electron-client-ipc';
5
- import { type BuiltinInspectorProps } from '@lobechat/types';
6
- import { Icon } from '@lobehub/ui';
7
- import { createStaticStyles, cx } from 'antd-style';
8
- import { ChevronRight } from 'lucide-react';
9
- import { memo } from 'react';
10
- import { useTranslation } from 'react-i18next';
11
-
12
- import { shinyTextStyles } from '@/styles';
13
-
14
- const styles = createStaticStyles(({ css, cssVar }) => ({
15
- content: css`
16
- font-family: ${cssVar.fontFamilyCode};
17
- `,
18
- root: css`
19
- overflow: hidden;
20
- display: -webkit-box;
21
- -webkit-box-orient: vertical;
22
- -webkit-line-clamp: 1;
23
-
24
- color: ${cssVar.colorTextDescription};
25
- `,
26
- }));
27
-
28
- export const GlobLocalFilesInspector = memo<BuiltinInspectorProps<GlobFilesParams, GlobFilesState>>(
29
- ({ args, isLoading }) => {
30
- const { t } = useTranslation('plugin');
31
-
32
- const pattern = args?.pattern || '';
33
-
34
- // When loading, show "本地系统 > 匹配搜索文件"
35
- if (isLoading) {
36
- return (
37
- <div className={cx(styles.root, shinyTextStyles.shinyText)}>
38
- <span>{t('builtins.lobe-local-system.title')}</span>
39
- <Icon icon={ChevronRight} style={{ marginInline: 4 }} />
40
- <span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}</span>
41
- </div>
42
- );
43
- }
44
-
45
- return (
46
- <div className={styles.root}>
47
- <span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}</span>
48
- {pattern && (
49
- <>
50
- <Icon icon={ChevronRight} style={{ marginInline: 4 }} />
51
- <span className={styles.content}>{pattern}</span>
52
- </>
53
- )}
54
- </div>
55
- );
56
- },
57
- );
58
-
59
- GlobLocalFilesInspector.displayName = 'GlobLocalFilesInspector';
@@ -1,59 +0,0 @@
1
- 'use client';
2
-
3
- import { type GrepContentState } from '@lobechat/builtin-tool-local-system';
4
- import { type GrepContentParams } from '@lobechat/electron-client-ipc';
5
- import { type BuiltinInspectorProps } from '@lobechat/types';
6
- import { Icon } from '@lobehub/ui';
7
- import { createStaticStyles, cx } from 'antd-style';
8
- import { ChevronRight } from 'lucide-react';
9
- import { memo } from 'react';
10
- import { useTranslation } from 'react-i18next';
11
-
12
- import { shinyTextStyles } from '@/styles';
13
-
14
- const styles = createStaticStyles(({ css, cssVar }) => ({
15
- content: css`
16
- font-family: ${cssVar.fontFamilyCode};
17
- `,
18
- root: css`
19
- overflow: hidden;
20
- display: -webkit-box;
21
- -webkit-box-orient: vertical;
22
- -webkit-line-clamp: 1;
23
-
24
- color: ${cssVar.colorTextDescription};
25
- `,
26
- }));
27
-
28
- export const GrepContentInspector = memo<
29
- BuiltinInspectorProps<GrepContentParams, GrepContentState>
30
- >(({ args, isLoading }) => {
31
- const { t } = useTranslation('plugin');
32
-
33
- const pattern = args?.pattern || '';
34
-
35
- // When loading, show "本地系统 > 搜索内容"
36
- if (isLoading) {
37
- return (
38
- <div className={cx(styles.root, shinyTextStyles.shinyText)}>
39
- <span>{t('builtins.lobe-local-system.title')}</span>
40
- <Icon icon={ChevronRight} style={{ marginInline: 4 }} />
41
- <span>{t('builtins.lobe-local-system.apiName.grepContent')}</span>
42
- </div>
43
- );
44
- }
45
-
46
- return (
47
- <div className={styles.root}>
48
- <span>{t('builtins.lobe-local-system.apiName.grepContent')}</span>
49
- {pattern && (
50
- <>
51
- <Icon icon={ChevronRight} style={{ marginInline: 4 }} />
52
- <span className={styles.content}>{pattern}</span>
53
- </>
54
- )}
55
- </div>
56
- );
57
- });
58
-
59
- GrepContentInspector.displayName = 'GrepContentInspector';
@@ -1,55 +0,0 @@
1
- 'use client';
2
-
3
- import type { LocalReadFileState } from '@lobechat/builtin-tool-local-system';
4
- import { type LocalReadFileParams } from '@lobechat/electron-client-ipc';
5
- import { type BuiltinInspectorProps } from '@lobechat/types';
6
- import { Icon } from '@lobehub/ui';
7
- import { createStaticStyles, cx } from 'antd-style';
8
- import { ChevronRight } from 'lucide-react';
9
- import path from 'path-browserify-esm';
10
- import { memo } from 'react';
11
- import { useTranslation } from 'react-i18next';
12
-
13
- import { shinyTextStyles } from '@/styles';
14
-
15
- const styles = createStaticStyles(({ css, cssVar }) => ({
16
- content: css`
17
- font-family: ${cssVar.fontFamilyCode};
18
- `,
19
- root: css`
20
- overflow: hidden;
21
- display: -webkit-box;
22
- -webkit-box-orient: vertical;
23
- -webkit-line-clamp: 1;
24
-
25
- color: ${cssVar.colorTextDescription};
26
- `,
27
- }));
28
-
29
- export const ReadLocalFileInspector = memo<
30
- BuiltinInspectorProps<LocalReadFileParams, LocalReadFileState>
31
- >(({ args, isLoading }) => {
32
- const { t } = useTranslation('plugin');
33
-
34
- // Show filename with parent directory for context
35
- let displayPath = '';
36
- if (args?.path) {
37
- const { base, dir } = path.parse(args.path);
38
- const parentDir = path.basename(dir);
39
- displayPath = parentDir ? `${parentDir}/${base}` : base;
40
- }
41
-
42
- return (
43
- <div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
44
- <span>{t('builtins.lobe-local-system.apiName.readLocalFile')}</span>
45
- {displayPath && (
46
- <>
47
- <Icon icon={ChevronRight} style={{ marginInline: 4 }} />
48
- <span className={styles.content}>{displayPath}</span>
49
- </>
50
- )}
51
- </div>
52
- );
53
- });
54
-
55
- ReadLocalFileInspector.displayName = 'ReadLocalFileInspector';