gopherhole_openclaw_a2a 0.4.0 → 0.4.2
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/SKILL.md +1 -1
- package/dist/src/connection.js +8 -3
- package/dist/src/gateway-client.js +17 -7
- package/dist/src/logger.js +1 -1
- package/package.json +2 -2
package/SKILL.md
CHANGED
|
@@ -16,7 +16,7 @@ Add to your Clawdbot config:
|
|
|
16
16
|
channels:
|
|
17
17
|
a2a:
|
|
18
18
|
enabled: true
|
|
19
|
-
agentId: nova # Our identifier (default:
|
|
19
|
+
agentId: nova # Our identifier (default: openclaw)
|
|
20
20
|
agentName: Nova # Display name
|
|
21
21
|
bridgeUrl: ws://localhost:8080/a2a # A2A bridge/hub (optional)
|
|
22
22
|
agents: # Direct agent connections (optional)
|
package/dist/src/connection.js
CHANGED
|
@@ -77,7 +77,11 @@ export class A2AConnectionManager {
|
|
|
77
77
|
// Set up event handlers
|
|
78
78
|
this.gopherhole.on('connect', () => {
|
|
79
79
|
this.connected = true;
|
|
80
|
-
console.log('[a2a] Connected to GopherHole Hub via SDK');
|
|
80
|
+
console.log('[a2a] Connected to GopherHole Hub via SDK (awaiting welcome)');
|
|
81
|
+
});
|
|
82
|
+
// Welcome received — agent identity is now known
|
|
83
|
+
this.gopherhole.on('ready', ({ agentId }) => {
|
|
84
|
+
console.log(`[a2a] GopherHole ready — agent ID: ${agentId}`);
|
|
81
85
|
});
|
|
82
86
|
this.gopherhole.on('disconnect', (reason) => {
|
|
83
87
|
this.connected = false;
|
|
@@ -96,10 +100,11 @@ export class A2AConnectionManager {
|
|
|
96
100
|
this.gopherhole.on('system', (message) => {
|
|
97
101
|
this.handleSystemMessage(message);
|
|
98
102
|
});
|
|
99
|
-
// Connect
|
|
103
|
+
// Connect — note: connect() resolves on socket open; the agent ID is
|
|
104
|
+
// delivered asynchronously via the 'welcome' message, which triggers
|
|
105
|
+
// the 'ready' event above. Do NOT log gopherhole.id here — it will be null.
|
|
100
106
|
try {
|
|
101
107
|
await this.gopherhole.connect();
|
|
102
|
-
console.log(`[a2a] GopherHole SDK connected, agent ID: ${this.gopherhole.id}`);
|
|
103
108
|
}
|
|
104
109
|
catch (err) {
|
|
105
110
|
console.error('[a2a] Failed to connect to GopherHole:', err.message);
|
|
@@ -17,14 +17,24 @@ let pendingChats = new Map(); // keyed by runId
|
|
|
17
17
|
let connected = false;
|
|
18
18
|
let handshakeComplete = false;
|
|
19
19
|
function getGatewayToken() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
// Try the current OpenClaw config location first, then the legacy
|
|
21
|
+
// Clawdbot path as a fallback for users still on older installs.
|
|
22
|
+
const candidates = [
|
|
23
|
+
join(homedir(), '.openclaw', 'openclaw.json'),
|
|
24
|
+
join(homedir(), '.clawdbot', 'clawdbot.json'),
|
|
25
|
+
];
|
|
26
|
+
for (const configPath of candidates) {
|
|
27
|
+
try {
|
|
28
|
+
const config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
29
|
+
const token = config?.gateway?.auth?.token;
|
|
30
|
+
if (token)
|
|
31
|
+
return token;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// file missing or unparseable — try next
|
|
35
|
+
}
|
|
27
36
|
}
|
|
37
|
+
return null;
|
|
28
38
|
}
|
|
29
39
|
export async function connectToGateway(port = 18789) {
|
|
30
40
|
if (ws && connected && handshakeComplete)
|
package/dist/src/logger.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { appendFileSync, mkdirSync, existsSync } from 'fs';
|
|
6
6
|
import { join } from 'path';
|
|
7
7
|
import { homedir } from 'os';
|
|
8
|
-
const LOG_DIR = join(homedir(), '.
|
|
8
|
+
const LOG_DIR = join(homedir(), '.openclaw', 'logs');
|
|
9
9
|
const A2A_LOG_FILE = join(LOG_DIR, 'a2a.log');
|
|
10
10
|
// Ensure log directory exists
|
|
11
11
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gopherhole_openclaw_a2a",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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.
|
|
38
|
+
"@gopherhole/sdk": "^0.7.2",
|
|
39
39
|
"uuid": "^10.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|