@codebolt/codeboltjs 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/Readme.md +3 -0
  2. package/dist/core/Codebolt.d.ts +212 -165
  3. package/dist/core/Codebolt.js +267 -6
  4. package/dist/core/websocket.js +9 -11
  5. package/dist/index.d.ts +1 -1
  6. package/dist/modules/agent.d.ts +2 -16
  7. package/dist/modules/agent.js +15 -33
  8. package/dist/modules/browser.d.ts +1 -1
  9. package/dist/modules/browser.js +52 -51
  10. package/dist/modules/chat.d.ts +2 -2
  11. package/dist/modules/chat.js +20 -18
  12. package/dist/modules/codeutils.d.ts +1 -9
  13. package/dist/modules/codeutils.js +13 -111
  14. package/dist/modules/dbmemory.d.ts +3 -3
  15. package/dist/modules/dbmemory.js +8 -7
  16. package/dist/modules/debug.d.ts +1 -1
  17. package/dist/modules/fs.d.ts +59 -28
  18. package/dist/modules/fs.js +86 -45
  19. package/dist/modules/git.d.ts +1 -1
  20. package/dist/modules/git.js +31 -30
  21. package/dist/modules/history.d.ts +1 -1
  22. package/dist/modules/history.js +7 -6
  23. package/dist/modules/llm.d.ts +13 -20
  24. package/dist/modules/llm.js +16 -15
  25. package/dist/modules/mcp.d.ts +4 -4
  26. package/dist/modules/mcp.js +25 -25
  27. package/dist/modules/outputparsers.d.ts +22 -22
  28. package/dist/modules/outputparsers.js +7 -5
  29. package/dist/modules/project.d.ts +1 -1
  30. package/dist/modules/project.js +15 -13
  31. package/dist/modules/state.d.ts +1 -1
  32. package/dist/modules/state.js +16 -15
  33. package/dist/modules/task.d.ts +136 -92
  34. package/dist/modules/task.js +354 -205
  35. package/dist/modules/terminal.d.ts +1 -1
  36. package/dist/modules/terminal.js +12 -11
  37. package/dist/modules/tokenizer.d.ts +1 -1
  38. package/dist/modules/tokenizer.js +7 -6
  39. package/dist/modules/user-message-manager.d.ts +165 -0
  40. package/dist/modules/user-message-manager.js +308 -0
  41. package/dist/modules/user-message-utilities.d.ts +111 -0
  42. package/dist/modules/user-message-utilities.js +115 -0
  43. package/dist/modules/utils.d.ts +1 -1
  44. package/dist/modules/utils.js +4 -3
  45. package/dist/modules/vectordb.d.ts +1 -1
  46. package/dist/modules/vectordb.js +13 -12
  47. package/dist/notificationfunctions/agent.js +7 -6
  48. package/dist/notificationfunctions/browser.js +9 -8
  49. package/dist/notificationfunctions/chat.js +9 -8
  50. package/dist/notificationfunctions/codeutils.js +9 -8
  51. package/dist/notificationfunctions/crawler.js +9 -8
  52. package/dist/notificationfunctions/dbmemory.js +9 -8
  53. package/dist/notificationfunctions/fs.js +45 -44
  54. package/dist/notificationfunctions/git.d.ts +2 -2
  55. package/dist/notificationfunctions/git.js +111 -51
  56. package/dist/notificationfunctions/history.js +9 -8
  57. package/dist/notificationfunctions/llm.js +9 -8
  58. package/dist/notificationfunctions/mcp.js +17 -16
  59. package/dist/notificationfunctions/search.js +13 -12
  60. package/dist/notificationfunctions/system.js +5 -4
  61. package/dist/notificationfunctions/terminal.js +5 -4
  62. package/dist/notificationfunctions/todo.js +13 -12
  63. package/dist/types/commonTypes.d.ts +4 -0
  64. package/dist/types/index.d.ts +1 -1
  65. package/dist/types/libFunctionTypes.d.ts +918 -29
  66. package/dist/types/libFunctionTypes.js +33 -0
  67. package/dist/types/notificationFunctions/git.d.ts +40 -1
  68. package/dist/types/notificationFunctions/index.d.ts +1 -0
  69. package/dist/types/notificationFunctions/index.js +1 -0
  70. package/package.json +17 -25
  71. package/dist/modules/codeparsers.d.ts +0 -37
  72. package/dist/modules/codeparsers.js +0 -329
