The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge commit '03537d69dc' into feat/local-models
emozillaa00e265b2b0d
diff --cc agent/model_metadata.pyindex 43e4aed15e6,b1e4724ce9b..f40d0a90a6e--- a/agent/model_metadata.py+++ b/agent/model_metadata.py@@@ -2310,28 -2354,8 +2383,29 @@@ def _query_local_context_length_uncachereturn int(ctx)break+ # llama.cpp: /props reports default_generation_settings.n_ctx —+ # the RUNTIME window the server grants. Critically, the router+ # answers this (from its preset) even for a model that is not+ # currently loaded, while /v1/models reports meta=null until+ # load. Without this probe, resolving a lazily-loaded model at+ # session start finds no metadata and falls through to the+ # name-pattern defaults, where a family catch-all (e.g. "qwen"+ # = 131072) misreports a server launched at 262144.+ if server_type == "llamacpp":+ for props_path in (f"/props?model={model}", "/props"):+ try:+ resp = client.get(f"{server_url}{props_path}")+ except httpx.HTTPError:+ break+ if resp.status_code != 200:+ continue+ n_ctx = (resp.json().get("default_generation_settings")+ or {}).get("n_ctx")+ if isinstance(n_ctx, (int, float)) and n_ctx:+ return int(n_ctx)+- # LM Studio / vLLM / llama.cpp: try /v1/models/{model}+ # LM Studio / vLLM / llama.cpp / Anthropic-compat proxies:+ # try /v1/models/{model}resp = client.get(f"{server_url}/v1/models/{model}")if resp.status_code == 200:data = resp.json()diff --cc apps/desktop/src/app/gateway/hooks/use-gateway-boot.tsindex b8d422c2116,15ec2595973..86e1f2c983a--- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts@@@ -29,8 -36,13 +36,14 @@@ importtouchSecondaryGateways} from '@/store/gateway'import { registerGatewayReconnect } from '@/store/gateway-reconnect'- import { $gatewaySwitching, wipeSessionListsForGatewaySwitch } from '@/store/gateway-switch'+ import {+ $gatewaySwitching,+ beginGatewaySwitch,+ endGatewaySwitch,+ isCurrentGatewaySwitch,+ registerGatewaySwitchLifecycle+ } from '@/store/gateway-switch'+import { checkLocalRuntimeUpdate, watchLocalRuntimeJobs } from '@/store/local-runtime-jobs'import { notify, notifyError } from '@/store/notifications'import {$activeGatewayProfile,@@@ -405,31 -587,49 +588,55 @@@ export function useGatewayBoot(// re-pulls /api/profiles deterministically post-switch — leaving the// rail stale or (if a stale in-flight response landed) collapsed// (#85731). Best-effort like the rest: a failure keeps the cached- // list rather than blanking the rail.- await adoptPrimaryProfile()+ // list rather than blanking the rail. NOT awaited: refreshProfiles+ // now carries a bounded retry chain (#70679), and switch completion+ // must not wait out backoff timers against an unhealthy backend.+ if (!(await adoptPrimaryProfile(ownsSwitch)) || !ownsSwitch()) {+ return+ }++ void refreshActiveProfile().catch(() => undefined)+await Promise.all([- seedDefaultCwd(),- refreshActiveProfile().catch(() => undefined),- callbacksRef.current.refreshHermesConfig().catch(() => undefined),- callbacksRef.current.refreshSessions().catch(() => undefined)+ seedDefaultCwd(ownsSwitch),+ callbacksRef.current.refreshHermesConfig(false, ownsSwitch).catch(() => undefined),+ callbacksRef.current.refreshSessions(ownsSwitch).catch(() => undefined)])++ if (!ownsSwitch()) {+ return+ }+completeDesktopBoot()bootCompleted = true+ // Rediscover local-runtime jobs (model downloads, runtime installs)+ // that were running before a reload — the backend registry is the+ // authority; this just resumes following it.+ watchLocalRuntimeJobs()+ // One-per-session engine-update pointer (enabled runtimes only).+ void checkLocalRuntimeUpdate()} catch (err) {- if (!cancelled) {+ const mayPublishFailure =+ !cancelled && (switchToken === null ? !$gatewaySwitching.get() : isCurrentGatewaySwitch(switchToken))++ if (mayPublishFailure) {const message = err instanceof Error ? err.message : String(err)failDesktopBoot(message)- notifyError(err, translateNow('boot.errors.desktopBootFailed'))++ // Only the current owner may lower loading. A failed begin returns no+ // token and cleans its own barrier internally; lower loading only when+ // that cleanup did not preserve a recursively-started newer switch.setSessionsLoading(false)++ notifyError(err, translateNow('boot.errors.desktopBootFailed'))}} finally {- $gatewaySwitching.set(false)+ // beginGatewaySwitch cleans up internally when setup throws before+ // returning. Never use token-less teardown here: it would force down a+ // newer switch started synchronously by error recovery/notification UI.+ if (switchToken !== null) {+ endGatewaySwitch(switchToken)+ }}}diff --cc hermes_cli/config_defaults.pyindex 4abfe0a095b,d3c36844a4d..53f27349cac--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@@ -3670,31 -3806,8 +3806,31 @@@ DEFAULT_CONFIG ="region": "global",},+ # Managed llama.cpp local runtime (see docs: user-guide/local-models).+ # Hermes downloads official llama.cpp release binaries, then spawns and+ # supervises one llama-server in router mode. Context sizing is policy,+ # not preference: there are deliberately no context/VRAM knobs here.+ "local_runtime": {+ # Master switch for the managed runtime. Off = detection-only+ # (Hermes still finds an external llama-server you run yourself).+ "enabled": False,+ # Pinned llama.cpp release tag (rolling bNNNN). Bumped by Hermes+ # releases after the validation suite re-runs, not tracked live.+ "tag": "b10362",+ # Inference backend: auto = CUDA on NVIDIA, Metal on macOS, Vulkan on+ # other GPUs, else CPU. Explicit values: cuda|metal|vulkan|hip|cpu.+ "backend": "auto",+ # Router process: how many models may be resident at once.+ "models_max": 4,+ # Port for the managed server. 0 = pick a free port at spawn.+ "port": 0,+ # Extra ports detection probes for an external llama-server, in+ # addition to the default 8080.+ "detect_ports": [],+ },+# Config schema version - bump this when adding new required fields- "_config_version": 38,+ "_config_version": 39,}# Optional environment variables that enhance functionality