The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(windows): normalize unknown permission states to not_required on Windows
ajabaabaa7306286b475d
diff --git a/app/src/components/desktop/DesktopConnectionPage.test.tsx b/app/src/components/desktop/DesktopConnectionPage.test.tsxindex 7175241495..626525ae32 100644--- a/app/src/components/desktop/DesktopConnectionPage.test.tsx+++ b/app/src/components/desktop/DesktopConnectionPage.test.tsx@@ -146,4 +146,28 @@ describe('Desktop connection', () => {await screen.findByText('Could not load pending desktop approvals. Refresh to try again.')).toBeInTheDocument();});++ it('treats not_required accessibility as ready on Windows and suppresses the settings button', async () => {+ const windowsReady: DesktopStatus = {+ ...enabled,+ platform: 'windows',+ accessibility: 'not_required',+ screen_recording: 'not_required',+ };+ vi.mocked(callCoreRpc).mockImplementation(async ({ method }) => {+ if (method === 'openhuman.desktop_status') return windowsReady as never;+ if (method === 'openhuman.desktop_pending') return [] as never;+ if (method === 'openhuman.desktop_probe') return { ok: true, app_count: 1 } as never;+ throw new Error(`Unexpected method: ${method}`);+ });+ renderWithProviders(<DesktopConnectionPage />);++ // "Not required" is a success state — the status badge should report connected.+ expect(await screen.findByText('Connected')).toBeInTheDocument();+ // No "Open settings" button should appear for permissions that are not_required.+ expect(screen.queryByRole('button', { name: 'Open settings' })).not.toBeInTheDocument();+ // The probe should succeed.+ fireEvent.click(screen.getByRole('button', { name: 'Test desktop access' }));+ expect(await screen.findByText('Desktop access works.')).toBeInTheDocument();+ });});diff --git a/app/src/components/desktop/DesktopConnectionPage.tsx b/app/src/components/desktop/DesktopConnectionPage.tsxindex 6b26524b15..735a452f83 100644--- a/app/src/components/desktop/DesktopConnectionPage.tsx+++ b/app/src/components/desktop/DesktopConnectionPage.tsx@@ -70,9 +70,9 @@ function permissionSettingsUrl(kind: PermissionKind, platform: string): string |if (platform === 'macos') {return `x-apple.systempreferences:com.apple.preference.security?Privacy_${kind === 'accessibility' ? 'Accessibility' : 'ScreenCapture'}`;}- if (platform === 'windows') {- return 'ms-settings:privacy';- }+ // Windows has no per-app accessibility or screen-recording permission toggle+ // analogous to macOS TCC. Opening the generic Privacy settings page sends+ // the user to a dead end, so return null to suppress the button.return null;}@@ -249,7 +249,7 @@ export default function DesktopConnectionPage({!!status &&status.enabled &&status.module_state === 'ready' &&- status.accessibility === 'granted' &&+ (status.accessibility === 'granted' || status.accessibility === 'not_required') &&status.jev_ready;const statusBadge = status?.supported ? (<Badgediff --git a/crates/openhuman-core/src/desktop/control/ops.rs b/crates/openhuman-core/src/desktop/control/ops.rsindex 7295c93753..99e0e2d710 100644--- a/crates/openhuman-core/src/desktop/control/ops.rs+++ b/crates/openhuman-core/src/desktop/control/ops.rs@@ -180,11 +180,24 @@ fn permission(data: &serde_json::Value, field: &str) -> String {.and_then(serde_json::Value::as_str).unwrap_or("unknown");match raw {- "granted" | "denied" | "not_required" => raw.to_owned(),+ "granted" | "denied" | "not_required" | "unknown" => raw.to_owned(),_ => "unknown".to_owned(),}}+/// On platforms without a per-app permission model for the given kind (e.g.+/// Windows has no macOS-style Accessibility or Screen Recording toggle),+/// treat an `unknown` report from the module as `not_required` so the UI+/// does not show a misleading "Not determined" state or send the user to+/// a generic settings page that has no relevant toggle.+pub(super) fn normalize_permission_for_platform(state: &str, platform: &str) -> String {+ if platform == "windows" && state == "unknown" {+ "not_required".to_owned()+ } else {+ state.to_owned()+ }+}+pub async fn status(config: &Config) -> DesktopStatus {status_with(config, supported(), || {crate::modules::desktop::permissions(config)@@ -222,8 +235,14 @@ wherematch permissions().await {Ok(response) if response.ok => {if let Some(data) = response.data.as_ref() {- result.accessibility = permission(data, "accessibility");- result.screen_recording = permission(data, "screen_recording");+ result.accessibility = normalize_permission_for_platform(+ &permission(data, "accessibility"),+ result.platform,+ );+ result.screen_recording = normalize_permission_for_platform(+ &permission(data, "screen_recording"),+ result.platform,+ );}result.module_state = "ready".to_owned();}@@ -289,13 +308,17 @@ where}}};- if permissions+ let accessibility_state = permissions.data.as_ref()- .map(|data| permission(data, "accessibility"))- .as_deref()- != Some("granted")- {+ .map(|data| {+ normalize_permission_for_platform(+ &permission(data, "accessibility"),+ std::env::consts::OS,+ )+ })+ .unwrap_or_else(|| "unknown".to_owned());+ if accessibility_state != "granted" && accessibility_state != "not_required" {return DesktopProbe {ok: false,app_count: None,diff --git a/crates/openhuman-core/src/desktop/control/ops_tests.rs b/crates/openhuman-core/src/desktop/control/ops_tests.rsindex 35bdb7a537..f56cc2dd6d 100644--- a/crates/openhuman-core/src/desktop/control/ops_tests.rs+++ b/crates/openhuman-core/src/desktop/control/ops_tests.rs@@ -248,12 +248,74 @@ async fn probe_requires_accessibility_and_snapshot_before_listing_apps() {assert_eq!(module_error.reason.as_deref(), Some("App listing denied"));}+#[tokio::test]+async fn probe_passes_when_accessibility_is_not_required() {+ use tinycomputer_bus::DesktopResponse;++ let dir = tempfile::tempdir().unwrap();+ let mut config = Config::default();+ config.workspace_dir = dir.path().to_path_buf();+ save(&config, true).unwrap();++ // Simulates the Windows adapter returning "unknown" for accessibility,+ // which the host normalizes to "not_required" on the windows platform.+ // Since this test binary runs on the build host (not necessarily windows),+ // we pass "not_required" directly to prove the probe accepts it.+ let result = probe_with(&config, true, |member| async move {+ Ok(DesktopResponse::ok(+ member,+ match member {+ names::methods::PERMISSIONS => serde_json::json!({+ "accessibility":{"state":"not_required"},+ "screen_recording":{"state":"not_required"}+ }),+ names::methods::SNAPSHOT => serde_json::json!({"elements":[]}),+ names::methods::LIST_APPS => {+ serde_json::json!({"apps":[{"name":"Explorer"}]})+ }+ _ => panic!("unexpected member"),+ },+ ))+ })+ .await;+ assert!(result.ok, "probe should pass when accessibility is not_required");+ assert_eq!(result.app_count, Some(1));+ assert!(result.reason.is_none());+}+#[test]fn permission_states_are_normalized() {let data = serde_json::json!({"accessibility":{"state":"granted"},"screen_recording":{"state":"weird"}});assert_eq!(permission(&data, "accessibility"), "granted");assert_eq!(permission(&data, "screen_recording"), "unknown");+ // "unknown" is a recognized pass-through state (distinct from a missing field).+ let unknown = serde_json::json!({"accessibility":{"state":"unknown"}});+ assert_eq!(permission(&unknown, "accessibility"), "unknown");+}++#[test]+fn windows_unknown_permissions_normalize_to_not_required() {+ assert_eq!(+ normalize_permission_for_platform("unknown", "windows"),+ "not_required"+ );+ assert_eq!(+ normalize_permission_for_platform("unknown", "macos"),+ "unknown"+ );+ assert_eq!(+ normalize_permission_for_platform("granted", "windows"),+ "granted"+ );+ assert_eq!(+ normalize_permission_for_platform("denied", "windows"),+ "denied"+ );+ assert_eq!(+ normalize_permission_for_platform("not_required", "windows"),+ "not_required"+ );}#[test]diff --git a/crates/openhuman-core/src/desktop/control/tools.rs b/crates/openhuman-core/src/desktop/control/tools.rsindex 191580b745..1ee9baa094 100644--- a/crates/openhuman-core/src/desktop/control/tools.rs+++ b/crates/openhuman-core/src/desktop/control/tools.rs@@ -295,14 +295,17 @@ impl Tool for DesktopTool {}Err(error) => return Ok(ToolResult::error(error)),};- let accessibility = permission+ let accessibility_raw = permission.data.as_ref().and_then(|data| data.get("accessibility")).and_then(|value| value.get("state")).and_then(Value::as_str).unwrap_or("unknown");+ let accessibility =+ super::ops::normalize_permission_for_platform(accessibility_raw, std::env::consts::OS);if accessibility != "granted"+ && accessibility != "not_required"&& !matches!(self.kind,DesktopToolKind::Apps | DesktopToolKind::Windows | DesktopToolKind::Launch