@@ -30,6 +30,7 @@ exports.CopyFileResponseNotify = CopyFileResponseNotify;
30
30
  exports.MoveFileRequestNotify = MoveFileRequestNotify;
31
31
  exports.MoveFileResponseNotify = MoveFileResponseNotify;
32
32
  const utils_1 = require("./utils");
33
+ const enum_1 = require("@codebolt/types/enum");
33
34
  /**
34
35
  * Sends a request to create a file
35
36
  * Requirements: 7.1
@@ -40,8 +41,8 @@ function FileCreateRequestNotify(fileName, source, filePath, toolUseId) {
40
41
  }
41
42
  const notification = {
42
43
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
43
- type: "fsnotify",
44
- action: "createFileRequest",
44
+ type: enum_1.NotificationEventType.FS_NOTIFY,
45
+ action: enum_1.FsNotificationAction.CREATE_FILE_REQUEST,
45
46
  data: {
46
47
  fileName: fileName,
47
48
  source: source,
@@ -61,8 +62,8 @@ function FileCreateResponseNotify(content, isError = false, toolUseId) {
61
62
  }
62
63
  const notification = {
63
64
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
64
- type: "fsnotify",
65
- action: "createFileResult",
65
+ type: enum_1.NotificationEventType.FS_NOTIFY,
66
+ action: enum_1.FsNotificationAction.CREATE_FILE_RESULT,
66
67
  content: content,
67
68
  isError: isError
68
69
  };
@@ -78,8 +79,8 @@ function FolderCreateRequestNotify(folderName, folderPath, toolUseId) {
78
79
  }
79
80
  const notification = {
80
81
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
81
- type: "fsnotify",
82
- action: "createFolderRequest",
82
+ type: enum_1.NotificationEventType.FS_NOTIFY,
83
+ action: enum_1.FsNotificationAction.CREATE_FOLDER_REQUEST,
83
84
  data: {
84
85
  folderName: folderName,
85
86
  folderPath: folderPath
@@ -98,8 +99,8 @@ function FolderCreateResponseNotify(content, isError = false, toolUseId) {
98
99
  }
99
100
  const notification = {
100
101
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
101
- type: "fsnotify",
102
- action: "createFolderResult",
102
+ type: enum_1.NotificationEventType.FS_NOTIFY,
103
+ action: enum_1.FsNotificationAction.CREATE_FOLDER_RESULT,
103
104
  content: content,
104
105
  isError: isError
105
106
  };
@@ -115,8 +116,8 @@ function FileReadRequestNotify(filePath, startLine, endLine, toolUseId) {
115
116
  }
116
117
  const notification = {
117
118
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
118
- type: "fsnotify",
119
- action: "readFileRequest",
119
+ type: enum_1.NotificationEventType.FS_NOTIFY,
120
+ action: enum_1.FsNotificationAction.READ_FILE_REQUEST,
120
121
  data: {
121
122
  filePath: filePath,
122
123
  startLine: startLine,
@@ -136,8 +137,8 @@ function FileReadResponseNotify(content, isError = false, toolUseId) {
136
137
  }
137
138
  const notification = {
138
139
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
139
- type: "fsnotify",
140
- action: "readFileResult",
140
+ type: enum_1.NotificationEventType.FS_NOTIFY,
141
+ action: enum_1.FsNotificationAction.READ_FILE_RESULT,
141
142
  content: content,
142
143
  isError: isError
143
144
  };
@@ -153,8 +154,8 @@ function FileEditRequestNotify(fileName, filePath, newContent, toolUseId) {
153
154
  }
154
155
  const notification = {
155
156
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
156
- type: "fsnotify",
157
- action: "updateFileRequest",
157
+ type: enum_1.NotificationEventType.FS_NOTIFY,
158
+ action: enum_1.FsNotificationAction.UPDATE_FILE_REQUEST,
158
159
  data: {
159
160
  fileName: fileName,
160
161
  filePath: filePath,
@@ -174,8 +175,8 @@ function FileEditResponseNotify(content, isError = false, toolUseId) {
174
175
  }
175
176
  const notification = {
176
177
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
177
- type: "fsnotify",
178
- action: "updateFileResult",
178
+ type: enum_1.NotificationEventType.FS_NOTIFY,
179
+ action: enum_1.FsNotificationAction.UPDATE_FILE_RESULT,
179
180
  content: content,
180
181
  isError: isError
181
182
  };
@@ -191,8 +192,8 @@ function FileDeleteRequestNotify(fileName, filePath, toolUseId) {
191
192
  }
192
193
  const notification = {
193
194
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
194
- type: "fsnotify",
195
- action: "deleteFileRequest",
195
+ type: enum_1.NotificationEventType.FS_NOTIFY,
196
+ action: enum_1.FsNotificationAction.DELETE_FILE_REQUEST,
196
197
  data: {
197
198
  fileName: fileName,
198
199
  filePath: filePath
@@ -211,8 +212,8 @@ function FileDeleteResponseNotify(content, isError = false, toolUseId) {
211
212
  }
212
213
  const notification = {
213
214
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
214
- type: "fsnotify",
215
- action: "deleteFileResult",
215
+ type: enum_1.NotificationEventType.FS_NOTIFY,
216
+ action: enum_1.FsNotificationAction.DELETE_FILE_RESULT,
216
217
  content: content,
217
218
  isError: isError
218
219
  };
@@ -228,8 +229,8 @@ function FolderDeleteRequestNotify(folderName, folderPath, toolUseId) {
228
229
  }
229
230
  const notification = {
230
231
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
231
- type: "fsnotify",
232
- action: "deleteFolderRequest",
232
+ type: enum_1.NotificationEventType.FS_NOTIFY,
233
+ action: enum_1.FsNotificationAction.DELETE_FOLDER_REQUEST,
233
234
  data: {
234
235
  folderName: folderName,
235
236
  folderPath: folderPath
@@ -248,8 +249,8 @@ function FolderDeleteResponseNotify(content, isError = false, toolUseId) {
248
249
  }
249
250
  const notification = {
250
251
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
251
- type: "fsnotify",
252
- action: "deleteFolderResult",
252
+ type: enum_1.NotificationEventType.FS_NOTIFY,
253
+ action: enum_1.FsNotificationAction.DELETE_FOLDER_RESULT,
253
254
  content: content,
254
255
  isError: isError
255
256
  };
@@ -265,8 +266,8 @@ function ListDirectoryRequestNotify(dirPath, toolUseId) {
265
266
  }
266
267
  const notification = {
267
268
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
268
- type: "fsnotify",
269
- action: "listDirectoryRequest",
269
+ type: enum_1.NotificationEventType.FS_NOTIFY,
270
+ action: enum_1.FsNotificationAction.LIST_DIRECTORY_REQUEST,
270
271
  data: {
271
272
  dirPath: dirPath
272
273
  }
@@ -284,8 +285,8 @@ function ListDirectoryResponseNotify(content, isError = false, toolUseId) {
284
285
  }
285
286
  const notification = {
286
287
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
287
- type: "fsnotify",
288
- action: "listDirectoryResult",
288
+ type: enum_1.NotificationEventType.FS_NOTIFY,
289
+ action: enum_1.FsNotificationAction.LIST_DIRECTORY_RESULT,
289
290
  content: content,
290
291
  isError: isError
291
292
  };
@@ -301,8 +302,8 @@ function WriteToFileRequestNotify(filePath, text, toolUseId) {
301
302
  }
302
303
  const notification = {
303
304
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
304
- type: "fsnotify",
305
- action: "writeToFileRequest",
305
+ type: enum_1.NotificationEventType.FS_NOTIFY,
306
+ action: enum_1.FsNotificationAction.WRITE_TO_FILE_REQUEST,
306
307
  data: {
307
308
  filePath: filePath,
308
309
  text: text
@@ -321,8 +322,8 @@ function WriteToFileResponseNotify(content, isError = false, toolUseId) {
321
322
  }
322
323
  const notification = {
323
324
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
324
- type: "fsnotify",
325
- action: "writeToFileResult",
325
+ type: enum_1.NotificationEventType.FS_NOTIFY,
326
+ action: enum_1.FsNotificationAction.WRITE_TO_FILE_RESULT,
326
327
  content: content,
327
328
  isError: isError
328
329
  };
@@ -338,8 +339,8 @@ function AppendToFileRequestNotify(filePath, text, toolUseId) {
338
339
  }
339
340
  const notification = {
340
341
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
341
- type: "fsnotify",
342
- action: "appendToFileRequest",
342
+ type: enum_1.NotificationEventType.FS_NOTIFY,
343
+ action: enum_1.FsNotificationAction.APPEND_TO_FILE_REQUEST,
343
344
  data: {
344
345
  filePath: filePath,
345
346
  text: text
@@ -358,8 +359,8 @@ function AppendToFileResponseNotify(content, isError = false, toolUseId) {
358
359
  }
359
360
  const notification = {
360
361
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
361
- type: "fsnotify",
362
- action: "appendToFileResult",
362
+ type: enum_1.NotificationEventType.FS_NOTIFY,
363
+ action: enum_1.FsNotificationAction.APPEND_TO_FILE_RESULT,
363
364
  content: content,
364
365
  isError: isError
365
366
  };
@@ -375,8 +376,8 @@ function CopyFileRequestNotify(sourceFile, destinationFile, toolUseId) {
375
376
  }
376
377
  const notification = {
377
378
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
378
- type: "fsnotify",
379
- action: "copyFileRequest",
379
+ type: enum_1.NotificationEventType.FS_NOTIFY,
380
+ action: enum_1.FsNotificationAction.COPY_FILE_REQUEST,
380
381
  data: {
381
382
  sourceFile: sourceFile,
382
383
  destinationFile: destinationFile
@@ -395,8 +396,8 @@ function CopyFileResponseNotify(content, isError = false, toolUseId) {
395
396
  }
396
397
  const notification = {
397
398
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
398
- type: "fsnotify",
399
- action: "copyFileResult",
399
+ type: enum_1.NotificationEventType.FS_NOTIFY,
400
+ action: enum_1.FsNotificationAction.COPY_FILE_RESULT,
400
401
  content: content,
401
402
  isError: isError
402
403
  };
@@ -412,8 +413,8 @@ function MoveFileRequestNotify(sourceFile, destinationFile, toolUseId) {
412
413
  }
413
414
  const notification = {
414
415
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
415
- type: "fsnotify",
416
- action: "moveFileRequest",
416
+ type: enum_1.NotificationEventType.FS_NOTIFY,
417
+ action: enum_1.FsNotificationAction.MOVE_FILE_REQUEST,
417
418
  data: {
418
419
  sourceFile: sourceFile,
419
420
  destinationFile: destinationFile
@@ -432,8 +433,8 @@ function MoveFileResponseNotify(content, isError = false, toolUseId) {
432
433
  }
433
434
  const notification = {
434
435
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
435
- type: "fsnotify",
436
- action: "moveFileResult",
436
+ type: enum_1.NotificationEventType.FS_NOTIFY,
437
+ action: enum_1.FsNotificationAction.MOVE_FILE_RESULT,
437
438
  content: content,
438
439
  isError: isError
439
440
  };
@@ -133,8 +133,8 @@ export declare function GitLogsResponseNotify(content: string | any, isError?: b
133
133
  */
