a2acalling 0.6.21 → 0.6.22

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.
Files changed (2) hide show
  1. package/bin/cli.js +63 -24
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -1391,35 +1391,74 @@ https://github.com/onthegonow/a2a_calling`;
1391
1391
  if (externalIp) {
1392
1392
  const verifyUrl = `http://${publicHost}/api/a2a/ping`;
1393
1393
  if (serverPort !== 80) {
1394
- // Check what's using port 80
1394
+ // Check what's using port 80 and detect web servers
1395
1395
  const port80Status = await isPortListening(80, '127.0.0.1', { timeoutMs: 250 });
1396
+ const { spawnSync } = require('child_process');
1397
+ const hasNginx = spawnSync('which', ['nginx'], { encoding: 'utf8' }).status === 0;
1398
+ const hasCaddy = spawnSync('which', ['caddy'], { encoding: 'utf8' }).status === 0;
1399
+ const hasSudo = spawnSync('sudo', ['-n', 'true'], { encoding: 'utf8' }).status === 0;
1400
+
1401
+ console.log(`\n ━━━ IMPORTANT: Port Configuration ━━━`);
1402
+ console.log(`\n A2A works best on port 80. Other ports require firewall configuration.`);
1403
+ console.log(` Current: A2A server on port ${serverPort}`);
1396
1404
 
1397
- console.log(`\n ━━━ Reverse Proxy Setup ━━━`);
1398
- console.log(` Server running on port ${serverPort}, but external callers expect port 80/443.`);
1399
1405
  if (port80Status.listening) {
1400
- console.log(` Port 80: in use (likely nginx, caddy, or another web server)`);
1406
+ console.log(` Port 80: IN USE (likely ${hasNginx ? 'nginx' : hasCaddy ? 'caddy' : 'a web server'})`);
1407
+ console.log(`\n RECOMMENDED: Configure reverse proxy to route /api/a2a/* from port 80 to ${serverPort}`);
1408
+ console.log(` This is the easiest option — no firewall changes needed.\n`);
1409
+
1410
+ if (hasNginx) {
1411
+ console.log(` ── nginx config (add to /etc/nginx/sites-available/default) ──`);
1412
+ console.log(` location /api/a2a/ {`);
1413
+ console.log(` proxy_pass http://127.0.0.1:${serverPort}/api/a2a/;`);
1414
+ console.log(` proxy_http_version 1.1;`);
1415
+ console.log(` proxy_set_header Host $host;`);
1416
+ console.log(` proxy_set_header X-Real-IP $remote_addr;`);
1417
+ console.log(` }`);
1418
+ console.log(` ────────────────────────────────────────────────────────────`);
1419
+ console.log(`\n To apply: sudo nano /etc/nginx/sites-available/default`);
1420
+ console.log(` (add the location block inside your server {})`);
1421
+ console.log(` sudo nginx -t && sudo systemctl reload nginx`);
1422
+ }
1423
+
1424
+ if (hasCaddy) {
1425
+ console.log(`\n ── Caddy config ──`);
1426
+ console.log(` handle /api/a2a/* {`);
1427
+ console.log(` reverse_proxy 127.0.0.1:${serverPort}`);
1428
+ console.log(` }`);
1429
+ console.log(` ───────────────────`);
1430
+ }
1431
+
1432
+ console.log(`\n After configuring, your invite hostname should be: ${externalIp}`);
1433
+ console.log(` (port 80 is the default, so no port number needed)`);
1434
+
1435
+ } else {
1436
+ console.log(` Port 80: AVAILABLE`);
1437
+ console.log(`\n RECOMMENDED: Restart A2A on port 80 for easiest setup.`);
1438
+ console.log(` Run: a2a stop && a2a start --port 80`);
1439
+ if (!hasSudo) {
1440
+ console.log(` Note: Port 80 may require sudo. Try: sudo a2a start --port 80`);
1441
+ }
1442
+ }
1443
+
1444
+ console.log(`\n ── Alternative: Firewall route (more complex) ──`);
1445
+ console.log(` If you can't use port 80, open port ${serverPort} in your firewall:`);
1446
+ console.log(` sudo ufw allow ${serverPort}/tcp # Ubuntu/Debian`);
1447
+ console.log(` sudo firewall-cmd --add-port=${serverPort}/tcp --permanent && sudo firewall-cmd --reload # RHEL/CentOS`);
1448
+ console.log(` Your invite will then use: ${publicHost}`);
1449
+
1450
+ console.log(`\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
1451
+ console.log(`\n AGENT ACTION: Configure ingress for A2A to receive external calls.`);
1452
+ console.log(` Options (in order of preference):`);
1453
+ if (!port80Status.listening) {
1454
+ console.log(` 1. Restart on port 80: a2a stop && ${hasSudo ? '' : 'sudo '}a2a start --port 80`);
1455
+ console.log(` 2. Configure firewall for port ${serverPort} (see commands above)`);
1401
1456
  } else {
1402
- console.log(` Port 80: available (but A2A is on ${serverPort})`);
1457
+ console.log(` 1. Add reverse proxy config to ${hasNginx ? 'nginx' : hasCaddy ? 'Caddy' : 'your web server'} (see above)`);
1458
+ console.log(` 2. Configure firewall for port ${serverPort} (see commands above)`);
1403
1459
  }
1404
- console.log(`\n RECOMMENDED: Configure your web server to proxy A2A requests:\n`);
1405
- console.log(` For nginx, add to your server block:`);
1406
- console.log(` location /api/a2a/ {`);
1407
- console.log(` proxy_pass http://127.0.0.1:${serverPort}/api/a2a/;`);
1408
- console.log(` proxy_http_version 1.1;`);
1409
- console.log(` proxy_set_header Host $host;`);
1410
- console.log(` }`);
1411
- console.log(`\n For Caddy:`);
1412
- console.log(` handle /api/a2a/* {`);
1413
- console.log(` reverse_proxy 127.0.0.1:${serverPort}`);
1414
- console.log(` }`);
1415
- console.log(`\n After configuring, update the invite hostname to use port 80:`);
1416
- console.log(` Current: ${publicHost}`);
1417
- console.log(` Should be: ${externalIp} (without port, defaults to 80)`);
1418
- console.log(`\n Or open port ${serverPort} directly in your firewall if no proxy is used.`);
1419
- console.log(` ━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
1420
- console.log(`\n ACTION REQUIRED: Ask your owner if they want to configure a reverse proxy.`);
1421
- console.log(` If they say yes, help them add the nginx/caddy config above.`);
1422
- console.log(` If they say no or skip, the invite will use port ${serverPort} directly.`);
1460
+ console.log(` 3. Skip (local-only testing, external agents won't be able to call)`);
1461
+ console.log(`\n Ask your owner which option to proceed with.`);
1423
1462
  }
1424
1463
  console.log(`\n Verify: curl -s ${verifyUrl}`);
1425
1464
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a2acalling",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "description": "Agent-to-agent calling for OpenClaw - A2A agent communication",
5
5
  "main": "src/index.js",
6
6
  "bin": {