omnius 1.0.980 → 1.0.982

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.
@@ -3290,6 +3290,15 @@ var init_model_store = __esm({
3290
3290
  }
3291
3291
  });
3292
3292
 
3293
+ // packages/execution/dist/tools/cuda-device-filter.js
3294
+ var init_cuda_device_filter = __esm({
3295
+ "packages/execution/dist/tools/cuda-device-filter.js"() {
3296
+ "use strict";
3297
+ init_process_async();
3298
+ init_gpu_selection2();
3299
+ }
3300
+ });
3301
+
3293
3302
  // packages/execution/dist/process-kill.js
3294
3303
  var IS_WINDOWS;
3295
3304
  var init_process_kill = __esm({
@@ -3423,15 +3432,6 @@ var init_playwright_download = __esm({
3423
3432
  }
3424
3433
  });
3425
3434
 
3426
- // packages/execution/dist/tools/cuda-device-filter.js
3427
- var init_cuda_device_filter = __esm({
3428
- "packages/execution/dist/tools/cuda-device-filter.js"() {
3429
- "use strict";
3430
- init_process_async();
3431
- init_gpu_selection2();
3432
- }
3433
- });
3434
-
3435
3435
  // packages/execution/dist/tools/camera-capture.js
3436
3436
  var DEFAULT_CAMERA_PROFILE, CAMERA_PROFILES;
3437
3437
  var init_camera_capture = __esm({
@@ -250358,6 +250358,104 @@ var OCR_JETSON_NATIVE_PROVIDERS = Object.freeze({
250358
250358
  // packages/execution/dist/python-cuda-runtime-async.js
250359
250359
  init_process_async();
250360
250360
 
250361
+ // packages/execution/dist/luxtts-device-policy.js
250362
+ init_cuda_device_filter();
250363
+ var LUX_TTS_DEVICE_POLICY_PREAMBLE = String.raw`
250364
+ # OMNIUS_LUXTTS_DEVICE_POLICY_V1
250365
+ import gc, json, os, signal, time
250366
+ _POLICY = json.loads(os.environ.get("OMNIUS_LUXTTS_DEVICE_POLICY", "{}"))
250367
+ _DEVICE = str(_POLICY.get("device") or "cpu")
250368
+ _GPU_TOKEN = str(_POLICY.get("gpuUuid") or "")
250369
+ _CPU_CAP = max(0.01, float(_POLICY.get("cpuPercent") or 80) / 100.0)
250370
+ _CPU_THREADS = max(1, min(8, int(_POLICY.get("cpuThreads") or 1)))
250371
+ if _DEVICE == "cuda":
250372
+ if _GPU_TOKEN and not _POLICY.get("brokerManaged"):
250373
+ os.environ["CUDA_VISIBLE_DEVICES"] = _GPU_TOKEN
250374
+ os.environ["HIP_VISIBLE_DEVICES"] = "-1"
250375
+ os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
250376
+ os.environ.pop("NVIDIA_VISIBLE_DEVICES", None)
250377
+ else:
250378
+ os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
250379
+ os.environ["HIP_VISIBLE_DEVICES"] = "-1"
250380
+ os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
250381
+ os.environ["NVIDIA_VISIBLE_DEVICES"] = "none"
250382
+
250383
+ _YIELD_REQUESTED = False
250384
+ _CPU_BUDGET = {"wall": None, "cpu": None}
250385
+
250386
+ def _handle_voice_stop(_signum, _frame):
250387
+ global _YIELD_REQUESTED
250388
+ _YIELD_REQUESTED = True
250389
+
250390
+ try:
250391
+ signal.signal(signal.SIGTERM, _handle_voice_stop)
250392
+ except Exception:
250393
+ pass
250394
+
250395
+ def _yield_requested():
250396
+ if _YIELD_REQUESTED or _POLICY.get("yieldRequested"):
250397
+ return True
250398
+ drain = os.environ.get("OMNIUS_LUXTTS_DRAIN_FILE", "")
250399
+ return bool(drain and os.path.exists(drain))
250400
+
250401
+ def _acknowledge_yield():
250402
+ ack = os.environ.get("OMNIUS_LUXTTS_DRAIN_ACK", "")
250403
+ if not ack:
250404
+ return
250405
+ try:
250406
+ with open(ack, "w") as handle:
250407
+ handle.write("yielded")
250408
+ except Exception:
250409
+ pass
250410
+
250411
+ def _mark_runtime_ready(ready=True):
250412
+ path = os.environ.get("OMNIUS_LUXTTS_READY_FILE", "")
250413
+ if not path:
250414
+ return
250415
+ try:
250416
+ if ready:
250417
+ with open(path, "w") as handle:
250418
+ handle.write("ready")
250419
+ elif os.path.exists(path):
250420
+ os.unlink(path)
250421
+ except Exception:
250422
+ pass
250423
+
250424
+ def _cpu_cap_begin():
250425
+ _CPU_BUDGET["wall"] = time.monotonic()
250426
+ _CPU_BUDGET["cpu"] = time.process_time()
250427
+
250428
+ def _cpu_cap_settle():
250429
+ wall_started = _CPU_BUDGET.get("wall")
250430
+ cpu_started = _CPU_BUDGET.get("cpu")
250431
+ _CPU_BUDGET["wall"] = None
250432
+ _CPU_BUDGET["cpu"] = None
250433
+ if wall_started is None or cpu_started is None:
250434
+ return
250435
+ wall = max(0.001, time.monotonic() - wall_started)
250436
+ cpu = max(0.0, time.process_time() - cpu_started)
250437
+ required_wall = cpu / _CPU_CAP
250438
+ debt = required_wall - wall
250439
+ if debt > 0:
250440
+ time.sleep(min(debt, 600.0))
250441
+
250442
+ def _drop_luxtts_model():
250443
+ for _name in ("tts", "prompt_cache"):
250444
+ globals().pop(_name, None)
250445
+ gc.collect()
250446
+ try:
250447
+ import torch
250448
+ if torch.cuda.is_available():
250449
+ torch.cuda.synchronize()
250450
+ torch.cuda.empty_cache()
250451
+ except Exception:
250452
+ pass
250453
+ `;
250454
+
250455
+ // packages/execution/dist/luxtts-gpu-lease.js
250456
+ init_process_async();
250457
+ init_model_broker();
250458
+
250361
250459
  // packages/execution/dist/broker-mediated-backend.js
250362
250460
  init_model_broker();
250363
250461
 
@@ -301960,6 +302058,32 @@ init_process_async();
301960
302058
  init_hf_media_models();
301961
302059
  init_cuda_device_filter();
301962
302060
  init_model_store();
302061
+ var _luxttsDaemon = null;
302062
+ var _luxttsStartingWorker = null;
302063
+ var _luxttsRuntimeLease = null;
302064
+ async function releaseLuxTtsRuntimeLease() {
302065
+ const lease = _luxttsRuntimeLease;
302066
+ _luxttsRuntimeLease = null;
302067
+ if (!lease)
302068
+ return;
302069
+ lease.signalRelease?.();
302070
+ if (lease.settleRelease)
302071
+ await lease.settleRelease();
302072
+ else
302073
+ await lease.release();
302074
+ }
302075
+ process.once("exit", () => {
302076
+ const workers = [_luxttsDaemon, _luxttsStartingWorker, _misottsDaemon];
302077
+ for (const worker of workers) {
302078
+ if (!worker)
302079
+ continue;
302080
+ try {
302081
+ worker.kill("SIGKILL");
302082
+ } catch {
302083
+ }
302084
+ }
302085
+ void releaseLuxTtsRuntimeLease();
302086
+ });
301963
302087
  var SUPERTONIC_INFER_PY = String.raw`
301964
302088
  import json, sys, traceback
301965
302089
  try:
@@ -301992,27 +302116,41 @@ except Exception as exc:
301992
302116
  sys.exit(1)
301993
302117
  `;
301994
302118
  var LUXTTS_DAEMON_PY = String.raw`
301995
- import json, os, sys, traceback, wave
301996
- # OMNIUS_LUXTTS_CPU_ONLY_V1
301997
- os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
301998
- os.environ["HIP_VISIBLE_DEVICES"] = "-1"
301999
- os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
302119
+ # OMNIUS_LUXTTS_DEVICE_POLICY_V1
302120
+ ${LUX_TTS_DEVICE_POLICY_PREAMBLE}
302121
+ import traceback, wave
302000
302122
  import numpy as np
302001
302123
  import torch
302124
+ try:
302125
+ torch.set_num_threads(_CPU_THREADS)
302126
+ except Exception:
302127
+ pass
302002
302128
  repo = os.environ.get("LUXTTS_REPO_PATH") or ""
302003
302129
  if repo:
302004
302130
  sys.path.insert(0, repo)
302005
302131
  from zipvoice.luxvoice import LuxTTS
302006
- device = "cpu"
302007
- tts = LuxTTS(model_path="YatharthS/LuxTTS", device=device, threads=4)
302008
- print(json.dumps({"type": "ready", "device": device}), flush=True)
302132
+ tts = LuxTTS(model_path="YatharthS/LuxTTS", device=_DEVICE, threads=_CPU_THREADS)
302133
+ _mark_runtime_ready(True)
302134
+ print(json.dumps({"type": "ready", "device": _DEVICE}), flush=True)
302009
302135
  for line in sys.stdin:
302136
+ if _yield_requested():
302137
+ _drop_luxtts_model()
302138
+ _acknowledge_yield()
302139
+ _mark_runtime_ready(False)
302140
+ print(json.dumps({"type": "yielded", "device": _DEVICE}), flush=True)
302141
+ break
302010
302142
  if not line.strip():
302011
302143
  continue
302012
302144
  req = json.loads(line)
302013
- if req.get("action") == "quit":
302145
+ if req.get("action") in ("quit", "yield", "release"):
302146
+ if req.get("action") != "quit":
302147
+ _drop_luxtts_model()
302148
+ _acknowledge_yield()
302149
+ _mark_runtime_ready(False)
302150
+ print(json.dumps({"type": "yielded", "id": req.get("id"), "device": _DEVICE}), flush=True)
302014
302151
  break
302015
302152
  rid = req.get("id")
302153
+ _cpu_cap_begin()
302016
302154
  try:
302017
302155
  text = str(req.get("text") or "").strip()
302018
302156
  clone_ref = str(req.get("clone_ref") or "")
@@ -302029,6 +302167,8 @@ for line in sys.stdin:
302029
302167
  print(json.dumps({"type": "result", "id": rid, "path": output}), flush=True)
302030
302168
  except Exception as exc:
302031
302169
  print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
302170
+ finally:
302171
+ _cpu_cap_settle()
302032
302172
  `;
302033
302173
  var MISO_DAEMON_PY = String.raw`
302034
302174
  import json, os, sys, traceback
@@ -302079,6 +302219,7 @@ for line in sys.stdin:
302079
302219
  except Exception as exc:
302080
302220
  print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
302081
302221
  `;
302222
+ var _misottsDaemon = null;
302082
302223
 
302083
302224
  // packages/execution/dist/tools/sdr-scan.js
302084
302225
  init_process_async();
@@ -709,7 +709,7 @@ function discoverSystemdOwner(user, capture) {
709
709
  return /^LoadState=loaded$/m.test(system) ? "system" : null;
710
710
  }
711
711
 
712
- function installDesktopCompanion(nodeBin, omniusScript, user) {
712
+ function installDesktopCompanion(nodeBin, omniusScript, user, options) {
713
713
  if (!user) return;
714
714
  if (process.env.OMNIUS_SKIP_TRAY_INSTALL === "1") {
715
715
  log("OMNIUS_SKIP_TRAY_INSTALL=1 — leaving the desktop tray companion unchanged.");
@@ -734,7 +734,8 @@ function installDesktopCompanion(nodeBin, omniusScript, user) {
734
734
  return;
735
735
  }
736
736
  cp.execFileSync(nodeBin, [helper, "--node", nodeBin, "--entrypoint", omniusScript,
737
- "--home", userHome, "--user", user, "--data-dir", path.join(userHome, ".omnius"), "--port", String(PORT)],
737
+ "--home", userHome, "--user", user, "--data-dir", path.join(userHome, ".omnius"), "--port", String(PORT),
738
+ ...(options && options.start === false ? ["--no-start"] : [])],
738
739
  { stdio: "pipe", timeout: 20000 });
739
740
  log("Updated the daemon's desktop tray companion (headless hosts need no tray).");
740
741
  } catch (e) {
@@ -1198,7 +1199,9 @@ function main() {
1198
1199
  // the shared desktop companion registered to the newly installed package.
1199
1200
  if (process.env.OMNIUS_UPDATE_COORDINATED === "1") {
1200
1201
  var companionEntrypoint = resolveOmniusBinary();
1201
- if (companionEntrypoint) installDesktopCompanion(resolveNodeBinary(), companionEntrypoint, effectiveUser());
1202
+ // Keep the installed unit/desktop entry current, but never let a package
1203
+ // script start the indicator while the coordinated worker holds it down.
1204
+ if (companionEntrypoint) installDesktopCompanion(resolveNodeBinary(), companionEntrypoint, effectiveUser(), { start: false });
1202
1205
  log("Coordinated update owns daemon restart and exact-version verification.");
1203
1206
  return safeExit(0);
1204
1207
  }