@codebolt/codeboltjs 2.0.13 → 2.0.16

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 (127) hide show
  1. package/dist/agentlib/agent.js +3 -7
  2. package/dist/agentlib/followupquestionbuilder.d.ts +75 -0
  3. package/dist/agentlib/followupquestionbuilder.js +193 -0
  4. package/dist/agentlib/llmoutputhandler.d.ts +102 -0
  5. package/dist/agentlib/llmoutputhandler.js +451 -0
  6. package/dist/agentlib/promptbuilder.d.ts +171 -17
  7. package/dist/agentlib/promptbuilder.js +367 -49
  8. package/dist/agentlib/systemprompt.js +3 -3
  9. package/dist/agentlib/usermessage.d.ts +1 -1
  10. package/dist/agentlib/usermessage.js +5 -1
  11. package/dist/core/Codebolt.d.ts +52 -20
  12. package/dist/core/Codebolt.js +43 -1
  13. package/dist/core/messageManager.d.ts +0 -1
  14. package/dist/core/messageManager.js +4 -2
  15. package/dist/core/websocket.js +27 -1
  16. package/dist/modules/llm.d.ts +23 -3
  17. package/dist/modules/llm.js +20 -3
  18. package/dist/modules/project.d.ts +3 -3
  19. package/dist/modules/project.js +1 -1
  20. package/dist/modules/state.d.ts +5 -3
  21. package/dist/modules/state.js +2 -0
  22. package/dist/modules/task.d.ts +126 -11
  23. package/dist/modules/task.js +262 -20
  24. package/dist/notificationfunctions/agent.d.ts +48 -0
  25. package/dist/notificationfunctions/agent.js +115 -0
  26. package/dist/notificationfunctions/browser.d.ts +60 -0
  27. package/dist/notificationfunctions/browser.js +145 -0
  28. package/dist/notificationfunctions/chat.d.ts +53 -0
  29. package/dist/notificationfunctions/chat.js +125 -0
  30. package/dist/notificationfunctions/codeutils.d.ts +60 -0
  31. package/dist/notificationfunctions/codeutils.js +145 -0
  32. package/dist/notificationfunctions/crawler.d.ts +59 -0
  33. package/dist/notificationfunctions/crawler.js +159 -0
  34. package/dist/notificationfunctions/dbmemory.d.ts +50 -0
  35. package/dist/notificationfunctions/dbmemory.js +132 -0
  36. package/dist/notificationfunctions/fs.d.ts +125 -0
  37. package/dist/notificationfunctions/fs.js +472 -0
  38. package/dist/notificationfunctions/git.d.ts +174 -0
  39. package/dist/notificationfunctions/git.js +521 -0
  40. package/dist/notificationfunctions/history.d.ts +38 -0
  41. package/dist/notificationfunctions/history.js +97 -0
  42. package/dist/notificationfunctions/index.d.ts +79 -0
  43. package/dist/notificationfunctions/index.js +102 -0
  44. package/dist/notificationfunctions/llm.d.ts +39 -0
  45. package/dist/notificationfunctions/llm.js +99 -0
  46. package/dist/notificationfunctions/mcp.d.ts +67 -0
  47. package/dist/notificationfunctions/mcp.js +192 -0
  48. package/dist/notificationfunctions/search.d.ts +50 -0
  49. package/dist/notificationfunctions/search.js +146 -0
  50. package/dist/notificationfunctions/system.d.ts +25 -0
  51. package/dist/notificationfunctions/system.js +59 -0
  52. package/dist/notificationfunctions/terminal.d.ts +26 -0
  53. package/dist/notificationfunctions/terminal.js +64 -0
  54. package/dist/notificationfunctions/todo.d.ts +63 -0
  55. package/dist/notificationfunctions/todo.js +164 -0
  56. package/dist/notificationfunctions/utils.d.ts +81 -0
  57. package/dist/notificationfunctions/utils.js +177 -0
  58. package/dist/types/InternalTypes.d.ts +1 -0
  59. package/dist/types/commonTypes.d.ts +26 -3
  60. package/dist/types/index.d.ts +2 -2
  61. package/dist/types/libFunctionTypes.d.ts +80 -3
  62. package/dist/types/notificationFunctions/agent.d.ts +8 -0
  63. package/dist/types/notificationFunctions/agent.js +2 -0
  64. package/dist/types/notificationFunctions/browser.d.ts +10 -0
  65. package/dist/types/notificationFunctions/browser.js +2 -0
  66. package/dist/types/notificationFunctions/chat.d.ts +10 -0
  67. package/dist/types/notificationFunctions/chat.js +2 -0
  68. package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
  69. package/dist/types/notificationFunctions/codeutils.js +2 -0
  70. package/dist/types/notificationFunctions/crawler.d.ts +10 -0
  71. package/dist/types/notificationFunctions/crawler.js +2 -0
  72. package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
  73. package/dist/types/notificationFunctions/dbmemory.js +2 -0
  74. package/dist/types/notificationFunctions/fs.d.ts +27 -0
  75. package/dist/types/notificationFunctions/fs.js +2 -0
  76. package/dist/types/notificationFunctions/git.d.ts +29 -0
  77. package/dist/types/notificationFunctions/git.js +2 -0
  78. package/dist/types/notificationFunctions/history.d.ts +10 -0
  79. package/dist/types/notificationFunctions/history.js +2 -0
  80. package/dist/types/notificationFunctions/index.d.ts +0 -0
  81. package/dist/types/notificationFunctions/index.js +1 -0
  82. package/dist/types/notificationFunctions/llm.d.ts +10 -0
  83. package/dist/types/notificationFunctions/llm.js +2 -0
  84. package/dist/types/notificationFunctions/mcp.d.ts +16 -0
  85. package/dist/types/notificationFunctions/mcp.js +2 -0
  86. package/dist/types/notificationFunctions/search.d.ts +11 -0
  87. package/dist/types/notificationFunctions/search.js +2 -0
  88. package/dist/types/notificationFunctions/system.d.ts +7 -0
  89. package/dist/types/notificationFunctions/system.js +2 -0
  90. package/dist/types/notificationFunctions/terminal.d.ts +7 -0
  91. package/dist/types/notificationFunctions/terminal.js +2 -0
  92. package/dist/types/notificationFunctions/todo.d.ts +11 -0
  93. package/dist/types/notificationFunctions/todo.js +2 -0
  94. package/dist/types/notifications/agent.d.ts +31 -0
  95. package/dist/types/notifications/agent.js +3 -0
  96. package/dist/types/notifications/browser.d.ts +53 -0
  97. package/dist/types/notifications/browser.js +3 -0
  98. package/dist/types/notifications/chat.d.ts +37 -0
  99. package/dist/types/notifications/chat.js +3 -0
  100. package/dist/types/notifications/codeutils.d.ts +55 -0
  101. package/dist/types/notifications/codeutils.js +3 -0
  102. package/dist/types/notifications/crawler.d.ts +55 -0
  103. package/dist/types/notifications/crawler.js +3 -0
  104. package/dist/types/notifications/dbmemory.d.ts +31 -0
  105. package/dist/types/notifications/dbmemory.js +3 -0
  106. package/dist/types/notifications/fs.d.ts +180 -0
  107. package/dist/types/notifications/fs.js +3 -0
  108. package/dist/types/notifications/git.d.ts +205 -0
  109. package/dist/types/notifications/git.js +3 -0
  110. package/dist/types/notifications/history.d.ts +32 -0
  111. package/dist/types/notifications/history.js +3 -0
  112. package/dist/types/notifications/llm.d.ts +45 -0
  113. package/dist/types/notifications/llm.js +2 -0
  114. package/dist/types/notifications/mcp.d.ts +63 -0
  115. package/dist/types/notifications/mcp.js +3 -0
  116. package/dist/types/notifications/search.d.ts +47 -0
  117. package/dist/types/notifications/search.js +3 -0
  118. package/dist/types/notifications/system.d.ts +20 -0
  119. package/dist/types/notifications/system.js +2 -0
  120. package/dist/types/notifications/terminal.d.ts +17 -0
  121. package/dist/types/notifications/terminal.js +2 -0
  122. package/dist/types/notifications/todo.d.ts +60 -0
  123. package/dist/types/notifications/todo.js +3 -0
  124. package/dist/types/socketMessageTypes.d.ts +3 -0
  125. package/dist/utils.d.ts +3 -0
  126. package/dist/utils.js +7 -1
  127. package/package.json +3 -1
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ /**
3
+ * Database Memory Notification Functions
4
+ *
5
+ * This module provides functions for sending database memory-related notifications,
6
+ * including knowledge storage and retrieval operations.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.dbmemoryNotifications = exports.GetMemoryResultNotify = exports.GetMemoryRequestNotify = exports.AddMemoryResultNotify = exports.AddMemoryRequestNotify = void 0;
10
+ const utils_1 = require("./utils");
11
+ /**
12
+ * Sends a request to add knowledge to memory
13
+ *
14
+ * @param key - The memory key
15
+ * @param value - The memory value
16
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
17
+ *
18
+ * Requirements: 6.1 - WHEN I call `codebolt.notify.dbmemory.AddMemoryRequestNotify()` THEN the system SHALL send an AddMemoryRequestNotification via WebSocket
19
+ */
20
+ function AddMemoryRequestNotify(key, value, toolUseId) {
21
+ // Validate required fields
22
+ if (!(0, utils_1.validateRequiredFields)({ key }, ['key'], 'dbmemory.AddMemoryRequestNotify')) {
23
+ return;
24
+ }
25
+ // Validate that value is provided (can be any type including null, but not undefined)
26
+ if (value === undefined) {
27
+ console.error('[NotificationFunctions] Value is required for dbmemory.AddMemoryRequestNotify');
28
+ return;
29
+ }
30
+ // Create the notification
31
+ const notification = {
32
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
33
+ type: "dbmemorynotify",
34
+ action: "addKnowledgeRequest",
35
+ data: {
36
+ key: key,
37
+ value: value
38
+ }
39
+ };
40
+ // Send the notification
41
+ (0, utils_1.sendNotification)(notification, 'dbmemory.AddMemoryRequestNotify');
42
+ }
43
+ exports.AddMemoryRequestNotify = AddMemoryRequestNotify;
44
+ /**
45
+ * Sends a result response for an add memory operation
46
+ *
47
+ * @param content - The response content (string or any object)
48
+ * @param isError - Whether this is an error response (default: false)
49
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
50
+ *
51
+ * Requirements: 6.2 - WHEN I call `codebolt.notify.dbmemory.AddMemoryResultNotify()` THEN the system SHALL send an AddMemoryResultNotification via WebSocket
52
+ */
53
+ function AddMemoryResultNotify(content, isError = false, toolUseId) {
54
+ // Validate content is provided
55
+ if (content === null || content === undefined) {
56
+ console.error('[NotificationFunctions] Content is required for dbmemory.AddMemoryResultNotify');
57
+ return;
58
+ }
59
+ // Create the notification
60
+ const notification = {
61
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
62
+ type: "dbmemorynotify",
63
+ action: "addKnowledgeResult",
64
+ content: content,
65
+ isError: isError
66
+ };
67
+ // Send the notification
68
+ (0, utils_1.sendNotification)(notification, 'dbmemory.AddMemoryResultNotify');
69
+ }
70
+ exports.AddMemoryResultNotify = AddMemoryResultNotify;
71
+ /**
72
+ * Sends a request to get knowledge from memory
73
+ *
74
+ * @param key - The memory key to retrieve
75
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
76
+ *
77
+ * Requirements: 6.3 - WHEN I call `codebolt.notify.dbmemory.GetMemoryRequestNotify()` THEN the system SHALL send a GetMemoryRequestNotification via WebSocket
78
+ */
79
+ function GetMemoryRequestNotify(key, toolUseId) {
80
+ // Validate required fields
81
+ if (!(0, utils_1.validateRequiredFields)({ key }, ['key'], 'dbmemory.GetMemoryRequestNotify')) {
82
+ return;
83
+ }
84
+ // Create the notification
85
+ const notification = {
86
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
87
+ type: "dbmemorynotify",
88
+ action: "getKnowledgeRequest",
89
+ data: {
90
+ key: key
91
+ }
92
+ };
93
+ // Send the notification
94
+ (0, utils_1.sendNotification)(notification, 'dbmemory.GetMemoryRequestNotify');
95
+ }
96
+ exports.GetMemoryRequestNotify = GetMemoryRequestNotify;
97
+ /**
98
+ * Sends a result response for a get memory operation
99
+ *
100
+ * @param content - The response content (string or any object)
101
+ * @param isError - Whether this is an error response (default: false)
102
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
103
+ *
104
+ * Requirements: 6.4 - WHEN I call `codebolt.notify.dbmemory.GetMemoryResultNotify()` THEN the system SHALL send a GetMemoryResultNotification via WebSocket
105
+ */
106
+ function GetMemoryResultNotify(content, isError = false, toolUseId) {
107
+ // Validate content is provided
108
+ if (content === null || content === undefined) {
109
+ console.error('[NotificationFunctions] Content is required for dbmemory.GetMemoryResultNotify');
110
+ return;
111
+ }
112
+ // Create the notification
113
+ const notification = {
114
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
115
+ type: "dbmemorynotify",
116
+ action: "getKnowledgeResult",
117
+ content: content,
118
+ isError: isError
119
+ };
120
+ // Send the notification
121
+ (0, utils_1.sendNotification)(notification, 'dbmemory.GetMemoryResultNotify');
122
+ }
123
+ exports.GetMemoryResultNotify = GetMemoryResultNotify;
124
+ /**
125
+ * Database memory notification functions object
126
+ */
127
+ exports.dbmemoryNotifications = {
128
+ AddMemoryRequestNotify,
129
+ AddMemoryResultNotify,
130
+ GetMemoryRequestNotify,
131
+ GetMemoryResultNotify
132
+ };
@@ -0,0 +1,125 @@
1
+ /**
2
+ * File System Notification Functions
3
+ *
4
+ * This module provides functions for sending file system-related notifications,
5
+ * including file and folder operations like create, read, edit, delete, etc.
6
+ */
7
+ import { FsNotifications } from '../types/notificationFunctions/fs';
8
+ /**
9
+ * Sends a request to create a file
10
+ * Requirements: 7.1
11
+ */
12
+ export declare function FileCreateRequestNotify(fileName: string, source: string, filePath: string, toolUseId?: string): void;
13
+ /**
14
+ * Sends a response to a file creation request
15
+ * Requirements: 7.2
16
+ */
17
+ export declare function FileCreateResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
18
+ /**
19
+ * Sends a request to create a folder
20
+ * Requirements: 7.3
21
+ */
22
+ export declare function FolderCreateRequestNotify(folderName: string, folderPath: string, toolUseId?: string): void;
23
+ /**
24
+ * Sends a response to a folder creation request
25
+ * Requirements: 7.4
26
+ */
27
+ export declare function FolderCreateResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
28
+ /**
29
+ * Sends a request to read a file
30
+ * Requirements: 7.4
31
+ */
32
+ export declare function FileReadRequestNotify(filePath: string, startLine?: string, endLine?: string, toolUseId?: string): void;
33
+ /**
34
+ * Sends a response to a file read request
35
+ * Requirements: 7.4
36
+ */
37
+ export declare function FileReadResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
38
+ /**
39
+ * Sends a request to edit a file
40
+ * Requirements: 7.5
41
+ */
42
+ export declare function FileEditRequestNotify(fileName: string, filePath: string, newContent: string, toolUseId?: string): void;
43
+ /**
44
+ * Sends a response to a file edit request
45
+ * Requirements: 7.5
46
+ */
47
+ export declare function FileEditResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
48
+ /**
49
+ * Sends a request to delete a file
50
+ * Requirements: 7.6
51
+ */
52
+ export declare function FileDeleteRequestNotify(fileName: string, filePath: string, toolUseId?: string): void;
53
+ /**
54
+ * Sends a response to a file delete request
55
+ * Requirements: 7.6
56
+ */
57
+ export declare function FileDeleteResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
58
+ /**
59
+ * Sends a request to delete a folder
60
+ * Requirements: 7.6
61
+ */
62
+ export declare function FolderDeleteRequestNotify(folderName: string, folderPath: string, toolUseId?: string): void;
63
+ /**
64
+ * Sends a response to a folder delete request
65
+ * Requirements: 7.6
66
+ */
67
+ export declare function FolderDeleteResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void; /**
68
+ *
69
+ Sends a request to list directory contents
70
+ * Requirements: 7.7
71
+ */
72
+ export declare function ListDirectoryRequestNotify(dirPath: string, toolUseId?: string): void;
73
+ /**
74
+ * Sends a response to a directory listing request
75
+ * Requirements: 7.7
76
+ */
77
+ export declare function ListDirectoryResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
78
+ /**
79
+ * Sends a request to write to a file
80
+ * Requirements: 7.8
81
+ */
82
+ export declare function WriteToFileRequestNotify(filePath: string, text: string, toolUseId?: string): void;
83
+ /**
84
+ * Sends a response to a write to file request
85
+ * Requirements: 7.8
86
+ */
87
+ export declare function WriteToFileResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
88
+ /**
89
+ * Sends a request to append to a file
90
+ * Requirements: 7.9
91
+ */
92
+ export declare function AppendToFileRequestNotify(filePath: string, text: string, toolUseId?: string): void;
93
+ /**
94
+ * Sends a response to an append to file request
95
+ * Requirements: 7.9
96
+ */
97
+ export declare function AppendToFileResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void; /**
98
+
99
+ * Sends a request to copy a file
100
+ * Requirements: 7.10
101
+ */
102
+ export declare function CopyFileRequestNotify(sourceFile: string, destinationFile: string, toolUseId?: string): void;
103
+ /**
104
+ * Sends a response to a file copy request
105
+ * Requirements: 7.10
106
+ */
107
+ export declare function CopyFileResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
108
+ /**
109
+ * Sends a request to move a file
110
+ * Requirements: 7.11
111
+ */
112
+ export declare function MoveFileRequestNotify(sourceFile: string, destinationFile: string, toolUseId?: string): void;
113
+ /**
114
+ * Sends a response to a file move request
115
+ * Requirements: 7.11
116
+ */
117
+ export declare function MoveFileResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
118
+ /**
119
+ * File system notification functions object
120
+ */
121
+ export declare const fsNotifications: FsNotifications;
122
+ /**
123
+ * Default export
124
+ */
125
+ export default fsNotifications;