omnius 1.0.628 → 1.0.629
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +811 -705
- package/dist/update-worker.js +196 -165
- package/docs/DISCOVERY.json +79 -7
- package/docs/DISCOVERY.md +2 -2
- package/docs/reference/rest-api.md +1 -1
- package/docs/rest/INDEX.md +1 -1
- package/docs/rest/endpoints/voice-vision.md +20 -1
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/dist/update-worker.js
CHANGED
|
@@ -69,11 +69,39 @@ 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";
|
|
72
73
|
import { homedir, platform } from "node:os";
|
|
73
|
-
|
|
74
|
+
import { join, sep } from "node:path";
|
|
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;
|
|
74
101
|
var init_model_store = __esm({
|
|
75
102
|
"packages/execution/dist/tools/model-store.js"() {
|
|
76
103
|
"use strict";
|
|
104
|
+
MEDIA_ROOT_POINTER = "media-store.json";
|
|
77
105
|
platformId = platform();
|
|
78
106
|
}
|
|
79
107
|
});
|
|
@@ -120,9 +148,9 @@ var init_process_kill = __esm({
|
|
|
120
148
|
|
|
121
149
|
// packages/execution/dist/process-lifecycle.js
|
|
122
150
|
import { randomUUID, createHash } from "node:crypto";
|
|
123
|
-
import { appendFileSync, existsSync, mkdirSync, readFileSync, readlinkSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
151
|
+
import { appendFileSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readlinkSync, renameSync as renameSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
124
152
|
import { homedir as homedir2 } from "node:os";
|
|
125
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
153
|
+
import { dirname, isAbsolute, join as join2, relative, resolve } from "node:path";
|
|
126
154
|
function nowFrom(system) {
|
|
127
155
|
return system?.now?.() ?? Date.now();
|
|
128
156
|
}
|
|
@@ -130,18 +158,18 @@ function realSleep(ms) {
|
|
|
130
158
|
return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
|
|
131
159
|
}
|
|
132
160
|
function registryDir(options) {
|
|
133
|
-
return options?.storeDir || process.env["OMNIUS_PROCESS_REGISTRY_DIR"] ||
|
|
161
|
+
return options?.storeDir || process.env["OMNIUS_PROCESS_REGISTRY_DIR"] || join2(process.env["OMNIUS_HOME"] || join2(homedir2(), ".omnius"), "processes");
|
|
134
162
|
}
|
|
135
163
|
function ensureStoreDir(options) {
|
|
136
164
|
const dir = registryDir(options);
|
|
137
|
-
|
|
165
|
+
mkdirSync2(dir, { recursive: true });
|
|
138
166
|
return dir;
|
|
139
167
|
}
|
|
140
168
|
function activeFilePath(options) {
|
|
141
|
-
return
|
|
169
|
+
return join2(ensureStoreDir(options), ACTIVE_FILE);
|
|
142
170
|
}
|
|
143
171
|
function jsonlFilePath(options) {
|
|
144
|
-
return
|
|
172
|
+
return join2(ensureStoreDir(options), JSONL_FILE);
|
|
145
173
|
}
|
|
146
174
|
function safeParseJson(text) {
|
|
147
175
|
try {
|
|
@@ -152,8 +180,8 @@ function safeParseJson(text) {
|
|
|
152
180
|
}
|
|
153
181
|
function readActiveStore(options) {
|
|
154
182
|
const activePath = activeFilePath(options);
|
|
155
|
-
if (
|
|
156
|
-
const parsed = safeParseJson(
|
|
183
|
+
if (existsSync2(activePath)) {
|
|
184
|
+
const parsed = safeParseJson(readFileSync2(activePath, "utf8"));
|
|
157
185
|
if (parsed?.version === 1 && Array.isArray(parsed.leases))
|
|
158
186
|
return parsed;
|
|
159
187
|
}
|
|
@@ -162,8 +190,8 @@ function readActiveStore(options) {
|
|
|
162
190
|
function rebuildActiveStoreFromLog(options) {
|
|
163
191
|
const logPath = jsonlFilePath(options);
|
|
164
192
|
const byId = /* @__PURE__ */ new Map();
|
|
165
|
-
if (
|
|
166
|
-
const text =
|
|
193
|
+
if (existsSync2(logPath)) {
|
|
194
|
+
const text = readFileSync2(logPath, "utf8");
|
|
167
195
|
for (const line of text.split("\n")) {
|
|
168
196
|
const trimmed = line.trim();
|
|
169
197
|
if (!trimmed)
|
|
@@ -184,10 +212,10 @@ function rebuildActiveStoreFromLog(options) {
|
|
|
184
212
|
}
|
|
185
213
|
function writeActiveStore(store, options) {
|
|
186
214
|
const target = activeFilePath(options);
|
|
187
|
-
|
|
215
|
+
mkdirSync2(dirname(target), { recursive: true });
|
|
188
216
|
const tmp = `${target}.${process.pid}.${randomUUID()}.tmp`;
|
|
189
|
-
|
|
190
|
-
|
|
217
|
+
writeFileSync2(tmp, JSON.stringify(store, null, 2));
|
|
218
|
+
renameSync2(tmp, target);
|
|
191
219
|
}
|
|
192
220
|
function appendLeaseEvent(type, lease, options) {
|
|
193
221
|
const event = { type, at: nowFrom(options?.system), lease };
|
|
@@ -458,13 +486,13 @@ function inspectRealProcess(pid) {
|
|
|
458
486
|
const now = Date.now();
|
|
459
487
|
const procDir = `/proc/${pid}`;
|
|
460
488
|
const identity = { pid, collectedAt: now };
|
|
461
|
-
if (process.platform !== "win32" &&
|
|
489
|
+
if (process.platform !== "win32" && existsSync2(procDir)) {
|
|
462
490
|
try {
|
|
463
|
-
identity.cwd = readlinkSync(
|
|
491
|
+
identity.cwd = readlinkSync(join2(procDir, "cwd"));
|
|
464
492
|
} catch {
|
|
465
493
|
}
|
|
466
494
|
try {
|
|
467
|
-
const cmdline =
|
|
495
|
+
const cmdline = readFileSync2(join2(procDir, "cmdline"));
|
|
468
496
|
const command = cmdline.toString("utf8").split("\0").filter(Boolean).join(" ");
|
|
469
497
|
if (command) {
|
|
470
498
|
identity.command = command;
|
|
@@ -473,14 +501,14 @@ function inspectRealProcess(pid) {
|
|
|
473
501
|
} catch {
|
|
474
502
|
}
|
|
475
503
|
try {
|
|
476
|
-
const environ =
|
|
504
|
+
const environ = readFileSync2(join2(procDir, "environ")).toString("utf8");
|
|
477
505
|
const envLeaseId = environ.split("\0").find((entry) => entry.startsWith("OMNIUS_PROCESS_LEASE_ID="))?.slice("OMNIUS_PROCESS_LEASE_ID=".length);
|
|
478
506
|
if (envLeaseId)
|
|
479
507
|
identity.envLeaseId = envLeaseId;
|
|
480
508
|
} catch {
|
|
481
509
|
}
|
|
482
510
|
try {
|
|
483
|
-
const stat =
|
|
511
|
+
const stat = readFileSync2(join2(procDir, "stat"), "utf8");
|
|
484
512
|
const afterComm = stat.slice(stat.lastIndexOf(")") + 2).trim().split(/\s+/);
|
|
485
513
|
const ppid = Number(afterComm[1]);
|
|
486
514
|
const pgid = Number(afterComm[2]);
|
|
@@ -11932,7 +11960,7 @@ ${lanes.join("\n")}
|
|
|
11932
11960
|
return process.memoryUsage().heapUsed;
|
|
11933
11961
|
},
|
|
11934
11962
|
getFileSize(path) {
|
|
11935
|
-
const stat =
|
|
11963
|
+
const stat = statSync5(path);
|
|
11936
11964
|
if (stat == null ? void 0 : stat.isFile()) {
|
|
11937
11965
|
return stat.size;
|
|
11938
11966
|
}
|
|
@@ -11976,7 +12004,7 @@ ${lanes.join("\n")}
|
|
|
11976
12004
|
}
|
|
11977
12005
|
};
|
|
11978
12006
|
return nodeSystem;
|
|
11979
|
-
function
|
|
12007
|
+
function statSync5(path) {
|
|
11980
12008
|
try {
|
|
11981
12009
|
return _fs.statSync(path, statSyncOptions);
|
|
11982
12010
|
} catch {
|
|
@@ -12035,7 +12063,7 @@ ${lanes.join("\n")}
|
|
|
12035
12063
|
activeSession.post("Profiler.stop", (err, { profile }) => {
|
|
12036
12064
|
var _a2;
|
|
12037
12065
|
if (!err) {
|
|
12038
|
-
if ((_a2 =
|
|
12066
|
+
if ((_a2 = statSync5(profilePath)) == null ? void 0 : _a2.isDirectory()) {
|
|
12039
12067
|
profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
|
|
12040
12068
|
}
|
|
12041
12069
|
try {
|
|
@@ -12155,7 +12183,7 @@ ${lanes.join("\n")}
|
|
|
12155
12183
|
let stat;
|
|
12156
12184
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
12157
12185
|
const name = combinePaths(path, entry);
|
|
12158
|
-
stat =
|
|
12186
|
+
stat = statSync5(name);
|
|
12159
12187
|
if (!stat) {
|
|
12160
12188
|
continue;
|
|
12161
12189
|
}
|
|
@@ -12179,7 +12207,7 @@ ${lanes.join("\n")}
|
|
|
12179
12207
|
return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
|
12180
12208
|
}
|
|
12181
12209
|
function fileSystemEntryExists(path, entryKind) {
|
|
12182
|
-
const stat =
|
|
12210
|
+
const stat = statSync5(path);
|
|
12183
12211
|
if (!stat) {
|
|
12184
12212
|
return false;
|
|
12185
12213
|
}
|
|
@@ -12221,7 +12249,7 @@ ${lanes.join("\n")}
|
|
|
12221
12249
|
}
|
|
12222
12250
|
function getModifiedTime3(path) {
|
|
12223
12251
|
var _a2;
|
|
12224
|
-
return (_a2 =
|
|
12252
|
+
return (_a2 = statSync5(path)) == null ? void 0 : _a2.mtime;
|
|
12225
12253
|
}
|
|
12226
12254
|
function setModifiedTime(path, time) {
|
|
12227
12255
|
try {
|
|
@@ -51385,11 +51413,11 @@ ${lanes.join("\n")}
|
|
|
51385
51413
|
if (i < rootLength) {
|
|
51386
51414
|
return void 0;
|
|
51387
51415
|
}
|
|
51388
|
-
const
|
|
51389
|
-
if (
|
|
51416
|
+
const sep2 = directory.lastIndexOf(directorySeparator, i - 1);
|
|
51417
|
+
if (sep2 === -1) {
|
|
51390
51418
|
return void 0;
|
|
51391
51419
|
}
|
|
51392
|
-
return directory.substr(0, Math.max(
|
|
51420
|
+
return directory.substr(0, Math.max(sep2, rootLength));
|
|
51393
51421
|
}
|
|
51394
51422
|
}
|
|
51395
51423
|
}
|
|
@@ -127572,7 +127600,7 @@ ${lanes.join("\n")}
|
|
|
127572
127600
|
}
|
|
127573
127601
|
}
|
|
127574
127602
|
function createImportCallExpressionAMD(arg2, containsLexicalThis) {
|
|
127575
|
-
const
|
|
127603
|
+
const resolve11 = factory2.createUniqueName("resolve");
|
|
127576
127604
|
const reject = factory2.createUniqueName("reject");
|
|
127577
127605
|
const parameters = [
|
|
127578
127606
|
factory2.createParameterDeclaration(
|
|
@@ -127581,7 +127609,7 @@ ${lanes.join("\n")}
|
|
|
127581
127609
|
/*dotDotDotToken*/
|
|
127582
127610
|
void 0,
|
|
127583
127611
|
/*name*/
|
|
127584
|
-
|
|
127612
|
+
resolve11
|
|
127585
127613
|
),
|
|
127586
127614
|
factory2.createParameterDeclaration(
|
|
127587
127615
|
/*modifiers*/
|
|
@@ -127598,7 +127626,7 @@ ${lanes.join("\n")}
|
|
|
127598
127626
|
factory2.createIdentifier("require"),
|
|
127599
127627
|
/*typeArguments*/
|
|
127600
127628
|
void 0,
|
|
127601
|
-
[factory2.createArrayLiteralExpression([arg2 || factory2.createOmittedExpression()]),
|
|
127629
|
+
[factory2.createArrayLiteralExpression([arg2 || factory2.createOmittedExpression()]), resolve11, reject]
|
|
127602
127630
|
)
|
|
127603
127631
|
)
|
|
127604
127632
|
]);
|
|
@@ -140409,9 +140437,9 @@ ${lanes.join("\n")}
|
|
|
140409
140437
|
/*ignoreCase*/
|
|
140410
140438
|
false
|
|
140411
140439
|
)) {
|
|
140412
|
-
const
|
|
140413
|
-
if (
|
|
140414
|
-
const name = removeSuffix(removePrefix(
|
|
140440
|
+
const basename9 = getBaseFileName(a.fileName);
|
|
140441
|
+
if (basename9 === "lib.d.ts" || basename9 === "lib.es6.d.ts") return 0;
|
|
140442
|
+
const name = removeSuffix(removePrefix(basename9, "lib."), ".d.ts");
|
|
140415
140443
|
const index = libs.indexOf(name);
|
|
140416
140444
|
if (index !== -1) return index + 1;
|
|
140417
140445
|
}
|
|
@@ -204337,8 +204365,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
204337
204365
|
}
|
|
204338
204366
|
};
|
|
204339
204367
|
for (const file of files) {
|
|
204340
|
-
const
|
|
204341
|
-
if (
|
|
204368
|
+
const basename9 = getBaseFileName(file);
|
|
204369
|
+
if (basename9 === "package.json" || basename9 === "bower.json") {
|
|
204342
204370
|
createProjectWatcher(
|
|
204343
204371
|
file,
|
|
204344
204372
|
"FileWatcher"
|
|
@@ -208022,8 +208050,8 @@ All files are: ${JSON.stringify(names)}`,
|
|
|
208022
208050
|
var _a2;
|
|
208023
208051
|
const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
|
|
208024
208052
|
if (!fileOrDirectoryPath) return;
|
|
208025
|
-
const
|
|
208026
|
-
if (((_a2 = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.size) && (
|
|
208053
|
+
const basename9 = getBaseFileName(fileOrDirectoryPath);
|
|
208054
|
+
if (((_a2 = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.size) && (basename9 === "package.json" || basename9 === "node_modules")) {
|
|
208027
208055
|
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
208028
208056
|
var _a22;
|
|
208029
208057
|
(_a22 = project.getModuleSpecifierCache()) == null ? void 0 : _a22.clear();
|
|
@@ -214509,8 +214537,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
214509
214537
|
installPackage(options) {
|
|
214510
214538
|
this.packageInstallId++;
|
|
214511
214539
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
214512
|
-
const promise = new Promise((
|
|
214513
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
214540
|
+
const promise = new Promise((resolve11, reject) => {
|
|
214541
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve11, reject });
|
|
214514
214542
|
});
|
|
214515
214543
|
this.installer.send(request);
|
|
214516
214544
|
return promise;
|
|
@@ -216757,7 +216785,7 @@ var require_path_browserify = __commonJS({
|
|
|
216757
216785
|
}
|
|
216758
216786
|
return res;
|
|
216759
216787
|
}
|
|
216760
|
-
function _format(
|
|
216788
|
+
function _format(sep2, pathObject) {
|
|
216761
216789
|
var dir = pathObject.dir || pathObject.root;
|
|
216762
216790
|
var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
216763
216791
|
if (!dir) {
|
|
@@ -216766,11 +216794,11 @@ var require_path_browserify = __commonJS({
|
|
|
216766
216794
|
if (dir === pathObject.root) {
|
|
216767
216795
|
return dir + base;
|
|
216768
216796
|
}
|
|
216769
|
-
return dir +
|
|
216797
|
+
return dir + sep2 + base;
|
|
216770
216798
|
}
|
|
216771
216799
|
var posix = {
|
|
216772
216800
|
// path.resolve([from ...], to)
|
|
216773
|
-
resolve: function
|
|
216801
|
+
resolve: function resolve11() {
|
|
216774
216802
|
var resolvedPath = "";
|
|
216775
216803
|
var resolvedAbsolute = false;
|
|
216776
216804
|
var cwd;
|
|
@@ -216904,7 +216932,7 @@ var require_path_browserify = __commonJS({
|
|
|
216904
216932
|
_makeLong: function _makeLong(path) {
|
|
216905
216933
|
return path;
|
|
216906
216934
|
},
|
|
216907
|
-
dirname: function
|
|
216935
|
+
dirname: function dirname10(path) {
|
|
216908
216936
|
assertPath(path);
|
|
216909
216937
|
if (path.length === 0) return ".";
|
|
216910
216938
|
var code = path.charCodeAt(0);
|
|
@@ -216926,7 +216954,7 @@ var require_path_browserify = __commonJS({
|
|
|
216926
216954
|
if (hasRoot && end === 1) return "//";
|
|
216927
216955
|
return path.slice(0, end);
|
|
216928
216956
|
},
|
|
216929
|
-
basename: function
|
|
216957
|
+
basename: function basename9(path, ext) {
|
|
216930
216958
|
if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
|
|
216931
216959
|
assertPath(path);
|
|
216932
216960
|
var start = 0;
|
|
@@ -220961,12 +220989,12 @@ ${nodeLocation}` : message;
|
|
|
220961
220989
|
};
|
|
220962
220990
|
var NodeRuntimeFileSystem = class {
|
|
220963
220991
|
delete(path2) {
|
|
220964
|
-
return new Promise((
|
|
220992
|
+
return new Promise((resolve11, reject) => {
|
|
220965
220993
|
fs__namespace.rm(path2, { recursive: true }, (err) => {
|
|
220966
220994
|
if (err)
|
|
220967
220995
|
reject(err);
|
|
220968
220996
|
else
|
|
220969
|
-
|
|
220997
|
+
resolve11();
|
|
220970
220998
|
});
|
|
220971
220999
|
});
|
|
220972
221000
|
}
|
|
@@ -220985,12 +221013,12 @@ ${nodeLocation}` : message;
|
|
|
220985
221013
|
}));
|
|
220986
221014
|
}
|
|
220987
221015
|
readFile(filePath, encoding = "utf-8") {
|
|
220988
|
-
return new Promise((
|
|
221016
|
+
return new Promise((resolve11, reject) => {
|
|
220989
221017
|
fs__namespace.readFile(filePath, encoding, (err, data) => {
|
|
220990
221018
|
if (err)
|
|
220991
221019
|
reject(err);
|
|
220992
221020
|
else
|
|
220993
|
-
|
|
221021
|
+
resolve11(data);
|
|
220994
221022
|
});
|
|
220995
221023
|
});
|
|
220996
221024
|
}
|
|
@@ -220998,12 +221026,12 @@ ${nodeLocation}` : message;
|
|
|
220998
221026
|
return fs__namespace.readFileSync(filePath, encoding);
|
|
220999
221027
|
}
|
|
221000
221028
|
async writeFile(filePath, fileText) {
|
|
221001
|
-
await new Promise((
|
|
221029
|
+
await new Promise((resolve11, reject) => {
|
|
221002
221030
|
fs__namespace.writeFile(filePath, fileText, (err) => {
|
|
221003
221031
|
if (err)
|
|
221004
221032
|
reject(err);
|
|
221005
221033
|
else
|
|
221006
|
-
|
|
221034
|
+
resolve11();
|
|
221007
221035
|
});
|
|
221008
221036
|
});
|
|
221009
221037
|
}
|
|
@@ -221017,12 +221045,12 @@ ${nodeLocation}` : message;
|
|
|
221017
221045
|
fs__namespace.mkdirSync(dirPath, { recursive: true });
|
|
221018
221046
|
}
|
|
221019
221047
|
move(srcPath, destPath) {
|
|
221020
|
-
return new Promise((
|
|
221048
|
+
return new Promise((resolve11, reject) => {
|
|
221021
221049
|
fs__namespace.rename(srcPath, destPath, (err) => {
|
|
221022
221050
|
if (err)
|
|
221023
221051
|
reject(err);
|
|
221024
221052
|
else
|
|
221025
|
-
|
|
221053
|
+
resolve11();
|
|
221026
221054
|
});
|
|
221027
221055
|
});
|
|
221028
221056
|
}
|
|
@@ -221030,12 +221058,12 @@ ${nodeLocation}` : message;
|
|
|
221030
221058
|
fs__namespace.renameSync(srcPath, destPath);
|
|
221031
221059
|
}
|
|
221032
221060
|
copy(srcPath, destPath) {
|
|
221033
|
-
return new Promise((
|
|
221061
|
+
return new Promise((resolve11, reject) => {
|
|
221034
221062
|
fs__namespace.copyFile(srcPath, destPath, (err) => {
|
|
221035
221063
|
if (err)
|
|
221036
221064
|
reject(err);
|
|
221037
221065
|
else
|
|
221038
|
-
|
|
221066
|
+
resolve11();
|
|
221039
221067
|
});
|
|
221040
221068
|
});
|
|
221041
221069
|
}
|
|
@@ -221043,15 +221071,15 @@ ${nodeLocation}` : message;
|
|
|
221043
221071
|
fs__namespace.copyFileSync(srcPath, destPath);
|
|
221044
221072
|
}
|
|
221045
221073
|
stat(path2) {
|
|
221046
|
-
return new Promise((
|
|
221074
|
+
return new Promise((resolve11, reject) => {
|
|
221047
221075
|
fs__namespace.stat(path2, (err, stat) => {
|
|
221048
221076
|
if (err) {
|
|
221049
221077
|
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
|
221050
|
-
|
|
221078
|
+
resolve11(void 0);
|
|
221051
221079
|
else
|
|
221052
221080
|
reject(err);
|
|
221053
221081
|
} else {
|
|
221054
|
-
|
|
221082
|
+
resolve11(stat);
|
|
221055
221083
|
}
|
|
221056
221084
|
});
|
|
221057
221085
|
});
|
|
@@ -245023,7 +245051,7 @@ var init_jibberlink = __esm({
|
|
|
245023
245051
|
});
|
|
245024
245052
|
|
|
245025
245053
|
// packages/execution/dist/tools/nexus.js
|
|
245026
|
-
import { existsSync as
|
|
245054
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, watch as fsWatchLocal } from "node:fs";
|
|
245027
245055
|
function readBundledDependencySpec(packageName, fallback) {
|
|
245028
245056
|
const candidates = [
|
|
245029
245057
|
new URL("../package.json", import.meta.url),
|
|
@@ -245032,7 +245060,7 @@ function readBundledDependencySpec(packageName, fallback) {
|
|
|
245032
245060
|
];
|
|
245033
245061
|
for (const candidate of candidates) {
|
|
245034
245062
|
try {
|
|
245035
|
-
const pkg = JSON.parse(
|
|
245063
|
+
const pkg = JSON.parse(readFileSync4(candidate, "utf8"));
|
|
245036
245064
|
const spec = pkg?.dependencies?.[packageName] ?? pkg?.optionalDependencies?.[packageName];
|
|
245037
245065
|
if (typeof spec === "string" && spec.trim())
|
|
245038
245066
|
return spec.trim();
|
|
@@ -245058,12 +245086,12 @@ import { join as join18 } from "node:path";
|
|
|
245058
245086
|
|
|
245059
245087
|
// packages/cli/src/daemon.ts
|
|
245060
245088
|
import { spawn } from "node:child_process";
|
|
245061
|
-
import { existsSync as
|
|
245089
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, unlinkSync, openSync, closeSync, writeSync, statSync as statSync3, renameSync as renameSync3 } from "node:fs";
|
|
245062
245090
|
import { join as join14 } from "node:path";
|
|
245063
|
-
import { homedir as
|
|
245091
|
+
import { homedir as homedir13 } from "node:os";
|
|
245064
245092
|
import { createServer as createNetServer } from "node:net";
|
|
245065
245093
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
245066
|
-
import { dirname as
|
|
245094
|
+
import { dirname as dirname7 } from "node:path";
|
|
245067
245095
|
|
|
245068
245096
|
// packages/execution/dist/index.js
|
|
245069
245097
|
init_model_broker();
|
|
@@ -290301,22 +290329,22 @@ for (const resource of OSINT_CATALOG_RESOURCES) {
|
|
|
290301
290329
|
|
|
290302
290330
|
// packages/execution/dist/tools/carbonyl-browser.js
|
|
290303
290331
|
import { homedir as homedir4 } from "node:os";
|
|
290304
|
-
import { join as
|
|
290332
|
+
import { join as join4 } from "node:path";
|
|
290305
290333
|
init_venv_paths();
|
|
290306
290334
|
init_process_lifecycle();
|
|
290307
290335
|
|
|
290308
290336
|
// packages/execution/dist/tools/playwright-browser.js
|
|
290309
|
-
import { dirname as dirname2, join as
|
|
290337
|
+
import { dirname as dirname2, join as join3, resolve as resolve3 } from "node:path";
|
|
290310
290338
|
import { homedir as homedir3, tmpdir } from "node:os";
|
|
290311
290339
|
init_vision();
|
|
290312
290340
|
var dynamicImport = new Function("mod", "return import(mod)");
|
|
290313
|
-
var PLAYWRIGHT_RUNTIME_DIR =
|
|
290314
|
-
var PLAYWRIGHT_BROWSERS_DIR =
|
|
290341
|
+
var PLAYWRIGHT_RUNTIME_DIR = join3(homedir3(), ".omnius", "playwright-runtime");
|
|
290342
|
+
var PLAYWRIGHT_BROWSERS_DIR = join3(PLAYWRIGHT_RUNTIME_DIR, "browsers");
|
|
290315
290343
|
|
|
290316
290344
|
// packages/execution/dist/tools/carbonyl-browser.js
|
|
290317
290345
|
init_process_async();
|
|
290318
|
-
var CARBONYL_VENV =
|
|
290319
|
-
var CARBONYL_RUNTIME_MARKER =
|
|
290346
|
+
var CARBONYL_VENV = join4(homedir4(), ".omnius", "venv");
|
|
290347
|
+
var CARBONYL_RUNTIME_MARKER = join4(CARBONYL_VENV, ".omnius-carbonyl-runtime-installed");
|
|
290320
290348
|
var INSTALL_TIMEOUT_MS = 10 * 6e4;
|
|
290321
290349
|
var CARBONYL_DRIVER_PY = String.raw`
|
|
290322
290350
|
import json, sys, traceback
|
|
@@ -291278,7 +291306,7 @@ init_hf_media_models();
|
|
|
291278
291306
|
|
|
291279
291307
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
291280
291308
|
init_model_broker();
|
|
291281
|
-
import { join as
|
|
291309
|
+
import { join as join5, basename, dirname as dirname3, extname, resolve as resolve4 } from "node:path";
|
|
291282
291310
|
import { homedir as homedir5, tmpdir as tmpdir2 } from "node:os";
|
|
291283
291311
|
init_cuda_device_filter();
|
|
291284
291312
|
init_process_async();
|
|
@@ -291289,9 +291317,9 @@ init_process_async();
|
|
|
291289
291317
|
|
|
291290
291318
|
// packages/execution/dist/tools/transcribe-tool.js
|
|
291291
291319
|
var MAX_TRANSCRIBE_URL_BYTES = 100 * 1024 * 1024;
|
|
291292
|
-
var MANAGED_ASR_VENV =
|
|
291293
|
-
var MANAGED_TRANSCRIBE_CLI_DIR =
|
|
291294
|
-
var YT_DLP_VENV =
|
|
291320
|
+
var MANAGED_ASR_VENV = join5(homedir5(), ".omnius", "runtimes", "asr", ".venv-whisper");
|
|
291321
|
+
var MANAGED_TRANSCRIBE_CLI_DIR = join5(homedir5(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
|
|
291322
|
+
var YT_DLP_VENV = join5(homedir5(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
291295
291323
|
|
|
291296
291324
|
// packages/execution/dist/tools/safe-math-eval.js
|
|
291297
291325
|
var CONSTANTS = {
|
|
@@ -293034,19 +293062,22 @@ init_process_async();
|
|
|
293034
293062
|
var MAX_IMAGE_BYTES = 8 * 1024 * 1024;
|
|
293035
293063
|
|
|
293036
293064
|
// packages/execution/dist/tools/ocr-image-advanced.js
|
|
293037
|
-
import { resolve as resolve5, basename as basename2, dirname as dirname4, join as join5 } from "node:path";
|
|
293038
293065
|
init_system_deps();
|
|
293039
293066
|
init_venv_paths();
|
|
293040
|
-
|
|
293041
|
-
|
|
293067
|
+
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
|
+
var OCR_PIPELINE_TIMEOUT_MS = 5 * 6e4;
|
|
293042
293073
|
|
|
293043
293074
|
// packages/execution/dist/tools/browser-action.js
|
|
293044
293075
|
init_process_lifecycle();
|
|
293045
|
-
import { copyFileSync, existsSync as
|
|
293046
|
-
import { basename as
|
|
293076
|
+
import { copyFileSync, existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
293077
|
+
import { basename as basename2, dirname as dirname4, join as join6, resolve as resolve5 } from "node:path";
|
|
293047
293078
|
import { fileURLToPath } from "node:url";
|
|
293048
293079
|
init_model_store();
|
|
293049
|
-
var __dirname2 =
|
|
293080
|
+
var __dirname2 = dirname4(fileURLToPath(import.meta.url));
|
|
293050
293081
|
var DEFAULT_PORT = 8130;
|
|
293051
293082
|
function findScrapeScript() {
|
|
293052
293083
|
const candidates = [
|
|
@@ -293059,7 +293090,7 @@ function findScrapeScript() {
|
|
|
293059
293090
|
// Dev monorepo alt: packages/execution/scripts/
|
|
293060
293091
|
join6(__dirname2, "..", "scripts", "web_scrape.py")
|
|
293061
293092
|
];
|
|
293062
|
-
return candidates.find((p) =>
|
|
293093
|
+
return candidates.find((p) => existsSync3(p)) || candidates[0];
|
|
293063
293094
|
}
|
|
293064
293095
|
var SCRAPE_SCRIPT = findScrapeScript();
|
|
293065
293096
|
var BASE_URL = `http://localhost:${DEFAULT_PORT}`;
|
|
@@ -293341,28 +293372,28 @@ var MESH_VENV = "/tmp/mesh-venv";
|
|
|
293341
293372
|
var MESH_CLI = `${MESH_VENV}/bin/meshtastic`;
|
|
293342
293373
|
|
|
293343
293374
|
// packages/execution/dist/tools/audio-analyze.js
|
|
293344
|
-
import { basename as
|
|
293345
|
-
import { homedir as
|
|
293375
|
+
import { basename as basename3, isAbsolute as isAbsolute2, join as join7, resolve as resolve6 } from "node:path";
|
|
293376
|
+
import { homedir as homedir6, tmpdir as tmpdir3 } from "node:os";
|
|
293346
293377
|
init_cuda_device_filter();
|
|
293347
293378
|
init_process_async();
|
|
293348
|
-
var VENV_DIR = join7(
|
|
293379
|
+
var VENV_DIR = join7(homedir6(), ".omnius", "audio-ml-venv");
|
|
293349
293380
|
var VENV_PIP = join7(VENV_DIR, "bin", "pip");
|
|
293350
293381
|
var VENV_PYTHON = join7(VENV_DIR, "bin", "python3");
|
|
293351
293382
|
|
|
293352
293383
|
// packages/execution/dist/tools/visual-memory.js
|
|
293353
293384
|
init_cuda_device_filter();
|
|
293354
293385
|
import { join as join8 } from "node:path";
|
|
293355
|
-
import { homedir as
|
|
293356
|
-
var VMEM_DIR = join8(
|
|
293357
|
-
var VENV_DIR2 = join8(
|
|
293386
|
+
import { homedir as homedir7, tmpdir as tmpdir4 } from "node:os";
|
|
293387
|
+
var VMEM_DIR = join8(homedir7(), ".omnius", "visual-memory");
|
|
293388
|
+
var VENV_DIR2 = join8(homedir7(), ".omnius", "vision-ml-venv");
|
|
293358
293389
|
var VENV_PY = join8(VENV_DIR2, "bin", "python3");
|
|
293359
293390
|
var VENV_PIP2 = join8(VENV_DIR2, "bin", "pip");
|
|
293360
293391
|
|
|
293361
293392
|
// packages/execution/dist/tools/multimodal-memory.js
|
|
293362
293393
|
import { join as join9 } from "node:path";
|
|
293363
|
-
import { homedir as
|
|
293394
|
+
import { homedir as homedir8, tmpdir as tmpdir5 } from "node:os";
|
|
293364
293395
|
init_camera_capture();
|
|
293365
|
-
var MM_DIR = join9(
|
|
293396
|
+
var MM_DIR = join9(homedir8(), ".omnius", "multimodal-episodes");
|
|
293366
293397
|
var MM_INDEX = join9(MM_DIR, "index.json");
|
|
293367
293398
|
|
|
293368
293399
|
// packages/execution/dist/asr/registry.js
|
|
@@ -293627,32 +293658,32 @@ init_secret_quarantine();
|
|
|
293627
293658
|
init_agent_tools();
|
|
293628
293659
|
|
|
293629
293660
|
// packages/execution/dist/tools/video-understand.js
|
|
293630
|
-
import { join as join10, basename as
|
|
293631
|
-
import { homedir as
|
|
293661
|
+
import { join as join10, basename as basename4, isAbsolute as isAbsolute3, resolve as resolve7 } from "node:path";
|
|
293662
|
+
import { homedir as homedir9 } from "node:os";
|
|
293632
293663
|
init_model_broker();
|
|
293633
293664
|
init_vision();
|
|
293634
293665
|
init_process_async();
|
|
293635
293666
|
init_venv_paths();
|
|
293636
|
-
var YT_DLP_VENV2 = join10(
|
|
293667
|
+
var YT_DLP_VENV2 = join10(homedir9(), ".omnius", "runtimes", "media-tools", ".venv-ytdlp");
|
|
293637
293668
|
|
|
293638
293669
|
// packages/execution/dist/tools/video-scan.js
|
|
293639
|
-
import { resolve as
|
|
293640
|
-
import { homedir as
|
|
293641
|
-
var CONFIG_PATH = join11(
|
|
293670
|
+
import { resolve as resolve8, dirname as dirname5, join as join11, basename as basename5 } from "node:path";
|
|
293671
|
+
import { homedir as homedir10 } from "node:os";
|
|
293672
|
+
var CONFIG_PATH = join11(homedir10(), ".omnius", "video-scan.json");
|
|
293642
293673
|
|
|
293643
293674
|
// packages/execution/dist/tools/live-media-loop.js
|
|
293644
293675
|
init_process_async();
|
|
293645
293676
|
init_venv_paths();
|
|
293646
|
-
import { homedir as
|
|
293647
|
-
import { basename as
|
|
293677
|
+
import { homedir as homedir11, tmpdir as tmpdir6 } from "node:os";
|
|
293678
|
+
import { basename as basename6, isAbsolute as isAbsolute4, join as join12, resolve as resolve9 } from "node:path";
|
|
293648
293679
|
init_camera_capture();
|
|
293649
|
-
var LIVE_MEDIA_ROOT = join12(
|
|
293680
|
+
var LIVE_MEDIA_ROOT = join12(homedir11(), ".omnius", "runtimes", "live-media");
|
|
293650
293681
|
var YOLO26_VENV = join12(LIVE_MEDIA_ROOT, ".venv-yolo26");
|
|
293651
293682
|
|
|
293652
293683
|
// packages/execution/dist/tools/lance.js
|
|
293653
|
-
import { resolve as
|
|
293654
|
-
import { homedir as
|
|
293655
|
-
var CONFIG_PATH2 = join13(
|
|
293684
|
+
import { resolve as resolve10, dirname as dirname6, join as join13, basename as basename7 } from "node:path";
|
|
293685
|
+
import { homedir as homedir12 } from "node:os";
|
|
293686
|
+
var CONFIG_PATH2 = join13(homedir12(), ".omnius", "lance.json");
|
|
293656
293687
|
var RUN_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
293657
293688
|
|
|
293658
293689
|
// packages/execution/dist/index.js
|
|
@@ -293662,7 +293693,7 @@ init_system_deps();
|
|
|
293662
293693
|
init_process_kill();
|
|
293663
293694
|
|
|
293664
293695
|
// packages/cli/src/daemon.ts
|
|
293665
|
-
var OMNIUS_DIR = process.env["OMNIUS_HOME"]?.trim() || join14(
|
|
293696
|
+
var OMNIUS_DIR = process.env["OMNIUS_HOME"]?.trim() || join14(homedir13(), ".omnius");
|
|
293666
293697
|
var PID_FILE = join14(OMNIUS_DIR, "daemon.pid");
|
|
293667
293698
|
var DEFAULT_PORT2 = 11435;
|
|
293668
293699
|
var LOCK_INITIALIZATION_GRACE_MS = 5e3;
|
|
@@ -293692,7 +293723,7 @@ function processIsAlive(pid) {
|
|
|
293692
293723
|
}
|
|
293693
293724
|
function readDaemonLock(lockFile) {
|
|
293694
293725
|
try {
|
|
293695
|
-
const value = JSON.parse(
|
|
293726
|
+
const value = JSON.parse(readFileSync5(lockFile, "utf8"));
|
|
293696
293727
|
if (typeof value.endpoint !== "string" || typeof value.pid !== "number" || !Number.isInteger(value.pid) || value.pid <= 0 || typeof value.token !== "string" || typeof value.startedAt !== "number") {
|
|
293697
293728
|
return null;
|
|
293698
293729
|
}
|
|
@@ -293703,7 +293734,7 @@ function readDaemonLock(lockFile) {
|
|
|
293703
293734
|
}
|
|
293704
293735
|
function daemonLockIsInitializing(lockFile) {
|
|
293705
293736
|
try {
|
|
293706
|
-
return Date.now() -
|
|
293737
|
+
return Date.now() - statSync3(lockFile).mtimeMs < LOCK_INITIALIZATION_GRACE_MS;
|
|
293707
293738
|
} catch {
|
|
293708
293739
|
return false;
|
|
293709
293740
|
}
|
|
@@ -293712,7 +293743,7 @@ function newDaemonLockToken() {
|
|
|
293712
293743
|
return `${process.pid}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
293713
293744
|
}
|
|
293714
293745
|
function claimDaemonEndpoint(port = getDaemonPort(), inheritedToken) {
|
|
293715
|
-
|
|
293746
|
+
mkdirSync4(OMNIUS_DIR, { recursive: true });
|
|
293716
293747
|
const endpoint = daemonEndpoint(port);
|
|
293717
293748
|
const lockFile = daemonLockFile(port);
|
|
293718
293749
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -293746,7 +293777,7 @@ function claimDaemonEndpoint(port = getDaemonPort(), inheritedToken) {
|
|
|
293746
293777
|
const existing = readDaemonLock(lockFile);
|
|
293747
293778
|
if (existing?.endpoint === endpoint && inheritedToken && existing.token === inheritedToken) {
|
|
293748
293779
|
const transferred = { ...existing, pid: process.pid, startedAt: Date.now() };
|
|
293749
|
-
|
|
293780
|
+
writeFileSync3(lockFile, JSON.stringify(transferred), { encoding: "utf8", mode: 384 });
|
|
293750
293781
|
return { endpoint, lockFile, pid: process.pid, port, token: inheritedToken };
|
|
293751
293782
|
}
|
|
293752
293783
|
if (existing && processIsAlive(existing.pid) || !existing && daemonLockIsInitializing(lockFile)) {
|
|
@@ -293803,7 +293834,7 @@ async function getDaemonReportedVersion(port) {
|
|
|
293803
293834
|
async function waitForDaemonReady(port, expectedVersion, attempts = 24) {
|
|
293804
293835
|
let observedVersion = null;
|
|
293805
293836
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
293806
|
-
await new Promise((
|
|
293837
|
+
await new Promise((resolve11) => setTimeout(resolve11, 500));
|
|
293807
293838
|
if (!await isDaemonRunning(port)) continue;
|
|
293808
293839
|
observedVersion = await getDaemonReportedVersion(port);
|
|
293809
293840
|
if (!expectedVersion || expectedVersion === "0.0.0" || observedVersion === expectedVersion) {
|
|
@@ -293813,7 +293844,7 @@ async function waitForDaemonReady(port, expectedVersion, attempts = 24) {
|
|
|
293813
293844
|
return { ok: false, observedVersion };
|
|
293814
293845
|
}
|
|
293815
293846
|
function delay(ms) {
|
|
293816
|
-
return new Promise((
|
|
293847
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
293817
293848
|
}
|
|
293818
293849
|
async function runUserSystemctl(args, timeout = 2e4) {
|
|
293819
293850
|
try {
|
|
@@ -293876,7 +293907,7 @@ function pidIsInManagedDaemonUnit(pid, readCgroup = defaultReadProcCgroup) {
|
|
|
293876
293907
|
}
|
|
293877
293908
|
function defaultReadProcCgroup(pid) {
|
|
293878
293909
|
try {
|
|
293879
|
-
return
|
|
293910
|
+
return readFileSync5(`/proc/${pid}/cgroup`, "utf8");
|
|
293880
293911
|
} catch {
|
|
293881
293912
|
return null;
|
|
293882
293913
|
}
|
|
@@ -293899,12 +293930,12 @@ async function repairManagedDaemonUnit(port, preferredEntrypoint) {
|
|
|
293899
293930
|
const command = await resolveDaemonCommand(process.execPath, preferredEntrypoint);
|
|
293900
293931
|
if (!command) return false;
|
|
293901
293932
|
try {
|
|
293902
|
-
const configHome = process.env["XDG_CONFIG_HOME"] || join14(
|
|
293933
|
+
const configHome = process.env["XDG_CONFIG_HOME"] || join14(homedir13(), ".config");
|
|
293903
293934
|
const unitDir = join14(configHome, "systemd", "user");
|
|
293904
293935
|
const unitPath = join14(unitDir, "omnius-daemon.service");
|
|
293905
293936
|
const logDir = join14(OMNIUS_DIR);
|
|
293906
|
-
|
|
293907
|
-
|
|
293937
|
+
mkdirSync4(unitDir, { recursive: true });
|
|
293938
|
+
mkdirSync4(logDir, { recursive: true });
|
|
293908
293939
|
const execStart = [command.command, ...command.args].map(systemdQuote).join(" ");
|
|
293909
293940
|
const unit = [
|
|
293910
293941
|
"[Unit]",
|
|
@@ -293930,8 +293961,8 @@ async function repairManagedDaemonUnit(port, preferredEntrypoint) {
|
|
|
293930
293961
|
""
|
|
293931
293962
|
].join("\n");
|
|
293932
293963
|
const tmp = `${unitPath}.tmp.${process.pid}.${Date.now()}`;
|
|
293933
|
-
|
|
293934
|
-
|
|
293964
|
+
writeFileSync3(tmp, unit, { encoding: "utf8", mode: 384 });
|
|
293965
|
+
renameSync3(tmp, unitPath);
|
|
293935
293966
|
return (await runUserSystemctl(["daemon-reload"], 1e4)).ok;
|
|
293936
293967
|
} catch {
|
|
293937
293968
|
return false;
|
|
@@ -293962,13 +293993,13 @@ ${fuser.stderr ?? ""}`;
|
|
|
293962
293993
|
}
|
|
293963
293994
|
}
|
|
293964
293995
|
async function daemonPortIsFree(port) {
|
|
293965
|
-
return new Promise((
|
|
293996
|
+
return new Promise((resolve11) => {
|
|
293966
293997
|
const probe = createNetServer();
|
|
293967
293998
|
let settled = false;
|
|
293968
293999
|
const finish = (free) => {
|
|
293969
294000
|
if (settled) return;
|
|
293970
294001
|
settled = true;
|
|
293971
|
-
|
|
294002
|
+
resolve11(free);
|
|
293972
294003
|
};
|
|
293973
294004
|
probe.once("error", () => finish(false));
|
|
293974
294005
|
probe.once("listening", () => {
|
|
@@ -294146,7 +294177,7 @@ async function restartDaemon(port, expectedVersion, preferredEntrypoint) {
|
|
|
294146
294177
|
function looksLikeNodeEntrypoint(path) {
|
|
294147
294178
|
if (/\.(?:mjs|cjs|js)$/i.test(path)) return true;
|
|
294148
294179
|
try {
|
|
294149
|
-
const firstBytes =
|
|
294180
|
+
const firstBytes = readFileSync5(path, "utf8").slice(0, 200);
|
|
294150
294181
|
return /^#!.*\bnode\b/.test(firstBytes);
|
|
294151
294182
|
} catch {
|
|
294152
294183
|
return false;
|
|
@@ -294162,7 +294193,7 @@ function commandForEntrypoint(path, nodeExe) {
|
|
|
294162
294193
|
async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
294163
294194
|
const candidates = [];
|
|
294164
294195
|
if (preferredEntrypoint) candidates.push(preferredEntrypoint);
|
|
294165
|
-
const thisDir =
|
|
294196
|
+
const thisDir = dirname7(fileURLToPath2(import.meta.url));
|
|
294166
294197
|
candidates.push(join14(thisDir, "index.js"));
|
|
294167
294198
|
if (process.argv[1]) candidates.push(process.argv[1]);
|
|
294168
294199
|
try {
|
|
@@ -294179,13 +294210,13 @@ async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
|
294179
294210
|
for (const candidate of candidates) {
|
|
294180
294211
|
if (!candidate || seen.has(candidate)) continue;
|
|
294181
294212
|
seen.add(candidate);
|
|
294182
|
-
if (!
|
|
294213
|
+
if (!existsSync5(candidate)) continue;
|
|
294183
294214
|
return commandForEntrypoint(candidate, nodeExe);
|
|
294184
294215
|
}
|
|
294185
294216
|
return null;
|
|
294186
294217
|
}
|
|
294187
294218
|
async function startDaemon(port = getDaemonPort(), preferredEntrypoint) {
|
|
294188
|
-
|
|
294219
|
+
mkdirSync4(OMNIUS_DIR, { recursive: true });
|
|
294189
294220
|
const daemonPort = port;
|
|
294190
294221
|
const endpointClaim = claimDaemonEndpoint(daemonPort);
|
|
294191
294222
|
if (!endpointClaim) return null;
|
|
@@ -294221,7 +294252,7 @@ async function startDaemon(port = getDaemonPort(), preferredEntrypoint) {
|
|
|
294221
294252
|
child.unref();
|
|
294222
294253
|
const pid = child.pid ?? null;
|
|
294223
294254
|
if (pid) {
|
|
294224
|
-
|
|
294255
|
+
writeFileSync3(PID_FILE, String(pid), "utf8");
|
|
294225
294256
|
registerProcessLease({
|
|
294226
294257
|
leaseId,
|
|
294227
294258
|
pid,
|
|
@@ -294279,18 +294310,18 @@ import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypt
|
|
|
294279
294310
|
import {
|
|
294280
294311
|
chmodSync,
|
|
294281
294312
|
closeSync as closeSync2,
|
|
294282
|
-
existsSync as
|
|
294283
|
-
mkdirSync as
|
|
294313
|
+
existsSync as existsSync6,
|
|
294314
|
+
mkdirSync as mkdirSync5,
|
|
294284
294315
|
openSync as openSync2,
|
|
294285
|
-
readFileSync as
|
|
294286
|
-
renameSync as
|
|
294287
|
-
statSync as
|
|
294316
|
+
readFileSync as readFileSync6,
|
|
294317
|
+
renameSync as renameSync4,
|
|
294318
|
+
statSync as statSync4,
|
|
294288
294319
|
unlinkSync as unlinkSync2,
|
|
294289
|
-
writeFileSync as
|
|
294320
|
+
writeFileSync as writeFileSync4,
|
|
294290
294321
|
writeSync as writeSync2
|
|
294291
294322
|
} from "node:fs";
|
|
294292
|
-
import { homedir as
|
|
294293
|
-
import { dirname as
|
|
294323
|
+
import { homedir as homedir14 } from "node:os";
|
|
294324
|
+
import { dirname as dirname8, join as join15 } from "node:path";
|
|
294294
294325
|
|
|
294295
294326
|
// packages/cli/src/service-version.ts
|
|
294296
294327
|
var OmniusVersionError = class extends Error {
|
|
@@ -294346,7 +294377,7 @@ function compareOmniusVersions(left, right) {
|
|
|
294346
294377
|
}
|
|
294347
294378
|
|
|
294348
294379
|
// packages/cli/src/update-service.ts
|
|
294349
|
-
function resolveUpdatePaths(env = process.env, platform2 = process.platform, home =
|
|
294380
|
+
function resolveUpdatePaths(env = process.env, platform2 = process.platform, home = homedir14()) {
|
|
294350
294381
|
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join15(home, "AppData", "Local") : platform2 === "darwin" ? join15(home, "Library", "Application Support") : env["XDG_STATE_HOME"] || join15(home, ".local", "state");
|
|
294351
294382
|
const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join15(home, "AppData", "Local") : platform2 === "darwin" ? join15(home, "Library", "Caches") : env["XDG_CACHE_HOME"] || join15(home, ".cache");
|
|
294352
294383
|
const stateDir = join15(stateBase, platform2 === "win32" ? "Omnius" : "omnius", "update");
|
|
@@ -294360,8 +294391,8 @@ function resolveUpdatePaths(env = process.env, platform2 = process.platform, hom
|
|
|
294360
294391
|
};
|
|
294361
294392
|
}
|
|
294362
294393
|
function ensurePrivateDirectories(paths) {
|
|
294363
|
-
|
|
294364
|
-
|
|
294394
|
+
mkdirSync5(paths.stateDir, { recursive: true, mode: 448 });
|
|
294395
|
+
mkdirSync5(paths.cacheDir, { recursive: true, mode: 448 });
|
|
294365
294396
|
try {
|
|
294366
294397
|
chmodSync(paths.stateDir, 448);
|
|
294367
294398
|
} catch {
|
|
@@ -294374,27 +294405,27 @@ function ensurePrivateDirectories(paths) {
|
|
|
294374
294405
|
function atomicPrivateJson(path, value) {
|
|
294375
294406
|
const temp = `${path}.${process.pid}.${randomUUID2()}.tmp`;
|
|
294376
294407
|
try {
|
|
294377
|
-
|
|
294408
|
+
writeFileSync4(temp, `${JSON.stringify(value, null, 2)}
|
|
294378
294409
|
`, {
|
|
294379
294410
|
encoding: "utf8",
|
|
294380
294411
|
mode: 384,
|
|
294381
294412
|
flag: "wx"
|
|
294382
294413
|
});
|
|
294383
|
-
|
|
294414
|
+
renameSync4(temp, path);
|
|
294384
294415
|
try {
|
|
294385
294416
|
chmodSync(path, 384);
|
|
294386
294417
|
} catch {
|
|
294387
294418
|
}
|
|
294388
294419
|
} finally {
|
|
294389
294420
|
try {
|
|
294390
|
-
if (
|
|
294421
|
+
if (existsSync6(temp)) unlinkSync2(temp);
|
|
294391
294422
|
} catch {
|
|
294392
294423
|
}
|
|
294393
294424
|
}
|
|
294394
294425
|
}
|
|
294395
294426
|
function readUpdateState(paths = resolveUpdatePaths()) {
|
|
294396
294427
|
try {
|
|
294397
|
-
return JSON.parse(
|
|
294428
|
+
return JSON.parse(readFileSync6(paths.stateFile, "utf8"));
|
|
294398
294429
|
} catch {
|
|
294399
294430
|
return null;
|
|
294400
294431
|
}
|
|
@@ -294419,7 +294450,7 @@ function adoptUpdateWorker(operationId, pid, paths = resolveUpdatePaths()) {
|
|
|
294419
294450
|
function releaseUpdateLock(paths = resolveUpdatePaths(), operationId) {
|
|
294420
294451
|
try {
|
|
294421
294452
|
if (operationId) {
|
|
294422
|
-
const lock = JSON.parse(
|
|
294453
|
+
const lock = JSON.parse(readFileSync6(paths.lockFile, "utf8"));
|
|
294423
294454
|
if (lock.operation_id !== operationId) return;
|
|
294424
294455
|
}
|
|
294425
294456
|
unlinkSync2(paths.lockFile);
|
|
@@ -294437,11 +294468,11 @@ function assertExactUpdateTarget(targetVersion, fromVersion) {
|
|
|
294437
294468
|
return target;
|
|
294438
294469
|
}
|
|
294439
294470
|
function npmCandidates(execPath = process.execPath) {
|
|
294440
|
-
const nodeDir =
|
|
294471
|
+
const nodeDir = dirname8(execPath);
|
|
294441
294472
|
return process.platform === "win32" ? [join15(nodeDir, "npm.cmd"), join15(nodeDir, "npm.exe"), "npm.cmd", "npm"] : [join15(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm", "npm"];
|
|
294442
294473
|
}
|
|
294443
294474
|
function runnableCommand(candidate) {
|
|
294444
|
-
return candidate.includes("/") || candidate.includes("\\") ?
|
|
294475
|
+
return candidate.includes("/") || candidate.includes("\\") ? existsSync6(candidate) : true;
|
|
294445
294476
|
}
|
|
294446
294477
|
function resolveNpmPath(execPath = process.execPath) {
|
|
294447
294478
|
const candidate = npmCandidates(execPath).find(runnableCommand);
|
|
@@ -294474,14 +294505,14 @@ function inspectGlobalOmniusInstall(expectedVersion, options = {}) {
|
|
|
294474
294505
|
throw new Error(`Could not resolve npm global prefix: ${prefixResult.stderr.trim() || "npm prefix -g failed"}`);
|
|
294475
294506
|
}
|
|
294476
294507
|
const npmPrefix = prefixResult.stdout.trim();
|
|
294477
|
-
const packageJsonPath = globalPackageCandidates(npmPrefix).find(
|
|
294508
|
+
const packageJsonPath = globalPackageCandidates(npmPrefix).find(existsSync6);
|
|
294478
294509
|
if (!packageJsonPath) throw new Error(`Global omnius package.json not found under ${npmPrefix}`);
|
|
294479
|
-
const packageJsonRaw =
|
|
294510
|
+
const packageJsonRaw = readFileSync6(packageJsonPath, "utf8");
|
|
294480
294511
|
const installedVersion = String(JSON.parse(packageJsonRaw)?.version ?? "");
|
|
294481
294512
|
if (installedVersion !== expectedVersion) {
|
|
294482
294513
|
throw new Error(`Global package verification failed: expected ${expectedVersion}, found ${installedVersion || "unknown"}`);
|
|
294483
294514
|
}
|
|
294484
|
-
const executablePath = globalExecutableCandidates(npmPrefix).find(
|
|
294515
|
+
const executablePath = globalExecutableCandidates(npmPrefix).find(existsSync6);
|
|
294485
294516
|
if (!executablePath) throw new Error(`Global Omnius executable not found under ${npmPrefix}`);
|
|
294486
294517
|
const versionResult = runSync(executablePath, ["--version"], { env: options.env, timeout: 1e4 });
|
|
294487
294518
|
const executableVersion = commandVersion(`${versionResult.stdout}
|
|
@@ -294510,7 +294541,7 @@ function permissionRemediation(evidence) {
|
|
|
294510
294541
|
return /EACCES|EPERM|permission denied/i.test(evidence) ? "The discovered npm global prefix is not writable. Configure a user-owned npm prefix or rerun the explicit update from a privileged terminal; Omnius never silently elevates." : void 0;
|
|
294511
294542
|
}
|
|
294512
294543
|
function installGlobalPackageStreaming(input) {
|
|
294513
|
-
return new Promise((
|
|
294544
|
+
return new Promise((resolve11) => {
|
|
294514
294545
|
const stderrTail = [];
|
|
294515
294546
|
let settled = false;
|
|
294516
294547
|
let timedOut = false;
|
|
@@ -294518,7 +294549,7 @@ function installGlobalPackageStreaming(input) {
|
|
|
294518
294549
|
if (settled) return;
|
|
294519
294550
|
settled = true;
|
|
294520
294551
|
clearTimeout(timer);
|
|
294521
|
-
|
|
294552
|
+
resolve11({ exitCode, ...error ? { error } : {} });
|
|
294522
294553
|
};
|
|
294523
294554
|
const child = spawn2(
|
|
294524
294555
|
input.npmPath,
|
|
@@ -294578,7 +294609,7 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
294578
294609
|
const npmPath = resolveNpmPath();
|
|
294579
294610
|
const env = {
|
|
294580
294611
|
...process.env,
|
|
294581
|
-
PATH: [
|
|
294612
|
+
PATH: [dirname8(process.execPath), process.env.PATH ?? ""].filter(Boolean).join(process.platform === "win32" ? ";" : ":"),
|
|
294582
294613
|
NPM_CONFIG_CACHE: paths.cacheDir,
|
|
294583
294614
|
npm_config_cache: paths.cacheDir,
|
|
294584
294615
|
npm_config_prefer_online: "true",
|
|
@@ -294625,7 +294656,7 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
294625
294656
|
if (daemon?.bootVersion === target && daemon.bootPackageHash === evidence.packageHash) {
|
|
294626
294657
|
break;
|
|
294627
294658
|
}
|
|
294628
|
-
if (attempt < 3) await new Promise((
|
|
294659
|
+
if (attempt < 3) await new Promise((resolve11) => setTimeout(resolve11, 1e3));
|
|
294629
294660
|
}
|
|
294630
294661
|
if (!daemon || daemon.bootVersion !== target) {
|
|
294631
294662
|
const observed = daemon?.bootVersion ?? "unreachable";
|
|
@@ -294692,18 +294723,18 @@ import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
|
294692
294723
|
import {
|
|
294693
294724
|
closeSync as closeSync3,
|
|
294694
294725
|
chmodSync as chmodSync2,
|
|
294695
|
-
existsSync as
|
|
294696
|
-
mkdirSync as
|
|
294726
|
+
existsSync as existsSync7,
|
|
294727
|
+
mkdirSync as mkdirSync6,
|
|
294697
294728
|
openSync as openSync3,
|
|
294698
|
-
readFileSync as
|
|
294729
|
+
readFileSync as readFileSync7,
|
|
294699
294730
|
realpathSync,
|
|
294700
|
-
renameSync as
|
|
294731
|
+
renameSync as renameSync5,
|
|
294701
294732
|
unlinkSync as unlinkSync3,
|
|
294702
|
-
writeFileSync as
|
|
294733
|
+
writeFileSync as writeFileSync5,
|
|
294703
294734
|
writeSync as writeSync3
|
|
294704
294735
|
} from "node:fs";
|
|
294705
|
-
import { homedir as
|
|
294706
|
-
import { basename as
|
|
294736
|
+
import { homedir as homedir15, tmpdir as tmpdir7 } from "node:os";
|
|
294737
|
+
import { basename as basename8, dirname as dirname9, join as join17 } from "node:path";
|
|
294707
294738
|
|
|
294708
294739
|
// packages/cli/src/updater.ts
|
|
294709
294740
|
import { join as join16 } from "node:path";
|
|
@@ -294716,8 +294747,8 @@ var DEFAULT_ENDPOINT = "http://127.0.0.1:11435";
|
|
|
294716
294747
|
function uidSuffix() {
|
|
294717
294748
|
return typeof process.getuid === "function" ? String(process.getuid()) : "user";
|
|
294718
294749
|
}
|
|
294719
|
-
function resolveTrayPaths(env = process.env, platform2 = process.platform, home =
|
|
294720
|
-
const runtimeBase = env["XDG_RUNTIME_DIR"] || join17(
|
|
294750
|
+
function resolveTrayPaths(env = process.env, platform2 = process.platform, home = homedir15()) {
|
|
294751
|
+
const runtimeBase = env["XDG_RUNTIME_DIR"] || join17(tmpdir7(), `omnius-${uidSuffix()}`);
|
|
294721
294752
|
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join17(home, "AppData", "Local") : env["XDG_STATE_HOME"] || join17(home, ".local", "state");
|
|
294722
294753
|
const configBase = platform2 === "win32" ? env["APPDATA"] || join17(home, "AppData", "Roaming") : env["XDG_CONFIG_HOME"] || join17(home, ".config");
|
|
294723
294754
|
const runtimeDir = join17(runtimeBase, "omnius");
|
|
@@ -294803,7 +294834,7 @@ function isProcessAlive2(pid) {
|
|
|
294803
294834
|
}
|
|
294804
294835
|
function readPid(path) {
|
|
294805
294836
|
try {
|
|
294806
|
-
const pid = Number(
|
|
294837
|
+
const pid = Number(readFileSync7(path, "utf8").trim());
|
|
294807
294838
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
294808
294839
|
} catch {
|
|
294809
294840
|
return null;
|
|
@@ -294811,7 +294842,7 @@ function readPid(path) {
|
|
|
294811
294842
|
}
|
|
294812
294843
|
function readProcessState(path) {
|
|
294813
294844
|
try {
|
|
294814
|
-
return JSON.parse(
|
|
294845
|
+
return JSON.parse(readFileSync7(path, "utf8"));
|
|
294815
294846
|
} catch {
|
|
294816
294847
|
return null;
|
|
294817
294848
|
}
|
|
@@ -294819,7 +294850,7 @@ function readProcessState(path) {
|
|
|
294819
294850
|
function processCommandLine(pid) {
|
|
294820
294851
|
try {
|
|
294821
294852
|
if (process.platform === "linux") {
|
|
294822
|
-
return
|
|
294853
|
+
return readFileSync7(`/proc/${pid}/cmdline`, "utf8").replace(/\0/g, " ");
|
|
294823
294854
|
}
|
|
294824
294855
|
if (process.platform !== "win32") {
|
|
294825
294856
|
return spawnSync2("ps", ["-p", String(pid), "-o", "command="], {
|
|
@@ -294861,7 +294892,7 @@ async function getTrayStatus(explicitEndpoint) {
|
|
|
294861
294892
|
// requested endpoint. This previously kept resurrecting an obsolete
|
|
294862
294893
|
// custom port (for example 11535) after the daemon had returned to 11435.
|
|
294863
294894
|
endpoint: running || !explicitEndpoint ? state?.endpoint || requestedEndpoint : requestedEndpoint,
|
|
294864
|
-
registered:
|
|
294895
|
+
registered: existsSync7(paths.autostartFile),
|
|
294865
294896
|
registrationFile: paths.autostartFile,
|
|
294866
294897
|
...state?.health ? { health: state.health } : {},
|
|
294867
294898
|
supported: support.supported,
|
|
@@ -294904,7 +294935,7 @@ async function stopTray() {
|
|
|
294904
294935
|
}
|
|
294905
294936
|
return true;
|
|
294906
294937
|
}
|
|
294907
|
-
await new Promise((
|
|
294938
|
+
await new Promise((resolve11) => setTimeout(resolve11, 100));
|
|
294908
294939
|
}
|
|
294909
294940
|
if (!trayProcessCommandLooksOwned(processCommandLine(pid))) return false;
|
|
294910
294941
|
try {
|
|
@@ -294923,7 +294954,7 @@ async function stopTray() {
|
|
|
294923
294954
|
}
|
|
294924
294955
|
return true;
|
|
294925
294956
|
}
|
|
294926
|
-
await new Promise((
|
|
294957
|
+
await new Promise((resolve11) => setTimeout(resolve11, 100));
|
|
294927
294958
|
}
|
|
294928
294959
|
return false;
|
|
294929
294960
|
}
|
|
@@ -294947,7 +294978,7 @@ function pathsFromEnvironment() {
|
|
|
294947
294978
|
}
|
|
294948
294979
|
async function restartTrayWithInstalledExecutable(executable, endpoint) {
|
|
294949
294980
|
await stopTray();
|
|
294950
|
-
const launched = await new Promise((
|
|
294981
|
+
const launched = await new Promise((resolve11) => {
|
|
294951
294982
|
const child = spawn4(executable, ["tray", "start", "--endpoint", endpoint], {
|
|
294952
294983
|
stdio: "ignore",
|
|
294953
294984
|
windowsHide: true
|
|
@@ -294958,22 +294989,22 @@ async function restartTrayWithInstalledExecutable(executable, endpoint) {
|
|
|
294958
294989
|
} catch {
|
|
294959
294990
|
}
|
|
294960
294991
|
;
|
|
294961
|
-
|
|
294992
|
+
resolve11(false);
|
|
294962
294993
|
}, 15e3);
|
|
294963
294994
|
child.once("error", () => {
|
|
294964
294995
|
clearTimeout(timer);
|
|
294965
|
-
|
|
294996
|
+
resolve11(false);
|
|
294966
294997
|
});
|
|
294967
294998
|
child.once("close", (code) => {
|
|
294968
294999
|
clearTimeout(timer);
|
|
294969
|
-
|
|
295000
|
+
resolve11(code === 0);
|
|
294970
295001
|
});
|
|
294971
295002
|
});
|
|
294972
295003
|
if (!launched) return false;
|
|
294973
295004
|
for (let attempt = 0; attempt < 30; attempt++) {
|
|
294974
295005
|
const status = await getTrayStatus(endpoint);
|
|
294975
295006
|
if (status.running && status.ready && status.endpoint === endpoint) return true;
|
|
294976
|
-
await new Promise((
|
|
295007
|
+
await new Promise((resolve11) => setTimeout(resolve11, 250));
|
|
294977
295008
|
}
|
|
294978
295009
|
return false;
|
|
294979
295010
|
}
|