@agentvault/agentvault 0.19.3 → 0.19.5

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
@@ -48412,9 +48412,10 @@ var init_channel = __esm({
48412
48412
  if (!this._persisted?.a2aChannels) {
48413
48413
  throw new Error("No A2A channels established");
48414
48414
  }
48415
- const channelEntry = Object.values(this._persisted.a2aChannels).find(
48415
+ const allMatches = Object.values(this._persisted.a2aChannels).filter(
48416
48416
  (ch) => ch.hubAddress === hubAddress
48417
48417
  );
48418
+ const channelEntry = allMatches.find((ch) => ch.conversationId) ?? allMatches[0];
48418
48419
  if (!channelEntry) {
48419
48420
  throw new Error(`No A2A channel found for hub address: ${hubAddress}`);
48420
48421
  }
@@ -49177,6 +49178,38 @@ var init_channel = __esm({
49177
49178
  console.log(
49178
49179
  `[SecureChannel] Observer ratchet initialized for channel ${obsAccChannelId.slice(0, 8)}... (side=${obsAccSide})`
49179
49180
  );
49181
+ try {
49182
+ const seedText = JSON.stringify({ type: "observer_seed", text: "" });
49183
+ const seedEncrypted = obsRatchet.encrypt(seedText);
49184
+ const seedHeaderObj = {
49185
+ dhPublicKey: bytesToHex(seedEncrypted.header.dhPublicKey),
49186
+ previousChainLength: seedEncrypted.header.previousChainLength,
49187
+ messageNumber: seedEncrypted.header.messageNumber
49188
+ };
49189
+ obsAccEntry.observerSession.ratchetState = obsRatchet.serialize();
49190
+ await this._persistState();
49191
+ if (this._ws && obsAccEntry.conversationId) {
49192
+ this._ws.send(JSON.stringify({
49193
+ event: "a2a_message",
49194
+ data: {
49195
+ conversation_id: obsAccEntry.conversationId,
49196
+ channel_id: obsAccChannelId,
49197
+ // Dummy A2A payload (plaintext, won't relay to peer)
49198
+ text: "",
49199
+ message_type: "observer_seed",
49200
+ // Observer copy is the real payload
49201
+ observer_header_blob: Buffer.from(JSON.stringify(seedHeaderObj)).toString("hex"),
49202
+ observer_ciphertext: bytesToHex(seedEncrypted.ciphertext),
49203
+ observer_nonce: bytesToHex(seedEncrypted.nonce)
49204
+ }
49205
+ }));
49206
+ console.log(
49207
+ `[SecureChannel] Observer seed message sent for channel ${obsAccChannelId.slice(0, 8)}...`
49208
+ );
49209
+ }
49210
+ } catch (seedErr) {
49211
+ console.error("[SecureChannel] Observer seed message failed:", seedErr);
49212
+ }
49180
49213
  } catch (err) {
49181
49214
  console.error("[SecureChannel] Observer ratchet init failed:", err);
49182
49215
  }