apexbot 1.0.1 → 1.0.2

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/dist/cli/index.js CHANGED
@@ -181,7 +181,7 @@ you log in on this machine, or a bot account like Telegram/Discord).
181
181
  ${chalk.yellow("If you're new to this, start with Ollama and least privilege.")} It helps limit what
182
182
  an agent can do if it's tricked or makes a mistake.
183
183
 
184
- ${chalk.cyan('Good news:')} ApexBot uses ${chalk.green('Ollama (local AI)')} by default — your data never leaves
184
+ ${chalk.cyan('Good news:')} ApexBot uses ${chalk.green('Ollama (local AI)')} by default — your data never leaves
185
185
  your computer. No cloud APIs, no tracking, 100% private and FREE.`);
186
186
  console.log('');
187
187
  const { continueSetup } = await inquirer.prompt([{
@@ -339,9 +339,9 @@ Configure at least one channel to start chatting.`);
339
339
  name: 'channels',
340
340
  message: 'Select channels to configure (space to toggle, enter to confirm):',
341
341
  choices: [
342
- { name: '📱 Telegram', value: 'telegram' },
343
- { name: '🎮 Discord', value: 'discord' },
344
- { name: '🌐 WebChat (built-in)', value: 'webchat' },
342
+ { name: 'Telegram', value: 'telegram' },
343
+ { name: 'Discord', value: 'discord' },
344
+ { name: 'WebChat (built-in)', value: 'webchat' },
345
345
  ],
