@agentvault/agentvault 0.19.19 → 0.19.21

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
@@ -47953,18 +47953,17 @@ var init_channel = __esm({
47953
47953
  (ch) => (ch.status === "active" || ch.status === "approved") && (ch.initiatorHubAddress === target.hubAddress || ch.responderHubAddress === target.hubAddress)
47954
47954
  );
47955
47955
  if (match?.conversationId) {
47956
- const isInit = match.initiatorHubAddress === myHub;
47957
- const correctPeerAddress = isInit ? match.responderHubAddress : match.initiatorHubAddress;
47956
+ const peerAddress = target.hubAddress;
47958
47957
  if (this._persisted?.a2aChannels?.[match.channelId]) {
47959
- this._persisted.a2aChannels[match.channelId].hubAddress = correctPeerAddress;
47958
+ this._persisted.a2aChannels[match.channelId].hubAddress = peerAddress;
47960
47959
  this._persisted.a2aChannels[match.channelId].conversationId = match.conversationId;
47961
47960
  await this._persistState();
47962
- console.log(`[deliver] A2A force-fixed persisted entry: hubAddress=${correctPeerAddress} conv=${match.conversationId.slice(0, 8)}...`);
47961
+ console.log(`[deliver] A2A force-fixed: peer=${peerAddress} conv=${match.conversationId.slice(0, 8)}...`);
47963
47962
  }
47964
47963
  try {
47965
- await this.sendToAgent(correctPeerAddress, content.text || "");
47966
- console.log(`[deliver] A2A sendToAgent OK \u2192 ${correctPeerAddress}`);
47967
- return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47964
+ await this.sendToAgent(peerAddress, content.text || "");
47965
+ console.log(`[deliver] A2A sendToAgent OK \u2192 ${peerAddress}`);
47966
+ return { ok: true, destination: { kind: "a2a", id: peerAddress }, timestamp: ts };
47968
47967
  } catch (sendErr) {
47969
47968
  console.warn(`[deliver] A2A sendToAgent failed after fix: ${sendErr}`);
47970
47969
  }
@@ -48543,12 +48542,19 @@ var init_channel = __esm({
48543
48542
  if (this._persisted.hubAddress) {
48544
48543
  payload.hub_address = this._persisted.hubAddress;
48545
48544
  }
48546
- this._ws.send(
48547
- JSON.stringify({
48548
- event: "a2a_message",
48549
- data: payload
48550
- })
48551
- );
48545
+ const a2aJson = JSON.stringify({ event: "a2a_message", data: payload });
48546
+ console.log(`[sendToAgent] Sending A2A plaintext: conv=${payload.conversation_id} wsReady=${this._ws.readyState} bytes=${a2aJson.length}`);
48547
+ await new Promise((resolve3, reject) => {
48548
+ this._ws.send(a2aJson, (err) => {
48549
+ if (err) {
48550
+ console.error(`[sendToAgent] WS send failed:`, err);
48551
+ reject(err);
48552
+ } else {
48553
+ console.log(`[sendToAgent] WS send confirmed`);
48554
+ resolve3();
48555
+ }
48556
+ });
48557
+ });
48552
48558
  }
48553
48559
  /**
48554
48560
  * List all A2A channels for this agent.