@codebolt/codeboltjs 2.2.1 → 2.2.3

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/Readme.md +3 -0
  2. package/dist/core/Codebolt.d.ts +212 -165
  3. package/dist/core/Codebolt.js +267 -6
  4. package/dist/core/websocket.js +9 -11
  5. package/dist/index.d.ts +1 -1
  6. package/dist/modules/agent.d.ts +2 -16
  7. package/dist/modules/agent.js +15 -33
  8. package/dist/modules/browser.d.ts +1 -1
  9. package/dist/modules/browser.js +52 -51
  10. package/dist/modules/chat.d.ts +2 -2
  11. package/dist/modules/chat.js +20 -18
  12. package/dist/modules/codeutils.d.ts +1 -9
  13. package/dist/modules/codeutils.js +13 -111
  14. package/dist/modules/dbmemory.d.ts +3 -3
  15. package/dist/modules/dbmemory.js +8 -7
  16. package/dist/modules/debug.d.ts +1 -1
  17. package/dist/modules/fs.d.ts +59 -28
  18. package/dist/modules/fs.js +86 -45
  19. package/dist/modules/git.d.ts +1 -1
  20. package/dist/modules/git.js +31 -30
  21. package/dist/modules/history.d.ts +1 -1
  22. package/dist/modules/history.js +7 -6
  23. package/dist/modules/llm.d.ts +13 -20
  24. package/dist/modules/llm.js +16 -15
  25. package/dist/modules/mcp.d.ts +4 -4
  26. package/dist/modules/mcp.js +25 -25
  27. package/dist/modules/outputparsers.d.ts +22 -22
  28. package/dist/modules/outputparsers.js +7 -5
  29. package/dist/modules/project.d.ts +1 -1
  30. package/dist/modules/project.js +15 -13
  31. package/dist/modules/state.d.ts +1 -1
  32. package/dist/modules/state.js +16 -15
  33. package/dist/modules/task.d.ts +136 -92
  34. package/dist/modules/task.js +354 -205
  35. package/dist/modules/terminal.d.ts +1 -1
  36. package/dist/modules/terminal.js +12 -11
  37. package/dist/modules/tokenizer.d.ts +1 -1
  38. package/dist/modules/tokenizer.js +7 -6
  39. package/dist/modules/user-message-manager.d.ts +165 -0
  40. package/dist/modules/user-message-manager.js +308 -0
  41. package/dist/modules/user-message-utilities.d.ts +111 -0
  42. package/dist/modules/user-message-utilities.js +115 -0
  43. package/dist/modules/utils.d.ts +1 -1
  44. package/dist/modules/utils.js +4 -3
  45. package/dist/modules/vectordb.d.ts +1 -1
  46. package/dist/modules/vectordb.js +13 -12
  47. package/dist/notificationfunctions/agent.js +7 -6
  48. package/dist/notificationfunctions/browser.js +9 -8
  49. package/dist/notificationfunctions/chat.js +9 -8
  50. package/dist/notificationfunctions/codeutils.js +9 -8
  51. package/dist/notificationfunctions/crawler.js +9 -8
  52. package/dist/notificationfunctions/dbmemory.js +9 -8
  53. package/dist/notificationfunctions/fs.js +45 -44
  54. package/dist/notificationfunctions/git.d.ts +2 -2
  55. package/dist/notificationfunctions/git.js +111 -51
  56. package/dist/notificationfunctions/history.js +9 -8
  57. package/dist/notificationfunctions/llm.js +9 -8
  58. package/dist/notificationfunctions/mcp.js +17 -16
  59. package/dist/notificationfunctions/search.js +13 -12
  60. package/dist/notificationfunctions/system.js +5 -4
  61. package/dist/notificationfunctions/terminal.js +5 -4
  62. package/dist/notificationfunctions/todo.js +13 -12
  63. package/dist/types/commonTypes.d.ts +4 -0
  64. package/dist/types/index.d.ts +1 -1
  65. package/dist/types/libFunctionTypes.d.ts +918 -29
  66. package/dist/types/libFunctionTypes.js +33 -0
  67. package/dist/types/notificationFunctions/git.d.ts +40 -1
  68. package/dist/types/notificationFunctions/index.d.ts +1 -0
  69. package/dist/types/notificationFunctions/index.js +1 -0
  70. package/package.json +17 -25
  71. package/dist/modules/codeparsers.d.ts +0 -37
  72. package/dist/modules/codeparsers.js +0 -329
