@simplexai/localmodels-win32-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
@@ -4,12 +4,156 @@ from __future__ import annotations
4
4
 
5
5
  import argparse
6
6
  import json
7
+ import math
8
+ import re
7
9
  import signal
8
10
  import sys
9
11
  import time
12
+ import urllib.parse
13
+ from http import HTTPStatus
10
14
  from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
11
15
  from typing import Any
12
16
 
17
+ from localmodels import speech_worker_sensevoice
18
+
19
+ _SPEECH_SILENCE_RMS = 150.0
20
+ _BOUNDARY_RE = re.compile(r'boundary=(?:"([^"]+)"|([^;\s]+))', re.IGNORECASE)
21
+ _NAME_RE = re.compile(r'name="([^"]+)"')
22
+
23
+
24
+ def _speech_wav_metrics(wav_bytes: bytes) -> tuple[float, float]:
25
+ samples, _rate, duration = speech_worker_sensevoice.read_pcm16_wav(wav_bytes)
26
+ if not samples:
27
+ return duration, 0.0
28
+ mean_sq = sum(sample * sample for sample in samples) / len(samples)
29
+ return duration, math.sqrt(mean_sq) * 32768.0
30
+
31
+
32
+ def _extract_multipart_speech(content_type: str, body: bytes) -> tuple[str, bytes]:
33
+ match = _BOUNDARY_RE.search(content_type)
34
+ if match is None:
35
+ raise ValueError("missing multipart boundary")
36
+ boundary = (match.group(1) or match.group(2) or "").encode("latin-1")
37
+ lang = "auto"
38
+ wav_bytes = b""
39
+ for raw_part in body.split(b"--" + boundary)[1:]:
40
+ if raw_part.startswith(b"--"):
41
+ break
42
+ part = raw_part[2:] if raw_part.startswith(b"\r\n") else raw_part.lstrip(b"\n")
43
+ sep = b"\r\n\r\n" if b"\r\n\r\n" in part else b"\n\n"
44
+ if sep not in part:
45
+ continue
46
+ head, content = part.split(sep, 1)
47
+ if content.endswith(b"\r\n"):
48
+ content = content[:-2]
49
+ elif content.endswith(b"\n"):
50
+ content = content[:-1]
51
+ name_match = _NAME_RE.search(head.decode("latin-1", errors="replace"))
52
+ if name_match is None:
53
+ continue
54
+ field_name = name_match.group(1)
55
+ if field_name == "language":
56
+ lang = content.decode("utf-8", errors="replace").strip() or "auto"
57
+ elif field_name == "file":
58
+ wav_bytes = content
59
+ return lang, wav_bytes
60
+
61
+
62
+ def _make_speech_handler(served_model: str, engine_mode: str) -> type[BaseHTTPRequestHandler]:
63
+ engine_name = "whisper.cpp" if engine_mode == "speech-whisper" else "sherpa-onnx"
64
+
65
+ class SpeechHandler(BaseHTTPRequestHandler):
66
+ protocol_version = "HTTP/1.1"
67
+
68
+ def log_message(self, format: str, *args: object) -> None: # noqa: A002
69
+ _ = (format, args)
70
+
71
+ def _send(self, status: HTTPStatus, body: dict[str, Any]) -> None:
72
+ speech_worker_sensevoice.send_json_response(self, status, body)
73
+
74
+ def do_GET(self) -> None: # noqa: N802
75
+ path = urllib.parse.urlsplit(self.path).path
76
+ if path == "/health" or (engine_mode == "speech-whisper" and path == "/"):
77
+ self._send(
78
+ HTTPStatus.OK,
79
+ {"status": "ok", "engine": engine_name, "simulated": True},
80
+ )
81
+ return
82
+ self._send(HTTPStatus.NOT_FOUND, {"error": {"message": "not found"}})
83
+
84
+ def do_POST(self) -> None: # noqa: N802
85
+ parsed = urllib.parse.urlsplit(self.path)
86
+ length = int(self.headers.get("Content-Length") or "0")
87
+ raw = self.rfile.read(length) if length > 0 else b""
88
+ if engine_mode == "speech-whisper" and parsed.path == "/v1/audio/transcriptions":
89
+ try:
90
+ lang, wav_bytes = _extract_multipart_speech(
91
+ self.headers.get("Content-Type") or "", raw
92
+ )
93
+ duration, rms = _speech_wav_metrics(wav_bytes)
94
+ except ValueError as exc:
95
+ self._send(HTTPStatus.BAD_REQUEST, {"error": {"message": str(exc)}})
96
+ return
97
+ if rms < _SPEECH_SILENCE_RMS:
98
+ self._send(
99
+ HTTPStatus.OK,
100
+ {
101
+ "text": "",
102
+ "language": "" if lang == "auto" else lang,
103
+ "duration": round(duration, 3),
104
+ "segments": [],
105
+ },
106
+ )
107
+ return
108
+ resolved_lang = "en" if lang == "auto" else lang
109
+ text = f"Simulated {served_model} transcript ({resolved_lang})."
110
+ dur = round(duration, 3)
111
+ self._send(
112
+ HTTPStatus.OK,
113
+ {
114
+ "text": text,
115
+ "language": resolved_lang,
116
+ "duration": dur,
117
+ "segments": [{"start": 0.0, "end": dur, "text": text}],
118
+ },
119
+ )
120
+ return
121
+
122
+ if engine_mode == "speech-sensevoice" and parsed.path == "/transcribe":
123
+ query = urllib.parse.parse_qs(parsed.query)
124
+ lang = (query.get("language") or ["auto"])[0] or "auto"
125
+ try:
126
+ duration, rms = _speech_wav_metrics(raw)
127
+ except ValueError as exc:
128
+ self._send(HTTPStatus.BAD_REQUEST, {"error": {"message": str(exc)}})
129
+ return
130
+ dur = round(duration, 3)
131
+ if rms < _SPEECH_SILENCE_RMS:
132
+ self._send(
133
+ HTTPStatus.OK,
134
+ {
135
+ "text": "<|zh|><|NEUTRAL|><|nospeech|>",
136
+ "language": "",
137
+ "duration": dur,
138
+ "segments": [],
139
+ },
140
+ )
141
+ return
142
+ resolved_lang = lang if lang in speech_worker_sensevoice.KNOWN_LANGUAGES else "zh"
143
+ text = (
144
+ f"<|{resolved_lang}|><|NEUTRAL|><|Speech|><|withitn|>"
145
+ f"Simulated {served_model} transcript ({resolved_lang})."
146
+ )
147
+ self._send(
148
+ HTTPStatus.OK,
149
+ {"text": text, "language": "", "duration": dur, "segments": []},
150
+ )
151
+ return
152
+
153
+ self._send(HTTPStatus.NOT_FOUND, {"error": {"message": "not found"}})
154
+
155
+ return SpeechHandler
156
+
13
157
 
