@simplexai/localmodels-darwin-arm64 0.1.0-dev.50 → 0.1.0-dev.51
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.
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +31 -31
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/catalog.json +1988 -16
- package/modules/localmodels/deploy.py +29 -134
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.1.json +132 -0
- package/modules/localmodels/harness_probe.py +38 -22
- package/modules/localmodels/library_gateway.py +17 -1
- package/modules/localmodels/library_model.py +5 -0
- package/modules/localmodels/library_poly.py +1 -0
- package/modules/localmodels/library_status.py +96 -31
- package/modules/localmodels/plan_envelope.py +234 -3
- package/modules/localmodels/process_identity.py +19 -9
- package/modules/localmodels/process_identity_darwin.py +155 -0
- package/modules/localmodels/remote_ops_service.py +11 -13
- package/modules/localmodels/runtime_cli.py +8 -8
- package/modules/localmodels/runtime_install.py +25 -1
- package/modules/localmodels/stack_cli.py +39 -0
- package/modules/localmodels/stack_compose.py +12 -43
- package/modules/localmodels/stack_plan.py +55 -3
- package/modules/localmodels/stack_suite.py +51 -12
- package/modules/localmodels/{strata-poly-serve-0.1.45-poly.9.txt → strata-poly-serve-0.2.20-poly.1.txt} +2 -2
- package/modules/localmodels/strata_poly_server.py +19 -0
- package/modules/localmodels/suite.py +26 -1
- package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev51.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev51.dist-info}/RECORD +28 -28
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/localmodels/engines-strata-poly-0.1.45-poly.9.json +0 -75
- /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev51.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev51.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev51.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev50.dist-info → simplex_localmodels-0.1.0.dev51.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
380
|
-
|
|
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
|
|
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
|
+
}
|
|
@@ -13,7 +13,7 @@ import sys
|
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from typing import TYPE_CHECKING, TypedDict
|
|
15
15
|
|
|
16
|
-
from localmodels import hosts, runtime_discovery
|
|
16
|
+
from localmodels import hosts, process_identity_darwin, runtime_discovery
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
19
|
from localmodels import harness
|
|
@@ -64,16 +64,21 @@ def shown_pi_model(text: str) -> str | None:
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
def listener_uids(addr: str, tables: tuple[str, ...] | None = None) -> set[int]:
|
|
67
|
-
"""The users whose sockets listen on ``addr``
|
|
68
|
-
on Linux), lsof on macOS when no table
|
|
67
|
+
"""The users whose sockets listen on ``addr`` (matching its host and port, plus wildcard
|
|
68
|
+
listeners): the given TCP tables (/proc's by default on Linux), lsof on macOS when no table
|
|
69
|
+
is given."""
|
|
69
70
|
from localmodels.harness import HarnessError, run_tool
|
|
70
71
|
|
|
71
|
-
port =
|
|
72
|
+
host, port = process_identity_darwin.parse_host_port(addr)
|
|
72
73
|
uids: set[int] = set()
|
|
73
74
|
if tables is None and sys.platform == "win32":
|
|
74
75
|
from localmodels import process_identity
|
|
75
76
|
|
|
76
|
-
pids =
|
|
77
|
+
pids = (
|
|
78
|
+
process_identity.listener_pids(port)
|
|
79
|
+
if host == "127.0.0.1"
|
|
80
|
+
else process_identity.listener_pids(port, host=host)
|
|
81
|
+
)
|
|
77
82
|
if pids is None:
|
|
78
83
|
raise HarnessError("cannot confirm who owns the Windows gateway listener")
|
|
79
84
|
for pid in pids:
|
|
@@ -82,16 +87,17 @@ def listener_uids(addr: str, tables: tuple[str, ...] | None = None) -> set[int]:
|
|
|
82
87
|
return uids
|
|
83
88
|
if tables is None and sys.platform == "darwin":
|
|
84
89
|
out = run_tool(
|
|
85
|
-
["/usr/sbin/lsof", "-
|
|
90
|
+
["/usr/sbin/lsof", "-wnP", f"-iTCP:{port}", "-sTCP:LISTEN", "-Fpun"], timeout=10
|
|
86
91
|
)
|
|
87
|
-
|
|
92
|
+
parsed = process_identity_darwin.parse_lsof_listeners(out.stdout, port, host)
|
|
93
|
+
if out.returncode not in (0, 1) or parsed is None:
|
|
88
94
|
raise HarnessError("cannot confirm who owns the macOS gateway listener")
|
|
89
|
-
uids
|
|
90
|
-
if out.returncode == 0 and not
|
|
95
|
+
_, uids, _, saw_uid = parsed
|
|
96
|
+
if out.returncode == 0 and not saw_uid:
|
|
91
97
|
raise HarnessError("cannot confirm who owns the macOS gateway listener")
|
|
92
98
|
if not uids:
|
|
93
99
|
try:
|
|
94
|
-
with socket.create_connection((
|
|
100
|
+
with socket.create_connection((host, port), timeout=1):
|
|
95
101
|
raise HarnessError(
|
|
96
102
|
"the macOS gateway port is listening, but its owner cannot be confirmed"
|
|
97
103
|
)
|
|
@@ -106,7 +112,9 @@ def listener_uids(addr: str, tables: tuple[str, ...] | None = None) -> set[int]:
|
|
|
106
112
|
for row in rows: # sl local rem st tx:rx tr:when retrnsmt uid ...
|
|
107
113
|
f = row.split()
|
|
108
114
|
if len(f) > 7 and f[3] == "0A" and int(f[1].rpartition(":")[2], 16) == port:
|
|
109
|
-
|
|
115
|
+
bound = process_identity_darwin.parse_proc_net_addr(f[1].rpartition(":")[0])
|
|
116
|
+
if bound is None or process_identity_darwin.address_conflicts(bound, host):
|
|
117
|
+
uids.add(int(f[7]))
|
|
110
118
|
return uids
|
|
111
119
|
|
|
112
120
|
|
|
@@ -145,12 +153,12 @@ def loopback_listener_pids(port: int, proc: str = _PROC) -> set[int] | None:
|
|
|
145
153
|
from localmodels.harness import run_tool
|
|
146
154
|
|
|
147
155
|
out = run_tool(
|
|
148
|
-
["/usr/sbin/lsof", "-wnP", f"-iTCP:{port}", "-sTCP:LISTEN", "-
|
|
156
|
+
["/usr/sbin/lsof", "-wnP", f"-iTCP:{port}", "-sTCP:LISTEN", "-Fpn"], timeout=10
|
|
149
157
|
)
|
|
150
|
-
|
|
151
|
-
if out.returncode not in (0, 1) or
|
|
158
|
+
parsed = process_identity_darwin.parse_lsof_listeners(out.stdout, port, "127.0.0.1")
|
|
159
|
+
if out.returncode not in (0, 1) or parsed is None:
|
|
152
160
|
return None
|
|
153
|
-
return
|
|
161
|
+
return parsed[0]
|
|
154
162
|
if not sys.platform.startswith("linux"):
|
|
155
163
|
return None
|
|
156
164
|
from localmodels import remote_ops_service
|
|
@@ -163,10 +171,11 @@ def loopback_listener_pids(port: int, proc: str = _PROC) -> set[int] | None:
|
|
|
163
171
|
return _linux_socket_owner_pids(inodes, proc, uid=os.getuid())
|
|
164
172
|
|
|
165
173
|
|
|
166
|
-
def port_holder(port: int, proc: str = _PROC) -> str | None:
|
|
167
|
-
"""Who listens on ``port``, for a refusal the operator can act on:
|
|
168
|
-
user's own process, "a process of user uid N" for another user's, None
|
|
169
|
-
listener or cannot be read (Linux only; the caller then says
|
|
174
|
+
def port_holder(port: int, proc: str = _PROC, *, host: str = "127.0.0.1") -> str | None:
|
|
175
|
+
"""Who listens on ``port`` conflicting with ``host``, for a refusal the operator can act on:
|
|
176
|
+
"name (pid N)" for this user's own process, "a process of user uid N" for another user's, None
|
|
177
|
+
when /proc shows no matching listener or cannot be read (Linux only; the caller then says
|
|
178
|
+
nothing more)."""
|
|
170
179
|
inodes: dict[str, int] = {}
|
|
171
180
|
for table in ("net/tcp", "net/tcp6"):
|
|
172
181
|
try:
|
|
@@ -176,7 +185,9 @@ def port_holder(port: int, proc: str = _PROC) -> str | None:
|
|
|
176
185
|
for row in rows: # sl local rem st tx:rx tr:when retrnsmt uid timeout inode
|
|
177
186
|
f = row.split()
|
|
178
187
|
if len(f) > 9 and f[3] == "0A" and int(f[1].rpartition(":")[2], 16) == port:
|
|
179
|
-
|
|
188
|
+
bound = process_identity_darwin.parse_proc_net_addr(f[1].rpartition(":")[0])
|
|
189
|
+
if bound is None or process_identity_darwin.address_conflicts(bound, host):
|
|
190
|
+
inodes[f[9]] = int(f[7])
|
|
180
191
|
if not inodes:
|
|
181
192
|
return None
|
|
182
193
|
for pid in sorted(_linux_socket_owner_pids(set(inodes), proc)):
|
|
@@ -391,8 +402,13 @@ def loopback_listening(port: int) -> bool:
|
|
|
391
402
|
def bifrost_held(addr: str) -> str:
|
|
392
403
|
"""The refusal for a listener of this user's that the manifest does not own, naming it: a
|
|
393
404
|
bifrost-http is most often another HOME's or state directory's localmodels gateway."""
|
|
394
|
-
port = addr.rpartition(":")
|
|
395
|
-
|
|
405
|
+
host, _, port = addr.rpartition(":")
|
|
406
|
+
target = host.strip("[]") or "127.0.0.1"
|
|
407
|
+
held = (
|
|
408
|
+
(port_holder(int(port)) if target == "127.0.0.1" else port_holder(int(port), host=target))
|
|
409
|
+
if port.isdigit()
|
|
410
|
+
else None
|
|
411
|
+
)
|
|
396
412
|
other = (
|
|
397
413
|
"; it is not in this tool's owned manifest, so it is most likely the localmodels "
|
|
398
414
|
"gateway of another HOME or state directory"
|
|
@@ -257,6 +257,21 @@ def _pi_add(provider: str, entry: dict[str, Any], base: str) -> None:
|
|
|
257
257
|
_write(path, models)
|
|
258
258
|
|
|
259
259
|
|
|
260
|
+
def _marker_for_other_file(marker: Path, path: Path) -> bool:
|
|
261
|
+
"""Whether ``marker`` records ownership of a different existing ``models.json``."""
|
|
262
|
+
try:
|
|
263
|
+
recorded = marker.read_text(encoding="utf-8").strip()
|
|
264
|
+
except OSError:
|
|
265
|
+
return False
|
|
266
|
+
if not recorded:
|
|
267
|
+
return False
|
|
268
|
+
other = Path(recorded)
|
|
269
|
+
try:
|
|
270
|
+
return other.resolve() != path.resolve() and other.is_file()
|
|
271
|
+
except OSError:
|
|
272
|
+
return False
|
|
273
|
+
|
|
274
|
+
|
|
260
275
|
def _pi_drop(provider: str, model_id: str) -> None:
|
|
261
276
|
marker = _ours_marker(provider)
|
|
262
277
|
if not marker.is_file():
|
|
@@ -266,7 +281,8 @@ def _pi_drop(provider: str, model_id: str) -> None:
|
|
|
266
281
|
providers = models.get("providers")
|
|
267
282
|
current = providers.get(provider) if isinstance(providers, dict) else None
|
|
268
283
|
if not isinstance(providers, dict) or not isinstance(current, dict):
|
|
269
|
-
marker
|
|
284
|
+
if not _marker_for_other_file(marker, path):
|
|
285
|
+
marker.unlink(missing_ok=True)
|
|
270
286
|
return
|
|
271
287
|
kept = [m for m in current.get("models", []) if m.get("id") != model_id]
|
|
272
288
|
if kept:
|
|
@@ -15,6 +15,7 @@ STATUS_SCHEMA = "localmodels.library-status/v1"
|
|
|
15
15
|
EVENT_SCHEMA = "localmodels.library-event/v1"
|
|
16
16
|
|
|
17
17
|
ModelState = Literal["absent", "downloading", "idle", "loading", "loaded", "failed"]
|
|
18
|
+
Engine = Literal["llama.cpp", "polystrata", "strata"]
|
|
18
19
|
Fit = Literal["gpu", "unified", "system", "none"]
|
|
19
20
|
Phase = Literal["download", "verify", "load", "warm"]
|
|
20
21
|
MemoryPressure = Literal["normal", "warn", "critical"]
|
|
@@ -229,6 +230,10 @@ class Row(_Row, total=False):
|
|
|
229
230
|
license: str
|
|
230
231
|
source_url: str
|
|
231
232
|
prompt_tokens_per_second: float # the last load's measured prefill speed
|
|
233
|
+
engine: Engine # inference engine family serving this row
|
|
234
|
+
engine_label: str # engine, pinned build and backend for display
|
|
235
|
+
concurrency: int # maximum simultaneous requests served (slots / parallel)
|
|
236
|
+
host_ram_bytes: int # system RAM held beside VRAM by a hybrid discrete-GPU engine
|
|
232
237
|
fits_now: bool # live pool currently has enough free memory to load
|
|
233
238
|
load_need_bytes: int # pool-aligned memory needed to load when fits_now is False
|
|
234
239
|
load_free_bytes: int # pool-aligned free memory when fits_now is False
|
|
@@ -152,6 +152,7 @@ def as_entry(recipe: suite.SuiteRecipe) -> tuple[cat.CatalogEntry, cat.QuantVari
|
|
|
152
152
|
validated_on=tuple(recipe.get("validated_on") or ()),
|
|
153
153
|
reasoning_efforts=tuple(recipe.get("reasoning_efforts") or ()),
|
|
154
154
|
runtime="strata-poly",
|
|
155
|
+
engine=recipe.get("engine") or "",
|
|
155
156
|
family=recipe.get("family") or "",
|
|
156
157
|
publisher=recipe.get("publisher") or "",
|
|
157
158
|
parameters=recipe.get("parameters") or "",
|