134
134
  export declare function GitDiffRequestNotify(path?: string, toolUseId?: string): void;
135
135
  /**
136
- * Sends a git diff response notification
137
- * @param content - The response content (diff information or error details)
136
+ * Sends a git diff response notification with comprehensive diff data
137
+ * @param content - The response content (raw diff string, structured GitDiffResult, or wrapped response)
138
138
  * @param isError - Whether this is an error response
139
139
  * @param toolUseId - The toolUseId from the original request
140
140
  */
@@ -32,6 +32,7 @@ exports.GitRemoteAddResponseNotify = GitRemoteAddResponseNotify;
32
32
  exports.GitCloneRequestNotify = GitCloneRequestNotify;
33
33
  exports.GitCloneResponseNotify = GitCloneResponseNotify;
34
34
  const utils_1 = require("./utils");
35
+ const enum_1 = require("@codebolt/types/enum");
35
36
  // ===== GIT INIT FUNCTIONS =====
36
37
  /**
37
38
  * Sends a git init request notification
@@ -41,8 +42,8 @@ const utils_1 = require("./utils");
41
42
  function GitInitRequestNotify(path, toolUseId) {
42
43
  const notification = {
43
44
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
44
- type: "gitnotify",
45
- action: "initRequest",
45
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
46
+ action: enum_1.GitNotificationAction.INIT_REQUEST,
46
47
  data: {
47
48
  path: path
48
49
  }
@@ -62,8 +63,8 @@ function GitInitResponseNotify(content, isError = false, toolUseId) {
62
63
  }
63
64
  const notification = {
64
65
  toolUseId,
65
- type: "gitnotify",
66
- action: "initResult",
66
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
67
+ action: enum_1.GitNotificationAction.INIT_RESULT,
67
68
  content,
68
69
  isError
69
70
  };
@@ -78,8 +79,8 @@ function GitInitResponseNotify(content, isError = false, toolUseId) {
78
79
  function GitPullRequestNotify(path, toolUseId) {
79
80
  const notification = {
80
81
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
81
- type: "gitnotify",
82
- action: "pullRequest",
82
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
83
+ action: enum_1.GitNotificationAction.PULL_REQUEST,
83
84
  data: {
84
85
  path: path
85
86
  }
@@ -99,8 +100,8 @@ function GitPullResponseNotify(content, isError = false, toolUseId) {
99
100
  }
100
101
  const notification = {
101
102
  toolUseId,
102
- type: "gitnotify",
103
- action: "pullResult",
103
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
104
+ action: enum_1.GitNotificationAction.PULL_RESULT,
104
105
  content,
105
106
  isError
106
107
  };
@@ -115,8 +116,8 @@ function GitPullResponseNotify(content, isError = false, toolUseId) {
115
116
  function GitPushRequestNotify(path, toolUseId) {
116
117
  const notification = {
117
118
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
118
- type: "gitnotify",
119
- action: "pushRequest",
119
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
120
+ action: enum_1.GitNotificationAction.PUSH_REQUEST,
120
121
  data: {
121
122
  path: path
122
123
  }
@@ -136,8 +137,8 @@ function GitPushResponseNotify(content, isError = false, toolUseId) {
136
137
  }
137
138
  const notification = {
138
139
  toolUseId,
139
- type: "gitnotify",
140
- action: "pushResult",
140
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
141
+ action: enum_1.GitNotificationAction.PUSH_RESULT,
141
142
  content,
142
143
  isError
143
144
  };
@@ -152,8 +153,8 @@ function GitPushResponseNotify(content, isError = false, toolUseId) {
152
153
  function GitStatusRequestNotify(path, toolUseId) {
153
154
  const notification = {
154
155
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
155
- type: "gitnotify",
156
- action: "statusRequest",
156
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
157
+ action: enum_1.GitNotificationAction.STATUS_REQUEST,
157
158
  data: {
158
159
  path: path
159
160
  }
@@ -173,8 +174,8 @@ function GitStatusResponseNotify(content, isError = false, toolUseId) {
173
174
  }
174
175
  const notification = {
175
176
  toolUseId,
176
- type: "gitnotify",
177
- action: "statusResult",
177
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
178
+ action: enum_1.GitNotificationAction.STATUS_RESULT,
178
179
  content,
179
180
  isError
180
181
  };
@@ -190,8 +191,8 @@ function GitStatusResponseNotify(content, isError = false, toolUseId) {
190
191
  function GitAddRequestNotify(path, files, toolUseId) {
191
192
  const notification = {
192
193
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
193
- type: "gitnotify",
194
- action: "addRequest",
194
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
195
+ action: enum_1.GitNotificationAction.ADD_REQUEST,
195
196
  data: {
196
197
  path: path,
197
198
  files: files
@@ -212,8 +213,8 @@ function GitAddResponseNotify(content, isError = false, toolUseId) {
212
213
  }
213
214
  const notification = {
214
215
  toolUseId,
215
- type: "gitnotify",
216
- action: "addResult",
216
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
217
+ action: enum_1.GitNotificationAction.ADD_RESULT,
217
218
  content,
218
219
  isError
219
220
  };
@@ -229,8 +230,8 @@ function GitAddResponseNotify(content, isError = false, toolUseId) {
229
230
  function GitCommitRequestNotify(path, message, toolUseId) {
230
231
  const notification = {
231
232
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
232
- type: "gitnotify",
233
- action: "commitRequest",
233
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
234
+ action: enum_1.GitNotificationAction.COMMIT_REQUEST,
234
235
  data: {
235
236
  path: path,
236
237
  message: message
@@ -251,8 +252,8 @@ function GitCommitResponseNotify(content, isError = false, toolUseId) {
251
252
  }
252
253
  const notification = {
253
254
  toolUseId,
254
- type: "gitnotify",
255
- action: "commitResult",
255
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
256
+ action: enum_1.GitNotificationAction.COMMIT_RESULT,
256
257
  content,
257
258
  isError
258
259
  };
@@ -268,8 +269,8 @@ function GitCommitResponseNotify(content, isError = false, toolUseId) {
268
269
  function GitCheckoutRequestNotify(path, branchName, toolUseId) {
269
270
  const notification = {
270
271
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
271
- type: "gitnotify",
272
- action: "checkoutRequest",
272
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
273
+ action: enum_1.GitNotificationAction.CHECKOUT_REQUEST,
273
274
  data: {
274
275
  path: path,
275
276
  branchName: branchName
@@ -290,8 +291,8 @@ function GitCheckoutResponseNotify(content, isError = false, toolUseId) {
290
291
  }
291
292
  const notification = {
292
293
  toolUseId,
293
- type: "gitnotify",
294
- action: "checkoutResult",
294
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
295
+ action: enum_1.GitNotificationAction.CHECKOUT_RESULT,
295
296
  content,
296
297
  isError
297
298
  };
@@ -307,8 +308,8 @@ function GitCheckoutResponseNotify(content, isError = false, toolUseId) {
307
308
  function GitBranchRequestNotify(path, branchName, toolUseId) {
308
309
  const notification = {
309
310
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
310
- type: "gitnotify",
311
- action: "branchRequest",
311
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
312
+ action: enum_1.GitNotificationAction.BRANCH_REQUEST,
312
313
  data: {
313
314
  path: path,
314
315
  branchName: branchName
@@ -329,8 +330,8 @@ function GitBranchResponseNotify(content, isError = false, toolUseId) {
329
330
  }
330
331
  const notification = {
331
332
  toolUseId,
332
- type: "gitnotify",
333
- action: "branchResult",
333
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
334
+ action: enum_1.GitNotificationAction.BRANCH_RESULT,
334
335
  content,
335
336
  isError
336
337
  };
@@ -345,8 +346,8 @@ function GitBranchResponseNotify(content, isError = false, toolUseId) {
345
346
  function GitLogsRequestNotify(path, toolUseId) {
346
347
  const notification = {
347
348
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
348
- type: "gitnotify",
349
- action: "logsRequest",
349
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
350
+ action: enum_1.GitNotificationAction.LOGS_REQUEST,
350
351
  data: {
351
352
  path: path
352
353
  }
@@ -366,8 +367,8 @@ function GitLogsResponseNotify(content, isError = false, toolUseId) {
366
367
  }
367
368
  const notification = {
368
369
  toolUseId,
369
- type: "gitnotify",
370
- action: "logsResult",
370
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
371
+ action: enum_1.GitNotificationAction.LOGS_RESULT,
371
372
  content,
372
373
  isError
373
374
  };
@@ -382,8 +383,8 @@ function GitLogsResponseNotify(content, isError = false, toolUseId) {
382
383
  function GitDiffRequestNotify(path, toolUseId) {
383
384
  const notification = {
384
385
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
385
- type: "gitnotify",
386
- action: "diffRequest",
386
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
387
+ action: enum_1.GitNotificationAction.DIFF_REQUEST,
387
388
  data: {
388
389
  path: path
389
390
  }
@@ -391,21 +392,80 @@ function GitDiffRequestNotify(path, toolUseId) {
391
392
  (0, utils_1.sendNotification)(notification, 'git-diff');
392
393
  }
393
394
  /**
394
- * Sends a git diff response notification
395
- * @param content - The response content (diff information or error details)
395
+ * Sends a git diff response notification with comprehensive diff data
396
+ * @param content - The response content (raw diff string, structured GitDiffResult, or wrapped response)
396
397
  * @param isError - Whether this is an error response
397
398
  * @param toolUseId - The toolUseId from the original request
398
399
  */
