@simplexai/localmodels-linux-x64 0.1.0-dev.44 → 0.1.0-dev.45

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 (64) hide show
  1. package/bootstrap.identity +1 -1
  2. package/bootstrap.sha256 +59 -63
  3. package/modules/localmodels/__init__.py +1 -1
  4. package/modules/localmodels/__main__.py +0 -1
  5. package/modules/localmodels/bifrost_checks.py +3 -127
  6. package/modules/localmodels/bifrost_clients.py +1 -1
  7. package/modules/localmodels/bifrost_config.py +2 -2
  8. package/modules/localmodels/bifrost_pi.py +1 -1
  9. package/modules/localmodels/budget.py +16 -1
  10. package/modules/localmodels/catalog.json +15 -50
  11. package/modules/localmodels/catalog_recipes.py +1 -1
  12. package/modules/localmodels/engines-strata-poly-0.1.45-poly.9.json +41 -1
  13. package/modules/localmodels/gateway.py +50 -15
  14. package/modules/localmodels/gateway_accept.py +8 -5
  15. package/modules/localmodels/gateway_bifrost.py +13 -12
  16. package/modules/localmodels/gateway_cli.py +5 -2
  17. package/modules/localmodels/gateway_requests.py +9 -2
  18. package/modules/localmodels/harness.py +38 -11
  19. package/modules/localmodels/harness_gateway.py +1 -1
  20. package/modules/localmodels/hosts.py +7 -20
  21. package/modules/localmodels/library_gateway.py +12 -9
  22. package/modules/localmodels/library_pricing.py +1 -5
  23. package/modules/localmodels/npm_transport.py +62 -54
  24. package/modules/localmodels/recommend.py +1 -1
  25. package/modules/localmodels/recommend_cli.py +2 -2
  26. package/modules/localmodels/remote_ops.py +14 -6
  27. package/modules/localmodels/remote_ops_download.py +1 -1
  28. package/modules/localmodels/remote_ops_verify.py +0 -33
  29. package/modules/localmodels/runtime_install.py +2 -1
  30. package/modules/localmodels/runtime_io.py +149 -34
  31. package/modules/localmodels/source_byok.py +6 -3
  32. package/modules/localmodels/source_cli.py +8 -1
  33. package/modules/localmodels/stack.py +1 -5
  34. package/modules/localmodels/stack_args.py +6 -8
  35. package/modules/localmodels/stack_binding.py +3 -3
  36. package/modules/localmodels/stack_compose.py +3 -8
  37. package/modules/localmodels/stack_events.py +2 -1
  38. package/modules/localmodels/stack_plan.py +1 -4
  39. package/modules/localmodels/stack_ports.py +0 -1
  40. package/modules/localmodels/stack_run.py +15 -30
  41. package/modules/localmodels/stack_suite.py +23 -46
  42. package/modules/localmodels/stack_summary.py +0 -1
  43. package/modules/localmodels/stack_try.py +3 -92
  44. package/modules/localmodels/stack_up.py +7 -3
  45. package/modules/localmodels/stack_update.py +5 -5
  46. package/modules/localmodels/stack_view_apply.py +1 -1
  47. package/modules/localmodels/stack_view_sandbox.py +0 -2
  48. package/modules/localmodels/stack_view_text.py +0 -1
  49. package/modules/localmodels/stack_view_words.py +0 -1
  50. package/modules/localmodels/suite.py +4 -7
  51. package/modules/localmodels/tui_dialogs.py +0 -1
  52. package/modules/localmodels/web/view/view.css +0 -3
  53. package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/METADATA +1 -1
  54. package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/RECORD +56 -60
  55. package/package.json +1 -1
  56. package/tool.json +1 -1
  57. package/modules/localmodels/bifrost_search.py +0 -66
  58. package/modules/localmodels/gateway_search.py +0 -223
  59. package/modules/localmodels/search-ddgs-9.16.1.txt +0 -222
  60. package/modules/localmodels/search_server.py +0 -474
  61. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/WHEEL +0 -0
  62. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/entry_points.txt +0 -0
  63. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/licenses/NOTICE +0 -0
  64. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev45.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -19,12 +19,13 @@ import urllib.error
19
19
  import urllib.parse
20
20
  import urllib.request
21
21
  import zipfile
22
+ from collections import deque
22
23
  from collections.abc import Callable
23
24
  from pathlib import Path
24
25
  from typing import Any, cast
25
26
 
