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
2 changes: 1 addition & 1 deletion app/src-tauri/src/claude_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn claude_code_login_launch() -> Result<String, String> {
.args(["/c", "start", "", "cmd", "/k", "claude login"])
.spawn()
.map_err(|e| format!("failed to open cmd: {e}"))?;
return Ok("cmd".into());
Ok("cmd".into())
}

#[cfg(target_os = "macos")]
Expand Down
1 change: 1 addition & 0 deletions app/src-tauri/src/core_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@ fn find_pid_on_port(port: u16) -> Option<u32> {
}

/// Pure parse of `lsof -t` output (one pid per line; first wins).
#[cfg(unix)]
fn parse_lsof_pid(stdout: &str) -> Option<u32> {
stdout
.lines()
Expand Down
6 changes: 5 additions & 1 deletion app/src-tauri/src/core_process_tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use super::{
current_rpc_token, default_core_port, generate_rpc_token, is_expected_port_clash,
is_openhuman_root_body, parse_lsof_pid, parse_netstat_pid, parse_ps_comm, parse_tasklist_name,
is_openhuman_root_body, parse_netstat_pid, parse_ps_comm, parse_tasklist_name,
validate_kill_target, CoreProcessHandle, PortOwner, RecoveryOutcome,
};
// lsof is a unix tool, so its parser is only compiled there.
#[cfg(unix)]
use super::parse_lsof_pid;
use std::sync::{Mutex, MutexGuard, OnceLock};

fn env_lock() -> MutexGuard<'static, ()> {
Expand Down Expand Up @@ -307,6 +310,7 @@ fn expected_port_clash_classifier_rejects_unknown_probe_shapes() {
));
}

#[cfg(unix)]
#[test]
fn parse_lsof_pid_picks_first_pid() {
assert_eq!(parse_lsof_pid("12345\n"), Some(12345));
Expand Down
7 changes: 5 additions & 2 deletions app/src-tauri/src/deep_link_ipc_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ pub(crate) fn try_forward_deep_links() -> ForwardResult {
ForwardResult::NoPrimary
}

/// Callback the app installs to receive deep-link URLs as they arrive.
type LiveHandler = Box<dyn Fn(String) + Send + Sync>;

static PENDING_URLS: OnceLock<Arc<Mutex<Vec<String>>>> = OnceLock::new();
static LIVE_HANDLER: OnceLock<Mutex<Option<Box<dyn Fn(String) + Send + Sync>>>> = OnceLock::new();
static LIVE_HANDLER: OnceLock<Mutex<Option<LiveHandler>>> = OnceLock::new();

fn pending_queue() -> &'static Arc<Mutex<Vec<String>>> {
PENDING_URLS.get_or_init(|| Arc::new(Mutex::new(Vec::new())))
}

fn live_handler() -> &'static Mutex<Option<Box<dyn Fn(String) + Send + Sync>>> {
fn live_handler() -> &'static Mutex<Option<LiveHandler>> {
LIVE_HANDLER.get_or_init(|| Mutex::new(None))
}

Expand Down
3 changes: 2 additions & 1 deletion src/core/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@
//! internal bearer or a stable user-managed external API key stored under
//! `openhuman::inference::http::EXTERNAL_OPENAI_COMPAT_PROVIDER`.

use std::io::Write as _;
use std::path::Path;
use std::sync::OnceLock;

#[cfg(unix)]
use std::io::Write as _;
#[cfg(unix)]
use std::os::unix::fs::OpenOptionsExt as _;

Expand Down
1 change: 0 additions & 1 deletion src/openhuman/inference/local/process_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const CREATE_NO_WINDOW: u32 = 0x0800_0000;

#[cfg(windows)]
pub(crate) fn apply_no_window(cmd: &mut tokio::process::Command) {
use std::os::windows::process::CommandExt;
cmd.creation_flags(CREATE_NO_WINDOW);
}

