omnius 1.0.620 → 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");
@@ -816658,26 +816719,60 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
816658
816719
  }
816659
816720
  const listen = getDaemonListenEngine();
816660
816721
  const context2 = urlObj.searchParams.get("context") || void 0;
816661
- 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
+ })();
816662
816764
  try {
816663
816765
  fs14.unlinkSync(tmpPath);
816664
816766
  } catch {
816665
816767
  }
816666
- if (!result) {
816667
- jsonResponse(res, 500, {
816668
- error: "transcribe_unavailable",
816669
- message: "ASR runtime unavailable; Omnius attempted managed transcribe-cli and Whisper fallback setup. Run /listen once or inspect ~/.omnius/runtimes/asr and ~/.omnius/venv."
816670
- });
816671
- return;
816672
- }
816673
816768
  jsonResponse(res, 200, {
816674
816769
  text: result.text,
816675
816770
  duration: result.duration,
816676
816771
  segments: result.segments,
816677
816772
  speakers: result.speakers,
816678
816773
  language: null,
816679
- engineId: result.engineId ?? listen.currentEngine,
816680
- modelId: result.modelId ?? listen.currentModel,
816774
+ engineId: result.engineId,
816775
+ modelId: result.modelId,
816681
816776
  rawText: result.rawText,
816682
816777
  warnings: result.warnings ?? []
816683
816778
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.620",
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.620",
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.620",
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",