@codebolt/codeboltjs 2.0.13 → 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.
Files changed (125) 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/websocket.js +2 -1
  14. package/dist/modules/llm.d.ts +23 -3
  15. package/dist/modules/llm.js +20 -3
  16. package/dist/modules/project.d.ts +3 -3
  17. package/dist/modules/project.js +1 -1
  18. package/dist/modules/state.d.ts +5 -3
  19. package/dist/modules/state.js +2 -0
  20. package/dist/modules/task.d.ts +126 -11
  21. package/dist/modules/task.js +262 -20
  22. package/dist/notificationfunctions/agent.d.ts +48 -0
  23. package/dist/notificationfunctions/agent.js +115 -0
  24. package/dist/notificationfunctions/browser.d.ts +60 -0
  25. package/dist/notificationfunctions/browser.js +145 -0
  26. package/dist/notificationfunctions/chat.d.ts +53 -0
  27. package/dist/notificationfunctions/chat.js +125 -0
  28. package/dist/notificationfunctions/codeutils.d.ts +60 -0
  29. package/dist/notificationfunctions/codeutils.js +145 -0
  30. package/dist/notificationfunctions/crawler.d.ts +59 -0
  31. package/dist/notificationfunctions/crawler.js +159 -0
  32. package/dist/notificationfunctions/dbmemory.d.ts +50 -0
  33. package/dist/notificationfunctions/dbmemory.js +132 -0
  34. package/dist/notificationfunctions/fs.d.ts +125 -0
  35. package/dist/notificationfunctions/fs.js +472 -0
  36. package/dist/notificationfunctions/git.d.ts +174 -0
  37. package/dist/notificationfunctions/git.js +521 -0
  38. package/dist/notificationfunctions/history.d.ts +38 -0
  39. package/dist/notificationfunctions/history.js +97 -0
  40. package/dist/notificationfunctions/index.d.ts +79 -0
  41. package/dist/notificationfunctions/index.js +102 -0
  42. package/dist/notificationfunctions/llm.d.ts +39 -0
  43. package/dist/notificationfunctions/llm.js +99 -0
  44. package/dist/notificationfunctions/mcp.d.ts +67 -0
  45. package/dist/notificationfunctions/mcp.js +192 -0
  46. package/dist/notificationfunctions/search.d.ts +50 -0
  47. package/dist/notificationfunctions/search.js +146 -0
  48. package/dist/notificationfunctions/system.d.ts +25 -0
  49. package/dist/notificationfunctions/system.js +59 -0
  50. package/dist/notificationfunctions/terminal.d.ts +26 -0
  51. package/dist/notificationfunctions/terminal.js +64 -0
  52. package/dist/notificationfunctions/todo.d.ts +63 -0
  53. package/dist/notificationfunctions/todo.js +164 -0
  54. package/dist/notificationfunctions/utils.d.ts +81 -0
  55. package/dist/notificationfunctions/utils.js +177 -0
  56. package/dist/types/InternalTypes.d.ts +1 -0
  57. package/dist/types/commonTypes.d.ts +26 -3
  58. package/dist/types/index.d.ts +2 -2
  59. package/dist/types/libFunctionTypes.d.ts +80 -3
  60. package/dist/types/notificationFunctions/agent.d.ts +8 -0
  61. package/dist/types/notificationFunctions/agent.js +2 -0
  62. package/dist/types/notificationFunctions/browser.d.ts +10 -0
  63. package/dist/types/notificationFunctions/browser.js +2 -0
  64. package/dist/types/notificationFunctions/chat.d.ts +10 -0
  65. package/dist/types/notificationFunctions/chat.js +2 -0
  66. package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
  67. package/dist/types/notificationFunctions/codeutils.js +2 -0
  68. package/dist/types/notificationFunctions/crawler.d.ts +10 -0
  69. package/dist/types/notificationFunctions/crawler.js +2 -0
  70. package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
  71. package/dist/types/notificationFunctions/dbmemory.js +2 -0
  72. package/dist/types/notificationFunctions/fs.d.ts +27 -0
  73. package/dist/types/notificationFunctions/fs.js +2 -0
  74. package/dist/types/notificationFunctions/git.d.ts +29 -0
  75. package/dist/types/notificationFunctions/git.js +2 -0
  76. package/dist/types/notificationFunctions/history.d.ts +10 -0
  77. package/dist/types/notificationFunctions/history.js +2 -0
  78. package/dist/types/notificationFunctions/index.d.ts +0 -0
  79. package/dist/types/notificationFunctions/index.js +1 -0
  80. package/dist/types/notificationFunctions/llm.d.ts +10 -0
  81. package/dist/types/notificationFunctions/llm.js +2 -0
  82. package/dist/types/notificationFunctions/mcp.d.ts +16 -0
  83. package/dist/types/notificationFunctions/mcp.js +2 -0
  84. package/dist/types/notificationFunctions/search.d.ts +11 -0
  85. package/dist/types/notificationFunctions/search.js +2 -0
  86. package/dist/types/notificationFunctions/system.d.ts +7 -0
  87. package/dist/types/notificationFunctions/system.js +2 -0
  88. package/dist/types/notificationFunctions/terminal.d.ts +7 -0
  89. package/dist/types/notificationFunctions/terminal.js +2 -0
  90. package/dist/types/notificationFunctions/todo.d.ts +11 -0
  91. package/dist/types/notificationFunctions/todo.js +2 -0
  92. package/dist/types/notifications/agent.d.ts +31 -0
  93. package/dist/types/notifications/agent.js +3 -0
  94. package/dist/types/notifications/browser.d.ts +53 -0
  95. package/dist/types/notifications/browser.js +3 -0
  96. package/dist/types/notifications/chat.d.ts +37 -0
  97. package/dist/types/notifications/chat.js +3 -0
  98. package/dist/types/notifications/codeutils.d.ts +55 -0
  99. package/dist/types/notifications/codeutils.js +3 -0
  100. package/dist/types/notifications/crawler.d.ts +55 -0
  101. package/dist/types/notifications/crawler.js +3 -0
  102. package/dist/types/notifications/dbmemory.d.ts +31 -0
  103. package/dist/types/notifications/dbmemory.js +3 -0
  104. package/dist/types/notifications/fs.d.ts +180 -0
  105. package/dist/types/notifications/fs.js +3 -0
  106. package/dist/types/notifications/git.d.ts +205 -0
  107. package/dist/types/notifications/git.js +3 -0
  108. package/dist/types/notifications/history.d.ts +32 -0
  109. package/dist/types/notifications/history.js +3 -0
  110. package/dist/types/notifications/llm.d.ts +45 -0
  111. package/dist/types/notifications/llm.js +2 -0
  112. package/dist/types/notifications/mcp.d.ts +63 -0
  113. package/dist/types/notifications/mcp.js +3 -0
  114. package/dist/types/notifications/search.d.ts +47 -0
  115. package/dist/types/notifications/search.js +3 -0
  116. package/dist/types/notifications/system.d.ts +20 -0
  117. package/dist/types/notifications/system.js +2 -0
  118. package/dist/types/notifications/terminal.d.ts +17 -0
  119. package/dist/types/notifications/terminal.js +2 -0
  120. package/dist/types/notifications/todo.d.ts +60 -0
  121. package/dist/types/notifications/todo.js +3 -0
  122. package/dist/types/socketMessageTypes.d.ts +3 -0
  123. package/dist/utils.d.ts +3 -0
  124. package/dist/utils.js +7 -1
  125. package/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Chat Notification Functions
