omnius 1.0.980 → 1.0.981

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.
@@ -4452,6 +4452,125 @@ var init_luxtts_runtime_contract = __esm({
4452
4452
  }
4453
4453
  });
4454
4454
 
4455
+ // packages/execution/dist/tools/cuda-device-filter.js
4456
+ var init_cuda_device_filter = __esm({
4457
+ "packages/execution/dist/tools/cuda-device-filter.js"() {
4458
+ "use strict";
4459
+ init_process_async();
4460
+ init_gpu_selection2();
4461
+ }
4462
+ });
4463
+
4464
+ // packages/execution/dist/luxtts-device-policy.js
4465
+ var LUX_TTS_DEVICE_POLICY_PREAMBLE;
4466
+ var init_luxtts_device_policy = __esm({
4467
+ "packages/execution/dist/luxtts-device-policy.js"() {
4468
+ "use strict";
4469
+ init_cuda_device_filter();
4470
+ LUX_TTS_DEVICE_POLICY_PREAMBLE = String.raw`
4471
+ # OMNIUS_LUXTTS_DEVICE_POLICY_V1
4472
+ import gc, json, os, signal, time
4473
+ _POLICY = json.loads(os.environ.get("OMNIUS_LUXTTS_DEVICE_POLICY", "{}"))
4474
+ _DEVICE = str(_POLICY.get("device") or "cpu")
4475
+ _GPU_TOKEN = str(_POLICY.get("gpuUuid") or "")
4476
+ _CPU_CAP = max(0.01, float(_POLICY.get("cpuPercent") or 80) / 100.0)
4477
+ _CPU_THREADS = max(1, min(8, int(_POLICY.get("cpuThreads") or 1)))
4478
+ if _DEVICE == "cuda":
4479
+ if _GPU_TOKEN and not _POLICY.get("brokerManaged"):
4480
+ os.environ["CUDA_VISIBLE_DEVICES"] = _GPU_TOKEN
4481
+ os.environ["HIP_VISIBLE_DEVICES"] = "-1"
4482
+ os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
4483
+ os.environ.pop("NVIDIA_VISIBLE_DEVICES", None)
4484
+ else:
4485
+ os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
4486
+ os.environ["HIP_VISIBLE_DEVICES"] = "-1"
4487
+ os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
4488
+ os.environ["NVIDIA_VISIBLE_DEVICES"] = "none"
4489
+
4490
+ _YIELD_REQUESTED = False
4491
+ _CPU_BUDGET = {"wall": None, "cpu": None}
4492
+
4493
+ def _handle_voice_stop(_signum, _frame):
4494
+ global _YIELD_REQUESTED
4495
+ _YIELD_REQUESTED = True
4496
+
4497
+ try:
4498
+ signal.signal(signal.SIGTERM, _handle_voice_stop)
4499
+ except Exception:
4500
+ pass
4501
+
4502
+ def _yield_requested():
4503
+ if _YIELD_REQUESTED or _POLICY.get("yieldRequested"):
4504
+ return True
4505
+ drain = os.environ.get("OMNIUS_LUXTTS_DRAIN_FILE", "")
4506
+ return bool(drain and os.path.exists(drain))
4507
+
4508
+ def _acknowledge_yield():
4509
+ ack = os.environ.get("OMNIUS_LUXTTS_DRAIN_ACK", "")
4510
+ if not ack:
4511
+ return
4512
+ try:
4513
+ with open(ack, "w") as handle:
4514
+ handle.write("yielded")
4515
+ except Exception:
4516
+ pass
4517
+
4518
+ def _mark_runtime_ready(ready=True):
4519
+ path = os.environ.get("OMNIUS_LUXTTS_READY_FILE", "")
4520
+ if not path:
4521
+ return
4522
+ try:
4523
+ if ready:
4524
+ with open(path, "w") as handle:
4525
+ handle.write("ready")
4526
+ elif os.path.exists(path):
4527
+ os.unlink(path)
4528
+ except Exception:
4529
+ pass
4530
+
4531
+ def _cpu_cap_begin():
4532
+ _CPU_BUDGET["wall"] = time.monotonic()
4533
+ _CPU_BUDGET["cpu"] = time.process_time()
4534
+
4535
+ def _cpu_cap_settle():
4536
+ wall_started = _CPU_BUDGET.get("wall")
4537
+ cpu_started = _CPU_BUDGET.get("cpu")
4538
+ _CPU_BUDGET["wall"] = None
4539
+ _CPU_BUDGET["cpu"] = None
4540
+ if wall_started is None or cpu_started is None:
4541
+ return
4542
+ wall = max(0.001, time.monotonic() - wall_started)
4543
+ cpu = max(0.0, time.process_time() - cpu_started)
4544
+ required_wall = cpu / _CPU_CAP
4545
+ debt = required_wall - wall
4546
+ if debt > 0:
4547
+ time.sleep(min(debt, 600.0))
4548
+
4549
+ def _drop_luxtts_model():
4550
+ for _name in ("tts", "prompt_cache"):
4551
+ globals().pop(_name, None)
4552
+ gc.collect()
4553
+ try:
4554
+ import torch
4555
+ if torch.cuda.is_available():
4556
+ torch.cuda.synchronize()
4557
+ torch.cuda.empty_cache()
4558
+ except Exception:
4559
+ pass
4560
+ `;
4561
+ }
4562
+ });
4563
+
4564
+ // packages/execution/dist/luxtts-gpu-lease.js
4565
+ var init_luxtts_gpu_lease = __esm({
4566
+ "packages/execution/dist/luxtts-gpu-lease.js"() {
4567
+ "use strict";
4568
+ init_process_async();
4569
+ init_model_broker();
4570
+ init_luxtts_device_policy();
4571
+ }
4572
+ });
4573
+
4455
4574
  // packages/execution/dist/broker-mediated-backend.js
