@codebolt/codeboltjs 2.0.4 → 2.0.6

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 (91) hide show
  1. package/dist/core/messageManager.d.ts +47 -0
  2. package/dist/core/messageManager.js +128 -0
  3. package/dist/{modules → core}/websocket.d.ts +5 -0
  4. package/dist/{modules → core}/websocket.js +15 -10
  5. package/dist/index.d.ts +98 -68
  6. package/dist/index.js +51 -4
  7. package/dist/modules/agent.js +26 -58
  8. package/dist/modules/browser.d.ts +7 -7
  9. package/dist/modules/browser.js +75 -195
  10. package/dist/modules/chat.d.ts +8 -20
  11. package/dist/modules/chat.js +60 -123
  12. package/dist/modules/codeparsers.d.ts +32 -3
  13. package/dist/modules/codeparsers.js +295 -3
  14. package/dist/modules/codeutils.d.ts +24 -7
  15. package/dist/modules/codeutils.js +113 -126
  16. package/dist/modules/crawler.d.ts +1 -16
  17. package/dist/modules/crawler.js +13 -72
  18. package/dist/modules/dbmemory.js +12 -28
  19. package/dist/modules/debug.js +17 -33
  20. package/dist/modules/docutils.d.ts +1 -4
  21. package/dist/modules/docutils.js +52 -2
  22. package/dist/modules/fs.d.ts +47 -1
  23. package/dist/modules/fs.js +151 -162
  24. package/dist/modules/git.d.ts +7 -14
  25. package/dist/modules/git.js +54 -163
  26. package/dist/modules/history.js +11 -27
  27. package/dist/modules/llm.js +8 -16
  28. package/dist/modules/outputparsers.d.ts +36 -4
  29. package/dist/modules/outputparsers.js +56 -5
  30. package/dist/modules/project.d.ts +4 -5
  31. package/dist/modules/project.js +23 -45
  32. package/dist/modules/state.js +29 -69
  33. package/dist/modules/task.js +19 -43
  34. package/dist/modules/terminal.d.ts +3 -2
  35. package/dist/modules/terminal.js +36 -47
  36. package/dist/modules/tokenizer.js +15 -31
  37. package/dist/modules/tools.d.ts +0 -6
  38. package/dist/modules/tools.js +41 -179
  39. package/dist/modules/utils.js +22 -0
  40. package/dist/modules/vectordb.js +30 -62
  41. package/dist/utils/parse-source-code/index.d.ts +9 -0
  42. package/dist/utils/parse-source-code/index.js +233 -0
  43. package/dist/utils/parse-source-code/languageParser.d.ts +8 -0
  44. package/dist/utils/parse-source-code/languageParser.js +137 -0
  45. package/dist/utils/parse-source-code/queries/c-sharp.d.ts +2 -0
  46. package/dist/utils/parse-source-code/queries/c-sharp.js +25 -0
  47. package/dist/utils/parse-source-code/queries/c.d.ts +2 -0
  48. package/dist/utils/parse-source-code/queries/c.js +17 -0
  49. package/dist/utils/parse-source-code/queries/cpp.d.ts +2 -0
  50. package/dist/utils/parse-source-code/queries/cpp.js +25 -0
  51. package/dist/utils/parse-source-code/queries/go.d.ts +2 -0
  52. package/dist/utils/parse-source-code/queries/go.js +29 -0
  53. package/dist/utils/parse-source-code/queries/index.d.ts +12 -0
  54. package/dist/utils/parse-source-code/queries/index.js +30 -0
  55. package/dist/utils/parse-source-code/queries/java.d.ts +2 -0
  56. package/dist/utils/parse-source-code/queries/java.js +17 -0
  57. package/dist/utils/parse-source-code/queries/javascript.d.ts +2 -0
  58. package/dist/utils/parse-source-code/queries/javascript.js +67 -0
  59. package/dist/utils/parse-source-code/queries/php.d.ts +2 -0
  60. package/dist/utils/parse-source-code/queries/php.js +17 -0
  61. package/dist/utils/parse-source-code/queries/python.d.ts +2 -0
  62. package/dist/utils/parse-source-code/queries/python.js +13 -0
  63. package/dist/utils/parse-source-code/queries/ruby.d.ts +2 -0
  64. package/dist/utils/parse-source-code/queries/ruby.js +54 -0
  65. package/dist/utils/parse-source-code/queries/rust.d.ts +2 -0
  66. package/dist/utils/parse-source-code/queries/rust.js +18 -0
  67. package/dist/utils/parse-source-code/queries/swift.d.ts +2 -0
  68. package/dist/utils/parse-source-code/queries/swift.js +47 -0
  69. package/dist/utils/parse-source-code/queries/typescript.d.ts +2 -0
  70. package/dist/utils/parse-source-code/queries/typescript.js +34 -0
  71. package/dist/utils/parse-source-code/tree-sitter-c.wasm +0 -0
  72. package/dist/utils/parse-source-code/tree-sitter-c_sharp.wasm +0 -0
  73. package/dist/utils/parse-source-code/tree-sitter-cpp.wasm +0 -0
  74. package/dist/utils/parse-source-code/tree-sitter-go.wasm +0 -0
  75. package/dist/utils/parse-source-code/tree-sitter-java.wasm +0 -0
  76. package/dist/utils/parse-source-code/tree-sitter-javascript.wasm +0 -0
  77. package/dist/utils/parse-source-code/tree-sitter-php.wasm +0 -0
  78. package/dist/utils/parse-source-code/tree-sitter-python.wasm +0 -0
  79. package/dist/utils/parse-source-code/tree-sitter-ruby.wasm +0 -0
  80. package/dist/utils/parse-source-code/tree-sitter-rust.wasm +0 -0
  81. package/dist/utils/parse-source-code/tree-sitter-swift.wasm +0 -0
  82. package/dist/utils/parse-source-code/tree-sitter-tsx.wasm +0 -0
  83. package/dist/utils/parse-source-code/tree-sitter-typescript.wasm +0 -0
  84. package/dist/utils/parse-source-code/tree-sitter.wasm +0 -0
  85. package/dist/utils.d.ts +1 -1
  86. package/dist/utils.js +1 -1
  87. package/package.json +6 -2
  88. package/dist/utils/editFile.js +0 -30
  89. /package/dist/{utils/editFile.d.ts → modules/utils.d.ts} +0 -0
  90. /package/dist/{modules → utils}/toolBox.d.ts +0 -0
  91. /package/dist/{modules → utils}/toolBox.js +0 -0