@@ -1,4 +1,4 @@
1
- import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '../types/socketMessageTypes';
1
+ import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse, FileListResponse, GrepSearchResponse, EditFileAndApplyDiffResponse, FileSearchResponse, SearchFilesResponse, ListCodeDefinitionsResponse, ReadManyFilesResponse, ListDirectoryResponse } from '@codebolt/types/sdk';
2
2
  /**
3
3
  * @module cbfs
4
4
  * @description This module provides functionality to interact with the filesystem.
@@ -59,35 +59,29 @@ declare const cbfs: {
59
59
  * @description Lists all files.
60
60
  * @returns {Promise<FileListResponse>} A promise that resolves with the list of files.
61
61
  */
62
- listFile: (folderPath: string, isRecursive?: boolean) => Promise<any>;
62
+ listFile: (folderPath: string, isRecursive?: boolean) => Promise<FileListResponse>;
63
63
  /**
64
64
  * @function listCodeDefinitionNames
65
65
  * @description Lists all code definition names in a given path.
66
66
  * @param {string} path - The path to search for code definitions.
67
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of code definition names.
67
+ * @returns {Promise<ListCodeDefinitionsResponse>} A promise that resolves with the list of code definition names.
68
68
  */
69
- listCodeDefinitionNames: (path: string) => Promise<{
70
- success: boolean;
71
- result: any;
72
- }>;
69
+ listCodeDefinitionNames: (path: string) => Promise<ListCodeDefinitionsResponse>;
73
70
  /**
74
71
  * @function searchFiles
75
72
  * @description Searches files in a given path using a regex pattern.
76
73
  * @param {string} path - The path to search within.
77
74
  * @param {string} regex - The regex pattern to search for.
78
75
  * @param {string} filePattern - The file pattern to match files.
79
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
76
+ * @returns {Promise<SearchFilesResponse>} A promise that resolves with the search results.
80
77
  */
81
- searchFiles: (path: string, regex: string, filePattern: string) => Promise<{
82
- success: boolean;
83
- result: any;
84
- }>;
78
+ searchFiles: (path: string, regex: string, filePattern: string) => Promise<SearchFilesResponse>;
85
79
  /**
86
80
  * @function writeToFile
87
81
  * @description Writes content to a file.
88
82
  * @param {string} relPath - The relative path of the file to write to.
89
83
  * @param {string} newContent - The new content to write into the file.
90
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the write operation result.
84
+ * @returns {Promise<WriteToFileResponse>} A promise that resolves with the write operation result.
91
85
  */
92
86
  writeToFile: (relPath: string, newContent: string) => Promise<any>;
93
87
  /**
@@ -106,22 +100,16 @@ declare const cbfs: {
106
100
  * @param {string} includePattern - Pattern of files to include.
107
101
  * @param {string} excludePattern - Pattern of files to exclude.
108
102
  * @param {boolean} caseSensitive - Whether the search is case sensitive.
109
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
103
+ * @returns {Promise<GrepSearchResponse>} A promise that resolves with the search results.
110
104
  */
111
- grepSearch: (path: string, query: string, includePattern?: string, excludePattern?: string, caseSensitive?: boolean) => Promise<{
112
- success: boolean;
113
- result: any;
114
- }>;
105
+ grepSearch: (path: string, query: string, includePattern?: string, excludePattern?: string, caseSensitive?: boolean) => Promise<GrepSearchResponse>;
115
106
  /**
116
107
  * @function fileSearch
117
108
  * @description Performs a fuzzy search for files.
118
109
  * @param {string} query - The query to search for.
119
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
110
+ * @returns {Promise<FileSearchResponse>} A promise that resolves with the search results.
120
111
  */
121
- fileSearch: (query: string) => Promise<{
122
- success: boolean;
123
- result: any;
124
- }>;
112
+ fileSearch: (query: string) => Promise<FileSearchResponse>;
125
113
  /**
126
114
  * @function editFileWithDiff
127
115
  * @description Edits a file by applying a diff.
@@ -130,11 +118,54 @@ declare const cbfs: {
130
118
  * @param {string} diffIdentifier - The diff identifier.
131
119
  * @param {string} prompt - The prompt for the edit.
132
120
  * @param {string} applyModel - The model to apply the edit with.
133
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the edit result.
121
+ * @returns {Promise<EditFileAndApplyDiffResponse>} A promise that resolves with the edit result.
134
122
  */
