@agentvault/agentvault 0.19.14 → 0.19.15

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
@@ -47946,12 +47946,27 @@ var init_channel = __esm({
47946
47946
  let channelEntry = a2aEntries.find((ch) => ch.hubAddress === target.hubAddress);
47947
47947
  if (!channelEntry) {
47948
47948
  try {
47949
- console.log(`[deliver] A2A channel not found for ${target.hubAddress}, re-syncing from server...`);
47950
- await this.listA2AChannels();
47951
- a2aEntries = this._persisted?.a2aChannels ? Object.values(this._persisted.a2aChannels) : [];
47952
- channelEntry = a2aEntries.find((ch) => ch.hubAddress === target.hubAddress);
47949
+ console.log(`[deliver] A2A local miss for ${target.hubAddress}, fetching from API...`);
47950
+ const channels = await this.listA2AChannels();
47951
+ const myHub = this._persisted?.hubAddress || "";
47952
+ const match = channels.find(
47953
+ (ch) => (ch.status === "active" || ch.status === "approved") && (ch.initiatorHubAddress === target.hubAddress || ch.responderHubAddress === target.hubAddress)
47954
+ );
47955
+ if (match) {
47956
+ const isInit = match.initiatorHubAddress === myHub;
47957
+ const peerId = isInit ? match.responderHubAddress : match.initiatorHubAddress;
47958
+ if (this._persisted?.a2aChannels) {
47959
+ const entry = this._persisted.a2aChannels[match.channelId];
47960
+ if (entry) {
47961
+ entry.hubAddress = peerId;
47962
+ entry.conversationId = match.conversationId || entry.conversationId;
47963
+ }
47964
+ }
47965
+ a2aEntries = this._persisted?.a2aChannels ? Object.values(this._persisted.a2aChannels) : [];
47966
+ channelEntry = a2aEntries.find((ch) => ch.hubAddress === target.hubAddress);
47967
+ }
47953
47968
  } catch (syncErr) {
47954
- console.warn("[deliver] A2A re-sync failed:", syncErr);
47969
+ console.warn("[deliver] A2A API lookup failed:", syncErr);
47955
47970
  }
47956
47971
  }
47957
47972
  if (!channelEntry) {