346
346
  validate: (input) => {
347
347
  if (input.length === 0) {
@@ -413,15 +413,15 @@ WebChat UI will be available at http://localhost:<port>/chat`);
413
413
  console.log('');
414
414
  console.log(chalk.gray('─'.repeat(60)));
415
415
  console.log('');
416
- showBox(`${chalk.green('Configuration saved!')}
416
+ showBox(`${chalk.green('Configuration saved!')}
417
417
 
418
- Config file: ${chalk.cyan(CONFIG_FILE)}`, '🎉 Setup Complete!');
418
+ Config file: ${chalk.cyan(CONFIG_FILE)}`, 'Setup Complete');
419
419
  console.log('');
420
420
  // Ask to start gateway immediately
421
421
  const { startNow } = await inquirer.prompt([{
422
422
  type: 'confirm',
423
423
  name: 'startNow',
424
- message: chalk.yellow('🚀 Start ApexBot gateway now?'),
424
+ message: chalk.yellow('Start ApexBot gateway now?'),
425
425
  default: true,
426
426
  }]);
427
427
  if (startNow) {
@@ -467,7 +467,7 @@ async function startGatewayServer(config, options = {}) {
467
467
  await gateway.start();
468
468
  await gateway.channels.connectAll();
469
469
  console.log('');
470
- console.log(chalk.green('ApexBot is running!'));
470
+ console.log(chalk.green('ApexBot is running!'));
471
471
  console.log('');
472
472
  console.log(` ${chalk.cyan('Dashboard:')} http://127.0.0.1:${port}/chat`);
473
473
  console.log(` ${chalk.cyan('API:')} http://127.0.0.1:${port}`);
@@ -478,7 +478,7 @@ async function startGatewayServer(config, options = {}) {
478
478
  // Handle shutdown
479
479
  process.on('SIGINT', async () => {
480
480
  console.log('');
481
- console.log(chalk.yellow('🛑 Shutting down...'));
481
+ console.log(chalk.yellow('Shutting down...'));
482
482
  await gateway.stop();
483
483
  process.exit(0);
484
484
  });
@@ -497,7 +497,7 @@ program
497
497
  const config = loadConfig();
498
498
  if (!config.agent?.provider) {
499
499
  console.log('');
500
- console.log(chalk.yellow('⚠️ ApexBot is not configured yet.'));
500
+ console.log(chalk.yellow('ApexBot is not configured yet.'));
501
501
  console.log('');
502
502
  console.log(`Run ${chalk.green('apexbot onboard')} to set up your bot.`);
503
503
  console.log('');
@@ -520,12 +520,12 @@ program
520
520
  // Check config
521
521
  const hasConfig = fs.existsSync(CONFIG_FILE);
522
522
  // Check Ollama
523
- let ollamaStatus = 'Not checked';
523
+ let ollamaStatus = 'Not checked';
524
524
  if (config.agent?.provider === 'ollama') {
525
525
  const ollama = await checkOllama(config.agent.apiUrl || 'http://localhost:11434');
526
526
  ollamaStatus = ollama.running
527
- ? chalk.green(`✅ Running (${ollama.models.length} models)`)
528
- : chalk.red('Not running');
527
+ ? chalk.green(`Running (${ollama.models.length} models)`)
528
+ : chalk.red('Not running');
529
529
  }
530
530
  // Check gateway
531
531
  let gatewayStatus = chalk.gray('Not running');
@@ -534,7 +534,7 @@ program
534
534
  const res = await fetch(`http://127.0.0.1:${port}/health`);
535
535
  if (res.ok) {
536
536
  const data = await res.json();
537
- gatewayStatus = chalk.green(`✅ Running (${data.sessions} sessions)`);
537
+ gatewayStatus = chalk.green(`Running (${data.sessions} sessions)`);
538
538
  }
539
539
  }
540
540
  catch (e) {
@@ -543,7 +543,7 @@ program
543
543
  spinner.stop();
544
544
  console.log(chalk.cyan('Status:'));
545
545
  console.log('');
546
- console.log(` Config: ${hasConfig ? chalk.green('✅ ' + CONFIG_FILE) : chalk.yellow('⚠️ Not configured')}`);
546
+ console.log(` Config: ${hasConfig ? chalk.green(CONFIG_FILE) : chalk.yellow('Not configured')}`);
547
547
  console.log(` Provider: ${config.agent?.provider || chalk.gray('None')}`);
548
548
  console.log(` Model: ${config.agent?.model || chalk.gray('None')}`);
549
549
  console.log(` Ollama: ${ollamaStatus}`);
@@ -575,7 +575,7 @@ program
575
575
  if (fs.existsSync(CONFIG_FILE)) {
576
576
  fs.unlinkSync(CONFIG_FILE);
577
577
  }
578
- console.log(chalk.green('Configuration reset.'));
578
+ console.log(chalk.green('Configuration reset.'));
579
579
  console.log(`Run ${chalk.cyan('apexbot onboard')} to set up again.`);
580
580
  }
581
581
  return;
@@ -625,7 +625,7 @@ program
625
625
  console.log(stdout);
626
626
  if (stderr)
627
627
  console.log(stderr);
628
- console.log(chalk.green('Model pulled successfully!'));
628
+ console.log(chalk.green('Model pulled successfully!'));
629
629
  });
630
630
  return;
631
631
  }
@@ -634,7 +634,7 @@ program
634
634
  spinner.stop();
635
635
  if (!ollama.running) {
636
636
  console.log('');
637
- console.log(chalk.red('Ollama is not running.'));
637
+ console.log(chalk.red('Ollama is not running.'));
638
638
  console.log(chalk.gray('Start it with: ollama serve'));
639
639
  console.log('');
640
640
  return;
@@ -677,7 +677,7 @@ program
677
677
  try {
678
678
  process.kill(parseInt(oldPid), 0);
679
679
  console.log('');
680
- console.log(chalk.yellow(`⚠️ Daemon already running (PID: ${oldPid})`));
680
+ console.log(chalk.yellow(`Daemon already running (PID: ${oldPid})`));
681
681
  console.log(chalk.gray(`Use 'apexbot daemon restart' to restart.`));
682
682
  console.log('');
683
683
  return;
@@ -688,23 +688,24 @@ program
688
688
  }
689
689
  }
690
690
  console.log('');
691
- console.log(chalk.cyan('🚀 Starting ApexBot daemon...'));
691
+ console.log(chalk.cyan('Starting ApexBot daemon...'));
692
692
  // Spawn detached process (cross-platform)
693
693
  // Use 'apexbot gateway' command directly - works with global npm install
694
694
  const { spawn } = require('child_process');
695
695
  const out = fs.openSync(logFile, 'a');
696
696
  const err = fs.openSync(logFile, 'a');
697
697
  const isWindows = process.platform === 'win32';
698
- const child = spawn(isWindows ? 'cmd.exe' : '/bin/sh', isWindows
698
+ const child = spawn(isWindows ? process.env.ComSpec || 'cmd.exe' : '/bin/sh', isWindows
699
699
  ? ['/c', 'apexbot', 'gateway']
700
700
  : ['-c', 'apexbot gateway'], {
701
701
  detached: true,
702
702
  stdio: ['ignore', out, err],
703
703
  shell: false,
704
+ windowsHide: true, // Hide console window on Windows
704
705
  });
705
706
  fs.writeFileSync(pidFile, String(child.pid));
706
707
  child.unref();
707
- console.log(chalk.green(`✅ Daemon started (PID: ${child.pid})`));
708
+ console.log(chalk.green('Daemon started (PID: ' + child.pid + ')'));
708
709
  console.log('');
709
710
  console.log(` ${chalk.cyan('Dashboard:')} http://127.0.0.1:${config.gateway?.port || 18789}/chat`);
710
711
  console.log(` ${chalk.cyan('Logs:')} ${logFile}`);
@@ -717,25 +718,25 @@ program
717
718
  case 'stop': {
718
719
  if (!fs.existsSync(pidFile)) {
719
720
  console.log('');
720
- console.log(chalk.yellow('⚠️ Daemon is not running.'));
721
+ console.log(chalk.yellow('Daemon is not running.'));
721
722
  console.log('');
722
723
  return;
723
724
  }
724
725
  const pid = parseInt(fs.readFileSync(pidFile, 'utf8').trim());
725
726
  console.log('');
726
- console.log(chalk.cyan(`🛑 Stopping daemon (PID: ${pid})...`));
727
+ console.log(chalk.cyan(`Stopping daemon (PID: ${pid})...`));
727
728
  try {
728
729
  process.kill(pid, 'SIGTERM');
729
730
  fs.unlinkSync(pidFile);
730
- console.log(chalk.green('Daemon stopped.'));
731
+ console.log(chalk.green('Daemon stopped.'));
731
732
  }
732
733
  catch (e) {
733
734
  if (e.code === 'ESRCH') {
734
735
  fs.unlinkSync(pidFile);
735
- console.log(chalk.yellow('⚠️ Daemon was not running (stale PID file removed).'));
736
+ console.log(chalk.yellow('Daemon was not running (stale PID file removed).'));
736
737
  }
737
738
  else {
738
- console.log(chalk.red(`❌ Failed to stop daemon: ${e.message}`));
739
+ console.log(chalk.red(`Failed to stop daemon: ${e.message}`));
739
740
  }
740
741
  }
741
742
  console.log('');
@@ -743,7 +744,7 @@ program
743
744
  }
744
745
  case 'restart': {
745
746
  console.log('');
746
- console.log(chalk.cyan('🔄 Restarting daemon...'));
747
+ console.log(chalk.cyan('Restarting daemon...'));
747
748
  // Stop first
748
749
  if (fs.existsSync(pidFile)) {
749
750
  const pid = parseInt(fs.readFileSync(pidFile, 'utf8').trim());
@@ -761,16 +762,17 @@ program
761
762
  const out = fs.openSync(logFile, 'a');
762
763
  const err = fs.openSync(logFile, 'a');
763
764
  const isWindows = process.platform === 'win32';
764
- const child = spawn(isWindows ? 'cmd.exe' : '/bin/sh', isWindows
765
+ const child = spawn(isWindows ? process.env.ComSpec || 'cmd.exe' : '/bin/sh', isWindows
765
766
  ? ['/c', 'apexbot', 'gateway']
766
767
  : ['-c', 'apexbot gateway'], {
767
768
  detached: true,
768
769
  stdio: ['ignore', out, err],
769
770
  shell: false,
771
+ windowsHide: true,
770
772
  });
771
773
  fs.writeFileSync(pidFile, String(child.pid));
772
774
  child.unref();
773
- console.log(chalk.green(`✅ Daemon restarted (PID: ${child.pid})`));
775
+ console.log(chalk.green('Daemon restarted (PID: ' + child.pid + ')'));
774
776
  console.log('');
775
777
  break;
776
778
  }
@@ -779,7 +781,7 @@ program
779
781
  console.log(chalk.cyan(MINI_LOGO));
780
782
  console.log('');
781
783
  if (!fs.existsSync(pidFile)) {
782
- console.log(chalk.yellow('⚠️ Daemon is not running.'));
784
+ console.log(chalk.yellow('Daemon is not running.'));
783
785
  console.log('');
784
786
  console.log(chalk.gray('Start with: apexbot daemon start'));
785
787
  console.log('');
@@ -795,7 +797,7 @@ program
795
797
  isRunning = false;
796
798
  }
797
799
  if (isRunning) {
798
- console.log(chalk.green(`✅ Daemon is running (PID: ${pid})`));
800
+ console.log(chalk.green('Daemon is running (PID: ' + pid + ')'));
799
801
  console.log('');
800
802
  // Try to get status from gateway
801
803
  try {
@@ -811,7 +813,7 @@ program
811
813
  }
812
814
  }
813
815
  else {
814
- console.log(chalk.yellow('⚠️ Daemon process died (cleaning up PID file).'));
816
+ console.log(chalk.yellow('Daemon process died (cleaning up PID file).'));
815
817
  fs.unlinkSync(pidFile);
816
818
  }
817
819
  console.log('');