@agentvault/agentvault 0.19.16 → 0.19.18

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
@@ -47960,9 +47960,21 @@ var init_channel = __esm({
47960
47960
  message_type: "a2a"
47961
47961
  };
47962
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 };
47963
+ try {
47964
+ await this.sendToAgent(target.hubAddress, content.text || "");
47965
+ console.log(`[deliver] A2A sendToAgent OK \u2192 ${target.hubAddress} via channel ${match.channelId.slice(0, 8)}...`);
47966
+ return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47967
+ } catch (sendErr) {
47968
+ console.log(`[deliver] A2A sendToAgent failed (${sendErr}), trying raw WS send...`);
47969
+ const wsReady = this._ws && this._ws.readyState === 1;
47970
+ if (wsReady) {
47971
+ this._ws.send(JSON.stringify({ event: "a2a_message", data: payload }));
47972
+ console.log(`[deliver] A2A raw WS send OK \u2192 ${target.hubAddress}`);
47973
+ return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47974
+ } else {
47975
+ console.warn(`[deliver] A2A WS not ready (state=${this._ws?.readyState})`);
47976
+ }
47977
+ }
47966
47978
  }
47967
47979
  } catch (syncErr) {
47968
47980
  console.warn("[deliver] A2A direct send failed:", syncErr);