135
- editFileWithDiff: (targetFile: string, codeEdit: string, diffIdentifier: string, prompt: string, applyModel?: string) => Promise<{
136
- success: boolean;
137
- result: any;
138
- }>;
123
+ editFileWithDiff: (targetFile: string, codeEdit: string, diffIdentifier: string, prompt: string, applyModel?: string) => Promise<EditFileAndApplyDiffResponse>;
124
+ /**
125
+ * @function readManyFiles
126
+ * @description Reads multiple files based on paths, patterns, or glob expressions.
127
+ * @param {string[]} paths - An array of file paths, directory paths, or glob patterns to read.
128
+ * @param {string[]} include - Optional glob patterns for files to include.
129
+ * @param {string[]} exclude - Optional glob patterns for files/directories to exclude.
130
+ * @param {boolean} recursive - Whether to search recursively through subdirectories.
131
+ * @param {boolean} use_default_excludes - Whether to use default exclusion patterns (node_modules, .git, etc.).
132
+ * @param {number} max_files - Maximum number of files to read.
133
+ * @param {number} max_total_size - Maximum total size of content to read (in bytes).
134
+ * @param {boolean} include_metadata - Whether to include file metadata in output.
135
+ * @param {string} separator_format - Custom separator format for file content.
136
+ * @param {boolean} notifyUser - Whether to notify the user about the operation.
137
+ * @returns {Promise<ReadManyFilesResponse>} A promise that resolves with the read operation result.
138
+ */
139
+ readManyFiles: (params: {
140
+ paths: string[];
141
+ include?: string[];
142
+ exclude?: string[];
143
+ recursive?: boolean;
144
+ use_default_excludes?: boolean;
145
+ max_files?: number;
146
+ max_total_size?: number;
147
+ include_metadata?: boolean;
148
+ separator_format?: string;
149
+ notifyUser?: boolean;
150
+ }) => Promise<ReadManyFilesResponse>;
151
+ /**
152
+ * @function listDirectory
153
+ * @description Lists directory contents using advanced directory listing tool.
154
+ * @param {string} path - The path to the directory to list.
155
+ * @param {string[]} ignore - Optional array of glob patterns for files/directories to ignore.
156
+ * @param {boolean} show_hidden - Whether to show hidden files and directories.
157
+ * @param {boolean} detailed - Whether to include detailed information (size, permissions, etc.).
158
+ * @param {number} limit - Maximum number of entries to return.
159
+ * @param {boolean} notifyUser - Whether to notify the user about the operation.
160
+ * @returns {Promise<ListDirectoryResponse>} A promise that resolves with the directory listing result.
161
+ */
162
+ listDirectory: (params: {
163
+ path: string;
164
+ ignore?: string[];
165
+ show_hidden?: boolean;
166
+ detailed?: boolean;
167
+ limit?: number;
168
+ notifyUser?: boolean;
169
+ }) => Promise<ListDirectoryResponse>;
139
170
  };
140
171
  export default cbfs;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const websocket_1 = __importDefault(require("../core/websocket"));
7
+ const enum_1 = require("@codebolt/types/enum");
7
8
  /**
8
9
  * @module cbfs
9
10
  * @description This module provides functionality to interact with the filesystem.
@@ -19,14 +20,14 @@ const cbfs = {
19
20
  */
20
21
  createFile: (fileName, source, filePath) => {
21
22
  return websocket_1.default.messageManager.sendAndWaitForResponse({
22
- "type": "fsEvent",
23
- "action": "createFile",
23
+ "type": enum_1.EventType.FS_EVENT,
24
+ "action": enum_1.FSAction.CREATE_FILE,
24
25
  "message": {
25
26
  fileName,
26
27
  source,
27
28
  filePath
28
29
  },
29
- }, "createFileResponse");
30
+ }, enum_1.FSResponseType.CREATE_FILE_RESPONSE);
30
31
  },
31
32
  /**
32
33
  * @function createFolder
@@ -37,13 +38,13 @@ const cbfs = {
37
38
  */
38
39
  createFolder: (folderName, folderPath) => {
39
40
  return websocket_1.default.messageManager.sendAndWaitForResponse({
40
- "type": "fsEvent",
41
- "action": "createFolder",
41
+ "type": enum_1.EventType.FS_EVENT,
42
+ "action": enum_1.FSAction.CREATE_FOLDER,
42
43
  "message": {
43
44
  folderName,
44
45
  folderPath
45
46
  },
46
- }, "createFolderResponse");
47
+ }, enum_1.FSResponseType.CREATE_FOLDER_RESPONSE);
47
48
  },
