File size: 754 Bytes
ccb6b75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import HumanBehaviorEngine from './index.js';
import logger from './utils/logger.js';
import figlet from 'figlet';
import chalk from 'chalk';

async function main() {
  console.log(
    chalk.cyan(
      figlet.textSync('Human Sim', { font: 'Standard', horizontalLayout: 'default' })
    )
  );

  const engine = new HumanBehaviorEngine();

  process.on('SIGINT', async () => {
    console.log('\nShutting down...');
    await engine.stop();
    process.exit(0);
  });

  process.on('SIGTERM', async () => {
    logger.info('Received SIGTERM, shutting down');
    await engine.stop();
    process.exit(0);
  });

  try {
    await engine.start();
  } catch (error) {
    logger.error(`Fatal error: ${error.message}`);
    process.exit(1);
  }
}

main();