4456
4575
  var init_broker_mediated_backend = __esm({
4457
4576
  "packages/execution/dist/broker-mediated-backend.js"() {
@@ -53746,15 +53865,6 @@ var init_playwright_download = __esm({
53746
53865
  }
53747
53866
  });
53748
53867
 
53749
- // packages/execution/dist/tools/cuda-device-filter.js
53750
- var init_cuda_device_filter = __esm({
53751
- "packages/execution/dist/tools/cuda-device-filter.js"() {
53752
- "use strict";
53753
- init_process_async();
53754
- init_gpu_selection2();
53755
- }
53756
- });
53757
-
53758
53868
  // packages/execution/dist/tools/camera-capture.js
53759
53869
  var DEFAULT_CAMERA_PROFILE, CAMERA_PROFILES;
53760
53870
  var init_camera_capture = __esm({
@@ -303033,7 +303143,18 @@ var init_audio_capture = __esm({
303033
303143
  });
303034
303144
 
303035
303145
  // packages/execution/dist/tools/audio-playback.js
303036
- var SUPERTONIC_INFER_PY, LUXTTS_DAEMON_PY, MISO_DAEMON_PY;
303146
+ async function releaseLuxTtsRuntimeLease() {
303147
+ const lease = _luxttsRuntimeLease;
303148
+ _luxttsRuntimeLease = null;
303149
+ if (!lease)
303150
+ return;
303151
+ lease.signalRelease?.();
303152
+ if (lease.settleRelease)
303153
+ await lease.settleRelease();
303154
+ else
303155
+ await lease.release();
303156
+ }
303157
+ var _luxttsDaemon, _luxttsStartingWorker, _luxttsRuntimeLease, SUPERTONIC_INFER_PY, LUXTTS_DAEMON_PY, MISO_DAEMON_PY, _misottsDaemon;
303037
303158
  var init_audio_playback = __esm({
303038
303159
  "packages/execution/dist/tools/audio-playback.js"() {
303039
303160
  "use strict";
@@ -303042,7 +303163,24 @@ var init_audio_playback = __esm({
303042
303163
  init_cuda_device_filter();
303043
303164
  init_model_store();
303044
303165
  init_luxtts_runtime_contract();
303166
+ init_luxtts_device_policy();
303167
+ init_luxtts_gpu_lease();
303045
303168
  init_python_cuda_runtime();
303169
+ _luxttsDaemon = null;
303170
+ _luxttsStartingWorker = null;
303171
+ _luxttsRuntimeLease = null;
303172
+ process.once("exit", () => {
303173
+ const workers = [_luxttsDaemon, _luxttsStartingWorker, _misottsDaemon];
303174
+ for (const worker of workers) {
303175
+ if (!worker)
303176
+ continue;
303177
+ try {
303178
+ worker.kill("SIGKILL");
303179
+ } catch {
303180
+ }
303181
+ }
303182
+ void releaseLuxTtsRuntimeLease();
303183
+ });
303046
303184
  SUPERTONIC_INFER_PY = String.raw`
303047
303185
  import json, sys, traceback
303048
303186
  try:
@@ -303075,27 +303213,41 @@ except Exception as exc:
303075
303213
  sys.exit(1)
303076
303214
  `;
303077
303215
  LUXTTS_DAEMON_PY = String.raw`
303078
- import json, os, sys, traceback, wave
303079
- # OMNIUS_LUXTTS_CPU_ONLY_V1
303080
- os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
303081
- os.environ["HIP_VISIBLE_DEVICES"] = "-1"
303082
- os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
303216
+ # OMNIUS_LUXTTS_DEVICE_POLICY_V1
303217
+ ${LUX_TTS_DEVICE_POLICY_PREAMBLE}
303218
+ import traceback, wave
303083
303219
  import numpy as np
303084
303220
  import torch
303221
+ try:
303222
+ torch.set_num_threads(_CPU_THREADS)
303223
+ except Exception:
303224
+ pass
303085
303225
  repo = os.environ.get("LUXTTS_REPO_PATH") or ""
303086
303226
  if repo:
303087
303227
  sys.path.insert(0, repo)
303088
303228
  from zipvoice.luxvoice import LuxTTS
303089
- device = "cpu"
303090
- tts = LuxTTS(model_path="YatharthS/LuxTTS", device=device, threads=4)
303091
- print(json.dumps({"type": "ready", "device": device}), flush=True)
303229
+ tts = LuxTTS(model_path="YatharthS/LuxTTS", device=_DEVICE, threads=_CPU_THREADS)
303230
+ _mark_runtime_ready(True)
303231
+ print(json.dumps({"type": "ready", "device": _DEVICE}), flush=True)
303092
303232
  for line in sys.stdin:
303233
+ if _yield_requested():
303234
+ _drop_luxtts_model()
303235
+ _acknowledge_yield()
303236
+ _mark_runtime_ready(False)
303237
+ print(json.dumps({"type": "yielded", "device": _DEVICE}), flush=True)
303238
+ break
303093
303239
  if not line.strip():
303094
303240
  continue
303095
303241
  req = json.loads(line)
303096
- if req.get("action") == "quit":
303242
+ if req.get("action") in ("quit", "yield", "release"):
303243
+ if req.get("action") != "quit":
303244
+ _drop_luxtts_model()
303245
+ _acknowledge_yield()
303246
+ _mark_runtime_ready(False)
303247
+ print(json.dumps({"type": "yielded", "id": req.get("id"), "device": _DEVICE}), flush=True)
303097
303248
  break
303098
303249
  rid = req.get("id")
303250
+ _cpu_cap_begin()
303099
303251
  try:
303100
303252
  text = str(req.get("text") or "").strip()
303101
303253
  clone_ref = str(req.get("clone_ref") or "")
@@ -303112,6 +303264,8 @@ for line in sys.stdin:
303112
303264
  print(json.dumps({"type": "result", "id": rid, "path": output}), flush=True)
303113
303265
  except Exception as exc:
303114
303266
  print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
303267
+ finally:
303268
+ _cpu_cap_settle()
303115
303269
  `;
303116
303270
  MISO_DAEMON_PY = String.raw`
303117
303271
  import json, os, sys, traceback
@@ -303162,6 +303316,7 @@ for line in sys.stdin:
303162
303316
  except Exception as exc:
303163
303317
  print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
303164
303318
  `;
303319
+ _misottsDaemon = null;
303165
303320
  }
303166
303321
  });
303167
303322
 
@@ -303945,6 +304100,8 @@ var init_dist5 = __esm({
303945
304100
  init_python_cuda_runtime();
303946
304101
  init_python_cuda_runtime_async();
303947
304102
  init_luxtts_runtime_contract();
304103
+ init_luxtts_device_policy();
304104
+ init_luxtts_gpu_lease();
303948
304105
  init_broker_mediated_backend();
303949
304106
  init_evidence();
303950
304107
  init_process_lifecycle();
@@ -306671,7 +306828,7 @@ async function transition(current, patch, paths) {
306671
306828
  function permissionRemediation(evidence) {
306672
306829
  return /EACCES|EPERM|permission denied/i.test(evidence) ? "The discovered npm global prefix is not writable. Configure a user-owned npm prefix or rerun the explicit update from a privileged terminal; Omnius never silently elevates." : void 0;
306673
306830
  }
306674
- async function quiesceDaemonWithRetry(quiesce, attempts = 3, pauseMs = 250) {
306831
+ async function quiesceWithRetry(quiesce, attempts = 3, pauseMs = 250) {
306675
306832
  const boundedAttempts = Math.max(1, Math.min(5, Math.floor(attempts)));
306676
306833
  for (let attempt = 1; attempt <= boundedAttempts; attempt++) {
306677
306834
  try {
@@ -306685,6 +306842,9 @@ async function quiesceDaemonWithRetry(quiesce, attempts = 3, pauseMs = 250) {
306685
306842
  }
306686
306843
  return false;
306687
306844
  }
306845
+ async function quiesceDaemonWithRetry(quiesce, attempts = 3, pauseMs = 250) {
306846
+ return quiesceWithRetry(quiesce, attempts, pauseMs);
306847
+ }
306688
306848
  async function installGlobalPackageStreaming(input) {
306689
306849
  const result = await runUpdateCommand(input.npmPath, [
306690
306850
  "install",
@@ -306732,6 +306892,8 @@ function restoreOmniusExecutableLink(prefix, installation) {
306732
306892
  async function runVerifiedUpdateTransaction(initial, dependencies, paths = resolveUpdatePaths()) {
306733
306893
  let state = initial;
306734
306894
  let daemonQuiesced = false;
306895
+ let trayQuiesced = false;
306896
+ let trayRestored = false;
306735
306897
  let installStarted = false;
306736
306898
  let installerSettled = true;
306737
306899
  let packageVerified = false;
@@ -306857,6 +307019,15 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
306857
307019
  throwIfCancelled();
306858
307020
  }
306859
307021
  state = await transition(state, { npm_preparation: "ready" }, paths);
307022
+ if (dependencies.quiesceTray) {
307023
+ trayQuiesced = true;
307024
+ state = await transition(state, { phase: "tray_quiescing", tray_quiesced: true }, paths);
307025
+ throwIfCancelled();
307026
+ if (!await quiesceWithRetry(dependencies.quiesceTray)) {
307027
+ throw new Error("Could not safely stop the running Omnius indicator before updating");
307028
+ }
307029
+ throwIfCancelled();
307030
+ }
306860
307031
  if (dependencies.quiesceDaemon) {
306861
307032
  state = await transition(state, { phase: "daemon_quiescing" }, paths);
306862
307033
  throwIfCancelled();
@@ -306952,14 +307123,20 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
306952
307123
  daemon_version: daemon.bootVersion,
306953
307124
  daemon_boot_hash: daemon.bootPackageHash
306954
307125
  }, paths);
306955
- if (state.tray_was_running && dependencies.restartTray) {
307126
+ if (state.tray_was_running) {
306956
307127
  throwIfCancelled();
307128
+ if (!dependencies.restartTray) {
307129
+ throw new Error("The running indicator was stopped but no verified restart path is available");
307130
+ }
306957
307131
  state = await transition(state, { phase: "tray_restarting" }, paths);
306958
307132
  throwIfCancelled();
306959
307133
  if (!await dependencies.restartTray(evidence.executablePath)) {
306960
307134
  throw new Error("The package and daemon updated, but the running tray could not be relaunched");
306961
307135
  }
306962
- state = await transition(state, { tray_restarted: true }, paths);
307136
+ trayRestored = true;
307137
+ state = await transition(state, { tray_restarted: true, tray_restore_receipt: "live" }, paths);
307138
+ } else {
307139
+ state = await transition(state, { tray_was_running: false, tray_restore_receipt: "no-tray" }, paths);
306963
307140
  }
306964
307141
  throwIfCancelled();
306965
307142
  try {
@@ -307127,15 +307304,37 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
307127
307304
  };
307128
307305
  const recovered = await dependencies.recoverDaemon(recoveryTarget);
307129
307306
  recoveryNote = recovered ? "The daemon was restarted after the interrupted update." : "The daemon could not be recovered automatically after the failed update.";
307130
- if (rolledBack && state.tray_was_running && dependencies.restartTray && state.global_executable) {
307131
- recoveryNote += await dependencies.restartTray(state.global_executable).catch(() => false) ? " The indicator was relaunched on the restored version." : " The indicator could not be relaunched on the restored version.";
307132
- }
307133
307307
  } catch (recoveryError) {
307134
307308
  recoveryNote = `Daemon recovery failed: ${recoveryError instanceof Error ? recoveryError.message : String(recoveryError)}`;
307135
307309
  }
307136
307310
  } else if ((daemonQuiesced || interruptedAfterRelease) && dependencies.recoverDaemon) {
307137
307311
  recoveryNote = "Daemon recovery was held because the installed runtime could not be verified.";
307138
307312
  }
307313
+ if (trayQuiesced && state.tray_was_running && !trayRestored && dependencies.restartTray) {
307314
+ const restoreExecutable = state.global_executable ?? recoveryInstallation?.executablePath ?? (previousInstallation && state.npm_prefix ? globalExecutableCandidates(state.npm_prefix).find(existsSync8) : void 0);
307315
+ const appendTrayNote = (note) => {
307316
+ recoveryNote = [recoveryNote, note].filter(Boolean).join(" ");
307317
+ };
307318
+ if (restoreExecutable && existsSync8(restoreExecutable)) {
307319
+ try {
307320
+ state = await transition(state, { phase: "recovering" }, paths);
307321
+ if (await dependencies.restartTray(restoreExecutable)) {
307322
+ trayRestored = true;
307323
+ state = await transition(state, { tray_restarted: true, tray_restore_receipt: "live" }, paths);
307324
+ appendTrayNote("The indicator was relaunched on the restored version.");
307325
+ } else {
307326
+ state = await transition(state, { tray_restore_receipt: "unavailable" }, paths);
307327
+ appendTrayNote("The indicator could not be relaunched on the restored version.");
307328
+ }
307329
+ } catch (trayError) {
307330
+ state = await transition(state, { tray_restore_receipt: "unavailable" }, paths);
307331
+ appendTrayNote(`Indicator recovery failed: ${trayError instanceof Error ? trayError.message : String(trayError)}`);
307332
+ }
307333
+ } else {
307334
+ state = await transition(state, { tray_restore_receipt: "unavailable" }, paths);
307335
+ appendTrayNote("The indicator could not be relaunched because no verified executable is available.");
307336
+ }
307337
+ }
307139
307338
  state = await transition(state, {
307140
307339
  status: cancelled ? "cancelled" : "failed",
307141
307340
  phase: cancelled ? "cancelled" : "failed",
@@ -308140,11 +308339,19 @@ function restartTrayServiceUnit(unit, env = process.env) {
308140
308339
  );
308141
308340
  });
308142
308341
  }
308342
+ function stopTrayServiceUnit(unit, env = process.env, exec2 = execFile5) {
308343
+ return new Promise((resolve13) => {
308344
+ exec2(
308345
+ "systemctl",
308346
+ ["--user", "stop", unit],
308347
+ { env: userManagerEnvironment(env), timeout: 15e3 },
308348
+ (error) => resolve13(!error)
308349
+ );
308350
+ });
308351
+ }
308143
308352
 
308144
308353
  // packages/cli/src/update-worker-runtime.ts
308145
- async function restartTrayWithInstalledExecutable(executable, endpoint) {
308146
- const previous = await getTrayStatus(endpoint);
308147
- const unit = previous.pid ? trayServiceUnitForPid(previous.pid) : void 0;
308354
+ async function restartTrayWithInstalledExecutable(executable, endpoint, previous, unit) {
308148
308355
  const launched = unit ? await restartTrayServiceUnit(unit) : await launchDetachedTray(executable, endpoint);
308149
308356
  if (!launched) return false;
308150
308357
  for (let attempt = 0; attempt < 60; attempt++) {
@@ -308203,7 +308410,9 @@ async function runUpdateWorkerRuntime(state, paths, endpoint) {
308203
308410
  };
308204
308411
  try {
308205
308412
  const port = Number(new URL(endpoint).port || "11435");
308206
- const trayWasRunning = state.tray_was_running || !cancellation.signal.aborted && (await getTrayStatus(endpoint)).running;
308413
+ const previousTray = await getTrayStatus(endpoint);
308414
+ const trayWasRunning = state.tray_was_running || !cancellation.signal.aborted && previousTray.running;
308415
+ const trayUnit = previousTray.pid ? trayServiceUnitForPid(previousTray.pid) ?? void 0 : void 0;
308207
308416
  state.tray_was_running = trayWasRunning;
308208
308417
  let daemonScope;
308209
308418
  const finalState = await runVerifiedUpdateTransaction(
@@ -308218,6 +308427,15 @@ async function runUpdateWorkerRuntime(state, paths, endpoint) {
308218
308427
  }
308219
308428
  return quiesceDaemonForUpdate(port, daemonScope);
308220
308429
  },
308430
+ quiesceTray: trayWasRunning ? async () => {
308431
+ const current = await getTrayStatus(endpoint);
308432
+ if (!current.running) {
308433
+ return trayUnit ? stopTrayServiceUnit(trayUnit) : true;
308434
+ }
308435
+ const unit = current.pid ? trayServiceUnitForPid(current.pid) ?? trayUnit ?? void 0 : trayUnit ?? void 0;
308436
+ const stopped = unit ? await stopTrayServiceUnit(unit) : await stopTray();
308437
+ return stopped && !(await getTrayStatus(endpoint)).running;
308438
+ } : void 0,
308221
308439
  restartDaemon: (expected, executable) => restartDaemon(port, expected, executable, daemonScope),
308222
308440
  recoverDaemon: async (target) => {
308223
308441
  await restartDaemon(port, target?.version, target?.executablePath, daemonScope);
@@ -308231,7 +308449,7 @@ async function runUpdateWorkerRuntime(state, paths, endpoint) {
308231
308449
  bootPackageHash: identity.bootPackageHash
308232
308450
  } : null;
308233
308451
  },
308234
- restartTray: trayWasRunning ? (executable) => restartTrayWithInstalledExecutable(executable, endpoint) : void 0,
308452
+ restartTray: trayWasRunning ? (executable) => restartTrayWithInstalledExecutable(executable, endpoint, previousTray, trayUnit) : void 0,
308235
308453
  // A daemon that boots but crashes shortly after is an update failure.
308236
308454
  stabilityWindowMs: 15e3,
308237
308455
  signal: cancellation.signal
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.980",
3
+ "version": "1.0.981",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.980",
9
+ "version": "1.0.981",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.980",
3
+ "version": "1.0.981",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/library.js",