@simplexai/localmodels-darwin-arm64 0.1.0-dev.55 → 0.1.0-dev.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/bootstrap.identity +1 -1
  2. package/bootstrap.sha256 +61 -55
  3. package/modules/localmodels/__init__.py +1 -1
  4. package/modules/localmodels/bifrost_admin.py +337 -0
  5. package/modules/localmodels/bifrost_checks.py +23 -10
  6. package/modules/localmodels/bifrost_config.py +13 -5
  7. package/modules/localmodels/bifrost_models.py +2 -1
  8. package/modules/localmodels/catalog.json +12 -9
  9. package/modules/localmodels/engines.py +24 -1
  10. package/modules/localmodels/gateway_accept.py +4 -3
  11. package/modules/localmodels/gateway_bifrost.py +2 -1
  12. package/modules/localmodels/gateway_cli.py +4 -3
  13. package/modules/localmodels/gateway_server.py +3 -1
  14. package/modules/localmodels/harness.py +2 -2
  15. package/modules/localmodels/hf_repo.py +27 -4
  16. package/modules/localmodels/library_floor.py +3 -1
  17. package/modules/localmodels/library_gateway.py +26 -4
  18. package/modules/localmodels/library_jobs.py +44 -6
  19. package/modules/localmodels/library_kept.py +117 -0
  20. package/modules/localmodels/library_model.py +1 -0
  21. package/modules/localmodels/library_order.py +234 -0
  22. package/modules/localmodels/library_poly.py +20 -16
  23. package/modules/localmodels/library_pricing.py +8 -1
  24. package/modules/localmodels/library_serve.py +9 -3
  25. package/modules/localmodels/library_state.py +12 -2
  26. package/modules/localmodels/library_status.py +2 -0
  27. package/modules/localmodels/llm_rank.py +11 -8
  28. package/modules/localmodels/mirrors.py +464 -0
  29. package/modules/localmodels/recommend.py +2 -2
  30. package/modules/localmodels/records.py +1 -0
  31. package/modules/localmodels/region.py +457 -42
  32. package/modules/localmodels/remote_ops.py +130 -33
  33. package/modules/localmodels/remote_ops_download.py +233 -418
  34. package/modules/localmodels/remote_ops_mirrors.py +290 -0
  35. package/modules/localmodels/remote_ops_ranges.py +447 -0
  36. package/modules/localmodels/runtime-lock.json +19 -19
  37. package/modules/localmodels/runtime_auth.py +2 -1
  38. package/modules/localmodels/runtime_cli.py +1 -1
  39. package/modules/localmodels/runtime_install.py +5 -2
  40. package/modules/localmodels/runtime_io.py +5 -6
  41. package/modules/localmodels/runtime_pi.py +2 -1
  42. package/modules/localmodels/runtime_windows_acl.py +39 -0
  43. package/modules/localmodels/setup_inspection.py +4 -0
  44. package/modules/localmodels/source_byok_probe.py +2 -1
  45. package/modules/localmodels/stack.py +13 -3
  46. package/modules/localmodels/stack_auto.py +38 -5
  47. package/modules/localmodels/stack_cli.py +1 -0
  48. package/modules/localmodels/stack_compose.py +2 -1
  49. package/modules/localmodels/stack_events.py +15 -0
  50. package/modules/localmodels/stack_plan.py +5 -1
  51. package/modules/localmodels/stack_progress.py +30 -5
  52. package/modules/localmodels/stack_run.py +117 -0
  53. package/modules/localmodels/stack_try.py +4 -1
  54. package/modules/localmodels/transport.py +2 -0
  55. package/modules/{simplex_localmodels-0.1.0.dev55.dist-info → simplex_localmodels-0.1.0.dev57.dist-info}/METADATA +1 -1
  56. package/modules/{simplex_localmodels-0.1.0.dev55.dist-info → simplex_localmodels-0.1.0.dev57.dist-info}/RECORD +58 -52
  57. package/package.json +1 -1
  58. package/tool.json +1 -1
  59. /package/modules/{simplex_localmodels-0.1.0.dev55.dist-info → simplex_localmodels-0.1.0.dev57.dist-info}/WHEEL +0 -0
  60. /package/modules/{simplex_localmodels-0.1.0.dev55.dist-info → simplex_localmodels-0.1.0.dev57.dist-info}/entry_points.txt +0 -0
  61. /package/modules/{simplex_localmodels-0.1.0.dev55.dist-info → simplex_localmodels-0.1.0.dev57.dist-info}/licenses/NOTICE +0 -0
  62. /package/modules/{simplex_localmodels-0.1.0.dev55.dist-info → simplex_localmodels-0.1.0.dev57.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -0,0 +1,117 @@
1
+ """Library models on disk that this version's catalog no longer offers as library models.
2
+
3
+ A Quick Install stack an older version accepted can leave a library record whose id the current
4
+ catalog does not list as a library model: dev37-dev49 kits picked ``qwen3.6-35b-a3b-q3-poly`` and
5
+ ``qwen3.6-35b-a3b-q4-poly`` (PolyStrata components without a model card), and dev37-dev40 kits
6
+ picked fast LLMs since retired (``lfm3-1.7b``, ``spark-x2.6-1.7b``). The first library command
7
+ adopted them, so ``library status``, ``unload``, ``remove`` and ``source apply`` meet their ids.
8
+
9
+ Such a record resolves through what is on disk. A PolyStrata recipe the catalog still ships under
10
+ the same id and quant is that recipe (the same pinned weights, so ``load`` starts it on today's
11
+ engine without downloading them again). When the recipe states no model card, it takes the card
12
+ of the catalog chat model from the same repository. Anything else is ``retired``: described by
13
+ its recorded plan, listed, unloadable and removable, and refused by ``load``.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import dataclasses
19
+ from collections.abc import Iterable
20
+
21
+ from localmodels import catalog as cat
22
+ from localmodels import library_poly, library_state, suite
23
+ from localmodels.library_state import Record
24
+
25
+ RETIRED = "retired"
26
+
27
+
28
+ def _recipe(record: Record) -> suite.SuiteRecipe | None:
29
+ for recipe in suite.recipes("llm"):
30
+ if (
31
+ recipe["id"] == record["catalog_id"]
32
+ and recipe["version"] == record["quant"]
33
+ and recipe["runtime"] == "strata-poly"
34
+ ):
35
+ return recipe
36
+ return None
37
+
38
+
39
+ def _named(entry: cat.CatalogEntry, catalog: Iterable[cat.CatalogEntry]) -> cat.CatalogEntry:
40
+ """``entry`` with the model card of the llama.cpp chat model from the same repository."""
41
+ twin = next(
42
+ (
43
+ e
44
+ for e in catalog
45
+ if e.runtime == "llama.cpp" and e.repo == entry.repo and e.display_name
46
+ ),
47
+ None,
48
+ )
49
+ if twin is None:
50
+ return entry
51
+ return dataclasses.replace(
52
+ entry,
53
+ display_name=f"{twin.display_name} PolyStrata", # never the llama.cpp row's name
54
+ description=twin.description,
55
+ family=twin.family,
56
+ publisher=twin.publisher,
57
+ parameters=twin.parameters,
58
+ active_parameters=twin.active_parameters,
59
+ )
60
+
61
+
62
+ def _runtime(record: Record) -> str:
63
+ build = str(record["plan"]["engine"].get("build") or "")
64
+ if build.startswith("strata-poly"):
65
+ return "strata-poly"
66
+ if build.startswith("strata"):
67
+ return "strata"
68
+ return "llama.cpp"
69
+
70
+
71
+ def _retired(record: Record) -> tuple[cat.CatalogEntry, cat.QuantVariant]:
72
+ plan = record["plan"]
73
+ spec = plan["model"]
74
+ files = tuple(
75
+ cat.AssetFile(
76
+ path=str(f.get("path") or f.get("local_name") or ""),
77
+ size_bytes=int(f.get("size_bytes") or 0),
78
+ local=str(f.get("local_name") or "") or None,
79
+ revision=str(f.get("revision") or "main"),
80
+ sha256=str(f.get("sha256") or "") or None,
81
+ )
82
+ for f in plan["files"]
83
+ )
84
+ variant = cat.QuantVariant(quant=record["quant"], files=files)
85
+ entry = cat.CatalogEntry(
86
+ id=record["catalog_id"],
87
+ display_name=str(spec.get("display_name") or record["catalog_id"]),
88
+ description="",
89
+ repo=str(spec.get("repo") or ""),
90
+ variants=(variant,),
91
+ n_ctx_train=int(str(plan["launch"].get("window") or 0)),
92
+ full_layers=0,
93
+ recurrent_layers=0,
94
+ per_layer_f16=0,
95
+ status=RETIRED,
96
+ tasks=("llm",),
97
+ runtime=_runtime(record),
98
+ )
99
+ return entry, variant
100
+
101
+
102
+ def find_entry(
103
+ model_id: str, catalog: Iterable[cat.CatalogEntry]
104
+ ) -> tuple[cat.CatalogEntry, cat.QuantVariant] | None:
105
+ """The model a library record on disk names by its full ``id:QUANT``, or None."""
106
+ record = library_state.load(model_id)
107
+ if record is None or record["id"] != model_id:
108
+ return None
109
+ if (recipe := _recipe(record)) is not None:
110
+ entry, variant = library_poly.as_entry(recipe)
111
+ return (entry if recipe.get("display_name") else _named(entry, catalog)), variant
112
+ return _retired(record)
113
+
114
+
115
+ def retired(entry: cat.CatalogEntry) -> bool:
116
+ """Whether ``entry`` is a kept model this version cannot load."""
117
+ return entry.status == RETIRED
@@ -151,6 +151,7 @@ class Reason(_Reason, total=False):
151
151
  reclaim_bytes: int
152
152
  gpu_vendor: Literal["amd", "intel", "none", "unknown"]
153
153
  required_cuda: str
154
+ required_driver: str
154
155
  detected_cuda: str
155
156
  driver_version: str
156
157
  missing_libraries: list[str]
@@ -0,0 +1,234 @@
1
+ """Suitability ordering for ``library status`` rows across Apple Silicon, Linux and Windows.
2
+
3
+ Apple Silicon Macs order rows around the Mac small-memory ladder (Decision 68). Linux and
4
+ Windows hosts order rows around validated intelligence, context window, quantization precision,
5
+ actionable driver/runtime upgrades and memory shortfall, demoting the Windows small-card
6
+ fallback below validated models whenever a validated model fits (Decision 69).
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from localmodels import budget, library_pricing, llm_rank, metal
12
+ from localmodels import catalog as cat
13
+ from localmodels.estimator import HardwareBudget
14
+ from localmodels.library_model import Row
15
+ from localmodels.library_pricing import Model
16
+ from localmodels.probe import HostFacts
17
+
18
+ _ACTIONABLE_UNAVAILABLE = frozenset({"DRIVER_UPDATE_REQUIRED", "RUNTIME_DEPENDENCY_MISSING"})
19
+ _LONG_CONTEXT_FLOOR = 131_072
20
+
21
+
22
+ def _mac_suitability_key(
23
+ model: Model,
24
+ row_doc: Row,
25
+ hw: HardwareBudget | None,
26
+ smartest_rungs: tuple[str, ...],
27
+ ) -> tuple[object, ...]:
28
+ """Order Apple Silicon library rows by machine-tailored suitability.
29
+
30
+ Recommended comes first, then fitting/active models ranked from high-intelligence validated
31
+ models (>= yield score) through the primary Mac ladder rung (Ornith 1.5 9B), secondary
32
+ validated models, fallback ladder rungs (Spark 4B), and ladder-replaced legacy entries
33
+ (Ling 3.0 tiny). Models that do not fit this Mac follow from smallest memory requirement up.
34
+ """
35
+ entry, variant = model.entry, model.variant
36
+ is_recommended = 0 if row_doc["recommended"] else 1
37
+ if row_doc["state"] != "absent" or (
38
+ row_doc["fit"] != "none" and row_doc["availability"]["downloadable"]
39
+ ):
40
+ avail_bucket = 0
41
+ elif row_doc["fit"] != "none":
42
+ avail_bucket = 1
43
+ else:
44
+ avail_bucket = 2
45
+ est_tok_s = round(cat.decode_estimate(entry, variant, hw).tok_s, 1) if hw else 0.0
46
+ if entry.id in llm_rank.MAC_LADDER_REPLACES:
47
+ tier = 4
48
+ rank_tuple: tuple[float, ...] = (
49
+ -entry.quality,
50
+ -est_tok_s,
51
+ -row_doc["context_tokens"],
52
+ -variant.size_bytes,
53
+ )
54
+ elif entry.id in smartest_rungs:
55
+ rung_idx = smartest_rungs.index(entry.id)
56
+ tier = 1 if rung_idx == 0 else 3
57
+ rank_tuple = (
58
+ float(rung_idx),
59
+ -est_tok_s,
60
+ -row_doc["context_tokens"],
61
+ -variant.size_bytes,
62
+ )
63
+ elif entry.quality >= llm_rank.MAC_DEFAULT_YIELD_SCORE:
64
+ tier = 0
65
+ rank_tuple = (
66
+ -entry.quality,
67
+ -est_tok_s,
68
+ -row_doc["context_tokens"],
69
+ -variant.size_bytes,
70
+ )
71
+ else:
72
+ tier = 2
73
+ rank_tuple = (
74
+ -entry.quality,
75
+ -variant.size_bytes,
76
+ -est_tok_s,
77
+ -row_doc["context_tokens"],
78
+ )
79
+ if avail_bucket == 2:
80
+ return (
81
+ is_recommended,
82
+ avail_bucket,
83
+ row_doc["memory_bytes"],
84
+ tier,
85
+ rank_tuple,
86
+ row_doc["id"],
87
+ )
88
+ return (is_recommended, avail_bucket, tier, rank_tuple, row_doc["id"])
89
+
90
+
91
+ def _best_cuda_budget(facts: HostFacts) -> HardwareBudget | None:
92
+ shown_cards = library_pricing.visible(facts)
93
+ cuda_placements = [
94
+ p
95
+ for p in budget.placements(facts, planning=True)
96
+ if not p.pooled
97
+ and p.backend == "cuda"
98
+ and (
99
+ not p.gpu_indices
100
+ or shown_cards is None
101
+ or all(idx in shown_cards for idx in p.gpu_indices)
102
+ )
103
+ ]
104
+ if not cuda_placements:
105
+ return None
106
+ best = max(cuda_placements, key=lambda p: p.budget.total_device_bytes)
107
+ return budget.agent_budget(best, facts) or best.budget
108
+
109
+
110
+ def _max_visible_nvidia_bytes(facts: HostFacts) -> int:
111
+ shown_cards = library_pricing.visible(facts)
112
+ return max(
113
+ (
114
+ g["total_bytes"]
115
+ for g in facts.get("gpus") or []
116
+ if g.get("vendor") == "nvidia" and (shown_cards is None or g["index"] in shown_cards)
117
+ ),
118
+ default=0,
119
+ )
120
+
121
+
122
+ def _desktop_suitability_key(
123
+ facts: HostFacts,
124
+ model: Model,
125
+ row_doc: Row,
126
+ hw: HardwareBudget | None,
127
+ max_gpu_bytes: int,
128
+ ) -> tuple[object, ...]:
129
+ """Order Linux and Windows library rows by suitability for this machine.
130
+
131
+ Recommended always comes first. Fitting/active rows follow in validated-intelligence,
132
+ context-tier, MoE efficiency and quantization-precision order, followed by optional library
133
+ candidates (such as Ornith 1.5 9B) and then the Windows small-card fallback (Spark-X2.6 4B)
134
+ whenever stronger models fit. Unavailable rows surface actionable driver/runtime upgrades
135
+ (preferring variants whose VRAM floor fits this GPU) before memory/hardware-blocked rows
136
+ ordered from smallest shortfall up.
137
+ """
138
+ entry, variant = model.entry, model.variant
139
+ is_recommended = 0 if row_doc["recommended"] else 1
140
+ reason = row_doc["availability"].get("reason")
141
+ reason_code = reason["code"] if reason is not None else ""
142
+ if row_doc["state"] != "absent" or (
143
+ row_doc["fit"] != "none" and row_doc["availability"]["downloadable"]
144
+ ):
145
+ avail_bucket = 0
146
+ elif row_doc["fit"] != "none":
147
+ avail_bucket = 1
148
+ elif reason_code in _ACTIONABLE_UNAVAILABLE:
149
+ avail_bucket = 2
150
+ else:
151
+ avail_bucket = 3
152
+
153
+ est_tok_s = round(cat.decode_estimate(entry, variant, hw).tok_s, 1) if hw else 0.0
154
+ if llm_rank.windows_fallback(entry, facts):
155
+ tier = 3
156
+ rank_tuple: tuple[float, ...] = (
157
+ -row_doc["context_tokens"],
158
+ -variant.size_bytes,
159
+ -est_tok_s,
160
+ )
161
+ elif entry.status != "validated":
162
+ tier = 2
163
+ rank_tuple = (
164
+ -row_doc["context_tokens"],
165
+ -variant.size_bytes,
166
+ -est_tok_s,
167
+ )
168
+ elif entry.quality >= llm_rank.MAC_DEFAULT_YIELD_SCORE:
169
+ tier = 0
170
+ rank_tuple = (
171
+ -entry.quality,
172
+ 0.0 if row_doc["context_tokens"] >= _LONG_CONTEXT_FLOOR else 1.0,
173
+ 0.0 if entry.moe else 1.0,
174
+ -variant.size_bytes,
175
+ -row_doc["context_tokens"],
176
+ -est_tok_s,
177
+ )
178
+ else:
179
+ tier = 1
180
+ rank_tuple = (
181
+ -entry.quality,
182
+ -variant.size_bytes,
183
+ -row_doc["context_tokens"],
184
+ -est_tok_s,
185
+ )
186
+
187
+ if avail_bucket == 2:
188
+ fits_card_vram = (
189
+ 0 if (max_gpu_bytes > 0 and row_doc["memory_bytes"] <= max_gpu_bytes) else 1
190
+ )
191
+ return (
192
+ is_recommended,
193
+ avail_bucket,
194
+ fits_card_vram,
195
+ tier,
196
+ rank_tuple,
197
+ row_doc["id"],
198
+ )
199
+ if avail_bucket == 3:
200
+ need_bytes = reason.get("need_bytes", 0) if reason is not None else 0
201
+ have_bytes = reason.get("have_bytes", 0) if reason is not None else 0
202
+ shortfall = max(0, need_bytes - have_bytes) if need_bytes > 0 else row_doc["memory_bytes"]
203
+ need = need_bytes if need_bytes > 0 else row_doc["memory_bytes"]
204
+ return (
205
+ is_recommended,
206
+ avail_bucket,
207
+ shortfall,
208
+ need,
209
+ tier,
210
+ rank_tuple,
211
+ row_doc["id"],
212
+ )
213
+ return (is_recommended, avail_bucket, tier, rank_tuple, row_doc["id"])
214
+
215
+
216
+ def order_rows(facts: HostFacts, models: list[Model], rows: list[Row]) -> list[Row]:
217
+ """Order ``library status`` rows by suitability for this host."""
218
+ pairs = list(zip(models, rows, strict=True))
219
+ if metal.supported(facts):
220
+ placement = next(
221
+ (p for p in budget.placements(facts, planning=True) if p.backend == "metal"),
222
+ None,
223
+ )
224
+ hw = (budget.agent_budget(placement, facts) or placement.budget) if placement else None
225
+ ladder = llm_rank.mac_ladder(facts)
226
+ smartest_rungs = ladder.smartest if ladder is not None else ()
227
+ pairs.sort(key=lambda pair: _mac_suitability_key(pair[0], pair[1], hw, smartest_rungs))
228
+ return [row_doc for _, row_doc in pairs]
229
+ hw = _best_cuda_budget(facts)
230
+ max_gpu_bytes = _max_visible_nvidia_bytes(facts)
231
+ pairs.sort(
232
+ key=lambda pair: _desktop_suitability_key(facts, pair[0], pair[1], hw, max_gpu_bytes)
233
+ )
234
+ return [row_doc for _, row_doc in pairs]
@@ -41,6 +41,8 @@ def engine_blocker(exc: plan_envelope.PlanError) -> Reason | None:
41
41
  reason: Reason = {"code": "DRIVER_UPDATE_REQUIRED"}
42
42
  if exc.required_cuda:
43
43
  reason["required_cuda"] = exc.required_cuda
44
+ if exc.required_driver:
45
+ reason["required_driver"] = exc.required_driver
44
46
  if exc.detected_cuda:
45
47
  reason["detected_cuda"] = exc.detected_cuda
46
48
  if exc.driver_version:
@@ -266,6 +268,24 @@ def price(
266
268
  recipe = suite.recipe(recipe_id)
267
269
  if not stack_suite.built_for(recipe, facts["platform"]):
268
270
  raise plan_envelope.PlanError(f"{recipe_id} has no engine build for {facts['platform']}")
271
+ # Reject immutable hardware capacity shortfalls before checking the CUDA driver so an
272
+ # outdated driver never promises that a 24 GB recipe will unlock on an 8 GB card.
273
+ need_vram = int(recipe.get("vram_bytes") or 0)
274
+ if need_vram > gpu["total_bytes"]:
275
+ msg = f"{recipe_id} needs {need_vram} bytes of VRAM, exceeding {gpu['total_bytes']} bytes"
276
+ raise deploy.AgentMemoryError(
277
+ msg, PhysicsRefusal(need_vram, gpu["total_bytes"], msg), "GPU memory"
278
+ )
279
+ min_total_ram = int(recipe.get("min_ram_total_bytes") or 0)
280
+ total_ram = facts["ram"]["total_bytes"]
281
+ if min_total_ram > total_ram:
282
+ msg = (
283
+ f"{recipe_id} recommends at least {min_total_ram} bytes of system memory, "
284
+ f"this host has {total_ram} bytes"
285
+ )
286
+ raise deploy.AgentMemoryError(
287
+ msg, PhysicsRefusal(min_total_ram, total_ram, msg), "system memory"
288
+ )
269
289
  spec = recipe.get("vision") or {}
270
290
  reader = vision.strata_mode(posture.vision, gpu["total_bytes"], bool(spec))
271
291
  reserve = stack_suite.poly_reserve_mib(recipe, gpu, 0)
@@ -281,12 +301,6 @@ def price(
281
301
  if facts["platform"] == "win32":
282
302
  plan = suite.unbounded(plan)
283
303
  _calibrate_host_ram(plan, recipe, gpu)
284
- need_vram = int(recipe.get("vram_bytes") or 0)
285
- if need_vram > gpu["total_bytes"]:
286
- msg = f"{recipe_id} needs {need_vram} bytes of VRAM, exceeding {gpu['total_bytes']} bytes"
287
- raise deploy.AgentMemoryError(
288
- msg, PhysicsRefusal(need_vram, gpu["total_bytes"], msg), "GPU memory"
289
- )
290
304
  min_free = int(recipe.get("min_vram_free_bytes") or need_vram)
291
305
  if require_live and min_free > gpu["free_bytes"]:
292
306
  msg = (
@@ -304,16 +318,6 @@ def price(
304
318
  raise deploy.AgentMemoryError(
305
319
  msg, PhysicsRefusal(min_free, gpu["free_bytes"], msg), "GPU memory"
306
320
  )
307
- min_total_ram = int(recipe.get("min_ram_total_bytes") or 0)
308
- total_ram = facts["ram"]["total_bytes"]
309
- if min_total_ram > total_ram:
310
- msg = (
311
- f"{recipe_id} recommends at least {min_total_ram} bytes of system memory, "
312
- f"this host has {total_ram} bytes"
313
- )
314
- raise deploy.AgentMemoryError(
315
- msg, PhysicsRefusal(min_total_ram, total_ram, msg), "system memory"
316
- )
317
321
  needed_ram = suite.bounded_ram(plan) + budget.HARNESS_RAM + budget.RAM_FLOOR
318
322
  _, avail_ram = budget.host_ram(facts)
319
323
  if needed_ram > avail_ram:
@@ -27,6 +27,7 @@ from localmodels import (
27
27
  deploy,
28
28
  engines,
29
29
  hosts,
30
+ library_kept,
30
31
  library_poly,
31
32
  library_vram,
32
33
  llm_rank,
@@ -106,7 +107,9 @@ def shown(facts: HostFacts, catalog: Iterable[cat.CatalogEntry]) -> list[Model]:
106
107
 
107
108
 
108
109
  def find(model_id: str, catalog: Iterable[cat.CatalogEntry]) -> Model:
109
- """The catalog row a library id names (``id:QUANT``; a bare id is its last variant)."""
110
+ """The catalog row a library id names (``id:QUANT``; a bare id is its last variant), else
111
+ the model a library record on disk holds under that id (library_kept)."""
112
+ catalog = tuple(catalog)
110
113
  catalog_id, quant = split_id(model_id)
111
114
  for entry in catalog:
112
115
  if entry.id == catalog_id and is_chat(entry):
@@ -116,6 +119,8 @@ def find(model_id: str, catalog: Iterable[cat.CatalogEntry]) -> Model:
116
119
  return Model(entry, variant)
117
120
  if poly := library_poly.find_entry(model_id):
118
121
  return Model(*poly)
122
+ if kept := library_kept.find_entry(model_id, catalog):
123
+ return Model(*kept)
119
124
  raise LibraryError("MODEL_UNKNOWN", f"the catalog has no chat model {model_id}")
120
125
 
121
126
 
@@ -353,6 +358,8 @@ def price(
353
358
  placement = pools(facts).get(pool)
354
359
  if placement is None:
355
360
  raise plan_envelope.PlanError(f"this computer has no pool {pool}")
361
+ if library_kept.retired(model.entry):
362
+ raise plan_envelope.PlanError(f"this version no longer ships {model.id}")
356
363
  if model.entry.runtime == "strata-poly":
357
364
  return library_poly.price(
358
365
  facts, model.entry.id, pool, base_dir, port, posture(), require_live=require_live
@@ -26,6 +26,7 @@ from localmodels import (
26
26
  hosts,
27
27
  library_gateway,
28
28
  library_jobs,
29
+ library_kept,
29
30
  library_pricing,
30
31
  library_state,
31
32
  library_status,
@@ -348,9 +349,9 @@ def _admit(model: Model, record: Record, targets: list[Record], facts: HostFacts
348
349
 
349
350
 
350
351
  def _row(model: Model, base_dir: str) -> Row:
351
- return library_status.model_row(
352
- library_status.Library.read(library_jobs.probe(), base_dir), model.id
353
- )
352
+ """The model's row now; by the model resolved before the command, as a removed model kept
353
+ only by its record (library_kept) no longer resolves by its id."""
354
+ return library_status.row(library_status.Library.read(library_jobs.probe(), base_dir), model)
354
355
 
355
356
 
356
357
  def load(model_id: str, base_dir: str, unload: list[str]) -> Row:
@@ -375,6 +376,11 @@ def load(model_id: str, base_dir: str, unload: list[str]) -> Row:
375
376
  url = str(record["plan"]["endpoint"]["base_url"])
376
377
  if record["state"] == "loaded" and library_status.answering(url):
377
378
  return library_status.model_row(library_status.Library.read(facts, base_dir), model.id)
379
+ if library_kept.retired(model.entry):
380
+ raise LibraryError(
381
+ "INVALID_STATE",
382
+ f"this version no longer ships {model.id}; remove it and download a current model",
383
+ )
378
384
  for other in others:
379
385
  library_state.refuse_busy(other, "unload")
380
386
  found = library_state.load(other)
@@ -269,7 +269,12 @@ class JobHandle:
269
269
  ) -> None:
270
270
  import time
271
271
 
272
- prev = (self.job.get("phase"), self.job.get("load_step"), self.job.get("source"))
272
+ prev = (
273
+ self.job.get("phase"),
274
+ self.job.get("load_step"),
275
+ self.job.get("source"),
276
+ self.job.get("total"),
277
+ )
273
278
  self.job["phase"], self.job["done"], self.job["total"] = phase, done, total
274
279
  self.job["bytes_per_second"] = bytes_per_second
275
280
  if phase == "download":
@@ -288,7 +293,12 @@ class JobHandle:
288
293
  self.job["load_step"] = load_step
289
294
  else:
290
295
  self.job.pop("load_step", None)
291
- changed = (self.job.get("phase"), self.job.get("load_step"), self.job.get("source")) != prev
296
+ changed = (
297
+ self.job.get("phase"),
298
+ self.job.get("load_step"),
299
+ self.job.get("source"),
300
+ self.job.get("total"),
301
+ ) != prev
292
302
  now = time.monotonic()
293
303
  if changed or now - self._written >= JOB_WRITE_EVERY_S or done >= total:
294
304
  self._written = now
@@ -17,6 +17,7 @@ from localmodels import (
17
17
  hosts,
18
18
  library_floor,
19
19
  library_gateway,
20
+ library_order,
20
21
  library_pricing,
21
22
  library_state,
22
23
  library_vram,
@@ -574,6 +575,7 @@ def build(lib: Library) -> Status:
574
575
  chosen = library_pricing.recommend(now, candidates, lib.base_dir)
575
576
  for r in rows:
576
577
  r["recommended"] = r["id"] == chosen
578
+ rows = library_order.order_rows(lib.facts, models, rows)
577
579
  status_doc: Status = {
578
580
  "schema": STATUS_SCHEMA,
579
581
  "tool_version": __version__,
@@ -90,13 +90,16 @@ PRODUCT_DEFAULTS = {
90
90
  # every 16 GB Mac, stays on the ladder rather than a lower-scored model such as Qwen3.6-35B-A3B.
91
91
  MAC_DEFAULT_YIELD_SCORE = 50
92
92
 
93
- # The Mac small-memory ladder (roadmap decisions 57 and 61, user-selected; replaces decision
93
+ # The Mac small-memory ladder (roadmap decisions 57, 61 and 68, user-selected; replaces decision
94
94
  # 39's LFM3-1.7B): on every Apple Silicon Mac of MAC_LADDER_MIN_BYTES or more, while no validated
95
- # model scoring MAC_DEFAULT_YIELD_SCORE or more fits, Spark-X2.6-4B Q4_K_M is the sole rung and
96
- # minimum automatic floor (1.7B is below the 4B floor, so Macs with less free memory refuse
97
- # rather than dropping to 1.7B). The rung is a candidate outside SimplexAI ranking: its catalog
98
- # score is unranked (0) and never competes with installed scores.
99
- MAC_LADDER = ("spark-x2.6-4b-q4km",)
95
+ # model scoring MAC_DEFAULT_YIELD_SCORE or more fits, --llm auto tries Ornith 1.5 9B Q4_K_M first
96
+ # (fits 16 GB idle Macs and busy 24 GB+ Macs from ~12.5 GiB available), then falls back to
97
+ # Spark-X2.6-4B Q4_K_M as the minimum automatic floor (1.7B is retired, so Macs with less free
98
+ # memory refuse). Under --prefer fastest, Spark-X2.6-4B Q4_K_M is tried ahead of Ornith 1.5 9B.
99
+ # Ladder rungs are candidates outside SimplexAI ranking: their catalog score never competes with
100
+ # installed scores.
101
+ MAC_LADDER = ("ornith-1.5-9b", "spark-x2.6-4b-q4km")
102
+ MAC_LADDER_FASTEST = ("spark-x2.6-4b-q4km", "ornith-1.5-9b")
100
103
  MAC_LADDER_MIN_BYTES = 16 * metal.GIB
101
104
  # Validated darwin entries the ladder replaces in automatic selection (decision 57): Ling-3.0-tiny
102
105
  # (25) was the 32 GB+ fallback. Explicit --llm still installs it.
@@ -120,10 +123,10 @@ class MacLadder:
120
123
 
121
124
 
122
125
  def mac_ladder(facts: HostFacts) -> MacLadder | None:
123
- """This Mac's ladder (decisions 57 and 61), or None off Apple Silicon and below 16 GB."""
126
+ """This Mac's ladder (decisions 57, 61 and 68), or None off Apple Silicon and below 16 GB."""
124
127
  if not metal.supported(facts) or facts["ram"]["total_bytes"] < MAC_LADDER_MIN_BYTES:
125
128
  return None
126
- return MacLadder(MAC_LADDER, MAC_LADDER)
129
+ return MacLadder(MAC_LADDER, MAC_LADDER_FASTEST)
127
130
 
128
131
 
129
132
  def mac_rung(entry: CatalogEntry, facts: HostFacts) -> bool: