@lobehub/chat 1.141.8 → 1.141.10

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 (50) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/apps/desktop/package.json +1 -0
  3. package/apps/desktop/src/main/controllers/LocalFileCtr.ts +279 -52
  4. package/apps/desktop/src/main/controllers/__tests__/LocalFileCtr.test.ts +392 -0
  5. package/changelog/v1.json +18 -0
  6. package/package.json +1 -1
  7. package/packages/agent-runtime/src/core/InterventionChecker.ts +173 -0
  8. package/packages/agent-runtime/src/core/UsageCounter.ts +248 -0
  9. package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +334 -0
  10. package/packages/agent-runtime/src/core/__tests__/UsageCounter.test.ts +873 -0
  11. package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +32 -26
  12. package/packages/agent-runtime/src/core/index.ts +2 -0
  13. package/packages/agent-runtime/src/core/runtime.ts +31 -18
  14. package/packages/agent-runtime/src/types/instruction.ts +1 -1
  15. package/packages/agent-runtime/src/types/state.ts +3 -3
  16. package/packages/agent-runtime/src/types/usage.ts +34 -25
  17. package/packages/context-engine/src/index.ts +1 -0
  18. package/packages/context-engine/src/tools/ToolNameResolver.ts +2 -2
  19. package/packages/context-engine/src/tools/ToolsEngine.ts +37 -8
  20. package/packages/context-engine/src/tools/__tests__/ToolsEngine.test.ts +149 -5
  21. package/packages/context-engine/src/tools/__tests__/utils.test.ts +2 -2
  22. package/packages/context-engine/src/tools/index.ts +1 -0
  23. package/packages/context-engine/src/tools/types.ts +18 -3
  24. package/packages/context-engine/src/tools/utils.ts +4 -4
  25. package/packages/types/src/tool/builtin.ts +54 -1
  26. package/packages/types/src/tool/index.ts +1 -0
  27. package/packages/types/src/tool/intervention.ts +114 -0
  28. package/packages/types/src/user/settings/tool.ts +37 -0
  29. package/src/app/[variants]/(main)/discover/(list)/(home)/Client.tsx +2 -2
  30. package/src/app/[variants]/(main)/discover/(list)/(home)/HomePage.tsx +2 -2
  31. package/src/app/[variants]/(main)/discover/DiscoverRouter.tsx +2 -1
  32. package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +4 -2
  33. package/src/store/chat/slices/builtinTool/actions/{dalle.test.ts → __tests__/dalle.test.ts} +2 -5
  34. package/src/store/chat/slices/builtinTool/actions/__tests__/{localFile.test.ts → localSystem.test.ts} +4 -4
  35. package/src/store/chat/slices/builtinTool/actions/index.ts +2 -2
  36. package/src/store/chat/slices/builtinTool/actions/{localFile.ts → localSystem.ts} +183 -69
  37. package/src/store/electron/selectors/__tests__/desktopState.test.ts +3 -3
  38. package/src/store/electron/selectors/desktopState.ts +11 -2
  39. package/src/tools/local-system/Placeholder/ListFiles.tsx +10 -8
  40. package/src/tools/local-system/Placeholder/SearchFiles.tsx +12 -10
  41. package/src/tools/local-system/Placeholder/index.tsx +1 -1
  42. package/src/tools/local-system/Render/ReadLocalFile/ReadFileSkeleton.tsx +8 -18
  43. package/src/tools/local-system/Render/ReadLocalFile/ReadFileView.tsx +21 -6
  44. package/src/tools/local-system/Render/SearchFiles/Result.tsx +5 -4
  45. package/src/tools/local-system/Render/SearchFiles/SearchQuery/SearchView.tsx +4 -15
  46. package/src/tools/local-system/Render/SearchFiles/index.tsx +3 -2
  47. package/src/tools/local-system/type.ts +39 -0
  48. package/src/tools/local-system/Placeholder/ReadLocalFile.tsx +0 -9
  49. package/src/tools/local-system/Render/ReadLocalFile/style.ts +0 -37
  50. /package/src/store/chat/slices/builtinTool/actions/{search.test.ts → __tests__/search.test.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { LocalSearchFilesParams } from '@lobechat/electron-client-ipc';
2
2
  import { memo } from 'react';
3
+ import { Flexbox } from 'react-layout-kit';
3
4
 
4
5
  import { LocalFileSearchState } from '@/tools/local-system/type';
5
6
  import { ChatMessagePluginError } from '@/types/message';
@@ -16,14 +17,14 @@ interface SearchFilesProps {
16
17
 
17
18
  const SearchFiles = memo<SearchFilesProps>(({ messageId, pluginError, args, pluginState }) => {
18
19
  return (
19
- <>
20
+ <Flexbox gap={4}>
20
21
  <SearchQuery args={args} messageId={messageId} pluginState={pluginState} />
21
22
  <SearchResult
22
23
  messageId={messageId}
23
24
  pluginError={pluginError}
24
25
  searchResults={pluginState?.searchResults}
25
26
  />
26
- </>
27
+ </Flexbox>
27
28
  );
28
29
  });
29
30
 
@@ -1,7 +1,13 @@
1
1
  import {
2
+ EditLocalFileResult,
3
+ GetCommandOutputResult,
4
+ GlobFilesResult,
5
+ GrepContentResult,
6
+ KillCommandResult,
2
7
  LocalFileItem,
3
8
  LocalMoveFilesResultItem,
4
9
  LocalReadFileResult,
10
+ RunCommandResult,
5
11
  } from '@lobechat/electron-client-ipc';
6
12
 
7
13
  export interface FileResult {
@@ -49,3 +55,36 @@ export interface LocalRenameFileState {
49
55
  oldPath: string;
50
56
  success: boolean;
51
57
  }
58
+
59
+ // Shell Command States
60
+ export interface RunCommandState {
61
+ message: string;
62
+ result: RunCommandResult;
63
+ }
64
+
65
+ export interface GetCommandOutputState {
66
+ message: string;
67
+ result: GetCommandOutputResult;
68
+ }
69
+
70
+ export interface KillCommandState {
71
+ message: string;
72
+ result: KillCommandResult;
73
+ }
74
+
75
+ // Search & Find States
76
+ export interface GrepContentState {
77
+ message: string;
78
+ result: GrepContentResult;
79
+ }
80
+
81
+ export interface GlobFilesState {
82
+ message: string;
83
+ result: GlobFilesResult;
84
+ }
85
+
86
+ // Edit State
87
+ export interface EditLocalFileState {
88
+ message: string;
89
+ result: EditLocalFileResult;
90
+ }
@@ -1,9 +0,0 @@
1
- 'use client';
2
-
3
- import { memo } from 'react';
4
-
5
- import Skeleton from '../Render/ReadLocalFile/ReadFileSkeleton';
6
-
7
- const ReadLocalFile = memo(() => <Skeleton />);
8
-
9
- export default ReadLocalFile;
@@ -1,37 +0,0 @@
1
- import { createStyles } from 'antd-style';
2
-
3
- export const useStyles = createStyles(({ css, token }) => ({
4
- container: css`
5
- overflow: hidden;
6
-
7
- max-width: 100%;
8
- padding: 12px;
9
- border: 1px solid ${token.colorBorderSecondary};
10
- border-radius: ${token.borderRadius}px;
11
- `,
12
- fileName: css`
13
- color: ${token.colorTextSecondary};
14
- `,
15
- meta: css`
16
- font-size: 10px;
17
- color: ${token.colorTextSecondary};
18
- `,
19
- metaItem: css`
20
- white-space: nowrap;
21
- `,
22
- path: css`
23
- font-size: 12px;
24
- line-height: 1;
25
- `,
26
- previewBox: css`
27
- padding-block: 8px;
28
- padding-inline: 12px;
29
- border-radius: ${token.borderRadiusSM}px;
30
- background: ${token.colorFillTertiary};
31
- `,
32
- previewText: css`
33
- font-family: ${token.fontFamilyCode};
34
- font-size: 12px;
35
- color: ${token.colorTextSecondary};
36
- `,
37
- }));