a2acalling 0.6.23 → 0.6.24
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/bin/cli.js +23 -2
- package/package.json +1 -1
- package/src/lib/invite-host.js +2 -1
package/bin/cli.js
CHANGED
|
@@ -407,15 +407,36 @@ async function resolveInviteHostname() {
|
|
|
407
407
|
try {
|
|
408
408
|
const { A2AConfig } = require('../src/lib/config');
|
|
409
409
|
const config = new A2AConfig();
|
|
410
|
+
const agent = config.getAgent() || {};
|
|
411
|
+
const onboarding = config.getAll().onboarding || {};
|
|
412
|
+
|
|
413
|
+
// If hostname is set without a port (e.g., "149.28.213.47"), assume port 80
|
|
414
|
+
// (user configured reverse proxy or direct bind to 80)
|
|
415
|
+
// If hostname has a port (e.g., "149.28.213.47:3007"), use that port
|
|
416
|
+
// If no hostname set, use server_port from onboarding
|
|
417
|
+
const hostname = agent.hostname || '';
|
|
418
|
+
const hasExplicitPort = hostname.includes(':') && !hostname.startsWith('[');
|
|
419
|
+
|
|
420
|
+
let defaultPort;
|
|
421
|
+
if (hasExplicitPort) {
|
|
422
|
+
defaultPort = null; // Will be parsed from hostname
|
|
423
|
+
} else if (hostname && !hostname.includes('localhost')) {
|
|
424
|
+
// External hostname without port = assume port 80 (reverse proxy or direct)
|
|
425
|
+
defaultPort = 80;
|
|
426
|
+
} else {
|
|
427
|
+
// Local or no hostname - use actual server port
|
|
428
|
+
defaultPort = onboarding.server_port || process.env.PORT || process.env.A2A_PORT || 80;
|
|
429
|
+
}
|
|
430
|
+
|
|
410
431
|
const resolved = await resolveInviteHost({
|
|
411
432
|
config,
|
|
412
|
-
defaultPort
|
|
433
|
+
defaultPort
|
|
413
434
|
});
|
|
414
435
|
return resolved;
|
|
415
436
|
} catch (err) {
|
|
416
437
|
return resolveInviteHost({
|
|
417
438
|
fallbackHost: process.env.OPENCLAW_HOSTNAME || process.env.HOSTNAME || 'localhost',
|
|
418
|
-
defaultPort: process.env.PORT || process.env.A2A_PORT ||
|
|
439
|
+
defaultPort: process.env.PORT || process.env.A2A_PORT || 80
|
|
419
440
|
});
|
|
420
441
|
}
|
|
421
442
|
}
|
package/package.json
CHANGED
package/src/lib/invite-host.js
CHANGED
|
@@ -74,7 +74,8 @@ function formatHostPort(hostname, port) {
|
|
|
74
74
|
if (!host) return '';
|
|
75
75
|
const needsBrackets = net.isIP(host) === 6;
|
|
76
76
|
const hostPart = needsBrackets ? `[${host}]` : host;
|
|
77
|
-
|
|
77
|
+
// Don't append port 80 (it's the default HTTP port)
|
|
78
|
+
return (p && p !== 80) ? `${hostPart}:${p}` : hostPart;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
function isPrivateIpv4(ip) {
|