399
400
  function GitDiffResponseNotify(content, isError = false, toolUseId) {
401
+ var _a;
400
402
  if (!toolUseId) {
401
403
  console.error('[GitNotifications] toolUseId is required for response notifications');
402
404
  return;
403
405
  }
406
+ // Process and validate content based on schema expectations
407
+ let processedContent;
408
+ if (typeof content === 'string') {
409
+ // Raw diff string - pass through as-is
410
+ processedContent = content;
411
+ }
412
+ else if (content && typeof content === 'object') {
413
+ // Check if it's a structured GitDiffResult
414
+ if (content.files && Array.isArray(content.files)) {
415
+ // Validate GitDiffResult structure
416
+ processedContent = {
417
+ files: content.files.map((file) => ({
418
+ file: file.file || file.path || '',
419
+ changes: file.changes || 0,
420
+ insertions: file.insertions || file.additions || 0,
421
+ deletions: file.deletions || 0,
422
+ binary: file.binary || false,
423
+ status: file.status,
424
+ oldFile: file.oldFile
425
+ })),
426
+ insertions: content.insertions || content.additions || 0,
427
+ deletions: content.deletions || 0,
428
+ changed: content.changed || ((_a = content.files) === null || _a === void 0 ? void 0 : _a.length) || 0,
429
+ diff: content.diff,
430
+ stats: content.stats,
431
+ metadata: content.metadata ? {
432
+ totalChanges: content.metadata.totalChanges || 0,
433
+ additions: content.metadata.additions || content.metadata.insertions || 0,
434
+ deletions: content.metadata.deletions || 0,
435
+ commitHash: content.metadata.commitHash,
436
+ parentCommit: content.metadata.parentCommit
437
+ } : undefined
438
+ };
439
+ }
440
+ else if (content.success !== undefined || content.data !== undefined) {
441
+ // Wrapped response format
442
+ processedContent = {
443
+ success: content.success || !isError,
444
+ data: content.data || content.diff || content.content || '',
445
+ commitHash: content.commitHash || content.hash,
446
+ message: content.message || content.error
447
+ };
448
+ }
449
+ else {
450
+ // Generic object - try to extract useful information
451
+ processedContent = {
452
+ success: !isError,
453
+ data: content.diff || content.content || JSON.stringify(content),
454
+ message: content.message || content.error
455
+ };
456
+ }
457
+ }
458
+ else {
459
+ // Fallback for unexpected content types
460
+ processedContent = isError ?
461
+ { success: false, message: 'Git diff operation failed', data: '' } :
462
+ { success: true, data: content || '', message: 'Git diff completed' };
463
+ }
404
464
  const notification = {
405
465
  toolUseId,
406
- type: "gitnotify",
407
- action: "diffResult",
408
- content,
466
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
467
+ action: enum_1.GitNotificationAction.DIFF_RESULT,
468
+ content: processedContent,
409
469
  isError
410
470
  };
411
471
  (0, utils_1.sendNotification)(notification, 'git-diff-response');
@@ -421,8 +481,8 @@ function GitDiffResponseNotify(content, isError = false, toolUseId) {
421
481
  function GitRemoteAddRequestNotify(remoteName, remoteUrl, path, toolUseId) {
422
482
  const notification = {
423
483
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
424
- type: "gitnotify",
425
- action: "remoteAddRequest",
484
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
485
+ action: enum_1.GitNotificationAction.REMOTE_ADD_REQUEST,
426
486
  data: {
427
487
  path: path,
428
488
  remoteName: remoteName,
@@ -444,8 +504,8 @@ function GitRemoteAddResponseNotify(content, isError = false, toolUseId) {
444
504
  }
445
505
  const notification = {
446
506
  toolUseId,
447
- type: "gitnotify",
448
- action: "remoteAddResult",
507
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
508
+ action: enum_1.GitNotificationAction.REMOTE_ADD_RESULT,
449
509
  content,
450
510
  isError
451
511
  };
@@ -461,8 +521,8 @@ function GitRemoteAddResponseNotify(content, isError = false, toolUseId) {
461
521
  function GitCloneRequestNotify(repoUrl, targetPath, toolUseId) {
462
522
  const notification = {
463
523
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
464
- type: "gitnotify",
465
- action: "cloneRequest",
524
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
525
+ action: enum_1.GitNotificationAction.CLONE_REQUEST,
466
526
  data: {
467
527
  repoUrl: repoUrl,
468
528
  targetPath: targetPath
@@ -483,8 +543,8 @@ function GitCloneResponseNotify(content, isError = false, toolUseId) {
483
543
  }
484
544
  const notification = {
485
545
  toolUseId,
486
- type: "gitnotify",
487
- action: "cloneResult",
546
+ type: enum_1.NotificationEventType.GIT_NOTIFY,
547
+ action: enum_1.GitNotificationAction.CLONE_RESULT,
488
548
  content,
489
549
  isError
490
550
  };
@@ -12,6 +12,7 @@ exports.sendSummarizePreviousResult = sendSummarizePreviousResult;
12
12
  exports.summarizeCurrentMessage = summarizeCurrentMessage;
13
13
  exports.sendSummarizeCurrentResult = sendSummarizeCurrentResult;
14
14
  const utils_1 = require("./utils");
15
+ const enum_1 = require("@codebolt/types/enum");
15
16
  // ===== SUMMARIZE PREVIOUS CONVERSATION FUNCTIONS =====
16
17
  /**
17
18
  * Sends a summarize previous conversation request notification
@@ -21,8 +22,8 @@ const utils_1 = require("./utils");
21
22
  function summarizePreviousConversation(data = {}, toolUseId) {
22
23
  const notification = {
23
24
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
24
- type: "historynotify",
25
- action: "summarizeAllRequest",
25
+ type: enum_1.NotificationEventType.HISTORY_NOTIFY,
26
+ action: enum_1.HistoryNotificationAction.SUMMARIZE_ALL_REQUEST,
26
27
  data
27
28
  };
28
29
  (0, utils_1.sendNotification)(notification, 'history-summarize-previous');
@@ -40,8 +41,8 @@ function sendSummarizePreviousResult(content, isError = false, toolUseId) {
40
41
  }
41
42
  const notification = {
42
43
  toolUseId,
43
- type: "historynotify",
44
- action: "summarizeAllResult",
44
+ type: enum_1.NotificationEventType.HISTORY_NOTIFY,
45
+ action: enum_1.HistoryNotificationAction.SUMMARIZE_ALL_RESULT,
45
46
  content,
46
47
  isError
47
48
  };
@@ -60,8 +61,8 @@ function summarizeCurrentMessage(data, toolUseId) {
60
61
  }
61
62
  const notification = {
62
63
  toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
63
- type: "historynotify",
64
- action: "summarizeRequest",
64
+ type: enum_1.NotificationEventType.HISTORY_NOTIFY,
65
+ action: enum_1.HistoryNotificationAction.SUMMARIZE_REQUEST,
65
66
  data
66
67
  };
67
68
  (0, utils_1.sendNotification)(notification, 'history-summarize-current');
@@ -79,8 +80,8 @@ function sendSummarizeCurrentResult(content, isError = false, toolUseId) {
79
80
  }
80
81
  const notification = {
81
82
  toolUseId,
82
- type: "historynotify",
83
- action: "summarizeResult",
83
+ type: enum_1.NotificationEventType.HISTORY_NOTIFY,
84
+ action: enum_1.HistoryNotificationAction.SUMMARIZE_RESULT,
84
85
  content,
85
86
  isError
86
87
  };