@@ -1,8 +1,36 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
29
  /**
4
30
  * A module for document utility functions.
5
31
  */
32
+ const fs = __importStar(require("fs"));
33
+ const pdf_parse_1 = __importDefault(require("pdf-parse"));
6
34
  const cbdocutils = {
7
35
  /**
8
36
  * Converts a PDF document to text.
@@ -10,9 +38,31 @@ const cbdocutils = {
10
38
  * @returns {Promise<string>} A promise that resolves with the converted text.
11
39
  */
12
40
  pdf_to_text: (pdf_path) => {
13
- // Implementation would go here
14
41
  return new Promise((resolve, reject) => {
15
- // PDF to text conversion logic
42
+ try {
43
+ // Check if file exists
44
+ if (!fs.existsSync(pdf_path)) {
45
+ return reject(new Error(`PDF file not found at path: ${pdf_path}`));
46
+ }
47
+ // Read the PDF file as buffer
48
+ const dataBuffer = fs.readFileSync(pdf_path);
49
+ // Parse the PDF document
50
+ (0, pdf_parse_1.default)(dataBuffer)
51
+ .then((data) => {
52
+ resolve(data.text);
53
+ })
54
+ .catch((error) => {
55
+ reject(new Error(`Error parsing PDF: ${error.message}`));
56
+ });
57
+ }
58
+ catch (error) {
59
+ if (error instanceof Error) {
60
+ reject(new Error(`Error processing PDF: ${error.message}`));
61
+ }
62
+ else {
63
+ reject(new Error('Unknown error processing PDF'));
64
+ }
65
+ }
16
66
  });
17
67
  }
18
68
  };
