@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.
- package/Readme.md +3 -0
- package/dist/core/Codebolt.d.ts +212 -165
- package/dist/core/Codebolt.js +267 -6
- package/dist/core/websocket.js +9 -11
- package/dist/index.d.ts +1 -1
- package/dist/modules/agent.d.ts +2 -16
- package/dist/modules/agent.js +15 -33
- package/dist/modules/browser.d.ts +1 -1
- package/dist/modules/browser.js +52 -51
- package/dist/modules/chat.d.ts +2 -2
- package/dist/modules/chat.js +20 -18
- package/dist/modules/codeutils.d.ts +1 -9
- package/dist/modules/codeutils.js +13 -111
- package/dist/modules/dbmemory.d.ts +3 -3
- package/dist/modules/dbmemory.js +8 -7
- package/dist/modules/debug.d.ts +1 -1
- package/dist/modules/fs.d.ts +59 -28
- package/dist/modules/fs.js +86 -45
- package/dist/modules/git.d.ts +1 -1
- package/dist/modules/git.js +31 -30
- package/dist/modules/history.d.ts +1 -1
- package/dist/modules/history.js +7 -6
- package/dist/modules/llm.d.ts +13 -20
- package/dist/modules/llm.js +16 -15
- package/dist/modules/mcp.d.ts +4 -4
- package/dist/modules/mcp.js +25 -25
- package/dist/modules/outputparsers.d.ts +22 -22
- package/dist/modules/outputparsers.js +7 -5
- package/dist/modules/project.d.ts +1 -1
- package/dist/modules/project.js +15 -13
- package/dist/modules/state.d.ts +1 -1
- package/dist/modules/state.js +16 -15
- package/dist/modules/task.d.ts +136 -92
- package/dist/modules/task.js +354 -205
- package/dist/modules/terminal.d.ts +1 -1
- package/dist/modules/terminal.js +12 -11
- package/dist/modules/tokenizer.d.ts +1 -1
- package/dist/modules/tokenizer.js +7 -6
- package/dist/modules/user-message-manager.d.ts +165 -0
- package/dist/modules/user-message-manager.js +308 -0
- package/dist/modules/user-message-utilities.d.ts +111 -0
- package/dist/modules/user-message-utilities.js +115 -0
- package/dist/modules/utils.d.ts +1 -1
- package/dist/modules/utils.js +4 -3
- package/dist/modules/vectordb.d.ts +1 -1
- package/dist/modules/vectordb.js +13 -12
- package/dist/notificationfunctions/agent.js +7 -6
- package/dist/notificationfunctions/browser.js +9 -8
- package/dist/notificationfunctions/chat.js +9 -8
- package/dist/notificationfunctions/codeutils.js +9 -8
- package/dist/notificationfunctions/crawler.js +9 -8
- package/dist/notificationfunctions/dbmemory.js +9 -8
- package/dist/notificationfunctions/fs.js +45 -44
- package/dist/notificationfunctions/git.d.ts +2 -2
- package/dist/notificationfunctions/git.js +111 -51
- package/dist/notificationfunctions/history.js +9 -8
- package/dist/notificationfunctions/llm.js +9 -8
- package/dist/notificationfunctions/mcp.js +17 -16
- package/dist/notificationfunctions/search.js +13 -12
- package/dist/notificationfunctions/system.js +5 -4
- package/dist/notificationfunctions/terminal.js +5 -4
- package/dist/notificationfunctions/todo.js +13 -12
- package/dist/types/commonTypes.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/libFunctionTypes.d.ts +918 -29
- package/dist/types/libFunctionTypes.js +33 -0
- package/dist/types/notificationFunctions/git.d.ts +40 -1
- package/dist/types/notificationFunctions/index.d.ts +1 -0
- package/dist/types/notificationFunctions/index.js +1 -0
- package/package.json +17 -25
- package/dist/modules/codeparsers.d.ts +0 -37
- package/dist/modules/codeparsers.js +0 -329
package/dist/modules/fs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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
|
-
|
|
137
|
-
|
|
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;
|
package/dist/modules/fs.js
CHANGED
|
@@ -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":
|
|
23
|
-
"action":
|
|
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
|
-
},
|
|
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":
|
|
41
|
-
"action":
|
|
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
|
-
},
|
|
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":
|
|
58
|
-
"action":
|
|
58
|
+
"type": enum_1.EventType.FS_EVENT,
|
|
59
|
+
"action": enum_1.FSAction.READ_FILE,
|
|
59
60
|
"message": {
|
|
60
61
|
filePath
|
|
61
62
|
},
|
|
62
|
-
},
|
|
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":
|
|
75
|
-
"action":
|
|
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
|
-
},
|
|
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":
|
|
93
|
-
"action":
|
|
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
|
-
},
|
|
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":
|
|
110
|
-
"action":
|
|
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
|
-
},
|
|
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":
|
|
125
|
-
"action":
|
|
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
|
-
},
|
|
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<
|
|
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":
|
|
141
|
-
"action":
|
|
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
|
-
},
|
|
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<
|
|
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":
|
|
158
|
-
"action":
|
|
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
|
-
},
|
|
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<
|
|
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":
|
|
176
|
-
"action":
|
|
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
|
-
},
|
|
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<
|
|
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":
|
|
204
|
-
"action":
|
|
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
|
-
},
|
|
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<
|
|
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":
|
|
223
|
-
"action":
|
|
223
|
+
"type": enum_1.EventType.FS_EVENT,
|
|
224
|
+
"action": enum_1.FSAction.FILE_SEARCH,
|
|
224
225
|
"message": {
|
|
225
226
|
query
|
|
226
227
|
}
|
|
227
|
-
},
|
|
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<
|
|
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":
|
|
242
|
-
"action":
|
|
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
|
-
},
|
|
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;
|
package/dist/modules/git.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GitInitResponse, GitPullResponse, GitPushResponse, GitStatusResponse, AddResponse, GitCommitResponse, GitCheckoutResponse, GitBranchResponse, GitLogsResponse, GitDiffResponse } from '
|
|
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
|
*/
|
package/dist/modules/git.js
CHANGED
|
@@ -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":
|
|
19
|
-
"action":
|
|
19
|
+
"type": enum_1.EventType.GIT_EVENT,
|
|
20
|
+
"action": enum_1.GitAction.INIT,
|
|
20
21
|
"path": path
|
|
21
|
-
},
|
|
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":
|
|
31
|
-
"action":
|
|
32
|
-
},
|
|
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":
|
|
42
|
-
"action":
|
|
43
|
-
},
|
|
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":
|
|
53
|
-
"action":
|
|
54
|
-
},
|
|
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":
|
|
64
|
-
"action":
|
|
65
|
-
},
|
|
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":
|
|
75
|
-
"action":
|
|
75
|
+
"type": enum_1.EventType.GIT_EVENT,
|
|
76
|
+
"action": enum_1.GitAction.COMMIT,
|
|
76
77
|
"message": message
|
|
77
|
-
},
|
|
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":
|
|
88
|
-
"action":
|
|
88
|
+
"type": enum_1.EventType.GIT_EVENT,
|
|
89
|
+
"action": enum_1.GitAction.CHECKOUT,
|
|
89
90
|
"branch": branch
|
|
90
|
-
},
|
|
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":
|
|
101
|
-
"action":
|
|
101
|
+
"type": enum_1.EventType.GIT_EVENT,
|
|
102
|
+
"action": enum_1.GitAction.GIT_BRANCH,
|
|
102
103
|
"branch": branch,
|
|
103
|
-
},
|
|
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":
|
|
113
|
-
"action":
|
|
113
|
+
"type": enum_1.EventType.GIT_EVENT,
|
|
114
|
+
"action": enum_1.GitAction.GIT_LOGS,
|
|
114
115
|
"path": path
|
|
115
|
-
},
|
|
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":
|
|
126
|
-
"action":
|
|
126
|
+
"type": enum_1.EventType.GIT_EVENT,
|
|
127
|
+
"action": enum_1.GitAction.DIFF,
|
|
127
128
|
"commitHash": commitHash
|
|
128
|
-
},
|
|
129
|
+
}, enum_1.GitResponseType.DIFF_RESPONSE);
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
132
|
exports.default = gitService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetSummarizeAllResponse, GetSummarizeResponse } from '
|
|
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.
|
package/dist/modules/history.js
CHANGED
|
@@ -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":
|
|
36
|
-
"action":
|
|
37
|
-
},
|
|
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":
|
|
49
|
-
"action":
|
|
49
|
+
"type": enum_1.EventType.CHAT_SUMMARY_EVENT,
|
|
50
|
+
"action": enum_1.ChatSummaryAction.SUMMARIZE_PART,
|
|
50
51
|
messages,
|
|
51
52
|
depth
|
|
52
|
-
},
|
|
53
|
+
}, enum_1.ChatSummaryResponseType.SUMMARIZE_PART_RESPONSE);
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
exports.default = exports.chatSummary;
|