48
49
  /**
49
50
  * @function readFile
@@ -54,12 +55,12 @@ const cbfs = {
54
55
  */
55
56
  readFile: (filePath) => {
56
57
  return websocket_1.default.messageManager.sendAndWaitForResponse({
57
- "type": "fsEvent",
58
- "action": "readFile",
58
+ "type": enum_1.EventType.FS_EVENT,
59
+ "action": enum_1.FSAction.READ_FILE,
59
60
  "message": {
60
61
  filePath
61
62
  },
62
- }, "readFileResponse");
63
+ }, enum_1.FSResponseType.READ_FILE_RESPONSE);
63
64
  },
64
65
  /**
65
66
  * @function updateFile
@@ -71,14 +72,14 @@ const cbfs = {
71
72
  */
72
73
  updateFile: (filename, filePath, newContent) => {
73
74
  return websocket_1.default.messageManager.sendAndWaitForResponse({
74
- "type": "fsEvent",
75
- "action": "updateFile",
75
+ "type": enum_1.EventType.FS_EVENT,
76
+ "action": enum_1.FSAction.UPDATE_FILE,
76
77
  "message": {
77
78
  filename,
78
79
  filePath,
79
80
  newContent
80
81
  },
81
- }, "updateFileResponse");
82
+ }, enum_1.FSResponseType.UPDATE_FILE_RESPONSE);
82
83
  },
83
84
  /**
84
85
  * @function deleteFile
@@ -89,13 +90,13 @@ const cbfs = {
89
90
  */
90
91
  deleteFile: (filename, filePath) => {
91
92
  return websocket_1.default.messageManager.sendAndWaitForResponse({
92
- "type": "fsEvent",
93
- "action": "deleteFile",
93
+ "type": enum_1.EventType.FS_EVENT,
94
+ "action": enum_1.FSAction.DELETE_FILE,
94
95
  "message": {
95
96
  filename,
96
97
  filePath
97
98
  },
98
- }, "deleteFileResponse");
99
+ }, enum_1.FSResponseType.DELETE_FILE_RESPONSE);
99
100
  },
100
101
  /**
101
102
  * @function deleteFolder
@@ -106,13 +107,13 @@ const cbfs = {
106
107
  */
107
108
  deleteFolder: (foldername, folderpath) => {
108
109
  return websocket_1.default.messageManager.sendAndWaitForResponse({
109
- "type": "fsEvent",
110
- "action": "deleteFolder",
110
+ "type": enum_1.EventType.FS_EVENT,
111
+ "action": enum_1.FSAction.DELETE_FOLDER,
111
112
  "message": {
112
113
  foldername,
113
114
  folderpath
114
115
  },
115
- }, "deleteFolderResponse");
116
+ }, enum_1.FSResponseType.DELETE_FOLDER_RESPONSE);
116
117
  },
117
118
  /**
118
119
  * @function listFile
@@ -121,28 +122,28 @@ const cbfs = {
121
122
  */
122
123
  listFile: (folderPath, isRecursive = false) => {
123
124
  return websocket_1.default.messageManager.sendAndWaitForResponse({
124
- "type": "fsEvent",
125
- "action": "fileList",
125
+ "type": enum_1.EventType.FS_EVENT,
126
+ "action": enum_1.FSAction.FILE_LIST,
126
127
  message: {
127
128
  folderPath,
128
129
  isRecursive
129
130
  }
130
- }, "fileListResponse");
131
+ }, enum_1.FSResponseType.FILE_LIST_RESPONSE);
131
132
  },
132
133
  /**
133
134
  * @function listCodeDefinitionNames
134
135
  * @description Lists all code definition names in a given path.
135
136
  * @param {string} path - The path to search for code definitions.
136
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of code definition names.
137
+ * @returns {Promise<ListCodeDefinitionsResponse>} A promise that resolves with the list of code definition names.
137
138
  */
138
139
  listCodeDefinitionNames: (path) => {
139
140
  return websocket_1.default.messageManager.sendAndWaitForResponse({
140
- "type": "fsEvent",
141
- "action": "listCodeDefinitionNames",
141
+ "type": enum_1.EventType.FS_EVENT,
142
+ "action": enum_1.FSAction.LIST_CODE_DEFINITION_NAMES,
142
143
  "message": {
143
144
  path
144
145
  }
145
- }, "listCodeDefinitionNamesResponse");
146
+ }, enum_1.FSResponseType.LIST_CODE_DEFINITION_NAMES_RESPONSE);
146
147
  },