26
27
  # remote_ops before remote_ops_download: the bundle's entry module loads its siblings
27
- from localmodels import region, remote_ops, remote_ops_download, runtime_windows_acl
28
+ from localmodels import npm_transport, region, remote_ops, remote_ops_download, runtime_windows_acl
28
29
 
29
30
  Event = Callable[[dict[str, Any]], None]
30
31
 
@@ -222,6 +223,13 @@ def _extract_archive(archive: Path, target: Path) -> None:
222
223
 
223
224
 
224
225
  DOWNLOAD_ATTEMPTS = 5
226
+ # One timeout covers the connection, the response headers and each read: a retry resumes the
227
+ # kept bytes, so a stalled connection is cheap to replace and needs no separate read timeout.
228
+ DOWNLOAD_TIMEOUT_S = 15
229
+ # A host that delivers less than SLOW_BYTES_PER_S over a whole SLOW_WINDOW_S window is left for
230
+ # another host serving the same file, when one is still worth trying (see ``download``).
231
+ SLOW_BYTES_PER_S = 512 * 1024
232
+ SLOW_WINDOW_S = 15
225
233
  _RETRY_HTTP = frozenset({408, 425, 429, 500, 502, 503, 504})
226
234
 
227
235
 
@@ -229,13 +237,16 @@ class RuntimeDownloadError(ValueError):
229
237
  """A pinned artifact could not be downloaded. The message names only the host, the file,
230
238
  a fixed reason and the bytes kept: no URL query, header or response body."""
231
239
 
232
- def __init__(self, url: str, reason: str, kept: int, *, retryable: bool) -> None:
240
+ def __init__(
241
+ self, url: str, reason: str, kept: int, *, retryable: bool, slow: bool = False
242
+ ) -> None:
233
243
  parts = urllib.parse.urlsplit(url)
234
244
  self.host = parts.hostname or "the download host"
235
245
  self.file = parts.path.rsplit("/", 1)[-1] or "artifact"
236
246
  self.reason = reason
237
247
  self.kept = kept
238
248
  self.retryable = retryable
249
+ self.slow = slow # the host was left for being too slow, not for failing
239
250
  message = f"Download of {self.file} from {self.host} failed: {reason}."
240
251
  if kept:
241
252
  message += f" {kept} bytes are kept; a retry resumes from there."
@@ -248,16 +259,19 @@ class RuntimeDownloadError(ValueError):
248
259
 
249
260
 
250
261
  class _TransferError(Exception):
251
- def __init__(self, reason: str, *, retryable: bool = True) -> None:
262
+ def __init__(self, reason: str, *, retryable: bool = True, slow: bool = False) -> None:
252
263
  super().__init__(reason)
253
264
  self.reason = reason
254
265
  self.retryable = retryable
266
+ self.slow = slow
255
267
 
256
268
 
257
269
  def _network_reason(exc: BaseException) -> tuple[str, bool]:
258
270
  """A fixed description of a network failure, and whether trying again can help."""
259
271
  if isinstance(exc, urllib.error.HTTPError):
260
272
  return f"HTTP {exc.code}", exc.code in _RETRY_HTTP
273
+ if isinstance(exc, npm_transport.UnsafeRedirect):
274
+ return "the server redirected to a URL without HTTPS or with credentials", False
261
275
  if isinstance(exc, urllib.error.URLError) and isinstance(exc.reason, BaseException):
262
276
  exc = exc.reason
263
277
  if isinstance(exc, ssl.SSLCertVerificationError):
@@ -304,14 +318,25 @@ class Rate:
304
318
  return found
305
319
 
306
320
 
307
- def _transfer(url: str, part: Path, limit: int, event: Event, *, retry_missing: bool) -> None:
308
- """One request for the rest of ``part``; network failures raise _TransferError."""
321
+ def _transfer(
322
+ url: str,
323
+ part: Path,
324
+ limit: int,
325
+ event: Event,
326
+ *,
327
+ retry_missing: bool,
328
+ slow_abort: bool = False,
329
+ clock: Callable[[], float] = time.monotonic,
330
+ ) -> None:
331
+ """One request for the rest of ``part``; network failures raise _TransferError. With
332
+ ``slow_abort``, a whole SLOW_WINDOW_S below SLOW_BYTES_PER_S raises one marked ``slow``."""
309
333
  have = part.stat().st_size
310
334
  request = urllib.request.Request(url, headers={"User-Agent": "localmodels-runtime"})
311
335
  if have:
