@simplexai/localmodels-darwin-x64 0.1.0-dev.60 → 0.1.0-dev.61
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 +73 -60
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +5 -3
- package/modules/localmodels/auth_proxy.py +185 -19
- package/modules/localmodels/catalog.json +363 -0
- package/modules/localmodels/catalog.py +1 -1
- package/modules/localmodels/catalog_add.py +5 -5
- package/modules/localmodels/catalog_license.py +2 -0
- package/modules/localmodels/catalog_recipes.py +2 -0
- package/modules/localmodels/cli_parser.py +6 -2
- package/modules/localmodels/context_policy.py +40 -4
- package/modules/localmodels/debug_mode.py +13 -0
- package/modules/localmodels/debug_stub_server.py +156 -1
- package/modules/localmodels/deploy.py +11 -2
- package/modules/localmodels/download-mirrors.json +12 -0
- package/modules/localmodels/engines-b12757-mix-ef2df21.json +26 -0
- package/modules/localmodels/engines-whisper-b5454.json +120 -1
- package/modules/localmodels/gateway_app_bifrost.py +14 -14
- package/modules/localmodels/gateway_bifrost.py +4 -1
- package/modules/localmodels/gateway_cli.py +14 -80
- package/modules/localmodels/gateway_server.py +88 -16
- package/modules/localmodels/gpu_specs.py +35 -1
- package/modules/localmodels/harness.py +1 -2
- package/modules/localmodels/hf_repo.py +12 -4
- package/modules/localmodels/install.py +4 -4
- package/modules/localmodels/library_serve.py +69 -13
- package/modules/localmodels/npm_transport.py +4 -58
- package/modules/localmodels/recommend_cli.py +2 -1
- package/modules/localmodels/remote_ops.py +120 -713
- package/modules/localmodels/remote_ops_common.py +729 -0
- package/modules/localmodels/remote_ops_download.py +397 -381
- package/modules/localmodels/remote_ops_mirrors.py +26 -65
- package/modules/localmodels/remote_ops_prepare.py +43 -35
- package/modules/localmodels/remote_ops_ranges.py +98 -62
- package/modules/localmodels/remote_ops_remove.py +30 -22
- package/modules/localmodels/remote_ops_service.py +102 -95
- package/modules/localmodels/remote_ops_verify.py +94 -63
- package/modules/localmodels/runtime_cli.py +15 -5
- package/modules/localmodels/runtime_io.py +54 -1
- package/modules/localmodels/speech-sv.txt +93 -0
- package/modules/localmodels/speech_admission.py +437 -0
- package/modules/localmodels/speech_catalog.py +170 -0
- package/modules/localmodels/speech_cli.py +273 -0
- package/modules/localmodels/speech_jobs.py +772 -0
- package/modules/localmodels/speech_model.py +404 -0
- package/modules/localmodels/speech_serve.py +287 -0
- package/modules/localmodels/speech_server.py +837 -0
- package/modules/localmodels/speech_state.py +697 -0
- package/modules/localmodels/speech_worker_sensevoice.py +255 -0
- package/modules/localmodels/speech_workers.py +783 -0
- package/modules/localmodels/stack.py +0 -33
- package/modules/localmodels/stack_auto.py +5 -3
- package/modules/localmodels/stack_aux_gpu.py +45 -4
- package/modules/localmodels/stack_capacity.py +77 -8
- package/modules/localmodels/stack_cli.py +16 -1
- package/modules/localmodels/stack_compose.py +1 -1
- package/modules/localmodels/stack_down.py +24 -1
- package/modules/localmodels/stack_hardware.py +57 -88
- package/modules/localmodels/stack_hardware_text.py +4 -59
- package/modules/localmodels/stack_memory.py +13 -3
- package/modules/localmodels/stack_suite.py +9 -10
- package/modules/localmodels/stack_summary.py +4 -4
- package/modules/localmodels/stack_view_llm.py +1 -1
- package/modules/localmodels/transport.py +3 -2
- package/modules/localmodels/tui_views.py +2 -2
- package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/RECORD +70 -57
- package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/licenses/NOTICE +9 -0
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -6,14 +6,13 @@ import hashlib
|
|
|
6
6
|
import http.client
|
|
7
7
|
import os
|
|
8
8
|
import queue
|
|
9
|
-
import re
|
|
10
9
|
import sys
|
|
11
10
|
import tarfile
|
|
12
11
|
import threading
|
|
13
12
|
import time
|
|
14
13
|
import urllib.error
|
|
15
14
|
import urllib.request
|
|
16
|
-
from collections.abc import
|
|
15
|
+
from collections.abc import Mapping
|
|
17
16
|
from pathlib import Path
|
|
18
17
|
from typing import Any, TypedDict
|
|
19
18
|
from urllib.parse import urljoin, urlsplit
|
|
@@ -36,7 +35,7 @@ class UnsafeRedirect(urllib.error.URLError):
|
|
|
36
35
|
"""A URL or redirect target without HTTPS, or with credentials, that is never contacted."""
|
|
37
36
|
|
|
38
37
|
|
|
39
|
-
def
|
|
38
|
+
def check_url(url: str, *, redirect: bool = False) -> str:
|
|
40
39
|
try:
|
|
41
40
|
parts = urlsplit(url)
|
|
42
41
|
_ = parts.port
|
|
@@ -67,7 +66,7 @@ def _redirect_target(url: str, location: str, hops: int) -> str:
|
|
|
67
66
|
target = urljoin(url, location)
|
|
68
67
|
except ValueError as error:
|
|
69
68
|
raise UnsafeRedirect("invalid npm redirect URL") from error
|
|
70
|
-
return
|
|
69
|
+
return check_url(target, redirect=True)
|
|
71
70
|
|
|
72
71
|
|
|
73
72
|
class HttpsRedirect(urllib.request.HTTPRedirectHandler):
|
|
@@ -136,7 +135,7 @@ def package_url(name: str, version: str, region: str, env: Mapping[str, str]) ->
|
|
|
136
135
|
def _probe(url: str, results: queue.Queue[bool]) -> None:
|
|
137
136
|
deadline = time.monotonic() + 5
|
|
138
137
|
try:
|
|
139
|
-
|
|
138
|
+
check_url(url)
|
|
140
139
|
for hops in range(6):
|
|
141
140
|
parts = urlsplit(url)
|
|
142
141
|
connection_type = (
|
|
@@ -239,56 +238,3 @@ def extract_bifrost(archive: Path, destination: Path, digest: str, size: int) ->
|
|
|
239
238
|
raise ValueError("Bifrost binary SHA256 mismatch")
|
|
240
239
|
destination.write_bytes(body)
|
|
241
240
|
destination.chmod(0o755)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
def _archive_pin(build: Mapping[str, Any]) -> tuple[str, int]:
|
|
245
|
-
"""The npm tarball's SHA256 and size, which every Bifrost build of the tool lock carries."""
|
|
246
|
-
pin = build["npm"]
|
|
247
|
-
digest, size = pin.get("sha256"), pin.get("bytes")
|
|
248
|
-
if (
|
|
249
|
-
not isinstance(digest, str)
|
|
250
|
-
or not re.fullmatch("[0-9a-f]{64}", digest)
|
|
251
|
-
or type(size) is not int
|
|
252
|
-
or not 0 < size <= archive_size_cap(build["size_bytes"])
|
|
253
|
-
):
|
|
254
|
-
raise ValueError(
|
|
255
|
-
"Bifrost npm archive pin is missing or invalid (the tool lock needs npm sha256 and"
|
|
256
|
-
" bytes)"
|
|
257
|
-
)
|
|
258
|
-
return digest, size
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
def _sha256(path: Path) -> str:
|
|
262
|
-
digest = hashlib.sha256()
|
|
263
|
-
with path.open("rb") as stream:
|
|
264
|
-
for chunk in iter(lambda: stream.read(1 << 20), b""):
|
|
265
|
-
digest.update(chunk)
|
|
266
|
-
return digest.hexdigest()
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
def fetch_bifrost(
|
|
270
|
-
build: Mapping[str, Any],
|
|
271
|
-
destination: Path,
|
|
272
|
-
archive: Path,
|
|
273
|
-
event: Callable[[dict[str, Any]], None],
|
|
274
|
-
) -> None:
|
|
275
|
-
"""Put the pinned Bifrost binary of ``build`` at ``destination``. The npm tarball downloads
|
|
276
|
-
to ``archive``, which must outlive this call: an interrupted download keeps
|
|
277
|
-
``archive.part`` for the next call to resume (``runtime_io.download``, which also moves
|
|
278
|
-
between the npm registry and its mirror), and a complete tarball left by a crash before
|
|
279
|
-
extraction is reused when it matches the pin. The tarball is deleted once extracted."""
|
|
280
|
-
from localmodels import runtime_io # runtime_io reaches the region through this module
|
|
281
|
-
|
|
282
|
-
digest, size = _archive_pin(build)
|
|
283
|
-
if archive.exists() or archive.is_symlink():
|
|
284
|
-
if archive.is_file() and not archive.is_symlink() and _sha256(archive) == digest:
|
|
285
|
-
event({"kind": "stage", "stage": "download", "state": "reused"})
|
|
286
|
-
else:
|
|
287
|
-
archive.unlink()
|
|
288
|
-
if not archive.exists():
|
|
289
|
-
pin = build["npm"]
|
|
290
|
-
url = _check_url(package_url(pin["package"], pin["version"], "global", os.environ))
|
|
291
|
-
artifact = {"url": url, "algorithm": "sha256", "digest": digest, "maxBytes": size}
|
|
292
|
-
runtime_io.download(artifact, archive, event)
|
|
293
|
-
extract_bifrost(archive, destination, build["sha256"], build["size_bytes"])
|
|
294
|
-
archive.unlink()
|
|
@@ -15,6 +15,7 @@ from localmodels import (
|
|
|
15
15
|
stack,
|
|
16
16
|
stack_capacity,
|
|
17
17
|
stack_hardware,
|
|
18
|
+
stack_hardware_text,
|
|
18
19
|
stack_summary,
|
|
19
20
|
suite,
|
|
20
21
|
)
|
|
@@ -138,7 +139,7 @@ def _show_parts(
|
|
|
138
139
|
print(" 按上面的硬件快照规划,不是已批准的安装计划。")
|
|
139
140
|
print(
|
|
140
141
|
f" LLM 窗口 {stack_summary.window_label(llm['launch']['window'])},"
|
|
141
|
-
+ (
|
|
142
|
+
+ (stack_hardware_text.agent_label(llm) or f"{llm['launch']['slots']} 路,")
|
|
142
143
|
+ _mtp_words(llm)
|
|
143
144
|
+ READER_WORDS.get(str(llm["launch"].get("vision") or "off"), "图片输入关闭")
|
|
144
145
|
)
|