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.
- package/dist/api/py-embed.js +159 -18
- package/dist/index.js +2 -2
- package/dist/library.js +320 -127
- package/dist/omni-setup-worker.js +159 -18
- package/dist/postinstall-daemon.cjs +6 -3
- package/dist/update-worker-runtime.js +248 -30
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -32833,6 +32833,233 @@ var init_luxtts_runtime_contract = __esm({
|
|
|
32833
32833
|
}
|
|
32834
32834
|
});
|
|
32835
32835
|
|
|
32836
|
+
// packages/execution/dist/tools/cuda-device-filter.js
|
|
32837
|
+
function cleanEnvValue(value) {
|
|
32838
|
+
const trimmed = value?.trim();
|
|
32839
|
+
return trimmed ? trimmed : void 0;
|
|
32840
|
+
}
|
|
32841
|
+
function envFlagEnabled(value) {
|
|
32842
|
+
return /^(1|true|yes|on)$/i.test(value?.trim() ?? "");
|
|
32843
|
+
}
|
|
32844
|
+
function parseCudaComputeCapability(value) {
|
|
32845
|
+
const match2 = value?.match(/(\d+(?:\.\d+)?)/);
|
|
32846
|
+
if (!match2)
|
|
32847
|
+
return null;
|
|
32848
|
+
const parsed = Number(match2[1]);
|
|
32849
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
32850
|
+
}
|
|
32851
|
+
function modalityEnvPrefix(modality) {
|
|
32852
|
+
return `OMNIUS_${modality.toUpperCase()}`;
|
|
32853
|
+
}
|
|
32854
|
+
function parseMinCudaComputeCapability(modality, env) {
|
|
32855
|
+
const prefix2 = modalityEnvPrefix(modality);
|
|
32856
|
+
const parsed = parseCudaComputeCapability(env[`${prefix2}_MIN_CUDA_CC`]) ?? parseCudaComputeCapability(env["OMNIUS_MEDIA_MIN_CUDA_CC"]);
|
|
32857
|
+
return parsed && parsed > 0 ? parsed : DEFAULT_MEDIA_MIN_CUDA_COMPUTE_CAPABILITY;
|
|
32858
|
+
}
|
|
32859
|
+
function splitCudaVisibleDevices(value) {
|
|
32860
|
+
return (value ?? "").split(",").map((part) => part.trim()).filter(Boolean);
|
|
32861
|
+
}
|
|
32862
|
+
function parseCudaDeviceInfo(text20) {
|
|
32863
|
+
const devices = [];
|
|
32864
|
+
for (const line of text20.split(/\r?\n/)) {
|
|
32865
|
+
const trimmed = line.trim();
|
|
32866
|
+
if (!trimmed)
|
|
32867
|
+
continue;
|
|
32868
|
+
const parts = trimmed.split(",").map((part) => part.trim());
|
|
32869
|
+
if (parts.length < 4)
|
|
32870
|
+
continue;
|
|
32871
|
+
const index = Number.parseInt(parts.shift() ?? "", 10);
|
|
32872
|
+
const capability = parseCudaComputeCapability(parts.pop());
|
|
32873
|
+
const uuid = cleanEnvValue(parts.shift());
|
|
32874
|
+
const name = cleanEnvValue(parts.join(", "));
|
|
32875
|
+
if (!Number.isFinite(index) || index < 0)
|
|
32876
|
+
continue;
|
|
32877
|
+
devices.push({ index, uuid, name, computeCapability: capability });
|
|
32878
|
+
}
|
|
32879
|
+
return devices;
|
|
32880
|
+
}
|
|
32881
|
+
function detectCudaDevices() {
|
|
32882
|
+
if (!cudaDeviceRefreshInFlight) {
|
|
32883
|
+
cudaDeviceRefreshInFlight = execFileText("nvidia-smi", ["--query-gpu=index,uuid,name,compute_cap", "--format=csv,noheader,nounits"], { timeout: 5e3 }).then((out) => {
|
|
32884
|
+
cachedCudaDevices = parseCudaDeviceInfo(out);
|
|
32885
|
+
}).catch(() => {
|
|
32886
|
+
cachedCudaDevices = [];
|
|
32887
|
+
}).finally(() => {
|
|
32888
|
+
cudaDeviceRefreshInFlight = null;
|
|
32889
|
+
});
|
|
32890
|
+
}
|
|
32891
|
+
return cachedCudaDevices ?? [];
|
|
32892
|
+
}
|
|
32893
|
+
function resolveMediaCudaVisibleDevicesForEnv(args) {
|
|
32894
|
+
const env = args.env ?? process.env;
|
|
32895
|
+
const prefix2 = modalityEnvPrefix(args.modality);
|
|
32896
|
+
const enabledUuids = enabledGpuUuidsFromEnv(env);
|
|
32897
|
+
const explicit = cleanEnvValue(env[`${prefix2}_CUDA_VISIBLE_DEVICES`]) ?? cleanEnvValue(env["OMNIUS_MEDIA_CUDA_VISIBLE_DEVICES"]) ?? (args.modality === "audio" ? cleanEnvValue(env["OMNIUS_AUDIO_GPU"]) : void 0);
|
|
32898
|
+
const hasCurrent = Object.prototype.hasOwnProperty.call(env, "CUDA_VISIBLE_DEVICES");
|
|
32899
|
+
const current6 = cleanEnvValue(env["CUDA_VISIBLE_DEVICES"]);
|
|
32900
|
+
if (enabledUuids?.length === 0 || hasCurrent && !current6)
|
|
32901
|
+
return "";
|
|
32902
|
+
if (explicit && enabledUuids === void 0)
|
|
32903
|
+
return explicit;
|
|
32904
|
+
if (envFlagEnabled(env[`${prefix2}_DISABLE_CUDA_FILTER`]) || envFlagEnabled(env["OMNIUS_MEDIA_DISABLE_CUDA_FILTER"])) {
|
|
32905
|
+
if (enabledUuids === void 0)
|
|
32906
|
+
return explicit ?? current6;
|
|
32907
|
+
}
|
|
32908
|
+
const devices = filterGpusByEnabledUuids(args.devices ?? detectCudaDevices(), enabledUuids);
|
|
32909
|
+
const minComputeCapability = args.minComputeCapability ?? parseMinCudaComputeCapability(args.modality, env);
|
|
32910
|
+
const compatible = devices.filter((device) => device.computeCapability !== null && device.computeCapability >= minComputeCapability);
|
|
32911
|
+
if (compatible.length === 0) {
|
|
32912
|
+
return enabledUuids !== void 0 || explicit !== void 0 || hasCurrent ? "" : void 0;
|
|
32913
|
+
}
|
|
32914
|
+
const compatibleTokens = /* @__PURE__ */ new Set();
|
|
32915
|
+
for (const device of compatible) {
|
|
32916
|
+
compatibleTokens.add(String(device.index));
|
|
32917
|
+
if (device.uuid)
|
|
32918
|
+
compatibleTokens.add(device.uuid);
|
|
32919
|
+
}
|
|
32920
|
+
const requestedMask = explicit ?? current6;
|
|
32921
|
+
if (requestedMask) {
|
|
32922
|
+
const requested = splitCudaVisibleDevices(requestedMask);
|
|
32923
|
+
const canFilter = requested.length > 0 && requested.every((token5) => /^\d+$/.test(token5) || token5.startsWith("GPU-"));
|
|
32924
|
+
if (!canFilter)
|
|
32925
|
+
return enabledUuids === void 0 ? requestedMask : "";
|
|
32926
|
+
const kept = requested.filter((token5) => compatibleTokens.has(token5));
|
|
32927
|
+
return kept.join(",");
|
|
32928
|
+
}
|
|
32929
|
+
return compatible.map((device) => enabledUuids !== void 0 ? device.uuid ?? String(device.index) : String(device.index)).join(",");
|
|
32930
|
+
}
|
|
32931
|
+
function applyMediaCudaDeviceFilterToEnv(env, modality) {
|
|
32932
|
+
const cudaVisibleDevices = resolveMediaCudaVisibleDevicesForEnv({ modality, env });
|
|
32933
|
+
if (cudaVisibleDevices !== void 0) {
|
|
32934
|
+
env["CUDA_VISIBLE_DEVICES"] = cudaVisibleDevices;
|
|
32935
|
+
if (cudaVisibleDevices) {
|
|
32936
|
+
env["PYTORCH_NVML_BASED_CUDA_CHECK"] = process.env["PYTORCH_NVML_BASED_CUDA_CHECK"] ?? "1";
|
|
32937
|
+
}
|
|
32938
|
+
}
|
|
32939
|
+
return env;
|
|
32940
|
+
}
|
|
32941
|
+
var DEFAULT_MEDIA_MIN_CUDA_COMPUTE_CAPABILITY, cachedCudaDevices, cudaDeviceRefreshInFlight;
|
|
32942
|
+
var init_cuda_device_filter = __esm({
|
|
32943
|
+
"packages/execution/dist/tools/cuda-device-filter.js"() {
|
|
32944
|
+
"use strict";
|
|
32945
|
+
init_process_async();
|
|
32946
|
+
init_gpu_selection2();
|
|
32947
|
+
DEFAULT_MEDIA_MIN_CUDA_COMPUTE_CAPABILITY = 7.5;
|
|
32948
|
+
cachedCudaDevices = null;
|
|
32949
|
+
cudaDeviceRefreshInFlight = null;
|
|
32950
|
+
}
|
|
32951
|
+
});
|
|
32952
|
+
|
|
32953
|
+
// packages/execution/dist/luxtts-device-policy.js
|
|
32954
|
+
var LUX_TTS_DEVICE_POLICY_PREAMBLE;
|
|
32955
|
+
var init_luxtts_device_policy = __esm({
|
|
32956
|
+
"packages/execution/dist/luxtts-device-policy.js"() {
|
|
32957
|
+
"use strict";
|
|
32958
|
+
init_cuda_device_filter();
|
|
32959
|
+
LUX_TTS_DEVICE_POLICY_PREAMBLE = String.raw`
|
|
32960
|
+
# OMNIUS_LUXTTS_DEVICE_POLICY_V1
|
|
32961
|
+
import gc, json, os, signal, time
|
|
32962
|
+
_POLICY = json.loads(os.environ.get("OMNIUS_LUXTTS_DEVICE_POLICY", "{}"))
|
|
32963
|
+
_DEVICE = str(_POLICY.get("device") or "cpu")
|
|
32964
|
+
_GPU_TOKEN = str(_POLICY.get("gpuUuid") or "")
|
|
32965
|
+
_CPU_CAP = max(0.01, float(_POLICY.get("cpuPercent") or 80) / 100.0)
|
|
32966
|
+
_CPU_THREADS = max(1, min(8, int(_POLICY.get("cpuThreads") or 1)))
|
|
32967
|
+
if _DEVICE == "cuda":
|
|
32968
|
+
if _GPU_TOKEN and not _POLICY.get("brokerManaged"):
|
|
32969
|
+
os.environ["CUDA_VISIBLE_DEVICES"] = _GPU_TOKEN
|
|
32970
|
+
os.environ["HIP_VISIBLE_DEVICES"] = "-1"
|
|
32971
|
+
os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
|
|
32972
|
+
os.environ.pop("NVIDIA_VISIBLE_DEVICES", None)
|
|
32973
|
+
else:
|
|
32974
|
+
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
|
32975
|
+
os.environ["HIP_VISIBLE_DEVICES"] = "-1"
|
|
32976
|
+
os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
|
|
32977
|
+
os.environ["NVIDIA_VISIBLE_DEVICES"] = "none"
|
|
32978
|
+
|
|
32979
|
+
_YIELD_REQUESTED = False
|
|
32980
|
+
_CPU_BUDGET = {"wall": None, "cpu": None}
|
|
32981
|
+
|
|
32982
|
+
def _handle_voice_stop(_signum, _frame):
|
|
32983
|
+
global _YIELD_REQUESTED
|
|
32984
|
+
_YIELD_REQUESTED = True
|
|
32985
|
+
|
|
32986
|
+
try:
|
|
32987
|
+
signal.signal(signal.SIGTERM, _handle_voice_stop)
|
|
32988
|
+
except Exception:
|
|
32989
|
+
pass
|
|
32990
|
+
|
|
32991
|
+
def _yield_requested():
|
|
32992
|
+
if _YIELD_REQUESTED or _POLICY.get("yieldRequested"):
|
|
32993
|
+
return True
|
|
32994
|
+
drain = os.environ.get("OMNIUS_LUXTTS_DRAIN_FILE", "")
|
|
32995
|
+
return bool(drain and os.path.exists(drain))
|
|
32996
|
+
|
|
32997
|
+
def _acknowledge_yield():
|
|
32998
|
+
ack = os.environ.get("OMNIUS_LUXTTS_DRAIN_ACK", "")
|
|
32999
|
+
if not ack:
|
|
33000
|
+
return
|
|
33001
|
+
try:
|
|
33002
|
+
with open(ack, "w") as handle:
|
|
33003
|
+
handle.write("yielded")
|
|
33004
|
+
except Exception:
|
|
33005
|
+
pass
|
|
33006
|
+
|
|
33007
|
+
def _mark_runtime_ready(ready=True):
|
|
33008
|
+
path = os.environ.get("OMNIUS_LUXTTS_READY_FILE", "")
|
|
33009
|
+
if not path:
|
|
33010
|
+
return
|
|
33011
|
+
try:
|
|
33012
|
+
if ready:
|
|
33013
|
+
with open(path, "w") as handle:
|
|
33014
|
+
handle.write("ready")
|
|
33015
|
+
elif os.path.exists(path):
|
|
33016
|
+
os.unlink(path)
|
|
33017
|
+
except Exception:
|
|
33018
|
+
pass
|
|
33019
|
+
|
|
33020
|
+
def _cpu_cap_begin():
|
|
33021
|
+
_CPU_BUDGET["wall"] = time.monotonic()
|
|
33022
|
+
_CPU_BUDGET["cpu"] = time.process_time()
|
|
33023
|
+
|
|
33024
|
+
def _cpu_cap_settle():
|
|
33025
|
+
wall_started = _CPU_BUDGET.get("wall")
|
|
33026
|
+
cpu_started = _CPU_BUDGET.get("cpu")
|
|
33027
|
+
_CPU_BUDGET["wall"] = None
|
|
33028
|
+
_CPU_BUDGET["cpu"] = None
|
|
33029
|
+
if wall_started is None or cpu_started is None:
|
|
33030
|
+
return
|
|
33031
|
+
wall = max(0.001, time.monotonic() - wall_started)
|
|
33032
|
+
cpu = max(0.0, time.process_time() - cpu_started)
|
|
33033
|
+
required_wall = cpu / _CPU_CAP
|
|
33034
|
+
debt = required_wall - wall
|
|
33035
|
+
if debt > 0:
|
|
33036
|
+
time.sleep(min(debt, 600.0))
|
|
33037
|
+
|
|
33038
|
+
def _drop_luxtts_model():
|
|
33039
|
+
for _name in ("tts", "prompt_cache"):
|
|
33040
|
+
globals().pop(_name, None)
|
|
33041
|
+
gc.collect()
|
|
33042
|
+
try:
|
|
33043
|
+
import torch
|
|
33044
|
+
if torch.cuda.is_available():
|
|
33045
|
+
torch.cuda.synchronize()
|
|
33046
|
+
torch.cuda.empty_cache()
|
|
33047
|
+
except Exception:
|
|
33048
|
+
pass
|
|
33049
|
+
`;
|
|
33050
|
+
}
|
|
33051
|
+
});
|
|
33052
|
+
|
|
33053
|
+
// packages/execution/dist/luxtts-gpu-lease.js
|
|
33054
|
+
var init_luxtts_gpu_lease = __esm({
|
|
33055
|
+
"packages/execution/dist/luxtts-gpu-lease.js"() {
|
|
33056
|
+
"use strict";
|
|
33057
|
+
init_process_async();
|
|
33058
|
+
init_model_broker();
|
|
33059
|
+
init_luxtts_device_policy();
|
|
33060
|
+
}
|
|
33061
|
+
});
|
|
33062
|
+
|
|
32836
33063
|
// packages/execution/dist/broker-mediated-backend.js
|
|
32837
33064
|
var init_broker_mediated_backend = __esm({
|
|
32838
33065
|
"packages/execution/dist/broker-mediated-backend.js"() {
|
|
@@ -85646,123 +85873,6 @@ var init_playwright_download = __esm({
|
|
|
85646
85873
|
}
|
|
85647
85874
|
});
|
|
85648
85875
|
|
|
85649
|
-
// packages/execution/dist/tools/cuda-device-filter.js
|
|
85650
|
-
function cleanEnvValue(value) {
|
|
85651
|
-
const trimmed = value?.trim();
|
|
85652
|
-
return trimmed ? trimmed : void 0;
|
|
85653
|
-
}
|
|
85654
|
-
function envFlagEnabled(value) {
|
|
85655
|
-
return /^(1|true|yes|on)$/i.test(value?.trim() ?? "");
|
|
85656
|
-
}
|
|
85657
|
-
function parseCudaComputeCapability(value) {
|
|
85658
|
-
const match2 = value?.match(/(\d+(?:\.\d+)?)/);
|
|
85659
|
-
if (!match2)
|
|
85660
|
-
return null;
|
|
85661
|
-
const parsed = Number(match2[1]);
|
|
85662
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
85663
|
-
}
|
|
85664
|
-
function modalityEnvPrefix(modality) {
|
|
85665
|
-
return `OMNIUS_${modality.toUpperCase()}`;
|
|
85666
|
-
}
|
|
85667
|
-
function parseMinCudaComputeCapability(modality, env) {
|
|
85668
|
-
const prefix2 = modalityEnvPrefix(modality);
|
|
85669
|
-
const parsed = parseCudaComputeCapability(env[`${prefix2}_MIN_CUDA_CC`]) ?? parseCudaComputeCapability(env["OMNIUS_MEDIA_MIN_CUDA_CC"]);
|
|
85670
|
-
return parsed && parsed > 0 ? parsed : DEFAULT_MEDIA_MIN_CUDA_COMPUTE_CAPABILITY;
|
|
85671
|
-
}
|
|
85672
|
-
function splitCudaVisibleDevices(value) {
|
|
85673
|
-
return (value ?? "").split(",").map((part) => part.trim()).filter(Boolean);
|
|
85674
|
-
}
|
|
85675
|
-
function parseCudaDeviceInfo(text20) {
|
|
85676
|
-
const devices = [];
|
|
85677
|
-
for (const line of text20.split(/\r?\n/)) {
|
|
85678
|
-
const trimmed = line.trim();
|
|
85679
|
-
if (!trimmed)
|
|
85680
|
-
continue;
|
|
85681
|
-
const parts = trimmed.split(",").map((part) => part.trim());
|
|
85682
|
-
if (parts.length < 4)
|
|
85683
|
-
continue;
|
|
85684
|
-
const index = Number.parseInt(parts.shift() ?? "", 10);
|
|
85685
|
-
const capability = parseCudaComputeCapability(parts.pop());
|
|
85686
|
-
const uuid = cleanEnvValue(parts.shift());
|
|
85687
|
-
const name = cleanEnvValue(parts.join(", "));
|
|
85688
|
-
if (!Number.isFinite(index) || index < 0)
|
|
85689
|
-
continue;
|
|
85690
|
-
devices.push({ index, uuid, name, computeCapability: capability });
|
|
85691
|
-
}
|
|
85692
|
-
return devices;
|
|
85693
|
-
}
|
|
85694
|
-
function detectCudaDevices() {
|
|
85695
|
-
if (!cudaDeviceRefreshInFlight) {
|
|
85696
|
-
cudaDeviceRefreshInFlight = execFileText("nvidia-smi", ["--query-gpu=index,uuid,name,compute_cap", "--format=csv,noheader,nounits"], { timeout: 5e3 }).then((out) => {
|
|
85697
|
-
cachedCudaDevices = parseCudaDeviceInfo(out);
|
|
85698
|
-
}).catch(() => {
|
|
85699
|
-
cachedCudaDevices = [];
|
|
85700
|
-
}).finally(() => {
|
|
85701
|
-
cudaDeviceRefreshInFlight = null;
|
|
85702
|
-
});
|
|
85703
|
-
}
|
|
85704
|
-
return cachedCudaDevices ?? [];
|
|
85705
|
-
}
|
|
85706
|
-
function resolveMediaCudaVisibleDevicesForEnv(args) {
|
|
85707
|
-
const env = args.env ?? process.env;
|
|
85708
|
-
const prefix2 = modalityEnvPrefix(args.modality);
|
|
85709
|
-
const enabledUuids = enabledGpuUuidsFromEnv(env);
|
|
85710
|
-
const explicit = cleanEnvValue(env[`${prefix2}_CUDA_VISIBLE_DEVICES`]) ?? cleanEnvValue(env["OMNIUS_MEDIA_CUDA_VISIBLE_DEVICES"]) ?? (args.modality === "audio" ? cleanEnvValue(env["OMNIUS_AUDIO_GPU"]) : void 0);
|
|
85711
|
-
const hasCurrent = Object.prototype.hasOwnProperty.call(env, "CUDA_VISIBLE_DEVICES");
|
|
85712
|
-
const current6 = cleanEnvValue(env["CUDA_VISIBLE_DEVICES"]);
|
|
85713
|
-
if (enabledUuids?.length === 0 || hasCurrent && !current6)
|
|
85714
|
-
return "";
|
|
85715
|
-
if (explicit && enabledUuids === void 0)
|
|
85716
|
-
return explicit;
|
|
85717
|
-
if (envFlagEnabled(env[`${prefix2}_DISABLE_CUDA_FILTER`]) || envFlagEnabled(env["OMNIUS_MEDIA_DISABLE_CUDA_FILTER"])) {
|
|
85718
|
-
if (enabledUuids === void 0)
|
|
85719
|
-
return explicit ?? current6;
|
|
85720
|
-
}
|
|
85721
|
-
const devices = filterGpusByEnabledUuids(args.devices ?? detectCudaDevices(), enabledUuids);
|
|
85722
|
-
const minComputeCapability = args.minComputeCapability ?? parseMinCudaComputeCapability(args.modality, env);
|
|
85723
|
-
const compatible = devices.filter((device) => device.computeCapability !== null && device.computeCapability >= minComputeCapability);
|
|
85724
|
-
if (compatible.length === 0) {
|
|
85725
|
-
return enabledUuids !== void 0 || explicit !== void 0 || hasCurrent ? "" : void 0;
|
|
85726
|
-
}
|
|
85727
|
-
const compatibleTokens = /* @__PURE__ */ new Set();
|
|
85728
|
-
for (const device of compatible) {
|
|
85729
|
-
compatibleTokens.add(String(device.index));
|
|
85730
|
-
if (device.uuid)
|
|
85731
|
-
compatibleTokens.add(device.uuid);
|
|
85732
|
-
}
|
|
85733
|
-
const requestedMask = explicit ?? current6;
|
|
85734
|
-
if (requestedMask) {
|
|
85735
|
-
const requested = splitCudaVisibleDevices(requestedMask);
|
|
85736
|
-
const canFilter = requested.length > 0 && requested.every((token5) => /^\d+$/.test(token5) || token5.startsWith("GPU-"));
|
|
85737
|
-
if (!canFilter)
|
|
85738
|
-
return enabledUuids === void 0 ? requestedMask : "";
|
|
85739
|
-
const kept = requested.filter((token5) => compatibleTokens.has(token5));
|
|
85740
|
-
return kept.join(",");
|
|
85741
|
-
}
|
|
85742
|
-
return compatible.map((device) => enabledUuids !== void 0 ? device.uuid ?? String(device.index) : String(device.index)).join(",");
|
|
85743
|
-
}
|
|
85744
|
-
function applyMediaCudaDeviceFilterToEnv(env, modality) {
|
|
85745
|
-
const cudaVisibleDevices = resolveMediaCudaVisibleDevicesForEnv({ modality, env });
|
|
85746
|
-
if (cudaVisibleDevices !== void 0) {
|
|
85747
|
-
env["CUDA_VISIBLE_DEVICES"] = cudaVisibleDevices;
|
|
85748
|
-
if (cudaVisibleDevices) {
|
|
85749
|
-
env["PYTORCH_NVML_BASED_CUDA_CHECK"] = process.env["PYTORCH_NVML_BASED_CUDA_CHECK"] ?? "1";
|
|
85750
|
-
}
|
|
85751
|
-
}
|
|
85752
|
-
return env;
|
|
85753
|
-
}
|
|
85754
|
-
var DEFAULT_MEDIA_MIN_CUDA_COMPUTE_CAPABILITY, cachedCudaDevices, cudaDeviceRefreshInFlight;
|
|
85755
|
-
var init_cuda_device_filter = __esm({
|
|
85756
|
-
"packages/execution/dist/tools/cuda-device-filter.js"() {
|
|
85757
|
-
"use strict";
|
|
85758
|
-
init_process_async();
|
|
85759
|
-
init_gpu_selection2();
|
|
85760
|
-
DEFAULT_MEDIA_MIN_CUDA_COMPUTE_CAPABILITY = 7.5;
|
|
85761
|
-
cachedCudaDevices = null;
|
|
85762
|
-
cudaDeviceRefreshInFlight = null;
|
|
85763
|
-
}
|
|
85764
|
-
});
|
|
85765
|
-
|
|
85766
85876
|
// packages/execution/dist/tools/camera-capture.js
|
|
85767
85877
|
var DEFAULT_CAMERA_PROFILE, CAMERA_PROFILES;
|
|
85768
85878
|
var init_camera_capture = __esm({
|
|
@@ -343043,7 +343153,18 @@ var init_audio_capture = __esm({
|
|
|
343043
343153
|
});
|
|
343044
343154
|
|
|
343045
343155
|
// packages/execution/dist/tools/audio-playback.js
|
|
343046
|
-
|
|
343156
|
+
async function releaseLuxTtsRuntimeLease() {
|
|
343157
|
+
const lease = _luxttsRuntimeLease;
|
|
343158
|
+
_luxttsRuntimeLease = null;
|
|
343159
|
+
if (!lease)
|
|
343160
|
+
return;
|
|
343161
|
+
lease.signalRelease?.();
|
|
343162
|
+
if (lease.settleRelease)
|
|
343163
|
+
await lease.settleRelease();
|
|
343164
|
+
else
|
|
343165
|
+
await lease.release();
|
|
343166
|
+
}
|
|
343167
|
+
var _luxttsDaemon, _luxttsStartingWorker, _luxttsRuntimeLease, SUPERTONIC_INFER_PY, LUXTTS_DAEMON_PY, MISO_DAEMON_PY, _misottsDaemon;
|
|
343047
343168
|
var init_audio_playback = __esm({
|
|
343048
343169
|
"packages/execution/dist/tools/audio-playback.js"() {
|
|
343049
343170
|
"use strict";
|
|
@@ -343052,7 +343173,24 @@ var init_audio_playback = __esm({
|
|
|
343052
343173
|
init_cuda_device_filter();
|
|
343053
343174
|
init_model_store();
|
|
343054
343175
|
init_luxtts_runtime_contract();
|
|
343176
|
+
init_luxtts_device_policy();
|
|
343177
|
+
init_luxtts_gpu_lease();
|
|
343055
343178
|
init_python_cuda_runtime();
|
|
343179
|
+
_luxttsDaemon = null;
|
|
343180
|
+
_luxttsStartingWorker = null;
|
|
343181
|
+
_luxttsRuntimeLease = null;
|
|
343182
|
+
process.once("exit", () => {
|
|
343183
|
+
const workers = [_luxttsDaemon, _luxttsStartingWorker, _misottsDaemon];
|
|
343184
|
+
for (const worker of workers) {
|
|
343185
|
+
if (!worker)
|
|
343186
|
+
continue;
|
|
343187
|
+
try {
|
|
343188
|
+
worker.kill("SIGKILL");
|
|
343189
|
+
} catch {
|
|
343190
|
+
}
|
|
343191
|
+
}
|
|
343192
|
+
void releaseLuxTtsRuntimeLease();
|
|
343193
|
+
});
|
|
343056
343194
|
SUPERTONIC_INFER_PY = String.raw`
|
|
343057
343195
|
import json, sys, traceback
|
|
343058
343196
|
try:
|
|
@@ -343085,27 +343223,41 @@ except Exception as exc:
|
|
|
343085
343223
|
sys.exit(1)
|
|
343086
343224
|
`;
|
|
343087
343225
|
LUXTTS_DAEMON_PY = String.raw`
|
|
343088
|
-
|
|
343089
|
-
|
|
343090
|
-
|
|
343091
|
-
os.environ["HIP_VISIBLE_DEVICES"] = "-1"
|
|
343092
|
-
os.environ["ROCR_VISIBLE_DEVICES"] = "-1"
|
|
343226
|
+
# OMNIUS_LUXTTS_DEVICE_POLICY_V1
|
|
343227
|
+
${LUX_TTS_DEVICE_POLICY_PREAMBLE}
|
|
343228
|
+
import traceback, wave
|
|
343093
343229
|
import numpy as np
|
|
343094
343230
|
import torch
|
|
343231
|
+
try:
|
|
343232
|
+
torch.set_num_threads(_CPU_THREADS)
|
|
343233
|
+
except Exception:
|
|
343234
|
+
pass
|
|
343095
343235
|
repo = os.environ.get("LUXTTS_REPO_PATH") or ""
|
|
343096
343236
|
if repo:
|
|
343097
343237
|
sys.path.insert(0, repo)
|
|
343098
343238
|
from zipvoice.luxvoice import LuxTTS
|
|
343099
|
-
|
|
343100
|
-
|
|
343101
|
-
print(json.dumps({"type": "ready", "device":
|
|
343239
|
+
tts = LuxTTS(model_path="YatharthS/LuxTTS", device=_DEVICE, threads=_CPU_THREADS)
|
|
343240
|
+
_mark_runtime_ready(True)
|
|
343241
|
+
print(json.dumps({"type": "ready", "device": _DEVICE}), flush=True)
|
|
343102
343242
|
for line in sys.stdin:
|
|
343243
|
+
if _yield_requested():
|
|
343244
|
+
_drop_luxtts_model()
|
|
343245
|
+
_acknowledge_yield()
|
|
343246
|
+
_mark_runtime_ready(False)
|
|
343247
|
+
print(json.dumps({"type": "yielded", "device": _DEVICE}), flush=True)
|
|
343248
|
+
break
|
|
343103
343249
|
if not line.strip():
|
|
343104
343250
|
continue
|
|
343105
343251
|
req = json.loads(line)
|
|
343106
|
-
if req.get("action")
|
|
343252
|
+
if req.get("action") in ("quit", "yield", "release"):
|
|
343253
|
+
if req.get("action") != "quit":
|
|
343254
|
+
_drop_luxtts_model()
|
|
343255
|
+
_acknowledge_yield()
|
|
343256
|
+
_mark_runtime_ready(False)
|
|
343257
|
+
print(json.dumps({"type": "yielded", "id": req.get("id"), "device": _DEVICE}), flush=True)
|
|
343107
343258
|
break
|
|
343108
343259
|
rid = req.get("id")
|
|
343260
|
+
_cpu_cap_begin()
|
|
343109
343261
|
try:
|
|
343110
343262
|
text = str(req.get("text") or "").strip()
|
|
343111
343263
|
clone_ref = str(req.get("clone_ref") or "")
|
|
@@ -343122,6 +343274,8 @@ for line in sys.stdin:
|
|
|
343122
343274
|
print(json.dumps({"type": "result", "id": rid, "path": output}), flush=True)
|
|
343123
343275
|
except Exception as exc:
|
|
343124
343276
|
print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
|
|
343277
|
+
finally:
|
|
343278
|
+
_cpu_cap_settle()
|
|
343125
343279
|
`;
|
|
343126
343280
|
MISO_DAEMON_PY = String.raw`
|
|
343127
343281
|
import json, os, sys, traceback
|
|
@@ -343172,6 +343326,7 @@ for line in sys.stdin:
|
|
|
343172
343326
|
except Exception as exc:
|
|
343173
343327
|
print(json.dumps({"type": "error", "id": rid, "error": str(exc), "trace": traceback.format_exc(limit=3)}), flush=True)
|
|
343174
343328
|
`;
|
|
343329
|
+
_misottsDaemon = null;
|
|
343175
343330
|
}
|
|
343176
343331
|
});
|
|
343177
343332
|
|
|
@@ -344992,6 +345147,8 @@ var init_dist5 = __esm({
|
|
|
344992
345147
|
init_python_cuda_runtime();
|
|
344993
345148
|
init_python_cuda_runtime_async();
|
|
344994
345149
|
init_luxtts_runtime_contract();
|
|
345150
|
+
init_luxtts_device_policy();
|
|
345151
|
+
init_luxtts_gpu_lease();
|
|
344995
345152
|
init_broker_mediated_backend();
|
|
344996
345153
|
init_evidence();
|
|
344997
345154
|
init_process_lifecycle();
|
|
@@ -441068,6 +441225,23 @@ Respond with the assessment and take the selected evidence-backed action.`;
|
|
|
441068
441225
|
try {
|
|
441069
441226
|
return await this.runModelTask(task, context, actualUserGoal);
|
|
441070
441227
|
} catch (error) {
|
|
441228
|
+
if (isInferenceFallbackDeclined(error)) {
|
|
441229
|
+
const cancellation = "Request cancelled; no remote inference was used.";
|
|
441230
|
+
this.emit({ type: "status", content: cancellation, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
441231
|
+
return {
|
|
441232
|
+
status: "awaiting_input",
|
|
441233
|
+
completed: false,
|
|
441234
|
+
turns: Math.max(0, this._currentSteeringTurn + 1),
|
|
441235
|
+
toolCalls: this._interruptionToolCallLog?.length ?? 0,
|
|
441236
|
+
totalTokens: 0,
|
|
441237
|
+
promptTokens: 0,
|
|
441238
|
+
completionTokens: 0,
|
|
441239
|
+
estimatedTokens: 0,
|
|
441240
|
+
summary: cancellation,
|
|
441241
|
+
durationMs: Date.now() - started,
|
|
441242
|
+
filesEdited: [...this._taskState.modifiedFiles.keys()]
|
|
441243
|
+
};
|
|
441244
|
+
}
|
|
441071
441245
|
if (!(error instanceof DetachedOwnedModelBlocker) || !this._ownedModelBlocker)
|
|
441072
441246
|
throw error;
|
|
441073
441247
|
const held = this._ownedInferenceWaitCheckpoint;
|
|
@@ -448726,6 +448900,13 @@ ${diagnosis}` : diagnosis;
|
|
|
448726
448900
|
if (isTerminalInferenceFailure(reqErr)) {
|
|
448727
448901
|
nonRetryableBackendFailure = true;
|
|
448728
448902
|
}
|
|
448903
|
+
if (isInferenceFallbackDeclined(reqErr)) {
|
|
448904
|
+
nonRetryableBackendFailure = true;
|
|
448905
|
+
const cancellation = "Request cancelled; no remote inference was used.";
|
|
448906
|
+
summary2 = summary2 || cancellation;
|
|
448907
|
+
this.emit({ type: "status", content: cancellation, turn, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
448908
|
+
break;
|
|
448909
|
+
}
|
|
448729
448910
|
if (this.aborted)
|
|
448730
448911
|
break;
|
|
448731
448912
|
if (this._currentTextToolRequestFailure(chatRequest, reqErr))
|
|
@@ -450383,6 +450564,13 @@ ${diagnosis}` : diagnosis;
|
|
|
450383
450564
|
if (isTerminalInferenceFailure(reqErr)) {
|
|
450384
450565
|
nonRetryableBackendFailure = true;
|
|
450385
450566
|
}
|
|
450567
|
+
if (isInferenceFallbackDeclined(reqErr)) {
|
|
450568
|
+
nonRetryableBackendFailure = true;
|
|
450569
|
+
const cancellation = "Request cancelled; no remote inference was used.";
|
|
450570
|
+
summary2 = summary2 || cancellation;
|
|
450571
|
+
this.emit({ type: "status", content: cancellation, turn, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
450572
|
+
break;
|
|
450573
|
+
}
|
|
450386
450574
|
if (this.aborted) {
|
|
450387
450575
|
break;
|
|
450388
450576
|
}
|
|
@@ -458706,6 +458894,11 @@ var FinalDeliveryReplacementAuthorized = class extends Error {
|
|
|
458706
458894
|
this.originalRequestId = originalRequestId;
|
|
458707
458895
|
}
|
|
458708
458896
|
};
|
|
458897
|
+
function isInferenceFallbackDeclined(error) {
|
|
458898
|
+
if (!error || typeof error !== "object")
|
|
458899
|
+
return false;
|
|
458900
|
+
return error.code === "fallback_declined";
|
|
458901
|
+
}
|
|
458709
458902
|
function isTerminalInferenceFailure(error) {
|
|
458710
458903
|
if (!error || typeof error !== "object")
|
|
458711
458904
|
return false;
|