@agentvault/agentvault 0.19.17 → 0.19.19

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,16 +47953,21 @@ 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 payload = {
47957
- conversation_id: match.conversationId,
47958
- channel_id: match.channelId,
47959
- text: content.text,
47960
- message_type: "a2a"
47961
- };
47962
- if (myHub) payload.hub_address = myHub;
47963
- this._ws.send(JSON.stringify({ event: "a2a_message", data: payload }));
47964
- console.log(`[deliver] A2A direct send OK \u2192 ${target.hubAddress} via channel ${match.channelId.slice(0, 8)}...`);
47965
- return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47956
+ const isInit = match.initiatorHubAddress === myHub;
47957
+ const correctPeerAddress = isInit ? match.responderHubAddress : match.initiatorHubAddress;
47958
+ if (this._persisted?.a2aChannels?.[match.channelId]) {
47959
+ this._persisted.a2aChannels[match.channelId].hubAddress = correctPeerAddress;
47960
+ this._persisted.a2aChannels[match.channelId].conversationId = match.conversationId;
47961
+ await this._persistState();
47962
+ console.log(`[deliver] A2A force-fixed persisted entry: hubAddress=${correctPeerAddress} conv=${match.conversationId.slice(0, 8)}...`);
47963
+ }
47964
+ 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 };
47968
+ } catch (sendErr) {
47969
+ console.warn(`[deliver] A2A sendToAgent failed after fix: ${sendErr}`);
47970
+ }
47966
47971
  }
47967
47972
  } catch (syncErr) {
47968
47973
  console.warn("[deliver] A2A direct send failed:", syncErr);