@simplexai/localmodels-linux-x64 0.1.0-dev.50 → 0.1.0-dev.52

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 (40) hide show
  1. package/bootstrap.identity +1 -1
  2. package/bootstrap.sha256 +38 -38
  3. package/modules/localmodels/__init__.py +1 -1
  4. package/modules/localmodels/catalog.json +1988 -16
  5. package/modules/localmodels/catalog_recipes.py +47 -8
  6. package/modules/localmodels/contracts.py +96 -37
  7. package/modules/localmodels/deploy.py +29 -134
  8. package/modules/localmodels/engines-strata-poly-0.2.20-poly.1.json +132 -0
  9. package/modules/localmodels/engines.py +18 -2
  10. package/modules/localmodels/gateway_bifrost.py +9 -0
  11. package/modules/localmodels/harness_probe.py +38 -22
  12. package/modules/localmodels/library_gateway.py +132 -1
  13. package/modules/localmodels/library_model.py +5 -0
  14. package/modules/localmodels/library_poly.py +59 -0
  15. package/modules/localmodels/library_status.py +96 -31
  16. package/modules/localmodels/plan_envelope.py +234 -3
  17. package/modules/localmodels/process_identity.py +19 -9
  18. package/modules/localmodels/process_identity_darwin.py +155 -0
  19. package/modules/localmodels/remote_ops_service.py +11 -13
  20. package/modules/localmodels/runtime_cli.py +8 -8
  21. package/modules/localmodels/runtime_install.py +25 -1
  22. package/modules/localmodels/source_cli.py +9 -1
  23. package/modules/localmodels/stack.py +0 -5
  24. package/modules/localmodels/stack_binding.py +6 -2
  25. package/modules/localmodels/stack_cli.py +39 -0
  26. package/modules/localmodels/stack_compose.py +12 -43
  27. package/modules/localmodels/stack_plan.py +58 -5
  28. package/modules/localmodels/stack_suite.py +51 -12
  29. package/modules/localmodels/{strata-poly-serve-0.1.45-poly.9.txt → strata-poly-serve-0.2.20-poly.1.txt} +2 -2
  30. package/modules/localmodels/strata_poly_server.py +19 -0
  31. package/modules/localmodels/suite.py +45 -8
  32. package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev52.dist-info}/METADATA +1 -1
  33. package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev52.dist-info}/RECORD +35 -35
  34. package/package.json +1 -1
  35. package/tool.json +1 -1
  36. package/modules/localmodels/engines-strata-poly-0.1.45-poly.9.json +0 -75
  37. /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev52.dist-info}/WHEEL +0 -0
  38. /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev52.dist-info}/entry_points.txt +0 -0
  39. /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev52.dist-info}/licenses/NOTICE +0 -0
  40. /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev52.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import base64
6
+ import copy
6
7
  import json
7
8
  import re
8
9
  from pathlib import Path
@@ -214,11 +215,38 @@ class DecisionRecipe(LlamaComponentRecipe, _DecisionOptional):
214
215
  cons: list[str]
215
216
 
216
217
 
218
+ _COMPONENTS_CACHE: dict[
219
+ Path,
220
+ tuple[
221
+ int,
222
+ int,
223
+ list[ComponentRecipe],
224
+ dict[str, list[LlamaComponentRecipe]],
225
+ list[DecisionRecipe] | None,
226
+ ],
227
+ ] = {}
228
+
229
+
230
+ def _components_entry() -> tuple[
231
+ list[ComponentRecipe], dict[str, list[LlamaComponentRecipe]], list[DecisionRecipe] | None
232
+ ]:
233
+ resolved = CATALOG_PATH.resolve()
234
+ stat = resolved.stat()
235
+ cached = _COMPONENTS_CACHE.get(resolved)
236
+ if cached is not None and cached[0] == stat.st_mtime_ns and cached[1] == stat.st_size:
237
+ return cached[2], cached[3], cached[4]
238
+ raw = json.loads(resolved.read_text(encoding="utf-8"))
239
+ all_components = decode(raw.get("components", []), list[ComponentRecipe])
240
+ by_task: dict[str, list[LlamaComponentRecipe]] = {}
241
+ _COMPONENTS_CACHE[resolved] = (stat.st_mtime_ns, stat.st_size, all_components, by_task, None)
242
+ return all_components, by_task, None
243
+
244
+
217
245
  def components() -> list[ComponentRecipe]:
