Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ members = [
"products/maka/cli",
"plugins/settings/store",
"products/maka/desktop-shell",
"products/maka/host-shell",
"products/maka/client",
"products/maka/terminal-shell",
"products/maka/workbench",
Expand Down
2 changes: 2 additions & 0 deletions platform/computer-use/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ native-desktop = [
"dep:windows-sys",
"dep:platform-linux",
"dep:platform-macos",
"dep:screencapturekit",
"dep:core-foundation",
"dep:objc2",
"dep:objc2-foundation",
Expand Down Expand Up @@ -108,6 +109,7 @@ imagesize.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
unicode-segmentation = { workspace = true, optional = true }
platform-macos = { git = "https://github.com/maka-agent/cua", rev = "b97a7e7a97b1dabc669b7c362ba39691766df761", optional = true }
screencapturekit = { version = "8.0.1", features = ["macos_15_0"], optional = true }
core-foundation = { version = "0.10.1", optional = true }
objc2 = { version = "0.6.5", optional = true }
objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSArray", "NSData", "NSString"], optional = true }
Expand Down
11 changes: 9 additions & 2 deletions platform/computer-use/src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub(crate) mod mouse;
pub(crate) mod page_scroll;
pub(crate) mod pasteboard;
pub(crate) mod permission_subject;
pub(crate) mod tcc;
use crate::protocol::*;
use core_foundation::{
base::{CFEqual, CFGetTypeID, CFRange, CFRelease, TCFType},
Expand Down Expand Up @@ -55,7 +56,13 @@ unsafe extern "C" {
fn CGSessionCopyCurrentDictionary() -> core_foundation::dictionary::CFDictionaryRef;
}

pub(crate) fn require_desktop() -> Result<(), ToolError> {
pub(crate) async fn require_desktop() -> Result<(), ToolError> {
tokio::task::spawn_blocking(require_desktop_blocking)
.await
.map_err(failed)?
}

pub(crate) fn require_desktop_blocking() -> Result<(), ToolError> {
use core_foundation::{
boolean::{CFBooleanGetTypeID, kCFBooleanTrue},
dictionary::CFDictionaryGetValue,
Expand All @@ -79,7 +86,7 @@ pub(crate) fn require_desktop() -> Result<(), ToolError> {
));
}
}
Ok(())
tcc::require(tcc::Grant::Accessibility)
}

pub(crate) struct Target {
Expand Down
2 changes: 1 addition & 1 deletion platform/computer-use/src/macos/permission_subject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) enum Request {

impl Request {
pub(crate) fn resolve(self, language: Language) -> Result<ComputerAppTarget, ToolError> {
super::require_desktop()?;
super::require_desktop_blocking()?;
let (app, binding) = match self {
Self::RawApp(name) => {
let selected = raw_app_candidate(&name, &apps::list_all_apps())?;
Expand Down
Loading
Loading