@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.
Files changed (129) hide show
  1. package/Readme.md +138 -4
  2. package/dist/agentlib/agent.js +3 -7
  3. package/dist/agentlib/followupquestionbuilder.d.ts +75 -0
  4. package/dist/agentlib/followupquestionbuilder.js +193 -0
  5. package/dist/agentlib/llmoutputhandler.d.ts +102 -0
  6. package/dist/agentlib/llmoutputhandler.js +451 -0
  7. package/dist/agentlib/promptbuilder.d.ts +171 -17
  8. package/dist/agentlib/promptbuilder.js +367 -49
  9. package/dist/agentlib/systemprompt.js +3 -3
  10. package/dist/agentlib/usermessage.d.ts +1 -1
  11. package/dist/agentlib/usermessage.js +5 -1
  12. package/dist/core/Codebolt.d.ts +342 -0
  13. package/dist/core/Codebolt.js +201 -0
  14. package/dist/core/websocket.js +2 -1
  15. package/dist/index.d.ts +4 -300
  16. package/dist/index.js +11 -137
  17. package/dist/modules/llm.d.ts +23 -3
  18. package/dist/modules/llm.js +20 -3
  19. package/dist/modules/project.d.ts +3 -3
  20. package/dist/modules/project.js +1 -1
  21. package/dist/modules/state.d.ts +5 -3
  22. package/dist/modules/state.js +2 -0
  23. package/dist/modules/task.d.ts +126 -11
  24. package/dist/modules/task.js +262 -20
  25. package/dist/notificationfunctions/agent.d.ts +48 -0
  26. package/dist/notificationfunctions/agent.js +115 -0
  27. package/dist/notificationfunctions/browser.d.ts +60 -0
  28. package/dist/notificationfunctions/browser.js +145 -0
  29. package/dist/notificationfunctions/chat.d.ts +53 -0
  30. package/dist/notificationfunctions/chat.js +125 -0
  31. package/dist/notificationfunctions/codeutils.d.ts +60 -0
  32. package/dist/notificationfunctions/codeutils.js +145 -0
  33. package/dist/notificationfunctions/crawler.d.ts +59 -0
  34. package/dist/notificationfunctions/crawler.js +159 -0
  35. package/dist/notificationfunctions/dbmemory.d.ts +50 -0
  36. package/dist/notificationfunctions/dbmemory.js +132 -0
  37. package/dist/notificationfunctions/fs.d.ts +125 -0
  38. package/dist/notificationfunctions/fs.js +472 -0
  39. package/dist/notificationfunctions/git.d.ts +174 -0
  40. package/dist/notificationfunctions/git.js +521 -0
  41. package/dist/notificationfunctions/history.d.ts +38 -0
  42. package/dist/notificationfunctions/history.js +97 -0
  43. package/dist/notificationfunctions/index.d.ts +79 -0
  44. package/dist/notificationfunctions/index.js +102 -0
  45. package/dist/notificationfunctions/llm.d.ts +39 -0
  46. package/dist/notificationfunctions/llm.js +99 -0
  47. package/dist/notificationfunctions/mcp.d.ts +67 -0
  48. package/dist/notificationfunctions/mcp.js +192 -0
  49. package/dist/notificationfunctions/search.d.ts +50 -0
  50. package/dist/notificationfunctions/search.js +146 -0
  51. package/dist/notificationfunctions/system.d.ts +25 -0
  52. package/dist/notificationfunctions/system.js +59 -0
  53. package/dist/notificationfunctions/terminal.d.ts +26 -0
  54. package/dist/notificationfunctions/terminal.js +64 -0
  55. package/dist/notificationfunctions/todo.d.ts +63 -0
  56. package/dist/notificationfunctions/todo.js +164 -0
  57. package/dist/notificationfunctions/utils.d.ts +81 -0
  58. package/dist/notificationfunctions/utils.js +177 -0
  59. package/dist/types/InternalTypes.d.ts +1 -0
  60. package/dist/types/commonTypes.d.ts +26 -3
  61. package/dist/types/index.d.ts +15 -0
  62. package/dist/types/index.js +15 -0
  63. package/dist/types/libFunctionTypes.d.ts +110 -4
  64. package/dist/types/notificationFunctions/agent.d.ts +8 -0
  65. package/dist/types/notificationFunctions/agent.js +2 -0
  66. package/dist/types/notificationFunctions/browser.d.ts +10 -0
  67. package/dist/types/notificationFunctions/browser.js +2 -0
  68. package/dist/types/notificationFunctions/chat.d.ts +10 -0
  69. package/dist/types/notificationFunctions/chat.js +2 -0
  70. package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
  71. package/dist/types/notificationFunctions/codeutils.js +2 -0
  72. package/dist/types/notificationFunctions/crawler.d.ts +10 -0
  73. package/dist/types/notificationFunctions/crawler.js +2 -0
  74. package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
  75. package/dist/types/notificationFunctions/dbmemory.js +2 -0
  76. package/dist/types/notificationFunctions/fs.d.ts +27 -0
  77. package/dist/types/notificationFunctions/fs.js +2 -0
  78. package/dist/types/notificationFunctions/git.d.ts +29 -0
  79. package/dist/types/notificationFunctions/git.js +2 -0
  80. package/dist/types/notificationFunctions/history.d.ts +10 -0
  81. package/dist/types/notificationFunctions/history.js +2 -0
  82. package/dist/types/notificationFunctions/index.d.ts +0 -0
  83. package/dist/types/notificationFunctions/index.js +1 -0
  84. package/dist/types/notificationFunctions/llm.d.ts +10 -0
  85. package/dist/types/notificationFunctions/llm.js +2 -0
  86. package/dist/types/notificationFunctions/mcp.d.ts +16 -0
  87. package/dist/types/notificationFunctions/mcp.js +2 -0
  88. package/dist/types/notificationFunctions/search.d.ts +11 -0
  89. package/dist/types/notificationFunctions/search.js +2 -0
  90. package/dist/types/notificationFunctions/system.d.ts +7 -0
  91. package/dist/types/notificationFunctions/system.js +2 -0
  92. package/dist/types/notificationFunctions/terminal.d.ts +7 -0
  93. package/dist/types/notificationFunctions/terminal.js +2 -0
  94. package/dist/types/notificationFunctions/todo.d.ts +11 -0
  95. package/dist/types/notificationFunctions/todo.js +2 -0
  96. package/dist/types/notifications/agent.d.ts +31 -0
  97. package/dist/types/notifications/agent.js +3 -0
  98. package/dist/types/notifications/browser.d.ts +53 -0
  99. package/dist/types/notifications/browser.js +3 -0
  100. package/dist/types/notifications/chat.d.ts +37 -0
  101. package/dist/types/notifications/chat.js +3 -0
  102. package/dist/types/notifications/codeutils.d.ts +55 -0
  103. package/dist/types/notifications/codeutils.js +3 -0
  104. package/dist/types/notifications/crawler.d.ts +55 -0
  105. package/dist/types/notifications/crawler.js +3 -0
  106. package/dist/types/notifications/dbmemory.d.ts +31 -0
  107. package/dist/types/notifications/dbmemory.js +3 -0
  108. package/dist/types/notifications/fs.d.ts +180 -0
  109. package/dist/types/notifications/fs.js +3 -0
  110. package/dist/types/notifications/git.d.ts +205 -0
  111. package/dist/types/notifications/git.js +3 -0
  112. package/dist/types/notifications/history.d.ts +32 -0
  113. package/dist/types/notifications/history.js +3 -0
  114. package/dist/types/notifications/llm.d.ts +45 -0
  115. package/dist/types/notifications/llm.js +2 -0
  116. package/dist/types/notifications/mcp.d.ts +63 -0
  117. package/dist/types/notifications/mcp.js +3 -0
  118. package/dist/types/notifications/search.d.ts +47 -0
  119. package/dist/types/notifications/search.js +3 -0
  120. package/dist/types/notifications/system.d.ts +20 -0
  121. package/dist/types/notifications/system.js +2 -0
  122. package/dist/types/notifications/terminal.d.ts +17 -0
  123. package/dist/types/notifications/terminal.js +2 -0
  124. package/dist/types/notifications/todo.d.ts +60 -0
  125. package/dist/types/notifications/todo.js +3 -0
  126. package/dist/types/socketMessageTypes.d.ts +3 -0
  127. package/dist/utils.d.ts +3 -0
  128. package/dist/utils.js +7 -1
  129. package/package.json +1 -1
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Browser Notification Functions
3
+ *
4
+ * This module provides functions for sending browser-related notifications,
5
+ * including web fetch and web search operations.
6
+ */
7
+ import { WebFetchResponseNotification, WebSearchResponseNotification } from '../types/notifications/browser';
8
+ import { BrowserNotifications } from '../types/notificationFunctions/browser';
9
+ /**
10
+ * Sends a web fetch request notification
11
+ *
12
+ * @param url - The URL to fetch
13
+ * @param method - Optional HTTP method
14
+ * @param headers - Optional headers object
15
+ * @param body - Optional request body
16
+ * @param timeout - Optional timeout in milliseconds
17
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
18
+ *
19
+ * Requirements: 2.1 - WHEN I call `codebolt.notify.browser.WebFetchRequestNotify()` THEN the system SHALL send a WebFetchRequestNotification via WebSocket
20
+ */
21
+ export declare function WebFetchRequestNotify(url: string, method?: string, headers?: Record<string, string>, body?: any, timeout?: number, toolUseId?: string): void;
22
+ /**
23
+ * Sends a web fetch response notification
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 including status, statusText, headers, and url
29
+ *
30
+ * Requirements: 2.2 - WHEN I call `codebolt.notify.browser.WebFetchResponseNotify()` THEN the system SHALL send a WebFetchResponseNotification via WebSocket
31
+ */
32
+ export declare function WebFetchResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: WebFetchResponseNotification['data']): void;
33
+ /**
34
+ * Sends a web search request notification
35
+ *
36
+ * @param query - The search query string
37
+ * @param maxResults - Optional maximum number of results
38
+ * @param searchEngine - Optional search engine to use
39
+ * @param filters - Optional search filters
40
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
41
+ *
42
+ * Requirements: 2.3 - WHEN I call `codebolt.notify.browser.WebSearchRequestNotify()` THEN the system SHALL send a WebSearchRequestNotification via WebSocket
43
+ */
44
+ export declare function WebSearchRequestNotify(query: string, maxResults?: number, searchEngine?: string, filters?: any, toolUseId?: string): void;
45
+ /**
46
+ * Sends a web search response notification
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 including results, totalResults, and searchTime
52
+ *
53
+ * Requirements: 2.4 - WHEN I call `codebolt.notify.browser.WebSearchResponseNotify()` THEN the system SHALL send a WebSearchResponseNotification via WebSocket
54
+ */
55
+ export declare function WebSearchResponseNotify(content: string | any, isError?: boolean, toolUseId?: string, data?: WebSearchResponseNotification['data']): void;
56
+ /**
57
+ * Browser notification functions object
58
+ */
59
+ export declare const browserNotifications: BrowserNotifications;
60
+ export default browserNotifications;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ /**
3
+ * Browser Notification Functions
4
+ *
5
+ * This module provides functions for sending browser-related notifications,
6
+ * including web fetch and web search operations.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.browserNotifications = exports.WebSearchResponseNotify = exports.WebSearchRequestNotify = exports.WebFetchResponseNotify = exports.WebFetchRequestNotify = void 0;
10
+ const utils_1 = require("./utils");
11
+ /**
12
+ * Sends a web fetch request notification
13
+ *
14
+ * @param url - The URL to fetch
15
+ * @param method - Optional HTTP method
16
+ * @param headers - Optional headers object
17
+ * @param body - Optional request body
18
+ * @param timeout - Optional timeout in milliseconds
19
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
20
+ *
21
+ * Requirements: 2.1 - WHEN I call `codebolt.notify.browser.WebFetchRequestNotify()` THEN the system SHALL send a WebFetchRequestNotification via WebSocket
22
+ */
23
+ function WebFetchRequestNotify(url, method, headers, body, timeout, toolUseId) {
24
+ // Validate required fields
25
+ if (!(0, utils_1.validateRequiredFields)({ url }, ['url'], 'browser.WebFetchRequestNotify')) {
26
+ return;
27
+ }
28
+ // Create the notification
29
+ const notification = {
30
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
31
+ type: "browsernotify",
32
+ action: "webFetchRequest",
33
+ data: {
34
+ url: url,
35
+ method: method,
36
+ headers: headers,
37
+ body: body,
38
+ timeout: timeout
39
+ }
40
+ };
41
+ // Send the notification
42
+ (0, utils_1.sendNotification)(notification, 'browser.WebFetchRequestNotify');
43
+ }
44
+ exports.WebFetchRequestNotify = WebFetchRequestNotify;
45
+ /**
46
+ * Sends a web fetch response notification
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 including status, statusText, headers, and url
52
+ *
53
+ * Requirements: 2.2 - WHEN I call `codebolt.notify.browser.WebFetchResponseNotify()` THEN the system SHALL send a WebFetchResponseNotification via WebSocket
54
+ */
55
+ function WebFetchResponseNotify(content, isError = false, toolUseId, data) {
56
+ // Validate content is provided
57
+ if (content === null || content === undefined) {
58
+ console.error('[NotificationFunctions] Content is required for browser.WebFetchResponseNotify');
59
+ return;
60
+ }
61
+ // Create the notification
62
+ const notification = {
63
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
64
+ type: "browsernotify",
65
+ action: "webFetchResult",
66
+ content: content,
67
+ isError: isError,
68
+ data: data
69
+ };
70
+ // Send the notification
71
+ (0, utils_1.sendNotification)(notification, 'browser.WebFetchResponseNotify');
72
+ }
73
+ exports.WebFetchResponseNotify = WebFetchResponseNotify;
74
+ /**
75
+ * Sends a web search request notification
76
+ *
77
+ * @param query - The search query string
78
+ * @param maxResults - Optional maximum number of results
79
+ * @param searchEngine - Optional search engine to use
80
+ * @param filters - Optional search filters
81
+ * @param toolUseId - Optional custom toolUseId, will be generated if not provided
82
+ *
83
+ * Requirements: 2.3 - WHEN I call `codebolt.notify.browser.WebSearchRequestNotify()` THEN the system SHALL send a WebSearchRequestNotification via WebSocket
84
+ */
85
+ function WebSearchRequestNotify(query, maxResults, searchEngine, filters, toolUseId) {
86
+ // Validate required fields
87
+ if (!(0, utils_1.validateRequiredFields)({ query }, ['query'], 'browser.WebSearchRequestNotify')) {
88
+ return;
89
+ }
90
+ // Create the notification
91
+ const notification = {
92
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
93
+ type: "browsernotify",
94
+ action: "webSearchRequest",
95
+ data: {
96
+ query: query,
97
+ maxResults: maxResults,
98
+ searchEngine: searchEngine,
99
+ filters: filters
100
+ }
101
+ };
102
+ // Send the notification
103
+ (0, utils_1.sendNotification)(notification, 'browser.WebSearchRequestNotify');
104
+ }
105
+ exports.WebSearchRequestNotify = WebSearchRequestNotify;
106
+ /**
107
+ * Sends a web search response notification
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 including results, totalResults, and searchTime
113
+ *
114
+ * Requirements: 2.4 - WHEN I call `codebolt.notify.browser.WebSearchResponseNotify()` THEN the system SHALL send a WebSearchResponseNotification via WebSocket
115
+ */
116
+ function WebSearchResponseNotify(content, isError = false, toolUseId, data) {
117
+ // Validate content is provided
118
+ if (content === null || content === undefined) {
119
+ console.error('[NotificationFunctions] Content is required for browser.WebSearchResponseNotify');
120
+ return;
121
+ }
122
+ // Create the notification
123
+ const notification = {
124
+ toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
125
+ type: "browsernotify",
126
+ action: "webSearchResult",
127
+ content: content,
128
+ isError: isError,
129
+ data: data
130
+ };
131
+ // Send the notification
132
+ (0, utils_1.sendNotification)(notification, 'browser.WebSearchResponseNotify');
133
+ }
134
+ exports.WebSearchResponseNotify = WebSearchResponseNotify;
135
+ /**
136
+ * Browser notification functions object
137
+ */
138
+ exports.browserNotifications = {
139
+ WebFetchRequestNotify,
140
+ WebFetchResponseNotify,
141
+ WebSearchRequestNotify,
142
+ WebSearchResponseNotify
143
+ };
144
+ // Default export
145
+ exports.default = exports.browserNotifications;
@@ -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;