218
246
  """Every task recipe in catalog order. Task recipes share the catalog, but never enter the
219
247
  GGUF recommender."""
220
- raw = json.loads(CATALOG_PATH.read_text(encoding="utf-8"))
221
- return decode(raw.get("components", []), list[ComponentRecipe])
248
+ all_components, _, _ = _components_entry()
249
+ return copy.deepcopy(all_components)
222
250
 
223
251
 
224
252
  def component_recipe(model_id: str) -> ComponentRecipe:
@@ -227,16 +255,27 @@ def component_recipe(model_id: str) -> ComponentRecipe:
227
255
 
228
256
  def llama_components(task: str) -> list[LlamaComponentRecipe]:
229
257
  """llama-server task components in catalog order (the first is the default)."""
230
- return [
231
- decode(recipe, LlamaComponentRecipe)
232
- for recipe in components()
233
- if recipe["task"] == task and recipe["runtime"] in ("llama.cpp-cpu", "llama.cpp")
234
- ]
258
+ all_components, by_task, _ = _components_entry()
259
+ found = by_task.get(task)
260
+ if found is None:
261
+ found = [
262
+ decode(recipe, LlamaComponentRecipe)
263
+ for recipe in all_components
264
+ if recipe["task"] == task and recipe["runtime"] in ("llama.cpp-cpu", "llama.cpp")
265
+ ]
266
+ by_task[task] = found
267
+ return copy.deepcopy(found)
235
268
 
236
269
 
237
270
  def decision_components() -> list[DecisionRecipe]:
238
271
  """Jev-like decision models in catalog order."""
239
- return [decode(recipe, DecisionRecipe) for recipe in llama_components("decision")]
272
+ resolved = CATALOG_PATH.resolve()
273
+ all_components, by_task, decisions = _components_entry()
274
+ if decisions is None:
275
+ decisions = [decode(recipe, DecisionRecipe) for recipe in llama_components("decision")]
276
+ cached = _COMPONENTS_CACHE[resolved]
277
+ _COMPONENTS_CACHE[resolved] = (cached[0], cached[1], all_components, by_task, decisions)
278
+ return copy.deepcopy(decisions)
240
279
 
241
280
 
242
281
  _REQUIRED_PROVENANCE = ("license", "license_url", "status", "tasks", "evidence")
@@ -4,9 +4,11 @@ from __future__ import annotations
4
4
 
5
5
  import functools
6
6
  import types
7
+ from collections.abc import Callable
7
8
  from typing import Any, TypeVar, Union, cast, get_args, get_origin, get_type_hints, is_typeddict
8
9
 
9
10
  T = TypeVar("T")
11
+ _Validator = Callable[[object, str], None]
10
12
 
11
13
 
12
14
  @functools.cache
