The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
merge: current main into consolidated PM and onboarding
ethernet38dfe6df507a
diff --cc agent/anthropic_adapter.pyindex 05430e23424,db0902f1ef3..d19927984a0--- a/agent/anthropic_adapter.py+++ b/agent/anthropic_adapter.py@@@ -425,12 -419,17 +425,17 @@@ def build_anthropic_bedrock_client(regi``context-1m-2025-08-07`` are attached: without the latter Bedrock caps Opus 4.6/4.7 at 200K.A configured ``bedrock.guardrail`` rides as InvokeModel headers so every client built here(primary, auxiliary, per-request rebuild) enforces it."""- from agent.bedrock_adapter import bedrock_guardrail_headers+ from agent.bedrock_adapter import bedrock_guardrail_headers, scoped_aws_session_kwargssdk = _require_sdk("the Bedrock provider")if not hasattr(sdk, "AnthropicBedrock"):- raise ImportError("anthropic.AnthropicBedrock not available. Upgrade with: pip install 'anthropic>=0.39.0'")+ raise ImportError("anthropic.AnthropicBedrock not available. Run: hermes pm repair")+ # Routed multiplex profile: its own AWS_* from the secret scope (the SDK would otherwise read the+ # launch profile's process env); unscoped passes nothing and keeps the default chain.+ scoped = scoped_aws_session_kwargs()+ aws_kwargs = {"aws_access_key": scoped.get("aws_access_key_id"), "aws_secret_key": scoped.get("aws_secret_access_key"),+ "aws_session_token": scoped.get("aws_session_token"), "aws_profile": scoped.get("profile_name")}return sdk.AnthropicBedrock(- aws_region=region, timeout=_client_timeout(None),+ aws_region=region, timeout=_client_timeout(None), **{k: v for k, v in aws_kwargs.items() if v},max_retries=0, # retry belongs to hermes's outer loop (honors Retry-After)default_headers={**_beta_header([*_COMMON_BETAS, _CONTEXT_1M_BETA]), **bedrock_guardrail_headers()},)diff --cc agent/model_metadata.pyindex 25192d59cba,402b400e70c..fcdbb522292--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@@ -876,10 -968,12 +923,11 @@@ def fetch_endpoint_model_metadata(base_normalized = _normalize_base_url(base_url)if not normalized or base_url_host_matches(normalized, "openrouter.ai"):return {}- _ensure_requests()local = is_local_endpoint(normalized)+ memo_key = _endpoint_memo_key(normalized, api_key)if not force_refresh:- cached = _endpoint_model_metadata_cache.get(normalized)- if cached is not None and (time.time() - _endpoint_model_metadata_cache_time.get(normalized, 0)) < _ENDPOINT_MODEL_CACHE_TTL:+ cached = _endpoint_model_metadata_cache.get(memo_key)+ if cached is not None and (time.time() - _endpoint_model_metadata_cache_time.get(memo_key, 0)) < _ENDPOINT_MODEL_CACHE_TTL:return cachedmemo = _endpoint_disk_cache_get(normalized) if not local else Noneif memo is not None:@@@ -924,9 -1018,12 +972,9 @@@except Exception as exc:last_error = exc_note_if_connect_timeout(exc, normalized)- finally:- if response is not None:- response.close()if last_error:logger.debug("Failed to fetch model metadata from %s/models: %s", normalized, last_error)- return _remember_endpoint_models(normalized, {})+ return _remember_endpoint_models(memo_key, {})def _resolve_endpoint_context_length(model: str, base_url: str, api_key: str = "") -> Optional[int]:diff --cc apps/desktop/electron/main.tsindex ea8858f49c4,288c97e00d2..202d772086e--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@@ -94,9 -95,9 +94,10 @@@ importbuildBrowserWindowUrl} from './browser-windows'import { detectBundleSkew } from './bundle-skew'-import { detectBundleSwap } from './bundle-swap'+import { detectBundleSwap, readBundleSwapStamp } from './bundle-swap'import { registerChatOnboardingWindow } from './chat-onboarding-window'+import { provisionCliLinks } from './cli-provision'+ import { writeComposerPaste } from './composer-paste'import { applyConnectionChange, teardownSshState } from './connection-apply'import {apiRequestRegistryConnectionId,diff --cc apps/desktop/src/i18n/en.tsindex de6a7f01660,7425997b254..6fba729eb50--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@@ -3145,50 -3172,19 +3164,60 @@@ export const en: Translations =notAvailable: 'Update not available for this backend.',failed: 'Backend update failed.',noReturn: 'Backend didn’t come back online. The update may not have completed — check the backend host.'- }+ },+ // Update-status overlay + version-details (mechanism-aware update UI).+ appName: 'Hermes',+ version: (value: string) => `Version ${value}`,+ versionUnavailable: 'Version unavailable',+ checkNow: 'Check now',+ seeWhatsNew: "See what's new",+ releaseNotes: 'Release notes',+ onLatest: "You're on the latest version.",+ installing: 'An update is currently installing.',+ cantReach: "We couldn't reach the update server.",+ tapCheck: 'Tap "Check now" to look for updates.',+ updateReady: count => `A new update is ready (${count} change${count === 1 ? '' : 's'} included).`,+ updateReadyUnknown: 'A new update is ready.',+ availableBodyRelease: tag => `Version ${tag} is ready to install.`,+ lastChecked: age => `Last checked ${age}`,+ never: 'never',+ justNow: 'just now',+ minAgo: count => `${count} min ago`,+ hoursAgo: count => `${count}h ago`,+ daysAgo: count => `${count}d ago`,+ justNowSuffix: ' · just now',+ bundleOutOfSync: 'App build out of date',+ bundleOutOfSyncDesc:+ 'The Hermes runtime was updated, but the desktop app itself is still an older build. Update it to pick up the latest fixes.',+ bundleOutOfSyncAction: 'Get the installer',+ checkingShort: 'Checking…',+ releaseAvailable: tag => `Version ${tag} is available.`,+ versionDetailsTitle: 'Version details',+ versionDetailsBody:+ 'This install is managed outside the app. Update it the same way you installed it.',+ versionDetailsVersion: 'Version',+ versionDetailsCommit: 'Commit',+ versionDetailsBuildOrigin: 'Build Origin',+ versionDetailsDistribution: 'Distribution',+ versionDetailsDistributionDesktop: 'Desktop app (MSIX)',+ versionDetailsDistributionStore: 'Microsoft Store',+ versionDetailsRuntime: 'Runtime',+ versionDetailsRuntimeEmbedded: 'Embedded runtime',+ versionDetailsRuntimeExternal: 'External (uses the machine runtime)',+ versionDetailsInstallId: 'Install ID',+ versionDetailsUncommittedChanges: 'uncommitted changes'},+ handoffTour: {+ profileTitle: 'Your first task runs on the default profile',+ profileText:+ 'This rail switches profiles. The one lit up now is default, where the task session lives. The other one is the setup profile, where the welcome chat lives.',+ sessionsTitle: 'Each profile keeps its own sessions',+ sessionsText:+ 'This list belongs to the default profile. New session starts one on whichever profile is selected. Switch profiles on the rail and the list changes with it.',+ stayTitle: 'Hermes is one click away',+ stayText: 'Switch to the setup profile and open Welcome to Hermes whenever you want a hand. It stays there.'+ },guidedGreeting: {line: "Hey, come on in. I'm Hermes. Give me two minutes to set the place up around you, then we'll put me to work on something you actually want done.\n\nFirst though, what should I call you?",nameSuggestion: (name: string) => `(I can also just call you ${name}, if you prefer.)`diff --cc apps/desktop/src/i18n/zh.tsindex 0e0e0456717,6e61a61dc4c..4b0027e7536--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@@ -1,14 -1,8 +1,14 @@@import { defineFieldCopy } from '@/app/settings/field-copy'- import type { Translations } from './types'+ import { defineLocale } from './define-locale'- export const zh: Translations = {+ export const zh = defineLocale({+ externalOpenFailed: {+ title: '无法打开此链接',+ message: '没有注册用于打开此地址的浏览器。请复制链接并手动打开。',+ copyUrl: '复制链接',+ close: '关闭'+ },connectors: {title: '连接你的应用',connect: '连接',diff --cc hermes_cli/config_defaults.pyindex 12322aafe76,ea5bdac14fe..437debf6dec--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@@ -1891,9 -1901,6 +1905,7 @@@ DEFAULT_CONFIG ="export": {"otlp": {"enabled": False, "endpoint": "", "headers_env": {}}},},"gateway": { # Gateway settings (messaging platforms: Telegram, Discord, Slack, ...).- # Named-profile allowlist for multiplex mode. None = serve all; [] = default only.- "multiplex_profile_allowlist": None,+# Seconds to let a SIGTERM-interrupted gateway agent unwind before adapter/database# teardown. Keep short so service-manager shutdowns don't exhaust their stop budget."signal_interrupt_grace_timeout": 1,diff --cc hermes_cli/gateway.pyindex aa877094ce9,ed480d5095a..1d3f7cf55b8--- a/hermes_cli/gateway.py+++ b/hermes_cli/gateway.py@@@ -1097,13 -1097,10 +1097,10 @@@ def _systemctl_show(properties: tuple[sreturn _parse_kv_pairs(result.stdout.splitlines()) if result.returncode == 0 else {}- def _hermes_home_from_systemd_unit_file(system: bool = False) -> str | None:- """``HERMES_HOME`` from the on-disk unit file — what refresh/compare already read, and reliable under ``sudo``."""- unit_path = get_systemd_unit_path(system=system)- if not unit_path.exists():- return None+ def _hermes_home_pinned_by_unit(unit_path: Path) -> str | None:+ """``HERMES_HOME`` pinned by the unit file at *unit_path*, or None when absent/unreadable."""try:- text = unit_path.read_text(encoding="utf-8")+ text = unit_path.read_text(encoding="utf-8-sig")except OSError:return Nonefor line in text.splitlines():diff --cc hermes_cli/status.pyindex e07454f122f,20bb7b70d0c..d7abe339b8c--- a/hermes_cli/status.py+++ b/hermes_cli/status.py@@@ -233,8 -234,15 +233,12 @@@ def _render_gateway(ctx)_kv("PID(s):", _format_gateway_pids(snapshot.gateway_pids))if snapshot.running and (served := multiplexer_served_secondaries()):_kv("Serves:", ", ".join(served))+ from hermes_cli.gateway_multiplex_served import served_profile_ingress_urls+ for name, per_platform in sorted(served_profile_ingress_urls().items()):+ for platform, url in sorted(per_platform.items()):+ _kv(f" {name}/{platform}:", url)if snapshot.has_process_service_mismatch:_kv("Service:", "installed but not managing the current running gateway")- elif _is_termux() and not snapshot.gateway_pids:- _kv("Start with:", "hermes gateway")- _kv("Note:", "Android may stop background jobs when Termux is suspended")elif snapshot.service_installed and not snapshot.service_running:_kv("Service:", "installed but stopped")except Exception:diff --cc hermes_constants.pyindex 4504c4bcebe,dced36c03e9..2f1a90a884f--- a/hermes_constants.py+++ b/hermes_constants.py@@@ -48,10 -47,29 +48,29 @@@ def _get_platform_default_hermes_home(if sys.platform == "win32":local_appdata = os.environ.get("LOCALAPPDATA", "").strip()base = Path(local_appdata) if local_appdata else Path.home() / "AppData" / "Local"- return base / "hermes"- return Path.home() / ".hermes"+ return base / ("hermes" + suffix)+ return Path.home() / (".hermes" + suffix)+ def sudo_invoker_default_home() -> Path | None:+ """The invoking user's native ``~/.hermes`` when this process is root under ``sudo``, else None.++ sudo strips HERMES_HOME and sets HOME=/root, so the process's own default is root's; the profile+ store and the system service being operated on belong to SUDO_USER.+ """+ if not hasattr(os, "geteuid") or os.geteuid() != 0:+ return None+ sudo_user = os.environ.get("SUDO_USER", "").strip()+ if not sudo_user or sudo_user == "root":+ return None+ import pwd++ try:+ return Path(pwd.getpwnam(sudo_user).pw_dir) / ".hermes"+ except KeyError: # SUDO_USER not in passwd (chroot/container)+ return None++def _warn_profile_fallback_once() -> None:"""Warn once when HERMES_HOME is unset but a non-default profile is sticky-active (wrong fallback)."""global _profile_fallback_warneddiff --cc plugins/memory/hindsight/__init__.pyindex d150f410def,25e663e7618..afeb558c6da--- a/plugins/memory/hindsight/__init__.py+++ b/plugins/memory/hindsight/__init__.py@@@ -77,17 -77,25 +77,19 @@@ def _maybe_upgrade_client() -> Noneif Version(installed) < Version(_MIN_CLIENT_VERSION):logger.warning("hindsight-client %s is outdated (need >=%s), attempting upgrade...",installed, _MIN_CLIENT_VERSION)- from tools.lazy_deps import install_specs- outcome = install_specs([f"hindsight-client>={_MIN_CLIENT_VERSION}"], timeout=120)- if outcome.ok:- logger.info("hindsight-client upgraded to >=%s", _MIN_CLIENT_VERSION)- elif outcome.blocked:- logger.warning("Auto-upgrade unavailable: %s. Run: uv pip install 'hindsight-client>=%s'",- outcome.reason, _MIN_CLIENT_VERSION)- else:- logger.warning("Auto-upgrade failed: %s. Run: uv pip install 'hindsight-client>=%s'",- (outcome.stderr or "").strip() or "install error", _MIN_CLIENT_VERSION)- except Exception:- pass # packaging not available or other issue — proceed anyway+ import pm++ pm.sync_venv(["hindsight"])+ logger.info("hindsight-client resynced against uv.lock")+ except Exception as exc:+ logger.warning("Auto-upgrade unavailable: %s. Run: hermes pm install", exc)- # update_mode='append' capability (Hindsight >= 0.5.0), cached per API URL per- # process so every provider on the same API shares one /version round trip.- _append_capability_cache: Dict[str, bool] = {}+ # update_mode='append' capability (Hindsight >= 0.5.0), cached per (API URL, key fingerprint)+ # per process so every provider on the same API+key shares one /version round trip. A failed probe+ # caches False, so the key must include the credential or one profile's 401 would silently downgrade+ # a sibling profile that shares the URL with a valid key.+ _append_capability_cache: Dict[tuple[str, str | None], bool] = {}_append_capability_lock = threading.Lock()diff --cc tests/hermes_cli/test_gateway_service.pyindex 36d858036a4,23594785733..62c18558467--- a/tests/hermes_cli/test_gateway_service.py+++ b/tests/hermes_cli/test_gateway_service.py@@@ -411,9 -418,8 +419,8 @@@ class TestGeneratedSystemdUnitsassert "SoftResourceLimits" not in plist-class TestGatewayStopCleanup:- @pytest.mark.linux_only+ @pytest.mark.platforms("linux")def test_stop_only_kills_current_profile_by_default(self, tmp_path, monkeypatch):"""Without --all, stop uses systemd (if available) and does NOT callthe global kill_gateway_processes().@@@ -1178,12 -1177,7 +1174,7 @@@ class TestGatewaySystemServiceRoutingassert "did not revive" in outassert "✓ Service restarted" in out------ @pytest.mark.macos_only+ @pytest.mark.platforms("macos")def test_gateway_restart_does_not_fallback_to_foreground_when_launchd_restart_fails(self, tmp_path, monkeypatch):"""macOS-gated: the branch under test is ``elif is_macos() andget_launchd_plist_path().exists()``. Faking the platform flags on Linux@@@ -1301,9 -1236,7 +1292,8 @@@ class TestDetectVenvDirresult = gateway_cli._detect_venv_dir()assert result == dot_venv-def test_returns_none_when_no_virtualenv(self, tmp_path, monkeypatch):+ monkeypatch.setattr(gateway_cli, "_pm_runtime_venv_dir", lambda: None)monkeypatch.setattr("sys.prefix", "/usr")monkeypatch.setattr("sys.base_prefix", "/usr")monkeypatch.delenv("VIRTUAL_ENV", raising=False)@@@ -1484,10 -1368,9 +1474,9 @@@ class TestSystemUnitHermesHomeunit = gateway_cli.generate_systemd_unit(system=True, run_as_user="alice")- assert 'HERMES_HOME=/home/alice/.hermes' in unit- assert '/root/.hermes' not in unit+ assert f'HERMES_HOME={target_home / ".hermes"}' in unit+ assert str(caller_home / ".hermes") not in unit-def test_user_unit_unaffected_by_change(self):# User-scope units should still use the calling user's HERMES_HOMEunit = gateway_cli.generate_systemd_unit(system=False)diff --cc tools/approval.pyindex b1606733070,7fb8d43f9d2..ecf9fa4e097--- a/tools/approval.py+++ b/tools/approval.py@@@ -324,6 -350,29 +350,29 @@@ def _persist_choice(session_key: str, c# --- Config persistence for permanent allowlist ---------------------------------------------------------------------+ def _read_permanent_allowlist() -> set:+ """``command_allowlist`` of the active profile's config as a set (empty on malformed input)."""+ from hermes_cli.config import load_config_readonly+ config = load_config_readonly()+ raw = config.get("command_allowlist")+ legacy = isinstance(raw, str)+ if legacy:+ # Old config-set versions serialized list values as scalar strings.- import yaml++ import hermes_yaml as yaml+ try:+ raw = yaml.safe_load(raw)+ except yaml.YAMLError:+ raw = False+ if raw is None and not legacy:+ raw = []+ if not isinstance(raw, list) or any(not isinstance(item, str) for item in raw):+ logger.warning("Ignoring malformed command_allowlist; configure a list of strings.")+ return set()+ if legacy:+ logger.warning("Recovered legacy string command_allowlist; re-save it as a list of strings.")+ return set(raw)++def load_permanent_allowlist() -> set:"""Load ``command_allowlist`` from config and sync it into the approval stateso is_approved() honors 'always' choices from previous sessions."""diff --cc tools/environments/local.pyindex 2157254ed02,b9ffb48aa5e..00163f3ae10--- a/tools/environments/local.py+++ b/tools/environments/local.py@@@ -368,19 -337,80 +368,43 @@@ def build_subprocess_envreturn delegated_child_subprocess_env(env)+ def strip_launch_profile_env(env: dict, target_home: "str | Path | None" = None) -> dict:+ """Drop the LAUNCH profile's residue from a child env built for another served profile.+ ``os.environ`` holds the default profile's ``.env`` and its bridged ``TERMINAL_*`` settings;+ the secret scrub removes credentials but not settings (``HERMES_MODEL``, ``TERMINAL_ENV``,+ ``HERMES_LANGUAGE``...), so a standalone ``hermes -p X`` worker and a served one saw different+ envs. The child re-loads X's own ``.env`` and bridges X's config itself. ``target_home``+ defaults to the active home override; no-op outside multiplex or when the target IS the+ launch profile."""+ from agent.secret_scope import _is_global_env, is_multiplex_active, load_env_file+ from hermes_constants import get_hermes_home_override, get_process_hermes_home+ target = target_home or get_hermes_home_override()+ if not is_multiplex_active() or not target:+ return env+ launch_home = get_process_hermes_home()+ if Path(target).resolve() == launch_home.resolve():+ return env+ from hermes_cli.config import TERMINAL_CONFIG_ENV_MAP+ for key in set(load_env_file(launch_home / ".env")) | set(TERMINAL_CONFIG_ENV_MAP.values()):+ if not _is_global_env(key) or key.startswith("TERMINAL_"):+ env.pop(key, None)+ return env+++ # --- Shell discovery ----def _windows_bash_candidates(custom: "str | None") -> list[str]:- """Ordered bash.exe candidates on Windows: HERMES_GIT_BASH_PATH, our portable Git- under %LOCALAPPDATA%\\hermes\\git (PortableGit ``bin`` and MinGit ``usr\\bin``),- known Git-for-Windows dirs, then PATH last — ``shutil.which`` may return WSL's- bash, which fails silently on Windows paths."""- getenv = os.environ.get- lad = getenv("LOCALAPPDATA", "")- roots = [- lad and os.path.join(lad, "hermes", "git", "bin"),- lad and os.path.join(lad, "hermes", "git", "usr", "bin"),- os.path.join(getenv("ProgramFiles", r"C:\Program Files"), "Git", "bin"),- os.path.join(getenv("ProgramFiles(x86)", r"C:\Program Files (x86)"), "Git", "bin"),- lad and os.path.join(lad, "Programs", "Git", "bin"),- ]- raw = [custom or "", *(os.path.join(r, "bash.exe") for r in roots if r)]- candidates = list(dict.fromkeys(c for c in raw if c and os.path.isfile(c)))- found = shutil.which("bash")- if found and found not in candidates:- candidates.append(found)- return candidates--def _find_bash() -> str:- """Find bash for command execution."""- if not _IS_WINDOWS:- return (shutil.which("bash")- or next((p for p in ("/usr/bin/bash", "/bin/bash") if os.path.isfile(p)), None)- or os.environ.get("SHELL") or "/bin/sh")- custom = os.environ.get("HERMES_GIT_BASH_PATH")- candidates = _windows_bash_candidates(custom)- # First candidate that can actually start wins: a stale HERMES_GIT_BASH_PATH- # pointing at a broken install must not beat a healthy portable Git.- for candidate in candidates:- if _bash_starts(candidate):- if candidate != custom and custom and os.path.isfile(custom):- logger.warning(- "HERMES_GIT_BASH_PATH=%s fails to start; using %s instead", custom, candidate)- return candidate- if candidates:- probe_details = "\n".join(- detail for c in candidates if (detail := _bash_probe_details_cache.get(c)))- if _mandatory_aslr_enabled() is True or _looks_like_msys_spawn_failure(probe_details):- raise RuntimeError(_git_bash_aslr_help(candidates[0], probe_details))- # Unknown failure class: return the first path so the caller sees the- # real bash error instead of a less useful "not found".- return candidates[0]+ """Resolve the shell Hermes runs commands with. Owned by pm (the store+ is the authority on bundled bash); this is a thin wrapper over+ pm.shell() for callers that need a bash binary."""+ import pm.shell++ bash = pm.shell.bash()+ if bash:+ return bashraise RuntimeError(- "Git Bash not found. Hermes Agent requires Git for Windows on Windows.\n"- "Install it from: https://git-scm.com/download/win\n"- "Or set HERMES_GIT_BASH_PATH to your bash.exe location.")+ "No shell found. Hermes needs bash (Git for Windows on Windows). "+ "Run `hermes pm install` or reinstall the bundle."+ )_git_bash_bin_dirs_cache: "list[str] | None" = Nonediff --cc website/sidebars.tsindex 9553bd2e772,55d1ed80160..43801877af7--- a/website/sidebars.ts+++ b/website/sidebars.ts@@@ -28,9 -28,7 +28,8 @@@ const sidebars: SidebarsConfig ='user-guide/bot-mode','user-guide/windows-native','user-guide/windows-wsl-quickstart',+ 'user-guide/switching-to-source','user-guide/configuration',- 'user-guide/free-tier','user-guide/managed-scope','user-guide/configuring-models',{