@agentvault/agentvault 0.19.17 → 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/cli.js CHANGED
@@ -47899,9 +47899,21 @@ var init_channel = __esm({
47899
47899
  message_type: "a2a"
47900
47900
  };
47901
47901
  if (myHub) payload.hub_address = myHub;
47902
- this._ws.send(JSON.stringify({ event: "a2a_message", data: payload }));
47903
- console.log(`[deliver] A2A direct send OK \u2192 ${target.hubAddress} via channel ${match.channelId.slice(0, 8)}...`);
47904
- return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47902
+ try {
47903
+ await this.sendToAgent(target.hubAddress, content.text || "");
47904
+ console.log(`[deliver] A2A sendToAgent OK \u2192 ${target.hubAddress} via channel ${match.channelId.slice(0, 8)}...`);
47905
+ return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47906
+ } catch (sendErr) {
47907
+ console.log(`[deliver] A2A sendToAgent failed (${sendErr}), trying raw WS send...`);
47908
+ const wsReady = this._ws && this._ws.readyState === 1;
47909
+ if (wsReady) {
47910
+ this._ws.send(JSON.stringify({ event: "a2a_message", data: payload }));
47911
+ console.log(`[deliver] A2A raw WS send OK \u2192 ${target.hubAddress}`);
47912
+ return { ok: true, destination: { kind: "a2a", id: target.hubAddress }, timestamp: ts };
47913
+ } else {
47914
+ console.warn(`[deliver] A2A WS not ready (state=${this._ws?.readyState})`);
47915
+ }
47916
+ }
47905
47917
  }
47906
47918
  } catch (syncErr) {
47907
47919
  console.warn("[deliver] A2A direct send failed:", syncErr);