@@ -89,6 +89,52 @@ declare const cbfs: {
89
89
  * @param {string} newContent - The new content to write into the file.
90
90
  * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the write operation result.
91
91
  */
92
- writeToFile: (relPath: string, newContent: string) => Promise<unknown>;
92
+ writeToFile: (relPath: string, newContent: string) => Promise<any>;
93
+ /**
94
+ * @function listFiles
95
+ * @description Lists all files in a directory.
96
+ * @param {string} path - The path to list files from.
97
+ * @param {boolean} isRecursive - Whether to list files recursively.
98
+ * @param {boolean} askForPermission - Whether to ask for permission before listing.
99
+ * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of files.
100
+ */
101
+ /**
102
+ * @function grepSearch
103
+ * @description Performs a grep search in files.
104
+ * @param {string} path - The path to search within.
105
+ * @param {string} query - The query to search for.
106
+ * @param {string} includePattern - Pattern of files to include.
107
+ * @param {string} excludePattern - Pattern of files to exclude.
108
+ * @param {boolean} caseSensitive - Whether the search is case sensitive.
109
+ * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
110
+ */
111
+ grepSearch: (path: string, query: string, includePattern?: string, excludePattern?: string, caseSensitive?: boolean) => Promise<{
112
+ success: boolean;
113
+ result: any;
114
+ }>;
115
+ /**
116
+ * @function fileSearch
117
+ * @description Performs a fuzzy search for files.
118
+ * @param {string} query - The query to search for.
119
+ * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
120
+ */
121
+ fileSearch: (query: string) => Promise<{
122
+ success: boolean;
123
+ result: any;
124
+ }>;
125
+ /**
126
+ * @function editFileWithDiff
127
+ * @description Edits a file by applying a diff.
128
+ * @param {string} targetFile - The target file to edit.
129
+ * @param {string} codeEdit - The code edit to apply.
130
+ * @param {string} diffIdentifier - The diff identifier.
131
+ * @param {string} prompt - The prompt for the edit.
132
+ * @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.
134
+ */
135
+ editFileWithDiff: (targetFile: string, codeEdit: string, diffIdentifier: string, prompt: string, applyModel?: string) => Promise<{
136
+ success: boolean;
137
+ result: any;
138
+ }>;
93
139
  };
94
140
  export default cbfs;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const websocket_1 = __importDefault(require("./websocket"));
6
+ const websocket_1 = __importDefault(require("../core/websocket"));
7
7
  /**
8
8
  * @module cbfs
9
9
  * @description This module provides functionality to interact with the filesystem.
@@ -18,23 +18,15 @@ const cbfs = {
18
18
  * @returns {Promise<CreateFileResponse>} A promise that resolves with the server response.
19
19
  */
20
20
  createFile: (fileName, source, filePath) => {
21
- return new Promise((resolve, reject) => {
22
- websocket_1.default.getWebsocket.send(JSON.stringify({
23
- "type": "fsEvent",
24
- "action": "createFile",
25
- "message": {
26
- fileName,
27
- source,
28
- filePath
29
- },
30
- }));
31
- websocket_1.default.getWebsocket.on('message', (data) => {
32
- const response = JSON.parse(data);
33
- if (response.type === "createFileResponse") {
34
- resolve(response);
35
- }
36
- });
37
- });
21
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
22
+ "type": "fsEvent",
23
+ "action": "createFile",
24
+ "message": {
25
+ fileName,
26
+ source,
27
+ filePath
28
+ },
29
+ }, "createFileResponse");
38
30
  },
39
31
  /**
40
32
  * @function createFolder
@@ -44,22 +36,14 @@ const cbfs = {
44
36
  * @returns {Promise<CreateFolderResponse>} A promise that resolves with the server response.
45
37
  */
46
38
  createFolder: (folderName, folderPath) => {
47
- return new Promise((resolve, reject) => {
48
- websocket_1.default.getWebsocket.send(JSON.stringify({
49
- "type": "fsEvent",
50
- "action": "createFolder",
51
- "message": {
52
- folderName,
53
- folderPath
54
- },
55
- }));
56
- websocket_1.default.getWebsocket.on('message', (data) => {
57
- const response = JSON.parse(data);
58
- if (response.type === "createFolderResponse") {
59
- resolve(response);
60
- }
61
- });
62
- });
39
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
40
+ "type": "fsEvent",
41
+ "action": "createFolder",
42
+ "message": {
43
+ folderName,
44
+ folderPath
45
+ },
46
+ }, "createFolderResponse");
63
47
  },
64
48
  /**
65
49
  * @function readFile
@@ -69,21 +53,13 @@ const cbfs = {
69
53
  * @returns {Promise<ReadFileResponse>} A promise that resolves with the server response.
70
54
  */
71
55
  readFile: (filePath) => {
72
- return new Promise((resolve, reject) => {
73
- websocket_1.default.getWebsocket.send(JSON.stringify({
74
- "type": "fsEvent",
75
- "action": "readFile",
76
- "message": {
77
- filePath
78
- },
79
- }));
80
- websocket_1.default.getWebsocket.on('message', (data) => {
81
- const response = JSON.parse(data);
82
- if (response.type === "readFileResponse") {
83
- resolve(response);
84
- }
85
- });
86
- });
56
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
57
+ "type": "fsEvent",
58
+ "action": "readFile",
59
+ "message": {
60
+ filePath
61
+ },
62
+ }, "readFileResponse");
87
63
  },
