chore: add a2a server bin (#10592)

This commit is contained in:
Adam Weidman
2025-10-10 01:47:18 +02:00
committed by GitHub
parent 83075b2800
commit c82c2c2b15
3 changed files with 18 additions and 11 deletions
+10 -9
View File
@@ -1,3 +1,5 @@
#!/usr/bin/env node
/**
* @license
* Copyright 2025 Google LLC
@@ -10,22 +12,21 @@ import * as path from 'node:path';
import { logger } from '../utils/logger.js';
import { main } from './app.js';
// Check if the module is the main script being run. path.resolve() creates a
// canonical, absolute path, which avoids cross-platform issues.
// Check if the module is the main script being run
const isMainModule =
path.resolve(process.argv[1]) ===
path.resolve(url.fileURLToPath(import.meta.url));
process.on('uncaughtException', (error) => {
logger.error('Unhandled exception:', error);
process.exit(1);
});
path.basename(process.argv[1]) ===
path.basename(url.fileURLToPath(import.meta.url));
if (
import.meta.url.startsWith('file:') &&
isMainModule &&
process.env['NODE_ENV'] !== 'test'
) {
process.on('uncaughtException', (error) => {
logger.error('Unhandled exception:', error);
process.exit(1);
});
main().catch((error) => {
logger.error('[CoreAgent] Unhandled error in main:', error);
process.exit(1);