@codebolt/codeboltjs 1.1.83 → 1.1.84

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 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;
@@ -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 === "startAgentResponse" && response.task === task) {
43
+ if (response.type === "taskCompletionResponse") {
43
44
  resolve(response); // Resolve the Promise when the agent has been successfully started
44
45
  }
45
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.83",
3
+ "version": "1.1.84",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -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 === "startAgentResponse" && response.task === task) {
41
+ if (response.type === "taskCompletionResponse") {
41
42
  resolve(response); // Resolve the Promise when the agent has been successfully started
42
43
  }
43
44
  });