omnius 1.0.148 → 1.0.149

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/index.js CHANGED
@@ -124372,7 +124372,7 @@ var require_client_h1 = __commonJS({
124372
124372
  kHTTPContext,
124373
124373
  kClosed
124374
124374
  } = require_symbols();
124375
- var constants = require_constants2();
124375
+ var constants2 = require_constants2();
124376
124376
  var EMPTY_BUF = Buffer.alloc(0);
124377
124377
  var FastBuffer = Buffer[Symbol.species];
124378
124378
  var removeAllListeners = util2.removeAllListeners;
@@ -124498,7 +124498,7 @@ var require_client_h1 = __commonJS({
124498
124498
  */
124499
124499
  constructor(client, socket, { exports: exports2 }) {
124500
124500
  this.llhttp = exports2;
124501
- this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE);
124501
+ this.ptr = this.llhttp.llhttp_alloc(constants2.TYPE.RESPONSE);
124502
124502
  this.client = client;
124503
124503
  this.socket = socket;
124504
124504
  this.timeout = null;
@@ -124593,11 +124593,11 @@ var require_client_h1 = __commonJS({
124593
124593
  currentParser = null;
124594
124594
  currentBufferRef = null;
124595
124595
  }
124596
- if (ret !== constants.ERROR.OK) {
124596
+ if (ret !== constants2.ERROR.OK) {
124597
124597
  const data = chunk.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
124598
- if (ret === constants.ERROR.PAUSED_UPGRADE) {
124598
+ if (ret === constants2.ERROR.PAUSED_UPGRADE) {
124599
124599
  this.onUpgrade(data);
124600
- } else if (ret === constants.ERROR.PAUSED) {
124600
+ } else if (ret === constants2.ERROR.PAUSED) {
124601
124601
  this.paused = true;
124602
124602
  socket.unshift(data);
124603
124603
  } else {
@@ -124607,7 +124607,7 @@ var require_client_h1 = __commonJS({
124607
124607
  const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
124608
124608
  message2 = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
124609
124609
  }
124610
- throw new HTTPParserError(message2, constants.ERROR[ret], data);
124610
+ throw new HTTPParserError(message2, constants2.ERROR[ret], data);
124611
124611
  }
124612
124612
  }
124613
124613
  } catch (err) {
@@ -124814,7 +124814,7 @@ var require_client_h1 = __commonJS({
124814
124814
  socket[kBlocking] = false;
124815
124815
  client[kResume]();
124816
124816
  }
124817
- return pause ? constants.ERROR.PAUSED : 0;
124817
+ return pause ? constants2.ERROR.PAUSED : 0;
124818
124818
  }
124819
124819
  /**
124820
124820
  * @param {Buffer} buf
@@ -124840,7 +124840,7 @@ var require_client_h1 = __commonJS({
124840
124840
  }
124841
124841
  this.bytesRead += buf.length;
124842
124842
  if (request.onData(buf) === false) {
124843
- return constants.ERROR.PAUSED;
124843
+ return constants2.ERROR.PAUSED;
124844
124844
  }
124845
124845
  return 0;
124846
124846
  }
@@ -124879,13 +124879,13 @@ var require_client_h1 = __commonJS({
124879
124879
  if (socket[kWriting]) {
124880
124880
  assert(client[kRunning] === 0);
124881
124881
  util2.destroy(socket, new InformationalError("reset"));
124882
- return constants.ERROR.PAUSED;
124882
+ return constants2.ERROR.PAUSED;
124883
124883
  } else if (!shouldKeepAlive) {
124884
124884
  util2.destroy(socket, new InformationalError("reset"));
124885
- return constants.ERROR.PAUSED;
124885
+ return constants2.ERROR.PAUSED;
124886
124886
  } else if (socket[kReset] && client[kRunning] === 0) {
124887
124887
  util2.destroy(socket, new InformationalError("reset"));
124888
- return constants.ERROR.PAUSED;
124888
+ return constants2.ERROR.PAUSED;
124889
124889
  } else if (client[kPipelining] == null || client[kPipelining] === 1) {
124890
124890
  setImmediate(client[kResume]);
124891
124891
  } else {
@@ -247747,7 +247747,7 @@ var require_scan = __commonJS({
247747
247747
  var require_parse3 = __commonJS({
247748
247748
  "../node_modules/picomatch/lib/parse.js"(exports, module) {
247749
247749
  "use strict";
247750
- var constants = require_constants8();
247750
+ var constants2 = require_constants8();
247751
247751
  var utils = require_utils4();
247752
247752
  var {
247753
247753
  MAX_LENGTH,
@@ -247755,7 +247755,7 @@ var require_parse3 = __commonJS({
247755
247755
  REGEX_NON_SPECIAL_CHARS,
247756
247756
  REGEX_SPECIAL_CHARS_BACKREF,
247757
247757
  REPLACEMENTS
247758
- } = constants;
247758
+ } = constants2;
247759
247759
  var expandRange = (args, options2) => {
247760
247760
  if (typeof options2.expandRange === "function") {
247761
247761
  return options2.expandRange(...args, options2);
@@ -247961,7 +247961,7 @@ var require_parse3 = __commonJS({
247961
247961
  if (options2.maxExtglobRecursion === false) {
247962
247962
  return { risky: false };
247963
247963
  }
247964
- const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
247964
+ const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
247965
247965
  const branches = splitTopLevel(body).map((branch) => branch.trim());
247966
247966
  if (branches.length > 1) {
247967
247967
  if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
@@ -247994,8 +247994,8 @@ var require_parse3 = __commonJS({
247994
247994
  const tokens = [bos];
247995
247995
  const capture = opts.capture ? "" : "?:";
247996
247996
  const win32 = utils.isWindows(options2);
247997
- const PLATFORM_CHARS = constants.globChars(win32);
247998
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
247997
+ const PLATFORM_CHARS = constants2.globChars(win32);
247998
+ const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
247999
247999
  const {
248000
248000
  DOT_LITERAL,
248001
248001
  PLUS_LITERAL,
@@ -248694,7 +248694,7 @@ var require_parse3 = __commonJS({
248694
248694
  NO_DOTS_SLASH,
248695
248695
  STAR,
248696
248696
  START_ANCHOR
248697
- } = constants.globChars(win32);
248697
+ } = constants2.globChars(win32);
248698
248698
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
248699
248699
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
248700
248700
  const capture = opts.capture ? "" : "?:";
@@ -248753,7 +248753,7 @@ var require_picomatch = __commonJS({
248753
248753
  var scan = require_scan();
248754
248754
  var parse3 = require_parse3();
248755
248755
  var utils = require_utils4();
248756
- var constants = require_constants8();
248756
+ var constants2 = require_constants8();
248757
248757
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
248758
248758
  var picomatch = (glob3, options2, returnState = false) => {
248759
248759
  if (Array.isArray(glob3)) {
@@ -248881,7 +248881,7 @@ var require_picomatch = __commonJS({
248881
248881
  return /$^/;
248882
248882
  }
248883
248883
  };
248884
- picomatch.constants = constants;
248884
+ picomatch.constants = constants2;
248885
248885
  module.exports = picomatch;
248886
248886
  }
248887
248887
  });
@@ -486496,7 +486496,7 @@ var require_scan2 = __commonJS({
486496
486496
  var require_parse4 = __commonJS({
486497
486497
  "node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(exports, module) {
486498
486498
  "use strict";
486499
- var constants = require_constants10();
486499
+ var constants2 = require_constants10();
486500
486500
  var utils = require_utils7();
486501
486501
  var {
486502
486502
  MAX_LENGTH,
@@ -486504,7 +486504,7 @@ var require_parse4 = __commonJS({
486504
486504
  REGEX_NON_SPECIAL_CHARS,
486505
486505
  REGEX_SPECIAL_CHARS_BACKREF,
486506
486506
  REPLACEMENTS
486507
- } = constants;
486507
+ } = constants2;
486508
486508
  var expandRange = (args, options2) => {
486509
486509
  if (typeof options2.expandRange === "function") {
486510
486510
  return options2.expandRange(...args, options2);
@@ -486710,7 +486710,7 @@ var require_parse4 = __commonJS({
486710
486710
  if (options2.maxExtglobRecursion === false) {
486711
486711
  return { risky: false };
486712
486712
  }
486713
- const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
486713
+ const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
486714
486714
  const branches = splitTopLevel(body).map((branch) => branch.trim());
486715
486715
  if (branches.length > 1) {
486716
486716
  if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
@@ -486742,8 +486742,8 @@ var require_parse4 = __commonJS({
486742
486742
  const bos = { type: "bos", value: "", output: opts.prepend || "" };
486743
486743
  const tokens = [bos];
486744
486744
  const capture = opts.capture ? "" : "?:";
486745
- const PLATFORM_CHARS = constants.globChars(opts.windows);
486746
- const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
486745
+ const PLATFORM_CHARS = constants2.globChars(opts.windows);
486746
+ const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
486747
486747
  const {
486748
486748
  DOT_LITERAL,
486749
486749
  PLUS_LITERAL,
@@ -487438,7 +487438,7 @@ var require_parse4 = __commonJS({
487438
487438
  NO_DOTS_SLASH,
487439
487439
  STAR,
487440
487440
  START_ANCHOR
487441
- } = constants.globChars(opts.windows);
487441
+ } = constants2.globChars(opts.windows);
487442
487442
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
487443
487443
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
487444
487444
  const capture = opts.capture ? "" : "?:";
@@ -487496,7 +487496,7 @@ var require_picomatch3 = __commonJS({
487496
487496
  var scan = require_scan2();
487497
487497
  var parse3 = require_parse4();
487498
487498
  var utils = require_utils7();
487499
- var constants = require_constants10();
487499
+ var constants2 = require_constants10();
487500
487500
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
487501
487501
  var picomatch = (glob3, options2, returnState = false) => {
487502
487502
  if (Array.isArray(glob3)) {
@@ -487624,7 +487624,7 @@ var require_picomatch3 = __commonJS({
487624
487624
  return /$^/;
487625
487625
  }
487626
487626
  };
487627
- picomatch.constants = constants;
487627
+ picomatch.constants = constants2;
487628
487628
  module.exports = picomatch;
487629
487629
  }
487630
487630
  });
@@ -515946,7 +515946,7 @@ Saved to: ${tempFile}`,
515946
515946
 
515947
515947
  // packages/execution/dist/tools/audio-playback.js
515948
515948
  import { execFileSync as execFileSync5, execSync as execSync30, spawn as spawn16 } from "node:child_process";
515949
- import { copyFileSync as copyFileSync3, existsSync as existsSync44, statSync as statSync22, writeFileSync as writeFileSync18, mkdirSync as mkdirSync19, readdirSync as readdirSync17 } from "node:fs";
515949
+ import { copyFileSync as copyFileSync3, existsSync as existsSync44, statSync as statSync22, writeFileSync as writeFileSync18, mkdirSync as mkdirSync19, readdirSync as readdirSync17, writeSync } from "node:fs";
515950
515950
  import { basename as basename14, extname as extname10, isAbsolute as isAbsolute2, join as join61 } from "node:path";
515951
515951
  import { homedir as homedir16, tmpdir as tmpdir11 } from "node:os";
515952
515952
  function hasCommand3(command) {
@@ -516208,6 +516208,12 @@ function pythonCanImportLuxTts(venvPy) {
516208
516208
  return false;
516209
516209
  }
516210
516210
  }
516211
+ function commandErrorText(err) {
516212
+ const anyErr = err;
516213
+ const stdout = anyErr?.stdout ? String(anyErr.stdout).trim() : "";
516214
+ const stderr = anyErr?.stderr ? String(anyErr.stderr).trim() : "";
516215
+ return [anyErr?.message ?? String(err), stderr, stdout].filter(Boolean).join("\n").slice(0, 1800);
516216
+ }
516211
516217
  function pipInstall(venvPy, packages, timeout2 = 9e5) {
516212
516218
  execFileSync5(venvPy, ["-m", "pip", "install", "--prefer-binary", ...packages], {
516213
516219
  stdio: "pipe",
@@ -516215,9 +516221,133 @@ function pipInstall(venvPy, packages, timeout2 = 9e5) {
516215
516221
  env: process.env
516216
516222
  });
516217
516223
  }
516224
+ function withVisibleElevationPrompt(reason, run2) {
516225
+ const hasInteractiveTty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
516226
+ if (!hasInteractiveTty)
516227
+ return run2();
516228
+ const stdinAny = process.stdin;
516229
+ const hadRaw = Boolean(stdinAny.isTTY && stdinAny.isRaw);
516230
+ try {
516231
+ stdinAny.setRawMode?.(false);
516232
+ } catch {
516233
+ }
516234
+ writeSync(1, "\x1B[?2026l\x1B[?25h\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[r\x1B[0m\x1B[2J\x1B[H");
516235
+ writeSync(1, `Omnius needs administrator privileges
516236
+ ${reason}
516237
+
516238
+ `);
516239
+ try {
516240
+ return run2();
516241
+ } finally {
516242
+ try {
516243
+ stdinAny.setRawMode?.(hadRaw);
516244
+ } catch {
516245
+ }
516246
+ writeSync(1, "\x1B[?2026l\x1B[?25h\x1B[r\x1B[0m\x1B[2J\x1B[H");
516247
+ }
516248
+ }
516249
+ function runPrivilegedInstall(command, args) {
516250
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
516251
+ if (isRoot) {
516252
+ execFileSync5(command, args, { stdio: "pipe", timeout: 6e5 });
516253
+ return;
516254
+ }
516255
+ if (!hasCommand3("sudo")) {
516256
+ throw new Error("sudo is not installed and this process is not running as root");
516257
+ }
516258
+ const hasInteractiveTty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
516259
+ if (hasInteractiveTty) {
516260
+ withVisibleElevationPrompt(`Installing LuxTTS system build dependencies with ${command}.`, () => {
516261
+ execFileSync5("sudo", ["-v"], { stdio: "inherit", timeout: 12e4 });
516262
+ execFileSync5("sudo", [command, ...args], { stdio: "inherit", timeout: 6e5 });
516263
+ });
516264
+ return;
516265
+ }
516266
+ execFileSync5("sudo", ["-n", command, ...args], { stdio: "pipe", timeout: 6e5 });
516267
+ }
516268
+ function installLuxttsSystemDepsBestEffort() {
516269
+ if (process.env["OMNIUS_VOICE_AUTO_SYSTEM_DEPS"] === "0") {
516270
+ return "system dependency install disabled by OMNIUS_VOICE_AUTO_SYSTEM_DEPS=0";
516271
+ }
516272
+ try {
516273
+ if (process.platform === "darwin") {
516274
+ if (!hasCommand3("brew"))
516275
+ return "Homebrew not found; cannot install macOS LuxTTS build dependencies automatically";
516276
+ execFileSync5("brew", ["install", "llvm", "gcc", "openblas", "libsndfile"], { stdio: "inherit", timeout: 6e5 });
516277
+ return "installed macOS LuxTTS build dependencies with brew";
516278
+ }
516279
+ if (process.platform !== "linux") {
516280
+ return `automatic system dependency install is unsupported on ${process.platform}`;
516281
+ }
516282
+ if (hasCommand3("apt-get")) {
516283
+ runPrivilegedInstall("apt-get", ["install", "-y", "--no-install-recommends", "git", "build-essential", "llvm-dev", "gcc", "g++", "gfortran", "libopenblas-dev", "libsndfile1-dev", "python3-dev"]);
516284
+ return "installed Linux LuxTTS build dependencies with apt-get";
516285
+ }
516286
+ if (hasCommand3("dnf")) {
516287
+ runPrivilegedInstall("dnf", ["install", "-y", "git", "gcc", "gcc-c++", "gcc-gfortran", "llvm-devel", "openblas-devel", "libsndfile-devel", "python3-devel"]);
516288
+ return "installed Linux LuxTTS build dependencies with dnf";
516289
+ }
516290
+ if (hasCommand3("yum")) {
516291
+ runPrivilegedInstall("yum", ["install", "-y", "git", "gcc", "gcc-c++", "gcc-gfortran", "llvm-devel", "openblas-devel", "libsndfile-devel", "python3-devel"]);
516292
+ return "installed Linux LuxTTS build dependencies with yum";
516293
+ }
516294
+ if (hasCommand3("pacman")) {
516295
+ runPrivilegedInstall("pacman", ["-S", "--needed", "--noconfirm", "git", "base-devel", "llvm", "openblas", "libsndfile", "python"]);
516296
+ return "installed Linux LuxTTS build dependencies with pacman";
516297
+ }
516298
+ if (hasCommand3("zypper")) {
516299
+ runPrivilegedInstall("zypper", ["--non-interactive", "install", "git", "gcc", "gcc-c++", "gcc-fortran", "llvm-devel", "openblas-devel", "libsndfile-devel", "python3-devel"]);
516300
+ return "installed Linux LuxTTS build dependencies with zypper";
516301
+ }
516302
+ return "no supported Linux package manager found for automatic LuxTTS system dependency install";
516303
+ } catch (err) {
516304
+ return `system dependency install skipped/failed: ${commandErrorText(err)}`;
516305
+ }
516306
+ }
516307
+ function runLuxttsInstallStep(venvPy, step, notes2) {
516308
+ try {
516309
+ pipInstall(venvPy, step.args, step.timeout ?? 9e5);
516310
+ return;
516311
+ } catch (firstErr) {
516312
+ if (step.retryWithSystemDeps) {
516313
+ notes2.push(`${step.label}: pip failed; attempting system dependency triage`);
516314
+ notes2.push(installLuxttsSystemDepsBestEffort());
516315
+ try {
516316
+ pipInstall(venvPy, step.args, step.timeout ?? 9e5);
516317
+ return;
516318
+ } catch (retryErr) {
516319
+ notes2.push(`${step.label}: retry failed: ${commandErrorText(retryErr)}`);
516320
+ }
516321
+ }
516322
+ if (!step.fatal) {
516323
+ notes2.push(`${step.label}: optional install skipped: ${commandErrorText(firstErr)}`);
516324
+ return;
516325
+ }
516326
+ throw new Error(`Failed to install LuxTTS dependency step '${step.label}': ${commandErrorText(firstErr)}${notes2.length ? `
516327
+ Triage:
516328
+ - ${notes2.join("\n- ")}` : ""}`);
516329
+ }
516330
+ }
516331
+ function collectLuxttsDiagnostics(venvPy, repoDir) {
516332
+ const lines = [];
516333
+ try {
516334
+ lines.push(execFileSync5(venvPy, ["-V"], { encoding: "utf8", timeout: 5e3 }).trim());
516335
+ } catch {
516336
+ }
516337
+ try {
516338
+ lines.push(execFileSync5(venvPy, ["-m", "pip", "--version"], { encoding: "utf8", timeout: 5e3 }).trim());
516339
+ } catch {
516340
+ }
516341
+ try {
516342
+ lines.push(`platform=${process.platform} arch=${process.arch} repo=${repoDir}`);
516343
+ } catch {
516344
+ }
516345
+ return lines.join("\n");
516346
+ }
516218
516347
  function ensureLuxttsInstalled() {
516219
516348
  const venvPy = luxttsVenvPy();
516220
516349
  const repoDir = luxttsRepoDir();
516350
+ const notes2 = [];
516221
516351
  mkdirSync19(voiceDir(), { recursive: true });
516222
516352
  if (existsSync44(venvPy) && existsSync44(join61(repoDir, "zipvoice", "luxvoice.py")) && pythonCanImportLuxTts(venvPy)) {
516223
516353
  writeFileSync18(luxttsInferScript(), LUXTTS_DAEMON_PY, "utf-8");
@@ -516233,7 +516363,6 @@ function ensureLuxttsInstalled() {
516233
516363
  stdio: "pipe",
516234
516364
  timeout: 3e5
516235
516365
  });
516236
- pipInstall(venvPy, ["torch", "torchaudio"], 12e5);
516237
516366
  if (!existsSync44(join61(repoDir, "zipvoice", "luxvoice.py"))) {
516238
516367
  if (!hasCommand3("git"))
516239
516368
  throw new Error("git is required to set up LuxTTS voice cloning.");
@@ -516242,29 +516371,50 @@ function ensureLuxttsInstalled() {
516242
516371
  timeout: 3e5
516243
516372
  });
516244
516373
  }
516245
- pipInstall(venvPy, [
516246
- "lhotse",
516247
- "huggingface_hub",
516248
- "safetensors",
516249
- "pydub",
516250
- "onnxruntime",
516251
- "librosa",
516252
- "transformers<=4.57.6",
516253
- "inflect",
516254
- "numpy",
516255
- "vocos",
516256
- "jieba",
516257
- "pypinyin",
516258
- "cn2an"
516259
- ], 12e5);
516260
- try {
516261
- pipInstall(venvPy, ["git+https://github.com/ysharma3501/LinaCodec.git"], 12e5);
516262
- } catch {
516374
+ const isArm = process.arch === "arm64" || process.arch === "arm";
516375
+ const installSteps = isArm ? [
516376
+ { label: "PyTorch", args: ["torch", "torchaudio"], fatal: true, timeout: 12e5 },
516377
+ { label: "numpy", args: ["numpy"], fatal: true },
516378
+ { label: "huggingface_hub + safetensors", args: ["huggingface_hub", "safetensors"], fatal: true },
516379
+ { label: "transformers", args: ["transformers<=4.57.6"], fatal: true },
516380
+ { label: "pydub + inflect", args: ["pydub", "inflect"], fatal: true },
516381
+ { label: "llvmlite", args: ["llvmlite"], fatal: false, retryWithSystemDeps: true },
516382
+ { label: "numba", args: ["numba"], fatal: false, retryWithSystemDeps: true },
516383
+ { label: "librosa", args: ["librosa"], fatal: true, retryWithSystemDeps: true },
516384
+ { label: "lhotse", args: ["lhotse"], fatal: true, retryWithSystemDeps: true },
516385
+ { label: "vocos", args: ["vocos"], fatal: true, retryWithSystemDeps: true },
516386
+ { label: "LinaCodec", args: ["git+https://github.com/ysharma3501/LinaCodec.git"], fatal: true, retryWithSystemDeps: true, timeout: 12e5 },
516387
+ { label: "piper-phonemize (optional)", args: ["piper-phonemize", "--find-links", "https://k2-fsa.github.io/icefall/piper_phonemize.html"], fatal: false, timeout: 6e5 },
516388
+ { label: "Chinese text processing", args: ["jieba", "pypinyin", "cn2an"], fatal: true },
516389
+ { label: "LuxTTS editable install", args: ["--no-deps", "-e", repoDir], fatal: true, timeout: 6e5 }
516390
+ ] : [
516391
+ { label: "PyTorch", args: ["torch", "torchaudio"], fatal: true, timeout: 12e5 },
516392
+ { label: "core LuxTTS deps", args: ["lhotse", "huggingface_hub", "safetensors", "pydub", "onnxruntime", "librosa", "transformers<=4.57.6", "inflect", "numpy", "vocos", "setuptools<81"], fatal: true, retryWithSystemDeps: true, timeout: 12e5 },
516393
+ { label: "piper-phonemize (optional)", args: ["piper-phonemize", "--find-links", "https://k2-fsa.github.io/icefall/piper_phonemize.html"], fatal: false, timeout: 6e5 },
516394
+ { label: "Chinese text processing", args: ["jieba", "pypinyin", "cn2an"], fatal: true },
516395
+ { label: "LinaCodec", args: ["git+https://github.com/ysharma3501/LinaCodec.git"], fatal: false, retryWithSystemDeps: true, timeout: 12e5 },
516396
+ { label: "LuxTTS editable install", args: ["--no-deps", "-e", repoDir], fatal: true, timeout: 6e5 }
516397
+ ];
516398
+ for (const step of installSteps) {
516399
+ runLuxttsInstallStep(venvPy, step, notes2);
516263
516400
  }
516264
- pipInstall(venvPy, ["-e", repoDir], 6e5);
516265
516401
  writeFileSync18(luxttsInferScript(), LUXTTS_DAEMON_PY, "utf-8");
516266
516402
  if (!pythonCanImportLuxTts(venvPy)) {
516267
- throw new Error(`LuxTTS setup completed but import still fails in ${luxttsVenvDir()}.`);
516403
+ notes2.push("LuxTTS import failed after dependency install; retrying source/build dependencies once");
516404
+ notes2.push(installLuxttsSystemDepsBestEffort());
516405
+ try {
516406
+ pipInstall(venvPy, ["git+https://github.com/ysharma3501/LinaCodec.git"], 12e5);
516407
+ pipInstall(venvPy, ["--no-deps", "-e", repoDir], 6e5);
516408
+ } catch (err) {
516409
+ notes2.push(`final repair install failed: ${commandErrorText(err)}`);
516410
+ }
516411
+ }
516412
+ if (!pythonCanImportLuxTts(venvPy)) {
516413
+ throw new Error(`LuxTTS setup completed but import still fails in ${luxttsVenvDir()}.
516414
+ Diagnostics:
516415
+ ${collectLuxttsDiagnostics(venvPy, repoDir)}
516416
+ Triage:
516417
+ - ${notes2.join("\n- ")}`);
516268
516418
  }
516269
516419
  return venvPy;
516270
516420
  }
@@ -561535,7 +561685,7 @@ __export(listen_exports, {
561535
561685
  waitForTranscribeCli: () => waitForTranscribeCli
561536
561686
  });
561537
561687
  import { spawn as spawn24, execSync as execSync47 } from "node:child_process";
561538
- import { existsSync as existsSync87, mkdirSync as mkdirSync48, writeFileSync as writeFileSync43, readdirSync as readdirSync28 } from "node:fs";
561688
+ import { accessSync, constants, existsSync as existsSync87, mkdirSync as mkdirSync48, writeFileSync as writeFileSync43, readdirSync as readdirSync28 } from "node:fs";
561539
561689
  import { join as join102, dirname as dirname27 } from "node:path";
561540
561690
  import { homedir as homedir32 } from "node:os";
561541
561691
  import { fileURLToPath as fileURLToPath11 } from "node:url";
@@ -561778,10 +561928,40 @@ function ensureTranscribeCliBackground() {
561778
561928
  } catch {
561779
561929
  }
561780
561930
  try {
561781
- const { exec: exec6 } = await import("node:child_process");
561931
+ let needsSudo = false;
561932
+ try {
561933
+ const prefix = execSync47("npm prefix -g", {
561934
+ encoding: "utf-8",
561935
+ timeout: 5e3,
561936
+ stdio: ["pipe", "pipe", "pipe"]
561937
+ }).trim();
561938
+ accessSync(prefix, constants.W_OK);
561939
+ } catch {
561940
+ needsSudo = process.platform !== "win32";
561941
+ }
561942
+ const terminalElevation = process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY;
561943
+ const command = terminalElevation && needsSudo ? "sudo" : "npm";
561944
+ const args = terminalElevation && needsSudo ? ["npm", "i", "-g", "transcribe-cli"] : ["i", "-g", "transcribe-cli"];
561782
561945
  return new Promise((resolve56) => {
561783
- exec6("npm i -g transcribe-cli", { timeout: 18e4 }, (err) => {
561784
- resolve56(!err);
561946
+ const child = spawn24(command, args, {
561947
+ stdio: terminalElevation ? "inherit" : "ignore",
561948
+ timeout: 18e4
561949
+ });
561950
+ const timeout2 = setTimeout(() => {
561951
+ try {
561952
+ child.kill("SIGTERM");
561953
+ } catch {
561954
+ }
561955
+ resolve56(false);
561956
+ }, 18e4);
561957
+ timeout2.unref?.();
561958
+ onChildClose(child, (code8) => {
561959
+ clearTimeout(timeout2);
561960
+ resolve56(code8 === 0);
561961
+ });
561962
+ onChildError(child, () => {
561963
+ clearTimeout(timeout2);
561964
+ resolve56(false);
561785
561965
  });
561786
561966
  });
561787
561967
  } catch {
@@ -583813,21 +583993,27 @@ function ensureZstd() {
583813
583993
  process.stdout.write(`
583814
583994
  ${c3.cyan("●")} Installing zstd (required by ollama install.sh)...
583815
583995
  `);
583996
+ const terminalElevation = process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY;
583816
583997
  const hasDisplay = !!(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
583817
583998
  const askpassHelper = detectAskpassHelper() ?? writeAskpassHelper();
583818
583999
  const askpassEnv = askpassHelper ? { ...process.env, SUDO_ASKPASS: askpassHelper, DEBIAN_FRONTEND: "noninteractive" } : { ...process.env, DEBIAN_FRONTEND: "noninteractive" };
583819
584000
  const candidates = [];
583820
- if (hasCmd("pkexec") && hasDisplay) {
583821
- candidates.push({ cmd: `pkexec sh -c ${shellEscape(installCmd)}`, env: process.env });
583822
- }
583823
- if (askpassHelper) {
583824
- candidates.push({ cmd: `sudo -A ${installCmd}`, env: askpassEnv });
584001
+ if (terminalElevation) {
584002
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
584003
+ candidates.push({ cmd: isRoot ? installCmd : `sudo ${installCmd}`, env: askpassEnv, stdio: "inherit" });
584004
+ } else {
584005
+ if (hasCmd("pkexec") && hasDisplay) {
584006
+ candidates.push({ cmd: `pkexec sh -c ${shellEscape(installCmd)}`, env: process.env });
584007
+ }
584008
+ if (askpassHelper) {
584009
+ candidates.push({ cmd: `sudo -A ${installCmd}`, env: askpassEnv });
584010
+ }
583825
584011
  }
583826
584012
  candidates.push({ cmd: installCmd, env: process.env });
583827
584013
  for (const cand of candidates) {
583828
584014
  try {
583829
584015
  execSync51(cand.cmd, {
583830
- stdio: ["ignore", "inherit", "pipe"],
584016
+ stdio: cand.stdio ?? ["ignore", "inherit", "pipe"],
583831
584017
  env: cand.env,
583832
584018
  timeout: 18e4
583833
584019
  });
@@ -583915,6 +584101,14 @@ osascript -e 'Tell application "System Events" to display dialog "Omnius needs a
583915
584101
  function buildElevatedInstall() {
583916
584102
  const installCmd = "curl -fsSL https://ollama.com/install.sh | sh";
583917
584103
  const baseEnv = { ...process.env };
584104
+ if (process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY) {
584105
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
584106
+ return {
584107
+ cmd: isRoot ? `sh -c ${shellEscape(installCmd)}` : `sudo sh -c ${shellEscape(installCmd)}`,
584108
+ env: { ...baseEnv, DEBIAN_FRONTEND: "noninteractive" },
584109
+ mode: "terminal"
584110
+ };
584111
+ }
583918
584112
  if (process.platform === "linux" && hasCmd("pkexec") && (process.env.DISPLAY || process.env.WAYLAND_DISPLAY)) {
583919
584113
  return {
583920
584114
  cmd: `pkexec sh -c ${shellEscape(installCmd)}`,
@@ -583946,20 +584140,29 @@ function runElevatedCommand(command, opts = {}) {
583946
584140
  const hasDisplay = !!(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
583947
584141
  const askpassHelper = detectAskpassHelper() ?? writeAskpassHelper();
583948
584142
  const askpassEnv = askpassHelper ? { ...process.env, SUDO_ASKPASS: askpassHelper } : process.env;
584143
+ const terminalElevation = process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY;
583949
584144
  const candidates = [];
583950
- if (hasCmd("pkexec") && hasDisplay) {
583951
- candidates.push({ cmd: `pkexec sh -c ${shellEscape(command)}`, env: process.env });
583952
- }
583953
- if (askpassHelper) {
583954
- candidates.push({ cmd: `sudo -A sh -c ${shellEscape(command)}`, env: askpassEnv });
584145
+ if (terminalElevation) {
584146
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
584147
+ candidates.push({
584148
+ cmd: isRoot ? `sh -c ${shellEscape(command)}` : `sudo sh -c ${shellEscape(command)}`,
584149
+ env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" },
584150
+ stdio: "inherit"
584151
+ });
584152
+ } else {
584153
+ if (hasCmd("pkexec") && hasDisplay) {
584154
+ candidates.push({ cmd: `pkexec sh -c ${shellEscape(command)}`, env: process.env });
584155
+ }
584156
+ if (askpassHelper) {
584157
+ candidates.push({ cmd: `sudo -A sh -c ${shellEscape(command)}`, env: askpassEnv });
584158
+ }
583955
584159
  }
583956
584160
  candidates.push({ cmd: command, env: process.env });
583957
584161
  let lastErr = null;
583958
584162
  for (const cand of candidates) {
583959
584163
  try {
583960
584164
  execSync51(cand.cmd, {
583961
- stdio: ["ignore", "pipe", "pipe"],
583962
- // never inherit TUI stdin
584165
+ stdio: cand.stdio ?? ["ignore", "pipe", "pipe"],
583963
584166
  env: cand.env,
583964
584167
  timeout: timeout2
583965
584168
  });
@@ -583979,7 +584182,10 @@ function runOllamaInstallScript() {
583979
584182
  `);
583980
584183
  }
583981
584184
  const elevated = buildElevatedInstall();
583982
- if (elevated.mode === "pkexec") {
584185
+ if (elevated.mode === "terminal") {
584186
+ process.stdout.write(` ${c3.cyan("●")} Elevation: sudo terminal prompt
584187
+ `);
584188
+ } else if (elevated.mode === "pkexec") {
583983
584189
  process.stdout.write(` ${c3.cyan("●")} Elevation: pkexec (graphical PolicyKit prompt)
583984
584190
  `);
583985
584191
  } else if (elevated.mode === "askpass") {
@@ -583993,7 +584199,7 @@ function runOllamaInstallScript() {
583993
584199
  }
583994
584200
  const runOnce = () => {
583995
584201
  execSync51(elevated.cmd, {
583996
- stdio: ["ignore", "inherit", "pipe"],
584202
+ stdio: elevated.mode === "terminal" ? "inherit" : ["ignore", "inherit", "pipe"],
583997
584203
  env: elevated.env,
583998
584204
  timeout: 6e5
583999
584205
  });
@@ -585270,6 +585476,20 @@ async function acquireSudoPassword(getSudoPassword, log22, cachedPasswordRef) {
585270
585476
  }
585271
585477
  async function sudoInstall(cmd, getSudoPassword, log22, cachedPasswordRef, timeoutMs = 12e4) {
585272
585478
  if (trySudoPasswordless(cmd, timeoutMs)) return true;
585479
+ if (process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY) {
585480
+ try {
585481
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
585482
+ const escaped = cmd.replace(/'/g, "'\\''");
585483
+ execSync51(isRoot ? `bash -c '${escaped}'` : `sudo bash -c '${escaped}'`, {
585484
+ stdio: "inherit",
585485
+ timeout: timeoutMs,
585486
+ env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
585487
+ });
585488
+ return true;
585489
+ } catch {
585490
+ return false;
585491
+ }
585492
+ }
585273
585493
  const pw2 = await acquireSudoPassword(getSudoPassword, log22, cachedPasswordRef);
585274
585494
  if (pw2 === null) return false;
585275
585495
  if (pw2 === "") return false;
@@ -585569,9 +585789,11 @@ function ensureCloudflaredBackground(onInfo) {
585569
585789
  } catch {
585570
585790
  }
585571
585791
  try {
585792
+ const terminalElevation = process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY;
585793
+ const sudoMove = terminalElevation ? `sudo mv /tmp/cloudflared /usr/local/bin/cloudflared` : `sudo mv /tmp/cloudflared /usr/local/bin/cloudflared 2>/dev/null`;
585572
585794
  execSync51(
585573
- `curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && sudo mv /tmp/cloudflared /usr/local/bin/cloudflared 2>/dev/null`,
585574
- { stdio: "pipe", timeout: 6e4 }
585795
+ `curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && ` + sudoMove,
585796
+ { stdio: terminalElevation ? "inherit" : "pipe", timeout: 6e4 }
585575
585797
  );
585576
585798
  if (hasCmd("cloudflared")) {
585577
585799
  log22("cloudflared installed.");
@@ -595400,7 +595622,8 @@ import {
595400
595622
  lstatSync,
595401
595623
  statSync as statSync41,
595402
595624
  rmSync as rmSync4,
595403
- appendFileSync as appendFileSync8
595625
+ appendFileSync as appendFileSync8,
595626
+ writeSync as writeSync2
595404
595627
  } from "node:fs";
595405
595628
  import { relative as relative11, join as join120 } from "node:path";
595406
595629
  async function _immediateReregister(newUrl) {
@@ -595619,50 +595842,161 @@ function parseTelegramMessageIdList(value2) {
595619
595842
  if (!value2) return [];
595620
595843
  return [...new Set(value2.split(",").map((part) => Number(part.trim())).filter((num) => Number.isFinite(num)))];
595621
595844
  }
595622
- async function runSudoScript(ctx3, script) {
595623
- const stdinAny = process.stdin;
595624
- const hadRaw = !!(stdinAny && stdinAny.isTTY && stdinAny.isRaw);
595845
+ function writeDirectTerminal(data) {
595625
595846
  try {
595626
- ctx3.deactivateStatusBar?.();
595847
+ writeSync2(1, data);
595627
595848
  } catch {
595849
+ try {
595850
+ overlayWrite(data);
595851
+ } catch {
595852
+ process.stdout.write(data);
595853
+ }
595628
595854
  }
595855
+ }
595856
+ function setRawInputMode(enabled2) {
595857
+ const stdinAny = process.stdin;
595629
595858
  try {
595630
595859
  if (stdinAny && stdinAny.isTTY && typeof stdinAny.setRawMode === "function") {
595631
- stdinAny.setRawMode(false);
595860
+ stdinAny.setRawMode(enabled2);
595632
595861
  }
595633
595862
  } catch {
595634
595863
  }
595864
+ }
595865
+ async function withTransientTerminalPrivilegePrompt(ctx3, reason, run2) {
595866
+ const hasInteractiveTty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
595867
+ if (!hasInteractiveTty) return await run2();
595868
+ const stdinAny = process.stdin;
595869
+ const hadRaw = Boolean(stdinAny?.isTTY && stdinAny.isRaw);
595870
+ const hadMouse = ctx3.isMouseEnabled?.() ?? false;
595871
+ const hadElevationMode = Object.prototype.hasOwnProperty.call(
595872
+ process.env,
595873
+ "OMNIUS_ELEVATION_MODE"
595874
+ );
595875
+ const previousElevationMode = process.env["OMNIUS_ELEVATION_MODE"];
595635
595876
  try {
595636
- const { spawn: spawn34 } = await import("node:child_process");
595637
- const full = `set -e; ${script}`;
595638
- await new Promise((resolve56) => {
595639
- const usePkexec = process.platform === "linux";
595640
- const cmd = usePkexec ? "pkexec" : "sudo";
595641
- const args = usePkexec ? ["bash", "-lc", full] : ["-n", "bash", "-lc", full];
595642
- const child = spawn34(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
595643
- let stdout = "";
595644
- let stderr = "";
595645
- child.stdout?.on("data", (data) => {
595646
- stdout += data.toString();
595647
- });
595648
- child.stderr?.on("data", (data) => {
595649
- stderr += data.toString();
595650
- });
595651
- onChildExit(child, () => resolve56());
595652
- onChildError(child, () => resolve56());
595653
- });
595877
+ ctx3.lockFooter?.();
595654
595878
  } catch {
595655
595879
  }
595656
595880
  try {
595657
- if (hadRaw && stdinAny && stdinAny.isTTY && typeof stdinAny.setRawMode === "function") {
595658
- stdinAny.setRawMode(true);
595659
- }
595881
+ lockFooterRedraws();
595660
595882
  } catch {
595661
595883
  }
595662
595884
  try {
595663
- ctx3.showPrompt?.();
595885
+ ctx3.disableMouse?.();
595664
595886
  } catch {
595665
595887
  }
595888
+ setRawInputMode(false);
595889
+ process.env["OMNIUS_ELEVATION_MODE"] = "terminal";
595890
+ writeDirectTerminal(
595891
+ "\x1B[?2026l\x1B[?25h\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[r\x1B[0m\x1B[2J\x1B[H"
595892
+ );
595893
+ writeDirectTerminal(
595894
+ `${c3.bold("Omnius needs administrator privileges")}
595895
+ ${reason}
595896
+
595897
+ `
595898
+ );
595899
+ try {
595900
+ return await run2();
595901
+ } finally {
595902
+ if (hadElevationMode) {
595903
+ process.env["OMNIUS_ELEVATION_MODE"] = previousElevationMode;
595904
+ } else {
595905
+ delete process.env["OMNIUS_ELEVATION_MODE"];
595906
+ }
595907
+ setRawInputMode(hadRaw);
595908
+ writeDirectTerminal(
595909
+ "\x1B[?2026l\x1B[?25h\x1B[r\x1B[0m\x1B[2J\x1B[H"
595910
+ );
595911
+ try {
595912
+ ctx3.unlockFooter?.();
595913
+ } catch {
595914
+ }
595915
+ try {
595916
+ unlockFooterRedraws();
595917
+ } catch {
595918
+ }
595919
+ try {
595920
+ ctx3.refreshDisplay?.();
595921
+ } catch {
595922
+ }
595923
+ try {
595924
+ if (hadMouse) {
595925
+ ctx3.enableMouse?.();
595926
+ writeDirectTerminal("\x1B[?1002h\x1B[?1006h");
595927
+ } else {
595928
+ writeDirectTerminal("\x1B[?1002l\x1B[?1006l");
595929
+ }
595930
+ } catch {
595931
+ }
595932
+ try {
595933
+ ctx3.showPrompt?.();
595934
+ } catch {
595935
+ }
595936
+ }
595937
+ }
595938
+ async function acquireSudoCredentials(ctx3, reason) {
595939
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
595940
+ if (isRoot) return true;
595941
+ const { spawnSync: spawnSync8 } = await import("node:child_process");
595942
+ return await withTransientTerminalPrivilegePrompt(ctx3, reason, () => {
595943
+ const hasInteractiveTty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
595944
+ const sudoResult = spawnSync8(
595945
+ "sudo",
595946
+ hasInteractiveTty ? ["-v"] : ["-n", "-v"],
595947
+ {
595948
+ stdio: hasInteractiveTty ? "inherit" : "pipe",
595949
+ timeout: 6e4
595950
+ }
595951
+ );
595952
+ return sudoResult.status === 0;
595953
+ });
595954
+ }
595955
+ async function runSudoScript(ctx3, script) {
595956
+ try {
595957
+ const { spawn: spawn34 } = await import("node:child_process");
595958
+ const full = `set -e; ${script}`;
595959
+ await withTransientTerminalPrivilegePrompt(
595960
+ ctx3,
595961
+ "Running elevated system changes.",
595962
+ () => new Promise((resolve56, reject) => {
595963
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
595964
+ const hasInteractiveTty = Boolean(
595965
+ process.stdin.isTTY && process.stdout.isTTY
595966
+ );
595967
+ const cmd = isRoot ? "bash" : "sudo";
595968
+ const args = isRoot ? ["-lc", full] : hasInteractiveTty ? ["bash", "-lc", full] : ["-n", "bash", "-lc", full];
595969
+ const child = spawn34(cmd, args, {
595970
+ stdio: hasInteractiveTty ? "inherit" : ["ignore", "pipe", "pipe"],
595971
+ env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
595972
+ });
595973
+ let stdout = "";
595974
+ let stderr = "";
595975
+ child.stdout?.on("data", (data) => {
595976
+ stdout += data.toString();
595977
+ });
595978
+ child.stderr?.on("data", (data) => {
595979
+ stderr += data.toString();
595980
+ });
595981
+ onChildExit(child, (code8) => {
595982
+ if (code8 === 0) {
595983
+ resolve56();
595984
+ return;
595985
+ }
595986
+ reject(
595987
+ new Error(
595988
+ (stderr || stdout || `elevated command exited with ${code8}`).trim().slice(0, 500)
595989
+ )
595990
+ );
595991
+ });
595992
+ onChildError(child, (err) => reject(err));
595993
+ })
595994
+ );
595995
+ } catch (err) {
595996
+ renderWarning(
595997
+ `Elevated command failed: ${err instanceof Error ? err.message : String(err)}`
595998
+ );
595999
+ }
595666
596000
  }
595667
596001
  async function ensureVoiceDeps(ctx3) {
595668
596002
  try {
@@ -606706,14 +607040,23 @@ async function handleUpdate(subcommand, ctx3) {
606706
607040
  renderInfo("Updating Ollama to the latest version...");
606707
607041
  }
606708
607042
  try {
606709
- if (doUpdateOllama()) {
607043
+ const updated = await withTransientTerminalPrivilegePrompt(
607044
+ ctx3,
607045
+ "Updating Ollama may need administrator privileges.",
607046
+ () => doUpdateOllama()
607047
+ );
607048
+ if (updated) {
606710
607049
  renderInfo("Ollama updated successfully.");
606711
607050
  try {
606712
607051
  const { runElevatedCommand: runElevatedCommand2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
606713
- runElevatedCommand2("systemctl restart ollama", {
606714
- timeoutMs: 1e4,
606715
- swallowErrors: true
606716
- });
607052
+ await withTransientTerminalPrivilegePrompt(
607053
+ ctx3,
607054
+ "Restarting the Ollama service may need administrator privileges.",
607055
+ () => runElevatedCommand2("systemctl restart ollama", {
607056
+ timeoutMs: 1e4,
607057
+ swallowErrors: true
607058
+ })
607059
+ );
606717
607060
  } catch {
606718
607061
  }
606719
607062
  } else {
@@ -606770,13 +607113,6 @@ async function handleUpdate(subcommand, ctx3) {
606770
607113
  "⣀",
606771
607114
  "⡀"
606772
607115
  ];
606773
- const safeWrite = (text) => {
606774
- if (isNeovimActive()) {
606775
- writeToNeovimOutput(text);
606776
- } else {
606777
- process.stdout.write(text);
606778
- }
606779
- };
606780
607116
  const PROGRESS_BLOCKS = [
606781
607117
  " ",
606782
607118
  "⠁",
@@ -606958,9 +607294,9 @@ async function handleUpdate(subcommand, ctx3) {
606958
607294
  (async () => {
606959
607295
  try {
606960
607296
  const prefix = await execA("npm prefix -g", { timeout: 5e3 });
606961
- const { accessSync, constants } = await import("node:fs");
607297
+ const { accessSync: accessSync2, constants: constants2 } = await import("node:fs");
606962
607298
  try {
606963
- accessSync(prefix, constants.W_OK);
607299
+ accessSync2(prefix, constants2.W_OK);
606964
607300
  return false;
606965
607301
  } catch {
606966
607302
  return true;
@@ -607200,7 +607536,16 @@ async function handleUpdate(subcommand, ctx3) {
607200
607536
  const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
607201
607537
  const { join: pj3 } = await import("node:path");
607202
607538
  const omniusPkgDir = pj3(globalModules, "omnius");
607203
- const sudoPrefix2 = needsSudo ? "sudo " : "";
607539
+ if (needsSudo && !await acquireSudoCredentials(
607540
+ ctx3,
607541
+ `Updating ${depName} in the global Omnius install requires administrator privileges.`
607542
+ )) {
607543
+ renderWarning(
607544
+ "Could not acquire sudo credentials. Try: sudo npm i -g omnius"
607545
+ );
607546
+ return;
607547
+ }
607548
+ const sudoPrefix2 = needsSudo ? "sudo -n " : "";
607204
607549
  const cmd = `${sudoPrefix2}npm install ${depName}@latest --prefer-online --save --prefix "${omniusPkgDir}" 2>&1`;
607205
607550
  const result = await execA(cmd, { timeout: 6e4 }).catch(
607206
607551
  (e2) => e2.message
@@ -607220,14 +607565,23 @@ async function handleUpdate(subcommand, ctx3) {
607220
607565
  renderInfo("Updating Ollama...");
607221
607566
  try {
607222
607567
  const { updateOllama: updateOllama2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
607223
- if (updateOllama2()) {
607568
+ const updated = await withTransientTerminalPrivilegePrompt(
607569
+ ctx3,
607570
+ "Updating Ollama may need administrator privileges.",
607571
+ () => updateOllama2()
607572
+ );
607573
+ if (updated) {
607224
607574
  renderInfo(`Ollama updated successfully!`);
607225
607575
  try {
607226
- const { execSync: es } = await import("node:child_process");
607227
- es("sudo systemctl restart ollama 2>/dev/null || true", {
607228
- timeout: 1e4,
607229
- stdio: "pipe"
607230
- });
607576
+ const { runElevatedCommand: runElevatedCommand2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
607577
+ await withTransientTerminalPrivilegePrompt(
607578
+ ctx3,
607579
+ "Restarting the Ollama service may need administrator privileges.",
607580
+ () => runElevatedCommand2("systemctl restart ollama", {
607581
+ timeoutMs: 1e4,
607582
+ swallowErrors: true
607583
+ })
607584
+ );
607231
607585
  } catch {
607232
607586
  }
607233
607587
  } else {
@@ -607257,7 +607611,7 @@ async function handleUpdate(subcommand, ctx3) {
607257
607611
  return compact3.slice(0, Math.max(1, max - 1)).trimEnd() + "…";
607258
607612
  };
607259
607613
  const summarizeInstallCommand = (cmd) => {
607260
- const cleaned = cmd.replace(/^\s*sudo\s+/, "").replace(/\s+2>\/dev\/null/g, "").replace(/\s+\|\|\s+true\s*$/g, "").replace(/\s+/g, " ").trim();
607614
+ const cleaned = cmd.replace(/^\s*sudo(?:\s+-n)?\s+/, "").replace(/\s+2>\/dev\/null/g, "").replace(/\s+\|\|\s+true\s*$/g, "").replace(/\s+/g, " ").trim();
607261
607615
  if (/^npm install -g omnius@/i.test(cleaned)) {
607262
607616
  const match = cleaned.match(/omnius@([^\s]+)/i);
607263
607617
  return `installing omnius@${match?.[1] ?? "latest"}`;
@@ -607389,17 +607743,11 @@ async function handleUpdate(subcommand, ctx3) {
607389
607743
  installOverlay.stop("Requesting permissions...");
607390
607744
  await new Promise((r2) => setTimeout(r2, 300));
607391
607745
  installOverlay.dismiss();
607392
- renderInfo("Global npm directory requires elevated permissions.");
607393
- renderInfo("Enter your password if prompted...");
607394
- safeWrite("\n");
607395
- try {
607396
- const { spawnSync: spawnSync8 } = await import("node:child_process");
607397
- const sudoResult = spawnSync8("sudo", ["-v"], {
607398
- stdio: "inherit",
607399
- timeout: 6e4
607400
- });
607401
- if (sudoResult.status !== 0) throw new Error("sudo failed");
607402
- } catch {
607746
+ const sudoReady = await acquireSudoCredentials(
607747
+ ctx3,
607748
+ "The global npm directory requires elevated permissions for this update."
607749
+ );
607750
+ if (!sudoReady) {
607403
607751
  renderWarning(
607404
607752
  "Could not acquire sudo credentials. Try: sudo npm i -g omnius"
607405
607753
  );
@@ -607408,7 +607756,8 @@ async function handleUpdate(subcommand, ctx3) {
607408
607756
  const installOverlay2 = startInstallOverlay(targetVersion);
607409
607757
  Object.assign(installOverlay, installOverlay2);
607410
607758
  }
607411
- const sudoPrefix = needsSudo ? "sudo " : "";
607759
+ const sudoPrefix = needsSudo ? "sudo -n " : "";
607760
+ const manualSudoPrefix = needsSudo ? "sudo " : "";
607412
607761
  let primaryUpdated = false;
607413
607762
  let depsUpdated = false;
607414
607763
  const totalPhases = (doPackage && info ? 5 : 0) + (doDeps ? 5 : 0) + (doRebuild ? 3 : 0) + (doPython ? 3 : 0) + (doCloudflared ? 2 : 0) + (doOllama ? 2 : 0);
@@ -607463,7 +607812,7 @@ async function handleUpdate(subcommand, ctx3) {
607463
607812
  installOverlay.stop("Install failed");
607464
607813
  await new Promise((r2) => setTimeout(r2, 2e3));
607465
607814
  installOverlay.dismiss();
607466
- const hint = process.platform === "win32" ? `npm i -g omnius${versionSpec} (run terminal as Administrator)` : `${sudoPrefix}npm cache clean --force && ${sudoPrefix}npm i -g omnius${versionSpec}`;
607815
+ const hint = process.platform === "win32" ? `npm i -g omnius${versionSpec} (run terminal as Administrator)` : `${manualSudoPrefix}npm cache clean --force && ${manualSudoPrefix}npm i -g omnius${versionSpec}`;
607467
607816
  renderWarning(
607468
607817
  `Update failed: ${installError.slice(0, 150) || "unknown error"}`
607469
607818
  );
@@ -607556,17 +607905,38 @@ async function handleUpdate(subcommand, ctx3) {
607556
607905
  installOverlay.setPhase("Ollama");
607557
607906
  installOverlay.setStatus("Updating Ollama...");
607558
607907
  try {
607559
- const { updateOllama: doOllamaUpgrade } = await Promise.resolve().then(() => (init_setup(), setup_exports));
607560
- if (doOllamaUpgrade()) {
607561
- installOverlay.setStatus(`Ollama updated to ${ollamaUpdate.latest}`);
607562
- try {
607563
- const { execSync: es22 } = await import("node:child_process");
607564
- es22("sudo systemctl restart ollama 2>/dev/null || true", {
607565
- timeout: 1e4,
607566
- stdio: "pipe"
607567
- });
607568
- } catch {
607908
+ installOverlay.stop("Updating Ollama...");
607909
+ await new Promise((r2) => setTimeout(r2, 300));
607910
+ installOverlay.dismiss();
607911
+ const ollamaUpdated = await withTransientTerminalPrivilegePrompt(
607912
+ ctx3,
607913
+ "Updating Ollama may need administrator privileges.",
607914
+ async () => {
607915
+ const {
607916
+ updateOllama: doOllamaUpgrade,
607917
+ runElevatedCommand: runElevatedCommand2
607918
+ } = await Promise.resolve().then(() => (init_setup(), setup_exports));
607919
+ const ok3 = doOllamaUpgrade();
607920
+ if (ok3) {
607921
+ try {
607922
+ runElevatedCommand2("systemctl restart ollama", {
607923
+ timeoutMs: 1e4,
607924
+ swallowErrors: true
607925
+ });
607926
+ } catch {
607927
+ }
607928
+ }
607929
+ return ok3;
607569
607930
  }
607931
+ );
607932
+ const installOverlay3 = startInstallOverlay(targetVersion);
607933
+ Object.assign(installOverlay, installOverlay3);
607934
+ installOverlay.setProgress(completedPhases, totalPhases);
607935
+ installOverlay.setPhase("Ollama");
607936
+ if (ollamaUpdated) {
607937
+ installOverlay.setStatus(`Ollama updated to ${ollamaUpdate.latest}`);
607938
+ } else {
607939
+ installOverlay.setStatus("Ollama update skipped/failed");
607570
607940
  }
607571
607941
  } catch {
607572
607942
  }
@@ -607657,7 +608027,18 @@ async function handleUpdate(subcommand, ctx3) {
607657
608027
  if (!hasPython) {
607658
608028
  installOverlay.setStatus("Installing Python3...");
607659
608029
  try {
607660
- ensurePython3();
608030
+ installOverlay.stop("Installing Python3...");
608031
+ await new Promise((r2) => setTimeout(r2, 300));
608032
+ installOverlay.dismiss();
608033
+ await withTransientTerminalPrivilegePrompt(
608034
+ ctx3,
608035
+ "Installing Python3 may need administrator privileges.",
608036
+ () => ensurePython3()
608037
+ );
608038
+ const installOverlayPy = startInstallOverlay(targetVersion);
608039
+ Object.assign(installOverlay, installOverlayPy);
608040
+ installOverlay.setProgress(completedPhases, totalPhases);
608041
+ installOverlay.setPhase("Python");
607661
608042
  hasPython = hasCmd("python3") || hasCmd("python");
607662
608043
  } catch {
607663
608044
  }
@@ -607668,7 +608049,18 @@ async function handleUpdate(subcommand, ctx3) {
607668
608049
  if (hasPython && !checkPythonVenv()) {
607669
608050
  installOverlay.setStatus("Installing python3-venv...");
607670
608051
  try {
607671
- ensurePythonVenv();
608052
+ installOverlay.stop("Installing python3-venv...");
608053
+ await new Promise((r2) => setTimeout(r2, 300));
608054
+ installOverlay.dismiss();
608055
+ await withTransientTerminalPrivilegePrompt(
608056
+ ctx3,
608057
+ "Installing python3-venv may need administrator privileges.",
608058
+ () => ensurePythonVenv()
608059
+ );
608060
+ const installOverlayVenv = startInstallOverlay(targetVersion);
608061
+ Object.assign(installOverlay, installOverlayVenv);
608062
+ installOverlay.setProgress(completedPhases, totalPhases);
608063
+ installOverlay.setPhase("Python");
607672
608064
  } catch {
607673
608065
  }
607674
608066
  }
@@ -607689,9 +608081,20 @@ async function handleUpdate(subcommand, ctx3) {
607689
608081
  installOverlay.setStatus("Python packages updated");
607690
608082
  } else {
607691
608083
  installOverlay.setStatus("Setting up Python venv...");
607692
- await ensureVisionDeps(() => {
607693
- }).catch(() => {
608084
+ installOverlay.stop("Setting up Python dependencies...");
608085
+ await new Promise((r2) => setTimeout(r2, 300));
608086
+ installOverlay.dismiss();
608087
+ await withTransientTerminalPrivilegePrompt(
608088
+ ctx3,
608089
+ "Installing Python vision dependencies may need administrator privileges.",
608090
+ () => ensureVisionDeps(() => {
608091
+ })
608092
+ ).catch(() => {
607694
608093
  });
608094
+ const installOverlayVision = startInstallOverlay(targetVersion);
608095
+ Object.assign(installOverlay, installOverlayVision);
608096
+ installOverlay.setProgress(completedPhases, totalPhases);
608097
+ installOverlay.setPhase("Python");
607695
608098
  installOverlay.setStatus("Python deps bootstrapped");
607696
608099
  }
607697
608100
  completedPhases += 3;
@@ -607709,13 +608112,33 @@ async function handleUpdate(subcommand, ctx3) {
607709
608112
  }
607710
608113
  if (!hasCf) {
607711
608114
  installOverlay.setStatus("Installing cloudflared...");
607712
- void ensureCloudflaredBackground(() => {
607713
- });
607714
- await new Promise((r2) => setTimeout(r2, 1e3));
608115
+ installOverlay.stop("Installing cloudflared...");
608116
+ await new Promise((r2) => setTimeout(r2, 300));
608117
+ installOverlay.dismiss();
608118
+ await withTransientTerminalPrivilegePrompt(
608119
+ ctx3,
608120
+ "Installing cloudflared may need administrator privileges.",
608121
+ () => ensureCloudflaredBackground(() => {
608122
+ })
608123
+ ).catch(() => false);
608124
+ const installOverlayCf = startInstallOverlay(targetVersion);
608125
+ Object.assign(installOverlay, installOverlayCf);
608126
+ installOverlay.setProgress(completedPhases, totalPhases);
608127
+ installOverlay.setPhase("Cloudflared");
607715
608128
  } else {
607716
608129
  installOverlay.setStatus("cloudflared ready");
607717
608130
  }
607718
- void ensureTranscribeCliBackground();
608131
+ installOverlay.setStatus("Checking transcribe-cli...");
608132
+ if (!hasCmd("transcribe-cli")) {
608133
+ await withTransientTerminalPrivilegePrompt(
608134
+ ctx3,
608135
+ "Installing transcribe-cli may need administrator privileges.",
608136
+ () => ensureTranscribeCliBackground()
608137
+ ).catch(() => false);
608138
+ } else {
608139
+ await ensureTranscribeCliBackground().catch(() => false);
608140
+ }
608141
+ installOverlay.setStatus("cloudflared/transcribe checks complete");
607719
608142
  }
607720
608143
  if (!primaryUpdated) {
607721
608144
  installOverlay.stop("Done — no restart needed");
@@ -662000,6 +662423,9 @@ Log: ${nexusLogPath}`)
662000
662423
  statusBar.fillContentArea();
662001
662424
  statusBar.refreshHeaderContent();
662002
662425
  },
662426
+ refreshDisplay() {
662427
+ statusBar.refreshDisplay();
662428
+ },
662003
662429
  exit() {
662004
662430
  if (reminderDispatchTimer) {
662005
662431
  clearInterval(reminderDispatchTimer);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.148",
3
+ "version": "1.0.149",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.148",
9
+ "version": "1.0.149",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.148",
3
+ "version": "1.0.149",
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/index.js",