@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.
Files changed (74) hide show
  1. package/bootstrap.identity +1 -1
  2. package/bootstrap.sha256 +73 -60
  3. package/modules/localmodels/__init__.py +1 -1
  4. package/modules/localmodels/__main__.py +5 -3
  5. package/modules/localmodels/auth_proxy.py +185 -19
  6. package/modules/localmodels/catalog.json +363 -0
  7. package/modules/localmodels/catalog.py +1 -1
  8. package/modules/localmodels/catalog_add.py +5 -5
  9. package/modules/localmodels/catalog_license.py +2 -0
  10. package/modules/localmodels/catalog_recipes.py +2 -0
  11. package/modules/localmodels/cli_parser.py +6 -2
  12. package/modules/localmodels/context_policy.py +40 -4
  13. package/modules/localmodels/debug_mode.py +13 -0
  14. package/modules/localmodels/debug_stub_server.py +156 -1
  15. package/modules/localmodels/deploy.py +11 -2
  16. package/modules/localmodels/download-mirrors.json +12 -0
  17. package/modules/localmodels/engines-b12757-mix-ef2df21.json +26 -0
  18. package/modules/localmodels/engines-whisper-b5454.json +120 -1
  19. package/modules/localmodels/gateway_app_bifrost.py +14 -14
  20. package/modules/localmodels/gateway_bifrost.py +4 -1
  21. package/modules/localmodels/gateway_cli.py +14 -80
  22. package/modules/localmodels/gateway_server.py +88 -16
  23. package/modules/localmodels/gpu_specs.py +35 -1
  24. package/modules/localmodels/harness.py +1 -2
  25. package/modules/localmodels/hf_repo.py +12 -4
  26. package/modules/localmodels/install.py +4 -4
  27. package/modules/localmodels/library_serve.py +69 -13
  28. package/modules/localmodels/npm_transport.py +4 -58
  29. package/modules/localmodels/recommend_cli.py +2 -1
  30. package/modules/localmodels/remote_ops.py +120 -713
  31. package/modules/localmodels/remote_ops_common.py +729 -0
  32. package/modules/localmodels/remote_ops_download.py +397 -381
  33. package/modules/localmodels/remote_ops_mirrors.py +26 -65
  34. package/modules/localmodels/remote_ops_prepare.py +43 -35
  35. package/modules/localmodels/remote_ops_ranges.py +98 -62
  36. package/modules/localmodels/remote_ops_remove.py +30 -22
  37. package/modules/localmodels/remote_ops_service.py +102 -95
  38. package/modules/localmodels/remote_ops_verify.py +94 -63
  39. package/modules/localmodels/runtime_cli.py +15 -5
  40. package/modules/localmodels/runtime_io.py +54 -1
  41. package/modules/localmodels/speech-sv.txt +93 -0
  42. package/modules/localmodels/speech_admission.py +437 -0
  43. package/modules/localmodels/speech_catalog.py +170 -0
  44. package/modules/localmodels/speech_cli.py +273 -0
  45. package/modules/localmodels/speech_jobs.py +772 -0
  46. package/modules/localmodels/speech_model.py +404 -0
  47. package/modules/localmodels/speech_serve.py +287 -0
  48. package/modules/localmodels/speech_server.py +837 -0
  49. package/modules/localmodels/speech_state.py +697 -0
  50. package/modules/localmodels/speech_worker_sensevoice.py +255 -0
  51. package/modules/localmodels/speech_workers.py +783 -0
  52. package/modules/localmodels/stack.py +0 -33
  53. package/modules/localmodels/stack_auto.py +5 -3
  54. package/modules/localmodels/stack_aux_gpu.py +45 -4
  55. package/modules/localmodels/stack_capacity.py +77 -8
  56. package/modules/localmodels/stack_cli.py +16 -1
  57. package/modules/localmodels/stack_compose.py +1 -1
  58. package/modules/localmodels/stack_down.py +24 -1
  59. package/modules/localmodels/stack_hardware.py +57 -88
  60. package/modules/localmodels/stack_hardware_text.py +4 -59
  61. package/modules/localmodels/stack_memory.py +13 -3
  62. package/modules/localmodels/stack_suite.py +9 -10
  63. package/modules/localmodels/stack_summary.py +4 -4
  64. package/modules/localmodels/stack_view_llm.py +1 -1
  65. package/modules/localmodels/transport.py +3 -2
  66. package/modules/localmodels/tui_views.py +2 -2
  67. package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/METADATA +1 -1
  68. package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/RECORD +70 -57
  69. package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/licenses/NOTICE +9 -0
  70. package/package.json +1 -1
  71. package/tool.json +1 -1
  72. /package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/WHEEL +0 -0
  73. /package/modules/{simplex_localmodels-0.1.0.dev60.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/entry_points.txt +0 -0
  74. /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 Callable, Mapping
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 _check_url(url: str, *, redirect: bool = False) -> str:
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 _check_url(target, redirect=True)
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
- _check_url(url)
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
- + (stack_hardware.agent_label(llm) or f"{llm['launch']['slots']} 路,")
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
  )