Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
refactor(cua-driver): share time and process parsing helpers (#4140)
Francesco Bonaccif9b9c9524a23
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/health_report.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/health_report.rsindex 8fe4e81f43..34a61b0a0b 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/health_report.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/health_report.rs@@ -193,6 +193,22 @@ impl CheckEntry {}self}++ /// The `binary_version` check. The version is a compiled-in constant, so+ /// reaching this code already implies the binary built; it always passes.+ pub fn binary_version() -> Self {+ Self::pass(+ NAME_BINARY_VERSION,+ format!("cua-driver {}", env!("CARGO_PKG_VERSION")),+ )+ }++ /// The `session_active` check. The server is servicing this MCP call, so+ /// by construction the session is up. The check exists so consumers can+ /// hard-code a canonical "is the server reachable?" signal.+ pub fn session_active() -> Self {+ Self::pass(NAME_SESSION_ACTIVE, "MCP session is active.")+ }}/// Top-level `health_report` payload.@@ -471,6 +487,22 @@ mod tests {use super::*;use serde_json::json;+ #[test]+ fn shared_constant_checks_always_pass_with_canonical_names() {+ let version = CheckEntry::binary_version();+ assert_eq!(version.name, NAME_BINARY_VERSION);+ assert_eq!(version.status, CheckStatus::Pass);+ assert_eq!(+ version.message,+ format!("cua-driver {}", env!("CARGO_PKG_VERSION"))+ );++ let session = CheckEntry::session_active();+ assert_eq!(session.name, NAME_SESSION_ACTIVE);+ assert_eq!(session.status, CheckStatus::Pass);+ assert_eq!(session.message, "MCP session is active.");+ }+// A platform-agnostic fixture provider used to exercise the// dispatcher, filter, and rollup logic without touching any real// TCC / UIA / SCK plumbing.diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rsindex c718b2d91b..7ce702bebc 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/lib.rs@@ -89,6 +89,7 @@ pub mod session_tools;pub(crate) mod snapshot_test_support;pub mod socket_io;pub mod text_sanitize;+pub mod timestamp;pub mod tool;pub mod tool_args;pub mod tool_schema;diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/timestamp.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/timestamp.rsnew file mode 100644index 0000000000..d8ea2b463b--- /dev/null+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/timestamp.rs@@ -0,0 +1,43 @@+//! Wire timestamps shared by every platform adapter.++use time::{format_description::well_known::Rfc3339, OffsetDateTime};++/// Format Unix epoch seconds as RFC 3339 UTC with whole seconds:+/// `YYYY-MM-DDTHH:MM:SSZ`.+///+/// Returns `None` when the instant is outside the range RFC 3339 can+/// represent (years 0000 through 9999).+pub fn unix_secs_to_rfc3339(secs: i64) -> Option<String> {+ OffsetDateTime::from_unix_timestamp(secs)+ .ok()?+ .format(&Rfc3339)+ .ok()+}++#[cfg(test)]+mod tests {+ use super::unix_secs_to_rfc3339;++ #[test]+ fn formats_whole_second_utc_timestamps() {+ for (secs, expected) in [+ (0, "1970-01-01T00:00:00Z"),+ // Pre-epoch.+ (-1, "1969-12-31T23:59:59Z"),+ (-365 * 86_400, "1969-01-01T00:00:00Z"),+ // Leap day, and the day after Feb 28 in a non-leap year.+ (1_582_977_600, "2020-02-29T12:00:00Z"),+ (1_551_312_000, "2019-02-28T00:00:00Z"),+ (1_551_312_000 + 86_400, "2019-03-01T00:00:00Z"),+ // Year wrap.+ (1_704_067_199, "2023-12-31T23:59:59Z"),+ (1_704_067_200, "2024-01-01T00:00:00Z"),+ (1_718_459_130, "2024-06-15T13:45:30Z"),+ (647_105_400, "1990-07-04T15:30:00Z"),+ (1_234_567_890, "2009-02-13T23:31:30Z"),+ ] {+ assert_eq!(unix_secs_to_rfc3339(secs).as_deref(), Some(expected));+ }+ assert_eq!(unix_secs_to_rfc3339(i64::MAX), None);+ }+}diff --git a/libs/cua-driver/rust/crates/platform-linux/src/browser_platform.rs b/libs/cua-driver/rust/crates/platform-linux/src/browser_platform.rsindex 93adaaa529..a0588380a7 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/browser_platform.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/browser_platform.rs@@ -389,25 +389,12 @@ fn process_identity(pid: i64) -> Result<(u64, Option<String>), BrowserRefusal> {format!("browser process {pid} is no longer available"),)})?;- let tail = stat- .rsplit_once(')')- .map(|(_, tail)| tail.trim())- .ok_or_else(|| {- refusal(- BrowserRefusalCode::BrowserRouteUnavailable,- format!("could not parse process identity for pid {pid}"),- )- })?;- let started = tail- .split_whitespace()- .nth(19)- .and_then(|value| value.parse::<u64>().ok())- .ok_or_else(|| {- refusal(- BrowserRefusalCode::BrowserRouteUnavailable,- format!("could not parse process start time for pid {pid}"),- )- })?;+ let started = crate::proc_fs::process_start_time_from_stat(&stat).ok_or_else(|| {+ refusal(+ BrowserRefusalCode::BrowserRouteUnavailable,+ format!("could not parse process start time for pid {pid}"),+ )+ })?;let executable = std::fs::read_link(format!("/proc/{pid}/exe")).ok().map(|path| path.to_string_lossy().into_owned());diff --git a/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs b/libs/cua-driver/rust/crates/platform-linux/src/health_report.rsindex f19300fef8..1a8641f7dc 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs@@ -50,9 +50,9 @@ impl HealthCheckProvider for LinuxHealthProvider {async fn run_check(&self, name: &str) -> CheckEntry {match name {- NAME_BINARY_VERSION => check_binary_version(),+ NAME_BINARY_VERSION => CheckEntry::binary_version(),NAME_PLATFORM_SUPPORTED => check_platform_supported(),- NAME_SESSION_ACTIVE => check_session_active(),+ NAME_SESSION_ACTIVE => CheckEntry::session_active(),NAME_BUNDLE_IDENTITY => skip_not_applicable(NAME_BUNDLE_IDENTITY),NAME_TCC_ACCESSIBILITY => skip_not_applicable(NAME_TCC_ACCESSIBILITY),NAME_TCC_SCREEN_RECORDING => skip_not_applicable(NAME_TCC_SCREEN_RECORDING),@@ -69,13 +69,6 @@ impl HealthCheckProvider for LinuxHealthProvider {// ── Individual checks ────────────────────────────────────────────────────────-pub(crate) fn check_binary_version() -> CheckEntry {- CheckEntry::pass(- NAME_BINARY_VERSION,- format!("cua-driver {}", env!("CARGO_PKG_VERSION")),- )-}-pub(crate) fn check_platform_supported() -> CheckEntry {let arch = arch_label();let os_version = os_release_pretty_name().unwrap_or_else(|| "Linux".to_owned());@@ -88,10 +81,6 @@ pub(crate) fn check_platform_supported() -> CheckEntry {)}-pub(crate) fn check_session_active() -> CheckEntry {- CheckEntry::pass(NAME_SESSION_ACTIVE, "MCP session is active.")-}-fn skip_not_applicable(name: &str) -> CheckEntry {CheckEntry::skip(name.to_owned(), "not applicable on Linux".to_owned())}@@ -650,19 +639,6 @@ mod tests {use cua_driver_core::tool::Tool;use std::sync::Arc;- #[test]- fn binary_version_always_passes() {- let entry = check_binary_version();- assert_eq!(entry.status, CheckStatus::Pass);- assert!(entry.message.contains("cua-driver "));- }-- #[test]- fn session_active_passes() {- let entry = check_session_active();- assert_eq!(entry.status, CheckStatus::Pass);- }-#[test]fn wayland_backend_passes_on_non_wlroots_when_portal_libei_backend_is_reachable() {let snap = WaylandManagers {diff --git a/libs/cua-driver/rust/crates/platform-linux/src/input/mpx_owner.rs b/libs/cua-driver/rust/crates/platform-linux/src/input/mpx_owner.rsindex 4c8672fa99..f6aca937ff 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/input/mpx_owner.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/input/mpx_owner.rs@@ -12,11 +12,7 @@ pub(super) struct Owner {}fn start_ticks(stat: &str) -> io::Result<u64> {- // comm can contain spaces and closing parentheses. Fields following its- // final ')' begin with state (field 3); starttime is field 22.- stat.rsplit_once(')')- .and_then(|(_, tail)| tail.split_whitespace().nth(19))- .and_then(|value| value.parse().ok())+ crate::proc_fs::process_start_time_from_stat(stat).ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "invalid proc stat"))}@@ -199,19 +195,6 @@ mod tests {assert!(owner.stale_with(&owner, |_| Ok(999), |_| panic!("must not probe")));}- #[test]- fn proc_stat_comm_delimiters_do_not_shift_starttime() {- let tail = (3..=21)- .map(|n| n.to_string())- .collect::<Vec<_>>()- .join(" ");- assert_eq!(- start_ticks(&format!("123 (name with ) parentheses) {tail} 98765 23")).unwrap(),- 98765- );- assert!(start_ticks("bad").is_err());- }-#[test]fn actual_current_process_is_not_stale() {let owner = Owner::current().unwrap();diff --git a/libs/cua-driver/rust/crates/platform-linux/src/installed_apps.rs b/libs/cua-driver/rust/crates/platform-linux/src/installed_apps.rsindex 03dc4732c7..9f204f1540 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/installed_apps.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/installed_apps.rs@@ -175,7 +175,7 @@ fn parse_desktop_file(path: &Path, bundle_id: &str) -> Option<InstalledApp> {.ok().and_then(|m| m.modified().ok()).and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())- .map(|d| unix_secs_to_rfc3339(d.as_secs() as i64));+ .and_then(|d| cua_driver_core::timestamp::unix_secs_to_rfc3339(d.as_secs() as i64));Some(InstalledApp {name,@@ -267,32 +267,6 @@ fn strip_exec_field_codes(exec: &str) -> String {out.trim().to_owned()}-/// Format Unix epoch seconds as `YYYY-MM-DDTHH:MM:SSZ` (UTC).-fn unix_secs_to_rfc3339(secs: i64) -> String {- let days = secs.div_euclid(86_400);- let seconds_of_day = secs.rem_euclid(86_400);- let hour = seconds_of_day / 3600;- let minute = (seconds_of_day % 3600) / 60;- let second = seconds_of_day % 60;-- // Howard Hinnant's civil-from-days algorithm.- let z = days + 719_468;- let era = if z >= 0 { z } else { z - 146_096 } / 146_097;- let doe = (z - era * 146_097) as u64;- let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;- let y = yoe as i64 + era * 400;- let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);- let mp = (5 * doy + 2) / 153;- let d = doy - (153 * mp + 2) / 5 + 1;- let m = if mp < 10 { mp + 3 } else { mp - 9 };- let y = if m <= 2 { y + 1 } else { y };-- format!(- "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z",- y, m, d, hour, minute, second- )-}-#[cfg(test)]mod tests {use super::*;@@ -395,10 +369,4 @@ Exec=/opt/demo/bin/demo %Ulet other = Path::new("/opt/something.desktop");assert_eq!(desktop_file_id(root, other), "");}-- #[test]- fn rfc3339_known_epoch() {- // 1234567890 → 2009-02-13T23:31:30Z- assert_eq!(unix_secs_to_rfc3339(1_234_567_890), "2009-02-13T23:31:30Z");- }}diff --git a/libs/cua-driver/rust/crates/platform-linux/src/proc_fs.rs b/libs/cua-driver/rust/crates/platform-linux/src/proc_fs.rsindex e08cadada0..91d1cfd84c 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/proc_fs.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/proc_fs.rs@@ -37,10 +37,13 @@ pub fn is_process_live(pid: u32) -> bool {is_process_live_state(&status)}-fn process_start_time_from_stat(stat: &str) -> Option<u64> {- // `comm` is parenthesized and may contain spaces. Fields after its closing- // parenthesis begin with state (field 3); starttime is field 22.- stat.rsplit_once(") ")?+/// Parse the kernel start time (field 22, in clock ticks) from the contents+/// of `/proc/<pid>/stat`.+pub(crate) fn process_start_time_from_stat(stat: &str) -> Option<u64> {+ // `comm` is parenthesized and may contain spaces and closing parentheses.+ // Fields after its final `)` begin with state (field 3); starttime is+ // field 22.+ stat.rsplit_once(')')?.1.split_whitespace().nth(19)?@@ -116,8 +119,24 @@ mod tests {let mut fields = vec!["S".to_owned()];fields.extend((4..=21).map(|field| field.to_string()));fields.push("987654".to_owned());- let stat = format!("42 (fixture with spaces) {}", fields.join(" "));- assert_eq!(super::process_start_time_from_stat(&stat), Some(987654));+ let fields = fields.join(" ");+ for comm in [+ "fixture with spaces",+ "name with ) parentheses",+ "ends with )",+ ] {+ let stat = format!("42 ({comm}) {fields} 23");+ assert_eq!(+ super::process_start_time_from_stat(&stat),+ Some(987654),+ "{comm}"+ );+ }+ assert_eq!(super::process_start_time_from_stat("bad"), None);+ assert_eq!(+ super::process_start_time_from_stat("42 (short) S 1 2"),+ None+ );}#[test]diff --git a/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs b/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rsindex 78981e9cc8..a4e8bfc296 100644--- a/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs+++ b/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs@@ -512,34 +512,7 @@ fn fs_last_used(path: &std::path::Path) -> Option<String> {let meta = std::fs::metadata(path).ok()?;let modified = meta.modified().ok()?;let duration = modified.duration_since(std::time::UNIX_EPOCH).ok()?;- Some(unix_secs_to_rfc3339(duration.as_secs() as i64))-}--/// Format a Unix epoch seconds value as `YYYY-MM-DDTHH:MM:SSZ` (UTC).-/// Hand-rolled to avoid pulling in a date/time crate just for this.-pub(crate) fn unix_secs_to_rfc3339(secs: i64) -> String {- // Days since 1970-01-01 + civil date breakdown per Howard Hinnant's algorithm.- let days = secs.div_euclid(86_400);- let seconds_of_day = secs.rem_euclid(86_400);- let hour = seconds_of_day / 3600;- let minute = (seconds_of_day % 3600) / 60;- let second = seconds_of_day % 60;-- let z = days + 719_468;- let era = if z >= 0 { z } else { z - 146_096 } / 146_097;- let doe = (z - era * 146_097) as u64; // [0, 146096]- let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; // [0, 399]- let y = yoe as i64 + era * 400;- let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); // [0, 365]- let mp = (5 * doy + 2) / 153; // [0, 11]- let d = doy - (153 * mp + 2) / 5 + 1; // [1, 31]- let m = if mp < 10 { mp + 3 } else { mp - 9 }; // [1, 12]- let y = if m <= 2 { y + 1 } else { y };-- format!(- "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z",- y, m, d, hour, minute, second- )+ cua_driver_core::timestamp::unix_secs_to_rfc3339(duration.as_secs() as i64)}fn read_app_plist(plist_path: &std::path::Path) -> Option<AppInfo> {@@ -716,7 +689,7 @@ pub fn format_app_list(apps: &[AppInfo]) -> String {#[cfg(test)]mod tests {- use super::{finder_folder_handoff, unix_secs_to_rfc3339};+ use super::finder_folder_handoff;#[test]fn finder_folder_handoff_is_narrowly_selected() {@@ -729,57 +702,4 @@ mod tests {&["https://example.com".to_owned()]));}-- #[test]- fn rfc3339_epoch() {- assert_eq!(unix_secs_to_rfc3339(0), "1970-01-01T00:00:00Z");- }-- #[test]- fn rfc3339_negative_pre_epoch() {- // 1969-12-31T23:59:59Z = epoch - 1 second.- assert_eq!(unix_secs_to_rfc3339(-1), "1969-12-31T23:59:59Z");- // 1969-01-01T00:00:00Z = epoch - 365 days.- assert_eq!(unix_secs_to_rfc3339(-365 * 86_400), "1969-01-01T00:00:00Z");- }-- #[test]- fn rfc3339_leap_day_in_leap_year() {- // 2020-02-29T12:00:00Z. Days from 1970-01-01:- // 50 years * 365 + 13 leap days (1972..=2020 inclusive of 13) - 1- // (Feb 29 is the 60th day of 2020, so 59 prior days in 2020).- // Use the known timestamp instead of recomputing.- // `date -d "2020-02-29T12:00:00Z" +%s` = 1582977600.- assert_eq!(unix_secs_to_rfc3339(1_582_977_600), "2020-02-29T12:00:00Z");- }-- #[test]- fn rfc3339_feb_28_non_leap_year() {- // 2019-02-28T00:00:00Z → 1551312000.- assert_eq!(unix_secs_to_rfc3339(1_551_312_000), "2019-02-28T00:00:00Z");- // The very next second is Mar 1, not Feb 29.- assert_eq!(- unix_secs_to_rfc3339(1_551_312_000 + 86_400),- "2019-03-01T00:00:00Z"- );- }-- #[test]- fn rfc3339_end_of_year_wrap() {- // 2023-12-31T23:59:59Z = 1704067199; +1 second wraps to 2024-01-01.- assert_eq!(unix_secs_to_rfc3339(1_704_067_199), "2023-12-31T23:59:59Z");- assert_eq!(unix_secs_to_rfc3339(1_704_067_200), "2024-01-01T00:00:00Z");- }-- #[test]- fn rfc3339_recent_arbitrary_timestamp() {- // 2024-06-15T13:45:30Z → 1718459130.- assert_eq!(unix_secs_to_rfc3339(1_718_459_130), "2024-06-15T13:45:30Z");- }-- #[test]- fn rfc3339_known_pre_2000_timestamp() {- // 1990-07-04T15:30:00Z → 647105400.- assert_eq!(unix_secs_to_rfc3339(647_105_400), "1990-07-04T15:30:00Z");- }}diff --git a/libs/cua-driver/rust/crates/platform-macos/src/tools/health_report.rs b/libs/cua-driver/rust/crates/platform-macos/src/tools/health_report.rsindex e8e8480406..235671c5fa 100644--- a/libs/cua-driver/rust/crates/platform-macos/src/tools/health_report.rs+++ b/libs/cua-driver/rust/crates/platform-macos/src/tools/health_report.rs@@ -50,9 +50,9 @@ impl HealthCheckProvider for MacosHealthProvider {async fn run_check(&self, name: &str) -> CheckEntry {match name {- NAME_BINARY_VERSION => check_binary_version(),+ NAME_BINARY_VERSION => CheckEntry::binary_version(),NAME_PLATFORM_SUPPORTED => check_platform_supported(),- NAME_SESSION_ACTIVE => check_session_active(),+ NAME_SESSION_ACTIVE => CheckEntry::session_active(),NAME_BUNDLE_IDENTITY => check_bundle_identity(),NAME_TCC_ACCESSIBILITY => check_tcc_accessibility(),NAME_TCC_SCREEN_RECORDING => check_tcc_screen_recording(),@@ -70,15 +70,6 @@ impl HealthCheckProvider for MacosHealthProvider {// ── Individual checks ────────────────────────────────────────────────────────-pub(crate) fn check_binary_version() -> CheckEntry {- // CARGO_PKG_VERSION is a compiled-in constant; reaching this code- // already implies the binary built. Always pass.- CheckEntry::pass(- NAME_BINARY_VERSION,- format!("cua-driver {}", env!("CARGO_PKG_VERSION")),- )-}-pub(crate) fn check_platform_supported() -> CheckEntry {// Reaching this code path on macOS implies a supported platform —// the macOS build is gated behind `cfg(target_os = "macos")`.@@ -95,13 +86,6 @@ pub(crate) fn check_platform_supported() -> CheckEntry {})}-pub(crate) fn check_session_active() -> CheckEntry {- // We are servicing this MCP call, so by construction the session- // is up. The check exists so consumers can hard-code a canonical- // "is the server reachable?" signal in a fixed shape.- CheckEntry::pass(NAME_SESSION_ACTIVE, "MCP session is active.")-}-pub(crate) fn check_bundle_identity() -> CheckEntry {let bid = current_bundle_identifier();let exe = std::env::current_exe()@@ -401,16 +385,6 @@ mod tests {}}- #[test]- fn binary_version_always_passes() {- let entry = check_binary_version();- assert_eq!(entry.status, CheckStatus::Pass);- assert!(- entry.message.contains("cua-driver "),- "message must include the binary version"- );- }-#[test]fn platform_supported_carries_os_and_arch_data() {let entry = check_platform_supported();@@ -420,12 +394,6 @@ mod tests {assert!(data.architecture.is_some(), "architecture must be set");}- #[test]- fn session_active_passes() {- let entry = check_session_active();- assert_eq!(entry.status, CheckStatus::Pass);- }-#[test]fn screen_capture_capability_is_not_probed_by_read_only_health_report() {let entry = check_screen_capture_capability();diff --git a/libs/cua-driver/rust/crates/platform-windows/src/health_report.rs b/libs/cua-driver/rust/crates/platform-windows/src/health_report.rsindex 2c8c11e194..0643b93636 100644--- a/libs/cua-driver/rust/crates/platform-windows/src/health_report.rs+++ b/libs/cua-driver/rust/crates/platform-windows/src/health_report.rs@@ -44,9 +44,9 @@ impl HealthCheckProvider for WindowsHealthProvider {async fn run_check(&self, name: &str) -> CheckEntry {match name {- NAME_BINARY_VERSION => check_binary_version(),+ NAME_BINARY_VERSION => CheckEntry::binary_version(),NAME_PLATFORM_SUPPORTED => check_platform_supported(),- NAME_SESSION_ACTIVE => check_session_active(),+ NAME_SESSION_ACTIVE => CheckEntry::session_active(),NAME_BUNDLE_IDENTITY => skip_not_applicable(NAME_BUNDLE_IDENTITY),NAME_TCC_ACCESSIBILITY => skip_not_applicable(NAME_TCC_ACCESSIBILITY),NAME_TCC_SCREEN_RECORDING => skip_not_applicable(NAME_TCC_SCREEN_RECORDING),@@ -62,13 +62,6 @@ impl HealthCheckProvider for WindowsHealthProvider {// ── Individual checks ────────────────────────────────────────────────────────-pub(crate) fn check_binary_version() -> CheckEntry {- CheckEntry::pass(- NAME_BINARY_VERSION,- format!("cua-driver {}", env!("CARGO_PKG_VERSION")),- )-}-pub(crate) fn check_platform_supported() -> CheckEntry {// The Windows build is gated behind `cfg(target_os = "windows")`,// so reaching this code path already implies a supported platform.@@ -85,10 +78,6 @@ pub(crate) fn check_platform_supported() -> CheckEntry {})}-pub(crate) fn check_session_active() -> CheckEntry {- CheckEntry::pass(NAME_SESSION_ACTIVE, "MCP session is active.")-}-/// Standard "this category does not exist on Windows" entry. Used for/// `tcc_*` and `bundle_identity` so cross-platform consumers can rely/// on a known answer rather than the entry being missing.@@ -225,13 +214,6 @@ mod tests {use cua_driver_core::tool::Tool;use std::sync::Arc;- #[test]- fn binary_version_always_passes() {- let entry = check_binary_version();- assert_eq!(entry.status, CheckStatus::Pass);- assert!(entry.message.contains("cua-driver "));- }-// End-to-end through the dispatcher: every Windows canonical name// appears in the response, in declared order. Run on every host so// CI matrices that don't target Windows still verify the schemadiff --git a/libs/cua-driver/rust/crates/platform-windows/src/win32/installed_apps.rs b/libs/cua-driver/rust/crates/platform-windows/src/win32/installed_apps.rsindex ba2b496bc0..dc8e717c51 100644--- a/libs/cua-driver/rust/crates/platform-windows/src/win32/installed_apps.rs+++ b/libs/cua-driver/rust/crates/platform-windows/src/win32/installed_apps.rs@@ -175,7 +175,7 @@ fn resolve_lnk(lnk_path: &Path) -> Option<InstalledApp> {.ok().and_then(|m| m.modified().ok()).and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())- .map(|d| unix_secs_to_rfc3339(d.as_secs() as i64));+ .and_then(|d| cua_driver_core::timestamp::unix_secs_to_rfc3339(d.as_secs() as i64));let launch_path = if args.trim().is_empty() {target.clone()@@ -620,34 +620,7 @@ fn read_install_mtime(pkg: &windows::ApplicationModel::Package) -> Option<Stringlet meta = std::fs::metadata(&path).ok()?;let modified = meta.modified().ok()?;let duration = modified.duration_since(std::time::UNIX_EPOCH).ok()?;- Some(unix_secs_to_rfc3339(duration.as_secs() as i64))-}--// ── Date helper ──────────────────────────────────────────────────────────────--/// Format Unix epoch seconds as `YYYY-MM-DDTHH:MM:SSZ` (UTC).-fn unix_secs_to_rfc3339(secs: i64) -> String {- let days = secs.div_euclid(86_400);- let seconds_of_day = secs.rem_euclid(86_400);- let hour = seconds_of_day / 3600;- let minute = (seconds_of_day % 3600) / 60;- let second = seconds_of_day % 60;-- let z = days + 719_468;- let era = if z >= 0 { z } else { z - 146_096 } / 146_097;- let doe = (z - era * 146_097) as u64;- let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;- let y = yoe as i64 + era * 400;- let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);- let mp = (5 * doy + 2) / 153;- let d = doy - (153 * mp + 2) / 5 + 1;- let m = if mp < 10 { mp + 3 } else { mp - 9 };- let y = if m <= 2 { y + 1 } else { y };-- format!(- "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z",- y, m, d, hour, minute, second- )+ cua_driver_core::timestamp::unix_secs_to_rfc3339(duration.as_secs() as i64)}#[cfg(test)]