omnius 1.0.629 → 1.0.633
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/README.md +3 -0
- package/dist/index.js +4785 -4352
- package/dist/postinstall-daemon.cjs +82 -6
- package/dist/scripts/audio-yamnet-tensorrt-worker.py +18 -1
- package/dist/scripts/ocr-advanced.py +22 -12
- package/dist/update-worker.js +168 -189
- package/docs/DISCOVERY.json +957 -1279
- package/docs/DISCOVERY.md +129 -127
- package/docs/reference/rest-api.md +2 -0
- package/docs/rest/INDEX.md +1 -1
- package/docs/rest/endpoints/voice-vision.md +30 -7
- package/npm-shrinkwrap.json +8 -8
- package/package.json +2 -2
package/dist/update-worker.js
CHANGED
|
@@ -69,39 +69,11 @@ var init_venv_paths = __esm({
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
// packages/execution/dist/tools/model-store.js
|
|
72
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync, statSync, statfsSync, readdirSync, rmSync, rmdirSync, renameSync, cpSync } from "node:fs";
|
|
73
72
|
import { homedir, platform } from "node:os";
|
|
74
|
-
|
|
75
|
-
function omniusHomeDir() {
|
|
76
|
-
const override = process.env["OMNIUS_HOME"]?.trim();
|
|
77
|
-
if (override)
|
|
78
|
-
return override;
|
|
79
|
-
return join(homedir(), ".omnius");
|
|
80
|
-
}
|
|
81
|
-
function mediaStoreRoot() {
|
|
82
|
-
const env = process.env["OMNIUS_MEDIA_HOME"]?.trim();
|
|
83
|
-
if (env)
|
|
84
|
-
return env;
|
|
85
|
-
try {
|
|
86
|
-
const pointer = join(omniusHomeDir(), MEDIA_ROOT_POINTER);
|
|
87
|
-
if (existsSync(pointer)) {
|
|
88
|
-
const parsed = JSON.parse(readFileSync(pointer, "utf8"));
|
|
89
|
-
if (typeof parsed?.root === "string" && parsed.root.trim()) {
|
|
90
|
-
return parsed.root.trim();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
} catch {
|
|
94
|
-
}
|
|
95
|
-
return omniusHomeDir();
|
|
96
|
-
}
|
|
97
|
-
function unifiedRuntimeDir(kind, backend) {
|
|
98
|
-
return join(mediaStoreRoot(), "runtimes", kind, `.venv-${backend}`);
|
|
99
|
-
}
|
|
100
|
-
var MEDIA_ROOT_POINTER, platformId;
|
|
73
|
+
var platformId;
|
|
101
74
|
var init_model_store = __esm({
|
|
102
75
|
"packages/execution/dist/tools/model-store.js"() {
|
|
103
76
|
"use strict";
|
|
104
|
-
MEDIA_ROOT_POINTER = "media-store.json";
|
|
105
77
|
platformId = platform();
|
|
106
78
|
}
|
|
107
79
|
});
|
|
@@ -148,9 +120,9 @@ var init_process_kill = __esm({
|
|
|
148
120
|
|
|
149
121
|
// packages/execution/dist/process-lifecycle.js
|
|
150
122
|
import { randomUUID, createHash } from "node:crypto";
|
|
151
|
-
import { appendFileSync, existsSync
|
|
123
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, readlinkSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
152
124
|
import { homedir as homedir2 } from "node:os";
|
|
153
|
-
import { dirname, isAbsolute, join
|
|
125
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
154
126
|
function nowFrom(system) {
|
|
155
127
|
return system?.now?.() ?? Date.now();
|
|
156
128
|
}
|
|
@@ -158,18 +130,18 @@ function realSleep(ms) {
|
|
|
158
130
|
return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
|
|
159
131
|
}
|
|
160
132
|
function registryDir(options) {
|
|
161
|
-
return options?.storeDir || process.env["OMNIUS_PROCESS_REGISTRY_DIR"] ||
|
|
133
|
+
return options?.storeDir || process.env["OMNIUS_PROCESS_REGISTRY_DIR"] || join(process.env["OMNIUS_HOME"] || join(homedir2(), ".omnius"), "processes");
|
|
162
134
|
}
|
|
163
135
|
function ensureStoreDir(options) {
|
|
164
136
|
const dir = registryDir(options);
|
|
165
|
-
|
|
137
|
+
mkdirSync(dir, { recursive: true });
|
|
166
138
|
return dir;
|
|
167
139
|
}
|
|
168
140
|
function activeFilePath(options) {
|
|
169
|
-
return
|
|
141
|
+
return join(ensureStoreDir(options), ACTIVE_FILE);
|
|
170
142
|
}
|
|
171
143
|
function jsonlFilePath(options) {
|
|
172
|
-
return
|
|
144
|
+
return join(ensureStoreDir(options), JSONL_FILE);
|
|
173
145
|
}
|
|
174
146
|
function safeParseJson(text) {
|
|
175
147
|
try {
|
|
@@ -180,8 +152,8 @@ function safeParseJson(text) {
|
|
|
180
152
|
}
|
|
181
153
|
function readActiveStore(options) {
|
|
182
154
|
const activePath = activeFilePath(options);
|
|
183
|
-
if (
|
|
184
|
-
const parsed = safeParseJson(
|
|
155
|
+
if (existsSync(activePath)) {
|
|
156
|
+
const parsed = safeParseJson(readFileSync(activePath, "utf8"));
|
|
185
157
|
if (parsed?.version === 1 && Array.isArray(parsed.leases))
|
|
186
158
|
return parsed;
|
|
187
159
|
}
|
|
@@ -190,8 +162,8 @@ function readActiveStore(options) {
|
|
|
190
162
|
function rebuildActiveStoreFromLog(options) {
|
|
191
163
|
const logPath = jsonlFilePath(options);
|
|
192
164
|
const byId = /* @__PURE__ */ new Map();
|
|
193
|
-
if (
|
|
194
|
-
const text =
|
|
165
|
+
if (existsSync(logPath)) {
|
|
166
|
+
const text = readFileSync(logPath, "utf8");
|
|
195
167
|
for (const line of text.split("\n")) {
|
|
196
168
|
const trimmed = line.trim();
|
|
197
169
|
if (!trimmed)
|
|
@@ -212,10 +184,10 @@ function rebuildActiveStoreFromLog(options) {
|
|
|
212
184
|
}
|
|
213
185
|
function writeActiveStore(store, options) {
|
|
214
186
|
const target = activeFilePath(options);
|
|
215
|
-
|
|
187
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
216
188
|
const tmp = `${target}.${process.pid}.${randomUUID()}.tmp`;
|
|
217
|
-
|
|
218
|
-
|
|
189
|
+
writeFileSync(tmp, JSON.stringify(store, null, 2));
|
|
190
|
+
renameSync(tmp, target);
|
|
219
191
|
}
|
|
220
192
|
function appendLeaseEvent(type, lease, options) {
|
|
221
193
|
const event = { type, at: nowFrom(options?.system), lease };
|
|
@@ -486,13 +458,13 @@ function inspectRealProcess(pid) {
|
|
|
486
458
|
const now = Date.now();
|
|
487
459
|
const procDir = `/proc/${pid}`;
|
|
488
460
|
const identity = { pid, collectedAt: now };
|
|
489
|
-
if (process.platform !== "win32" &&
|
|
461
|
+
if (process.platform !== "win32" && existsSync(procDir)) {
|
|
490
462
|
try {
|
|
491
|
-
identity.cwd = readlinkSync(
|
|
463
|
+
identity.cwd = readlinkSync(join(procDir, "cwd"));
|
|
492
464
|
} catch {
|
|
493
465
|
}
|
|
494
466
|
try {
|
|
495
|
-
const cmdline =
|
|
467
|
+
const cmdline = readFileSync(join(procDir, "cmdline"));
|
|
496
468
|
const command = cmdline.toString("utf8").split("\0").filter(Boolean).join(" ");
|
|
497
469
|
if (command) {
|
|
498
470
|
identity.command = command;
|
|
@@ -501,14 +473,14 @@ function inspectRealProcess(pid) {
|
|
|
501
473
|
} catch {
|
|
502
474
|
}
|
|
503
475
|
try {
|
|
504
|
-
const environ =
|
|
476
|
+
const environ = readFileSync(join(procDir, "environ")).toString("utf8");
|
|
505
477
|
const envLeaseId = environ.split("\0").find((entry) => entry.startsWith("OMNIUS_PROCESS_LEASE_ID="))?.slice("OMNIUS_PROCESS_LEASE_ID=".length);
|
|
506
478
|
if (envLeaseId)
|
|
507
479
|
identity.envLeaseId = envLeaseId;
|
|
508
480
|
} catch {
|
|
509
481
|
}
|
|
510
482
|
try {
|
|
511
|
-
const stat =
|
|
483
|
+
const stat = readFileSync(join(procDir, "stat"), "utf8");
|
|
512
484
|
const afterComm = stat.slice(stat.lastIndexOf(")") + 2).trim().split(/\s+/);
|
|
513
485
|
const ppid = Number(afterComm[1]);
|
|
514
486
|
const pgid = Number(afterComm[2]);
|
|
@@ -1227,7 +1199,7 @@ var require_util = __commonJS({
|
|
|
1227
1199
|
return path;
|
|
1228
1200
|
}
|
|
1229
1201
|
exports.normalize = normalize;
|
|
1230
|
-
function
|
|
1202
|
+
function join18(aRoot, aPath) {
|
|
1231
1203
|
if (aRoot === "") {
|
|
1232
1204
|
aRoot = ".";
|
|
1233
1205
|
}
|
|
@@ -1259,7 +1231,7 @@ var require_util = __commonJS({
|
|
|
1259
1231
|
}
|
|
1260
1232
|
return joined;
|
|
1261
1233
|
}
|
|
1262
|
-
exports.join =
|
|
1234
|
+
exports.join = join18;
|
|
1263
1235
|
exports.isAbsolute = function(aPath) {
|
|
1264
1236
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
1265
1237
|
};
|
|
@@ -1432,7 +1404,7 @@ var require_util = __commonJS({
|
|
|
1432
1404
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
1433
1405
|
}
|
|
1434
1406
|
}
|
|
1435
|
-
sourceURL =
|
|
1407
|
+
sourceURL = join18(urlGenerate(parsed), sourceURL);
|
|
1436
1408
|
}
|
|
1437
1409
|
return normalize(sourceURL);
|
|
1438
1410
|
}
|
|
@@ -11960,7 +11932,7 @@ ${lanes.join("\n")}
|
|
|
11960
11932
|
return process.memoryUsage().heapUsed;
|
|
11961
11933
|
},
|
|
11962
11934
|
getFileSize(path) {
|
|
11963
|
-
const stat =
|
|
11935
|
+
const stat = statSync4(path);
|
|
11964
11936
|
if (stat == null ? void 0 : stat.isFile()) {
|
|
11965
11937
|
return stat.size;
|
|
11966
11938
|
}
|
|
@@ -12004,7 +11976,7 @@ ${lanes.join("\n")}
|
|
|
12004
11976
|
}
|
|
12005
11977
|
};
|
|
12006
11978
|
return nodeSystem;
|
|
12007
|
-
function
|
|
11979
|
+
function statSync4(path) {
|
|
12008
11980
|
try {
|
|
12009
11981
|
return _fs.statSync(path, statSyncOptions);
|
|
12010
11982
|
} catch {
|
|
@@ -12063,7 +12035,7 @@ ${lanes.join("\n")}
|
|
|
12063
12035
|
activeSession.post("Profiler.stop", (err, { profile }) => {
|
|
12064
12036
|
var _a2;
|
|
12065
12037
|
if (!err) {
|
|
12066
|
-
if ((_a2 =
|
|
12038
|
+
if ((_a2 = statSync4(profilePath)) == null ? void 0 : _a2.isDirectory()) {
|
|
12067
12039
|
profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
|
|
12068
12040
|
}
|
|
12069
12041
|
try {
|
|
@@ -12183,7 +12155,7 @@ ${lanes.join("\n")}
|
|
|
12183
12155
|
let stat;
|
|
12184
12156
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
12185
12157
|
const name = combinePaths(path, entry);
|
|
12186
|
-
stat =
|
|
12158
|
+
stat = statSync4(name);
|
|
12187
12159
|
if (!stat) {
|
|
12188
12160
|
continue;
|
|
12189
12161
|
}
|
|
@@ -12207,7 +12179,7 @@ ${lanes.join("\n")}
|
|
|
12207
12179
|
return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
|
12208
12180
|
}
|
|
12209
12181
|
function fileSystemEntryExists(path, entryKind) {
|
|
12210
|
-
const stat =
|
|
12182
|
+
const stat = statSync4(path);
|
|
12211
12183
|
if (!stat) {
|
|
12212
12184
|
return false;
|
|
12213
12185
|
}
|
|
@@ -12249,7 +12221,7 @@ ${lanes.join("\n")}
|
|
|
12249
12221
|
}
|
|
12250
12222
|
function getModifiedTime3(path) {
|
|
12251
12223
|
var _a2;
|
|
12252
|
-
return (_a2 =
|
|
12224
|
+
return (_a2 = statSync4(path)) == null ? void 0 : _a2.mtime;
|
|
12253
12225
|
}
|
|
12254
12226
|
function setModifiedTime(path, time) {
|
|
12255
12227
|
try {
|
|
@@ -51413,11 +51385,11 @@ ${lanes.join("\n")}
|
|
|
51413
51385
|
if (i < rootLength) {
|
|
51414
51386
|
return void 0;
|
|
51415
51387
|
}
|
|
51416
|
-
const
|
|
51417
|
-
if (
|
|
51388
|
+
const sep = directory.lastIndexOf(directorySeparator, i - 1);
|
|
51389
|
+
if (sep === -1) {
|
|
51418
51390
|
return void 0;
|
|
51419
51391
|
}
|
|
51420
|
-
return directory.substr(0, Math.max(
|
|
51392
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
51421
51393
|
}
|
|
51422
51394
|
}
|
|
51423
51395
|
}
|
|
@@ -216785,7 +216757,7 @@ var require_path_browserify = __commonJS({
|
|
|
216785
216757
|
}
|
|
216786
216758
|
return res;
|
|
216787
216759
|
}
|
|
216788
|
-
function _format(
|
|
216760
|
+
function _format(sep, pathObject) {
|
|
216789
216761
|
var dir = pathObject.dir || pathObject.root;
|
|
216790
216762
|
var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
216791
216763
|
if (!dir) {
|
|
@@ -216794,7 +216766,7 @@ var require_path_browserify = __commonJS({
|
|
|
216794
216766
|
if (dir === pathObject.root) {
|
|
216795
216767
|
return dir + base;
|
|
216796
216768
|
}
|
|
216797
|
-
return dir +
|
|
216769
|
+
return dir + sep + base;
|
|
216798
216770
|
}
|
|
216799
216771
|
var posix = {
|
|
216800
216772
|
// path.resolve([from ...], to)
|
|
@@ -216845,7 +216817,7 @@ var require_path_browserify = __commonJS({
|
|
|
216845
216817
|
assertPath(path);
|
|
216846
216818
|
return path.length > 0 && path.charCodeAt(0) === 47;
|
|
216847
216819
|
},
|
|
216848
|
-
join: function
|
|
216820
|
+
join: function join18() {
|
|
216849
216821
|
if (arguments.length === 0)
|
|
216850
216822
|
return ".";
|
|
216851
216823
|
var joined;
|
|
@@ -245051,7 +245023,7 @@ var init_jibberlink = __esm({
|
|
|
245051
245023
|
});
|
|
245052
245024
|
|
|
245053
245025
|
// packages/execution/dist/tools/nexus.js
|
|
245054
|
-
import { existsSync as
|
|
245026
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, watch as fsWatchLocal } from "node:fs";
|
|
245055
245027
|
function readBundledDependencySpec(packageName, fallback) {
|
|
245056
245028
|
const candidates = [
|
|
245057
245029
|
new URL("../package.json", import.meta.url),
|
|
@@ -245060,7 +245032,7 @@ function readBundledDependencySpec(packageName, fallback) {
|
|
|
245060
245032
|
];
|
|
245061
245033
|
for (const candidate of candidates) {
|
|
245062
245034
|
try {
|
|
245063
|
-
const pkg = JSON.parse(
|
|
245035
|
+
const pkg = JSON.parse(readFileSync3(candidate, "utf8"));
|
|
245064
245036
|
const spec = pkg?.dependencies?.[packageName] ?? pkg?.optionalDependencies?.[packageName];
|
|
245065
245037
|
if (typeof spec === "string" && spec.trim())
|
|
245066
245038
|
return spec.trim();
|
|
@@ -245082,12 +245054,12 @@ var init_nexus = __esm({
|
|
|
245082
245054
|
|
|
245083
245055
|
// packages/cli/src/update-worker.ts
|
|
245084
245056
|
import { spawn as spawn4 } from "node:child_process";
|
|
245085
|
-
import { join as
|
|
245057
|
+
import { join as join17 } from "node:path";
|
|
245086
245058
|
|
|
245087
245059
|
// packages/cli/src/daemon.ts
|
|
245088
245060
|
import { spawn } from "node:child_process";
|
|
245089
|
-
import { existsSync as
|
|
245090
|
-
import { join as
|
|
245061
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, mkdirSync as mkdirSync3, unlinkSync, openSync, closeSync, writeSync, statSync as statSync2, renameSync as renameSync2 } from "node:fs";
|
|
245062
|
+
import { join as join13 } from "node:path";
|
|
245091
245063
|
import { homedir as homedir13 } from "node:os";
|
|
245092
245064
|
import { createServer as createNetServer } from "node:net";
|
|
245093
245065
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -245107,11 +245079,21 @@ init_venv_paths();
|
|
|
245107
245079
|
// packages/execution/dist/audio-classifier-runtime.js
|
|
245108
245080
|
init_jetson_monitor();
|
|
245109
245081
|
init_model_store();
|
|
245082
|
+
init_venv_paths();
|
|
245110
245083
|
var MODEL_REVISION = "ac2ca3bd45d12ec1f19f1144205ea529b4e9dedf";
|
|
245111
245084
|
var MODEL_URL = `https://huggingface.co/zeropointnine/yamnet-onnx/resolve/${MODEL_REVISION}/yamnet.onnx`;
|
|
245112
245085
|
var CLASS_MAP_URL = `https://huggingface.co/zeropointnine/yamnet-onnx/resolve/${MODEL_REVISION}/yamnet_class_map.csv`;
|
|
245113
245086
|
var SETUP_TIMEOUT_MS = 20 * 6e4;
|
|
245114
245087
|
|
|
245088
|
+
// packages/execution/dist/ocr-advanced-runtime.js
|
|
245089
|
+
init_process_async();
|
|
245090
|
+
init_jetson_monitor();
|
|
245091
|
+
init_venv_paths();
|
|
245092
|
+
init_model_store();
|
|
245093
|
+
var OCR_JETSON_NATIVE_PROVIDERS = Object.freeze({
|
|
245094
|
+
"python3-opencv": ["python3-opencv", "libopencv-python"]
|
|
245095
|
+
});
|
|
245096
|
+
|
|
245115
245097
|
// packages/execution/dist/broker-mediated-backend.js
|
|
245116
245098
|
init_model_broker();
|
|
245117
245099
|
|
|
@@ -290329,22 +290311,22 @@ for (const resource of OSINT_CATALOG_RESOURCES) {
|
|
|
290329
290311
|
|
|
290330
290312
|
// packages/execution/dist/tools/carbonyl-browser.js
|
|
290331
290313
|
import { homedir as homedir4 } from "node:os";
|
|
290332
|
-
import { join as
|
|
290314
|
+
import { join as join3 } from "node:path";
|
|
290333
290315
|
init_venv_paths();
|
|
290334
290316
|
init_process_lifecycle();
|
|
290335
290317
|
|
|
290336
290318
|
// packages/execution/dist/tools/playwright-browser.js
|
|
290337
|
-
import { dirname as dirname2, join as
|
|
290319
|
+
import { dirname as dirname2, join as join2, resolve as resolve3 } from "node:path";
|
|
290338
290320
|
import { homedir as homedir3, tmpdir } from "node:os";
|
|
290339
290321
|
init_vision();
|
|
290340
290322
|
var dynamicImport = new Function("mod", "return import(mod)");
|
|
290341
|
-
var PLAYWRIGHT_RUNTIME_DIR =
|
|
290342
|
-
var PLAYWRIGHT_BROWSERS_DIR =
|
|
290323
|
+
var PLAYWRIGHT_RUNTIME_DIR = join2(homedir3(), ".omnius", "playwright-runtime");
|
|
290324
|
+
var PLAYWRIGHT_BROWSERS_DIR = join2(PLAYWRIGHT_RUNTIME_DIR, "browsers");
|
|
290343
290325
|
|
|
290344
290326
|
// packages/execution/dist/tools/carbonyl-browser.js
|
|
290345
290327
|
init_process_async();
|
|
290346
|
-
var CARBONYL_VENV =
|
|
290347
|
-
var CARBONYL_RUNTIME_MARKER =
|
|
290328
|
+
var CARBONYL_VENV = join3(homedir4(), ".omnius", "venv");
|
|
290329
|
+
var CARBONYL_RUNTIME_MARKER = join3(CARBONYL_VENV, ".omnius-carbonyl-runtime-installed");
|
|
290348
290330
|
var INSTALL_TIMEOUT_MS = 10 * 6e4;
|
|
290349
290331
|
var CARBONYL_DRIVER_PY = String.raw`
|
|
290350
290332
|
import json, sys, traceback
|
|
@@ -291306,7 +291288,7 @@ init_hf_media_models();
|
|
|
291306
291288
|
|
|
291307
291289
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
291308
291290
|
init_model_broker();
|
|
291309
|
-
import { join as
|
|
291291
|
+
import { join as join4, basename, dirname as dirname3, extname, resolve as resolve4 } from "node:path";
|
|
291310
291292
|
import { homedir as homedir5, tmpdir as tmpdir2 } from "node:os";
|
|
291311
291293
|
init_cuda_device_filter();
|
|
291312
291294
|
init_process_async();
|
|
@@ -291317,9 +291299,9 @@ init_process_async();
|
|
|
291317
291299
|
|
|
291318
291300
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
291319
291301
|
var MAX_TRANSCRIBE_URL_BYTES = 100 * 1024 * 1024;
|
|
291320
|
-
var MANAGED_ASR_VENV =
|
|
291321
|
-
var MANAGED_TRANSCRIBE_CLI_DIR =
|
|
291322
|
-
var YT_DLP_VENV =
|
|
291302
|
+
var MANAGED_ASR_VENV = join4(homedir5(), ".omnius", "runtimes", "asr", ".venv-whisper");
|
|
291303
|
+
var MANAGED_TRANSCRIBE_CLI_DIR = join4(homedir5(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
291304
|
+
var YT_DLP_VENV = join4(homedir5(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
291323
291305
|
|
|
291324
291306
|
// packages/execution/dist/tools/safe-math-eval.js
|
|
291325
291307
|
var CONSTANTS = {
|
|
@@ -293062,19 +293044,13 @@ init_process_async();
|
|
|
293062
293044
|
var MAX_IMAGE_BYTES = 8 * 1024 * 1024;
|
|
293063
293045
|
|
|
293064
293046
|
// packages/execution/dist/tools/ocr-image-advanced.js
|
|
293065
|
-
init_system_deps();
|
|
293066
|
-
init_venv_paths();
|
|
293067
293047
|
init_process_async();
|
|
293068
|
-
init_jetson_monitor();
|
|
293069
|
-
init_model_store();
|
|
293070
|
-
var OCR_VENV_DIR = unifiedRuntimeDir("vision", "ocr-advanced");
|
|
293071
|
-
var OCR_SETUP_TIMEOUT_MS = 5 * 6e4;
|
|
293072
293048
|
var OCR_PIPELINE_TIMEOUT_MS = 5 * 6e4;
|
|
293073
293049
|
|
|
293074
293050
|
// packages/execution/dist/tools/browser-action.js
|
|
293075
293051
|
init_process_lifecycle();
|
|
293076
|
-
import { copyFileSync, existsSync as
|
|
293077
|
-
import { basename as basename2, dirname as dirname4, join as
|
|
293052
|
+
import { copyFileSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
293053
|
+
import { basename as basename2, dirname as dirname4, join as join5, resolve as resolve5 } from "node:path";
|
|
293078
293054
|
import { fileURLToPath } from "node:url";
|
|
293079
293055
|
init_model_store();
|
|
293080
293056
|
var __dirname2 = dirname4(fileURLToPath(import.meta.url));
|
|
@@ -293082,15 +293058,15 @@ var DEFAULT_PORT = 8130;
|
|
|
293082
293058
|
function findScrapeScript() {
|
|
293083
293059
|
const candidates = [
|
|
293084
293060
|
// Published npm package: dist/scripts/web_scrape.py
|
|
293085
|
-
|
|
293061
|
+
join5(__dirname2, "scripts", "web_scrape.py"),
|
|
293086
293062
|
// Published npm package (from node_modules): node_modules/omnius/dist/scripts/
|
|
293087
|
-
|
|
293063
|
+
join5(__dirname2, "..", "node_modules", "omnius", "dist", "scripts", "web_scrape.py"),
|
|
293088
293064
|
// Dev monorepo: packages/execution/src/tools/../../scripts/
|
|
293089
|
-
|
|
293065
|
+
join5(__dirname2, "..", "..", "scripts", "web_scrape.py"),
|
|
293090
293066
|
// Dev monorepo alt: packages/execution/scripts/
|
|
293091
|
-
|
|
293067
|
+
join5(__dirname2, "..", "scripts", "web_scrape.py")
|
|
293092
293068
|
];
|
|
293093
|
-
return candidates.find((p) =>
|
|
293069
|
+
return candidates.find((p) => existsSync2(p)) || candidates[0];
|
|
293094
293070
|
}
|
|
293095
293071
|
var SCRAPE_SCRIPT = findScrapeScript();
|
|
293096
293072
|
var BASE_URL = `http://localhost:${DEFAULT_PORT}`;
|
|
@@ -293372,33 +293348,34 @@ var MESH_VENV = "/tmp/mesh-venv";
|
|
|
293372
293348
|
var MESH_CLI = `${MESH_VENV}/bin/meshtastic`;
|
|
293373
293349
|
|
|
293374
293350
|
// packages/execution/dist/tools/audio-analyze.js
|
|
293375
|
-
import { basename as basename3, isAbsolute as isAbsolute2, join as
|
|
293351
|
+
import { basename as basename3, isAbsolute as isAbsolute2, join as join6, resolve as resolve6 } from "node:path";
|
|
293376
293352
|
import { homedir as homedir6, tmpdir as tmpdir3 } from "node:os";
|
|
293377
293353
|
init_cuda_device_filter();
|
|
293378
293354
|
init_process_async();
|
|
293379
|
-
var VENV_DIR =
|
|
293380
|
-
var VENV_PIP =
|
|
293381
|
-
var VENV_PYTHON =
|
|
293355
|
+
var VENV_DIR = join6(homedir6(), ".omnius", "audio-ml-venv");
|
|
293356
|
+
var VENV_PIP = join6(VENV_DIR, "bin", "pip");
|
|
293357
|
+
var VENV_PYTHON = join6(VENV_DIR, "bin", "python3");
|
|
293382
293358
|
|
|
293383
293359
|
// packages/execution/dist/tools/visual-memory.js
|
|
293384
293360
|
init_cuda_device_filter();
|
|
293385
|
-
import { join as
|
|
293361
|
+
import { join as join7 } from "node:path";
|
|
293386
293362
|
import { homedir as homedir7, tmpdir as tmpdir4 } from "node:os";
|
|
293387
|
-
var VMEM_DIR =
|
|
293388
|
-
var VENV_DIR2 =
|
|
293389
|
-
var VENV_PY =
|
|
293390
|
-
var VENV_PIP2 =
|
|
293363
|
+
var VMEM_DIR = join7(homedir7(), ".omnius", "visual-memory");
|
|
293364
|
+
var VENV_DIR2 = join7(homedir7(), ".omnius", "vision-ml-venv");
|
|
293365
|
+
var VENV_PY = join7(VENV_DIR2, "bin", "python3");
|
|
293366
|
+
var VENV_PIP2 = join7(VENV_DIR2, "bin", "pip");
|
|
293391
293367
|
|
|
293392
293368
|
// packages/execution/dist/tools/multimodal-memory.js
|
|
293393
|
-
import { join as
|
|
293369
|
+
import { join as join8 } from "node:path";
|
|
293394
293370
|
import { homedir as homedir8, tmpdir as tmpdir5 } from "node:os";
|
|
293395
293371
|
init_camera_capture();
|
|
293396
|
-
var MM_DIR =
|
|
293397
|
-
var MM_INDEX =
|
|
293372
|
+
var MM_DIR = join8(homedir8(), ".omnius", "multimodal-episodes");
|
|
293373
|
+
var MM_INDEX = join8(MM_DIR, "index.json");
|
|
293398
293374
|
|
|
293399
293375
|
// packages/execution/dist/asr/registry.js
|
|
293400
293376
|
var VIBEVOICE_ASR_MODEL_REVISION = "d0c9efdb8d614685062c04425d91e01b6f37d944";
|
|
293401
293377
|
var VIBEVOICE_ASR_WEIGHTS_BYTES = 17348198410;
|
|
293378
|
+
var NEMOTRON_DISABLED_REASON = "Nemotron is catalogued but its legacy self-installing worker is disabled until it is migrated to the managed fail-closed runtime.";
|
|
293402
293379
|
var whisperCapabilities = Object.freeze({
|
|
293403
293380
|
file: true,
|
|
293404
293381
|
pcmStream: true,
|
|
@@ -293447,6 +293424,8 @@ var ASR_ENGINES = Object.freeze([
|
|
|
293447
293424
|
provider: "NVIDIA",
|
|
293448
293425
|
runtime: "python",
|
|
293449
293426
|
setupMode: "managed",
|
|
293427
|
+
availability: "disabled",
|
|
293428
|
+
unavailableReason: NEMOTRON_DISABLED_REASON,
|
|
293450
293429
|
models: [
|
|
293451
293430
|
{
|
|
293452
293431
|
id: "nemotron-speech-streaming-en-0.6b",
|
|
@@ -293658,32 +293637,32 @@ init_secret_quarantine();
|
|
|
293658
293637
|
init_agent_tools();
|
|
293659
293638
|
|
|
293660
293639
|
// packages/execution/dist/tools/video-understand.js
|
|
293661
|
-
import { join as
|
|
293640
|
+
import { join as join9, basename as basename4, isAbsolute as isAbsolute3, resolve as resolve7 } from "node:path";
|
|
293662
293641
|
import { homedir as homedir9 } from "node:os";
|
|
293663
293642
|
init_model_broker();
|
|
293664
293643
|
init_vision();
|
|
293665
293644
|
init_process_async();
|
|
293666
293645
|
init_venv_paths();
|
|
293667
|
-
var YT_DLP_VENV2 =
|
|
293646
|
+
var YT_DLP_VENV2 = join9(homedir9(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
293668
293647
|
|
|
293669
293648
|
// packages/execution/dist/tools/video-scan.js
|
|
293670
|
-
import { resolve as resolve8, dirname as dirname5, join as
|
|
293649
|
+
import { resolve as resolve8, dirname as dirname5, join as join10, basename as basename5 } from "node:path";
|
|
293671
293650
|
import { homedir as homedir10 } from "node:os";
|
|
293672
|
-
var CONFIG_PATH =
|
|
293651
|
+
var CONFIG_PATH = join10(homedir10(), ".omnius", "video-scan.json");
|
|
293673
293652
|
|
|
293674
293653
|
// packages/execution/dist/tools/live-media-loop.js
|
|
293675
293654
|
init_process_async();
|
|
293676
293655
|
init_venv_paths();
|
|
293677
293656
|
import { homedir as homedir11, tmpdir as tmpdir6 } from "node:os";
|
|
293678
|
-
import { basename as basename6, isAbsolute as isAbsolute4, join as
|
|
293657
|
+
import { basename as basename6, isAbsolute as isAbsolute4, join as join11, resolve as resolve9 } from "node:path";
|
|
293679
293658
|
init_camera_capture();
|
|
293680
|
-
var LIVE_MEDIA_ROOT =
|
|
293681
|
-
var YOLO26_VENV =
|
|
293659
|
+
var LIVE_MEDIA_ROOT = join11(homedir11(), ".omnius", "runtimes", "live-media");
|
|
293660
|
+
var YOLO26_VENV = join11(LIVE_MEDIA_ROOT, ".venv-yolo26");
|
|
293682
293661
|
|
|
293683
293662
|
// packages/execution/dist/tools/lance.js
|
|
293684
|
-
import { resolve as resolve10, dirname as dirname6, join as
|
|
293663
|
+
import { resolve as resolve10, dirname as dirname6, join as join12, basename as basename7 } from "node:path";
|
|
293685
293664
|
import { homedir as homedir12 } from "node:os";
|
|
293686
|
-
var CONFIG_PATH2 =
|
|
293665
|
+
var CONFIG_PATH2 = join12(homedir12(), ".omnius", "lance.json");
|
|
293687
293666
|
var RUN_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
293688
293667
|
|
|
293689
293668
|
// packages/execution/dist/index.js
|
|
@@ -293693,8 +293672,8 @@ init_system_deps();
|
|
|
293693
293672
|
init_process_kill();
|
|
293694
293673
|
|
|
293695
293674
|
// packages/cli/src/daemon.ts
|
|
293696
|
-
var OMNIUS_DIR = process.env["OMNIUS_HOME"]?.trim() ||
|
|
293697
|
-
var PID_FILE =
|
|
293675
|
+
var OMNIUS_DIR = process.env["OMNIUS_HOME"]?.trim() || join13(homedir13(), ".omnius");
|
|
293676
|
+
var PID_FILE = join13(OMNIUS_DIR, "daemon.pid");
|
|
293698
293677
|
var DEFAULT_PORT2 = 11435;
|
|
293699
293678
|
var LOCK_INITIALIZATION_GRACE_MS = 5e3;
|
|
293700
293679
|
var DAEMON_GRACEFUL_STOP_ATTEMPTS = 20;
|
|
@@ -293711,7 +293690,7 @@ function daemonEndpoint(port) {
|
|
|
293711
293690
|
return `127.0.0.1:${port}`;
|
|
293712
293691
|
}
|
|
293713
293692
|
function daemonLockFile(port) {
|
|
293714
|
-
return
|
|
293693
|
+
return join13(OMNIUS_DIR, `daemon-${port}.lock`);
|
|
293715
293694
|
}
|
|
293716
293695
|
function processIsAlive(pid) {
|
|
293717
293696
|
try {
|
|
@@ -293723,7 +293702,7 @@ function processIsAlive(pid) {
|
|
|
293723
293702
|
}
|
|
293724
293703
|
function readDaemonLock(lockFile) {
|
|
293725
293704
|
try {
|
|
293726
|
-
const value = JSON.parse(
|
|
293705
|
+
const value = JSON.parse(readFileSync4(lockFile, "utf8"));
|
|
293727
293706
|
if (typeof value.endpoint !== "string" || typeof value.pid !== "number" || !Number.isInteger(value.pid) || value.pid <= 0 || typeof value.token !== "string" || typeof value.startedAt !== "number") {
|
|
293728
293707
|
return null;
|
|
293729
293708
|
}
|
|
@@ -293734,7 +293713,7 @@ function readDaemonLock(lockFile) {
|
|
|
293734
293713
|
}
|
|
293735
293714
|
function daemonLockIsInitializing(lockFile) {
|
|
293736
293715
|
try {
|
|
293737
|
-
return Date.now() -
|
|
293716
|
+
return Date.now() - statSync2(lockFile).mtimeMs < LOCK_INITIALIZATION_GRACE_MS;
|
|
293738
293717
|
} catch {
|
|
293739
293718
|
return false;
|
|
293740
293719
|
}
|
|
@@ -293743,7 +293722,7 @@ function newDaemonLockToken() {
|
|
|
293743
293722
|
return `${process.pid}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
293744
293723
|
}
|
|
293745
293724
|
function claimDaemonEndpoint(port = getDaemonPort(), inheritedToken) {
|
|
293746
|
-
|
|
293725
|
+
mkdirSync3(OMNIUS_DIR, { recursive: true });
|
|
293747
293726
|
const endpoint = daemonEndpoint(port);
|
|
293748
293727
|
const lockFile = daemonLockFile(port);
|
|
293749
293728
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -293777,7 +293756,7 @@ function claimDaemonEndpoint(port = getDaemonPort(), inheritedToken) {
|
|
|
293777
293756
|
const existing = readDaemonLock(lockFile);
|
|
293778
293757
|
if (existing?.endpoint === endpoint && inheritedToken && existing.token === inheritedToken) {
|
|
293779
293758
|
const transferred = { ...existing, pid: process.pid, startedAt: Date.now() };
|
|
293780
|
-
|
|
293759
|
+
writeFileSync2(lockFile, JSON.stringify(transferred), { encoding: "utf8", mode: 384 });
|
|
293781
293760
|
return { endpoint, lockFile, pid: process.pid, port, token: inheritedToken };
|
|
293782
293761
|
}
|
|
293783
293762
|
if (existing && processIsAlive(existing.pid) || !existing && daemonLockIsInitializing(lockFile)) {
|
|
@@ -293907,7 +293886,7 @@ function pidIsInManagedDaemonUnit(pid, readCgroup = defaultReadProcCgroup) {
|
|
|
293907
293886
|
}
|
|
293908
293887
|
function defaultReadProcCgroup(pid) {
|
|
293909
293888
|
try {
|
|
293910
|
-
return
|
|
293889
|
+
return readFileSync4(`/proc/${pid}/cgroup`, "utf8");
|
|
293911
293890
|
} catch {
|
|
293912
293891
|
return null;
|
|
293913
293892
|
}
|
|
@@ -293930,12 +293909,12 @@ async function repairManagedDaemonUnit(port, preferredEntrypoint) {
|
|
|
293930
293909
|
const command = await resolveDaemonCommand(process.execPath, preferredEntrypoint);
|
|
293931
293910
|
if (!command) return false;
|
|
293932
293911
|
try {
|
|
293933
|
-
const configHome = process.env["XDG_CONFIG_HOME"] ||
|
|
293934
|
-
const unitDir =
|
|
293935
|
-
const unitPath =
|
|
293936
|
-
const logDir =
|
|
293937
|
-
|
|
293938
|
-
|
|
293912
|
+
const configHome = process.env["XDG_CONFIG_HOME"] || join13(homedir13(), ".config");
|
|
293913
|
+
const unitDir = join13(configHome, "systemd", "user");
|
|
293914
|
+
const unitPath = join13(unitDir, "omnius-daemon.service");
|
|
293915
|
+
const logDir = join13(OMNIUS_DIR);
|
|
293916
|
+
mkdirSync3(unitDir, { recursive: true });
|
|
293917
|
+
mkdirSync3(logDir, { recursive: true });
|
|
293939
293918
|
const execStart = [command.command, ...command.args].map(systemdQuote).join(" ");
|
|
293940
293919
|
const unit = [
|
|
293941
293920
|
"[Unit]",
|
|
@@ -293953,16 +293932,16 @@ async function repairManagedDaemonUnit(port, preferredEntrypoint) {
|
|
|
293953
293932
|
`ExecStart=${execStart}`,
|
|
293954
293933
|
"Restart=always",
|
|
293955
293934
|
"RestartSec=3",
|
|
293956
|
-
`StandardOutput=append:${
|
|
293957
|
-
`StandardError=append:${
|
|
293935
|
+
`StandardOutput=append:${join13(logDir, "daemon.log")}`,
|
|
293936
|
+
`StandardError=append:${join13(logDir, "daemon.err.log")}`,
|
|
293958
293937
|
"",
|
|
293959
293938
|
"[Install]",
|
|
293960
293939
|
"WantedBy=default.target",
|
|
293961
293940
|
""
|
|
293962
293941
|
].join("\n");
|
|
293963
293942
|
const tmp = `${unitPath}.tmp.${process.pid}.${Date.now()}`;
|
|
293964
|
-
|
|
293965
|
-
|
|
293943
|
+
writeFileSync2(tmp, unit, { encoding: "utf8", mode: 384 });
|
|
293944
|
+
renameSync2(tmp, unitPath);
|
|
293966
293945
|
return (await runUserSystemctl(["daemon-reload"], 1e4)).ok;
|
|
293967
293946
|
} catch {
|
|
293968
293947
|
return false;
|
|
@@ -294177,7 +294156,7 @@ async function restartDaemon(port, expectedVersion, preferredEntrypoint) {
|
|
|
294177
294156
|
function looksLikeNodeEntrypoint(path) {
|
|
294178
294157
|
if (/\.(?:mjs|cjs|js)$/i.test(path)) return true;
|
|
294179
294158
|
try {
|
|
294180
|
-
const firstBytes =
|
|
294159
|
+
const firstBytes = readFileSync4(path, "utf8").slice(0, 200);
|
|
294181
294160
|
return /^#!.*\bnode\b/.test(firstBytes);
|
|
294182
294161
|
} catch {
|
|
294183
294162
|
return false;
|
|
@@ -294194,7 +294173,7 @@ async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
|
294194
294173
|
const candidates = [];
|
|
294195
294174
|
if (preferredEntrypoint) candidates.push(preferredEntrypoint);
|
|
294196
294175
|
const thisDir = dirname7(fileURLToPath2(import.meta.url));
|
|
294197
|
-
candidates.push(
|
|
294176
|
+
candidates.push(join13(thisDir, "index.js"));
|
|
294198
294177
|
if (process.argv[1]) candidates.push(process.argv[1]);
|
|
294199
294178
|
try {
|
|
294200
294179
|
const { spawnSync: spawnSync3 } = await import("node:child_process");
|
|
@@ -294210,13 +294189,13 @@ async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
|
294210
294189
|
for (const candidate of candidates) {
|
|
294211
294190
|
if (!candidate || seen.has(candidate)) continue;
|
|
294212
294191
|
seen.add(candidate);
|
|
294213
|
-
if (!
|
|
294192
|
+
if (!existsSync4(candidate)) continue;
|
|
294214
294193
|
return commandForEntrypoint(candidate, nodeExe);
|
|
294215
294194
|
}
|
|
294216
294195
|
return null;
|
|
294217
294196
|
}
|
|
294218
294197
|
async function startDaemon(port = getDaemonPort(), preferredEntrypoint) {
|
|
294219
|
-
|
|
294198
|
+
mkdirSync3(OMNIUS_DIR, { recursive: true });
|
|
294220
294199
|
const daemonPort = port;
|
|
294221
294200
|
const endpointClaim = claimDaemonEndpoint(daemonPort);
|
|
294222
294201
|
if (!endpointClaim) return null;
|
|
@@ -294229,8 +294208,8 @@ async function startDaemon(port = getDaemonPort(), preferredEntrypoint) {
|
|
|
294229
294208
|
let outFd = null;
|
|
294230
294209
|
let errFd = null;
|
|
294231
294210
|
try {
|
|
294232
|
-
outFd = openSync(
|
|
294233
|
-
errFd = openSync(
|
|
294211
|
+
outFd = openSync(join13(OMNIUS_DIR, "daemon.log"), "a");
|
|
294212
|
+
errFd = openSync(join13(OMNIUS_DIR, "daemon.err.log"), "a");
|
|
294234
294213
|
const leaseId = newProcessLeaseId("daemon");
|
|
294235
294214
|
const ownerId = `daemon:${daemonPort}`;
|
|
294236
294215
|
const child = spawn(daemonCommand.command, daemonCommand.args, {
|
|
@@ -294252,7 +294231,7 @@ async function startDaemon(port = getDaemonPort(), preferredEntrypoint) {
|
|
|
294252
294231
|
child.unref();
|
|
294253
294232
|
const pid = child.pid ?? null;
|
|
294254
294233
|
if (pid) {
|
|
294255
|
-
|
|
294234
|
+
writeFileSync2(PID_FILE, String(pid), "utf8");
|
|
294256
294235
|
registerProcessLease({
|
|
294257
294236
|
leaseId,
|
|
294258
294237
|
pid,
|
|
@@ -294310,18 +294289,18 @@ import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypt
|
|
|
294310
294289
|
import {
|
|
294311
294290
|
chmodSync,
|
|
294312
294291
|
closeSync as closeSync2,
|
|
294313
|
-
existsSync as
|
|
294314
|
-
mkdirSync as
|
|
294292
|
+
existsSync as existsSync5,
|
|
294293
|
+
mkdirSync as mkdirSync4,
|
|
294315
294294
|
openSync as openSync2,
|
|
294316
|
-
readFileSync as
|
|
294317
|
-
renameSync as
|
|
294318
|
-
statSync as
|
|
294295
|
+
readFileSync as readFileSync5,
|
|
294296
|
+
renameSync as renameSync3,
|
|
294297
|
+
statSync as statSync3,
|
|
294319
294298
|
unlinkSync as unlinkSync2,
|
|
294320
|
-
writeFileSync as
|
|
294299
|
+
writeFileSync as writeFileSync3,
|
|
294321
294300
|
writeSync as writeSync2
|
|
294322
294301
|
} from "node:fs";
|
|
294323
294302
|
import { homedir as homedir14 } from "node:os";
|
|
294324
|
-
import { dirname as dirname8, join as
|
|
294303
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
294325
294304
|
|
|
294326
294305
|
// packages/cli/src/service-version.ts
|
|
294327
294306
|
var OmniusVersionError = class extends Error {
|
|
@@ -294378,21 +294357,21 @@ function compareOmniusVersions(left, right) {
|
|
|
294378
294357
|
|
|
294379
294358
|
// packages/cli/src/update-service.ts
|
|
294380
294359
|
function resolveUpdatePaths(env = process.env, platform2 = process.platform, home = homedir14()) {
|
|
294381
|
-
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] ||
|
|
294382
|
-
const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] ||
|
|
294383
|
-
const stateDir =
|
|
294384
|
-
const cacheDir =
|
|
294360
|
+
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join14(home, "AppData", "Local") : platform2 === "darwin" ? join14(home, "Library", "Application Support") : env["XDG_STATE_HOME"] || join14(home, ".local", "state");
|
|
294361
|
+
const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join14(home, "AppData", "Local") : platform2 === "darwin" ? join14(home, "Library", "Caches") : env["XDG_CACHE_HOME"] || join14(home, ".cache");
|
|
294362
|
+
const stateDir = join14(stateBase, platform2 === "win32" ? "Omnius" : "omnius", "update");
|
|
294363
|
+
const cacheDir = join14(cacheBase, platform2 === "win32" ? "Omnius" : "omnius", "npm-update");
|
|
294385
294364
|
return {
|
|
294386
294365
|
stateDir,
|
|
294387
294366
|
cacheDir,
|
|
294388
|
-
stateFile:
|
|
294389
|
-
lockFile:
|
|
294390
|
-
logFile:
|
|
294367
|
+
stateFile: join14(stateDir, "state.json"),
|
|
294368
|
+
lockFile: join14(stateDir, "update.lock"),
|
|
294369
|
+
logFile: join14(stateDir, "update.log")
|
|
294391
294370
|
};
|
|
294392
294371
|
}
|
|
294393
294372
|
function ensurePrivateDirectories(paths) {
|
|
294394
|
-
|
|
294395
|
-
|
|
294373
|
+
mkdirSync4(paths.stateDir, { recursive: true, mode: 448 });
|
|
294374
|
+
mkdirSync4(paths.cacheDir, { recursive: true, mode: 448 });
|
|
294396
294375
|
try {
|
|
294397
294376
|
chmodSync(paths.stateDir, 448);
|
|
294398
294377
|
} catch {
|
|
@@ -294405,27 +294384,27 @@ function ensurePrivateDirectories(paths) {
|
|
|
294405
294384
|
function atomicPrivateJson(path, value) {
|
|
294406
294385
|
const temp = `${path}.${process.pid}.${randomUUID2()}.tmp`;
|
|
294407
294386
|
try {
|
|
294408
|
-
|
|
294387
|
+
writeFileSync3(temp, `${JSON.stringify(value, null, 2)}
|
|
294409
294388
|
`, {
|
|
294410
294389
|
encoding: "utf8",
|
|
294411
294390
|
mode: 384,
|
|
294412
294391
|
flag: "wx"
|
|
294413
294392
|
});
|
|
294414
|
-
|
|
294393
|
+
renameSync3(temp, path);
|
|
294415
294394
|
try {
|
|
294416
294395
|
chmodSync(path, 384);
|
|
294417
294396
|
} catch {
|
|
294418
294397
|
}
|
|
294419
294398
|
} finally {
|
|
294420
294399
|
try {
|
|
294421
|
-
if (
|
|
294400
|
+
if (existsSync5(temp)) unlinkSync2(temp);
|
|
294422
294401
|
} catch {
|
|
294423
294402
|
}
|
|
294424
294403
|
}
|
|
294425
294404
|
}
|
|
294426
294405
|
function readUpdateState(paths = resolveUpdatePaths()) {
|
|
294427
294406
|
try {
|
|
294428
|
-
return JSON.parse(
|
|
294407
|
+
return JSON.parse(readFileSync5(paths.stateFile, "utf8"));
|
|
294429
294408
|
} catch {
|
|
294430
294409
|
return null;
|
|
294431
294410
|
}
|
|
@@ -294450,7 +294429,7 @@ function adoptUpdateWorker(operationId, pid, paths = resolveUpdatePaths()) {
|
|
|
294450
294429
|
function releaseUpdateLock(paths = resolveUpdatePaths(), operationId) {
|
|
294451
294430
|
try {
|
|
294452
294431
|
if (operationId) {
|
|
294453
|
-
const lock = JSON.parse(
|
|
294432
|
+
const lock = JSON.parse(readFileSync5(paths.lockFile, "utf8"));
|
|
294454
294433
|
if (lock.operation_id !== operationId) return;
|
|
294455
294434
|
}
|
|
294456
294435
|
unlinkSync2(paths.lockFile);
|
|
@@ -294469,10 +294448,10 @@ function assertExactUpdateTarget(targetVersion, fromVersion) {
|
|
|
294469
294448
|
}
|
|
294470
294449
|
function npmCandidates(execPath = process.execPath) {
|
|
294471
294450
|
const nodeDir = dirname8(execPath);
|
|
294472
|
-
return process.platform === "win32" ? [
|
|
294451
|
+
return process.platform === "win32" ? [join14(nodeDir, "npm.cmd"), join14(nodeDir, "npm.exe"), "npm.cmd", "npm"] : [join14(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm", "npm"];
|
|
294473
294452
|
}
|
|
294474
294453
|
function runnableCommand(candidate) {
|
|
294475
|
-
return candidate.includes("/") || candidate.includes("\\") ?
|
|
294454
|
+
return candidate.includes("/") || candidate.includes("\\") ? existsSync5(candidate) : true;
|
|
294476
294455
|
}
|
|
294477
294456
|
function resolveNpmPath(execPath = process.execPath) {
|
|
294478
294457
|
const candidate = npmCandidates(execPath).find(runnableCommand);
|
|
@@ -294493,10 +294472,10 @@ function runSync(command, args, options = {}) {
|
|
|
294493
294472
|
});
|
|
294494
294473
|
}
|
|
294495
294474
|
function globalPackageCandidates(prefix) {
|
|
294496
|
-
return process.platform === "win32" ? [
|
|
294475
|
+
return process.platform === "win32" ? [join14(prefix, "node_modules", "omnius", "package.json"), join14(prefix, "omnius", "package.json")] : [join14(prefix, "lib", "node_modules", "omnius", "package.json"), join14(prefix, "node_modules", "omnius", "package.json")];
|
|
294497
294476
|
}
|
|
294498
294477
|
function globalExecutableCandidates(prefix) {
|
|
294499
|
-
return process.platform === "win32" ? [
|
|
294478
|
+
return process.platform === "win32" ? [join14(prefix, "omnius.cmd"), join14(prefix, "omnius.exe"), join14(prefix, "bin", "omnius.cmd")] : [join14(prefix, "bin", "omnius")];
|
|
294500
294479
|
}
|
|
294501
294480
|
function inspectGlobalOmniusInstall(expectedVersion, options = {}) {
|
|
294502
294481
|
const npmPath = options.npmPath ?? resolveNpmPath();
|
|
@@ -294505,14 +294484,14 @@ function inspectGlobalOmniusInstall(expectedVersion, options = {}) {
|
|
|
294505
294484
|
throw new Error(`Could not resolve npm global prefix: ${prefixResult.stderr.trim() || "npm prefix -g failed"}`);
|
|
294506
294485
|
}
|
|
294507
294486
|
const npmPrefix = prefixResult.stdout.trim();
|
|
294508
|
-
const packageJsonPath = globalPackageCandidates(npmPrefix).find(
|
|
294487
|
+
const packageJsonPath = globalPackageCandidates(npmPrefix).find(existsSync5);
|
|
294509
294488
|
if (!packageJsonPath) throw new Error(`Global omnius package.json not found under ${npmPrefix}`);
|
|
294510
|
-
const packageJsonRaw =
|
|
294489
|
+
const packageJsonRaw = readFileSync5(packageJsonPath, "utf8");
|
|
294511
294490
|
const installedVersion = String(JSON.parse(packageJsonRaw)?.version ?? "");
|
|
294512
294491
|
if (installedVersion !== expectedVersion) {
|
|
294513
294492
|
throw new Error(`Global package verification failed: expected ${expectedVersion}, found ${installedVersion || "unknown"}`);
|
|
294514
294493
|
}
|
|
294515
|
-
const executablePath = globalExecutableCandidates(npmPrefix).find(
|
|
294494
|
+
const executablePath = globalExecutableCandidates(npmPrefix).find(existsSync5);
|
|
294516
294495
|
if (!executablePath) throw new Error(`Global Omnius executable not found under ${npmPrefix}`);
|
|
294517
294496
|
const versionResult = runSync(executablePath, ["--version"], { env: options.env, timeout: 1e4 });
|
|
294518
294497
|
const executableVersion = commandVersion(`${versionResult.stdout}
|
|
@@ -294723,24 +294702,24 @@ import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
|
294723
294702
|
import {
|
|
294724
294703
|
closeSync as closeSync3,
|
|
294725
294704
|
chmodSync as chmodSync2,
|
|
294726
|
-
existsSync as
|
|
294727
|
-
mkdirSync as
|
|
294705
|
+
existsSync as existsSync6,
|
|
294706
|
+
mkdirSync as mkdirSync5,
|
|
294728
294707
|
openSync as openSync3,
|
|
294729
|
-
readFileSync as
|
|
294708
|
+
readFileSync as readFileSync6,
|
|
294730
294709
|
realpathSync,
|
|
294731
|
-
renameSync as
|
|
294710
|
+
renameSync as renameSync4,
|
|
294732
294711
|
unlinkSync as unlinkSync3,
|
|
294733
|
-
writeFileSync as
|
|
294712
|
+
writeFileSync as writeFileSync4,
|
|
294734
294713
|
writeSync as writeSync3
|
|
294735
294714
|
} from "node:fs";
|
|
294736
294715
|
import { homedir as homedir15, tmpdir as tmpdir7 } from "node:os";
|
|
294737
|
-
import { basename as basename8, dirname as dirname9, join as
|
|
294716
|
+
import { basename as basename8, dirname as dirname9, join as join16 } from "node:path";
|
|
294738
294717
|
|
|
294739
294718
|
// packages/cli/src/updater.ts
|
|
294740
|
-
import { join as
|
|
294719
|
+
import { join as join15 } from "node:path";
|
|
294741
294720
|
var CHECK_INTERVAL_MS = 60 * 1e3;
|
|
294742
294721
|
var CACHE_DIR = resolveUpdatePaths().stateDir;
|
|
294743
|
-
var CACHE_FILE =
|
|
294722
|
+
var CACHE_FILE = join15(CACHE_DIR, "registry-check.json");
|
|
294744
294723
|
|
|
294745
294724
|
// packages/cli/src/tray.ts
|
|
294746
294725
|
var DEFAULT_ENDPOINT = "http://127.0.0.1:11435";
|
|
@@ -294748,19 +294727,19 @@ function uidSuffix() {
|
|
|
294748
294727
|
return typeof process.getuid === "function" ? String(process.getuid()) : "user";
|
|
294749
294728
|
}
|
|
294750
294729
|
function resolveTrayPaths(env = process.env, platform2 = process.platform, home = homedir15()) {
|
|
294751
|
-
const runtimeBase = env["XDG_RUNTIME_DIR"] ||
|
|
294752
|
-
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] ||
|
|
294753
|
-
const configBase = platform2 === "win32" ? env["APPDATA"] ||
|
|
294754
|
-
const runtimeDir =
|
|
294755
|
-
const stateDir = platform2 === "win32" ?
|
|
294756
|
-
const autostartFile = platform2 === "darwin" ?
|
|
294730
|
+
const runtimeBase = env["XDG_RUNTIME_DIR"] || join16(tmpdir7(), `omnius-${uidSuffix()}`);
|
|
294731
|
+
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join16(home, "AppData", "Local") : env["XDG_STATE_HOME"] || join16(home, ".local", "state");
|
|
294732
|
+
const configBase = platform2 === "win32" ? env["APPDATA"] || join16(home, "AppData", "Roaming") : env["XDG_CONFIG_HOME"] || join16(home, ".config");
|
|
294733
|
+
const runtimeDir = join16(runtimeBase, "omnius");
|
|
294734
|
+
const stateDir = platform2 === "win32" ? join16(stateBase, "Omnius") : join16(stateBase, "omnius");
|
|
294735
|
+
const autostartFile = platform2 === "darwin" ? join16(home, "Library", "LaunchAgents", "ai.omnius.tray.plist") : platform2 === "win32" ? join16(configBase, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "omnius-tray.cmd") : join16(configBase, "autostart", "omnius-tray.desktop");
|
|
294757
294736
|
return {
|
|
294758
294737
|
runtimeDir,
|
|
294759
294738
|
stateDir,
|
|
294760
|
-
pidFile:
|
|
294761
|
-
stateFile:
|
|
294762
|
-
stdoutLog:
|
|
294763
|
-
stderrLog:
|
|
294739
|
+
pidFile: join16(runtimeDir, "tray.pid"),
|
|
294740
|
+
stateFile: join16(runtimeDir, "tray-state.json"),
|
|
294741
|
+
stdoutLog: join16(stateDir, "tray.log"),
|
|
294742
|
+
stderrLog: join16(stateDir, "tray.err.log"),
|
|
294764
294743
|
autostartFile
|
|
294765
294744
|
};
|
|
294766
294745
|
}
|
|
@@ -294834,7 +294813,7 @@ function isProcessAlive2(pid) {
|
|
|
294834
294813
|
}
|
|
294835
294814
|
function readPid(path) {
|
|
294836
294815
|
try {
|
|
294837
|
-
const pid = Number(
|
|
294816
|
+
const pid = Number(readFileSync6(path, "utf8").trim());
|
|
294838
294817
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
294839
294818
|
} catch {
|
|
294840
294819
|
return null;
|
|
@@ -294842,7 +294821,7 @@ function readPid(path) {
|
|
|
294842
294821
|
}
|
|
294843
294822
|
function readProcessState(path) {
|
|
294844
294823
|
try {
|
|
294845
|
-
return JSON.parse(
|
|
294824
|
+
return JSON.parse(readFileSync6(path, "utf8"));
|
|
294846
294825
|
} catch {
|
|
294847
294826
|
return null;
|
|
294848
294827
|
}
|
|
@@ -294850,7 +294829,7 @@ function readProcessState(path) {
|
|
|
294850
294829
|
function processCommandLine(pid) {
|
|
294851
294830
|
try {
|
|
294852
294831
|
if (process.platform === "linux") {
|
|
294853
|
-
return
|
|
294832
|
+
return readFileSync6(`/proc/${pid}/cmdline`, "utf8").replace(/\0/g, " ");
|
|
294854
294833
|
}
|
|
294855
294834
|
if (process.platform !== "win32") {
|
|
294856
294835
|
return spawnSync2("ps", ["-p", String(pid), "-o", "command="], {
|
|
@@ -294892,7 +294871,7 @@ async function getTrayStatus(explicitEndpoint) {
|
|
|
294892
294871
|
// requested endpoint. This previously kept resurrecting an obsolete
|
|
294893
294872
|
// custom port (for example 11535) after the daemon had returned to 11435.
|
|
294894
294873
|
endpoint: running || !explicitEndpoint ? state?.endpoint || requestedEndpoint : requestedEndpoint,
|
|
294895
|
-
registered:
|
|
294874
|
+
registered: existsSync6(paths.autostartFile),
|
|
294896
294875
|
registrationFile: paths.autostartFile,
|
|
294897
294876
|
...state?.health ? { health: state.health } : {},
|
|
294898
294877
|
supported: support.supported,
|
|
@@ -294971,9 +294950,9 @@ function pathsFromEnvironment() {
|
|
|
294971
294950
|
return {
|
|
294972
294951
|
stateDir,
|
|
294973
294952
|
cacheDir,
|
|
294974
|
-
stateFile:
|
|
294975
|
-
lockFile:
|
|
294976
|
-
logFile:
|
|
294953
|
+
stateFile: join17(stateDir, "state.json"),
|
|
294954
|
+
lockFile: join17(stateDir, "update.lock"),
|
|
294955
|
+
logFile: join17(stateDir, "update.log")
|
|
294977
294956
|
};
|
|
294978
294957
|
}
|
|
294979
294958
|
async function restartTrayWithInstalledExecutable(executable, endpoint) {
|