a2acalling 0.6.25 → 0.6.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a2acalling",
3
- "version": "0.6.25",
3
+ "version": "0.6.27",
4
4
  "description": "Agent-to-agent calling for OpenClaw - A2A agent communication",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -465,10 +465,26 @@ function createDashboardApiRouter(options = {}) {
465
465
  let warnings = [];
466
466
  let inviteResolution = null;
467
467
  try {
468
+ // Determine default port based on config hostname:
469
+ // - If hostname has no port (e.g., "149.28.213.47"), assume port 80 (reverse proxy)
470
+ // - If hostname has explicit port, use that
471
+ // - Otherwise fall back to server port or env
472
+ const agent = context.config?.getAgent?.() || {};
473
+ const hostname = agent.hostname || '';
474
+ const hasExplicitPort = hostname.includes(':') && !hostname.startsWith('[');
475
+ let defaultPort;
476
+ if (hasExplicitPort) {
477
+ defaultPort = null; // Will be parsed from hostname
478
+ } else if (hostname && !hostname.includes('localhost')) {
479
+ defaultPort = 80; // External hostname without port = assume reverse proxy on 80
480
+ } else {
481
+ defaultPort = process.env.PORT || process.env.A2A_PORT || 80;
482
+ }
483
+
468
484
  const resolved = await resolveInviteHost({
469
485
  config: context.config,
470
486
  fallbackHost: req.headers.host || process.env.HOSTNAME || 'localhost',
471
- defaultPort: process.env.PORT || process.env.A2A_PORT || 3001,
487
+ defaultPort,
472
488
  refreshExternalIp: refreshIp,
473
489
  forceRefreshExternalIp: refreshIp,
474
490
  alwaysLookupExternalIp: true,
@@ -502,7 +518,7 @@ function createDashboardApiRouter(options = {}) {
502
518
  manifest_file: require('../lib/disclosure').MANIFEST_FILE,
503
519
  public_base_url: publicBaseUrl,
504
520
  public_dashboard_url: publicBaseUrl ? `${publicBaseUrl}/dashboard/` : null,
505
- callbook_install_base: publicBaseUrl ? `${publicBaseUrl}/callbook/install` : null,
521
+ callbook_install_base: publicBaseUrl ? `${publicBaseUrl}/api/a2a/callbook/install` : null,
506
522
  invite_host: inviteResolution ? {
507
523
  host: inviteResolution.host,
508
524
  source: inviteResolution.source || null,
@@ -554,10 +570,23 @@ function createDashboardApiRouter(options = {}) {
554
570
  let resolvedHost = null;
555
571
  let warnings = [];
556
572
  try {
573
+ // Use same port logic as /status endpoint
574
+ const agent = context.config?.getAgent?.() || {};
575
+ const hostname = agent.hostname || '';
576
+ const hasExplicitPort = hostname.includes(':') && !hostname.startsWith('[');
577
+ let defaultPort;
578
+ if (hasExplicitPort) {
579
+ defaultPort = null;
580
+ } else if (hostname && !hostname.includes('localhost')) {
581
+ defaultPort = 80;
582
+ } else {
583
+ defaultPort = process.env.PORT || process.env.A2A_PORT || 80;
584
+ }
585
+
557
586
  const resolved = await resolveInviteHost({
558
587
  config: context.config,
559
588
  fallbackHost: req.headers.host || process.env.HOSTNAME || 'localhost',
560
- defaultPort: process.env.PORT || process.env.A2A_PORT || 3001,
589
+ defaultPort,
561
590
  refreshExternalIp: true,
562
591
  forceRefreshExternalIp: true
563
592
  });
@@ -570,7 +599,7 @@ function createDashboardApiRouter(options = {}) {
570
599
  const schemeOverride = String(process.env.A2A_PUBLIC_SCHEME || '').trim();
571
600
  const scheme = schemeOverride || (isHttpsRequest(req) ? 'https' : 'http');
572
601
  const baseUrl = resolvedHost ? `${scheme}://${resolvedHost}` : null;
573
- const installUrl = baseUrl ? `${baseUrl}/callbook/install#code=${created.code}` : null;
602
+ const installUrl = baseUrl ? `${baseUrl}/api/a2a/callbook/install#code=${created.code}` : null;
574
603
 
575
604
  return res.json({
576
605
  success: true,
package/src/server.js CHANGED
@@ -717,18 +717,28 @@ const app = express();
717
717
  app.use(express.json());
718
718
 
719
719
  // Minimal owner dashboard (local by default unless A2A_ADMIN_TOKEN is provided)
720
+ // All routes under /api/a2a/* so reverse proxy config stays simple.
720
721
  app.use('/api/a2a/dashboard', createDashboardApiRouter({
721
722
  tokenStore,
722
723
  agentContext,
723
724
  logger: logger.child({ component: 'a2a.dashboard' })
724
725
  }));
725
- app.use('/dashboard', createDashboardUiRouter({
726
+ app.use('/api/a2a/dashboard', createDashboardUiRouter({
726
727
  tokenStore,
727
728
  agentContext,
728
729
  logger: logger.child({ component: 'a2a.dashboard' })
729
730
  }));
730
731
 
731
732
  // Callbook Remote pairing flow (public install page).
733
+ // Mounted under /api/a2a/ for reverse proxy compatibility.
734
+ app.use('/api/a2a/callbook', createCallbookRouter());
735
+
736
+ // Legacy routes for backwards compatibility (direct access without reverse proxy)
737
+ app.use('/dashboard', createDashboardUiRouter({
738
+ tokenStore,
739
+ agentContext,
740
+ logger: logger.child({ component: 'a2a.dashboard' })
741
+ }));
732
742
  app.use('/callbook', createCallbookRouter());
733
743
 
734
744
  app.use('/api/a2a', createRoutes({