vibelet 0.1.11 → 0.1.13

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/bin/vibelet.mjs CHANGED
@@ -587,17 +587,19 @@ async function main() {
587
587
 
588
588
  if (command === 'stop') {
589
589
  process.stdout.write('Stopping vibelet daemon...\n');
590
+ // Always try graceful HTTP shutdown first — gives the daemon time to
591
+ // close sessions and flush logs before the service manager kills it.
592
+ await requestShutdown();
590
593
  if (backend.handlesProcessLifecycle) {
591
- // macOS launchd / Linux systemd: the service manager owns the process.
592
- // bootout/stop kills the process and unregisters the service in one step.
594
+ // macOS launchd / Linux systemd: unregister the service.
593
595
  backend.stop();
594
596
  } else {
595
- // Detached process: gracefully shut down via HTTP, then clean up PID file.
596
- await requestShutdown();
597
+ // Detached process: clean up PID file.
597
598
  backend.stop();
598
599
  }
599
- // Verify daemon is actually gone
600
- const stillAlive = await probeHealth(1_500);
600
+ // Verify daemon is actually gone (daemon's own shutdown timeout is 3s,
601
+ // plus a small margin for process teardown).
602
+ const stillAlive = await probeHealth(5_000);
601
603
  if (stillAlive) {
602
604
  fail('Daemon did not stop in time.');
603
605
  }
@@ -645,12 +647,8 @@ async function main() {
645
647
 
646
648
  if (command === 'restart') {
647
649
  process.stdout.write('Restarting vibelet daemon...\n');
648
- if (backend.handlesProcessLifecycle) {
649
- backend.stop();
650
- } else {
651
- await requestShutdown();
652
- backend.stop();
653
- }
650
+ await requestShutdown();
651
+ backend.stop();
654
652
  // Wait for daemon to actually stop
655
653
  const stillAlive = await probeHealth(5_000);
656
654
  if (stillAlive) {