@codebolt/codeboltjs 2.0.12 → 2.0.15
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 +138 -4
- package/dist/agentlib/agent.js +3 -7
- package/dist/agentlib/followupquestionbuilder.d.ts +75 -0
- package/dist/agentlib/followupquestionbuilder.js +193 -0
- package/dist/agentlib/llmoutputhandler.d.ts +102 -0
- package/dist/agentlib/llmoutputhandler.js +451 -0
- package/dist/agentlib/promptbuilder.d.ts +171 -17
- package/dist/agentlib/promptbuilder.js +367 -49
- package/dist/agentlib/systemprompt.js +3 -3
- package/dist/agentlib/usermessage.d.ts +1 -1
- package/dist/agentlib/usermessage.js +5 -1
- package/dist/core/Codebolt.d.ts +342 -0
- package/dist/core/Codebolt.js +201 -0
- package/dist/core/websocket.js +2 -1
- package/dist/index.d.ts +4 -300
- package/dist/index.js +11 -137
- package/dist/modules/llm.d.ts +23 -3
- package/dist/modules/llm.js +20 -3
- package/dist/modules/project.d.ts +3 -3
- package/dist/modules/project.js +1 -1
- package/dist/modules/state.d.ts +5 -3
- package/dist/modules/state.js +2 -0
- package/dist/modules/task.d.ts +126 -11
- package/dist/modules/task.js +262 -20
- package/dist/notificationfunctions/agent.d.ts +48 -0
- package/dist/notificationfunctions/agent.js +115 -0
- package/dist/notificationfunctions/browser.d.ts +60 -0
- package/dist/notificationfunctions/browser.js +145 -0
- package/dist/notificationfunctions/chat.d.ts +53 -0
- package/dist/notificationfunctions/chat.js +125 -0
- package/dist/notificationfunctions/codeutils.d.ts +60 -0
- package/dist/notificationfunctions/codeutils.js +145 -0
- package/dist/notificationfunctions/crawler.d.ts +59 -0
- package/dist/notificationfunctions/crawler.js +159 -0
- package/dist/notificationfunctions/dbmemory.d.ts +50 -0
- package/dist/notificationfunctions/dbmemory.js +132 -0
- package/dist/notificationfunctions/fs.d.ts +125 -0
- package/dist/notificationfunctions/fs.js +472 -0
- package/dist/notificationfunctions/git.d.ts +174 -0
- package/dist/notificationfunctions/git.js +521 -0
- package/dist/notificationfunctions/history.d.ts +38 -0
- package/dist/notificationfunctions/history.js +97 -0
- package/dist/notificationfunctions/index.d.ts +79 -0
- package/dist/notificationfunctions/index.js +102 -0
- package/dist/notificationfunctions/llm.d.ts +39 -0
- package/dist/notificationfunctions/llm.js +99 -0
- package/dist/notificationfunctions/mcp.d.ts +67 -0
- package/dist/notificationfunctions/mcp.js +192 -0
- package/dist/notificationfunctions/search.d.ts +50 -0
- package/dist/notificationfunctions/search.js +146 -0
- package/dist/notificationfunctions/system.d.ts +25 -0
- package/dist/notificationfunctions/system.js +59 -0
- package/dist/notificationfunctions/terminal.d.ts +26 -0
- package/dist/notificationfunctions/terminal.js +64 -0
- package/dist/notificationfunctions/todo.d.ts +63 -0
- package/dist/notificationfunctions/todo.js +164 -0
- package/dist/notificationfunctions/utils.d.ts +81 -0
- package/dist/notificationfunctions/utils.js +177 -0
- package/dist/types/InternalTypes.d.ts +1 -0
- package/dist/types/commonTypes.d.ts +26 -3
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.js +15 -0
- package/dist/types/libFunctionTypes.d.ts +110 -4
- package/dist/types/notificationFunctions/agent.d.ts +8 -0
- package/dist/types/notificationFunctions/agent.js +2 -0
- package/dist/types/notificationFunctions/browser.d.ts +10 -0
- package/dist/types/notificationFunctions/browser.js +2 -0
- package/dist/types/notificationFunctions/chat.d.ts +10 -0
- package/dist/types/notificationFunctions/chat.js +2 -0
- package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
- package/dist/types/notificationFunctions/codeutils.js +2 -0
- package/dist/types/notificationFunctions/crawler.d.ts +10 -0
- package/dist/types/notificationFunctions/crawler.js +2 -0
- package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
- package/dist/types/notificationFunctions/dbmemory.js +2 -0
- package/dist/types/notificationFunctions/fs.d.ts +27 -0
- package/dist/types/notificationFunctions/fs.js +2 -0
- package/dist/types/notificationFunctions/git.d.ts +29 -0
- package/dist/types/notificationFunctions/git.js +2 -0
- package/dist/types/notificationFunctions/history.d.ts +10 -0
- package/dist/types/notificationFunctions/history.js +2 -0
- package/dist/types/notificationFunctions/index.d.ts +0 -0
- package/dist/types/notificationFunctions/index.js +1 -0
- package/dist/types/notificationFunctions/llm.d.ts +10 -0
- package/dist/types/notificationFunctions/llm.js +2 -0
- package/dist/types/notificationFunctions/mcp.d.ts +16 -0
- package/dist/types/notificationFunctions/mcp.js +2 -0
- package/dist/types/notificationFunctions/search.d.ts +11 -0
- package/dist/types/notificationFunctions/search.js +2 -0
- package/dist/types/notificationFunctions/system.d.ts +7 -0
- package/dist/types/notificationFunctions/system.js +2 -0
- package/dist/types/notificationFunctions/terminal.d.ts +7 -0
- package/dist/types/notificationFunctions/terminal.js +2 -0
- package/dist/types/notificationFunctions/todo.d.ts +11 -0
- package/dist/types/notificationFunctions/todo.js +2 -0
- package/dist/types/notifications/agent.d.ts +31 -0
- package/dist/types/notifications/agent.js +3 -0
- package/dist/types/notifications/browser.d.ts +53 -0
- package/dist/types/notifications/browser.js +3 -0
- package/dist/types/notifications/chat.d.ts +37 -0
- package/dist/types/notifications/chat.js +3 -0
- package/dist/types/notifications/codeutils.d.ts +55 -0
- package/dist/types/notifications/codeutils.js +3 -0
- package/dist/types/notifications/crawler.d.ts +55 -0
- package/dist/types/notifications/crawler.js +3 -0
- package/dist/types/notifications/dbmemory.d.ts +31 -0
- package/dist/types/notifications/dbmemory.js +3 -0
- package/dist/types/notifications/fs.d.ts +180 -0
- package/dist/types/notifications/fs.js +3 -0
- package/dist/types/notifications/git.d.ts +205 -0
- package/dist/types/notifications/git.js +3 -0
- package/dist/types/notifications/history.d.ts +32 -0
- package/dist/types/notifications/history.js +3 -0
- package/dist/types/notifications/llm.d.ts +45 -0
- package/dist/types/notifications/llm.js +2 -0
- package/dist/types/notifications/mcp.d.ts +63 -0
- package/dist/types/notifications/mcp.js +3 -0
- package/dist/types/notifications/search.d.ts +47 -0
- package/dist/types/notifications/search.js +3 -0
- package/dist/types/notifications/system.d.ts +20 -0
- package/dist/types/notifications/system.js +2 -0
- package/dist/types/notifications/terminal.d.ts +17 -0
- package/dist/types/notifications/terminal.js +2 -0
- package/dist/types/notifications/todo.d.ts +60 -0
- package/dist/types/notifications/todo.js +3 -0
- package/dist/types/socketMessageTypes.d.ts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* File System Notification Functions
|
|
4
|
+
*
|
|
5
|
+
* This module provides functions for sending file system-related notifications,
|
|
6
|
+
* including file and folder operations like create, read, edit, delete, etc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.fsNotifications = exports.MoveFileResponseNotify = exports.MoveFileRequestNotify = exports.CopyFileResponseNotify = exports.CopyFileRequestNotify = exports.AppendToFileResponseNotify = exports.AppendToFileRequestNotify = exports.WriteToFileResponseNotify = exports.WriteToFileRequestNotify = exports.ListDirectoryResponseNotify = exports.ListDirectoryRequestNotify = exports.FolderDeleteResponseNotify = exports.FolderDeleteRequestNotify = exports.FileDeleteResponseNotify = exports.FileDeleteRequestNotify = exports.FileEditResponseNotify = exports.FileEditRequestNotify = exports.FileReadResponseNotify = exports.FileReadRequestNotify = exports.FolderCreateResponseNotify = exports.FolderCreateRequestNotify = exports.FileCreateResponseNotify = exports.FileCreateRequestNotify = void 0;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
/**
|
|
12
|
+
* Sends a request to create a file
|
|
13
|
+
* Requirements: 7.1
|
|
14
|
+
*/
|
|
15
|
+
function FileCreateRequestNotify(fileName, source, filePath, toolUseId) {
|
|
16
|
+
if (!(0, utils_1.validateRequiredFields)({ fileName, source, filePath }, ['fileName', 'source', 'filePath'], 'fs.FileCreateRequestNotify')) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const notification = {
|
|
20
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
21
|
+
type: "fsnotify",
|
|
22
|
+
action: "createFileRequest",
|
|
23
|
+
data: {
|
|
24
|
+
fileName: fileName,
|
|
25
|
+
source: source,
|
|
26
|
+
filePath: filePath
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileCreateRequestNotify');
|
|
30
|
+
}
|
|
31
|
+
exports.FileCreateRequestNotify = FileCreateRequestNotify;
|
|
32
|
+
/**
|
|
33
|
+
* Sends a response to a file creation request
|
|
34
|
+
* Requirements: 7.2
|
|
35
|
+
*/
|
|
36
|
+
function FileCreateResponseNotify(content, isError = false, toolUseId) {
|
|
37
|
+
if (content === null || content === undefined) {
|
|
38
|
+
console.error('[NotificationFunctions] Content is required for fs.FileCreateResponseNotify');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const notification = {
|
|
42
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
43
|
+
type: "fsnotify",
|
|
44
|
+
action: "createFileResult",
|
|
45
|
+
content: content,
|
|
46
|
+
isError: isError
|
|
47
|
+
};
|
|
48
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileCreateResponseNotify');
|
|
49
|
+
}
|
|
50
|
+
exports.FileCreateResponseNotify = FileCreateResponseNotify;
|
|
51
|
+
/**
|
|
52
|
+
* Sends a request to create a folder
|
|
53
|
+
* Requirements: 7.3
|
|
54
|
+
*/
|
|
55
|
+
function FolderCreateRequestNotify(folderName, folderPath, toolUseId) {
|
|
56
|
+
if (!(0, utils_1.validateRequiredFields)({ folderName, folderPath }, ['folderName', 'folderPath'], 'fs.FolderCreateRequestNotify')) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const notification = {
|
|
60
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
61
|
+
type: "fsnotify",
|
|
62
|
+
action: "createFolderRequest",
|
|
63
|
+
data: {
|
|
64
|
+
folderName: folderName,
|
|
65
|
+
folderPath: folderPath
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
(0, utils_1.sendNotification)(notification, 'fs.FolderCreateRequestNotify');
|
|
69
|
+
}
|
|
70
|
+
exports.FolderCreateRequestNotify = FolderCreateRequestNotify;
|
|
71
|
+
/**
|
|
72
|
+
* Sends a response to a folder creation request
|
|
73
|
+
* Requirements: 7.4
|
|
74
|
+
*/
|
|
75
|
+
function FolderCreateResponseNotify(content, isError = false, toolUseId) {
|
|
76
|
+
if (content === null || content === undefined) {
|
|
77
|
+
console.error('[NotificationFunctions] Content is required for fs.FolderCreateResponseNotify');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const notification = {
|
|
81
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
82
|
+
type: "fsnotify",
|
|
83
|
+
action: "createFolderResult",
|
|
84
|
+
content: content,
|
|
85
|
+
isError: isError
|
|
86
|
+
};
|
|
87
|
+
(0, utils_1.sendNotification)(notification, 'fs.FolderCreateResponseNotify');
|
|
88
|
+
}
|
|
89
|
+
exports.FolderCreateResponseNotify = FolderCreateResponseNotify;
|
|
90
|
+
/**
|
|
91
|
+
* Sends a request to read a file
|
|
92
|
+
* Requirements: 7.4
|
|
93
|
+
*/
|
|
94
|
+
function FileReadRequestNotify(filePath, startLine, endLine, toolUseId) {
|
|
95
|
+
if (!(0, utils_1.validateRequiredFields)({ filePath }, ['filePath'], 'fs.FileReadRequestNotify')) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const notification = {
|
|
99
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
100
|
+
type: "fsnotify",
|
|
101
|
+
action: "readFileRequest",
|
|
102
|
+
data: {
|
|
103
|
+
filePath: filePath,
|
|
104
|
+
startLine: startLine,
|
|
105
|
+
endLine: endLine
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileReadRequestNotify');
|
|
109
|
+
}
|
|
110
|
+
exports.FileReadRequestNotify = FileReadRequestNotify;
|
|
111
|
+
/**
|
|
112
|
+
* Sends a response to a file read request
|
|
113
|
+
* Requirements: 7.4
|
|
114
|
+
*/
|
|
115
|
+
function FileReadResponseNotify(content, isError = false, toolUseId) {
|
|
116
|
+
if (content === null || content === undefined) {
|
|
117
|
+
console.error('[NotificationFunctions] Content is required for fs.FileReadResponseNotify');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const notification = {
|
|
121
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
122
|
+
type: "fsnotify",
|
|
123
|
+
action: "readFileResult",
|
|
124
|
+
content: content,
|
|
125
|
+
isError: isError
|
|
126
|
+
};
|
|
127
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileReadResponseNotify');
|
|
128
|
+
}
|
|
129
|
+
exports.FileReadResponseNotify = FileReadResponseNotify;
|
|
130
|
+
/**
|
|
131
|
+
* Sends a request to edit a file
|
|
132
|
+
* Requirements: 7.5
|
|
133
|
+
*/
|
|
134
|
+
function FileEditRequestNotify(fileName, filePath, newContent, toolUseId) {
|
|
135
|
+
if (!(0, utils_1.validateRequiredFields)({ fileName, filePath, newContent }, ['fileName', 'filePath', 'newContent'], 'fs.FileEditRequestNotify')) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const notification = {
|
|
139
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
140
|
+
type: "fsnotify",
|
|
141
|
+
action: "updateFileRequest",
|
|
142
|
+
data: {
|
|
143
|
+
fileName: fileName,
|
|
144
|
+
filePath: filePath,
|
|
145
|
+
newContent: newContent
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileEditRequestNotify');
|
|
149
|
+
}
|
|
150
|
+
exports.FileEditRequestNotify = FileEditRequestNotify;
|
|
151
|
+
/**
|
|
152
|
+
* Sends a response to a file edit request
|
|
153
|
+
* Requirements: 7.5
|
|
154
|
+
*/
|
|
155
|
+
function FileEditResponseNotify(content, isError = false, toolUseId) {
|
|
156
|
+
if (content === null || content === undefined) {
|
|
157
|
+
console.error('[NotificationFunctions] Content is required for fs.FileEditResponseNotify');
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const notification = {
|
|
161
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
162
|
+
type: "fsnotify",
|
|
163
|
+
action: "updateFileResult",
|
|
164
|
+
content: content,
|
|
165
|
+
isError: isError
|
|
166
|
+
};
|
|
167
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileEditResponseNotify');
|
|
168
|
+
}
|
|
169
|
+
exports.FileEditResponseNotify = FileEditResponseNotify;
|
|
170
|
+
/**
|
|
171
|
+
* Sends a request to delete a file
|
|
172
|
+
* Requirements: 7.6
|
|
173
|
+
*/
|
|
174
|
+
function FileDeleteRequestNotify(fileName, filePath, toolUseId) {
|
|
175
|
+
if (!(0, utils_1.validateRequiredFields)({ fileName, filePath }, ['fileName', 'filePath'], 'fs.FileDeleteRequestNotify')) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const notification = {
|
|
179
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
180
|
+
type: "fsnotify",
|
|
181
|
+
action: "deleteFileRequest",
|
|
182
|
+
data: {
|
|
183
|
+
fileName: fileName,
|
|
184
|
+
filePath: filePath
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileDeleteRequestNotify');
|
|
188
|
+
}
|
|
189
|
+
exports.FileDeleteRequestNotify = FileDeleteRequestNotify;
|
|
190
|
+
/**
|
|
191
|
+
* Sends a response to a file delete request
|
|
192
|
+
* Requirements: 7.6
|
|
193
|
+
*/
|
|
194
|
+
function FileDeleteResponseNotify(content, isError = false, toolUseId) {
|
|
195
|
+
if (content === null || content === undefined) {
|
|
196
|
+
console.error('[NotificationFunctions] Content is required for fs.FileDeleteResponseNotify');
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const notification = {
|
|
200
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
201
|
+
type: "fsnotify",
|
|
202
|
+
action: "deleteFileResult",
|
|
203
|
+
content: content,
|
|
204
|
+
isError: isError
|
|
205
|
+
};
|
|
206
|
+
(0, utils_1.sendNotification)(notification, 'fs.FileDeleteResponseNotify');
|
|
207
|
+
}
|
|
208
|
+
exports.FileDeleteResponseNotify = FileDeleteResponseNotify;
|
|
209
|
+
/**
|
|
210
|
+
* Sends a request to delete a folder
|
|
211
|
+
* Requirements: 7.6
|
|
212
|
+
*/
|
|
213
|
+
function FolderDeleteRequestNotify(folderName, folderPath, toolUseId) {
|
|
214
|
+
if (!(0, utils_1.validateRequiredFields)({ folderName, folderPath }, ['folderName', 'folderPath'], 'fs.FolderDeleteRequestNotify')) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const notification = {
|
|
218
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
219
|
+
type: "fsnotify",
|
|
220
|
+
action: "deleteFolderRequest",
|
|
221
|
+
data: {
|
|
222
|
+
folderName: folderName,
|
|
223
|
+
folderPath: folderPath
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
(0, utils_1.sendNotification)(notification, 'fs.FolderDeleteRequestNotify');
|
|
227
|
+
}
|
|
228
|
+
exports.FolderDeleteRequestNotify = FolderDeleteRequestNotify;
|
|
229
|
+
/**
|
|
230
|
+
* Sends a response to a folder delete request
|
|
231
|
+
* Requirements: 7.6
|
|
232
|
+
*/
|
|
233
|
+
function FolderDeleteResponseNotify(content, isError = false, toolUseId) {
|
|
234
|
+
if (content === null || content === undefined) {
|
|
235
|
+
console.error('[NotificationFunctions] Content is required for fs.FolderDeleteResponseNotify');
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const notification = {
|
|
239
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
240
|
+
type: "fsnotify",
|
|
241
|
+
action: "deleteFolderResult",
|
|
242
|
+
content: content,
|
|
243
|
+
isError: isError
|
|
244
|
+
};
|
|
245
|
+
(0, utils_1.sendNotification)(notification, 'fs.FolderDeleteResponseNotify');
|
|
246
|
+
} /**
|
|
247
|
+
*
|
|
248
|
+
Sends a request to list directory contents
|
|
249
|
+
* Requirements: 7.7
|
|
250
|
+
*/
|
|
251
|
+
exports.FolderDeleteResponseNotify = FolderDeleteResponseNotify;
|
|
252
|
+
function ListDirectoryRequestNotify(dirPath, toolUseId) {
|
|
253
|
+
if (!(0, utils_1.validateRequiredFields)({ dirPath }, ['dirPath'], 'fs.ListDirectoryRequestNotify')) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const notification = {
|
|
257
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
258
|
+
type: "fsnotify",
|
|
259
|
+
action: "listDirectoryRequest",
|
|
260
|
+
data: {
|
|
261
|
+
dirPath: dirPath
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
(0, utils_1.sendNotification)(notification, 'fs.ListDirectoryRequestNotify');
|
|
265
|
+
}
|
|
266
|
+
exports.ListDirectoryRequestNotify = ListDirectoryRequestNotify;
|
|
267
|
+
/**
|
|
268
|
+
* Sends a response to a directory listing request
|
|
269
|
+
* Requirements: 7.7
|
|
270
|
+
*/
|
|
271
|
+
function ListDirectoryResponseNotify(content, isError = false, toolUseId) {
|
|
272
|
+
if (content === null || content === undefined) {
|
|
273
|
+
console.error('[NotificationFunctions] Content is required for fs.ListDirectoryResponseNotify');
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const notification = {
|
|
277
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
278
|
+
type: "fsnotify",
|
|
279
|
+
action: "listDirectoryResult",
|
|
280
|
+
content: content,
|
|
281
|
+
isError: isError
|
|
282
|
+
};
|
|
283
|
+
(0, utils_1.sendNotification)(notification, 'fs.ListDirectoryResponseNotify');
|
|
284
|
+
}
|
|
285
|
+
exports.ListDirectoryResponseNotify = ListDirectoryResponseNotify;
|
|
286
|
+
/**
|
|
287
|
+
* Sends a request to write to a file
|
|
288
|
+
* Requirements: 7.8
|
|
289
|
+
*/
|
|
290
|
+
function WriteToFileRequestNotify(filePath, text, toolUseId) {
|
|
291
|
+
if (!(0, utils_1.validateRequiredFields)({ filePath, text }, ['filePath', 'text'], 'fs.WriteToFileRequestNotify')) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const notification = {
|
|
295
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
296
|
+
type: "fsnotify",
|
|
297
|
+
action: "writeToFileRequest",
|
|
298
|
+
data: {
|
|
299
|
+
filePath: filePath,
|
|
300
|
+
text: text
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
(0, utils_1.sendNotification)(notification, 'fs.WriteToFileRequestNotify');
|
|
304
|
+
}
|
|
305
|
+
exports.WriteToFileRequestNotify = WriteToFileRequestNotify;
|
|
306
|
+
/**
|
|
307
|
+
* Sends a response to a write to file request
|
|
308
|
+
* Requirements: 7.8
|
|
309
|
+
*/
|
|
310
|
+
function WriteToFileResponseNotify(content, isError = false, toolUseId) {
|
|
311
|
+
if (content === null || content === undefined) {
|
|
312
|
+
console.error('[NotificationFunctions] Content is required for fs.WriteToFileResponseNotify');
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const notification = {
|
|
316
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
317
|
+
type: "fsnotify",
|
|
318
|
+
action: "writeToFileResult",
|
|
319
|
+
content: content,
|
|
320
|
+
isError: isError
|
|
321
|
+
};
|
|
322
|
+
(0, utils_1.sendNotification)(notification, 'fs.WriteToFileResponseNotify');
|
|
323
|
+
}
|
|
324
|
+
exports.WriteToFileResponseNotify = WriteToFileResponseNotify;
|
|
325
|
+
/**
|
|
326
|
+
* Sends a request to append to a file
|
|
327
|
+
* Requirements: 7.9
|
|
328
|
+
*/
|
|
329
|
+
function AppendToFileRequestNotify(filePath, text, toolUseId) {
|
|
330
|
+
if (!(0, utils_1.validateRequiredFields)({ filePath, text }, ['filePath', 'text'], 'fs.AppendToFileRequestNotify')) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const notification = {
|
|
334
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
335
|
+
type: "fsnotify",
|
|
336
|
+
action: "appendToFileRequest",
|
|
337
|
+
data: {
|
|
338
|
+
filePath: filePath,
|
|
339
|
+
text: text
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
(0, utils_1.sendNotification)(notification, 'fs.AppendToFileRequestNotify');
|
|
343
|
+
}
|
|
344
|
+
exports.AppendToFileRequestNotify = AppendToFileRequestNotify;
|
|
345
|
+
/**
|
|
346
|
+
* Sends a response to an append to file request
|
|
347
|
+
* Requirements: 7.9
|
|
348
|
+
*/
|
|
349
|
+
function AppendToFileResponseNotify(content, isError = false, toolUseId) {
|
|
350
|
+
if (content === null || content === undefined) {
|
|
351
|
+
console.error('[NotificationFunctions] Content is required for fs.AppendToFileResponseNotify');
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const notification = {
|
|
355
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
356
|
+
type: "fsnotify",
|
|
357
|
+
action: "appendToFileResult",
|
|
358
|
+
content: content,
|
|
359
|
+
isError: isError
|
|
360
|
+
};
|
|
361
|
+
(0, utils_1.sendNotification)(notification, 'fs.AppendToFileResponseNotify');
|
|
362
|
+
} /**
|
|
363
|
+
|
|
364
|
+
* Sends a request to copy a file
|
|
365
|
+
* Requirements: 7.10
|
|
366
|
+
*/
|
|
367
|
+
exports.AppendToFileResponseNotify = AppendToFileResponseNotify;
|
|
368
|
+
function CopyFileRequestNotify(sourceFile, destinationFile, toolUseId) {
|
|
369
|
+
if (!(0, utils_1.validateRequiredFields)({ sourceFile, destinationFile }, ['sourceFile', 'destinationFile'], 'fs.CopyFileRequestNotify')) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const notification = {
|
|
373
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
374
|
+
type: "fsnotify",
|
|
375
|
+
action: "copyFileRequest",
|
|
376
|
+
data: {
|
|
377
|
+
sourceFile: sourceFile,
|
|
378
|
+
destinationFile: destinationFile
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
(0, utils_1.sendNotification)(notification, 'fs.CopyFileRequestNotify');
|
|
382
|
+
}
|
|
383
|
+
exports.CopyFileRequestNotify = CopyFileRequestNotify;
|
|
384
|
+
/**
|
|
385
|
+
* Sends a response to a file copy request
|
|
386
|
+
* Requirements: 7.10
|
|
387
|
+
*/
|
|
388
|
+
function CopyFileResponseNotify(content, isError = false, toolUseId) {
|
|
389
|
+
if (content === null || content === undefined) {
|
|
390
|
+
console.error('[NotificationFunctions] Content is required for fs.CopyFileResponseNotify');
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const notification = {
|
|
394
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
395
|
+
type: "fsnotify",
|
|
396
|
+
action: "copyFileResult",
|
|
397
|
+
content: content,
|
|
398
|
+
isError: isError
|
|
399
|
+
};
|
|
400
|
+
(0, utils_1.sendNotification)(notification, 'fs.CopyFileResponseNotify');
|
|
401
|
+
}
|
|
402
|
+
exports.CopyFileResponseNotify = CopyFileResponseNotify;
|
|
403
|
+
/**
|
|
404
|
+
* Sends a request to move a file
|
|
405
|
+
* Requirements: 7.11
|
|
406
|
+
*/
|
|
407
|
+
function MoveFileRequestNotify(sourceFile, destinationFile, toolUseId) {
|
|
408
|
+
if (!(0, utils_1.validateRequiredFields)({ sourceFile, destinationFile }, ['sourceFile', 'destinationFile'], 'fs.MoveFileRequestNotify')) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const notification = {
|
|
412
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
413
|
+
type: "fsnotify",
|
|
414
|
+
action: "moveFileRequest",
|
|
415
|
+
data: {
|
|
416
|
+
sourceFile: sourceFile,
|
|
417
|
+
destinationFile: destinationFile
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
(0, utils_1.sendNotification)(notification, 'fs.MoveFileRequestNotify');
|
|
421
|
+
}
|
|
422
|
+
exports.MoveFileRequestNotify = MoveFileRequestNotify;
|
|
423
|
+
/**
|
|
424
|
+
* Sends a response to a file move request
|
|
425
|
+
* Requirements: 7.11
|
|
426
|
+
*/
|
|
427
|
+
function MoveFileResponseNotify(content, isError = false, toolUseId) {
|
|
428
|
+
if (content === null || content === undefined) {
|
|
429
|
+
console.error('[NotificationFunctions] Content is required for fs.MoveFileResponseNotify');
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
const notification = {
|
|
433
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
434
|
+
type: "fsnotify",
|
|
435
|
+
action: "moveFileResult",
|
|
436
|
+
content: content,
|
|
437
|
+
isError: isError
|
|
438
|
+
};
|
|
439
|
+
(0, utils_1.sendNotification)(notification, 'fs.MoveFileResponseNotify');
|
|
440
|
+
}
|
|
441
|
+
exports.MoveFileResponseNotify = MoveFileResponseNotify;
|
|
442
|
+
/**
|
|
443
|
+
* File system notification functions object
|
|
444
|
+
*/
|
|
445
|
+
exports.fsNotifications = {
|
|
446
|
+
FileCreateRequestNotify,
|
|
447
|
+
FileCreateResponseNotify,
|
|
448
|
+
FolderCreateRequestNotify,
|
|
449
|
+
FolderCreateResponseNotify,
|
|
450
|
+
FileReadRequestNotify,
|
|
451
|
+
FileReadResponseNotify,
|
|
452
|
+
FileEditRequestNotify,
|
|
453
|
+
FileEditResponseNotify,
|
|
454
|
+
FileDeleteRequestNotify,
|
|
455
|
+
FileDeleteResponseNotify,
|
|
456
|
+
FolderDeleteRequestNotify,
|
|
457
|
+
FolderDeleteResponseNotify,
|
|
458
|
+
ListDirectoryRequestNotify,
|
|
459
|
+
ListDirectoryResponseNotify,
|
|
460
|
+
WriteToFileRequestNotify,
|
|
461
|
+
WriteToFileResponseNotify,
|
|
462
|
+
AppendToFileRequestNotify,
|
|
463
|
+
AppendToFileResponseNotify,
|
|
464
|
+
CopyFileRequestNotify,
|
|
465
|
+
CopyFileResponseNotify,
|
|
466
|
+
MoveFileRequestNotify,
|
|
467
|
+
MoveFileResponseNotify
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* Default export
|
|
471
|
+
*/
|
|
472
|
+
exports.default = exports.fsNotifications;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Notification Functions
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions for sending git-related notifications,
|
|
5
|
+
* including version control operations.
|
|
6
|
+
*/
|
|
7
|
+
import { GitNotifications } from '../types/notificationFunctions/git';
|
|
8
|
+
/**
|
|
9
|
+
* Sends a git init request notification
|
|
10
|
+
* @param path - Optional path where to initialize the git repository
|
|
11
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
12
|
+
*/
|
|
13
|
+
export declare function GitInitRequestNotify(path?: string, toolUseId?: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Sends a git init response notification
|
|
16
|
+
* @param content - The response content (success message or error details)
|
|
17
|
+
* @param isError - Whether this is an error response
|
|
18
|
+
* @param toolUseId - The toolUseId from the original request
|
|
19
|
+
*/
|
|
20
|
+
export declare function GitInitResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sends a git pull request notification
|
|
23
|
+
* @param path - Optional path where to perform the git pull
|
|
24
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
25
|
+
*/
|
|
26
|
+
export declare function GitPullRequestNotify(path?: string, toolUseId?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Sends a git pull response notification
|
|
29
|
+
* @param content - The response content (success message or error details)
|
|
30
|
+
* @param isError - Whether this is an error response
|
|
31
|
+
* @param toolUseId - The toolUseId from the original request
|
|
32
|
+
*/
|
|
33
|
+
export declare function GitPullResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Sends a git push request notification
|
|
36
|
+
* @param path - Optional path where to perform the git push
|
|
37
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
38
|
+
*/
|
|
39
|
+
export declare function GitPushRequestNotify(path?: string, toolUseId?: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Sends a git push response notification
|
|
42
|
+
* @param content - The response content (success message or error details)
|
|
43
|
+
* @param isError - Whether this is an error response
|
|
44
|
+
* @param toolUseId - The toolUseId from the original request
|
|
45
|
+
*/
|
|
46
|
+
export declare function GitPushResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Sends a git status request notification
|
|
49
|
+
* @param path - Optional path where to check git status
|
|
50
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
51
|
+
*/
|
|
52
|
+
export declare function GitStatusRequestNotify(path?: string, toolUseId?: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Sends a git status response notification
|
|
55
|
+
* @param content - The response content (status information or error details)
|
|
56
|
+
* @param isError - Whether this is an error response
|
|
57
|
+
* @param toolUseId - The toolUseId from the original request
|
|
58
|
+
*/
|
|
59
|
+
export declare function GitStatusResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Sends a git add request notification
|
|
62
|
+
* @param path - Optional path where to perform git add
|
|
63
|
+
* @param files - Optional array of files to add
|
|
64
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
65
|
+
*/
|
|
66
|
+
export declare function GitAddRequestNotify(path?: string, files?: string[], toolUseId?: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Sends a git add response notification
|
|
69
|
+
* @param content - The response content (success message or error details)
|
|
70
|
+
* @param isError - Whether this is an error response
|
|
71
|
+
* @param toolUseId - The toolUseId from the original request
|
|
72
|
+
*/
|
|
73
|
+
export declare function GitAddResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Sends a git commit request notification
|
|
76
|
+
* @param path - Optional path where to perform git commit
|
|
77
|
+
* @param message - Optional commit message
|
|
78
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
79
|
+
*/
|
|
80
|
+
export declare function GitCommitRequestNotify(path?: string, message?: string, toolUseId?: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Sends a git commit response notification
|
|
83
|
+
* @param content - The response content (commit information or error details)
|
|
84
|
+
* @param isError - Whether this is an error response
|
|
85
|
+
* @param toolUseId - The toolUseId from the original request
|
|
86
|
+
*/
|
|
87
|
+
export declare function GitCommitResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Sends a git checkout request notification
|
|
90
|
+
* @param path - Optional path where to perform git checkout
|
|
91
|
+
* @param branchName - Optional branch name to checkout
|
|
92
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
93
|
+
*/
|
|
94
|
+
export declare function GitCheckoutRequestNotify(path?: string, branchName?: string, toolUseId?: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Sends a git checkout response notification
|
|
97
|
+
* @param content - The response content (checkout information or error details)
|
|
98
|
+
* @param isError - Whether this is an error response
|
|
99
|
+
* @param toolUseId - The toolUseId from the original request
|
|
100
|
+
*/
|
|
101
|
+
export declare function GitCheckoutResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Sends a git branch request notification
|
|
104
|
+
* @param path - Optional path where to perform git branch operation
|
|
105
|
+
* @param branchName - Optional branch name to create or list
|
|
106
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
107
|
+
*/
|
|
108
|
+
export declare function GitBranchRequestNotify(path?: string, branchName?: string, toolUseId?: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Sends a git branch response notification
|
|
111
|
+
* @param content - The response content (branch information or error details)
|
|
112
|
+
* @param isError - Whether this is an error response
|
|
113
|
+
* @param toolUseId - The toolUseId from the original request
|
|
114
|
+
*/
|
|
115
|
+
export declare function GitBranchResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Sends a git logs request notification
|
|
118
|
+
* @param path - Optional path where to get git logs
|
|
119
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
120
|
+
*/
|
|
121
|
+
export declare function GitLogsRequestNotify(path?: string, toolUseId?: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Sends a git logs response notification
|
|
124
|
+
* @param content - The response content (log information or error details)
|
|
125
|
+
* @param isError - Whether this is an error response
|
|
126
|
+
* @param toolUseId - The toolUseId from the original request
|
|
127
|
+
*/
|
|
128
|
+
export declare function GitLogsResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Sends a git diff request notification
|
|
131
|
+
* @param path - Optional path where to get git diff
|
|
132
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
133
|
+
*/
|
|
134
|
+
export declare function GitDiffRequestNotify(path?: string, toolUseId?: string): void;
|
|
135
|
+
/**
|
|
136
|
+
* Sends a git diff response notification
|
|
137
|
+
* @param content - The response content (diff information or error details)
|
|
138
|
+
* @param isError - Whether this is an error response
|
|
139
|
+
* @param toolUseId - The toolUseId from the original request
|
|
140
|
+
*/
|
|
141
|
+
export declare function GitDiffResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Sends a git remote add request notification
|
|
144
|
+
* @param remoteName - Name of the remote to add
|
|
145
|
+
* @param remoteUrl - URL of the remote repository
|
|
146
|
+
* @param path - Optional path where to add the remote
|
|
147
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
148
|
+
*/
|
|
149
|
+
export declare function GitRemoteAddRequestNotify(remoteName: string, remoteUrl: string, path?: string, toolUseId?: string): void;
|
|
150
|
+
/**
|
|
151
|
+
* Sends a git remote add response notification
|
|
152
|
+
* @param content - The response content (success message or error details)
|
|
153
|
+
* @param isError - Whether this is an error response
|
|
154
|
+
* @param toolUseId - The toolUseId from the original request
|
|
155
|
+
*/
|
|
156
|
+
export declare function GitRemoteAddResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* Sends a git clone request notification
|
|
159
|
+
* @param repoUrl - URL of the repository to clone
|
|
160
|
+
* @param targetPath - Optional target path for the cloned repository
|
|
161
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
162
|
+
*/
|
|
163
|
+
export declare function GitCloneRequestNotify(repoUrl: string, targetPath?: string, toolUseId?: string): void;
|
|
164
|
+
/**
|
|
165
|
+
* Sends a git clone response notification
|
|
166
|
+
* @param content - The response content (clone information or error details)
|
|
167
|
+
* @param isError - Whether this is an error response
|
|
168
|
+
* @param toolUseId - The toolUseId from the original request
|
|
169
|
+
*/
|
|
170
|
+
export declare function GitCloneResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
171
|
+
/**
|
|
172
|
+
* Git notification functions object
|
|
173
|
+
*/
|
|
174
|
+
export declare const gitNotifications: GitNotifications;
|