()
| 56 | } |
| 57 | |
| 58 | async function main() { |
| 59 | const hubUrl = process.env.A2A_HUB_URL || process.env.EVOMAP_HUB_URL; |
| 60 | if (!hubUrl) { |
| 61 | console.error('[Seed] A2A_HUB_URL or EVOMAP_HUB_URL is required.'); |
| 62 | process.exit(1); |
| 63 | } |
| 64 | |
| 65 | console.log('[Seed] Hub:', hubUrl); |
| 66 | console.log('[Seed] Starting merchant with', SEED_SERVICES.length, 'services...'); |
| 67 | |
| 68 | await merchantAgent.start({ |
| 69 | services: SEED_SERVICES, |
| 70 | onOrder: handleOrder, |
| 71 | pollMs: 30000, |
| 72 | }); |
| 73 | |
| 74 | console.log('[Seed] Merchant started. Polling for orders. Press Ctrl+C to stop.'); |
| 75 | |
| 76 | process.on('SIGINT', () => { |
| 77 | console.log('\n[Seed] Shutting down...'); |
| 78 | merchantAgent.stop(); |
| 79 | process.exit(0); |
| 80 | }); |
| 81 | |
| 82 | process.on('SIGTERM', () => { |
| 83 | merchantAgent.stop(); |
| 84 | process.exit(0); |
| 85 | }); |
| 86 | } |
| 87 | |
| 88 | main().catch((err) => { |
| 89 | console.error('[Seed] Fatal:', err.message || err); |
no test coverage detected