@simplexai/localmodels-linux-arm64 0.1.0-dev.103 → 0.1.0-dev.105

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 (172) hide show
  1. package/LICENSE +201 -0
  2. package/{modules/simplex_localmodels-0.1.0.dev103.dist-info/licenses/NOTICE → NOTICE} +42 -13
  3. package/README.md +10 -0
  4. package/bootstrap.identity +1 -1
  5. package/bootstrap.sha256 +159 -158
  6. package/modules/localmodels/__init__.py +1 -1
  7. package/modules/localmodels/__main__.py +204 -86
  8. package/modules/localmodels/apple_sensors.py +23 -0
  9. package/modules/localmodels/approval.py +25 -2
  10. package/modules/localmodels/catalog.json +584 -158
  11. package/modules/localmodels/catalog.py +18 -3
  12. package/modules/localmodels/catalog_recipes.py +64 -6
  13. package/modules/localmodels/cli_help.py +10 -0
  14. package/modules/localmodels/cli_parser.py +313 -230
  15. package/modules/localmodels/component.py +21 -3
  16. package/modules/localmodels/console.py +1 -1
  17. package/modules/localmodels/context_policy.py +6 -5
  18. package/modules/localmodels/custom_probe.py +4 -2
  19. package/modules/localmodels/debug_cli.py +0 -12
  20. package/modules/localmodels/debug_mode.py +0 -6
  21. package/modules/localmodels/decode_calibration.json +3 -4
  22. package/modules/localmodels/decode_calibration.py +5 -2
  23. package/modules/localmodels/deploy.py +11 -1
  24. package/modules/localmodels/deployment_lifecycle.py +1 -1
  25. package/modules/localmodels/download-mirrors.json +1 -1
  26. package/modules/localmodels/engine_adapters/base.py +11 -1
  27. package/modules/localmodels/engine_adapters/strata_poly.py +65 -3
  28. package/modules/localmodels/engine_adapters/suite_plan.py +61 -24
  29. package/modules/localmodels/engines-b11583.json +6 -26
  30. package/modules/localmodels/engines-b12588-mix-c0c3de8.json +3 -15
  31. package/modules/localmodels/engines-b12757-mix-ef2df21.json +3 -15
  32. package/modules/localmodels/engines-prism-b12178-03ec600.json +3 -15
  33. package/modules/localmodels/engines-speechcpp-v0.11.3.json +4 -20
  34. package/modules/localmodels/engines-strata-0.1.47.json +1 -5
  35. package/modules/localmodels/engines-strata-0.1.49.2.json +1 -5
  36. package/modules/localmodels/engines-strata-0.1.59.1.json +1 -5
  37. package/modules/localmodels/engines-strata-poly-0.2.20-poly.1.json +6 -30
  38. package/modules/localmodels/engines-strata-poly-0.2.20-poly.9.json +129 -0
  39. package/modules/localmodels/engines-whisper-b5454.json +6 -30
  40. package/modules/localmodels/engines.json +13 -61
  41. package/modules/localmodels/estimator.py +10 -5
  42. package/modules/localmodels/gpu_specs.py +1 -1
  43. package/modules/localmodels/host_sensors.py +25 -2
  44. package/modules/localmodels/hosts.py +38 -21
  45. package/modules/localmodels/kokoro-tts-0.6.1.txt +1 -1
  46. package/modules/localmodels/library_cli.py +34 -16
  47. package/modules/localmodels/library_custom.py +9 -1
  48. package/modules/localmodels/library_direct.py +41 -1
  49. package/modules/localmodels/library_elastic.py +135 -6
  50. package/modules/localmodels/library_jobs.py +23 -4
  51. package/modules/localmodels/library_kept.py +9 -1
  52. package/modules/localmodels/library_model.py +174 -2
  53. package/modules/localmodels/library_order.py +175 -69
  54. package/modules/localmodels/library_poly.py +150 -21
  55. package/modules/localmodels/library_presentation.py +485 -0
  56. package/modules/localmodels/library_pricing.py +15 -4
  57. package/modules/localmodels/library_serve.py +342 -70
  58. package/modules/localmodels/library_smoke.py +63 -5
  59. package/modules/localmodels/library_state.py +48 -10
  60. package/modules/localmodels/library_status.py +37 -17
  61. package/modules/localmodels/llm_rank.py +22 -11
  62. package/modules/localmodels/metal.py +1 -2
  63. package/modules/localmodels/plan_envelope.py +40 -13
  64. package/modules/localmodels/planning/budget.py +14 -12
  65. package/modules/localmodels/planning/memory_pools.py +7 -1
  66. package/modules/localmodels/privacy_acceptance.py +6 -5
  67. package/modules/localmodels/probe.py +34 -7
  68. package/modules/localmodels/py.typed +0 -0
  69. package/modules/localmodels/quant_formats.py +10 -3
  70. package/modules/localmodels/recommend_cli.py +1 -1
  71. package/modules/localmodels/records.py +19 -2
  72. package/modules/localmodels/remote_ops_launchd.py +8 -1
  73. package/modules/localmodels/remote_ops_verify.py +91 -24
  74. package/modules/localmodels/runtime_index.py +303 -0
  75. package/modules/localmodels/runtime_process.py +1 -1
  76. package/modules/localmodels/service_deployment.py +2 -4
  77. package/modules/localmodels/service_probe.py +59 -13
  78. package/modules/localmodels/setup_inspection.py +94 -73
  79. package/modules/localmodels/setup_text.py +7 -56
  80. package/modules/localmodels/sidecar_downloads.py +34 -0
  81. package/modules/localmodels/sidecar_http.py +61 -5
  82. package/modules/localmodels/sidecar_state.py +52 -2
  83. package/modules/localmodels/speech_admission.py +20 -4
  84. package/modules/localmodels/speech_catalog.py +23 -0
  85. package/modules/localmodels/speech_cli.py +30 -16
  86. package/modules/localmodels/speech_jobs.py +42 -17
  87. package/modules/localmodels/speech_serve.py +9 -2
  88. package/modules/localmodels/speech_server.py +185 -81
  89. package/modules/localmodels/speech_state.py +4 -1
  90. package/modules/localmodels/speech_workers.py +11 -0
  91. package/modules/localmodels/stack.py +1 -1
  92. package/modules/localmodels/stack_args.py +276 -145
  93. package/modules/localmodels/stack_auto.py +91 -6
  94. package/modules/localmodels/stack_aux_gpu.py +1 -1
  95. package/modules/localmodels/stack_cleanup.py +21 -18
  96. package/modules/localmodels/stack_cli.py +120 -115
  97. package/modules/localmodels/stack_compose.py +16 -5
  98. package/modules/localmodels/stack_debug.py +15 -6
  99. package/modules/localmodels/stack_decision.py +4 -4
  100. package/modules/localmodels/stack_doctor.py +2 -2
  101. package/modules/localmodels/stack_down.py +2 -0
  102. package/modules/localmodels/stack_events.py +1 -1
  103. package/modules/localmodels/stack_gpu_memory.py +1 -1
  104. package/modules/localmodels/stack_hardware.py +17 -15
  105. package/modules/localmodels/stack_mcp.py +1 -2
  106. package/modules/localmodels/stack_mlx.py +8 -1
  107. package/modules/localmodels/stack_picks.py +20 -21
  108. package/modules/localmodels/stack_plan.py +12 -11
  109. package/modules/localmodels/stack_ports.py +31 -4
  110. package/modules/localmodels/stack_review.py +28 -7
  111. package/modules/localmodels/stack_rollback.py +1 -1
  112. package/modules/localmodels/stack_run.py +1 -1
  113. package/modules/localmodels/stack_suite.py +72 -21
  114. package/modules/localmodels/stack_up.py +2 -0
  115. package/modules/localmodels/stack_view.py +180 -35
  116. package/modules/localmodels/stack_view_agent.py +1 -1
  117. package/modules/localmodels/stack_view_demo.py +2 -0
  118. package/modules/localmodels/stack_view_gpu.py +36 -2
  119. package/modules/localmodels/stack_view_schema.py +26 -3
  120. package/modules/localmodels/stack_view_serve.py +0 -2
  121. package/modules/localmodels/stack_view_slots.py +3 -1
  122. package/modules/localmodels/stack_view_telemetry.py +90 -4
  123. package/modules/localmodels/stack_view_tick.py +246 -40
  124. package/modules/localmodels/stack_view_words.py +9 -2
  125. package/modules/localmodels/stack_warm.py +2 -2
  126. package/modules/localmodels/stack_whatif.py +524 -41
  127. package/modules/localmodels/stack_whatif_html.py +900 -0
  128. package/modules/localmodels/startlux-decide-83fe6c7d.txt +2 -2
  129. package/modules/localmodels/{strata-poly-serve-0.2.20-poly.7.txt → strata-poly-serve-0.2.20-poly.9.txt} +1 -1
  130. package/modules/localmodels/strata_poly_server.py +114 -3
  131. package/modules/localmodels/suite.py +265 -6
  132. package/modules/localmodels/telemetry_math.py +458 -18
  133. package/modules/localmodels/transport.py +8 -1
  134. package/modules/localmodels/tts_admission.py +2 -17
  135. package/modules/localmodels/tts_catalog.py +29 -1
  136. package/modules/localmodels/tts_cli.py +45 -22
  137. package/modules/localmodels/tts_http.py +10 -4
  138. package/modules/localmodels/tts_jobs.py +49 -19
  139. package/modules/localmodels/tts_serve.py +9 -2
  140. package/modules/localmodels/tts_server.py +1 -1
  141. package/modules/localmodels/tts_sidecar.py +69 -28
  142. package/modules/localmodels/tts_state.py +7 -2
  143. package/modules/localmodels/vision.py +5 -3
  144. package/modules/localmodels/web/view/ASSET-SOURCES.md +4 -7
  145. package/modules/localmodels/web/view/view.css +0 -1
  146. package/modules/localmodels/web/view/view.js +2 -5
  147. package/modules/localmodels/web/whatif/app.js +730 -0
  148. package/modules/localmodels/web/whatif/page.html +1172 -0
  149. package/modules/localmodels/web/whatif/sim.js +297 -0
  150. package/modules/localmodels/win_probe.py +89 -16
  151. package/modules/localmodels/windows_job.py +179 -11
  152. package/modules/simplex_localmodels-0.1.0.dev105.dist-info/METADATA +14 -0
  153. package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/RECORD +151 -145
  154. package/modules/simplex_localmodels-0.1.0.dev105.dist-info/licenses/LICENSE +201 -0
  155. package/modules/simplex_localmodels-0.1.0.dev105.dist-info/licenses/NOTICE +126 -0
  156. package/package.json +11 -2
  157. package/tool.json +1 -1
  158. package/modules/localmodels/engines-strata-poly-0.2.20-poly.7.json +0 -94
  159. package/modules/localmodels/fixtures/stack-research-demo-plan.json +0 -1059
  160. package/modules/localmodels/stack_research.py +0 -716
  161. package/modules/localmodels/stack_research_demo.py +0 -125
  162. package/modules/localmodels/stack_research_plan.py +0 -146
  163. package/modules/localmodels/web/index.html +0 -2605
  164. package/modules/localmodels/web/sizecalc/app.js +0 -1306
  165. package/modules/localmodels/web/sizecalc/calc.js +0 -269
  166. package/modules/localmodels/web/sizecalc/page.html +0 -520
  167. package/modules/localmodels/web/view/logo-claude.svg +0 -3
  168. package/modules/localmodels/web/view/logo-codex.png +0 -0
  169. package/modules/simplex_localmodels-0.1.0.dev103.dist-info/METADATA +0 -9
  170. /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/WHEEL +0 -0
  171. /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/entry_points.txt +0 -0
  172. /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev105.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -2,8 +2,7 @@
