@awarevue/agent-sdk 2.0.79 → 2.0.80

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.
@@ -47,7 +47,8 @@ export declare class AgentServer<TPeer extends PeerId = string> {
47
47
  private onPeerLeave;
48
48
  private processMessage;
49
49
  startAgent({ agentId, ...rest }: StartAgentArgs): void;
50
- stopAgent(agentId: string, provider: string): void;
50
+ stopAgent(agentId: string, provider: string): Promise<void>;
51
+ restartAgent({ agentId, ...rest }: StartAgentArgs): Promise<void>;
51
52
  finalize(): void;
52
53
  getAgentSender(agentId: string): AgentProtocol<'server'> | null;
53
54
  private getPeerSender;
@@ -119,9 +119,19 @@ class AgentServer {
119
119
  const protocol = this.getAgentSender(agentId);
120
120
  protocol === null || protocol === void 0 ? void 0 : protocol.send({ kind: 'start', ...rest });
121
121
  }
122
- stopAgent(agentId, provider) {
122
+ async stopAgent(agentId, provider) {
123
123
  const protocol = this.getAgentSender(agentId);
124
- protocol === null || protocol === void 0 ? void 0 : protocol.send({ kind: 'stop', provider });
124
+ if (!protocol) {
125
+ this.notifications$.next(`Cannot stop agent ${agentId} - no connection found`);
126
+ return;
127
+ }
128
+ await (0, rxjs_1.lastValueFrom)(protocol.getReply$({ kind: 'stop', provider })).catch((err) => {
129
+ this.notifications$.next(`Failed to stop agent ${agentId}: ${err.message}`);
130
+ });
131
+ }
132
+ async restartAgent({ agentId, ...rest }) {
133
+ await this.stopAgent(agentId, rest.provider);
134
+ this.startAgent({ agentId, ...rest });
125
135
  }
126
136
  finalize() {
127
137
  var _a;
package/dist/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/Linc-Security-Systems/aware-essentials.git"
6
6
  },
7
- "version": "2.0.79",
7
+ "version": "2.0.80",
8
8
  "description": "SDK for building Agent implementations that speak the agent protocol.",
9
9
  "author": "Yaser Awajan",
10
10
  "license": "MIT",
@@ -31,12 +31,12 @@
31
31
  "lint:fix": "yarn lint --fix"
32
32
  },
33
33
  "peerDependencies": {
34
- "@awarevue/api-types": "2.0.79",
34
+ "@awarevue/api-types": "2.0.80",
35
35
  "rxjs": "^7.8.2",
36
36
  "ws": "^8"
37
37
  },
38
38
  "devDependencies": {
39
- "@awarevue/api-types": "2.0.79",
39
+ "@awarevue/api-types": "2.0.80",
40
40
  "@types/node": "^20.12.7",
41
41
  "@types/ws": "^8.18.1",
42
42
  "@typescript-eslint/eslint-plugin": "^8.31.1",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/Linc-Security-Systems/aware-essentials.git"
6
6
  },
7
- "version": "2.0.79",
7
+ "version": "2.0.80",
8
8
  "description": "SDK for building Agent implementations that speak the agent protocol.",
9
9
  "author": "Yaser Awajan",
10
10
  "license": "MIT",
@@ -31,12 +31,12 @@
31
31
  "lint:fix": "yarn lint --fix"
32
32
  },
33
33
  "peerDependencies": {
34
- "@awarevue/api-types": "2.0.79",
34
+ "@awarevue/api-types": "2.0.80",
35
35
  "rxjs": "^7.8.2",
36
36
  "ws": "^8"
37
37
  },
38
38
  "devDependencies": {
39
- "@awarevue/api-types": "2.0.79",
39
+ "@awarevue/api-types": "2.0.80",
40
40
  "@types/node": "^20.12.7",
41
41
  "@types/ws": "^8.18.1",
42
42
  "@typescript-eslint/eslint-plugin": "^8.31.1",