147
148
  /**
148
149
  * @function searchFiles
@@ -150,35 +151,35 @@ const cbfs = {
150
151
  * @param {string} path - The path to search within.
151
152
  * @param {string} regex - The regex pattern to search for.
152
153
  * @param {string} filePattern - The file pattern to match files.
153
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
154
+ * @returns {Promise<SearchFilesResponse>} A promise that resolves with the search results.
154
155
  */
155
156
  searchFiles: (path, regex, filePattern) => {
156
157
  return websocket_1.default.messageManager.sendAndWaitForResponse({
157
- "type": "fsEvent",
158
- "action": "searchFiles",
158
+ "type": enum_1.EventType.FS_EVENT,
159
+ "action": enum_1.FSAction.SEARCH_FILES,
159
160
  "message": {
160
161
  path,
161
162
  regex,
162
163
  filePattern
163
164
  }
164
- }, "searchFilesResponse");
165
+ }, enum_1.FSResponseType.SEARCH_FILES_RESPONSE);
165
166
  },
166
167
  /**
167
168
  * @function writeToFile
168
169
  * @description Writes content to a file.
169
170
  * @param {string} relPath - The relative path of the file to write to.
170
171
  * @param {string} newContent - The new content to write into the file.
171
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the write operation result.
172
+ * @returns {Promise<WriteToFileResponse>} A promise that resolves with the write operation result.
172
173
  */
173
174
  writeToFile: (relPath, newContent) => {
174
175
  return websocket_1.default.messageManager.sendAndWaitForResponse({
175
- "type": "fsEvent",
176
- "action": "writeToFile",
176
+ "type": enum_1.EventType.FS_EVENT,
177
+ "action": enum_1.FSAction.WRITE_TO_FILE,
177
178
  "message": {
178
179
  relPath,
179
180
  newContent
180
181
  }
181
- }, "writeToFileResponse");
182
+ }, enum_1.FSResponseType.WRITE_TO_FILE_RESPONSE);
182
183
  },
183
184
  /**
184
185
  * @function listFiles
@@ -196,12 +197,12 @@ const cbfs = {
196
197
  * @param {string} includePattern - Pattern of files to include.
197
198
  * @param {string} excludePattern - Pattern of files to exclude.
198
199
  * @param {boolean} caseSensitive - Whether the search is case sensitive.
199
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
200
+ * @returns {Promise<GrepSearchResponse>} A promise that resolves with the search results.
200
201
  */
201
202
  grepSearch: (path, query, includePattern, excludePattern, caseSensitive = true) => {
202
203
  return websocket_1.default.messageManager.sendAndWaitForResponse({
203
- "type": "fsEvent",
204
- "action": "grep_search",
204
+ "type": enum_1.EventType.FS_EVENT,
205
+ "action": enum_1.FSAction.GREP_SEARCH,
205
206
  "message": {
206
207
  path,
207
208
  query,
@@ -209,22 +210,22 @@ const cbfs = {
209
210
  excludePattern,
210
211
  caseSensitive
211
212
  }
212
- }, "grepSearchResponse");
213
+ }, enum_1.FSResponseType.GREP_SEARCH_RESPONSE);
213
214
  },
214
215
  /**
215
216
  * @function fileSearch
216
217
  * @description Performs a fuzzy search for files.
217
218
  * @param {string} query - The query to search for.
218
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
219
+ * @returns {Promise<FileSearchResponse>} A promise that resolves with the search results.
219
220
  */
220
221
  fileSearch: (query) => {
221
222
  return websocket_1.default.messageManager.sendAndWaitForResponse({
222
- "type": "fsEvent",
223
- "action": "file_search",
223
+ "type": enum_1.EventType.FS_EVENT,
224
+ "action": enum_1.FSAction.FILE_SEARCH,
224
225
  "message": {
225
226
  query
226
227
  }
227
- }, "fileSearchResponse");
228
+ }, enum_1.FSResponseType.FILE_SEARCH_RESPONSE);
228
229
  },