2
2
 
3
3
  ``stack plan`` normally chooses these itself (the agent posture's KV order, the catalog entry's
4
4
  last variant). For local testing and debugging an operator may pin them; the window and the
5
- thinking cap are product options already (``--context``, ``--reasoning-budget``, roadmap
6
- decision 37). The overrides are plan options, so the approval id binds them and
5
+ thinking cap are product options already (``--context``, ``--reasoning-budget``). The overrides are plan options, so the approval id binds them and
7
6
  ``stack apply`` re-plans with them; they are still priced: a pinned KV pair or variant that does
8
7
  not fit is refused, never lowered or spilled. They need ``--llm`` naming a llama.cpp model:
9
8
  ``auto`` might pick a Strata recipe, which has its own launch, and naming the model keeps the
@@ -70,9 +69,10 @@ def variant(entry: cat.CatalogEntry, quant: str) -> cat.QuantVariant:
70
69
  return found
71
70
 
72
71
 
73
- def check(options: Options, strata: bool) -> None:
74
- """Refuse overrides the plan cannot honour: they need a named llama.cpp LLM. Whether the
75
- entry pins the ``--quant`` variant is deploy's question, once it has the entry."""
72
+ def check(options: Options, strata: bool, *, strata_quant: str | None = None) -> None:
73
+ """Refuse overrides the plan cannot honour. ``--kv`` is llama.cpp-only; ``--quant`` is
74
+ accepted on a named Strata/PolyStrata recipe when it matches the recipe's pinned version
75
+ (case-insensitive) and refused with the pinned version otherwise."""
76
76
  found = given(options)
