@agentvault/agentvault 0.9.7 → 0.9.9

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/index.js CHANGED
@@ -46621,10 +46621,10 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
46621
46621
  this._scanEngine = new ScanEngine();
46622
46622
  await this._fetchScanRules();
46623
46623
  }
46624
- if (!this._telemetryReporter && this._persisted?.deviceJwt && this._persisted?.hubAddress) {
46624
+ if (!this._telemetryReporter && this._persisted?.deviceJwt && this._persisted?.hubId) {
46625
46625
  this._telemetryReporter = new TelemetryReporter({
46626
46626
  apiBase: this.config.apiUrl,
46627
- hubId: this._persisted.hubAddress,
46627
+ hubId: this._persisted.hubId,
46628
46628
  authHeader: `Bearer ${this._persisted.deviceJwt}`
46629
46629
  });
46630
46630
  this._telemetryReporter.startAutoFlush(3e4);
@@ -46727,9 +46727,26 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
46727
46727
  await this._fetchScanRules();
46728
46728
  return;
46729
46729
  }
46730
+ if (data.event === "hub_identity_sync") {
46731
+ if (this._persisted && data.data?.hub_id) {
46732
+ const changed = this._persisted.hubId !== data.data.hub_id;
46733
+ this._persisted.hubAddress = data.data.hub_address;
46734
+ this._persisted.hubId = data.data.hub_id;
46735
+ if (changed) this._persistState();
46736
+ if (!this._telemetryReporter && this._persisted.deviceJwt && this._persisted.hubId) {
46737
+ this._telemetryReporter = new TelemetryReporter({
46738
+ apiBase: this.config.apiUrl,
46739
+ hubId: this._persisted.hubId,
46740
+ authHeader: `Bearer ${this._persisted.deviceJwt}`
46741
+ });
46742
+ this._telemetryReporter.startAutoFlush(3e4);
46743
+ }
46744
+ }
46745
+ }
46730
46746
  if (data.event === "hub_identity_assigned") {
46731
46747
  if (this._persisted) {
46732
46748
  this._persisted.hubAddress = data.data.hub_address;
46749
+ this._persisted.hubId = data.data.hub_id;
46733
46750
  this._persistState();
46734
46751
  }
46735
46752
  this.emit("hub_identity_assigned", data.data);
@@ -46737,6 +46754,7 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
46737
46754
  if (data.event === "hub_identity_removed") {
46738
46755
  if (this._persisted) {
46739
46756
  delete this._persisted.hubAddress;
46757
+ delete this._persisted.hubId;
46740
46758
  this._persistState();
46741
46759
  }
46742
46760
  this.emit("hub_identity_removed", data.data);