@agentvault/agentvault 0.19.23 → 0.19.25

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
@@ -48813,6 +48813,34 @@ var init_channel = __esm({
48813
48813
  const a2aCount = Object.keys(this._persisted?.a2aChannels ?? {}).length;
48814
48814
  console.log(`[SecureChannel] A2A sync complete: ${a2aCount} channels`);
48815
48815
  this.emit("a2a_channels_synced", { count: a2aCount });
48816
+ if (this._persisted?.a2aChannels) {
48817
+ const channelsNeedingKx = Object.entries(this._persisted.a2aChannels).filter(
48818
+ ([_2, entry]) => !entry.session && !entry.pendingEphemeralPrivateKey && entry.conversationId
48819
+ );
48820
+ if (channelsNeedingKx.length > 0) {
48821
+ setTimeout(async () => {
48822
+ if (!this._ws || this._state !== "ready") return;
48823
+ for (const [chId, entry] of channelsNeedingKx) {
48824
+ try {
48825
+ const a2aEphemeral = await generateEphemeralKeypair();
48826
+ const ephPubHex = bytesToHex(a2aEphemeral.publicKey);
48827
+ const ephPrivHex = bytesToHex(a2aEphemeral.privateKey);
48828
+ entry.pendingEphemeralPrivateKey = ephPrivHex;
48829
+ this._ws.send(JSON.stringify({
48830
+ event: "a2a_key_exchange",
48831
+ data: { channel_id: chId, ephemeral_key: ephPubHex }
48832
+ }));
48833
+ console.log(
48834
+ `[SecureChannel] A2A key exchange initiated for channel ${chId.slice(0, 8)}... (role=${entry.role ?? "unknown"})`
48835
+ );
48836
+ } catch (kxErr) {
48837
+ console.warn(`[SecureChannel] A2A key exchange failed for ${chId.slice(0, 8)}...:`, kxErr);
48838
+ }
48839
+ }
48840
+ await this._persistState();
48841
+ }, 3e3);
48842
+ }
48843
+ }
48816
48844
  } catch (err) {
48817
48845
  console.warn("[SecureChannel] A2A channel sync failed (non-fatal):", err);
48818
48846
  }