88
64
  /**
89
65
  * @function updateFile
@@ -94,23 +70,15 @@ const cbfs = {
94
70
  * @returns {Promise<UpdateFileResponse>} A promise that resolves with the server response.
95
71
  */
96
72
  updateFile: (filename, filePath, newContent) => {
97
- return new Promise((resolve, reject) => {
98
- websocket_1.default.getWebsocket.send(JSON.stringify({
99
- "type": "fsEvent",
100
- "action": "updateFile",
101
- "message": {
102
- filename,
103
- filePath,
104
- newContent
105
- },
106
- }));
107
- websocket_1.default.getWebsocket.on('message', (data) => {
108
- const response = JSON.parse(data);
109
- if (response.type === "commandOutput") {
110
- resolve(response);
111
- }
112
- });
113
- });
73
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
74
+ "type": "fsEvent",
75
+ "action": "updateFile",
76
+ "message": {
77
+ filename,
78
+ filePath,
79
+ newContent
80
+ },
81
+ }, "updateFileResponse");
114
82
  },
115
83
  /**
116
84
  * @function deleteFile
@@ -120,22 +88,14 @@ const cbfs = {
120
88
  * @returns {Promise<DeleteFileResponse>} A promise that resolves with the server response.
121
89
  */
122
90
  deleteFile: (filename, filePath) => {
123
- return new Promise((resolve, reject) => {
124
- websocket_1.default.getWebsocket.send(JSON.stringify({
125
- "type": "fsEvent",
126
- "action": "deleteFile",
127
- "message": {
128
- filename,
129
- filePath
130
- },
131
- }));
132
- websocket_1.default.getWebsocket.on('message', (data) => {
133
- const response = JSON.parse(data);
134
- if (response.type === "deleteFileResponse") {
135
- resolve(response);
136
- }
137
- });
138
- });
91
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
92
+ "type": "fsEvent",
93
+ "action": "deleteFile",
94
+ "message": {
95
+ filename,
96
+ filePath
97
+ },
98
+ }, "deleteFileResponse");
139
99
  },
140
100
  /**
141
101
  * @function deleteFolder
@@ -145,22 +105,14 @@ const cbfs = {
145
105
  * @returns {Promise<DeleteFolderResponse>} A promise that resolves with the server response.
146
106
  */
147
107
  deleteFolder: (foldername, folderpath) => {
148
- return new Promise((resolve, reject) => {
149
- websocket_1.default.getWebsocket.send(JSON.stringify({
150
- "type": "fsEvent",
151
- "action": "deleteFolder",
152
- "message": {
153
- foldername,
154
- folderpath
155
- },
156
- }));
157
- websocket_1.default.getWebsocket.on('message', (data) => {
158
- const response = JSON.parse(data);
159
- if (response.type === "deleteFolderResponse") {
160
- resolve(response);
161
- }
162
- });
163
- });
108
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
109
+ "type": "fsEvent",
110
+ "action": "deleteFolder",
111
+ "message": {
112
+ foldername,
113
+ folderpath
114
+ },
115
+ }, "deleteFolderResponse");
164
116
  },
165
117
  /**
166
118
  * @function listFile
@@ -168,22 +120,14 @@ const cbfs = {
168
120
  * @returns {Promise<FileListResponse>} A promise that resolves with the list of files.
169
121
  */
170
122
  listFile: (folderPath, isRecursive = false) => {
171
- return new Promise((resolve, reject) => {
172
- websocket_1.default.getWebsocket.send(JSON.stringify({
173
- "type": "fsEvent",
174
- "action": "fileList",
175
- message: {
176
- folderPath,
177
- isRecursive
178
- }
179
- }));
180
- websocket_1.default.getWebsocket.on('message', (data) => {
181
- const response = JSON.parse(data);
182
- if (response.type === "fileListResponse") {
183
- resolve(response);
184
- }
185
- });
186
- });
123
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
124
+ "type": "fsEvent",
125
+ "action": "fileList",
126
+ message: {
127
+ folderPath,
128
+ isRecursive
129
+ }
130
+ }, "fileListResponse");
187
131
  },