312
336
  request.add_header("Range", f"bytes={have}-")
313
337
  try:
314
- source = urllib.request.urlopen(request, timeout=30)
338
+ # Redirects stay on HTTPS without credentials, as for every npm download of this tool.
339
+ source = npm_transport.https_opener().open(request, timeout=DOWNLOAD_TIMEOUT_S)
315
340
  except urllib.error.HTTPError as exc:
316
341
  if exc.code == 404 and retry_missing:
317
342
  raise _TransferError("HTTP 404") from None
@@ -331,6 +356,7 @@ def _transfer(url: str, part: Path, limit: int, event: Event, *, retry_missing:
331
356
  length = source.headers.get("Content-Length")
332
357
  total = completed + int(length) if length and length.isdigit() else None
333
358
  rate = Rate(completed)
359
+ window, window_bytes = clock(), 0
334
360
  with part.open("ab" if resumed else "wb") as output:
335
361
  while True:
336
362
  try:
@@ -344,6 +370,17 @@ def _transfer(url: str, part: Path, limit: int, event: Event, *, retry_missing:
344
370
  output.truncate(0)
345
371
  raise ValueError("Runtime artifact exceeds size limit")
346
372
  output.write(chunk)
373
+ window_bytes += len(chunk)
374
+ elapsed = clock() - window
375
+ # The rest arriving within one window at the floor is not worth another host
376
+ # (it also keeps a finished file from being left on its last read).
377
+ near_done = (
378
+ total is not None and total - completed <= SLOW_BYTES_PER_S * SLOW_WINDOW_S
379
+ )
380
+ if slow_abort and elapsed >= SLOW_WINDOW_S and not near_done:
381
+ if window_bytes < SLOW_BYTES_PER_S * elapsed:
382
+ raise _TransferError("the download is too slow", slow=True)
383
+ window, window_bytes = window + elapsed, 0
347
384
  event(
348
385
  {
349
386
  "kind": "progress",
@@ -375,6 +412,11 @@ def download_urls(url: str) -> list[str]:
375
412
  return region.prefer(region.current_region(), [u for u in every if u not in cn], cn)
376
413
 
377
414
 
415
+ def _host(url: str) -> str:
416
+ """The host name of ``url`` alone: events never carry a path, query or credentials."""
417
+ return urllib.parse.urlsplit(url).hostname or ""
418
+
419
+
378
420
  def download(
379
421
  artifact: dict[str, Any],
380
422
  destination: Path,
@@ -383,16 +425,25 @@ def download(
383
425
  attempts: int = DOWNLOAD_ATTEMPTS,
384
426
  pause: Callable[[float], None] = time.sleep,
385
427
  retry_missing: bool = False,
428
+ clock: Callable[[], float] = time.monotonic,
386
429
  ) -> None:
387
430
  """Fetch a pinned artifact into ``destination``, which must not exist. Network failures are
388
431
  retried with backoff and each retry resumes ``destination.part``; a part left by an earlier
389
- call is resumed too. Only content matching the pinned digest is published. When every
390
- retry against one host fails, the next host serving the same file (``download_urls``) is
391
- tried, and a success on the other region's side switches the region."""
392
- urls = download_urls(artifact["url"])
432
+ call is resumed too, also from another host, since the bytes are pinned by digest. Only
433
+ content matching the pinned digest is published.
434
+
435
+ The hosts serving the same file (``download_urls``) are tried in turn. A host that fails
436
+ every retry is dropped. A host slower than SLOW_BYTES_PER_S is left once for the next host
437
+ and queued again last, never to be left for slowness again; only a host followed by one not
438
+ yet left for slowness may be left, so a uniformly slow network switches once and the last
439
+ host always finishes. A success on the other region's side after a failure on the preferred
440
+ side switches the region."""
441
+ urls = deque(download_urls(artifact["url"]))
393
442
  preferred = remote_ops_download.side(urls[0])
394
443
  failed_preferred = False
395
- for index, url in enumerate(urls):
444
+ slow: set[str] = set() # hosts already left once for slowness
445
+ while urls:
446
+ url = urls.popleft()
396
447
  try:
397
448
  _download_from(
398
449
  url,
@@ -402,11 +453,30 @@ def download(
402
453
  attempts=attempts,
403
454
  pause=pause,
404
455
  retry_missing=retry_missing,
456
+ slow_abort=url not in slow and any(u not in slow for u in urls),
457
+ clock=clock,
405
458
  )
406
- except RuntimeDownloadError:
407
- if index + 1 == len(urls):
459
+ except RuntimeDownloadError as exc:
460
+ if exc.slow:
461
+ slow.add(url)
462
+ urls.append(url)
463
+ else:
464
+ # Only a failure moves the region: the region also picks model hubs, so a slow
465
+ # npm mirror must not send a cn user's model downloads to huggingface.co.
466
+ failed_preferred = failed_preferred or remote_ops_download.side(url) == preferred
467
+ if not urls:
408
468
  raise
409
- failed_preferred = failed_preferred or remote_ops_download.side(url) == preferred
469
+ event(
470
+ {
471
+ "kind": "stage",
472
+ "stage": "download",
473
+ "state": "switching",
474
+ "from": _host(url),
475
+ "to": _host(urls[0]),
476
+ "reason": "slow" if exc.slow else exc.reason,
477
+ "completed": exc.kept,
478
+ }
479
+ )
410
480
  continue
411
481
  used = remote_ops_download.side(url)
412
482
  if failed_preferred and used and used != preferred:
@@ -423,6 +493,8 @@ def _download_from(
423
493
  attempts: int,
424
494
  pause: Callable[[float], None],
425
495
  retry_missing: bool,
496
+ slow_abort: bool = False,
497
+ clock: Callable[[], float] = time.monotonic,
426
498
  ) -> None:
427
499
  part = destination.with_name(destination.name + ".part")
428
500
  if destination.exists() or destination.is_symlink():
@@ -435,39 +507,82 @@ def _download_from(
435
507
  flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_NOFOLLOW", 0)
436
508
  os.close(os.open(part, flags, 0o600))
437
509
  private_permissions(part, created=True)
438
- attempt = 0
510
+ # Bytes kept by an earlier call: they may be another version's when the pin changed.
511
+ resumed = part.stat().st_size > 0
512
+ if resumed and _matches(part, artifact):
513
+ _publish(part, destination)
514
+ return
439
515
  while True:
440
- attempt += 1
441
- try:
442
- _transfer(url, part, artifact["maxBytes"], event, retry_missing=retry_missing)
443
- break
444
- except _TransferError as exc:
445
- kept = part.stat().st_size
446
- if not exc.retryable or attempt >= attempts:
447
- raise RuntimeDownloadError(url, exc.reason, kept, retryable=exc.retryable) from None
448
- wait = min(30, 2**attempt)
516
+ attempt = 0
517
+ while True:
518
+ attempt += 1
449
519
  event(
450
520
  {
451
521
  "kind": "stage",
452
522
  "stage": "download",
453
- "state": "retrying",
523
+ "state": "connecting",
524
+ "host": _host(url),
454
525
  "attempt": attempt,
455
526
  "attempts": attempts,
456
- "reason": exc.reason,
457
- "completed": kept,
458
- "waitSeconds": wait,
459
527
  }
460
528
  )
461
- pause(wait)
462
- digest = hashlib.new(artifact["algorithm"])
463
- with part.open("rb") as stream:
464
- for chunk in iter(lambda: stream.read(1024 * 1024), b""):
465
- digest.update(chunk)
466
- if digest.hexdigest() != artifact["digest"]:
529
+ try:
530
+ _transfer(
531
+ url,
532
+ part,
533
+ artifact["maxBytes"],
534
+ event,
535
+ retry_missing=retry_missing,
536
+ slow_abort=slow_abort,
537
+ clock=clock,
538
+ )
539
+ break
540
+ except _TransferError as exc:
541
+ kept = part.stat().st_size
542
+ if exc.slow: # not retried here: the caller moves to another host
543
+ raise RuntimeDownloadError(
544
+ url, exc.reason, kept, retryable=True, slow=True
545
+ ) from None
546
+ if not exc.retryable or attempt >= attempts:
547
+ raise RuntimeDownloadError(
548
+ url, exc.reason, kept, retryable=exc.retryable
549
+ ) from None
550
+ wait = min(30, 2**attempt)
551
+ event(
552
+ {
553
+ "kind": "stage",
554
+ "stage": "download",
555
+ "state": "retrying",
556
+ "attempt": attempt,
557
+ "attempts": attempts,
558
+ "reason": exc.reason,
559
+ "completed": kept,
560
+ "waitSeconds": wait,
561
+ }
562
+ )
563
+ pause(wait)
564
+ if _matches(part, artifact):
565
+ break
566
+ if resumed: # restart once from zero on this host rather than blame it
567
+ part.write_bytes(b"")
568
+ resumed = False
569
+ continue
467
570
  part.unlink()
468
571
  raise RuntimeDownloadError(
469
572
  url, "the content does not match the pinned digest", 0, retryable=True
470
573
  )
574
+ _publish(part, destination)
575
+
576
+
577
+ def _matches(part: Path, artifact: dict[str, Any]) -> bool:
578
+ digest = hashlib.new(artifact["algorithm"])
579
+ with part.open("rb") as stream:
580
+ for chunk in iter(lambda: stream.read(1024 * 1024), b""):
581
+ digest.update(chunk)
582
+ return bool(digest.hexdigest() == artifact["digest"])
583
+
584
+
585
+ def _publish(part: Path, destination: Path) -> None:
471
586
  part.rename(destination)
472
587
  private_permissions(destination)
473
588
 
@@ -481,11 +481,14 @@ def write_byok_profiles(addr: str, creds: ByokCredentials) -> dict[str, str]:
481
481
  }
482
482
 
483
483
 
484
- def mount_byok(creds: ByokCredentials, facts: HostFacts) -> tuple[str, dict[str, str]]:
485
- """Mount ``localmodels-byok`` onto owned Bifrost and generate isolated client profiles."""
484
+ def mount_byok(
485
+ creds: ByokCredentials, facts: HostFacts, event: runtime_io.Event = lambda _: None
486
+ ) -> tuple[str, dict[str, str]]:
487
+ """Mount ``localmodels-byok`` onto owned Bifrost and generate isolated client profiles;
488
+ ``event`` receives the download events of a Bifrost installed on the way."""
486
489
  with library_gateway.gateway_locked():
487
490
  try:
488
- record = library_gateway.ensure_instance(facts)
491
+ record = library_gateway.ensure_instance(facts, event)
489
492
  if record is None:
490
493
  raise ByokError("BYOK_GATEWAY_FAILED", "Bifrost gateway could not be prepared.")
491
494
  app = Path(record["app_dir"])
@@ -261,13 +261,20 @@ def _ensure_runtime_installed(
261
261
  runtime_cli.apply_plan(plan, str(plan["id"]))
262
262
 
263
263
 
264
+ def _stderr_event(event: dict[str, Any]) -> None:
265
+ """One JSON line per event on stderr, written at once: stdout carries only the final
266
+ document, which the installer parses whole."""
267
+ sys.stderr.write(json.dumps(event, ensure_ascii=False) + "\n")
268
+ sys.stderr.flush()
269
+
270
+
264
271
  def _apply_byok(args: argparse.Namespace, runtime: Runtime) -> SourceState:
265
272
  payload = _read_stdin_json() if args.config_stdin else None
266
273
  creds = source_byok_probe.probe_upstream(source_byok.resolve_endpoint(payload))
267
274
  _unload_loaded_local_models(args.base_dir)
268
275
  source_byok.save_credentials(creds)
269
276
  facts = library_jobs.probe()
270
- gateway_url, env = source_byok.mount_byok(creds, facts)
277
+ gateway_url, env = source_byok.mount_byok(creds, facts, _stderr_event)
271
278
  return source_byok.save_source_state(
272
279
  {
273
280
  "schema": source_byok.SOURCE_SCHEMA,
@@ -202,11 +202,7 @@ def _deploy(component: str, plan: Plan, key: str, log: Log) -> Component:
202
202
  )
203
203
  if record["ok"]:
204
204
  return _ok(component, f"{plan['endpoint']['base_url']} ({plan['service']['name']})")
205
- return _failed(
206
- component,
207
- record.get("error", "unknown failure"),
208
- stack_run.search_failure_checks(component, record),
209
- )
205
+ return _failed(component, record.get("error", "unknown failure"))
210
206
 
211
207
 
212
208
  @dataclass(frozen=True)
@@ -67,8 +67,8 @@ GROUPS = (
67
67
  )
68
68
  STACK = """\
69
69
  Plan, install and run the local agent stack on this computer: the smartest LLM that fits,
70
- a gateway (Bifrost by default) and the pi agent. A GPU decision model, embedding/reranker/STT,
71
- TTS and free web search are optional and off by default (--decision, --aux, --tts, --search).
70
+ a gateway (Bifrost by default) and the pi agent. A GPU decision model, embedding/reranker/STT
71
+ and TTS are optional and off by default (--decision, --aux, --tts).
72
72
  Nothing is downloaded or started until you approve a saved plan.
73
73
 
74
74
  typical flow:
@@ -87,9 +87,9 @@ AGENTS = """\
87
87
  Read-only: hardware, memory, what-if, decisions, plan (saves a file), status, view, verify, doctor,
88
88
  commands, clients, mcp (read-only stdio JSON-RPC), ledger, arena leaderboard, card (writes a local
89
89
  SVG), remove --dry-run, and rollback without --approve. warm sends each installed LLM two short
90
- requests (--sudo also runs macOS purge); try sends one demo request through the local gateway (try
91
- search queries public search engines) and changes nothing installed. arena compares two local LLMs
92
- blindly and writes only model IDs and Elo counts.
90
+ requests (--sudo also runs macOS purge); try sends one demo request through the local gateway and
91
+ changes nothing installed. arena compares two local LLMs blindly and writes only model IDs and Elo
92
+ counts.
93
93
  Installs only an approved plan: apply PLAN --approve ID, rollback --approve ID; install asks
94
94
  y/N (--yes skips). Also changes things: up (starts what was installed), down (stops it), remove, prune --yes.
95
95
  Machine output: --json on plan, hardware, memory, what-if, status, view, verify, doctor, up, down, apply,
@@ -209,8 +209,7 @@ def add_plan_arguments(plan: argparse.ArgumentParser) -> None:
209
209
  "--gateway",
210
210
  choices=list(harness.GATEWAYS),
211
211
  help="the gateway clients reach the local models through: bifrost (this tool's own "
212
- "instance, the default) or magpie (the user's Magpie, with reasoning-effort routing and "
213
- "web search)",
212
+ "instance, the default) or magpie (the user's Magpie, with reasoning-effort routing)",
214
213
  )
215
214
  choose.add_argument(
216
215
  "--vision",
@@ -405,7 +404,6 @@ def _plan(actions: Parsers) -> None:
405
404
  ("%(prog)s", "recommended stack for this computer"),
406
405
  ("%(prog)s --llm qwen3.8-27b --decision none", "pin the LLM, no decision model"),
407
406
  ("%(prog)s --aux embedding,reranker", "opt in to some auxiliaries"),
408
- ("%(prog)s --search", "add the free web search"),
409
407
  ("%(prog)s --gpu 1 --share-gpu", "a card that already runs something"),
410
408
  ("%(prog)s --update", "replace only what changed in the installed stack"),
411
409
  ("%(prog)s --facts host.json --offline --json", "price saved facts, no network"),
@@ -117,9 +117,9 @@ def _deployments_ready(
117
117
  required = stack_run.required_components(plan)
118
118
  for name, part in parts.items():
119
119
  if (
120
- part["endpoint"].get("contract") == "search"
121
- and "search" not in required
122
- and stack_run.search_failure_checks("search", by_name[name]) is not None
120
+ part["endpoint"].get("contract") == stack_run.SEARCH
121
+ and stack_run.SEARCH not in required
122
+ and stack_run.search_unavailable(by_name[name])
123
123
  ):
124
124
  continue
125
125
  row, entry = rows.get(name), owned["deployments"].get(name)
@@ -283,6 +283,8 @@ def _llama_quality(
283
283
  except StackError:
284
284
  return -1, ""
285
285
  entry = next(e for e in cat.load_catalog_file() if e.id == llm_id)
286
+ if llm_rank.windows_fallback(entry, facts):
287
+ return 0, llm_id # an editorial anchor, not an installed score, as in the card lists
286
288
  return entry.quality, llm_id
287
289
 
288
290
 
@@ -698,14 +700,7 @@ def assemble(
698
700
  w.replace("so all hit one LLM at client effort", "each LLM uses client effort")
699
701
  for w in tools_plan["warnings"]
700
702
  ]
701
- if harness.gateway_kind(tools_plan["gateway"]) == "bifrost":
702
- if any(p["endpoint"].get("contract") == "search" for p in aux):
703
- tools_plan["warnings"].append(
704
- "Bifrost runs the web search service as an MCP tool: it replaces native web search"
705
- " in the LLM's requests (Codex, Claude Code, pi) with an injected web_search and"
706
- " runs the calls itself, so every LLM request offers it"
707
- )
708
- else:
703
+ if harness.gateway_kind(tools_plan["gateway"]) != "bifrost":
709
704
  tools_plan = gateway_keys.with_caller_key(tools_plan)
710
705
  warnings += tools_plan["warnings"]
711
706
 
@@ -31,9 +31,10 @@ APPLY_ORDER = (
31
31
  "rerank",
32
32
  "stt",
33
33
  "tts",
34
- "search",
35
34
  "gateway",
36
35
  )
36
+ # Every component a run record may name. ``search`` is the web search service runs recorded
37
+ # while the stack could install it (stack_run.SEARCH): their records stay readable.
37
38
  COMPONENTS = frozenset(
38
39
  {
39
40
  "tools",
@@ -117,7 +117,6 @@ class _OptionsSince20261022(TypedDict, total=False):
117
117
  offline: bool # since 2026-10-24: pins from the catalog, no Hub request, at plan and apply
118
118
  slots: int # concurrent sequences on the LLM's unified KV (agent posture); default 2
119
119
  tts: bool # since 2026-10-27: the opt-in debug TTS joins the auxiliaries; default off
120
- search: bool # since 2026-10-31: False leaves out the free web search; absent: planned
121
120
  defer_services: bool # foundation services install independently of Runtime readiness
122
121
  gpu: int # since 2026-10-28: the card for the LLM and the decision model; absent: auto
123
122
  # Since 2026-10-31: the auxiliary tasks `--aux` named, in AUX_TASKS order; absent: all of
@@ -431,7 +430,6 @@ def default_options() -> StackOptions:
431
430
  "offline": False,
432
431
  "slots": 2,
433
432
  "tts": False,
434
- "search": False,
435
433
  "reasoning_budget": REASONING_BUDGET,
436
434
  "gateway": default_gateway(),
437
435
  "vision": vision.DEFAULT,
@@ -441,7 +439,7 @@ def default_options() -> StackOptions:
441
439
  def gateway_lines(plan: StackPlan) -> list[str]:
442
440
  """The plan summary's gateway lines: what is registered where, the routed model pi gets, and
443
441
  each native client whose default changes."""
444
- from localmodels import gateway_clients, gateway_search
442
+ from localmodels import gateway_clients
445
443
 
446
444
  gw = plan["harness"]["gateway"]
447
445
  aux_providers = [
@@ -460,7 +458,6 @@ def gateway_lines(plan: StackPlan) -> list[str]:
460
458
  + (" (tiered by the decision model)" if gw["decision"] else "")
461
459
  if bifrost
462
460
  else f", routing group group/{gw['group']}"
463
- + gateway_search.summary(plan.get("aux", []))
464
461
  )
465
462
  + f"; pi default model {gw['pi_model_before'] or 'not set'} → {gw['pi_model']}"
466
463
  ]
@@ -18,7 +18,6 @@ AUXILIARY_PORTS = {
18
18
  "embedding": (18352, *range(18432, 18464)),
19
19
  "reranker": (18351, *range(18400, 18432)),
20
20
  "stt": (18370, *range(18464, 18496)),
21
- "search": (18390, *range(18496, 18528)),
22
21
  }
23
22
 
24
23
 
@@ -14,7 +14,6 @@ from uuid import UUID, uuid4
14
14
  from localmodels import console, hosts
15
15
  from localmodels.approval import digest
16
16
  from localmodels.contracts import decode
17
- from localmodels.gateway_search import Check
18
17
  from localmodels.plan_envelope import utc_now
19
18
  from localmodels.records import FinishedRecord
20
19
  from localmodels.stack_events import COMPONENTS
@@ -31,6 +30,10 @@ RunState = Literal["running", "completed", "failed", "interrupted"]
31
30
  _DIGEST = re.compile(r"^[0-9a-f]{64}$")
32
31
  _TIMESTAMP = re.compile(r"^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?(?:Z|\+00:00)$")
33
32
  _CORE = frozenset({"tools", "llm", "gateway", "acceptance"})
33
+ # Plans and run records written while the stack could run a web search service stay readable,
34
+ # so that ``install`` and ``stack plan --update`` can still retire the service. A deferred plan
35
+ # did not require it, and its verify could fail with this code alone.
36
+ SEARCH = "search"
34
37
  SEARCH_UNAVAILABLE = "SEARCH_PROVIDER_UNAVAILABLE"
35
38
 
36
39
 
@@ -101,18 +104,8 @@ def report(record: StackRecord, timing: Mapping[str, float] | None = None) -> in
101
104
  + "; full agent acceptance not done"
102
105
  )
103
106
  else:
104
- degraded = record["ok"] and any(
105
- part["component"] == "search" and part["status"] != "ok"
106
- for part in record["components"]
107
- )
108
107
  verdict, style = (
109
- (
110
- "core works; search degraded (external search unavailable for now), "
111
- "failure diagnostics kept",
112
- "yellow",
113
- )
114
- if degraded
115
- else ("whole stack works", "green")
108
+ ("whole stack works", "green")
116
109
  if record["ok"]
117
110
  else (
118
111
  "some components failed (see above); after fixing, rerun with the same "
@@ -138,7 +131,7 @@ def _planned_components(plan: StackPlan) -> list[str]:
138
131
 
139
132
  def _required_components(planned: list[str], options: object) -> list[str]:
140
133
  deferred = isinstance(options, dict) and options.get("defer_services") is True
141
- return [name for name in planned if not (deferred and name == "search")]
134
+ return [name for name in planned if not (deferred and name == SEARCH)]
142
135
 
143
136
 
144
137
  def required_components(plan: StackPlan) -> list[str]:
@@ -288,21 +281,21 @@ def _required(value: object) -> list[str] | None:
288
281
  return list(value)
289
282
 
290
283
 
291
- def search_failure_checks(component: str, record: FinishedRecord) -> list[Check] | None:
284
+ def search_unavailable(record: FinishedRecord) -> bool:
285
+ """A web search deployment's record whose verify failed only because no search engine
286
+ answered; nothing else about it failed."""
292
287
  steps = record["steps"]
293
- if record["ok"] or component != "search" or not steps or steps[-1]["step"] != "verify":
294
- return None
288
+ if record["ok"] or not steps or steps[-1]["step"] != "verify":
289
+ return False
295
290
  outcome = steps[-1]["result"]
296
- if (
291
+ return (
297
292
  not steps[-1]["ok"]
298
293
  and all(step["ok"] for step in steps[:-1])
299
294
  and outcome is not None
300
295
  and outcome["event"] == "error"
301
296
  and outcome.get("type") == "RuntimeError"
302
297
  and outcome.get("message") == SEARCH_UNAVAILABLE
303
- ):
304
- return [{"check": SEARCH_UNAVAILABLE, "ok": False, "detail": SEARCH_UNAVAILABLE}]
305
- return None
298
+ )
306
299
 
307
300
 
308
301
  def _complete(
@@ -316,7 +309,7 @@ def _complete(
316
309
  if part["component"] in required:
317
310
  if part["status"] != "ok":
318
311
  return False
319
- elif part["component"] != "search" or not (
312
+ elif part["component"] != SEARCH or not (
320
313
  part["status"] == "ok"
321
314
  or (
322
315
  part["status"] == "failed"
@@ -449,8 +442,6 @@ CAUSES = {
449
442
  # An apply that ran to the end with a component that did not pass (a run record exists).
450
443
  "STACK_COMPONENT_FAILED": "a component did not pass; failed_components names it, and stack "
451
444
  "status and stack doctor show why",
452
- SEARCH_UNAVAILABLE: "no free web search engine answered from this network; plan again "
453
- "without --search, or apply again later",
454
445
  }
455
446
 
456
447
 
@@ -465,12 +456,6 @@ def component_failure(record: StackRecord) -> tuple[list[str], tuple[str, str]]
465
456
  order = [name for name in parts if name in COMPONENTS]
466
457
  order += [name for name in planned if name not in parts]
467
458
  failed = [name for name in order if name not in parts or parts[name]["status"] != "ok"]
468
- first = parts.get(failed[0]) if failed else None
469
- checks = (first.get("checks") or []) if first is not None else []
470
- unanswered = [check for check in checks if isinstance(check, dict) and not check.get("ok")]
471
- if unanswered and all(check.get("detail") == SEARCH_UNAVAILABLE for check in unanswered):
472
- # web search's own verify, or acceptance whose only failure is the direct search check
473
- return failed, (SEARCH_UNAVAILABLE, CAUSES[SEARCH_UNAVAILABLE])
474
459
  return failed, ("STACK_COMPONENT_FAILED", CAUSES["STACK_COMPONENT_FAILED"])
475
460
 
476
461
 
@@ -576,7 +561,7 @@ def _required_from_saved_plan(plan: object, plan_id: str) -> list[str] | None:
576
561
  "rerank",
577
562
  "stt",
578
563
  "tts",
579
- "search",
564
+ SEARCH,
580
565
  ):
581
566
  return None
582
567
  result.append(contract)