omnius 1.0.619 → 1.0.621

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
@@ -682401,6 +682401,7 @@ __export(py_embed_exports, {
682401
682401
  runEmbedImage: () => runEmbedImage,
682402
682402
  runEmbedText: () => runEmbedText,
682403
682403
  runTranscribeFile: () => runTranscribeFile,
682404
+ transcribeManagedAsrFile: () => transcribeManagedAsrFile,
682404
682405
  transcribeManagedNemotronFile: () => transcribeManagedNemotronFile
682405
682406
  });
682406
682407
  import { spawnSync as spawnSync9 } from "node:child_process";
@@ -682940,6 +682941,66 @@ function transcribeManagedNemotronFile(input) {
682940
682941
  warnings: []
682941
682942
  };
682942
682943
  }
682944
+ function transcribeManagedWhisperFile(input) {
682945
+ const modelId = input.modelId.trim().toLowerCase();
682946
+ const existing = getManagedAsrReadiness("openai-whisper", modelId);
682947
+ if (!existing.weightsReady) ensureManagedAsrModel({ engineId: "openai-whisper", modelId, device: input.device });
682948
+ const modelDir2 = managedAsrModelDir("openai-whisper");
682949
+ const code8 = [
682950
+ "import json, os, sys",
682951
+ "import torch, whisper",
682952
+ "allow_cpu=os.environ.get('OMNIUS_ASR_ALLOW_CPU','').strip().lower() in ('1','true','yes','on')",
682953
+ "if torch.cuda.is_available() and torch.cuda.device_count() > 0:",
682954
+ " index=int(os.environ.get('OMNIUS_ASR_CUDA_DEVICE','0') or '0')",
682955
+ " if index < 0 or index >= torch.cuda.device_count(): raise RuntimeError(f'CUDA device {index} is outside the visible device range')",
682956
+ " torch.cuda.set_device(index); device=f'cuda:{index}'",
682957
+ "elif allow_cpu: device='cpu'",
682958
+ `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()})')`,
682959
+ "result=whisper.load_model(sys.argv[2], device=device, download_root=sys.argv[3]).transcribe(sys.argv[1], fp16=device.startswith('cuda'), verbose=False)",
682960
+ "segments=[{'start':float(s.get('start',0)), 'end':float(s.get('end',0)), 'text':str(s.get('text','')).strip()} for s in result.get('segments',[])]",
682961
+ "duration=max((s['end'] for s in segments), default=None)",
682962
+ "print(json.dumps({'ok': True, 'text': str(result.get('text','')).strip(), 'duration': duration, 'segments': segments, 'device': device}))"
682963
+ ].join("\n");
682964
+ const result = spawnSync9(getVenvPython(), ["-c", code8, input.path, modelId, modelDir2], {
682965
+ encoding: "utf8",
682966
+ timeout: 12e5,
682967
+ env: {
682968
+ ...process.env,
682969
+ OMNIUS_ASR_MODEL_DIR: modelDir2,
682970
+ ...input.device ? { OMNIUS_ASR_CUDA_DEVICE: input.device } : {}
682971
+ }
682972
+ });
682973
+ const payload = [...parseWorkerEvents(`${result.stdout || ""}`)].reverse().find((event) => event["ok"] === true);
682974
+ if (result.status !== 0 || !payload) {
682975
+ const detail = `${result.stderr || ""}`.trim() || String(result.error ?? "Whisper file transcription failed");
682976
+ throw new Error(detail);
682977
+ }
682978
+ const segments = Array.isArray(payload["segments"]) ? payload["segments"].flatMap((segment) => {
682979
+ if (!segment || typeof segment !== "object") return [];
682980
+ const value2 = segment;
682981
+ return [{
682982
+ start: Number(value2["start"] ?? 0),
682983
+ end: Number(value2["end"] ?? 0),
682984
+ text: String(value2["text"] ?? "")
682985
+ }];
682986
+ }) : [];
682987
+ return {
682988
+ text: String(payload["text"] ?? ""),
682989
+ duration: Number.isFinite(Number(payload["duration"])) ? Number(payload["duration"]) : null,
682990
+ device: typeof payload["device"] === "string" ? payload["device"] : existing.device,
682991
+ segments,
682992
+ warnings: []
682993
+ };
682994
+ }
682995
+ function transcribeManagedAsrFile(input) {
682996
+ const engineId = input.engineId.trim().toLowerCase();
682997
+ if (engineId === "openai-whisper") return transcribeManagedWhisperFile(input);
682998
+ if (engineId === "nemotron-streaming") {
682999
+ const result = transcribeManagedNemotronFile(input);
683000
+ return { ...result, segments: [] };
683001
+ }
683002
+ throw new Error(`Direct managed file ASR is unavailable for ${input.engineId}`);
683003
+ }
682943
683004
  function runEmbedImage(input) {
682944
683005
  const py = getVenvPython();
682945
683006
  const script = locateScript("embed-image.py");
@@ -683654,6 +683715,7 @@ var init_listen = __esm({
683654
683715
  registeredBrokerName = null;
683655
683716
  lastVadSpeech = null;
683656
683717
  lastVisibleVadAt = 0;
683718
+ stderrTail = "";
683657
683719
  get ready() {
683658
683720
  return this._ready;
683659
683721
  }
@@ -683702,6 +683764,7 @@ var init_listen = __esm({
683702
683764
  "--silence-ms",
683703
683765
  silenceMs
683704
683766
  ];
683767
+ this.stderrTail = "";
683705
683768
  this.process = spawn33(
683706
683769
  pyPath,
683707
683770
  workerArgs,
@@ -683785,7 +683848,11 @@ var init_listen = __esm({
683785
683848
  });
683786
683849
  this.process.stderr?.on("data", (data) => {
683787
683850
  const text2 = data.toString().trim();
683788
- if (text2) this.emit("status", text2);
683851
+ if (text2) {
683852
+ this.stderrTail = `${this.stderrTail}
683853
+ ${text2}`.slice(-2e3);
683854
+ this.emit("status", text2);
683855
+ }
683789
683856
  });
683790
683857
  onChildError(this.process, (err) => {
683791
683858
  clearTimeout(timeout2);
@@ -683796,7 +683863,9 @@ var init_listen = __esm({
683796
683863
  if (!this._ready) {
683797
683864
  clearTimeout(timeout2);
683798
683865
  reject(
683799
- new Error(`Whisper worker exited with code ${code8} before ready`)
683866
+ new Error(
683867
+ `${this.engineId} worker exited with code ${code8} before ready` + (this.stderrTail ? `: ${this.stderrTail.trim()}` : "")
683868
+ )
683800
683869
  );
683801
683870
  }
683802
683871
  });
@@ -816650,26 +816719,60 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
816650
816719
  }
816651
816720
  const listen = getDaemonListenEngine();
816652
816721
  const context2 = urlObj.searchParams.get("context") || void 0;
816653
- const result = await listen.transcribeFile(tmpPath, void 0, { context: context2 });
816722
+ const selection = resolveAsrSelection({
816723
+ engineId: listen.currentEngine,
816724
+ modelId: listen.currentModel
816725
+ });
816726
+ const result = selection.engineId === "vibevoice-transformers" ? await (async () => {
816727
+ const vibe = await transcribeVibeVoiceFile({
816728
+ filePath: tmpPath,
816729
+ context: context2,
816730
+ setup: true
816731
+ });
816732
+ return {
816733
+ text: vibe.text,
816734
+ duration: vibe.durationMs == null ? null : vibe.durationMs / 1e3,
816735
+ segments: vibe.segments.map((segment) => ({
816736
+ start: segment.startMs / 1e3,
816737
+ end: segment.endMs / 1e3,
816738
+ text: segment.text,
816739
+ speaker: segment.speakerId
816740
+ })),
816741
+ speakers: vibe.speakers,
816742
+ engineId: vibe.engineId,
816743
+ modelId: vibe.modelId,
816744
+ rawText: vibe.rawText,
816745
+ warnings: vibe.warnings
816746
+ };
816747
+ })() : (() => {
816748
+ const managed = transcribeManagedAsrFile({
816749
+ engineId: selection.engineId,
816750
+ modelId: selection.modelId,
816751
+ path: tmpPath
816752
+ });
816753
+ return {
816754
+ text: managed.text,
816755
+ duration: managed.duration,
816756
+ segments: managed.segments,
816757
+ speakers: [],
816758
+ engineId: selection.engineId,
816759
+ modelId: selection.modelId,
816760
+ rawText: void 0,
816761
+ warnings: managed.warnings
816762
+ };
816763
+ })();
816654
816764
  try {
816655
816765
  fs14.unlinkSync(tmpPath);
816656
816766
  } catch {
816657
816767
  }
816658
- if (!result) {
816659
- jsonResponse(res, 500, {
816660
- error: "transcribe_unavailable",
816661
- message: "ASR runtime unavailable; Omnius attempted managed transcribe-cli and Whisper fallback setup. Run /listen once or inspect ~/.omnius/runtimes/asr and ~/.omnius/venv."
816662
- });
816663
- return;
816664
- }
816665
816768
  jsonResponse(res, 200, {
816666
816769
  text: result.text,
816667
816770
  duration: result.duration,
816668
816771
  segments: result.segments,
816669
816772
  speakers: result.speakers,
816670
816773
  language: null,
816671
- engineId: result.engineId ?? listen.currentEngine,
816672
- modelId: result.modelId ?? listen.currentModel,
816774
+ engineId: result.engineId,
816775
+ modelId: result.modelId,
816673
816776
  rawText: result.rawText,
816674
816777
  warnings: result.warnings ?? []
816675
816778
  });
@@ -166,7 +166,7 @@ def _ensure_deps():
166
166
  emit_status(f"Installing core deps: {', '.join(need)}...")
167
167
  try:
168
168
  subprocess.check_call(
169
- [str(PIP), "install", *need],
169
+ [sys.executable, "-m", "pip", "install", *need],
170
170
  stdout=subprocess.DEVNULL, stderr=subprocess.PIPE,
171
171
  )
172
172
  except subprocess.CalledProcessError as e:
@@ -185,7 +185,7 @@ def _ensure_deps():
185
185
  emit_status("Installing nemo_toolkit[asr] (large — may take a few minutes)...")
186
186
  try:
187
187
  subprocess.check_call(
188
- [str(PIP), "install", "nemo_toolkit[asr]"],
188
+ [sys.executable, "-m", "pip", "install", "nemo_toolkit[asr]"],
189
189
  stdout=subprocess.DEVNULL, stderr=subprocess.PIPE,
190
190
  timeout=600,
191
191
  )
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.619",
3
+ "version": "1.0.621",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.619",
9
+ "version": "1.0.621",
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.619",
3
+ "version": "1.0.621",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/library.js",