gopherhole_openclaw_a2a 0.3.10 → 0.3.12
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/src/connection.d.ts +32 -3
- package/dist/src/connection.js +42 -15
- package/package.json +1 -1
- package/src/connection.ts +86 -27
package/dist/src/connection.d.ts
CHANGED
|
@@ -54,15 +54,44 @@ export declare class A2AConnectionManager {
|
|
|
54
54
|
*/
|
|
55
55
|
isGopherHoleConnected(): boolean;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* Fetches same-tenant agents + agents with approved access + public agents
|
|
57
|
+
* Make an A2A JSON-RPC call
|
|
59
58
|
*/
|
|
60
|
-
|
|
59
|
+
private a2aRpc;
|
|
60
|
+
/**
|
|
61
|
+
* List available agents from GopherHole (agents you have access to)
|
|
62
|
+
*/
|
|
63
|
+
listAvailableAgents(options?: {
|
|
64
|
+
query?: string;
|
|
65
|
+
public?: boolean;
|
|
66
|
+
}): Promise<Array<{
|
|
61
67
|
id: string;
|
|
62
68
|
name: string;
|
|
63
69
|
description?: string;
|
|
70
|
+
verified?: boolean;
|
|
64
71
|
accessType: 'same-tenant' | 'public' | 'granted';
|
|
65
72
|
}>>;
|
|
73
|
+
/**
|
|
74
|
+
* Discover public agents in the marketplace
|
|
75
|
+
*/
|
|
76
|
+
discoverAgents(options?: {
|
|
77
|
+
query?: string;
|
|
78
|
+
category?: string;
|
|
79
|
+
tag?: string;
|
|
80
|
+
skillTag?: string;
|
|
81
|
+
contentMode?: string;
|
|
82
|
+
sort?: string;
|
|
83
|
+
verified?: boolean;
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
86
|
+
scope?: string;
|
|
87
|
+
}): Promise<Array<{
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
verified?: boolean;
|
|
92
|
+
tenantName?: string;
|
|
93
|
+
avgRating?: number;
|
|
94
|
+
}>>;
|
|
66
95
|
/**
|
|
67
96
|
* List connection status (for backward compatibility)
|
|
68
97
|
*/
|
package/dist/src/connection.js
CHANGED
|
@@ -272,39 +272,66 @@ export class A2AConnectionManager {
|
|
|
272
272
|
return this.connected && this.gopherhole?.connected === true;
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
275
|
-
*
|
|
276
|
-
* Fetches same-tenant agents + agents with approved access + public agents
|
|
275
|
+
* Make an A2A JSON-RPC call
|
|
277
276
|
*/
|
|
278
|
-
async
|
|
277
|
+
async a2aRpc(method, params) {
|
|
279
278
|
if (!this.config.apiKey) {
|
|
280
|
-
return
|
|
279
|
+
return null;
|
|
281
280
|
}
|
|
282
281
|
const hubUrl = this.config.bridgeUrl || 'wss://hub.gopherhole.ai/ws';
|
|
283
|
-
// Convert wss:// to https:// for API calls
|
|
284
282
|
const apiBase = hubUrl.replace('wss://', 'https://').replace('/ws', '');
|
|
285
283
|
try {
|
|
286
|
-
const response = await fetch(`${apiBase}/
|
|
284
|
+
const response = await fetch(`${apiBase}/a2a`, {
|
|
285
|
+
method: 'POST',
|
|
287
286
|
headers: {
|
|
288
287
|
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
289
288
|
'Content-Type': 'application/json',
|
|
290
289
|
},
|
|
290
|
+
body: JSON.stringify({
|
|
291
|
+
jsonrpc: '2.0',
|
|
292
|
+
method,
|
|
293
|
+
params: params || {},
|
|
294
|
+
id: Date.now(),
|
|
295
|
+
}),
|
|
291
296
|
});
|
|
292
297
|
if (!response.ok) {
|
|
293
|
-
console.error(`[a2a]
|
|
294
|
-
return
|
|
298
|
+
console.error(`[a2a] RPC failed: ${response.status}`);
|
|
299
|
+
return null;
|
|
295
300
|
}
|
|
296
301
|
const data = await response.json();
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}));
|
|
302
|
+
if (data.error) {
|
|
303
|
+
console.error(`[a2a] RPC error: ${data.error.message}`);
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
return data.result || null;
|
|
303
307
|
}
|
|
304
308
|
catch (err) {
|
|
305
|
-
console.error('[a2a]
|
|
309
|
+
console.error('[a2a] RPC error:', err.message);
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* List available agents from GopherHole (agents you have access to)
|
|
315
|
+
*/
|
|
316
|
+
async listAvailableAgents(options) {
|
|
317
|
+
const result = await this.a2aRpc('x-gopherhole/agents.available', options);
|
|
318
|
+
if (!result?.agents) {
|
|
306
319
|
return [];
|
|
307
320
|
}
|
|
321
|
+
return result.agents.map(a => ({
|
|
322
|
+
id: a.id,
|
|
323
|
+
name: a.name,
|
|
324
|
+
description: a.description,
|
|
325
|
+
verified: a.verified,
|
|
326
|
+
accessType: a.accessType,
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Discover public agents in the marketplace
|
|
331
|
+
*/
|
|
332
|
+
async discoverAgents(options) {
|
|
333
|
+
const result = await this.a2aRpc('x-gopherhole/agents.discover', options);
|
|
334
|
+
return result?.agents || [];
|
|
308
335
|
}
|
|
309
336
|
/**
|
|
310
337
|
* List connection status (for backward compatibility)
|
package/package.json
CHANGED
package/src/connection.ts
CHANGED
|
@@ -343,53 +343,112 @@ export class A2AConnectionManager {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
347
|
-
* Fetches same-tenant agents + agents with approved access + public agents
|
|
346
|
+
* Make an A2A JSON-RPC call
|
|
348
347
|
*/
|
|
349
|
-
async
|
|
350
|
-
id: string;
|
|
351
|
-
name: string;
|
|
352
|
-
description?: string;
|
|
353
|
-
accessType: 'same-tenant' | 'public' | 'granted';
|
|
354
|
-
}>> {
|
|
348
|
+
private async a2aRpc<T>(method: string, params?: Record<string, unknown>): Promise<T | null> {
|
|
355
349
|
if (!this.config.apiKey) {
|
|
356
|
-
return
|
|
350
|
+
return null;
|
|
357
351
|
}
|
|
358
352
|
|
|
359
353
|
const hubUrl = this.config.bridgeUrl || 'wss://hub.gopherhole.ai/ws';
|
|
360
|
-
// Convert wss:// to https:// for API calls
|
|
361
354
|
const apiBase = hubUrl.replace('wss://', 'https://').replace('/ws', '');
|
|
362
355
|
|
|
363
356
|
try {
|
|
364
|
-
const response = await fetch(`${apiBase}/
|
|
357
|
+
const response = await fetch(`${apiBase}/a2a`, {
|
|
358
|
+
method: 'POST',
|
|
365
359
|
headers: {
|
|
366
360
|
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
367
361
|
'Content-Type': 'application/json',
|
|
368
362
|
},
|
|
363
|
+
body: JSON.stringify({
|
|
364
|
+
jsonrpc: '2.0',
|
|
365
|
+
method,
|
|
366
|
+
params: params || {},
|
|
367
|
+
id: Date.now(),
|
|
368
|
+
}),
|
|
369
369
|
});
|
|
370
370
|
|
|
371
371
|
if (!response.ok) {
|
|
372
|
-
console.error(`[a2a]
|
|
373
|
-
return
|
|
372
|
+
console.error(`[a2a] RPC failed: ${response.status}`);
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const data = await response.json() as { result?: T; error?: { message: string } };
|
|
377
|
+
if (data.error) {
|
|
378
|
+
console.error(`[a2a] RPC error: ${data.error.message}`);
|
|
379
|
+
return null;
|
|
374
380
|
}
|
|
375
381
|
|
|
376
|
-
|
|
377
|
-
id: string;
|
|
378
|
-
name: string;
|
|
379
|
-
description?: string;
|
|
380
|
-
access_type: string;
|
|
381
|
-
}> };
|
|
382
|
-
|
|
383
|
-
return data.agents.map(a => ({
|
|
384
|
-
id: a.id,
|
|
385
|
-
name: a.name,
|
|
386
|
-
description: a.description,
|
|
387
|
-
accessType: a.access_type as 'same-tenant' | 'public' | 'granted',
|
|
388
|
-
}));
|
|
382
|
+
return data.result || null;
|
|
389
383
|
} catch (err) {
|
|
390
|
-
console.error('[a2a]
|
|
384
|
+
console.error('[a2a] RPC error:', (err as Error).message);
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* List available agents from GopherHole (agents you have access to)
|
|
391
|
+
*/
|
|
392
|
+
async listAvailableAgents(options?: { query?: string; public?: boolean }): Promise<Array<{
|
|
393
|
+
id: string;
|
|
394
|
+
name: string;
|
|
395
|
+
description?: string;
|
|
396
|
+
verified?: boolean;
|
|
397
|
+
accessType: 'same-tenant' | 'public' | 'granted';
|
|
398
|
+
}>> {
|
|
399
|
+
const result = await this.a2aRpc<{ agents: Array<{
|
|
400
|
+
id: string;
|
|
401
|
+
name: string;
|
|
402
|
+
description?: string;
|
|
403
|
+
verified?: boolean;
|
|
404
|
+
accessType: string;
|
|
405
|
+
}> }>('x-gopherhole/agents.available', options);
|
|
406
|
+
|
|
407
|
+
if (!result?.agents) {
|
|
391
408
|
return [];
|
|
392
409
|
}
|
|
410
|
+
|
|
411
|
+
return result.agents.map(a => ({
|
|
412
|
+
id: a.id,
|
|
413
|
+
name: a.name,
|
|
414
|
+
description: a.description,
|
|
415
|
+
verified: a.verified,
|
|
416
|
+
accessType: a.accessType as 'same-tenant' | 'public' | 'granted',
|
|
417
|
+
}));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Discover public agents in the marketplace
|
|
422
|
+
*/
|
|
423
|
+
async discoverAgents(options?: {
|
|
424
|
+
query?: string;
|
|
425
|
+
category?: string;
|
|
426
|
+
tag?: string;
|
|
427
|
+
skillTag?: string;
|
|
428
|
+
contentMode?: string;
|
|
429
|
+
sort?: string;
|
|
430
|
+
verified?: boolean;
|
|
431
|
+
limit?: number;
|
|
432
|
+
offset?: number;
|
|
433
|
+
scope?: string;
|
|
434
|
+
}): Promise<Array<{
|
|
435
|
+
id: string;
|
|
436
|
+
name: string;
|
|
437
|
+
description?: string;
|
|
438
|
+
verified?: boolean;
|
|
439
|
+
tenantName?: string;
|
|
440
|
+
avgRating?: number;
|
|
441
|
+
}>> {
|
|
442
|
+
const result = await this.a2aRpc<{ agents: Array<{
|
|
443
|
+
id: string;
|
|
444
|
+
name: string;
|
|
445
|
+
description?: string;
|
|
446
|
+
verified?: boolean;
|
|
447
|
+
tenantName?: string;
|
|
448
|
+
avgRating?: number;
|
|
449
|
+
}> }>('x-gopherhole/agents.discover', options);
|
|
450
|
+
|
|
451
|
+
return result?.agents || [];
|
|
393
452
|
}
|
|
394
453
|
|
|
395
454
|
/**
|