gopherhole_openclaw_a2a 0.3.0 → 0.3.1

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.
@@ -178,16 +178,18 @@ export const a2aPlugin = {
178
178
  lastError: snapshot.lastError ?? null,
179
179
  }),
180
180
  probeAccount: async () => ({ ok: connectionManager !== null }),
181
- buildAccountSnapshot: ({ account, runtime }) => {
182
- const agents = connectionManager?.listAgents() ?? [];
181
+ buildAccountSnapshot: async ({ account, runtime }) => {
182
+ const connectionStatus = connectionManager?.listAgents() ?? [];
183
+ const availableAgents = await connectionManager?.listAvailableAgents() ?? [];
183
184
  return {
184
185
  accountId: account.accountId,
185
186
  name: account.name,
186
187
  enabled: account.enabled,
187
188
  configured: account.configured,
188
189
  running: runtime?.running ?? false,
189
- connected: agents.some((a) => a.connected),
190
- agents,
190
+ connected: connectionStatus.some((a) => a.connected),
191
+ hubStatus: connectionStatus,
192
+ availableAgents,
191
193
  lastStartAt: runtime?.lastStartAt ?? null,
192
194
  lastStopAt: runtime?.lastStopAt ?? null,
193
195
  lastError: runtime?.lastError ?? null,
@@ -49,7 +49,17 @@ export declare class A2AConnectionManager {
49
49
  */
50
50
  isGopherHoleConnected(): boolean;
51
51
  /**
52
- * List connected agents (just GopherHole for now)
52
+ * List available agents from GopherHole
53
+ * Fetches same-tenant agents + agents with approved access + public agents
54
+ */
55
+ listAvailableAgents(): Promise<Array<{
56
+ id: string;
57
+ name: string;
58
+ description?: string;
59
+ accessType: 'same-tenant' | 'public' | 'granted';
60
+ }>>;
61
+ /**
62
+ * List connection status (for backward compatibility)
53
63
  */
54
64
  listAgents(): Array<{
55
65
  id: string;
@@ -212,7 +212,42 @@ export class A2AConnectionManager {
212
212
  return this.connected && this.gopherhole?.connected === true;
213
213
  }
214
214
  /**
215
- * List connected agents (just GopherHole for now)
215
+ * List available agents from GopherHole
216
+ * Fetches same-tenant agents + agents with approved access + public agents
217
+ */
218
+ async listAvailableAgents() {
219
+ if (!this.config.apiKey) {
220
+ return [];
221
+ }
222
+ const hubUrl = this.config.bridgeUrl || 'wss://gopherhole.ai/ws';
223
+ // Convert wss:// to https:// for API calls
224
+ const apiBase = hubUrl.replace('wss://', 'https://').replace('/ws', '');
225
+ try {
226
+ const response = await fetch(`${apiBase}/api/agents/available`, {
227
+ headers: {
228
+ 'Authorization': `Bearer ${this.config.apiKey}`,
229
+ 'Content-Type': 'application/json',
230
+ },
231
+ });
232
+ if (!response.ok) {
233
+ console.error(`[a2a] Failed to fetch agents: ${response.status}`);
234
+ return [];
235
+ }
236
+ const data = await response.json();
237
+ return data.agents.map(a => ({
238
+ id: a.id,
239
+ name: a.name,
240
+ description: a.description,
241
+ accessType: a.access_type,
242
+ }));
243
+ }
244
+ catch (err) {
245
+ console.error('[a2a] Error fetching available agents:', err.message);
246
+ return [];
247
+ }
248
+ }
249
+ /**
250
+ * List connection status (for backward compatibility)
216
251
  */
217
252
  listAgents() {
218
253
  const agents = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gopherhole_openclaw_a2a",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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",
package/src/channel.ts CHANGED
@@ -255,16 +255,18 @@ export const a2aPlugin: ChannelPlugin<ResolvedA2AAccount> = {
255
255
  lastError: snapshot.lastError ?? null,
256
256
  }),
257
257
  probeAccount: async () => ({ ok: connectionManager !== null }),
258
- buildAccountSnapshot: ({ account, runtime }) => {
259
- const agents = connectionManager?.listAgents() ?? [];
258
+ buildAccountSnapshot: async ({ account, runtime }) => {
259
+ const connectionStatus = connectionManager?.listAgents() ?? [];
260
+ const availableAgents = await connectionManager?.listAvailableAgents() ?? [];
260
261
  return {
261
262
  accountId: account.accountId,
262
263
  name: account.name,
263
264
  enabled: account.enabled,
264
265
  configured: account.configured,
265
266
  running: runtime?.running ?? false,
266
- connected: agents.some((a) => a.connected),
267
- agents,
267
+ connected: connectionStatus.some((a) => a.connected),
268
+ hubStatus: connectionStatus,
269
+ availableAgents,
268
270
  lastStartAt: runtime?.lastStartAt ?? null,
269
271
  lastStopAt: runtime?.lastStopAt ?? null,
270
272
  lastError: runtime?.lastError ?? null,
package/src/connection.ts CHANGED
@@ -270,7 +270,57 @@ export class A2AConnectionManager {
270
270
  }
271
271
 
272
272
  /**
273
- * List connected agents (just GopherHole for now)
273
+ * List available agents from GopherHole
274
+ * Fetches same-tenant agents + agents with approved access + public agents
275
+ */
276
+ async listAvailableAgents(): Promise<Array<{
277
+ id: string;
278
+ name: string;
279
+ description?: string;
280
+ accessType: 'same-tenant' | 'public' | 'granted';
281
+ }>> {
282
+ if (!this.config.apiKey) {
283
+ return [];
284
+ }
285
+
286
+ const hubUrl = this.config.bridgeUrl || 'wss://gopherhole.ai/ws';
287
+ // Convert wss:// to https:// for API calls
288
+ const apiBase = hubUrl.replace('wss://', 'https://').replace('/ws', '');
289
+
290
+ try {
291
+ const response = await fetch(`${apiBase}/api/agents/available`, {
292
+ headers: {
293
+ 'Authorization': `Bearer ${this.config.apiKey}`,
294
+ 'Content-Type': 'application/json',
295
+ },
296
+ });
297
+
298
+ if (!response.ok) {
299
+ console.error(`[a2a] Failed to fetch agents: ${response.status}`);
300
+ return [];
301
+ }
302
+
303
+ const data = await response.json() as { agents: Array<{
304
+ id: string;
305
+ name: string;
306
+ description?: string;
307
+ access_type: string;
308
+ }> };
309
+
310
+ return data.agents.map(a => ({
311
+ id: a.id,
312
+ name: a.name,
313
+ description: a.description,
314
+ accessType: a.access_type as 'same-tenant' | 'public' | 'granted',
315
+ }));
316
+ } catch (err) {
317
+ console.error('[a2a] Error fetching available agents:', (err as Error).message);
318
+ return [];
319
+ }
320
+ }
321
+
322
+ /**
323
+ * List connection status (for backward compatibility)
274
324
  */
275
325
  listAgents(): Array<{ id: string; name: string; connected: boolean }> {
276
326
  const agents: Array<{ id: string; name: string; connected: boolean }> = [];