229
230
  /**
230
231
  * @function editFileWithDiff
@@ -234,12 +235,12 @@ const cbfs = {
234
235
  * @param {string} diffIdentifier - The diff identifier.
235
236
  * @param {string} prompt - The prompt for the edit.
236
237
  * @param {string} applyModel - The model to apply the edit with.
237
- * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the edit result.
238
+ * @returns {Promise<EditFileAndApplyDiffResponse>} A promise that resolves with the edit result.
238
239
  */
239
240
  editFileWithDiff: (targetFile, codeEdit, diffIdentifier, prompt, applyModel) => {
240
241
  return websocket_1.default.messageManager.sendAndWaitForResponse({
241
- "type": "fsEvent",
242
- "action": "edit_file_with_diff",
242
+ "type": enum_1.EventType.FS_EVENT,
243
+ "action": enum_1.FSAction.EDIT_FILE_WITH_DIFF,
243
244
  "message": {
244
245
  target_file: targetFile,
245
246
  code_edit: codeEdit,
@@ -247,7 +248,47 @@ const cbfs = {
247
248
  prompt,
248
249
  applyModel
249
250
  }
250
- }, "editFileAndApplyDiffResponse");
251
+ }, enum_1.FSResponseType.EDIT_FILE_AND_APPLY_DIFF_RESPONSE);
252
+ },
253
+ /**
254
+ * @function readManyFiles
255
+ * @description Reads multiple files based on paths, patterns, or glob expressions.
256
+ * @param {string[]} paths - An array of file paths, directory paths, or glob patterns to read.
257
+ * @param {string[]} include - Optional glob patterns for files to include.
258
+ * @param {string[]} exclude - Optional glob patterns for files/directories to exclude.
259
+ * @param {boolean} recursive - Whether to search recursively through subdirectories.
260
+ * @param {boolean} use_default_excludes - Whether to use default exclusion patterns (node_modules, .git, etc.).
261
+ * @param {number} max_files - Maximum number of files to read.
262
+ * @param {number} max_total_size - Maximum total size of content to read (in bytes).
263
+ * @param {boolean} include_metadata - Whether to include file metadata in output.
264
+ * @param {string} separator_format - Custom separator format for file content.
265
+ * @param {boolean} notifyUser - Whether to notify the user about the operation.
266
+ * @returns {Promise<ReadManyFilesResponse>} A promise that resolves with the read operation result.
267
+ */
268
+ readManyFiles: (params) => {
269
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
270
+ "type": enum_1.EventType.FS_EVENT,
271
+ "action": enum_1.FSAction.READ_MANY_FILES,
272
+ "message": params
273
+ }, enum_1.FSResponseType.READ_MANY_FILES_RESPONSE);
274
+ },
275
+ /**
276
+ * @function listDirectory
277
+ * @description Lists directory contents using advanced directory listing tool.
278
+ * @param {string} path - The path to the directory to list.
279
+ * @param {string[]} ignore - Optional array of glob patterns for files/directories to ignore.
280
+ * @param {boolean} show_hidden - Whether to show hidden files and directories.
281
+ * @param {boolean} detailed - Whether to include detailed information (size, permissions, etc.).
282
+ * @param {number} limit - Maximum number of entries to return.
283
+ * @param {boolean} notifyUser - Whether to notify the user about the operation.
284
+ * @returns {Promise<ListDirectoryResponse>} A promise that resolves with the directory listing result.
285
+ */
286
+ listDirectory: (params) => {
287
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
288
+ "type": enum_1.EventType.FS_EVENT,
289
+ "action": enum_1.FSAction.LIST_DIRECTORY,
290
+ "message": params
291
+ }, enum_1.FSResponseType.LIST_DIRECTORY_RESPONSE);
251
292
  },
252
293
  };
253
294
  exports.default = cbfs;
@@ -1,4 +1,4 @@
1
- import { GitInitResponse, GitPullResponse, GitPushResponse, GitStatusResponse, AddResponse, GitCommitResponse, GitCheckoutResponse, GitBranchResponse, GitLogsResponse, GitDiffResponse } from '../types/socketMessageTypes';
1
+ import { GitInitResponse, GitPullResponse, GitPushResponse, GitStatusResponse, AddResponse, GitCommitResponse, GitCheckoutResponse, GitBranchResponse, GitLogsResponse, GitDiffResponse } from '@codebolt/types/sdk';
2
2
  /**
3
3
  * A service for interacting with Git operations via WebSocket messages.
4
4
  */
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const websocket_1 = __importDefault(require("../core/websocket"));
7
+ const enum_1 = require("@codebolt/types/enum");
7
8
  /**
8
9
  * A service for interacting with Git operations via WebSocket messages.
9
10
  */
