@team-agent/installer 0.5.20 → 0.5.21

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/Cargo.lock CHANGED
@@ -575,7 +575,7 @@ dependencies = [
575
575
 
576
576
  [[package]]
577
577
  name = "team-agent"
578
- version = "0.5.20"
578
+ version = "0.5.21"
579
579
  dependencies = [
580
580
  "anyhow",
581
581
  "chrono",
package/Cargo.toml CHANGED
@@ -9,7 +9,7 @@ members = ["crates/team-agent", "crates/win-conpty-phase0", "crates/conpty-trans
9
9
 
10
10
  [workspace.package]
11
11
  edition = "2021"
12
- version = "0.5.20"
12
+ version = "0.5.21"
13
13
  license = "AGPL-3.0"
14
14
  rust-version = "1.95"
15
15
 
@@ -552,7 +552,19 @@ fn sleep_seconds(seconds: f64) {
552
552
  if seconds <= 0.0 {
553
553
  return;
554
554
  }
555
- std::thread::sleep(std::time::Duration::from_secs_f64(seconds));
555
+ let deadline = std::time::Instant::now() + std::time::Duration::from_secs_f64(seconds);
556
+ loop {
557
+ #[cfg(unix)]
558
+ if SIGNAL_STOP_REQUESTED.load(std::sync::atomic::Ordering::SeqCst) {
559
+ return;
560
+ }
561
+ let now = std::time::Instant::now();
562
+ if now >= deadline {
563
+ return;
564
+ }
565
+ let remaining = deadline.saturating_duration_since(now);
566
+ std::thread::sleep(remaining.min(std::time::Duration::from_millis(100)));
567
+ }
556
568
  }
557
569
 
558
570
  /// 子进程退出错误(daemon bin 顶层用 anyhow,但 lib 入口仍给 typed)。
@@ -661,4 +673,22 @@ mod tests {
661
673
  "panic marker must carry a backtrace; event={panic_event}"
662
674
  );
663
675
  }
676
+
677
+ #[cfg(unix)]
678
+ #[test]
679
+ fn signal_stop_request_interrupts_daemon_sleep_without_consuming_signal() {
680
+ SIGNAL_STOP_NUMBER.store(libc::SIGTERM, std::sync::atomic::Ordering::SeqCst);
681
+ SIGNAL_STOP_REQUESTED.store(true, std::sync::atomic::Ordering::SeqCst);
682
+
683
+ let started = std::time::Instant::now();
684
+ sleep_seconds(1.0);
685
+ let elapsed = started.elapsed();
686
+ let signal = take_signal_stop_request();
687
+
688
+ assert_eq!(signal, Some("SIGTERM"));
689
+ assert!(
690
+ elapsed < std::time::Duration::from_millis(500),
691
+ "daemon sleep must wake promptly after SIGTERM stop flag; elapsed={elapsed:?}"
692
+ );
693
+ }
664
694
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-agent/installer",
3
- "version": "0.5.20",
3
+ "version": "0.5.21",
4
4
  "description": "npx installer for Team Agent",
5
5
  "keywords": [
6
6
  "codex",
@@ -20,9 +20,9 @@
20
20
  "team-agent-installer": "npm/install.mjs"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@team-agent/cli-darwin-arm64": "0.5.20",
24
- "@team-agent/cli-darwin-x64": "0.5.20",
25
- "@team-agent/cli-linux-x64": "0.5.20"
23
+ "@team-agent/cli-darwin-arm64": "0.5.21",
24
+ "@team-agent/cli-darwin-x64": "0.5.21",
25
+ "@team-agent/cli-linux-x64": "0.5.21"
26
26
  },
27
27
  "scripts": {
28
28
  "postinstall": "node npm/bincheck.mjs",