@codebolt/codeboltjs 1.1.95 → 1.1.97
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/{src/modules → bkp}/toolBox.bkp.ts +0 -3
- package/modules/agent.js +1 -1
- package/modules/agentlib/agent.d.ts +63 -0
- package/modules/agentlib/agent.js +57 -7
- package/modules/agentlib/taskInstruction.d.ts +37 -0
- package/modules/agentlib/taskInstruction.js +20 -0
- package/modules/agentlib/usermessage.d.ts +68 -0
- package/modules/agentlib/usermessage.js +43 -0
- package/modules/chat.js +0 -6
- package/modules/codeparsers.js +0 -2
- package/modules/codeutils.js +0 -1
- package/modules/history.d.ts +22 -0
- package/modules/history.js +22 -0
- package/modules/rag.js +0 -1
- package/modules/search.js +0 -3
- package/modules/terminal.js +0 -1
- package/modules/toolBox.d.ts +202 -2
- package/modules/toolBox.js +53 -35
- package/modules/tools.d.ts +58 -0
- package/modules/tools.js +58 -0
- package/modules/websocket.js +0 -3
- package/package.json +1 -1
- package/src/modules/agent.ts +1 -1
- package/src/modules/agentlib/agent.ts +84 -9
- package/src/modules/agentlib/taskInstruction.ts +43 -4
- package/src/modules/agentlib/usermessage.ts +82 -8
- package/src/modules/chat.ts +0 -6
- package/src/modules/codeparsers.ts +0 -2
- package/src/modules/codeutils.ts +0 -1
- package/src/modules/history.ts +23 -2
- package/src/modules/rag.ts +0 -1
- package/src/modules/search.ts +0 -3
- package/src/modules/terminal.ts +0 -1
- package/src/modules/toolBox.ts +218 -40
- package/src/modules/tools.ts +67 -0
- package/src/modules/websocket.ts +0 -3
- package/modules/mcp.d.ts +0 -9
- package/modules/mcp.js +0 -148
- package/modules/toolBox.bkp.d.ts +0 -262
- package/modules/toolBox.bkp.js +0 -721
- package/src/modules/agentlib/package-lock.json +0 -282
- package/src/modules/agentlib/package.json +0 -6
package/src/modules/chat.ts
CHANGED
|
@@ -77,7 +77,6 @@ const cbchat = {
|
|
|
77
77
|
const response = JSON.parse(data);
|
|
78
78
|
if (response.type === "messageResponse") {
|
|
79
79
|
eventEmitter.emit("userMessage", response, (message: string) => {
|
|
80
|
-
console.log("Callback function invoked with message:", message);
|
|
81
80
|
cbws.getWebsocket.send(JSON.stringify({
|
|
82
81
|
"type": "processStoped",
|
|
83
82
|
"message": message
|
|
@@ -98,7 +97,6 @@ const cbchat = {
|
|
|
98
97
|
* @param {string} message - The message to be sent.
|
|
99
98
|
*/
|
|
100
99
|
sendMessage: (message: string, payload: any) => {
|
|
101
|
-
console.log(message);
|
|
102
100
|
cbws.getWebsocket.send(JSON.stringify({
|
|
103
101
|
"type": "sendMessage",
|
|
104
102
|
"message": message,
|
|
@@ -136,7 +134,6 @@ const cbchat = {
|
|
|
136
134
|
// Register event listener for WebSocket messages
|
|
137
135
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
138
136
|
const message = JSON.parse(data);
|
|
139
|
-
console.log("Received message:", message);
|
|
140
137
|
if (message.type === 'stopProcessClicked')
|
|
141
138
|
|
|
142
139
|
// Emit a custom event based on the message type
|
|
@@ -148,7 +145,6 @@ const cbchat = {
|
|
|
148
145
|
event: eventEmitter,
|
|
149
146
|
stopProcess: () => {
|
|
150
147
|
// Implement the logic to stop the process here
|
|
151
|
-
console.log("Stopping process...");
|
|
152
148
|
// For example, you might want to send a specific message to the server to stop the process
|
|
153
149
|
cbws.getWebsocket.send(JSON.stringify({
|
|
154
150
|
"type": "processStoped"
|
|
@@ -162,7 +158,6 @@ const cbchat = {
|
|
|
162
158
|
*/
|
|
163
159
|
stopProcess: () => {
|
|
164
160
|
// Implement the logic to stop the process here
|
|
165
|
-
console.log("Stopping process...");
|
|
166
161
|
// For example, you might want to send a specific message to the server to stop the process
|
|
167
162
|
cbws.getWebsocket.send(JSON.stringify({
|
|
168
163
|
"type": "processStoped"
|
|
@@ -174,7 +169,6 @@ const cbchat = {
|
|
|
174
169
|
*/
|
|
175
170
|
processFinished: () => {
|
|
176
171
|
// Implement the logic to stop the process here
|
|
177
|
-
console.log("Process Finished ...");
|
|
178
172
|
// For example, you might want to send a specific message to the server to stop the process
|
|
179
173
|
cbws.getWebsocket.send(JSON.stringify({
|
|
180
174
|
"type": "processFinished"
|
|
@@ -7,7 +7,6 @@ const cbcodeparsers = {
|
|
|
7
7
|
* @param file The file to parse for classes.
|
|
8
8
|
*/
|
|
9
9
|
getClassesInFile: (file: any) => {
|
|
10
|
-
console.log('Code parsers initialized');
|
|
11
10
|
},
|
|
12
11
|
/**
|
|
13
12
|
* Retrieves the functions in a given class within a file.
|
|
@@ -15,7 +14,6 @@ const cbcodeparsers = {
|
|
|
15
14
|
* @param className The name of the class to parse for functions.
|
|
16
15
|
*/
|
|
17
16
|
getFunctionsinClass: (file: any, className: any) => {
|
|
18
|
-
console.log('Code parsers initialized');
|
|
19
17
|
},
|
|
20
18
|
/**
|
|
21
19
|
* Generates an Abstract Syntax Tree (AST) for a given file.
|
package/src/modules/codeutils.ts
CHANGED
|
@@ -45,7 +45,6 @@ const cbcodeutils = {
|
|
|
45
45
|
}
|
|
46
46
|
} else if (path.extname(file.name) === '.js') {
|
|
47
47
|
const code = fs.readFileSync(path.join(directory, file.name), 'utf-8');
|
|
48
|
-
console.log(code);
|
|
49
48
|
let tree: any = parser.parse(code);
|
|
50
49
|
tree.rootNode.path = path.join(directory, file.name); // Set file path for t
|
|
51
50
|
trees.push(tree);
|
package/src/modules/history.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import cbws from './websocket';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing different types of log messages.
|
|
5
|
+
*/
|
|
3
6
|
export enum logType {
|
|
7
|
+
/** Informational messages */
|
|
4
8
|
info = "info",
|
|
9
|
+
/** Error messages */
|
|
5
10
|
error = "error",
|
|
11
|
+
/** Warning messages */
|
|
6
12
|
warning = "warning"
|
|
7
13
|
}
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Object with methods for summarizing chat history.
|
|
17
|
+
* Provides functionality to create summaries of conversation history.
|
|
18
|
+
*/
|
|
10
19
|
export const chatSummary = {
|
|
11
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Summarizes the entire chat history.
|
|
22
|
+
*
|
|
23
|
+
* @returns Promise with an array of message objects containing role and content
|
|
24
|
+
*/
|
|
12
25
|
summarizeAll: (): Promise<{
|
|
13
26
|
role: string;
|
|
14
27
|
content: string;
|
|
@@ -29,6 +42,14 @@ export const chatSummary = {
|
|
|
29
42
|
|
|
30
43
|
|
|
31
44
|
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Summarizes a specific part of the chat history.
|
|
48
|
+
*
|
|
49
|
+
* @param messages - Array of message objects to summarize
|
|
50
|
+
* @param depth - How far back in history to consider
|
|
51
|
+
* @returns Promise with an array of summarized message objects
|
|
52
|
+
*/
|
|
32
53
|
summarize: (messages: {
|
|
33
54
|
role: string;
|
|
34
55
|
content: string;
|
package/src/modules/rag.ts
CHANGED
package/src/modules/search.ts
CHANGED
|
@@ -7,7 +7,6 @@ const cbsearch = {
|
|
|
7
7
|
* @param {string} [engine="bing"] - The search engine to use for initializing the module.
|
|
8
8
|
*/
|
|
9
9
|
init: (engine: string = "bing"): void => {
|
|
10
|
-
console.log("Initializing Search Module with engine: " + engine);
|
|
11
10
|
},
|
|
12
11
|
/**
|
|
13
12
|
* Performs a search operation for the given query.
|
|
@@ -15,7 +14,6 @@ const cbsearch = {
|
|
|
15
14
|
* @returns {Promise<string>} A promise that resolves with the search results.
|
|
16
15
|
*/
|
|
17
16
|
search: async (query: string): Promise<string> => {
|
|
18
|
-
console.log("Searching for " + query);
|
|
19
17
|
return new Promise((resolve, reject) => {
|
|
20
18
|
resolve("Search Results for " + query);
|
|
21
19
|
});
|
|
@@ -26,7 +24,6 @@ const cbsearch = {
|
|
|
26
24
|
* @returns {Promise<string>} A promise that resolves with the first link of the search results.
|
|
27
25
|
*/
|
|
28
26
|
get_first_link: async (query: string): Promise<string> => {
|
|
29
|
-
console.log("Getting first link for " + query);
|
|
30
27
|
return new Promise((resolve, reject) => {
|
|
31
28
|
resolve("First Link for " + query);
|
|
32
29
|
});
|
package/src/modules/terminal.ts
CHANGED
|
@@ -97,7 +97,6 @@ const cbterminal = {
|
|
|
97
97
|
// Register event listener for WebSocket messages
|
|
98
98
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
99
99
|
const response = JSON.parse(data);
|
|
100
|
-
console.log("Received message:", response);
|
|
101
100
|
if (response.type === "commandOutput" || response.type === "commandError" || response.type === "commandFinish") {
|
|
102
101
|
this.eventEmitter.emit(response.type, response);
|
|
103
102
|
}
|