@@ -15,10 +16,10 @@ const gitService = {
15
16
  */
16
17
  init: async (path) => {
17
18
  return websocket_1.default.messageManager.sendAndWaitForResponse({
18
- "type": "gitEvent",
19
- "action": "Init",
19
+ "type": enum_1.EventType.GIT_EVENT,
20
+ "action": enum_1.GitAction.INIT,
20
21
  "path": path
21
- }, "gitInitResponse");
22
+ }, enum_1.GitResponseType.GIT_INIT_RESPONSE);
22
23
  },
23
24
  /**
24
25
  * Pulls the latest changes from the remote repository to the local repository at the given path.
@@ -27,9 +28,9 @@ const gitService = {
27
28
  */
28
29
  pull: async () => {
29
30
  return websocket_1.default.messageManager.sendAndWaitForResponse({
30
- "type": "gitEvent",
31
- "action": "Pull"
32
- }, "PullResponse");
31
+ "type": enum_1.EventType.GIT_EVENT,
32
+ "action": enum_1.GitAction.PULL
33
+ }, enum_1.GitResponseType.PULL_RESPONSE);
33
34
  },
34
35
  /**
35
36
  * Pushes local repository changes to the remote repository at the given path.
@@ -38,9 +39,9 @@ const gitService = {
38
39
  */
39
40
  push: async () => {
40
41
  return websocket_1.default.messageManager.sendAndWaitForResponse({
41
- "type": "gitEvent",
42
- "action": "Push",
43
- }, "PushResponse");
42
+ "type": enum_1.EventType.GIT_EVENT,
43
+ "action": enum_1.GitAction.PUSH,
44
+ }, enum_1.GitResponseType.PUSH_RESPONSE);
44
45
  },
45
46
  /**
46
47
  * Retrieves the status of the local repository at the given path.
@@ -49,9 +50,9 @@ const gitService = {
49
50
  */
50
51
  status: async () => {
51
52
  return websocket_1.default.messageManager.sendAndWaitForResponse({
52
- "type": "gitEvent",
53
- "action": "Status",
54
- }, "gitStatusResponse");
53
+ "type": enum_1.EventType.GIT_EVENT,
54
+ "action": enum_1.GitAction.STATUS,
55
+ }, enum_1.GitResponseType.GIT_STATUS_RESPONSE);
55
56
  },
56
57
  /**
57
58
  * Adds changes in the local repository to the staging area at the given path.
@@ -60,9 +61,9 @@ const gitService = {
60
61
  */
61
62
  addAll: async () => {
62
63
  return websocket_1.default.messageManager.sendAndWaitForResponse({
63
- "type": "gitEvent",
64
- "action": "Add",
65
- }, "AddResponse");
64
+ "type": enum_1.EventType.GIT_EVENT,
65
+ "action": enum_1.GitAction.ADD,
66
+ }, enum_1.GitResponseType.ADD_RESPONSE);
66
67
  },
67
68
  /**
68
69
  * Commits the staged changes in the local repository with the given commit message.
@@ -71,10 +72,10 @@ const gitService = {
71
72
  */
72
73
  commit: async (message) => {
73
74
  return websocket_1.default.messageManager.sendAndWaitForResponse({
74
- "type": "gitEvent",
75
- "action": "Commit",
75
+ "type": enum_1.EventType.GIT_EVENT,
76
+ "action": enum_1.GitAction.COMMIT,
76
77
  "message": message
77
- }, "gitCommitResponse");
78
+ }, enum_1.GitResponseType.GIT_COMMIT_RESPONSE);
78
79
  },
79
80
  /**
80
81
  * Checks out a branch or commit in the local repository at the given path.
@@ -84,10 +85,10 @@ const gitService = {
84
85
  */
85
86
  checkout: async (branch) => {
86
87
  return websocket_1.default.messageManager.sendAndWaitForResponse({
87
- "type": "gitEvent",
88
- "action": "Checkout",
88
+ "type": enum_1.EventType.GIT_EVENT,
89
+ "action": enum_1.GitAction.CHECKOUT,
89
90
  "branch": branch
90
- }, "gitCheckoutResponse");
91
+ }, enum_1.GitResponseType.GIT_CHECKOUT_RESPONSE);
91
92
  },
