omnius 1.0.930 → 1.0.933
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/_types/orchestrator/interruption-lifecycle.d.ts +13 -0
- package/dist/api/py-embed.js +9 -2
- package/dist/index.js +2 -2
- package/dist/library.js +68 -4
- package/dist/omni-setup-worker.js +9 -2
- package/dist/scripts/transcribe-file.py +103 -10
- package/dist/transcribe-cpu-runtime.js +84 -0
- package/dist/tui/native/worker.js +166 -0
- package/dist/update-worker-runtime.js +16 -3
- package/docs/DISCOVERY.json +31 -0
- package/docs/DISCOVERY.md +1 -0
- package/docs/cpu-transcription.md +29 -0
- package/docs/guides/telegram.md +11 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -79,6 +79,8 @@ export interface InterruptionLifecycleOptions {
|
|
|
79
79
|
owner: Omit<InterruptionOwner, "generation">;
|
|
80
80
|
now?: () => Date;
|
|
81
81
|
persist?: boolean;
|
|
82
|
+
/** Refuse a changed retained owner before recovery can persist anything. */
|
|
83
|
+
expectedRecoveryIdentity?: Pick<InterruptionRunIdentity, "sessionId" | "runId" | "taskEpoch" | "owner">;
|
|
82
84
|
/** Deterministic pre-rename fault seam for durability tests only. */
|
|
83
85
|
persistenceFaultForTest?: (stage: "temporary_synced" | "after_rename_before_directory_sync") => void;
|
|
84
86
|
}
|
|
@@ -137,6 +139,17 @@ export declare class InterruptionLifecycle {
|
|
|
137
139
|
acknowledgeOperation(ticket: InterruptionOperationTicket, outcome?: "completed" | "cancelled" | "unknown"): boolean;
|
|
138
140
|
canCommit(ticket: InterruptionOperationTicket): boolean;
|
|
139
141
|
resolveAmbiguousEffect(operationId: string, state: "confirmed_applied" | "confirmed_absent", evidenceId: string): boolean;
|
|
142
|
+
/** Repair the old ASR classification, without supplying a transcription
|
|
143
|
+
* result. The absent effect is an external action, not an owned cache or
|
|
144
|
+
* transcript artifact. All other interrupted effects retain their fence. */
|
|
145
|
+
reconcileInterruptedTranscription(input: {
|
|
146
|
+
expected: Pick<InterruptionRunIdentity, "sessionId" | "runId" | "taskEpoch" | "owner">;
|
|
147
|
+
tool: {
|
|
148
|
+
name: string;
|
|
149
|
+
isReadOnly?: (args: Record<string, unknown>) => boolean;
|
|
150
|
+
interruptionEffect?: InterruptionEffectClass;
|
|
151
|
+
};
|
|
152
|
+
}): number;
|
|
140
153
|
replaceChildLineage(childLineage: string[]): void;
|
|
141
154
|
private markTerminal;
|
|
142
155
|
private ownerMatches;
|
package/dist/api/py-embed.js
CHANGED
|
@@ -297966,8 +297966,11 @@ var WORKER = `
|
|
|
297966
297966
|
let input = "";
|
|
297967
297967
|
for await (const chunk of process.stdin) input += chunk;
|
|
297968
297968
|
const options = JSON.parse(input);
|
|
297969
|
-
const
|
|
297970
|
-
|
|
297969
|
+
const cpu = process.env.OMNIUS_ASR_DEVICE?.trim().toLowerCase() === "cpu";
|
|
297970
|
+
if (cpu && !/^(1|true|yes|on)$/i.test(process.env.OMNIUS_ASR_ALLOW_CPU?.trim() ?? "")) throw new Error("CPU ASR preparation requires CPU permission");
|
|
297971
|
+
const runtimeModule = await import(process.argv[cpu ? 2 : 1]);
|
|
297972
|
+
const name = cpu ? "ensureAsrCpuPythonVenvSync" : "ensureCudaPythonVenvSync";
|
|
297973
|
+
const prepare = runtimeModule[name] ?? runtimeModule.default?.[name];
|
|
297971
297974
|
if (typeof prepare !== "function") throw new Error("ASR preparation runtime has no preparation entrypoint");
|
|
297972
297975
|
const runtime = prepare({ ...options, env: { ...process.env } });
|
|
297973
297976
|
// The caller needs only Python and the protected-Torch constraint. Never
|
|
@@ -298086,9 +298089,13 @@ function noSpeechResultFor(inspection) {
|
|
|
298086
298089
|
};
|
|
298087
298090
|
}
|
|
298088
298091
|
|
|
298092
|
+
// packages/execution/dist/asr-device.js
|
|
298093
|
+
init_process_async();
|
|
298094
|
+
|
|
298089
298095
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
298090
298096
|
var MAX_TRANSCRIBE_URL_BYTES = 100 * 1024 * 1024;
|
|
298091
298097
|
var MANAGED_ASR_VENV = join3(homedir4(), ".omnius", "runtimes", "asr", ".venv-whisper");
|
|
298098
|
+
var MANAGED_CPU_ASR_VENV = join3(homedir4(), ".omnius", "runtimes", "asr", ".venv-whisper-cpu");
|
|
298092
298099
|
var MANAGED_TRANSCRIBE_CLI_DIR = join3(homedir4(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
298093
298100
|
var YT_DLP_VENV = join3(homedir4(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
298094
298101
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/index.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 41404006 bytes
|
|
4
|
+
sha256: be58a5d5d2b8a9eef20e5f59cd795bec65dd19e397280be9577570655f952bd0
|
package/dist/library.js
CHANGED
|
@@ -88453,8 +88453,11 @@ var init_transcribe_cuda_preparation = __esm({
|
|
|
88453
88453
|
let input = "";
|
|
88454
88454
|
for await (const chunk of process.stdin) input += chunk;
|
|
88455
88455
|
const options = JSON.parse(input);
|
|
88456
|
-
const
|
|
88457
|
-
|
|
88456
|
+
const cpu = process.env.OMNIUS_ASR_DEVICE?.trim().toLowerCase() === "cpu";
|
|
88457
|
+
if (cpu && !/^(1|true|yes|on)$/i.test(process.env.OMNIUS_ASR_ALLOW_CPU?.trim() ?? "")) throw new Error("CPU ASR preparation requires CPU permission");
|
|
88458
|
+
const runtimeModule = await import(process.argv[cpu ? 2 : 1]);
|
|
88459
|
+
const name = cpu ? "ensureAsrCpuPythonVenvSync" : "ensureCudaPythonVenvSync";
|
|
88460
|
+
const prepare = runtimeModule[name] ?? runtimeModule.default?.[name];
|
|
88458
88461
|
if (typeof prepare !== "function") throw new Error("ASR preparation runtime has no preparation entrypoint");
|
|
88459
88462
|
const runtime = prepare({ ...options, env: { ...process.env } });
|
|
88460
88463
|
// The caller needs only Python and the protected-Torch constraint. Never
|
|
@@ -88503,10 +88506,18 @@ var init_pcm16_silence_gate = __esm({
|
|
|
88503
88506
|
}
|
|
88504
88507
|
});
|
|
88505
88508
|
|
|
88509
|
+
// packages/execution/dist/asr-device.js
|
|
88510
|
+
var init_asr_device = __esm({
|
|
88511
|
+
"packages/execution/dist/asr-device.js"() {
|
|
88512
|
+
"use strict";
|
|
88513
|
+
init_process_async();
|
|
88514
|
+
}
|
|
88515
|
+
});
|
|
88516
|
+
|
|
88506
88517
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
88507
88518
|
import { join as join28, basename as basename8, dirname as dirname14, extname as extname2, resolve as resolve12 } from "node:path";
|
|
88508
88519
|
import { homedir as homedir6, tmpdir as tmpdir2 } from "node:os";
|
|
88509
|
-
var MAX_TRANSCRIBE_URL_BYTES, MANAGED_ASR_VENV, MANAGED_TRANSCRIBE_CLI_DIR, YT_DLP_VENV;
|
|
88520
|
+
var MAX_TRANSCRIBE_URL_BYTES, MANAGED_ASR_VENV, MANAGED_CPU_ASR_VENV, MANAGED_TRANSCRIBE_CLI_DIR, YT_DLP_VENV;
|
|
88510
88521
|
var init_transcribe_tool = __esm({
|
|
88511
88522
|
"packages/execution/dist/tools/transcribe-tool.js"() {
|
|
88512
88523
|
"use strict";
|
|
@@ -88519,8 +88530,10 @@ var init_transcribe_tool = __esm({
|
|
|
88519
88530
|
init_transcribe_python_runtime();
|
|
88520
88531
|
init_transcribe_cli_worker();
|
|
88521
88532
|
init_pcm16_silence_gate();
|
|
88533
|
+
init_asr_device();
|
|
88522
88534
|
MAX_TRANSCRIBE_URL_BYTES = 100 * 1024 * 1024;
|
|
88523
88535
|
MANAGED_ASR_VENV = join28(homedir6(), ".omnius", "runtimes", "asr", ".venv-whisper");
|
|
88536
|
+
MANAGED_CPU_ASR_VENV = join28(homedir6(), ".omnius", "runtimes", "asr", ".venv-whisper-cpu");
|
|
88524
88537
|
MANAGED_TRANSCRIBE_CLI_DIR = join28(homedir6(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
88525
88538
|
YT_DLP_VENV = join28(homedir6(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
88526
88539
|
}
|
|
@@ -373340,6 +373353,7 @@ import { closeSync as closeSync17, existsSync as existsSync35, fsyncSync as fsyn
|
|
|
373340
373353
|
import { randomUUID as randomUUID51 } from "node:crypto";
|
|
373341
373354
|
import { dirname as dirname30, join as join51, resolve as resolve33 } from "node:path";
|
|
373342
373355
|
var INTERRUPTION_LIFECYCLE_SCHEMA = "omnius.interruption-lifecycle.v1";
|
|
373356
|
+
var TRANSCRIPTION_OBSERVATION_RECONCILIATION = "registered-tool:transcribe_file:cancelled-observation:no-external-action:no-transcript-result";
|
|
373343
373357
|
var TERMINAL_PHASES = /* @__PURE__ */ new Set([
|
|
373344
373358
|
"stopped",
|
|
373345
373359
|
"completed",
|
|
@@ -373461,7 +373475,8 @@ function isSnapshot(value) {
|
|
|
373461
373475
|
}
|
|
373462
373476
|
return ambiguous.every((effect) => {
|
|
373463
373477
|
const acknowledgement = acknowledgementById.get(effect.operationId);
|
|
373464
|
-
|
|
373478
|
+
const reclassifiedTranscription = acknowledgement?.effect === "read_only" && acknowledgement.status === "acknowledged" && effect.ownerId === "tool:transcribe_file" && ["mutating_tool", "media"].includes(effect.kind) && effect.state === "confirmed_absent" && effect.evidenceId === TRANSCRIPTION_OBSERVATION_RECONCILIATION;
|
|
373479
|
+
return Boolean(acknowledgement && acknowledgement.status !== "pending" && (acknowledgement.effect === "external_effect" || reclassifiedTranscription) && acknowledgement.kind === effect.kind && acknowledgement.ownerId === effect.ownerId && acknowledgement.generation === effect.generation);
|
|
373465
373480
|
});
|
|
373466
373481
|
}
|
|
373467
373482
|
function interruptionLifecycleMode(env = process.env) {
|
|
@@ -373487,6 +373502,10 @@ var InterruptionLifecycle = class {
|
|
|
373487
373502
|
if (recovered && recovered.sessionId !== options.sessionId) {
|
|
373488
373503
|
throw new Error("interruption_state_invalid:session_identity_mismatch");
|
|
373489
373504
|
}
|
|
373505
|
+
const expected = options.expectedRecoveryIdentity;
|
|
373506
|
+
if (expected && (!recovered || recovered.sessionId !== expected.sessionId || recovered.runId !== expected.runId || recovered.taskEpoch !== expected.taskEpoch || recovered.owner.kind !== expected.owner.kind || recovered.owner.id !== expected.owner.id || recovered.owner.generation !== expected.owner.generation)) {
|
|
373507
|
+
throw new Error("interruption_recovery_identity_mismatch");
|
|
373508
|
+
}
|
|
373490
373509
|
if (recovered) {
|
|
373491
373510
|
this.state = this.recover(recovered);
|
|
373492
373511
|
this.operationSequence = this.maxOperationSequence(this.state);
|
|
@@ -373839,6 +373858,47 @@ var InterruptionLifecycle = class {
|
|
|
373839
373858
|
}
|
|
373840
373859
|
return true;
|
|
373841
373860
|
}
|
|
373861
|
+
/** Repair the old ASR classification, without supplying a transcription
|
|
373862
|
+
* result. The absent effect is an external action, not an owned cache or
|
|
373863
|
+
* transcript artifact. All other interrupted effects retain their fence. */
|
|
373864
|
+
reconcileInterruptedTranscription(input2) {
|
|
373865
|
+
if (this.durabilityUncertain || !this.persistEnabled || !this.state.recovered || !["paused", "stopped", "failed"].includes(this.state.phase) || input2.tool.name !== "transcribe_file" || input2.tool.interruptionEffect === "external_effect")
|
|
373866
|
+
return 0;
|
|
373867
|
+
const expected = input2.expected;
|
|
373868
|
+
if (this.state.sessionId !== expected.sessionId || this.state.runId !== expected.runId || this.state.taskEpoch !== expected.taskEpoch || this.state.owner.kind !== expected.owner.kind || this.state.owner.id !== expected.owner.id || this.state.owner.generation !== expected.owner.generation)
|
|
373869
|
+
return 0;
|
|
373870
|
+
try {
|
|
373871
|
+
if (input2.tool.isReadOnly?.({}) !== true)
|
|
373872
|
+
return 0;
|
|
373873
|
+
} catch {
|
|
373874
|
+
return 0;
|
|
373875
|
+
}
|
|
373876
|
+
const matches = this.state.ambiguousEffects.flatMap((effect) => {
|
|
373877
|
+
if (effect.state !== "unknown_after_interrupt" || effect.ownerId !== "tool:transcribe_file" || effect.generation > this.state.owner.generation || !["mutating_tool", "media"].includes(effect.kind))
|
|
373878
|
+
return [];
|
|
373879
|
+
const acknowledgement = this.state.pendingAcknowledgements.find((item) => item.id === effect.operationId && item.ownerId === effect.ownerId && item.generation === effect.generation && item.kind === effect.kind && item.effect === "external_effect" && item.status !== "pending");
|
|
373880
|
+
return acknowledgement ? [{ effect, acknowledgement }] : [];
|
|
373881
|
+
});
|
|
373882
|
+
if (!matches.length)
|
|
373883
|
+
return 0;
|
|
373884
|
+
const previousState = cloneSnapshot(this.state), at = this.timestamp();
|
|
373885
|
+
try {
|
|
373886
|
+
for (const { effect, acknowledgement } of matches) {
|
|
373887
|
+
acknowledgement.effect = "read_only";
|
|
373888
|
+
acknowledgement.status = "acknowledged";
|
|
373889
|
+
acknowledgement.acknowledgedAt = at;
|
|
373890
|
+
effect.state = "confirmed_absent";
|
|
373891
|
+
effect.resolvedAt = at;
|
|
373892
|
+
effect.evidenceId = TRANSCRIPTION_OBSERVATION_RECONCILIATION;
|
|
373893
|
+
}
|
|
373894
|
+
this.persist();
|
|
373895
|
+
} catch (error) {
|
|
373896
|
+
if (!persistenceMayHaveCommitted(error))
|
|
373897
|
+
this.state = previousState;
|
|
373898
|
+
throw error;
|
|
373899
|
+
}
|
|
373900
|
+
return matches.length;
|
|
373901
|
+
}
|
|
373842
373902
|
replaceChildLineage(childLineage) {
|
|
373843
373903
|
this.assertDurabilityCertain();
|
|
373844
373904
|
const previousState = cloneSnapshot(this.state);
|
|
@@ -427917,6 +427977,10 @@ Respond with the assessment and take the selected evidence-backed action.`;
|
|
|
427917
427977
|
owner: { kind: "runner", id: this._interruptionOwnerId },
|
|
427918
427978
|
persist: this._interruptionMode !== "off"
|
|
427919
427979
|
});
|
|
427980
|
+
const registeredTranscription = this.lookupRegisteredTool("transcribe_file");
|
|
427981
|
+
if (registeredTranscription?.name === "transcribe_file") {
|
|
427982
|
+
lifecycle.reconcileInterruptedTranscription({ expected: lifecycle.snapshot(), tool: registeredTranscription.tool });
|
|
427983
|
+
}
|
|
427920
427984
|
const recovered = lifecycle.snapshot();
|
|
427921
427985
|
let pausedCheckpoint = null;
|
|
427922
427986
|
this._interruptionLifecycle = lifecycle;
|
|
@@ -299392,8 +299392,11 @@ var WORKER = `
|
|
|
299392
299392
|
let input = "";
|
|
299393
299393
|
for await (const chunk of process.stdin) input += chunk;
|
|
299394
299394
|
const options = JSON.parse(input);
|
|
299395
|
-
const
|
|
299396
|
-
|
|
299395
|
+
const cpu = process.env.OMNIUS_ASR_DEVICE?.trim().toLowerCase() === "cpu";
|
|
299396
|
+
if (cpu && !/^(1|true|yes|on)$/i.test(process.env.OMNIUS_ASR_ALLOW_CPU?.trim() ?? "")) throw new Error("CPU ASR preparation requires CPU permission");
|
|
299397
|
+
const runtimeModule = await import(process.argv[cpu ? 2 : 1]);
|
|
299398
|
+
const name = cpu ? "ensureAsrCpuPythonVenvSync" : "ensureCudaPythonVenvSync";
|
|
299399
|
+
const prepare = runtimeModule[name] ?? runtimeModule.default?.[name];
|
|
299397
299400
|
if (typeof prepare !== "function") throw new Error("ASR preparation runtime has no preparation entrypoint");
|
|
299398
299401
|
const runtime = prepare({ ...options, env: { ...process.env } });
|
|
299399
299402
|
// The caller needs only Python and the protected-Torch constraint. Never
|
|
@@ -299421,9 +299424,13 @@ const bridge = require(process.argv[1]);
|
|
|
299421
299424
|
})().catch(error => { console.error(error && error.stack || String(error)); process.exitCode = 1; });
|
|
299422
299425
|
`;
|
|
299423
299426
|
|
|
299427
|
+
// packages/execution/dist/asr-device.js
|
|
299428
|
+
init_process_async();
|
|
299429
|
+
|
|
299424
299430
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
299425
299431
|
var MAX_TRANSCRIBE_URL_BYTES = 100 * 1024 * 1024;
|
|
299426
299432
|
var MANAGED_ASR_VENV = join3(homedir4(), ".omnius", "runtimes", "asr", ".venv-whisper");
|
|
299433
|
+
var MANAGED_CPU_ASR_VENV = join3(homedir4(), ".omnius", "runtimes", "asr", ".venv-whisper-cpu");
|
|
299427
299434
|
var MANAGED_TRANSCRIBE_CLI_DIR = join3(homedir4(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
299428
299435
|
var YT_DLP_VENV = join3(homedir4(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
299429
299436
|
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
Transcribe an audio file using openai-whisper
|
|
3
|
+
Transcribe an audio file using openai-whisper on verified CUDA or CPU hardware.
|
|
4
4
|
|
|
5
5
|
stdin: JSON {"path": "...", "model": "tiny|base|small|medium|large-v3"}
|
|
6
6
|
stdout: JSON {"text": "...", "duration": null, "segments": []}
|
|
7
7
|
or {"error": "<kind>", "message": "..."}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Automatic CPU is selected only when physical CUDA hardware is absent.
|
|
10
|
+
An explicit CPU override still requires OMNIUS_ASR_ALLOW_CPU=1.
|
|
10
11
|
"""
|
|
11
|
-
import sys, os, json, math, struct, warnings, wave
|
|
12
|
+
import sys, os, json, math, struct, warnings, wave, platform, re, subprocess
|
|
13
|
+
from pathlib import Path
|
|
12
14
|
|
|
13
15
|
warnings.filterwarnings("ignore")
|
|
14
16
|
os.environ.setdefault("PYTHONWARNINGS", "ignore")
|
|
@@ -18,6 +20,102 @@ PCM16_SILENCE_MAX_RMS = 1.0
|
|
|
18
20
|
PCM16_ACTIVE_SAMPLE_THRESHOLD = 8
|
|
19
21
|
|
|
20
22
|
|
|
23
|
+
def path_exists(path):
|
|
24
|
+
try:
|
|
25
|
+
Path(path).stat()
|
|
26
|
+
return True
|
|
27
|
+
except FileNotFoundError:
|
|
28
|
+
return False
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def linux_cuda_hardware(pci_root="/sys/bus/pci/devices", dev_root="/dev",
|
|
32
|
+
jetson_paths=("/etc/nv_tegra_release", "/sys/module/tegra_fuse"),
|
|
33
|
+
model_path="/proc/device-tree/model", driver_path="/proc/driver/nvidia/gpus"):
|
|
34
|
+
"""Inspect physical inventory, never Torch availability or CUDA masks."""
|
|
35
|
+
try:
|
|
36
|
+
if any(path_exists(path) for path in jetson_paths):
|
|
37
|
+
return "present"
|
|
38
|
+
model = Path(model_path)
|
|
39
|
+
if path_exists(model) and re.search(r"\b(nvidia|jetson|orin|tegra)\b", model.read_text().replace("\0", " "), re.I):
|
|
40
|
+
return "present"
|
|
41
|
+
nodes = list(Path(dev_root).iterdir())
|
|
42
|
+
if len(nodes) > 4096:
|
|
43
|
+
return "unknown"
|
|
44
|
+
if any(re.match(r"^(nvidia|nvhost)|^nvmap$", path.name) for path in nodes):
|
|
45
|
+
return "present"
|
|
46
|
+
driver = Path(driver_path)
|
|
47
|
+
if path_exists(driver) and any(driver.iterdir()):
|
|
48
|
+
return "present"
|
|
49
|
+
devices = list(Path(pci_root).iterdir())
|
|
50
|
+
if not devices or len(devices) > 4096:
|
|
51
|
+
return "unknown"
|
|
52
|
+
for path in devices:
|
|
53
|
+
vendor = (path / "vendor").read_text().strip().lower()
|
|
54
|
+
if not re.fullmatch(r"0x[0-9a-f]{4}", vendor):
|
|
55
|
+
return "unknown"
|
|
56
|
+
if vendor == "0x10de":
|
|
57
|
+
return "present"
|
|
58
|
+
return "absent"
|
|
59
|
+
except (OSError, ValueError):
|
|
60
|
+
return "unknown"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def windows_cuda_hardware(env):
|
|
64
|
+
try:
|
|
65
|
+
result = subprocess.run(["powershell.exe", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command",
|
|
66
|
+
"$ErrorActionPreference='Stop'; $ids=@(Get-CimInstance Win32_PnPEntity | ForEach-Object { $_.PNPDeviceID }); "
|
|
67
|
+
"@{complete=$true; ids=$ids} | ConvertTo-Json -Compress"], env=env, capture_output=True, text=True, timeout=3)
|
|
68
|
+
if result.returncode or len(result.stdout) > 262144:
|
|
69
|
+
return "unknown"
|
|
70
|
+
inventory = json.loads(result.stdout.lstrip("\ufeff"))
|
|
71
|
+
ids = inventory.get("ids")
|
|
72
|
+
if inventory.get("complete") is not True or not isinstance(ids, list) or not 0 < len(ids) <= 4096 or not all(isinstance(value, str) and value for value in ids):
|
|
73
|
+
return "unknown"
|
|
74
|
+
return "present" if any(re.match(r"^PCI\\VEN_10DE(?:&|\\|$)", value, re.I) for value in ids) else "absent"
|
|
75
|
+
except (OSError, ValueError, AttributeError, subprocess.SubprocessError):
|
|
76
|
+
return "unknown"
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def cuda_hardware(env):
|
|
80
|
+
system = platform.system()
|
|
81
|
+
if system == "Darwin":
|
|
82
|
+
return "absent"
|
|
83
|
+
smi = "unknown"
|
|
84
|
+
try:
|
|
85
|
+
result = subprocess.run(["nvidia-smi", "--query-gpu=uuid", "--format=csv,noheader"],
|
|
86
|
+
env=env, capture_output=True, text=True, timeout=3)
|
|
87
|
+
lines = [line.strip() for line in result.stdout.splitlines() if line.strip()]
|
|
88
|
+
if result.returncode == 0 and len(result.stdout) <= 16384:
|
|
89
|
+
if lines and all(re.fullmatch(r"GPU-[a-z0-9-]+", line, re.I) for line in lines):
|
|
90
|
+
return "present"
|
|
91
|
+
smi = "absent" if not lines else "unknown"
|
|
92
|
+
elif (result.stdout + "\n" + result.stderr).strip() == "No devices were found":
|
|
93
|
+
smi = "absent"
|
|
94
|
+
except FileNotFoundError:
|
|
95
|
+
smi = "unavailable"
|
|
96
|
+
except (OSError, subprocess.SubprocessError):
|
|
97
|
+
pass
|
|
98
|
+
physical = linux_cuda_hardware() if system == "Linux" else windows_cuda_hardware(env) if system == "Windows" else "unknown"
|
|
99
|
+
if physical == "present":
|
|
100
|
+
return "present"
|
|
101
|
+
return "unknown" if smi == "unknown" else physical
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def resolve_asr_device(env=None, hardware_probe=None):
|
|
105
|
+
env = os.environ if env is None else env
|
|
106
|
+
requested = env.get("OMNIUS_ASR_DEVICE", "auto").strip().lower() or "auto"
|
|
107
|
+
if requested == "cpu":
|
|
108
|
+
if env.get("OMNIUS_ASR_ALLOW_CPU", "").strip().lower() not in ("1", "true", "yes", "on"):
|
|
109
|
+
raise RuntimeError("Explicit CPU ASR requires OMNIUS_ASR_ALLOW_CPU=1.")
|
|
110
|
+
return "cpu", False
|
|
111
|
+
if re.fullmatch(r"cuda(?::(?:0|[1-9][0-9]*))?", requested):
|
|
112
|
+
return requested, False
|
|
113
|
+
if requested != "auto":
|
|
114
|
+
raise RuntimeError("Unsupported ASR device: " + requested)
|
|
115
|
+
hardware = (hardware_probe or cuda_hardware)(env)
|
|
116
|
+
return ("cpu", True) if hardware == "absent" else ("cuda", False)
|
|
117
|
+
|
|
118
|
+
|
|
21
119
|
def exact_pcm16_silence(path):
|
|
22
120
|
"""Return typed no-speech evidence for exact PCM16/16k/mono WAV only.
|
|
23
121
|
|
|
@@ -89,21 +187,16 @@ def main() -> None:
|
|
|
89
187
|
|
|
90
188
|
model_name = data.get("model") or "tiny"
|
|
91
189
|
try:
|
|
190
|
+
device, automatic_cpu = resolve_asr_device()
|
|
92
191
|
import whisper
|
|
93
|
-
device = os.environ.get("OMNIUS_ASR_DEVICE", "cuda").strip().lower() or "cuda"
|
|
94
|
-
allow_cpu = os.environ.get("OMNIUS_ASR_ALLOW_CPU", "").strip().lower() in ("1", "true", "yes", "on")
|
|
95
|
-
if device == "auto":
|
|
96
|
-
device = "cuda"
|
|
97
192
|
if device.startswith("cuda"):
|
|
98
193
|
import torch
|
|
99
194
|
if not torch.cuda.is_available() or torch.cuda.device_count() <= 0:
|
|
100
195
|
raise RuntimeError(
|
|
101
196
|
f"CUDA-only ASR requested but torch cannot use CUDA "
|
|
102
197
|
f"(torch.version.cuda={getattr(torch.version, 'cuda', None)}, device_count={torch.cuda.device_count()}). "
|
|
103
|
-
"
|
|
198
|
+
"Repair CUDA/PyTorch or explicitly select an authorized CPU device. Hardware presence never triggers automatic CPU fallback."
|
|
104
199
|
)
|
|
105
|
-
elif device == "cpu" and not allow_cpu:
|
|
106
|
-
raise RuntimeError("CPU ASR refused. Set OMNIUS_ASR_ALLOW_CPU=1 only for explicit emergency fallback.")
|
|
107
200
|
model = whisper.load_model(model_name, device=device)
|
|
108
201
|
result = model.transcribe(path, fp16=device.startswith("cuda"), condition_on_previous_text=False)
|
|
109
202
|
except Exception as e:
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createRequire as __omnius_createRequire } from "node:module"; import { fileURLToPath as __omnius_fileURLToPath } from "node:url"; import { dirname as __omnius_dirname } from "node:path"; const require = __omnius_createRequire(import.meta.url); const __filename = __omnius_fileURLToPath(import.meta.url); const __dirname = __omnius_dirname(__filename);
|
|
2
|
+
|
|
3
|
+
// packages/execution/src/transcribe-cpu-runtime.ts
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { dirname, join as join2 } from "node:path";
|
|
7
|
+
|
|
8
|
+
// packages/execution/src/venv-paths.ts
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
var isWin = process.platform === "win32";
|
|
11
|
+
function venvPython(venvDir) {
|
|
12
|
+
return isWin ? join(venvDir, "Scripts", "python.exe") : join(venvDir, "bin", "python");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// packages/execution/src/transcribe-cpu-runtime.ts
|
|
16
|
+
var CPU_TORCH_INDEX = "https://download.pytorch.org/whl/cpu";
|
|
17
|
+
var run = (command, args, timeout, env) => {
|
|
18
|
+
const result = spawnSync(command, args, { encoding: "utf8", timeout, env, maxBuffer: 16 * 1024 * 1024 });
|
|
19
|
+
return {
|
|
20
|
+
ok: !result.error && result.status === 0,
|
|
21
|
+
output: `${result.stdout ?? ""}
|
|
22
|
+
${result.stderr ?? ""}
|
|
23
|
+
${result.error?.message ?? ""}`.trim()
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
function ensureAsrCpuPythonVenvSync(options, dependencies = {}) {
|
|
27
|
+
const execute = dependencies.run ?? run, env = { ...process.env, ...options.env };
|
|
28
|
+
if (env.OMNIUS_ASR_DEVICE?.trim().toLowerCase() !== "cpu" || !/^(1|true|yes|on)$/i.test(env.OMNIUS_ASR_ALLOW_CPU?.trim() ?? ""))
|
|
29
|
+
throw new Error("CPU ASR preparation requires an explicitly resolved and permitted CPU device");
|
|
30
|
+
const python = venvPython(options.venvDir), label = options.label ?? "managed CPU ASR runtime";
|
|
31
|
+
const cleanEnv = { ...env, PYTHONNOUSERSITE: "1" };
|
|
32
|
+
delete cleanEnv.PYTHONPATH;
|
|
33
|
+
delete cleanEnv.PYTHONHOME;
|
|
34
|
+
delete cleanEnv.PIP_CONSTRAINT;
|
|
35
|
+
if (!existsSync(python)) {
|
|
36
|
+
mkdirSync(dirname(options.venvDir), { recursive: true });
|
|
37
|
+
const created = execute(options.bootstrapPython?.trim() || "python3", ["-m", "venv", options.venvDir], 12e4, cleanEnv);
|
|
38
|
+
if (!created.ok) throw new Error(`Failed to create ${label}: ${created.output}`);
|
|
39
|
+
}
|
|
40
|
+
if (!/^include-system-site-packages\s*=\s*false\s*$/mi.test(readFileSync(join2(options.venvDir, "pyvenv.cfg"), "utf8")))
|
|
41
|
+
throw new Error(`${label} must be isolated from system and CUDA Python packages`);
|
|
42
|
+
const code = "import json,torch; assert torch.version.cuda is None, 'CPU ASR requires a CPU-only Torch build'; assert torch.tensor([1],device='cpu').item()==1; print(json.dumps({'torch':torch.__version__}))";
|
|
43
|
+
const probe = () => execute(python, ["-c", code], 3e4, cleanEnv);
|
|
44
|
+
let verified = probe();
|
|
45
|
+
if (!verified.ok) {
|
|
46
|
+
const installEnv = { ...cleanEnv };
|
|
47
|
+
for (const name of Object.keys(installEnv)) if (name.startsWith("PIP_")) delete installEnv[name];
|
|
48
|
+
Object.assign(installEnv, {
|
|
49
|
+
PIP_CONFIG_FILE: process.platform === "win32" ? "NUL" : "/dev/null",
|
|
50
|
+
PIP_INDEX_URL: CPU_TORCH_INDEX,
|
|
51
|
+
PIP_EXTRA_INDEX_URL: ""
|
|
52
|
+
});
|
|
53
|
+
const installed = execute(python, [
|
|
54
|
+
"-m",
|
|
55
|
+
"pip",
|
|
56
|
+
"install",
|
|
57
|
+
"--disable-pip-version-check",
|
|
58
|
+
"--upgrade",
|
|
59
|
+
"--force-reinstall",
|
|
60
|
+
"--index-url",
|
|
61
|
+
CPU_TORCH_INDEX,
|
|
62
|
+
"--only-binary=:all:",
|
|
63
|
+
"torch"
|
|
64
|
+
], 9e5, installEnv);
|
|
65
|
+
if (!installed.ok) throw new Error(`${label} could not install CPU Torch: ${installed.output}`);
|
|
66
|
+
verified = probe();
|
|
67
|
+
}
|
|
68
|
+
if (!verified.ok) throw new Error(`${label} failed CPU-only Torch validation: ${verified.output}`);
|
|
69
|
+
const line = verified.output.split(/\r?\n/).reverse().find((value) => value.trim().startsWith("{"));
|
|
70
|
+
let version;
|
|
71
|
+
try {
|
|
72
|
+
version = JSON.parse(line ?? "{}").torch;
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
if (typeof version !== "string" || !/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/.test(version))
|
|
76
|
+
throw new Error(`${label} returned an invalid CPU Torch version`);
|
|
77
|
+
const constraint = join2(options.venvDir, "omnius-cpu-torch-constraints.txt");
|
|
78
|
+
writeFileSync(constraint, `torch==${version}
|
|
79
|
+
`, { mode: 384 });
|
|
80
|
+
return { python, pipEnv: { ...cleanEnv, PIP_CONSTRAINT: constraint } };
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
ensureAsrCpuPythonVenvSync
|
|
84
|
+
};
|
|
@@ -73,6 +73,7 @@ function sanitizeNativeInterfaceState(value) {
|
|
|
73
73
|
scrollTop: offset(instruments.scrollTop),
|
|
74
74
|
deviceScrollTop: offset(instruments.deviceScrollTop),
|
|
75
75
|
...typeof instruments.routeAttempts === "boolean" ? { routeAttempts: instruments.routeAttempts } : {},
|
|
76
|
+
...typeof instruments.telegram === "boolean" ? { telegram: instruments.telegram } : {},
|
|
76
77
|
...taskNotes ? { taskNotes: { open: taskNotes.open !== false, tasks: taskNotes.tasks !== false, notes: taskNotes.notes !== false, layers: taskNotes.layers !== false, disclosures: taskDisclosures } } : {},
|
|
77
78
|
...workQueue ? { workQueue: { open: workQueue.open !== false, history: workQueue.history === true, disclosures: workDisclosures } } : {},
|
|
78
79
|
...workspaceFiles ? { workspaceFiles: {
|
|
@@ -5745,10 +5746,166 @@ var ChannelMap = class extends BoxRenderable9 {
|
|
|
5745
5746
|
}
|
|
5746
5747
|
}
|
|
5747
5748
|
};
|
|
5749
|
+
var NativeTelegramView = class extends BoxRenderable9 {
|
|
5750
|
+
constructor(renderer2, colors, onAction, reveal) {
|
|
5751
|
+
super(renderer2, { id: "omnius-telegram", width: "100%", minWidth: 0, flexDirection: "column", flexShrink: 0, visible: false });
|
|
5752
|
+
this.renderer = renderer2;
|
|
5753
|
+
this.colors = colors;
|
|
5754
|
+
this.onAction = onAction;
|
|
5755
|
+
this.reveal = reveal;
|
|
5756
|
+
this.header = new SectionBanner(renderer2, "TELEGRAM", "omnius-telegram:heading", () => this.setExpanded(!this.expanded));
|
|
5757
|
+
this.header.update("TELEGRAM", false);
|
|
5758
|
+
this.header.on(RenderableEvents6.FOCUSED, () => this.reveal?.(this.header));
|
|
5759
|
+
this.add(this.header);
|
|
5760
|
+
this.body = new BoxRenderable9(renderer2, { id: "omnius-telegram:body", width: "100%", minWidth: 0, flexDirection: "column", flexShrink: 0, visible: false });
|
|
5761
|
+
this.add(this.body);
|
|
5762
|
+
const text = (id) => new TextRenderable8(renderer2, {
|
|
5763
|
+
id,
|
|
5764
|
+
content: "",
|
|
5765
|
+
width: "100%",
|
|
5766
|
+
minWidth: 0,
|
|
5767
|
+
flexShrink: 0,
|
|
5768
|
+
wrapMode: "word",
|
|
5769
|
+
fg: colors.foreground,
|
|
5770
|
+
bg: colors.background
|
|
5771
|
+
});
|
|
5772
|
+
this.details = text("omnius-telegram:details");
|
|
5773
|
+
this.body.add(this.details);
|
|
5774
|
+
this.error = text("omnius-telegram:error");
|
|
5775
|
+
this.body.add(this.error);
|
|
5776
|
+
this.applyTheme(colors);
|
|
5777
|
+
}
|
|
5778
|
+
renderer;
|
|
5779
|
+
colors;
|
|
5780
|
+
onAction;
|
|
5781
|
+
reveal;
|
|
5782
|
+
header;
|
|
5783
|
+
body;
|
|
5784
|
+
details;
|
|
5785
|
+
error;
|
|
5786
|
+
actions = /* @__PURE__ */ new Map();
|
|
5787
|
+
expanded = false;
|
|
5788
|
+
busy = false;
|
|
5789
|
+
ownsFocus() {
|
|
5790
|
+
for (let node = this.renderer.currentFocusedRenderable; node; node = node.parent) {
|
|
5791
|
+
if (node === this) return true;
|
|
5792
|
+
}
|
|
5793
|
+
return false;
|
|
5794
|
+
}
|
|
5795
|
+
update(state) {
|
|
5796
|
+
this.visible = state?.configured === true;
|
|
5797
|
+
this.body.visible = this.visible && this.expanded;
|
|
5798
|
+
if (!this.visible || !state) return;
|
|
5799
|
+
this.busy = state.busy === true;
|
|
5800
|
+
const safe3 = (value) => plainText(value).replace(/[\r\n\t]+/g, " ");
|
|
5801
|
+
const details = [
|
|
5802
|
+
`STATUS ${state.status.toUpperCase()} · ${state.owner.toUpperCase()}${state.busy ? " · UPDATING" : ""}`,
|
|
5803
|
+
...state.botUsername ? [`BOT @${safe3(state.botUsername).replace(/^@/, "")}`] : [],
|
|
5804
|
+
`MODE ${state.mode.toUpperCase()} · SLOTS ${instrumentNumber(state.slots)}`,
|
|
5805
|
+
`POLLING ${state.enabled ? "ENABLED" : "DISABLED"}${state.pollPhase ? ` · ${safe3(state.pollPhase)}` : ""}`,
|
|
5806
|
+
...state.activeTasks !== void 0 || state.queuedTasks !== void 0 ? [`TASKS ${instrumentNumber(state.activeTasks)} ACTIVE · ${instrumentNumber(state.queuedTasks)} QUEUED`] : [],
|
|
5807
|
+
...state.privacyLimited ? ["Group visibility is limited by bot privacy."] : [],
|
|
5808
|
+
...state.restartRequired ? ["Restart required to apply settings."] : [],
|
|
5809
|
+
...state.detail ? [safe3(state.detail)] : []
|
|
5810
|
+
].join("\n");
|
|
5811
|
+
if (this.details.plainText !== details) this.details.content = details;
|
|
5812
|
+
this.error.content = safe3(state.error);
|
|
5813
|
+
this.error.visible = Boolean(state.error);
|
|
5814
|
+
const current = new Set(state.actions.map((action) => action.id));
|
|
5815
|
+
for (const [id, row] of this.actions) if (!current.has(id)) {
|
|
5816
|
+
if (row.control.focused) this.header.focus();
|
|
5817
|
+
row.control.destroy();
|
|
5818
|
+
this.actions.delete(id);
|
|
5819
|
+
}
|
|
5820
|
+
for (const [index, action] of state.actions.entries()) {
|
|
5821
|
+
let row = this.actions.get(action.id);
|
|
5822
|
+
if (!row) {
|
|
5823
|
+
const activate = () => {
|
|
5824
|
+
const latest = this.actions.get(action.id);
|
|
5825
|
+
if (this.visible && this.expanded && !this.busy && latest && !latest.action.disabled) {
|
|
5826
|
+
this.onAction?.(latest.action.command ?? latest.action.id);
|
|
5827
|
+
}
|
|
5828
|
+
};
|
|
5829
|
+
const control = new TextRenderable8(this.renderer, {
|
|
5830
|
+
id: `omnius-telegram:action:${action.id}`,
|
|
5831
|
+
content: "",
|
|
5832
|
+
width: "100%",
|
|
5833
|
+
minWidth: 0,
|
|
5834
|
+
height: 1,
|
|
5835
|
+
flexShrink: 0,
|
|
5836
|
+
wrapMode: "none",
|
|
5837
|
+
truncate: true,
|
|
5838
|
+
selectable: false,
|
|
5839
|
+
fg: this.colors.foreground,
|
|
5840
|
+
bg: this.colors.background,
|
|
5841
|
+
onMouseDown: (event) => {
|
|
5842
|
+
if (event.button === 0) {
|
|
5843
|
+
if (control.focusable) control.focus();
|
|
5844
|
+
activate();
|
|
5845
|
+
event.preventDefault();
|
|
5846
|
+
event.stopPropagation();
|
|
5847
|
+
}
|
|
5848
|
+
},
|
|
5849
|
+
onKeyDown: (key) => {
|
|
5850
|
+
if (key.eventType !== "release" && (key.name === "return" || key.sequence === " ")) {
|
|
5851
|
+
activate();
|
|
5852
|
+
key.preventDefault();
|
|
5853
|
+
key.stopPropagation();
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5856
|
+
});
|
|
5857
|
+
const style = () => {
|
|
5858
|
+
control.attributes = (control.focusable ? 0 : TextAttributes8.DIM) | (this.actions.get(action.id)?.action.active ? TextAttributes8.BOLD : 0) | (control.focused ? TextAttributes8.INVERSE : 0);
|
|
5859
|
+
};
|
|
5860
|
+
control.on(RenderableEvents6.FOCUSED, () => {
|
|
5861
|
+
style();
|
|
5862
|
+
this.reveal?.(control);
|
|
5863
|
+
});
|
|
5864
|
+
control.on(RenderableEvents6.BLURRED, style);
|
|
5865
|
+
row = { control, action };
|
|
5866
|
+
this.actions.set(action.id, row);
|
|
5867
|
+
this.body.add(control);
|
|
5868
|
+
}
|
|
5869
|
+
row.action = action;
|
|
5870
|
+
row.control.content = safe3(action.label);
|
|
5871
|
+
row.control.focusable = !this.busy && !action.disabled;
|
|
5872
|
+
row.control.attributes = (row.control.focusable ? 0 : TextAttributes8.DIM) | (action.active ? TextAttributes8.BOLD : 0) | (row.control.focused ? TextAttributes8.INVERSE : 0);
|
|
5873
|
+
if (this.body.getChildren()[index + 2] !== row.control) this.body.add(row.control, index + 2);
|
|
5874
|
+
if (!row.control.focusable && row.control.focused) this.header.focus();
|
|
5875
|
+
}
|
|
5876
|
+
}
|
|
5877
|
+
setExpanded(expanded) {
|
|
5878
|
+
if (!expanded && this.ownsFocus()) this.header.focus();
|
|
5879
|
+
this.expanded = expanded;
|
|
5880
|
+
this.header.update("TELEGRAM", expanded);
|
|
5881
|
+
this.body.visible = this.visible && expanded;
|
|
5882
|
+
}
|
|
5883
|
+
get isExpanded() {
|
|
5884
|
+
return this.expanded;
|
|
5885
|
+
}
|
|
5886
|
+
focusTargets() {
|
|
5887
|
+
return this.visible ? [this.header, ...this.expanded ? this.body.getChildren().filter((node) => node instanceof TextRenderable8 && node.focusable) : []] : [];
|
|
5888
|
+
}
|
|
5889
|
+
applyTheme(colors) {
|
|
5890
|
+
this.colors = colors;
|
|
5891
|
+
this.backgroundColor = colors.background;
|
|
5892
|
+
this.header.fg = colors.foreground;
|
|
5893
|
+
this.header.bg = colors.background;
|
|
5894
|
+
this.details.fg = colors.foreground;
|
|
5895
|
+
this.details.bg = colors.background;
|
|
5896
|
+
this.error.fg = colors.error;
|
|
5897
|
+
this.error.bg = colors.background;
|
|
5898
|
+
for (const row of this.actions.values()) {
|
|
5899
|
+
row.control.fg = colors.foreground;
|
|
5900
|
+
row.control.bg = colors.background;
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
};
|
|
5748
5904
|
var InstrumentRail = class extends BoxRenderable9 {
|
|
5749
5905
|
workQueue;
|
|
5750
5906
|
workspaceFiles;
|
|
5751
5907
|
taskNotes;
|
|
5908
|
+
telegram;
|
|
5752
5909
|
scroll;
|
|
5753
5910
|
inferenceHeader;
|
|
5754
5911
|
sessionHeader;
|
|
@@ -5821,6 +5978,8 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
5821
5978
|
selection: background
|
|
5822
5979
|
}, (target) => this.reveal(target));
|
|
5823
5980
|
this.scroll.add(this.taskNotes);
|
|
5981
|
+
this.telegram = new NativeTelegramView(renderer2, colors, options.onAction, (target) => this.reveal(target));
|
|
5982
|
+
this.scroll.add(this.telegram);
|
|
5824
5983
|
this.inferenceHeader = new SectionBanner(
|
|
5825
5984
|
renderer2,
|
|
5826
5985
|
"INFERENCE",
|
|
@@ -5935,6 +6094,9 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
5935
6094
|
if (options.colors) this.applyTheme(options.colors);
|
|
5936
6095
|
}
|
|
5937
6096
|
update(state) {
|
|
6097
|
+
const telegramFocused = this.telegram.focusTargets().some((target) => target.focused);
|
|
6098
|
+
this.telegram.update(state.instruments?.telegram);
|
|
6099
|
+
if (telegramFocused && !this.telegram.visible) this.inferenceHeader.focus();
|
|
5938
6100
|
this.workQueue.update(state.workQueue);
|
|
5939
6101
|
this.workspaceFiles.update(state.workspaceFiles);
|
|
5940
6102
|
this.taskNotes.update(state.taskNotes);
|
|
@@ -6038,6 +6200,7 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
6038
6200
|
this.workQueue.applyTheme(colors);
|
|
6039
6201
|
this.workspaceFiles.applyTheme(colors);
|
|
6040
6202
|
this.taskNotes.applyTheme(colors);
|
|
6203
|
+
this.telegram.applyTheme(colors);
|
|
6041
6204
|
styleNativeScrollbars(this.scroll, colors);
|
|
6042
6205
|
styleNativeScrollbars(this.devices.scroll, colors);
|
|
6043
6206
|
}
|
|
@@ -6056,6 +6219,7 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
6056
6219
|
session: this.session.visible,
|
|
6057
6220
|
context: this.contextHeader.expanded,
|
|
6058
6221
|
devices: this.devices.isExpanded,
|
|
6222
|
+
telegram: this.telegram.isExpanded,
|
|
6059
6223
|
deviceSections: this.devices.captureDeviceSections(),
|
|
6060
6224
|
routeAttempts: this.routeAttemptsHeader.expanded,
|
|
6061
6225
|
scrollTop: this.scroll.scrollTop,
|
|
@@ -6069,6 +6233,7 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
6069
6233
|
this.workQueue.restorePresentation(state.workQueue);
|
|
6070
6234
|
this.workspaceFiles.restorePresentation(state.workspaceFiles);
|
|
6071
6235
|
this.taskNotes.restorePresentation(state.taskNotes);
|
|
6236
|
+
this.telegram.setExpanded(state.telegram === true);
|
|
6072
6237
|
if (this.inference.visible !== state.inference) this.toggleSection("inference");
|
|
6073
6238
|
if (this.session.visible !== state.session) this.toggleSection("session");
|
|
6074
6239
|
this.contextHeader.update("CONTEXT DETAILS", state.context);
|
|
@@ -6085,6 +6250,7 @@ var InstrumentRail = class extends BoxRenderable9 {
|
|
|
6085
6250
|
return [
|
|
6086
6251
|
...this.workQueue.focusTargets(),
|
|
6087
6252
|
...this.taskNotes.focusTargets(),
|
|
6253
|
+
...this.telegram.focusTargets(),
|
|
6088
6254
|
this.inferenceHeader,
|
|
6089
6255
|
...this.inference.visible && this.contextHeader.visible ? [this.contextHeader] : [],
|
|
6090
6256
|
...this.inference.visible && this.routeAttemptsHeader.visible ? [this.routeAttemptsHeader] : [],
|
|
@@ -55445,8 +55445,11 @@ var init_transcribe_cuda_preparation = __esm({
|
|
|
55445
55445
|
let input = "";
|
|
55446
55446
|
for await (const chunk of process.stdin) input += chunk;
|
|
55447
55447
|
const options = JSON.parse(input);
|
|
55448
|
-
const
|
|
55449
|
-
|
|
55448
|
+
const cpu = process.env.OMNIUS_ASR_DEVICE?.trim().toLowerCase() === "cpu";
|
|
55449
|
+
if (cpu && !/^(1|true|yes|on)$/i.test(process.env.OMNIUS_ASR_ALLOW_CPU?.trim() ?? "")) throw new Error("CPU ASR preparation requires CPU permission");
|
|
55450
|
+
const runtimeModule = await import(process.argv[cpu ? 2 : 1]);
|
|
55451
|
+
const name = cpu ? "ensureAsrCpuPythonVenvSync" : "ensureCudaPythonVenvSync";
|
|
55452
|
+
const prepare = runtimeModule[name] ?? runtimeModule.default?.[name];
|
|
55450
55453
|
if (typeof prepare !== "function") throw new Error("ASR preparation runtime has no preparation entrypoint");
|
|
55451
55454
|
const runtime = prepare({ ...options, env: { ...process.env } });
|
|
55452
55455
|
// The caller needs only Python and the protected-Torch constraint. Never
|
|
@@ -55495,10 +55498,18 @@ var init_pcm16_silence_gate = __esm({
|
|
|
55495
55498
|
}
|
|
55496
55499
|
});
|
|
55497
55500
|
|
|
55501
|
+
// packages/execution/dist/asr-device.js
|
|
55502
|
+
var init_asr_device = __esm({
|
|
55503
|
+
"packages/execution/dist/asr-device.js"() {
|
|
55504
|
+
"use strict";
|
|
55505
|
+
init_process_async();
|
|
55506
|
+
}
|
|
55507
|
+
});
|
|
55508
|
+
|
|
55498
55509
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
55499
55510
|
import { join as join4, basename, dirname as dirname3, extname, resolve as resolve3 } from "node:path";
|
|
55500
55511
|
import { homedir as homedir5, tmpdir } from "node:os";
|
|
55501
|
-
var MAX_TRANSCRIBE_URL_BYTES, MANAGED_ASR_VENV, MANAGED_TRANSCRIBE_CLI_DIR, YT_DLP_VENV;
|
|
55512
|
+
var MAX_TRANSCRIBE_URL_BYTES, MANAGED_ASR_VENV, MANAGED_CPU_ASR_VENV, MANAGED_TRANSCRIBE_CLI_DIR, YT_DLP_VENV;
|
|
55502
55513
|
var init_transcribe_tool = __esm({
|
|
55503
55514
|
"packages/execution/dist/tools/transcribe-tool.js"() {
|
|
55504
55515
|
"use strict";
|
|
@@ -55511,8 +55522,10 @@ var init_transcribe_tool = __esm({
|
|
|
55511
55522
|
init_transcribe_python_runtime();
|
|
55512
55523
|
init_transcribe_cli_worker();
|
|
55513
55524
|
init_pcm16_silence_gate();
|
|
55525
|
+
init_asr_device();
|
|
55514
55526
|
MAX_TRANSCRIBE_URL_BYTES = 100 * 1024 * 1024;
|
|
55515
55527
|
MANAGED_ASR_VENV = join4(homedir5(), ".omnius", "runtimes", "asr", ".venv-whisper");
|
|
55528
|
+
MANAGED_CPU_ASR_VENV = join4(homedir5(), ".omnius", "runtimes", "asr", ".venv-whisper-cpu");
|
|
55516
55529
|
MANAGED_TRANSCRIBE_CLI_DIR = join4(homedir5(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
55517
55530
|
YT_DLP_VENV = join4(homedir5(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
55518
55531
|
}
|
package/docs/DISCOVERY.json
CHANGED
|
@@ -31652,6 +31652,37 @@
|
|
|
31652
31652
|
}
|
|
31653
31653
|
]
|
|
31654
31654
|
},
|
|
31655
|
+
{
|
|
31656
|
+
"id": "guide.cpu-transcription",
|
|
31657
|
+
"kind": "guide",
|
|
31658
|
+
"title": "Transcription on CPU-only hosts",
|
|
31659
|
+
"summary": "Telegram speech transcription runs locally, even when chat inference uses a remote provider. With OMNIUSASRDEVICE unset or set to auto, Omnius selects CPU when hardware inventory establishes that CUDA hardware is absent. Missing Torch, a driver failure, or a GPU visibility mask alone does not establish that absence. Explicit CUDA selection remains CUDA.",
|
|
31660
|
+
"keywords": [
|
|
31661
|
+
"cpu",
|
|
31662
|
+
"transcription",
|
|
31663
|
+
"md"
|
|
31664
|
+
],
|
|
31665
|
+
"maturity": "stable",
|
|
31666
|
+
"audiences": [
|
|
31667
|
+
"user",
|
|
31668
|
+
"integrator",
|
|
31669
|
+
"coding-agent"
|
|
31670
|
+
],
|
|
31671
|
+
"layer": "documentation",
|
|
31672
|
+
"interfaces": [
|
|
31673
|
+
{
|
|
31674
|
+
"type": "file",
|
|
31675
|
+
"target": "docs/cpu-transcription.md"
|
|
31676
|
+
}
|
|
31677
|
+
],
|
|
31678
|
+
"references": [
|
|
31679
|
+
{
|
|
31680
|
+
"type": "documentation",
|
|
31681
|
+
"target": "docs/cpu-transcription.md",
|
|
31682
|
+
"relation": "canonical-artifact"
|
|
31683
|
+
}
|
|
31684
|
+
]
|
|
31685
|
+
},
|
|
31655
31686
|
{
|
|
31656
31687
|
"id": "guide.dedup-false-positive-meta-analysis",
|
|
31657
31688
|
"kind": "guide",
|
package/docs/DISCOVERY.md
CHANGED
|
@@ -446,6 +446,7 @@ Daemon equivalents are `GET /v1/discovery/bootstrap`, `GET /v1/discovery?q=<inte
|
|
|
446
446
|
| `guide.context-management-medium-models-proposal` | Context Management for Medium Models (30-40B) — Implementation Proposal | Date: 2026-04-25 Problem: Medium-tier models (~35B params) exhibit excessive repetition at ~35% context fill despite 256K context windows Root Cause: Monolithic context structure + attention degradation + tool schema bloat |
|
|
447
447
|
| `guide.context-recovery-review` | Context Recovery Review | Bundled Omnius documentation artifact: docs/context-recovery-review.json. |
|
|
448
448
|
| `guide.corpus-ocr` | Explicit scanned-PDF corpus OCR | The public sourcecorpus tool can process an acquired PDF population with begin using filters: {channel: "ocrtext"} and optional ocrlanguage (default eng). Repeated process calls resume a durable per-source page cursor. Installed CPU Poppler and Tesseract are required. The default channel remains nativetext; completing native extraction of an empty scanned pa |
|
|
449
|
+
| `guide.cpu-transcription` | Transcription on CPU-only hosts | Telegram speech transcription runs locally, even when chat inference uses a remote provider. With OMNIUSASRDEVICE unset or set to auto, Omnius selects CPU when hardware inventory establishes that CUDA hardware is absent. Missing Torch, a driver failure, or a GPU visibility mask alone does not establish that absence. Explicit CUDA selection remains CUDA. |
|
|
449
450
|
| `guide.dedup-false-positive-meta-analysis` | Meta-Analysis: False Positive Duplicate Tool Call Detection | Date: 2026-05-14 Scope: packages/orchestrator/src/agenticRunner.ts — proactivePrune() + buildResourceKey() |
|
|
450
451
|
| `guide.design-dashboard-reconstruction-plan` | Dashboard reconstruction plan | 2026-10-16 · source implementation only; publishing remains with the user. |
|
|
451
452
|
| `guide.design-dashboard-styleguide` | Omnius browser instrument design system | Version 1 · 2026-10-16 · implementation contract |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Transcription on CPU-only hosts
|
|
2
|
+
|
|
3
|
+
Telegram speech transcription runs locally, even when chat inference uses a
|
|
4
|
+
remote provider. With `OMNIUS_ASR_DEVICE` unset or set to `auto`, Omnius selects
|
|
5
|
+
CPU when hardware inventory establishes that CUDA hardware is absent. Missing
|
|
6
|
+
Torch, a driver failure, or a GPU visibility mask alone does not establish that
|
|
7
|
+
absence. Explicit CUDA selection remains CUDA.
|
|
8
|
+
|
|
9
|
+
Automatic CPU speech transcription uses a separate `.venv-whisper-cpu` runtime with
|
|
10
|
+
CPU-only Torch and preserves the selected Whisper model. It skips the automatic
|
|
11
|
+
transcribe-cli installation used by the CUDA path. Requested speaker diarization
|
|
12
|
+
continues through transcribe-cli rather than being silently discarded. Initial setup downloads the
|
|
13
|
+
runtime dependencies and requested model; later requests reuse them. Existing
|
|
14
|
+
explicit CPU overrides retain the `OMNIUS_ASR_ALLOW_CPU=1` requirement.
|
|
15
|
+
|
|
16
|
+
Transcription is a retryable observation: it does not modify its input or send a
|
|
17
|
+
Telegram message. Derived transcripts remain in host-owned artifact storage.
|
|
18
|
+
An interrupted transcription no longer creates an ambiguous external action.
|
|
19
|
+
When an older retained task resumes, only its authenticated, closed transcription
|
|
20
|
+
tickets can receive this classification repair. The repair supplies no transcript
|
|
21
|
+
or successful result. Unknown writes and uploads still require reconciliation.
|
|
22
|
+
|
|
23
|
+
Validation: 69 execution tests, 75 interruption tests, 7 retained Telegram cases,
|
|
24
|
+
2 actual Telegram tool-registration cases and 46 packaging checks passed. A real CPU-only Torch runtime decoded an English
|
|
25
|
+
speech clip using Whisper `base` in 8.9 seconds, leaving the input unchanged.
|
|
26
|
+
Hardware absence and driver-error distinctions were tested with deterministic
|
|
27
|
+
Linux, Windows and macOS inventories; the live CPU test explicitly selected CPU
|
|
28
|
+
on a host that also has GPUs. The smaller `tiny` model also decoded on CPU but
|
|
29
|
+
missed the stricter word-matching checks on the synthesized clip.
|
package/docs/guides/telegram.md
CHANGED
|
@@ -12,6 +12,17 @@ The Telegram bridge is a scoped public ingress and egress layer. It supports adm
|
|
|
12
12
|
/telegram stop
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
The TUI's right details sidebar includes a **TELEGRAM** dropdown after a bot is
|
|
16
|
+
configured. It shows bridge state, polling, interaction mode and work slots,
|
|
17
|
+
with controls for managing the bot and opening its settings. Click the heading
|
|
18
|
+
or focus it with Tab and press Enter or Space to expand it. On narrow terminals,
|
|
19
|
+
open **DETAILS** first. The dropdown remains available while the bot is stopped
|
|
20
|
+
or polling is disabled.
|
|
21
|
+
|
|
22
|
+
Workspace-owned bots use the daemon's existing controls. Settings that require
|
|
23
|
+
a worker restart are labeled as applying on the next start. A bot owned by
|
|
24
|
+
another terminal remains under that terminal's control.
|
|
25
|
+
|
|
15
26
|
## Workspace Services
|
|
16
27
|
|
|
17
28
|
The Omnius daemon supervises Telegram agents for registered workspaces, so a terminal does not need to stay open. A workspace must have its own saved `telegramKey`; global bot tokens are never copied across projects. Existing Telegram enablement, endpoint, credentials, and GPU selections still apply.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.933",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.933",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED