The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge remote-tracking branch 'origin/main' into ethie/pm-clean
ethernetca06a8dec9cf
diff --cc apps/bootstrap-installer/src-tauri/src/update.rsindex 5f016a7db14,5cb83c7a54d..07ba8f8a082--- a/apps/bootstrap-installer/src-tauri/src/update.rs+++ b/apps/bootstrap-installer/src-tauri/src/update.rs@@@ -3,12 -3,27 +3,14 @@@//! Driven when the installer is launched as `Hermes-Setup.exe --update` (see//! `AppMode` in lib.rs). The desktop app hands off to us — it exits, then we://!-//! 1. wait for the old Hermes desktop process to fully exit (so both the-//! venv shim and packaged app.asar are free; otherwise `hermes update`-//! or repair bootstrap can race locked files),-//! 2. run `hermes update --yes --gateway` (Python/repo update; this does NOT-//! rebuild apps/desktop by design — see cmd_update in hermes_cli/main.py),-//! 3. run `hermes desktop --build-only` (the rebuild step update skips),-//! 4. launch the freshly-built desktop (reuses bootstrap::launch logic).-//!-//! We reuse the `BootstrapEvent` channel + the existing progress UI by-//! emitting a synthetic multi-stage manifest (handoff → update → rebuild, plus-//! an install stage on macOS). To the frontend an update looks like a short-//! bootstrap, broken into the real operations run_update performs so the user-//! sees discrete steps (with the live log underneath) instead of one bar.-//!-//! Cross-platform note: `hermes update` already handles macOS/Linux (git/pip).-//! The only OS-specific bits here are the venv shim path (resolve_hermes) and-//! the no-window creation flag — both already cfg-gated. Keep new logic-//! OS-agnostic so the mac/linux port stays "fill in the paths".+//! Application output locks protect replacement. Python owns dependency+//! generations, product compilation, and gateway draining/restart. Only a+//! pre-PM runtime gets the historical extra rebuild/retry. Published launchers+//! bind every command to the installation; user-bin migration verifies identity+//! through the existing `--version` surface before selecting an older launcher.+ use std::collections::VecDeque;+ use std::env;use std::ffi::OsString;use std::path::{Path, PathBuf};use std::process::Stdio;@@@ -753,23 -962,10 +774,24 @@@ async fn run_streamedenvs: &[(String, OsString)],stage: Option<&str>,) -> Result<CmdResult> {+ let mut stdout_tail: VecDeque<String> = VecDeque::with_capacity(STDOUT_TAIL_LINES);-- let mut cmd = Command::new(program);- cmd.args(args)+ let current = resolve_hermes(cwd).await.ok_or_else(|| anyhow!("Installation launcher missing under {}", cwd.display()))?;+ let mut command: Vec<String> = vec![current.to_string_lossy().into_owned()];+ if current.starts_with(cwd.join(".hermes").join("bin")) {+ let mut query = Command::new(¤t);+ query.arg("--print-runtime-command").current_dir(cwd);+ #[cfg(windows)]+ query.creation_flags(0x0800_0000);+ for (key, value) in envs { query.env(key, value); }+ let output = query.output().await?;+ if !output.status.success() { return Err(anyhow!("Installation launcher could not resolve its runtime: {}", current.display())); }+ command = serde_json::from_slice(&output.stdout)?;+ if command.len() < 2 || command.iter().any(|part| part.is_empty()) {+ return Err(anyhow!("Installation launcher returned invalid runtime command"));+ }+ }+ let mut cmd = Command::new(&command[0]);+ cmd.args(&command[1..]).args(args).current_dir(cwd).stdin(Stdio::null()).stdout(Stdio::piped())@@@ -822,28 -1025,34 +851,30 @@@struct CmdResult {exit_code: Option<i32>,+ /// Last [`STDOUT_TAIL_LINES`] stdout lines; see [`concurrent_update_message`].+ stdout_tail: Vec<String>,}-/// Path to the venv hermes shim under an install root, regardless of existence.-fn venv_hermes(install_root: &Path) -> PathBuf {- if cfg!(target_os = "windows") {- install_root.join("venv").join("Scripts").join("hermes.exe")- } else {- install_root.join("venv").join("bin").join("hermes")- }-}--/// Resolve the hermes CLI to drive. Prefer the venv shim in the install we-/// just updated; fall back to `hermes` on PATH.-fn resolve_hermes(install_root: &Path) -> Option<PathBuf> {- let shim = venv_hermes(install_root);- if shim.exists() {- return Some(shim);+/// Resolve only a launcher owned by this installation, never PATH.+async fn resolve_hermes(install_root: &Path) -> Option<PathBuf> {+ let names: &[&str] = if cfg!(target_os = "windows") { &["hermes.exe", "hermes.cmd"] } else { &["hermes"] };+ for name in names {+ let launcher = install_root.join(".hermes").join("bin").join(name);+ if launcher.is_file() { return Some(launcher); }}- // PATH fallback. which-style probe via env, kept dependency-free.- let exe = if cfg!(target_os = "windows") { "hermes.exe" } else { "hermes" };- if let Ok(path) = std::env::var("PATH") {- let sep = if cfg!(target_os = "windows") { ';' } else { ':' };- for dir in path.split(sep) {- let cand = Path::new(dir).join(exe);- if cand.exists() {- return Some(cand);+ // Earlier PM publication lived in user-bin only. The CLI's existing+ // version surface proves which source tree that command belongs to.+ if install_root.join("hermes_cli/_launchers.py").is_file() {+ let mut directories = vec![crate::paths::hermes_home().join("bin")];+ if let Some(home) = dirs::home_dir() { directories.push(home.join(".local/bin")); }+ if let Some(parent) = install_root.parent() { directories.push(parent.join("bin")); }+ if let Some(local) = std::env::var_os("LOCALAPPDATA") { directories.push(PathBuf::from(local).join("hermes/bin")); }+ for directory in directories {+ for name in names {+ let candidate = directory.join(name);+ if candidate.is_file() && launcher_targets_installation(&candidate, install_root).await {+ return Some(candidate);+ }}}}diff --cc apps/desktop/electron/main.tsindex 6e1eb2d2a42,d8f5c1b35e0..2a11b4dede4--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@@ -340,10 -318,10 +340,11 @@@ import { loadNativeTokenSet, type Nativimport { registerNativeNotifications } from './notification-ipc'import { serializeJsonBody, setJsonRequestHeaders } from './oauth-net-request'import { LEGACY_OAUTH_PARTITION, resolveOauthPartition } from './oauth-partition'-import { mintGatewayWsTicket as mintOauthGatewayWsTicket, requestWithOauthFallback } from './oauth-rest-request'import { wireOauthSessionResponse } from './oauth-session-response'+import { listWindowsProcesses, reapPackageRootedProcesses } from './package-process-reap'import { createParentStartMarkerResolver, parentWatchdogEnv } from './parent-process-identity'+import { bundledPayload, installIdForRoot, type PayloadInfo } from './payload-backend'+ import { petOverlayClickThrough } from './pet-overlay'import { placePetOverlay, registerPetOverlayIpc } from './pet-overlay-ipc'import {pendingNotice as pendingPluginCompatNotice,