92
93
  /**
93
94
  * Creates a new branch in the local repository at the given path.
@@ -97,10 +98,10 @@ const gitService = {
97
98
  */
98
99
  branch: async (branch) => {
99
100
  return websocket_1.default.messageManager.sendAndWaitForResponse({
100
- "type": "gitEvent",
101
- "action": "gitBranch",
101
+ "type": enum_1.EventType.GIT_EVENT,
102
+ "action": enum_1.GitAction.GIT_BRANCH,
102
103
  "branch": branch,
103
- }, "gitBranchResponse");
104
+ }, enum_1.GitResponseType.GIT_BRANCH_RESPONSE);
104
105
  },
105
106
  /**
106
107
  * Retrieves the commit logs for the local repository at the given path.
@@ -109,10 +110,10 @@ const gitService = {
109
110
  */
110
111
  logs: async (path) => {
111
112
  return websocket_1.default.messageManager.sendAndWaitForResponse({
112
- "type": "gitEvent",
113
- "action": "gitLogs",
113
+ "type": enum_1.EventType.GIT_EVENT,
114
+ "action": enum_1.GitAction.GIT_LOGS,
114
115
  "path": path
115
- }, "gitLogsResponse");
116
+ }, enum_1.GitResponseType.GIT_LOGS_RESPONSE);
116
117
  },
117
118
  /**
118
119
  * Retrieves the diff of changes for a specific commit in the local repository.
@@ -122,10 +123,10 @@ const gitService = {
122
123
  */
123
124
  diff: async (commitHash) => {
124
125
  return websocket_1.default.messageManager.sendAndWaitForResponse({
125
- "type": "gitEvent",
126
- "action": "Diff",
126
+ "type": enum_1.EventType.GIT_EVENT,
127
+ "action": enum_1.GitAction.DIFF,
127
128
  "commitHash": commitHash
128
- }, "DiffResponse");
129
+ }, enum_1.GitResponseType.DIFF_RESPONSE);
129
130
  }
130
131
  };
131
132
  exports.default = gitService;
@@ -1,4 +1,4 @@
1
- import { GetSummarizeAllResponse, GetSummarizeResponse } from '../types/socketMessageTypes';
1
+ import { GetSummarizeAllResponse, GetSummarizeResponse } from '@codebolt/types/sdk';
2
2
  import { LogType } from '../types/commonTypes';
3
3
  /**
4
4
  * Enum representing different types of log messages.
@@ -7,6 +7,7 @@ exports.chatSummary = exports.LogType = exports.logType = void 0;
7
7
  const websocket_1 = __importDefault(require("../core/websocket"));
8
8
  const commonTypes_1 = require("../types/commonTypes");
9
9
  Object.defineProperty(exports, "LogType", { enumerable: true, get: function () { return commonTypes_1.LogType; } });
10
+ const enum_1 = require("@codebolt/types/enum");
10
11
  /**
11
12
  * Enum representing different types of log messages.
12
13
  * @deprecated Use LogType from commonTypes instead
@@ -32,9 +33,9 @@ exports.chatSummary = {
32
33
  */
33
34
  summarizeAll: () => {
34
35
  return websocket_1.default.messageManager.sendAndWaitForResponse({
35
- "type": "chatSummaryEvent",
36
- "action": "summarizeAll",
37
- }, "getSummarizeAllResponse");
36
+ "type": enum_1.EventType.CHAT_SUMMARY_EVENT,
37
+ "action": enum_1.ChatSummaryAction.SUMMARIZE_ALL,
38
+ }, enum_1.ChatSummaryResponseType.SUMMARIZE_ALL_RESPONSE);
38
39
  },
39
40
  /**
40
41
  * Summarizes a specific part of the chat history.
@@ -45,11 +46,11 @@ exports.chatSummary = {
45
46
  */
46
47
  summarize: (messages, depth) => {
47
48
  return websocket_1.default.messageManager.sendAndWaitForResponse({
48
- "type": "chatSummaryEvent",
49
- "action": "summarize",
49
+ "type": enum_1.EventType.CHAT_SUMMARY_EVENT,
50
+ "action": enum_1.ChatSummaryAction.SUMMARIZE_PART,
50
51
  messages,
51
52
  depth
52
- }, "getSummarizeResponse");
53
+ }, enum_1.ChatSummaryResponseType.SUMMARIZE_PART_RESPONSE);
53
54
  }
54
55
  };
55
56
  exports.default = exports.chatSummary;