@awarevue/agent-sdk 1.1.13 → 1.1.15

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/dist/agent-app.js CHANGED
@@ -72,7 +72,16 @@ class AgentApp {
72
72
  .run$(context)
73
73
  .pipe((0, rxjs_1.tap)((message) => this.options.transport.send(this.addEnvelope({ ...message, provider: context.provider })))),
74
74
  // handle messages to agent
75
- this.options.transport.messages$.pipe((0, rxjs_1.mergeMap)((message) => {
75
+ this.options.transport.messages$.pipe((0, rxjs_1.startWith)(null), // emit immediately to ensure subscription is active
76
+ (0, rxjs_1.mergeMap)((message) => {
77
+ // Send start-rs on the first emission (null) to signal we're ready
78
+ if (message === null) {
79
+ this.options.transport.send(this.addEnvelope({
80
+ kind: 'start-rs',
81
+ requestId: context.startRequestId,
82
+ }));
83
+ return rxjs_1.EMPTY;
84
+ }
76
85
  switch (message.kind) {
77
86
  // handle commands
78
87
  case 'command':
@@ -90,6 +99,13 @@ class AgentApp {
90
99
  requestId: message.id,
91
100
  result,
92
101
  })), this.handleResponse$(message.id));
102
+ case 'push-file':
103
+ if (!this.agent.pushFile) {
104
+ return (0, rxjs_1.throwError)(() => new Error(`Agent ${context.provider} does not support file pushing`));
105
+ }
106
+ return this.agent.pushFile(context, message).pipe(
107
+ // success - no return value
108
+ (0, rxjs_1.mergeMap)(() => rxjs_1.EMPTY), this.handleResponse$(message.id));
93
109
  case 'get-available-devices':
94
110
  // get available devices
95
111
  return this.agent.getDevicesAndRelations$(context).pipe(
@@ -145,13 +161,7 @@ class AgentApp {
145
161
  provider: message.provider,
146
162
  config: message.config,
147
163
  })
148
- .pipe((0, rxjs_1.retry)({ delay: 3000 }), (0, rxjs_1.tap)(() => {
149
- // reply to server that we are starting
150
- this.options.transport.send(this.addEnvelope({
151
- kind: 'start-rs',
152
- requestId: message.id,
153
- }));
154
- }), (0, rxjs_1.map)((deviceCatalog) => ({
164
+ .pipe((0, rxjs_1.retry)({ delay: 3000 }), (0, rxjs_1.map)((deviceCatalog) => ({
155
165
  provider: message.provider,
156
166
  config: message.config,
157
167
  lastEventForeignRef: message.lastEventForeignRef,
@@ -159,6 +169,7 @@ class AgentApp {
159
169
  ? null
160
170
  : Math.min(Date.now(), message.lastEventTimestamp),
161
171
  deviceCatalog,
172
+ startRequestId: message.id,
162
173
  })), (0, rxjs_1.mergeMap)((context) => this.runProvider$(context)))
163
174
  : (0, rxjs_1.of)(message).pipe((0, rxjs_1.tap)(() => this.options.transport.send(this.addEnvelope({
164
175
  kind: 'stop-rs',
package/dist/agent.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidateProviderConfigRs, DeviceDiscoveryDto, RunCommandRq, AccessValidateChangeRq, AccessChangeIssue, AccessApplyChange, AccessRefMap, AccessObjectKind, QueryRq } from '@awarevue/api-types';
1
+ import { ValidateProviderConfigRs, DeviceDiscoveryDto, RunCommandRq, AccessValidateChangeRq, AccessChangeIssue, AccessApplyChange, AccessRefMap, AccessObjectKind, QueryRq, PushFile } from '@awarevue/api-types';
2
2
  import { Observable } from 'rxjs';
3
3
  import { DeviceActivity } from './agent-app';
4
4
  export type Context = {
@@ -27,4 +27,5 @@ export interface Agent {
27
27
  validateAccessChange$?: (context: AccessChangeContext, change: AccessValidateChangeRq) => Observable<AccessChangeIssue[]>;
28
28
  applyAccessChange$?: (context: AccessChangeContext, change: AccessApplyChange) => Observable<AccessRefMap>;
29
29
  find$?: (context: Context, objectKind: AccessObjectKind, objectIds: string[]) => Observable<Record<string, Record<string, unknown>>>;
30
+ pushFile?: (context: Context, req: PushFile) => Observable<boolean>;
30
31
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/agent-sdk",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "SDK for building Agent implementations that speak the Aware protocol.",
5
5
  "author": "Yaser Awajan",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "lint:fix": "yarn lint --fix"
28
28
  },
29
29
  "dependencies": {
30
- "@awarevue/api-types": "^1.1.13",
30
+ "@awarevue/api-types": "^1.1.15",
31
31
  "rxjs": "^7.8.2",
32
32
  "ws": "^8",
33
33
  "zod": "3.24.2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/agent-sdk",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "SDK for building Agent implementations that speak the Aware protocol.",
5
5
  "author": "Yaser Awajan",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "lint:fix": "yarn lint --fix"
28
28
  },
29
29
  "dependencies": {
30
- "@awarevue/api-types": "^1.1.13",
30
+ "@awarevue/api-types": "^1.1.15",
31
31
  "rxjs": "^7.8.2",
32
32
  "ws": "^8",
33
33
  "zod": "3.24.2"