@codebolt/codeboltjs 1.1.96 → 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.
@@ -73,7 +73,6 @@ export const imageContent = async (
73
73
  }
74
74
  const { fileTypeFromBuffer } = await loadEsm('file-type');
75
75
  const mimeType = await fileTypeFromBuffer(rawData);
76
- console.log(mimeType);
77
76
 
78
77
  const base64Data = rawData.toString("base64");
79
78
 
@@ -1074,7 +1073,6 @@ export class ToolBox extends FastMCPEventEmitter {
1074
1073
  ) {
1075
1074
  if (options.transportType === "stdio") {
1076
1075
  const transport = new StdioServerTransport();
1077
- // console.log("tools", this.#tools);
1078
1076
 
1079
1077
  const session = new FastMCPSession({
1080
1078
  name: this.#options.name,
@@ -1084,7 +1082,6 @@ export class ToolBox extends FastMCPEventEmitter {
1084
1082
  resourcesTemplates: this.#resourcesTemplates,
1085
1083
  prompts: this.#prompts,
1086
1084
  });
1087
- // console.log("session", session);
1088
1085
  await session.connect(transport);
1089
1086
 
1090
1087
  this.#sessions.push(session);
@@ -102,11 +102,8 @@ class Agent {
102
102
  else {
103
103
  let [serverName] = toolName.replace('--', ':').split(':');
104
104
  if (serverName == 'subagent') {
105
- console.log("calling agent with params", toolName, toolInput);
106
105
  const agentResponse = await agent_1.default.startAgent(toolName.replace("subagent--", ''), toolInput.task);
107
- console.log("got sub agent resonse result", agentResponse);
108
106
  const [didUserReject, result] = [false, "tool result is successful"];
109
- console.log("got sub agent resonse result", didUserReject, result);
110
107
  let toolResult = this.getToolResult(toolUseId, result);
111
108
  toolResults.push({
112
109
  role: "tool",
@@ -124,9 +121,7 @@ class Agent {
124
121
  }
125
122
  }
126
123
  else {
127
- console.log("calling tool with params", toolName, toolInput);
128
124
  const [didUserReject, result] = await this.executeTool(toolName, toolInput);
129
- console.log("tool result", result);
130
125
  // toolResults.push(this.getToolResult(toolUseId, result));
131
126
  let toolResult = this.getToolResult(toolUseId, result);
132
127
  toolResults.push({
@@ -242,7 +237,6 @@ class Agent {
242
237
  return completion;
243
238
  }
244
239
  catch (error) {
245
- console.log(error);
246
240
  return this.attemptApiRequest();
247
241
  }
248
242
  }
package/modules/chat.js CHANGED
@@ -79,7 +79,6 @@ const cbchat = {
79
79
  const response = JSON.parse(data);
80
80
  if (response.type === "messageResponse") {
81
81
  eventEmitter.emit("userMessage", response, (message) => {
82
- console.log("Callback function invoked with message:", message);
83
82
  websocket_1.default.getWebsocket.send(JSON.stringify({
84
83
  "type": "processStoped",
85
84
  "message": message
@@ -100,7 +99,6 @@ const cbchat = {
100
99
  * @param {string} message - The message to be sent.
101
100
  */
102
101
  sendMessage: (message, payload) => {
103
- console.log(message);
104
102
  websocket_1.default.getWebsocket.send(JSON.stringify({
105
103
  "type": "sendMessage",
106
104
  "message": message,
@@ -138,7 +136,6 @@ const cbchat = {
138
136
  // Register event listener for WebSocket messages
139
137
  websocket_1.default.getWebsocket.on('message', (data) => {
140
138
  const message = JSON.parse(data);
141
- console.log("Received message:", message);
142
139
  if (message.type === 'stopProcessClicked')
143
140
  // Emit a custom event based on the message type
144
141
  eventEmitter.emit("stopProcessClicked", message);
@@ -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
  websocket_1.default.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
  websocket_1.default.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
  websocket_1.default.getWebsocket.send(JSON.stringify({
180
174
  "type": "processFinished"
@@ -9,7 +9,6 @@ const cbcodeparsers = {
9
9
  * @param file The file to parse for classes.
10
10
  */
11
11
  getClassesInFile: (file) => {
12
- console.log('Code parsers initialized');
13
12
  },
14
13
  /**
15
14
  * Retrieves the functions in a given class within a file.
@@ -17,7 +16,6 @@ const cbcodeparsers = {
17
16
  * @param className The name of the class to parse for functions.
18
17
  */
19
18
  getFunctionsinClass: (file, className) => {
20
- console.log('Code parsers initialized');
21
19
  },
22
20
  /**
23
21
  * Generates an Abstract Syntax Tree (AST) for a given file.
@@ -68,7 +68,6 @@ const cbcodeutils = {
68
68
  }
69
69
  else if (path_1.default.extname(file.name) === '.js') {
70
70
  const code = fs.readFileSync(path_1.default.join(directory, file.name), 'utf-8');
71
- console.log(code);
72
71
  let tree = parser.parse(code);
73
72
  tree.rootNode.path = path_1.default.join(directory, file.name); // Set file path for t
74
73
  trees.push(tree);
package/modules/rag.js CHANGED
@@ -8,7 +8,6 @@ const cbrag = {
8
8
  * Initializes the CodeBolt File System Module.
9
9
  */
10
10
  init: () => {
11
- console.log("Initializing CodeBolt File System Module");
12
11
  },
13
12
  /**
14
13
  * Adds a file to the CodeBolt File System.
package/modules/search.js CHANGED
@@ -9,7 +9,6 @@ const cbsearch = {
9
9
  * @param {string} [engine="bing"] - The search engine to use for initializing the module.
10
10
  */
11
11
  init: (engine = "bing") => {
12
- console.log("Initializing Search Module with engine: " + engine);
13
12
  },
14
13
  /**
15
14
  * Performs a search operation for the given query.
@@ -17,7 +16,6 @@ const cbsearch = {
17
16
  * @returns {Promise<string>} A promise that resolves with the search results.
18
17
  */
19
18
  search: async (query) => {
20
- console.log("Searching for " + query);
21
19
  return new Promise((resolve, reject) => {
22
20
  resolve("Search Results for " + query);
23
21
  });
@@ -28,7 +26,6 @@ const cbsearch = {
28
26
  * @returns {Promise<string>} A promise that resolves with the first link of the search results.
29
27
  */
30
28
  get_first_link: async (query) => {
31
- console.log("Getting first link for " + query);
32
29
  return new Promise((resolve, reject) => {
33
30
  resolve("First Link for " + query);
34
31
  });
@@ -96,7 +96,6 @@ const cbterminal = {
96
96
  // Register event listener for WebSocket messages
97
97
  websocket_1.default.getWebsocket.on('message', (data) => {
98
98
  const response = JSON.parse(data);
99
- console.log("Received message:", response);
100
99
  if (response.type === "commandOutput" || response.type === "commandError" || response.type === "commandFinish") {
101
100
  this.eventEmitter.emit(response.type, response);
102
101
  }
@@ -55,11 +55,9 @@ class cbws {
55
55
  this.websocket = new ws_1.default(`ws://localhost:${process.env.SOCKET_PORT}/codebolt?id=${uniqueConnectionId}${agentIdParam}${parentIdParam}${process.env.Is_Dev ? '&dev=true' : ''}`);
56
56
  return new Promise((resolve, reject) => {
57
57
  this.websocket.on('error', (error) => {
58
- console.log('WebSocket error:', error);
59
58
  reject(error);
60
59
  });
61
60
  this.websocket.on('open', () => {
62
- console.log('WebSocket connected');
63
61
  // if (this.websocket) {
64
62
  // this.websocket.send(JSON.stringify({
65
63
  // "type": "sendMessage",
@@ -70,7 +68,6 @@ class cbws {
70
68
  });
71
69
  this.websocket.on('message', (data) => {
72
70
  // Handle incoming WebSocket messages here.
73
- // console.log('WebSocket message received:', data);
74
71
  });
75
72
  });
76
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.96",
3
+ "version": "1.1.97",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -169,12 +169,9 @@ class Agent {
169
169
 
170
170
 
171
171
  if (serverName == 'subagent') {
172
- console.log("calling agent with params", toolName, toolInput);
173
172
 
174
173
  const agentResponse = await codeboltAgent.startAgent(toolName.replace("subagent--", ''), toolInput.task);
175
- console.log("got sub agent resonse result", agentResponse);
176
174
  const [didUserReject, result] = [false, "tool result is successful"];
177
- console.log("got sub agent resonse result", didUserReject, result);
178
175
  let toolResult = this.getToolResult(toolUseId, result)
179
176
  toolResults.push({
180
177
  role: "tool",
@@ -194,9 +191,7 @@ class Agent {
194
191
 
195
192
  }
196
193
  else {
197
- console.log("calling tool with params", toolName, toolInput);
198
194
  const [didUserReject, result] = await this.executeTool(toolName, toolInput);
199
- console.log("tool result", result);
200
195
  // toolResults.push(this.getToolResult(toolUseId, result));
201
196
  let toolResult = this.getToolResult(toolUseId, result)
202
197
  toolResults.push({
@@ -328,7 +323,6 @@ class Agent {
328
323
  const { completion } = await llm.inference(createParams);
329
324
  return completion;
330
325
  } catch (error) {
331
- console.log(error);
332
326
  return this.attemptApiRequest();
333
327
  }
334
328
  }
@@ -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.
@@ -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);
@@ -6,7 +6,6 @@ const cbrag = {
6
6
  * Initializes the CodeBolt File System Module.
7
7
  */
8
8
  init: () => {
9
- console.log("Initializing CodeBolt File System Module");
10
9
  },
11
10
  /**
12
11
  * Adds a file to the CodeBolt File System.
@@ -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
  });
@@ -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
  }
@@ -59,12 +59,10 @@ class cbws {
59
59
 
60
60
  return new Promise((resolve, reject) => {
61
61
  this.websocket.on('error', (error: Error) => {
62
- console.log('WebSocket error:', error);
63
62
  reject(error);
64
63
  });
65
64
 
66
65
  this.websocket.on('open', () => {
67
- console.log('WebSocket connected');
68
66
  // if (this.websocket) {
69
67
  // this.websocket.send(JSON.stringify({
70
68
  // "type": "sendMessage",
@@ -76,7 +74,6 @@ class cbws {
76
74
 
77
75
  this.websocket.on('message', (data: WebSocket.Data) => {
78
76
  // Handle incoming WebSocket messages here.
79
- // console.log('WebSocket message received:', data);
80
77
  });
81
78
  });
82
79
  }
package/modules/mcp.d.ts DELETED
@@ -1,9 +0,0 @@
1
- declare const codeboltMCP: {
2
- executeTool: (toolName: string, params: any, mcpServer?: string) => Promise<any>;
3
- getMcpTools: (tools: string[]) => Promise<any>;
4
- getAllMCPTools: (mpcName: string) => Promise<any>;
5
- getMCPTool: (name: string) => Promise<any>;
6
- getEnabledMCPS: () => Promise<any>;
7
- configureMCPTool: (name: string, config: any) => Promise<any>;
8
- };
9
- export default codeboltMCP;
package/modules/mcp.js DELETED
@@ -1,148 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const websocket_1 = __importDefault(require("./websocket"));
7
- const codeboltMCP = {
8
- executeTool: (toolName, params, mcpServer) => {
9
- return new Promise((resolve, reject) => {
10
- websocket_1.default.getWebsocket.send(JSON.stringify({
11
- "type": "mcpEvent",
12
- "action": "executeTool",
13
- "toolName": toolName,
14
- "params": params
15
- }));
16
- websocket_1.default.getWebsocket.on('message', (data) => {
17
- try {
18
- const response = JSON.parse(data);
19
- if (response.type === "executeToolResponse") {
20
- resolve(response.data);
21
- }
22
- }
23
- catch (error) {
24
- reject(new Error("Failed to parse response"));
25
- }
26
- });
27
- websocket_1.default.getWebsocket.on('error', (error) => {
28
- reject(error);
29
- });
30
- });
31
- },
32
- getMcpTools: (tools) => {
33
- return new Promise((resolve, reject) => {
34
- websocket_1.default.getWebsocket.send(JSON.stringify({
35
- "type": "mcpEvent",
36
- "action": "getMcpTools",
37
- "tools": tools
38
- }));
39
- websocket_1.default.getWebsocket.on('message', (data) => {
40
- try {
41
- const response = JSON.parse(data);
42
- if (response.type === "getMcpToolsResponse") {
43
- resolve(response.data);
44
- }
45
- }
46
- catch (error) {
47
- reject(new Error("Failed to parse response"));
48
- }
49
- });
50
- websocket_1.default.getWebsocket.on('error', (error) => {
51
- reject(error);
52
- });
53
- });
54
- },
55
- getAllMCPTools: (mpcName) => {
56
- return new Promise((resolve, reject) => {
57
- websocket_1.default.getWebsocket.send(JSON.stringify({
58
- "type": "mcpEvent",
59
- "action": "getAllMCPTools",
60
- "mpcName": mpcName
61
- }));
62
- websocket_1.default.getWebsocket.on('message', (data) => {
63
- try {
64
- const response = JSON.parse(data);
65
- if (response.type === "getAllMCPToolsResponse") {
66
- resolve(response.data);
67
- }
68
- }
69
- catch (error) {
70
- reject(new Error("Failed to parse response"));
71
- }
72
- });
73
- websocket_1.default.getWebsocket.on('error', (error) => {
74
- reject(error);
75
- });
76
- });
77
- },
78
- getMCPTool: (name) => {
79
- return new Promise((resolve, reject) => {
80
- websocket_1.default.getWebsocket.send(JSON.stringify({
81
- "type": "mcpEvent",
82
- "action": "getMCPTool",
83
- "mcpName": name
84
- }));
85
- websocket_1.default.getWebsocket.on('message', (data) => {
86
- try {
87
- const response = JSON.parse(data);
88
- if (response.type === "getMCPToolResponse") {
89
- resolve(response.data);
90
- }
91
- }
92
- catch (error) {
93
- reject(new Error("Failed to parse response"));
94
- }
95
- });
96
- websocket_1.default.getWebsocket.on('error', (error) => {
97
- reject(error);
98
- });
99
- });
100
- },
101
- getEnabledMCPS: () => {
102
- return new Promise((resolve, reject) => {
103
- websocket_1.default.getWebsocket.send(JSON.stringify({
104
- "type": "mcpEvent",
105
- "action": "getEnabledMCPS"
106
- }));
107
- websocket_1.default.getWebsocket.on('message', (data) => {
108
- try {
109
- const response = JSON.parse(data);
110
- if (response.type === "getEnabledMCPSResponse") {
111
- resolve(response.data);
112
- }
113
- }
114
- catch (error) {
115
- reject(new Error("Failed to parse response"));
116
- }
117
- });
118
- websocket_1.default.getWebsocket.on('error', (error) => {
119
- reject(error);
120
- });
121
- });
122
- },
123
- configureMCPTool: (name, config) => {
124
- return new Promise((resolve, reject) => {
125
- websocket_1.default.getWebsocket.send(JSON.stringify({
126
- "type": "mcpEvent",
127
- "action": "configureMCPTool",
128
- "mcpName": name,
129
- "config": config
130
- }));
131
- websocket_1.default.getWebsocket.on('message', (data) => {
132
- try {
133
- const response = JSON.parse(data);
134
- if (response.type === "configureMCPToolResponse") {
135
- resolve(response.data);
136
- }
137
- }
138
- catch (error) {
139
- reject(new Error("Failed to parse response"));
140
- }
141
- });
142
- websocket_1.default.getWebsocket.on('error', (error) => {
143
- reject(error);
144
- });
145
- });
146
- },
147
- };
148
- exports.default = codeboltMCP;