@simplexai/localmodels-darwin-arm64 0.1.0-dev.44 → 0.1.0-dev.47

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 (86) hide show
  1. package/bootstrap.identity +1 -1
  2. package/bootstrap.sha256 +81 -83
  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 +165 -50
  11. package/modules/localmodels/catalog.py +20 -5
  12. package/modules/localmodels/catalog_recipes.py +9 -1
  13. package/modules/localmodels/context_policy.py +32 -9
  14. package/modules/localmodels/deploy.py +20 -14
  15. package/modules/localmodels/engines-b12588-mix-c0c3de8.json +98 -0
  16. package/modules/localmodels/engines-strata-poly-0.1.45-poly.9.json +41 -1
  17. package/modules/localmodels/engines.py +28 -2
  18. package/modules/localmodels/estimator.py +12 -3
  19. package/modules/localmodels/gateway.py +50 -15
  20. package/modules/localmodels/gateway_accept.py +8 -5
  21. package/modules/localmodels/gateway_bifrost.py +108 -34
  22. package/modules/localmodels/gateway_cli.py +5 -2
  23. package/modules/localmodels/gateway_requests.py +9 -2
  24. package/modules/localmodels/gguf.py +6 -2
  25. package/modules/localmodels/harness.py +38 -11
  26. package/modules/localmodels/harness_gateway.py +1 -1
  27. package/modules/localmodels/harness_probe.py +60 -13
  28. package/modules/localmodels/hosts.py +7 -20
  29. package/modules/localmodels/library_gateway.py +12 -9
  30. package/modules/localmodels/library_pricing.py +7 -9
  31. package/modules/localmodels/library_state.py +6 -4
  32. package/modules/localmodels/npm_transport.py +62 -54
  33. package/modules/localmodels/probe.py +38 -11
  34. package/modules/localmodels/process_identity.py +47 -33
  35. package/modules/localmodels/process_identity_linux.py +135 -0
  36. package/modules/localmodels/process_windows.py +150 -1
  37. package/modules/localmodels/recommend.py +1 -1
  38. package/modules/localmodels/recommend_cli.py +2 -2
  39. package/modules/localmodels/remote_ops.py +14 -6
  40. package/modules/localmodels/remote_ops_download.py +1 -1
  41. package/modules/localmodels/remote_ops_verify.py +0 -33
  42. package/modules/localmodels/runtime_install.py +2 -1
  43. package/modules/localmodels/runtime_io.py +149 -34
  44. package/modules/localmodels/runtime_windows_acl.py +100 -0
  45. package/modules/localmodels/service_probe.py +26 -20
  46. package/modules/localmodels/setup_inspection.py +132 -36
  47. package/modules/localmodels/setup_text.py +14 -0
  48. package/modules/localmodels/source_byok.py +6 -3
  49. package/modules/localmodels/source_cli.py +8 -1
  50. package/modules/localmodels/stack.py +1 -5
  51. package/modules/localmodels/stack_args.py +6 -8
  52. package/modules/localmodels/stack_binding.py +61 -3
  53. package/modules/localmodels/stack_compose.py +3 -8
  54. package/modules/localmodels/stack_events.py +2 -1
  55. package/modules/localmodels/stack_lifecycle.py +7 -4
  56. package/modules/localmodels/stack_plan.py +1 -4
  57. package/modules/localmodels/stack_ports.py +0 -1
  58. package/modules/localmodels/stack_run.py +15 -30
  59. package/modules/localmodels/stack_suite.py +23 -46
  60. package/modules/localmodels/stack_summary.py +0 -1
  61. package/modules/localmodels/stack_try.py +3 -92
  62. package/modules/localmodels/stack_up.py +7 -3
  63. package/modules/localmodels/stack_update.py +5 -5
  64. package/modules/localmodels/stack_view_apply.py +1 -1
  65. package/modules/localmodels/stack_view_llm.py +1 -1
  66. package/modules/localmodels/stack_view_sandbox.py +3 -3
  67. package/modules/localmodels/stack_view_text.py +0 -1
  68. package/modules/localmodels/stack_view_words.py +0 -1
  69. package/modules/localmodels/stack_warm.py +18 -7
  70. package/modules/localmodels/strata_poly_server.py +4 -2
  71. package/modules/localmodels/suite.py +4 -7
  72. package/modules/localmodels/transport.py +7 -1
  73. package/modules/localmodels/tui_dialogs.py +0 -1
  74. package/modules/localmodels/web/view/view.css +0 -3
  75. package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev47.dist-info}/METADATA +1 -1
  76. package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev47.dist-info}/RECORD +78 -80
  77. package/package.json +1 -1
  78. package/tool.json +1 -1
  79. package/modules/localmodels/bifrost_search.py +0 -66
  80. package/modules/localmodels/gateway_search.py +0 -223
  81. package/modules/localmodels/search-ddgs-9.16.1.txt +0 -222
  82. package/modules/localmodels/search_server.py +0 -474
  83. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev47.dist-info}/WHEEL +0 -0
  84. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev47.dist-info}/entry_points.txt +0 -0
  85. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev47.dist-info}/licenses/NOTICE +0 -0
  86. /package/modules/{simplex_localmodels-0.1.0.dev44.dist-info → simplex_localmodels-0.1.0.dev47.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import argparse
6
6
  import copy
7
7
  import json
8
+ import re
8
9
  import sys
9
10
  from pathlib import Path
10
11
  from typing import Any, Literal, TypedDict
@@ -24,6 +25,7 @@ from localmodels import (
24
25
  stack_review,
25
26
  )
26
27
  from localmodels.contracts import decode
28
+ from localmodels.engines import CudaDriverError
27
29
  from localmodels.estimator import AGENT_VRAM_RESERVE_BYTES
28
30
  from localmodels.plan_envelope import PlanError
29
31
  from localmodels.probe import HostFacts, Services
@@ -46,6 +48,10 @@ class _ReasonSince014(TypedDict, total=False):
46
48
  gpuIndex: int
47
49
  freeBytes: int
48
50
  requiredBytes: int
51
+ # On cuda-driver-update-required and cuda-driver-version-unknown: driver and CUDA versions.
52
+ detectedCudaVersion: str
53
+ requiredCudaVersion: str
54
+ driverVersion: str
49
55
 
50
56
 
51
57
  class Reason(_ReasonSince014):
@@ -94,10 +100,113 @@ class SetupReport(TypedDict):
94
100
  recommendation: str
95
101
 
96
102
 
103
+ _DRIVER_REASON_CODES = frozenset({"cuda-driver-update-required", "cuda-driver-version-unknown"})
104
+ _VERSION_RE = re.compile(r"^\d+(?:\.\d+){0,2}$")
105
+
106
+
97
107
  def _plan_reason(error: PlanError | StackError | harness.HarnessError) -> Reason:
98
108
  return {"code": "plan-unavailable", "message": str(error)}
99
109
 
100
110
 
111
+ def _cuda_driver_reason(error: CudaDriverError, lang: Lang) -> Reason:
112
+ detected = error.detected_cuda if _VERSION_RE.fullmatch(error.detected_cuda) else ""
113
+ required = error.required_cuda if _VERSION_RE.fullmatch(error.required_cuda) else ""
114
+ driver = error.driver_version if _VERSION_RE.fullmatch(error.driver_version) else ""
115
+ if detected:
116
+ reason: Reason = {
117
+ "code": "cuda-driver-update-required",
118
+ "message": text(
119
+ "cuda-driver-update-required",
120
+ lang,
121
+ detected=detected,
122
+ required=required or error.required_cuda,
123
+ ),
124
+ "detectedCudaVersion": detected,
125
+ }
126
+ else:
127
+ reason = {
128
+ "code": "cuda-driver-version-unknown",
129
+ "message": text(
130
+ "cuda-driver-version-unknown",
131
+ lang,
132
+ required=required or error.required_cuda,
133
+ ),
134
+ }
135
+ if required:
136
+ reason["requiredCudaVersion"] = required
137
+ if driver:
138
+ reason["driverVersion"] = driver
139
+ return reason
140
+
141
+
142
+ def _fits_with_required_cuda(options: StackOptions, facts: HostFacts, required_cuda: str) -> bool:
143
+ """Whether this computer's hardware fits a local stack once the NVIDIA driver supports
144
+ ``required_cuda`` (live or once other programs free memory)."""
145
+ upgraded = copy.deepcopy(facts)
146
+ upgraded["nvidia"] = {**(upgraded.get("nvidia") or {}), "cuda_version": required_cuda}
147
+ if _plans(options, upgraded):
148
+ return True
149
+ roomy = _capacity_facts(upgraded)
150
+ return roomy is not None and _plans(options, roomy)
151
+
152
+
153
+ def _driver_block(
154
+ error: PlanError | StackError | harness.HarnessError | None,
155
+ options: StackOptions,
156
+ facts: HostFacts,
157
+ lang: Lang,
158
+ ) -> StackAvailability | None:
159
+ if not isinstance(error, CudaDriverError):
160
+ return None
161
+ if not _fits_with_required_cuda(options, facts, error.required_cuda):
162
+ return None
163
+ return {
164
+ "available": False,
165
+ "reasons": [_cuda_driver_reason(error, lang)],
166
+ "plan": None,
167
+ }
168
+
169
+
170
+ def _capacity_availability(
171
+ options: StackOptions, facts: HostFacts, lang: Lang
172
+ ) -> StackAvailability | None:
173
+ roomy = _capacity_facts(facts)
174
+ if roomy is None:
175
+ return None
176
+ try:
177
+ plan = stack.build(options, facts=roomy)
178
+ except (PlanError, stack.StackError, harness.HarnessError) as roomy_exc:
179
+ if blocked := _driver_block(roomy_exc, options, roomy, lang):
180
+ return blocked
181
+ # The hardware itself is too small and the live refusal stands, unless only another
182
+ # inference app on a Mac's GPU stands in the way: that memory is not counted as freeable
183
+ # (roadmap decision 43), but the refusal names the app instead of blaming the hardware.
184
+ if alone := _fits_without_other_inference(options, roomy):
185
+ reason: Reason = {
186
+ "code": "plan-unavailable",
187
+ "message": text(
188
+ "inference-app-running",
189
+ lang,
190
+ apps="; ".join(metal.conflicts(facts)),
191
+ ),
192
+ }
193
+ return {
194
+ "available": False,
195
+ "reasons": [reason],
196
+ "plan": alone,
197
+ "basis": "capacity",
198
+ }
199
+ return None
200
+ # Roadmap decision 56: an install now prices the memory free now and would refuse, so the stack
201
+ # is not available; the plan shows what it needs.
202
+ return {
203
+ "available": False,
204
+ "reasons": _held_reasons(options, facts, roomy, plan, lang),
205
+ "plan": plan,
206
+ "basis": "capacity",
207
+ }
208
+
209
+
101
210
  def _stack(
102
211
  root: Path,
103
212
  facts: HostFacts,
@@ -132,6 +241,8 @@ def _stack(
132
241
  try:
133
242
  plan = stack.build(options, facts=facts)
134
243
  except (PlanError, stack.StackError, harness.HarnessError) as exc:
244
+ last_error: PlanError | StackError | harness.HarnessError | None = exc
245
+ last_options = options
135
246
  reason = _plan_reason(exc)
136
247
  # Consent decides by free VRAM whoever else uses a card (roadmap decision 60), so
137
248
  # only a Mac, whose sharing still needs every discovery section, skips the retry.
@@ -140,47 +251,23 @@ def _stack(
140
251
  and budget.holders(facts)
141
252
  and (not budget.unknown_services(facts) or not metal.supported(facts))
142
253
  ):
254
+ shared_options: StackOptions = {**options, "share_gpu": True}
143
255
  try:
144
- stack.build({**options, "share_gpu": True}, facts=facts)
256
+ stack.build(shared_options, facts=facts)
145
257
  except (PlanError, stack.StackError, harness.HarnessError) as shared_exc:
258
+ last_error, last_options = shared_exc, shared_options
146
259
  reason = _plan_reason(shared_exc)
147
260
  else:
261
+ last_error = None
148
262
  reason = {
149
263
  "code": "gpu-sharing-required",
150
264
  "message": text("gpu-sharing-required", lang),
151
265
  }
152
- if reason["code"] == "plan-unavailable" and (roomy := _capacity_facts(facts)):
153
- try:
154
- plan = stack.build(options, facts=roomy)
155
- except (PlanError, stack.StackError, harness.HarnessError):
156
- # The hardware itself is too small and the live refusal stands, unless only
157
- # another inference app on a Mac's GPU stands in the way: that memory is not
158
- # counted as freeable (roadmap decision 43), but the refusal names the app
159
- # instead of blaming the hardware.
160
- if alone := _fits_without_other_inference(options, roomy):
161
- reason = {
162
- "code": "plan-unavailable",
163
- "message": text(
164
- "inference-app-running",
165
- lang,
166
- apps="; ".join(metal.conflicts(facts)),
167
- ),
168
- }
169
- return {
170
- "available": False,
171
- "reasons": [reason],
172
- "plan": alone,
173
- "basis": "capacity",
174
- }
175
- else:
176
- # Roadmap decision 56: an install now prices the memory free now and would
177
- # refuse, so the stack is not available; the plan shows what it needs.
178
- return {
179
- "available": False,
180
- "reasons": _held_reasons(options, facts, roomy, plan, lang),
181
- "plan": plan,
182
- "basis": "capacity",
183
- }
266
+ if blocked := _driver_block(last_error, last_options, facts, lang):
267
+ return blocked
268
+ if reason["code"] == "plan-unavailable":
269
+ if capacity := _capacity_availability(options, facts, lang):
270
+ return capacity
184
271
 
185
272
  return {"available": plan is not None, "reasons": [reason] if reason else [], "plan": plan}
186
273
 
@@ -320,7 +407,11 @@ def _classify(availability: StackAvailability, facts: HostFacts) -> None:
320
407
  codes = {reason["code"] for reason in availability["reasons"]}
321
408
  if availability["available"]:
322
409
  availability["state"], availability["hardwareCapable"] = "ready", True
323
- elif availability.get("basis") == "capacity" or "gpu-sharing-required" in codes:
410
+ elif (
411
+ availability.get("basis") == "capacity"
412
+ or "gpu-sharing-required" in codes
413
+ or bool(codes & _DRIVER_REASON_CODES)
414
+ ):
324
415
  availability["state"], availability["hardwareCapable"] = "blocked-now", True
325
416
  else:
326
417
  availability["state"] = "unavailable"
@@ -433,8 +524,13 @@ INSPECT = (
433
524
  )
434
525
  INSPECT_REASONS = (
435
526
  "unsupported-platform · facts-unavailable · plan-unavailable · gpu-sharing-required\n"
436
- "(the last: a plan fits only beside other GPU work, its owner known or not; ask, then rerun "
437
- "with --share-gpu, which plans by the free VRAM)\n"
527
+ "cuda-driver-update-required · cuda-driver-version-unknown\n"
528
+ "(gpu-sharing-required: a plan fits only beside other GPU work, its owner known or not; ask, "
529
+ "then rerun with --share-gpu, which plans by the free VRAM)\n"
530
+ "cuda-driver-update-required / cuda-driver-version-unknown (stack.state is blocked-now, "
531
+ "hardwareCapable is true: the GPU can run local models, but the NVIDIA driver's CUDA version "
532
+ "is older than requiredCudaVersion or could not be read; detectedCudaVersion, "
533
+ "requiredCudaVersion and driverVersion carry the versions)\n"
438
534
  "gpu-memory-required (stack.state is blocked-now, stack.basis is capacity: other programs "
439
535
  "use the GPU memory the plan needs; close them and check again; gpuIndex, freeBytes and "
440
536
  "requiredBytes give the card and its free and needed VRAM)\n"
@@ -60,6 +60,20 @@ MESSAGES: dict[str, tuple[str, str]] = {
60
60
  "Mac's GPU and unified memory ({apps}). This tool does not count that memory as free; "
61
61
  "quit the app and check again.",
62
62
  ),
63
+ "cuda-driver-update-required": (
64
+ "这台电脑的显卡可以运行本地模型,但当前 NVIDIA 驱动支持的 CUDA 版本({detected})低于"
65
+ "本地模型引擎要求的最低版本(CUDA >= {required})。请更新 NVIDIA 驱动后重新检查。",
66
+ "This computer's GPU can run local models, but the installed NVIDIA driver supports "
67
+ "CUDA {detected}, older than the required CUDA {required} or newer. Update the NVIDIA "
68
+ "driver and check again.",
69
+ ),
70
+ "cuda-driver-version-unknown": (
71
+ "检测到 NVIDIA 显卡,但无法读取驱动支持的 CUDA 版本(需要 CUDA >= {required})。"
72
+ "请更新或重新安装 NVIDIA 驱动后重新检查。",
73
+ "An NVIDIA GPU was detected, but the driver's supported CUDA version could not be read "
74
+ "(requires CUDA {required} or newer). Update or reinstall the NVIDIA driver and check "
75
+ "again.",
76
+ ),
63
77
  "plan-invalid": (
64
78
  "批准计划不存在、无效或摘要不一致。",
65
79
  "The approved plan is missing or invalid, or its digest does not match.",
@@ -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"),
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import hashlib
6
6
  import json
7
7
  import os
8
+ import stat
8
9
  from pathlib import Path
9
10
  from typing import TypedDict, cast
10
11
 
@@ -13,6 +14,8 @@ from localmodels import stack_lifecycle as lifecycle
13
14
  from localmodels.setup_text import Lang, text
14
15
  from localmodels.stack_plan import StackPlan, deployments
15
16
 
17
+ _REPARSE_POINT = 0x400 # FILE_ATTRIBUTE_REPARSE_POINT: a symbolic link, junction or mount point
18
+
16
19
 
17
20
  class Reason(TypedDict):
18
21
  code: str
@@ -37,7 +40,62 @@ class BindingReport(TypedDict):
37
40
  reasons: list[Reason]
38
41
 
39
42
 
43
+ def _windows() -> bool:
44
+ return os.name == "nt"
45
+
46
+
47
+ def _reparse_point(info: os.stat_result) -> bool:
48
+ return bool(getattr(info, "st_file_attributes", 0) & _REPARSE_POINT)
49
+
50
+
51
+ def _windows_profile_file(path: Path) -> bytes | None:
52
+ """``path``'s bytes when it is a regular file owned by this user, or by Administrators while
53
+ this user is an administrator (an elevated install creates files that group owns); None when
54
+ it is missing. Its type, owner and bytes come from one handle on the file itself, so a link,
55
+ a junction or a replacement mid-check cannot pass one test and supply the other."""
56
+ from localmodels import gateway_home, runtime_windows_acl
57
+
58
+ try:
59
+ fd = runtime_windows_acl.open_unfollowed(path)
60
+ except FileNotFoundError:
61
+ return None
62
+ with open(fd, "rb") as source:
63
+ info = os.fstat(fd)
64
+ if not stat.S_ISREG(info.st_mode) or _reparse_point(info):
65
+ raise ValueError("Pi configuration unavailable")
66
+ owner = runtime_windows_acl.descriptor_owner_sid(fd)
67
+ if owner != runtime_windows_acl.identity()[4] and not (
68
+ owner == gateway_home.ADMINISTRATORS_SID and runtime_windows_acl.is_administrator()
69
+ ):
70
+ raise ValueError("Pi configuration unavailable")
71
+ return source.read()
72
+
73
+
74
+ def _windows_profile_fingerprint(executable: Path, profile: Path) -> str:
75
+ """The POSIX fingerprint, same bytes in the same order, with ownership proved by owner SID:
76
+ Windows has no ``os.getuid``."""
77
+ if (
78
+ not executable.is_file()
79
+ or not os.access(executable, os.X_OK)
80
+ or profile.is_symlink()
81
+ or _reparse_point(profile.lstat())
82
+ ):
83
+ raise ValueError("Pi configuration unavailable")
84
+ digest = hashlib.sha256(executable.read_bytes())
85
+ for name in ("settings.json", "models.json", "auth.json"):
86
+ body = _windows_profile_file(profile / name)
87
+ if body is None:
88
+ if name == "auth.json":
89
+ continue
90
+ raise ValueError("Pi configuration unavailable")
91
+ digest.update(name.encode())
92
+ digest.update(body)
93
+ return digest.hexdigest()
94
+
95
+
40
96
  def _profile_fingerprint(executable: Path, profile: Path) -> str:
97
+ if _windows():
98
+ return _windows_profile_fingerprint(executable, profile)
41
99
  if not hasattr(os, "getuid"):
42
100
  raise ValueError("Pi profile ownership inspection is unavailable on this platform")
43
101
  uid = os.getuid()
@@ -117,9 +175,9 @@ def _deployments_ready(
117
175
  required = stack_run.required_components(plan)
118
176
  for name, part in parts.items():
119
177
  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
178
+ part["endpoint"].get("contract") == stack_run.SEARCH
179
+ and stack_run.SEARCH not in required
180
+ and stack_run.search_unavailable(by_name[name])
123
181
  ):
124
182
  continue
125
183
  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",
@@ -23,6 +23,7 @@ from localmodels import (
23
23
  hosts,
24
24
  http_local,
25
25
  process_identity,
26
+ process_windows,
26
27
  remote_ops_launchd,
27
28
  stack_cleanup,
28
29
  stack_remove,
@@ -127,13 +128,15 @@ def deployment_pids(plan: Plan) -> list[int]:
127
128
  """Current process identities of this exact deployment, including its unit children. A
128
129
  nohup or launchd deployment is its recorded process and the group that process leads: the
129
130
  server a launcher (slot_cache.py) starts is the one on the card's process list. Who holds
130
- the port is still asked of the recorded process alone (_not_serving). A Windows service is
131
- one process with no launcher: its recorded pid, with no look at other processes."""
131
+ the port is still asked of the recorded process alone (_not_serving). On Windows a launcher
132
+ (strata_poly_server.py) may also spawn a child engine (strata-poly.exe), so the recorded
133
+ process and its verified same-user descendants are returned."""
132
134
  state, pid = _service(plan)
133
135
  if state != "active" or pid is None:
134
136
  return []
135
- systemd = sys.platform.startswith("linux") and plan["service"]["kind"] == "systemd-user"
136
- if systemd or sys.platform == "win32":
137
+ if sys.platform == "win32":
138
+ return process_windows.windows_tree_pids(pid)
139
+ if sys.platform.startswith("linux") and plan["service"]["kind"] == "systemd-user":
137
140
  return _service_pids(plan, pid)
138
141
  return group_pids(pid)
139
142
 
@@ -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