188
132
  /**
189
133
  * @function listCodeDefinitionNames
@@ -192,21 +136,13 @@ const cbfs = {
192
136
  * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of code definition names.
193
137
  */
194
138
  listCodeDefinitionNames: (path) => {
195
- return new Promise((resolve, reject) => {
196
- websocket_1.default.getWebsocket.send(JSON.stringify({
197
- "type": "fsEvent",
198
- "action": "listCodeDefinitionNames",
199
- "message": {
200
- path
201
- }
202
- }));
203
- websocket_1.default.getWebsocket.on('message', (data) => {
204
- const response = JSON.parse(data);
205
- if (response.type === "listCodeDefinitionNamesResponse") {
206
- resolve(response);
207
- }
208
- });
209
- });
139
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
140
+ "type": "fsEvent",
141
+ "action": "listCodeDefinitionNames",
142
+ "message": {
143
+ path
144
+ }
145
+ }, "listCodeDefinitionNamesResponse");
210
146
  },
211
147
  /**
212
148
  * @function searchFiles
@@ -217,23 +153,15 @@ const cbfs = {
217
153
  * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
218
154
  */
219
155
  searchFiles: (path, regex, filePattern) => {
220
- return new Promise((resolve, reject) => {
221
- websocket_1.default.getWebsocket.send(JSON.stringify({
222
- "type": "fsEvent",
223
- "action": "searchFiles",
224
- "message": {
225
- path,
226
- regex,
227
- filePattern
228
- }
229
- }));
230
- websocket_1.default.getWebsocket.on('message', (data) => {
231
- const response = JSON.parse(data);
232
- if (response.type === "searchFilesResponse") {
233
- resolve(response);
234
- }
235
- });
236
- });
156
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
157
+ "type": "fsEvent",
158
+ "action": "searchFiles",
159
+ "message": {
160
+ path,
161
+ regex,
162
+ filePattern
163
+ }
164
+ }, "searchFilesResponse");
237
165
  },
238
166
  /**
239
167
  * @function writeToFile
@@ -243,22 +171,83 @@ const cbfs = {
243
171
  * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the write operation result.
244
172
  */
245
173
  writeToFile: (relPath, newContent) => {
246
- return new Promise((resolve, reject) => {
247
- websocket_1.default.getWebsocket.send(JSON.stringify({
248
- "type": "fsEvent",
249
- "action": "writeToFile",
250
- "message": {
251
- relPath,
252
- newContent
253
- }
254
- }));
255
- websocket_1.default.getWebsocket.on('message', (data) => {
256
- const response = JSON.parse(data);
257
- if (response.type === "writeToFileResponse") {
258
- resolve(response);
259
- }
260
- });
261
- });
174
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
175
+ "type": "fsEvent",
176
+ "action": "writeToFile",
177
+ "message": {
178
+ relPath,
179
+ newContent
180
+ }
181
+ }, "writeToFileResponse");
182
+ },
183
+ /**
184
+ * @function listFiles
185
+ * @description Lists all files in a directory.
186
+ * @param {string} path - The path to list files from.
187
+ * @param {boolean} isRecursive - Whether to list files recursively.
188
+ * @param {boolean} askForPermission - Whether to ask for permission before listing.
189
+ * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of files.
190
+ */
191
+ /**
192
+ * @function grepSearch
193
+ * @description Performs a grep search in files.
194
+ * @param {string} path - The path to search within.
195
+ * @param {string} query - The query to search for.
196
+ * @param {string} includePattern - Pattern of files to include.
197
+ * @param {string} excludePattern - Pattern of files to exclude.
198
+ * @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
+ */
201
+ grepSearch: (path, query, includePattern, excludePattern, caseSensitive = true) => {
202
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
203
+ "type": "fsEvent",
204
+ "action": "grep_search",
205
+ "message": {
206
+ path,
207
+ query,
208
+ includePattern,
209
+ excludePattern,
210
+ caseSensitive
211
+ }
212
+ }, "grepSearchResponse");
213
+ },
214
+ /**
215
+ * @function fileSearch
216
+ * @description Performs a fuzzy search for files.
217
+ * @param {string} query - The query to search for.
218
+ * @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
219
+ */
220
+ fileSearch: (query) => {
221
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
222
+ "type": "fsEvent",
223
+ "action": "file_search",
224
+ "message": {
225
+ query
226
+ }
227
+ }, "fileSearchResponse");
228
+ },
229
+ /**
230
+ * @function editFileWithDiff
231
+ * @description Edits a file by applying a diff.
232
+ * @param {string} targetFile - The target file to edit.
233
+ * @param {string} codeEdit - The code edit to apply.
234
+ * @param {string} diffIdentifier - The diff identifier.
235
+ * @param {string} prompt - The prompt for the edit.
236
+ * @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
+ */
239
+ editFileWithDiff: (targetFile, codeEdit, diffIdentifier, prompt, applyModel) => {
240
+ return websocket_1.default.messageManager.sendAndWaitForResponse({
241
+ "type": "fsEvent",
242
+ "action": "edit_file_with_diff",
243
+ "message": {
244
+ target_file: targetFile,
245
+ code_edit: codeEdit,
246
+ diffIdentifier,
247
+ prompt,
248
+ applyModel
249
+ }
250
+ }, "editFileAndApplyDiffResponse");
262
251
  },
