Skip to content

The agent that grows with you

feat(local-runtime): catalog data moves to pulled JSON — day-0 models without an app release

emozillaaa43f4b175bb
diff --git a/hermes_cli/local_runtime/catalog.json b/hermes_cli/local_runtime/catalog.json
new file mode 100644
index 00000000000..437af775ee0
--- /dev/null
+++ b/hermes_cli/local_runtime/catalog.json
@@ -0,0 +1,347 @@
+{
+ "schema_version": 1,
+ "models": [
+ {
+ "id": "qwen3.8-27b",
+ "display_name": "Qwen3.8 27B",
+ "description": "Best all-round agent model; sees images; long context stays fast",
+ "repo": "unsloth/Qwen3.8-27B-GGUF",
+ "variants": [
+ {
+ "quant": "UD-Q8_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.8-27B-UD-Q8_K_XL.gguf",
+ "size_bytes": 31457991680
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q6_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.8-27B-UD-Q6_K_XL.gguf",
+ "size_bytes": 25299061664
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q5_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.8-27B-UD-Q5_K_XL.gguf",
+ "size_bytes": 20876938144
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q4_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.8-27B-UD-Q4_K_XL.gguf",
+ "size_bytes": 17559178144
+ }
+ ]
+ }
+ ],
+ "n_ctx_train": 262144,
+ "full_layers": 16,
+ "recurrent_layers": 48,
+ "per_layer_f16": 4096,
+ "n_vocab": 248320,
+ "mmproj": {
+ "path": "mmproj-BF16.gguf",
+ "size_bytes": 931146432,
+ "local": "mmproj-Qwen3.8-27B-BF16.gguf"
+ },
+ "sampling": {
+ "temp": "1.0",
+ "top-p": "0.95",
+ "top-k": "20",
+ "min-p": "0.0"
+ },
+ "tags": [
+ "recommended",
+ "hybrid",
+ "reasoning",
+ "vision",
+ "day-0"
+ ]
+ },
+ {
+ "id": "qwen3.6-35b-a3b",
+ "display_name": "Qwen3.6 35B-A3B",
+ "description": "Bigger mixture-of-experts with multi-token prediction; sees images",
+ "repo": "unsloth/Qwen3.6-35B-A3B-MTP-GGUF",
+ "variants": [
+ {
+ "quant": "UD-Q8_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.6-35B-A3B-UD-Q8_K_XL.gguf",
+ "size_bytes": 39099447584
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q6_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.6-35B-A3B-UD-Q6_K_XL.gguf",
+ "size_bytes": 32611711264
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q5_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.6-35B-A3B-UD-Q5_K_XL.gguf",
+ "size_bytes": 27159116064
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q4_K_XL",
+ "files": [
+ {
+ "path": "Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf",
+ "size_bytes": 22853663008
+ }
+ ],
+ "validated": true
+ }
+ ],
+ "n_ctx_train": 262144,
+ "full_layers": 10,
+ "recurrent_layers": 30,
+ "per_layer_f16": 2048,
+ "moe": true,
+ "mtp": true,
+ "n_vocab": 248320,
+ "mtp_draft_depth": 2,
+ "mmproj": {
+ "path": "mmproj-BF16.gguf",
+ "size_bytes": 902822528,
+ "local": "mmproj-Qwen3.6-35B-A3B-BF16.gguf"
+ },
+ "sampling": {
+ "temp": "1.0",
+ "top-p": "0.95",
+ "top-k": "20",
+ "min-p": "0.0"
+ },
+ "tags": [
+ "hybrid",
+ "moe",
+ "mtp",
+ "vision"
+ ]
+ },
+ {
+ "id": "nemotron-3.5-lightning-30b",
+ "display_name": "Nemotron 3.5 Lightning 30B",
+ "description": "NVIDIA's fast tool-calling model; 1M-token context",
+ "repo": "unsloth/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF",
+ "variants": [
+ {
+ "quant": "UD-Q8_K_XL",
+ "files": [
+ {
+ "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q8_K_XL.gguf",
+ "size_bytes": 38615380032
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q6_K_XL",
+ "files": [
+ {
+ "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q6_K_XL.gguf",
+ "size_bytes": 35004643392
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q5_K_XL",
+ "files": [
+ {
+ "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q5_K_XL.gguf",
+ "size_bytes": 30414829632
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q4_K_XL",
+ "files": [
+ {
+ "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q4_K_XL.gguf",
+ "size_bytes": 25505724480
+ }
+ ]
+ }
+ ],
+ "n_ctx_train": 1048576,
+ "full_layers": 6,
+ "recurrent_layers": 46,
+ "per_layer_f16": 1024,
+ "moe": true,
+ "mtp": true,
+ "n_vocab": 131072,
+ "sampling": {
+ "temp": "0.6",
+ "top-p": "0.95",
+ "min-p": "0.01"
+ },
+ "tags": [
+ "day-0",
+ "long-context",
+ "hybrid",
+ "moe",
+ "mtp"
+ ]
+ },
+ {
+ "id": "muse-glimmer-30b",
+ "display_name": "Muse Glimmer 30B",
+ "description": "Meta's open vision model for coding and agent work",
+ "repo": "unsloth/Muse-Glimmer-30B-GGUF",
+ "variants": [
+ {
+ "quant": "UD-Q8_K_XL",
+ "files": [
+ {
+ "path": "Muse-Glimmer-30B-UD-Q8_K_XL.gguf",
+ "size_bytes": 32300651040
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q6_K_XL",
+ "files": [
+ {
+ "path": "Muse-Glimmer-30B-UD-Q6_K_XL.gguf",
+ "size_bytes": 26265362976
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q5_K_XL",
+ "files": [
+ {
+ "path": "Muse-Glimmer-30B-UD-Q5_K_XL.gguf",
+ "size_bytes": 21789618976
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q4_K_XL",
+ "files": [
+ {
+ "path": "Muse-Glimmer-30B-UD-Q4_K_XL.gguf",
+ "size_bytes": 15878222368
+ }
+ ]
+ }
+ ],
+ "n_ctx_train": 262144,
+ "full_layers": 60,
+ "recurrent_layers": 0,
+ "per_layer_f16": 4096,
+ "n_vocab": 202048,
+ "mmproj": {
+ "path": "mmproj-Muse-Glimmer-30B-BF16.gguf",
+ "size_bytes": 3849173728
+ },
+ "sampling": {
+ "temp": "1.0",
+ "top-p": "0.95",
+ "top-k": "64"
+ },
+ "tags": [
+ "day-0",
+ "vision",
+ "dense"
+ ]
+ },
+ {
+ "id": "deepseek-v4-flash",
+ "display_name": "DeepSeek V4 Flash",
+ "description": "Frontier-class model for machines with 128GB+ memory",
+ "repo": "unsloth/DeepSeek-V4-Flash-0731-GGUF",
+ "variants": [
+ {
+ "quant": "UD-Q8_K_XL",
+ "files": [
+ {
+ "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00001-of-00005.gguf",
+ "size_bytes": 5257408
+ },
+ {
+ "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00002-of-00005.gguf",
+ "size_bytes": 49215492960
+ },
+ {
+ "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00003-of-00005.gguf",
+ "size_bytes": 49700372160
+ },
+ {
+ "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00004-of-00005.gguf",
+ "size_bytes": 49466495968
+ },
+ {
+ "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00005-of-00005.gguf",
+ "size_bytes": 13481997024
+ }
+ ]
+ },
+ {
+ "quant": "UD-Q4_K_XL",
+ "files": [
+ {
+ "path": "UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00001-of-00005.gguf",
+ "size_bytes": 5257408
+ },
+ {
+ "path": "UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00002-of-00005.gguf",
+ "size_bytes": 48935523072
+ },
+ {
+ "path": "UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00003-of-00005.gguf",
+ "size_bytes": 48980787136
+ },
+ {
+ "path": "UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00004-of-00005.gguf",
+ "size_bytes": 49999168416
+ },
+ {
+ "path": "UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00005-of-00005.gguf",
+ "size_bytes": 7174505088
+ }
+ ]
+ }
+ ],
+ "n_ctx_train": 1048576,
+ "full_layers": 43,
+ "recurrent_layers": 0,
+ "per_layer_f16": 1152,
+ "moe": true,
+ "n_vocab": 163840,
+ "draft": {
+ "path": "dspark-DeepSeek-V4-Flash-0731-Q8_0.gguf",
+ "size_bytes": 10896057440
+ },
+ "sampling": {
+ "temp": "1.0",
+ "top-p": "0.95",
+ "min-p": "0.01"
+ },
+ "tags": [
+ "day-0",
+ "long-context",
+ "moe",
+ "frontier"
+ ]
+ }
+ ]
+}
diff --git a/hermes_cli/local_runtime/catalog.py b/hermes_cli/local_runtime/catalog.py
index 7082d04154c..17709531f0a 100644
--- a/hermes_cli/local_runtime/catalog.py
+++ b/hermes_cli/local_runtime/catalog.py
@@ -47,7 +47,12 @@ reviewed like a tag bump.
from __future__ import annotations
+import json
+import logging
import re
+import threading
+import time
+import urllib.request
from dataclasses import dataclass, field
from pathlib import PurePosixPath
@@ -64,6 +69,8 @@ from hermes_cli.local_runtime.estimator import (
ctx_bytes,
)
+logger = logging.getLogger(__name__)
+
_GIB = 1 << 30
_PART_SUFFIX = re.compile(r"-\d{5}-of-\d{5}$")
@@ -144,6 +151,10 @@ class CatalogEntry:
mmproj: "AssetFile | None" = None # vision projector, downloads with model
draft: "AssetFile | None" = None # spec-decode draft model (e.g. DSpark)
sampling: dict = field(default_factory=dict) # INI long-form launch defaults
+ # Oldest llama.cpp release tag that can load this model (day-0
+ # architectures need the release where their support landed). Empty
+ # means any installed engine. The pane gates download/activate on it.
+ min_engine: str = ""
tags: tuple = field(default_factory=tuple)
def profile(self, variant: QuantVariant) -> ModelProfile:
@@ -224,155 +235,113 @@ def select_variant(entry: CatalogEntry, budget: HardwareBudget) -> VariantChoice
return None
-def _v(quant: str, *files, validated: bool = False) -> QuantVariant:
- return QuantVariant(quant=quant,
- files=tuple(AssetFile(*f) for f in files),
- validated=validated)
-
-
-# Ordered: recommended first. File bytes pinned from HF LFS metadata.
-CATALOG: tuple[CatalogEntry, ...] = (
- CatalogEntry(
- id="qwen3.8-27b",
- display_name="Qwen3.8 27B",
- description="Best all-round agent model; sees images; long context stays fast",
- repo="unsloth/Qwen3.8-27B-GGUF",
- variants=(
- _v("UD-Q8_K_XL",
- ("Qwen3.8-27B-UD-Q8_K_XL.gguf", 31457991680)),
- _v("UD-Q6_K_XL",
- ("Qwen3.8-27B-UD-Q6_K_XL.gguf", 25299061664)),
- _v("UD-Q5_K_XL",
- ("Qwen3.8-27B-UD-Q5_K_XL.gguf", 20876938144)),
- _v("UD-Q4_K_XL",
- ("Qwen3.8-27B-UD-Q4_K_XL.gguf", 17559178144)),
- ),
- n_ctx_train=262144,
- # Same hybrid family as Qwen3.6-27B (config-verified: 64 layers,
- # 16 full-attention via full_attention_interval=4, 4 KV heads x
- # 256 head_dim = 4 KiB/token per full layer). The GGUF header is
- # the authority after download.
- full_layers=16, recurrent_layers=48, per_layer_f16=4096,
- n_vocab=248320,
- mmproj=AssetFile("mmproj-BF16.gguf", 931146432,
- local="mmproj-Qwen3.8-27B-BF16.gguf"),
- sampling={"temp": "1.0", "top-p": "0.95", "top-k": "20", "min-p": "0.0"},
- tags=("recommended", "hybrid", "reasoning", "vision", "day-0"),
- ),
- CatalogEntry(
- id="qwen3.6-35b-a3b",
- display_name="Qwen3.6 35B-A3B",
- description="Bigger mixture-of-experts with multi-token prediction; sees images",
- repo="unsloth/Qwen3.6-35B-A3B-MTP-GGUF",
- variants=(
- _v("UD-Q8_K_XL",
- ("Qwen3.6-35B-A3B-UD-Q8_K_XL.gguf", 39099447584)),
- _v("UD-Q6_K_XL",
- ("Qwen3.6-35B-A3B-UD-Q6_K_XL.gguf", 32611711264)),
- _v("UD-Q5_K_XL",
- ("Qwen3.6-35B-A3B-UD-Q5_K_XL.gguf", 27159116064)),
- # Validated on this repo's prior upload; upstream has since
- # re-uploaded. Same model id + pipeline — re-verify at the
- # next validation pass.
- _v("UD-Q4_K_XL",
- ("Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf", 22853663008),
- validated=True),
- ),
- n_ctx_train=262144,
- # Config-derived (Qwen/Qwen3.6-35B-A3B): 40 layers, 10 full-attn
- # (interval 4) + 30 linear; KV heads 2 x head_dim 256.
- full_layers=10, recurrent_layers=30, per_layer_f16=2048,
- moe=True, mtp=True, mtp_draft_depth=2, n_vocab=248320,
- mmproj=AssetFile("mmproj-BF16.gguf", 902822528,
- local="mmproj-Qwen3.6-35B-A3B-BF16.gguf"),
- sampling={"temp": "1.0", "top-p": "0.95", "top-k": "20", "min-p": "0.0"},
- tags=("hybrid", "moe", "mtp", "vision"),
- ),
- CatalogEntry(
- id="nemotron-3.5-lightning-30b",
- display_name="Nemotron 3.5 Lightning 30B",
- description="NVIDIA's fast tool-calling model; 1M-token context",
- repo="unsloth/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF",
- variants=(
- _v("UD-Q8_K_XL",
- ("NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q8_K_XL.gguf", 38615380032)),
- _v("UD-Q6_K_XL",
- ("NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q6_K_XL.gguf", 35004643392)),
- _v("UD-Q5_K_XL",
- ("NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q5_K_XL.gguf", 30414829632)),
- _v("UD-Q4_K_XL",
- ("NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q4_K_XL.gguf", 25505724480)),
- ),
- n_ctx_train=1048576,
- # Prior from Nemotron-3-Nano (same hybrid family; base config gated
- # upstream): 6 full-attn + 46 recurrent, ~1 KiB/tok/full-layer.
- # Prior from the same hybrid family (measured: 1M ctx in ~3.2 GiB
- # KV on the predecessor). GGUF header is
- # the authority after download.
- full_layers=6, recurrent_layers=46, per_layer_f16=1024,
- moe=True, mtp=True, n_vocab=131072,
- sampling={"temp": "0.6", "top-p": "0.95", "min-p": "0.01"},
- tags=("day-0", "long-context", "hybrid", "moe", "mtp"),
- ),
- CatalogEntry(
- id="muse-glimmer-30b",
- display_name="Muse Glimmer 30B",
- description="Meta's open vision model for coding and agent work",
- repo="unsloth/Muse-Glimmer-30B-GGUF",
- variants=(
- _v("UD-Q8_K_XL",
- ("Muse-Glimmer-30B-UD-Q8_K_XL.gguf", 32300651040)),
- _v("UD-Q6_K_XL",
- ("Muse-Glimmer-30B-UD-Q6_K_XL.gguf", 26265362976)),
- _v("UD-Q5_K_XL",
- ("Muse-Glimmer-30B-UD-Q5_K_XL.gguf", 21789618976)),
- _v("UD-Q4_K_XL",
- ("Muse-Glimmer-30B-UD-Q4_K_XL.gguf", 15878222368)),
- ),
- n_ctx_train=262144,
- # Conservative dense prior (base config gated upstream): 30B-class
- # dense, ~60 layers x 4 KiB/tok. Dense KV is the expensive shape —
- # overestimating here keeps the zero-spill promise safe until the
- # GGUF header corrects it.
- full_layers=60, recurrent_layers=0, per_layer_f16=4096,
- n_vocab=202048,
- mmproj=AssetFile("mmproj-Muse-Glimmer-30B-BF16.gguf", 3849173728),
- sampling={"temp": "1.0", "top-p": "0.95", "top-k": "64"},
- tags=("day-0", "vision", "dense"),
- ),
- CatalogEntry(
- id="deepseek-v4-flash",
- display_name="DeepSeek V4 Flash",
- description="Frontier-class model for machines with 128GB+ memory",
- repo="unsloth/DeepSeek-V4-Flash-0731-GGUF",
- variants=(
- # Q8 is bit-lossless vs the official QAT checkpoint; Q4 keeps
- # the MXFP4 experts bit-exact and only requants the other 4%.
- _v("UD-Q8_K_XL",
- ("UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00001-of-00005.gguf", 5257408),
- ("UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00002-of-00005.gguf", 49215492960),
- ("UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00003-of-00005.gguf", 49700372160),
- ("UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00004-of-00005.gguf", 49466495968),
- ("UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00005-of-00005.gguf", 13481997024)),
- _v("UD-Q4_K_XL",
- ("UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00001-of-00005.gguf", 5257408),
- ("UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00002-of-00005.gguf", 48935523072),
- ("UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00003-of-00005.gguf", 48980787136),
- ("UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00004-of-00005.gguf", 49999168416),
- ("UD-Q4_K_XL/DeepSeek-V4-Flash-0731-UD-Q4_K_XL-00005-of-00005.gguf", 7174505088)),
- ),
- n_ctx_train=1048576,
- # Config-derived (deepseek-ai/DeepSeek-V4-Flash-0731): 43 layers,
- # MLA compressed KV (rank 512 + 64 rope) ~1.15 KiB/tok/layer f16.
- # Config shows sliding_window=128 with no per-layer map — priced
- # all-full (conservative); GGUF header decides after download.
- full_layers=43, recurrent_layers=0, per_layer_f16=1152,
- moe=True, n_vocab=163840,
- draft=AssetFile("dspark-DeepSeek-V4-Flash-0731-Q8_0.gguf", 10896057440),
- sampling={"temp": "1.0", "top-p": "0.95", "min-p": "0.01"},
- tags=("day-0", "long-context", "moe", "frontier"),
- ),
-)
+# ── catalog data: packaged JSON, refreshed from GitHub in memory ─
+#
+# The catalog DATA lives in catalog.json (checked in beside this module
+# and shipped as package data); this module keeps all policy. At import
+# we load the packaged copy — no network on the import path. A TTL-gated
+# background refresh fetches the same file from the repo's main branch
+# and swaps it in memory only: nothing on disk changes, so a git
+# checkout never sees a dirty tracked file and the packaged copy remains
+# the offline truth. A reverted commit on main heals every install on
+# its next fetch, and day-0 entries reach users without an app release.
+
+_CATALOG_URL = ("https://raw.githubusercontent.com/NousResearch/hermes-agent"
+ "/main/hermes_cli/local_runtime/catalog.json")
+_SCHEMA_VERSION = 1
+_REFRESH_TTL_S = 6 * 3600
+_refresh_lock = threading.Lock()
+_last_refresh_attempt = 0.0
+
+
+def _asset_from(d: "dict | None") -> "AssetFile | None":
+ if not d:
+ return None
+ return AssetFile(path=d["path"], size_bytes=int(d["size_bytes"]),
+ local=d.get("local"))
+
+
+def _load_catalog(doc: dict) -> "tuple[CatalogEntry, ...]":
+ """Parse a catalog document into entries. Unknown fields are ignored
+ (newer catalogs stay readable by older apps); a major schema bump is
+ the signal that they wouldn't be, and the caller skips the document."""
+ if int(doc.get("schema_version", 0)) != _SCHEMA_VERSION:
+ raise ValueError(f"catalog schema {doc.get('schema_version')!r} "
+ f"(this build reads {_SCHEMA_VERSION})")
+ entries = []
+ for m in doc["models"]:
+ variants = tuple(
+ QuantVariant(quant=v["quant"],
+ files=tuple(_asset_from(f) for f in v["files"]),
+ validated=bool(v.get("validated")))
+ for v in m["variants"])
+ entries.append(CatalogEntry(
+ id=m["id"], display_name=m["display_name"],
+ description=m["description"], repo=m["repo"], variants=variants,
+ n_ctx_train=int(m["n_ctx_train"]),
+ full_layers=int(m["full_layers"]),
+ recurrent_layers=int(m["recurrent_layers"]),
+ per_layer_f16=int(m["per_layer_f16"]),
+ swa_layers=int(m.get("swa_layers", 0)),
+ swa_window=int(m.get("swa_window", 0)),
+ moe=bool(m.get("moe")), mtp=bool(m.get("mtp")),
+ mtp_draft_depth=int(m.get("mtp_draft_depth", 3)),
+ n_vocab=int(m.get("n_vocab", 0)),
+ mmproj=_asset_from(m.get("mmproj")),
+ draft=_asset_from(m.get("draft")),
+ sampling=dict(m.get("sampling", {})),
+ min_engine=str(m.get("min_engine", "")),
+ tags=tuple(m.get("tags", ())),
+ ))
+ return tuple(entries)
+
+
+def _packaged_catalog() -> "tuple[CatalogEntry, ...]":
+ from importlib.resources import files
+
+ raw = files("hermes_cli.local_runtime").joinpath("catalog.json").read_text(
+ encoding="utf-8")
+ return _load_catalog(json.loads(raw))
+
+
+CATALOG: "tuple[CatalogEntry, ...]" = _packaged_catalog()
+
+
+def refresh_catalog(force: bool = False) -> bool:
+ """Fetch the current catalog from the repo and swap it in memory.
+
+ Best-effort by design: any failure (offline, GitHub down, unreadable
+ schema) leaves the running catalog untouched and retries after the
+ TTL. Returns True when a fetched document replaced the catalog."""
+ global CATALOG, _last_refresh_attempt
+
+ now = time.monotonic()
+ with _refresh_lock:
+ if not force and now - _last_refresh_attempt < _REFRESH_TTL_S:
+ return False
+ _last_refresh_attempt = now
+ try:
+ req = urllib.request.Request(
+ _CATALOG_URL, headers={"User-Agent": "hermes-local-runtime"})
+ with urllib.request.urlopen(req, timeout=10) as r:
+ fetched = _load_catalog(json.load(r))
+ except Exception as exc: # noqa: BLE001
+ logger.debug("catalog refresh skipped: %s", exc)
+ return False
+ if fetched != CATALOG:
+ logger.info("catalog refreshed from repo (%d models)", len(fetched))
+ CATALOG = fetched
+ return True
+
+
+def refresh_catalog_soon() -> None:
+ """TTL-gated background refresh; returns immediately. The caller's
+ current request serves the catalog it already has — the refresh
+ lands for the next one."""
+ if time.monotonic() - _last_refresh_attempt < _REFRESH_TTL_S:
+ return
+ threading.Thread(target=refresh_catalog, daemon=True,
+ name="catalog-refresh").start()
def catalog_by_id() -> dict[str, CatalogEntry]:
diff --git a/hermes_cli/web_routers/local_models.py b/hermes_cli/web_routers/local_models.py
index e2ad77043f1..758c31a51aa 100644
--- a/hermes_cli/web_routers/local_models.py
+++ b/hermes_cli/web_routers/local_models.py
@@ -230,6 +230,22 @@ def _models_dir() -> Path:
return models_dir()
+def _engine_too_old(min_engine: str) -> bool:
+ """True when the installed llama.cpp predates a model's requirement.
+ Tags are release numbers (b10362); no engine installed compares as
+ too old only when the model states a requirement."""
+ if not min_engine:
+ return False
+ try:
+ from hermes_cli.local_runtime.binaries import default_tag, installed_tags
+
+ tags = installed_tags() or [default_tag()]
+ newest = max(int(t.lstrip("b")) for t in tags if t.lstrip("b").isdigit())
+ return newest < int(min_engine.lstrip("b"))
+ except Exception: # noqa: BLE001
+ return False
+
+
def _load_config() -> dict:
from hermes_cli.config import load_config
@@ -453,7 +469,11 @@ async def local_models_catalog():
build for this machine (highest quality that runs fully on the GPU at
the 64K floor; else the smallest that works, spilled and priced). No
entry is hidden; unaffordable models show WHY."""
- from hermes_cli.local_runtime.catalog import CATALOG, select_variant
+ from hermes_cli.local_runtime.catalog import (
+ CATALOG,
+ refresh_catalog_soon,
+ select_variant,
+ )
from hermes_cli.local_runtime.context_policy import (
RUNTIME_OVERHEAD_BYTES,
initial_window,
@@ -462,6 +482,11 @@ async def local_models_catalog():
from hermes_cli.local_runtime.estimator import PhysicsRefusal
from hermes_cli.local_runtime.hardware import probe_budget
+ # This request serves the catalog already in memory; a TTL-gated
+ # background fetch from the repo lands new entries for the next one
+ # (day-0 models reach the pane without an app release).
+ refresh_catalog_soon()
+
# Planning budget: price against machine capacity, not live-free VRAM.
# A loaded model must not make the catalog call every row unaffordable.
budget = probe_budget(planning=True)
@@ -486,6 +511,12 @@ async def local_models_catalog():
"downloaded_quant": downloaded_variant.quant if downloaded_variant else None,
"mtp": entry.mtp,
"vision": entry.mmproj is not None,
+ # Day-0 architectures need the llama.cpp release where their
+ # support landed. True gates download/activate in the pane
+ # until the engine updates; the row still renders (visible +
+ # explained beats hidden).
+ "needs_engine": _engine_too_old(entry.min_engine),
+ "min_engine": entry.min_engine or None,
}
if choice is None:
smallest = min(entry.variants, key=lambda v: v.size_bytes)
@@ -663,6 +694,11 @@ async def local_models_download(body: ModelDownloadBody):
entry = catalog_by_id().get(body.model_id)
variant = None
if entry is not None:
+ if _engine_too_old(entry.min_engine):
+ raise HTTPException(
+ status_code=409,
+ detail=(f"{entry.display_name} needs llama.cpp {entry.min_engine} "
+ f"or newer — update the engine first"))
# Same planning budget as the catalog — the user downloads exactly
# the build the row advertised.
choice = select_variant(entry, probe_budget(planning=True))
diff --git a/pyproject.toml b/pyproject.toml
index 86311548451..60dc7085e7b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -445,7 +445,7 @@ py-modules = [
include = ["agent", "agent.*", "tools", "tools.*", "hermes_cli", "hermes_cli.*", "gateway", "gateway.*", "tui_gateway", "tui_gateway.*", "cron", "cron.*", "acp_adapter", "plugins", "plugins.*", "providers", "providers.*"]
[tool.setuptools.package-data]
-hermes_cli = ["observability/schemas/*.json", "data/*.json"]
+hermes_cli = ["observability/schemas/*.json", "data/*.json", "local_runtime/*.json"]
# gateway/assets/ ships status_phrases.yaml and the Telegram BotFather
# screenshot. Without this, sealed venvs (uv2nix) silently lose both —
# status phrases fall back to the tiny hardcoded set and the Telegram
diff --git a/tests/hermes_cli/test_catalog_json.py b/tests/hermes_cli/test_catalog_json.py
new file mode 100644
index 00000000000..f0318684f3b
--- /dev/null
+++ b/tests/hermes_cli/test_catalog_json.py
@@ -0,0 +1,118 @@
+"""The pulled catalog: packaged JSON is the offline truth, a GitHub fetch
+swaps entries in memory only, and min_engine gates day-0 models.
+
+Nothing here touches disk beyond the packaged file — the design constraint
+is that a git checkout must never see a dirty tracked catalog.json."""
+
+from __future__ import annotations
+
+import dataclasses
+import io
+import json
+import urllib.request
+
+import pytest
+
+import hermes_cli.local_runtime.catalog as cat
+
+
[email protected](autouse=True)
+def _reset_refresh_state(monkeypatch):
+ """Each test starts outside the TTL window with the packaged catalog."""
+ monkeypatch.setattr(cat, "_last_refresh_attempt", 0.0)
+ packaged = cat._packaged_catalog()
+ monkeypatch.setattr(cat, "CATALOG", packaged)
+ yield
+
+
+def _doc_from(entries):
+ """A fetchable catalog document built by mutating the packaged JSON."""
+ from importlib.resources import files
+
+ doc = json.loads(files("hermes_cli.local_runtime")
+ .joinpath("catalog.json").read_text(encoding="utf-8"))
+ doc["models"] = entries(doc["models"])
+ return doc
+
+
+def _fetch_returns(monkeypatch, doc):
+ body = json.dumps(doc).encode()
+
+ class R(io.BytesIO):
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *a):
+ return False
+
+ monkeypatch.setattr(urllib.request, "urlopen",
+ lambda *a, **k: R(body))
+
+
+def test_packaged_json_round_trips_the_catalog():
+ """The packaged JSON must produce a complete, selection-ready catalog:
+ every entry carries estimator inputs and at least one variant, and the
+ known invariants (best-first ordering, Q4 floor) hold — the same
+ contract the literals obeyed."""
+ assert len(cat.CATALOG) >= 5
+ for e in cat.CATALOG:
+ assert e.variants and e.n_ctx_train > 0 and e.per_layer_f16 >= 0
+ sizes = [v.size_bytes for v in e.variants]
+ assert sizes == sorted(sizes, reverse=True), f"{e.id} not best-first"
+
+
+def test_refresh_swaps_in_memory_only(monkeypatch, tmp_path):
+ """A fetched catalog replaces CATALOG in memory; the packaged file on
+ disk is untouched (checkout stays clean)."""
+ from importlib.resources import files
+
+ packaged_path = files("hermes_cli.local_runtime").joinpath("catalog.json")
+ before = packaged_path.read_text(encoding="utf-8")
+
+ def add_day0(models):
+ day0 = dict(models[0])
+ day0.update(id="day0-model", display_name="Day 0",
+ description="new", min_engine="b99999")
+ return models + [day0]
+
+ _fetch_returns(monkeypatch, _doc_from(add_day0))
+ assert cat.refresh_catalog(force=True) is True
+ assert "day0-model" in {e.id for e in cat.CATALOG}
+ assert cat.catalog_by_id()["day0-model"].min_engine == "b99999"
+ assert packaged_path.read_text(encoding="utf-8") == before
+
+
+def test_refresh_failure_keeps_current_catalog(monkeypatch):
+ def boom(*a, **k):
+ raise OSError("offline")
+
+ monkeypatch.setattr(urllib.request, "urlopen", boom)
+ ids_before = [e.id for e in cat.CATALOG]
+ assert cat.refresh_catalog(force=True) is False
+ assert [e.id for e in cat.CATALOG] == ids_before
+
+
+def test_refresh_rejects_wrong_schema(monkeypatch):
+ doc = _doc_from(lambda m: m)
+ doc["schema_version"] = 2
+ _fetch_returns(monkeypatch, doc)
+ ids_before = [e.id for e in cat.CATALOG]
+ assert cat.refresh_catalog(force=True) is False
+ assert [e.id for e in cat.CATALOG] == ids_before
+
+
+def test_loader_ignores_unknown_fields():
+ doc = _doc_from(lambda m: m)
+ doc["models"][0]["future_field"] = {"anything": True}
+ entries = cat._load_catalog(doc)
+ assert entries[0].id == doc["models"][0]["id"]
+
+
+def test_min_engine_gate(monkeypatch):
+ from hermes_cli.web_routers.local_models import _engine_too_old
+
+ monkeypatch.setattr("hermes_cli.local_runtime.binaries.installed_tags",
+ lambda: ["b10362"])
+ assert _engine_too_old("") is False, "no requirement, no gate"
+ assert _engine_too_old("b10000") is False, "installed engine suffices"
+ assert _engine_too_old("b10363") is True, "newer requirement gates"