@agentvault/agentvault 0.9.8 → 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/channel.d.ts.map +1 -1
- package/dist/cli.js +16 -17
- package/dist/cli.js.map +3 -3
- package/dist/index.js +16 -17
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46621,23 +46621,6 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46621
46621
|
this._scanEngine = new ScanEngine();
|
|
46622
46622
|
await this._fetchScanRules();
|
|
46623
46623
|
}
|
|
46624
|
-
if (this._persisted && this._persisted.hubAddress && !this._persisted.hubId && this._persisted.deviceJwt) {
|
|
46625
|
-
try {
|
|
46626
|
-
const listRes = await fetch(
|
|
46627
|
-
`${this.config.apiUrl}/api/v1/hub/identities`,
|
|
46628
|
-
{ headers: { Authorization: `Bearer ${this._persisted.deviceJwt}` } }
|
|
46629
|
-
);
|
|
46630
|
-
if (listRes.ok) {
|
|
46631
|
-
const identities = await listRes.json();
|
|
46632
|
-
const match = identities.find((h2) => h2.hub_address === this._persisted.hubAddress);
|
|
46633
|
-
if (match) {
|
|
46634
|
-
this._persisted.hubId = match.hub_id;
|
|
46635
|
-
this._persistState();
|
|
46636
|
-
}
|
|
46637
|
-
}
|
|
46638
|
-
} catch {
|
|
46639
|
-
}
|
|
46640
|
-
}
|
|
46641
46624
|
if (!this._telemetryReporter && this._persisted?.deviceJwt && this._persisted?.hubId) {
|
|
46642
46625
|
this._telemetryReporter = new TelemetryReporter({
|
|
46643
46626
|
apiBase: this.config.apiUrl,
|
|
@@ -46744,6 +46727,22 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
|
|
|
46744
46727
|
await this._fetchScanRules();
|
|
46745
46728
|
return;
|
|
46746
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
|
+
}
|
|
46747
46746
|
if (data.event === "hub_identity_assigned") {
|
|
46748
46747
|
if (this._persisted) {
|
|
46749
46748
|
this._persisted.hubAddress = data.data.hub_address;
|