gopherhole_openclaw_a2a 0.4.1 → 0.4.3

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.
@@ -25,6 +25,19 @@ export class A2AConnectionManager {
25
25
  async connectToGopherHole() {
26
26
  const hubUrl = this.config.bridgeUrl || 'wss://hub.gopherhole.ai/ws';
27
27
  const timeoutMs = this.config.requestTimeoutMs ?? 180000;
28
+ // Force SDK to use the 'ws' npm module instead of Node's native WebSocket.
29
+ // Node 22's native WebSocket uses undici which fails inside the OpenClaw gateway
30
+ // process context, but the 'ws' package works fine.
31
+ // Also set up global.require so the SDK's ESM __require can find the ws package.
32
+ try {
33
+ const { createRequire } = await import('module');
34
+ const req = createRequire(import.meta.url);
35
+ globalThis.require = req;
36
+ }
37
+ catch {
38
+ // ignore
39
+ }
40
+ globalThis.WebSocket = undefined;
28
41
  this.gopherhole = new GopherHole({
29
42
  apiKey: this.config.apiKey,
30
43
  hubUrl,
@@ -77,7 +90,11 @@ export class A2AConnectionManager {
77
90
  // Set up event handlers
78
91
  this.gopherhole.on('connect', () => {
79
92
  this.connected = true;
80
- console.log('[a2a] Connected to GopherHole Hub via SDK');
93
+ console.log('[a2a] Connected to GopherHole Hub via SDK (awaiting welcome)');
94
+ });
95
+ // Welcome received — agent identity is now known
96
+ this.gopherhole.on('ready', ({ agentId }) => {
97
+ console.log(`[a2a] GopherHole ready — agent ID: ${agentId}`);
81
98
  });
82
99
  this.gopherhole.on('disconnect', (reason) => {
83
100
  this.connected = false;
@@ -96,10 +113,11 @@ export class A2AConnectionManager {
96
113
  this.gopherhole.on('system', (message) => {
97
114
  this.handleSystemMessage(message);
98
115
  });
99
- // Connect
116
+ // Connect — note: connect() resolves on socket open; the agent ID is
117
+ // delivered asynchronously via the 'welcome' message, which triggers
118
+ // the 'ready' event above. Do NOT log gopherhole.id here — it will be null.
100
119
  try {
101
120
  await this.gopherhole.connect();
102
- console.log(`[a2a] GopherHole SDK connected, agent ID: ${this.gopherhole.id}`);
103
121
  }
104
122
  catch (err) {
105
123
  console.error('[a2a] Failed to connect to GopherHole:', err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gopherhole_openclaw_a2a",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "GopherHole A2A plugin for OpenClaw - connect your AI agent to the GopherHole network",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "license": "MIT",
37
37
  "dependencies": {
38
- "@gopherhole/sdk": "^0.7.1",
38
+ "@gopherhole/sdk": "^0.7.2",
39
39
  "uuid": "^10.0.0"
40
40
  },
41
41
  "devDependencies": {