omnius 1.0.617 → 1.0.619

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
@@ -204044,7 +204044,7 @@ var require_snapshot_recorder = __commonJS({
204044
204044
  "../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
204045
204045
  "use strict";
204046
204046
  var { writeFile: writeFile27, readFile: readFile27, mkdir: mkdir24 } = __require("node:fs/promises");
204047
- var { dirname: dirname67, resolve: resolve88 } = __require("node:path");
204047
+ var { dirname: dirname68, resolve: resolve88 } = __require("node:path");
204048
204048
  var { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = __require("node:timers");
204049
204049
  var { InvalidArgumentError, UndiciError } = require_errors2();
204050
204050
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -204275,7 +204275,7 @@ var require_snapshot_recorder = __commonJS({
204275
204275
  throw new InvalidArgumentError("Snapshot path is required");
204276
204276
  }
204277
204277
  const resolvedPath = resolve88(path16);
204278
- await mkdir24(dirname67(resolvedPath), { recursive: true });
204278
+ await mkdir24(dirname68(resolvedPath), { recursive: true });
204279
204279
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
204280
204280
  hash: hash2,
204281
204281
  snapshot
@@ -317937,15 +317937,15 @@ var init_ls = __esm({
317937
317937
  });
317938
317938
 
317939
317939
  // ../node_modules/@helia/unixfs/dist/src/commands/mkdir.js
317940
- async function mkdir6(parentCid, dirname67, blockstore, options2 = {}) {
317941
- if (dirname67.includes("/")) {
317940
+ async function mkdir6(parentCid, dirname68, blockstore, options2 = {}) {
317941
+ if (dirname68.includes("/")) {
317942
317942
  throw new InvalidParametersError4("Path must not have slashes");
317943
317943
  }
317944
317944
  const entry = await exporter2(parentCid, blockstore, options2);
317945
317945
  if (entry.type !== "directory") {
317946
317946
  throw new NotADirectoryError(`${parentCid.toString()} was not a UnixFS directory`);
317947
317947
  }
317948
- log16("creating %s", dirname67);
317948
+ log16("creating %s", dirname68);
317949
317949
  const metadata = new UnixFS({
317950
317950
  type: "directory",
317951
317951
  mode: options2.mode,
@@ -317961,9 +317961,9 @@ async function mkdir6(parentCid, dirname67, blockstore, options2 = {}) {
317961
317961
  await blockstore.put(emptyDirCid, buf);
317962
317962
  const [directory, pblink] = await Promise.all([
317963
317963
  cidToDirectory(parentCid, blockstore, options2),
317964
- cidToPBLink(emptyDirCid, dirname67, blockstore, options2)
317964
+ cidToPBLink(emptyDirCid, dirname68, blockstore, options2)
317965
317965
  ]);
317966
- log16("adding empty dir called %s to %c", dirname67, parentCid);
317966
+ log16("adding empty dir called %s to %c", dirname68, parentCid);
317967
317967
  const result = await addLink(directory, pblink, blockstore, {
317968
317968
  ...options2,
317969
317969
  allowOverwriting: options2.force
@@ -318462,8 +318462,8 @@ var init_unixfs2 = __esm({
318462
318462
  async *ls(cid, options2 = {}) {
318463
318463
  yield* ls(cid, this.components.blockstore, options2);
318464
318464
  }
318465
- async mkdir(cid, dirname67, options2 = {}) {
318466
- return mkdir6(cid, dirname67, this.components.blockstore, options2);
318465
+ async mkdir(cid, dirname68, options2 = {}) {
318466
+ return mkdir6(cid, dirname68, this.components.blockstore, options2);
318467
318467
  }
318468
318468
  async rm(cid, path16, options2 = {}) {
318469
318469
  return rm3(cid, path16, this.components.blockstore, options2);
@@ -566258,7 +566258,7 @@ var require_path_browserify = __commonJS({
566258
566258
  _makeLong: function _makeLong(path16) {
566259
566259
  return path16;
566260
566260
  },
566261
- dirname: function dirname67(path16) {
566261
+ dirname: function dirname68(path16) {
566262
566262
  assertPath(path16);
566263
566263
  if (path16.length === 0) return ".";
566264
566264
  var code8 = path16.charCodeAt(0);
@@ -602245,9 +602245,9 @@ function whisperModel(engineId, id2, label) {
602245
602245
  languages: ["multilingual"],
602246
602246
  capabilities: whisperCapabilities,
602247
602247
  resources: {
602248
- cpuSupported: engineId === "transcribe-cli",
602248
+ cpuSupported: false,
602249
602249
  architectures: ["x64", "arm64"],
602250
- notes: engineId === "transcribe-cli" ? ["Managed transcribe-cli runtime; implementation may use faster-whisper or ONNX."] : ["CUDA is required by Omnius unless an explicit local override is configured."]
602250
+ notes: ["CUDA is required by Omnius unless an explicit local override is configured."]
602251
602251
  }
602252
602252
  };
602253
602253
  }
@@ -602300,7 +602300,7 @@ var init_registry2 = __esm({
602300
602300
  VIBEVOICE_ASR_SOURCE_REVISION = "94da20d98b2fa7688e9cbfaf7692ddb4954f7600";
602301
602301
  VIBEVOICE_ASR_QWEN_TOKENIZER_REVISION = "d149729398750b98c0af14eb82c78cfe92750796";
602302
602302
  VIBEVOICE_ASR_WEIGHTS_BYTES = 17348198410;
602303
- NEMOTRON_DISABLED_REASON = "Nemotron is catalogued but its legacy self-installing worker is disabled until it is migrated to the managed fail-closed runtime.";
602303
+ NEMOTRON_DISABLED_REASON = "Nemotron is unavailable because its managed CUDA runtime could not be activated.";
602304
602304
  whisperCapabilities = Object.freeze({
602305
602305
  file: true,
602306
602306
  pcmStream: true,
@@ -602325,15 +602325,6 @@ var init_registry2 = __esm({
602325
602325
  setupMode: "managed",
602326
602326
  models: whisperModels("openai-whisper")
602327
602327
  },
602328
- {
602329
- id: "transcribe-cli",
602330
- label: "transcribe-cli",
602331
- detail: "Managed faster-whisper/ONNX bridge for live and file transcription",
602332
- provider: "transcribe-cli",
602333
- runtime: "node",
602334
- setupMode: "managed",
602335
- models: whisperModels("transcribe-cli")
602336
- },
602337
602328
  {
602338
602329
  id: "nemotron-streaming",
602339
602330
  label: "NVIDIA Nemotron Speech Streaming",
@@ -602341,8 +602332,6 @@ var init_registry2 = __esm({
602341
602332
  provider: "NVIDIA",
602342
602333
  runtime: "python",
602343
602334
  setupMode: "managed",
602344
- availability: "disabled",
602345
- unavailableReason: NEMOTRON_DISABLED_REASON,
602346
602335
  models: [
602347
602336
  {
602348
602337
  id: "nemotron-speech-streaming-en-0.6b",
@@ -602423,8 +602412,10 @@ var init_registry2 = __esm({
602423
602412
  ENGINE_ALIASES = {
602424
602413
  whisper: "openai-whisper",
602425
602414
  openai_whisper: "openai-whisper",
602426
- faster_whisper: "transcribe-cli",
602427
- transcribe_cli: "transcribe-cli",
602415
+ transcribe_cli: "openai-whisper",
602416
+ transcribe_cli_runtime: "openai-whisper",
602417
+ "transcribe-cli": "openai-whisper",
602418
+ faster_whisper: "openai-whisper",
602428
602419
  nemotron: "nemotron-streaming",
602429
602420
  vibevoice: "vibevoice-transformers",
602430
602421
  vibevoice_asr: "vibevoice-transformers"
@@ -633848,8 +633839,8 @@ var init_adversaryStream = __esm({
633848
633839
  return;
633849
633840
  try {
633850
633841
  const { writeFileSync: writeFileSync104, mkdirSync: mkdirSync120, existsSync: existsSync184 } = __require("node:fs");
633851
- const { dirname: dirname67 } = __require("node:path");
633852
- const dir = dirname67(this.persistPath);
633842
+ const { dirname: dirname68 } = __require("node:path");
633843
+ const dir = dirname68(this.persistPath);
633853
633844
  if (!existsSync184(dir))
633854
633845
  mkdirSync120(dir, { recursive: true });
633855
633846
  writeFileSync104(this.persistPath, JSON.stringify({ ledger: this.ledger }, null, 2));
@@ -679198,6 +679189,8 @@ __export(daemon_exports, {
679198
679189
  getDaemonStatus: () => getDaemonStatus,
679199
679190
  getLocalCliVersion: () => getLocalCliVersion,
679200
679191
  isDaemonRunning: () => isDaemonRunning,
679192
+ managedDaemonServiceOwnsPort: () => managedDaemonServiceOwnsPort,
679193
+ pidIsInManagedDaemonUnit: () => pidIsInManagedDaemonUnit,
679201
679194
  quiesceDaemonForUpdate: () => quiesceDaemonForUpdate,
679202
679195
  reclaimOwnedDaemonListener: () => reclaimOwnedDaemonListener,
679203
679196
  recoverDaemonVersionBoundedly: () => recoverDaemonVersionBoundedly,
@@ -679442,6 +679435,27 @@ async function managedDaemonServiceMatchesPort(port) {
679442
679435
  if (environment === null) return false;
679443
679436
  return daemonServiceMatchesPort(port, environment);
679444
679437
  }
679438
+ function pidIsInManagedDaemonUnit(pid, readCgroup = defaultReadProcCgroup) {
679439
+ const cgroup = readCgroup(pid);
679440
+ return cgroup === null ? false : cgroup.includes("omnius-daemon.service");
679441
+ }
679442
+ function defaultReadProcCgroup(pid) {
679443
+ try {
679444
+ return readFileSync95(`/proc/${pid}/cgroup`, "utf8");
679445
+ } catch {
679446
+ return null;
679447
+ }
679448
+ }
679449
+ async function managedDaemonServiceOwnsPort(port, dependencies = {
679450
+ holderPids: (value2) => portHolderPids(value2),
679451
+ pidInUnit: (pid) => pidIsInManagedDaemonUnit(pid)
679452
+ }) {
679453
+ const holders = await dependencies.holderPids(port);
679454
+ if (holders === null) return false;
679455
+ const uniqueHolders = [...new Set(holders.filter((pid) => pid > 0 && pid !== process.pid))];
679456
+ if (uniqueHolders.length === 0) return true;
679457
+ return uniqueHolders.every((pid) => dependencies.pidInUnit(pid));
679458
+ }
679445
679459
  async function managedDaemonServicePort() {
679446
679460
  if (!await hasManagedDaemonService()) return null;
679447
679461
  const environment = await readUserSystemctl([
@@ -679718,6 +679732,11 @@ async function restartDaemon(port, expectedVersion) {
679718
679732
  const p2 = port ?? getDaemonPort();
679719
679733
  const managed = await managedDaemonServiceMatchesPort(p2);
679720
679734
  if (managed) {
679735
+ if (!await managedDaemonServiceOwnsPort(p2)) {
679736
+ const reclaimed = await reclaimOwnedDaemonListener(p2);
679737
+ if (!reclaimed.ok) return false;
679738
+ await reclaimStaleDaemonEndpointClaim(p2);
679739
+ }
679721
679740
  const restarted = await runUserSystemctl(["restart", "omnius-daemon.service"]);
679722
679741
  if (restarted.ok && (await waitForDaemonReady(p2, expectedVersion)).ok) return true;
679723
679742
  const repaired = await repairManagedDaemonUnit(p2);
@@ -679903,7 +679922,7 @@ async function stopDaemonAtPort(port = getDaemonPort()) {
679903
679922
  async function quiesceDaemonForUpdate(port = getDaemonPort()) {
679904
679923
  if (await managedDaemonServiceMatchesPort(port)) {
679905
679924
  const stopped = await runUserSystemctl(["stop", "omnius-daemon.service"]);
679906
- return stopped.ok && await waitForDaemonStopped(port);
679925
+ if (stopped.ok && await waitForDaemonStopped(port)) return true;
679907
679926
  }
679908
679927
  if (!await isDaemonRunning(port)) {
679909
679928
  return daemonPortIsFree(port);
@@ -680023,6 +680042,13 @@ async function ensureDaemonVersion(expectedVersion = getLocalCliVersion(), port
680023
680042
  return finish(false, "failed", null, 0, process.platform === "linux");
680024
680043
  }
680025
680044
  getDaemonPid();
680045
+ if (await managedDaemonServiceMatchesPort(port)) {
680046
+ const started = await runUserSystemctl(["start", "omnius-daemon.service"]);
680047
+ if (started.ok) {
680048
+ const ready2 = await waitForDaemonReady(port, expectedVersion);
680049
+ if (ready2.ok) return finish(true, "started", ready2.observedVersion);
680050
+ }
680051
+ }
680026
680052
  const pid = await startDaemon(port);
680027
680053
  if (!pid) {
680028
680054
  for (let i2 = 0; i2 < 20; i2++) {
@@ -682368,16 +682394,64 @@ var init_image_ascii_preview = __esm({
682368
682394
  var py_embed_exports = {};
682369
682395
  __export(py_embed_exports, {
682370
682396
  ensureEmbedDeps: () => ensureEmbedDeps,
682397
+ ensureManagedAsrModel: () => ensureManagedAsrModel,
682398
+ getManagedAsrReadiness: () => getManagedAsrReadiness,
682371
682399
  getVenvPython: () => getVenvPython,
682372
682400
  runEmbedAudio: () => runEmbedAudio,
682373
682401
  runEmbedImage: () => runEmbedImage,
682374
682402
  runEmbedText: () => runEmbedText,
682375
- runTranscribeFile: () => runTranscribeFile
682403
+ runTranscribeFile: () => runTranscribeFile,
682404
+ transcribeManagedNemotronFile: () => transcribeManagedNemotronFile
682376
682405
  });
682377
682406
  import { spawnSync as spawnSync9 } from "node:child_process";
682378
682407
  import { existsSync as existsSync122, mkdirSync as mkdirSync74, readFileSync as readFileSync99, writeFileSync as writeFileSync64 } from "node:fs";
682379
- import { join as join134 } from "node:path";
682408
+ import { dirname as dirname46, join as join134 } from "node:path";
682380
682409
  import { homedir as homedir41 } from "node:os";
682410
+ import { fileURLToPath as fileURLToPath21 } from "node:url";
682411
+ function managedAsrStateFile(engineId) {
682412
+ return join134(MANAGED_ASR_ROOT, engineId, "models.json");
682413
+ }
682414
+ function managedAsrModelDir(engineId) {
682415
+ return join134(MANAGED_ASR_MODEL_ROOT, engineId);
682416
+ }
682417
+ function readManagedAsrState(engineId) {
682418
+ try {
682419
+ return JSON.parse(readFileSync99(managedAsrStateFile(engineId), "utf8"));
682420
+ } catch {
682421
+ return {};
682422
+ }
682423
+ }
682424
+ function persistManagedAsrReadiness(readiness) {
682425
+ const root = join134(MANAGED_ASR_ROOT, readiness.engineId);
682426
+ mkdirSync74(root, { recursive: true });
682427
+ const state2 = readManagedAsrState(readiness.engineId);
682428
+ state2.models ??= {};
682429
+ state2.models[readiness.modelId] = {
682430
+ installed: readiness.installed,
682431
+ weightsReady: readiness.weightsReady,
682432
+ device: readiness.device,
682433
+ lastError: readiness.lastError,
682434
+ pulledAt: readiness.pulledAt
682435
+ };
682436
+ writeFileSync64(managedAsrStateFile(readiness.engineId), `${JSON.stringify(state2, null, 2)}
682437
+ `, "utf8");
682438
+ }
682439
+ function assertManagedAsrModel(engineId, modelId) {
682440
+ if (engineId === "openai-whisper" && WHISPER_MODEL_IDS2.has(modelId)) return;
682441
+ if (engineId === "nemotron-streaming" && modelId === NEMOTRON_MODEL_ID) return;
682442
+ throw new Error(`No managed CUDA runtime is registered for ASR model ${engineId}/${modelId}`);
682443
+ }
682444
+ function parseWorkerEvents(output2) {
682445
+ const events = [];
682446
+ for (const line of output2.split(/\r?\n/)) {
682447
+ try {
682448
+ const value2 = JSON.parse(line);
682449
+ if (value2 && typeof value2 === "object") events.push(value2);
682450
+ } catch {
682451
+ }
682452
+ }
682453
+ return events;
682454
+ }
682381
682455
  function getVenvDir() {
682382
682456
  return join134(homedir41(), ".omnius", "venv");
682383
682457
  }
@@ -682746,6 +682820,126 @@ ${log22.slice(-2e3)}` };
682746
682820
  }
682747
682821
  return { ok: ok3, log: log22 };
682748
682822
  }
682823
+ function getManagedAsrReadiness(engineId, modelId) {
682824
+ assertManagedAsrModel(engineId, modelId);
682825
+ const saved = readManagedAsrState(engineId).models?.[modelId];
682826
+ return {
682827
+ engineId,
682828
+ modelId,
682829
+ installed: Boolean(saved?.installed && existsSync122(getVenvPython())),
682830
+ weightsReady: Boolean(saved?.weightsReady),
682831
+ active: false,
682832
+ device: saved?.device,
682833
+ lastError: saved?.lastError,
682834
+ pulledAt: saved?.pulledAt
682835
+ };
682836
+ }
682837
+ function ensureManagedAsrModel(input) {
682838
+ const engineId = input.engineId.trim().toLowerCase();
682839
+ const modelId = input.modelId.trim().toLowerCase();
682840
+ assertManagedAsrModel(engineId, modelId);
682841
+ const deps = ensureEmbedDeps();
682842
+ if (!deps.ok) throw new Error(`ASR dependency setup failed: ${deps.log.slice(-2400)}`);
682843
+ const modelDir2 = managedAsrModelDir(engineId);
682844
+ mkdirSync74(modelDir2, { recursive: true });
682845
+ const env2 = {
682846
+ ...process.env,
682847
+ OMNIUS_ASR_MODEL_DIR: modelDir2,
682848
+ ...input.device ? { OMNIUS_ASR_CUDA_DEVICE: input.device } : {}
682849
+ };
682850
+ let device = "";
682851
+ let failure = "";
682852
+ if (engineId === "openai-whisper") {
682853
+ const code8 = [
682854
+ "import json, os, sys",
682855
+ "import torch, whisper",
682856
+ "allow_cpu=os.environ.get('OMNIUS_ASR_ALLOW_CPU','').strip().lower() in ('1','true','yes','on')",
682857
+ "if torch.cuda.is_available() and torch.cuda.device_count() > 0:",
682858
+ " index=int(os.environ.get('OMNIUS_ASR_CUDA_DEVICE','0') or '0')",
682859
+ " if index < 0 or index >= torch.cuda.device_count(): raise RuntimeError(f'CUDA device {index} is outside the visible device range')",
682860
+ " torch.cuda.set_device(index); device=f'cuda:{index}'",
682861
+ "elif allow_cpu: device='cpu'",
682862
+ `else: raise RuntimeError(f'CUDA-only ASR is enabled but torch cannot use CUDA (torch.version.cuda={getattr(torch.version, \\"cuda\\", None)}, device_count={torch.cuda.device_count()})')`,
682863
+ "model=whisper.load_model(sys.argv[1], device=device, download_root=sys.argv[2])",
682864
+ "print(json.dumps({'ok': True, 'device': device, 'cuda': device.startswith('cuda'), 'model': sys.argv[1]}))"
682865
+ ].join("\n");
682866
+ const pulled = spawnSync9(getVenvPython(), ["-c", code8, modelId, modelDir2], {
682867
+ encoding: "utf8",
682868
+ timeout: 12e5,
682869
+ env: env2
682870
+ });
682871
+ const events = parseWorkerEvents(`${pulled.stdout || ""}`);
682872
+ const ready = events.find((event) => event["ok"] === true);
682873
+ device = typeof ready?.["device"] === "string" ? ready["device"] : "";
682874
+ failure = `${pulled.stderr || ""}`.trim() || (pulled.error ? String(pulled.error) : "");
682875
+ if (pulled.status !== 0 || !ready || !device) {
682876
+ const message2 = failure || `Whisper model pull exited with status ${pulled.status ?? "unknown"}`;
682877
+ const readiness2 = { engineId, modelId, installed: true, weightsReady: false, active: false, lastError: message2 };
682878
+ persistManagedAsrReadiness(readiness2);
682879
+ throw new Error(message2);
682880
+ }
682881
+ } else {
682882
+ const script = locateScript("live-nemotron.py");
682883
+ const pulled = spawnSync9(getVenvPython(), [script, "--model", modelId, "--setup"], {
682884
+ encoding: "utf8",
682885
+ timeout: 12e5,
682886
+ env: env2
682887
+ });
682888
+ const events = parseWorkerEvents(`${pulled.stdout || ""}`);
682889
+ const ready = events.find((event) => event["type"] === "ready");
682890
+ const error = events.find((event) => event["type"] === "error");
682891
+ device = typeof ready?.["device"] === "string" ? ready["device"] : "";
682892
+ failure = String(error?.["message"] ?? (`${pulled.stderr || ""}`.trim() || pulled.error || ""));
682893
+ if (pulled.status !== 0 || !ready || !device) {
682894
+ const message2 = failure || `Nemotron model pull exited with status ${pulled.status ?? "unknown"}`;
682895
+ const readiness2 = { engineId, modelId, installed: true, weightsReady: false, active: false, lastError: message2 };
682896
+ persistManagedAsrReadiness(readiness2);
682897
+ throw new Error(message2);
682898
+ }
682899
+ }
682900
+ const readiness = {
682901
+ engineId,
682902
+ modelId,
682903
+ installed: true,
682904
+ weightsReady: true,
682905
+ active: false,
682906
+ device,
682907
+ pulledAt: (/* @__PURE__ */ new Date()).toISOString()
682908
+ };
682909
+ persistManagedAsrReadiness(readiness);
682910
+ return readiness;
682911
+ }
682912
+ function transcribeManagedNemotronFile(input) {
682913
+ const modelId = input.modelId.trim().toLowerCase();
682914
+ const existing = getManagedAsrReadiness("nemotron-streaming", modelId);
682915
+ if (!existing.weightsReady) ensureManagedAsrModel({ engineId: "nemotron-streaming", modelId, device: input.device });
682916
+ const result = spawnSync9(
682917
+ getVenvPython(),
682918
+ [locateScript("live-nemotron.py"), "--model", modelId, "--file", input.path],
682919
+ {
682920
+ encoding: "utf8",
682921
+ timeout: 12e5,
682922
+ env: {
682923
+ ...process.env,
682924
+ OMNIUS_ASR_MODEL_DIR: managedAsrModelDir("nemotron-streaming"),
682925
+ ...input.device ? { OMNIUS_ASR_CUDA_DEVICE: input.device } : {}
682926
+ }
682927
+ }
682928
+ );
682929
+ const events = parseWorkerEvents(`${result.stdout || ""}`);
682930
+ const transcript = [...events].reverse().find((event) => event["type"] === "transcript");
682931
+ const ready = events.find((event) => event["type"] === "ready");
682932
+ const error = events.find((event) => event["type"] === "error");
682933
+ if (result.status !== 0 || !transcript) {
682934
+ throw new Error(String(error?.["message"] ?? (`${result.stderr || ""}`.trim() || result.error || "Nemotron file transcription failed")));
682935
+ }
682936
+ return {
682937
+ text: String(transcript["text"] ?? ""),
682938
+ duration: Number.isFinite(Number(transcript["audioSeconds"])) ? Number(transcript["audioSeconds"]) : null,
682939
+ device: typeof ready?.["device"] === "string" ? ready["device"] : existing.device,
682940
+ warnings: []
682941
+ };
682942
+ }
682749
682943
  function runEmbedImage(input) {
682750
682944
  const py = getVenvPython();
682751
682945
  const script = locateScript("embed-image.py");
@@ -682792,20 +682986,23 @@ function runTranscribeFile(input) {
682792
682986
  }
682793
682987
  function locateScript(name10) {
682794
682988
  const candidates = [
682989
+ join134(MODULE_DIR, "..", "scripts", name10),
682795
682990
  join134(process.cwd(), "dist", "scripts", name10),
682796
682991
  join134(process.cwd(), name10),
682797
682992
  join134(process.cwd(), "scripts", name10)
682798
682993
  ];
682799
682994
  for (const c9 of candidates) if (existsSync122(c9)) return c9;
682800
682995
  const fallback = join134(process.cwd(), name10);
682801
- try {
682802
- writeFileSync64(fallback, 'print("missing script")\n');
682803
- } catch {
682804
- }
682805
682996
  return fallback;
682806
682997
  }
682998
+ var MODULE_DIR, MANAGED_ASR_ROOT, MANAGED_ASR_MODEL_ROOT, WHISPER_MODEL_IDS2, NEMOTRON_MODEL_ID;
682807
682999
  var init_py_embed = __esm({
682808
683000
  "packages/cli/src/api/py-embed.ts"() {
683001
+ MODULE_DIR = dirname46(fileURLToPath21(import.meta.url));
683002
+ MANAGED_ASR_ROOT = join134(homedir41(), ".omnius", "runtimes", "asr");
683003
+ MANAGED_ASR_MODEL_ROOT = join134(homedir41(), ".omnius", "models", "asr");
683004
+ WHISPER_MODEL_IDS2 = /* @__PURE__ */ new Set(["tiny", "base", "small", "medium", "large-v3"]);
683005
+ NEMOTRON_MODEL_ID = "nemotron-speech-streaming-en-0.6b";
682809
683006
  }
682810
683007
  });
682811
683008
 
@@ -682831,9 +683028,9 @@ import {
682831
683028
  writeFileSync as writeFileSync65,
682832
683029
  readdirSync as readdirSync37
682833
683030
  } from "node:fs";
682834
- import { join as join135, dirname as dirname46 } from "node:path";
683031
+ import { join as join135, dirname as dirname47 } from "node:path";
682835
683032
  import { homedir as homedir42 } from "node:os";
682836
- import { fileURLToPath as fileURLToPath21 } from "node:url";
683033
+ import { fileURLToPath as fileURLToPath22 } from "node:url";
682837
683034
  import { EventEmitter as EventEmitter6 } from "node:events";
682838
683035
  import { createInterface as createInterface3 } from "node:readline";
682839
683036
  function isAudioPath(path16) {
@@ -683086,7 +683283,7 @@ async function findMicCaptureCommand() {
683086
683283
  return null;
683087
683284
  }
683088
683285
  async function findTranscribeFileScript() {
683089
- const thisDir = dirname46(fileURLToPath21(import.meta.url));
683286
+ const thisDir = dirname47(fileURLToPath22(import.meta.url));
683090
683287
  const candidates = [
683091
683288
  join135(thisDir, "../../../../packages/execution/scripts/transcribe-file.py"),
683092
683289
  join135(thisDir, "../../../packages/execution/scripts/transcribe-file.py"),
@@ -683171,15 +683368,15 @@ async function transcribeFileViaWhisper(filePath, model) {
683171
683368
  }
683172
683369
  });
683173
683370
  }
683174
- async function findLiveWhisperScript() {
683175
- const thisDir = dirname46(fileURLToPath21(import.meta.url));
683371
+ async function findLiveAsrScript(scriptName) {
683372
+ const thisDir = dirname47(fileURLToPath22(import.meta.url));
683176
683373
  const candidates = [
683177
- join135(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
683178
- join135(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
683179
- join135(thisDir, "../../execution/scripts/live-whisper.py"),
683374
+ join135(thisDir, "../../../../packages/execution/scripts", scriptName),
683375
+ join135(thisDir, "../../../packages/execution/scripts", scriptName),
683376
+ join135(thisDir, "../../execution/scripts", scriptName),
683180
683377
  // npm install layout — scripts bundled alongside dist
683181
- join135(thisDir, "../scripts/live-whisper.py"),
683182
- join135(thisDir, "../../scripts/live-whisper.py")
683378
+ join135(thisDir, "../scripts", scriptName),
683379
+ join135(thisDir, "../../scripts", scriptName)
683183
683380
  ];
683184
683381
  for (const p2 of candidates) {
683185
683382
  if (existsSync123(p2)) return p2;
@@ -683187,8 +683384,8 @@ async function findLiveWhisperScript() {
683187
683384
  try {
683188
683385
  const globalRoot = (await execFileText5("npm", ["root", "-g"], { timeout: 5e3 })).trim();
683189
683386
  const candidates2 = [
683190
- join135(globalRoot, "omnius", "dist", "scripts", "live-whisper.py"),
683191
- join135(globalRoot, "omnius", "scripts", "live-whisper.py")
683387
+ join135(globalRoot, "omnius", "dist", "scripts", scriptName),
683388
+ join135(globalRoot, "omnius", "scripts", scriptName)
683192
683389
  ];
683193
683390
  for (const p2 of candidates2) {
683194
683391
  if (existsSync123(p2)) return p2;
@@ -683207,7 +683404,7 @@ async function findLiveWhisperScript() {
683207
683404
  "omnius",
683208
683405
  "dist",
683209
683406
  "scripts",
683210
- "live-whisper.py"
683407
+ scriptName
683211
683408
  );
683212
683409
  if (existsSync123(p2)) return p2;
683213
683410
  }
@@ -683216,6 +683413,12 @@ async function findLiveWhisperScript() {
683216
683413
  }
683217
683414
  return null;
683218
683415
  }
683416
+ async function findLiveWhisperScript() {
683417
+ return findLiveAsrScript("live-whisper.py");
683418
+ }
683419
+ async function findLiveNemotronScript() {
683420
+ return findLiveAsrScript("live-nemotron.py");
683421
+ }
683219
683422
  function defaultConsensusModel(primaryModel) {
683220
683423
  const model = primaryModel.trim().toLowerCase();
683221
683424
  if (model === "tiny") return "base";
@@ -683437,13 +683640,15 @@ var init_listen = __esm({
683437
683640
  196
683438
683641
  ];
683439
683642
  WhisperFallbackTranscriber = class extends EventEmitter6 {
683440
- constructor(model, scriptPath2) {
683643
+ constructor(model, scriptPath2, engineId = "openai-whisper") {
683441
683644
  super();
683442
683645
  this.model = model;
683443
683646
  this.scriptPath = scriptPath2;
683647
+ this.engineId = engineId;
683444
683648
  }
683445
683649
  model;
683446
683650
  scriptPath;
683651
+ engineId;
683447
683652
  process = null;
683448
683653
  _ready = false;
683449
683654
  registeredBrokerName = null;
@@ -683475,30 +683680,31 @@ var init_listen = __esm({
683475
683680
  }
683476
683681
  updateListenLiveState({
683477
683682
  phase: "loading-model",
683478
- backend: "openai-whisper",
683683
+ backend: this.engineId,
683479
683684
  model: this.model,
683480
- lastStatus: `loading whisper ${this.model} model...`
683685
+ lastStatus: `loading ${this.engineId} ${this.model} model...`
683481
683686
  });
683482
683687
  const consensusModel = resolveAsrConsensusModel(this.model);
683483
683688
  const consensusThreshold = String(process.env["OMNIUS_ASR_CONSENSUS_THRESHOLD"] ?? "0.45");
683484
683689
  const silenceMs = String(process.env["OMNIUS_ASR_SILENCE_MS"] ?? "3000");
683690
+ const workerArgs = this.engineId === "nemotron-streaming" ? [this.scriptPath, "--model", this.model] : [
683691
+ this.scriptPath,
683692
+ "--model",
683693
+ this.model,
683694
+ "--chunk-seconds",
683695
+ "3",
683696
+ "--window-seconds",
683697
+ "10",
683698
+ "--consensus-model",
683699
+ consensusModel,
683700
+ "--consensus-threshold",
683701
+ consensusThreshold,
683702
+ "--silence-ms",
683703
+ silenceMs
683704
+ ];
683485
683705
  this.process = spawn33(
683486
683706
  pyPath,
683487
- [
683488
- this.scriptPath,
683489
- "--model",
683490
- this.model,
683491
- "--chunk-seconds",
683492
- "3",
683493
- "--window-seconds",
683494
- "10",
683495
- "--consensus-model",
683496
- consensusModel,
683497
- "--consensus-threshold",
683498
- consensusThreshold,
683499
- "--silence-ms",
683500
- silenceMs
683501
- ],
683707
+ workerArgs,
683502
683708
  {
683503
683709
  stdio: ["pipe", "pipe", "pipe"],
683504
683710
  env: { ...process.env }
@@ -683524,7 +683730,7 @@ var init_listen = __esm({
683524
683730
  case "ready":
683525
683731
  this._ready = true;
683526
683732
  clearTimeout(timeout2);
683527
- updateListenLiveState({ phase: "ready", lastStatus: "whisper model loaded" });
683733
+ updateListenLiveState({ phase: "ready", lastStatus: `${this.engineId} model loaded` });
683528
683734
  this.registerBrokerModel(evt);
683529
683735
  this.emit("ready");
683530
683736
  resolve88();
@@ -683554,7 +683760,7 @@ var init_listen = __esm({
683554
683760
  const speech = evt.speech === true;
683555
683761
  const now2 = Date.now();
683556
683762
  if (process.env["OMNIUS_ASR_VERBOSE_VAD"] === "1" && (speech !== this.lastVadSpeech || now2 - this.lastVisibleVadAt > 1e4)) {
683557
- this.emit("status", `Whisper VAD: ${speech ? "speech" : "silence"}`);
683763
+ this.emit("status", `${this.engineId} VAD: ${speech ? "speech" : "silence"}`);
683558
683764
  this.lastVisibleVadAt = now2;
683559
683765
  }
683560
683766
  this.lastVadSpeech = speech;
@@ -683621,11 +683827,11 @@ var init_listen = __esm({
683621
683827
  const gpuIndexMatch = device.match(/^cuda:(\d+)/);
683622
683828
  const gpuIndex = gpuIndexMatch ? Number(gpuIndexMatch[1]) : null;
683623
683829
  const consensus = typeof evt["consensusModel"] === "string" && String(evt["consensusModel"]).trim() ? String(evt["consensusModel"]).trim() : "";
683624
- const name10 = `whisper:${this.model}${consensus ? `+${consensus}` : ""}`;
683830
+ const name10 = `${this.engineId}:${this.model}${consensus ? `+${consensus}` : ""}`;
683625
683831
  const vramMB = Math.max(0, Math.round(Number(evt["vramUsedMB"] ?? 0)));
683626
683832
  try {
683627
683833
  getModelBroker().registerLoaded({
683628
- key: `whisper-cli:${name10}`,
683834
+ key: `asr-worker:${name10}`,
683629
683835
  name: name10,
683630
683836
  domain: "asr",
683631
683837
  host: "whisper-cli",
@@ -683672,7 +683878,7 @@ var init_listen = __esm({
683672
683878
  // Medium by default (EGG lineage): with utterance-chunked capture the
683673
683879
  // per-utterance compute fits, and accuracy jumps over base.
683674
683880
  model: config?.model ?? "medium",
683675
- engineId: config?.engineId ?? "openai-whisper",
683881
+ engineId: normalizeAsrEngineId(config?.engineId ?? "openai-whisper"),
683676
683882
  modelId: config?.modelId ?? config?.model ?? "medium",
683677
683883
  mode: config?.mode ?? "confirm",
683678
683884
  silenceTimeoutMs: config?.silenceTimeoutMs ?? 3e3
@@ -683759,6 +683965,14 @@ var init_listen = __esm({
683759
683965
  }
683760
683966
  const unavailableReason = getAsrEngineUnavailableReason(selection.engineId);
683761
683967
  if (unavailableReason) throw new Error(unavailableReason);
683968
+ if (options2.setup && (selection.engineId === "openai-whisper" || selection.engineId === "nemotron-streaming")) {
683969
+ const managed = await Promise.resolve().then(() => (init_py_embed(), py_embed_exports));
683970
+ managed.ensureManagedAsrModel({
683971
+ engineId: selection.engineId,
683972
+ modelId: selection.modelId,
683973
+ device: options2.device
683974
+ });
683975
+ }
683762
683976
  const whisperModel2 = selection.modelId;
683763
683977
  if (wasActive) await this.stop();
683764
683978
  if (previous.engineId === "vibevoice-transformers") await stopVibeVoiceAsr();
@@ -683904,7 +684118,7 @@ var init_listen = __esm({
683904
684118
  const req3 = createRequire12(import.meta.url);
683905
684119
  const loaded = req3("transcribe-cli");
683906
684120
  try {
683907
- transcribeCliPackageDirs.add(dirname46(req3.resolve("transcribe-cli/package.json")));
684121
+ transcribeCliPackageDirs.add(dirname47(req3.resolve("transcribe-cli/package.json")));
683908
684122
  } catch {
683909
684123
  }
683910
684124
  return loaded;
@@ -683951,9 +684165,7 @@ var init_listen = __esm({
683951
684165
  if (this.config.engineId === "vibevoice-transformers") {
683952
684166
  return "VibeVoice ASR does not support incremental PCM streaming. Use file/completed-utterance transcription or select Whisper.";
683953
684167
  }
683954
- if (this.config.engineId === "nemotron-streaming") {
683955
- return "Nemotron live activation is unavailable until its managed CUDA runtime passes the hardware gate.";
683956
- }
684168
+ const isNemotron = this.config.engineId === "nemotron-streaming";
683957
684169
  this.micWaterfall = [];
683958
684170
  updateListenLiveState({
683959
684171
  phase: "bootstrapping",
@@ -683970,17 +684182,17 @@ var init_listen = __esm({
683970
684182
  updateListenLiveState({ phase: "error", lastStatus: "no mic capture tool (arecord/sox/ffmpeg)" });
683971
684183
  return "No microphone capture tool found. Install arecord (Linux), sox (macOS), or ffmpeg.";
683972
684184
  }
683973
- const consensusEnabled = asrConsensusEnabled(this.config.model);
683974
- const useTranscribeCli = this.config.engineId === "transcribe-cli" || liveAsrUseTranscribeCli() && !consensusEnabled;
684185
+ const consensusEnabled = !isNemotron && asrConsensusEnabled(this.config.model);
684186
+ const useTranscribeCli = !isNemotron && liveAsrUseTranscribeCli() && !consensusEnabled;
683975
684187
  const preferWhisperFallback = !useTranscribeCli;
683976
684188
  if (preferWhisperFallback) {
683977
684189
  this.emit(
683978
684190
  "info",
683979
- consensusEnabled ? "ASR consensus enabled — using live-whisper.py with CUDA-only Whisper guard." : "Using live-whisper.py with CUDA-only Whisper guard."
684191
+ consensusEnabled ? "ASR consensus enabled — using live-whisper.py with CUDA-only Whisper guard." : isNemotron ? "Using managed Nemotron worker with CUDA-only guard." : "Using live-whisper.py with CUDA-only Whisper guard."
683980
684192
  );
683981
684193
  updateListenLiveState({
683982
- backend: "openai-whisper",
683983
- lastStatus: consensusEnabled ? "starting consensus Whisper backend..." : "starting CUDA Whisper backend..."
684194
+ backend: this.config.engineId,
684195
+ lastStatus: consensusEnabled ? "starting consensus Whisper backend..." : isNemotron ? "starting CUDA Nemotron backend..." : "starting CUDA Whisper backend..."
683984
684196
  });
683985
684197
  }
683986
684198
  let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
@@ -684008,7 +684220,7 @@ var init_listen = __esm({
684008
684220
  let tcUpToDate = false;
684009
684221
  try {
684010
684222
  const tcPkgPath = join135(
684011
- dirname46(__require.resolve?.("transcribe-cli/package.json") || ""),
684223
+ dirname47(__require.resolve?.("transcribe-cli/package.json") || ""),
684012
684224
  "package.json"
684013
684225
  );
684014
684226
  if (existsSync123(tcPkgPath)) {
@@ -684106,15 +684318,16 @@ var init_listen = __esm({
684106
684318
  }
684107
684319
  }
684108
684320
  if (!this.liveTranscriber) {
684109
- const scriptPath2 = await findLiveWhisperScript();
684321
+ const scriptPath2 = isNemotron ? await findLiveNemotronScript() : await findLiveWhisperScript();
684110
684322
  if (!scriptPath2) {
684111
684323
  const hint = transcribeCliError ? ` transcribe-cli error: ${transcribeCliError}` : "";
684112
- return `No transcription backend available.${hint} live-whisper.py not found.`;
684324
+ return `No transcription backend available.${hint} ${isNemotron ? "live-nemotron.py" : "live-whisper.py"} not found.`;
684113
684325
  }
684114
684326
  try {
684115
684327
  const fallback = new WhisperFallbackTranscriber(
684116
684328
  this.config.model,
684117
- scriptPath2
684329
+ scriptPath2,
684330
+ isNemotron ? "nemotron-streaming" : "openai-whisper"
684118
684331
  );
684119
684332
  usedFallback = true;
684120
684333
  fallback.on("status", (msg) => {
@@ -684153,7 +684366,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
684153
684366
  this.emit("started");
684154
684367
  this.emit("recording", true);
684155
684368
  const modeDesc = this.config.mode === "auto" ? `auto (${this.config.silenceTimeoutMs / 1e3}s timeout)` : "confirm (press Enter to submit)";
684156
- const backend = usedFallback ? "openai-whisper" : "transcribe-cli";
684369
+ const backend = usedFallback ? this.config.engineId : "transcribe-cli";
684157
684370
  updateListenLiveState({
684158
684371
  phase: "listening",
684159
684372
  backend,
@@ -684264,6 +684477,18 @@ transcribe-cli error: ${transcribeCliError}` : "";
684264
684477
  * Caller is responsible for calling .stop() when done.
684265
684478
  */
684266
684479
  async createCallTranscriber() {
684480
+ if (this.config.engineId === "vibevoice-transformers") return null;
684481
+ if (this.config.engineId === "nemotron-streaming") {
684482
+ const scriptPath3 = await findLiveNemotronScript();
684483
+ if (!scriptPath3) return null;
684484
+ try {
684485
+ const fallback = new WhisperFallbackTranscriber(this.config.model, scriptPath3, "nemotron-streaming");
684486
+ await fallback.start();
684487
+ return fallback;
684488
+ } catch {
684489
+ return null;
684490
+ }
684491
+ }
684267
684492
  const requireConsensus = asrConsensusEnabled(this.config.model);
684268
684493
  const useTranscribeCli = liveAsrUseTranscribeCli() && !requireConsensus;
684269
684494
  let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
@@ -684356,15 +684581,36 @@ transcribe-cli error: ${transcribeCliError}` : "";
684356
684581
  };
684357
684582
  }
684358
684583
  if (this.config.engineId === "nemotron-streaming") {
684359
- throw new Error("Nemotron file transcription is disabled until its managed runtime passes the hardware gate");
684584
+ const managed = await Promise.resolve().then(() => (init_py_embed(), py_embed_exports));
684585
+ const result = managed.transcribeManagedNemotronFile({
684586
+ path: filePath,
684587
+ modelId: this.config.modelId,
684588
+ device: options2.device
684589
+ });
684590
+ if (outputDir2) {
684591
+ const { basename: basename47 } = await import("node:path");
684592
+ const transcriptDir = join135(outputDir2, ".omnius", "transcripts");
684593
+ mkdirSync75(transcriptDir, { recursive: true });
684594
+ writeFileSync65(join135(transcriptDir, `${basename47(filePath)}.txt`), result.text, "utf-8");
684595
+ }
684596
+ return {
684597
+ text: result.text,
684598
+ duration: result.duration,
684599
+ speakers: [],
684600
+ engineId: "nemotron-streaming",
684601
+ modelId: this.config.modelId,
684602
+ warnings: result.warnings,
684603
+ segments: []
684604
+ };
684360
684605
  }
684361
- let tc = this.config.engineId === "transcribe-cli" ? await this.loadTranscribeCli() : null;
684362
- if (this.config.engineId === "transcribe-cli" && !tc && _bgInstallPromise) {
684606
+ const useTranscribeCli = liveAsrUseTranscribeCli();
684607
+ let tc = useTranscribeCli ? await this.loadTranscribeCli() : null;
684608
+ if (useTranscribeCli && !tc && _bgInstallPromise) {
684363
684609
  await _bgInstallPromise;
684364
684610
  this.transcribeCliAvailable = null;
684365
684611
  tc = await this.loadTranscribeCli();
684366
684612
  }
684367
- if (this.config.engineId === "transcribe-cli" && !tc) {
684613
+ if (useTranscribeCli && !tc) {
684368
684614
  try {
684369
684615
  await ensureManagedTranscribeCliNode();
684370
684616
  this.transcribeCliAvailable = null;
@@ -703261,7 +703507,7 @@ var init_types3 = __esm({
703261
703507
  // packages/cli/src/tui/p2p/secret-vault.ts
703262
703508
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash55 } from "node:crypto";
703263
703509
  import { readFileSync as readFileSync106, writeFileSync as writeFileSync69, existsSync as existsSync130, mkdirSync as mkdirSync80 } from "node:fs";
703264
- import { dirname as dirname47 } from "node:path";
703510
+ import { dirname as dirname48 } from "node:path";
703265
703511
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
703266
703512
  var init_secret_vault = __esm({
703267
703513
  "packages/cli/src/tui/p2p/secret-vault.ts"() {
@@ -703467,7 +703713,7 @@ var init_secret_vault = __esm({
703467
703713
  const encrypted = Buffer.concat([cipher.update(data, "utf8"), cipher.final()]);
703468
703714
  const tag = cipher.getAuthTag();
703469
703715
  const blob = Buffer.concat([salt, iv, tag, encrypted]);
703470
- const dir = dirname47(this.storePath);
703716
+ const dir = dirname48(this.storePath);
703471
703717
  if (!existsSync130(dir)) mkdirSync80(dir, { recursive: true });
703472
703718
  writeFileSync69(this.storePath, blob, { mode: 384 });
703473
703719
  }
@@ -705142,7 +705388,7 @@ __export(omnius_directory_exports, {
705142
705388
  writeTaskHandoff: () => writeTaskHandoff2
705143
705389
  });
705144
705390
  import { appendFileSync as appendFileSync15, cpSync as cpSync2, existsSync as existsSync132, mkdirSync as mkdirSync82, readFileSync as readFileSync108, writeFileSync as writeFileSync71, readdirSync as readdirSync41, statSync as statSync52, unlinkSync as unlinkSync28, openSync as openSync9, closeSync as closeSync9, renameSync as renameSync19, watch as fsWatch3 } from "node:fs";
705145
- import { join as join143, relative as relative18, basename as basename27, dirname as dirname48, resolve as resolve67 } from "node:path";
705391
+ import { join as join143, relative as relative18, basename as basename27, dirname as dirname49, resolve as resolve67 } from "node:path";
705146
705392
  import { homedir as homedir45 } from "node:os";
705147
705393
  import { createHash as createHash58 } from "node:crypto";
705148
705394
  function isGitRoot(dir) {
@@ -705207,7 +705453,7 @@ function ensureOmniusIgnored(repoRoot) {
705207
705453
  if (!gitRoot) return;
705208
705454
  const gitignorePath = findNearestExistingGitignore(repoRoot, gitRoot);
705209
705455
  if (!gitignorePath) return;
705210
- const gitignoreDir = dirname48(gitignorePath);
705456
+ const gitignoreDir = dirname49(gitignorePath);
705211
705457
  const relDir = relative18(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
705212
705458
  const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
705213
705459
  const content = readFileSync108(gitignorePath, "utf-8");
@@ -705790,7 +706036,7 @@ function pruneContextLedger(ledgerPath) {
705790
706036
  const lines = readFileSync108(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
705791
706037
  if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
705792
706038
  const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
705793
- const archiveDir = join143(dirname48(ledgerPath), "archive");
706039
+ const archiveDir = join143(dirname49(ledgerPath), "archive");
705794
706040
  mkdirSync82(archiveDir, { recursive: true });
705795
706041
  const archivePath = join143(
705796
706042
  archiveDir,
@@ -707538,8 +707784,8 @@ var init_render2 = __esm({
707538
707784
 
707539
707785
  // packages/prompts/dist/promptLoader.js
707540
707786
  import { readFileSync as readFileSync111, existsSync as existsSync135 } from "node:fs";
707541
- import { join as join145, dirname as dirname49 } from "node:path";
707542
- import { fileURLToPath as fileURLToPath22 } from "node:url";
707787
+ import { join as join145, dirname as dirname50 } from "node:path";
707788
+ import { fileURLToPath as fileURLToPath23 } from "node:url";
707543
707789
  function resolvePromptsDir(baseDir, promptPath = "code.md") {
707544
707790
  const devPath2 = join145(baseDir, "..", "templates");
707545
707791
  const publishedPath2 = join145(baseDir, "..", "prompts", "templates");
@@ -707567,8 +707813,8 @@ var __filename4, __dirname5, PROMPTS_DIR2, cache6;
707567
707813
  var init_promptLoader2 = __esm({
707568
707814
  "packages/prompts/dist/promptLoader.js"() {
707569
707815
  "use strict";
707570
- __filename4 = fileURLToPath22(import.meta.url);
707571
- __dirname5 = dirname49(__filename4);
707816
+ __filename4 = fileURLToPath23(import.meta.url);
707817
+ __dirname5 = dirname50(__filename4);
707572
707818
  PROMPTS_DIR2 = resolvePromptsDir(__dirname5);
707573
707819
  cache6 = /* @__PURE__ */ new Map();
707574
707820
  }
@@ -707682,8 +707928,8 @@ var init_task_templates = __esm({
707682
707928
  });
707683
707929
 
707684
707930
  // packages/prompts/dist/index.js
707685
- import { join as join146, dirname as dirname50 } from "node:path";
707686
- import { fileURLToPath as fileURLToPath23 } from "node:url";
707931
+ import { join as join146, dirname as dirname51 } from "node:path";
707932
+ import { fileURLToPath as fileURLToPath24 } from "node:url";
707687
707933
  var _dir, _packageRoot;
707688
707934
  var init_dist9 = __esm({
707689
707935
  "packages/prompts/dist/index.js"() {
@@ -707692,7 +707938,7 @@ var init_dist9 = __esm({
707692
707938
  init_render2();
707693
707939
  init_task_templates();
707694
707940
  init_render2();
707695
- _dir = dirname50(fileURLToPath23(import.meta.url));
707941
+ _dir = dirname51(fileURLToPath24(import.meta.url));
707696
707942
  _packageRoot = join146(_dir, "..");
707697
707943
  }
707698
707944
  });
@@ -709090,7 +709336,7 @@ var init_braille_spinner = __esm({
709090
709336
 
709091
709337
  // packages/cli/src/tui/project-context.ts
709092
709338
  import { existsSync as existsSync137, readFileSync as readFileSync113, readdirSync as readdirSync42, mkdirSync as mkdirSync84, statSync as statSync54, writeFileSync as writeFileSync73 } from "node:fs";
709093
- import { dirname as dirname51, join as join148, basename as basename29, resolve as resolve69 } from "node:path";
709339
+ import { dirname as dirname52, join as join148, basename as basename29, resolve as resolve69 } from "node:path";
709094
709340
  import { homedir as homedir48 } from "node:os";
709095
709341
  function projectContextUrlSpanAt(text2, index) {
709096
709342
  PROJECT_CONTEXT_URL_RE.lastIndex = 0;
@@ -709164,7 +709410,7 @@ function findGitDir(repoRoot) {
709164
709410
  }
709165
709411
  return gitPath;
709166
709412
  }
709167
- const parent = dirname51(dir);
709413
+ const parent = dirname52(dir);
709168
709414
  if (parent === dir) return null;
709169
709415
  dir = parent;
709170
709416
  }
@@ -710815,7 +711061,7 @@ __export(status_bar_exports, {
710815
711061
  stripSubAgentPrefix: () => stripSubAgentPrefix,
710816
711062
  unlockFooterRedraws: () => unlockFooterRedraws
710817
711063
  });
710818
- import { basename as basename30, dirname as dirname52 } from "node:path";
711064
+ import { basename as basename30, dirname as dirname53 } from "node:path";
710819
711065
  import { readFile as readFileAsync } from "node:fs/promises";
710820
711066
  function headerButtonGlyphFg() {
710821
711067
  const a2 = tuiAccent();
@@ -715118,7 +715364,7 @@ ${CONTENT_BG_SEQ}`);
715118
715364
  if (limit <= 6) return value2.slice(-limit);
715119
715365
  const marker = "...";
715120
715366
  const leaf = basename30(value2);
715121
- const parentLeaf = basename30(dirname52(value2));
715367
+ const parentLeaf = basename30(dirname53(value2));
715122
715368
  const suffix = parentLeaf && parentLeaf !== "." && parentLeaf !== leaf ? `${parentLeaf}/${leaf}` : leaf;
715123
715369
  if (suffix.length + marker.length + 1 <= limit) {
715124
715370
  return `${marker}/${suffix}`;
@@ -717279,10 +717525,10 @@ __export(personaplex_exports, {
717279
717525
  stopPersonaPlex: () => stopPersonaPlex
717280
717526
  });
717281
717527
  import { existsSync as existsSync138, writeFileSync as writeFileSync74, readFileSync as readFileSync114, mkdirSync as mkdirSync85, copyFileSync as copyFileSync5, readdirSync as readdirSync43, statSync as statSync55 } from "node:fs";
717282
- import { join as join149, dirname as dirname53 } from "node:path";
717528
+ import { join as join149, dirname as dirname54 } from "node:path";
717283
717529
  import { homedir as homedir49 } from "node:os";
717284
717530
  import { spawn as spawn37 } from "node:child_process";
717285
- import { fileURLToPath as fileURLToPath24 } from "node:url";
717531
+ import { fileURLToPath as fileURLToPath25 } from "node:url";
717286
717532
  function personaplexPythonEnv(extra = {}) {
717287
717533
  const env2 = { ...process.env, ...extra };
717288
717534
  applyMediaCudaDeviceFilterToEnv(env2, "voice");
@@ -718089,7 +718335,7 @@ function getShippedVoicesDir() {
718089
718335
  // repo root
718090
718336
  ];
718091
718337
  try {
718092
- const modDir = dirname53(fileURLToPath24(import.meta.url));
718338
+ const modDir = dirname54(fileURLToPath25(import.meta.url));
718093
718339
  candidates.push(join149(modDir, "..", "voices", "personaplex"));
718094
718340
  candidates.push(join149(modDir, "..", "..", "..", "voices", "personaplex"));
718095
718341
  candidates.push(join149(modDir, "..", "..", "..", "..", "voices", "personaplex"));
@@ -719472,7 +719718,7 @@ async function runOptionalDepsSetup(rl) {
719472
719718
  };
719473
719719
  process.stdout.write(` ${c3.bold("Optional dependencies")}
719474
719720
  `);
719475
- process.stdout.write(` ${c3.dim("These add features (vision/OCR, voice tunnel, live transcription). You can install them now or later via the in-TUI commands.")}
719721
+ process.stdout.write(` ${c3.dim("These add features (vision/OCR, voice tunnel). You can install them now or later via the in-TUI commands.")}
719476
719722
 
719477
719723
  `);
719478
719724
  const askVision = await ask(rl, ` ${c3.bold("Install vision / OCR deps?")} (Y/n) `);
@@ -719519,31 +719765,6 @@ async function runOptionalDepsSetup(rl) {
719519
719765
  } else {
719520
719766
  process.stdout.write(` ${c3.dim("Skipped cloudflared.")}
719521
719767
 
719522
- `);
719523
- }
719524
- const askTranscribe = await ask(rl, ` ${c3.bold("Install transcribe-cli for live transcription?")} (Y/n) `);
719525
- if (askTranscribe.toLowerCase() !== "n") {
719526
- process.stdout.write(` ${c3.cyan("●")} Installing managed transcribe-cli runtime...
719527
- `);
719528
- try {
719529
- const ok3 = await ensureTranscribeCliBackground();
719530
- if (ok3) {
719531
- process.stdout.write(` ${c3.green("✔")} Transcribe-CLI installed.
719532
-
719533
- `);
719534
- } else {
719535
- process.stdout.write(` ${c3.cyan("⚠")} transcribe-cli install did not complete — live transcription will be unavailable.
719536
-
719537
- `);
719538
- }
719539
- } catch (err) {
719540
- process.stdout.write(` ${c3.cyan("⚠")} transcribe-cli install hit an error: ${err instanceof Error ? err.message : String(err)}
719541
-
719542
- `);
719543
- }
719544
- } else {
719545
- process.stdout.write(` ${c3.dim("Skipped transcribe-cli.")}
719546
-
719547
719768
  `);
719548
719769
  }
719549
719770
  }
@@ -721171,7 +721392,6 @@ var init_setup = __esm({
721171
721392
  init_config();
721172
721393
  init_dist6();
721173
721394
  init_tui_select();
721174
- init_listen();
721175
721395
  init_ollama_gpu_policy();
721176
721396
  execAsync2 = promisify8(exec5);
721177
721397
  OMNIUS_FIRST_RUN_BANNER = [
@@ -725694,7 +725914,7 @@ import {
725694
725914
  renameSync as renameSync20,
725695
725915
  unlinkSync as unlinkSync31
725696
725916
  } from "node:fs";
725697
- import { dirname as dirname54, join as join155 } from "node:path";
725917
+ import { dirname as dirname55, join as join155 } from "node:path";
725698
725918
  import { homedir as homedir52 } from "node:os";
725699
725919
  import { randomBytes as randomBytes26 } from "node:crypto";
725700
725920
  function configHome() {
@@ -725710,7 +725930,7 @@ function bootstrapApiKeyFile() {
725710
725930
  return fromEnv || join155(configHome(), "api.key");
725711
725931
  }
725712
725932
  function ensureDirFor(file) {
725713
- const dir = dirname54(file);
725933
+ const dir = dirname55(file);
725714
725934
  if (!existsSync146(dir)) mkdirSync87(dir, { recursive: true });
725715
725935
  }
725716
725936
  function atomicWritePrivateFile(file, content) {
@@ -728675,10 +728895,10 @@ import {
728675
728895
  statSync as statSync59,
728676
728896
  writeFileSync as writeFileSync80
728677
728897
  } from "node:fs";
728678
- import { dirname as dirname55, join as join160, resolve as resolve72 } from "node:path";
728898
+ import { dirname as dirname56, join as join160, resolve as resolve72 } from "node:path";
728679
728899
  import { platform as platform8 } from "node:os";
728680
728900
  import { spawn as spawn39, spawnSync as spawnSync10 } from "node:child_process";
728681
- import { fileURLToPath as fileURLToPath25 } from "node:url";
728901
+ import { fileURLToPath as fileURLToPath26 } from "node:url";
728682
728902
  function normalizeVoiceboxModelId(value2) {
728683
728903
  const normalized3 = String(value2 || "").trim().toLowerCase().replace(/-/g, "_");
728684
728904
  return MODEL_ALIASES[normalized3] ?? normalized3;
@@ -728813,7 +729033,7 @@ async function runCommand(command, args, options2 = {}) {
728813
729033
  });
728814
729034
  }
728815
729035
  function packageAssetPath(...segments) {
728816
- const moduleDir = dirname55(fileURLToPath25(import.meta.url));
729036
+ const moduleDir = dirname56(fileURLToPath26(import.meta.url));
728817
729037
  const candidates = [
728818
729038
  join160(moduleDir, "..", "assets", ...segments),
728819
729039
  join160(moduleDir, "..", "..", "assets", ...segments)
@@ -729183,7 +729403,7 @@ function writeProfileMap(value2) {
729183
729403
  if (Buffer.byteLength(serialized) > PROFILE_MAP_MAX_BYTES) {
729184
729404
  throw new Error("Voicebox profile map exceeded its bounded storage limit");
729185
729405
  }
729186
- mkdirSync91(dirname55(profileMapPath()), { recursive: true });
729406
+ mkdirSync91(dirname56(profileMapPath()), { recursive: true });
729187
729407
  const temporary = `${profileMapPath()}.tmp-${process.pid}-${Date.now()}`;
729188
729408
  writeFileSync80(temporary, serialized, { mode: 384 });
729189
729409
  renameSync21(temporary, profileMapPath());
@@ -729571,13 +729791,13 @@ import {
729571
729791
  copyFileSync as copyFileSync6,
729572
729792
  rmSync as rmSync13
729573
729793
  } from "node:fs";
729574
- import { basename as basename32, join as join161, dirname as dirname56, resolve as resolve73 } from "node:path";
729794
+ import { basename as basename32, join as join161, dirname as dirname57, resolve as resolve73 } from "node:path";
729575
729795
  import { homedir as homedir55, tmpdir as tmpdir24, platform as platform9 } from "node:os";
729576
729796
  import {
729577
729797
  spawn as nodeSpawn
729578
729798
  } from "node:child_process";
729579
729799
  import { createRequire as createRequire8 } from "node:module";
729580
- import { fileURLToPath as fileURLToPath26 } from "node:url";
729800
+ import { fileURLToPath as fileURLToPath27 } from "node:url";
729581
729801
  function voicePythonEnv(extra = {}) {
729582
729802
  const { TRANSFORMERS_CACHE: _deprecatedCache, ...baseEnv } = process.env;
729583
729803
  const { TRANSFORMERS_CACHE: _extraDeprecatedCache, ...safeExtra } = extra;
@@ -729677,7 +729897,7 @@ function luxttsInferScript2() {
729677
729897
  return join161(voiceDir2(), "luxtts-infer.py");
729678
729898
  }
729679
729899
  function resolveBundledVoiceAsset(relativePath2) {
729680
- const moduleDir = dirname56(fileURLToPath26(import.meta.url));
729900
+ const moduleDir = dirname57(fileURLToPath27(import.meta.url));
729681
729901
  const candidates = [
729682
729902
  // npm bundle: publish/dist/index.js -> publish/assets
729683
729903
  join161(moduleDir, "..", "assets", relativePath2),
@@ -729778,7 +729998,7 @@ function consolidateVoiceDirs2() {
729778
729998
  const c9 = join161(dir, ".omnius", "voice");
729779
729999
  if (existsSync152(c9) && c9 !== globalVoice) candidates.add(c9);
729780
730000
  prev = dir;
729781
- dir = dirname56(dir);
730001
+ dir = dirname57(dir);
729782
730002
  }
729783
730003
  for (const root of COMMON_PROJECT_ROOTS) {
729784
730004
  const rootDir2 = join161(homedir55(), root);
@@ -729973,7 +730193,7 @@ function insertTagAfterOpeningClause(text2, tag) {
729973
730193
  function writeDetectTorchScript(targetPath) {
729974
730194
  if (existsSync152(targetPath)) return;
729975
730195
  try {
729976
- mkdirSync92(dirname56(targetPath), { recursive: true });
730196
+ mkdirSync92(dirname57(targetPath), { recursive: true });
729977
730197
  } catch {
729978
730198
  }
729979
730199
  const script = `#!/usr/bin/env python3
@@ -734531,7 +734751,7 @@ import {
734531
734751
  appendFileSync as appendFileSync17,
734532
734752
  writeSync as writeSync5
734533
734753
  } from "node:fs";
734534
- import { basename as basename33, dirname as dirname57, relative as relative20, join as join162 } from "node:path";
734754
+ import { basename as basename33, dirname as dirname58, relative as relative20, join as join162 } from "node:path";
734535
734755
  function omniusPinnedDependencyVersion(name10) {
734536
734756
  const spec = OMNIUS_PINNED_DEPENDENCY_SPECS[name10];
734537
734757
  if (!spec) return null;
@@ -748369,7 +748589,7 @@ async function collectSponsorMediaStream(args) {
748369
748589
  }
748370
748590
  const safeName3 = basename33(artifact.filename).replace(/[^\w.-]/g, "_") || `artifact${defaultExtensionForMime(artifact.mime)}`;
748371
748591
  const outputPath3 = join162(args.outputRoot, safeName3);
748372
- mkdirSync93(dirname57(outputPath3), { recursive: true });
748592
+ mkdirSync93(dirname58(outputPath3), { recursive: true });
748373
748593
  writeFileSync82(outputPath3, bytes2);
748374
748594
  return { ok: true, path: outputPath3, metadata };
748375
748595
  }
@@ -748870,14 +749090,14 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
748870
749090
  if (models.length > 0) {
748871
749091
  try {
748872
749092
  const { writeFileSync: writeFileSync104, mkdirSync: mkdirSync120 } = await import("node:fs");
748873
- const { join: join197, dirname: dirname67 } = await import("node:path");
749093
+ const { join: join197, dirname: dirname68 } = await import("node:path");
748874
749094
  const cachePath2 = join197(
748875
749095
  ctx3.repoRoot || process.cwd(),
748876
749096
  ".omnius",
748877
749097
  "nexus",
748878
749098
  "peer-models-cache.json"
748879
749099
  );
748880
- mkdirSync120(dirname67(cachePath2), { recursive: true });
749100
+ mkdirSync120(dirname68(cachePath2), { recursive: true });
748881
749101
  writeFileSync104(
748882
749102
  cachePath2,
748883
749103
  JSON.stringify(
@@ -748953,14 +749173,14 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local, advertisedModels
748953
749173
  );
748954
749174
  try {
748955
749175
  const { writeFileSync: writeFileSync104, mkdirSync: mkdirSync120 } = await import("node:fs");
748956
- const { join: join197, dirname: dirname67 } = await import("node:path");
749176
+ const { join: join197, dirname: dirname68 } = await import("node:path");
748957
749177
  const cachePath2 = join197(
748958
749178
  ctx3.repoRoot || process.cwd(),
748959
749179
  ".omnius",
748960
749180
  "nexus",
748961
749181
  "peer-models-cache.json"
748962
749182
  );
748963
- mkdirSync120(dirname67(cachePath2), { recursive: true });
749183
+ mkdirSync120(dirname68(cachePath2), { recursive: true });
748964
749184
  writeFileSync104(
748965
749185
  cachePath2,
748966
749186
  JSON.stringify(
@@ -749986,11 +750206,11 @@ async function handleUpdate(subcommand, ctx3) {
749986
750206
  let currentVersion = "0.0.0";
749987
750207
  try {
749988
750208
  const { createRequire: createRequire12 } = await import("node:module");
749989
- const { fileURLToPath: fileURLToPath32 } = await import("node:url");
749990
- const { dirname: dirname67, join: join197 } = await import("node:path");
750209
+ const { fileURLToPath: fileURLToPath33 } = await import("node:url");
750210
+ const { dirname: dirname68, join: join197 } = await import("node:path");
749991
750211
  const { existsSync: existsSync184 } = await import("node:fs");
749992
750212
  const req3 = createRequire12(import.meta.url);
749993
- const thisDir = dirname67(fileURLToPath32(import.meta.url));
750213
+ const thisDir = dirname68(fileURLToPath33(import.meta.url));
749994
750214
  const candidates = [
749995
750215
  join197(thisDir, "..", "package.json"),
749996
750216
  join197(thisDir, "..", "..", "package.json"),
@@ -751143,9 +751363,7 @@ async function handleUpdate(subcommand, ctx3) {
751143
751363
  } else {
751144
751364
  installOverlay.setStatus("cloudflared ready");
751145
751365
  }
751146
- installOverlay.setStatus("Checking managed transcribe-cli runtime...");
751147
- await ensureTranscribeCliBackground().catch(() => false);
751148
- installOverlay.setStatus("cloudflared/transcribe checks complete");
751366
+ installOverlay.setStatus("Cloudflared checks complete");
751149
751367
  }
751150
751368
  if (!primaryUpdated) {
751151
751369
  installOverlay.stop("Done — no restart needed");
@@ -751174,17 +751392,12 @@ async function handleUpdate(subcommand, ctx3) {
751174
751392
  daemonUpgrade = await ensureDaemonVersion2(expectedDaemonVersion);
751175
751393
  }
751176
751394
  }
751177
- if (!daemonUpgrade.ok) {
751178
- installOverlay.stop("Update installed, but daemon upgrade was not verified");
751179
- await new Promise((r2) => setTimeout(r2, 1200));
751180
- installOverlay.dismiss();
751181
- renderError(
751182
- `Updated CLI to ${expectedDaemonVersion}, but the shared daemon still reports ${daemonUpgrade.observedVersion ?? "unavailable"} after ${daemonUpgrade.recoveryAttempts} verified recovery round(s). A privileged owner was ${daemonUpgrade.requiresPrivilegedMigration ? "not safely migratable" : "not detected"}; no arbitrary port holder was terminated.`
751183
- );
751184
- return;
751395
+ const daemonUpgradeFailure = daemonUpgrade.ok ? null : `The shared daemon still reports ${daemonUpgrade.observedVersion ?? "unavailable"} after ${daemonUpgrade.recoveryAttempts} verified recovery round(s). A privileged owner was ${daemonUpgrade.requiresPrivilegedMigration ? "not safely migratable" : "not detected"}; no arbitrary port holder was terminated. Restarting this session on ${expectedDaemonVersion} anyway — run /daemon restart to retry the daemon.`;
751396
+ if (daemonUpgradeFailure) {
751397
+ renderWarning(daemonUpgradeFailure);
751185
751398
  }
751186
751399
  installOverlay.setStatus(
751187
- daemonUpgrade.action === "restarted" ? `Daemon upgraded to ${expectedDaemonVersion}` : `Daemon verified at ${expectedDaemonVersion}`
751400
+ !daemonUpgrade.ok ? `Daemon still at ${daemonUpgrade.observedVersion ?? "unknown"} — restarting client anyway` : daemonUpgrade.action === "restarted" ? `Daemon upgraded to ${expectedDaemonVersion}` : `Daemon verified at ${expectedDaemonVersion}`
751188
751401
  );
751189
751402
  ctx3.contextSave?.();
751190
751403
  const hadActiveTask = ctx3.savePendingTaskState?.() ?? false;
@@ -751710,7 +751923,6 @@ var init_commands = __esm({
751710
751923
  init_typed_node_events();
751711
751924
  init_platforms();
751712
751925
  init_workspace_explorer();
751713
- init_listen();
751714
751926
  init_dist6();
751715
751927
  init_tui_select();
751716
751928
  init_usage_bars();
@@ -751754,10 +751966,10 @@ var init_commands = __esm({
751754
751966
  }
751755
751967
  try {
751756
751968
  const { createRequire: createRequire12 } = await import("node:module");
751757
- const { fileURLToPath: fileURLToPath32 } = await import("node:url");
751969
+ const { fileURLToPath: fileURLToPath33 } = await import("node:url");
751758
751970
  const { dirname: pathDirname, join: pathJoin } = await import("node:path");
751759
751971
  const localRequire = createRequire12(import.meta.url);
751760
- const here = pathDirname(fileURLToPath32(import.meta.url));
751972
+ const here = pathDirname(fileURLToPath33(import.meta.url));
751761
751973
  let version5 = "?";
751762
751974
  for (const up of ["..", "../..", "../../.."]) {
751763
751975
  try {
@@ -757438,8 +757650,8 @@ Call task_complete with the JSON array when done.`,
757438
757650
 
757439
757651
  // packages/cli/src/tui/promptLoader.ts
757440
757652
  import { readFileSync as readFileSync132, existsSync as existsSync161 } from "node:fs";
757441
- import { join as join170, dirname as dirname59 } from "node:path";
757442
- import { fileURLToPath as fileURLToPath27 } from "node:url";
757653
+ import { join as join170, dirname as dirname60 } from "node:path";
757654
+ import { fileURLToPath as fileURLToPath28 } from "node:url";
757443
757655
  function loadPrompt3(promptPath, vars) {
757444
757656
  let content = cache7.get(promptPath);
757445
757657
  if (content === void 0) {
@@ -757456,8 +757668,8 @@ function loadPrompt3(promptPath, vars) {
757456
757668
  var __filename5, __dirname6, devPath, publishedPath, PROMPTS_DIR3, cache7;
757457
757669
  var init_promptLoader3 = __esm({
757458
757670
  "packages/cli/src/tui/promptLoader.ts"() {
757459
- __filename5 = fileURLToPath27(import.meta.url);
757460
- __dirname6 = dirname59(__filename5);
757671
+ __filename5 = fileURLToPath28(import.meta.url);
757672
+ __dirname6 = dirname60(__filename5);
757461
757673
  devPath = join170(__dirname6, "..", "..", "prompts");
757462
757674
  publishedPath = join170(__dirname6, "..", "prompts");
757463
757675
  PROMPTS_DIR3 = existsSync161(devPath) ? devPath : publishedPath;
@@ -762673,7 +762885,7 @@ import {
762673
762885
  import { mkdir as mkdir23 } from "node:fs/promises";
762674
762886
  import {
762675
762887
  basename as basename41,
762676
- dirname as dirname60,
762888
+ dirname as dirname61,
762677
762889
  extname as extname21,
762678
762890
  isAbsolute as isAbsolute16,
762679
762891
  join as join174,
@@ -762894,7 +763106,7 @@ function scopedTool(base3, root, mode) {
762894
763106
  guarded.path.rel
762895
763107
  );
762896
763108
  if (!materialized.ok) return denied(materialized.error);
762897
- mkdirSync102(dirname60(guarded.path.abs), { recursive: true });
763109
+ mkdirSync102(dirname61(guarded.path.abs), { recursive: true });
762898
763110
  writeFileSync90(guarded.path.abs, readFileSync135(materialized.path));
762899
763111
  materialized.cleanup?.();
762900
763112
  restoredEditPath = guarded.path.abs;
@@ -763413,7 +763625,7 @@ var init_telegram_creative_tools = __esm({
763413
763625
  stage: "setup",
763414
763626
  message: "Preparing scoped TTS audio file"
763415
763627
  });
763416
- await mkdir23(dirname60(guarded.path.abs), { recursive: true });
763628
+ await mkdir23(dirname61(guarded.path.abs), { recursive: true });
763417
763629
  const tts = new TtsGenerateTool();
763418
763630
  this.emitProgress(start2, {
763419
763631
  stage: "load",
@@ -766842,7 +767054,7 @@ import {
766842
767054
  } from "node:fs";
766843
767055
  import {
766844
767056
  join as join177,
766845
- dirname as dirname61,
767057
+ dirname as dirname62,
766846
767058
  resolve as resolve79,
766847
767059
  basename as basename43,
766848
767060
  relative as relative22,
@@ -771185,7 +771397,7 @@ ${message2}`)
771185
771397
  appendTelegramIntakeJournal(sessionKey, entry) {
771186
771398
  const write2 = async () => {
771187
771399
  const path16 = this.telegramIntakePath(sessionKey);
771188
- await mkdirAsync(dirname61(path16), { recursive: true });
771400
+ await mkdirAsync(dirname62(path16), { recursive: true });
771189
771401
  await appendFileAsync(path16, `${JSON.stringify(entry)}
771190
771402
  `, "utf8");
771191
771403
  };
@@ -786933,15 +787145,14 @@ function getDaemonListenEngine() {
786933
787145
  const settings = loadGlobalSettings();
786934
787146
  const modelId = settings.asrModel?.trim() || "medium";
786935
787147
  const whisperModels2 = /* @__PURE__ */ new Set(["tiny", "base", "small", "medium", "large-v3"]);
787148
+ const persistedEngine = settings.asrEngine?.trim() ?? "openai-whisper";
787149
+ const engineId = normalizeAsrEngineId(persistedEngine);
786936
787150
  _listenEngine = getListenEngine({
786937
- engineId: settings.asrEngine?.trim() || "openai-whisper",
787151
+ engineId,
786938
787152
  modelId,
786939
787153
  ...whisperModels2.has(modelId) ? { model: modelId } : {}
786940
787154
  });
786941
787155
  }
786942
- if (_listenEngine.currentEngine === "transcribe-cli" && !_daemonAsrBootstrap) {
786943
- _daemonAsrBootstrap = ensureTranscribeCliBackground().catch(() => false);
786944
- }
786945
787156
  return _listenEngine;
786946
787157
  }
786947
787158
  function getVoiceBus() {
@@ -787189,7 +787400,7 @@ function _resetForTests() {
787189
787400
  _shutdownTimer = null;
787190
787401
  }
787191
787402
  }
787192
- var _voiceEngine, _listenEngine, _voiceChatSession, _bus, _state3, _loadedAt, _lastError, _clients2, _ttsSpeaking, _shutdownTimer, _daemonAsrBootstrap, _runtimeLoadPromise, IDLE_SHUTDOWN_MS, _wired;
787403
+ var _voiceEngine, _listenEngine, _voiceChatSession, _bus, _state3, _loadedAt, _lastError, _clients2, _ttsSpeaking, _shutdownTimer, _runtimeLoadPromise, IDLE_SHUTDOWN_MS, _wired;
787193
787404
  var init_voice_runtime = __esm({
787194
787405
  "packages/cli/src/api/voice-runtime.ts"() {
787195
787406
  init_voice();
@@ -787207,7 +787418,6 @@ var init_voice_runtime = __esm({
787207
787418
  _clients2 = /* @__PURE__ */ new Map();
787208
787419
  _ttsSpeaking = false;
787209
787420
  _shutdownTimer = null;
787210
- _daemonAsrBootstrap = null;
787211
787421
  _runtimeLoadPromise = null;
787212
787422
  IDLE_SHUTDOWN_MS = 6e4;
787213
787423
  _wired = false;
@@ -788657,7 +788867,7 @@ var init_audit_log = __esm({
788657
788867
  // packages/cli/src/api/disk-task-output.ts
788658
788868
  import { open } from "node:fs/promises";
788659
788869
  import { existsSync as existsSync171, mkdirSync as mkdirSync108, statSync as statSync66 } from "node:fs";
788660
- import { dirname as dirname62 } from "node:path";
788870
+ import { dirname as dirname63 } from "node:path";
788661
788871
  import * as fsConstants from "node:constants";
788662
788872
  var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
788663
788873
  var init_disk_task_output = __esm({
@@ -788675,7 +788885,7 @@ var init_disk_task_output = __esm({
788675
788885
  fileSize = 0;
788676
788886
  constructor(outputPath3) {
788677
788887
  this.path = outputPath3;
788678
- mkdirSync108(dirname62(outputPath3), { recursive: true });
788888
+ mkdirSync108(dirname63(outputPath3), { recursive: true });
788679
788889
  }
788680
788890
  /** Queue content for async append. Non-blocking. */
788681
788891
  append(chunk) {
@@ -808734,7 +808944,7 @@ function getOpenApiSpec() {
808734
808944
  patch: {
808735
808945
  summary: "Persist and activate an exact ASR selection",
808736
808946
  tags: ["ASR"],
808737
- description: "Body: {engineId, modelId?, setup?, device?}. Selection is validated against the registry. VibeVoice activation is CUDA-only and fail-closed; setup=true installs the pinned runtime and exact weights before activation. Hardware evidence uses nvidia-smi on discrete Linux and NVIDIA's documented tegrastats plus a CUDA Torch property probe on Jetson/L4T.",
808947
+ description: "Body: {engineId, modelId?, setup?, device?}. Selection is validated against the registry. setup=true pulls the exact managed model and verifies CUDA placement before activation. Hardware evidence uses nvidia-smi on discrete Linux and NVIDIA's documented tegrastats plus a CUDA Torch property probe on Jetson/L4T.",
808738
808948
  responses: { 200: { description: "Exact selection activated" }, 400: { description: "Unknown engine or model" }, 409: { description: "Runtime unavailable or not installed" }, 500: { description: "Setup, hardware preflight, or activation failed" } }
808739
808949
  }
808740
808950
  },
@@ -808743,11 +808953,29 @@ function getOpenApiSpec() {
808743
808953
  post: {
808744
808954
  summary: "Install a managed ASR runtime and its pinned weights",
808745
808955
  tags: ["ASR"],
808746
- description: "Currently implemented for vibevoice-transformers. The exact microsoft/VibeVoice-ASR revision and tokenizer snapshot are stored under the unified Omnius ASR model/runtime directories; model weights are never bundled into npm.",
808956
+ description: "Body: {modelId?, device?}. Installs the managed runtime and pulls the requested model. Whisper and Nemotron loads validate their selected CUDA device; VibeVoice stores its pinned model and tokenizer snapshot under Omnius' ASR runtime directories.",
808747
808957
  parameters: [{ name: "engineId", in: "path", required: true, schema: { type: "string" } }],
808748
808958
  responses: { 200: { description: "Runtime and weights ready" }, 409: { description: "Engine has no managed setup adapter" }, 500: { description: "Setup failed" } }
808749
808959
  }
808750
808960
  },
808961
+ "/v1/asr/engines/{engineId}/models/{modelId}/pull": {
808962
+ post: {
808963
+ summary: "Pull one exact ASR model and validate its managed runtime",
808964
+ tags: ["ASR"],
808965
+ description: "Optional body: {device}. Downloads model weights into Omnius-managed storage and verifies CUDA placement for Whisper and Nemotron.",
808966
+ parameters: [{ name: "engineId", in: "path", required: true, schema: { type: "string" } }, { name: "modelId", in: "path", required: true, schema: { type: "string" } }],
808967
+ responses: { 200: { description: "Weights are ready" }, 500: { description: "Runtime, download, or CUDA validation failed" } }
808968
+ }
808969
+ },
808970
+ "/v1/asr/engines/{engineId}/models/{modelId}/deploy": {
808971
+ post: {
808972
+ summary: "Pull, select, and activate one exact ASR model",
808973
+ tags: ["ASR"],
808974
+ description: "Optional body: {device}. Persists the selection after the managed runtime and weights are ready.",
808975
+ parameters: [{ name: "engineId", in: "path", required: true, schema: { type: "string" } }, { name: "modelId", in: "path", required: true, schema: { type: "string" } }],
808976
+ responses: { 200: { description: "Model deployed and selected" }, 500: { description: "Deploy or CUDA validation failed" } }
808977
+ }
808978
+ },
808751
808979
  "/v1/voice/asr-models": { get: { summary: "Compatibility alias of GET /v1/asr/engines", tags: ["ASR"], responses: { 200: { description: "Canonical ASR registry plus legacy model projection" } } } },
808752
808980
  "/v1/voice/asr-models/switch": { post: { summary: "Compatibility alias of POST /v1/asr/activate", tags: ["ASR"], responses: { 200: { description: "Exact selection activated" }, 400: { description: "Unknown selection" }, 409: { description: "Runtime unavailable" }, 500: { description: "Activation failed" } } } },
808753
808981
  "/v1/voice/tts": {
@@ -809422,9 +809650,9 @@ var init_chat_followup = __esm({
809422
809650
  // packages/cli/src/docker.ts
809423
809651
  import { execSync as execSync38, spawn as spawn41 } from "node:child_process";
809424
809652
  import { existsSync as existsSync179, mkdirSync as mkdirSync114, writeFileSync as writeFileSync98 } from "node:fs";
809425
- import { join as join188, resolve as resolve82, dirname as dirname63 } from "node:path";
809653
+ import { join as join188, resolve as resolve82, dirname as dirname64 } from "node:path";
809426
809654
  import { homedir as homedir64 } from "node:os";
809427
- import { fileURLToPath as fileURLToPath28 } from "node:url";
809655
+ import { fileURLToPath as fileURLToPath29 } from "node:url";
809428
809656
  function getDockerDir() {
809429
809657
  try {
809430
809658
  if (typeof __dirname !== "undefined") {
@@ -809433,7 +809661,7 @@ function getDockerDir() {
809433
809661
  } catch {
809434
809662
  }
809435
809663
  try {
809436
- const thisDir = dirname63(fileURLToPath28(import.meta.url));
809664
+ const thisDir = dirname64(fileURLToPath29(import.meta.url));
809437
809665
  return join188(thisDir, "..", "..", "..", "docker");
809438
809666
  } catch {
809439
809667
  }
@@ -809899,8 +810127,8 @@ __export(serve_exports, {
809899
810127
  import * as http5 from "node:http";
809900
810128
  import * as https3 from "node:https";
809901
810129
  import { createRequire as createRequire9 } from "node:module";
809902
- import { fileURLToPath as fileURLToPath29 } from "node:url";
809903
- import { dirname as dirname64, join as join190, resolve as resolve83 } from "node:path";
810130
+ import { fileURLToPath as fileURLToPath30 } from "node:url";
810131
+ import { dirname as dirname65, join as join190, resolve as resolve83 } from "node:path";
809904
810132
  import { homedir as homedir65 } from "node:os";
809905
810133
  import { spawn as spawn42, execSync as execSync39 } from "node:child_process";
809906
810134
  import {
@@ -809929,7 +810157,7 @@ function memoryDbPaths3(baseDir = process.cwd()) {
809929
810157
  }
809930
810158
  function readServerPackageIdentity() {
809931
810159
  try {
809932
- const thisDir = dirname64(fileURLToPath29(import.meta.url));
810160
+ const thisDir = dirname65(fileURLToPath30(import.meta.url));
809933
810161
  const candidates = [
809934
810162
  join190(thisDir, "..", "package.json"),
809935
810163
  join190(thisDir, "..", "..", "package.json"),
@@ -813747,7 +813975,7 @@ async function handleV1Update(req3, res, requestId) {
813747
813975
  );
813748
813976
  const fs14 = require4("node:fs");
813749
813977
  const nodeBin = process.execPath;
813750
- const nodeDir = dirname64(nodeBin);
813978
+ const nodeDir = dirname65(nodeBin);
813751
813979
  const { execSync: es } = require4("node:child_process");
813752
813980
  const isWin2 = process.platform === "win32";
813753
813981
  let npmBin = "";
@@ -813762,7 +813990,7 @@ async function handleV1Update(req3, res, requestId) {
813762
813990
  const dir = join190(homedir65(), ".omnius");
813763
813991
  fs14.mkdirSync(dir, { recursive: true });
813764
813992
  const logFd = fs14.openSync(logPath3, "w");
813765
- const npmPrefix = dirname64(nodeDir);
813993
+ const npmPrefix = dirname65(nodeDir);
813766
813994
  let globalBinDir = "";
813767
813995
  try {
813768
813996
  if (isWin2) {
@@ -816750,16 +816978,13 @@ data: ${JSON.stringify(data)}
816750
816978
  const engines = listAsrEngines().map((engine) => {
816751
816979
  const selected = engine.id === listen.currentEngine;
816752
816980
  const unavailableReason = getAsrEngineUnavailableReason(engine.id);
816981
+ const selectedModel = selected ? listen.currentModel : engine.models[0]?.id;
816753
816982
  const readiness = unavailableReason ? {
816754
816983
  installed: false,
816755
816984
  weightsReady: false,
816756
816985
  active: false,
816757
816986
  lastError: unavailableReason
816758
- } : engine.id === "vibevoice-transformers" ? vibe : {
816759
- installed: true,
816760
- weightsReady: true,
816761
- active: selected && listen.isActive
816762
- };
816987
+ } : engine.id === "vibevoice-transformers" ? vibe : getManagedAsrReadiness(engine.id, selectedModel ?? engine.models[0].id);
816763
816988
  return {
816764
816989
  ...engine,
816765
816990
  availability: unavailableReason ? "disabled" : "available",
@@ -816768,6 +816993,7 @@ data: ${JSON.stringify(data)}
816768
816993
  readiness,
816769
816994
  models: engine.models.map((model) => ({
816770
816995
  ...model,
816996
+ readiness: engine.id === "vibevoice-transformers" ? vibe : getManagedAsrReadiness(engine.id, model.id),
816771
816997
  selected: selected && model.id === listen.currentModel,
816772
816998
  isActive: selected && model.id === listen.currentModel && readiness.active
816773
816999
  }))
@@ -816793,35 +817019,76 @@ data: ${JSON.stringify(data)}
816793
817019
  modelId: listen.currentModel
816794
817020
  },
816795
817021
  state: getRuntimeStatus(),
816796
- vibevoice: getVibeVoiceAsrReadiness()
817022
+ vibevoice: getVibeVoiceAsrReadiness(),
817023
+ runtimes: listAsrEngines().filter((engine) => engine.id === "openai-whisper" || engine.id === "nemotron-streaming").flatMap((engine) => engine.models.map((model) => getManagedAsrReadiness(engine.id, model.id)))
816797
817024
  });
816798
817025
  return;
816799
817026
  }
817027
+ const asrPullMatch = pathname.match(/^\/v1\/asr\/engines\/([^/]+)\/models\/([^/]+)\/pull$/);
817028
+ if (asrPullMatch && method === "POST") {
817029
+ const engineId = decodeURIComponent(asrPullMatch[1] || "");
817030
+ const modelId = decodeURIComponent(asrPullMatch[2] || "");
817031
+ const body = await parseJsonBody(req3);
817032
+ try {
817033
+ const selection = resolveAsrSelection({ engineId, modelId });
817034
+ const readiness = selection.engineId === "vibevoice-transformers" ? (await ensureVibeVoiceAsrSetup(), getVibeVoiceAsrReadiness()) : ensureManagedAsrModel({ ...selection, device: body?.device });
817035
+ jsonResponse(res, 200, { ok: true, action: "pull", selection, readiness });
817036
+ } catch (err) {
817037
+ jsonResponse(res, 500, {
817038
+ error: "asr_pull_failed",
817039
+ engineId,
817040
+ modelId,
817041
+ message: err instanceof Error ? err.message : String(err)
817042
+ });
817043
+ }
817044
+ return;
817045
+ }
817046
+ const asrDeployMatch = pathname.match(/^\/v1\/asr\/engines\/([^/]+)\/models\/([^/]+)\/deploy$/);
817047
+ if (asrDeployMatch && method === "POST") {
817048
+ const engineId = decodeURIComponent(asrDeployMatch[1] || "");
817049
+ const modelId = decodeURIComponent(asrDeployMatch[2] || "");
817050
+ const body = await parseJsonBody(req3);
817051
+ try {
817052
+ const selection = resolveAsrSelection({ engineId, modelId });
817053
+ const activated = await getDaemonListenEngine().activateSelection(selection, {
817054
+ setup: true,
817055
+ device: body?.device
817056
+ });
817057
+ saveGlobalSettings({ asrEngine: activated.selection.engineId, asrModel: activated.selection.modelId });
817058
+ jsonResponse(res, 200, { ok: true, action: "deploy", ...activated, state: getRuntimeStatus() });
817059
+ } catch (err) {
817060
+ jsonResponse(res, 500, {
817061
+ error: "asr_deploy_failed",
817062
+ engineId,
817063
+ modelId,
817064
+ message: err instanceof Error ? err.message : String(err)
817065
+ });
817066
+ }
817067
+ return;
817068
+ }
816800
817069
  const asrSetupMatch = pathname.match(/^\/v1\/asr\/engines\/([^/]+)\/setup$/);
816801
817070
  if (asrSetupMatch && method === "POST") {
816802
817071
  const engineId = decodeURIComponent(asrSetupMatch[1] || "");
816803
- if (engineId !== "vibevoice-transformers") {
816804
- jsonResponse(res, 409, {
816805
- error: "setup_not_managed_here",
817072
+ const body = await parseJsonBody(req3);
817073
+ try {
817074
+ const current = getDaemonListenEngine();
817075
+ const selection = resolveAsrSelection({
816806
817076
  engineId,
816807
- message: "Only the VibeVoice managed setup is exposed by this endpoint in this release."
817077
+ modelId: body?.modelId ?? body?.model ?? (current.currentEngine === engineId ? current.currentModel : void 0)
816808
817078
  });
816809
- return;
816810
- }
816811
- try {
816812
- await ensureVibeVoiceAsrSetup();
817079
+ const readiness = selection.engineId === "vibevoice-transformers" ? (await ensureVibeVoiceAsrSetup(), getVibeVoiceAsrReadiness()) : ensureManagedAsrModel({ ...selection, device: body?.device });
816813
817080
  jsonResponse(res, 200, {
816814
817081
  ok: true,
816815
- engineId,
816816
- readiness: getVibeVoiceAsrReadiness(),
816817
- plan: getVibeVoiceAsrSetupPlan()
817082
+ selection,
817083
+ readiness,
817084
+ ...selection.engineId === "vibevoice-transformers" ? { plan: getVibeVoiceAsrSetupPlan() } : {}
816818
817085
  });
816819
817086
  } catch (err) {
816820
817087
  jsonResponse(res, 500, {
816821
817088
  error: "asr_setup_failed",
816822
817089
  engineId,
816823
817090
  message: err instanceof Error ? err.message : String(err),
816824
- readiness: getVibeVoiceAsrReadiness()
817091
+ readiness: engineId === "vibevoice-transformers" ? getVibeVoiceAsrReadiness() : void 0
816825
817092
  });
816826
817093
  }
816827
817094
  return;
@@ -820931,6 +821198,7 @@ var init_serve = __esm({
820931
821198
  init_project_preferences();
820932
821199
  init_internal_output();
820933
821200
  init_voice_runtime();
821201
+ init_py_embed();
820934
821202
  init_voice();
820935
821203
  init_voicebox();
820936
821204
  init_audit_log();
@@ -821120,9 +821388,9 @@ var init_clipboard_media = __esm({
821120
821388
 
821121
821389
  // packages/cli/src/tui/interactive.ts
821122
821390
  import { cwd } from "node:process";
821123
- import { resolve as resolve84, join as join192, dirname as dirname65, extname as extname23, relative as relative23, sep as sep10 } from "node:path";
821391
+ import { resolve as resolve84, join as join192, dirname as dirname66, extname as extname23, relative as relative23, sep as sep10 } from "node:path";
821124
821392
  import { createRequire as createRequire10 } from "node:module";
821125
- import { fileURLToPath as fileURLToPath30 } from "node:url";
821393
+ import { fileURLToPath as fileURLToPath31 } from "node:url";
821126
821394
  import { createHash as createHash68 } from "node:crypto";
821127
821395
  import {
821128
821396
  readFileSync as readFileSync149,
@@ -821181,7 +821449,7 @@ function formatTimeAgo2(date) {
821181
821449
  function getVersion4() {
821182
821450
  try {
821183
821451
  const require5 = createRequire10(import.meta.url);
821184
- const thisDir = dirname65(fileURLToPath30(import.meta.url));
821452
+ const thisDir = dirname66(fileURLToPath31(import.meta.url));
821185
821453
  const candidates = [
821186
821454
  join192(thisDir, "..", "package.json"),
821187
821455
  join192(thisDir, "..", "..", "package.json"),
@@ -828090,6 +828358,14 @@ This is an independent background session started from /background.`
828090
828358
  }, 1500);
828091
828359
  return;
828092
828360
  }
828361
+ setTimeout(() => {
828362
+ if (statusBar.isActive)
828363
+ writeContent(
828364
+ () => renderWarning(
828365
+ `Shared daemon on port ${apiPort} reports ${daemon.observedVersion ?? "unavailable"}, expected ${daemon.expectedVersion}. Run /daemon restart to retry it.`
828366
+ )
828367
+ );
828368
+ }, 1500);
828093
828369
  const { startApiServer: startApiServer2 } = await Promise.resolve().then(() => (init_serve(), serve_exports));
828094
828370
  const apiServer = startApiServer2({
828095
828371
  port: apiPort,
@@ -833503,7 +833779,7 @@ var init_config6 = __esm({
833503
833779
  // -- Voice & audio --
833504
833780
  voice: "Enable TTS voice feedback (true/false)",
833505
833781
  voiceModel: "TTS voice model id (built-in, LuxTTS clone, Supertonic, MisoTTS, or selected Voicebox model)",
833506
- asrEngine: "ASR engine id (openai-whisper, transcribe-cli, nemotron-streaming, vibevoice-transformers)",
833782
+ asrEngine: "ASR engine id (openai-whisper, nemotron-streaming, vibevoice-transformers)",
833507
833783
  asrModel: "Exact model id within the selected ASR engine",
833508
833784
  // -- Agent autonomy --
833509
833785
  commandsMode: "Agent slash-command access: auto (agent can invoke) or manual (user-only)",
@@ -833920,8 +834196,8 @@ init_updater();
833920
834196
  init_typed_node_events();
833921
834197
  init_dist5();
833922
834198
  import { parseArgs as nodeParseArgs2 } from "node:util";
833923
- import { fileURLToPath as fileURLToPath31 } from "node:url";
833924
- import { dirname as dirname66, join as join196 } from "node:path";
834199
+ import { fileURLToPath as fileURLToPath32 } from "node:url";
834200
+ import { dirname as dirname67, join as join196 } from "node:path";
833925
834201
  import { createRequire as createRequire11 } from "node:module";
833926
834202
 
833927
834203
  // packages/cli/src/cli.ts
@@ -834090,7 +834366,7 @@ init_output();
834090
834366
  function getVersion5() {
834091
834367
  try {
834092
834368
  const require5 = createRequire11(import.meta.url);
834093
- const pkgPath = join196(dirname66(fileURLToPath31(import.meta.url)), "..", "package.json");
834369
+ const pkgPath = join196(dirname67(fileURLToPath32(import.meta.url)), "..", "package.json");
834094
834370
  const pkg = require5(pkgPath);
834095
834371
  return pkg.version;
834096
834372
  } catch {