Expand Down
1 change: 0 additions & 1 deletion src/openhuman/inference/voice/local_speech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ pub async fn synthesize_piper(
// every TTS request (piper.exe is a console subsystem binary).
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
cmd.creation_flags(0x08000000);
}
let mut child = cmd
Expand Down
1 change: 1 addition & 0 deletions src/openhuman/integrations/composio/trigger_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::sync::Mutex;
use std::sync::{Arc, OnceLock};

use chrono::Utc;
#[cfg(not(windows))]
use fs2::FileExt;

use super::types::{ComposioTriggerHistoryEntry, ComposioTriggerHistoryResult};
Expand Down
2 changes: 1 addition & 1 deletion src/openhuman/platform/doctor/core_part_01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ fn check_workspace(config: &Config, items: &mut Vec<DiagnosticItem>) {
fn available_disk_space_mb(path: &Path) -> Option<u64> {
#[cfg(target_os = "windows")]
{
return available_disk_space_mb_windows(path);
available_disk_space_mb_windows(path)
}

#[cfg(not(target_os = "windows"))]
Expand Down
12 changes: 9 additions & 3 deletions src/openhuman/sandbox/cwd_jail/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use std::process::{Child, Command};
use std::ptr;

use windows_sys::core::PWSTR;
use windows_sys::Win32::Foundation::{CloseHandle, LocalFree, HANDLE, HLOCAL};
use windows_sys::Win32::Foundation::{CloseHandle, LocalFree, HLOCAL};
use windows_sys::Win32::Security::Authorization::{
GetNamedSecurityInfoW, SetEntriesInAclW, SetNamedSecurityInfoW, EXPLICIT_ACCESS_W, SET_ACCESS,
SE_FILE_OBJECT, TRUSTEE_IS_GROUP, TRUSTEE_IS_SID, TRUSTEE_W,
Expand Down Expand Up @@ -107,6 +107,12 @@ impl AppContainerBackend {
}
}

impl Default for AppContainerBackend {
fn default() -> Self {
Self::new()
}
}

impl JailBackend for AppContainerBackend {
fn name(&self) -> &'static str {
"appcontainer"
Expand Down Expand Up @@ -305,7 +311,7 @@ unsafe fn grant_sid_access(path: &Path, sid: PSID, access: u32) -> io::Result<()
// locking out the owner / SYSTEM / Administrators. Merge instead.
let mut sd_ptr: *mut std::ffi::c_void = ptr::null_mut();
let mut existing_dacl: *mut ACL = ptr::null_mut();
let mut dacl_present: i32 = 0;
let dacl_present: i32 = 0;
let rc = GetNamedSecurityInfoW(
path_w.as_ptr(),
SE_FILE_OBJECT,
Expand Down Expand Up @@ -335,7 +341,7 @@ unsafe fn grant_sid_access(path: &Path, sid: PSID, access: u32) -> io::Result<()
};

let mut new_acl: *mut ACL = ptr::null_mut();
let rc = SetEntriesInAclW(1, &mut ea, existing_dacl, &mut new_acl);
let rc = SetEntriesInAclW(1, &ea, existing_dacl, &mut new_acl);
if rc != 0 {
return Err(io::Error::from_raw_os_error(rc as i32));
}
Expand Down
6 changes: 3 additions & 3 deletions src/openhuman/security/keyring/encrypted_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ impl SecretStore {
};

let hex_key = read_result.with_context(|| {
// `mut` is only exercised inside the #[cfg(windows)] block below.
#[cfg_attr(not(windows), allow(unused_mut))]
let mut msg = format!(
// The #[cfg(windows)] arm below shadows this binding rather than
// mutating it, so it does not need to be mutable on either platform.
let msg = format!(
"Failed to read secret key file at {}",
self.key_path.display()
);
Expand Down
3 changes: 2 additions & 1 deletion src/openhuman/security/pairing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
// a bearer token. Tokens can be persisted in config so restarts don't require
// re-pairing.

use std::io::Write as _;
use std::path::Path;

#[cfg(unix)]
use std::io::Write as _;
#[cfg(unix)]
use std::os::unix::fs::OpenOptionsExt as _;

Expand Down
Loading