omnius 1.0.145 → 1.0.147
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 +974 -591
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1421,8 +1421,8 @@ async function vramSnapshotPerDevice() {
|
|
|
1421
1421
|
if (_nvSmiAvailable === false)
|
|
1422
1422
|
return [];
|
|
1423
1423
|
try {
|
|
1424
|
-
const out = await new Promise((
|
|
1425
|
-
exec("nvidia-smi --query-gpu=index,uuid,memory.total,memory.used,memory.free --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) :
|
|
1424
|
+
const out = await new Promise((resolve56, reject) => {
|
|
1425
|
+
exec("nvidia-smi --query-gpu=index,uuid,memory.total,memory.used,memory.free --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve56(stdout));
|
|
1426
1426
|
});
|
|
1427
1427
|
_nvSmiAvailable = true;
|
|
1428
1428
|
const devices = [];
|
|
@@ -2174,7 +2174,7 @@ var init_model_broker = __esm({
|
|
|
2174
2174
|
this._reservedBySession.set(spec.sessionKey, slot.info.id);
|
|
2175
2175
|
return Promise.resolve(slot);
|
|
2176
2176
|
}
|
|
2177
|
-
return new Promise((
|
|
2177
|
+
return new Promise((resolve56, reject) => {
|
|
2178
2178
|
if (this._slotQueue.length >= this.queueCapacity) {
|
|
2179
2179
|
const newPrio = spec.priority ?? 0;
|
|
2180
2180
|
let victim = -1;
|
|
@@ -2202,7 +2202,7 @@ var init_model_broker = __esm({
|
|
|
2202
2202
|
return;
|
|
2203
2203
|
}
|
|
2204
2204
|
}
|
|
2205
|
-
const entry = { spec, resolve:
|
|
2205
|
+
const entry = { spec, resolve: resolve56, reject, enqueuedAt: Date.now() };
|
|
2206
2206
|
if (spec.signal) {
|
|
2207
2207
|
const onAbort = () => {
|
|
2208
2208
|
const idx = this._slotQueue.indexOf(entry);
|
|
@@ -4322,8 +4322,8 @@ var init_shell = __esm({
|
|
|
4322
4322
|
yield pending2.shift();
|
|
4323
4323
|
continue;
|
|
4324
4324
|
}
|
|
4325
|
-
await new Promise((
|
|
4326
|
-
wake =
|
|
4325
|
+
await new Promise((resolve56) => {
|
|
4326
|
+
wake = resolve56;
|
|
4327
4327
|
});
|
|
4328
4328
|
}
|
|
4329
4329
|
if (finalError)
|
|
@@ -4415,7 +4415,7 @@ exit $__omnius_exit
|
|
|
4415
4415
|
}
|
|
4416
4416
|
const shellBin = isWin2 ? "cmd.exe" : "bash";
|
|
4417
4417
|
const shellArgs = isWin2 ? ["/d", "/s", "/c", wrappedCommand] : ["-c", wrappedCommand];
|
|
4418
|
-
return new Promise((
|
|
4418
|
+
return new Promise((resolve56) => {
|
|
4419
4419
|
const child = spawn(shellBin, shellArgs, {
|
|
4420
4420
|
cwd: this.currentCwd,
|
|
4421
4421
|
env: {
|
|
@@ -4471,7 +4471,7 @@ exit $__omnius_exit
|
|
|
4471
4471
|
if (exitFlushTimer)
|
|
4472
4472
|
clearTimeout(exitFlushTimer);
|
|
4473
4473
|
captureFinalCwd();
|
|
4474
|
-
|
|
4474
|
+
resolve56(result);
|
|
4475
4475
|
};
|
|
4476
4476
|
const timer = setTimeout(() => {
|
|
4477
4477
|
killed = true;
|
|
@@ -6948,7 +6948,7 @@ ${JSON.stringify(extracted, null, 2)}`);
|
|
|
6948
6948
|
return null;
|
|
6949
6949
|
}
|
|
6950
6950
|
runProcess(cmd, args, timeoutMs) {
|
|
6951
|
-
return new Promise((
|
|
6951
|
+
return new Promise((resolve56, reject) => {
|
|
6952
6952
|
const proc = execFile3(cmd, args, {
|
|
6953
6953
|
timeout: timeoutMs,
|
|
6954
6954
|
maxBuffer: 10 * 1024 * 1024,
|
|
@@ -6958,7 +6958,7 @@ ${JSON.stringify(extracted, null, 2)}`);
|
|
|
6958
6958
|
reject(new Error(`Process timeout after ${timeoutMs}ms`));
|
|
6959
6959
|
return;
|
|
6960
6960
|
}
|
|
6961
|
-
|
|
6961
|
+
resolve56({
|
|
6962
6962
|
stdout: String(stdout),
|
|
6963
6963
|
stderr: String(stderr),
|
|
6964
6964
|
exitCode: error ? error.code ?? 1 : 0
|
|
@@ -7978,7 +7978,7 @@ function findPython() {
|
|
|
7978
7978
|
}
|
|
7979
7979
|
function runCarbonylPython(args, timeoutMs) {
|
|
7980
7980
|
const py = venvPython(CARBONYL_VENV);
|
|
7981
|
-
return new Promise((
|
|
7981
|
+
return new Promise((resolve56, reject) => {
|
|
7982
7982
|
const child = spawn2(py, ["-c", CARBONYL_DRIVER_PY], {
|
|
7983
7983
|
stdio: ["pipe", "pipe", "pipe"],
|
|
7984
7984
|
env: { ...process.env, PYTHONUNBUFFERED: "1" }
|
|
@@ -8006,7 +8006,7 @@ function runCarbonylPython(args, timeoutMs) {
|
|
|
8006
8006
|
clearTimeout(timer);
|
|
8007
8007
|
const text = stdout.trim().split("\n").pop() ?? "";
|
|
8008
8008
|
try {
|
|
8009
|
-
|
|
8009
|
+
resolve56(JSON.parse(text));
|
|
8010
8010
|
} catch {
|
|
8011
8011
|
reject(new Error((stderr || stdout || "carbonyl_browser returned no JSON").slice(0, 2e3)));
|
|
8012
8012
|
}
|
|
@@ -8828,8 +8828,8 @@ async function withTopicLock(topicFile, fn) {
|
|
|
8828
8828
|
const prev = _writeLocks.get(topicFile) ?? Promise.resolve();
|
|
8829
8829
|
let release = () => {
|
|
8830
8830
|
};
|
|
8831
|
-
const current = new Promise((
|
|
8832
|
-
release =
|
|
8831
|
+
const current = new Promise((resolve56) => {
|
|
8832
|
+
release = resolve56;
|
|
8833
8833
|
});
|
|
8834
8834
|
_writeLocks.set(topicFile, prev.then(() => current));
|
|
8835
8835
|
try {
|
|
@@ -19266,7 +19266,7 @@ var init_custom_tool = __esm({
|
|
|
19266
19266
|
}
|
|
19267
19267
|
/** Execute a single shell command and return output */
|
|
19268
19268
|
runCommand(command) {
|
|
19269
|
-
return new Promise((
|
|
19269
|
+
return new Promise((resolve56) => {
|
|
19270
19270
|
const child = spawn5("bash", ["-c", command], {
|
|
19271
19271
|
cwd: this.workingDir,
|
|
19272
19272
|
env: { ...process.env, CI: "true", NO_COLOR: "1" },
|
|
@@ -19291,11 +19291,11 @@ var init_custom_tool = __esm({
|
|
|
19291
19291
|
child.kill("SIGTERM");
|
|
19292
19292
|
} catch {
|
|
19293
19293
|
}
|
|
19294
|
-
|
|
19294
|
+
resolve56({ success: false, output: stdout, error: "Command timed out after 60s" });
|
|
19295
19295
|
}, 6e4);
|
|
19296
19296
|
child.on("close", (code8) => {
|
|
19297
19297
|
clearTimeout(timer);
|
|
19298
|
-
|
|
19298
|
+
resolve56({
|
|
19299
19299
|
success: code8 === 0,
|
|
19300
19300
|
output: stdout + (stderr && code8 === 0 ? `
|
|
19301
19301
|
STDERR:
|
|
@@ -19305,7 +19305,7 @@ ${stderr}` : ""),
|
|
|
19305
19305
|
});
|
|
19306
19306
|
child.on("error", (err) => {
|
|
19307
19307
|
clearTimeout(timer);
|
|
19308
|
-
|
|
19308
|
+
resolve56({ success: false, output: stdout, error: err.message });
|
|
19309
19309
|
});
|
|
19310
19310
|
});
|
|
19311
19311
|
}
|
|
@@ -21427,7 +21427,7 @@ import { writeFile as writeFile9, mkdtemp, rm as rm2, readdir as readdir4, stat
|
|
|
21427
21427
|
import { join as join30 } from "node:path";
|
|
21428
21428
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
21429
21429
|
function runProcess(cmd, args, options2) {
|
|
21430
|
-
return new Promise((
|
|
21430
|
+
return new Promise((resolve56) => {
|
|
21431
21431
|
const proc = spawn6(cmd, args, {
|
|
21432
21432
|
cwd: options2.cwd,
|
|
21433
21433
|
timeout: options2.timeout,
|
|
@@ -21459,7 +21459,7 @@ function runProcess(cmd, args, options2) {
|
|
|
21459
21459
|
proc.on("error", (err) => {
|
|
21460
21460
|
const errCode2 = err.code || "";
|
|
21461
21461
|
const reason = errCode2 === "ENOENT" ? `interpreter "${cmd}" not found in PATH — install it or use a different language` : errCode2 === "EACCES" ? `interpreter "${cmd}" exists but is not executable (check permissions)` : err.message;
|
|
21462
|
-
|
|
21462
|
+
resolve56({
|
|
21463
21463
|
stdout,
|
|
21464
21464
|
stderr: stderr || `[spawn error] ${reason}`,
|
|
21465
21465
|
exitCode: 1,
|
|
@@ -21471,7 +21471,7 @@ function runProcess(cmd, args, options2) {
|
|
|
21471
21471
|
if (signal === "SIGTERM" || signal === "SIGKILL") {
|
|
21472
21472
|
timedOut = true;
|
|
21473
21473
|
}
|
|
21474
|
-
|
|
21474
|
+
resolve56({
|
|
21475
21475
|
stdout,
|
|
21476
21476
|
stderr,
|
|
21477
21477
|
exitCode: code8 ?? (timedOut ? 124 : 1),
|
|
@@ -31517,8 +31517,8 @@ var init_multiaddr = __esm({
|
|
|
31517
31517
|
// ../node_modules/p-defer/index.js
|
|
31518
31518
|
function pDefer() {
|
|
31519
31519
|
const deferred = {};
|
|
31520
|
-
deferred.promise = new Promise((
|
|
31521
|
-
deferred.resolve =
|
|
31520
|
+
deferred.promise = new Promise((resolve56, reject) => {
|
|
31521
|
+
deferred.resolve = resolve56;
|
|
31522
31522
|
deferred.reject = reject;
|
|
31523
31523
|
});
|
|
31524
31524
|
return deferred;
|
|
@@ -31650,12 +31650,12 @@ function _pushable(getNext, options2) {
|
|
|
31650
31650
|
if (ended) {
|
|
31651
31651
|
return { done: true };
|
|
31652
31652
|
}
|
|
31653
|
-
return await new Promise((
|
|
31653
|
+
return await new Promise((resolve56, reject) => {
|
|
31654
31654
|
onNext = (next) => {
|
|
31655
31655
|
onNext = null;
|
|
31656
31656
|
buffer2.push(next);
|
|
31657
31657
|
try {
|
|
31658
|
-
|
|
31658
|
+
resolve56(getNext(buffer2));
|
|
31659
31659
|
} catch (err) {
|
|
31660
31660
|
reject(err);
|
|
31661
31661
|
}
|
|
@@ -31731,7 +31731,7 @@ function _pushable(getNext, options2) {
|
|
|
31731
31731
|
let cancel;
|
|
31732
31732
|
let listener;
|
|
31733
31733
|
if (signal != null) {
|
|
31734
|
-
cancel = new Promise((
|
|
31734
|
+
cancel = new Promise((resolve56, reject) => {
|
|
31735
31735
|
listener = () => {
|
|
31736
31736
|
reject(new AbortError2());
|
|
31737
31737
|
};
|
|
@@ -31823,7 +31823,7 @@ function pTimeout(promise, options2) {
|
|
|
31823
31823
|
} = options2;
|
|
31824
31824
|
let timer;
|
|
31825
31825
|
let abortHandler;
|
|
31826
|
-
const wrappedPromise = new Promise((
|
|
31826
|
+
const wrappedPromise = new Promise((resolve56, reject) => {
|
|
31827
31827
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
31828
31828
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
31829
31829
|
}
|
|
@@ -31837,7 +31837,7 @@ function pTimeout(promise, options2) {
|
|
|
31837
31837
|
};
|
|
31838
31838
|
signal.addEventListener("abort", abortHandler, { once: true });
|
|
31839
31839
|
}
|
|
31840
|
-
promise.then(
|
|
31840
|
+
promise.then(resolve56, reject);
|
|
31841
31841
|
if (milliseconds === Number.POSITIVE_INFINITY) {
|
|
31842
31842
|
return;
|
|
31843
31843
|
}
|
|
@@ -31845,7 +31845,7 @@ function pTimeout(promise, options2) {
|
|
|
31845
31845
|
timer = customTimers.setTimeout.call(void 0, () => {
|
|
31846
31846
|
if (fallback) {
|
|
31847
31847
|
try {
|
|
31848
|
-
|
|
31848
|
+
resolve56(fallback());
|
|
31849
31849
|
} catch (error) {
|
|
31850
31850
|
reject(error);
|
|
31851
31851
|
}
|
|
@@ -31855,7 +31855,7 @@ function pTimeout(promise, options2) {
|
|
|
31855
31855
|
promise.cancel();
|
|
31856
31856
|
}
|
|
31857
31857
|
if (message2 === false) {
|
|
31858
|
-
|
|
31858
|
+
resolve56();
|
|
31859
31859
|
} else if (message2 instanceof Error) {
|
|
31860
31860
|
reject(message2);
|
|
31861
31861
|
} else {
|
|
@@ -31893,7 +31893,7 @@ var init_p_timeout = __esm({
|
|
|
31893
31893
|
// ../node_modules/p-event/index.js
|
|
31894
31894
|
function pEventMultiple(emitter, event, options2) {
|
|
31895
31895
|
let cancel;
|
|
31896
|
-
const returnValue = new Promise((
|
|
31896
|
+
const returnValue = new Promise((resolve56, reject) => {
|
|
31897
31897
|
options2 = {
|
|
31898
31898
|
rejectionEvents: ["error"],
|
|
31899
31899
|
multiArgs: false,
|
|
@@ -31924,7 +31924,7 @@ function pEventMultiple(emitter, event, options2) {
|
|
|
31924
31924
|
items.push(value2);
|
|
31925
31925
|
if (options2.count === items.length) {
|
|
31926
31926
|
cancel();
|
|
31927
|
-
|
|
31927
|
+
resolve56(items);
|
|
31928
31928
|
}
|
|
31929
31929
|
};
|
|
31930
31930
|
const rejectHandler = (...arguments_) => {
|
|
@@ -31955,7 +31955,7 @@ function pEventMultiple(emitter, event, options2) {
|
|
|
31955
31955
|
}, { once: true });
|
|
31956
31956
|
}
|
|
31957
31957
|
if (options2.resolveImmediately) {
|
|
31958
|
-
|
|
31958
|
+
resolve56(items);
|
|
31959
31959
|
}
|
|
31960
31960
|
});
|
|
31961
31961
|
returnValue.cancel = cancel;
|
|
@@ -32082,7 +32082,7 @@ async function raceSignal(promise, signal, opts) {
|
|
|
32082
32082
|
try {
|
|
32083
32083
|
return await Promise.race([
|
|
32084
32084
|
promise,
|
|
32085
|
-
new Promise((
|
|
32085
|
+
new Promise((resolve56, reject) => {
|
|
32086
32086
|
listener = () => {
|
|
32087
32087
|
reject(translateError(signal));
|
|
32088
32088
|
};
|
|
@@ -37815,10 +37815,10 @@ function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}
|
|
|
37815
37815
|
signal.removeEventListener("abort", signalListener);
|
|
37816
37816
|
}
|
|
37817
37817
|
};
|
|
37818
|
-
const delayPromise = new Promise((
|
|
37818
|
+
const delayPromise = new Promise((resolve56, reject) => {
|
|
37819
37819
|
settle = () => {
|
|
37820
37820
|
cleanup();
|
|
37821
|
-
|
|
37821
|
+
resolve56(value2);
|
|
37822
37822
|
};
|
|
37823
37823
|
rejectFunction = reject;
|
|
37824
37824
|
timeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);
|
|
@@ -39283,7 +39283,7 @@ async function raceEvent(emitter, eventName, signal, opts) {
|
|
|
39283
39283
|
if (signal?.aborted === true) {
|
|
39284
39284
|
return Promise.reject(error);
|
|
39285
39285
|
}
|
|
39286
|
-
return new Promise((
|
|
39286
|
+
return new Promise((resolve56, reject) => {
|
|
39287
39287
|
function removeListeners() {
|
|
39288
39288
|
removeListener(signal, "abort", abortListener);
|
|
39289
39289
|
removeListener(emitter, eventName, eventListener);
|
|
@@ -39300,7 +39300,7 @@ async function raceEvent(emitter, eventName, signal, opts) {
|
|
|
39300
39300
|
return;
|
|
39301
39301
|
}
|
|
39302
39302
|
removeListeners();
|
|
39303
|
-
|
|
39303
|
+
resolve56(evt);
|
|
39304
39304
|
};
|
|
39305
39305
|
const errorEventListener = (evt) => {
|
|
39306
39306
|
removeListeners();
|
|
@@ -39807,7 +39807,7 @@ var init_channel = __esm({
|
|
|
39807
39807
|
name: requestEvent.name,
|
|
39808
39808
|
identifier: requestEvent.identifier
|
|
39809
39809
|
});
|
|
39810
|
-
await new Promise((
|
|
39810
|
+
await new Promise((resolve56) => {
|
|
39811
39811
|
const releaseEventListener = (event2) => {
|
|
39812
39812
|
if (event2?.data == null) {
|
|
39813
39813
|
return;
|
|
@@ -39819,7 +39819,7 @@ var init_channel = __esm({
|
|
|
39819
39819
|
};
|
|
39820
39820
|
if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {
|
|
39821
39821
|
channel.removeEventListener("message", releaseEventListener);
|
|
39822
|
-
|
|
39822
|
+
resolve56();
|
|
39823
39823
|
}
|
|
39824
39824
|
};
|
|
39825
39825
|
channel.addEventListener("message", releaseEventListener);
|
|
@@ -39881,11 +39881,11 @@ var init_cluster = __esm({
|
|
|
39881
39881
|
name: requestEvent.name,
|
|
39882
39882
|
identifier: requestEvent.identifier
|
|
39883
39883
|
});
|
|
39884
|
-
await new Promise((
|
|
39884
|
+
await new Promise((resolve56) => {
|
|
39885
39885
|
const releaseEventListener = (releaseEvent) => {
|
|
39886
39886
|
if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {
|
|
39887
39887
|
worker2.removeListener("message", releaseEventListener);
|
|
39888
|
-
|
|
39888
|
+
resolve56();
|
|
39889
39889
|
}
|
|
39890
39890
|
};
|
|
39891
39891
|
worker2.on("message", releaseEventListener);
|
|
@@ -39970,7 +39970,7 @@ var init_channel2 = __esm({
|
|
|
39970
39970
|
identifier: id,
|
|
39971
39971
|
name: this.name
|
|
39972
39972
|
});
|
|
39973
|
-
return new Promise((
|
|
39973
|
+
return new Promise((resolve56, reject) => {
|
|
39974
39974
|
const abortListener = () => {
|
|
39975
39975
|
this.channel.postMessage({
|
|
39976
39976
|
type: abortType,
|
|
@@ -39988,7 +39988,7 @@ var init_channel2 = __esm({
|
|
|
39988
39988
|
if (event.data?.type === grantType) {
|
|
39989
39989
|
this.channel.removeEventListener("message", listener);
|
|
39990
39990
|
options2?.signal?.removeEventListener("abort", abortListener);
|
|
39991
|
-
|
|
39991
|
+
resolve56(() => {
|
|
39992
39992
|
this.channel.postMessage({
|
|
39993
39993
|
type: releaseType,
|
|
39994
39994
|
identifier: id,
|
|
@@ -40053,7 +40053,7 @@ var init_cluster2 = __esm({
|
|
|
40053
40053
|
identifier: id,
|
|
40054
40054
|
name: this.name
|
|
40055
40055
|
});
|
|
40056
|
-
return new Promise((
|
|
40056
|
+
return new Promise((resolve56, reject) => {
|
|
40057
40057
|
const abortListener = () => {
|
|
40058
40058
|
process.send?.({
|
|
40059
40059
|
type: abortType,
|
|
@@ -40071,7 +40071,7 @@ var init_cluster2 = __esm({
|
|
|
40071
40071
|
if (event.type === grantType) {
|
|
40072
40072
|
process.removeListener("message", listener);
|
|
40073
40073
|
options2?.signal?.removeEventListener("abort", abortListener);
|
|
40074
|
-
|
|
40074
|
+
resolve56(() => {
|
|
40075
40075
|
process.send?.({
|
|
40076
40076
|
type: releaseType,
|
|
40077
40077
|
identifier: id,
|
|
@@ -40220,8 +40220,8 @@ function getImplementation(opts) {
|
|
|
40220
40220
|
async function createReleasable(queue, options2) {
|
|
40221
40221
|
let res;
|
|
40222
40222
|
let rej;
|
|
40223
|
-
const p2 = new Promise((
|
|
40224
|
-
res =
|
|
40223
|
+
const p2 = new Promise((resolve56, reject) => {
|
|
40224
|
+
res = resolve56;
|
|
40225
40225
|
rej = reject;
|
|
40226
40226
|
});
|
|
40227
40227
|
const listener = () => {
|
|
@@ -40231,10 +40231,10 @@ async function createReleasable(queue, options2) {
|
|
|
40231
40231
|
once: true
|
|
40232
40232
|
});
|
|
40233
40233
|
queue.add(async () => {
|
|
40234
|
-
await new Promise((
|
|
40234
|
+
await new Promise((resolve56) => {
|
|
40235
40235
|
res(() => {
|
|
40236
40236
|
options2?.signal?.removeEventListener("abort", listener);
|
|
40237
|
-
|
|
40237
|
+
resolve56();
|
|
40238
40238
|
});
|
|
40239
40239
|
});
|
|
40240
40240
|
}, {
|
|
@@ -47946,7 +47946,7 @@ var init_dist3 = __esm({
|
|
|
47946
47946
|
// Assign unique ID if not provided
|
|
47947
47947
|
id: options2.id ?? (this.#idAssigner++).toString()
|
|
47948
47948
|
};
|
|
47949
|
-
return new Promise((
|
|
47949
|
+
return new Promise((resolve56, reject) => {
|
|
47950
47950
|
const taskSymbol = /* @__PURE__ */ Symbol(`task-${options2.id}`);
|
|
47951
47951
|
this.#queue.enqueue(async () => {
|
|
47952
47952
|
this.#pending++;
|
|
@@ -47984,7 +47984,7 @@ var init_dist3 = __esm({
|
|
|
47984
47984
|
})]);
|
|
47985
47985
|
}
|
|
47986
47986
|
const result = await operation;
|
|
47987
|
-
|
|
47987
|
+
resolve56(result);
|
|
47988
47988
|
this.emit("completed", result);
|
|
47989
47989
|
} catch (error) {
|
|
47990
47990
|
reject(error);
|
|
@@ -48141,13 +48141,13 @@ var init_dist3 = __esm({
|
|
|
48141
48141
|
});
|
|
48142
48142
|
}
|
|
48143
48143
|
async #onEvent(event, filter2) {
|
|
48144
|
-
return new Promise((
|
|
48144
|
+
return new Promise((resolve56) => {
|
|
48145
48145
|
const listener = () => {
|
|
48146
48146
|
if (filter2 && !filter2()) {
|
|
48147
48147
|
return;
|
|
48148
48148
|
}
|
|
48149
48149
|
this.off(event, listener);
|
|
48150
|
-
|
|
48150
|
+
resolve56();
|
|
48151
48151
|
};
|
|
48152
48152
|
this.on(event, listener);
|
|
48153
48153
|
});
|
|
@@ -53283,7 +53283,7 @@ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTi
|
|
|
53283
53283
|
const finalDelay = Math.min(delayTime, remainingTime);
|
|
53284
53284
|
options2.signal?.throwIfAborted();
|
|
53285
53285
|
if (finalDelay > 0) {
|
|
53286
|
-
await new Promise((
|
|
53286
|
+
await new Promise((resolve56, reject) => {
|
|
53287
53287
|
const onAbort = () => {
|
|
53288
53288
|
clearTimeout(timeoutToken);
|
|
53289
53289
|
options2.signal?.removeEventListener("abort", onAbort);
|
|
@@ -53291,7 +53291,7 @@ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTi
|
|
|
53291
53291
|
};
|
|
53292
53292
|
const timeoutToken = setTimeout(() => {
|
|
53293
53293
|
options2.signal?.removeEventListener("abort", onAbort);
|
|
53294
|
-
|
|
53294
|
+
resolve56();
|
|
53295
53295
|
}, finalDelay);
|
|
53296
53296
|
if (options2.unref) {
|
|
53297
53297
|
timeoutToken.unref?.();
|
|
@@ -55368,12 +55368,12 @@ var init_connection2 = __esm({
|
|
|
55368
55368
|
for (let i2 = 0; i2 < middleware.length; i2++) {
|
|
55369
55369
|
const mw = middleware[i2];
|
|
55370
55370
|
stream.log.trace("running middleware", i2, mw);
|
|
55371
|
-
await new Promise((
|
|
55371
|
+
await new Promise((resolve56, reject) => {
|
|
55372
55372
|
try {
|
|
55373
55373
|
const result = mw(stream, connection, (s2, c8) => {
|
|
55374
55374
|
stream = s2;
|
|
55375
55375
|
connection = c8;
|
|
55376
|
-
|
|
55376
|
+
resolve56();
|
|
55377
55377
|
});
|
|
55378
55378
|
if (result instanceof Promise) {
|
|
55379
55379
|
result.catch(reject);
|
|
@@ -60372,7 +60372,7 @@ async function randomDelay() {
|
|
|
60372
60372
|
const min = 200;
|
|
60373
60373
|
const max = 1e3;
|
|
60374
60374
|
const delay3 = Math.random() * (max - min) + min;
|
|
60375
|
-
await new Promise((
|
|
60375
|
+
await new Promise((resolve56) => setTimeout(resolve56, delay3));
|
|
60376
60376
|
}
|
|
60377
60377
|
function DsName(name10) {
|
|
60378
60378
|
return new Key(keyPrefix + name10);
|
|
@@ -67428,11 +67428,11 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
67428
67428
|
}
|
|
67429
67429
|
function __awaiter(thisArg, _arguments, P2, generator) {
|
|
67430
67430
|
function adopt(value2) {
|
|
67431
|
-
return value2 instanceof P2 ? value2 : new P2(function(
|
|
67432
|
-
|
|
67431
|
+
return value2 instanceof P2 ? value2 : new P2(function(resolve56) {
|
|
67432
|
+
resolve56(value2);
|
|
67433
67433
|
});
|
|
67434
67434
|
}
|
|
67435
|
-
return new (P2 || (P2 = Promise))(function(
|
|
67435
|
+
return new (P2 || (P2 = Promise))(function(resolve56, reject) {
|
|
67436
67436
|
function fulfilled(value2) {
|
|
67437
67437
|
try {
|
|
67438
67438
|
step(generator.next(value2));
|
|
@@ -67448,7 +67448,7 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
67448
67448
|
}
|
|
67449
67449
|
}
|
|
67450
67450
|
function step(result) {
|
|
67451
|
-
result.done ?
|
|
67451
|
+
result.done ? resolve56(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
67452
67452
|
}
|
|
67453
67453
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
67454
67454
|
});
|
|
@@ -67639,14 +67639,14 @@ function __asyncValues(o2) {
|
|
|
67639
67639
|
}, i2);
|
|
67640
67640
|
function verb(n2) {
|
|
67641
67641
|
i2[n2] = o2[n2] && function(v) {
|
|
67642
|
-
return new Promise(function(
|
|
67643
|
-
v = o2[n2](v), settle(
|
|
67642
|
+
return new Promise(function(resolve56, reject) {
|
|
67643
|
+
v = o2[n2](v), settle(resolve56, reject, v.done, v.value);
|
|
67644
67644
|
});
|
|
67645
67645
|
};
|
|
67646
67646
|
}
|
|
67647
|
-
function settle(
|
|
67647
|
+
function settle(resolve56, reject, d2, v) {
|
|
67648
67648
|
Promise.resolve(v).then(function(v2) {
|
|
67649
|
-
|
|
67649
|
+
resolve56({ value: v2, done: d2 });
|
|
67650
67650
|
}, reject);
|
|
67651
67651
|
}
|
|
67652
67652
|
}
|
|
@@ -73174,11 +73174,11 @@ function __metadata2(metadataKey, metadataValue) {
|
|
|
73174
73174
|
}
|
|
73175
73175
|
function __awaiter2(thisArg, _arguments, P2, generator) {
|
|
73176
73176
|
function adopt(value2) {
|
|
73177
|
-
return value2 instanceof P2 ? value2 : new P2(function(
|
|
73178
|
-
|
|
73177
|
+
return value2 instanceof P2 ? value2 : new P2(function(resolve56) {
|
|
73178
|
+
resolve56(value2);
|
|
73179
73179
|
});
|
|
73180
73180
|
}
|
|
73181
|
-
return new (P2 || (P2 = Promise))(function(
|
|
73181
|
+
return new (P2 || (P2 = Promise))(function(resolve56, reject) {
|
|
73182
73182
|
function fulfilled(value2) {
|
|
73183
73183
|
try {
|
|
73184
73184
|
step(generator.next(value2));
|
|
@@ -73194,7 +73194,7 @@ function __awaiter2(thisArg, _arguments, P2, generator) {
|
|
|
73194
73194
|
}
|
|
73195
73195
|
}
|
|
73196
73196
|
function step(result) {
|
|
73197
|
-
result.done ?
|
|
73197
|
+
result.done ? resolve56(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
73198
73198
|
}
|
|
73199
73199
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
73200
73200
|
});
|
|
@@ -73372,14 +73372,14 @@ function __asyncValues2(o2) {
|
|
|
73372
73372
|
}, i2);
|
|
73373
73373
|
function verb(n2) {
|
|
73374
73374
|
i2[n2] = o2[n2] && function(v) {
|
|
73375
|
-
return new Promise(function(
|
|
73376
|
-
v = o2[n2](v), settle(
|
|
73375
|
+
return new Promise(function(resolve56, reject) {
|
|
73376
|
+
v = o2[n2](v), settle(resolve56, reject, v.done, v.value);
|
|
73377
73377
|
});
|
|
73378
73378
|
};
|
|
73379
73379
|
}
|
|
73380
|
-
function settle(
|
|
73380
|
+
function settle(resolve56, reject, d2, v) {
|
|
73381
73381
|
Promise.resolve(v).then(function(v2) {
|
|
73382
|
-
|
|
73382
|
+
resolve56({ value: v2, done: d2 });
|
|
73383
73383
|
}, reject);
|
|
73384
73384
|
}
|
|
73385
73385
|
}
|
|
@@ -91789,10 +91789,10 @@ var require_axios = __commonJS({
|
|
|
91789
91789
|
}
|
|
91790
91790
|
};
|
|
91791
91791
|
var CanceledError$1 = CanceledError;
|
|
91792
|
-
function settle(
|
|
91792
|
+
function settle(resolve56, reject, response) {
|
|
91793
91793
|
const validateStatus = response.config.validateStatus;
|
|
91794
91794
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
91795
|
-
|
|
91795
|
+
resolve56(response);
|
|
91796
91796
|
} else {
|
|
91797
91797
|
reject(
|
|
91798
91798
|
new AxiosError$1(
|
|
@@ -92384,7 +92384,7 @@ var require_axios = __commonJS({
|
|
|
92384
92384
|
}
|
|
92385
92385
|
var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
|
|
92386
92386
|
var wrapAsync = (asyncExecutor) => {
|
|
92387
|
-
return new Promise((
|
|
92387
|
+
return new Promise((resolve56, reject) => {
|
|
92388
92388
|
let onDone;
|
|
92389
92389
|
let isDone;
|
|
92390
92390
|
const done = (value2, isRejected) => {
|
|
@@ -92394,7 +92394,7 @@ var require_axios = __commonJS({
|
|
|
92394
92394
|
};
|
|
92395
92395
|
const _resolve = (value2) => {
|
|
92396
92396
|
done(value2);
|
|
92397
|
-
|
|
92397
|
+
resolve56(value2);
|
|
92398
92398
|
};
|
|
92399
92399
|
const _reject = (reason) => {
|
|
92400
92400
|
done(reason, true);
|
|
@@ -92441,7 +92441,7 @@ var require_axios = __commonJS({
|
|
|
92441
92441
|
}
|
|
92442
92442
|
};
|
|
92443
92443
|
var httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
|
|
92444
|
-
return wrapAsync(async function dispatchHttpRequest(
|
|
92444
|
+
return wrapAsync(async function dispatchHttpRequest(resolve56, reject, onDone) {
|
|
92445
92445
|
let { data, lookup, family, httpVersion = 1, http2Options } = config;
|
|
92446
92446
|
const { responseType, responseEncoding } = config;
|
|
92447
92447
|
const method = config.method.toUpperCase();
|
|
@@ -92531,7 +92531,7 @@ var require_axios = __commonJS({
|
|
|
92531
92531
|
}
|
|
92532
92532
|
let convertedData;
|
|
92533
92533
|
if (method !== "GET") {
|
|
92534
|
-
return settle(
|
|
92534
|
+
return settle(resolve56, reject, {
|
|
92535
92535
|
status: 405,
|
|
92536
92536
|
statusText: "method not allowed",
|
|
92537
92537
|
headers: {},
|
|
@@ -92553,7 +92553,7 @@ var require_axios = __commonJS({
|
|
|
92553
92553
|
} else if (responseType === "stream") {
|
|
92554
92554
|
convertedData = stream__default["default"].Readable.from(convertedData);
|
|
92555
92555
|
}
|
|
92556
|
-
return settle(
|
|
92556
|
+
return settle(resolve56, reject, {
|
|
92557
92557
|
data: convertedData,
|
|
92558
92558
|
status: 200,
|
|
92559
92559
|
statusText: "OK",
|
|
@@ -92794,7 +92794,7 @@ var require_axios = __commonJS({
|
|
|
92794
92794
|
};
|
|
92795
92795
|
if (responseType === "stream") {
|
|
92796
92796
|
response.data = responseStream;
|
|
92797
|
-
settle(
|
|
92797
|
+
settle(resolve56, reject, response);
|
|
92798
92798
|
} else {
|
|
92799
92799
|
const responseBuffer = [];
|
|
92800
92800
|
let totalResponseBytes = 0;
|
|
@@ -92844,7 +92844,7 @@ var require_axios = __commonJS({
|
|
|
92844
92844
|
} catch (err) {
|
|
92845
92845
|
return reject(AxiosError$1.from(err, null, config, response.request, response));
|
|
92846
92846
|
}
|
|
92847
|
-
settle(
|
|
92847
|
+
settle(resolve56, reject, response);
|
|
92848
92848
|
});
|
|
92849
92849
|
}
|
|
92850
92850
|
abortEmitter.once("abort", (err) => {
|
|
@@ -93094,7 +93094,7 @@ var require_axios = __commonJS({
|
|
|
93094
93094
|
};
|
|
93095
93095
|
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
93096
93096
|
var xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
93097
|
-
return new Promise(function dispatchXhrRequest(
|
|
93097
|
+
return new Promise(function dispatchXhrRequest(resolve56, reject) {
|
|
93098
93098
|
const _config3 = resolveConfig(config);
|
|
93099
93099
|
let requestData = _config3.data;
|
|
93100
93100
|
const requestHeaders = AxiosHeaders$1.from(_config3.headers).normalize();
|
|
@@ -93129,7 +93129,7 @@ var require_axios = __commonJS({
|
|
|
93129
93129
|
};
|
|
93130
93130
|
settle(
|
|
93131
93131
|
function _resolve(value2) {
|
|
93132
|
-
|
|
93132
|
+
resolve56(value2);
|
|
93133
93133
|
done();
|
|
93134
93134
|
},
|
|
93135
93135
|
function _reject(err) {
|
|
@@ -93521,8 +93521,8 @@ var require_axios = __commonJS({
|
|
|
93521
93521
|
config
|
|
93522
93522
|
);
|
|
93523
93523
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
93524
|
-
return await new Promise((
|
|
93525
|
-
settle(
|
|
93524
|
+
return await new Promise((resolve56, reject) => {
|
|
93525
|
+
settle(resolve56, reject, {
|
|
93526
93526
|
data: responseData,
|
|
93527
93527
|
headers: AxiosHeaders$1.from(response.headers),
|
|
93528
93528
|
status: response.status,
|
|
@@ -93926,8 +93926,8 @@ var require_axios = __commonJS({
|
|
|
93926
93926
|
throw new TypeError("executor must be a function.");
|
|
93927
93927
|
}
|
|
93928
93928
|
let resolvePromise;
|
|
93929
|
-
this.promise = new Promise(function promiseExecutor(
|
|
93930
|
-
resolvePromise =
|
|
93929
|
+
this.promise = new Promise(function promiseExecutor(resolve56) {
|
|
93930
|
+
resolvePromise = resolve56;
|
|
93931
93931
|
});
|
|
93932
93932
|
const token = this;
|
|
93933
93933
|
this.promise.then((cancel) => {
|
|
@@ -93940,9 +93940,9 @@ var require_axios = __commonJS({
|
|
|
93940
93940
|
});
|
|
93941
93941
|
this.promise.then = (onfulfilled) => {
|
|
93942
93942
|
let _resolve;
|
|
93943
|
-
const promise = new Promise((
|
|
93944
|
-
token.subscribe(
|
|
93945
|
-
_resolve =
|
|
93943
|
+
const promise = new Promise((resolve56) => {
|
|
93944
|
+
token.subscribe(resolve56);
|
|
93945
|
+
_resolve = resolve56;
|
|
93946
93946
|
}).then(onfulfilled);
|
|
93947
93947
|
promise.cancel = function reject() {
|
|
93948
93948
|
token.unsubscribe(_resolve);
|
|
@@ -94170,8 +94170,8 @@ var require_util = __commonJS({
|
|
|
94170
94170
|
}
|
|
94171
94171
|
const duration = backoff.duration();
|
|
94172
94172
|
log22(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e2.message}`);
|
|
94173
|
-
await new Promise((
|
|
94174
|
-
setTimeout(
|
|
94173
|
+
await new Promise((resolve56) => {
|
|
94174
|
+
setTimeout(resolve56, duration);
|
|
94175
94175
|
});
|
|
94176
94176
|
return retryPromise(fn, attempts, backoff);
|
|
94177
94177
|
}
|
|
@@ -94276,7 +94276,7 @@ var require_util = __commonJS({
|
|
|
94276
94276
|
return resolver;
|
|
94277
94277
|
}
|
|
94278
94278
|
async function retrieveTlsAlpnCertificate(host, port, timeout2 = 3e4) {
|
|
94279
|
-
return new Promise((
|
|
94279
|
+
return new Promise((resolve56, reject) => {
|
|
94280
94280
|
let result;
|
|
94281
94281
|
const socket = tls2.connect({
|
|
94282
94282
|
host,
|
|
@@ -94299,7 +94299,7 @@ var require_util = __commonJS({
|
|
|
94299
94299
|
});
|
|
94300
94300
|
socket.on("end", () => {
|
|
94301
94301
|
if (result) {
|
|
94302
|
-
return
|
|
94302
|
+
return resolve56(result.toString());
|
|
94303
94303
|
}
|
|
94304
94304
|
return reject(new Error("TLS ALPN lookup failed to retrieve certificate"));
|
|
94305
94305
|
});
|
|
@@ -94440,8 +94440,8 @@ var require_axios2 = __commonJS({
|
|
|
94440
94440
|
retryAfter = retryDefaultDelay * config.retryAttempt;
|
|
94441
94441
|
log22(`Unable to locate or parse retry-after response header, waiting ${retryAfter} seconds`);
|
|
94442
94442
|
}
|
|
94443
|
-
await new Promise((
|
|
94444
|
-
setTimeout(
|
|
94443
|
+
await new Promise((resolve56) => {
|
|
94444
|
+
setTimeout(resolve56, retryAfter * 1e3);
|
|
94445
94445
|
});
|
|
94446
94446
|
return instance(config);
|
|
94447
94447
|
}
|
|
@@ -113670,10 +113670,10 @@ function createDelay2({ clearTimeout: defaultClear, setTimeout: defaultSet } = {
|
|
|
113670
113670
|
signal.removeEventListener("abort", signalListener);
|
|
113671
113671
|
}
|
|
113672
113672
|
};
|
|
113673
|
-
const delayPromise = new Promise((
|
|
113673
|
+
const delayPromise = new Promise((resolve56, reject) => {
|
|
113674
113674
|
settle = () => {
|
|
113675
113675
|
cleanup();
|
|
113676
|
-
|
|
113676
|
+
resolve56(value2);
|
|
113677
113677
|
};
|
|
113678
113678
|
rejectFunction = reject;
|
|
113679
113679
|
timeoutId = (defaultSet ?? setTimeout)(settle, milliseconds);
|
|
@@ -120475,9 +120475,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
120475
120475
|
}
|
|
120476
120476
|
close(callback) {
|
|
120477
120477
|
if (callback === void 0) {
|
|
120478
|
-
return new Promise((
|
|
120478
|
+
return new Promise((resolve56, reject) => {
|
|
120479
120479
|
this.close((err, data) => {
|
|
120480
|
-
return err ? reject(err) :
|
|
120480
|
+
return err ? reject(err) : resolve56(data);
|
|
120481
120481
|
});
|
|
120482
120482
|
});
|
|
120483
120483
|
}
|
|
@@ -120515,9 +120515,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
120515
120515
|
err = null;
|
|
120516
120516
|
}
|
|
120517
120517
|
if (callback === void 0) {
|
|
120518
|
-
return new Promise((
|
|
120518
|
+
return new Promise((resolve56, reject) => {
|
|
120519
120519
|
this.destroy(err, (err2, data) => {
|
|
120520
|
-
return err2 ? reject(err2) :
|
|
120520
|
+
return err2 ? reject(err2) : resolve56(data);
|
|
120521
120521
|
});
|
|
120522
120522
|
});
|
|
120523
120523
|
}
|
|
@@ -123994,8 +123994,8 @@ var require_promise = __commonJS({
|
|
|
123994
123994
|
function createDeferredPromise2() {
|
|
123995
123995
|
let res;
|
|
123996
123996
|
let rej;
|
|
123997
|
-
const promise = new Promise((
|
|
123998
|
-
res =
|
|
123997
|
+
const promise = new Promise((resolve56, reject) => {
|
|
123998
|
+
res = resolve56;
|
|
123999
123999
|
rej = reject;
|
|
124000
124000
|
});
|
|
124001
124001
|
return { promise, resolve: res, reject: rej };
|
|
@@ -125296,12 +125296,12 @@ upgrade: ${upgrade}\r
|
|
|
125296
125296
|
cb();
|
|
125297
125297
|
}
|
|
125298
125298
|
}
|
|
125299
|
-
const waitForDrain = () => new Promise((
|
|
125299
|
+
const waitForDrain = () => new Promise((resolve56, reject) => {
|
|
125300
125300
|
assert(callback === null);
|
|
125301
125301
|
if (socket[kError]) {
|
|
125302
125302
|
reject(socket[kError]);
|
|
125303
125303
|
} else {
|
|
125304
|
-
callback =
|
|
125304
|
+
callback = resolve56;
|
|
125305
125305
|
}
|
|
125306
125306
|
});
|
|
125307
125307
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -126146,12 +126146,12 @@ var require_client_h2 = __commonJS({
|
|
|
126146
126146
|
cb();
|
|
126147
126147
|
}
|
|
126148
126148
|
}
|
|
126149
|
-
const waitForDrain = () => new Promise((
|
|
126149
|
+
const waitForDrain = () => new Promise((resolve56, reject) => {
|
|
126150
126150
|
assert(callback === null);
|
|
126151
126151
|
if (socket[kError]) {
|
|
126152
126152
|
reject(socket[kError]);
|
|
126153
126153
|
} else {
|
|
126154
|
-
callback =
|
|
126154
|
+
callback = resolve56;
|
|
126155
126155
|
}
|
|
126156
126156
|
});
|
|
126157
126157
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -126462,16 +126462,16 @@ var require_client2 = __commonJS({
|
|
|
126462
126462
|
return this[kNeedDrain] < 2;
|
|
126463
126463
|
}
|
|
126464
126464
|
[kClose]() {
|
|
126465
|
-
return new Promise((
|
|
126465
|
+
return new Promise((resolve56) => {
|
|
126466
126466
|
if (this[kSize]) {
|
|
126467
|
-
this[kClosedResolve] =
|
|
126467
|
+
this[kClosedResolve] = resolve56;
|
|
126468
126468
|
} else {
|
|
126469
|
-
|
|
126469
|
+
resolve56(null);
|
|
126470
126470
|
}
|
|
126471
126471
|
});
|
|
126472
126472
|
}
|
|
126473
126473
|
[kDestroy](err) {
|
|
126474
|
-
return new Promise((
|
|
126474
|
+
return new Promise((resolve56) => {
|
|
126475
126475
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
126476
126476
|
for (let i2 = 0; i2 < requests.length; i2++) {
|
|
126477
126477
|
const request = requests[i2];
|
|
@@ -126482,7 +126482,7 @@ var require_client2 = __commonJS({
|
|
|
126482
126482
|
this[kClosedResolve]();
|
|
126483
126483
|
this[kClosedResolve] = null;
|
|
126484
126484
|
}
|
|
126485
|
-
|
|
126485
|
+
resolve56(null);
|
|
126486
126486
|
};
|
|
126487
126487
|
if (this[kHTTPContext]) {
|
|
126488
126488
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -126887,8 +126887,8 @@ var require_pool_base = __commonJS({
|
|
|
126887
126887
|
}
|
|
126888
126888
|
return Promise.all(closeAll);
|
|
126889
126889
|
} else {
|
|
126890
|
-
return new Promise((
|
|
126891
|
-
this[kClosedResolve] =
|
|
126890
|
+
return new Promise((resolve56) => {
|
|
126891
|
+
this[kClosedResolve] = resolve56;
|
|
126892
126892
|
});
|
|
126893
126893
|
}
|
|
126894
126894
|
}
|
|
@@ -127980,10 +127980,10 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
127980
127980
|
const proxyHost = this[kProxyUrl].hostname;
|
|
127981
127981
|
const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
|
|
127982
127982
|
debug("creating SOCKS5 connection to", proxyHost, proxyPort);
|
|
127983
|
-
const socket = await new Promise((
|
|
127983
|
+
const socket = await new Promise((resolve56, reject) => {
|
|
127984
127984
|
const onConnect = () => {
|
|
127985
127985
|
socket2.removeListener("error", onError);
|
|
127986
|
-
|
|
127986
|
+
resolve56(socket2);
|
|
127987
127987
|
};
|
|
127988
127988
|
const onError = (err) => {
|
|
127989
127989
|
socket2.removeListener("connect", onConnect);
|
|
@@ -128002,14 +128002,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
128002
128002
|
socket.destroy();
|
|
128003
128003
|
});
|
|
128004
128004
|
await socks5Client.handshake();
|
|
128005
|
-
await new Promise((
|
|
128005
|
+
await new Promise((resolve56, reject) => {
|
|
128006
128006
|
const timeout2 = setTimeout(() => {
|
|
128007
128007
|
reject(new Error("SOCKS5 authentication timeout"));
|
|
128008
128008
|
}, 5e3);
|
|
128009
128009
|
const onAuthenticated = () => {
|
|
128010
128010
|
clearTimeout(timeout2);
|
|
128011
128011
|
socks5Client.removeListener("error", onError);
|
|
128012
|
-
|
|
128012
|
+
resolve56();
|
|
128013
128013
|
};
|
|
128014
128014
|
const onError = (err) => {
|
|
128015
128015
|
clearTimeout(timeout2);
|
|
@@ -128018,14 +128018,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
128018
128018
|
};
|
|
128019
128019
|
if (socks5Client.state === "authenticated") {
|
|
128020
128020
|
clearTimeout(timeout2);
|
|
128021
|
-
|
|
128021
|
+
resolve56();
|
|
128022
128022
|
} else {
|
|
128023
128023
|
socks5Client.once("authenticated", onAuthenticated);
|
|
128024
128024
|
socks5Client.once("error", onError);
|
|
128025
128025
|
}
|
|
128026
128026
|
});
|
|
128027
128027
|
await socks5Client.connect(targetHost, targetPort);
|
|
128028
|
-
await new Promise((
|
|
128028
|
+
await new Promise((resolve56, reject) => {
|
|
128029
128029
|
const timeout2 = setTimeout(() => {
|
|
128030
128030
|
reject(new Error("SOCKS5 connection timeout"));
|
|
128031
128031
|
}, 5e3);
|
|
@@ -128033,7 +128033,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
128033
128033
|
debug("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
|
|
128034
128034
|
clearTimeout(timeout2);
|
|
128035
128035
|
socks5Client.removeListener("error", onError);
|
|
128036
|
-
|
|
128036
|
+
resolve56();
|
|
128037
128037
|
};
|
|
128038
128038
|
const onError = (err) => {
|
|
128039
128039
|
clearTimeout(timeout2);
|
|
@@ -128074,8 +128074,8 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
128074
128074
|
servername: targetHost,
|
|
128075
128075
|
...connectOpts.tls || {}
|
|
128076
128076
|
});
|
|
128077
|
-
await new Promise((
|
|
128078
|
-
finalSocket.once("secureConnect",
|
|
128077
|
+
await new Promise((resolve56, reject) => {
|
|
128078
|
+
finalSocket.once("secureConnect", resolve56);
|
|
128079
128079
|
finalSocket.once("error", reject);
|
|
128080
128080
|
});
|
|
128081
128081
|
}
|
|
@@ -129100,7 +129100,7 @@ var require_readable = __commonJS({
|
|
|
129100
129100
|
if (this._readableState.closeEmitted) {
|
|
129101
129101
|
return Promise.resolve(null);
|
|
129102
129102
|
}
|
|
129103
|
-
return new Promise((
|
|
129103
|
+
return new Promise((resolve56, reject) => {
|
|
129104
129104
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
129105
129105
|
this.destroy(new AbortError6());
|
|
129106
129106
|
}
|
|
@@ -129114,11 +129114,11 @@ var require_readable = __commonJS({
|
|
|
129114
129114
|
if (signal.aborted) {
|
|
129115
129115
|
reject(signal.reason ?? new AbortError6());
|
|
129116
129116
|
} else {
|
|
129117
|
-
|
|
129117
|
+
resolve56(null);
|
|
129118
129118
|
}
|
|
129119
129119
|
});
|
|
129120
129120
|
} else {
|
|
129121
|
-
this.on("close",
|
|
129121
|
+
this.on("close", resolve56);
|
|
129122
129122
|
}
|
|
129123
129123
|
this.on("error", noop2).on("data", () => {
|
|
129124
129124
|
if (this[kBytesRead] > limit) {
|
|
@@ -129146,7 +129146,7 @@ var require_readable = __commonJS({
|
|
|
129146
129146
|
}
|
|
129147
129147
|
function consume(stream, type) {
|
|
129148
129148
|
assert(!stream[kConsume]);
|
|
129149
|
-
return new Promise((
|
|
129149
|
+
return new Promise((resolve56, reject) => {
|
|
129150
129150
|
if (isUnusable(stream)) {
|
|
129151
129151
|
const rState = stream._readableState;
|
|
129152
129152
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -129161,7 +129161,7 @@ var require_readable = __commonJS({
|
|
|
129161
129161
|
stream[kConsume] = {
|
|
129162
129162
|
type,
|
|
129163
129163
|
stream,
|
|
129164
|
-
resolve:
|
|
129164
|
+
resolve: resolve56,
|
|
129165
129165
|
reject,
|
|
129166
129166
|
length: 0,
|
|
129167
129167
|
body: []
|
|
@@ -129235,18 +129235,18 @@ var require_readable = __commonJS({
|
|
|
129235
129235
|
return buffer2;
|
|
129236
129236
|
}
|
|
129237
129237
|
function consumeEnd(consume2, encoding) {
|
|
129238
|
-
const { type, body, resolve:
|
|
129238
|
+
const { type, body, resolve: resolve56, stream, length: length4 } = consume2;
|
|
129239
129239
|
try {
|
|
129240
129240
|
if (type === "text") {
|
|
129241
|
-
|
|
129241
|
+
resolve56(chunksDecode(body, length4, encoding));
|
|
129242
129242
|
} else if (type === "json") {
|
|
129243
|
-
|
|
129243
|
+
resolve56(JSON.parse(chunksDecode(body, length4, encoding)));
|
|
129244
129244
|
} else if (type === "arrayBuffer") {
|
|
129245
|
-
|
|
129245
|
+
resolve56(chunksConcat(body, length4).buffer);
|
|
129246
129246
|
} else if (type === "blob") {
|
|
129247
|
-
|
|
129247
|
+
resolve56(new Blob(body, { type: stream[kContentType] }));
|
|
129248
129248
|
} else if (type === "bytes") {
|
|
129249
|
-
|
|
129249
|
+
resolve56(chunksConcat(body, length4));
|
|
129250
129250
|
}
|
|
129251
129251
|
consumeFinish(consume2);
|
|
129252
129252
|
} catch (err) {
|
|
@@ -129436,9 +129436,9 @@ var require_api_request = __commonJS({
|
|
|
129436
129436
|
};
|
|
129437
129437
|
function request(opts, callback) {
|
|
129438
129438
|
if (callback === void 0) {
|
|
129439
|
-
return new Promise((
|
|
129439
|
+
return new Promise((resolve56, reject) => {
|
|
129440
129440
|
request.call(this, opts, (err, data) => {
|
|
129441
|
-
return err ? reject(err) :
|
|
129441
|
+
return err ? reject(err) : resolve56(data);
|
|
129442
129442
|
});
|
|
129443
129443
|
});
|
|
129444
129444
|
}
|
|
@@ -129650,9 +129650,9 @@ var require_api_stream = __commonJS({
|
|
|
129650
129650
|
};
|
|
129651
129651
|
function stream(opts, factory, callback) {
|
|
129652
129652
|
if (callback === void 0) {
|
|
129653
|
-
return new Promise((
|
|
129653
|
+
return new Promise((resolve56, reject) => {
|
|
129654
129654
|
stream.call(this, opts, factory, (err, data) => {
|
|
129655
|
-
return err ? reject(err) :
|
|
129655
|
+
return err ? reject(err) : resolve56(data);
|
|
129656
129656
|
});
|
|
129657
129657
|
});
|
|
129658
129658
|
}
|
|
@@ -129940,9 +129940,9 @@ var require_api_upgrade = __commonJS({
|
|
|
129940
129940
|
};
|
|
129941
129941
|
function upgrade(opts, callback) {
|
|
129942
129942
|
if (callback === void 0) {
|
|
129943
|
-
return new Promise((
|
|
129943
|
+
return new Promise((resolve56, reject) => {
|
|
129944
129944
|
upgrade.call(this, opts, (err, data) => {
|
|
129945
|
-
return err ? reject(err) :
|
|
129945
|
+
return err ? reject(err) : resolve56(data);
|
|
129946
129946
|
});
|
|
129947
129947
|
});
|
|
129948
129948
|
}
|
|
@@ -130035,9 +130035,9 @@ var require_api_connect = __commonJS({
|
|
|
130035
130035
|
};
|
|
130036
130036
|
function connect3(opts, callback) {
|
|
130037
130037
|
if (callback === void 0) {
|
|
130038
|
-
return new Promise((
|
|
130038
|
+
return new Promise((resolve56, reject) => {
|
|
130039
130039
|
connect3.call(this, opts, (err, data) => {
|
|
130040
|
-
return err ? reject(err) :
|
|
130040
|
+
return err ? reject(err) : resolve56(data);
|
|
130041
130041
|
});
|
|
130042
130042
|
});
|
|
130043
130043
|
}
|
|
@@ -131311,7 +131311,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
131311
131311
|
"../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
131312
131312
|
"use strict";
|
|
131313
131313
|
var { writeFile: writeFile24, readFile: readFile23, mkdir: mkdir20 } = __require("node:fs/promises");
|
|
131314
|
-
var { dirname: dirname43, resolve:
|
|
131314
|
+
var { dirname: dirname43, resolve: resolve56 } = __require("node:path");
|
|
131315
131315
|
var { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = __require("node:timers");
|
|
131316
131316
|
var { InvalidArgumentError, UndiciError } = require_errors2();
|
|
131317
131317
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -131512,7 +131512,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
131512
131512
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
131513
131513
|
}
|
|
131514
131514
|
try {
|
|
131515
|
-
const data = await readFile23(
|
|
131515
|
+
const data = await readFile23(resolve56(path12), "utf8");
|
|
131516
131516
|
const parsed = JSON.parse(data);
|
|
131517
131517
|
if (Array.isArray(parsed)) {
|
|
131518
131518
|
this.#snapshots.clear();
|
|
@@ -131541,7 +131541,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
131541
131541
|
if (!path12) {
|
|
131542
131542
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
131543
131543
|
}
|
|
131544
|
-
const resolvedPath =
|
|
131544
|
+
const resolvedPath = resolve56(path12);
|
|
131545
131545
|
await mkdir20(dirname43(resolvedPath), { recursive: true });
|
|
131546
131546
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
131547
131547
|
hash,
|
|
@@ -138383,7 +138383,7 @@ var require_fetch = __commonJS({
|
|
|
138383
138383
|
const agent = fetchParams.controller.dispatcher;
|
|
138384
138384
|
const path12 = url.pathname + url.search;
|
|
138385
138385
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
138386
|
-
return new Promise((
|
|
138386
|
+
return new Promise((resolve56, reject) => agent.dispatch(
|
|
138387
138387
|
{
|
|
138388
138388
|
path: hasTrailingQuestionMark ? `${path12}?` : path12,
|
|
138389
138389
|
origin: url.origin,
|
|
@@ -138463,7 +138463,7 @@ var require_fetch = __commonJS({
|
|
|
138463
138463
|
}
|
|
138464
138464
|
}
|
|
138465
138465
|
const onError = this.onError.bind(this);
|
|
138466
|
-
|
|
138466
|
+
resolve56({
|
|
138467
138467
|
status,
|
|
138468
138468
|
statusText,
|
|
138469
138469
|
headersList,
|
|
@@ -138516,7 +138516,7 @@ var require_fetch = __commonJS({
|
|
|
138516
138516
|
headersList.append(headerName, String(value2), true);
|
|
138517
138517
|
}
|
|
138518
138518
|
}
|
|
138519
|
-
|
|
138519
|
+
resolve56({
|
|
138520
138520
|
status,
|
|
138521
138521
|
statusText: STATUS_CODES2[status],
|
|
138522
138522
|
headersList,
|
|
@@ -138532,7 +138532,7 @@ var require_fetch = __commonJS({
|
|
|
138532
138532
|
for (let i2 = 0; i2 < rawHeaders.length; i2 += 2) {
|
|
138533
138533
|
headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i2]), rawHeaders[i2 + 1].toString("latin1"), true);
|
|
138534
138534
|
}
|
|
138535
|
-
|
|
138535
|
+
resolve56({
|
|
138536
138536
|
status,
|
|
138537
138537
|
statusText: STATUS_CODES2[status],
|
|
138538
138538
|
headersList,
|
|
@@ -143134,7 +143134,7 @@ function toBytes(data) {
|
|
|
143134
143134
|
throw new InvalidParametersError("Unsupported data type");
|
|
143135
143135
|
}
|
|
143136
143136
|
async function readResponse2(stream, options2) {
|
|
143137
|
-
return new Promise((
|
|
143137
|
+
return new Promise((resolve56, reject) => {
|
|
143138
143138
|
let readHeaders2 = false;
|
|
143139
143139
|
const parser2 = new HTTPParser("RESPONSE");
|
|
143140
143140
|
parser2[HTTPParser.kOnHeadersComplete] = (info) => {
|
|
@@ -143143,7 +143143,7 @@ async function readResponse2(stream, options2) {
|
|
|
143143
143143
|
for (let i2 = 0; i2 < info.headers.length; i2 += 2) {
|
|
143144
143144
|
headers.push([info.headers[i2], info.headers[i2 + 1]]);
|
|
143145
143145
|
}
|
|
143146
|
-
|
|
143146
|
+
resolve56(new Response2(null, {
|
|
143147
143147
|
status: info.statusCode,
|
|
143148
143148
|
statusText: info.statusMessage,
|
|
143149
143149
|
headers: new Headers(headers)
|
|
@@ -217371,11 +217371,11 @@ var init_mdns = __esm({
|
|
|
217371
217371
|
clearInterval(this._queryInterval);
|
|
217372
217372
|
this._queryInterval = null;
|
|
217373
217373
|
}
|
|
217374
|
-
await new Promise((
|
|
217374
|
+
await new Promise((resolve56) => {
|
|
217375
217375
|
if (this.mdns != null) {
|
|
217376
|
-
this.mdns.destroy(
|
|
217376
|
+
this.mdns.destroy(resolve56);
|
|
217377
217377
|
} else {
|
|
217378
|
-
|
|
217378
|
+
resolve56();
|
|
217379
217379
|
}
|
|
217380
217380
|
});
|
|
217381
217381
|
this.mdns = void 0;
|
|
@@ -218305,9 +218305,9 @@ var init_listener2 = __esm({
|
|
|
218305
218305
|
return;
|
|
218306
218306
|
}
|
|
218307
218307
|
const netConfig = this.status.netConfig;
|
|
218308
|
-
await new Promise((
|
|
218308
|
+
await new Promise((resolve56, reject) => {
|
|
218309
218309
|
this.server.once("error", reject);
|
|
218310
|
-
this.server.listen(netConfig,
|
|
218310
|
+
this.server.listen(netConfig, resolve56);
|
|
218311
218311
|
});
|
|
218312
218312
|
this.status = { ...this.status, code: TCPListenerStatusCode.ACTIVE };
|
|
218313
218313
|
this.log("listening on %s", this.server.address());
|
|
@@ -218400,7 +218400,7 @@ var init_tcp = __esm({
|
|
|
218400
218400
|
options2.signal.throwIfAborted();
|
|
218401
218401
|
options2.onProgress?.(new CustomProgressEvent("tcp:open-connection"));
|
|
218402
218402
|
let rawSocket;
|
|
218403
|
-
return new Promise((
|
|
218403
|
+
return new Promise((resolve56, reject) => {
|
|
218404
218404
|
const start2 = Date.now();
|
|
218405
218405
|
const cOpts = multiaddrToNetConfig(ma, {
|
|
218406
218406
|
...this.opts.dialOpts ?? {},
|
|
@@ -218442,7 +218442,7 @@ var init_tcp = __esm({
|
|
|
218442
218442
|
reject(err);
|
|
218443
218443
|
return;
|
|
218444
218444
|
}
|
|
218445
|
-
|
|
218445
|
+
resolve56(rawSocket);
|
|
218446
218446
|
};
|
|
218447
218447
|
rawSocket.on("error", onError);
|
|
218448
218448
|
rawSocket.on("timeout", onTimeout);
|
|
@@ -222830,14 +222830,14 @@ ${key.data.toString("base64")}
|
|
|
222830
222830
|
};
|
|
222831
222831
|
var Pbkdf2Provider = class extends core__namespace.Pbkdf2Provider {
|
|
222832
222832
|
async onDeriveBits(algorithm, baseKey, length4) {
|
|
222833
|
-
return new Promise((
|
|
222833
|
+
return new Promise((resolve56, reject) => {
|
|
222834
222834
|
const salt = core__namespace.BufferSourceConverter.toArrayBuffer(algorithm.salt);
|
|
222835
222835
|
const hash = algorithm.hash.name.replace("-", "");
|
|
222836
222836
|
crypto14.pbkdf2(getCryptoKey(baseKey).data, buffer2.Buffer.from(salt), algorithm.iterations, length4 >> 3, hash, (err, derivedBits) => {
|
|
222837
222837
|
if (err) {
|
|
222838
222838
|
reject(err);
|
|
222839
222839
|
} else {
|
|
222840
|
-
|
|
222840
|
+
resolve56(new Uint8Array(derivedBits).buffer);
|
|
222841
222841
|
}
|
|
222842
222842
|
});
|
|
222843
222843
|
});
|
|
@@ -223527,7 +223527,7 @@ var init_tls = __esm({
|
|
|
223527
223527
|
socket.emit("error", new HandshakeTimeoutError());
|
|
223528
223528
|
};
|
|
223529
223529
|
options2?.signal?.addEventListener("abort", onAbort);
|
|
223530
|
-
return new Promise((
|
|
223530
|
+
return new Promise((resolve56, reject) => {
|
|
223531
223531
|
const verifyRemote = () => {
|
|
223532
223532
|
const remote = socket.getPeerCertificate();
|
|
223533
223533
|
verifyPeerCertificate(remote.raw, options2?.remotePeer, log22).then((remotePeer) => {
|
|
@@ -223542,7 +223542,7 @@ var init_tls = __esm({
|
|
|
223542
223542
|
reject(err);
|
|
223543
223543
|
}
|
|
223544
223544
|
}
|
|
223545
|
-
|
|
223545
|
+
resolve56({
|
|
223546
223546
|
remotePeer,
|
|
223547
223547
|
connection: toMessageStream2(connection, socket),
|
|
223548
223548
|
streamMuxer
|
|
@@ -229785,12 +229785,12 @@ var require_parser2 = __commonJS({
|
|
|
229785
229785
|
};
|
|
229786
229786
|
Parser2.prototype.parseStringPromise = function(str) {
|
|
229787
229787
|
return new Promise(/* @__PURE__ */ (function(_this) {
|
|
229788
|
-
return function(
|
|
229788
|
+
return function(resolve56, reject) {
|
|
229789
229789
|
return _this.parseString(str, function(err, value2) {
|
|
229790
229790
|
if (err) {
|
|
229791
229791
|
return reject(err);
|
|
229792
229792
|
} else {
|
|
229793
|
-
return
|
|
229793
|
+
return resolve56(value2);
|
|
229794
229794
|
}
|
|
229795
229795
|
});
|
|
229796
229796
|
};
|
|
@@ -230116,7 +230116,7 @@ function initRequest(url, init2) {
|
|
|
230116
230116
|
}
|
|
230117
230117
|
}
|
|
230118
230118
|
async function fetch3(url, init2 = {}) {
|
|
230119
|
-
return new Promise((
|
|
230119
|
+
return new Promise((resolve56, reject) => {
|
|
230120
230120
|
const request = initRequest(new URL(url), init2);
|
|
230121
230121
|
if (init2.body != null) {
|
|
230122
230122
|
request.write(init2.body);
|
|
@@ -230135,7 +230135,7 @@ async function fetch3(url, init2 = {}) {
|
|
|
230135
230135
|
body += chunk.toString();
|
|
230136
230136
|
});
|
|
230137
230137
|
response.on("end", () => {
|
|
230138
|
-
|
|
230138
|
+
resolve56(body);
|
|
230139
230139
|
});
|
|
230140
230140
|
response.on("error", (err) => {
|
|
230141
230141
|
reject(err);
|
|
@@ -230283,7 +230283,7 @@ var init_broadcast_advert = __esm({
|
|
|
230283
230283
|
// ../node_modules/freeport-promise/dist/src/index.js
|
|
230284
230284
|
import { createServer } from "net";
|
|
230285
230285
|
async function freeport() {
|
|
230286
|
-
return await new Promise((
|
|
230286
|
+
return await new Promise((resolve56, reject) => {
|
|
230287
230287
|
const server2 = createServer();
|
|
230288
230288
|
let port = 0;
|
|
230289
230289
|
server2.once("listening", () => {
|
|
@@ -230298,7 +230298,7 @@ async function freeport() {
|
|
|
230298
230298
|
server2.close();
|
|
230299
230299
|
});
|
|
230300
230300
|
server2.once("close", () => {
|
|
230301
|
-
|
|
230301
|
+
resolve56(port);
|
|
230302
230302
|
});
|
|
230303
230303
|
server2.once("error", reject);
|
|
230304
230304
|
server2.listen(0, "127.0.0.1");
|
|
@@ -230362,7 +230362,7 @@ async function createLocation(ssdp, advert) {
|
|
|
230362
230362
|
advert.location = {};
|
|
230363
230363
|
await Promise.all(ssdp.sockets.map(async (socket) => Promise.all(findAllInterfaces(socket.type === "udp4" && advert.ipv4, socket.type === "udp6" && advert.ipv6).map(async (iface) => {
|
|
230364
230364
|
await freeport().then(async (port) => {
|
|
230365
|
-
await new Promise((
|
|
230365
|
+
await new Promise((resolve56, reject) => {
|
|
230366
230366
|
let location = "http://";
|
|
230367
230367
|
if (socket.type === "udp6") {
|
|
230368
230368
|
location += `[${iface.address}]`;
|
|
@@ -230376,7 +230376,7 @@ async function createLocation(ssdp, advert) {
|
|
|
230376
230376
|
});
|
|
230377
230377
|
const addr = socket.address();
|
|
230378
230378
|
server2.listen(port, addr.address, () => {
|
|
230379
|
-
|
|
230379
|
+
resolve56();
|
|
230380
230380
|
});
|
|
230381
230381
|
server2.on("error", (err) => {
|
|
230382
230382
|
reject(err);
|
|
@@ -230386,9 +230386,9 @@ async function createLocation(ssdp, advert) {
|
|
|
230386
230386
|
});
|
|
230387
230387
|
}))));
|
|
230388
230388
|
return async () => {
|
|
230389
|
-
await Promise.all(servers.map(async (server2) => new Promise((
|
|
230389
|
+
await Promise.all(servers.map(async (server2) => new Promise((resolve56, reject) => {
|
|
230390
230390
|
server2.close();
|
|
230391
|
-
|
|
230391
|
+
resolve56();
|
|
230392
230392
|
})));
|
|
230393
230393
|
};
|
|
230394
230394
|
}
|
|
@@ -230581,10 +230581,10 @@ function parseAdvertOptions(ssdp, options2) {
|
|
|
230581
230581
|
}, options2);
|
|
230582
230582
|
const details = opts.details;
|
|
230583
230583
|
opts.details = async () => {
|
|
230584
|
-
return new Promise((
|
|
230584
|
+
return new Promise((resolve56, reject) => {
|
|
230585
230585
|
try {
|
|
230586
230586
|
const builder = new import_xml2js3.default.Builder();
|
|
230587
|
-
|
|
230587
|
+
resolve56(builder.buildObject(details));
|
|
230588
230588
|
} catch (error) {
|
|
230589
230589
|
reject(error);
|
|
230590
230590
|
}
|
|
@@ -230663,7 +230663,7 @@ import { createSocket } from "node:dgram";
|
|
|
230663
230663
|
async function createSockets(ssdp, signal) {
|
|
230664
230664
|
const sockets = [];
|
|
230665
230665
|
await Promise.allSettled((ssdp.options.sockets ?? []).map(async (options2) => {
|
|
230666
|
-
return new Promise((
|
|
230666
|
+
return new Promise((resolve56, reject) => {
|
|
230667
230667
|
const socket = createSocket({
|
|
230668
230668
|
type: options2.type ?? "udp4",
|
|
230669
230669
|
ipv6Only: options2.type === "udp6",
|
|
@@ -230687,7 +230687,7 @@ async function createSockets(ssdp, signal) {
|
|
|
230687
230687
|
socket.setMulticastTTL(options2.maxHops);
|
|
230688
230688
|
}
|
|
230689
230689
|
sockets.push(socket);
|
|
230690
|
-
|
|
230690
|
+
resolve56();
|
|
230691
230691
|
} catch (error) {
|
|
230692
230692
|
error.message = `Adding membership ${options2.broadcast?.address} failed - ${error.message}`;
|
|
230693
230693
|
reject(error);
|
|
@@ -230852,14 +230852,14 @@ var init_utils37 = __esm({
|
|
|
230852
230852
|
// ../node_modules/@achingbrain/ssdp/dist/src/send-ssdp-message.js
|
|
230853
230853
|
function sendSsdpMessage(ssdp, status, headers, remote) {
|
|
230854
230854
|
Promise.all(ssdp.sockets.map(async (socket) => {
|
|
230855
|
-
await new Promise((
|
|
230855
|
+
await new Promise((resolve56, reject) => {
|
|
230856
230856
|
if (socket.closed) {
|
|
230857
|
-
|
|
230857
|
+
resolve56();
|
|
230858
230858
|
return;
|
|
230859
230859
|
}
|
|
230860
230860
|
const recipient = remote ?? socket.options.broadcast;
|
|
230861
230861
|
if (recipient != null && addressFamilyMismatch(recipient, socket)) {
|
|
230862
|
-
|
|
230862
|
+
resolve56();
|
|
230863
230863
|
return;
|
|
230864
230864
|
}
|
|
230865
230865
|
if (headers.LOCATION != null) {
|
|
@@ -230884,7 +230884,7 @@ function sendSsdpMessage(ssdp, status, headers, remote) {
|
|
|
230884
230884
|
reject(error);
|
|
230885
230885
|
return;
|
|
230886
230886
|
}
|
|
230887
|
-
|
|
230887
|
+
resolve56();
|
|
230888
230888
|
});
|
|
230889
230889
|
});
|
|
230890
230890
|
})).catch((err) => {
|
|
@@ -230941,9 +230941,9 @@ var init_ssdp = __esm({
|
|
|
230941
230941
|
async stop() {
|
|
230942
230942
|
await adverts.stopAll();
|
|
230943
230943
|
await Promise.all(this.sockets.map(async (socket) => {
|
|
230944
|
-
await new Promise((
|
|
230944
|
+
await new Promise((resolve56) => {
|
|
230945
230945
|
socket.on("close", () => {
|
|
230946
|
-
|
|
230946
|
+
resolve56();
|
|
230947
230947
|
});
|
|
230948
230948
|
socket.close();
|
|
230949
230949
|
socket.closed = true;
|
|
@@ -233534,12 +233534,12 @@ var init_RTCSctpTransport = __esm({
|
|
|
233534
233534
|
|
|
233535
233535
|
// ../node_modules/node-datachannel/dist/esm/polyfill/RTCPeerConnection.mjs
|
|
233536
233536
|
function createDeferredPromise() {
|
|
233537
|
-
let
|
|
233537
|
+
let resolve56, reject;
|
|
233538
233538
|
const promise = new Promise(function(_resolve, _reject) {
|
|
233539
|
-
|
|
233539
|
+
resolve56 = _resolve;
|
|
233540
233540
|
reject = _reject;
|
|
233541
233541
|
});
|
|
233542
|
-
promise.resolve =
|
|
233542
|
+
promise.resolve = resolve56;
|
|
233543
233543
|
promise.reject = reject;
|
|
233544
233544
|
return promise;
|
|
233545
233545
|
}
|
|
@@ -233856,14 +233856,14 @@ var init_RTCPeerConnection = __esm({
|
|
|
233856
233856
|
throw new DOMException("Not implemented");
|
|
233857
233857
|
}
|
|
233858
233858
|
getStats() {
|
|
233859
|
-
return new Promise((
|
|
233859
|
+
return new Promise((resolve56) => {
|
|
233860
233860
|
const report2 = /* @__PURE__ */ new Map();
|
|
233861
233861
|
const cp2 = __privateGet9(this, _peerConnection)?.getSelectedCandidatePair();
|
|
233862
233862
|
const bytesSent = __privateGet9(this, _peerConnection)?.bytesSent();
|
|
233863
233863
|
const bytesReceived = __privateGet9(this, _peerConnection)?.bytesReceived();
|
|
233864
233864
|
const rtt = __privateGet9(this, _peerConnection)?.rtt();
|
|
233865
233865
|
if (!cp2) {
|
|
233866
|
-
return
|
|
233866
|
+
return resolve56(report2);
|
|
233867
233867
|
}
|
|
233868
233868
|
const localIdRs = getRandomString(8);
|
|
233869
233869
|
const localId = "RTCIceCandidate_" + localIdRs;
|
|
@@ -233918,7 +233918,7 @@ var init_RTCPeerConnection = __esm({
|
|
|
233918
233918
|
dataChannelsOpened: __privateGet9(this, _dataChannels).size,
|
|
233919
233919
|
dataChannelsClosed: __privateGet9(this, _dataChannelsClosed)
|
|
233920
233920
|
});
|
|
233921
|
-
return
|
|
233921
|
+
return resolve56(report2);
|
|
233922
233922
|
});
|
|
233923
233923
|
}
|
|
233924
233924
|
getTransceivers() {
|
|
@@ -234749,14 +234749,14 @@ var init_get_port = __esm({
|
|
|
234749
234749
|
}
|
|
234750
234750
|
return results;
|
|
234751
234751
|
};
|
|
234752
|
-
checkAvailablePort = (options2) => new Promise((
|
|
234752
|
+
checkAvailablePort = (options2) => new Promise((resolve56, reject) => {
|
|
234753
234753
|
const server2 = net3.createServer();
|
|
234754
234754
|
server2.unref();
|
|
234755
234755
|
server2.on("error", reject);
|
|
234756
234756
|
server2.listen(options2, () => {
|
|
234757
234757
|
const { port } = server2.address();
|
|
234758
234758
|
server2.close(() => {
|
|
234759
|
-
|
|
234759
|
+
resolve56(port);
|
|
234760
234760
|
});
|
|
234761
234761
|
});
|
|
234762
234762
|
});
|
|
@@ -234829,12 +234829,12 @@ var resolveValue, sleep2, validateOptions, createTimeoutError, handleFallback, h
|
|
|
234829
234829
|
var init_p_wait_for = __esm({
|
|
234830
234830
|
"../node_modules/p-wait-for/index.js"() {
|
|
234831
234831
|
resolveValue = /* @__PURE__ */ Symbol("resolveValue");
|
|
234832
|
-
sleep2 = (ms, signal) => new Promise((
|
|
234832
|
+
sleep2 = (ms, signal) => new Promise((resolve56, reject) => {
|
|
234833
234833
|
if (signal?.aborted) {
|
|
234834
234834
|
reject(signal.reason);
|
|
234835
234835
|
return;
|
|
234836
234836
|
}
|
|
234837
|
-
const timeout2 = setTimeout(
|
|
234837
|
+
const timeout2 = setTimeout(resolve56, ms);
|
|
234838
234838
|
if (signal) {
|
|
234839
234839
|
signal.addEventListener("abort", () => {
|
|
234840
234840
|
clearTimeout(timeout2);
|
|
@@ -239808,10 +239808,10 @@ var init_listener5 = __esm({
|
|
|
239808
239808
|
...config,
|
|
239809
239809
|
ipv6Only: config.type === "ip6"
|
|
239810
239810
|
});
|
|
239811
|
-
await new Promise((
|
|
239811
|
+
await new Promise((resolve56, reject) => {
|
|
239812
239812
|
const onListening = () => {
|
|
239813
239813
|
removeListeners();
|
|
239814
|
-
|
|
239814
|
+
resolve56();
|
|
239815
239815
|
};
|
|
239816
239816
|
const onError = (err) => {
|
|
239817
239817
|
this.metrics.errors?.increment({ [`${this.addr} listen_error`]: true });
|
|
@@ -250271,41 +250271,41 @@ var require_queue = __commonJS({
|
|
|
250271
250271
|
queue.drained = drained;
|
|
250272
250272
|
return queue;
|
|
250273
250273
|
function push(value2) {
|
|
250274
|
-
var p2 = new Promise(function(
|
|
250274
|
+
var p2 = new Promise(function(resolve56, reject) {
|
|
250275
250275
|
pushCb(value2, function(err, result) {
|
|
250276
250276
|
if (err) {
|
|
250277
250277
|
reject(err);
|
|
250278
250278
|
return;
|
|
250279
250279
|
}
|
|
250280
|
-
|
|
250280
|
+
resolve56(result);
|
|
250281
250281
|
});
|
|
250282
250282
|
});
|
|
250283
250283
|
p2.catch(noop2);
|
|
250284
250284
|
return p2;
|
|
250285
250285
|
}
|
|
250286
250286
|
function unshift(value2) {
|
|
250287
|
-
var p2 = new Promise(function(
|
|
250287
|
+
var p2 = new Promise(function(resolve56, reject) {
|
|
250288
250288
|
unshiftCb(value2, function(err, result) {
|
|
250289
250289
|
if (err) {
|
|
250290
250290
|
reject(err);
|
|
250291
250291
|
return;
|
|
250292
250292
|
}
|
|
250293
|
-
|
|
250293
|
+
resolve56(result);
|
|
250294
250294
|
});
|
|
250295
250295
|
});
|
|
250296
250296
|
p2.catch(noop2);
|
|
250297
250297
|
return p2;
|
|
250298
250298
|
}
|
|
250299
250299
|
function drained() {
|
|
250300
|
-
var p2 = new Promise(function(
|
|
250300
|
+
var p2 = new Promise(function(resolve56) {
|
|
250301
250301
|
process.nextTick(function() {
|
|
250302
250302
|
if (queue.idle()) {
|
|
250303
|
-
|
|
250303
|
+
resolve56();
|
|
250304
250304
|
} else {
|
|
250305
250305
|
var previousDrain = queue.drain;
|
|
250306
250306
|
queue.drain = function() {
|
|
250307
250307
|
if (typeof previousDrain === "function") previousDrain();
|
|
250308
|
-
|
|
250308
|
+
resolve56();
|
|
250309
250309
|
queue.drain = previousDrain;
|
|
250310
250310
|
};
|
|
250311
250311
|
}
|
|
@@ -250791,9 +250791,9 @@ var require_stream4 = __commonJS({
|
|
|
250791
250791
|
});
|
|
250792
250792
|
}
|
|
250793
250793
|
_getStat(filepath) {
|
|
250794
|
-
return new Promise((
|
|
250794
|
+
return new Promise((resolve56, reject) => {
|
|
250795
250795
|
this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
|
250796
|
-
return error === null ?
|
|
250796
|
+
return error === null ? resolve56(stats) : reject(error);
|
|
250797
250797
|
});
|
|
250798
250798
|
});
|
|
250799
250799
|
}
|
|
@@ -250817,10 +250817,10 @@ var require_async6 = __commonJS({
|
|
|
250817
250817
|
this._readerStream = new stream_1.default(this._settings);
|
|
250818
250818
|
}
|
|
250819
250819
|
dynamic(root, options2) {
|
|
250820
|
-
return new Promise((
|
|
250820
|
+
return new Promise((resolve56, reject) => {
|
|
250821
250821
|
this._walkAsync(root, options2, (error, entries) => {
|
|
250822
250822
|
if (error === null) {
|
|
250823
|
-
|
|
250823
|
+
resolve56(entries);
|
|
250824
250824
|
} else {
|
|
250825
250825
|
reject(error);
|
|
250826
250826
|
}
|
|
@@ -250830,10 +250830,10 @@ var require_async6 = __commonJS({
|
|
|
250830
250830
|
async static(patterns, options2) {
|
|
250831
250831
|
const entries = [];
|
|
250832
250832
|
const stream = this._readerStream.static(patterns, options2);
|
|
250833
|
-
return new Promise((
|
|
250833
|
+
return new Promise((resolve56, reject) => {
|
|
250834
250834
|
stream.once("error", reject);
|
|
250835
250835
|
stream.on("data", (entry) => entries.push(entry));
|
|
250836
|
-
stream.once("end", () =>
|
|
250836
|
+
stream.once("end", () => resolve56(entries));
|
|
250837
250837
|
});
|
|
250838
250838
|
}
|
|
250839
250839
|
};
|
|
@@ -251675,7 +251675,7 @@ async function retryAsyncOperation(fn, maxRetries, delayMs) {
|
|
|
251675
251675
|
return await fn();
|
|
251676
251676
|
} catch (error) {
|
|
251677
251677
|
if (i2 < maxRetries - 1) {
|
|
251678
|
-
await new Promise((
|
|
251678
|
+
await new Promise((resolve56) => setTimeout(resolve56, delayMs));
|
|
251679
251679
|
} else {
|
|
251680
251680
|
throw error;
|
|
251681
251681
|
}
|
|
@@ -251696,11 +251696,11 @@ var init_lib3 = __esm({
|
|
|
251696
251696
|
// File is locked, add data for later
|
|
251697
251697
|
#add(data) {
|
|
251698
251698
|
this.#nextData = data;
|
|
251699
|
-
this.#nextPromise ||= new Promise((
|
|
251700
|
-
this.#next = [
|
|
251699
|
+
this.#nextPromise ||= new Promise((resolve56, reject) => {
|
|
251700
|
+
this.#next = [resolve56, reject];
|
|
251701
251701
|
});
|
|
251702
|
-
return new Promise((
|
|
251703
|
-
this.#nextPromise?.then(
|
|
251702
|
+
return new Promise((resolve56, reject) => {
|
|
251703
|
+
this.#nextPromise?.then(resolve56).catch(reject);
|
|
251704
251704
|
});
|
|
251705
251705
|
}
|
|
251706
251706
|
// File isn't locked, write data
|
|
@@ -252231,7 +252231,7 @@ Justification: ${justification || "(none provided)"}`,
|
|
|
252231
252231
|
})();
|
|
252232
252232
|
const ipfsResult = await Promise.race([
|
|
252233
252233
|
ipfsPromise,
|
|
252234
|
-
new Promise((
|
|
252234
|
+
new Promise((resolve56) => setTimeout(() => resolve56(null), 2e3))
|
|
252235
252235
|
]);
|
|
252236
252236
|
if (ipfsResult && ipfsResult.success) {
|
|
252237
252237
|
const cidData = JSON.parse(ipfsResult.output);
|
|
@@ -252752,7 +252752,7 @@ print("__OMNIUS_REPL_READY__")
|
|
|
252752
252752
|
return;
|
|
252753
252753
|
const sockId = randomBytes11(8).toString("hex");
|
|
252754
252754
|
this.ipcPath = join33(tmpdir5(), `omnius-repl-ipc-${sockId}.sock`);
|
|
252755
|
-
return new Promise((
|
|
252755
|
+
return new Promise((resolve56, reject) => {
|
|
252756
252756
|
this.ipcServer = createServer2((conn) => {
|
|
252757
252757
|
let buffer2 = new Uint8Array(0);
|
|
252758
252758
|
conn.on("data", (chunk) => {
|
|
@@ -252768,7 +252768,7 @@ print("__OMNIUS_REPL_READY__")
|
|
|
252768
252768
|
});
|
|
252769
252769
|
});
|
|
252770
252770
|
this.ipcServer.on("error", reject);
|
|
252771
|
-
this.ipcServer.listen(this.ipcPath, () =>
|
|
252771
|
+
this.ipcServer.listen(this.ipcPath, () => resolve56());
|
|
252772
252772
|
});
|
|
252773
252773
|
}
|
|
252774
252774
|
async processIpcBuffer(conn, input) {
|
|
@@ -252831,9 +252831,9 @@ print("__OMNIUS_REPL_READY__")
|
|
|
252831
252831
|
}
|
|
252832
252832
|
// ── Code execution ─────────────────────────────────────────────────────
|
|
252833
252833
|
executeCode(code8, isInit = false) {
|
|
252834
|
-
return new Promise((
|
|
252834
|
+
return new Promise((resolve56) => {
|
|
252835
252835
|
if (!this.proc?.stdin || !this.proc?.stdout || !this.proc?.stderr) {
|
|
252836
|
-
|
|
252836
|
+
resolve56({ success: false, output: "REPL process not available", error: "No process", durationMs: 0 });
|
|
252837
252837
|
return;
|
|
252838
252838
|
}
|
|
252839
252839
|
const sentinel = `__OMNIUS_SENTINEL_${randomBytes11(6).toString("hex")}__`;
|
|
@@ -252843,7 +252843,7 @@ print("__OMNIUS_REPL_READY__")
|
|
|
252843
252843
|
const timeout2 = setTimeout(() => {
|
|
252844
252844
|
if (!resolved) {
|
|
252845
252845
|
resolved = true;
|
|
252846
|
-
|
|
252846
|
+
resolve56({
|
|
252847
252847
|
success: false,
|
|
252848
252848
|
output: stdout || "Execution timed out",
|
|
252849
252849
|
error: `Timeout after ${this.execTimeout / 1e3}s`,
|
|
@@ -252860,13 +252860,13 @@ print("__OMNIUS_REPL_READY__")
|
|
|
252860
252860
|
if (isInit) {
|
|
252861
252861
|
const ready = cleanOutput.includes("__OMNIUS_REPL_READY__");
|
|
252862
252862
|
const displayOutput = cleanOutput.replace("__OMNIUS_REPL_READY__", "").trim();
|
|
252863
|
-
|
|
252863
|
+
resolve56({
|
|
252864
252864
|
success: ready,
|
|
252865
252865
|
output: displayOutput || "REPL initialized",
|
|
252866
252866
|
durationMs: 0
|
|
252867
252867
|
});
|
|
252868
252868
|
} else {
|
|
252869
|
-
|
|
252869
|
+
resolve56({
|
|
252870
252870
|
success: true,
|
|
252871
252871
|
output: cleanOutput || "(no output)",
|
|
252872
252872
|
durationMs: 0
|
|
@@ -252875,7 +252875,7 @@ print("__OMNIUS_REPL_READY__")
|
|
|
252875
252875
|
}
|
|
252876
252876
|
if (stdout.length > 2e5) {
|
|
252877
252877
|
cleanup();
|
|
252878
|
-
|
|
252878
|
+
resolve56({
|
|
252879
252879
|
success: true,
|
|
252880
252880
|
output: stdout.slice(0, 2e5) + "\n[output truncated at 200KB]",
|
|
252881
252881
|
durationMs: 0
|
|
@@ -259281,7 +259281,7 @@ async function launchComfyBackground(args) {
|
|
|
259281
259281
|
if (child.exitCode !== null) {
|
|
259282
259282
|
throw new Error(`ComfyUI bootstrap exited with code ${child.exitCode} before becoming reachable.`);
|
|
259283
259283
|
}
|
|
259284
|
-
await new Promise((
|
|
259284
|
+
await new Promise((resolve56) => setTimeout(resolve56, 1e3));
|
|
259285
259285
|
}
|
|
259286
259286
|
child.kill("SIGTERM");
|
|
259287
259287
|
throw new Error("ComfyUI did not become reachable within 4 minutes.");
|
|
@@ -259316,7 +259316,7 @@ async function comfyPollHistory(client, promptId, onProgress) {
|
|
|
259316
259316
|
if (onProgress && attempt % 5 === 0) {
|
|
259317
259317
|
onProgress({ stage: "generate", message: `ComfyUI rendering prompt ${promptId.slice(0, 8)} (attempt ${attempt})` });
|
|
259318
259318
|
}
|
|
259319
|
-
await new Promise((
|
|
259319
|
+
await new Promise((resolve56) => setTimeout(resolve56, 3e3));
|
|
259320
259320
|
}
|
|
259321
259321
|
throw new Error(`ComfyUI prompt ${promptId} did not complete within 30 minutes.`);
|
|
259322
259322
|
}
|
|
@@ -259382,23 +259382,23 @@ async function muxAudioIntoVideo(args) {
|
|
|
259382
259382
|
"1:a:0",
|
|
259383
259383
|
args.outputPath
|
|
259384
259384
|
];
|
|
259385
|
-
return await new Promise((
|
|
259385
|
+
return await new Promise((resolve56) => {
|
|
259386
259386
|
const child = spawn10(ffmpegBin(), argv, { stdio: ["ignore", "pipe", "pipe"] });
|
|
259387
259387
|
let stderr = "";
|
|
259388
259388
|
child.stderr?.on("data", (chunk) => {
|
|
259389
259389
|
stderr += chunk.toString();
|
|
259390
259390
|
});
|
|
259391
|
-
child.on("error", (err) =>
|
|
259391
|
+
child.on("error", (err) => resolve56({ ok: false, error: String(err.message || err) }));
|
|
259392
259392
|
child.on("close", (code8) => {
|
|
259393
259393
|
if (code8 === 0)
|
|
259394
|
-
|
|
259394
|
+
resolve56({ ok: true });
|
|
259395
259395
|
else
|
|
259396
|
-
|
|
259396
|
+
resolve56({ ok: false, error: `ffmpeg exited with code ${code8}: ${stderr.slice(0, 400)}` });
|
|
259397
259397
|
});
|
|
259398
259398
|
});
|
|
259399
259399
|
}
|
|
259400
259400
|
async function ffmpegExtractFirstFrame(videoPath, thumbnailPath) {
|
|
259401
|
-
return await new Promise((
|
|
259401
|
+
return await new Promise((resolve56) => {
|
|
259402
259402
|
const child = spawn10(ffmpegBin(), [
|
|
259403
259403
|
"-hide_banner",
|
|
259404
259404
|
"-loglevel",
|
|
@@ -259412,8 +259412,8 @@ async function ffmpegExtractFirstFrame(videoPath, thumbnailPath) {
|
|
|
259412
259412
|
"2",
|
|
259413
259413
|
thumbnailPath
|
|
259414
259414
|
], { stdio: ["ignore", "ignore", "ignore"] });
|
|
259415
|
-
child.on("error", () =>
|
|
259416
|
-
child.on("close", (code8) =>
|
|
259415
|
+
child.on("error", () => resolve56(false));
|
|
259416
|
+
child.on("close", (code8) => resolve56(code8 === 0));
|
|
259417
259417
|
});
|
|
259418
259418
|
}
|
|
259419
259419
|
function outputPath2(repoRoot) {
|
|
@@ -279843,7 +279843,7 @@ ${lanes.join("\n")}
|
|
|
279843
279843
|
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
279844
279844
|
}
|
|
279845
279845
|
}
|
|
279846
|
-
function createUseFsEventsOnParentDirectoryWatchFile(
|
|
279846
|
+
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch5, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp) {
|
|
279847
279847
|
const fileWatcherCallbacks = createMultiMap();
|
|
279848
279848
|
const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
|
|
279849
279849
|
const dirWatchers = /* @__PURE__ */ new Map();
|
|
@@ -279870,7 +279870,7 @@ ${lanes.join("\n")}
|
|
|
279870
279870
|
};
|
|
279871
279871
|
}
|
|
279872
279872
|
function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
|
|
279873
|
-
const watcher =
|
|
279873
|
+
const watcher = fsWatch5(
|
|
279874
279874
|
dirName,
|
|
279875
279875
|
1,
|
|
279876
279876
|
(eventName, relativeFileName) => {
|
|
@@ -280324,7 +280324,7 @@ ${lanes.join("\n")}
|
|
|
280324
280324
|
void 0
|
|
280325
280325
|
);
|
|
280326
280326
|
case 4:
|
|
280327
|
-
return
|
|
280327
|
+
return fsWatch5(
|
|
280328
280328
|
fileName,
|
|
280329
280329
|
0,
|
|
280330
280330
|
createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime3),
|
|
@@ -280335,7 +280335,7 @@ ${lanes.join("\n")}
|
|
|
280335
280335
|
);
|
|
280336
280336
|
case 5:
|
|
280337
280337
|
if (!nonPollingWatchFile) {
|
|
280338
|
-
nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(
|
|
280338
|
+
nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch5, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp);
|
|
280339
280339
|
}
|
|
280340
280340
|
return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options2));
|
|
280341
280341
|
default:
|
|
@@ -280390,7 +280390,7 @@ ${lanes.join("\n")}
|
|
|
280390
280390
|
}
|
|
280391
280391
|
function watchDirectory(directoryName, callback, recursive2, options2) {
|
|
280392
280392
|
if (fsSupportsRecursiveFsWatch) {
|
|
280393
|
-
return
|
|
280393
|
+
return fsWatch5(
|
|
280394
280394
|
directoryName,
|
|
280395
280395
|
1,
|
|
280396
280396
|
createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options2, useCaseSensitiveFileNames2, getCurrentDirectory),
|
|
@@ -280444,7 +280444,7 @@ ${lanes.join("\n")}
|
|
|
280444
280444
|
void 0
|
|
280445
280445
|
);
|
|
280446
280446
|
case 0:
|
|
280447
|
-
return
|
|
280447
|
+
return fsWatch5(
|
|
280448
280448
|
directoryName,
|
|
280449
280449
|
1,
|
|
280450
280450
|
createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options2, useCaseSensitiveFileNames2, getCurrentDirectory),
|
|
@@ -280486,7 +280486,7 @@ ${lanes.join("\n")}
|
|
|
280486
280486
|
(cb) => pollingWatchFileWorker(fileName, cb, pollingInterval, options2)
|
|
280487
280487
|
);
|
|
280488
280488
|
}
|
|
280489
|
-
function
|
|
280489
|
+
function fsWatch5(fileOrDirectory, entryKind, callback, recursive2, fallbackPollingInterval, fallbackOptions) {
|
|
280490
280490
|
return createSingleWatcherPerName(
|
|
280491
280491
|
recursive2 ? fsWatchesRecursive : fsWatches,
|
|
280492
280492
|
useCaseSensitiveFileNames2,
|
|
@@ -396347,7 +396347,7 @@ ${lanes.join("\n")}
|
|
|
396347
396347
|
}
|
|
396348
396348
|
}
|
|
396349
396349
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
396350
|
-
const
|
|
396350
|
+
const resolve56 = factory2.createUniqueName("resolve");
|
|
396351
396351
|
const reject = factory2.createUniqueName("reject");
|
|
396352
396352
|
const parameters = [
|
|
396353
396353
|
factory2.createParameterDeclaration(
|
|
@@ -396356,7 +396356,7 @@ ${lanes.join("\n")}
|
|
|
396356
396356
|
/*dotDotDotToken*/
|
|
396357
396357
|
void 0,
|
|
396358
396358
|
/*name*/
|
|
396359
|
-
|
|
396359
|
+
resolve56
|
|
396360
396360
|
),
|
|
396361
396361
|
factory2.createParameterDeclaration(
|
|
396362
396362
|
/*modifiers*/
|
|
@@ -396373,7 +396373,7 @@ ${lanes.join("\n")}
|
|
|
396373
396373
|
factory2.createIdentifier("require"),
|
|
396374
396374
|
/*typeArguments*/
|
|
396375
396375
|
void 0,
|
|
396376
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
396376
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve56, reject]
|
|
396377
396377
|
)
|
|
396378
396378
|
)
|
|
396379
396379
|
]);
|
|
@@ -483284,8 +483284,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
483284
483284
|
installPackage(options2) {
|
|
483285
483285
|
this.packageInstallId++;
|
|
483286
483286
|
const request = { kind: "installPackage", ...options2, id: this.packageInstallId };
|
|
483287
|
-
const promise = new Promise((
|
|
483288
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
483287
|
+
const promise = new Promise((resolve56, reject) => {
|
|
483288
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve56, reject });
|
|
483289
483289
|
});
|
|
483290
483290
|
this.installer.send(request);
|
|
483291
483291
|
return promise;
|
|
@@ -485545,7 +485545,7 @@ var require_path_browserify = __commonJS({
|
|
|
485545
485545
|
}
|
|
485546
485546
|
var posix = {
|
|
485547
485547
|
// path.resolve([from ...], to)
|
|
485548
|
-
resolve: function
|
|
485548
|
+
resolve: function resolve56() {
|
|
485549
485549
|
var resolvedPath = "";
|
|
485550
485550
|
var resolvedAbsolute = false;
|
|
485551
485551
|
var cwd4;
|
|
@@ -489736,12 +489736,12 @@ ${nodeLocation}` : message2;
|
|
|
489736
489736
|
};
|
|
489737
489737
|
var NodeRuntimeFileSystem = class {
|
|
489738
489738
|
delete(path13) {
|
|
489739
|
-
return new Promise((
|
|
489739
|
+
return new Promise((resolve56, reject) => {
|
|
489740
489740
|
fs__namespace.rm(path13, { recursive: true }, (err) => {
|
|
489741
489741
|
if (err)
|
|
489742
489742
|
reject(err);
|
|
489743
489743
|
else
|
|
489744
|
-
|
|
489744
|
+
resolve56();
|
|
489745
489745
|
});
|
|
489746
489746
|
});
|
|
489747
489747
|
}
|
|
@@ -489760,12 +489760,12 @@ ${nodeLocation}` : message2;
|
|
|
489760
489760
|
}));
|
|
489761
489761
|
}
|
|
489762
489762
|
readFile(filePath, encoding = "utf-8") {
|
|
489763
|
-
return new Promise((
|
|
489763
|
+
return new Promise((resolve56, reject) => {
|
|
489764
489764
|
fs__namespace.readFile(filePath, encoding, (err, data) => {
|
|
489765
489765
|
if (err)
|
|
489766
489766
|
reject(err);
|
|
489767
489767
|
else
|
|
489768
|
-
|
|
489768
|
+
resolve56(data);
|
|
489769
489769
|
});
|
|
489770
489770
|
});
|
|
489771
489771
|
}
|
|
@@ -489773,12 +489773,12 @@ ${nodeLocation}` : message2;
|
|
|
489773
489773
|
return fs__namespace.readFileSync(filePath, encoding);
|
|
489774
489774
|
}
|
|
489775
489775
|
async writeFile(filePath, fileText) {
|
|
489776
|
-
await new Promise((
|
|
489776
|
+
await new Promise((resolve56, reject) => {
|
|
489777
489777
|
fs__namespace.writeFile(filePath, fileText, (err) => {
|
|
489778
489778
|
if (err)
|
|
489779
489779
|
reject(err);
|
|
489780
489780
|
else
|
|
489781
|
-
|
|
489781
|
+
resolve56();
|
|
489782
489782
|
});
|
|
489783
489783
|
});
|
|
489784
489784
|
}
|
|
@@ -489792,12 +489792,12 @@ ${nodeLocation}` : message2;
|
|
|
489792
489792
|
fs__namespace.mkdirSync(dirPath, { recursive: true });
|
|
489793
489793
|
}
|
|
489794
489794
|
move(srcPath, destPath) {
|
|
489795
|
-
return new Promise((
|
|
489795
|
+
return new Promise((resolve56, reject) => {
|
|
489796
489796
|
fs__namespace.rename(srcPath, destPath, (err) => {
|
|
489797
489797
|
if (err)
|
|
489798
489798
|
reject(err);
|
|
489799
489799
|
else
|
|
489800
|
-
|
|
489800
|
+
resolve56();
|
|
489801
489801
|
});
|
|
489802
489802
|
});
|
|
489803
489803
|
}
|
|
@@ -489805,12 +489805,12 @@ ${nodeLocation}` : message2;
|
|
|
489805
489805
|
fs__namespace.renameSync(srcPath, destPath);
|
|
489806
489806
|
}
|
|
489807
489807
|
copy(srcPath, destPath) {
|
|
489808
|
-
return new Promise((
|
|
489808
|
+
return new Promise((resolve56, reject) => {
|
|
489809
489809
|
fs__namespace.copyFile(srcPath, destPath, (err) => {
|
|
489810
489810
|
if (err)
|
|
489811
489811
|
reject(err);
|
|
489812
489812
|
else
|
|
489813
|
-
|
|
489813
|
+
resolve56();
|
|
489814
489814
|
});
|
|
489815
489815
|
});
|
|
489816
489816
|
}
|
|
@@ -489818,15 +489818,15 @@ ${nodeLocation}` : message2;
|
|
|
489818
489818
|
fs__namespace.copyFileSync(srcPath, destPath);
|
|
489819
489819
|
}
|
|
489820
489820
|
stat(path13) {
|
|
489821
|
-
return new Promise((
|
|
489821
|
+
return new Promise((resolve56, reject) => {
|
|
489822
489822
|
fs__namespace.stat(path13, (err, stat7) => {
|
|
489823
489823
|
if (err) {
|
|
489824
489824
|
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
|
489825
|
-
|
|
489825
|
+
resolve56(void 0);
|
|
489826
489826
|
else
|
|
489827
489827
|
reject(err);
|
|
489828
489828
|
} else {
|
|
489829
|
-
|
|
489829
|
+
resolve56(stat7);
|
|
489830
489830
|
}
|
|
489831
489831
|
});
|
|
489832
489832
|
});
|
|
@@ -516313,7 +516313,7 @@ function ensureLuxttsDaemon() {
|
|
|
516313
516313
|
if (!existsSync44(venvPy) || !existsSync44(inferScript))
|
|
516314
516314
|
return Promise.resolve(false);
|
|
516315
516315
|
_luxttsStarting = true;
|
|
516316
|
-
return new Promise((
|
|
516316
|
+
return new Promise((resolve56) => {
|
|
516317
516317
|
let settled = false;
|
|
516318
516318
|
let timeout2;
|
|
516319
516319
|
const finish = (ready) => {
|
|
@@ -516321,7 +516321,7 @@ function ensureLuxttsDaemon() {
|
|
|
516321
516321
|
return;
|
|
516322
516322
|
settled = true;
|
|
516323
516323
|
clearTimeout(timeout2);
|
|
516324
|
-
|
|
516324
|
+
resolve56(ready);
|
|
516325
516325
|
};
|
|
516326
516326
|
timeout2 = setTimeout(() => {
|
|
516327
516327
|
_luxttsStarting = false;
|
|
@@ -516387,7 +516387,7 @@ function ensureLuxttsDaemon() {
|
|
|
516387
516387
|
});
|
|
516388
516388
|
}
|
|
516389
516389
|
function luxttsSynthesize(text, cloneRef, outputPath3, speed = 1) {
|
|
516390
|
-
return new Promise((
|
|
516390
|
+
return new Promise((resolve56, reject) => {
|
|
516391
516391
|
if (!_luxttsDaemon || !_luxttsReady) {
|
|
516392
516392
|
reject(new Error("Daemon not ready"));
|
|
516393
516393
|
return;
|
|
@@ -516401,7 +516401,7 @@ function luxttsSynthesize(text, cloneRef, outputPath3, speed = 1) {
|
|
|
516401
516401
|
_luxttsPending.set(id, {
|
|
516402
516402
|
resolve: (path12) => {
|
|
516403
516403
|
clearTimeout(timeout2);
|
|
516404
|
-
|
|
516404
|
+
resolve56(path12 || outPath);
|
|
516405
516405
|
},
|
|
516406
516406
|
reject: (err) => {
|
|
516407
516407
|
clearTimeout(timeout2);
|
|
@@ -521924,7 +521924,7 @@ var init_transport5 = __esm({
|
|
|
521924
521924
|
});
|
|
521925
521925
|
}
|
|
521926
521926
|
request(req2, timeoutMs = 3e4) {
|
|
521927
|
-
return new Promise((
|
|
521927
|
+
return new Promise((resolve56, reject) => {
|
|
521928
521928
|
if (!this.process || !this._connected) {
|
|
521929
521929
|
return reject(new Error("Transport not connected"));
|
|
521930
521930
|
}
|
|
@@ -521932,7 +521932,7 @@ var init_transport5 = __esm({
|
|
|
521932
521932
|
this.pending.delete(req2.id);
|
|
521933
521933
|
reject(new Error(`MCP request timeout after ${timeoutMs}ms: ${req2.method}`));
|
|
521934
521934
|
}, timeoutMs);
|
|
521935
|
-
this.pending.set(req2.id, { resolve:
|
|
521935
|
+
this.pending.set(req2.id, { resolve: resolve56, reject, timer });
|
|
521936
521936
|
const line = JSON.stringify(req2) + "\n";
|
|
521937
521937
|
this.process.stdin?.write(line, (err) => {
|
|
521938
521938
|
if (err) {
|
|
@@ -525129,7 +525129,7 @@ import { spawn as spawn21 } from "node:child_process";
|
|
|
525129
525129
|
async function runShell(options2) {
|
|
525130
525130
|
const { command, args = [], cwd: cwd4, env: env2, timeoutMs = DEFAULT_TIMEOUT_MS2 } = options2;
|
|
525131
525131
|
const mergedEnv = env2 ? { ...process.env, ...env2 } : process.env;
|
|
525132
|
-
return new Promise((
|
|
525132
|
+
return new Promise((resolve56) => {
|
|
525133
525133
|
const start2 = Date.now();
|
|
525134
525134
|
let timedOut = false;
|
|
525135
525135
|
const child = spawn21(command, args, {
|
|
@@ -525153,7 +525153,7 @@ async function runShell(options2) {
|
|
|
525153
525153
|
clearTimeout(timer);
|
|
525154
525154
|
const durationMs = Date.now() - start2;
|
|
525155
525155
|
const exitCode = timedOut ? -1 : code8 ?? -1;
|
|
525156
|
-
|
|
525156
|
+
resolve56({
|
|
525157
525157
|
stdout,
|
|
525158
525158
|
stderr,
|
|
525159
525159
|
exitCode,
|
|
@@ -525165,7 +525165,7 @@ async function runShell(options2) {
|
|
|
525165
525165
|
child.on("error", (err) => {
|
|
525166
525166
|
clearTimeout(timer);
|
|
525167
525167
|
const durationMs = Date.now() - start2;
|
|
525168
|
-
|
|
525168
|
+
resolve56({
|
|
525169
525169
|
stdout,
|
|
525170
525170
|
stderr: stderr + err.message,
|
|
525171
525171
|
exitCode: -1,
|
|
@@ -525280,7 +525280,7 @@ async function applyUnifiedDiff(patch) {
|
|
|
525280
525280
|
}
|
|
525281
525281
|
function runWithStdin(options2) {
|
|
525282
525282
|
const { command, args, cwd: cwd4, stdin } = options2;
|
|
525283
|
-
return new Promise((
|
|
525283
|
+
return new Promise((resolve56) => {
|
|
525284
525284
|
const child = spawn22(command, args, {
|
|
525285
525285
|
cwd: cwd4,
|
|
525286
525286
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -525297,10 +525297,10 @@ function runWithStdin(options2) {
|
|
|
525297
525297
|
child.stdin.end();
|
|
525298
525298
|
child.on("close", (code8) => {
|
|
525299
525299
|
const exitCode = code8 ?? -1;
|
|
525300
|
-
|
|
525300
|
+
resolve56({ success: exitCode === 0, exitCode, stdout, stderr });
|
|
525301
525301
|
});
|
|
525302
525302
|
child.on("error", (err) => {
|
|
525303
|
-
|
|
525303
|
+
resolve56({ success: false, exitCode: -1, stdout, stderr: err.message });
|
|
525304
525304
|
});
|
|
525305
525305
|
});
|
|
525306
525306
|
}
|
|
@@ -528596,12 +528596,12 @@ async function maybeApplyInference(scan, options2, system) {
|
|
|
528596
528596
|
}
|
|
528597
528597
|
function makeSystem(overrides) {
|
|
528598
528598
|
const base3 = {
|
|
528599
|
-
runCommand: (command, args, timeoutMs) => new Promise((
|
|
528599
|
+
runCommand: (command, args, timeoutMs) => new Promise((resolve56, reject) => {
|
|
528600
528600
|
execFile5(command, args, { encoding: "utf8", timeout: timeoutMs }, (err, stdout) => {
|
|
528601
528601
|
if (err)
|
|
528602
528602
|
reject(err);
|
|
528603
528603
|
else
|
|
528604
|
-
|
|
528604
|
+
resolve56(stdout);
|
|
528605
528605
|
});
|
|
528606
528606
|
}),
|
|
528607
528607
|
readFile: async (path12) => fsReadFile(path12, "utf8"),
|
|
@@ -528627,7 +528627,7 @@ function makeSystem(overrides) {
|
|
|
528627
528627
|
return false;
|
|
528628
528628
|
}
|
|
528629
528629
|
},
|
|
528630
|
-
sleep: (ms) => new Promise((
|
|
528630
|
+
sleep: (ms) => new Promise((resolve56) => setTimeout(resolve56, ms)),
|
|
528631
528631
|
now: () => Date.now()
|
|
528632
528632
|
};
|
|
528633
528633
|
return { ...base3, ...overrides ?? {} };
|
|
@@ -529012,38 +529012,136 @@ function inferHomeFromProcUid(pid) {
|
|
|
529012
529012
|
}
|
|
529013
529013
|
return null;
|
|
529014
529014
|
}
|
|
529015
|
+
function detectPeerOmniusOllamaPool() {
|
|
529016
|
+
if (!isDirectory("/proc"))
|
|
529017
|
+
return false;
|
|
529018
|
+
const selfPid = String(process.pid);
|
|
529019
|
+
const selfPpid = String(process.ppid ?? "");
|
|
529020
|
+
const peerNodePids = /* @__PURE__ */ new Set();
|
|
529021
|
+
let entries;
|
|
529022
|
+
try {
|
|
529023
|
+
entries = readdirSync21("/proc", { withFileTypes: true }).filter((d2) => d2.isDirectory() && /^\d+$/.test(d2.name)).map((d2) => ({ name: d2.name }));
|
|
529024
|
+
} catch {
|
|
529025
|
+
return false;
|
|
529026
|
+
}
|
|
529027
|
+
for (const e2 of entries) {
|
|
529028
|
+
if (e2.name === selfPid || e2.name === selfPpid)
|
|
529029
|
+
continue;
|
|
529030
|
+
try {
|
|
529031
|
+
const cmdline = readFileSync50(`/proc/${e2.name}/cmdline`, "utf8");
|
|
529032
|
+
if (!cmdline.includes("node"))
|
|
529033
|
+
continue;
|
|
529034
|
+
if (!/[/\\]omnius[/\\]dist[/\\]index\.js|[/\\]omnius[/\\]/i.test(cmdline))
|
|
529035
|
+
continue;
|
|
529036
|
+
peerNodePids.add(e2.name);
|
|
529037
|
+
} catch {
|
|
529038
|
+
}
|
|
529039
|
+
}
|
|
529040
|
+
if (peerNodePids.size === 0)
|
|
529041
|
+
return false;
|
|
529042
|
+
for (const e2 of entries) {
|
|
529043
|
+
try {
|
|
529044
|
+
const cmd = readFileSync50(`/proc/${e2.name}/cmdline`, "utf8");
|
|
529045
|
+
if (!cmd.includes("ollama"))
|
|
529046
|
+
continue;
|
|
529047
|
+
if (!cmd.split("\0").includes("serve"))
|
|
529048
|
+
continue;
|
|
529049
|
+
const status = readFileSync50(`/proc/${e2.name}/status`, "utf8");
|
|
529050
|
+
const ppid = status.match(/^PPid:\s+(\d+)/m)?.[1];
|
|
529051
|
+
if (ppid && peerNodePids.has(ppid))
|
|
529052
|
+
return true;
|
|
529053
|
+
} catch {
|
|
529054
|
+
}
|
|
529055
|
+
}
|
|
529056
|
+
return false;
|
|
529057
|
+
}
|
|
529015
529058
|
async function detectGpus() {
|
|
529016
529059
|
if (_nvidiaSmiAvailable === false)
|
|
529017
529060
|
return [];
|
|
529018
|
-
return new Promise((
|
|
529019
|
-
|
|
529061
|
+
return new Promise((resolve56) => {
|
|
529062
|
+
const queryFields = "index,uuid,name,memory.total,memory.free,utilization.gpu,compute_cap";
|
|
529063
|
+
exec2(`nvidia-smi --query-gpu=${queryFields} --format=csv,noheader,nounits 2>/dev/null`, { encoding: "utf8", timeout: 3e3 }, (err, stdout) => {
|
|
529020
529064
|
if (err) {
|
|
529021
|
-
|
|
529022
|
-
|
|
529065
|
+
exec2("nvidia-smi --query-gpu=index,uuid,name,memory.total,memory.free,utilization.gpu --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 3e3 }, (err2, stdout2) => {
|
|
529066
|
+
if (err2) {
|
|
529067
|
+
_nvidiaSmiAvailable = false;
|
|
529068
|
+
resolve56([]);
|
|
529069
|
+
return;
|
|
529070
|
+
}
|
|
529071
|
+
_nvidiaSmiAvailable = true;
|
|
529072
|
+
resolve56(parseGpuQueryOutput(
|
|
529073
|
+
stdout2,
|
|
529074
|
+
/* hasComputeCap */
|
|
529075
|
+
false
|
|
529076
|
+
));
|
|
529077
|
+
});
|
|
529023
529078
|
return;
|
|
529024
529079
|
}
|
|
529025
529080
|
_nvidiaSmiAvailable = true;
|
|
529026
|
-
|
|
529027
|
-
|
|
529028
|
-
|
|
529029
|
-
|
|
529030
|
-
|
|
529031
|
-
const idx = Number(parts[0]);
|
|
529032
|
-
if (!Number.isFinite(idx))
|
|
529033
|
-
continue;
|
|
529034
|
-
gpus.push({
|
|
529035
|
-
index: idx,
|
|
529036
|
-
uuid: parts[1] ?? "",
|
|
529037
|
-
name: parts[2] ?? "",
|
|
529038
|
-
vramTotalMB: Number(parts[3]) || 0,
|
|
529039
|
-
vramFreeMB: Number(parts[4]) || 0,
|
|
529040
|
-
utilization: Number(parts[5]) || 0
|
|
529041
|
-
});
|
|
529042
|
-
}
|
|
529043
|
-
resolve55(gpus);
|
|
529081
|
+
resolve56(parseGpuQueryOutput(
|
|
529082
|
+
stdout,
|
|
529083
|
+
/* hasComputeCap */
|
|
529084
|
+
true
|
|
529085
|
+
));
|
|
529044
529086
|
});
|
|
529045
529087
|
});
|
|
529046
529088
|
}
|
|
529089
|
+
function parseGpuQueryOutput(stdout, hasComputeCap) {
|
|
529090
|
+
const gpus = [];
|
|
529091
|
+
const minFields = hasComputeCap ? 7 : 6;
|
|
529092
|
+
for (const line of stdout.split("\n")) {
|
|
529093
|
+
const parts = line.split(",").map((s2) => s2.trim());
|
|
529094
|
+
if (parts.length < minFields)
|
|
529095
|
+
continue;
|
|
529096
|
+
const idx = Number(parts[0]);
|
|
529097
|
+
if (!Number.isFinite(idx))
|
|
529098
|
+
continue;
|
|
529099
|
+
const info = {
|
|
529100
|
+
index: idx,
|
|
529101
|
+
uuid: parts[1] ?? "",
|
|
529102
|
+
name: parts[2] ?? "",
|
|
529103
|
+
vramTotalMB: Number(parts[3]) || 0,
|
|
529104
|
+
vramFreeMB: Number(parts[4]) || 0,
|
|
529105
|
+
utilization: Number(parts[5]) || 0
|
|
529106
|
+
};
|
|
529107
|
+
if (hasComputeCap) {
|
|
529108
|
+
const cap = Number(parts[6]);
|
|
529109
|
+
if (Number.isFinite(cap))
|
|
529110
|
+
info.computeCapability = cap;
|
|
529111
|
+
}
|
|
529112
|
+
gpus.push(info);
|
|
529113
|
+
}
|
|
529114
|
+
return gpus;
|
|
529115
|
+
}
|
|
529116
|
+
function resolveMinGpuVramMB() {
|
|
529117
|
+
const fromEnv = Number(process.env["OMNIUS_OLLAMA_MIN_GPU_MB"]);
|
|
529118
|
+
return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : DEFAULT_MIN_GPU_VRAM_MB;
|
|
529119
|
+
}
|
|
529120
|
+
function resolveMinComputeCapability() {
|
|
529121
|
+
const fromEnv = Number(process.env["OMNIUS_OLLAMA_MIN_COMPUTE_CAP"]);
|
|
529122
|
+
return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : DEFAULT_MIN_COMPUTE_CAPABILITY;
|
|
529123
|
+
}
|
|
529124
|
+
function isCapableForLLM(gpu, thresholds = {}) {
|
|
529125
|
+
const minVramMB = thresholds.minVramMB ?? resolveMinGpuVramMB();
|
|
529126
|
+
const minComputeCap = thresholds.minComputeCap ?? resolveMinComputeCapability();
|
|
529127
|
+
if (gpu.vramTotalMB < minVramMB)
|
|
529128
|
+
return false;
|
|
529129
|
+
if (gpu.computeCapability !== void 0 && gpu.computeCapability < minComputeCap)
|
|
529130
|
+
return false;
|
|
529131
|
+
return true;
|
|
529132
|
+
}
|
|
529133
|
+
function filterCapableGpus(gpus, thresholds) {
|
|
529134
|
+
return gpus.filter((g) => isCapableForLLM(g, thresholds));
|
|
529135
|
+
}
|
|
529136
|
+
function recommendMaxParallelFromVram(minFreeMB) {
|
|
529137
|
+
if (minFreeMB >= 60 * 1024)
|
|
529138
|
+
return 8;
|
|
529139
|
+
if (minFreeMB >= 40 * 1024)
|
|
529140
|
+
return 4;
|
|
529141
|
+
if (minFreeMB >= 24 * 1024)
|
|
529142
|
+
return 2;
|
|
529143
|
+
return 1;
|
|
529144
|
+
}
|
|
529047
529145
|
async function getHardwareSnapshot() {
|
|
529048
529146
|
const { totalmem: totalmem8, freemem: freemem7, cpus: cpus5 } = await import("node:os");
|
|
529049
529147
|
const gpus = await detectGpus();
|
|
@@ -529113,11 +529211,11 @@ function snapshotNetwork() {
|
|
|
529113
529211
|
async function findFreePort(start2) {
|
|
529114
529212
|
let port = start2;
|
|
529115
529213
|
for (; port < start2 + 1e3; port++) {
|
|
529116
|
-
const free = await new Promise((
|
|
529214
|
+
const free = await new Promise((resolve56) => {
|
|
529117
529215
|
const probe = createServer3();
|
|
529118
|
-
probe.once("error", () =>
|
|
529216
|
+
probe.once("error", () => resolve56(false));
|
|
529119
529217
|
probe.listen(port, "127.0.0.1", () => {
|
|
529120
|
-
probe.close(() =>
|
|
529218
|
+
probe.close(() => resolve56(true));
|
|
529121
529219
|
});
|
|
529122
529220
|
});
|
|
529123
529221
|
if (free)
|
|
@@ -529127,10 +529225,15 @@ async function findFreePort(start2) {
|
|
|
529127
529225
|
}
|
|
529128
529226
|
function resolveDefaultPoolConfig() {
|
|
529129
529227
|
const baseInstanceUrl = process.env["OMNIUS_OLLAMA_BASE_URL"] || process.env["OLLAMA_HOST"]?.replace(/^([^:/]+:[0-9]+)$/, "http://$1") || "http://127.0.0.1:11434";
|
|
529130
|
-
const
|
|
529131
|
-
const
|
|
529228
|
+
const maxParallelExplicit = process.env["OMNIUS_OLLAMA_MAX_PARALLEL"] !== void 0;
|
|
529229
|
+
const maxParallelPerInstance = maxParallelExplicit ? Number(process.env["OMNIUS_OLLAMA_MAX_PARALLEL"]) || 1 : 1;
|
|
529230
|
+
const autoTuneMaxParallel = !maxParallelExplicit;
|
|
529231
|
+
const gpuPlacementExplicit = process.env["OMNIUS_OLLAMA_GPU_PLACEMENT"] !== void 0;
|
|
529232
|
+
const maxInstancesExplicit = process.env["OMNIUS_OLLAMA_MAX_INSTANCES"] !== void 0;
|
|
529233
|
+
const peerPoolActive = !gpuPlacementExplicit && !maxInstancesExplicit && detectPeerOmniusOllamaPool();
|
|
529234
|
+
const maxSpawnedInstances = maxInstancesExplicit ? Number(process.env["OMNIUS_OLLAMA_MAX_INSTANCES"]) || 0 : peerPoolActive ? 1 : 0;
|
|
529132
529235
|
const targetGpuInstances = Number(process.env["OMNIUS_OLLAMA_TARGET_GPU_INSTANCES"]) || 0;
|
|
529133
|
-
const gpuPlacementRaw = (process.env["OMNIUS_OLLAMA_GPU_PLACEMENT"] ?? "auto").toLowerCase();
|
|
529236
|
+
const gpuPlacementRaw = (process.env["OMNIUS_OLLAMA_GPU_PLACEMENT"] ?? (peerPoolActive ? "elastic" : "auto")).toLowerCase();
|
|
529134
529237
|
const gpuPlacement = gpuPlacementRaw === "dedicated" || gpuPlacementRaw === "elastic" || gpuPlacementRaw === "auto" ? gpuPlacementRaw : "auto";
|
|
529135
529238
|
const idleMs = Number(process.env["OMNIUS_OLLAMA_IDLE_MS"]) || 3 * 60 * 60 * 1e3;
|
|
529136
529239
|
const reaperIntervalMs = Number(process.env["OMNIUS_OLLAMA_REAPER_MS"]) || 3e4;
|
|
@@ -529155,7 +529258,8 @@ function resolveDefaultPoolConfig() {
|
|
|
529155
529258
|
ollamaBinary,
|
|
529156
529259
|
spawnReadyTimeoutSec,
|
|
529157
529260
|
networkRxBudgetBytesPerSec,
|
|
529158
|
-
networkTxBudgetBytesPerSec
|
|
529261
|
+
networkTxBudgetBytesPerSec,
|
|
529262
|
+
autoTuneMaxParallel
|
|
529159
529263
|
};
|
|
529160
529264
|
}
|
|
529161
529265
|
function parseNullableNumber(value2) {
|
|
@@ -529223,11 +529327,13 @@ function setOllamaPool(pool3) {
|
|
|
529223
529327
|
_poolByBaseUrl.set(pool3.statusConfig().baseInstanceUrl, pool3);
|
|
529224
529328
|
}
|
|
529225
529329
|
}
|
|
529226
|
-
var _nvidiaSmiAvailable, _lastNetworkSnapshot, OllamaInstance, realInstanceSpawner, _gpuCursor, OllamaPool, _poolSingleton, _poolByBaseUrl;
|
|
529330
|
+
var _nvidiaSmiAvailable, DEFAULT_MIN_GPU_VRAM_MB, DEFAULT_MIN_COMPUTE_CAPABILITY, _lastNetworkSnapshot, OllamaInstance, realInstanceSpawner, _gpuCursor, OllamaPool, _poolSingleton, _poolByBaseUrl;
|
|
529227
529331
|
var init_ollama_pool = __esm({
|
|
529228
529332
|
"packages/orchestrator/dist/ollama-pool.js"() {
|
|
529229
529333
|
"use strict";
|
|
529230
529334
|
_nvidiaSmiAvailable = null;
|
|
529335
|
+
DEFAULT_MIN_GPU_VRAM_MB = 16 * 1024;
|
|
529336
|
+
DEFAULT_MIN_COMPUTE_CAPABILITY = 7;
|
|
529231
529337
|
_lastNetworkSnapshot = null;
|
|
529232
529338
|
OllamaInstance = class {
|
|
529233
529339
|
state;
|
|
@@ -529281,6 +529387,7 @@ var init_ollama_pool = __esm({
|
|
|
529281
529387
|
env2["OLLAMA_MODELS"] = config.sharedModelStore;
|
|
529282
529388
|
}
|
|
529283
529389
|
env2["OLLAMA_NUM_PARALLEL"] = String(config.maxParallelPerInstance);
|
|
529390
|
+
env2["OLLAMA_KEEP_ALIVE"] = process.env["OMNIUS_OLLAMA_SPAWN_KEEP_ALIVE"] ?? "-1";
|
|
529284
529391
|
if (gpuUuid) {
|
|
529285
529392
|
env2["CUDA_VISIBLE_DEVICES"] = gpuUuid;
|
|
529286
529393
|
env2["GPU_DEVICE_ORDINAL"] = gpuIndex === null ? "" : String(gpuIndex);
|
|
@@ -529334,6 +529441,20 @@ var init_ollama_pool = __esm({
|
|
|
529334
529441
|
dedicatedGpuPoolActive = false;
|
|
529335
529442
|
activePlacementMode = "constrained";
|
|
529336
529443
|
gpuCache = null;
|
|
529444
|
+
/**
|
|
529445
|
+
* Set once after the first capability-filtered GPU detection. Prevents the
|
|
529446
|
+
* auto-tune from oscillating maxParallelPerInstance as free VRAM fluctuates
|
|
529447
|
+
* during normal inference.
|
|
529448
|
+
*/
|
|
529449
|
+
_autoTuned = false;
|
|
529450
|
+
/** UUIDs we've already emitted gpu-excluded for. Prevents log spam. */
|
|
529451
|
+
_excludedGpusReported = /* @__PURE__ */ new Set();
|
|
529452
|
+
/**
|
|
529453
|
+
* Cached model footprint in MiB (model name → estimated VRAM required).
|
|
529454
|
+
* Populated lazily via /api/show on the base instance. null sentinel means
|
|
529455
|
+
* "we tried but failed" so we don't re-probe in a tight loop.
|
|
529456
|
+
*/
|
|
529457
|
+
_modelVramEstimateMB = /* @__PURE__ */ new Map();
|
|
529337
529458
|
slotWaiters = [];
|
|
529338
529459
|
/**
|
|
529339
529460
|
* Agent → preferred instance id. Set whenever an acquire resolves an
|
|
@@ -529492,7 +529613,7 @@ var init_ollama_pool = __esm({
|
|
|
529492
529613
|
this.recordAffinity(agentId, pick.state.id);
|
|
529493
529614
|
return this.buildSlot(pick, agentId);
|
|
529494
529615
|
}
|
|
529495
|
-
await new Promise((
|
|
529616
|
+
await new Promise((resolve56) => this.slotWaiters.push(resolve56));
|
|
529496
529617
|
}
|
|
529497
529618
|
}
|
|
529498
529619
|
wakeNextSlotWaiter() {
|
|
@@ -529533,7 +529654,18 @@ var init_ollama_pool = __esm({
|
|
|
529533
529654
|
const freedPick = this.pickInstance({ model });
|
|
529534
529655
|
if (freedPick)
|
|
529535
529656
|
return freedPick;
|
|
529536
|
-
const
|
|
529657
|
+
const vramNeededMB = await this.estimateModelVramMB(model);
|
|
529658
|
+
const capable = this.gpusWithCapacityForModel(gpus, vramNeededMB);
|
|
529659
|
+
if (capable.length === 0 && vramNeededMB !== null) {
|
|
529660
|
+
this.emit("spawn-skipped", {
|
|
529661
|
+
reason: "insufficient-vram",
|
|
529662
|
+
model,
|
|
529663
|
+
vramNeededMB,
|
|
529664
|
+
gpuFreeMBs: gpus.map((g) => g.vramFreeMB)
|
|
529665
|
+
});
|
|
529666
|
+
return null;
|
|
529667
|
+
}
|
|
529668
|
+
const gpu = this.pickGpuForSpawn(capable.length > 0 ? capable : gpus);
|
|
529537
529669
|
return this.spawnInstance(model, gpu);
|
|
529538
529670
|
});
|
|
529539
529671
|
}
|
|
@@ -529544,8 +529676,20 @@ var init_ollama_pool = __esm({
|
|
|
529544
529676
|
if (!this.canSpawnWithSharedModelStore(model))
|
|
529545
529677
|
return;
|
|
529546
529678
|
const target = this.dedicatedTargetCount(gpus);
|
|
529679
|
+
const vramNeededMB = await this.estimateModelVramMB(model);
|
|
529547
529680
|
while (this.instances.filter((i2) => i2.state.poolOwned).length < target) {
|
|
529548
|
-
const
|
|
529681
|
+
const candidates = this.gpusWithCapacityForModel(gpus, vramNeededMB);
|
|
529682
|
+
const pool3 = candidates.length > 0 ? candidates : vramNeededMB === null ? gpus : [];
|
|
529683
|
+
if (pool3.length === 0) {
|
|
529684
|
+
this.emit("spawn-skipped", {
|
|
529685
|
+
reason: "insufficient-vram",
|
|
529686
|
+
model,
|
|
529687
|
+
vramNeededMB,
|
|
529688
|
+
gpuFreeMBs: gpus.map((g) => g.vramFreeMB)
|
|
529689
|
+
});
|
|
529690
|
+
break;
|
|
529691
|
+
}
|
|
529692
|
+
const gpu = this.pickGpuForSpawn(pool3);
|
|
529549
529693
|
if (!gpu)
|
|
529550
529694
|
break;
|
|
529551
529695
|
const inst = await this.spawnInstance(model, gpu);
|
|
@@ -529603,9 +529747,59 @@ var init_ollama_pool = __esm({
|
|
|
529603
529747
|
if (this.gpuCache && now - this.gpuCache.takenAtMs <= maxAgeMs) {
|
|
529604
529748
|
return this.gpuCache.gpus;
|
|
529605
529749
|
}
|
|
529606
|
-
const
|
|
529607
|
-
|
|
529608
|
-
|
|
529750
|
+
const rawGpus = await this.gpuDetector();
|
|
529751
|
+
const filtered = filterCapableGpus(rawGpus);
|
|
529752
|
+
const filteredUuids = new Set(filtered.map((g) => g.uuid));
|
|
529753
|
+
for (const g of rawGpus) {
|
|
529754
|
+
if (filteredUuids.has(g.uuid))
|
|
529755
|
+
continue;
|
|
529756
|
+
if (this._excludedGpusReported.has(g.uuid))
|
|
529757
|
+
continue;
|
|
529758
|
+
this._excludedGpusReported.add(g.uuid);
|
|
529759
|
+
const reason = g.vramTotalMB < resolveMinGpuVramMB() ? "insufficient-vram" : "insufficient-compute-capability";
|
|
529760
|
+
this.emit("gpu-excluded", {
|
|
529761
|
+
uuid: g.uuid,
|
|
529762
|
+
index: g.index,
|
|
529763
|
+
name: g.name,
|
|
529764
|
+
vramTotalMB: g.vramTotalMB,
|
|
529765
|
+
computeCapability: g.computeCapability,
|
|
529766
|
+
reason
|
|
529767
|
+
});
|
|
529768
|
+
}
|
|
529769
|
+
this.gpuCache = { gpus: filtered, takenAtMs: now };
|
|
529770
|
+
this.maybeAutoTuneMaxParallel(filtered);
|
|
529771
|
+
return filtered;
|
|
529772
|
+
}
|
|
529773
|
+
/**
|
|
529774
|
+
* One-shot: bump `maxParallelPerInstance` from the worst-case free VRAM
|
|
529775
|
+
* across capable GPUs the first time we see them. We never tune down (a
|
|
529776
|
+
* subsequent low-VRAM read shouldn't strip concurrency from in-flight
|
|
529777
|
+
* requests), and we never tune again once successful — the recommendation
|
|
529778
|
+
* ladder is stable enough that a single read at startup is correct.
|
|
529779
|
+
*/
|
|
529780
|
+
maybeAutoTuneMaxParallel(filtered) {
|
|
529781
|
+
if (!this.config.autoTuneMaxParallel)
|
|
529782
|
+
return;
|
|
529783
|
+
if (this._autoTuned)
|
|
529784
|
+
return;
|
|
529785
|
+
if (filtered.length === 0)
|
|
529786
|
+
return;
|
|
529787
|
+
const minFreeMB = filtered.reduce((m2, g) => Math.min(m2, g.vramFreeMB), Number.POSITIVE_INFINITY);
|
|
529788
|
+
const recommended = recommendMaxParallelFromVram(minFreeMB);
|
|
529789
|
+
if (recommended > this.config.maxParallelPerInstance) {
|
|
529790
|
+
const previous = this.config.maxParallelPerInstance;
|
|
529791
|
+
this.config.maxParallelPerInstance = recommended;
|
|
529792
|
+
for (const inst of this.instances) {
|
|
529793
|
+
inst.state.maxParallel = recommended;
|
|
529794
|
+
}
|
|
529795
|
+
this.emit("max-parallel-tuned", {
|
|
529796
|
+
previous,
|
|
529797
|
+
recommended,
|
|
529798
|
+
minFreeMB,
|
|
529799
|
+
capableGpuCount: filtered.length
|
|
529800
|
+
});
|
|
529801
|
+
}
|
|
529802
|
+
this._autoTuned = true;
|
|
529609
529803
|
}
|
|
529610
529804
|
async spawnInstance(model, gpu) {
|
|
529611
529805
|
let port;
|
|
@@ -529668,6 +529862,56 @@ var init_ollama_pool = __esm({
|
|
|
529668
529862
|
});
|
|
529669
529863
|
return inst;
|
|
529670
529864
|
}
|
|
529865
|
+
/**
|
|
529866
|
+
* Best-effort: estimate the VRAM (in MiB) a model needs to be served
|
|
529867
|
+
* without CPU spill. Hits the base instance's `/api/show` once per model
|
|
529868
|
+
* and caches the result. Returns null when the probe fails (the caller
|
|
529869
|
+
* then falls back to "no estimate" semantics — capacity check is skipped).
|
|
529870
|
+
*
|
|
529871
|
+
* The number returned is `disk_size * 1.15 + maxParallel * 1024` (1 GiB of
|
|
529872
|
+
* KV cache per parallel slot — conservative for 30B-class models). Newer
|
|
529873
|
+
* model families may exceed this margin slightly; bumps are safe via
|
|
529874
|
+
* OMNIUS_OLLAMA_VRAM_SAFETY_MARGIN.
|
|
529875
|
+
*/
|
|
529876
|
+
async estimateModelVramMB(model) {
|
|
529877
|
+
if (this._modelVramEstimateMB.has(model)) {
|
|
529878
|
+
return this._modelVramEstimateMB.get(model) ?? null;
|
|
529879
|
+
}
|
|
529880
|
+
let bytesOnDisk = null;
|
|
529881
|
+
try {
|
|
529882
|
+
const url = `${this.config.baseInstanceUrl.replace(/\/+$/, "")}/api/show`;
|
|
529883
|
+
const resp = await fetch(url, {
|
|
529884
|
+
method: "POST",
|
|
529885
|
+
headers: { "Content-Type": "application/json" },
|
|
529886
|
+
body: JSON.stringify({ name: model }),
|
|
529887
|
+
signal: AbortSignal.timeout(2e3)
|
|
529888
|
+
});
|
|
529889
|
+
if (resp.ok) {
|
|
529890
|
+
const data = await resp.json();
|
|
529891
|
+
if (typeof data.size === "number" && data.size > 0)
|
|
529892
|
+
bytesOnDisk = data.size;
|
|
529893
|
+
}
|
|
529894
|
+
} catch {
|
|
529895
|
+
}
|
|
529896
|
+
if (bytesOnDisk === null) {
|
|
529897
|
+
this._modelVramEstimateMB.set(model, null);
|
|
529898
|
+
return null;
|
|
529899
|
+
}
|
|
529900
|
+
const safetyMargin = Number(process.env["OMNIUS_OLLAMA_VRAM_SAFETY_MARGIN"]) || 1.15;
|
|
529901
|
+
const kvCacheMB = this.config.maxParallelPerInstance * 1024;
|
|
529902
|
+
const estimateMB = Math.ceil(bytesOnDisk / (1024 * 1024) * safetyMargin + kvCacheMB);
|
|
529903
|
+
this._modelVramEstimateMB.set(model, estimateMB);
|
|
529904
|
+
return estimateMB;
|
|
529905
|
+
}
|
|
529906
|
+
/**
|
|
529907
|
+
* Filter GPUs to those with enough free VRAM for the model. Caller decides
|
|
529908
|
+
* how to react to an empty list (skip spawn vs degrade to constrained).
|
|
529909
|
+
*/
|
|
529910
|
+
gpusWithCapacityForModel(gpus, vramNeededMB) {
|
|
529911
|
+
if (vramNeededMB === null)
|
|
529912
|
+
return gpus;
|
|
529913
|
+
return gpus.filter((g) => g.vramFreeMB >= vramNeededMB);
|
|
529914
|
+
}
|
|
529671
529915
|
/**
|
|
529672
529916
|
* Pick a GPU for a freshly-spawned instance. Prefers GPUs that no
|
|
529673
529917
|
* pool-owned instance is already pinned to, then most free VRAM. Returns
|
|
@@ -529704,6 +529948,28 @@ var init_ollama_pool = __esm({
|
|
|
529704
529948
|
survivors.push(inst);
|
|
529705
529949
|
continue;
|
|
529706
529950
|
}
|
|
529951
|
+
const PROBE_GRACE_MS = 3e4;
|
|
529952
|
+
if (inst.state.inflight === 0 && Date.now() - inst.state.spawnedAtMs > PROBE_GRACE_MS && await this.isPartialVramSpilled(inst)) {
|
|
529953
|
+
const reapedAtMs = Date.now();
|
|
529954
|
+
await inst.terminate();
|
|
529955
|
+
this.dropAffinityFor(inst.state.id);
|
|
529956
|
+
this.emit("instance-reaped", {
|
|
529957
|
+
id: inst.state.id,
|
|
529958
|
+
pid: inst.state.pid,
|
|
529959
|
+
reason: "partial-vram",
|
|
529960
|
+
totalRequests: inst.state.totalRequests,
|
|
529961
|
+
peakInflight: inst.state.peakInflight,
|
|
529962
|
+
ageMs: reapedAtMs - inst.state.spawnedAtMs,
|
|
529963
|
+
idleMs: reapedAtMs - inst.state.lastUsedMs,
|
|
529964
|
+
provenance: {
|
|
529965
|
+
entity: `urn:omnius:ollama-instance:${inst.state.id}`,
|
|
529966
|
+
activity: "ollama-instance-reap-partial-vram",
|
|
529967
|
+
agent: "orchestrator.ollama-pool",
|
|
529968
|
+
timestampMs: reapedAtMs
|
|
529969
|
+
}
|
|
529970
|
+
});
|
|
529971
|
+
continue;
|
|
529972
|
+
}
|
|
529707
529973
|
if (inst.isIdleLongerThan(this.config.idleMs)) {
|
|
529708
529974
|
const reapedAtMs = Date.now();
|
|
529709
529975
|
await inst.terminate();
|
|
@@ -529711,6 +529977,7 @@ var init_ollama_pool = __esm({
|
|
|
529711
529977
|
this.emit("instance-reaped", {
|
|
529712
529978
|
id: inst.state.id,
|
|
529713
529979
|
pid: inst.state.pid,
|
|
529980
|
+
reason: "idle",
|
|
529714
529981
|
totalRequests: inst.state.totalRequests,
|
|
529715
529982
|
peakInflight: inst.state.peakInflight,
|
|
529716
529983
|
ageMs: reapedAtMs - inst.state.spawnedAtMs,
|
|
@@ -529728,6 +529995,33 @@ var init_ollama_pool = __esm({
|
|
|
529728
529995
|
}
|
|
529729
529996
|
this.instances = survivors;
|
|
529730
529997
|
}
|
|
529998
|
+
/**
|
|
529999
|
+
* Probe `/api/ps` on the instance and return true if any resident model has
|
|
530000
|
+
* less than 95% of its weights in VRAM — the unmistakable CPU-offload
|
|
530001
|
+
* signature that produces 50× slowdowns. Defensive: any HTTP failure
|
|
530002
|
+
* returns false so a transient network blip never triggers a reap.
|
|
530003
|
+
*/
|
|
530004
|
+
async isPartialVramSpilled(inst) {
|
|
530005
|
+
const PARTIAL_VRAM_THRESHOLD = 0.95;
|
|
530006
|
+
try {
|
|
530007
|
+
const url = `${inst.state.baseUrl.replace(/\/+$/, "")}/api/ps`;
|
|
530008
|
+
const resp = await fetch(url, { signal: AbortSignal.timeout(2e3) });
|
|
530009
|
+
if (!resp.ok)
|
|
530010
|
+
return false;
|
|
530011
|
+
const data = await resp.json();
|
|
530012
|
+
if (!data.models || data.models.length === 0)
|
|
530013
|
+
return false;
|
|
530014
|
+
return data.models.some((m2) => {
|
|
530015
|
+
const total = m2.size ?? 0;
|
|
530016
|
+
const vram = m2.size_vram ?? 0;
|
|
530017
|
+
if (total <= 0)
|
|
530018
|
+
return false;
|
|
530019
|
+
return vram / total < PARTIAL_VRAM_THRESHOLD;
|
|
530020
|
+
});
|
|
530021
|
+
} catch {
|
|
530022
|
+
return false;
|
|
530023
|
+
}
|
|
530024
|
+
}
|
|
529731
530025
|
/** Stop the reaper and terminate every spawned instance. Call on process exit. */
|
|
529732
530026
|
async shutdown() {
|
|
529733
530027
|
if (this.reaperHandle) {
|
|
@@ -546849,8 +547143,8 @@ ${notice}`;
|
|
|
546849
547143
|
async waitIfPaused() {
|
|
546850
547144
|
if (!this._paused)
|
|
546851
547145
|
return true;
|
|
546852
|
-
await new Promise((
|
|
546853
|
-
this._pauseResolve =
|
|
547146
|
+
await new Promise((resolve56) => {
|
|
547147
|
+
this._pauseResolve = resolve56;
|
|
546854
547148
|
});
|
|
546855
547149
|
return !this.aborted;
|
|
546856
547150
|
}
|
|
@@ -552577,14 +552871,14 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
|
|
|
552577
552871
|
waitForSudoPassword(timeoutMs = 12e4) {
|
|
552578
552872
|
if (this._sudoPassword)
|
|
552579
552873
|
return Promise.resolve(this._sudoPassword);
|
|
552580
|
-
return new Promise((
|
|
552874
|
+
return new Promise((resolve56) => {
|
|
552581
552875
|
const timer = setTimeout(() => {
|
|
552582
552876
|
this._sudoResolve = null;
|
|
552583
|
-
|
|
552877
|
+
resolve56(null);
|
|
552584
552878
|
}, timeoutMs);
|
|
552585
552879
|
this._sudoResolve = (pw2) => {
|
|
552586
552880
|
clearTimeout(timer);
|
|
552587
|
-
|
|
552881
|
+
resolve56(pw2);
|
|
552588
552882
|
};
|
|
552589
552883
|
});
|
|
552590
552884
|
}
|
|
@@ -553307,7 +553601,7 @@ Describe what you see and integrate this into your current approach.` : "[User s
|
|
|
553307
553601
|
}
|
|
553308
553602
|
async extractImageOcrText(tmpImgPath) {
|
|
553309
553603
|
try {
|
|
553310
|
-
const stdout = await new Promise((
|
|
553604
|
+
const stdout = await new Promise((resolve56, reject) => {
|
|
553311
553605
|
_execFile("tesseract", [tmpImgPath, "stdout"], {
|
|
553312
553606
|
encoding: "utf8",
|
|
553313
553607
|
timeout: 15e3,
|
|
@@ -553317,7 +553611,7 @@ Describe what you see and integrate this into your current approach.` : "[User s
|
|
|
553317
553611
|
reject(err);
|
|
553318
553612
|
return;
|
|
553319
553613
|
}
|
|
553320
|
-
|
|
553614
|
+
resolve56(out);
|
|
553321
553615
|
});
|
|
553322
553616
|
});
|
|
553323
553617
|
return stdout.trim();
|
|
@@ -556886,12 +557180,12 @@ var init_nexusBackend = __esm({
|
|
|
556886
557180
|
const deadline = Date.now() + (request.timeoutMs ?? 12e4);
|
|
556887
557181
|
try {
|
|
556888
557182
|
while (!done && Date.now() < deadline) {
|
|
556889
|
-
await new Promise((
|
|
557183
|
+
await new Promise((resolve56) => {
|
|
556890
557184
|
let resolved = false;
|
|
556891
557185
|
const finish = () => {
|
|
556892
557186
|
if (!resolved) {
|
|
556893
557187
|
resolved = true;
|
|
556894
|
-
|
|
557188
|
+
resolve56();
|
|
556895
557189
|
}
|
|
556896
557190
|
};
|
|
556897
557191
|
let watcher = null;
|
|
@@ -561332,7 +561626,7 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
561332
561626
|
const exe = process.platform === "win32" ? "python.exe" : "python3";
|
|
561333
561627
|
const venvPython2 = join102(homedir32(), ".omnius", "venv", bin, exe);
|
|
561334
561628
|
if (!existsSync87(venvPython2)) return null;
|
|
561335
|
-
return new Promise((
|
|
561629
|
+
return new Promise((resolve56) => {
|
|
561336
561630
|
const child = spawn24(venvPython2, [script], {
|
|
561337
561631
|
stdio: ["pipe", "pipe", "pipe"],
|
|
561338
561632
|
env: process.env
|
|
@@ -561346,7 +561640,7 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
561346
561640
|
child.kill("SIGTERM");
|
|
561347
561641
|
} catch {
|
|
561348
561642
|
}
|
|
561349
|
-
|
|
561643
|
+
resolve56(val ? parse3(val) : null);
|
|
561350
561644
|
};
|
|
561351
561645
|
function parse3(raw) {
|
|
561352
561646
|
try {
|
|
@@ -561366,10 +561660,10 @@ async function transcribeFileViaWhisper(filePath, model) {
|
|
|
561366
561660
|
});
|
|
561367
561661
|
child.once("error", () => stop2(null));
|
|
561368
561662
|
child.once("close", () => {
|
|
561369
|
-
if (out.trim())
|
|
561663
|
+
if (out.trim()) resolve56(parse3(out));
|
|
561370
561664
|
else {
|
|
561371
561665
|
void err;
|
|
561372
|
-
|
|
561666
|
+
resolve56(null);
|
|
561373
561667
|
}
|
|
561374
561668
|
});
|
|
561375
561669
|
timer = setTimeout(() => stop2(null), 12e4);
|
|
@@ -561456,9 +561750,9 @@ function ensureTranscribeCliBackground() {
|
|
|
561456
561750
|
}
|
|
561457
561751
|
try {
|
|
561458
561752
|
const { exec: exec6 } = await import("node:child_process");
|
|
561459
|
-
return new Promise((
|
|
561753
|
+
return new Promise((resolve56) => {
|
|
561460
561754
|
exec6("npm i -g transcribe-cli", { timeout: 18e4 }, (err) => {
|
|
561461
|
-
|
|
561755
|
+
resolve56(!err);
|
|
561462
561756
|
});
|
|
561463
561757
|
});
|
|
561464
561758
|
} catch {
|
|
@@ -561548,7 +561842,7 @@ var init_listen = __esm({
|
|
|
561548
561842
|
stdio: ["pipe", "pipe", "pipe"],
|
|
561549
561843
|
env: { ...process.env }
|
|
561550
561844
|
});
|
|
561551
|
-
return new Promise((
|
|
561845
|
+
return new Promise((resolve56, reject) => {
|
|
561552
561846
|
const timeout2 = setTimeout(() => {
|
|
561553
561847
|
reject(new Error("Whisper fallback: model load timeout (5 min). First run downloads the model."));
|
|
561554
561848
|
}, 3e5);
|
|
@@ -561564,7 +561858,7 @@ var init_listen = __esm({
|
|
|
561564
561858
|
this._ready = true;
|
|
561565
561859
|
clearTimeout(timeout2);
|
|
561566
561860
|
this.emit("ready");
|
|
561567
|
-
|
|
561861
|
+
resolve56();
|
|
561568
561862
|
break;
|
|
561569
561863
|
case "transcript":
|
|
561570
561864
|
this.emit("transcript", {
|
|
@@ -561809,11 +562103,11 @@ var init_listen = __esm({
|
|
|
561809
562103
|
this.liveTranscriber.on("error", (err) => {
|
|
561810
562104
|
this.emit("error", err);
|
|
561811
562105
|
});
|
|
561812
|
-
await new Promise((
|
|
562106
|
+
await new Promise((resolve56, reject) => {
|
|
561813
562107
|
const timeout2 = setTimeout(() => reject(new Error("Model load timeout (60s)")), 6e4);
|
|
561814
562108
|
this.liveTranscriber.on("ready", () => {
|
|
561815
562109
|
clearTimeout(timeout2);
|
|
561816
|
-
|
|
562110
|
+
resolve56();
|
|
561817
562111
|
});
|
|
561818
562112
|
this.liveTranscriber.on("error", (err) => {
|
|
561819
562113
|
clearTimeout(timeout2);
|
|
@@ -562039,11 +562333,11 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
562039
562333
|
sampleWidth: 2,
|
|
562040
562334
|
chunkDuration: 3
|
|
562041
562335
|
});
|
|
562042
|
-
await new Promise((
|
|
562336
|
+
await new Promise((resolve56, reject) => {
|
|
562043
562337
|
const timeout2 = setTimeout(() => reject(new Error("Model load timeout (60s)")), 6e4);
|
|
562044
562338
|
transcriber.on("ready", () => {
|
|
562045
562339
|
clearTimeout(timeout2);
|
|
562046
|
-
|
|
562340
|
+
resolve56();
|
|
562047
562341
|
});
|
|
562048
562342
|
transcriber.on("error", (err) => {
|
|
562049
562343
|
clearTimeout(timeout2);
|
|
@@ -570185,8 +570479,8 @@ var init_voice_session = __esm({
|
|
|
570185
570479
|
socket.destroy();
|
|
570186
570480
|
}
|
|
570187
570481
|
});
|
|
570188
|
-
await new Promise((
|
|
570189
|
-
this.server.listen(port, "127.0.0.1", () =>
|
|
570482
|
+
await new Promise((resolve56, reject) => {
|
|
570483
|
+
this.server.listen(port, "127.0.0.1", () => resolve56());
|
|
570190
570484
|
this.server.on("error", reject);
|
|
570191
570485
|
});
|
|
570192
570486
|
try {
|
|
@@ -570401,7 +570695,7 @@ var init_voice_session = __esm({
|
|
|
570401
570695
|
}
|
|
570402
570696
|
// ── Cloudflared tunnel ────────────────────────────────────────────────
|
|
570403
570697
|
startCloudflared(port) {
|
|
570404
|
-
return new Promise((
|
|
570698
|
+
return new Promise((resolve56, reject) => {
|
|
570405
570699
|
const timeout2 = setTimeout(() => {
|
|
570406
570700
|
reject(new Error("Cloudflared tunnel start timeout (30s)"));
|
|
570407
570701
|
}, 3e4);
|
|
@@ -570419,7 +570713,7 @@ var init_voice_session = __esm({
|
|
|
570419
570713
|
if (urlMatch && !urlFound) {
|
|
570420
570714
|
urlFound = true;
|
|
570421
570715
|
clearTimeout(timeout2);
|
|
570422
|
-
|
|
570716
|
+
resolve56(urlMatch[0]);
|
|
570423
570717
|
}
|
|
570424
570718
|
};
|
|
570425
570719
|
this.cloudflaredProcess.stdout?.on("data", handleOutput);
|
|
@@ -570459,13 +570753,13 @@ var init_voice_session = __esm({
|
|
|
570459
570753
|
}
|
|
570460
570754
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
570461
570755
|
findFreePort() {
|
|
570462
|
-
return new Promise((
|
|
570756
|
+
return new Promise((resolve56, reject) => {
|
|
570463
570757
|
const srv = createServer4();
|
|
570464
570758
|
srv.listen(0, "127.0.0.1", () => {
|
|
570465
570759
|
const addr = srv.address();
|
|
570466
570760
|
if (addr && typeof addr === "object") {
|
|
570467
570761
|
const port = addr.port;
|
|
570468
|
-
srv.close(() =>
|
|
570762
|
+
srv.close(() => resolve56(port));
|
|
570469
570763
|
} else {
|
|
570470
570764
|
srv.close(() => reject(new Error("Could not find free port")));
|
|
570471
570765
|
}
|
|
@@ -571343,11 +571637,11 @@ async function collectSystemMetricsAsync() {
|
|
|
571343
571637
|
vramUtilization: 0
|
|
571344
571638
|
};
|
|
571345
571639
|
try {
|
|
571346
|
-
const smi = await new Promise((
|
|
571640
|
+
const smi = await new Promise((resolve56, reject) => {
|
|
571347
571641
|
exec3(
|
|
571348
571642
|
"nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null",
|
|
571349
571643
|
{ encoding: "utf8", timeout: 3e3 },
|
|
571350
|
-
(err, stdout) => err ? reject(err) :
|
|
571644
|
+
(err, stdout) => err ? reject(err) : resolve56(stdout)
|
|
571351
571645
|
);
|
|
571352
571646
|
});
|
|
571353
571647
|
const line = smi.trim().split("\n")[0];
|
|
@@ -571551,8 +571845,8 @@ var init_expose = __esm({
|
|
|
571551
571845
|
if (this.server) throw new Error("Gateway already running");
|
|
571552
571846
|
const port = await this.findFreePort();
|
|
571553
571847
|
this.server = this.createProxyServer(port);
|
|
571554
|
-
await new Promise((
|
|
571555
|
-
this.server.listen(port, "127.0.0.1", () =>
|
|
571848
|
+
await new Promise((resolve56, reject) => {
|
|
571849
|
+
this.server.listen(port, "127.0.0.1", () => resolve56());
|
|
571556
571850
|
this.server.on("error", reject);
|
|
571557
571851
|
});
|
|
571558
571852
|
let lastStartErr;
|
|
@@ -571622,8 +571916,8 @@ var init_expose = __esm({
|
|
|
571622
571916
|
this._cloudflaredPid = state.pid;
|
|
571623
571917
|
this._proxyPort = state.proxyPort;
|
|
571624
571918
|
this.server = this.createProxyServer(state.proxyPort);
|
|
571625
|
-
await new Promise((
|
|
571626
|
-
this.server.listen(state.proxyPort, "127.0.0.1", () =>
|
|
571919
|
+
await new Promise((resolve56, reject) => {
|
|
571920
|
+
this.server.listen(state.proxyPort, "127.0.0.1", () => resolve56());
|
|
571627
571921
|
this.server.on("error", reject);
|
|
571628
571922
|
});
|
|
571629
571923
|
this._stats.status = "active";
|
|
@@ -571648,8 +571942,8 @@ var init_expose = __esm({
|
|
|
571648
571942
|
}
|
|
571649
571943
|
this._cloudflaredPid = null;
|
|
571650
571944
|
if (this.server) {
|
|
571651
|
-
await new Promise((
|
|
571652
|
-
this.server.close(() =>
|
|
571945
|
+
await new Promise((resolve56) => {
|
|
571946
|
+
this.server.close(() => resolve56());
|
|
571653
571947
|
});
|
|
571654
571948
|
this.server = null;
|
|
571655
571949
|
}
|
|
@@ -572050,7 +572344,7 @@ var init_expose = __esm({
|
|
|
572050
572344
|
_proxyPort = 0;
|
|
572051
572345
|
startCloudflared(port) {
|
|
572052
572346
|
this._proxyPort = port;
|
|
572053
|
-
return new Promise((
|
|
572347
|
+
return new Promise((resolve56, reject) => {
|
|
572054
572348
|
const TUNNEL_TIMEOUT_MS = 6e4;
|
|
572055
572349
|
const timeout2 = setTimeout(() => {
|
|
572056
572350
|
reject(new Error("Cloudflared tunnel start timeout (60s). Slow network? Try again."));
|
|
@@ -572093,7 +572387,7 @@ var init_expose = __esm({
|
|
|
572093
572387
|
this.cloudflaredProcess?.unref();
|
|
572094
572388
|
this.cloudflaredProcess?.stdout?.destroy();
|
|
572095
572389
|
this.cloudflaredProcess?.stderr?.destroy();
|
|
572096
|
-
|
|
572390
|
+
resolve56(urlMatch[0]);
|
|
572097
572391
|
}
|
|
572098
572392
|
};
|
|
572099
572393
|
this.cloudflaredProcess.stdout?.on("data", handleOutput);
|
|
@@ -572214,13 +572508,13 @@ ${this.formatConnectionInfo()}`);
|
|
|
572214
572508
|
}
|
|
572215
572509
|
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
572216
572510
|
findFreePort() {
|
|
572217
|
-
return new Promise((
|
|
572511
|
+
return new Promise((resolve56, reject) => {
|
|
572218
572512
|
const srv = createServer5();
|
|
572219
572513
|
srv.listen(0, "127.0.0.1", () => {
|
|
572220
572514
|
const addr = srv.address();
|
|
572221
572515
|
if (addr && typeof addr === "object") {
|
|
572222
572516
|
const port = addr.port;
|
|
572223
|
-
srv.close(() =>
|
|
572517
|
+
srv.close(() => resolve56(port));
|
|
572224
572518
|
} else {
|
|
572225
572519
|
srv.close(() => reject(new Error("Could not find free port")));
|
|
572226
572520
|
}
|
|
@@ -573158,8 +573452,8 @@ var init_peer_mesh = __esm({
|
|
|
573158
573452
|
this.wss.on("connection", (ws, req2) => {
|
|
573159
573453
|
this.handleInboundConnection(ws, req2.url ?? "");
|
|
573160
573454
|
});
|
|
573161
|
-
await new Promise((
|
|
573162
|
-
this.server.listen(port, "127.0.0.1", () =>
|
|
573455
|
+
await new Promise((resolve56, reject) => {
|
|
573456
|
+
this.server.listen(port, "127.0.0.1", () => resolve56());
|
|
573163
573457
|
this.server.on("error", reject);
|
|
573164
573458
|
});
|
|
573165
573459
|
this.pingTimer = setInterval(() => this.pingAll(), PING_INTERVAL_MS);
|
|
@@ -573198,7 +573492,7 @@ var init_peer_mesh = __esm({
|
|
|
573198
573492
|
this.wss = null;
|
|
573199
573493
|
}
|
|
573200
573494
|
if (this.server) {
|
|
573201
|
-
await new Promise((
|
|
573495
|
+
await new Promise((resolve56) => this.server.close(() => resolve56()));
|
|
573202
573496
|
this.server = null;
|
|
573203
573497
|
}
|
|
573204
573498
|
this.emit("stopped");
|
|
@@ -573212,7 +573506,7 @@ var init_peer_mesh = __esm({
|
|
|
573212
573506
|
else if (!wsUrl.startsWith("ws://") && !wsUrl.startsWith("wss://")) wsUrl = `ws://${wsUrl}`;
|
|
573213
573507
|
if (!wsUrl.includes("/p2p")) wsUrl += "/p2p";
|
|
573214
573508
|
wsUrl += `?key=${encodeURIComponent(this._authKey)}`;
|
|
573215
|
-
return new Promise((
|
|
573509
|
+
return new Promise((resolve56, reject) => {
|
|
573216
573510
|
const ws = new import_websocket5.default(wsUrl, { handshakeTimeout: 1e4 });
|
|
573217
573511
|
let resolved = false;
|
|
573218
573512
|
const timeout2 = setTimeout(() => {
|
|
@@ -573252,7 +573546,7 @@ var init_peer_mesh = __esm({
|
|
|
573252
573546
|
this.connections.set(peer.peerId, ws);
|
|
573253
573547
|
this.setupPeerHandlers(ws, peer.peerId);
|
|
573254
573548
|
this.emit("peer_connected", peer);
|
|
573255
|
-
|
|
573549
|
+
resolve56(peer);
|
|
573256
573550
|
} else {
|
|
573257
573551
|
this.handleMessage(msg, ws);
|
|
573258
573552
|
}
|
|
@@ -573309,12 +573603,12 @@ var init_peer_mesh = __esm({
|
|
|
573309
573603
|
throw new Error(`Peer ${peerId} not connected`);
|
|
573310
573604
|
}
|
|
573311
573605
|
const msgId = randomBytes22(8).toString("hex");
|
|
573312
|
-
return new Promise((
|
|
573606
|
+
return new Promise((resolve56, reject) => {
|
|
573313
573607
|
const timeout2 = setTimeout(() => {
|
|
573314
573608
|
this.pendingRequests.delete(msgId);
|
|
573315
573609
|
reject(new Error(`Inference timeout (${timeoutMs}ms)`));
|
|
573316
573610
|
}, timeoutMs);
|
|
573317
|
-
this.pendingRequests.set(msgId, { resolve:
|
|
573611
|
+
this.pendingRequests.set(msgId, { resolve: resolve56, reject, timeout: timeout2, chunks: [] });
|
|
573318
573612
|
this.sendMsg(ws, "infer_request", request, msgId);
|
|
573319
573613
|
});
|
|
573320
573614
|
}
|
|
@@ -573531,13 +573825,13 @@ var init_peer_mesh = __esm({
|
|
|
573531
573825
|
ws.send(JSON.stringify(msg));
|
|
573532
573826
|
}
|
|
573533
573827
|
findFreePort() {
|
|
573534
|
-
return new Promise((
|
|
573828
|
+
return new Promise((resolve56, reject) => {
|
|
573535
573829
|
const srv = createServer6();
|
|
573536
573830
|
srv.listen(0, "127.0.0.1", () => {
|
|
573537
573831
|
const addr = srv.address();
|
|
573538
573832
|
if (addr && typeof addr === "object") {
|
|
573539
573833
|
const port = addr.port;
|
|
573540
|
-
srv.close(() =>
|
|
573834
|
+
srv.close(() => resolve56(port));
|
|
573541
573835
|
} else {
|
|
573542
573836
|
srv.close(() => reject(new Error("Could not find free port")));
|
|
573543
573837
|
}
|
|
@@ -574164,7 +574458,7 @@ If you don't supply one within ${timeoutSec}s, I will fall back to a non-gated a
|
|
|
574164
574458
|
fallbackBit.trim()
|
|
574165
574459
|
].join("\n")
|
|
574166
574460
|
);
|
|
574167
|
-
return new Promise((
|
|
574461
|
+
return new Promise((resolve56) => {
|
|
574168
574462
|
const timer = setTimeout(() => {
|
|
574169
574463
|
const ref = pending;
|
|
574170
574464
|
pending = null;
|
|
@@ -574173,13 +574467,13 @@ If you don't supply one within ${timeoutSec}s, I will fall back to a non-gated a
|
|
|
574173
574467
|
`No HF token supplied within ${timeoutSec}s — falling back to a non-gated alternative for ${opts.model}.`
|
|
574174
574468
|
);
|
|
574175
574469
|
}
|
|
574176
|
-
|
|
574470
|
+
resolve56(null);
|
|
574177
574471
|
}, timeoutMs);
|
|
574178
574472
|
if (typeof timer.unref === "function") timer.unref();
|
|
574179
574473
|
pending = {
|
|
574180
574474
|
model: opts.model,
|
|
574181
574475
|
onMessage: opts.onMessage,
|
|
574182
|
-
resolve:
|
|
574476
|
+
resolve: resolve56,
|
|
574183
574477
|
timer,
|
|
574184
574478
|
startedAt: Date.now()
|
|
574185
574479
|
};
|
|
@@ -574441,20 +574735,35 @@ __export(omnius_directory_exports, {
|
|
|
574441
574735
|
saveSessionContext: () => saveSessionContext,
|
|
574442
574736
|
saveSessionHistory: () => saveSessionHistory,
|
|
574443
574737
|
sessionContextToHistoryBoxData: () => sessionContextToHistoryBoxData,
|
|
574738
|
+
stopOmniusGitignoreWatcher: () => stopOmniusGitignoreWatcher,
|
|
574444
574739
|
writeIndexData: () => writeIndexData,
|
|
574445
574740
|
writeIndexMeta: () => writeIndexMeta,
|
|
574446
574741
|
writeTaskHandoff: () => writeTaskHandoff2
|
|
574447
574742
|
});
|
|
574448
|
-
import { appendFileSync as appendFileSync6, cpSync as cpSync2, existsSync as existsSync94, mkdirSync as mkdirSync53, readFileSync as readFileSync75, writeFileSync as writeFileSync48, readdirSync as readdirSync31, statSync as statSync36, unlinkSync as unlinkSync17, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync4 } from "node:fs";
|
|
574449
|
-
import { join as join110, relative as relative9, basename as basename21, dirname as dirname31 } from "node:path";
|
|
574743
|
+
import { appendFileSync as appendFileSync6, cpSync as cpSync2, existsSync as existsSync94, mkdirSync as mkdirSync53, readFileSync as readFileSync75, writeFileSync as writeFileSync48, readdirSync as readdirSync31, statSync as statSync36, unlinkSync as unlinkSync17, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync4, watch as fsWatch2 } from "node:fs";
|
|
574744
|
+
import { join as join110, relative as relative9, basename as basename21, dirname as dirname31, resolve as resolve41 } from "node:path";
|
|
574450
574745
|
import { homedir as homedir34 } from "node:os";
|
|
574451
574746
|
import { createHash as createHash23 } from "node:crypto";
|
|
574747
|
+
function isGitRoot(dir) {
|
|
574748
|
+
const gitPath = join110(dir, ".git");
|
|
574749
|
+
if (!existsSync94(gitPath)) return false;
|
|
574750
|
+
try {
|
|
574751
|
+
const stat7 = statSync36(gitPath);
|
|
574752
|
+
if (stat7.isFile()) {
|
|
574753
|
+
return readFileSync75(gitPath, "utf-8").trim().startsWith("gitdir:");
|
|
574754
|
+
}
|
|
574755
|
+
if (!stat7.isDirectory()) return false;
|
|
574756
|
+
return existsSync94(join110(gitPath, "HEAD")) || existsSync94(join110(gitPath, "config")) || existsSync94(join110(gitPath, "commondir"));
|
|
574757
|
+
} catch {
|
|
574758
|
+
return false;
|
|
574759
|
+
}
|
|
574760
|
+
}
|
|
574452
574761
|
function findGitRoot(startDir) {
|
|
574453
574762
|
let dir = startDir;
|
|
574454
574763
|
const visited = /* @__PURE__ */ new Set();
|
|
574455
574764
|
while (dir && !visited.has(dir)) {
|
|
574456
574765
|
visited.add(dir);
|
|
574457
|
-
if (
|
|
574766
|
+
if (isGitRoot(dir)) return dir;
|
|
574458
574767
|
const parent = join110(dir, "..");
|
|
574459
574768
|
if (parent === dir) break;
|
|
574460
574769
|
dir = parent;
|
|
@@ -574475,6 +574784,20 @@ function findNearestExistingGitignore(startDir, gitRoot) {
|
|
|
574475
574784
|
}
|
|
574476
574785
|
return null;
|
|
574477
574786
|
}
|
|
574787
|
+
function candidateGitignoreDirs(startDir, gitRoot) {
|
|
574788
|
+
const dirs = [];
|
|
574789
|
+
let dir = startDir;
|
|
574790
|
+
const visited = /* @__PURE__ */ new Set();
|
|
574791
|
+
while (dir && !visited.has(dir)) {
|
|
574792
|
+
visited.add(dir);
|
|
574793
|
+
dirs.push(dir);
|
|
574794
|
+
if (dir === gitRoot) break;
|
|
574795
|
+
const parent = join110(dir, "..");
|
|
574796
|
+
if (parent === dir) break;
|
|
574797
|
+
dir = parent;
|
|
574798
|
+
}
|
|
574799
|
+
return dirs;
|
|
574800
|
+
}
|
|
574478
574801
|
function normalizeIgnoreRule(rule) {
|
|
574479
574802
|
return rule.trim().replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
574480
574803
|
}
|
|
@@ -574502,6 +574825,47 @@ function ensureOmniusIgnored(repoRoot) {
|
|
|
574502
574825
|
"utf-8"
|
|
574503
574826
|
);
|
|
574504
574827
|
}
|
|
574828
|
+
function watchForOmniusGitignore(repoRoot) {
|
|
574829
|
+
const gitRoot = findGitRoot(repoRoot);
|
|
574830
|
+
if (!gitRoot) return;
|
|
574831
|
+
const key = resolve41(repoRoot);
|
|
574832
|
+
if (gitignoreWatchers.has(key)) return;
|
|
574833
|
+
const watchers = [];
|
|
574834
|
+
for (const dir of candidateGitignoreDirs(repoRoot, gitRoot)) {
|
|
574835
|
+
try {
|
|
574836
|
+
const watcher = fsWatch2(dir, { persistent: false }, (_event, filename) => {
|
|
574837
|
+
if (String(filename ?? "") !== ".gitignore") return;
|
|
574838
|
+
try {
|
|
574839
|
+
ensureOmniusIgnored(repoRoot);
|
|
574840
|
+
} catch {
|
|
574841
|
+
}
|
|
574842
|
+
const timer = setTimeout(() => {
|
|
574843
|
+
try {
|
|
574844
|
+
ensureOmniusIgnored(repoRoot);
|
|
574845
|
+
} catch {
|
|
574846
|
+
}
|
|
574847
|
+
}, 50);
|
|
574848
|
+
timer.unref?.();
|
|
574849
|
+
});
|
|
574850
|
+
watchers.push(watcher);
|
|
574851
|
+
} catch {
|
|
574852
|
+
}
|
|
574853
|
+
}
|
|
574854
|
+
if (watchers.length > 0) gitignoreWatchers.set(key, watchers);
|
|
574855
|
+
}
|
|
574856
|
+
function stopOmniusGitignoreWatcher(repoRoot) {
|
|
574857
|
+
const keys = repoRoot ? [resolve41(repoRoot)] : Array.from(gitignoreWatchers.keys());
|
|
574858
|
+
for (const key of keys) {
|
|
574859
|
+
const watchers = gitignoreWatchers.get(key) ?? [];
|
|
574860
|
+
for (const watcher of watchers) {
|
|
574861
|
+
try {
|
|
574862
|
+
watcher.close();
|
|
574863
|
+
} catch {
|
|
574864
|
+
}
|
|
574865
|
+
}
|
|
574866
|
+
gitignoreWatchers.delete(key);
|
|
574867
|
+
}
|
|
574868
|
+
}
|
|
574505
574869
|
function migrateLegacyDirectories(repoRoot, omniusPath) {
|
|
574506
574870
|
for (const legacyDir of LEGACY_DIRS) {
|
|
574507
574871
|
const legacyPath = join110(repoRoot, legacyDir);
|
|
@@ -574527,6 +574891,10 @@ function initOmniusDirectory(repoRoot) {
|
|
|
574527
574891
|
ensureOmniusIgnored(repoRoot);
|
|
574528
574892
|
} catch {
|
|
574529
574893
|
}
|
|
574894
|
+
try {
|
|
574895
|
+
watchForOmniusGitignore(repoRoot);
|
|
574896
|
+
} catch {
|
|
574897
|
+
}
|
|
574530
574898
|
return omniusPath;
|
|
574531
574899
|
}
|
|
574532
574900
|
function hasOmniusDirectory(repoRoot) {
|
|
@@ -575483,7 +575851,7 @@ function deleteUsageRecord(kind, value2, repoRoot) {
|
|
|
575483
575851
|
remove(join110(repoRoot, OMNIUS_DIR, USAGE_HISTORY_FILE));
|
|
575484
575852
|
}
|
|
575485
575853
|
}
|
|
575486
|
-
var OMNIUS_DIR, LEGACY_DIRS, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, HANDOFF_FILE, CONTEXT_SAVE_FILE, CONTEXT_LEDGER_FILE, MAX_CONTEXT_ENTRIES, MAX_SESSION_DIARY_ENTRIES, SAME_TASK_REPLACE_WINDOW_MS, LOCK_TIMEOUT_MS, LOCK_RETRY_MS, LOCK_RETRY_MAX, SESSIONS_DIR, SESSIONS_INDEX, SKIP_DIRS2, HOME_SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
|
|
575854
|
+
var OMNIUS_DIR, LEGACY_DIRS, SUBDIRS, gitignoreWatchers, CONTEXT_FILES, PENDING_TASK_FILE, HANDOFF_FILE, CONTEXT_SAVE_FILE, CONTEXT_LEDGER_FILE, MAX_CONTEXT_ENTRIES, MAX_SESSION_DIARY_ENTRIES, SAME_TASK_REPLACE_WINDOW_MS, LOCK_TIMEOUT_MS, LOCK_RETRY_MS, LOCK_RETRY_MAX, SESSIONS_DIR, SESSIONS_INDEX, SKIP_DIRS2, HOME_SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
|
|
575487
575855
|
var init_omnius_directory = __esm({
|
|
575488
575856
|
"packages/cli/src/tui/omnius-directory.ts"() {
|
|
575489
575857
|
"use strict";
|
|
@@ -575491,6 +575859,7 @@ var init_omnius_directory = __esm({
|
|
|
575491
575859
|
OMNIUS_DIR = ".omnius";
|
|
575492
575860
|
LEGACY_DIRS = [".oa", ".open-agents"];
|
|
575493
575861
|
SUBDIRS = ["memory", "index", "context", "history", "notes", "embedded", "provenance", "tools", "dreams"];
|
|
575862
|
+
gitignoreWatchers = /* @__PURE__ */ new Map();
|
|
575494
575863
|
CONTEXT_FILES = [
|
|
575495
575864
|
"AGENTS.md",
|
|
575496
575865
|
"Omnius.md",
|
|
@@ -575967,8 +576336,8 @@ async function collectNetworkMetrics() {
|
|
|
575967
576336
|
}
|
|
575968
576337
|
if (plat === "darwin") {
|
|
575969
576338
|
try {
|
|
575970
|
-
const output = await new Promise((
|
|
575971
|
-
exec4("netstat -ib 2>/dev/null | head -30", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) :
|
|
576339
|
+
const output = await new Promise((resolve56, reject) => {
|
|
576340
|
+
exec4("netstat -ib 2>/dev/null | head -30", { encoding: "utf8", timeout: 3e3 }, (err, stdout) => err ? reject(err) : resolve56(stdout));
|
|
575972
576341
|
});
|
|
575973
576342
|
let rxBytes = 0, txBytes = 0;
|
|
575974
576343
|
for (const line of output.split("\n")) {
|
|
@@ -576010,11 +576379,11 @@ async function collectGpuMetrics() {
|
|
|
576010
576379
|
};
|
|
576011
576380
|
if (_nvidiaSmiAvailable2 === false) return noGpu;
|
|
576012
576381
|
try {
|
|
576013
|
-
const smi = await new Promise((
|
|
576382
|
+
const smi = await new Promise((resolve56, reject) => {
|
|
576014
576383
|
exec4(
|
|
576015
576384
|
"nvidia-smi --query-gpu=index,uuid,utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null",
|
|
576016
576385
|
{ encoding: "utf8", timeout: 3e3 },
|
|
576017
|
-
(err, stdout) => err ? reject(err) :
|
|
576386
|
+
(err, stdout) => err ? reject(err) : resolve56(stdout)
|
|
576018
576387
|
);
|
|
576019
576388
|
});
|
|
576020
576389
|
_nvidiaSmiAvailable2 = true;
|
|
@@ -576518,7 +576887,7 @@ __export(tui_tasks_renderer_exports, {
|
|
|
576518
576887
|
setTuiTasksSession: () => setTuiTasksSession,
|
|
576519
576888
|
teardownTuiTasks: () => teardownTuiTasks
|
|
576520
576889
|
});
|
|
576521
|
-
import { existsSync as existsSync95, readFileSync as readFileSync76, watch as
|
|
576890
|
+
import { existsSync as existsSync95, readFileSync as readFileSync76, watch as fsWatch3 } from "node:fs";
|
|
576522
576891
|
import { join as join111 } from "node:path";
|
|
576523
576892
|
import { homedir as homedir35 } from "node:os";
|
|
576524
576893
|
function setTasksRendererWriter(writer) {
|
|
@@ -576624,7 +576993,7 @@ function teardownTuiTasks() {
|
|
|
576624
576993
|
function installWatcher() {
|
|
576625
576994
|
if (!_activeSessionId) return;
|
|
576626
576995
|
try {
|
|
576627
|
-
_watcher =
|
|
576996
|
+
_watcher = fsWatch3(todoDir2(), { persistent: false }, (_evt, fname) => {
|
|
576628
576997
|
if (!fname || !_activeSessionId) return;
|
|
576629
576998
|
const expected = `${_activeSessionId.replace(/[^a-zA-Z0-9_.-]/g, "_")}.json`;
|
|
576630
576999
|
if (fname !== expected) return;
|
|
@@ -577125,6 +577494,7 @@ var init_status_bar = __esm({
|
|
|
577125
577494
|
_inferenceCount = 0;
|
|
577126
577495
|
_totalInferenceDurationMs = 0;
|
|
577127
577496
|
_peakTokensPerSecond = 0;
|
|
577497
|
+
_tokensPerSecond = 0;
|
|
577128
577498
|
_successfulToolCalls = 0;
|
|
577129
577499
|
_failedToolCalls = 0;
|
|
577130
577500
|
_toolCallBreakdown = [];
|
|
@@ -578393,6 +578763,7 @@ var init_status_bar = __esm({
|
|
|
578393
578763
|
if (this._streamStartTime === 0) this._streamStartTime = Date.now();
|
|
578394
578764
|
const elapsedSec = (Date.now() - this._streamStartTime) / 1e3;
|
|
578395
578765
|
const tokenRate = elapsedSec > 0.1 ? this._streamingTokens / elapsedSec : 0;
|
|
578766
|
+
if (tokenRate > 0) this._tokensPerSecond = tokenRate;
|
|
578396
578767
|
this._brailleSpinner.setMetrics({ tokenRate, isStreaming: true });
|
|
578397
578768
|
if (!this._streamThrottleTimer && this.active) {
|
|
578398
578769
|
this._streamThrottleTimer = setTimeout(() => {
|
|
@@ -578413,6 +578784,7 @@ var init_status_bar = __esm({
|
|
|
578413
578784
|
this.metrics.estimatedContextTokens = 0;
|
|
578414
578785
|
this.metrics.lastPromptTokens = 0;
|
|
578415
578786
|
this.metrics.lastCompletionTokens = 0;
|
|
578787
|
+
this._tokensPerSecond = 0;
|
|
578416
578788
|
this.pushSpinnerContextMetrics();
|
|
578417
578789
|
if (this.active) this.renderFooterPreserveCursor();
|
|
578418
578790
|
}
|
|
@@ -579783,6 +580155,11 @@ ${CONTENT_BG_SEQ}`);
|
|
|
579783
580155
|
if (n2 < 1e6) return `${Math.round(n2 / 1e3)}K`;
|
|
579784
580156
|
return `${(n2 / 1e6).toFixed(1)}M`;
|
|
579785
580157
|
}
|
|
580158
|
+
static formatTokensPerSecond(n2) {
|
|
580159
|
+
if (!Number.isFinite(n2) || n2 <= 0) return "0";
|
|
580160
|
+
if (n2 < 100) return n2.toFixed(1);
|
|
580161
|
+
return Math.round(n2).toLocaleString();
|
|
580162
|
+
}
|
|
579786
580163
|
/** Build the metrics line string with adaptive compaction */
|
|
579787
580164
|
buildMetricsLine() {
|
|
579788
580165
|
const m2 = this.metrics;
|
|
@@ -579810,10 +580187,13 @@ ${CONTENT_BG_SEQ}`);
|
|
|
579810
580187
|
m2.totalTokens > 0 ? m2.totalTokens - m2.promptTokens : m2.estimatedContextTokens * 0.3
|
|
579811
580188
|
);
|
|
579812
580189
|
const tokOutVal = Math.max(0, tokOutRaw);
|
|
579813
|
-
const
|
|
579814
|
-
const
|
|
579815
|
-
const
|
|
579816
|
-
const
|
|
580190
|
+
const tpsStr = _StatusBar.formatTokensPerSecond(this._tokensPerSecond);
|
|
580191
|
+
const tpsExpanded = " " + pastel2(222, "t/s") + " " + c3.bold(tpsStr);
|
|
580192
|
+
const tpsW = 1 + 3 + 1 + tpsStr.length;
|
|
580193
|
+
const tokExpanded = pastel2(117, "↑") + c3.bold(tokInRaw.toLocaleString()) + " " + pastel2(151, "↓") + c3.bold(tokOutVal.toLocaleString()) + tpsExpanded;
|
|
580194
|
+
const tokCompact = pastel2(117, "↑") + c3.bold(_StatusBar.compactNum(tokInRaw)) + " " + pastel2(151, "↓") + c3.bold(_StatusBar.compactNum(tokOutVal)) + tpsExpanded;
|
|
580195
|
+
const tokExpW = 1 + tokInRaw.toLocaleString().length + 1 + 1 + tokOutVal.toLocaleString().length + tpsW;
|
|
580196
|
+
const tokCompW = 1 + _StatusBar.compactNum(tokInRaw).length + 1 + 1 + _StatusBar.compactNum(tokOutVal).length + tpsW;
|
|
579817
580197
|
sections.push({
|
|
579818
580198
|
expanded: tokExpanded,
|
|
579819
580199
|
compact: tokCompact,
|
|
@@ -580866,6 +581246,9 @@ ${CONTENT_BG_SEQ}`);
|
|
|
580866
581246
|
recordInference(durationMs, tokensPerSecond) {
|
|
580867
581247
|
this._inferenceCount++;
|
|
580868
581248
|
this._totalInferenceDurationMs += durationMs;
|
|
581249
|
+
if (Number.isFinite(tokensPerSecond) && tokensPerSecond > 0) {
|
|
581250
|
+
this._tokensPerSecond = tokensPerSecond;
|
|
581251
|
+
}
|
|
580869
581252
|
if (tokensPerSecond > this._peakTokensPerSecond) {
|
|
580870
581253
|
this._peakTokensPerSecond = tokensPerSecond;
|
|
580871
581254
|
}
|
|
@@ -581029,7 +581412,7 @@ function tuiSelect(opts) {
|
|
|
581029
581412
|
let maxVisible = opts.maxVisible ?? Math.max(3, termRows() - selectChrome);
|
|
581030
581413
|
let scrollOffset = 0;
|
|
581031
581414
|
let lastRenderedLines = 0;
|
|
581032
|
-
return new Promise((
|
|
581415
|
+
return new Promise((resolve56) => {
|
|
581033
581416
|
const stdin = process.stdin;
|
|
581034
581417
|
const hadRawMode = stdin.isRaw;
|
|
581035
581418
|
const savedRlListeners = [];
|
|
@@ -581205,10 +581588,10 @@ ${tuiBgSeq()}`);
|
|
|
581205
581588
|
render2();
|
|
581206
581589
|
} else if (hasBreadcrumbs) {
|
|
581207
581590
|
cleanup();
|
|
581208
|
-
|
|
581591
|
+
resolve56({ confirmed: false, key: "__back__", index: cursor });
|
|
581209
581592
|
} else {
|
|
581210
581593
|
cleanup();
|
|
581211
|
-
|
|
581594
|
+
resolve56({ confirmed: false, key: null, index: cursor });
|
|
581212
581595
|
}
|
|
581213
581596
|
return;
|
|
581214
581597
|
}
|
|
@@ -581238,7 +581621,7 @@ ${tuiBgSeq()}`);
|
|
|
581238
581621
|
if (!isSkippable(itemIdx) && matchSet.has(itemIdx)) {
|
|
581239
581622
|
cursor = itemIdx;
|
|
581240
581623
|
cleanup();
|
|
581241
|
-
|
|
581624
|
+
resolve56({ confirmed: true, key: items[cursor].key, index: cursor });
|
|
581242
581625
|
return;
|
|
581243
581626
|
} else if (!isSkippable(itemIdx)) {
|
|
581244
581627
|
cursor = itemIdx;
|
|
@@ -581321,7 +581704,7 @@ ${tuiBgSeq()}`);
|
|
|
581321
581704
|
items.splice(deletedIdx, 1);
|
|
581322
581705
|
if (items.length === 0) {
|
|
581323
581706
|
cleanup();
|
|
581324
|
-
|
|
581707
|
+
resolve56({ confirmed: false, key: null, index: -1 });
|
|
581325
581708
|
return;
|
|
581326
581709
|
}
|
|
581327
581710
|
updateFilter();
|
|
@@ -581407,7 +581790,7 @@ ${tuiBgSeq()}`);
|
|
|
581407
581790
|
done: () => render2(),
|
|
581408
581791
|
resolve: (result) => {
|
|
581409
581792
|
cleanup();
|
|
581410
|
-
|
|
581793
|
+
resolve56(result);
|
|
581411
581794
|
},
|
|
581412
581795
|
getInput: (prompt, prefill) => getInputFromUser(prompt, prefill),
|
|
581413
581796
|
render: () => render2(),
|
|
@@ -581416,7 +581799,7 @@ ${tuiBgSeq()}`);
|
|
|
581416
581799
|
if (consumed) return;
|
|
581417
581800
|
}
|
|
581418
581801
|
cleanup();
|
|
581419
|
-
|
|
581802
|
+
resolve56({ confirmed: true, key: items[cursor].key, index: cursor });
|
|
581420
581803
|
}
|
|
581421
581804
|
} else if (seq === "\x1B" || seq === "\x1B\x1B") {
|
|
581422
581805
|
if (filter2) {
|
|
@@ -581428,14 +581811,14 @@ ${tuiBgSeq()}`);
|
|
|
581428
581811
|
render2();
|
|
581429
581812
|
} else if (hasBreadcrumbs) {
|
|
581430
581813
|
cleanup();
|
|
581431
|
-
|
|
581814
|
+
resolve56({ confirmed: false, key: "__back__", index: cursor });
|
|
581432
581815
|
} else {
|
|
581433
581816
|
cleanup();
|
|
581434
|
-
|
|
581817
|
+
resolve56({ confirmed: false, key: null, index: cursor });
|
|
581435
581818
|
}
|
|
581436
581819
|
} else if (seq === "") {
|
|
581437
581820
|
cleanup();
|
|
581438
|
-
|
|
581821
|
+
resolve56({ confirmed: false, key: null, index: cursor });
|
|
581439
581822
|
} else if (seq === "" || seq === "\b") {
|
|
581440
581823
|
if (filter2.length > 0) {
|
|
581441
581824
|
filter2 = filter2.slice(0, -1);
|
|
@@ -581452,7 +581835,7 @@ ${tuiBgSeq()}`);
|
|
|
581452
581835
|
render2();
|
|
581453
581836
|
} else if (hasBreadcrumbs) {
|
|
581454
581837
|
cleanup();
|
|
581455
|
-
|
|
581838
|
+
resolve56({ confirmed: false, key: "__back__", index: cursor });
|
|
581456
581839
|
}
|
|
581457
581840
|
} else if (seq.length === 1 && seq.charCodeAt(0) >= 32 && seq.charCodeAt(0) < 127) {
|
|
581458
581841
|
if (opts.onCustomKey && !isSkippable(cursor) && matchSet.has(cursor)) {
|
|
@@ -581460,7 +581843,7 @@ ${tuiBgSeq()}`);
|
|
|
581460
581843
|
done: () => render2(),
|
|
581461
581844
|
resolve: (result) => {
|
|
581462
581845
|
cleanup();
|
|
581463
|
-
|
|
581846
|
+
resolve56(result);
|
|
581464
581847
|
},
|
|
581465
581848
|
getInput: (prompt, prefill) => getInputFromUser(prompt, prefill),
|
|
581466
581849
|
render: () => render2(),
|
|
@@ -581558,7 +581941,7 @@ ${tuiBgSeq()}`);
|
|
|
581558
581941
|
setTitle,
|
|
581559
581942
|
resolve: (result) => {
|
|
581560
581943
|
cleanup();
|
|
581561
|
-
|
|
581944
|
+
resolve56(result);
|
|
581562
581945
|
}
|
|
581563
581946
|
});
|
|
581564
581947
|
if (typeof maybeCleanup === "function") {
|
|
@@ -581614,7 +581997,7 @@ import { homedir as homedir36 } from "node:os";
|
|
|
581614
581997
|
import { execSync as execSync50, spawn as spawn27 } from "node:child_process";
|
|
581615
581998
|
import { fileURLToPath as fileURLToPath14 } from "node:url";
|
|
581616
581999
|
function execAsync(cmd, opts = {}) {
|
|
581617
|
-
return new Promise((
|
|
582000
|
+
return new Promise((resolve56, reject) => {
|
|
581618
582001
|
const child = spawn27("bash", ["-c", cmd], {
|
|
581619
582002
|
stdio: ["ignore", "pipe", "pipe"],
|
|
581620
582003
|
timeout: opts.timeout ?? 3e5,
|
|
@@ -581629,7 +582012,7 @@ function execAsync(cmd, opts = {}) {
|
|
|
581629
582012
|
stderr += d2.toString();
|
|
581630
582013
|
});
|
|
581631
582014
|
onChildClose(child, (code8, signal) => {
|
|
581632
|
-
if (code8 === 0)
|
|
582015
|
+
if (code8 === 0) resolve56(stdout.trim());
|
|
581633
582016
|
else reject(new Error(`Exit ${code8}${signal ? ` (signal: ${signal})` : ""}: ${stderr.slice(0, 500)}`));
|
|
581634
582017
|
});
|
|
581635
582018
|
onChildError(child, reject);
|
|
@@ -582379,7 +582762,7 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
|
|
|
582379
582762
|
}
|
|
582380
582763
|
log22(`Cloning voice "${voiceName}" from ${inputWav}...`);
|
|
582381
582764
|
log22("This requires loading the full 7B model — may take 30-60s...");
|
|
582382
|
-
return new Promise((
|
|
582765
|
+
return new Promise((resolve56) => {
|
|
582383
582766
|
const child = spawn27(venvPython2, [
|
|
582384
582767
|
cloneScript,
|
|
582385
582768
|
"--input",
|
|
@@ -582407,10 +582790,10 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
|
|
|
582407
582790
|
onChildClose(child, (code8) => {
|
|
582408
582791
|
if (code8 === 0 && existsSync96(outputPt)) {
|
|
582409
582792
|
log22(`Voice "${voiceName}" cloned successfully.`);
|
|
582410
|
-
|
|
582793
|
+
resolve56(outputPt);
|
|
582411
582794
|
} else {
|
|
582412
582795
|
log22(`Voice cloning failed (exit ${code8}).`);
|
|
582413
|
-
|
|
582796
|
+
resolve56(null);
|
|
582414
582797
|
}
|
|
582415
582798
|
});
|
|
582416
582799
|
});
|
|
@@ -582960,12 +583343,12 @@ function calculateExpandedVariantContextWindow(specs, modelSizeGB2, kvBytesPerTo
|
|
|
582960
583343
|
};
|
|
582961
583344
|
}
|
|
582962
583345
|
function ask(rl, question) {
|
|
582963
|
-
return new Promise((
|
|
582964
|
-
rl.question(question, (answer) =>
|
|
583346
|
+
return new Promise((resolve56) => {
|
|
583347
|
+
rl.question(question, (answer) => resolve56(answer.trim()));
|
|
582965
583348
|
});
|
|
582966
583349
|
}
|
|
582967
583350
|
function askSecret(rl, question) {
|
|
582968
|
-
return new Promise((
|
|
583351
|
+
return new Promise((resolve56) => {
|
|
582969
583352
|
process.stdout.write(question);
|
|
582970
583353
|
let secret = "";
|
|
582971
583354
|
const stdin = process.stdin;
|
|
@@ -582983,7 +583366,7 @@ function askSecret(rl, question) {
|
|
|
582983
583366
|
stdin.setRawMode(hadRawMode ?? false);
|
|
582984
583367
|
}
|
|
582985
583368
|
process.stdout.write("\n");
|
|
582986
|
-
|
|
583369
|
+
resolve56(secret.trim());
|
|
582987
583370
|
return;
|
|
582988
583371
|
} else if (c8 === "") {
|
|
582989
583372
|
stdin.removeListener("data", onData);
|
|
@@ -582991,7 +583374,7 @@ function askSecret(rl, question) {
|
|
|
582991
583374
|
stdin.setRawMode(hadRawMode ?? false);
|
|
582992
583375
|
}
|
|
582993
583376
|
process.stdout.write("\n");
|
|
582994
|
-
|
|
583377
|
+
resolve56("");
|
|
582995
583378
|
return;
|
|
582996
583379
|
} else if (c8 === "" || c8 === "\b") {
|
|
582997
583380
|
if (secret.length > 0) {
|
|
@@ -583459,7 +583842,7 @@ async function ensureOllamaRunning(backendUrl2, rl) {
|
|
|
583459
583842
|
return false;
|
|
583460
583843
|
}
|
|
583461
583844
|
for (let i2 = 0; i2 < 5; i2++) {
|
|
583462
|
-
await new Promise((
|
|
583845
|
+
await new Promise((resolve56) => setTimeout(resolve56, 2e3));
|
|
583463
583846
|
try {
|
|
583464
583847
|
const resp = await fetch(`${backendUrl2}/api/tags`, {
|
|
583465
583848
|
signal: AbortSignal.timeout(3e3)
|
|
@@ -584133,7 +584516,7 @@ ${c3.cyan(OMNIUS_FIRST_RUN_BANNER)}
|
|
|
584133
584516
|
try {
|
|
584134
584517
|
const child = spawn28("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
584135
584518
|
child.unref();
|
|
584136
|
-
await new Promise((
|
|
584519
|
+
await new Promise((resolve56) => setTimeout(resolve56, 3e3));
|
|
584137
584520
|
try {
|
|
584138
584521
|
models = await fetchOllamaModels(config.backendUrl);
|
|
584139
584522
|
process.stdout.write(` ${c3.green("✔")} Ollama is running.
|
|
@@ -584161,7 +584544,7 @@ ${c3.cyan(OMNIUS_FIRST_RUN_BANNER)}
|
|
|
584161
584544
|
try {
|
|
584162
584545
|
const child = spawn28("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
584163
584546
|
child.unref();
|
|
584164
|
-
await new Promise((
|
|
584547
|
+
await new Promise((resolve56) => setTimeout(resolve56, 3e3));
|
|
584165
584548
|
try {
|
|
584166
584549
|
models = await fetchOllamaModels(config.backendUrl);
|
|
584167
584550
|
process.stdout.write(` ${c3.green("✔")} Ollama is running.
|
|
@@ -586130,7 +586513,7 @@ var init_platforms = __esm({
|
|
|
586130
586513
|
|
|
586131
586514
|
// packages/cli/src/tui/workspace-explorer.ts
|
|
586132
586515
|
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as readFileSync80, statSync as statSync38 } from "node:fs";
|
|
586133
|
-
import { basename as basename22, extname as extname12, join as join114, relative as relative10, resolve as
|
|
586516
|
+
import { basename as basename22, extname as extname12, join as join114, relative as relative10, resolve as resolve42 } from "node:path";
|
|
586134
586517
|
function exploreWorkspace(root, options2 = {}) {
|
|
586135
586518
|
const query = (options2.query ?? "").trim().toLowerCase();
|
|
586136
586519
|
const maxResults = options2.maxResults ?? 80;
|
|
@@ -586212,8 +586595,8 @@ function formatWorkspaceExplorer(result) {
|
|
|
586212
586595
|
function previewWorkspaceFile(root, relPath, options2 = {}) {
|
|
586213
586596
|
const maxBytes = options2.maxBytes ?? 48 * 1024;
|
|
586214
586597
|
const maxLines = options2.maxLines ?? 120;
|
|
586215
|
-
const rootResolved =
|
|
586216
|
-
const full =
|
|
586598
|
+
const rootResolved = resolve42(root);
|
|
586599
|
+
const full = resolve42(root, relPath);
|
|
586217
586600
|
if (!full.startsWith(rootResolved + "/") && full !== rootResolved) {
|
|
586218
586601
|
throw new Error("File path escapes workspace root");
|
|
586219
586602
|
}
|
|
@@ -586319,7 +586702,7 @@ var init_workspace_explorer = __esm({
|
|
|
586319
586702
|
|
|
586320
586703
|
// packages/cli/src/tui/drop-panel.ts
|
|
586321
586704
|
import { existsSync as existsSync100 } from "node:fs";
|
|
586322
|
-
import { extname as extname13, resolve as
|
|
586705
|
+
import { extname as extname13, resolve as resolve43 } from "node:path";
|
|
586323
586706
|
function ansi4(code8, text) {
|
|
586324
586707
|
return isTTY3 ? `\x1B[${code8}m${text}\x1B[0m` : text;
|
|
586325
586708
|
}
|
|
@@ -586438,7 +586821,7 @@ function showDropPanel(opts) {
|
|
|
586438
586821
|
if (filePath.startsWith("file://")) {
|
|
586439
586822
|
filePath = decodeURIComponent(filePath.slice(7));
|
|
586440
586823
|
}
|
|
586441
|
-
filePath =
|
|
586824
|
+
filePath = resolve43(filePath);
|
|
586442
586825
|
if (!existsSync100(filePath)) {
|
|
586443
586826
|
errorMsg = `File not found: ${filePath}`;
|
|
586444
586827
|
render2();
|
|
@@ -589051,12 +589434,12 @@ function stopNeovimMode() {
|
|
|
589051
589434
|
} catch {
|
|
589052
589435
|
}
|
|
589053
589436
|
const s2 = _state;
|
|
589054
|
-
return new Promise((
|
|
589437
|
+
return new Promise((resolve56) => {
|
|
589055
589438
|
setTimeout(() => {
|
|
589056
589439
|
if (s2 && !s2.cleanedUp) {
|
|
589057
589440
|
doCleanup(s2);
|
|
589058
589441
|
}
|
|
589059
|
-
|
|
589442
|
+
resolve56();
|
|
589060
589443
|
}, 300);
|
|
589061
589444
|
});
|
|
589062
589445
|
}
|
|
@@ -590448,7 +590831,7 @@ __export(image_ascii_preview_exports, {
|
|
|
590448
590831
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
590449
590832
|
import { createRequire as createRequire5 } from "node:module";
|
|
590450
590833
|
import { existsSync as existsSync105, readFileSync as readFileSync84, statSync as statSync39 } from "node:fs";
|
|
590451
|
-
import { resolve as
|
|
590834
|
+
import { resolve as resolve44 } from "node:path";
|
|
590452
590835
|
function clamp5(n2, min, max) {
|
|
590453
590836
|
if (!Number.isFinite(n2)) return min;
|
|
590454
590837
|
return Math.max(min, Math.min(max, Math.floor(n2)));
|
|
@@ -590712,7 +591095,7 @@ function convertWithFfmpeg(imagePath, width, height, timeoutMs) {
|
|
|
590712
591095
|
}
|
|
590713
591096
|
}
|
|
590714
591097
|
async function buildImageAsciiPreview(inputPath, options2 = {}) {
|
|
590715
|
-
const imagePath =
|
|
591098
|
+
const imagePath = resolve44(inputPath);
|
|
590716
591099
|
if (!existsSync105(imagePath)) return null;
|
|
590717
591100
|
try {
|
|
590718
591101
|
if (!statSync39(imagePath).isFile()) return null;
|
|
@@ -590776,7 +591159,7 @@ function extractSavedImagePath(text, repoRoot) {
|
|
|
590776
591159
|
if (!match?.[1]) continue;
|
|
590777
591160
|
const raw = match[1].trim().replace(/\s+\([^)]+\)\s*$/g, "").replace(/^["']|["']$/g, "");
|
|
590778
591161
|
if (!hasImageExtension(raw)) continue;
|
|
590779
|
-
const candidate = raw.startsWith("/") ? raw :
|
|
591162
|
+
const candidate = raw.startsWith("/") ? raw : resolve44(repoRoot, raw);
|
|
590780
591163
|
if (existsSync105(candidate)) return candidate;
|
|
590781
591164
|
}
|
|
590782
591165
|
return null;
|
|
@@ -592548,8 +592931,8 @@ except Exception as exc:
|
|
|
592548
592931
|
async drainQueue() {
|
|
592549
592932
|
this.speaking = true;
|
|
592550
592933
|
if (!this.drainPromise) {
|
|
592551
|
-
this.drainPromise = new Promise((
|
|
592552
|
-
this.drainResolve =
|
|
592934
|
+
this.drainPromise = new Promise((resolve56) => {
|
|
592935
|
+
this.drainResolve = resolve56;
|
|
592553
592936
|
});
|
|
592554
592937
|
}
|
|
592555
592938
|
let isFirst = true;
|
|
@@ -592629,7 +593012,7 @@ except Exception as exc:
|
|
|
592629
593012
|
this.drainPromise = null;
|
|
592630
593013
|
}
|
|
592631
593014
|
sleep(ms) {
|
|
592632
|
-
return new Promise((
|
|
593015
|
+
return new Promise((resolve56) => setTimeout(resolve56, ms));
|
|
592633
593016
|
}
|
|
592634
593017
|
// -------------------------------------------------------------------------
|
|
592635
593018
|
// Synthesis pipeline
|
|
@@ -592927,7 +593310,7 @@ except Exception as exc:
|
|
|
592927
593310
|
async playWav(path12) {
|
|
592928
593311
|
const cmd = this.getPlayCommand(path12);
|
|
592929
593312
|
if (!cmd) return;
|
|
592930
|
-
return new Promise((
|
|
593313
|
+
return new Promise((resolve56) => {
|
|
592931
593314
|
const child = nodeSpawn(cmd[0], cmd.slice(1), {
|
|
592932
593315
|
stdio: "ignore",
|
|
592933
593316
|
detached: false
|
|
@@ -592935,11 +593318,11 @@ except Exception as exc:
|
|
|
592935
593318
|
this.currentPlayback = child;
|
|
592936
593319
|
onChildClose(child, () => {
|
|
592937
593320
|
if (this.currentPlayback === child) this.currentPlayback = null;
|
|
592938
|
-
|
|
593321
|
+
resolve56();
|
|
592939
593322
|
});
|
|
592940
593323
|
onChildError(child, () => {
|
|
592941
593324
|
if (this.currentPlayback === child) this.currentPlayback = null;
|
|
592942
|
-
|
|
593325
|
+
resolve56();
|
|
592943
593326
|
});
|
|
592944
593327
|
setTimeout(() => {
|
|
592945
593328
|
if (this.currentPlayback === child) {
|
|
@@ -592949,7 +593332,7 @@ except Exception as exc:
|
|
|
592949
593332
|
}
|
|
592950
593333
|
this.currentPlayback = null;
|
|
592951
593334
|
}
|
|
592952
|
-
|
|
593335
|
+
resolve56();
|
|
592953
593336
|
}, 15e3);
|
|
592954
593337
|
});
|
|
592955
593338
|
}
|
|
@@ -593111,7 +593494,7 @@ except Exception as exc:
|
|
|
593111
593494
|
writeFileSync53(supertonicInferScript2(), SUPERTONIC_INFER_PY2, "utf-8");
|
|
593112
593495
|
}
|
|
593113
593496
|
supertonicRequest(req2, timeoutMs = 12e4) {
|
|
593114
|
-
return new Promise((
|
|
593497
|
+
return new Promise((resolve56, reject) => {
|
|
593115
593498
|
const child = nodeSpawn(supertonicVenvPy2(), [supertonicInferScript2()], {
|
|
593116
593499
|
stdio: ["pipe", "pipe", "pipe"],
|
|
593117
593500
|
env: { ...process.env, PYTHONUNBUFFERED: "1" }
|
|
@@ -593150,7 +593533,7 @@ except Exception as exc:
|
|
|
593150
593533
|
String(parsed.error ?? (stderr || "Supertonic3 failed"))
|
|
593151
593534
|
)
|
|
593152
593535
|
);
|
|
593153
|
-
else
|
|
593536
|
+
else resolve56(parsed);
|
|
593154
593537
|
} catch {
|
|
593155
593538
|
reject(
|
|
593156
593539
|
new Error(
|
|
@@ -593255,7 +593638,7 @@ except Exception as exc:
|
|
|
593255
593638
|
/** Non-blocking shell execution — async alternative to execSync.
|
|
593256
593639
|
* Returns stdout string on exit 0, rejects otherwise. */
|
|
593257
593640
|
asyncShell(command, timeoutMs = 3e4) {
|
|
593258
|
-
return new Promise((
|
|
593641
|
+
return new Promise((resolve56, reject) => {
|
|
593259
593642
|
const proc = nodeSpawn("sh", ["-c", command], {
|
|
593260
593643
|
stdio: ["ignore", "pipe", "pipe"],
|
|
593261
593644
|
cwd: tmpdir20()
|
|
@@ -593276,7 +593659,7 @@ except Exception as exc:
|
|
|
593276
593659
|
}, timeoutMs);
|
|
593277
593660
|
procAny.on("close", (code8) => {
|
|
593278
593661
|
clearTimeout(timer);
|
|
593279
|
-
if (code8 === 0)
|
|
593662
|
+
if (code8 === 0) resolve56(stdout.trim());
|
|
593280
593663
|
else reject(new Error(stderr.slice(0, 300) || `Exit code ${code8}`));
|
|
593281
593664
|
});
|
|
593282
593665
|
});
|
|
@@ -594032,7 +594415,7 @@ if __name__ == '__main__':
|
|
|
594032
594415
|
if (this._luxttsDaemon && !this._luxttsDaemon.killed) return true;
|
|
594033
594416
|
const venvPy = luxttsVenvPy2();
|
|
594034
594417
|
if (!existsSync106(venvPy)) return false;
|
|
594035
|
-
return new Promise((
|
|
594418
|
+
return new Promise((resolve56) => {
|
|
594036
594419
|
const env2 = { ...process.env, LUXTTS_REPO_PATH: luxttsRepoDir2() };
|
|
594037
594420
|
const daemon = nodeSpawn(venvPy, [luxttsInferScript2()], {
|
|
594038
594421
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -594058,7 +594441,7 @@ if __name__ == '__main__':
|
|
|
594058
594441
|
status: "running"
|
|
594059
594442
|
});
|
|
594060
594443
|
}
|
|
594061
|
-
|
|
594444
|
+
resolve56(true);
|
|
594062
594445
|
} else if (msg.type === "result" || msg.type === "error") {
|
|
594063
594446
|
const pending2 = this._luxttsPending.get(msg.id);
|
|
594064
594447
|
if (pending2) {
|
|
@@ -594081,25 +594464,25 @@ if __name__ == '__main__':
|
|
|
594081
594464
|
});
|
|
594082
594465
|
daemon.on("error", () => {
|
|
594083
594466
|
this._luxttsDaemon = null;
|
|
594084
|
-
|
|
594467
|
+
resolve56(false);
|
|
594085
594468
|
});
|
|
594086
594469
|
setTimeout(() => {
|
|
594087
594470
|
if (this._luxttsDaemon === daemon && !this._luxttsPending.has("__ready__")) {
|
|
594088
|
-
|
|
594471
|
+
resolve56(false);
|
|
594089
594472
|
}
|
|
594090
594473
|
}, 6e4);
|
|
594091
594474
|
});
|
|
594092
594475
|
}
|
|
594093
594476
|
/** Send a request to the LuxTTS daemon and await the response */
|
|
594094
594477
|
luxttsRequest(req2) {
|
|
594095
|
-
return new Promise((
|
|
594478
|
+
return new Promise((resolve56, reject) => {
|
|
594096
594479
|
if (!this._luxttsDaemon || this._luxttsDaemon.killed) {
|
|
594097
594480
|
reject(new Error("LuxTTS daemon not running"));
|
|
594098
594481
|
return;
|
|
594099
594482
|
}
|
|
594100
594483
|
const id = `req_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
594101
594484
|
req2.id = id;
|
|
594102
|
-
this._luxttsPending.set(id, { resolve:
|
|
594485
|
+
this._luxttsPending.set(id, { resolve: resolve56, reject });
|
|
594103
594486
|
this._luxttsDaemon.stdin.write(JSON.stringify(req2) + "\n");
|
|
594104
594487
|
setTimeout(() => {
|
|
594105
594488
|
if (this._luxttsPending.has(id)) {
|
|
@@ -594536,24 +594919,24 @@ async function showKeyPoolMenu(options2) {
|
|
|
594536
594919
|
done(true);
|
|
594537
594920
|
}
|
|
594538
594921
|
},
|
|
594539
|
-
onEnter: (item, { getInput, resolve:
|
|
594922
|
+
onEnter: (item, { getInput, resolve: resolve56 }) => {
|
|
594540
594923
|
if (item.key === "__add_key__") {
|
|
594541
594924
|
getInput("API key", "").then((newKey) => {
|
|
594542
594925
|
if (!newKey?.trim()) {
|
|
594543
|
-
|
|
594926
|
+
resolve56({ confirmed: false, key: "", index: -1 });
|
|
594544
594927
|
return;
|
|
594545
594928
|
}
|
|
594546
594929
|
const suffix = newKey.trim().slice(-4);
|
|
594547
594930
|
if (pool3.some((k) => k.suffix === suffix)) {
|
|
594548
594931
|
renderWarning("Key ending ..." + suffix + " already in pool.");
|
|
594549
|
-
|
|
594932
|
+
resolve56({ confirmed: false, key: "", index: -1 });
|
|
594550
594933
|
return;
|
|
594551
594934
|
}
|
|
594552
594935
|
pool3.push({ key: newKey.trim(), suffix });
|
|
594553
594936
|
onSave(pool3);
|
|
594554
594937
|
onSetKeyPool(pool3.map((k) => k.key));
|
|
594555
594938
|
renderInfo("Added key ..." + suffix + " to pool.");
|
|
594556
|
-
|
|
594939
|
+
resolve56({ confirmed: true, key: "__added__", index: -1 });
|
|
594557
594940
|
});
|
|
594558
594941
|
return true;
|
|
594559
594942
|
}
|
|
@@ -594580,7 +594963,7 @@ async function showKeyPoolMenu(options2) {
|
|
|
594580
594963
|
renderInfo("Default key set to ..." + selected.suffix);
|
|
594581
594964
|
}
|
|
594582
594965
|
}
|
|
594583
|
-
|
|
594966
|
+
resolve56({ confirmed: true, key: "__set_default__", index: -1 });
|
|
594584
594967
|
});
|
|
594585
594968
|
return true;
|
|
594586
594969
|
}
|
|
@@ -594589,7 +594972,7 @@ async function showKeyPoolMenu(options2) {
|
|
|
594589
594972
|
onSave([]);
|
|
594590
594973
|
onSetKeyPool([]);
|
|
594591
594974
|
renderInfo("Key pool cleared. Using single API key from config.");
|
|
594592
|
-
|
|
594975
|
+
resolve56({ confirmed: true, key: "__clear_pool__", index: -1 });
|
|
594593
594976
|
return true;
|
|
594594
594977
|
}
|
|
594595
594978
|
return false;
|
|
@@ -594852,7 +595235,7 @@ async function runSudoScript(ctx3, script) {
|
|
|
594852
595235
|
try {
|
|
594853
595236
|
const { spawn: spawn34 } = await import("node:child_process");
|
|
594854
595237
|
const full = `set -e; ${script}`;
|
|
594855
|
-
await new Promise((
|
|
595238
|
+
await new Promise((resolve56) => {
|
|
594856
595239
|
const usePkexec = process.platform === "linux";
|
|
594857
595240
|
const cmd = usePkexec ? "pkexec" : "sudo";
|
|
594858
595241
|
const args = usePkexec ? ["bash", "-lc", full] : ["-n", "bash", "-lc", full];
|
|
@@ -594865,8 +595248,8 @@ async function runSudoScript(ctx3, script) {
|
|
|
594865
595248
|
child.stderr?.on("data", (data) => {
|
|
594866
595249
|
stderr += data.toString();
|
|
594867
595250
|
});
|
|
594868
|
-
onChildExit(child, () =>
|
|
594869
|
-
onChildError(child, () =>
|
|
595251
|
+
onChildExit(child, () => resolve56());
|
|
595252
|
+
onChildError(child, () => resolve56());
|
|
594870
595253
|
});
|
|
594871
595254
|
} catch {
|
|
594872
595255
|
}
|
|
@@ -598266,11 +598649,11 @@ systemctl --user enable --now omnius-daemon.service || true
|
|
|
598266
598649
|
sleep 1
|
|
598267
598650
|
`;
|
|
598268
598651
|
const { spawn: spawn34 } = await import("node:child_process");
|
|
598269
|
-
await new Promise((
|
|
598652
|
+
await new Promise((resolve56) => {
|
|
598270
598653
|
const child = spawn34("bash", ["-lc", takeover], {
|
|
598271
598654
|
stdio: "inherit"
|
|
598272
598655
|
});
|
|
598273
|
-
onChildExit(child, () =>
|
|
598656
|
+
onChildExit(child, () => resolve56());
|
|
598274
598657
|
});
|
|
598275
598658
|
renderInfo("Daemon takeover complete.");
|
|
598276
598659
|
} catch (e2) {
|
|
@@ -604016,7 +604399,7 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
604016
604399
|
deleteUsageRecord("endpoint", item.key, ctx3.repoRoot);
|
|
604017
604400
|
done(true);
|
|
604018
604401
|
},
|
|
604019
|
-
onEnter: (item, { getInput, resolve:
|
|
604402
|
+
onEnter: (item, { getInput, resolve: resolve56 }) => {
|
|
604020
604403
|
if (item.key === "__add__") {
|
|
604021
604404
|
getInput("URL", "http://").then(async (url2) => {
|
|
604022
604405
|
if (!url2 || !url2.trim()) return;
|
|
@@ -604024,12 +604407,12 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
604024
604407
|
const trimmedUrl = url2.trim();
|
|
604025
604408
|
const authArg = authKey?.trim() ? ` --auth ${authKey.trim()}` : "";
|
|
604026
604409
|
addedEndpoint = `${trimmedUrl}${authArg}`;
|
|
604027
|
-
|
|
604410
|
+
resolve56({ confirmed: true, key: "__add__", index: -1 });
|
|
604028
604411
|
});
|
|
604029
604412
|
return true;
|
|
604030
604413
|
}
|
|
604031
604414
|
if (item.key === "__sponsor__") {
|
|
604032
|
-
|
|
604415
|
+
resolve56({ confirmed: true, key: "__sponsor__", index: -1 });
|
|
604033
604416
|
return true;
|
|
604034
604417
|
}
|
|
604035
604418
|
return false;
|
|
@@ -604078,18 +604461,18 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
604078
604461
|
title: "Select Endpoint",
|
|
604079
604462
|
rl: ctx3.rl,
|
|
604080
604463
|
availableRows: ctx3.availableContentRows?.(),
|
|
604081
|
-
onEnter: (item, { getInput, resolve:
|
|
604464
|
+
onEnter: (item, { getInput, resolve: resolve56 }) => {
|
|
604082
604465
|
if (item.key === "__add__") {
|
|
604083
604466
|
getInput("URL", "http://").then(async (url2) => {
|
|
604084
604467
|
if (!url2?.trim()) return;
|
|
604085
604468
|
const authKey = await getInput("Auth key (optional)", "");
|
|
604086
604469
|
addedUrl = `${url2.trim()}${authKey?.trim() ? ` --auth ${authKey.trim()}` : ""}`;
|
|
604087
|
-
|
|
604470
|
+
resolve56({ confirmed: true, key: "__add__", index: -1 });
|
|
604088
604471
|
});
|
|
604089
604472
|
return true;
|
|
604090
604473
|
}
|
|
604091
604474
|
if (item.key === "__sponsor__") {
|
|
604092
|
-
|
|
604475
|
+
resolve56({ confirmed: true, key: "__sponsor__", index: -1 });
|
|
604093
604476
|
return true;
|
|
604094
604477
|
}
|
|
604095
604478
|
return false;
|
|
@@ -606442,7 +606825,7 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
606442
606825
|
_installProgress = 0;
|
|
606443
606826
|
_installTotal = 20;
|
|
606444
606827
|
_installPhase = "Preparing...";
|
|
606445
|
-
const runInstall2 = (cmd, label = summarizeInstallCommand(cmd)) => new Promise((
|
|
606828
|
+
const runInstall2 = (cmd, label = summarizeInstallCommand(cmd)) => new Promise((resolve56) => {
|
|
606446
606829
|
const startedAt2 = Date.now();
|
|
606447
606830
|
let lastOutputAt = startedAt2;
|
|
606448
606831
|
let settled = false;
|
|
@@ -606453,7 +606836,7 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
606453
606836
|
clearInterval(heartbeat);
|
|
606454
606837
|
clearTimeout(timeout2);
|
|
606455
606838
|
if (!ok3 && error) installError = error.trim();
|
|
606456
|
-
|
|
606839
|
+
resolve56(ok3);
|
|
606457
606840
|
};
|
|
606458
606841
|
const noteLine = (line, isError2) => {
|
|
606459
606842
|
const cleaned = stripInstallAnsi(line).trim();
|
|
@@ -606775,11 +607158,11 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
606775
607158
|
if (doRebuild) {
|
|
606776
607159
|
installOverlay.setPhase("Native Modules");
|
|
606777
607160
|
installOverlay.setStatus("Rebuilding native modules...");
|
|
606778
|
-
await new Promise((
|
|
607161
|
+
await new Promise((resolve56) => {
|
|
606779
607162
|
const child = exec6(
|
|
606780
607163
|
`${sudoPrefix}npm rebuild -g omnius 2>/dev/null || true`,
|
|
606781
607164
|
{ timeout: 12e4 },
|
|
606782
|
-
() =>
|
|
607165
|
+
() => resolve56(true)
|
|
606783
607166
|
);
|
|
606784
607167
|
child.stdout?.resume();
|
|
606785
607168
|
child.stderr?.resume();
|
|
@@ -606817,11 +607200,11 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
606817
607200
|
const venvPip2 = isWin2 ? pathJoin(venvDir, "Scripts", "pip.exe") : pathJoin(venvDir, "bin", "pip");
|
|
606818
607201
|
if (fsExists(venvPip2)) {
|
|
606819
607202
|
installOverlay.setStatus("Upgrading Python packages...");
|
|
606820
|
-
await new Promise((
|
|
607203
|
+
await new Promise((resolve56) => {
|
|
606821
607204
|
const child = exec6(
|
|
606822
607205
|
`"${venvPip2}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`,
|
|
606823
607206
|
{ timeout: 3e5 },
|
|
606824
|
-
(err) =>
|
|
607207
|
+
(err) => resolve56(!err)
|
|
606825
607208
|
);
|
|
606826
607209
|
child.stdout?.resume();
|
|
606827
607210
|
child.stderr?.resume();
|
|
@@ -607264,16 +607647,16 @@ async function showExposeDashboard(gateway, rl, ctx3) {
|
|
|
607264
607647
|
renderDashboard();
|
|
607265
607648
|
}, 1e3);
|
|
607266
607649
|
let stopGateway = false;
|
|
607267
|
-
await new Promise((
|
|
607650
|
+
await new Promise((resolve56) => {
|
|
607268
607651
|
const onData = (data) => {
|
|
607269
607652
|
const key = data.toString();
|
|
607270
607653
|
if (key === "q" || key === "Q" || key === "\x1B" || key === "") {
|
|
607271
|
-
|
|
607654
|
+
resolve56();
|
|
607272
607655
|
return;
|
|
607273
607656
|
}
|
|
607274
607657
|
if (key === "s" || key === "S") {
|
|
607275
607658
|
stopGateway = true;
|
|
607276
|
-
|
|
607659
|
+
resolve56();
|
|
607277
607660
|
return;
|
|
607278
607661
|
}
|
|
607279
607662
|
if (key === "c" || key === "C") {
|
|
@@ -607334,8 +607717,8 @@ async function showExposeDashboard(gateway, rl, ctx3) {
|
|
|
607334
607717
|
process.stdout.write("\x1B[?1002h\x1B[?1006h");
|
|
607335
607718
|
}
|
|
607336
607719
|
};
|
|
607337
|
-
const origResolve =
|
|
607338
|
-
|
|
607720
|
+
const origResolve = resolve56;
|
|
607721
|
+
resolve56 = (() => {
|
|
607339
607722
|
cleanup();
|
|
607340
607723
|
origResolve();
|
|
607341
607724
|
});
|
|
@@ -608408,7 +608791,7 @@ var init_visual_identity_association = __esm({
|
|
|
608408
608791
|
|
|
608409
608792
|
// packages/cli/src/tui/identity-memory-tool.ts
|
|
608410
608793
|
import { existsSync as existsSync109 } from "node:fs";
|
|
608411
|
-
import { basename as basename25, extname as extname14, resolve as
|
|
608794
|
+
import { basename as basename25, extname as extname14, resolve as resolve45 } from "node:path";
|
|
608412
608795
|
function personKey2(name10) {
|
|
608413
608796
|
return `person:${name10.trim().toLowerCase().replace(/\s+/g, " ")}`;
|
|
608414
608797
|
}
|
|
@@ -608469,7 +608852,7 @@ async function resolveMediaFromArgs(args, opts) {
|
|
|
608469
608852
|
if (!ref || ["reply", "latest", "last", "current", "this", "that", "it"].includes(ref.toLowerCase())) {
|
|
608470
608853
|
return null;
|
|
608471
608854
|
}
|
|
608472
|
-
const path12 =
|
|
608855
|
+
const path12 = resolve45(ref);
|
|
608473
608856
|
if (!existsSync109(path12)) return null;
|
|
608474
608857
|
const mediaType = inferMediaTypeFromPath(path12);
|
|
608475
608858
|
const media = { path: path12, mediaType };
|
|
@@ -615407,7 +615790,7 @@ import {
|
|
|
615407
615790
|
isAbsolute as isAbsolute7,
|
|
615408
615791
|
join as join130,
|
|
615409
615792
|
relative as relative12,
|
|
615410
|
-
resolve as
|
|
615793
|
+
resolve as resolve46,
|
|
615411
615794
|
sep as sep3
|
|
615412
615795
|
} from "node:path";
|
|
615413
615796
|
function telegramCreativeWorkspaceRoot(repoRoot, chatId) {
|
|
@@ -615444,7 +615827,7 @@ function publicCreativeContentPolicyError(args) {
|
|
|
615444
615827
|
return null;
|
|
615445
615828
|
}
|
|
615446
615829
|
function collectGeneratedArtifactPathsFromText(text, root) {
|
|
615447
|
-
const rootAbs =
|
|
615830
|
+
const rootAbs = resolve46(root);
|
|
615448
615831
|
const paths = /* @__PURE__ */ new Set();
|
|
615449
615832
|
for (const match of text.matchAll(MEDIA_PATH_RE)) {
|
|
615450
615833
|
const value2 = match[1];
|
|
@@ -615480,7 +615863,7 @@ function buildTelegramCreativeTools(repoRoot, chatId, backendUrl2, imageDefaults
|
|
|
615480
615863
|
];
|
|
615481
615864
|
}
|
|
615482
615865
|
function scopedTool(base3, root, mode) {
|
|
615483
|
-
const rootAbs =
|
|
615866
|
+
const rootAbs = resolve46(root);
|
|
615484
615867
|
const wrapper = {
|
|
615485
615868
|
name: base3.name,
|
|
615486
615869
|
description: `[PUBLIC TELEGRAM CREATIVE WORKSPACE: ${rootAbs}] ${base3.description} Paths are restricted to this workspace. This tool cannot access or modify files outside the workspace. ` + (mode === "edit" ? "It can only edit files already created in this workspace manifest. " : ""),
|
|
@@ -615539,11 +615922,11 @@ function scopedTool(base3, root, mode) {
|
|
|
615539
615922
|
if (result2.success) {
|
|
615540
615923
|
if (base3.name === "generate_tts" && typeof next["output"] === "string") {
|
|
615541
615924
|
rememberCreated(rootAbs, String(next["output"]));
|
|
615542
|
-
recordedPaths2.add(
|
|
615925
|
+
recordedPaths2.add(resolve46(String(next["output"])));
|
|
615543
615926
|
}
|
|
615544
615927
|
for (const path12 of collectGeneratedArtifactPathsFromText(result2.output, rootAbs)) {
|
|
615545
615928
|
rememberCreated(rootAbs, path12);
|
|
615546
|
-
recordedPaths2.add(
|
|
615929
|
+
recordedPaths2.add(resolve46(path12));
|
|
615547
615930
|
}
|
|
615548
615931
|
}
|
|
615549
615932
|
return withTelegramAutoAttachmentNotice(result2, recordedPaths2.size);
|
|
@@ -615584,7 +615967,7 @@ function scopedTool(base3, root, mode) {
|
|
|
615584
615967
|
const guarded = guardPath(rootAbs, String(args[pathKey]));
|
|
615585
615968
|
if (guarded.ok) {
|
|
615586
615969
|
rememberCreated(rootAbs, guarded.path.abs);
|
|
615587
|
-
recordedPaths.add(
|
|
615970
|
+
recordedPaths.add(resolve46(guarded.path.abs));
|
|
615588
615971
|
}
|
|
615589
615972
|
} else if (restoredEditPath) {
|
|
615590
615973
|
try {
|
|
@@ -615595,7 +615978,7 @@ function scopedTool(base3, root, mode) {
|
|
|
615595
615978
|
if (result.success) {
|
|
615596
615979
|
for (const path12 of collectGeneratedArtifactPathsFromText(result.output, rootAbs)) {
|
|
615597
615980
|
rememberCreated(rootAbs, path12);
|
|
615598
|
-
recordedPaths.add(
|
|
615981
|
+
recordedPaths.add(resolve46(path12));
|
|
615599
615982
|
}
|
|
615600
615983
|
}
|
|
615601
615984
|
return withTelegramAutoAttachmentNotice(result, recordedPaths.size);
|
|
@@ -615618,10 +616001,10 @@ ${notice}` : notice;
|
|
|
615618
616001
|
return { ...result, output, llmContent };
|
|
615619
616002
|
}
|
|
615620
616003
|
function guardPath(root, rawPath) {
|
|
615621
|
-
const rootAbs =
|
|
616004
|
+
const rootAbs = resolve46(root);
|
|
615622
616005
|
const trimmed = rawPath.trim().replace(/^["']|["']$/g, "");
|
|
615623
616006
|
if (!trimmed) return { ok: false, error: "Empty path is not allowed in the public creative workspace." };
|
|
615624
|
-
const abs =
|
|
616007
|
+
const abs = resolve46(rootAbs, trimmed);
|
|
615625
616008
|
if (!isInside(rootAbs, abs)) {
|
|
615626
616009
|
return {
|
|
615627
616010
|
ok: false,
|
|
@@ -615641,8 +616024,8 @@ function guardPath(root, rawPath) {
|
|
|
615641
616024
|
return { ok: true, path: { abs, rel } };
|
|
615642
616025
|
}
|
|
615643
616026
|
function isInside(root, path12) {
|
|
615644
|
-
const rootAbs =
|
|
615645
|
-
const pathAbs =
|
|
616027
|
+
const rootAbs = resolve46(root);
|
|
616028
|
+
const pathAbs = resolve46(path12);
|
|
615646
616029
|
return pathAbs === rootAbs || pathAbs.startsWith(rootAbs.endsWith(sep3) ? rootAbs : rootAbs + sep3);
|
|
615647
616030
|
}
|
|
615648
616031
|
function looksLikeLocalPath(value2) {
|
|
@@ -615700,8 +616083,8 @@ function rememberCreated(root, absPath) {
|
|
|
615700
616083
|
if (existsSync116(guarded.path.abs) && safeStatFile(guarded.path.abs)) {
|
|
615701
616084
|
const previous = manifest.objects?.[rel];
|
|
615702
616085
|
if (previous) {
|
|
615703
|
-
const previousPath =
|
|
615704
|
-
if (isInside(
|
|
616086
|
+
const previousPath = resolve46(root, previous.storedRel);
|
|
616087
|
+
if (isInside(resolve46(root), previousPath) && existsSync116(previousPath)) {
|
|
615705
616088
|
try {
|
|
615706
616089
|
unlinkSync22(previousPath);
|
|
615707
616090
|
} catch {
|
|
@@ -615746,7 +616129,7 @@ function isManifestArtifact(root, relPath) {
|
|
|
615746
616129
|
return manifestHas(root, relPath);
|
|
615747
616130
|
}
|
|
615748
616131
|
function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
615749
|
-
const rootAbs =
|
|
616132
|
+
const rootAbs = resolve46(root);
|
|
615750
616133
|
const guarded = guardPath(rootAbs, rawPath);
|
|
615751
616134
|
if (!guarded.ok) return { ok: false, error: guarded.error };
|
|
615752
616135
|
const policyError = publicCreativeArtifactPolicyError(guarded.path.abs);
|
|
@@ -615755,7 +616138,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
|
|
|
615755
616138
|
const rel = guarded.path.rel.replace(/\\/g, "/");
|
|
615756
616139
|
const object = manifest.objects?.[rel];
|
|
615757
616140
|
if (object) {
|
|
615758
|
-
const storedAbs =
|
|
616141
|
+
const storedAbs = resolve46(rootAbs, object.storedRel);
|
|
615759
616142
|
if (!isInside(rootAbs, storedAbs) || !existsSync116(storedAbs) || !safeStatFile(storedAbs)) {
|
|
615760
616143
|
return { ok: false, error: `Scoped artifact storage is missing for ${rel}.` };
|
|
615761
616144
|
}
|
|
@@ -618587,7 +618970,7 @@ var init_vision_ingress = __esm({
|
|
|
618587
618970
|
|
|
618588
618971
|
// packages/cli/src/tui/telegram-bridge.ts
|
|
618589
618972
|
import { mkdirSync as mkdirSync68, existsSync as existsSync119, unlinkSync as unlinkSync24, readdirSync as readdirSync42, statSync as statSync43, statfsSync as statfsSync5, readFileSync as readFileSync97, writeFileSync as writeFileSync62, appendFileSync as appendFileSync10 } from "node:fs";
|
|
618590
|
-
import { join as join133, resolve as
|
|
618973
|
+
import { join as join133, resolve as resolve47, basename as basename31, relative as relative13, isAbsolute as isAbsolute8, extname as extname16 } from "node:path";
|
|
618591
618974
|
import { homedir as homedir43 } from "node:os";
|
|
618592
618975
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
618593
618976
|
import { createHash as createHash27, randomBytes as randomBytes24, randomInt } from "node:crypto";
|
|
@@ -620095,7 +620478,7 @@ function telegramCachedMediaIsVideo(entry) {
|
|
|
620095
620478
|
return [".mp4", ".mkv", ".avi", ".mov", ".webm"].includes(extname16(entry.localPath).toLowerCase());
|
|
620096
620479
|
}
|
|
620097
620480
|
function isPathInside(root, path12) {
|
|
620098
|
-
const rel = relative13(
|
|
620481
|
+
const rel = relative13(resolve47(root), resolve47(path12));
|
|
620099
620482
|
return rel === "" || Boolean(rel) && !rel.startsWith("..") && !isAbsolute8(rel);
|
|
620100
620483
|
}
|
|
620101
620484
|
function extractTelegramMentionedUsernames(message2, text) {
|
|
@@ -620786,10 +621169,10 @@ External acquisition contract:
|
|
|
620786
621169
|
this.repoRoot = repoRoot;
|
|
620787
621170
|
this.toolPolicyConfig = toolPolicyConfig;
|
|
620788
621171
|
this.telegramToolPolicy = resolveSettings(repoRoot || ".").telegramToolPolicy ?? {};
|
|
620789
|
-
this.mediaCacheDir =
|
|
620790
|
-
this.telegramConversationDir =
|
|
620791
|
-
this.telegramSqlitePath =
|
|
620792
|
-
this.telegramToolButtonDir =
|
|
621172
|
+
this.mediaCacheDir = resolve47(repoRoot || ".", ".omnius", "telegram-media-cache");
|
|
621173
|
+
this.telegramConversationDir = resolve47(repoRoot || ".", ".omnius", "telegram-conversations");
|
|
621174
|
+
this.telegramSqlitePath = resolve47(repoRoot || ".", ".omnius", "telegram.sqlite");
|
|
621175
|
+
this.telegramToolButtonDir = resolve47(repoRoot || ".", ".omnius", "telegram-tool-buttons");
|
|
620793
621176
|
this.state.maxSubAgents = normalizeTelegramSubAgentLimit(resolveSettings(repoRoot || ".").telegramSubAgents);
|
|
620794
621177
|
this.hydrateTelegramCommandMap(buildTelegramBotCommands({ scope: "admin" }));
|
|
620795
621178
|
}
|
|
@@ -622082,7 +622465,7 @@ ${mediaContext}` : ""
|
|
|
622082
622465
|
return null;
|
|
622083
622466
|
}
|
|
622084
622467
|
try {
|
|
622085
|
-
mkdirSync68(
|
|
622468
|
+
mkdirSync68(resolve47(this.repoRoot, ".omnius"), { recursive: true });
|
|
622086
622469
|
const db = initDb(this.telegramSqlitePath);
|
|
622087
622470
|
db.exec(`
|
|
622088
622471
|
CREATE TABLE IF NOT EXISTS telegram_messages (
|
|
@@ -623288,7 +623671,7 @@ ${mediaContext}` : ""
|
|
|
623288
623671
|
return { ok: true, path: entry.localPath };
|
|
623289
623672
|
}
|
|
623290
623673
|
const matchingEntry = mediaEntries.find((entry) => {
|
|
623291
|
-
if (
|
|
623674
|
+
if (resolve47(entry.localPath) === resolve47(raw)) return true;
|
|
623292
623675
|
if (basename31(entry.localPath) === raw) return true;
|
|
623293
623676
|
if (entry.fileUniqueId === raw || entry.fileId === raw) return true;
|
|
623294
623677
|
if (entry.messageId && String(entry.messageId) === raw) return true;
|
|
@@ -623296,7 +623679,7 @@ ${mediaContext}` : ""
|
|
|
623296
623679
|
return false;
|
|
623297
623680
|
});
|
|
623298
623681
|
if (matchingEntry) return { ok: true, path: matchingEntry.localPath };
|
|
623299
|
-
const creativeCandidate = isAbsolute8(raw) ?
|
|
623682
|
+
const creativeCandidate = isAbsolute8(raw) ? resolve47(raw) : resolve47(creativeRoot, raw);
|
|
623300
623683
|
if (isPathInside(creativeRoot, creativeCandidate) && existsSync119(creativeCandidate)) {
|
|
623301
623684
|
return { ok: true, path: creativeCandidate };
|
|
623302
623685
|
}
|
|
@@ -623325,7 +623708,7 @@ ${mediaContext}` : ""
|
|
|
623325
623708
|
return replied ?? entries[0];
|
|
623326
623709
|
}
|
|
623327
623710
|
return entries.find((entry2) => {
|
|
623328
|
-
if (
|
|
623711
|
+
if (resolve47(entry2.localPath) === resolve47(ref)) return true;
|
|
623329
623712
|
if (basename31(entry2.localPath) === ref) return true;
|
|
623330
623713
|
if (entry2.fileUniqueId === ref || entry2.fileId === ref) return true;
|
|
623331
623714
|
if (entry2.messageId && String(entry2.messageId) === ref) return true;
|
|
@@ -623362,7 +623745,7 @@ ${mediaContext}` : ""
|
|
|
623362
623745
|
const repoRoot = this.repoRoot || ".";
|
|
623363
623746
|
const creativeRoot = telegramCreativeWorkspaceRoot(repoRoot, chatId);
|
|
623364
623747
|
const raw = String(rawValue || fallbackName).trim() || fallbackName;
|
|
623365
|
-
const outputPath3 = isAbsolute8(raw) ?
|
|
623748
|
+
const outputPath3 = isAbsolute8(raw) ? resolve47(raw) : resolve47(creativeRoot, raw);
|
|
623366
623749
|
if (!isPathInside(creativeRoot, outputPath3)) {
|
|
623367
623750
|
return { ok: false, error: `Output path must stay inside this Telegram chat's creative workspace: ${raw}` };
|
|
623368
623751
|
}
|
|
@@ -624172,7 +624555,7 @@ ${lines.join("\n")}`;
|
|
|
624172
624555
|
let topicCount = 0;
|
|
624173
624556
|
if (this.repoRoot && chatId !== void 0) {
|
|
624174
624557
|
try {
|
|
624175
|
-
const memDir =
|
|
624558
|
+
const memDir = resolve47(this.repoRoot, ".omnius", "memory");
|
|
624176
624559
|
if (existsSync119(memDir)) {
|
|
624177
624560
|
const prefix = this.telegramScopedMemoryPrefix(chatId);
|
|
624178
624561
|
for (const file of readdirSync42(memDir)) {
|
|
@@ -625048,13 +625431,13 @@ ${retryText}`,
|
|
|
625048
625431
|
existing.trailing.toolContext = toolContext;
|
|
625049
625432
|
return existing.trailing.promise;
|
|
625050
625433
|
}
|
|
625051
|
-
let
|
|
625434
|
+
let resolve56;
|
|
625052
625435
|
let reject;
|
|
625053
625436
|
const promise = new Promise((res, rej) => {
|
|
625054
|
-
|
|
625437
|
+
resolve56 = res;
|
|
625055
625438
|
reject = rej;
|
|
625056
625439
|
});
|
|
625057
|
-
existing.trailing = { msg, toolContext, promise, resolve:
|
|
625440
|
+
existing.trailing = { msg, toolContext, promise, resolve: resolve56, reject };
|
|
625058
625441
|
return promise;
|
|
625059
625442
|
}
|
|
625060
625443
|
/**
|
|
@@ -625079,9 +625462,9 @@ ${retryText}`,
|
|
|
625079
625462
|
state = void 0;
|
|
625080
625463
|
}
|
|
625081
625464
|
if (!state?.trailing) return;
|
|
625082
|
-
const { msg: nextMsg, toolContext: nextCtx, resolve:
|
|
625465
|
+
const { msg: nextMsg, toolContext: nextCtx, resolve: resolve56, reject } = state.trailing;
|
|
625083
625466
|
try {
|
|
625084
|
-
this.startCoalescedTelegramRouterCall(sessionKey, nextMsg, nextCtx).then(
|
|
625467
|
+
this.startCoalescedTelegramRouterCall(sessionKey, nextMsg, nextCtx).then(resolve56, reject);
|
|
625085
625468
|
} catch (err) {
|
|
625086
625469
|
reject(err);
|
|
625087
625470
|
}
|
|
@@ -625920,10 +626303,10 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
625920
626303
|
}
|
|
625921
626304
|
if (me.result?.id) {
|
|
625922
626305
|
const botUserId = Number(me.result.id);
|
|
625923
|
-
const globalLockDir = process.env["OMNIUS_TELEGRAM_LOCK_DIR"] ?
|
|
626306
|
+
const globalLockDir = process.env["OMNIUS_TELEGRAM_LOCK_DIR"] ? resolve47(process.env["OMNIUS_TELEGRAM_LOCK_DIR"]) : resolve47(homedir43(), ".omnius", "telegram-runner-state");
|
|
625924
626307
|
const lockDirs = /* @__PURE__ */ new Set([globalLockDir]);
|
|
625925
626308
|
if (this.repoRoot) {
|
|
625926
|
-
lockDirs.add(
|
|
626309
|
+
lockDirs.add(resolve47(this.repoRoot, ".omnius", "telegram-runner-state"));
|
|
625927
626310
|
}
|
|
625928
626311
|
const claimed = [];
|
|
625929
626312
|
try {
|
|
@@ -629396,10 +629779,10 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
629396
629779
|
return { ok: false, error: "Expected chat_id/user_id as digits, or a valid @username." };
|
|
629397
629780
|
}
|
|
629398
629781
|
resolveTelegramFilePath(rawPath, repoRoot, scopedRoot) {
|
|
629399
|
-
const base3 = scopedRoot ?
|
|
629782
|
+
const base3 = scopedRoot ? resolve47(scopedRoot) : resolve47(repoRoot);
|
|
629400
629783
|
const trimmed = rawPath.trim().replace(/^["']|["']$/g, "");
|
|
629401
629784
|
if (scopedRoot) {
|
|
629402
|
-
const logicalPath = isAbsolute8(trimmed) ?
|
|
629785
|
+
const logicalPath = isAbsolute8(trimmed) ? resolve47(trimmed) : resolve47(base3, trimmed);
|
|
629403
629786
|
if (!isPathInside(base3, logicalPath)) {
|
|
629404
629787
|
return { ok: false, error: `Path escapes the scoped Telegram creative workspace: ${trimmed}` };
|
|
629405
629788
|
}
|
|
@@ -629407,15 +629790,15 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
629407
629790
|
if (!materialized.ok) return materialized;
|
|
629408
629791
|
return { ...materialized, logicalPath };
|
|
629409
629792
|
}
|
|
629410
|
-
const abs = isAbsolute8(trimmed) ?
|
|
629793
|
+
const abs = isAbsolute8(trimmed) ? resolve47(trimmed) : resolve47(base3, trimmed);
|
|
629411
629794
|
if (!existsSync119(abs)) return { ok: false, error: `File does not exist: ${trimmed}` };
|
|
629412
629795
|
if (!statSync43(abs).isFile()) return { ok: false, error: `Path is not a file: ${trimmed}` };
|
|
629413
629796
|
return { ok: true, path: abs };
|
|
629414
629797
|
}
|
|
629415
629798
|
rememberTelegramDeliveredArtifact(subAgent, path12) {
|
|
629416
|
-
const abs =
|
|
629799
|
+
const abs = resolve47(path12);
|
|
629417
629800
|
subAgent.deliveredArtifacts ??= [];
|
|
629418
|
-
if (!subAgent.deliveredArtifacts.some((existing) =>
|
|
629801
|
+
if (!subAgent.deliveredArtifacts.some((existing) => resolve47(existing) === abs)) {
|
|
629419
629802
|
subAgent.deliveredArtifacts.push(abs);
|
|
629420
629803
|
}
|
|
629421
629804
|
}
|
|
@@ -629428,7 +629811,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
|
|
|
629428
629811
|
telegramFileSendFingerprint(chatId, path12, kind, caption, replyToMessageId) {
|
|
629429
629812
|
return stableTelegramValueKey({
|
|
629430
629813
|
chatId: String(chatId),
|
|
629431
|
-
path:
|
|
629814
|
+
path: resolve47(path12),
|
|
629432
629815
|
kind,
|
|
629433
629816
|
caption: caption ?? "",
|
|
629434
629817
|
replyToMessageId: replyToMessageId ?? null
|
|
@@ -629765,10 +630148,10 @@ ${text}`.trim());
|
|
|
629765
630148
|
deliveredArtifactMediaSuppressorForMessage(msg) {
|
|
629766
630149
|
const subAgent = this.subAgents.get(this.sessionKeyForMessage(msg));
|
|
629767
630150
|
const delivered = new Set(
|
|
629768
|
-
(subAgent?.deliveredArtifacts ?? []).map((path12) =>
|
|
630151
|
+
(subAgent?.deliveredArtifacts ?? []).map((path12) => resolve47(path12))
|
|
629769
630152
|
);
|
|
629770
630153
|
if (delivered.size === 0) return void 0;
|
|
629771
|
-
return (media) => media.source === "file" && delivered.has(
|
|
630154
|
+
return (media) => media.source === "file" && delivered.has(resolve47(media.value));
|
|
629772
630155
|
}
|
|
629773
630156
|
async replyToTelegramMessage(msg, text, options2 = {}) {
|
|
629774
630157
|
if (msg.guestQueryId) {
|
|
@@ -629779,7 +630162,7 @@ ${text}`.trim());
|
|
|
629779
630162
|
return options2.html ? this.sendMessageHTML(msg.chatId, text, options2.replyToMessageId) : this.sendMessage(msg.chatId, text, options2.replyToMessageId);
|
|
629780
630163
|
}
|
|
629781
630164
|
async sendTelegramFileToChat(chatId, path12, options2) {
|
|
629782
|
-
const abs =
|
|
630165
|
+
const abs = resolve47(path12);
|
|
629783
630166
|
if (!existsSync119(abs) || !statSync43(abs).isFile()) {
|
|
629784
630167
|
throw new Error(`File does not exist or is not a regular file: ${path12}`);
|
|
629785
630168
|
}
|
|
@@ -629995,18 +630378,18 @@ Content-Type: ${contentType}\r
|
|
|
629995
630378
|
async sendGeneratedArtifactsFromSubAgent(msg, subAgent, finalText, includeMentioned) {
|
|
629996
630379
|
const root = subAgent.creativeWorkspaceRoot;
|
|
629997
630380
|
if (!root) return;
|
|
629998
|
-
const rootAbs =
|
|
630381
|
+
const rootAbs = resolve47(root);
|
|
629999
630382
|
const paths = new Set(subAgent.generatedArtifacts);
|
|
630000
630383
|
for (const path12 of collectGeneratedArtifactPathsFromText(finalText, root)) {
|
|
630001
630384
|
paths.add(path12);
|
|
630002
630385
|
}
|
|
630003
630386
|
if (paths.size === 0) return;
|
|
630004
630387
|
const alreadySentByText = new Set(
|
|
630005
|
-
extractMediaReferences(finalText).media.filter((media) => media.source === "file").map((media) =>
|
|
630388
|
+
extractMediaReferences(finalText).media.filter((media) => media.source === "file").map((media) => resolve47(media.value))
|
|
630006
630389
|
);
|
|
630007
|
-
const alreadyDelivered = new Set((subAgent.deliveredArtifacts ?? []).map((path12) =>
|
|
630390
|
+
const alreadyDelivered = new Set((subAgent.deliveredArtifacts ?? []).map((path12) => resolve47(path12)));
|
|
630008
630391
|
for (const path12 of paths) {
|
|
630009
|
-
const abs =
|
|
630392
|
+
const abs = resolve47(path12);
|
|
630010
630393
|
if (!isPathInside(rootAbs, abs)) continue;
|
|
630011
630394
|
if (alreadyDelivered.has(abs)) continue;
|
|
630012
630395
|
if (!includeMentioned && alreadySentByText.has(abs)) continue;
|
|
@@ -631267,7 +631650,7 @@ __export(projects_exports, {
|
|
|
631267
631650
|
});
|
|
631268
631651
|
import { readFileSync as readFileSync99, writeFileSync as writeFileSync64, mkdirSync as mkdirSync70, existsSync as existsSync121, statSync as statSync44, renameSync as renameSync7 } from "node:fs";
|
|
631269
631652
|
import { homedir as homedir45 } from "node:os";
|
|
631270
|
-
import { basename as basename32, join as join135, resolve as
|
|
631653
|
+
import { basename as basename32, join as join135, resolve as resolve48 } from "node:path";
|
|
631271
631654
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
631272
631655
|
function readAll2() {
|
|
631273
631656
|
try {
|
|
@@ -631299,7 +631682,7 @@ function listProjects() {
|
|
|
631299
631682
|
return alive;
|
|
631300
631683
|
}
|
|
631301
631684
|
function registerProject(root, pid) {
|
|
631302
|
-
const canonical =
|
|
631685
|
+
const canonical = resolve48(root);
|
|
631303
631686
|
const now = Date.now();
|
|
631304
631687
|
const file = readAll2();
|
|
631305
631688
|
const existing = file.projects.find((p2) => p2.root === canonical);
|
|
@@ -631327,7 +631710,7 @@ function registerProject(root, pid) {
|
|
|
631327
631710
|
return entry;
|
|
631328
631711
|
}
|
|
631329
631712
|
function unregisterProject(root) {
|
|
631330
|
-
const canonical =
|
|
631713
|
+
const canonical = resolve48(root);
|
|
631331
631714
|
const file = readAll2();
|
|
631332
631715
|
const before = file.projects.length;
|
|
631333
631716
|
file.projects = file.projects.filter((p2) => p2.root !== canonical);
|
|
@@ -631336,7 +631719,7 @@ function unregisterProject(root) {
|
|
|
631336
631719
|
return true;
|
|
631337
631720
|
}
|
|
631338
631721
|
function renameProject(root, name10) {
|
|
631339
|
-
const canonical =
|
|
631722
|
+
const canonical = resolve48(root);
|
|
631340
631723
|
const file = readAll2();
|
|
631341
631724
|
const idx = file.projects.findIndex((p2) => p2.root === canonical);
|
|
631342
631725
|
if (idx < 0) return null;
|
|
@@ -631360,7 +631743,7 @@ function getCurrentProject() {
|
|
|
631360
631743
|
return all2.find((p2) => p2.root === currentRoot) ?? null;
|
|
631361
631744
|
}
|
|
631362
631745
|
function setCurrentProject(root) {
|
|
631363
|
-
const canonical =
|
|
631746
|
+
const canonical = resolve48(root);
|
|
631364
631747
|
const entry = listProjects().find((p2) => p2.root === canonical);
|
|
631365
631748
|
if (!entry) return null;
|
|
631366
631749
|
currentRoot = canonical;
|
|
@@ -632198,10 +632581,10 @@ var init_access_policy = __esm({
|
|
|
632198
632581
|
import { createHash as createHash28 } from "node:crypto";
|
|
632199
632582
|
import { existsSync as existsSync122, mkdirSync as mkdirSync71, readFileSync as readFileSync100, renameSync as renameSync8, writeFileSync as writeFileSync65, unlinkSync as unlinkSync26 } from "node:fs";
|
|
632200
632583
|
import { homedir as homedir46 } from "node:os";
|
|
632201
|
-
import { join as join136, resolve as
|
|
632584
|
+
import { join as join136, resolve as resolve49 } from "node:path";
|
|
632202
632585
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
632203
632586
|
function projectKey(root) {
|
|
632204
|
-
const canonical =
|
|
632587
|
+
const canonical = resolve49(root);
|
|
632205
632588
|
return createHash28("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
632206
632589
|
}
|
|
632207
632590
|
function projectDir(root) {
|
|
@@ -632219,7 +632602,7 @@ function ensureDir(root) {
|
|
|
632219
632602
|
const sentinel = rootSentinelPath(root);
|
|
632220
632603
|
try {
|
|
632221
632604
|
if (!existsSync122(sentinel)) {
|
|
632222
|
-
writeFileSync65(sentinel, `${
|
|
632605
|
+
writeFileSync65(sentinel, `${resolve49(root)}
|
|
632223
632606
|
`, "utf8");
|
|
632224
632607
|
}
|
|
632225
632608
|
} catch {
|
|
@@ -633473,7 +633856,7 @@ function publishEvent(type, data, opts = {}) {
|
|
|
633473
633856
|
});
|
|
633474
633857
|
}
|
|
633475
633858
|
function readBodyWithLimit(req2, maxBytes = 1048576) {
|
|
633476
|
-
return new Promise((
|
|
633859
|
+
return new Promise((resolve56, reject) => {
|
|
633477
633860
|
const chunks = [];
|
|
633478
633861
|
let size = 0;
|
|
633479
633862
|
req2.on("data", (chunk) => {
|
|
@@ -633485,7 +633868,7 @@ function readBodyWithLimit(req2, maxBytes = 1048576) {
|
|
|
633485
633868
|
}
|
|
633486
633869
|
chunks.push(chunk);
|
|
633487
633870
|
});
|
|
633488
|
-
req2.on("end", () =>
|
|
633871
|
+
req2.on("end", () => resolve56(Buffer.concat(chunks).toString("utf-8")));
|
|
633489
633872
|
req2.on("error", reject);
|
|
633490
633873
|
});
|
|
633491
633874
|
}
|
|
@@ -634458,7 +634841,7 @@ function getLocalOnion() {
|
|
|
634458
634841
|
return null;
|
|
634459
634842
|
}
|
|
634460
634843
|
async function torIsReachable() {
|
|
634461
|
-
return new Promise((
|
|
634844
|
+
return new Promise((resolve56) => {
|
|
634462
634845
|
const sock = createConnection3({ host: DEFAULT_SOCKS_HOST, port: DEFAULT_SOCKS_PORT });
|
|
634463
634846
|
let done = false;
|
|
634464
634847
|
const finish = (ok3) => {
|
|
@@ -634468,7 +634851,7 @@ async function torIsReachable() {
|
|
|
634468
634851
|
sock.destroy();
|
|
634469
634852
|
} catch {
|
|
634470
634853
|
}
|
|
634471
|
-
|
|
634854
|
+
resolve56(ok3);
|
|
634472
634855
|
};
|
|
634473
634856
|
sock.once("connect", () => finish(true));
|
|
634474
634857
|
sock.once("error", () => finish(false));
|
|
@@ -634510,7 +634893,7 @@ async function tunnelViaTor(req2) {
|
|
|
634510
634893
|
return { status, headers: respHeaders, body: bodyText, streaming };
|
|
634511
634894
|
}
|
|
634512
634895
|
function openSocks5(targetHost, targetPort, timeoutMs) {
|
|
634513
|
-
return new Promise((
|
|
634896
|
+
return new Promise((resolve56, reject) => {
|
|
634514
634897
|
const sock = createConnection3({ host: DEFAULT_SOCKS_HOST, port: DEFAULT_SOCKS_PORT });
|
|
634515
634898
|
let stage = "greet";
|
|
634516
634899
|
const timer = setTimeout(() => {
|
|
@@ -634573,7 +634956,7 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
|
|
|
634573
634956
|
}
|
|
634574
634957
|
clearTimeout(timer);
|
|
634575
634958
|
stage = "ready";
|
|
634576
|
-
|
|
634959
|
+
resolve56(sock);
|
|
634577
634960
|
}
|
|
634578
634961
|
});
|
|
634579
634962
|
});
|
|
@@ -634662,7 +635045,7 @@ async function runGraphicalSudo(opts) {
|
|
|
634662
635045
|
cmd = "sudo";
|
|
634663
635046
|
args = ["/bin/bash", opts.scriptPath, ...opts.args ?? []];
|
|
634664
635047
|
}
|
|
634665
|
-
return new Promise((
|
|
635048
|
+
return new Promise((resolve56, reject) => {
|
|
634666
635049
|
const child = spawn30(cmd, args, {
|
|
634667
635050
|
env: { ...process.env, ...opts.env || {}, ...extraEnv },
|
|
634668
635051
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -634696,7 +635079,7 @@ async function runGraphicalSudo(opts) {
|
|
|
634696
635079
|
child.once("close", (code8) => {
|
|
634697
635080
|
clearTimeout(timer);
|
|
634698
635081
|
if (timedOut) return reject(new Error(`graphical sudo timed out after ${timeoutMs}ms`));
|
|
634699
|
-
|
|
635082
|
+
resolve56({ code: code8 ?? -1, stdout, stderr, helper });
|
|
634700
635083
|
});
|
|
634701
635084
|
});
|
|
634702
635085
|
}
|
|
@@ -647387,7 +647770,7 @@ var init_profiles = __esm({
|
|
|
647387
647770
|
// packages/cli/src/docker.ts
|
|
647388
647771
|
import { execSync as execSync57, spawn as spawn31 } from "node:child_process";
|
|
647389
647772
|
import { existsSync as existsSync132, mkdirSync as mkdirSync78, writeFileSync as writeFileSync70 } from "node:fs";
|
|
647390
|
-
import { join as join145, resolve as
|
|
647773
|
+
import { join as join145, resolve as resolve50, dirname as dirname39 } from "node:path";
|
|
647391
647774
|
import { homedir as homedir52 } from "node:os";
|
|
647392
647775
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
647393
647776
|
function getDockerDir() {
|
|
@@ -647643,7 +648026,7 @@ function runInContainer(opts) {
|
|
|
647643
648026
|
const timeout2 = (opts.timeoutS || 120) + 30;
|
|
647644
648027
|
args.push("--stop-timeout", String(timeout2));
|
|
647645
648028
|
if (opts.workingDir) {
|
|
647646
|
-
const hostDir =
|
|
648029
|
+
const hostDir = resolve50(opts.workingDir);
|
|
647647
648030
|
args.push("-v", `${hostDir}:/workspace`);
|
|
647648
648031
|
}
|
|
647649
648032
|
const ollamaHost = opts.ollamaHost || process.env["OLLAMA_HOST"] || "http://host.docker.internal:11434";
|
|
@@ -647867,10 +648250,10 @@ import * as http5 from "node:http";
|
|
|
647867
648250
|
import * as https3 from "node:https";
|
|
647868
648251
|
import { createRequire as createRequire7 } from "node:module";
|
|
647869
648252
|
import { fileURLToPath as fileURLToPath18 } from "node:url";
|
|
647870
|
-
import { dirname as dirname40, join as join147, resolve as
|
|
648253
|
+
import { dirname as dirname40, join as join147, resolve as resolve51 } from "node:path";
|
|
647871
648254
|
import { homedir as homedir53 } from "node:os";
|
|
647872
648255
|
import { spawn as spawn32, execSync as execSync58 } from "node:child_process";
|
|
647873
|
-
import { mkdirSync as mkdirSync79, writeFileSync as writeFileSync71, readFileSync as readFileSync108, readdirSync as readdirSync47, existsSync as existsSync133, watch as
|
|
648256
|
+
import { mkdirSync as mkdirSync79, writeFileSync as writeFileSync71, readFileSync as readFileSync108, readdirSync as readdirSync47, existsSync as existsSync133, watch as fsWatch4, renameSync as renameSync9, unlinkSync as unlinkSync28 } from "node:fs";
|
|
647874
648257
|
import { randomBytes as randomBytes27, randomUUID as randomUUID17 } from "node:crypto";
|
|
647875
648258
|
import { createHash as createHash31 } from "node:crypto";
|
|
647876
648259
|
function memoryDbPaths3(baseDir = process.cwd()) {
|
|
@@ -648223,10 +648606,10 @@ function corsHeaders(req2, res) {
|
|
|
648223
648606
|
return true;
|
|
648224
648607
|
}
|
|
648225
648608
|
function readBody(req2) {
|
|
648226
|
-
return new Promise((
|
|
648609
|
+
return new Promise((resolve56, reject) => {
|
|
648227
648610
|
const chunks = [];
|
|
648228
648611
|
req2.on("data", (chunk) => chunks.push(chunk));
|
|
648229
|
-
req2.on("end", () =>
|
|
648612
|
+
req2.on("end", () => resolve56(Buffer.concat(chunks).toString("utf-8")));
|
|
648230
648613
|
req2.on("error", reject);
|
|
648231
648614
|
});
|
|
648232
648615
|
}
|
|
@@ -648360,7 +648743,7 @@ async function directChatBackend(opts) {
|
|
|
648360
648743
|
let acc = "";
|
|
648361
648744
|
const url = backendUrl(ollamaUrl, "/v1/chat/completions");
|
|
648362
648745
|
const transport = url.protocol === "https:" ? https3 : http5;
|
|
648363
|
-
await new Promise((
|
|
648746
|
+
await new Promise((resolve56, reject) => {
|
|
648364
648747
|
const proxyReq = transport.request({
|
|
648365
648748
|
hostname: url.hostname,
|
|
648366
648749
|
port: url.port || (url.protocol === "https:" ? 443 : 80),
|
|
@@ -648385,7 +648768,7 @@ async function directChatBackend(opts) {
|
|
|
648385
648768
|
});
|
|
648386
648769
|
proxyRes.on("end", () => {
|
|
648387
648770
|
res.end();
|
|
648388
|
-
|
|
648771
|
+
resolve56();
|
|
648389
648772
|
});
|
|
648390
648773
|
proxyRes.on("error", reject);
|
|
648391
648774
|
});
|
|
@@ -648449,7 +648832,7 @@ async function directChatBackend(opts) {
|
|
|
648449
648832
|
"X-API-Version": API_VERSION
|
|
648450
648833
|
});
|
|
648451
648834
|
let acc = "";
|
|
648452
|
-
await new Promise((
|
|
648835
|
+
await new Promise((resolve56, reject) => {
|
|
648453
648836
|
ollamaStream(
|
|
648454
648837
|
ollamaUrl,
|
|
648455
648838
|
"/api/chat",
|
|
@@ -648483,7 +648866,7 @@ async function directChatBackend(opts) {
|
|
|
648483
648866
|
},
|
|
648484
648867
|
() => {
|
|
648485
648868
|
res.end();
|
|
648486
|
-
|
|
648869
|
+
resolve56();
|
|
648487
648870
|
},
|
|
648488
648871
|
(err) => reject(err)
|
|
648489
648872
|
);
|
|
@@ -648571,7 +648954,7 @@ function backendUrl(baseUrl, path12) {
|
|
|
648571
648954
|
return url;
|
|
648572
648955
|
}
|
|
648573
648956
|
function ollamaRequest(ollamaUrl, path12, method, body, timeoutMs, endpoint) {
|
|
648574
|
-
return new Promise((
|
|
648957
|
+
return new Promise((resolve56, reject) => {
|
|
648575
648958
|
const url = backendUrl(ollamaUrl, path12);
|
|
648576
648959
|
const isHttps = url.protocol === "https:";
|
|
648577
648960
|
const options2 = {
|
|
@@ -648592,7 +648975,7 @@ function ollamaRequest(ollamaUrl, path12, method, body, timeoutMs, endpoint) {
|
|
|
648592
648975
|
proxyRes.on("data", (chunk) => chunks.push(chunk));
|
|
648593
648976
|
proxyRes.on("end", () => {
|
|
648594
648977
|
clearTimeout(hardTimeout);
|
|
648595
|
-
|
|
648978
|
+
resolve56({
|
|
648596
648979
|
status: proxyRes.statusCode ?? 500,
|
|
648597
648980
|
headers: proxyRes.headers,
|
|
648598
648981
|
body: Buffer.concat(chunks).toString("utf-8")
|
|
@@ -648643,7 +649026,7 @@ function ollamaStream(ollamaUrl, path12, method, body, onData, onEnd, onError, t
|
|
|
648643
649026
|
proxyReq.end();
|
|
648644
649027
|
}
|
|
648645
649028
|
function jobsDir() {
|
|
648646
|
-
const root =
|
|
649029
|
+
const root = resolve51(process.cwd());
|
|
648647
649030
|
const dir = join147(root, ".omnius", "jobs");
|
|
648648
649031
|
mkdirSync79(dir, { recursive: true });
|
|
648649
649032
|
return dir;
|
|
@@ -650114,7 +650497,7 @@ ${task}` : task,
|
|
|
650114
650497
|
});
|
|
650115
650498
|
if (streamMode) {
|
|
650116
650499
|
res.writeHead(200, { "Content-Type": "text/event-stream", "Cache-Control": "no-cache" });
|
|
650117
|
-
await new Promise((
|
|
650500
|
+
await new Promise((resolve56) => {
|
|
650118
650501
|
ollamaStream(
|
|
650119
650502
|
ollamaUrl,
|
|
650120
650503
|
"/v1/completions",
|
|
@@ -650123,11 +650506,11 @@ ${task}` : task,
|
|
|
650123
650506
|
(chunk) => res.write(chunk),
|
|
650124
650507
|
() => {
|
|
650125
650508
|
res.end();
|
|
650126
|
-
|
|
650509
|
+
resolve56();
|
|
650127
650510
|
},
|
|
650128
650511
|
(err) => {
|
|
650129
650512
|
res.end(JSON.stringify({ error: String(err) }));
|
|
650130
|
-
|
|
650513
|
+
resolve56();
|
|
650131
650514
|
}
|
|
650132
650515
|
);
|
|
650133
650516
|
});
|
|
@@ -650163,7 +650546,7 @@ ${task}` : task,
|
|
|
650163
650546
|
"Connection": "keep-alive",
|
|
650164
650547
|
"X-API-Version": API_VERSION
|
|
650165
650548
|
});
|
|
650166
|
-
await new Promise((
|
|
650549
|
+
await new Promise((resolve56) => {
|
|
650167
650550
|
ollamaStream(
|
|
650168
650551
|
ollamaUrl,
|
|
650169
650552
|
"/api/generate",
|
|
@@ -650172,11 +650555,11 @@ ${task}` : task,
|
|
|
650172
650555
|
(chunk) => res.write(chunk),
|
|
650173
650556
|
() => {
|
|
650174
650557
|
res.end();
|
|
650175
|
-
|
|
650558
|
+
resolve56();
|
|
650176
650559
|
},
|
|
650177
650560
|
(err) => {
|
|
650178
650561
|
res.end(JSON.stringify({ error: String(err) }) + "\n");
|
|
650179
|
-
|
|
650562
|
+
resolve56();
|
|
650180
650563
|
}
|
|
650181
650564
|
);
|
|
650182
650565
|
});
|
|
@@ -650223,7 +650606,7 @@ ${task}` : task;
|
|
|
650223
650606
|
runEnv["OLLAMA_HOST"] = currentCfg.backendUrl || process.env["OLLAMA_HOST"] || "http://127.0.0.1:11434";
|
|
650224
650607
|
if (currentCfg.apiKey) runEnv["OMNIUS_API_KEY_INHERIT"] = currentCfg.apiKey;
|
|
650225
650608
|
const child = spawn32(process.execPath, [omniusBin, ...args], {
|
|
650226
|
-
cwd:
|
|
650609
|
+
cwd: resolve51(process.cwd()),
|
|
650227
650610
|
env: runEnv,
|
|
650228
650611
|
stdio: ["ignore", "pipe", "pipe"]
|
|
650229
650612
|
});
|
|
@@ -650757,13 +651140,13 @@ async function handleV1Run(req2, res) {
|
|
|
650757
651140
|
const isolate = requestBody["isolate"] === true;
|
|
650758
651141
|
let cwd4;
|
|
650759
651142
|
if (workingDir) {
|
|
650760
|
-
cwd4 =
|
|
651143
|
+
cwd4 = resolve51(workingDir);
|
|
650761
651144
|
} else if (isolate) {
|
|
650762
651145
|
const wsDir = join147(dir, "..", "workspaces", id);
|
|
650763
651146
|
mkdirSync79(wsDir, { recursive: true });
|
|
650764
651147
|
cwd4 = wsDir;
|
|
650765
651148
|
} else {
|
|
650766
|
-
cwd4 =
|
|
651149
|
+
cwd4 = resolve51(process.cwd());
|
|
650767
651150
|
}
|
|
650768
651151
|
const authUser = req2._authUser || "anonymous";
|
|
650769
651152
|
const authScope = req2._authScope || "admin";
|
|
@@ -651751,8 +652134,8 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
651751
652134
|
if (pathname === "/v1/files" && method === "GET") {
|
|
651752
652135
|
const dir = urlObj.searchParams.get("path") || process.cwd();
|
|
651753
652136
|
try {
|
|
651754
|
-
const entries = readdirSync47(
|
|
651755
|
-
jsonResponse(res, 200, { path:
|
|
652137
|
+
const entries = readdirSync47(resolve51(dir), { withFileTypes: true }).filter((e2) => !e2.name.startsWith(".") && e2.name !== "node_modules").slice(0, 100).map((e2) => ({ name: e2.name, type: e2.isDirectory() ? "dir" : "file" }));
|
|
652138
|
+
jsonResponse(res, 200, { path: resolve51(dir), entries });
|
|
651756
652139
|
} catch (e2) {
|
|
651757
652140
|
jsonResponse(res, 400, { error: e2.message });
|
|
651758
652141
|
}
|
|
@@ -651863,7 +652246,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
651863
652246
|
jsonResponse(res, 400, { error: "missing_root", message: "body.root (absolute path) is required." });
|
|
651864
652247
|
return;
|
|
651865
652248
|
}
|
|
651866
|
-
let entry = listProjects().find((p2) => p2.root === rawRoot || p2.root ===
|
|
652249
|
+
let entry = listProjects().find((p2) => p2.root === rawRoot || p2.root === resolve51(rawRoot));
|
|
651867
652250
|
if (!entry && body?.registerIfMissing) {
|
|
651868
652251
|
entry = registerProject(rawRoot);
|
|
651869
652252
|
}
|
|
@@ -651927,7 +652310,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
651927
652310
|
const queriedRoot = urlObj.searchParams.get("root");
|
|
651928
652311
|
let targetRoot = null;
|
|
651929
652312
|
if (queriedRoot && queriedRoot.trim()) {
|
|
651930
|
-
targetRoot =
|
|
652313
|
+
targetRoot = resolve51(queriedRoot.trim());
|
|
651931
652314
|
} else {
|
|
651932
652315
|
const current = getCurrentProject();
|
|
651933
652316
|
if (current) targetRoot = current.root;
|
|
@@ -652203,7 +652586,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
652203
652586
|
const path12 = await import("node:path");
|
|
652204
652587
|
const tmpPath = path12.join(os9.tmpdir(), `omnius-asr-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.bin`);
|
|
652205
652588
|
let bytesWritten = 0;
|
|
652206
|
-
await new Promise((
|
|
652589
|
+
await new Promise((resolve56, reject) => {
|
|
652207
652590
|
const ws = fs11.createWriteStream(tmpPath);
|
|
652208
652591
|
let stripBoundary = ct.includes("multipart/form-data");
|
|
652209
652592
|
let firstChunk = true;
|
|
@@ -652232,7 +652615,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
652232
652615
|
}
|
|
652233
652616
|
});
|
|
652234
652617
|
req2.on("end", () => {
|
|
652235
|
-
ws.end(() =>
|
|
652618
|
+
ws.end(() => resolve56());
|
|
652236
652619
|
});
|
|
652237
652620
|
req2.on("error", reject);
|
|
652238
652621
|
});
|
|
@@ -652455,7 +652838,7 @@ data: ${JSON.stringify(data)}
|
|
|
652455
652838
|
const tmpPath = path12.join(os9.tmpdir(), `omnius-clone-upload-${Date.now()}-${filename}`);
|
|
652456
652839
|
const stripBoundary = ct.includes("multipart/form-data");
|
|
652457
652840
|
let bytesWritten = 0;
|
|
652458
|
-
await new Promise((
|
|
652841
|
+
await new Promise((resolve56, reject) => {
|
|
652459
652842
|
const ws = fs11.createWriteStream(tmpPath);
|
|
652460
652843
|
let firstChunk = true;
|
|
652461
652844
|
let inFilePart = !stripBoundary;
|
|
@@ -652483,7 +652866,7 @@ data: ${JSON.stringify(data)}
|
|
|
652483
652866
|
}
|
|
652484
652867
|
});
|
|
652485
652868
|
req2.on("end", () => {
|
|
652486
|
-
ws.end(() =>
|
|
652869
|
+
ws.end(() => resolve56());
|
|
652487
652870
|
});
|
|
652488
652871
|
req2.on("error", reject);
|
|
652489
652872
|
});
|
|
@@ -652848,7 +653231,7 @@ data: ${JSON.stringify(data)}
|
|
|
652848
653231
|
}
|
|
652849
653232
|
const sessionId = chatBody.session_id;
|
|
652850
653233
|
const model = chatBody.model || loadConfig().model;
|
|
652851
|
-
const cwdPath =
|
|
653234
|
+
const cwdPath = resolve51(process.cwd());
|
|
652852
653235
|
const session = getSession(sessionId, model, cwdPath);
|
|
652853
653236
|
addUserMessage(session, chatBody.message);
|
|
652854
653237
|
compactSession(session);
|
|
@@ -653048,7 +653431,7 @@ ${historyLines}
|
|
|
653048
653431
|
});
|
|
653049
653432
|
child.stderr?.on("data", () => {
|
|
653050
653433
|
});
|
|
653051
|
-
await new Promise((
|
|
653434
|
+
await new Promise((resolve56) => {
|
|
653052
653435
|
onChildClose(child, () => {
|
|
653053
653436
|
if (lineBuffer.trim()) finalLines.push(lineBuffer);
|
|
653054
653437
|
const rawFinal = finalLines.join("\n").trim();
|
|
@@ -653115,7 +653498,7 @@ ${historyLines}
|
|
|
653115
653498
|
});
|
|
653116
653499
|
res.write("data: [DONE]\n\n");
|
|
653117
653500
|
res.end();
|
|
653118
|
-
|
|
653501
|
+
resolve56();
|
|
653119
653502
|
});
|
|
653120
653503
|
});
|
|
653121
653504
|
return;
|
|
@@ -653146,12 +653529,12 @@ ${historyLines}
|
|
|
653146
653529
|
});
|
|
653147
653530
|
const killDeadlineMs = chatTimeoutS * 1e3 + 3e4;
|
|
653148
653531
|
let killedByDeadline = false;
|
|
653149
|
-
await new Promise((
|
|
653532
|
+
await new Promise((resolve56) => {
|
|
653150
653533
|
let done = false;
|
|
653151
653534
|
const finish = () => {
|
|
653152
653535
|
if (!done) {
|
|
653153
653536
|
done = true;
|
|
653154
|
-
|
|
653537
|
+
resolve56();
|
|
653155
653538
|
}
|
|
653156
653539
|
};
|
|
653157
653540
|
onChildClose(child, finish);
|
|
@@ -654472,7 +654855,7 @@ function startApiServer(options2 = {}) {
|
|
|
654472
654855
|
}
|
|
654473
654856
|
} catch {
|
|
654474
654857
|
}
|
|
654475
|
-
const watcher =
|
|
654858
|
+
const watcher = fsWatch4(dir, (_evt, fname) => {
|
|
654476
654859
|
if (!fname || !fname.endsWith(".json") || fname.includes(".tmp.")) return;
|
|
654477
654860
|
const sid = fname.replace(/\.json$/, "");
|
|
654478
654861
|
const fp = join147(dir, fname);
|
|
@@ -654557,8 +654940,8 @@ function startApiServer(options2 = {}) {
|
|
|
654557
654940
|
if (useTls) {
|
|
654558
654941
|
try {
|
|
654559
654942
|
tlsOpts = {
|
|
654560
|
-
cert: readFileSync108(
|
|
654561
|
-
key: readFileSync108(
|
|
654943
|
+
cert: readFileSync108(resolve51(tlsCert)),
|
|
654944
|
+
key: readFileSync108(resolve51(tlsKey))
|
|
654562
654945
|
};
|
|
654563
654946
|
} catch (e2) {
|
|
654564
654947
|
log22(`
|
|
@@ -655506,8 +655889,8 @@ async function apiServeCommand(opts, config) {
|
|
|
655506
655889
|
verbose: opts.verbose,
|
|
655507
655890
|
ollamaUrl: config.backendUrl
|
|
655508
655891
|
});
|
|
655509
|
-
await new Promise((
|
|
655510
|
-
server2.on("close",
|
|
655892
|
+
await new Promise((resolve56) => {
|
|
655893
|
+
server2.on("close", resolve56);
|
|
655511
655894
|
});
|
|
655512
655895
|
}
|
|
655513
655896
|
function removeCronByMarker(id) {
|
|
@@ -655688,7 +656071,7 @@ var init_clipboard_media = __esm({
|
|
|
655688
656071
|
|
|
655689
656072
|
// packages/cli/src/tui/interactive.ts
|
|
655690
656073
|
import { cwd } from "node:process";
|
|
655691
|
-
import { resolve as
|
|
656074
|
+
import { resolve as resolve52, join as join149, dirname as dirname41, extname as extname17, relative as relative14 } from "node:path";
|
|
655692
656075
|
import { createRequire as createRequire8 } from "node:module";
|
|
655693
656076
|
import { fileURLToPath as fileURLToPath19 } from "node:url";
|
|
655694
656077
|
import {
|
|
@@ -658875,7 +659258,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
658875
659258
|
};
|
|
658876
659259
|
}
|
|
658877
659260
|
async function startInteractive(config, repoPath) {
|
|
658878
|
-
const repoRoot =
|
|
659261
|
+
const repoRoot = resolve52(repoPath ?? cwd());
|
|
658879
659262
|
try {
|
|
658880
659263
|
const { registerProject: registerProject2, getCurrentProject: getCurrentProject2, setCurrentProject: setCurrentProject2 } = await Promise.resolve().then(() => (init_projects(), projects_exports));
|
|
658881
659264
|
registerProject2(repoRoot, process.pid);
|
|
@@ -662410,8 +662793,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
662410
662793
|
if (name10 === "voice_list_files") {
|
|
662411
662794
|
const baseDir = String(args?.dir ?? ".");
|
|
662412
662795
|
const { readdirSync: readdirSync50, statSync: statSync49 } = __require("node:fs");
|
|
662413
|
-
const { join: join154, resolve:
|
|
662414
|
-
const base3 = baseDir.startsWith("/") ? baseDir :
|
|
662796
|
+
const { join: join154, resolve: resolve56 } = __require("node:path");
|
|
662797
|
+
const base3 = baseDir.startsWith("/") ? baseDir : resolve56(join154(repoRoot, baseDir));
|
|
662415
662798
|
const items = readdirSync50(base3).slice(0, 200).map((f2) => {
|
|
662416
662799
|
const s2 = statSync49(join154(base3, f2));
|
|
662417
662800
|
return { name: f2, dir: s2.isDirectory(), size: s2.size };
|
|
@@ -663126,7 +663509,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
663126
663509
|
title: `Restore previous session?`,
|
|
663127
663510
|
rl,
|
|
663128
663511
|
availableRows: statusBar.isActive ? statusBar.availableContentRows : void 0,
|
|
663129
|
-
onInit: ({ updateItem, resolve:
|
|
663512
|
+
onInit: ({ updateItem, resolve: resolve56 }) => {
|
|
663130
663513
|
const timer = setInterval(() => {
|
|
663131
663514
|
countdown -= 1;
|
|
663132
663515
|
if (countdown >= 0) {
|
|
@@ -663136,7 +663519,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
663136
663519
|
}
|
|
663137
663520
|
if (countdown <= 0) {
|
|
663138
663521
|
clearInterval(timer);
|
|
663139
|
-
|
|
663522
|
+
resolve56({ confirmed: true, key: "restore", index: 0 });
|
|
663140
663523
|
}
|
|
663141
663524
|
}, 1e3);
|
|
663142
663525
|
return () => clearInterval(timer);
|
|
@@ -663508,9 +663891,9 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
663508
663891
|
}
|
|
663509
663892
|
}
|
|
663510
663893
|
const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
|
|
663511
|
-
const isImage = isImagePath(cleanPath) && existsSync134(
|
|
663512
|
-
const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync134(
|
|
663513
|
-
const isMarkdown = !isImage && !isMedia && /\.(md|markdown)$/i.test(cleanPath) && existsSync134(
|
|
663894
|
+
const isImage = isImagePath(cleanPath) && existsSync134(resolve52(repoRoot, cleanPath));
|
|
663895
|
+
const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync134(resolve52(repoRoot, cleanPath));
|
|
663896
|
+
const isMarkdown = !isImage && !isMedia && /\.(md|markdown)$/i.test(cleanPath) && existsSync134(resolve52(repoRoot, cleanPath));
|
|
663514
663897
|
if (activeTask) {
|
|
663515
663898
|
if ((isImage || isMedia) && activeTask.runner.isPaused) {
|
|
663516
663899
|
activeTask.runner.resume();
|
|
@@ -663518,7 +663901,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
663518
663901
|
}
|
|
663519
663902
|
if (isImage) {
|
|
663520
663903
|
try {
|
|
663521
|
-
const imgPath =
|
|
663904
|
+
const imgPath = resolve52(repoRoot, cleanPath);
|
|
663522
663905
|
const imgBuffer = readFileSync110(imgPath);
|
|
663523
663906
|
const base642 = imgBuffer.toString("base64");
|
|
663524
663907
|
const ext = extname17(cleanPath).toLowerCase();
|
|
@@ -663565,7 +663948,7 @@ ${combinedImageContext}` : `User shared image: ${cleanPath}`
|
|
|
663565
663948
|
writeContent(() => renderInfo(`Transcribing: ${cleanPath}...`));
|
|
663566
663949
|
const engine = getListenEngine();
|
|
663567
663950
|
const result = await engine.transcribeFile(
|
|
663568
|
-
|
|
663951
|
+
resolve52(repoRoot, cleanPath),
|
|
663569
663952
|
repoRoot
|
|
663570
663953
|
);
|
|
663571
663954
|
if (result) {
|
|
@@ -663650,7 +664033,7 @@ ${result.text}`;
|
|
|
663650
664033
|
}
|
|
663651
664034
|
let fullInput = input;
|
|
663652
664035
|
if (isImage && fullInput === input) {
|
|
663653
|
-
const imgPath =
|
|
664036
|
+
const imgPath = resolve52(repoRoot, cleanPath);
|
|
663654
664037
|
const asciiContext = await renderAsciiPreviewForImage(
|
|
663655
664038
|
imgPath,
|
|
663656
664039
|
cleanPath,
|
|
@@ -663693,7 +664076,7 @@ Read it with image_read or vision if more detail is needed. Describe what you se
|
|
|
663693
664076
|
() => renderInfo(`Setting voice clone reference: ${cleanPath}`)
|
|
663694
664077
|
);
|
|
663695
664078
|
const msg = await voiceEngine.setCloneVoice(
|
|
663696
|
-
|
|
664079
|
+
resolve52(repoRoot, cleanPath)
|
|
663697
664080
|
);
|
|
663698
664081
|
writeContent(() => renderInfo(msg));
|
|
663699
664082
|
showPrompt();
|
|
@@ -663702,7 +664085,7 @@ Read it with image_read or vision if more detail is needed. Describe what you se
|
|
|
663702
664085
|
}
|
|
663703
664086
|
if (isMarkdown && fullInput === input) {
|
|
663704
664087
|
try {
|
|
663705
|
-
const mdPath =
|
|
664088
|
+
const mdPath = resolve52(repoRoot, cleanPath);
|
|
663706
664089
|
const mdContent = readFileSync110(mdPath, "utf8");
|
|
663707
664090
|
const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
|
|
663708
664091
|
const result = parseMcpMarkdown2(mdContent);
|
|
@@ -663767,7 +664150,7 @@ Read it with image_read or vision if more detail is needed. Describe what you se
|
|
|
663767
664150
|
writeContent(() => renderInfo(`Transcribing: ${cleanPath}...`));
|
|
663768
664151
|
const engine = getListenEngine();
|
|
663769
664152
|
const result = await engine.transcribeFile(
|
|
663770
|
-
|
|
664153
|
+
resolve52(repoRoot, cleanPath),
|
|
663771
664154
|
repoRoot
|
|
663772
664155
|
);
|
|
663773
664156
|
if (result) {
|
|
@@ -664188,7 +664571,7 @@ async function shouldRunFirstRunSetup(config, firstRun = isFirstRun()) {
|
|
|
664188
664571
|
}
|
|
664189
664572
|
}
|
|
664190
664573
|
async function runWithTUI(task, config, repoPath, callbacks) {
|
|
664191
|
-
const repoRoot =
|
|
664574
|
+
const repoRoot = resolve52(repoPath ?? cwd());
|
|
664192
664575
|
initOmniusDirectory(repoRoot);
|
|
664193
664576
|
if (await shouldRunFirstRunSetup(config)) {
|
|
664194
664577
|
const setupModel = await runSetupWizard(config);
|
|
@@ -664694,13 +665077,13 @@ __export(run_exports, {
|
|
|
664694
665077
|
runCommand: () => runCommand2,
|
|
664695
665078
|
statusCommand: () => statusCommand
|
|
664696
665079
|
});
|
|
664697
|
-
import { resolve as
|
|
665080
|
+
import { resolve as resolve53 } from "node:path";
|
|
664698
665081
|
import { spawn as spawn33 } from "node:child_process";
|
|
664699
665082
|
import { mkdirSync as mkdirSync82, writeFileSync as writeFileSync74, readFileSync as readFileSync111, readdirSync as readdirSync49, existsSync as existsSync135 } from "node:fs";
|
|
664700
665083
|
import { randomBytes as randomBytes28 } from "node:crypto";
|
|
664701
665084
|
import { join as join150 } from "node:path";
|
|
664702
665085
|
function jobsDir2(repoPath) {
|
|
664703
|
-
const root =
|
|
665086
|
+
const root = resolve53(repoPath ?? process.cwd());
|
|
664704
665087
|
const dir = join150(root, ".omnius", "jobs");
|
|
664705
665088
|
mkdirSync82(dir, { recursive: true });
|
|
664706
665089
|
return dir;
|
|
@@ -664797,7 +665180,7 @@ function extractSummary(captured) {
|
|
|
664797
665180
|
async function runBackground(task, config, opts) {
|
|
664798
665181
|
const id = `job-${randomBytes28(3).toString("hex")}`;
|
|
664799
665182
|
const dir = jobsDir2(opts.repoPath);
|
|
664800
|
-
const repoRoot =
|
|
665183
|
+
const repoRoot = resolve53(opts.repoPath ?? process.cwd());
|
|
664801
665184
|
const job = {
|
|
664802
665185
|
id,
|
|
664803
665186
|
pid: 0,
|
|
@@ -664906,11 +665289,11 @@ var index_repo_exports = {};
|
|
|
664906
665289
|
__export(index_repo_exports, {
|
|
664907
665290
|
indexRepoCommand: () => indexRepoCommand
|
|
664908
665291
|
});
|
|
664909
|
-
import { resolve as
|
|
665292
|
+
import { resolve as resolve54 } from "node:path";
|
|
664910
665293
|
import { existsSync as existsSync136, statSync as statSync48 } from "node:fs";
|
|
664911
665294
|
import { cwd as cwd2 } from "node:process";
|
|
664912
665295
|
async function indexRepoCommand(opts, _config3) {
|
|
664913
|
-
const repoRoot =
|
|
665296
|
+
const repoRoot = resolve54(opts.repoPath ?? cwd2());
|
|
664914
665297
|
printHeader("Index Repository");
|
|
664915
665298
|
printInfo(`Indexing: ${repoRoot}`);
|
|
664916
665299
|
if (!existsSync136(repoRoot)) {
|
|
@@ -665165,7 +665548,7 @@ var config_exports2 = {};
|
|
|
665165
665548
|
__export(config_exports2, {
|
|
665166
665549
|
configCommand: () => configCommand
|
|
665167
665550
|
});
|
|
665168
|
-
import { join as join151, resolve as
|
|
665551
|
+
import { join as join151, resolve as resolve55 } from "node:path";
|
|
665169
665552
|
import { homedir as homedir55 } from "node:os";
|
|
665170
665553
|
import { cwd as cwd3 } from "node:process";
|
|
665171
665554
|
function redactIfSensitive(key, value2) {
|
|
@@ -665197,7 +665580,7 @@ async function configCommand(opts, config) {
|
|
|
665197
665580
|
return handleShow(opts, config);
|
|
665198
665581
|
}
|
|
665199
665582
|
function handleShow(opts, config) {
|
|
665200
|
-
const repoRoot =
|
|
665583
|
+
const repoRoot = resolve55(opts.repoPath ?? cwd3());
|
|
665201
665584
|
printHeader("Configuration");
|
|
665202
665585
|
const resolved = resolveSettings(repoRoot);
|
|
665203
665586
|
printSection("Core Inference");
|
|
@@ -665281,7 +665664,7 @@ function handleSet(opts, _config3) {
|
|
|
665281
665664
|
process.exit(1);
|
|
665282
665665
|
}
|
|
665283
665666
|
if (opts.local) {
|
|
665284
|
-
const repoRoot =
|
|
665667
|
+
const repoRoot = resolve55(opts.repoPath ?? cwd3());
|
|
665285
665668
|
try {
|
|
665286
665669
|
initOmniusDirectory(repoRoot);
|
|
665287
665670
|
const coerced = coerceForSettings(key, value2);
|
|
@@ -665431,14 +665814,14 @@ async function serveCommand(opts, config) {
|
|
|
665431
665814
|
}, 3e4);
|
|
665432
665815
|
idleChecker.unref();
|
|
665433
665816
|
}
|
|
665434
|
-
await new Promise((
|
|
665817
|
+
await new Promise((resolve56) => {
|
|
665435
665818
|
process.on("SIGINT", () => {
|
|
665436
665819
|
server2.close();
|
|
665437
|
-
|
|
665820
|
+
resolve56();
|
|
665438
665821
|
});
|
|
665439
665822
|
process.on("SIGTERM", () => {
|
|
665440
665823
|
server2.close();
|
|
665441
|
-
|
|
665824
|
+
resolve56();
|
|
665442
665825
|
});
|
|
665443
665826
|
});
|
|
665444
665827
|
} catch (err) {
|
|
@@ -666007,11 +666390,11 @@ async function main() {
|
|
|
666007
666390
|
if (mode === "crossmodal") {
|
|
666008
666391
|
process.stdout.write("Running crossmodal smoke tests...\n");
|
|
666009
666392
|
const { spawn: spawn34 } = await import("node:child_process");
|
|
666010
|
-
const run2 = (file) => new Promise((
|
|
666393
|
+
const run2 = (file) => new Promise((resolve56, reject) => {
|
|
666011
666394
|
const p2 = spawn34(process.execPath, [file], { stdio: ["ignore", "pipe", "pipe"] });
|
|
666012
666395
|
p2.stdout.on("data", (d2) => process.stdout.write(d2));
|
|
666013
666396
|
p2.stderr.on("data", (d2) => process.stdout.write(d2));
|
|
666014
|
-
onChildExit(p2, (code8) => code8 === 0 ?
|
|
666397
|
+
onChildExit(p2, (code8) => code8 === 0 ? resolve56() : reject(new Error(`${file} exited ${code8}`)));
|
|
666015
666398
|
});
|
|
666016
666399
|
const base3 = process.cwd();
|
|
666017
666400
|
await run2(`${base3}/eval/test-crossmodal.mjs`);
|