14
158
  def _last_user_text(messages: Any) -> str:
15
159
  if not isinstance(messages, list):
@@ -176,8 +320,19 @@ def main(argv: list[str] | None = None) -> int:
176
320
  parser.add_argument("--bind", default="127.0.0.1")
177
321
  parser.add_argument("--port", type=int, required=True)
178
322
  parser.add_argument("--model", required=True)
323
+ parser.add_argument(
324
+ "--mode",
325
+ choices=("llm", "speech-whisper", "speech-sensevoice"),
326
+ default="llm",
327
+ )
179
328
  args = parser.parse_args(argv)
180
- server = ThreadingHTTPServer((args.bind, args.port), _make_handler(args.model))
329
+ handler = (
330
+ _make_handler(args.model)
331
+ if args.mode == "llm"
332
+ else _make_speech_handler(args.model, args.mode)
333
+ )
334
+ server = ThreadingHTTPServer((args.bind, args.port), handler)
335
+ server.daemon_threads = True
181
336
  signal.signal(signal.SIGTERM, lambda *_a: sys.exit(0))
182
337
  try:
183
338
  server.serve_forever(poll_interval=0.2)
@@ -33,6 +33,7 @@ from localmodels.budget import (
33
33
  unknown_services,
34
34
  )
35
35
  from localmodels.context_policy import (
36
+ DEFAULT_UBATCH,
36
37
  RUNTIME_OVERHEAD_BYTES,
37
38
  AgentPosture,
38
39
  LaunchPlan,
@@ -80,6 +81,7 @@ from localmodels.transport import Executor
80
81
 
81
82
  DEFAULT_BASE_DIR = "~/.local/share/localmodels"
82
83
  DEFAULT_PORT = 18100
84
+ METAL_DEFAULT_ENGINE = "b12757-mix-ef2df21"
83
85
  HF_API = region.HF_API
84
86
 
85
87
 
@@ -384,7 +386,7 @@ def build_plan(
384
386
  argv += CPU_ARGS
385
387
  elif placement.backend == "metal":
386
388
  argv += ["--device", "MTL0"]
387
- engine = _engine_plan(facts, options, entry, placement.backend, warnings, argv)
389
+ engine = engine_plan(facts, options, entry, placement.backend, warnings, argv)
388
390
  argv[0] = engine["binary"]
389
391
 
390
392
  gpus = {g["index"]: g for g in facts.get("gpus") or []}
@@ -467,6 +469,7 @@ def build_plan(
467
469
  "mtp_draft_depth": decision.mtp_draft_depth,
468
470
  "posture": "agent",
469
471
  "vram_bytes": decision.vram_bytes,
472
+ **({"ubatch": decision.ubatch} if decision.ubatch != DEFAULT_UBATCH else {}),
470
473
  }
471
474
  if options.agent is not None
472
475
  else {}
@@ -536,7 +539,7 @@ def _placement_warnings(placement: Placement, facts: HostFacts) -> list[str]:
536
539
  return warnings
537
540
 
538
541
 
539
- def _engine_plan(
542
+ def engine_plan(
540
543
  facts: HostFacts,
541
544
  options: PlanOptions,
542
545
  entry: cat.CatalogEntry,
@@ -581,6 +584,12 @@ def _engine_plan(
581
584
  if lock_tag is None:
582
585
  build = select_engine_build(facts, backend)
583
586
  lock_tag = entry.min_engine if cat.engine_too_old(entry, build["tag"]) else None
587
+ metal_num = cat.build_number(METAL_DEFAULT_ENGINE) or 0
588
+ if backend == "metal" and (
589
+ lock_tag is None
590
+ or (lock_tag.startswith("b") and (cat.build_number(lock_tag) or 0) < metal_num)
591
+ ):
592
+ lock_tag = METAL_DEFAULT_ENGINE
584
593
  if lock_tag is not None:
585
594
  lock = engine_lock_path(lock_tag)
586
595
  if not lock.is_file():
@@ -50,10 +50,22 @@
50
50
  "repo": "XHToken/Spark-X2.6-4B-GGUF",
51
51
  "path": "Spark-X2.6-4B-Q8_0.gguf"
52
52
  },
53
+ "12ca1a2ae7ecf3e0019ef2822307ee0b5cadc9196569e379b4c4026f8205276d": {
54
+ "repo": "aistoy/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2025-09-09",
55
+ "path": "model.int8.onnx"
56
+ },
57
+ "f449eb28dc567533d7fa59be34e2abca8784f771850c78a47fb731a31429a1dc": {
58
+ "repo": "aistoy/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2025-09-09",
59
+ "path": "tokens.txt"
60
+ },
53
61
  "a43c7c9b11a4c1517e5bf95151960e1621d1b72f7a493364b01e386cf1aaa1d3": {
54
62
  "repo": "gpustack/bge-reranker-v2-m3-GGUF",
55
63
  "path": "bge-reranker-v2-m3-Q8_0.gguf"
56
64
  },
65
+ "394221709cd5ad1f40c46e6031ca61bce88931e6e088c188294c6d5a55ffa7e2": {
66
+ "repo": "iceCream2025/whisper.cpp",
67
+ "path": "ggml-large-v3-turbo-q5_0.bin"
68
+ },
57
69
  "246d67d45f5b0c7447ca0ce0bdb8b46b8a47b593c5068635dc16422c051d7be9": {
58
70
  "repo": "inclusionAI/Ling-3.0-tiny-GGUF",
59
71
  "path": "Ling-3.0-tiny-Q4_K_M.gguf"
@@ -0,0 +1,26 @@
1
+ {
2
+ "schema": "localmodels.engine-lock/v1",
3
+ "tag": "b12757-mix-ef2df21",
4
+ "commit": "9b3ec1144de6b33c2f1589e81ae49f51b310a9ba",
5
+ "source": "https://github.com/unslothai/llama.cpp/releases/tag/b12757-mix-ef2df21",
6
+ "note": "Apple Silicon Metal build from unslothai/llama.cpp b12757-mix-ef2df21 (upstream llama.cpp b12757 + Unsloth looped Inkling 2 & DSpark patches, published 2026-11-26, verified byte-for-byte against GitHub release API and llama-prebuilt-sha256.json). Includes late-Nov Metal kernel speedups (+27.3% decode, +22-32% prefill, -711 MiB RSS on Inkling 2 Mini vs b12588-mix-c0c3de8; +61% 1K prefill and +5-7% decode on Spark-X2.6-4B vs b11370) while supporting both standard llama.cpp GGUFs and looped Inkling 2 Mini architectures in one Metal binary. Unpacks with a single top directory llama-b12757-mix-ef2df21/ stripped by remote_ops.unpack.",
7
+ "builds": [
8
+ {
9
+ "platform": "darwin",
10
+ "arch": "arm64",
11
+ "backend": "metal",
12
+ "assets": [
13
+ {
14
+ "name": "llama-b12757-mix-ef2df21-bin-macos-arm64.tar.gz",
15
+ "url": "https://github.com/unslothai/llama.cpp/releases/download/b12757-mix-ef2df21/llama-b12757-mix-ef2df21-bin-macos-arm64.tar.gz",
16
+ "sha256": "1982808b8ab586c55eb406028a8543f7460b8bfe89708c8d1c6c5e7da78a06f0",
17
+ "size_bytes": 13462270,
18
+ "npm_copy": {
19
+ "package": "@simplexai/engine-llama-b12757-mix-ef2df21-bin-macos-arm64",
20
+ "version": "0.0.0-sha256-1982808b8ab586c5"
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ }
@@ -3,8 +3,36 @@
3
3
  "tag": "whisper-b5454",
4
4
  "commit": "d1be6fde11ac6e0407606b4e42fe72d34add8037",
5
5
  "source": "https://github.com/ggml-org/whisper.cpp/releases/tag/b5454",
6
- "note": "whisper.cpp release build b5454, the same commit as v1.9.5 (whose tag has no assets), read 2026-10-21. CPU only, RUNPATH $ORIGIN; binaries import at most GLIBC_2.34. whisper-server has no --version; whisper-cli --version prints the release version, 1.9.5. Like upstream llama.cpp's Linux builds, it links GCC's OpenMP runtime (libgomp.so.1, Debian package libgomp1), which minimal images lack (readelf NEEDED, 2026-10-23); a plan on such a host stops instead of installing it.",
6
+ "note": "whisper.cpp release build b5454, the same commit as v1.9.5 (whose tag has no assets). Linux CPU and Windows x64 CPU/CUDA digests are from the GitHub release API (Linux x64 read 2026-10-21; Linux arm64 and Windows x64 read 2026-11-26). Upstream Linux CPU tarballs (ubuntu-22.04) use RUNPATH $ORIGIN, import at most GLIBC_2.34, and link libgomp.so.1 (Debian package libgomp1), which minimal images lack. Linux x64 CUDA 12.8 (ubuntu22.04-r1, built 2026-11-27 via scripts/build_whisper_engine.py in pinned nvidia/cuda:12.8.2-devel-ubuntu22.04) bundles libgomp.so.1 with RUNPATH $ORIGIN, imports at most GLIBC_2.34 / GLIBCXX_3.4.30 / CXXABI_1.3.13, targets CUDA archs 50-virtual..120a-real, pairs with its CUDA 12.8.2 cudart companion, and is hosted on the public CloudFront CDN with provenance JSON. macOS arm64 Metal (embedded Metal shaders, runtime -ng CPU fallback) and macOS x64 CPU tarballs (built 2026-11-27 on Apple Silicon Xcode 27.2 targeting macOS 13.0 with @loader_path rpath and system frameworks only) are hosted on the same CloudFront CDN alongside their provenance JSONs. Windows x64 zips unpack a single Release/ top directory stripped by remote_ops.unpack to yield whisper-server.exe beside its ggml/whisper/SDL2 DLLs; the CUDA 12.4 zip is self-contained and already bundles cudart64_12.dll, cublas64_12.dll and cublasLt64_12.dll. whisper-server has no --version; whisper-cli --version prints 1.9.5. Linux Vulkan awaits a container-verified Ubuntu 22.04 glslc + spirv-headers toolchain.",
7
7
  "builds": [
8
+ {
9
+ "platform": "linux",
10
+ "arch": "x64",
11
+ "backend": "cuda",
12
+ "min_cuda": "12.8",
13
+ "min_glibc": "2.34",
14
+ "variant": "ubuntu22.04-r1",
15
+ "binary": "whisper-server",
16
+ "provenance": "https://d2ikbbcl3j6jz9.cloudfront.net/cli/localmodels/engines/whisper/b5454/whisper-b5454-bin-ubuntu22.04-r1-cuda-12.8-x64.provenance.json",
17
+ "assets": [
18
+ {
19
+ "name": "whisper-b5454-bin-ubuntu22.04-r1-cuda-12.8-x64.tar.gz",
20
+ "url": "https://d2ikbbcl3j6jz9.cloudfront.net/cli/localmodels/engines/whisper/b5454/whisper-b5454-bin-ubuntu22.04-r1-cuda-12.8-x64.tar.gz",
21
+ "sha256": "4848c97a7ef34cd0a42a132dbbf6f21a538701f71469f9c861657ff6ed32f314",
22
+ "size_bytes": 162307029,
23
+ "npm_copy": {
24
+ "package": "@simplexai/engine-whisper-b5454-bin-ubuntu22.04-r1-cuda-12.8-x64",
25
+ "version": "0.0.0-sha256-4848c97a7ef34cd0"
26
+ }
27
+ },
28
+ {
29
+ "name": "cudart-whisper-b5454-bin-ubuntu22.04-r1-cuda-12.8-x64.tar.gz",
30
+ "url": "https://d2ikbbcl3j6jz9.cloudfront.net/cli/localmodels/engines/whisper/b5454/cudart-whisper-b5454-bin-ubuntu22.04-r1-cuda-12.8-x64.tar.gz",
31
+ "sha256": "70f571e233c8a89f9fa176bb6861015b5827778b241bf61de55affb6eb270e86",
32
+ "size_bytes": 593656061
33
+ }
34
+ ]
35
+ },
8
36
  {
9
37
  "platform": "linux",
10
38
  "arch": "x64",
@@ -26,6 +54,97 @@
26
54
  }
27
55
  }
28
56
  ]
57
+ },
58
+ {
59
+ "platform": "linux",
60
+ "arch": "arm64",
61
+ "backend": "cpu",
62
+ "min_glibc": "2.34",
63
+ "binary": "whisper-server",
64
+ "host_libraries": {
65
+ "libgomp.so.1": "libgomp1"
66
+ },
67
+ "assets": [
68
+ {
69
+ "name": "whisper-bin-ubuntu-arm64.tar.gz",
70
+ "url": "https://github.com/ggml-org/whisper.cpp/releases/download/b5454/whisper-bin-ubuntu-arm64.tar.gz",
71
+ "sha256": "6b95ebfc60447df48e70ef00a73bdc3f41679ed2d01ef465827206a2ff325149",
72
+ "size_bytes": 4608377,
73
+ "npm_copy": {
74
+ "package": "@simplexai/engine-whisper-bin-ubuntu-arm64",
75
+ "version": "0.0.0-sha256-6b95ebfc60447df4"
76
+ }
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ "platform": "darwin",
82
+ "arch": "arm64",
83
+ "backend": "metal",
84
+ "binary": "whisper-server",
85
+ "assets": [
86
+ {
87
+ "name": "whisper-b5454-bin-macos-arm64.tar.gz",
88
+ "url": "https://d2ikbbcl3j6jz9.cloudfront.net/cli/localmodels/engines/whisper/b5454/whisper-b5454-bin-macos-arm64.tar.gz",
89
+ "sha256": "cd70f1be3676db1280775df08294340cb36e625c8370385ca8c2acac7fe0e6d1",
90
+ "size_bytes": 3372342,
91
+ "npm_copy": {
92
+ "package": "@simplexai/engine-whisper-b5454-bin-macos-arm64",
93
+ "version": "0.0.0-sha256-cd70f1be3676db12"
94
+ }
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "platform": "darwin",
100
+ "arch": "x64",
101
+ "backend": "cpu",
102
+ "binary": "whisper-server",
103
+ "assets": [
104
+ {
105
+ "name": "whisper-b5454-bin-macos-x64.tar.gz",
106
+ "url": "https://d2ikbbcl3j6jz9.cloudfront.net/cli/localmodels/engines/whisper/b5454/whisper-b5454-bin-macos-x64.tar.gz",
107
+ "sha256": "445c8f42ac3326221c5c1aa990a49be9590ea33d59b6ffdeadc44d0c5303d5d2",
108
+ "size_bytes": 2623802,
109
+ "npm_copy": {
110
+ "package": "@simplexai/engine-whisper-b5454-bin-macos-x64",
111
+ "version": "0.0.0-sha256-445c8f42ac332622"
112
+ }
113
+ }
114
+ ]
115
+ },
116
+ {
117
+ "platform": "win32",
118
+ "arch": "x64",
119
+ "backend": "cuda",
120
+ "min_cuda": "12.4",
121
+ "binary": "whisper-server.exe",
122
+ "assets": [
123
+ {
124
+ "name": "whisper-bin-win-cuda-12.4.0-x64.zip",
125
+ "url": "https://github.com/ggml-org/whisper.cpp/releases/download/b5454/whisper-bin-win-cuda-12.4.0-x64.zip",
126
+ "sha256": "afef0b881c500958921c3f5523b50e59ee2ec9b6f5cbd25b324c51ed308a957a",
127
+ "size_bytes": 684913404
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "platform": "win32",
133
+ "arch": "x64",
134
+ "backend": "cpu",
135
+ "binary": "whisper-server.exe",
136
+ "assets": [
137
+ {
138
+ "name": "whisper-bin-x64.zip",
139
+ "url": "https://github.com/ggml-org/whisper.cpp/releases/download/b5454/whisper-bin-x64.zip",
140
+ "sha256": "6ba69e3482d7826214f90a6a9c84ca07782aec1e1d0c6a7c30c994fd5d816ccb",
141
+ "size_bytes": 8928640,
142
+ "npm_copy": {
143
+ "package": "@simplexai/engine-whisper-bin-x64",
144
+ "version": "0.0.0-sha256-6ba69e3482d78262"
145
+ }
146
+ }
147
+ ]
29
148
  }
30
149
  ],
31
150
  "version": "1.9.5"
@@ -4,13 +4,13 @@ from __future__ import annotations
4
4
 
5
5
  import os
6
6
  import subprocess
7
+ from collections.abc import Callable
7
8
  from pathlib import Path
8
9
  from typing import Any
9
10
 
10
11
  from localmodels import (
11
12
  bifrost_config,
12
13
  gateway_bifrost,
13
- gateway_cli,
14
14
  gateway_foundations,
15
15
  harness,
16
16
  process_identity,
@@ -69,9 +69,15 @@ def render(
69
69
 
70
70
 
71
71
  class Upstream:
72
- def __init__(self, root: Path, state: dict[str, Any]):
72
+ def __init__(
73
+ self,
74
+ root: Path,
75
+ state: dict[str, Any],
76
+ resolve: Callable[[], tuple[dict[str, Any] | None, bool]],
77
+ ):
73
78
  self.root = root
74
79
  self.state = state
80
+ self._resolve = resolve
75
81
  self.app = root / "bifrost"
76
82
  runtime_io.private_directory(self.app)
77
83
  for name in ("admin-password", "config.json", "config.json.tmp"):
@@ -83,25 +89,19 @@ class Upstream:
83
89
  self.authenticated = False
84
90
 
85
91
  def refresh(self) -> None:
86
- from localmodels import gateway_server
87
-
88
- row = gateway_cli.selected_runtime(
89
- Path(self.state["harnessRoot"]), self.state["runtime"], self.state.get("node")
90
- )
91
- env = gateway_cli.gateway_environment(self.root / "home", row)
92
- provider = gateway_server.api_provider(row, env, self.state)
92
+ provider, authed = self._resolve()
93
93
  source = self.state.get("foundationsRoot")
94
94
  config = render(provider, Path(source) if source else None, self.app, self.password)
95
95
  if config != gateway_bifrost.read_config(self.app):
96
96
  running = self.child is not None
97
97
  self.stop()
98
- gateway_bifrost._write_config(self.app, config)
98
+ gateway_bifrost.write_config(self.app, config)
99
99
  if running:
100
100
  self.start()
101
- self.authenticated = provider is not None and row["authenticated"] is True
101
+ self.authenticated = provider is not None and authed
102
102
 
103
103
  def start(self) -> None:
104
- gateway_bifrost._stop_serve(self.app)
104
+ gateway_bifrost.stop_serve(self.app)
105
105
  env = dict(os.environ, NO_PROXY="*", no_proxy="*")
106
106
  # Explicit config owns all providers; inherited credential variables must not add any.
107
107
  for name in tuple(env):
@@ -131,12 +131,12 @@ class Upstream:
131
131
  try:
132
132
  process_identity.save(self.app / "bifrost.pid", self.child.pid)
133
133
  except (OSError, ValueError, RuntimeError, subprocess.SubprocessError):
134
- runtime_process._terminate_tree(self.child)
134
+ runtime_process.terminate_tree(self.child)
135
135
  self.child = None
136
136
  raise harness.HarnessError("Cannot record Bifrost process identity") from None
137
137
 
138
138
  def stop(self) -> None:
139
- gateway_bifrost._stop_serve(self.app)
139
+ gateway_bifrost.stop_serve(self.app)
140
140
  if self.child is not None:
141
141
  self.child.wait(timeout=10)
142
142
  self.child = None
@@ -583,7 +583,7 @@ def _stop_owned_serve(record: hosts.OwnedBifrost) -> None:
583
583
  _stop_orphaned_serve(record)
584
584
 
585
585
 
586
- def _stop_serve(app: Path) -> None:
586
+ def stop_serve(app: Path) -> None:
587
587
  """Only the process group the identity receipt proves is ours; anything else is kept."""
588
588
  try:
589
589
  outcome = process_identity.stop(app / "bifrost.pid")
@@ -596,6 +596,9 @@ def _stop_serve(app: Path) -> None:
596
596
  _stop_orphaned_serve(record)
597
597
 
598
598
 
599
+ _stop_serve = stop_serve
600
+
601
+
599
602
  def pause(record: hosts.OwnedBifrost) -> str:
600
603
  """Stop the proven instance, retaining its unit, configuration and ownership record."""
601
604
  running = owned_listener(record)