agent-hub-runtime 0.6.0

AgentHub desktop and companion CLI runtime for Tauri applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Reuse the native macOS authorization prompt for narrowly scoped system changes.
pub(crate) fn authorize(script: &str) -> Result<(), String> {
    if !cfg!(target_os = "macos") {
        return Err("Administrator setup requires macOS".into());
    }
    let shell = format!("/bin/bash -c '{}'", script.replace('\'', "'\\''"));
    let apple = format!(
        "do shell script \"{}\" with administrator privileges",
        shell
            .replace('\\', "\\\\")
            .replace('"', "\\\"")
            .replace('\n', "\\n")
    );
    crate::core::cli_process::command_with_timeout("/usr/bin/osascript", &["-e", &apple], &[], 300)
        .map(|_| ())
}