The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(local-runtime): show live placement — how each loaded model is actually running
emozilla412b55b27edc
diff --git a/apps/desktop/src/app/settings/local-models-settings.tsx b/apps/desktop/src/app/settings/local-models-settings.tsxindex 9017c232e70..66cedc513bb 100644--- a/apps/desktop/src/app/settings/local-models-settings.tsx+++ b/apps/desktop/src/app/settings/local-models-settings.tsx@@ -380,6 +380,7 @@ export function LocalModelsSettings() {const residency = activateTarget ? status.loaded_models[activateTarget] : undefinedconst isLoaded = residency === 'loaded' || residency === 'ready'const isLoadingNow = residency === 'loading'+ const livePlacement = activateTarget ? status.placement?.[activateTarget] : undefinedconst aJob = jobs.find(j => j.kind === 'model-activate' && j.status === 'running' && j.model_id === activateTarget@@ -392,7 +393,23 @@ export function LocalModelsSettings() {action={model.downloaded ? (<div className="flex items-center justify-end gap-2">- {isLoaded && <Pill>{copy.loadedPill}</Pill>}+ {isLoaded && livePlacement && (+ <Tip+ label={+ livePlacement.spilled+ ? copy.placementSpilledTip+ : copy.placementResidentTip+ }+ >+ <Pill tone={livePlacement.spilled ? 'warn' : 'success'}>+ <Cpu className="mr-1 size-3" />+ {livePlacement.granted_window_label ?? livePlacement.window_label ?? ''}+ {' · '}+ {livePlacement.spilled ? copy.placementSpilled : copy.placementResident}+ </Pill>+ </Tip>+ )}+ {isLoaded && !livePlacement && <Pill>{copy.loadedPill}</Pill>}{isLoadingNow && (<Pill>diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 48ccafeb403..eb135c19e48 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -907,6 +907,11 @@ export const en: Translations = {activeDetail: 'New chats use this model — it loads when you send your first message',activeNotLoaded: 'Loads on your first message',loadedPill: 'In memory',+ placementResident: 'all on GPU',+ placementSpilled: 'partly in RAM',+ placementResidentTip: 'Running entirely in GPU memory at this context window — full speed.',+ placementSpilledTip:+ 'Part of this model runs from system RAM — it works, but slower. A more compact build or a smaller context would fit fully.',loadingPill: 'Loading…',ejectTip: 'Free GPU memory (loads again on the next message)',ejected: 'Model unloaded — GPU memory freed.',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 7dcbce21604..0ebcf183080 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -932,6 +932,10 @@ export const ja = defineLocale({activeDetail: '新しいチャットはこのモデルを使用——最初のメッセージ送信時に読み込みます',activeNotLoaded: '最初のメッセージで読み込みます',loadedPill: '読み込み済み',+ placementResident: 'すべて GPU 上',+ placementSpilled: '一部 RAM 上',+ placementResidentTip: 'このコンテキストウィンドウで GPU メモリ内で完全に動作しています — フルスピード。',+ placementSpilledTip: 'モデルの一部がシステム RAM から動作しています — 動作しますが遅くなります。よりコンパクトなビルドか小さいコンテキストなら完全に収まります。',loadingPill: '読み込み中…',ejectTip: 'GPU メモリを解放(必要時に再読み込み)',ejected: 'モデルをアンロードしました——GPU メモリを解放しました。',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex d48c8801cce..3ca8af96fe0 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -774,6 +774,10 @@ export interface Translations {activeDetail: stringactiveNotLoaded: stringloadedPill: string+ placementResident: string+ placementSpilled: string+ placementResidentTip: string+ placementSpilledTip: stringloadingPill: stringejectTip: stringejected: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 4595c1a9f88..65564a0d3f3 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -903,6 +903,10 @@ export const zhHant = defineLocale({activeDetail: '新對話使用此模型——傳送首條訊息時載入',activeNotLoaded: '首條訊息時載入',loadedPill: '已載入',+ placementResident: '全部在 GPU',+ placementSpilled: '部分在記憶體',+ placementResidentTip: '完全在 GPU 記憶體中以此上下文視窗執行——全速。',+ placementSpilledTip: '模型的一部分從系統記憶體執行——可用但較慢。更緊湊的版本或更小的上下文可以完全放入顯示記憶體。',loadingPill: '載入中…',ejectTip: '釋放顯示記憶體(需要時重新載入)',ejected: '模型已卸載——顯示記憶體已釋放。',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex f0343179926..10b63e93282 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -1107,6 +1107,10 @@ export const zh: Translations = {activeDetail: '新对话使用此模型——发送首条消息时加载',activeNotLoaded: '首条消息时加载',loadedPill: '已加载',+ placementResident: '全部在 GPU',+ placementSpilled: '部分在内存',+ placementResidentTip: '完全在 GPU 显存中以此上下文窗口运行——全速。',+ placementSpilledTip: '模型的一部分从系统内存运行——可用但较慢。更紧凑的版本或更小的上下文可以完全放入显存。',loadingPill: '加载中…',ejectTip: '释放显存(需要时重新加载)',ejected: '模型已卸载——显存已释放。',diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.tsindex a5384ef22a4..f42de4b765d 100644--- a/apps/desktop/src/types/hermes.ts+++ b/apps/desktop/src/types/hermes.ts@@ -1161,6 +1161,14 @@ export interface StatusResponse {// ── Managed local runtime (llama.cpp) ──────────────────────────+export interface LocalModelPlacement {+ window?: number+ window_label?: string+ spilled?: boolean+ granted_window?: number+ granted_window_label?: string+}+export interface LocalModelsStatus {enabled: booleantag: string@@ -1172,6 +1180,7 @@ export interface LocalModelsStatus {server_base_url: string | nullactive_model_id: string | nullloaded_models: Record<string, string>+ placement?: Record<string, LocalModelPlacement>models: { id: string; size_bytes: number; size_label: string }[]models_dir: string}diff --git a/hermes_cli/local_runtime/presets.py b/hermes_cli/local_runtime/presets.pyindex f518df2cbdb..1b7031b731b 100644--- a/hermes_cli/local_runtime/presets.py+++ b/hermes_cli/local_runtime/presets.py@@ -161,6 +161,30 @@ def generate_presets(models_dir: Path, budget: HardwareBudget,return entries+def read_preset_decisions(preset_path: Path | None = None) -> dict[str, PresetEntry]:+ """The launch decisions the running server was actually given, read+ back from the preset INI (the INI is the record — it's what spawned+ the children). Missing/unparseable file returns {}."""+ import configparser++ if preset_path is None:+ from hermes_constants import get_hermes_home++ preset_path = get_hermes_home() / "runtimes" / "llamacpp" / "presets.ini"+ out: dict[str, PresetEntry] = {}+ try:+ parser = configparser.ConfigParser()+ parser.read(preset_path, encoding="utf-8")+ for section in parser.sections():+ window = parser.getint(section, "ctx-size", fallback=0)+ spilled = parser.has_option(section, "override-tensor")+ out[section] = PresetEntry(model_id=section, window=window,+ spilled=spilled)+ except Exception as exc: # noqa: BLE001+ logger.debug("preset read-back failed: %s", exc)+ return out++def _strip_part(stem: str) -> str:import rediff --git a/hermes_cli/web_routers/local_models.py b/hermes_cli/web_routers/local_models.pyindex 9e0374dc690..74b02fc8653 100644--- a/hermes_cli/web_routers/local_models.py+++ b/hermes_cli/web_routers/local_models.py@@ -305,6 +305,7 @@ async def local_models_status():# from the live router when it's up; {} when down. Feeds the pane's# Loaded pills and eject buttons.loaded: Dict[str, str] = {}+ placement: Dict[str, Any] = {}if running is not None:try:import urllib.request as _url@@ -322,6 +323,39 @@ async def local_models_status():# single most important thing the pane can show).if m.get("status", {}).get("value") in ("loaded", "ready", "loading")}+ # How each loaded model is actually running: the granted window+ # from the child itself, and the plan's spill facts from the+ # preset decision. The pane shows this verbatim — placement is+ # the difference between 'fast' and 'why is my CPU busy', so it+ # must be inspectable, not inferred from Task Manager.+ from hermes_cli.local_runtime.presets import read_preset_decisions++ decisions = read_preset_decisions()+ for model_id in loaded:+ entry_facts: Dict[str, Any] = {}+ plan = decisions.get(model_id)+ if plan is not None:+ entry_facts["window"] = plan.window+ entry_facts["window_label"] = f"{plan.window // 1024}K"+ entry_facts["spilled"] = plan.spilled+ if loaded[model_id] in ("loaded", "ready"):+ try:+ preq = _url.Request(+ running["base_url"].rsplit("/v1", 1)[0]+ + f"/props?model={model_id}",+ headers={"Authorization":+ f"Bearer {running.get('api_key', '')}"})+ with _url.urlopen(preq, timeout=3) as pr:+ props = json.loads(pr.read())+ n_ctx = (props.get("default_generation_settings", {})+ .get("n_ctx"))+ if n_ctx:+ entry_facts["granted_window"] = int(n_ctx)+ entry_facts["granted_window_label"] = f"{int(n_ctx) // 1024}K"+ except Exception: # noqa: BLE001+ pass+ if entry_facts:+ placement[model_id] = entry_factsexcept Exception as exc: # noqa: BLE001# Never silent: an empty dict here renders as 'Not in memory'# on a machine whose VRAM is visibly full.@@ -353,6 +387,7 @@ async def local_models_status():"server_base_url": (running or {}).get("base_url"),"active_model_id": active_model_id,"loaded_models": loaded,+ "placement": placement,"models": staged,"models_dir": str(mdir),}