@@ -18,57 +20,114 @@ def _record_fields(schema: Any) -> tuple[frozenset[str], tuple[tuple[str, object
18
20
  )
19
21
 
20
22
 
21
- def decode(value: object, schema: type[T]) -> T:
22
- """Reject malformed external data before it reaches typed application code.
23
+ def _validate_object(_value: object, _path: str) -> None:
24
+ return None
23
25
 
24
- Unknown object fields are retained for forward compatibility. Error messages
25
- contain field names and types, never values (facts may contain private data).
26
- """
27
- _validate(value, schema, "$")
28
- return cast(T, value)
29
26
 
27
+ def _validate_float(value: object, path: str) -> None:
28
+ kind = type(value)
29
+ if kind is not float and kind is not int:
30
+ raise ValueError(f"{path}: unexpected type")
30
31
 
31
- def _validate(value: object, schema: object, path: str) -> None:
32
- origin, args = get_origin(schema), get_args(schema)
33
- if schema is object:
34
- return
35
- if origin in (Union, types.UnionType):
36
- for option in args:
32
+
33
+ def _exact_validator(schema: type[object]) -> _Validator:
34
+ def check_exact(value: object, path: str) -> None:
35
+ if type(value) is not schema:
36
+ raise ValueError(f"{path}: unexpected type")
37
+
38
+ return check_exact
39
+
40
+
41
+ def _union_validator(args: tuple[object, ...]) -> _Validator:
42
+ options = tuple(_compile(option) for option in args)
43
+
44
+ def check_union(value: object, path: str) -> None:
45
+ for option in options:
37
46
  try:
38
- _validate(value, option, path)
47
+ option(value, path)
39
48
  return
40
49
  except ValueError:
41
50
  pass
42
51
  raise ValueError(f"{path}: unexpected type")
43
- if is_typeddict(schema):
44
- _validate_record(value, schema, path)
45
- return
46
- if origin is list:
52
+
53
+ return check_union
54
+
55
+
56
+ def _record_validator(schema: object) -> _Validator:
57
+ required, raw_fields = _record_fields(schema)
58
+ compiled_fields = tuple((key, _compile(field)) for key, field in raw_fields)
59
+
60
+ def check_record(value: object, path: str) -> None:
61
+ if not isinstance(value, dict):
62
+ raise ValueError(f"{path}: expected object")
63
+ for key, check_field in compiled_fields:
64
+ if key in value:
65
+ check_field(value[key], f"{path}.{key}")
66
+ elif key in required:
67
+ raise ValueError(f"{path}.{key}: missing field")
68
+
69
+ return check_record
70
+
71
+
72
+ def _list_validator(item_schema: object) -> _Validator:
73
+ check_item = _compile(item_schema)
74
+
75
+ def check_list(value: object, path: str) -> None:
47
76
  if not isinstance(value, list):
48
77
  raise ValueError(f"{path}: expected array")
78
+ item_path = f"{path}[]"
49
79
  for item in value:
50
- _validate(item, args[0], f"{path}[]")
51
- return
52
- if origin is dict:
80
+ check_item(item, item_path)
81
+
82
+ return check_list
83
+
84
+
85
+ def _dict_validator(key_schema: object, val_schema: object) -> _Validator:
86
+ check_key, check_val = _compile(key_schema), _compile(val_schema)
87
+
88
+ def check_dict(value: object, path: str) -> None:
53
89
  if not isinstance(value, dict):
54
90
  raise ValueError(f"{path}: expected object")
91
+ val_path = f"{path}.*"
55
92
  for key, item in value.items():
56
- _validate(key, args[0], path)
57
- _validate(item, args[1], f"{path}.*")
58
- return
59
- if isinstance(schema, type) and (
60
- type(value) is schema or schema is float and type(value) is int
61
- ):
62
- return
93
+ check_key(key, path)
94
+ check_val(item, val_path)
95
+
96
+ return check_dict
97
+
98
+
99
+ def _reject_value(_value: object, path: str) -> None:
63
100
  raise ValueError(f"{path}: unexpected type")
64
101
 
65
102
 
66
- def _validate_record(value: object, schema: object, path: str) -> None:
67
- if not isinstance(value, dict):
68
- raise ValueError(f"{path}: expected object")
69
- required, fields = _record_fields(schema)
70
- for key, field in fields:
71
- if key in value:
72
- _validate(value[key], field, f"{path}.{key}")
73
- elif key in required:
74
- raise ValueError(f"{path}.{key}: missing field")
103
+ @functools.cache
104
+ def _compile(schema: object) -> _Validator:
105
+ """Compile a reusable validator for ``schema`` so hot decodes skip typing introspection."""
106
+ if schema is object:
107
+ return _validate_object
108
+ if schema is float:
109
+ return _validate_float
110
+ if schema in (str, int, bool, type(None)):
111
+ return _exact_validator(cast(type[object], schema))
112
+ origin, args = get_origin(schema), get_args(schema)
113
+ if origin in (Union, types.UnionType):
114
+ return _union_validator(args)
115
+ if is_typeddict(schema):
116
+ return _record_validator(schema)
117
+ if origin is list:
118
+ return _list_validator(args[0])
119
+ if origin is dict:
120
+ return _dict_validator(args[0], args[1])
121
+ if isinstance(schema, type):
122
+ return _exact_validator(schema)
123
+ return _reject_value
124
+
125
+
126
+ def decode(value: object, schema: type[T]) -> T:
127
+ """Reject malformed external data before it reaches typed application code.
128
+
129
+ Unknown object fields are retained for forward compatibility. Error messages
130
+ contain field names and types, never values (facts may contain private data).
131
+ """
132
+ _compile(cast(Any, schema))(value, "$")
133
+ return cast(T, value)
@@ -9,15 +9,20 @@ from __future__ import annotations
9
9
  import json
10
10
  import os
11
11
  import secrets
12
- import urllib.error
13
- import urllib.parse
14
- import urllib.request
15
12
  from collections.abc import Callable
16
13
  from dataclasses import dataclass
17
- from typing import TypedDict
18
14
 
19
15
  from localmodels import catalog as cat
20
- from localmodels import chat_template, hf_repo, hosts, metal, region, stack_debug, vision
16
+ from localmodels import (
17
+ chat_template,
18
+ hf_repo,
19
+ hosts,
20
+ metal,
21
+ plan_envelope,
22
+ region,
23
+ stack_debug,
24
+ vision,
25
+ )
21
26
  from localmodels.budget import (
22
27
  Placement,
23
28
  agent_budget,
@@ -50,14 +55,16 @@ from localmodels.engines import (
50
55
  )
51
56
  from localmodels.estimator import PhysicsRefusal, as_loaded, eager
52
57
  from localmodels.plan_envelope import (
58
+ HubUnreachableError,
53
59
  PlanError,
60
+ catalog_pins,
54
61
  deployment,
55
62
  hub_url,
56
- plan_envelope,
57
63
  require_disk,
58
64
  require_free_port,
59
65
  utc_now,
60
66
  )
67
+ from localmodels.plan_envelope import plan_envelope as build_plan_envelope
61
68
  from localmodels.probe import HostFacts
62
69
  from localmodels.records import (
63
70
  FinishedRecord,
@@ -105,7 +112,8 @@ class GpuConflictError(PlanError):
105
112
  super().__init__(
106
113
  f"{placement.label} runs services this tool does not own "
107
114
  f"({', '.join(placement.conflicts)}); to share it, pass --placement "
108
- f"{placement.id} and consent to sharing before apply"
115
+ f"{placement.id} and consent to sharing before apply",
116
+ cause_code="GPU_CONFLICT",
109
117
  )
110
118
 
111
119
 
@@ -129,144 +137,25 @@ class AgentMemoryError(PlanError):
129
137
  """The agent planner's refusal, with the same capacity figures used to admit a model."""
130
138
 
131
139
  def __init__(self, message: str, refused: PhysicsRefusal, memory: str) -> None:
132
- super().__init__(message)
140
+ super().__init__(message, cause_code="MEMORY_INSUFFICIENT")
133
141
  self.needed_bytes = refused.needed_bytes
134
142
  self.available_bytes = refused.available_bytes
135
143
  self.memory = memory
136
144
 
137
145
 
138
146
  def _hf_get(url: str) -> object:
139
- """One Hub API document. A Hub that cannot be reached is a refusal that says how to go on:
140
- home networks often reach a mirror but not huggingface.co (the Mac mini, 2026-11-12)."""
141
- req = urllib.request.Request(url, headers={"User-Agent": "localmodels-plan"})
142
- try:
143
- with urllib.request.urlopen(req, timeout=20) as r:
144
- return json.load(r)
145
- except urllib.error.HTTPError:
146
- raise # the Hub answered: a missing repo or revision is the caller's to report
147
- except OSError as exc: # URLError and timeouts
148
- host = urllib.parse.urlsplit(url).netloc
149
- raise PlanError(
150
- f"cannot reach {host} to look up the model files ({getattr(exc, 'reason', exc)}); "
151
- "name a reachable Hub with --hf-endpoint URL or HF_ENDPOINT (a mirror such as "
152
- "https://hf-mirror.com), or plan from the catalog's pins with --offline"
153
- ) from exc
147
+ return plan_envelope.hf_get(url)
154
148
 
155
149
 
156
150
  def hub_get(api: str, path: str, *, mint: bool = False) -> object:
157
- """One Hub API document. A lookup checked against a catalog pin asks the Hubs
158
- region.hub_endpoints orders (in cn hf-mirror.com first) and moves to the other when one
159
- cannot be reached, switching the region. A lookup that ``mint``s a SHA256 pin asks ``api``
160
- alone: the default Hugging Face or the user's own Hub, never the mirror. A Hub that
161
- answered (an HTTP error) is final."""
162
- endpoints = [api.rstrip("/")] if mint else region.hub_endpoints(api)
163
- for index, endpoint in enumerate(endpoints):
164
- try:
165
- doc = _hf_get(endpoint + path)
166
- except PlanError as exc:
167
- if index + 1 < len(endpoints):
168
- continue
169
- if mint and not region.explicit_hub(api):
170
- what = path.split("/api/models/")[-1]
171
- raise PlanError(region.MINT_REFUSAL.format(what=what)) from exc
172
- raise
173
- if index:
174
- region.fallback_to(region.side_of_endpoint(endpoint))
175
- return doc
176
- raise AssertionError("unreachable Hub loop")
177
-
178
-
179
- class Revision(TypedDict):
180
- sha: str
181
-
182
-
183
- class LfsFile(TypedDict):
184
- size: int
185
- oid: str
186
-
187
-
188
- class TreeEntry(TypedDict):
189
- path: str
190
-
191
-
192
- class OptionalTreeEntry(TreeEntry, total=False):
193
- lfs: LfsFile
151
+ return plan_envelope.hub_get(api, path, mint=mint, fetch=_hf_get)
194
152
 
195
153
 
196
154
  def resolve_files(assets: list[tuple[str, cat.AssetFile]], api: str) -> list[PinnedFile]:
197
- """Pin each asset to a commit and its LFS SHA256 via the Hub API. The catalog records sizes,
198
- and digests only for files it pins; a file whose size disagrees with the catalog is refused
199
- (the pricing would lie), and so is one whose content differs from its catalog pin."""
200
- revisions: dict[tuple[str, str, bool], str] = {}
201
- trees: dict[tuple[str, str, str, bool], dict[str, OptionalTreeEntry]] = {}
202
- pinned: list[PinnedFile] = []
203
- for repo, asset in assets:
204
- mint = asset.sha256 is None # the Hub's answer becomes the pin: trusted Hub only
205
- key = (repo, asset.revision, mint)
206
- if key not in revisions:
207
- doc = decode(
208
- hub_get(
209
- api,
210
- f"/api/models/{repo}/revision/{urllib.parse.quote(asset.revision)}",
211
- mint=mint,
212
- ),
213
- Revision,
214
- )
215
- revisions[key] = doc["sha"]
216
- commit = revisions[key]
217
- directory = asset.path.rsplit("/", 1)[0] if "/" in asset.path else ""
218
- tkey = (repo, commit, directory, mint)
219
- if tkey not in trees:
220
- path = f"/api/models/{repo}/tree/{commit}" + (
221
- f"/{urllib.parse.quote(directory)}" if directory else ""
222
- )
223
- entries = hub_get(api, path, mint=mint)
224
- if not isinstance(entries, list):
225
- raise PlanError("Hub tree must be an array")
226
- parsed = [decode(e, OptionalTreeEntry) for e in entries]
227
- trees[tkey] = {e["path"]: e for e in parsed}
228
- entry = trees[tkey].get(asset.path)
229
- if entry is None or not entry.get("lfs"):
230
- raise PlanError(f"{asset.path} not found in {repo}@{commit[:12]}")
231
- if int(entry["lfs"]["size"]) != asset.size_bytes:
232
- raise PlanError(
233
- f"{asset.path} size {entry['lfs']['size']} != catalog size {asset.size_bytes}"
234
- )
235
- if asset.sha256 is not None and entry["lfs"]["oid"] != asset.sha256:
236
- raise PlanError(f"{asset.path} on the Hub has a SHA256 the catalog does not pin")
237
- pinned.append(
238
- {
239
- "repo": repo,
240
- "path": asset.path,
241
- "revision": commit,
242
- "size_bytes": asset.size_bytes,
243
- "sha256": entry["lfs"]["oid"],
244
- "local_name": asset.local_name,
245
- }
246
- )
247
- return pinned
155
+ return plan_envelope.resolve_files(assets, api, fetch_hub=hub_get)
248
156
 
249
157
 
250
- def catalog_pins(assets: list[tuple[str, cat.AssetFile]], _api: str) -> list[PinnedFile]:
251
- """Each asset at the commit and SHA256 the catalog pins, asking the Hub nothing: the resolver
252
- for a plan made offline. A file the catalog does not pin is refused, never guessed."""
253
- pinned: list[PinnedFile] = []
254
- for repo, asset in assets:
255
- if asset.sha256 is None:
256
- raise PlanError(
257
- f"catalog pins no commit and SHA256 for {repo}/{asset.path}; cannot plan it offline"
258
- )
259
- pinned.append(
260
- {
261
- "repo": repo,
262
- "path": asset.path,
263
- "revision": asset.revision,
264
- "size_bytes": asset.size_bytes,
265
- "sha256": asset.sha256,
266
- "local_name": asset.local_name,
267
- }
268
- )
269
- return pinned
158
+ __all__ = ["HubUnreachableError", "catalog_pins"]
270
159
 
271
160
 
272
161
  def _choose_agent_placement(
@@ -376,8 +265,14 @@ def _choose_placement(
376
265
  fallbacks.append((now.decision.spill_bytes, placement, now))
377
266
  if not fallbacks:
378
267
  if capacity and all(p.backend == "cpu" for p in capacity):
379
- raise PlanError(f"{entry.display_name} exceeds free system memory (CPU deployment)")
380
- raise PlanError(f"{entry.display_name} exceeds free GPU memory and system memory")
268
+ raise PlanError(
269
+ f"{entry.display_name} exceeds free system memory (CPU deployment)",
270
+ cause_code="MEMORY_INSUFFICIENT",
271
+ )
272
+ raise PlanError(
273
+ f"{entry.display_name} exceeds free GPU memory and system memory",
274
+ cause_code="MEMORY_INSUFFICIENT",
275
+ )
381
276
  _, placement, now = min(fallbacks, key=lambda t: t[0])
382
277
  return placement, now
383
278
 
@@ -520,7 +415,7 @@ def build_plan(
520
415
  agent_posture=options.agent is not None and facts["platform"] != "win32",
521
416
  )
522
417
 
523
- return plan_envelope(
418
+ return build_plan_envelope(
524
419
  host_id,
525
420
  facts,
526
421
  where,
@@ -0,0 +1,132 @@
1
+ {
2
+ "schema": "localmodels.engine-lock/v1",
3
+ "tag": "strata-poly-0.2.20-poly.1",
4
+ "commit": "v0.2.20-poly.1",
5
+ "source": "https://github.com/simplexai-labs/PolyStrata/releases/tag/v0.2.20-poly.1",
6
+ "note": "PolyStrata 0.2.20-poly.1 (MIT, commit fdd8f0de, strata-poly engine 0.1.66), every build from its release page. Linux: strata-poly and strata-vision built from the release commit with NVIDIA's CUDA 13.0.3 toolkit (nvcc 13.0.88) and gcc 12.3 on Ubuntu 22.04, -DSTRATA_PORTABLE=ON (AVX2 CPU baseline), CUDA architectures 75, 80, 86, 89 and 120 (RTX 20, 30, 40 and 50 series); it loads the CUDA 13.0.3 runtime libraries (libcublas, libcublasLt, libcudart) of the archive already pinned for 0.1.45-poly.9, under NVIDIA's licence, and needs an NVIDIA driver for CUDA 13.0 (580 or newer), glibc 2.34 and libstdc++ 12 (Ubuntu 22.04, Debian 12 or newer). Windows: the same two programs for CUDA 13.0 and the same architectures; NVIDIA's cuBLAS 13.0.2.14 wheel (the version upstream's setup.py installs on Windows) supplies cublas64_13.dll under nvidia/cu13/bin/x86_64, the directory the recipes' lib_dirs put on the engine's PATH. macOS: arm64 Metal, macOS 15 or newer, with the Metal kernel sources the engine compiles when it starts (metal/). On all three the tag archive supplies PolyStrata's Python server and tokenizer tool, which have been under terminal/ since 0.2.19-poly.1: only terminal/serve/, terminal/tools/, terminal/strata_control/, terminal/strata_cli/ and LICENSE are unpacked. All archives of a build unpack into one directory. The engine no longer links ggml or llama.cpp. These recipes do not use the picture reader.",
7
+ "builds": [
8
+ {
9
+ "platform": "linux",
10
+ "arch": "x64",
11
+ "backend": "cuda",
12
+ "min_cuda": "13.0",
13
+ "min_glibc": "2.34",
14
+ "binary": "strata-poly",
15
+ "assets": [
16
+ {
17
+ "name": "strata-poly-linux-x64-cuda13-e668ba48c1712c06.tar.gz",
18
+ "url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.2.20-poly.1/strata-poly-linux-x64-cuda13-e668ba48c1712c06.tar.gz",
19
+ "sha256": "dc15bc9f518c7d4bb3eae465913a121baa82d02fcce5b41905f1eedd0a4a7848",
20
+ "size_bytes": 76570403,
21
+ "npm_copy": {
22
+ "package": "@simplexai/engine-strata-poly-linux-x64-cuda13-e668ba48c1712c06",
23
+ "version": "0.0.0-sha256-dc15bc9f518c7d4b"
24
+ }
25
+ },
26
+ {
27
+ "name": "polystrata-0.2.20-poly.1-source.tar.gz",
28
+ "url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.2.20-poly.1.tar.gz",
29
+ "sha256": "4efe2544631a65a07f68959dad652e8195b88f1f2edfa0c7e3c2ffd226c51628",
30
+ "size_bytes": 50152248,
31
+ "members": [
32
+ "terminal/serve/",
33
+ "terminal/tools/",
34
+ "terminal/strata_control/",
35
+ "terminal/strata_cli/",
36
+ "terminal/data/expert-profile-glm.txt",
37
+ "LICENSE"
38
+ ],
39
+ "npm_copy": {
40
+ "package": "@simplexai/engine-polystrata-0.2.20-poly.1-source",
41
+ "version": "0.0.0-sha256-4efe2544631a65a0"
42
+ }
43
+ },
44
+ {
45
+ "name": "cudart-strata-poly-linux-x64-cuda13.0.3.tar.gz",
46
+ "url": "https://d2ikbbcl3j6jz9.cloudfront.net/cli/localmodels/engines/strata-poly/0.1.45-poly.9/cudart-strata-poly-linux-x64-cuda13.0.3.tar.gz",
47
+ "sha256": "189c3a9fb5fd5f87331ffcedf03d5469c2a9c91f46379299ee6ea277364f05d2",
48
+ "size_bytes": 422462968
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "platform": "darwin",
54
+ "arch": "arm64",
55
+ "backend": "metal",
56
+ "binary": "strata-poly",
57
+ "assets": [
58
+ {
59
+ "name": "strata-poly-macos-arm64-e668ba48c1712c06.tar.gz",
60
+ "url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.2.20-poly.1/strata-poly-macos-arm64-e668ba48c1712c06.tar.gz",
61
+ "sha256": "050c44da7676938adf3904cdf44e92a559fab1d52886499e1a2dd02836da84d1",
62
+ "size_bytes": 1136875,
63
+ "npm_copy": {
64
+ "package": "@simplexai/engine-strata-poly-macos-arm64-e668ba48c1712c06",
65
+ "version": "0.0.0-sha256-050c44da7676938a"
66
+ }
67
+ },
68
+ {
69
+ "name": "polystrata-0.2.20-poly.1-source.tar.gz",
70
+ "url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.2.20-poly.1.tar.gz",
71
+ "sha256": "4efe2544631a65a07f68959dad652e8195b88f1f2edfa0c7e3c2ffd226c51628",
72
+ "size_bytes": 50152248,
73
+ "members": [
74
+ "terminal/serve/",
75
+ "terminal/tools/",
76
+ "terminal/strata_control/",
77
+ "terminal/strata_cli/",
78
+ "terminal/data/expert-profile-glm.txt",
79
+ "LICENSE"
80
+ ],
81
+ "npm_copy": {
82
+ "package": "@simplexai/engine-polystrata-0.2.20-poly.1-source",
83
+ "version": "0.0.0-sha256-4efe2544631a65a0"
84
+ }
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "platform": "win32",
90
+ "arch": "x64",
91
+ "backend": "cuda",
92
+ "min_cuda": "13.0",
93
+ "binary": "strata-poly.exe",
94
+ "assets": [
95
+ {
96
+ "name": "strata-poly-windows-x64-ea81920b1df9eb4a.zip",
97
+ "url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.2.20-poly.1/strata-poly-windows-x64-ea81920b1df9eb4a.zip",
98
+ "sha256": "a615b0aac5a3182abf6e95a677a88c05fc81aeefb1edf71ac38c519aa046d575",
99
+ "size_bytes": 76744416,
100
+ "npm_copy": {
101
+ "package": "@simplexai/engine-strata-poly-windows-x64-ea81920b1df9eb4a",
102
+ "version": "0.0.0-sha256-a615b0aac5a3182a"
103
+ }
104
+ },
105
+ {
106
+ "name": "polystrata-0.2.20-poly.1-source.tar.gz",
107
+ "url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.2.20-poly.1.tar.gz",
108
+ "sha256": "4efe2544631a65a07f68959dad652e8195b88f1f2edfa0c7e3c2ffd226c51628",
109
+ "size_bytes": 50152248,
110
+ "members": [
111
+ "terminal/serve/",
112
+ "terminal/tools/",
113
+ "terminal/strata_control/",
114
+ "terminal/strata_cli/",
115
+ "terminal/data/expert-profile-glm.txt",
116
+ "LICENSE"
117
+ ],
118
+ "npm_copy": {
119
+ "package": "@simplexai/engine-polystrata-0.2.20-poly.1-source",
120
+ "version": "0.0.0-sha256-4efe2544631a65a0"
121
+ }
122
+ },
123
+ {
124
+ "name": "nvidia_cublas-13.0.2.14-py3-none-win_amd64.whl",
125
+ "url": "https://files.pythonhosted.org/packages/f3/91/bda39230b7a4c102bb724c21b50823efc63544490a885fea0b604911c0ab/nvidia_cublas-13.0.2.14-py3-none-win_amd64.whl",
126
+ "sha256": "5f7a90456b1392db60e28719547ba6e00696bfa81304b6887cf287f9edf2c1d7",
127
+ "size_bytes": 401887280
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ }
@@ -11,6 +11,7 @@ supports every option the plan uses. ``build_number`` (catalog.py) is the one pa
11
11
 
12
12
  from __future__ import annotations
13
13
 
14
+ import copy
14
15
  import json
15
16
  import os
16
17
  import re
@@ -77,12 +78,26 @@ def engine_lock_path(tag: str | None = None) -> Path:
77
78
  return ENGINE_LOCK if tag is None else ENGINE_LOCK.with_name(f"engines-{tag}.json")
78
79
 
79
80
 
81
+ _ENGINE_LOCK_CACHE: dict[Path, tuple[int, int, EngineLock]] = {}
82
+
83
+
84
+ def _load_engine_lock(lock_path: Path) -> EngineLock:
85
+ resolved = lock_path.resolve()
86
+ stat = resolved.stat()
87
+ cached = _ENGINE_LOCK_CACHE.get(resolved)
88
+ if cached is not None and cached[0] == stat.st_mtime_ns and cached[1] == stat.st_size:
89
+ return cached[2]
90
+ lock = decode(json.loads(resolved.read_text(encoding="utf-8")), EngineLock)
91
+ _ENGINE_LOCK_CACHE[resolved] = (stat.st_mtime_ns, stat.st_size, lock)
92
+ return lock
93
+
94
+
80
95
  def select_engine_build(
81
96
  facts: HostFacts, backend: str, lock_path: Path = ENGINE_LOCK
82
97
  ) -> SelectedBuild:
83
98
  """The pinned build for the host: newest CUDA build the driver supports, and among those
84
99
  the one needing the newest glibc the host has (upstream's own archive before a rebuild)."""
85
- lock = decode(json.loads(lock_path.read_text(encoding="utf-8")), EngineLock)
100
+ lock = _load_engine_lock(lock_path)
86
101
  platform = (
87
102
  "darwin"
88
103
  if facts.get("platform") == "darwin"
@@ -167,7 +182,8 @@ def select_engine_build(
167
182
  raise PlanError(
168
183
  f"no {lock['tag']} prebuilt engine for {platform}/{facts.get('arch')}/{backend}"
169
184
  )
170
- return {"tag": lock["tag"], "commit": lock["commit"], **builds[0]}
185
+ selected: SelectedBuild = {"tag": lock["tag"], "commit": lock["commit"], **builds[0]}
186
+ return copy.deepcopy(selected)
171
187
 
172
188
 
173
189
  def host_engine(