@codebolt/codeboltjs 2.0.12 → 2.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +138 -4
- package/dist/agentlib/agent.js +3 -7
- package/dist/agentlib/followupquestionbuilder.d.ts +75 -0
- package/dist/agentlib/followupquestionbuilder.js +193 -0
- package/dist/agentlib/llmoutputhandler.d.ts +102 -0
- package/dist/agentlib/llmoutputhandler.js +451 -0
- package/dist/agentlib/promptbuilder.d.ts +171 -17
- package/dist/agentlib/promptbuilder.js +367 -49
- package/dist/agentlib/systemprompt.js +3 -3
- package/dist/agentlib/usermessage.d.ts +1 -1
- package/dist/agentlib/usermessage.js +5 -1
- package/dist/core/Codebolt.d.ts +342 -0
- package/dist/core/Codebolt.js +201 -0
- package/dist/core/websocket.js +2 -1
- package/dist/index.d.ts +4 -300
- package/dist/index.js +11 -137
- package/dist/modules/llm.d.ts +23 -3
- package/dist/modules/llm.js +20 -3
- package/dist/modules/project.d.ts +3 -3
- package/dist/modules/project.js +1 -1
- package/dist/modules/state.d.ts +5 -3
- package/dist/modules/state.js +2 -0
- package/dist/modules/task.d.ts +126 -11
- package/dist/modules/task.js +262 -20
- package/dist/notificationfunctions/agent.d.ts +48 -0
- package/dist/notificationfunctions/agent.js +115 -0
- package/dist/notificationfunctions/browser.d.ts +60 -0
- package/dist/notificationfunctions/browser.js +145 -0
- package/dist/notificationfunctions/chat.d.ts +53 -0
- package/dist/notificationfunctions/chat.js +125 -0
- package/dist/notificationfunctions/codeutils.d.ts +60 -0
- package/dist/notificationfunctions/codeutils.js +145 -0
- package/dist/notificationfunctions/crawler.d.ts +59 -0
- package/dist/notificationfunctions/crawler.js +159 -0
- package/dist/notificationfunctions/dbmemory.d.ts +50 -0
- package/dist/notificationfunctions/dbmemory.js +132 -0
- package/dist/notificationfunctions/fs.d.ts +125 -0
- package/dist/notificationfunctions/fs.js +472 -0
- package/dist/notificationfunctions/git.d.ts +174 -0
- package/dist/notificationfunctions/git.js +521 -0
- package/dist/notificationfunctions/history.d.ts +38 -0
- package/dist/notificationfunctions/history.js +97 -0
- package/dist/notificationfunctions/index.d.ts +79 -0
- package/dist/notificationfunctions/index.js +102 -0
- package/dist/notificationfunctions/llm.d.ts +39 -0
- package/dist/notificationfunctions/llm.js +99 -0
- package/dist/notificationfunctions/mcp.d.ts +67 -0
- package/dist/notificationfunctions/mcp.js +192 -0
- package/dist/notificationfunctions/search.d.ts +50 -0
- package/dist/notificationfunctions/search.js +146 -0
- package/dist/notificationfunctions/system.d.ts +25 -0
- package/dist/notificationfunctions/system.js +59 -0
- package/dist/notificationfunctions/terminal.d.ts +26 -0
- package/dist/notificationfunctions/terminal.js +64 -0
- package/dist/notificationfunctions/todo.d.ts +63 -0
- package/dist/notificationfunctions/todo.js +164 -0
- package/dist/notificationfunctions/utils.d.ts +81 -0
- package/dist/notificationfunctions/utils.js +177 -0
- package/dist/types/InternalTypes.d.ts +1 -0
- package/dist/types/commonTypes.d.ts +26 -3
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.js +15 -0
- package/dist/types/libFunctionTypes.d.ts +110 -4
- package/dist/types/notificationFunctions/agent.d.ts +8 -0
- package/dist/types/notificationFunctions/agent.js +2 -0
- package/dist/types/notificationFunctions/browser.d.ts +10 -0
- package/dist/types/notificationFunctions/browser.js +2 -0
- package/dist/types/notificationFunctions/chat.d.ts +10 -0
- package/dist/types/notificationFunctions/chat.js +2 -0
- package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
- package/dist/types/notificationFunctions/codeutils.js +2 -0
- package/dist/types/notificationFunctions/crawler.d.ts +10 -0
- package/dist/types/notificationFunctions/crawler.js +2 -0
- package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
- package/dist/types/notificationFunctions/dbmemory.js +2 -0
- package/dist/types/notificationFunctions/fs.d.ts +27 -0
- package/dist/types/notificationFunctions/fs.js +2 -0
- package/dist/types/notificationFunctions/git.d.ts +29 -0
- package/dist/types/notificationFunctions/git.js +2 -0
- package/dist/types/notificationFunctions/history.d.ts +10 -0
- package/dist/types/notificationFunctions/history.js +2 -0
- package/dist/types/notificationFunctions/index.d.ts +0 -0
- package/dist/types/notificationFunctions/index.js +1 -0
- package/dist/types/notificationFunctions/llm.d.ts +10 -0
- package/dist/types/notificationFunctions/llm.js +2 -0
- package/dist/types/notificationFunctions/mcp.d.ts +16 -0
- package/dist/types/notificationFunctions/mcp.js +2 -0
- package/dist/types/notificationFunctions/search.d.ts +11 -0
- package/dist/types/notificationFunctions/search.js +2 -0
- package/dist/types/notificationFunctions/system.d.ts +7 -0
- package/dist/types/notificationFunctions/system.js +2 -0
- package/dist/types/notificationFunctions/terminal.d.ts +7 -0
- package/dist/types/notificationFunctions/terminal.js +2 -0
- package/dist/types/notificationFunctions/todo.d.ts +11 -0
- package/dist/types/notificationFunctions/todo.js +2 -0
- package/dist/types/notifications/agent.d.ts +31 -0
- package/dist/types/notifications/agent.js +3 -0
- package/dist/types/notifications/browser.d.ts +53 -0
- package/dist/types/notifications/browser.js +3 -0
- package/dist/types/notifications/chat.d.ts +37 -0
- package/dist/types/notifications/chat.js +3 -0
- package/dist/types/notifications/codeutils.d.ts +55 -0
- package/dist/types/notifications/codeutils.js +3 -0
- package/dist/types/notifications/crawler.d.ts +55 -0
- package/dist/types/notifications/crawler.js +3 -0
- package/dist/types/notifications/dbmemory.d.ts +31 -0
- package/dist/types/notifications/dbmemory.js +3 -0
- package/dist/types/notifications/fs.d.ts +180 -0
- package/dist/types/notifications/fs.js +3 -0
- package/dist/types/notifications/git.d.ts +205 -0
- package/dist/types/notifications/git.js +3 -0
- package/dist/types/notifications/history.d.ts +32 -0
- package/dist/types/notifications/history.js +3 -0
- package/dist/types/notifications/llm.d.ts +45 -0
- package/dist/types/notifications/llm.js +2 -0
- package/dist/types/notifications/mcp.d.ts +63 -0
- package/dist/types/notifications/mcp.js +3 -0
- package/dist/types/notifications/search.d.ts +47 -0
- package/dist/types/notifications/search.js +3 -0
- package/dist/types/notifications/system.d.ts +20 -0
- package/dist/types/notifications/system.js +2 -0
- package/dist/types/notifications/terminal.d.ts +17 -0
- package/dist/types/notifications/terminal.js +2 -0
- package/dist/types/notifications/todo.d.ts +60 -0
- package/dist/types/notifications/todo.js +3 -0
- package/dist/types/socketMessageTypes.d.ts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,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;
|
|
@@ -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;
|