mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-13 06:40:33 -07:00
Add a2a-server package to gemini-cli (#6597)
This commit is contained in:
33
packages/a2a-server/src/server.ts
Normal file
33
packages/a2a-server/src/server.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import * as url from 'node:url';
|
||||
import * as path from 'node:path';
|
||||
|
||||
import { logger } from './logger.js';
|
||||
import { main } from './agent.js';
|
||||
|
||||
// Check if the module is the main script being run. path.resolve() creates a
|
||||
// canonical, absolute path, which avoids cross-platform issues.
|
||||
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);
|
||||
});
|
||||
|
||||
if (
|
||||
import.meta.url.startsWith('file:') &&
|
||||
isMainModule &&
|
||||
process.env['NODE_ENV'] !== 'test'
|
||||
) {
|
||||
main().catch((error) => {
|
||||
logger.error('[CoreAgent] Unhandled error in main:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user