77
77
  if not found:
78
78
  return
@@ -85,7 +85,16 @@ def check(options: Options, strata: bool) -> None:
85
85
  f"{flags}: name the model with --llm ID (see python3 -m localmodels models)"
86
86
  )
87
87
  if strata:
88
- raise PlanError(f"{flags}: {llm} is a Strata recipe; these pin llama.cpp only")
88
+ if "kv" in found:
89
+ raise PlanError(f"{flags}: {llm} is a Strata recipe; these pin llama.cpp only")
90
+ if "quant" in found:
91
+ wanted = str(found["quant"])
92
+ if strata_quant is None:
93
+ raise PlanError(f"{flags}: {llm} is a Strata recipe; these pin llama.cpp only")
94
+ if wanted.lower() != strata_quant.lower():
95
+ raise PlanError(
96
+ f"--quant {wanted}: {llm} pins {strata_quant}; add a variant to the catalog first"
97
+ )
89
98
 
90
99
 
91
100
  def refusal(
@@ -1,6 +1,6 @@
1
1
  """Which decision model the stack runs, and on which card.
2
2
 
3
- A decision model only runs on a GPU (AGENTS.md). In the llama.cpp branch ``choose`` ranks every
3
+ A decision model only runs on a GPU. In the llama.cpp branch ``choose`` ranks every
4
4
  catalog model's measured tiers by quality inside the decision VRAM budget and takes the best one
5
5
  with which the LLM, priced again with that VRAM held back, neither spills nor loses window. An
6
6
  explicit ``--decision-vram`` takes the best tier in that budget as it is, spill included. The plan
@@ -106,7 +106,7 @@ def priced(facts: HostFacts, card: GPU, reserve: int, llm: Plan, price_llm: Pric
106
106
  def keeps(llm: Plan, again: Plan) -> bool:
107
107
  """The re-priced LLM still runs beside the tier. In agent posture an optional decision
108
108
  model may not cost the LLM its preferred window (128K, or what it reached alone when that
109
- was less), its slots or its MTP (roadmap decision 26: the LLM is the product, the decision
109
+ was less), its slots or its MTP (the LLM is the product, the decision
110
110
  model an add-on); a default plan keeps the old rule — no spill and no lost window."""
111
111
  if again["launch"].get("posture") == "agent":
112
112
  # MTP, where the LLM had it alone, is part of what a tier may not take away: the
@@ -615,7 +615,7 @@ def listing() -> str:
615
615
  lines.append(
616
616
  "Decision models only run on a GPU, on the LLM's card; stack plan picks by measured "
617
617
  "quality by default, --decision <id> picks another, --decision-vram <GiB> sets the VRAM "
618
- "budget. Data measured on lab-12021 RTX 4090 D"
618
+ "budget. Reference timings measured on an RTX 4090 D"
619
619
  )
620
620
  return "\n".join(lines)
621
621
 
@@ -705,7 +705,7 @@ def add_arguments(plan: argparse._ActionsContainer) -> None:
705
705
  action=cli_help.ComponentSelection,
706
706
  default="none",
707
707
  metavar="ID|auto|none",
708
- help="optional decision model: none (the default since roadmap decision 26: only the "
708
+ help="optional decision model: none (default: only the "
709
709
  "LLM is installed), an id from `stack decisions`, or auto (highest measured quality on "
710
710
  "the LLM's card, any license; the plan lists the others as options)",
711
711
  )
@@ -153,7 +153,7 @@ def _service(component: str, part: Plan) -> Finding:
153
153
  plan = record["plan"]
154
154
  row = lifecycle.status_rows([record])[0]
155
155
  port, log = plan["service"]["port"], f"{plan['service']['deploy_dir']}/server.log"
156
- if row["state"] == "active" and row["health"] in ("ok", "ready"):
156
+ if deployment_lifecycle.healthy(row["state"], row["health"]):
157
157
  return finding(check, "pass", f"{name} running, 127.0.0.1:{port} health {row['health']}")
158
158
  if row["state"] == "active" and row["health"] == "loading":
159
159
  return finding(
@@ -295,7 +295,7 @@ def _proxy(env: dict[str, str]) -> Finding | None:
295
295
  "host.proxy",
296
296
  "warn",
297
297
  f"{', '.join(names)} set, but NO_PROXY lacks 127.0.0.1 and localhost: "
298
- "clients may reach the local gateway through the proxy",
298
+ "clients may reach the local model servers through the proxy",
299
299
  'export NO_PROXY="127.0.0.1,localhost${NO_PROXY:+,$NO_PROXY}" (add it to your shell profile)',
300
300
  )
301
301
 
@@ -18,6 +18,7 @@ from localmodels import (
18
18
  deploy,
19
19
  deployment_lifecycle,
20
20
  hosts,
21
+ runtime_index,
21
22
  speech_state,
22
23
  tts_state,
23
24
  )
@@ -99,6 +100,7 @@ def _down(out: Out) -> DownReport:
99
100
  f"{'✗' if action == 'failed' else '…'} {sidecar_name} "
100
101
  f"{'failed to stop' if action == 'failed' else 'stopped'}"
101
102
  )
103
+ runtime_index.refresh()
102
104
  return {
103
105
  "schema": SCHEMA,
104
106
  "ok": all(p["action"] != "failed" for p in parts),
@@ -50,7 +50,7 @@ COMPONENTS = frozenset(
50
50
  )
51
51
  STEPS = frozenset({"engine", "download", "install", "start", "verify"})
52
52
  PHASES = frozenset({"download", "verify", "loading"})
53
- # Safe, closed-set public sub-reasons for a failing stack component (WHI-1002):
53
+ # Safe, closed-set public sub-reasons for a failing stack component:
54
54
  # never raw stderr, paths, hostnames, or exception text.
55
55
  COMPONENT_REASON_CODES = frozenset(
56
56
  {
@@ -1,5 +1,5 @@
1
1
  """``--gpu-memory``: price a plan as if its card had at most this much free memory, so several
2
- stacks can each take a share of one large card (SP4, evidence/2026-11-04-gpu2-split4-lab8520)."""
2
+ stacks can each take a share of one large card."""
3
3
 
4
4
  from __future__ import annotations
5
5
 
@@ -47,7 +47,7 @@ from localmodels.stack_plan import (
47
47
  )
48
48
 
49
49
  GIB = 1 << 30
50
- TIERS_GIB = (8, 12, 16, 24, 32, 48, 96) # research/2026-10-24-vram-tier-stacks
50
+ TIERS_GIB = (8, 12, 16, 24, 32, 48, 96)
51
51
  _NOMINAL_SLACK = 1.1 # a 24 GB card reports 22.5–24 GiB; an 80 GB one is not a 96 GB card
52
52
  _FIRST_TIER_RAM = 60 * GIB # 64 GB of RAM reads about 62 GiB
53
53
  # ``--unified-memory`` when the option is not given: a front-end that runs this tool (the Simplex
@@ -151,7 +151,7 @@ def slow_advisory(facts: HostFacts, llm: Plan) -> str | None:
151
151
  def cards(facts: HostFacts, gpu: int | None = None, *, share_gpu: bool = False) -> list[int]:
152
152
  """Single-card choices by free memory. A card with foreign GPU work needs explicit sharing;
153
153
  with it, who else uses the card, known or not, does not matter: the free memory decides,
154
- with the usual margins (roadmap decision 60)."""
154
+ with the usual margins."""
155
155
  if metal.device(facts) is not None:
156
156
  if gpu not in (None, 0):
157
157
  raise StackError(f"this computer has one Metal GPU (GPU 0), no GPU {gpu}")
@@ -182,7 +182,7 @@ def check_shared_start(
182
182
  part: Plan, facts: HostFacts, *, options: StackOptions | None = None
183
183
  ) -> None:
184
184
  """Recheck free VRAM before starting. Shared or not, an unknown owner of other GPU work no
185
- longer refuses (roadmap decision 60): the card's free memory against ``start_need`` decides;
185
+ longer refuses: the card's free memory against ``start_need`` decides;
186
186
  too little raises VramShortError (STACK_VRAM_INSUFFICIENT)."""
187
187
  from localmodels import hosts, stack_lifecycle
188
188
 
@@ -326,27 +326,29 @@ def llm_fits(
326
326
  tok_s = float(fit["decode_tok_s"]) if fit["decode_tok_s"] is not None else -1.0
327
327
  found.append((((0 if unscored else entry.quality), tok_s), fit))
328
328
 
329
+ usable_llama_scores = [
330
+ f["quality"]
331
+ for _, f in found
332
+ if not f.get("candidate_fallback")
333
+ and f["decode_tok_s"] is not None
334
+ and f["decode_tok_s"] >= cat.USABLE_FLOOR_TOK_S
335
+ ]
329
336
  llama_score = max(
330
- (f["quality"] for _, f in found if not f.get("candidate_fallback")), default=-1
337
+ usable_llama_scores or [f["quality"] for _, f in found if not f.get("candidate_fallback")],
338
+ default=-1,
331
339
  )
332
- preferred_strata = {
333
- c["id"]
334
- for c in catalog_recipes.components()
335
- if c["runtime"] in ("strata", "strata-poly") and c.get("prefer_over_llama")
336
- }
337
- strata_vram = {
338
- c["id"]: int(str(c.get("vram_bytes") or 0))
339
- for c in catalog_recipes.components()
340
- if c["runtime"] in ("strata", "strata-poly")
340
+ strata_by_id = {
341
+ r["id"]: r for r in suite.recipes("llm") if r["runtime"] in suite.STRATA_RUNTIMES
341
342
  }
342
343
  for fit in stack_auto.card_fits(facts, index, options, llama_score):
343
344
  _apply_fit_measurement(facts, index, fit)
344
- tie = (1e9 if fit["id"] in preferred_strata else -1e9) + strata_vram.get(fit["id"], 0) / GIB
345
+ recipe = strata_by_id.get(fit["id"])
346
+ tie = suite.strata_smart_tie(recipe) if recipe is not None else -1e9
345
347
  found.append(((fit["quality"], tie), fit))
346
348
  found = [row for row in found if not row[1].get("candidate_fallback")] or found
347
349
  default_id = llm_rank.listed_default(facts, [(f["id"], f["quality"]) for _, f in found])
348
350
  if default_id is None and found:
349
- strata_ids = set(strata_vram)
351
+ strata_ids = set(strata_by_id)
350
352
  fallback_ids = {f["id"] for _, f in found if f.get("candidate_fallback")}
351
353
  slow_ids = {
352
354
  f["id"]
@@ -158,8 +158,7 @@ TOOLS: tuple[dict[str, Any], ...] = (
158
158
  ),
159
159
  _tool_def(
160
160
  "stack_status",
161
- "Read-only status of local stack deployments, owned manifest, latest "
162
- "apply run, gateway wiring, and observed gateway speed.",
161
+ "Read-only status of local stack deployments, owned manifest, and latest apply run.",
163
162
  {},
164
163
  ),
165
164
  )
@@ -181,7 +181,14 @@ def _model_plan(facts: HostFacts, options: StackOptions, entry: catalog.CatalogE
181
181
  "frontend_bytes": 1 << 30,
182
182
  },
183
183
  service={"argv": argv, "env": {"HF_HUB_OFFLINE": "1", "TOKENIZERS_PARALLELISM": "false"}},
184
- endpoint={"model": model_dir, "contract": "openai-chat"},
184
+ endpoint={
185
+ "model": model_dir,
186
+ "contract": "openai-chat",
187
+ "health_path": "/health",
188
+ "slots_path": None,
189
+ "metrics_path": None,
190
+ "metrics_requires_auth": False,
191
+ },
185
192
  warnings=list(WARNINGS),
186
193
  )
187
194
  plan["service"]["kind"] = "launchd-user"
@@ -8,7 +8,7 @@ pick is returned when the same model is both, or when the faster one gains less
8
8
  WORTH_FASTER. Speeds are the catalog's: measured on the same device model where a measurement
9
9
  exists, an estimate otherwise (memory bandwidth over the bytes read per token, with no
10
10
  speculative decoding); the basis travels with each pick and is printed. An estimate is not a
11
- bound: with MTP on, Qwen3.8-27B decoded prose faster than its estimate on local-118 (CYC2).
11
+ bound: with MTP on, Qwen3.8-27B decoded prose faster than its bandwidth estimate on reference hardware.
12
12
  """
13
13
 
14
14
  from __future__ import annotations
@@ -17,7 +17,7 @@ from collections.abc import Sequence
17
17
  from typing import TypedDict
18
18
 
19
19
  from localmodels import catalog as cat
20
- from localmodels import catalog_recipes, llm_rank
20
+ from localmodels import llm_rank, suite
21
21
 
22
22
  # A second choice has to be worth offering: at least this much faster than the smartest.
23
23
  WORTH_FASTER = 1.2
@@ -70,17 +70,16 @@ def picks(cards: Sequence[CardFits], ladder: llm_rank.MacLadder | None = None) -
70
70
  found.setdefault(
71
71
  fit["id"], {**fit, "role": "", "card": card["index"], "shared": not free}
72
72
  )
73
- components = catalog_recipes.components()
74
- strata_ids = {c["id"] for c in components if c["runtime"] in ("strata", "strata-poly")}
75
- preferred_strata = {
76
- c["id"]
77
- for c in components
78
- if c["runtime"] in ("strata", "strata-poly") and c.get("prefer_over_llama")
79
- }
80
- strata_vram = {
81
- c["id"]: int(str(c.get("vram_bytes") or 0))
82
- for c in components
83
- if c["runtime"] in ("strata", "strata-poly")
73
+ strata_recipes = [r for r in suite.recipes("llm") if r["runtime"] in suite.STRATA_RUNTIMES]
74
+ strata_by_id = {r["id"]: r for r in strata_recipes}
75
+ strata_ids = set(strata_by_id)
76
+ preferred_strata = {r["id"] for r in strata_recipes if r.get("prefer_over_llama")}
77
+ poly_fastest_ids = {
78
+ r["id"]
79
+ for r in strata_recipes
80
+ if r["runtime"] == "strata-poly"
81
+ and r.get("prefer_over_llama")
82
+ and suite.effective_parallel(r, r.get("card_args") or ()) >= 2
84
83
  }
85
84
  llama_scores = [
86
85
  p["quality"]
@@ -102,9 +101,8 @@ def picks(cards: Sequence[CardFits], ladder: llm_rank.MacLadder | None = None) -
102
101
  return []
103
102
 
104
103
  def _smart_tie(p: Pick) -> float:
105
- if p["id"] in strata_ids:
106
- gib_rank = strata_vram.get(p["id"], 0) / (1 << 30)
107
- return (1e9 if p["id"] in preferred_strata else -1e9) + gib_rank
104
+ if (recipe := strata_by_id.get(p["id"])) is not None:
105
+ return suite.strata_smart_tie(recipe)
108
106
  return -1.0 if p["decode_tok_s"] is None else p["decode_tok_s"]
109
107
 
110
108
  ranked = [((p["quality"], _smart_tie(p)), p["id"], p["card"]) for p in eligible]
@@ -119,18 +117,19 @@ def picks(cards: Sequence[CardFits], ladder: llm_rank.MacLadder | None = None) -
119
117
  smartest = found[
120
118
  llm_rank.choose(ranked, "smartest", ladder, fallback_ids=fallback_ids, slow_ids=slow_ids)[0]
121
119
  ]
122
- llama_ranked = [
120
+ speed_ranked = [
123
121
  ((p["quality"], float(p["decode_tok_s"])), p["id"], p["card"])
124
- for p in eligible
125
- if p["id"] not in strata_ids and p["decode_tok_s"] is not None
122
+ for p in found.values()
123
+ if p["decode_tok_s"] is not None
124
+ and (p["id"] not in strata_ids or p["id"] in poly_fastest_ids)
126
125
  ]
127
126
  fastest = (
128
127
  found[
129
128
  llm_rank.choose(
130
- llama_ranked, "fastest", ladder, fallback_ids=fallback_ids, slow_ids=slow_ids
129
+ speed_ranked, "fastest", ladder, fallback_ids=fallback_ids, slow_ids=slow_ids
131
130
  )[0]
132
131
  ]
133
- if llama_ranked
132
+ if speed_ranked
134
133
  else smartest
135
134
  )
136
135
  offered: list[Pick] = [{**smartest, "role": "smartest"}]
@@ -8,7 +8,6 @@ import datetime as dt
8
8
  import json
9
9
  import os
10
10
  import subprocess
11
- import sys
12
11
  from collections.abc import Callable
13
12
  from pathlib import Path
14
13
  from typing import Literal, TypedDict, cast
@@ -83,10 +82,10 @@ GIB = 1 << 30
83
82
  # memory "available" there counts free + inactive + speculative pages, and macOS reclaims beyond
84
83
  # it, so Linux's 4 GiB floor held back a second margin. A 24 GiB Mac ran Ling 128K and 64K with
85
84
  # pi for 20+ minutes from 8.4–8.9 GB available, pressure 1 and no swap growth, where the 4 GiB
86
- # floor refused it (evidence/2026-11-05-mac-llm-only-tiers/REPORT.md). The live gates stay: a
85
+ # floor refused it. The live gates stay: a
87
86
  # plan needs pressure 1 or 2 (2 keeps a quarter back, metal.pressured) and apply re-probes.
88
87
  METAL_RAM_FLOOR = 1 * GIB
89
- # The thinking cap new plans give the LLM (roadmap decision 37). An estimate, not a measurement:
88
+ # The thinking cap new plans give the LLM. An estimate, not a measurement:
90
89
  # the only measured cap is 2,048 (MM64, Ling 3.0 tiny on a 24 GB Mac: basic and long-input checks
91
90
  # unchanged); 8,192 is four times that and the whole-reply budget agent clients already send,
92
91
  # so a reply that would think without end (14,000 tokens of thinking, no answer, on local-119
@@ -160,8 +159,8 @@ def guard_details(exc: BaseException) -> dict[str, object]:
160
159
 
161
160
  def platform_error(platform: str, profile: str | None = None, arch: str | None = "") -> str | None:
162
161
  """Executable stack recipes, not the controller's ability to inspect a host: Linux, Apple
163
- Silicon Macs (Metal; an unknown ``arch`` is taken as one), 64-bit Windows (roadmap decision
164
- 48; an unknown ``arch`` is taken as x64) and the explicit Apple Silicon MLX installation
162
+ Silicon Macs (Metal; an unknown ``arch`` is taken as one), 64-bit Windows (an unknown
163
+ ``arch`` is taken as x64) and the explicit Apple Silicon MLX installation
165
164
  preview."""
166
165
  if profile == "macos-mlx-preview":
167
166
  if platform == "darwin" and arch == "arm64":
@@ -207,20 +206,20 @@ class _OptionsSince20261022(TypedDict, total=False):
207
206
  # Since 2026-11-03 (`stack plan --update`): the plan id of the accepted stack this plan
208
207
  # updates (stack_update). Absent: a plain plan, which keeps running parts as recorded.
209
208
  update: str
210
- # Since 2026-11-03 (roadmap decision 26): what ``--llm auto`` optimizes, one of PREFERENCES.
209
+ # What ``--llm auto`` optimizes, one of PREFERENCES.
211
210
  # Absent: "smartest", the highest installed SimplexAI score that fits.
212
211
  prefer: str
213
- # Since 2026-11-04 (roadmap decision 31): where the LLM's picture reader runs, one of
212
+ # Where the LLM's picture reader runs, one of
214
213
  # vision.READERS ("auto" for new plans). Absent: "off", text-only like every older plan.
215
214
  vision: str
216
215
  # Since 2026-11-04: price the plan with at most this much free memory on the --gpu card
217
216
  # (every NVIDIA card without --gpu); systemd size, e.g. 24G (stack_gpu_memory.capped).
218
217
  # Absent: the cards as read.
219
218
  gpu_memory: str
220
- # Since 2026-11-05 (roadmap decision 37): the LLM's window ceiling in tokens (``--context``;
219
+ # The LLM's window ceiling in tokens (``--context``;
221
220
  # at least the agent floor, 64K). Absent: the largest window that fits, up to 200K.
222
221
  context: int
223
- # Since 2026-11-05 (roadmap decision 37): the most tokens one reply may think, passed to
222
+ # The most tokens one reply may think, passed to
224
223
  # llama-server's --reasoning-budget and Strata's reasoning_budget_tokens; 0: no cap.
225
224
  # Absent: no cap, as every older plan ran.
226
225
  reasoning_budget: int
@@ -232,7 +231,7 @@ class _OptionsSince20261022(TypedDict, total=False):
232
231
  llm_fast_port: int # resolved when route is enabled, bound by approval
233
232
 
234
233
 
235
- # The scenarios a user picks instead of weights (roadmap decision 26, docs/local-models/model-scoring.md).
234
+ # The scenarios a user picks instead of weights (see docs/local-models/model-scoring-public.md).
236
235
  # Since 2026-11-12 (decision 45): fastest, the highest decode speed that fits whatever its score,
237
236
  # the second choice `stack` offers beside smartest (stack_picks).
238
237
  PREFERENCES = ("smartest", "concurrent", "fast", "fastest")
@@ -524,7 +523,9 @@ def deployments(plan: StackPlan) -> list[Plan]:
524
523
 
525
524
  def command() -> str:
526
525
  """How the operator ran this tool, for commands it tells them to run next."""
527
- return "localmodels" if Path(sys.argv[0]).name == "localmodels" else "python3 -m localmodels"
526
+ from localmodels import cli_help
527
+
528
+ return cli_help.command()
528
529
 
529
530
 
530
531
  NOTHING_HERE = (
@@ -13,7 +13,14 @@ from collections.abc import Callable, Iterator, Sequence
13
13
  from pathlib import Path
14
14
  from typing import Literal
15
15
 
16
- from localmodels import component, deploy, deployment_lifecycle, hosts, process_identity_darwin
16
+ from localmodels import (
17
+ component,
18
+ deploy,
19
+ deployment_lifecycle,
20
+ hosts,
21
+ plan_envelope,
22
+ process_identity_darwin,
23
+ )
17
24
  from localmodels.plan_envelope import PlanError
18
25
  from localmodels.probe import HostFacts
19
26
  from localmodels.records import Plan
@@ -122,8 +129,22 @@ AUXILIARY_PORTS = {
122
129
  TTS_PORTS: tuple[int, ...] = (18380, *range(18528, 18560))
123
130
 
124
131
 
132
+ PORTS_IN_USE = "PORTS_IN_USE"
133
+
134
+
125
135
  class PortUnavailableError(PlanError):
126
- """A bounded endpoint cannot be admitted from known-free loopback ports."""
136
+ """Every port of a bounded range is known to be in use. Like PortProbeError it says nothing
137
+ about the model being planned; its cause code PORTS_IN_USE tells an installer the hardware
138
+ may still fit once a program frees a port (setup inspect: ``ports-in-use``, blocked-now)."""
139
+
140
+ def __init__(self, message: str) -> None:
141
+ super().__init__(message, cause_code=PORTS_IN_USE)
142
+
143
+
144
+ def ports_in_use(exc: BaseException) -> bool:
145
+ """Whether ``exc`` refuses a plan only because a whole default port range is in use. The
146
+ cause code survives the PlanError-to-StackError wrapping between the planner's layers."""
147
+ return getattr(exc, "cause_code", None) == PORTS_IN_USE
127
148
 
128
149
 
129
150
  class PortProbeError(StackError):
@@ -142,7 +163,10 @@ PortState = Literal["free", "busy", "unknown"]
142
163
 
143
164
  def port_state(facts: HostFacts, port: int, listening: Callable[[int], bool]) -> PortState:
144
165
  """Free only on known absence of every observed loopback listener; ``unknown`` when the
145
- inventory or the probe cannot tell."""
166
+ inventory or the probe cannot tell. Every port is free while plan_envelope.assume_ports_free
167
+ holds (setup inspect only)."""
168
+ if plan_envelope.ports_assumed_free():
169
+ return "free"
146
170
  if any(service["port"] == port for service in facts.get("llama_servers") or []):
147
171
  return "busy"
148
172
  services = facts.get("services")
@@ -259,6 +283,8 @@ def loopback_bindable(port: int) -> bool:
259
283
 
260
284
  def loopback_listening(port: int) -> bool:
261
285
  """Keep planning failures typed while sharing the lower-level listener proof."""
286
+ if plan_envelope.ports_assumed_free():
287
+ return False
262
288
  seen = _SNAPSHOT.get()
263
289
  if seen is not None and port in seen:
264
290
  known = seen[port]
@@ -327,7 +353,8 @@ def llm_port(
327
353
  "loopback check failed); check again, or pick a port with --llm-port"
328
354
  )
329
355
  raise StackError(
330
- "default LLM ports 18100..18131 are all in use; pick a free port with --llm-port"
356
+ "default LLM ports 18100..18131 are all in use; pick a free port with --llm-port",
357
+ cause_code=PORTS_IN_USE,
331
358
  )
332
359
 
333
360
 
@@ -7,7 +7,7 @@ from pathlib import Path
7
7
  from typing import TypedDict
8
8
  from urllib.parse import urlsplit, urlunsplit
9
9
 
10
- from localmodels import catalog_license, stack
10
+ from localmodels import catalog_license, library_presentation, stack
11
11
  from localmodels.contracts import decode
12
12
  from localmodels.planning import budget
13
13
  from localmodels.setup_text import Lang, join, text
@@ -26,10 +26,7 @@ class PlanGPU(TypedDict):
26
26
  roles: list[str] # llm, llm_fast, decision: the models the plan places on this card
27
27
 
28
28
 
29
- class PlanSummary(TypedDict):
30
- """What a plan installs and needs, read from the plan alone: the recommendation an installer
31
- shows. ``gpus`` lists every card the plan places a model on, the LLM's first."""
32
-
29
+ class _PlanSummaryRequired(TypedDict):
33
30
  llm: str # catalog model ID
34
31
  llmName: str # display name and quantization
35
32
  contextWindow: int
@@ -43,6 +40,16 @@ class PlanSummary(TypedDict):
43
40
  text: str # one sentence in the requested language
44
41
 
45
42
 
43
+ class PlanSummary(_PlanSummaryRequired, total=False):
44
+ """What a plan installs and needs, read from the plan alone: the recommendation an installer
45
+ shows. ``gpus`` lists every card the plan places a model on, the LLM's first."""
46
+
47
+ engine: str
48
+ quant: str
49
+ quant_fidelity: str
50
+ recommendation_reasons: list[str]
51
+
52
+
46
53
  class _StackReview(TypedDict):
47
54
  schema: str
48
55
  planId: str
@@ -144,10 +151,11 @@ def summarize(plan: StackPlan, lang: Lang = "zh") -> PlanSummary:
144
151
  ram, download = decode(need["ram_needed_bytes"], int), decode(need["download_bytes"], int)
145
152
  disk = decode(need["disk_needed_bytes"], int)
146
153
  gib = budget.gib
147
- return {
154
+ context_window = decode(llm["launch"]["window"], int)
155
+ summary: PlanSummary = {
148
156
  "llm": model["id"],
149
157
  "llmName": name,
150
- "contextWindow": decode(llm["launch"]["window"], int),
158
+ "contextWindow": context_window,
151
159
  "gpus": gpus,
152
160
  "placement": str(llm["placement"].get("label") or ""),
153
161
  "memoryKind": "unified" if unified else "discrete",
@@ -166,6 +174,19 @@ def summarize(plan: StackPlan, lang: Lang = "zh") -> PlanSummary:
166
174
  disk=gib(disk),
167
175
  ),
168
176
  }
177
+ extra = library_presentation.plan_presentation(
178
+ llm, context_window=context_window, gpus=gpus, unified=unified
179
+ )
180
+ if isinstance(engine := extra.get("engine"), str):
181
+ summary["engine"] = engine
182
+ if isinstance(quant := extra.get("quant"), str) and quant:
183
+ summary["quant"] = quant
184
+ if isinstance(fidelity := extra.get("quant_fidelity"), str):
185
+ summary["quant_fidelity"] = fidelity
186
+ reasons = extra.get("recommendation_reasons")
187
+ if isinstance(reasons, list) and reasons:
188
+ summary["recommendation_reasons"] = [str(r) for r in reasons]
189
+ return summary
169
190
 
170
191
 
171
192
  def review_plan(path: Path, lang: Lang = "zh") -> StackReview:
@@ -166,7 +166,7 @@ def _cards(target: StackPlan, facts: HostFacts, share_gpu: bool) -> list[str]:
166
166
  )
167
167
  # Metal needs every discovery section read; an unshared card needs to know who uses
168
168
  # the GPUs, as at plan time (budget.gpu_users_unknown). Sharing consent decides by free
169
- # VRAM whoever else is there (roadmap decision 60).
169
+ # VRAM whoever else is there.
170
170
  unknown = (
171
171
  bool(unknown_services(facts))
172
172
  if stack_hardware.on_metal(part)
@@ -189,7 +189,7 @@ def persist(session: RunSession) -> StackRecord:
189
189
  def checkpointed(session: RunSession) -> Iterator[None]:
190
190
  """Record the run before its first component and on every way out. A Ctrl+C or SIGTERM
191
191
  during the first write, or a second one while the end is being recorded, still leaves the
192
- record interrupted or failed, never running (.agents/skills/stack-run-record)."""
192
+ record interrupted or failed, never running."""
193
193
  try:
194
194
  persist(session)
195
195
  yield