@codebolt/codeboltjs 1.1.83 → 1.1.85
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/index.d.ts +1 -1
- package/modules/agent.d.ts +1 -1
- package/modules/agent.js +3 -2
- package/modules/websocket.js +2 -2
- package/package.json +1 -1
- package/src/modules/agent.ts +3 -2
- package/src/modules/websocket.ts +2 -2
package/index.d.ts
CHANGED
|
@@ -243,7 +243,7 @@ declare class Codebolt {
|
|
|
243
243
|
};
|
|
244
244
|
AGENT: {
|
|
245
245
|
getAgent: (task: string) => Promise<any>;
|
|
246
|
-
startAgent: (task: string) => Promise<any>;
|
|
246
|
+
startAgent: (agentId: string, task: string) => Promise<any>;
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
declare const _default: Codebolt;
|
package/modules/agent.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ declare const codeboltAgent: {
|
|
|
10
10
|
* @param {string} task - The task for which the agent should be started.
|
|
11
11
|
* @returns {Promise<void>} A promise that resolves when the agent has been successfully started.
|
|
12
12
|
*/
|
|
13
|
-
startAgent: (task: string) => Promise<any>;
|
|
13
|
+
startAgent: (agentId: string, task: string) => Promise<any>;
|
|
14
14
|
};
|
|
15
15
|
export default codeboltAgent;
|
package/modules/agent.js
CHANGED
|
@@ -30,16 +30,17 @@ const codeboltAgent = {
|
|
|
30
30
|
* @param {string} task - The task for which the agent should be started.
|
|
31
31
|
* @returns {Promise<void>} A promise that resolves when the agent has been successfully started.
|
|
32
32
|
*/
|
|
33
|
-
startAgent: (task) => {
|
|
33
|
+
startAgent: (agentId, task) => {
|
|
34
34
|
return new Promise((resolve, reject) => {
|
|
35
35
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
36
36
|
"type": "agentEvent",
|
|
37
37
|
"action": "startAgent",
|
|
38
|
+
"agentId": agentId,
|
|
38
39
|
"task": task
|
|
39
40
|
}));
|
|
40
41
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
41
42
|
const response = JSON.parse(data);
|
|
42
|
-
if (response.type === "
|
|
43
|
+
if (response.type === "taskCompletionResponse") {
|
|
43
44
|
resolve(response); // Resolve the Promise when the agent has been successfully started
|
|
44
45
|
}
|
|
45
46
|
});
|
package/modules/websocket.js
CHANGED
|
@@ -16,8 +16,8 @@ class cbws {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
const uniqueConnectionId = this.getUniqueConnectionId();
|
|
18
18
|
const initialMessage = this.getInitialMessage();
|
|
19
|
-
const agentIdParam = process.env.
|
|
20
|
-
const parentIdParam = process.env.
|
|
19
|
+
const agentIdParam = process.env.agentId ? `&agentId=${process.env.agentId}` : '';
|
|
20
|
+
const parentIdParam = process.env.parentId ? `&parentId=${process.env.parentId}` : '';
|
|
21
21
|
this.websocket = new ws_1.default(`ws://localhost:${process.env.SOCKET_PORT}/codebolt?id=${uniqueConnectionId}${agentIdParam}${parentIdParam}${process.env.Is_Dev ? '&dev=true' : ''}`);
|
|
22
22
|
this.initializeWebSocket(initialMessage).catch(error => {
|
|
23
23
|
console.error("WebSocket connection failed:", error);
|
package/package.json
CHANGED
package/src/modules/agent.ts
CHANGED
|
@@ -28,16 +28,17 @@ const codeboltAgent = {
|
|
|
28
28
|
* @param {string} task - The task for which the agent should be started.
|
|
29
29
|
* @returns {Promise<void>} A promise that resolves when the agent has been successfully started.
|
|
30
30
|
*/
|
|
31
|
-
startAgent: (task: string): Promise<any> => {
|
|
31
|
+
startAgent: (agentId: string, task: string): Promise<any> => {
|
|
32
32
|
return new Promise((resolve, reject) => {
|
|
33
33
|
cbws.getWebsocket.send(JSON.stringify({
|
|
34
34
|
"type": "agentEvent",
|
|
35
35
|
"action": "startAgent",
|
|
36
|
+
"agentId": agentId,
|
|
36
37
|
"task": task
|
|
37
38
|
}));
|
|
38
39
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
39
40
|
const response = JSON.parse(data);
|
|
40
|
-
if (response.type === "
|
|
41
|
+
if (response.type === "taskCompletionResponse") {
|
|
41
42
|
resolve(response); // Resolve the Promise when the agent has been successfully started
|
|
42
43
|
}
|
|
43
44
|
});
|
package/src/modules/websocket.ts
CHANGED
|
@@ -15,8 +15,8 @@ class cbws {
|
|
|
15
15
|
const uniqueConnectionId = this.getUniqueConnectionId();
|
|
16
16
|
const initialMessage = this.getInitialMessage();
|
|
17
17
|
|
|
18
|
-
const agentIdParam = process.env.
|
|
19
|
-
const parentIdParam = process.env.
|
|
18
|
+
const agentIdParam = process.env.agentId ? `&agentId=${process.env.agentId}` : '';
|
|
19
|
+
const parentIdParam = process.env.parentId ? `&parentId=${process.env.parentId}` : '';
|
|
20
20
|
this.websocket = new WebSocket(`ws://localhost:${process.env.SOCKET_PORT}/codebolt?id=${uniqueConnectionId}${agentIdParam}${parentIdParam}${process.env.Is_Dev ? '&dev=true' : ''}`);
|
|
21
21
|
this.initializeWebSocket(initialMessage).catch(error => {
|
|
22
22
|
console.error("WebSocket connection failed:", error);
|