263
252
  };
264
253
  exports.default = cbfs;
@@ -8,37 +8,30 @@ declare const gitService: {
8
8
  * @returns {Promise<any>} A promise that resolves with the response from the init event.
9
9
  */
10
10
  init: (path: string) => Promise<any>;
11
- /**
12
- * Clones a Git repository from the given URL to the specified path.
13
- * @param {string} url - The URL of the Git repository to clone.
14
- * @param {string} path - The file system path where the repository should be cloned to.
15
- * @returns {Promise<any>} A promise that resolves with the response from the clone event.
16
- */
17
- clone: (url: string, path: string) => Promise<any>;
18
11
  /**
19
12
  * Pulls the latest changes from the remote repository to the local repository at the given path.
20
13
  * @param {string} path - The file system path of the local Git repository.
21
14
  * @returns {Promise<any>} A promise that resolves with the response from the pull event.
22
15
  */
23
- pull: (path: string) => Promise<any>;
16
+ pull: () => Promise<any>;
24
17
  /**
25
18
  * Pushes local repository changes to the remote repository at the given path.
26
19
  * @param {string} path - The file system path of the local Git repository.
27
20
  * @returns {Promise<any>} A promise that resolves with the response from the push event.
28
21
  */
29
- push: (path: string) => Promise<any>;
22
+ push: () => Promise<any>;
30
23
  /**
31
24
  * Retrieves the status of the local repository at the given path.
32
25
  * @param {string} path - The file system path of the local Git repository.
33
26
  * @returns {Promise<any>} A promise that resolves with the response from the status event.
34
27
  */
35
- status: (path: string) => Promise<any>;
28
+ status: () => Promise<any>;
36
29
  /**
37
30
  * Adds changes in the local repository to the staging area at the given path.
38
31
  * @param {string} path - The file system path of the local Git repository.
39
32
  * @returns {Promise<any>} A promise that resolves with the response from the add event.
40
33
  */
41
- add: (path: string) => Promise<any>;
34
+ addAll: () => Promise<any>;
42
35
  /**
43
36
  * Commits the staged changes in the local repository with the given commit message.
44
37
  * @param {string} message - The commit message to use for the commit.
@@ -51,14 +44,14 @@ declare const gitService: {
51
44
  * @param {string} branch - The name of the branch or commit to check out.
52
45
  * @returns {Promise<any>} A promise that resolves with the response from the checkout event.
53
46
  */
54
- checkout: (path: string, branch: string) => Promise<any>;
47
+ checkout: (branch: string) => Promise<any>;
55
48
  /**
56
49
  * Creates a new branch in the local repository at the given path.
57
50
  * @param {string} path - The file system path of the local Git repository.
58
51
  * @param {string} branch - The name of the new branch to create.
59
52
  * @returns {Promise<any>} A promise that resolves with the response from the branch event.
60
53
  */
61
- branch: (path: string, branch: string) => Promise<any>;
54
+ branch: (branch: string) => Promise<any>;
62
55
  /**
63
56
  * Retrieves the commit logs for the local repository at the given path.
64
57
  * @param {string} path - The file system path of the local Git repository.
@@ -71,6 +64,6 @@ declare const gitService: {
71
64
  * @param {string} path - The file system path of the local Git repository.
72
65
  * @returns {Promise<any>} A promise that resolves with the response from the diff event.
73
66
  */
74
- diff: (commitHash: string, path: string) => Promise<any>;
67
+ diff: (commitHash: string) => Promise<any>;
75
68
  };
76
69
  export default gitService;