3
+ *
4
+ * This module provides functions for sending chat-related notifications,
5
+ * including user messages, agent responses, and chat history operations.
6
+ */
7
+ import { AgentTextResponseNotification, GetChatHistoryRequestNotification } from '../types/notifications/chat';
8
+ import { ChatNotifications } from '../types/notificationFunctions/chat';
9
+ /**
10
+ * Sends a user message request
11
+ *
12
+ * @param message - The user message
13
+ * @param payload - Optional payload data
14
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
15
+ *
16
+ * Requirements: 3.1 - WHEN I call `codebolt.notify.chat.UserMessageRequestNotify()` THEN the system SHALL send a UserMessageRequestNotification via WebSocket
17
+ */
18
+ export declare function UserMessageRequestNotify(message: string, payload?: any, toolUseId?: string): void;
19
+ /**
20
+ * Sends an agent text response
21
+ *
22
+ * @param content - The response content (string or any object)
23
+ * @param isError - Whether this is an error response (default: false)
24
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
25
+ * @param data - Optional additional data including message, timestamp, agentId, and conversationId
26
+ *
27
+ * Requirements: 3.2 - WHEN I call `codebolt.notify.chat.AgentTextResponseNotify()` THEN the system SHALL send an AgentTextResponseNotification via WebSocket
28
+ */
29
+ export declare function AgentTextResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: AgentTextResponseNotification['data']): void;
30
+ /**
31
+ * Requests chat history
32
+ *
33
+ * @param data - Optional data including sessionId
34
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
35
+ *
36
+ * Requirements: 3.3 - WHEN I call `codebolt.notify.chat.GetChatHistoryRequestNotify()` THEN the system SHALL send a GetChatHistoryRequestNotification via WebSocket
37
+ */
38
+ export declare function GetChatHistoryRequestNotify(data?: GetChatHistoryRequestNotification['data'], toolUseId?: string): void;
39
+ /**
40
+ * Sends chat history result
41
+ *
42
+ * @param content - The chat history content (string or any object)
43
+ * @param isError - Whether this is an error response (default: false)
44
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
45
+ *
46
+ * Requirements: 3.4 - WHEN I call `codebolt.notify.chat.GetChatHistoryResultNotify()` THEN the system SHALL send a GetChatHistoryResultNotification via WebSocket
47
+ */
48
+ export declare function GetChatHistoryResultNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
49
+ /**
50
+ * Chat notification functions object
51
+ */
52
+ export declare const chatNotifications: ChatNotifications;
53
+ export default chatNotifications;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ /**
3
+ * Chat Notification Functions
4
+ *
5
+ * This module provides functions for sending chat-related notifications,
6
+ * including user messages, agent responses, and chat history operations.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.chatNotifications = exports.GetChatHistoryResultNotify = exports.GetChatHistoryRequestNotify = exports.AgentTextResponseNotify = exports.UserMessageRequestNotify = void 0;
10
+ const utils_1 = require("./utils");
11
+ /**
12
+ * Sends a user message request
13
+ *
14
+ * @param message - The user message
15
+ * @param payload - Optional payload data
16
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
17
+ *
18
+ * Requirements: 3.1 - WHEN I call `codebolt.notify.chat.UserMessageRequestNotify()` THEN the system SHALL send a UserMessageRequestNotification via WebSocket
19
+ */
20
+ function UserMessageRequestNotify(message, payload, toolUseId) {
21
+ // Validate required fields
22
+ if (!(0, utils_1.validateRequiredFields)({ message }, ['message'], 'chat.UserMessageRequestNotify')) {
23
+ return;
24
+ }
25
+ // Create the notification
26
+ const notification = {
27
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
28
+ type: "chatnotify",
29
+ action: "sendMessageRequest",
30
+ data: {
31
+ message: message,
32
+ payload: payload
33
+ }
34
+ };
35
+ // Send the notification
36
+ (0, utils_1.sendNotification)(notification, 'chat.UserMessageRequestNotify');
37
+ }
38
+ exports.UserMessageRequestNotify = UserMessageRequestNotify;
39
+ /**
40
+ * Sends an agent text response
41
+ *
42
+ * @param content - The response content (string or any object)
43
+ * @param isError - Whether this is an error response (default: false)
44
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
45
+ * @param data - Optional additional data including message, timestamp, agentId, and conversationId
46
+ *
47
+ * Requirements: 3.2 - WHEN I call `codebolt.notify.chat.AgentTextResponseNotify()` THEN the system SHALL send an AgentTextResponseNotification via WebSocket
48
+ */
49
+ function AgentTextResponseNotify(content, isError = false, toolUseId, data) {
50
+ // Validate content is provided
51
+ if (content === null || content === undefined) {
52
+ console.error('[NotificationFunctions] Content is required for chat.AgentTextResponseNotify');
53
+ return;
54
+ }
55
+ // Create the notification
56
+ const notification = {
57
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
58
+ type: "chatnotify",
59
+ action: "agentTextResponse",
60
+ content: content,
61
+ isError: isError,
62
+ data: data
63
+ };
64
+ // Send the notification
65
+ (0, utils_1.sendNotification)(notification, 'chat.AgentTextResponseNotify');
66
+ }
67
+ exports.AgentTextResponseNotify = AgentTextResponseNotify;
68
+ /**
69
+ * Requests chat history
70
+ *
71
+ * @param data - Optional data including sessionId
72
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
73
+ *
74
+ * Requirements: 3.3 - WHEN I call `codebolt.notify.chat.GetChatHistoryRequestNotify()` THEN the system SHALL send a GetChatHistoryRequestNotification via WebSocket
75
+ */
76
+ function GetChatHistoryRequestNotify(data, toolUseId) {
77
+ // Create the notification
78
+ const notification = {
79
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
80
+ type: "chatnotify",
81
+ action: "getChatHistoryRequest",
82
+ data: data || {}
83
+ };
84
+ // Send the notification
85
+ (0, utils_1.sendNotification)(notification, 'chat.GetChatHistoryRequestNotify');
86
+ }
87
+ exports.GetChatHistoryRequestNotify = GetChatHistoryRequestNotify;
88
+ /**
89
+ * Sends chat history result
90
+ *
91
+ * @param content - The chat history content (string or any object)
92
+ * @param isError - Whether this is an error response (default: false)
93
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
94
+ *
95
+ * Requirements: 3.4 - WHEN I call `codebolt.notify.chat.GetChatHistoryResultNotify()` THEN the system SHALL send a GetChatHistoryResultNotification via WebSocket
96
+ */
97
+ function GetChatHistoryResultNotify(content, isError = false, toolUseId) {
98
+ // Validate content is provided
99
+ if (content === null || content === undefined) {
100
+ console.error('[NotificationFunctions] Content is required for chat.GetChatHistoryResultNotify');
101
+ return;
102
+ }
103
+ // Create the notification
104
+ const notification = {
105
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
106
+ type: "chatnotify",
107
+ action: "getChatHistoryResult",
108
+ content: content,
109
+ isError: isError
110
+ };
111
+ // Send the notification
112
+ (0, utils_1.sendNotification)(notification, 'chat.GetChatHistoryResultNotify');
113
+ }
114
+ exports.GetChatHistoryResultNotify = GetChatHistoryResultNotify;
115
+ /**
116
+ * Chat notification functions object
117
+ */
118
+ exports.chatNotifications = {
119
+ UserMessageRequestNotify,
120
+ AgentTextResponseNotify,
121
+ GetChatHistoryRequestNotify,
122
+ GetChatHistoryResultNotify
123
+ };
124
+ // Default export
125
+ exports.default = exports.chatNotifications;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Code Utils Notification Functions
3
+ *
4
+ * This module provides functions for sending code utilities-related notifications,
5
+ * including grep search and glob search operations.
6
+ */
7
+ import { GrepSearchResponseNotification, GlobSearchResponseNotification } from '../types/notifications/codeutils';
8
+ import { CodeutilsNotifications } from '../types/notificationFunctions/codeutils';
9
+ /**
10
+ * Sends a grep search request
11
+ *
12
+ * @param pattern - The search pattern
13
+ * @param filePath - Optional file path to search in
14
+ * @param recursive - Optional recursive search flag
15
+ * @param ignoreCase - Optional ignore case flag
16
+ * @param maxResults - Optional maximum number of results
17
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
18
+ *
19
+ * Requirements: 4.1 - WHEN I call `codebolt.notify.codeutils.GrepSearchRequestNotify()` THEN the system SHALL send a GrepSearchRequestNotification via WebSocket
20
+ */
21
+ export declare function GrepSearchRequestNotify(pattern: string, filePath?: string, recursive?: boolean, ignoreCase?: boolean, maxResults?: number, toolUseId?: string): void;
22
+ /**
23
+ * Sends a response to a grep search request
24
+ *
25
+ * @param content - The response content (string or any object)
26
+ * @param isError - Whether this is an error response (default: false)
27
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
28
+ * @param data - Optional response data with matches and totalMatches
29
+ *
30
+ * Requirements: 4.2 - WHEN I call `codebolt.notify.codeutils.GrepSearchResponseNotify()` THEN the system SHALL send a GrepSearchResponseNotification via WebSocket
31
+ */
32
+ export declare function GrepSearchResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: GrepSearchResponseNotification['data']): void;
33
+ /**
34
+ * Sends a glob search request
35
+ *
36
+ * @param pattern - The glob pattern
37
+ * @param basePath - Optional base path to search in
38
+ * @param maxDepth - Optional maximum search depth
39
+ * @param includeDirectories - Optional flag to include directories
40
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
41
+ *
42
+ * Requirements: 4.3 - WHEN I call `codebolt.notify.codeutils.GlobSearchRequestNotify()` THEN the system SHALL send a GlobSearchRequestNotification via WebSocket
43
+ */
44
+ export declare function GlobSearchRequestNotify(pattern: string, basePath?: string, maxDepth?: number, includeDirectories?: boolean, toolUseId?: string): void;
45
+ /**
46
+ * Sends a response to a glob search request
47
+ *
48
+ * @param content - The response content (string or any object)
49
+ * @param isError - Whether this is an error response (default: false)
50
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
51
+ * @param data - Optional response data with files and totalFiles
52
+ *
53
+ * Requirements: 4.4 - WHEN I call `codebolt.notify.codeutils.GlobSearchResponseNotify()` THEN the system SHALL send a GlobSearchResponseNotification via WebSocket
54
+ */
55
+ export declare function GlobSearchResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: GlobSearchResponseNotification['data']): void;
56
+ /**
57
+ * Codeutils notification functions object
58
+ */
59
+ export declare const codeutilsNotifications: CodeutilsNotifications;
60
+ export default codeutilsNotifications;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ /**
3
+ * Code Utils Notification Functions
4
+ *
5
+ * This module provides functions for sending code utilities-related notifications,
6
+ * including grep search and glob search operations.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.codeutilsNotifications = exports.GlobSearchResponseNotify = exports.GlobSearchRequestNotify = exports.GrepSearchResponseNotify = exports.GrepSearchRequestNotify = void 0;
10
+ const utils_1 = require("./utils");
11
+ /**
12
+ * Sends a grep search request
13
+ *
14
+ * @param pattern - The search pattern
15
+ * @param filePath - Optional file path to search in
16
+ * @param recursive - Optional recursive search flag
17
+ * @param ignoreCase - Optional ignore case flag
18
+ * @param maxResults - Optional maximum number of results
19
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
20
+ *
21
+ * Requirements: 4.1 - WHEN I call `codebolt.notify.codeutils.GrepSearchRequestNotify()` THEN the system SHALL send a GrepSearchRequestNotification via WebSocket
22
+ */
23
+ function GrepSearchRequestNotify(pattern, filePath, recursive, ignoreCase, maxResults, toolUseId) {
24
+ // Validate required fields
25
+ if (!(0, utils_1.validateRequiredFields)({ pattern }, ['pattern'], 'codeutils.GrepSearchRequestNotify')) {
26
+ return;
27
+ }
28
+ // Create the notification
29
+ const notification = {
30
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
31
+ type: "codeutilsnotify",
32
+ action: "grepSearchRequest",
33
+ data: {
34
+ pattern: pattern,
35
+ filePath: filePath,
36
+ recursive: recursive,
37
+ ignoreCase: ignoreCase,
38
+ maxResults: maxResults
39
+ }
40
+ };
41
+ // Send the notification
42
+ (0, utils_1.sendNotification)(notification, 'codeutils.GrepSearchRequestNotify');
43
+ }
44
+ exports.GrepSearchRequestNotify = GrepSearchRequestNotify;
45
+ /**
46
+ * Sends a response to a grep search request
47
+ *
48
+ * @param content - The response content (string or any object)
49
+ * @param isError - Whether this is an error response (default: false)
50
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
51
+ * @param data - Optional response data with matches and totalMatches
52
+ *
53
+ * Requirements: 4.2 - WHEN I call `codebolt.notify.codeutils.GrepSearchResponseNotify()` THEN the system SHALL send a GrepSearchResponseNotification via WebSocket
54
+ */
55
+ function GrepSearchResponseNotify(content, isError = false, toolUseId, data) {
56
+ // Validate content is provided
57
+ if (content === null || content === undefined) {
58
+ console.error('[NotificationFunctions] Content is required for codeutils.GrepSearchResponseNotify');
59
+ return;
60
+ }
61
+ // Create the notification
62
+ const notification = {
63
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
64
+ type: "codeutilsnotify",
65
+ action: "grepSearchResult",
66
+ content: content,
67
+ isError: isError,
68
+ data: data
69
+ };
70
+ // Send the notification
71
+ (0, utils_1.sendNotification)(notification, 'codeutils.GrepSearchResponseNotify');
72
+ }
73
+ exports.GrepSearchResponseNotify = GrepSearchResponseNotify;
74
+ /**
75
+ * Sends a glob search request
76
+ *
77
+ * @param pattern - The glob pattern
78
+ * @param basePath - Optional base path to search in
79
+ * @param maxDepth - Optional maximum search depth
80
+ * @param includeDirectories - Optional flag to include directories
81
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
82
+ *
83
+ * Requirements: 4.3 - WHEN I call `codebolt.notify.codeutils.GlobSearchRequestNotify()` THEN the system SHALL send a GlobSearchRequestNotification via WebSocket
84
+ */
85
+ function GlobSearchRequestNotify(pattern, basePath, maxDepth, includeDirectories, toolUseId) {
86
+ // Validate required fields
87
+ if (!(0, utils_1.validateRequiredFields)({ pattern }, ['pattern'], 'codeutils.GlobSearchRequestNotify')) {
88
+ return;
89
+ }
90
+ // Create the notification
91
+ const notification = {
92
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
93
+ type: "codeutilsnotify",
94
+ action: "globSearchRequest",
95
+ data: {
96
+ pattern: pattern,
97
+ basePath: basePath,
98
+ maxDepth: maxDepth,
99
+ includeDirectories: includeDirectories
100
+ }
101
+ };
102
+ // Send the notification
103
+ (0, utils_1.sendNotification)(notification, 'codeutils.GlobSearchRequestNotify');
104
+ }
105
+ exports.GlobSearchRequestNotify = GlobSearchRequestNotify;
106
+ /**
107
+ * Sends a response to a glob search request
108
+ *
109
+ * @param content - The response content (string or any object)
110
+ * @param isError - Whether this is an error response (default: false)
111
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
112
+ * @param data - Optional response data with files and totalFiles
113
+ *
114
+ * Requirements: 4.4 - WHEN I call `codebolt.notify.codeutils.GlobSearchResponseNotify()` THEN the system SHALL send a GlobSearchResponseNotification via WebSocket
115
+ */
116
+ function GlobSearchResponseNotify(content, isError = false, toolUseId, data) {
117
+ // Validate content is provided
118
+ if (content === null || content === undefined) {
119
+ console.error('[NotificationFunctions] Content is required for codeutils.GlobSearchResponseNotify');
120
+ return;
121
+ }
122
+ // Create the notification
123
+ const notification = {
124
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
125
+ type: "codeutilsnotify",
126
+ action: "globSearchResult",
127
+ content: content,
128
+ isError: isError,
129
+ data: data
130
+ };
131
+ // Send the notification
132
+ (0, utils_1.sendNotification)(notification, 'codeutils.GlobSearchResponseNotify');
133
+ }
134
+ exports.GlobSearchResponseNotify = GlobSearchResponseNotify;
135
+ /**
136
+ * Codeutils notification functions object
137
+ */
138
+ exports.codeutilsNotifications = {
139
+ GrepSearchRequestNotify,
140
+ GrepSearchResponseNotify,
141
+ GlobSearchRequestNotify,
142
+ GlobSearchResponseNotify
143
+ };
144
+ // Default export
145
+ exports.default = exports.codeutilsNotifications;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Crawler Notification Functions
3
+ *
4
+ * This module provides functions for sending crawler-related notifications,
5
+ * including web crawling search operations and crawler initialization.
6
+ */
7
+ import { CrawlerSearchResponseNotification, CrawlerStartResponseNotification } from '../types/notifications/crawler';
8
+ import { CrawlerNotifications } from '../types/notificationFunctions/crawler';
9
+ /**
10
+ * Sends a request to perform a crawler search
11
+ *
12
+ * @param url - The URL to crawl
13
+ * @param searchQuery - Optional search query
14
+ * @param maxDepth - Optional maximum crawl depth
15
+ * @param maxPages - Optional maximum pages to crawl
16
+ * @param includeSubdomains - Optional flag to include subdomains
17
+ * @param followRedirects - Optional flag to follow redirects
18
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
19
+ *
20
+ * Requirements: 5.1 - WHEN I call `codebolt.notify.crawler.CrawlerSearchRequestNotify()` THEN the system SHALL send a CrawlerSearchRequestNotification via WebSocket
21
+ */
22
+ export declare function CrawlerSearchRequestNotify(url: string, searchQuery?: string, maxDepth?: number, maxPages?: number, includeSubdomains?: boolean, followRedirects?: boolean, toolUseId?: string): void;
23
+ /**
24
+ * Sends a response to a crawler search request
25
+ *
26
+ * @param content - The response content (string or any object)
27
+ * @param isError - Whether this is an error response (default: false)
28
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
29
+ * @param data - Optional response data containing pages, totalPages, and crawlTime
30
+ *
31
+ * Requirements: 5.2 - WHEN I call `codebolt.notify.crawler.CrawlerSearchResponseNotify()` THEN the system SHALL send a CrawlerSearchResponseNotification via WebSocket
32
+ */
33
+ export declare function CrawlerSearchResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: CrawlerSearchResponseNotification['data']): void;
34
+ /**
35
+ * Sends a request to start a crawler
36
+ *
37
+ * @param startUrl - The URL to start crawling from
38
+ * @param options - Optional crawler configuration options
39
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
40
+ *
41
+ * Requirements: 5.3 - WHEN I call `codebolt.notify.crawler.CrawlerStartRequestNotify()` THEN the system SHALL send a CrawlerStartRequestNotification via WebSocket
42
+ */
43
+ export declare function CrawlerStartRequestNotify(startUrl: string, options?: any, toolUseId?: string): void;
44
+ /**
45
+ * Sends a response to a crawler start request
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
+ * @param data - Optional response data containing sessionId and status
51
+ *
52
+ * Requirements: 5.4 - WHEN I call `codebolt.notify.crawler.CrawlerStartResponseNotify()` THEN the system SHALL send a CrawlerStartResponseNotification via WebSocket
53
+ */
54
+ export declare function CrawlerStartResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: CrawlerStartResponseNotification['data']): void;
55
+ /**
56
+ * Crawler notification functions object
57
+ */
58
+ export declare const crawlerNotifications: CrawlerNotifications;
59
+ export default crawlerNotifications;
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ /**
3
+ * Crawler Notification Functions
4
+ *
5
+ * This module provides functions for sending crawler-related notifications,
6
+ * including web crawling search operations and crawler initialization.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.crawlerNotifications = exports.CrawlerStartResponseNotify = exports.CrawlerStartRequestNotify = exports.CrawlerSearchResponseNotify = exports.CrawlerSearchRequestNotify = void 0;
10
+ const utils_1 = require("./utils");
11
+ /**
12
+ * Sends a request to perform a crawler search
13
+ *
14
+ * @param url - The URL to crawl
15
+ * @param searchQuery - Optional search query
16
+ * @param maxDepth - Optional maximum crawl depth
17
+ * @param maxPages - Optional maximum pages to crawl
18
+ * @param includeSubdomains - Optional flag to include subdomains
19
+ * @param followRedirects - Optional flag to follow redirects
20
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
21
+ *
22
+ * Requirements: 5.1 - WHEN I call `codebolt.notify.crawler.CrawlerSearchRequestNotify()` THEN the system SHALL send a CrawlerSearchRequestNotification via WebSocket
23
+ */
24
+ function CrawlerSearchRequestNotify(url, searchQuery, maxDepth, maxPages, includeSubdomains, followRedirects, toolUseId) {
25
+ // Validate required fields
26
+ if (!(0, utils_1.validateRequiredFields)({ url }, ['url'], 'crawler.CrawlerSearchRequestNotify')) {
27
+ return;
28
+ }
29
+ // Validate URL format
30
+ try {
31
+ new URL(url);
32
+ }
33
+ catch (error) {
34
+ console.error('[NotificationFunctions] Invalid URL format for crawler.CrawlerSearchRequestNotify:', url);
35
+ return;
36
+ }
37
+ // Create the notification
38
+ const notification = {
39
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
40
+ type: "crawlernotify",
41
+ action: "crawlerSearchRequest",
42
+ data: {
43
+ url: url,
44
+ searchQuery: searchQuery,
45
+ maxDepth: maxDepth,
46
+ maxPages: maxPages,
47
+ includeSubdomains: includeSubdomains,
48
+ followRedirects: followRedirects
49
+ }
50
+ };
51
+ // Send the notification
52
+ (0, utils_1.sendNotification)(notification, 'crawler.CrawlerSearchRequestNotify');
53
+ }
54
+ exports.CrawlerSearchRequestNotify = CrawlerSearchRequestNotify;
55
+ /**
56
+ * Sends a response to a crawler search request
57
+ *
58
+ * @param content - The response content (string or any object)
59
+ * @param isError - Whether this is an error response (default: false)
60
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
61
+ * @param data - Optional response data containing pages, totalPages, and crawlTime
62
+ *
63
+ * Requirements: 5.2 - WHEN I call `codebolt.notify.crawler.CrawlerSearchResponseNotify()` THEN the system SHALL send a CrawlerSearchResponseNotification via WebSocket
64
+ */
65
+ function CrawlerSearchResponseNotify(content, isError = false, toolUseId, data) {
66
+ // Validate content is provided
67
+ if (content === null || content === undefined) {
68
+ console.error('[NotificationFunctions] Content is required for crawler.CrawlerSearchResponseNotify');
69
+ return;
70
+ }
71
+ // Create the notification
72
+ const notification = {
73
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
74
+ type: "crawlernotify",
75
+ action: "crawlerSearchResult",
76
+ content: content,
77
+ isError: isError,
78
+ data: data
79
+ };
80
+ // Send the notification
81
+ (0, utils_1.sendNotification)(notification, 'crawler.CrawlerSearchResponseNotify');
82
+ }
83
+ exports.CrawlerSearchResponseNotify = CrawlerSearchResponseNotify;
84
+ /**
85
+ * Sends a request to start a crawler
86
+ *
87
+ * @param startUrl - The URL to start crawling from
88
+ * @param options - Optional crawler configuration options
89
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
90
+ *
91
+ * Requirements: 5.3 - WHEN I call `codebolt.notify.crawler.CrawlerStartRequestNotify()` THEN the system SHALL send a CrawlerStartRequestNotification via WebSocket
92
+ */
93
+ function CrawlerStartRequestNotify(startUrl, options, toolUseId) {
94
+ // Validate required fields
95
+ if (!(0, utils_1.validateRequiredFields)({ startUrl }, ['startUrl'], 'crawler.CrawlerStartRequestNotify')) {
96
+ return;
97
+ }
98
+ // Validate URL format
99
+ try {
100
+ new URL(startUrl);
101
+ }
102
+ catch (error) {
103
+ console.error('[NotificationFunctions] Invalid URL format for crawler.CrawlerStartRequestNotify:', startUrl);
104
+ return;
105
+ }
106
+ // Create the notification
107
+ const notification = {
108
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
109
+ type: "crawlernotify",
110
+ action: "crawlerStartRequest",
111
+ data: {
112
+ startUrl: startUrl,
113
+ options: options
114
+ }
115
+ };
116
+ // Send the notification
117
+ (0, utils_1.sendNotification)(notification, 'crawler.CrawlerStartRequestNotify');
118
+ }
119
+ exports.CrawlerStartRequestNotify = CrawlerStartRequestNotify;
120
+ /**
121
+ * Sends a response to a crawler start request
122
+ *
123
+ * @param content - The response content (string or any object)
124
+ * @param isError - Whether this is an error response (default: false)
125
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
126
+ * @param data - Optional response data containing sessionId and status
127
+ *
128
+ * Requirements: 5.4 - WHEN I call `codebolt.notify.crawler.CrawlerStartResponseNotify()` THEN the system SHALL send a CrawlerStartResponseNotification via WebSocket
129
+ */
130
+ function CrawlerStartResponseNotify(content, isError = false, toolUseId, data) {
131
+ // Validate content is provided
132
+ if (content === null || content === undefined) {
133
+ console.error('[NotificationFunctions] Content is required for crawler.CrawlerStartResponseNotify');
134
+ return;
135
+ }
136
+ // Create the notification
137
+ const notification = {
138
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
139
+ type: "crawlernotify",
140
+ action: "crawlerStartResult",
141
+ content: content,
142
+ isError: isError,
143
+ data: data
144
+ };
145
+ // Send the notification
146
+ (0, utils_1.sendNotification)(notification, 'crawler.CrawlerStartResponseNotify');
147
+ }
148
+ exports.CrawlerStartResponseNotify = CrawlerStartResponseNotify;
149
+ /**
150
+ * Crawler notification functions object
151
+ */
152
+ exports.crawlerNotifications = {
153
+ CrawlerSearchRequestNotify,
154
+ CrawlerSearchResponseNotify,
155
+ CrawlerStartRequestNotify,
156
+ CrawlerStartResponseNotify
157
+ };
158
+ // Default export
159
+ exports.default = exports.crawlerNotifications;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Database Memory Notification Functions
3
+ *
4
+ * This module provides functions for sending database memory-related notifications,
5
+ * including knowledge storage and retrieval operations.
6
+ */
7
+ import { DbmemoryNotifications } from '../types/notificationFunctions/dbmemory';
8
+ /**
9
+ * Sends a request to add knowledge to memory
10
+ *
11
+ * @param key - The memory key
12
+ * @param value - The memory value
13
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
14
+ *
15
+ * Requirements: 6.1 - WHEN I call `codebolt.notify.dbmemory.AddMemoryRequestNotify()` THEN the system SHALL send an AddMemoryRequestNotification via WebSocket
16
+ */
17
+ export declare function AddMemoryRequestNotify(key: string, value: any, toolUseId?: string): void;
18
+ /**
19
+ * Sends a result response for an add memory operation
20
+ *
21
+ * @param content - The response content (string or any object)
22
+ * @param isError - Whether this is an error response (default: false)
23
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
24
+ *
25
+ * Requirements: 6.2 - WHEN I call `codebolt.notify.dbmemory.AddMemoryResultNotify()` THEN the system SHALL send an AddMemoryResultNotification via WebSocket
26
+ */
27
+ export declare function AddMemoryResultNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
28
+ /**
29
+ * Sends a request to get knowledge from memory
30
+ *
31
+ * @param key - The memory key to retrieve
32
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
33
+ *
34
+ * Requirements: 6.3 - WHEN I call `codebolt.notify.dbmemory.GetMemoryRequestNotify()` THEN the system SHALL send a GetMemoryRequestNotification via WebSocket
35
+ */
36
+ export declare function GetMemoryRequestNotify(key: string, toolUseId?: string): void;
37
+ /**
38
+ * Sends a result response for a get memory operation
39
+ *
40
+ * @param content - The response content (string or any object)
41
+ * @param isError - Whether this is an error response (default: false)
42
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
43
+ *
44
+ * Requirements: 6.4 - WHEN I call `codebolt.notify.dbmemory.GetMemoryResultNotify()` THEN the system SHALL send a GetMemoryResultNotification via WebSocket
45
+ */
46
+ export declare function GetMemoryResultNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
47
+ /**
48
+ * Database memory notification functions object
49
+ */
50
+ export declare const dbmemoryNotifications: DbmemoryNotifications;