omnius 1.0.388 → 1.0.390
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 +543 -268
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9900,9 +9900,9 @@ var init_vision = __esm({
|
|
|
9900
9900
|
if (ollamaResult)
|
|
9901
9901
|
return ollamaResult;
|
|
9902
9902
|
try {
|
|
9903
|
-
const { execSync:
|
|
9903
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
9904
9904
|
try {
|
|
9905
|
-
|
|
9905
|
+
execSync62("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
|
|
9906
9906
|
timeout: 12e4,
|
|
9907
9907
|
stdio: "pipe"
|
|
9908
9908
|
});
|
|
@@ -9915,7 +9915,7 @@ var init_vision = __esm({
|
|
|
9915
9915
|
} catch {
|
|
9916
9916
|
}
|
|
9917
9917
|
try {
|
|
9918
|
-
|
|
9918
|
+
execSync62("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
|
|
9919
9919
|
const retryOllama = await this.tryOllamaVision(buffer2, filename, action, prompt, length4, start2, preferredModel);
|
|
9920
9920
|
if (retryOllama)
|
|
9921
9921
|
return retryOllama;
|
|
@@ -547162,7 +547162,7 @@ def _omnius_normalized_features(features):
|
|
|
547162
547162
|
});
|
|
547163
547163
|
|
|
547164
547164
|
// packages/execution/dist/tools/visual-memory.js
|
|
547165
|
-
import {
|
|
547165
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
547166
547166
|
import { existsSync as existsSync66, mkdirSync as mkdirSync39, writeFileSync as writeFileSync31, readFileSync as readFileSync47 } from "node:fs";
|
|
547167
547167
|
import { join as join80 } from "node:path";
|
|
547168
547168
|
import { homedir as homedir20, tmpdir as tmpdir16 } from "node:os";
|
|
@@ -547179,6 +547179,26 @@ function stringArg2(args, ...keys) {
|
|
|
547179
547179
|
}
|
|
547180
547180
|
return "";
|
|
547181
547181
|
}
|
|
547182
|
+
function execFileText(file, args, opts) {
|
|
547183
|
+
return new Promise((resolve74, reject) => {
|
|
547184
|
+
execFile6(file, args, {
|
|
547185
|
+
timeout: opts.timeout,
|
|
547186
|
+
env: opts.env,
|
|
547187
|
+
cwd: opts.cwd,
|
|
547188
|
+
maxBuffer: 16 * 1024 * 1024
|
|
547189
|
+
}, (error, stdout, stderr) => {
|
|
547190
|
+
if (error) {
|
|
547191
|
+
Object.assign(error, { stdout, stderr });
|
|
547192
|
+
reject(error);
|
|
547193
|
+
return;
|
|
547194
|
+
}
|
|
547195
|
+
resolve74({
|
|
547196
|
+
stdout: String(stdout ?? ""),
|
|
547197
|
+
stderr: String(stderr ?? "")
|
|
547198
|
+
});
|
|
547199
|
+
});
|
|
547200
|
+
});
|
|
547201
|
+
}
|
|
547182
547202
|
function stringListArg(value2) {
|
|
547183
547203
|
if (Array.isArray(value2)) {
|
|
547184
547204
|
return value2.filter((item) => typeof item === "string" && item.trim().length > 0).map((item) => item.trim());
|
|
@@ -547856,9 +547876,8 @@ ${objects.join("\n") || " (none taught)"}`,
|
|
|
547856
547876
|
async ensureVenv() {
|
|
547857
547877
|
if (existsSync66(VENV_PY)) {
|
|
547858
547878
|
try {
|
|
547859
|
-
|
|
547879
|
+
await execFileText(VENV_PY, ["-c", "import insightface, transformers, torch"], {
|
|
547860
547880
|
timeout: 15e3,
|
|
547861
|
-
stdio: "pipe",
|
|
547862
547881
|
env: visualMemoryPythonEnv()
|
|
547863
547882
|
});
|
|
547864
547883
|
return true;
|
|
@@ -547867,12 +547886,27 @@ ${objects.join("\n") || " (none taught)"}`,
|
|
|
547867
547886
|
}
|
|
547868
547887
|
try {
|
|
547869
547888
|
if (!existsSync66(VENV_PY)) {
|
|
547870
|
-
|
|
547889
|
+
await execFileText("python3", ["-m", "venv", VENV_DIR2], {
|
|
547890
|
+
timeout: 3e4,
|
|
547891
|
+
env: visualMemoryPythonEnv()
|
|
547892
|
+
});
|
|
547871
547893
|
}
|
|
547872
|
-
|
|
547873
|
-
|
|
547874
|
-
|
|
547875
|
-
|
|
547894
|
+
await execFileText(VENV_PIP2, ["install", "setuptools<81", "wheel"], {
|
|
547895
|
+
timeout: 6e4,
|
|
547896
|
+
env: visualMemoryPythonEnv()
|
|
547897
|
+
});
|
|
547898
|
+
await execFileText(VENV_PIP2, ["install", "torch", "torchvision"], {
|
|
547899
|
+
timeout: 6e5,
|
|
547900
|
+
env: visualMemoryPythonEnv()
|
|
547901
|
+
});
|
|
547902
|
+
await execFileText(VENV_PIP2, ["install", "insightface", "onnxruntime", "opencv-python-headless"], {
|
|
547903
|
+
timeout: 3e5,
|
|
547904
|
+
env: visualMemoryPythonEnv()
|
|
547905
|
+
});
|
|
547906
|
+
await execFileText(VENV_PIP2, ["install", "transformers", "pillow"], {
|
|
547907
|
+
timeout: 3e5,
|
|
547908
|
+
env: visualMemoryPythonEnv()
|
|
547909
|
+
});
|
|
547876
547910
|
return true;
|
|
547877
547911
|
} catch {
|
|
547878
547912
|
return false;
|
|
@@ -547882,8 +547916,7 @@ ${objects.join("\n") || " (none taught)"}`,
|
|
|
547882
547916
|
const scriptFile = join80(tmpdir16(), `omnius-vmem-${Date.now()}.py`);
|
|
547883
547917
|
writeFileSync31(scriptFile, script);
|
|
547884
547918
|
try {
|
|
547885
|
-
const output =
|
|
547886
|
-
encoding: "utf8",
|
|
547919
|
+
const { stdout: output } = await execFileText(VENV_PY, [scriptFile], {
|
|
547887
547920
|
timeout: timeoutMs,
|
|
547888
547921
|
env: visualMemoryPythonEnv({ PYTHONUNBUFFERED: "1" })
|
|
547889
547922
|
});
|
|
@@ -547910,7 +547943,7 @@ ${objects.join("\n") || " (none taught)"}`,
|
|
|
547910
547943
|
});
|
|
547911
547944
|
|
|
547912
547945
|
// packages/execution/dist/tools/multimodal-memory.js
|
|
547913
|
-
import { execSync as
|
|
547946
|
+
import { execSync as execSync39 } from "node:child_process";
|
|
547914
547947
|
import { existsSync as existsSync67, mkdirSync as mkdirSync40, writeFileSync as writeFileSync32, readFileSync as readFileSync48, readdirSync as readdirSync22 } from "node:fs";
|
|
547915
547948
|
import { join as join81 } from "node:path";
|
|
547916
547949
|
import { homedir as homedir21, tmpdir as tmpdir17 } from "node:os";
|
|
@@ -547997,10 +548030,10 @@ var init_multimodal_memory = __esm({
|
|
|
547997
548030
|
const imagePath = join81(episodeDir2, "photo.jpg");
|
|
547998
548031
|
const cameraArgs = cameraDevice ? `device=${cameraDevice}` : "";
|
|
547999
548032
|
if (cameraDevice === "qoocam") {
|
|
548000
|
-
|
|
548033
|
+
execSync39(`curl -s --connect-timeout 5 "http://192.168.173.1/osc/commands/execute" -H "Content-Type: application/json" -d '{"name":"camera.takePicture"}' -o /dev/null && sleep 1`, { timeout: 15e3, stdio: "pipe" });
|
|
548001
548034
|
}
|
|
548002
548035
|
try {
|
|
548003
|
-
|
|
548036
|
+
execSync39(`ffmpeg -hide_banner -loglevel error -f v4l2 -video_size 1280x720 -i /dev/video0 -frames:v 1 -q:v 2 -y ${imagePath}`, { timeout: 1e4, stdio: "pipe" });
|
|
548004
548037
|
} catch {
|
|
548005
548038
|
}
|
|
548006
548039
|
if (existsSync67(imagePath)) {
|
|
@@ -548024,7 +548057,7 @@ print(json.dumps(features[0].cpu().numpy().tolist()))
|
|
|
548024
548057
|
`;
|
|
548025
548058
|
const scriptFile = join81(tmpdir17(), `mm-clip-${Date.now()}.py`);
|
|
548026
548059
|
writeFileSync32(scriptFile, clipScript);
|
|
548027
|
-
const clipOutput =
|
|
548060
|
+
const clipOutput = execSync39(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 12e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
|
|
548028
548061
|
const embedding = JSON.parse(clipOutput.trim().split("\n").pop());
|
|
548029
548062
|
episode.visual.clipEmbedding = embedding;
|
|
548030
548063
|
results.push(`CLIP embedding computed (${embedding.length}d)`);
|
|
@@ -548046,7 +548079,7 @@ print(json.dumps(result))
|
|
|
548046
548079
|
`;
|
|
548047
548080
|
const scriptFile = join81(tmpdir17(), `mm-face-${Date.now()}.py`);
|
|
548048
548081
|
writeFileSync32(scriptFile, faceScript);
|
|
548049
|
-
const faceOutput =
|
|
548082
|
+
const faceOutput = execSync39(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 6e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
|
|
548050
548083
|
const faces = JSON.parse(faceOutput.trim().split("\n").pop());
|
|
548051
548084
|
episode.visual.faceIds = faces.map((_, i2) => `face_${i2}`);
|
|
548052
548085
|
if (faces.length > 0)
|
|
@@ -548062,7 +548095,7 @@ print(json.dumps(result))
|
|
|
548062
548095
|
}
|
|
548063
548096
|
try {
|
|
548064
548097
|
const audioPath = join81(episodeDir2, "audio.wav");
|
|
548065
|
-
|
|
548098
|
+
execSync39(`arecord -D default -f S16_LE -r 16000 -c 1 -d ${duration} -q ${audioPath}`, { timeout: (duration + 5) * 1e3, stdio: "pipe" });
|
|
548066
548099
|
if (existsSync67(audioPath)) {
|
|
548067
548100
|
episode.audio = { transcript: null, soundClass: null, recordingPath: audioPath, rmsDb: null };
|
|
548068
548101
|
results.push(`${duration}s audio recorded`);
|
|
@@ -548098,14 +548131,14 @@ print(classes[top])
|
|
|
548098
548131
|
`;
|
|
548099
548132
|
const scriptFile = join81(tmpdir17(), `mm-yamnet-${Date.now()}.py`);
|
|
548100
548133
|
writeFileSync32(scriptFile, classifyScript);
|
|
548101
|
-
const soundClass =
|
|
548134
|
+
const soundClass = execSync39(`${mlVenvPy} ${scriptFile}`, { encoding: "utf8", timeout: 12e4 }).trim().split("\n").pop();
|
|
548102
548135
|
episode.audio.soundClass = soundClass;
|
|
548103
548136
|
results.push(`Sound: ${soundClass}`);
|
|
548104
548137
|
}
|
|
548105
548138
|
} catch {
|
|
548106
548139
|
}
|
|
548107
548140
|
try {
|
|
548108
|
-
const transcribeResult =
|
|
548141
|
+
const transcribeResult = execSync39(`which transcribe-cli 2>/dev/null && transcribe-cli ${audioPath} 2>/dev/null || echo ""`, { encoding: "utf8", timeout: 6e4 }).trim();
|
|
548109
548142
|
if (transcribeResult && transcribeResult.length > 5) {
|
|
548110
548143
|
episode.audio.transcript = transcribeResult;
|
|
548111
548144
|
results.push(`Transcript: "${transcribeResult.slice(0, 80)}"`);
|
|
@@ -548194,7 +548227,7 @@ else:
|
|
|
548194
548227
|
`;
|
|
548195
548228
|
const scriptFile = join81(tmpdir17(), `mm-enroll-${Date.now()}.py`);
|
|
548196
548229
|
writeFileSync32(scriptFile, enrollScript);
|
|
548197
|
-
const enrollOutput =
|
|
548230
|
+
const enrollOutput = execSync39(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 6e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
|
|
548198
548231
|
const enrollResult = JSON.parse(enrollOutput.trim().split("\n").pop());
|
|
548199
548232
|
if (enrollResult.enrolled) {
|
|
548200
548233
|
episode.text.content += `. Face enrolled for recognition (${enrollResult.samples} samples).`;
|
|
@@ -548249,7 +548282,7 @@ print(json.dumps(features[0].cpu().numpy().tolist()))
|
|
|
548249
548282
|
`;
|
|
548250
548283
|
const scriptFile = join81(tmpdir17(), `mm-clipq-${Date.now()}.py`);
|
|
548251
548284
|
writeFileSync32(scriptFile, clipTextScript);
|
|
548252
|
-
const output =
|
|
548285
|
+
const output = execSync39(`${venvPy} ${scriptFile}`, { encoding: "utf8", timeout: 6e4, env: { ...process.env, PYTHONUNBUFFERED: "1" } });
|
|
548253
548286
|
queryClipEmbedding = JSON.parse(output.trim().split("\n").pop());
|
|
548254
548287
|
}
|
|
548255
548288
|
} catch {
|
|
@@ -548497,7 +548530,7 @@ ${lines.join("\n")}`,
|
|
|
548497
548530
|
});
|
|
548498
548531
|
|
|
548499
548532
|
// packages/execution/dist/tools/asr-listen.js
|
|
548500
|
-
import { execSync as
|
|
548533
|
+
import { execSync as execSync40, spawnSync as spawnSync9 } from "node:child_process";
|
|
548501
548534
|
import { existsSync as existsSync68, mkdirSync as mkdirSync41, writeFileSync as writeFileSync33, readFileSync as readFileSync49, unlinkSync as unlinkSync14 } from "node:fs";
|
|
548502
548535
|
import { dirname as dirname21, join as join82, resolve as resolve41 } from "node:path";
|
|
548503
548536
|
import { tmpdir as tmpdir18, homedir as homedir22 } from "node:os";
|
|
@@ -548621,10 +548654,10 @@ var init_asr_listen = __esm({
|
|
|
548621
548654
|
const audioFile = join82(captureDir, `listen-${Date.now()}.wav`);
|
|
548622
548655
|
try {
|
|
548623
548656
|
try {
|
|
548624
|
-
|
|
548625
|
-
|
|
548657
|
+
execSync40(`which pw-record`, { stdio: "pipe", timeout: 2e3 });
|
|
548658
|
+
execSync40(`pw-record --channels 1 --rate 16000 --format s16 ${audioFile} & PID=$!; sleep ${duration}; kill $PID 2>/dev/null; wait $PID 2>/dev/null`, { timeout: (duration + 5) * 1e3, stdio: "pipe", shell: "/bin/bash" });
|
|
548626
548659
|
} catch {
|
|
548627
|
-
|
|
548660
|
+
execSync40(`arecord -D ${device} -f S16_LE -r 16000 -c 1 -d ${duration} -q ${audioFile}`, {
|
|
548628
548661
|
timeout: (duration + 5) * 1e3,
|
|
548629
548662
|
stdio: "pipe"
|
|
548630
548663
|
});
|
|
@@ -548774,7 +548807,7 @@ print(json.dumps({"ok": False, "error": "No whisper backend available"}))
|
|
|
548774
548807
|
if (pyPath.includes("/") && !existsSync68(pyPath))
|
|
548775
548808
|
continue;
|
|
548776
548809
|
try {
|
|
548777
|
-
const output =
|
|
548810
|
+
const output = execSync40(`"${pyPath}" "${scriptFile}"`, {
|
|
548778
548811
|
encoding: "utf8",
|
|
548779
548812
|
timeout: 12e4,
|
|
548780
548813
|
env: asrPythonEnv({ PYTHONUNBUFFERED: "1" })
|
|
@@ -549562,7 +549595,7 @@ var init_agent_tool = __esm({
|
|
|
549562
549595
|
});
|
|
549563
549596
|
|
|
549564
549597
|
// packages/execution/dist/tools/worktree.js
|
|
549565
|
-
import { execSync as
|
|
549598
|
+
import { execSync as execSync41 } from "node:child_process";
|
|
549566
549599
|
import { existsSync as existsSync69, mkdirSync as mkdirSync42, rmSync as rmSync8 } from "node:fs";
|
|
549567
549600
|
import { join as join83, resolve as resolve42 } from "node:path";
|
|
549568
549601
|
function validateSlug(slug) {
|
|
@@ -549581,7 +549614,7 @@ function flattenSlug(slug) {
|
|
|
549581
549614
|
}
|
|
549582
549615
|
function isGitRepo(cwd4) {
|
|
549583
549616
|
try {
|
|
549584
|
-
|
|
549617
|
+
execSync41("git rev-parse --is-inside-work-tree", { cwd: cwd4, stdio: "pipe" });
|
|
549585
549618
|
return true;
|
|
549586
549619
|
} catch {
|
|
549587
549620
|
return false;
|
|
@@ -549589,14 +549622,14 @@ function isGitRepo(cwd4) {
|
|
|
549589
549622
|
}
|
|
549590
549623
|
function getCurrentBranch(cwd4) {
|
|
549591
549624
|
try {
|
|
549592
|
-
return
|
|
549625
|
+
return execSync41("git rev-parse --abbrev-ref HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
|
|
549593
549626
|
} catch {
|
|
549594
549627
|
return void 0;
|
|
549595
549628
|
}
|
|
549596
549629
|
}
|
|
549597
549630
|
function getCurrentCommit(cwd4) {
|
|
549598
549631
|
try {
|
|
549599
|
-
return
|
|
549632
|
+
return execSync41("git rev-parse --short HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
|
|
549600
549633
|
} catch {
|
|
549601
549634
|
return void 0;
|
|
549602
549635
|
}
|
|
@@ -549627,13 +549660,13 @@ function createWorktree(repoRoot, slug) {
|
|
|
549627
549660
|
}
|
|
549628
549661
|
mkdirSync42(worktreeBase, { recursive: true });
|
|
549629
549662
|
try {
|
|
549630
|
-
|
|
549663
|
+
execSync41(`git worktree add "${worktreePath}" -b "${branchName}"`, {
|
|
549631
549664
|
cwd: repoRoot,
|
|
549632
549665
|
stdio: "pipe"
|
|
549633
549666
|
});
|
|
549634
549667
|
} catch (err) {
|
|
549635
549668
|
try {
|
|
549636
|
-
|
|
549669
|
+
execSync41(`git worktree add "${worktreePath}" "${branchName}"`, {
|
|
549637
549670
|
cwd: repoRoot,
|
|
549638
549671
|
stdio: "pipe"
|
|
549639
549672
|
});
|
|
@@ -549655,7 +549688,7 @@ function createWorktree(repoRoot, slug) {
|
|
|
549655
549688
|
}
|
|
549656
549689
|
function worktreeHasChanges(worktreePath) {
|
|
549657
549690
|
try {
|
|
549658
|
-
const status =
|
|
549691
|
+
const status = execSync41("git status --porcelain", {
|
|
549659
549692
|
cwd: worktreePath,
|
|
549660
549693
|
stdio: "pipe"
|
|
549661
549694
|
}).toString().trim();
|
|
@@ -549676,20 +549709,20 @@ function removeWorktree(repoRoot, slug, force = false) {
|
|
|
549676
549709
|
return "Worktree has uncommitted changes. Use force=true to discard, or commit/stash first.";
|
|
549677
549710
|
}
|
|
549678
549711
|
try {
|
|
549679
|
-
|
|
549712
|
+
execSync41(`git worktree remove "${worktreePath}" ${force ? "--force" : ""}`, {
|
|
549680
549713
|
cwd: repoRoot,
|
|
549681
549714
|
stdio: "pipe"
|
|
549682
549715
|
});
|
|
549683
549716
|
} catch (err) {
|
|
549684
549717
|
try {
|
|
549685
549718
|
rmSync8(worktreePath, { recursive: true, force: true });
|
|
549686
|
-
|
|
549719
|
+
execSync41("git worktree prune", { cwd: repoRoot, stdio: "pipe" });
|
|
549687
549720
|
} catch {
|
|
549688
549721
|
return `Failed to remove worktree: ${err}`;
|
|
549689
549722
|
}
|
|
549690
549723
|
}
|
|
549691
549724
|
try {
|
|
549692
|
-
|
|
549725
|
+
execSync41(`git branch -D "${branchName}"`, { cwd: repoRoot, stdio: "pipe" });
|
|
549693
549726
|
} catch {
|
|
549694
549727
|
}
|
|
549695
549728
|
_sessions.delete(slug);
|
|
@@ -552211,7 +552244,7 @@ List cells or retry with exact current source.`,
|
|
|
552211
552244
|
});
|
|
552212
552245
|
|
|
552213
552246
|
// packages/execution/dist/tools/environment-snapshot.js
|
|
552214
|
-
import { execSync as
|
|
552247
|
+
import { execSync as execSync42 } from "node:child_process";
|
|
552215
552248
|
import { cpus as cpus2, totalmem as totalmem3, freemem as freemem2, hostname as hostname2, platform as platform2, arch, uptime } from "node:os";
|
|
552216
552249
|
import { statfsSync as statfsSync4 } from "node:fs";
|
|
552217
552250
|
function collectSnapshot(workingDir) {
|
|
@@ -552229,7 +552262,7 @@ function collectSnapshot(workingDir) {
|
|
|
552229
552262
|
}
|
|
552230
552263
|
let gpu = void 0;
|
|
552231
552264
|
try {
|
|
552232
|
-
const nvOut =
|
|
552265
|
+
const nvOut = execSync42("nvidia-smi --query-gpu=name,memory.total,memory.used,temperature.gpu --format=csv,noheader,nounits", { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split(",").map((s2) => s2.trim());
|
|
552233
552266
|
if (nvOut.length >= 3) {
|
|
552234
552267
|
gpu = {
|
|
552235
552268
|
name: nvOut[0],
|
|
@@ -552244,12 +552277,12 @@ function collectSnapshot(workingDir) {
|
|
|
552244
552277
|
let battery = void 0;
|
|
552245
552278
|
try {
|
|
552246
552279
|
if (platform2() === "linux") {
|
|
552247
|
-
const cap =
|
|
552248
|
-
const status =
|
|
552280
|
+
const cap = execSync42("cat /sys/class/power_supply/BAT0/capacity 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
|
|
552281
|
+
const status = execSync42("cat /sys/class/power_supply/BAT0/status 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
|
|
552249
552282
|
if (cap)
|
|
552250
552283
|
battery = { percent: parseInt(cap, 10), charging: status === "Charging" || status === "Full" };
|
|
552251
552284
|
} else if (platform2() === "darwin") {
|
|
552252
|
-
const pmOut =
|
|
552285
|
+
const pmOut = execSync42("pmset -g batt", { encoding: "utf-8", timeout: 2e3 });
|
|
552253
552286
|
const match = pmOut.match(/(\d+)%;\s*(charging|discharging|charged)/i);
|
|
552254
552287
|
if (match)
|
|
552255
552288
|
battery = { percent: parseInt(match[1], 10), charging: match[2].toLowerCase() !== "discharging" };
|
|
@@ -552273,8 +552306,8 @@ function collectSnapshot(workingDir) {
|
|
|
552273
552306
|
}
|
|
552274
552307
|
let processInfo = { total: 0, nodeCount: 0, omniusSpawned: 0, topCpu: [] };
|
|
552275
552308
|
try {
|
|
552276
|
-
const psLines =
|
|
552277
|
-
const total = parseInt(
|
|
552309
|
+
const psLines = execSync42("ps -eo pid,%cpu,args --sort=-%cpu --no-headers 2>/dev/null | head -50", { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n");
|
|
552310
|
+
const total = parseInt(execSync42("ps aux | wc -l", { encoding: "utf-8", timeout: 2e3 }).trim(), 10);
|
|
552278
552311
|
let nodeCount = 0;
|
|
552279
552312
|
let omniusSpawned = 0;
|
|
552280
552313
|
const topCpu = [];
|
|
@@ -552355,7 +552388,7 @@ var init_environment_snapshot = __esm({
|
|
|
552355
552388
|
});
|
|
552356
552389
|
|
|
552357
552390
|
// packages/execution/dist/tools/video-understand.js
|
|
552358
|
-
import { execSync as
|
|
552391
|
+
import { execSync as execSync43 } from "node:child_process";
|
|
552359
552392
|
import { existsSync as existsSync74, mkdirSync as mkdirSync45, writeFileSync as writeFileSync37, readFileSync as readFileSync54, readdirSync as readdirSync24, unlinkSync as unlinkSync16 } from "node:fs";
|
|
552360
552393
|
import { join as join87, basename as basename17, isAbsolute as isAbsolute6, resolve as resolve44 } from "node:path";
|
|
552361
552394
|
import { createHash as createHash24 } from "node:crypto";
|
|
@@ -552364,11 +552397,11 @@ function isYouTubeUrl2(url) {
|
|
|
552364
552397
|
}
|
|
552365
552398
|
function ensureYtDlp2() {
|
|
552366
552399
|
try {
|
|
552367
|
-
|
|
552400
|
+
execSync43("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
|
|
552368
552401
|
return true;
|
|
552369
552402
|
} catch {
|
|
552370
552403
|
try {
|
|
552371
|
-
|
|
552404
|
+
execSync43("pip3 install --break-system-packages yt-dlp 2>/dev/null || pip3 install --user yt-dlp 2>/dev/null", { timeout: 6e4, stdio: "pipe" });
|
|
552372
552405
|
return true;
|
|
552373
552406
|
} catch {
|
|
552374
552407
|
return false;
|
|
@@ -552377,7 +552410,7 @@ function ensureYtDlp2() {
|
|
|
552377
552410
|
}
|
|
552378
552411
|
function ensureFfmpeg() {
|
|
552379
552412
|
try {
|
|
552380
|
-
|
|
552413
|
+
execSync43("ffmpeg -version", { timeout: 3e3, stdio: "pipe" });
|
|
552381
552414
|
return true;
|
|
552382
552415
|
} catch {
|
|
552383
552416
|
return false;
|
|
@@ -552388,7 +552421,7 @@ function shellQuote(value2) {
|
|
|
552388
552421
|
}
|
|
552389
552422
|
function probeVideo(videoPath) {
|
|
552390
552423
|
try {
|
|
552391
|
-
const raw =
|
|
552424
|
+
const raw = execSync43(`ffprobe -v quiet -print_format json -show_format -show_streams ${shellQuote(videoPath)}`, { encoding: "utf-8", timeout: 15e3, stdio: ["pipe", "pipe", "pipe"] });
|
|
552392
552425
|
return JSON.parse(raw);
|
|
552393
552426
|
} catch {
|
|
552394
552427
|
return null;
|
|
@@ -552408,7 +552441,7 @@ function probeDurationSeconds(videoPath, probe) {
|
|
|
552408
552441
|
if (candidates.length > 0)
|
|
552409
552442
|
return Math.max(...candidates);
|
|
552410
552443
|
try {
|
|
552411
|
-
const raw =
|
|
552444
|
+
const raw = execSync43(`ffprobe -v error -show_entries format=duration -of default=nk=1:nw=1 ${shellQuote(videoPath)}`, { encoding: "utf-8", timeout: 1e4, stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
552412
552445
|
const parsed = Number(raw);
|
|
552413
552446
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
552414
552447
|
} catch {
|
|
@@ -552427,7 +552460,7 @@ function extractAudioIfPresent(videoPath, audioPath, probe) {
|
|
|
552427
552460
|
return { available: false, status: "no audio track detected; transcription skipped" };
|
|
552428
552461
|
}
|
|
552429
552462
|
try {
|
|
552430
|
-
|
|
552463
|
+
execSync43(`ffmpeg -y -i ${shellQuote(videoPath)} -map 0:a:0 -vn -acodec libmp3lame -q:a 5 ${shellQuote(audioPath)}`, { timeout: 12e4, stdio: "pipe" });
|
|
552431
552464
|
if (existsSync74(audioPath))
|
|
552432
552465
|
return { available: true, status: "audio extracted" };
|
|
552433
552466
|
return { available: false, status: "audio stream detected but extraction produced no file" };
|
|
@@ -552588,22 +552621,22 @@ var init_video_understand = __esm({
|
|
|
552588
552621
|
return { success: false, output: "", error: "yt-dlp required but not available. Install: pip3 install yt-dlp", durationMs: performance.now() - start2 };
|
|
552589
552622
|
}
|
|
552590
552623
|
try {
|
|
552591
|
-
|
|
552624
|
+
execSync43(`yt-dlp -f "worst[ext=mp4]" -o "${join87(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
|
|
552592
552625
|
} catch {
|
|
552593
|
-
|
|
552626
|
+
execSync43(`yt-dlp -f worst -o "${join87(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
|
|
552594
552627
|
}
|
|
552595
552628
|
try {
|
|
552596
|
-
|
|
552629
|
+
execSync43(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o ${shellQuote(join87(tmpDir, "audio.%(ext)s"))} ${shellQuote(url)}`, { timeout: 3e5, stdio: "pipe" });
|
|
552597
552630
|
} catch (err) {
|
|
552598
552631
|
const message2 = err instanceof Error ? err.message : String(err);
|
|
552599
552632
|
audioStatus = `audio download failed; transcription skipped: ${message2.slice(0, 160)}`;
|
|
552600
552633
|
}
|
|
552601
552634
|
try {
|
|
552602
|
-
title =
|
|
552635
|
+
title = execSync43(`yt-dlp --get-title ${shellQuote(url)}`, { encoding: "utf-8", timeout: 15e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
552603
552636
|
} catch {
|
|
552604
552637
|
}
|
|
552605
552638
|
} else {
|
|
552606
|
-
|
|
552639
|
+
execSync43(`curl -sL -o ${shellQuote(join87(tmpDir, "video.mp4"))} ${shellQuote(url)}`, { timeout: 3e5, stdio: "pipe" });
|
|
552607
552640
|
}
|
|
552608
552641
|
videoPath = readdirSync24(tmpDir).find((f2) => f2.startsWith("video")) ? join87(tmpDir, readdirSync24(tmpDir).find((f2) => f2.startsWith("video"))) : join87(tmpDir, "video.mp4");
|
|
552609
552642
|
audioPath = readdirSync24(tmpDir).find((f2) => f2.startsWith("audio")) ? join87(tmpDir, readdirSync24(tmpDir).find((f2) => f2.startsWith("audio"))) : join87(tmpDir, "audio.mp3");
|
|
@@ -552635,7 +552668,7 @@ var init_video_understand = __esm({
|
|
|
552635
552668
|
let duration = probedDuration;
|
|
552636
552669
|
if (audioAvailable) {
|
|
552637
552670
|
try {
|
|
552638
|
-
|
|
552671
|
+
execSync43(`transcribe-cli transcribe ${shellQuote(audioPath)} --model ${whisperModel} --format json -o ${shellQuote(tmpDir)}`, { timeout: 6e5, stdio: "pipe" });
|
|
552639
552672
|
const jsonFile = readdirSync24(tmpDir).find((f2) => f2.endsWith(".json") && f2 !== "result.json");
|
|
552640
552673
|
if (jsonFile) {
|
|
552641
552674
|
const data = JSON.parse(readFileSync54(join87(tmpDir, jsonFile), "utf-8"));
|
|
@@ -552682,7 +552715,7 @@ var init_video_understand = __esm({
|
|
|
552682
552715
|
const fps = 25;
|
|
552683
552716
|
const intervalFrames = Math.max(1, frameInterval * fps);
|
|
552684
552717
|
try {
|
|
552685
|
-
|
|
552718
|
+
execSync43(`ffmpeg -y -i ${shellQuote(videoPath)} -vf ${shellQuote(`select='gt(scene\\,${sceneThreshold})+not(mod(n\\,${intervalFrames}))',showinfo`)} -vsync vfr ${shellQuote(join87(framesDir, "frame_%04d.jpg"))}`, { timeout: 3e5, stdio: "pipe" });
|
|
552686
552719
|
} catch {
|
|
552687
552720
|
}
|
|
552688
552721
|
const extractedCount = (() => {
|
|
@@ -552695,7 +552728,7 @@ var init_video_understand = __esm({
|
|
|
552695
552728
|
if (extractedCount < minFrames) {
|
|
552696
552729
|
try {
|
|
552697
552730
|
const fallbackFilter = duration > 20 ? `fps=1/${Math.max(1, Math.floor(frameInterval))}` : "fps=1";
|
|
552698
|
-
|
|
552731
|
+
execSync43(`ffmpeg -y -i ${shellQuote(videoPath)} -vf ${shellQuote(fallbackFilter)} -q:v 2 ${shellQuote(join87(framesDir, "interval_%04d.jpg"))}`, { timeout: 3e5, stdio: "pipe" });
|
|
552699
552732
|
} catch {
|
|
552700
552733
|
}
|
|
552701
552734
|
}
|
|
@@ -552842,7 +552875,7 @@ Topic: ${(segments.slice(0, 5).map((s2) => s2.text).join(" ") || audioComprehens
|
|
|
552842
552875
|
}
|
|
552843
552876
|
}
|
|
552844
552877
|
try {
|
|
552845
|
-
|
|
552878
|
+
execSync43(`rm -rf ${shellQuote(tmpDir)}`, { timeout: 1e4, stdio: "pipe" });
|
|
552846
552879
|
} catch {
|
|
552847
552880
|
}
|
|
552848
552881
|
return {
|
|
@@ -558146,9 +558179,9 @@ var init_verifierRunner = __esm({
|
|
|
558146
558179
|
async executeTests(patch, repoRoot) {
|
|
558147
558180
|
if (patch.testsToRun.length === 0)
|
|
558148
558181
|
return "(no tests specified)";
|
|
558149
|
-
const { execFile:
|
|
558182
|
+
const { execFile: execFile10 } = await import("node:child_process");
|
|
558150
558183
|
const { promisify: promisify9 } = await import("node:util");
|
|
558151
|
-
const execFileAsync6 = promisify9(
|
|
558184
|
+
const execFileAsync6 = promisify9(execFile10);
|
|
558152
558185
|
const outputs = [];
|
|
558153
558186
|
const workDir = this.options.workingDir || repoRoot;
|
|
558154
558187
|
for (const cmd of patch.testsToRun.slice(0, 3)) {
|
|
@@ -560013,7 +560046,7 @@ __export(ollama_pool_cleanup_exports, {
|
|
|
560013
560046
|
cleanupStaleOllamaProcesses: () => cleanupStaleOllamaProcesses,
|
|
560014
560047
|
scanOllamaProcesses: () => scanOllamaProcesses
|
|
560015
560048
|
});
|
|
560016
|
-
import { execFile as
|
|
560049
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
560017
560050
|
import { readdir as readdir6, readFile as fsReadFile, readlink } from "node:fs/promises";
|
|
560018
560051
|
import { basename as basename20 } from "node:path";
|
|
560019
560052
|
async function scanOllamaProcesses(options2 = {}) {
|
|
@@ -560334,7 +560367,7 @@ async function maybeApplyInference(scan, options2, system) {
|
|
|
560334
560367
|
function makeSystem(overrides) {
|
|
560335
560368
|
const base3 = {
|
|
560336
560369
|
runCommand: (command, args, timeoutMs) => new Promise((resolve74, reject) => {
|
|
560337
|
-
|
|
560370
|
+
execFile7(command, args, { encoding: "utf8", timeout: timeoutMs }, (err, stdout) => {
|
|
560338
560371
|
if (err)
|
|
560339
560372
|
reject(err);
|
|
560340
560373
|
else
|
|
@@ -563960,7 +563993,7 @@ var init_backward_pass_critic = __esm({
|
|
|
563960
563993
|
|
|
563961
563994
|
// packages/orchestrator/dist/backward-pass-runner.js
|
|
563962
563995
|
import { existsSync as existsSync92, readFileSync as readFileSync69, statSync as statSync35 } from "node:fs";
|
|
563963
|
-
import { execSync as
|
|
563996
|
+
import { execSync as execSync44 } from "node:child_process";
|
|
563964
563997
|
import { isAbsolute as isAbsolute11, join as join102, relative as relative9 } from "node:path";
|
|
563965
563998
|
function collectDiff(opts) {
|
|
563966
563999
|
const cap = Math.max(1, opts.maxFiles);
|
|
@@ -563981,7 +564014,7 @@ function collectDiff(opts) {
|
|
|
563981
564014
|
}
|
|
563982
564015
|
if (existsSync92(join102(opts.workingDir, ".git"))) {
|
|
563983
564016
|
try {
|
|
563984
|
-
const out =
|
|
564017
|
+
const out = execSync44("git diff --name-status HEAD 2>/dev/null; git ls-files --others --exclude-standard 2>/dev/null", { cwd: opts.workingDir, encoding: "utf-8", maxBuffer: 4 * 1024 * 1024, stdio: ["ignore", "pipe", "ignore"] });
|
|
563985
564018
|
const files = [];
|
|
563986
564019
|
for (const line of out.split(/\r?\n/)) {
|
|
563987
564020
|
if (!line.trim())
|
|
@@ -567042,12 +567075,12 @@ var init_tool_batching = __esm({
|
|
|
567042
567075
|
});
|
|
567043
567076
|
|
|
567044
567077
|
// packages/orchestrator/dist/hooks.js
|
|
567045
|
-
import { execSync as
|
|
567078
|
+
import { execSync as execSync45 } from "node:child_process";
|
|
567046
567079
|
function executeHook(hook, env2 = {}) {
|
|
567047
567080
|
const start2 = performance.now();
|
|
567048
567081
|
const timeout2 = hook.timeoutMs ?? DEFAULT_HOOK_TIMEOUT;
|
|
567049
567082
|
try {
|
|
567050
|
-
const output =
|
|
567083
|
+
const output = execSync45(hook.command, {
|
|
567051
567084
|
timeout: timeout2,
|
|
567052
567085
|
env: { ...process.env, ...env2 },
|
|
567053
567086
|
encoding: "utf8",
|
|
@@ -568932,10 +568965,11 @@ function recordContextWindowDump(input) {
|
|
|
568932
568965
|
try {
|
|
568933
568966
|
mkdirSync56(dir, { recursive: true });
|
|
568934
568967
|
const filePath = join107(dir, `${record.id}.json`);
|
|
568935
|
-
|
|
568936
|
-
writeFileSync46(
|
|
568968
|
+
const payload = JSON.stringify(record, null, 2);
|
|
568969
|
+
writeFileSync46(filePath, payload, "utf-8");
|
|
568970
|
+
writeFileSync46(join107(dir, "latest.json"), payload, "utf-8");
|
|
568937
568971
|
appendFileSync8(join107(dir, "index.jsonl"), JSON.stringify(toSummary(record, filePath)) + "\n", "utf-8");
|
|
568938
|
-
|
|
568972
|
+
maybePruneOldDumpFiles(dir);
|
|
568939
568973
|
} catch {
|
|
568940
568974
|
return null;
|
|
568941
568975
|
}
|
|
@@ -569082,6 +569116,13 @@ function toSummary(record, path12) {
|
|
|
569082
569116
|
const { request: _request, ...summary } = record;
|
|
569083
569117
|
return { ...summary, path: path12 };
|
|
569084
569118
|
}
|
|
569119
|
+
function maybePruneOldDumpFiles(dir) {
|
|
569120
|
+
const now2 = Date.now();
|
|
569121
|
+
if (now2 - lastPruneAtMs < 3e4)
|
|
569122
|
+
return;
|
|
569123
|
+
lastPruneAtMs = now2;
|
|
569124
|
+
pruneOldDumpFiles(dir);
|
|
569125
|
+
}
|
|
569085
569126
|
function compactFocusSupervisor(input) {
|
|
569086
569127
|
const directive = input.directive ? {
|
|
569087
569128
|
id: input.directive.id,
|
|
@@ -569133,12 +569174,13 @@ function defaultContextWindowDumpLocations(cwd4 = process.cwd()) {
|
|
|
569133
569174
|
locations.unshift(resolve50(envDir));
|
|
569134
569175
|
return [...new Set(locations)];
|
|
569135
569176
|
}
|
|
569136
|
-
var IMAGE_BASE64_RE, DEFAULT_MAX_FILES;
|
|
569177
|
+
var IMAGE_BASE64_RE, DEFAULT_MAX_FILES, lastPruneAtMs;
|
|
569137
569178
|
var init_contextWindowDump = __esm({
|
|
569138
569179
|
"packages/orchestrator/dist/contextWindowDump.js"() {
|
|
569139
569180
|
"use strict";
|
|
569140
569181
|
IMAGE_BASE64_RE = /\[IMAGE_BASE64:[^\]]+\]/g;
|
|
569141
569182
|
DEFAULT_MAX_FILES = 200;
|
|
569183
|
+
lastPruneAtMs = 0;
|
|
569142
569184
|
}
|
|
569143
569185
|
});
|
|
569144
569186
|
|
|
@@ -570952,7 +570994,7 @@ __export(preflightSnapshot_exports, {
|
|
|
570952
570994
|
freeDiskBytes: () => freeDiskBytes
|
|
570953
570995
|
});
|
|
570954
570996
|
import { existsSync as existsSync98, readFileSync as readFileSync75, statSync as statSync37 } from "node:fs";
|
|
570955
|
-
import { execSync as
|
|
570997
|
+
import { execSync as execSync46 } from "node:child_process";
|
|
570956
570998
|
import { homedir as homedir33, platform as platform3, arch as arch2, totalmem as totalmem4, freemem as freemem3, hostname as hostname3 } from "node:os";
|
|
570957
570999
|
import { join as join108 } from "node:path";
|
|
570958
571000
|
import { createHash as createHash28 } from "node:crypto";
|
|
@@ -571108,7 +571150,7 @@ function captureToolchainVersions() {
|
|
|
571108
571150
|
const out = {};
|
|
571109
571151
|
for (const probe of TOOLCHAIN_PROBES) {
|
|
571110
571152
|
try {
|
|
571111
|
-
const v =
|
|
571153
|
+
const v = execSync46(probe.cmd, {
|
|
571112
571154
|
encoding: "utf8",
|
|
571113
571155
|
stdio: ["ignore", "pipe", "ignore"],
|
|
571114
571156
|
timeout: 500
|
|
@@ -571133,7 +571175,7 @@ function freeDiskBytes(path12 = "/tmp") {
|
|
|
571133
571175
|
const st = statSync37(path12);
|
|
571134
571176
|
if (!st.isDirectory())
|
|
571135
571177
|
return -1;
|
|
571136
|
-
const out =
|
|
571178
|
+
const out = execSync46(`df -P -k ${JSON.stringify(path12)} | tail -1`, {
|
|
571137
571179
|
encoding: "utf8",
|
|
571138
571180
|
timeout: 500
|
|
571139
571181
|
});
|
|
@@ -572459,11 +572501,86 @@ function computeEffectiveThink(params) {
|
|
|
572459
572501
|
return params.defaultThink;
|
|
572460
572502
|
}
|
|
572461
572503
|
function sanitizeHistoryThink(messages2) {
|
|
572462
|
-
|
|
572504
|
+
const referencedToolCallIds = /* @__PURE__ */ new Set();
|
|
572505
|
+
for (const message2 of messages2) {
|
|
572506
|
+
if (message2.role === "tool" && message2.tool_call_id) {
|
|
572507
|
+
referencedToolCallIds.add(message2.tool_call_id);
|
|
572508
|
+
}
|
|
572509
|
+
}
|
|
572510
|
+
const stripped = messages2.map((m2) => {
|
|
572463
572511
|
if (m2.role !== "assistant" || typeof m2.content !== "string")
|
|
572464
572512
|
return m2;
|
|
572465
572513
|
return { ...m2, content: stripThinkBlocks(m2.content) };
|
|
572466
572514
|
});
|
|
572515
|
+
const sanitized = [];
|
|
572516
|
+
for (let i2 = 0; i2 < stripped.length; i2++) {
|
|
572517
|
+
const current = stripped[i2];
|
|
572518
|
+
const next = stripped[i2 + 1];
|
|
572519
|
+
if (isOrphanDuplicateAssistantToolAnchor(current, next, referencedToolCallIds)) {
|
|
572520
|
+
continue;
|
|
572521
|
+
}
|
|
572522
|
+
sanitized.push(current);
|
|
572523
|
+
}
|
|
572524
|
+
return sanitized;
|
|
572525
|
+
}
|
|
572526
|
+
function isOrphanDuplicateAssistantToolAnchor(current, next, referencedToolCallIds) {
|
|
572527
|
+
if (!next)
|
|
572528
|
+
return false;
|
|
572529
|
+
if (current.role !== "assistant" || next.role !== "assistant")
|
|
572530
|
+
return false;
|
|
572531
|
+
if (!Array.isArray(current.tool_calls) || !Array.isArray(next.tool_calls)) {
|
|
572532
|
+
return false;
|
|
572533
|
+
}
|
|
572534
|
+
if (current.tool_calls.length === 0 || next.tool_calls.length === 0) {
|
|
572535
|
+
return false;
|
|
572536
|
+
}
|
|
572537
|
+
if (assistantVisibleText(current).length > 0)
|
|
572538
|
+
return false;
|
|
572539
|
+
if (toolCallsFingerprint(current.tool_calls) !== toolCallsFingerprint(next.tool_calls)) {
|
|
572540
|
+
return false;
|
|
572541
|
+
}
|
|
572542
|
+
const currentIds = current.tool_calls.map((call) => call.id).filter(Boolean);
|
|
572543
|
+
const nextIds = next.tool_calls.map((call) => call.id).filter(Boolean);
|
|
572544
|
+
const currentReferenced = currentIds.some((id) => referencedToolCallIds.has(id));
|
|
572545
|
+
const nextReferenced = nextIds.some((id) => referencedToolCallIds.has(id));
|
|
572546
|
+
return !currentReferenced && (nextReferenced || currentIds.length > 0);
|
|
572547
|
+
}
|
|
572548
|
+
function assistantVisibleText(message2) {
|
|
572549
|
+
if (typeof message2.content === "string")
|
|
572550
|
+
return message2.content.trim();
|
|
572551
|
+
if (!Array.isArray(message2.content))
|
|
572552
|
+
return "";
|
|
572553
|
+
return message2.content.map((part) => part.type === "text" ? part.text ?? "" : "").join("").trim();
|
|
572554
|
+
}
|
|
572555
|
+
function toolCallsFingerprint(calls) {
|
|
572556
|
+
return calls.map((call) => {
|
|
572557
|
+
const args = normalizeToolCallArgumentString(call.function.arguments);
|
|
572558
|
+
return `${call.function.name}:${args}`;
|
|
572559
|
+
}).join("|");
|
|
572560
|
+
}
|
|
572561
|
+
function normalizeToolCallArgumentString(args) {
|
|
572562
|
+
try {
|
|
572563
|
+
return JSON.stringify(JSON.parse(args));
|
|
572564
|
+
} catch {
|
|
572565
|
+
return args.replace(/\s+/g, " ").trim();
|
|
572566
|
+
}
|
|
572567
|
+
}
|
|
572568
|
+
function normalizeEditComparable(text2) {
|
|
572569
|
+
return text2.replace(/\r\n/g, "\n").trim();
|
|
572570
|
+
}
|
|
572571
|
+
function previewInline(text2, max = 140) {
|
|
572572
|
+
const normalized = text2.replace(/\s+/g, " ").trim();
|
|
572573
|
+
if (normalized.length <= max)
|
|
572574
|
+
return JSON.stringify(normalized);
|
|
572575
|
+
return JSON.stringify(`${normalized.slice(0, max - 18)}...#${quickTextHash(normalized)}`);
|
|
572576
|
+
}
|
|
572577
|
+
function quickTextHash(input) {
|
|
572578
|
+
let hash = 2166136261;
|
|
572579
|
+
for (let index = 0; index < input.length; index++) {
|
|
572580
|
+
hash ^= input.charCodeAt(index);
|
|
572581
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
572582
|
+
}
|
|
572583
|
+
return hash.toString(16).padStart(8, "0");
|
|
572467
572584
|
}
|
|
572468
572585
|
function applyMemoryPrefixToMessages(messages2, memoryPrefix) {
|
|
572469
572586
|
const prefix = memoryPrefix?.trim();
|
|
@@ -572938,6 +573055,8 @@ var init_agenticRunner = __esm({
|
|
|
572938
573055
|
_completionCaveat = null;
|
|
572939
573056
|
_completionLedger = null;
|
|
572940
573057
|
_staleEditFamilies = /* @__PURE__ */ new Map();
|
|
573058
|
+
_lastReadTurnByPathKey = /* @__PURE__ */ new Map();
|
|
573059
|
+
_recentSuccessfulReplacements = [];
|
|
572941
573060
|
// ── WO-AM-01/04/10: Associative memory stores ──
|
|
572942
573061
|
// Episode store: every tool call → persistent episode with importance + decay
|
|
572943
573062
|
// Temporal KG: entities + relations with temporal validity (valid_from/valid_until)
|
|
@@ -578793,6 +578912,8 @@ Respond with your assessment, then take action.`;
|
|
|
578793
578912
|
this._completionLedger = null;
|
|
578794
578913
|
this._focusTerminalLedgerRecorded = false;
|
|
578795
578914
|
this._staleEditFamilies.clear();
|
|
578915
|
+
this._lastReadTurnByPathKey.clear();
|
|
578916
|
+
this._recentSuccessfulReplacements = [];
|
|
578796
578917
|
this._lastWorldStateTurn = -1;
|
|
578797
578918
|
this._fileWritesSinceLastWorldState = 0;
|
|
578798
578919
|
this._resetVisualEvidenceState();
|
|
@@ -579078,8 +579199,8 @@ Respond with your assessment, then take action.`;
|
|
|
579078
579199
|
const memMod = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
579079
579200
|
let commitSha = "no-commit";
|
|
579080
579201
|
try {
|
|
579081
|
-
const { execSync:
|
|
579082
|
-
commitSha =
|
|
579202
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
579203
|
+
commitSha = execSync62("git rev-parse HEAD", {
|
|
579083
579204
|
cwd: this._workingDirectory,
|
|
579084
579205
|
stdio: ["ignore", "pipe", "ignore"]
|
|
579085
579206
|
}).toString().trim().slice(0, 12) || "no-commit";
|
|
@@ -581183,7 +581304,7 @@ ${memoryLines.join("\n")}`
|
|
|
581183
581304
|
this.proactivePrune(compacted, turn);
|
|
581184
581305
|
this.microcompact(compacted, recentToolResults);
|
|
581185
581306
|
this._insertContextFrame(compacted, await this._buildTurnContextFrame(turn, compacted, recentToolResults, environmentBlock));
|
|
581186
|
-
let requestMessages = compacted;
|
|
581307
|
+
let requestMessages = sanitizeHistoryThink(compacted);
|
|
581187
581308
|
{
|
|
581188
581309
|
const _limits = this.contextLimits();
|
|
581189
581310
|
const ceInput = {
|
|
@@ -581219,6 +581340,7 @@ ${memoryLines.join("\n")}`
|
|
|
581219
581340
|
}
|
|
581220
581341
|
}
|
|
581221
581342
|
const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
|
|
581343
|
+
requestMessages = sanitizeHistoryThink(requestMessages);
|
|
581222
581344
|
const chatRequest = {
|
|
581223
581345
|
messages: requestMessages,
|
|
581224
581346
|
tools: toolDefs,
|
|
@@ -582178,6 +582300,69 @@ Use the saved fact to continue the promised synthesis or next concrete step, or
|
|
|
582178
582300
|
systemGuidance: staleRewriteOutput
|
|
582179
582301
|
};
|
|
582180
582302
|
}
|
|
582303
|
+
const editReversalBlock = this.editReversalPreflightBlock(tc.name, tc.arguments ?? {}, turn);
|
|
582304
|
+
if (editReversalBlock) {
|
|
582305
|
+
const focusDecision2 = this._focusSupervisor?.evaluateProposedCall({
|
|
582306
|
+
turn,
|
|
582307
|
+
toolName: tc.name,
|
|
582308
|
+
args: tc.arguments ?? {},
|
|
582309
|
+
fingerprint: toolFingerprint,
|
|
582310
|
+
isReadLike: false,
|
|
582311
|
+
stalePreflightMessage: editReversalBlock,
|
|
582312
|
+
context: this._buildFocusContextSnapshot()
|
|
582313
|
+
});
|
|
582314
|
+
const reversalOutput = focusDecision2?.kind === "block_tool_call" ? focusDecision2.message : editReversalBlock;
|
|
582315
|
+
if (focusDecision2 && focusDecision2.kind !== "pass") {
|
|
582316
|
+
this._emitFocusSupervisorEvent({
|
|
582317
|
+
decision: focusDecision2.kind,
|
|
582318
|
+
state: focusDecision2.state,
|
|
582319
|
+
directiveId: focusDecision2.directive.id,
|
|
582320
|
+
reason: focusDecision2.directive.reason,
|
|
582321
|
+
requiredNextAction: focusDecision2.directive.requiredNextAction,
|
|
582322
|
+
blockedTool: tc.name,
|
|
582323
|
+
turn
|
|
582324
|
+
});
|
|
582325
|
+
this._maybeMarkFocusTerminalIncomplete({
|
|
582326
|
+
decision: focusDecision2,
|
|
582327
|
+
blockedTool: tc.name,
|
|
582328
|
+
turn
|
|
582329
|
+
});
|
|
582330
|
+
}
|
|
582331
|
+
this.emit({
|
|
582332
|
+
type: "tool_call",
|
|
582333
|
+
toolName: tc.name,
|
|
582334
|
+
toolArgs: tc.arguments,
|
|
582335
|
+
turn,
|
|
582336
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
582337
|
+
});
|
|
582338
|
+
this.emit({
|
|
582339
|
+
type: "tool_result",
|
|
582340
|
+
toolName: tc.name,
|
|
582341
|
+
success: false,
|
|
582342
|
+
content: reversalOutput.slice(0, 120),
|
|
582343
|
+
turn,
|
|
582344
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
582345
|
+
});
|
|
582346
|
+
this._tagSyntheticFailure({
|
|
582347
|
+
mode: "step_repetition",
|
|
582348
|
+
rationale: "edit attempted to reverse a recent successful replacement without fresh evidence"
|
|
582349
|
+
});
|
|
582350
|
+
if (this._completionLedger) {
|
|
582351
|
+
this._completionLedger = recordToolEvidence(this._completionLedger, {
|
|
582352
|
+
name: tc.name,
|
|
582353
|
+
success: false,
|
|
582354
|
+
outputPreview: reversalOutput.slice(0, 500),
|
|
582355
|
+
argsKey: tc.arguments ? JSON.stringify(tc.arguments).slice(0, 300) : ""
|
|
582356
|
+
});
|
|
582357
|
+
this._saveCompletionLedgerSafe();
|
|
582358
|
+
}
|
|
582359
|
+
return {
|
|
582360
|
+
tc,
|
|
582361
|
+
output: reversalOutput,
|
|
582362
|
+
success: false,
|
|
582363
|
+
systemGuidance: reversalOutput
|
|
582364
|
+
};
|
|
582365
|
+
}
|
|
582181
582366
|
const baseIsReadLike = ![
|
|
582182
582367
|
"file_write",
|
|
582183
582368
|
"file_edit",
|
|
@@ -583812,6 +583997,7 @@ Evidence: ${evidencePreview}`.slice(0, 500);
|
|
|
583812
583997
|
const filePath = typeof tc.arguments?.path === "string" ? tc.arguments.path : "";
|
|
583813
583998
|
recordToolExecution(this._appState, tc.name, performance.now() - toolStart, result.success, filePath || void 0);
|
|
583814
583999
|
this.noteStaleEditGuardOutcome(tc.name, tc.arguments ?? {}, result, turn);
|
|
584000
|
+
this.noteEditReversalOutcome(tc.name, tc.arguments ?? {}, result, turn);
|
|
583815
584001
|
{
|
|
583816
584002
|
const beforeDirective = this._focusSupervisor?.snapshot().directive?.id ?? null;
|
|
583817
584003
|
this._focusSupervisor?.observeToolResult({
|
|
@@ -584876,8 +585062,9 @@ ${this.options.maxTurns && this.options.maxTurns > 0 ? `You have ${this.options.
|
|
|
584876
585062
|
}
|
|
584877
585063
|
}
|
|
584878
585064
|
this._insertContextFrame(compactedMsgs, await this._buildTurnContextFrame(turn, compactedMsgs, void 0, bfEnvironmentBlock));
|
|
585065
|
+
const modelFacingMessages = sanitizeHistoryThink(compactedMsgs);
|
|
584879
585066
|
const chatRequest = {
|
|
584880
|
-
messages:
|
|
585067
|
+
messages: modelFacingMessages,
|
|
584881
585068
|
tools: toolDefs,
|
|
584882
585069
|
temperature: this.options.temperature,
|
|
584883
585070
|
maxTokens: this.options.maxTokens,
|
|
@@ -586461,6 +586648,94 @@ ${marker}` : marker);
|
|
|
586461
586648
|
`Stale target preview: ${active.preview}`
|
|
586462
586649
|
].join("\n");
|
|
586463
586650
|
}
|
|
586651
|
+
editReversalPreflightBlock(toolName, args, turn) {
|
|
586652
|
+
if (process.env["OMNIUS_ALLOW_BLIND_EDIT_REVERSAL"] === "1")
|
|
586653
|
+
return null;
|
|
586654
|
+
const replacements = this.extractReplacementEdits(toolName, args);
|
|
586655
|
+
if (replacements.length === 0)
|
|
586656
|
+
return null;
|
|
586657
|
+
for (const replacement of replacements) {
|
|
586658
|
+
const prior = [...this._recentSuccessfulReplacements].reverse().find((entry) => entry.pathKey === replacement.pathKey && entry.oldHash === replacement.newHash && entry.newHash === replacement.oldHash && turn - entry.turn <= 8);
|
|
586659
|
+
if (!prior)
|
|
586660
|
+
continue;
|
|
586661
|
+
const lastReadTurn = this._lastReadTurnByPathKey.get(replacement.pathKey) ?? -1;
|
|
586662
|
+
if (lastReadTurn > prior.turn)
|
|
586663
|
+
continue;
|
|
586664
|
+
return [
|
|
586665
|
+
`[EDIT REVERSAL BLOCKED] ${toolName} would exactly reverse a recent successful edit on ${replacement.path}.`,
|
|
586666
|
+
`Prior edit at turn ${prior.turn}: ${previewInline(prior.oldText)} -> ${previewInline(prior.newText)}.`,
|
|
586667
|
+
`Proposed edit: ${previewInline(replacement.oldText)} -> ${previewInline(replacement.newText)}.`,
|
|
586668
|
+
``,
|
|
586669
|
+
`Do not toggle a target back and forth after verification fails. First file_read the authoritative current file once, then choose one:`,
|
|
586670
|
+
`1. make a different edit based on the fresh file and the latest failure output,`,
|
|
586671
|
+
`2. run a verification command if the current file is already correct, or`,
|
|
586672
|
+
`3. report incomplete/blocked with the concrete failing evidence.`
|
|
586673
|
+
].join("\n");
|
|
586674
|
+
}
|
|
586675
|
+
return null;
|
|
586676
|
+
}
|
|
586677
|
+
noteEditReversalOutcome(toolName, args, result, turn) {
|
|
586678
|
+
const path12 = this.extractPrimaryToolPath(args);
|
|
586679
|
+
if (toolName === "file_read" && path12 && result.success) {
|
|
586680
|
+
this._lastReadTurnByPathKey.set(this.staleEditPathKey(path12), turn);
|
|
586681
|
+
return;
|
|
586682
|
+
}
|
|
586683
|
+
if (!result.success || result.mutated === false)
|
|
586684
|
+
return;
|
|
586685
|
+
const replacements = this.extractReplacementEdits(toolName, args);
|
|
586686
|
+
if (replacements.length === 0)
|
|
586687
|
+
return;
|
|
586688
|
+
for (const replacement of replacements) {
|
|
586689
|
+
this._recentSuccessfulReplacements.push({
|
|
586690
|
+
...replacement,
|
|
586691
|
+
tool: toolName,
|
|
586692
|
+
turn
|
|
586693
|
+
});
|
|
586694
|
+
}
|
|
586695
|
+
if (this._recentSuccessfulReplacements.length > 40) {
|
|
586696
|
+
this._recentSuccessfulReplacements = this._recentSuccessfulReplacements.slice(-40);
|
|
586697
|
+
}
|
|
586698
|
+
}
|
|
586699
|
+
extractReplacementEdits(toolName, args) {
|
|
586700
|
+
if (!args)
|
|
586701
|
+
return [];
|
|
586702
|
+
const out = [];
|
|
586703
|
+
const add3 = (path12, oldText, newText) => {
|
|
586704
|
+
if (typeof path12 !== "string" || !path12.trim())
|
|
586705
|
+
return;
|
|
586706
|
+
if (typeof oldText !== "string" || typeof newText !== "string")
|
|
586707
|
+
return;
|
|
586708
|
+
const normalizedOld = normalizeEditComparable(oldText);
|
|
586709
|
+
const normalizedNew = normalizeEditComparable(newText);
|
|
586710
|
+
if (!normalizedOld || !normalizedNew || normalizedOld === normalizedNew)
|
|
586711
|
+
return;
|
|
586712
|
+
out.push({
|
|
586713
|
+
path: path12.trim(),
|
|
586714
|
+
pathKey: this.staleEditPathKey(path12),
|
|
586715
|
+
oldText: normalizedOld,
|
|
586716
|
+
newText: normalizedNew,
|
|
586717
|
+
oldHash: this.quickHash(normalizedOld),
|
|
586718
|
+
newHash: this.quickHash(normalizedNew)
|
|
586719
|
+
});
|
|
586720
|
+
};
|
|
586721
|
+
if (toolName === "file_edit") {
|
|
586722
|
+
add3(this.extractPrimaryToolPath(args), args["old_string"] ?? args["oldString"] ?? args["oldText"], args["new_string"] ?? args["newString"] ?? args["newText"]);
|
|
586723
|
+
return out;
|
|
586724
|
+
}
|
|
586725
|
+
if (toolName === "batch_edit") {
|
|
586726
|
+
const fallbackPath = this.extractPrimaryToolPath(args);
|
|
586727
|
+
const edits = args["edits"];
|
|
586728
|
+
if (!Array.isArray(edits))
|
|
586729
|
+
return out;
|
|
586730
|
+
for (const edit of edits) {
|
|
586731
|
+
if (!edit || typeof edit !== "object")
|
|
586732
|
+
continue;
|
|
586733
|
+
const rec = edit;
|
|
586734
|
+
add3(rec["path"] ?? rec["file"] ?? rec["filePath"] ?? rec["file_path"] ?? fallbackPath, rec["old_string"] ?? rec["oldString"] ?? rec["oldText"], rec["new_string"] ?? rec["newString"] ?? rec["newText"]);
|
|
586735
|
+
}
|
|
586736
|
+
}
|
|
586737
|
+
return out;
|
|
586738
|
+
}
|
|
586464
586739
|
noteStaleEditGuardOutcome(toolName, args, result, turn) {
|
|
586465
586740
|
const path12 = this.extractPrimaryToolPath(args);
|
|
586466
586741
|
const pathKey = path12 ? this.staleEditPathKey(path12) : "";
|
|
@@ -589693,7 +589968,7 @@ ${result}`
|
|
|
589693
589968
|
const buffer2 = Buffer.from(rawBase64, "base64");
|
|
589694
589969
|
let resizedBase64 = null;
|
|
589695
589970
|
try {
|
|
589696
|
-
const { execSync:
|
|
589971
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
589697
589972
|
const { writeFileSync: writeFileSync91, readFileSync: readFileSync133, unlinkSync: unlinkSync37 } = await import("node:fs");
|
|
589698
589973
|
const { join: join180 } = await import("node:path");
|
|
589699
589974
|
const { tmpdir: tmpdir24 } = await import("node:os");
|
|
@@ -589703,7 +589978,7 @@ ${result}`
|
|
|
589703
589978
|
const pyBin = process.platform === "win32" ? "python" : "python3";
|
|
589704
589979
|
const escapedIn = tmpIn.replace(/\\/g, "\\\\");
|
|
589705
589980
|
const escapedOut = tmpOut.replace(/\\/g, "\\\\");
|
|
589706
|
-
|
|
589981
|
+
execSync62(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
|
|
589707
589982
|
const resizedBuf = readFileSync133(tmpOut);
|
|
589708
589983
|
resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
|
|
589709
589984
|
try {
|
|
@@ -589802,8 +590077,8 @@ ${result}`
|
|
|
589802
590077
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
589803
590078
|
});
|
|
589804
590079
|
try {
|
|
589805
|
-
const { execSync:
|
|
589806
|
-
|
|
590080
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
590081
|
+
execSync62("ollama pull moondream", {
|
|
589807
590082
|
timeout: 3e5,
|
|
589808
590083
|
stdio: "pipe"
|
|
589809
590084
|
});
|
|
@@ -596491,7 +596766,7 @@ var init_missionSystem = __esm({
|
|
|
596491
596766
|
});
|
|
596492
596767
|
|
|
596493
596768
|
// packages/orchestrator/dist/context-references.js
|
|
596494
|
-
import { execSync as
|
|
596769
|
+
import { execSync as execSync47 } from "node:child_process";
|
|
596495
596770
|
import { readFileSync as readFileSync83, readdirSync as readdirSync33, statSync as statSync40 } from "node:fs";
|
|
596496
596771
|
import { homedir as homedir35 } from "node:os";
|
|
596497
596772
|
import { join as join118, resolve as resolve51, relative as relative10, sep as sep3, extname as extname13 } from "node:path";
|
|
@@ -596745,7 +597020,7 @@ ${listing}`];
|
|
|
596745
597020
|
}
|
|
596746
597021
|
function expandGitReference(ref, cwd4, args, label) {
|
|
596747
597022
|
try {
|
|
596748
|
-
const result =
|
|
597023
|
+
const result = execSync47(["git", ...args].join(" "), {
|
|
596749
597024
|
cwd: cwd4,
|
|
596750
597025
|
encoding: "utf-8",
|
|
596751
597026
|
stdio: "pipe",
|
|
@@ -598297,7 +598572,7 @@ __export(listen_exports, {
|
|
|
598297
598572
|
transcribeFileViaWhisper: () => transcribeFileViaWhisper,
|
|
598298
598573
|
waitForTranscribeCli: () => waitForTranscribeCli
|
|
598299
598574
|
});
|
|
598300
|
-
import { spawn as spawn25, execSync as
|
|
598575
|
+
import { spawn as spawn25, execSync as execSync48 } from "node:child_process";
|
|
598301
598576
|
import {
|
|
598302
598577
|
accessSync,
|
|
598303
598578
|
constants,
|
|
@@ -598326,7 +598601,7 @@ function findMicCaptureCommand() {
|
|
|
598326
598601
|
const platform7 = process.platform;
|
|
598327
598602
|
if (platform7 === "linux") {
|
|
598328
598603
|
try {
|
|
598329
|
-
|
|
598604
|
+
execSync48("which arecord", { stdio: "pipe" });
|
|
598330
598605
|
return {
|
|
598331
598606
|
cmd: "arecord",
|
|
598332
598607
|
args: [
|
|
@@ -598347,7 +598622,7 @@ function findMicCaptureCommand() {
|
|
|
598347
598622
|
}
|
|
598348
598623
|
if (platform7 === "darwin") {
|
|
598349
598624
|
try {
|
|
598350
|
-
|
|
598625
|
+
execSync48("which sox", { stdio: "pipe" });
|
|
598351
598626
|
return {
|
|
598352
598627
|
cmd: "sox",
|
|
598353
598628
|
args: [
|
|
@@ -598369,7 +598644,7 @@ function findMicCaptureCommand() {
|
|
|
598369
598644
|
}
|
|
598370
598645
|
}
|
|
598371
598646
|
try {
|
|
598372
|
-
|
|
598647
|
+
execSync48("which ffmpeg", { stdio: "pipe" });
|
|
598373
598648
|
if (platform7 === "linux") {
|
|
598374
598649
|
return {
|
|
598375
598650
|
cmd: "ffmpeg",
|
|
@@ -598426,7 +598701,7 @@ function findTranscribeFileScript() {
|
|
|
598426
598701
|
if (existsSync107(p2)) return p2;
|
|
598427
598702
|
}
|
|
598428
598703
|
try {
|
|
598429
|
-
const globalRoot =
|
|
598704
|
+
const globalRoot = execSync48("npm root -g", {
|
|
598430
598705
|
encoding: "utf-8",
|
|
598431
598706
|
timeout: 5e3,
|
|
598432
598707
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -598517,7 +598792,7 @@ function findLiveWhisperScript() {
|
|
|
598517
598792
|
if (existsSync107(p2)) return p2;
|
|
598518
598793
|
}
|
|
598519
598794
|
try {
|
|
598520
|
-
const globalRoot =
|
|
598795
|
+
const globalRoot = execSync48("npm root -g", {
|
|
598521
598796
|
encoding: "utf-8",
|
|
598522
598797
|
timeout: 5e3,
|
|
598523
598798
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -598565,7 +598840,7 @@ function ensureVenvForTranscribeCli() {
|
|
|
598565
598840
|
process.env.PATH = `${venvBin}${pathSep2}${currentPath}`;
|
|
598566
598841
|
}
|
|
598567
598842
|
try {
|
|
598568
|
-
|
|
598843
|
+
execSync48(`"${venvPython2}" -c "import numpy"`, {
|
|
598569
598844
|
stdio: "pipe",
|
|
598570
598845
|
timeout: 1e4
|
|
598571
598846
|
});
|
|
@@ -598578,7 +598853,7 @@ function ensureTranscribeCliBackground() {
|
|
|
598578
598853
|
if (_bgInstallPromise) return _bgInstallPromise;
|
|
598579
598854
|
_bgInstallPromise = (async () => {
|
|
598580
598855
|
try {
|
|
598581
|
-
const globalRoot =
|
|
598856
|
+
const globalRoot = execSync48("npm root -g", {
|
|
598582
598857
|
encoding: "utf-8",
|
|
598583
598858
|
timeout: 5e3,
|
|
598584
598859
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -598591,7 +598866,7 @@ function ensureTranscribeCliBackground() {
|
|
|
598591
598866
|
try {
|
|
598592
598867
|
let needsSudo = false;
|
|
598593
598868
|
try {
|
|
598594
|
-
const prefix =
|
|
598869
|
+
const prefix = execSync48("npm prefix -g", {
|
|
598595
598870
|
encoding: "utf-8",
|
|
598596
598871
|
timeout: 5e3,
|
|
598597
598872
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -598847,7 +599122,7 @@ var init_listen = __esm({
|
|
|
598847
599122
|
}
|
|
598848
599123
|
if (!this.transcribeCliAvailable) {
|
|
598849
599124
|
try {
|
|
598850
|
-
|
|
599125
|
+
execSync48("which transcribe-cli", { stdio: "pipe" });
|
|
598851
599126
|
this.transcribeCliAvailable = true;
|
|
598852
599127
|
} catch {
|
|
598853
599128
|
this.transcribeCliAvailable = false;
|
|
@@ -598864,7 +599139,7 @@ var init_listen = __esm({
|
|
|
598864
599139
|
} catch {
|
|
598865
599140
|
}
|
|
598866
599141
|
try {
|
|
598867
|
-
const globalRoot =
|
|
599142
|
+
const globalRoot = execSync48("npm root -g", {
|
|
598868
599143
|
encoding: "utf-8",
|
|
598869
599144
|
timeout: 5e3,
|
|
598870
599145
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -598919,7 +599194,7 @@ var init_listen = __esm({
|
|
|
598919
599194
|
}
|
|
598920
599195
|
if (!tc) {
|
|
598921
599196
|
try {
|
|
598922
|
-
|
|
599197
|
+
execSync48("npm i -g transcribe-cli", {
|
|
598923
599198
|
stdio: "pipe",
|
|
598924
599199
|
timeout: 18e4
|
|
598925
599200
|
});
|
|
@@ -598948,7 +599223,7 @@ var init_listen = __esm({
|
|
|
598948
599223
|
}
|
|
598949
599224
|
} catch {
|
|
598950
599225
|
try {
|
|
598951
|
-
const out =
|
|
599226
|
+
const out = execSync48(
|
|
598952
599227
|
"npm list -g transcribe-cli --depth=0 --json",
|
|
598953
599228
|
{
|
|
598954
599229
|
encoding: "utf-8",
|
|
@@ -598964,7 +599239,7 @@ var init_listen = __esm({
|
|
|
598964
599239
|
}
|
|
598965
599240
|
if (!tcUpToDate) {
|
|
598966
599241
|
try {
|
|
598967
|
-
|
|
599242
|
+
execSync48("npm i -g transcribe-cli@latest", {
|
|
598968
599243
|
stdio: "pipe",
|
|
598969
599244
|
timeout: 12e4
|
|
598970
599245
|
});
|
|
@@ -599232,7 +599507,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
599232
599507
|
}
|
|
599233
599508
|
if (!tc) {
|
|
599234
599509
|
try {
|
|
599235
|
-
|
|
599510
|
+
execSync48("npm i -g transcribe-cli", {
|
|
599236
599511
|
stdio: "pipe",
|
|
599237
599512
|
timeout: 18e4
|
|
599238
599513
|
});
|
|
@@ -599294,7 +599569,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
599294
599569
|
}
|
|
599295
599570
|
if (!tc) {
|
|
599296
599571
|
try {
|
|
599297
|
-
|
|
599572
|
+
execSync48("npm i -g transcribe-cli", {
|
|
599298
599573
|
stdio: "pipe",
|
|
599299
599574
|
timeout: 18e4
|
|
599300
599575
|
});
|
|
@@ -604550,7 +604825,7 @@ __export(text_selection_exports, {
|
|
|
604550
604825
|
stripAnsi: () => stripAnsi,
|
|
604551
604826
|
visibleLength: () => visibleLength
|
|
604552
604827
|
});
|
|
604553
|
-
import { execSync as
|
|
604828
|
+
import { execSync as execSync49 } from "node:child_process";
|
|
604554
604829
|
function stripAnsi(s2) {
|
|
604555
604830
|
return s2.replace(/\x1B\[[0-9;]*[A-Za-z]|\x1B\].*?(?:\x07|\x1B\\)/g, "");
|
|
604556
604831
|
}
|
|
@@ -604572,11 +604847,11 @@ function copyText(text2) {
|
|
|
604572
604847
|
try {
|
|
604573
604848
|
const platform7 = process.platform;
|
|
604574
604849
|
if (platform7 === "darwin") {
|
|
604575
|
-
|
|
604850
|
+
execSync49("pbcopy", { input: text2, timeout: 3e3 });
|
|
604576
604851
|
return true;
|
|
604577
604852
|
}
|
|
604578
604853
|
if (platform7 === "win32") {
|
|
604579
|
-
|
|
604854
|
+
execSync49("clip", { input: text2, timeout: 3e3 });
|
|
604580
604855
|
return true;
|
|
604581
604856
|
}
|
|
604582
604857
|
for (const tool of [
|
|
@@ -604585,7 +604860,7 @@ function copyText(text2) {
|
|
|
604585
604860
|
"wl-copy"
|
|
604586
604861
|
]) {
|
|
604587
604862
|
try {
|
|
604588
|
-
|
|
604863
|
+
execSync49(tool, { input: text2, timeout: 3e3 });
|
|
604589
604864
|
return true;
|
|
604590
604865
|
} catch {
|
|
604591
604866
|
continue;
|
|
@@ -604594,13 +604869,13 @@ function copyText(text2) {
|
|
|
604594
604869
|
if (!_clipboardAutoInstallAttempted) {
|
|
604595
604870
|
_clipboardAutoInstallAttempted = true;
|
|
604596
604871
|
try {
|
|
604597
|
-
|
|
604872
|
+
execSync49("which apt-get", { timeout: 2e3, stdio: "pipe" });
|
|
604598
604873
|
try {
|
|
604599
|
-
|
|
604874
|
+
execSync49("sudo -n apt-get install -y xclip 2>/dev/null", {
|
|
604600
604875
|
timeout: 15e3,
|
|
604601
604876
|
stdio: "pipe"
|
|
604602
604877
|
});
|
|
604603
|
-
|
|
604878
|
+
execSync49("xclip -selection clipboard", {
|
|
604604
604879
|
input: text2,
|
|
604605
604880
|
timeout: 3e3
|
|
604606
604881
|
});
|
|
@@ -604624,10 +604899,10 @@ function pasteText() {
|
|
|
604624
604899
|
try {
|
|
604625
604900
|
const platform7 = process.platform;
|
|
604626
604901
|
if (platform7 === "darwin") {
|
|
604627
|
-
return
|
|
604902
|
+
return execSync49("pbpaste", { timeout: 3e3, encoding: "utf8" }).trimEnd();
|
|
604628
604903
|
}
|
|
604629
604904
|
if (platform7 === "win32") {
|
|
604630
|
-
return
|
|
604905
|
+
return execSync49("powershell -command Get-Clipboard", {
|
|
604631
604906
|
timeout: 3e3,
|
|
604632
604907
|
encoding: "utf8"
|
|
604633
604908
|
}).trimEnd();
|
|
@@ -604638,7 +604913,7 @@ function pasteText() {
|
|
|
604638
604913
|
{ cmd: "wl-paste", args: [] }
|
|
604639
604914
|
]) {
|
|
604640
604915
|
try {
|
|
604641
|
-
const result =
|
|
604916
|
+
const result = execSync49(`${tool.cmd} ${tool.args.join(" ")}`, {
|
|
604642
604917
|
timeout: 3e3,
|
|
604643
604918
|
encoding: "utf8"
|
|
604644
604919
|
});
|
|
@@ -608200,7 +608475,7 @@ var init_render = __esm({
|
|
|
608200
608475
|
|
|
608201
608476
|
// packages/cli/src/tui/voice-session.ts
|
|
608202
608477
|
import { createServer as createServer4 } from "node:http";
|
|
608203
|
-
import { spawn as spawn26, execSync as
|
|
608478
|
+
import { spawn as spawn26, execSync as execSync50 } from "node:child_process";
|
|
608204
608479
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
608205
608480
|
function generateFrontendHTML() {
|
|
608206
608481
|
return `<!DOCTYPE html>
|
|
@@ -616496,7 +616771,7 @@ var init_braille_spinner = __esm({
|
|
|
616496
616771
|
});
|
|
616497
616772
|
|
|
616498
616773
|
// packages/cli/src/tui/disk-monitor.ts
|
|
616499
|
-
import { execFile as
|
|
616774
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
616500
616775
|
import { promisify as promisify6 } from "node:util";
|
|
616501
616776
|
function unavailableDiskMetrics(path12 = process.cwd()) {
|
|
616502
616777
|
return {
|
|
@@ -616545,7 +616820,7 @@ var execFileAsync5;
|
|
|
616545
616820
|
var init_disk_monitor = __esm({
|
|
616546
616821
|
"packages/cli/src/tui/disk-monitor.ts"() {
|
|
616547
616822
|
"use strict";
|
|
616548
|
-
execFileAsync5 = promisify6(
|
|
616823
|
+
execFileAsync5 = promisify6(execFile8);
|
|
616549
616824
|
}
|
|
616550
616825
|
});
|
|
616551
616826
|
|
|
@@ -622971,7 +623246,7 @@ __export(personaplex_exports, {
|
|
|
622971
623246
|
import { existsSync as existsSync118, writeFileSync as writeFileSync61, readFileSync as readFileSync95, mkdirSync as mkdirSync71, copyFileSync as copyFileSync5, readdirSync as readdirSync40, statSync as statSync44 } from "node:fs";
|
|
622972
623247
|
import { join as join132, dirname as dirname42 } from "node:path";
|
|
622973
623248
|
import { homedir as homedir42 } from "node:os";
|
|
622974
|
-
import { execSync as
|
|
623249
|
+
import { execSync as execSync51, spawn as spawn28 } from "node:child_process";
|
|
622975
623250
|
import { fileURLToPath as fileURLToPath18 } from "node:url";
|
|
622976
623251
|
function personaplexPythonEnv(extra = {}) {
|
|
622977
623252
|
const env2 = { ...process.env, ...extra };
|
|
@@ -623009,7 +623284,7 @@ function detectJetson() {
|
|
|
623009
623284
|
try {
|
|
623010
623285
|
const model = readFileSync95("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
|
|
623011
623286
|
if (/jetson|orin|tegra/i.test(model)) {
|
|
623012
|
-
const memInfo =
|
|
623287
|
+
const memInfo = execSync51("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
|
|
623013
623288
|
const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
|
|
623014
623289
|
return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
|
|
623015
623290
|
}
|
|
@@ -623043,7 +623318,7 @@ function detectPersonaPlexCapability() {
|
|
|
623043
623318
|
};
|
|
623044
623319
|
}
|
|
623045
623320
|
try {
|
|
623046
|
-
const nvsmi =
|
|
623321
|
+
const nvsmi = execSync51("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader,nounits", {
|
|
623047
623322
|
encoding: "utf8",
|
|
623048
623323
|
timeout: 5e3,
|
|
623049
623324
|
stdio: "pipe"
|
|
@@ -623055,7 +623330,7 @@ function detectPersonaPlexCapability() {
|
|
|
623055
623330
|
return { ...fail3(`GPU has ${vramGB.toFixed(1)}GB VRAM (need ≥8GB)`), gpuName: gpuName ?? "", vramGB };
|
|
623056
623331
|
}
|
|
623057
623332
|
try {
|
|
623058
|
-
|
|
623333
|
+
execSync51('python3 -c "import torch; assert torch.cuda.is_available()"', {
|
|
623059
623334
|
timeout: 1e4,
|
|
623060
623335
|
stdio: "pipe",
|
|
623061
623336
|
env: personaplexPythonEnv()
|
|
@@ -623129,7 +623404,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
623129
623404
|
mkdirSync71(PERSONAPLEX_DIR, { recursive: true });
|
|
623130
623405
|
let arch3 = "";
|
|
623131
623406
|
try {
|
|
623132
|
-
arch3 =
|
|
623407
|
+
arch3 = execSync51("uname -m", { encoding: "utf8", timeout: 3e3, stdio: "pipe" }).trim();
|
|
623133
623408
|
} catch {
|
|
623134
623409
|
}
|
|
623135
623410
|
const isAarch64 = arch3 === "aarch64" || arch3 === "arm64";
|
|
@@ -623150,16 +623425,16 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
623150
623425
|
log22("Checking system dependencies (libopus)...");
|
|
623151
623426
|
try {
|
|
623152
623427
|
if (process.platform === "linux") {
|
|
623153
|
-
|
|
623428
|
+
execSync51("dpkg -l libopus-dev 2>/dev/null || sudo apt-get install -y libopus-dev", { timeout: 3e4, stdio: "pipe" });
|
|
623154
623429
|
} else if (process.platform === "darwin") {
|
|
623155
|
-
|
|
623430
|
+
execSync51("brew list opus 2>/dev/null || brew install opus", { timeout: 6e4, stdio: "pipe" });
|
|
623156
623431
|
}
|
|
623157
623432
|
} catch {
|
|
623158
623433
|
}
|
|
623159
623434
|
if (isAarch64) {
|
|
623160
623435
|
log22("ARM64: Checking Rust toolchain for sphn build...");
|
|
623161
623436
|
try {
|
|
623162
|
-
|
|
623437
|
+
execSync51("rustc --version", { timeout: 5e3, stdio: "pipe" });
|
|
623163
623438
|
} catch {
|
|
623164
623439
|
log22("ARM64: Installing Rust toolchain (needed for sphn audio codec)...");
|
|
623165
623440
|
try {
|
|
@@ -623232,7 +623507,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
623232
623507
|
}
|
|
623233
623508
|
const serverPy = join132(venvDir, "lib", `python3.${process.versions.node ? "12" : "10"}`, "site-packages", "moshi", "server.py");
|
|
623234
623509
|
try {
|
|
623235
|
-
const sitePackages =
|
|
623510
|
+
const sitePackages = execSync51(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
|
|
623236
623511
|
encoding: "utf8",
|
|
623237
623512
|
timeout: 5e3,
|
|
623238
623513
|
stdio: "pipe",
|
|
@@ -623250,7 +623525,7 @@ async function installPersonaPlex(onInfo, weightTier) {
|
|
|
623250
623525
|
} catch {
|
|
623251
623526
|
}
|
|
623252
623527
|
try {
|
|
623253
|
-
const sitePackages =
|
|
623528
|
+
const sitePackages = execSync51(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
|
|
623254
623529
|
encoding: "utf8",
|
|
623255
623530
|
timeout: 5e3,
|
|
623256
623531
|
stdio: "pipe",
|
|
@@ -623355,7 +623630,7 @@ $2if filename.endswith(".safetensors"):`
|
|
|
623355
623630
|
} catch {
|
|
623356
623631
|
}
|
|
623357
623632
|
try {
|
|
623358
|
-
const sitePackages2 =
|
|
623633
|
+
const sitePackages2 = execSync51(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
|
|
623359
623634
|
encoding: "utf8",
|
|
623360
623635
|
timeout: 5e3,
|
|
623361
623636
|
stdio: "pipe",
|
|
@@ -623491,14 +623766,14 @@ async function startPersonaPlexDaemon(onInfo) {
|
|
|
623491
623766
|
if (tier === "nf4-distilled") {
|
|
623492
623767
|
log22(`Weight tier: ${tier} — distilled NF4 (90% token match, ${repoInfo.sizeGB}GB)...`);
|
|
623493
623768
|
try {
|
|
623494
|
-
const weightPath =
|
|
623769
|
+
const weightPath = execSync51(
|
|
623495
623770
|
`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}', token=False))"`,
|
|
623496
623771
|
{ encoding: "utf8", timeout: 6e4, stdio: "pipe", env: personaplexPythonEnv() }
|
|
623497
623772
|
).trim();
|
|
623498
623773
|
if (existsSync118(weightPath)) {
|
|
623499
623774
|
if (!existsSync118(cachedBf16)) {
|
|
623500
623775
|
log22("Converting .pt checkpoint to safetensors (one-time)...");
|
|
623501
|
-
|
|
623776
|
+
execSync51(
|
|
623502
623777
|
`"${venvPython2}" -c "
|
|
623503
623778
|
import torch; from safetensors.torch import save_file
|
|
623504
623779
|
state = torch.load('${weightPath}', map_location='cpu', weights_only=True)
|
|
@@ -623530,13 +623805,13 @@ print('Converted')
|
|
|
623530
623805
|
}
|
|
623531
623806
|
}
|
|
623532
623807
|
try {
|
|
623533
|
-
const weightPath =
|
|
623808
|
+
const weightPath = execSync51(
|
|
623534
623809
|
`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}'${repoInfo.needsToken ? "" : ", token=False"}))"`,
|
|
623535
623810
|
{ encoding: "utf8", timeout: 3e4, stdio: "pipe", env: personaplexPythonEnv() }
|
|
623536
623811
|
).trim();
|
|
623537
623812
|
if (existsSync118(dequantScript) && existsSync118(weightPath)) {
|
|
623538
623813
|
try {
|
|
623539
|
-
|
|
623814
|
+
execSync51(
|
|
623540
623815
|
`"${venvPython2}" "${dequantScript}" --input "${weightPath}" --output "${cachedBf16}"`,
|
|
623541
623816
|
{ timeout: 3e5, stdio: "pipe", env: personaplexPythonEnv() }
|
|
623542
623817
|
);
|
|
@@ -623549,7 +623824,7 @@ print('Converted')
|
|
|
623549
623824
|
}
|
|
623550
623825
|
}
|
|
623551
623826
|
try {
|
|
623552
|
-
const mimiPath =
|
|
623827
|
+
const mimiPath = execSync51(
|
|
623553
623828
|
`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer-e351c8d8-checkpoint125.safetensors', token=False))"`,
|
|
623554
623829
|
{ encoding: "utf8", timeout: 3e4, stdio: "pipe", env: personaplexPythonEnv() }
|
|
623555
623830
|
).trim();
|
|
@@ -623557,7 +623832,7 @@ print('Converted')
|
|
|
623557
623832
|
} catch {
|
|
623558
623833
|
}
|
|
623559
623834
|
try {
|
|
623560
|
-
const tokPath =
|
|
623835
|
+
const tokPath = execSync51(
|
|
623561
623836
|
`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer_spm_32k_3.model', token=False))"`,
|
|
623562
623837
|
{ encoding: "utf8", timeout: 3e4, stdio: "pipe", env: personaplexPythonEnv() }
|
|
623563
623838
|
).trim();
|
|
@@ -623581,7 +623856,7 @@ print('Converted')
|
|
|
623581
623856
|
}
|
|
623582
623857
|
if (!ollamaModel) ollamaModel = "qwen3.5:4b";
|
|
623583
623858
|
try {
|
|
623584
|
-
const ollamaCheck =
|
|
623859
|
+
const ollamaCheck = execSync51("curl -s http://localhost:11434/api/tags", {
|
|
623585
623860
|
timeout: 3e3,
|
|
623586
623861
|
stdio: "pipe",
|
|
623587
623862
|
encoding: "utf8"
|
|
@@ -623655,7 +623930,7 @@ print('Converted')
|
|
|
623655
623930
|
return null;
|
|
623656
623931
|
}
|
|
623657
623932
|
try {
|
|
623658
|
-
|
|
623933
|
+
execSync51(`curl -sk -o /dev/null -w "%{http_code}" https://127.0.0.1:${PORT}/`, {
|
|
623659
623934
|
timeout: 3e3,
|
|
623660
623935
|
stdio: "pipe",
|
|
623661
623936
|
encoding: "utf8"
|
|
@@ -623678,7 +623953,7 @@ function stopPersonaPlex() {
|
|
|
623678
623953
|
if (isNaN(pid) || pid <= 0) return;
|
|
623679
623954
|
try {
|
|
623680
623955
|
if (process.platform === "win32") {
|
|
623681
|
-
|
|
623956
|
+
execSync51(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
|
|
623682
623957
|
} else {
|
|
623683
623958
|
process.kill(pid, "SIGTERM");
|
|
623684
623959
|
}
|
|
@@ -623989,7 +624264,7 @@ __export(setup_exports, {
|
|
|
623989
624264
|
updateOllama: () => updateOllama
|
|
623990
624265
|
});
|
|
623991
624266
|
import * as readline from "node:readline";
|
|
623992
|
-
import { execSync as
|
|
624267
|
+
import { execSync as execSync52, spawn as spawn29, exec as exec5 } from "node:child_process";
|
|
623993
624268
|
import { promisify as promisify7 } from "node:util";
|
|
623994
624269
|
import { existsSync as existsSync119, writeFileSync as writeFileSync62, readFileSync as readFileSync96, appendFileSync as appendFileSync12, mkdirSync as mkdirSync72 } from "node:fs";
|
|
623995
624270
|
import { join as join133 } from "node:path";
|
|
@@ -624112,7 +624387,7 @@ function detectSystemSpecs() {
|
|
|
624112
624387
|
let availableVramGB = 0;
|
|
624113
624388
|
let gpuName = "";
|
|
624114
624389
|
try {
|
|
624115
|
-
const memInfo =
|
|
624390
|
+
const memInfo = execSync52("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
|
|
624116
624391
|
encoding: "utf8",
|
|
624117
624392
|
timeout: 5e3
|
|
624118
624393
|
});
|
|
@@ -624132,7 +624407,7 @@ function detectSystemSpecs() {
|
|
|
624132
624407
|
} catch {
|
|
624133
624408
|
}
|
|
624134
624409
|
try {
|
|
624135
|
-
const nvidiaSmi =
|
|
624410
|
+
const nvidiaSmi = execSync52(
|
|
624136
624411
|
"nvidia-smi --query-gpu=memory.total,memory.free,name --format=csv,noheader,nounits 2>/dev/null",
|
|
624137
624412
|
{ encoding: "utf8", timeout: 5e3 }
|
|
624138
624413
|
);
|
|
@@ -624144,7 +624419,7 @@ function detectSystemSpecs() {
|
|
|
624144
624419
|
}
|
|
624145
624420
|
if (gpuVramGB === 0) {
|
|
624146
624421
|
try {
|
|
624147
|
-
const rocmSmi =
|
|
624422
|
+
const rocmSmi = execSync52(
|
|
624148
624423
|
"rocm-smi --showmeminfo vram --csv 2>/dev/null",
|
|
624149
624424
|
{ encoding: "utf8", timeout: 5e3 }
|
|
624150
624425
|
);
|
|
@@ -624400,7 +624675,7 @@ function ensureCurl() {
|
|
|
624400
624675
|
for (const s2 of strategies) {
|
|
624401
624676
|
if (hasCmd(s2.check)) {
|
|
624402
624677
|
try {
|
|
624403
|
-
|
|
624678
|
+
execSync52(s2.install, { stdio: "inherit", timeout: 12e4 });
|
|
624404
624679
|
if (hasCmd("curl")) {
|
|
624405
624680
|
process.stdout.write(` ${c3.green("✔")} curl installed via ${s2.label}.
|
|
624406
624681
|
`);
|
|
@@ -624414,7 +624689,7 @@ function ensureCurl() {
|
|
|
624414
624689
|
}
|
|
624415
624690
|
if (plat === "darwin") {
|
|
624416
624691
|
try {
|
|
624417
|
-
|
|
624692
|
+
execSync52("xcode-select --install", { stdio: "inherit", timeout: 3e5 });
|
|
624418
624693
|
if (hasCmd("curl")) return true;
|
|
624419
624694
|
} catch {
|
|
624420
624695
|
}
|
|
@@ -624428,7 +624703,7 @@ function ensureZstd() {
|
|
|
624428
624703
|
if (process.platform === "darwin") {
|
|
624429
624704
|
if (!hasCmd("brew")) return false;
|
|
624430
624705
|
try {
|
|
624431
|
-
|
|
624706
|
+
execSync52("brew install zstd", { stdio: "inherit", timeout: 12e4 });
|
|
624432
624707
|
return hasCmd("zstd");
|
|
624433
624708
|
} catch {
|
|
624434
624709
|
return false;
|
|
@@ -624470,7 +624745,7 @@ function ensureZstd() {
|
|
|
624470
624745
|
candidates.push({ cmd: installCmd, env: process.env });
|
|
624471
624746
|
for (const cand of candidates) {
|
|
624472
624747
|
try {
|
|
624473
|
-
|
|
624748
|
+
execSync52(cand.cmd, {
|
|
624474
624749
|
stdio: cand.stdio ?? ["ignore", "inherit", "pipe"],
|
|
624475
624750
|
env: cand.env,
|
|
624476
624751
|
timeout: 18e4
|
|
@@ -624507,7 +624782,7 @@ function detectAskpassHelper() {
|
|
|
624507
624782
|
for (const name10 of ["ssh-askpass", "ksshaskpass", "x11-ssh-askpass"]) {
|
|
624508
624783
|
if (hasCmd(name10)) {
|
|
624509
624784
|
try {
|
|
624510
|
-
const p2 =
|
|
624785
|
+
const p2 = execSync52(`command -v ${name10}`, { encoding: "utf8" }).trim();
|
|
624511
624786
|
if (p2) return p2;
|
|
624512
624787
|
} catch {
|
|
624513
624788
|
}
|
|
@@ -624550,7 +624825,7 @@ osascript -e 'Tell application "System Events" to display dialog "Omnius needs a
|
|
|
624550
624825
|
}
|
|
624551
624826
|
try {
|
|
624552
624827
|
writeFileSync62(helperPath, body, { mode: 448 });
|
|
624553
|
-
|
|
624828
|
+
execSync52(`chmod 700 "${helperPath}"`, { stdio: "ignore" });
|
|
624554
624829
|
return helperPath;
|
|
624555
624830
|
} catch {
|
|
624556
624831
|
return null;
|
|
@@ -624619,7 +624894,7 @@ function runElevatedCommand(command, opts = {}) {
|
|
|
624619
624894
|
let lastErr = null;
|
|
624620
624895
|
for (const cand of candidates) {
|
|
624621
624896
|
try {
|
|
624622
|
-
|
|
624897
|
+
execSync52(cand.cmd, {
|
|
624623
624898
|
stdio: cand.stdio ?? ["ignore", "pipe", "pipe"],
|
|
624624
624899
|
env: cand.env,
|
|
624625
624900
|
timeout: timeout2
|
|
@@ -624656,7 +624931,7 @@ function runOllamaInstallScript() {
|
|
|
624656
624931
|
`);
|
|
624657
624932
|
}
|
|
624658
624933
|
const runOnce = () => {
|
|
624659
|
-
|
|
624934
|
+
execSync52(elevated.cmd, {
|
|
624660
624935
|
stdio: elevated.mode === "terminal" ? "inherit" : ["ignore", "inherit", "pipe"],
|
|
624661
624936
|
env: elevated.env,
|
|
624662
624937
|
timeout: 6e5
|
|
@@ -624735,7 +625010,7 @@ async function installOllamaMac(_rl) {
|
|
|
624735
625010
|
|
|
624736
625011
|
`);
|
|
624737
625012
|
try {
|
|
624738
|
-
|
|
625013
|
+
execSync52(
|
|
624739
625014
|
'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',
|
|
624740
625015
|
{ stdio: "inherit", timeout: 6e5 }
|
|
624741
625016
|
);
|
|
@@ -624771,7 +625046,7 @@ async function installOllamaMac(_rl) {
|
|
|
624771
625046
|
|
|
624772
625047
|
`);
|
|
624773
625048
|
try {
|
|
624774
|
-
|
|
625049
|
+
execSync52("brew install ollama", {
|
|
624775
625050
|
stdio: "inherit",
|
|
624776
625051
|
timeout: 3e5
|
|
624777
625052
|
});
|
|
@@ -624798,7 +625073,7 @@ function installOllamaWindows() {
|
|
|
624798
625073
|
|
|
624799
625074
|
`);
|
|
624800
625075
|
try {
|
|
624801
|
-
|
|
625076
|
+
execSync52('powershell -Command "irm https://ollama.com/install.ps1 | iex"', {
|
|
624802
625077
|
stdio: "inherit",
|
|
624803
625078
|
timeout: 3e5
|
|
624804
625079
|
});
|
|
@@ -624878,7 +625153,7 @@ async function ensureOllamaRunning(backendUrl2, rl) {
|
|
|
624878
625153
|
}
|
|
624879
625154
|
function getOllamaVersion() {
|
|
624880
625155
|
try {
|
|
624881
|
-
const out =
|
|
625156
|
+
const out = execSync52("ollama --version", { encoding: "utf8", timeout: 5e3 });
|
|
624882
625157
|
const match = out.match(/(\d+\.\d+\.\d+)/);
|
|
624883
625158
|
return match ? match[1] : null;
|
|
624884
625159
|
} catch {
|
|
@@ -624935,7 +625210,7 @@ function updateOllama() {
|
|
|
624935
625210
|
}
|
|
624936
625211
|
function pullModelWithAutoUpdate(tag) {
|
|
624937
625212
|
try {
|
|
624938
|
-
|
|
625213
|
+
execSync52(`ollama pull ${tag}`, {
|
|
624939
625214
|
stdio: "inherit",
|
|
624940
625215
|
timeout: 36e5
|
|
624941
625216
|
// 1 hour max
|
|
@@ -624962,7 +625237,7 @@ function pullModelWithAutoUpdate(tag) {
|
|
|
624962
625237
|
process.stdout.write(` ${c3.cyan("●")} Retrying pull of ${c3.bold(tag)}...
|
|
624963
625238
|
|
|
624964
625239
|
`);
|
|
624965
|
-
|
|
625240
|
+
execSync52(`ollama pull ${tag}`, {
|
|
624966
625241
|
stdio: "inherit",
|
|
624967
625242
|
timeout: 36e5
|
|
624968
625243
|
});
|
|
@@ -625051,7 +625326,7 @@ function ensurePython3() {
|
|
|
625051
625326
|
if (plat === "darwin") {
|
|
625052
625327
|
if (hasCmd("brew")) {
|
|
625053
625328
|
try {
|
|
625054
|
-
|
|
625329
|
+
execSync52("brew install python3", { stdio: "inherit", timeout: 3e5 });
|
|
625055
625330
|
if (hasCmd("python3")) {
|
|
625056
625331
|
process.stdout.write(` ${c3.green("✔")} Python3 installed via Homebrew.
|
|
625057
625332
|
`);
|
|
@@ -625064,7 +625339,7 @@ function ensurePython3() {
|
|
|
625064
625339
|
for (const s2 of strategies) {
|
|
625065
625340
|
if (hasCmd(s2.check)) {
|
|
625066
625341
|
try {
|
|
625067
|
-
|
|
625342
|
+
execSync52(s2.install, { stdio: "inherit", timeout: 12e4 });
|
|
625068
625343
|
if (hasCmd("python3") || hasCmd("python")) {
|
|
625069
625344
|
process.stdout.write(` ${c3.green("✔")} Python3 installed via ${s2.label}.
|
|
625070
625345
|
`);
|
|
@@ -625080,11 +625355,11 @@ function ensurePython3() {
|
|
|
625080
625355
|
}
|
|
625081
625356
|
function checkPythonVenv() {
|
|
625082
625357
|
try {
|
|
625083
|
-
|
|
625358
|
+
execSync52("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
|
|
625084
625359
|
return true;
|
|
625085
625360
|
} catch {
|
|
625086
625361
|
try {
|
|
625087
|
-
|
|
625362
|
+
execSync52("python -m venv --help", { stdio: "pipe", timeout: 5e3 });
|
|
625088
625363
|
return true;
|
|
625089
625364
|
} catch {
|
|
625090
625365
|
return false;
|
|
@@ -625103,7 +625378,7 @@ function ensurePythonVenv() {
|
|
|
625103
625378
|
for (const s2 of strategies) {
|
|
625104
625379
|
if (hasCmd(s2.check)) {
|
|
625105
625380
|
try {
|
|
625106
|
-
|
|
625381
|
+
execSync52(s2.install, { stdio: "inherit", timeout: 12e4 });
|
|
625107
625382
|
if (checkPythonVenv()) {
|
|
625108
625383
|
process.stdout.write(` ${c3.green("✔")} python3-venv installed via ${s2.label}.
|
|
625109
625384
|
`);
|
|
@@ -625710,7 +625985,7 @@ ${c3.cyan(OMNIUS_FIRST_RUN_BANNER)}
|
|
|
625710
625985
|
for (let i2 = 0; i2 < modelfileCandidates.length; i2++) {
|
|
625711
625986
|
writeFileSync62(modelfilePath, modelfileCandidates[i2] + "\n", "utf8");
|
|
625712
625987
|
try {
|
|
625713
|
-
|
|
625988
|
+
execSync52(`ollama create ${customName} -f ${modelfilePath}`, {
|
|
625714
625989
|
stdio: "pipe",
|
|
625715
625990
|
timeout: 12e4
|
|
625716
625991
|
});
|
|
@@ -625772,7 +626047,7 @@ function isFirstRun() {
|
|
|
625772
626047
|
function hasCmd(cmd) {
|
|
625773
626048
|
try {
|
|
625774
626049
|
const whichCmd = process.platform === "win32" ? `where ${cmd}` : `which ${cmd}`;
|
|
625775
|
-
|
|
626050
|
+
execSync52(whichCmd, { stdio: "pipe", timeout: 3e3 });
|
|
625776
626051
|
return true;
|
|
625777
626052
|
} catch {
|
|
625778
626053
|
return false;
|
|
@@ -625784,7 +626059,7 @@ function detectPkgManager() {
|
|
|
625784
626059
|
if (hasCmd("choco")) return "choco";
|
|
625785
626060
|
if (hasCmd("winget")) return "winget";
|
|
625786
626061
|
try {
|
|
625787
|
-
|
|
626062
|
+
execSync52(
|
|
625788
626063
|
`powershell -NoProfile -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"`,
|
|
625789
626064
|
{ stdio: "pipe", timeout: 12e4 }
|
|
625790
626065
|
);
|
|
@@ -625796,7 +626071,7 @@ function detectPkgManager() {
|
|
|
625796
626071
|
if (plat === "darwin") {
|
|
625797
626072
|
if (hasCmd("brew")) return "brew";
|
|
625798
626073
|
try {
|
|
625799
|
-
|
|
626074
|
+
execSync52(
|
|
625800
626075
|
'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',
|
|
625801
626076
|
{ stdio: "pipe", timeout: 3e5, env: { ...process.env, NONINTERACTIVE: "1" } }
|
|
625802
626077
|
);
|
|
@@ -625816,7 +626091,7 @@ function getVenvDir2() {
|
|
|
625816
626091
|
}
|
|
625817
626092
|
function hasVenvModule() {
|
|
625818
626093
|
try {
|
|
625819
|
-
|
|
626094
|
+
execSync52('python3 -c "import ensurepip, venv"', {
|
|
625820
626095
|
stdio: "pipe",
|
|
625821
626096
|
timeout: 5e3
|
|
625822
626097
|
});
|
|
@@ -625833,17 +626108,17 @@ function ensureVenv2(log22) {
|
|
|
625833
626108
|
const pythonCmd = isWin2 ? "python" : "python3";
|
|
625834
626109
|
if (existsSync119(pipPath)) {
|
|
625835
626110
|
try {
|
|
625836
|
-
|
|
626111
|
+
execSync52(`"${venvPyPath}" -m pip --version`, { stdio: "pipe", timeout: 1e4 });
|
|
625837
626112
|
return venvDir;
|
|
625838
626113
|
} catch {
|
|
625839
626114
|
log22("Python venv pip is broken — repairing...");
|
|
625840
626115
|
try {
|
|
625841
|
-
|
|
626116
|
+
execSync52(`"${venvPyPath}" -m ensurepip --upgrade`, { stdio: "pipe", timeout: 3e4 });
|
|
625842
626117
|
log22("pip repaired via ensurepip.");
|
|
625843
626118
|
return venvDir;
|
|
625844
626119
|
} catch {
|
|
625845
626120
|
try {
|
|
625846
|
-
|
|
626121
|
+
execSync52(`curl -sS https://bootstrap.pypa.io/get-pip.py | "${venvPyPath}"`, { stdio: "pipe", timeout: 6e4 });
|
|
625847
626122
|
log22("pip repaired via get-pip.py.");
|
|
625848
626123
|
return venvDir;
|
|
625849
626124
|
} catch {
|
|
@@ -625864,17 +626139,17 @@ function ensureVenv2(log22) {
|
|
|
625864
626139
|
try {
|
|
625865
626140
|
mkdirSync72(join133(homedir43(), ".omnius"), { recursive: true });
|
|
625866
626141
|
const pyCmd = hasCmd(pythonCmd) ? pythonCmd : "python3";
|
|
625867
|
-
|
|
626142
|
+
execSync52(`${pyCmd} -m venv --clear "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
|
|
625868
626143
|
try {
|
|
625869
|
-
|
|
626144
|
+
execSync52(`"${venvPyPath}" -m pip --version`, { stdio: "pipe", timeout: 1e4 });
|
|
625870
626145
|
} catch {
|
|
625871
626146
|
try {
|
|
625872
|
-
|
|
626147
|
+
execSync52(`"${venvPyPath}" -m ensurepip --upgrade`, { stdio: "pipe", timeout: 3e4 });
|
|
625873
626148
|
} catch {
|
|
625874
|
-
|
|
626149
|
+
execSync52(`curl -sS https://bootstrap.pypa.io/get-pip.py | "${venvPyPath}"`, { stdio: "pipe", timeout: 6e4 });
|
|
625875
626150
|
}
|
|
625876
626151
|
}
|
|
625877
|
-
|
|
626152
|
+
execSync52(`"${venvPyPath}" -m pip install --upgrade pip`, {
|
|
625878
626153
|
stdio: "pipe",
|
|
625879
626154
|
timeout: 6e4
|
|
625880
626155
|
});
|
|
@@ -625887,7 +626162,7 @@ function ensureVenv2(log22) {
|
|
|
625887
626162
|
}
|
|
625888
626163
|
function trySudoPasswordless(cmd, timeoutMs = 12e4) {
|
|
625889
626164
|
try {
|
|
625890
|
-
|
|
626165
|
+
execSync52(`sudo -n ${cmd}`, {
|
|
625891
626166
|
stdio: "pipe",
|
|
625892
626167
|
timeout: timeoutMs,
|
|
625893
626168
|
env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
|
|
@@ -625900,7 +626175,7 @@ function trySudoPasswordless(cmd, timeoutMs = 12e4) {
|
|
|
625900
626175
|
function runWithSudo(cmd, password, timeoutMs = 12e4) {
|
|
625901
626176
|
try {
|
|
625902
626177
|
const escaped = cmd.replace(/'/g, "'\\''");
|
|
625903
|
-
|
|
626178
|
+
execSync52(`sudo -S bash -c '${escaped}'`, {
|
|
625904
626179
|
input: password + "\n",
|
|
625905
626180
|
stdio: ["pipe", "pipe", "pipe"],
|
|
625906
626181
|
timeout: timeoutMs,
|
|
@@ -625942,7 +626217,7 @@ async function sudoInstall(cmd, getSudoPassword, log22, cachedPasswordRef, timeo
|
|
|
625942
626217
|
try {
|
|
625943
626218
|
const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
|
|
625944
626219
|
const escaped = cmd.replace(/'/g, "'\\''");
|
|
625945
|
-
|
|
626220
|
+
execSync52(isRoot ? `bash -c '${escaped}'` : `sudo bash -c '${escaped}'`, {
|
|
625946
626221
|
stdio: "inherit",
|
|
625947
626222
|
timeout: timeoutMs,
|
|
625948
626223
|
env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
|
|
@@ -626008,7 +626283,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626008
626283
|
let winNeedsElevation = false;
|
|
626009
626284
|
if (process.platform === "win32") {
|
|
626010
626285
|
try {
|
|
626011
|
-
|
|
626286
|
+
execSync52("net session", { stdio: "pipe", timeout: 3e3 });
|
|
626012
626287
|
} catch {
|
|
626013
626288
|
winNeedsElevation = true;
|
|
626014
626289
|
log22(`Installing ${labels} via ${pm2} (requires admin — UAC prompt will appear)...`);
|
|
@@ -626055,12 +626330,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626055
626330
|
if (needsSudo) {
|
|
626056
626331
|
await sudoInstall(installCmd, getPassword, log22, cachedPasswordRef, 18e4);
|
|
626057
626332
|
} else if (winNeedsElevation) {
|
|
626058
|
-
|
|
626333
|
+
execSync52(
|
|
626059
626334
|
`powershell -NoProfile -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c ${installCmd.replace(/'/g, "''")}' -Verb RunAs -Wait"`,
|
|
626060
626335
|
{ stdio: "pipe", timeout: 18e4 }
|
|
626061
626336
|
);
|
|
626062
626337
|
} else {
|
|
626063
|
-
|
|
626338
|
+
execSync52(installCmd, { stdio: "pipe", timeout: 18e4 });
|
|
626064
626339
|
}
|
|
626065
626340
|
} catch (e2) {
|
|
626066
626341
|
const stderr = e2.stderr?.toString?.()?.trim?.() ?? "";
|
|
@@ -626073,7 +626348,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626073
626348
|
if (!hasCmd(d2.binary) && pipPkg) {
|
|
626074
626349
|
try {
|
|
626075
626350
|
const pipCmd = process.platform === "win32" ? `pip install ${pipPkg}` : `pip3 install ${pipPkg}`;
|
|
626076
|
-
|
|
626351
|
+
execSync52(pipCmd, { stdio: "pipe", timeout: 12e4 });
|
|
626077
626352
|
lastError = "";
|
|
626078
626353
|
} catch (e2) {
|
|
626079
626354
|
const stderr = e2.stderr?.toString?.()?.trim?.() ?? "";
|
|
@@ -626085,7 +626360,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626085
626360
|
}
|
|
626086
626361
|
if (process.platform === "win32" && !hasCmd(d2.binary)) {
|
|
626087
626362
|
try {
|
|
626088
|
-
const freshPath =
|
|
626363
|
+
const freshPath = execSync52(
|
|
626089
626364
|
`powershell -NoProfile -Command "[System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')"`,
|
|
626090
626365
|
{ encoding: "utf8", timeout: 5e3, stdio: "pipe" }
|
|
626091
626366
|
).trim();
|
|
@@ -626131,7 +626406,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626131
626406
|
const venvCmds = {
|
|
626132
626407
|
apt: () => {
|
|
626133
626408
|
try {
|
|
626134
|
-
const pyVer =
|
|
626409
|
+
const pyVer = execSync52(
|
|
626135
626410
|
`python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"`,
|
|
626136
626411
|
{ encoding: "utf8", stdio: "pipe", timeout: 5e3 }
|
|
626137
626412
|
).trim();
|
|
@@ -626163,12 +626438,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626163
626438
|
const venvPip2 = join133(venvBin, "pip");
|
|
626164
626439
|
log22("Installing moondream-station in ~/.omnius/venv...");
|
|
626165
626440
|
try {
|
|
626166
|
-
|
|
626441
|
+
execSync52(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
|
|
626167
626442
|
if (existsSync119(venvMoondream)) {
|
|
626168
626443
|
log22("moondream-station installed successfully.");
|
|
626169
626444
|
} else {
|
|
626170
626445
|
try {
|
|
626171
|
-
const check =
|
|
626446
|
+
const check = execSync52(`"${venvPip2}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
|
|
626172
626447
|
if (check.includes("moondream")) {
|
|
626173
626448
|
log22("moondream-station package installed.");
|
|
626174
626449
|
}
|
|
@@ -626185,7 +626460,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626185
626460
|
const venvPip2 = join133(venvBin, isWin2 ? "pip.exe" : "pip");
|
|
626186
626461
|
let ocrStackInstalled = false;
|
|
626187
626462
|
try {
|
|
626188
|
-
|
|
626463
|
+
execSync52(
|
|
626189
626464
|
`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`,
|
|
626190
626465
|
{ stdio: "pipe", timeout: 1e4 }
|
|
626191
626466
|
);
|
|
@@ -626196,12 +626471,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
626196
626471
|
const ocrPackages = "pytesseract Pillow opencv-python-headless numpy";
|
|
626197
626472
|
log22("Installing OCR Python stack (pytesseract, OpenCV, Pillow, numpy)...");
|
|
626198
626473
|
try {
|
|
626199
|
-
|
|
626474
|
+
execSync52(
|
|
626200
626475
|
`"${venvPip2}" install ${ocrPackages}`,
|
|
626201
626476
|
{ stdio: "pipe", timeout: 3e5 }
|
|
626202
626477
|
);
|
|
626203
626478
|
try {
|
|
626204
|
-
|
|
626479
|
+
execSync52(
|
|
626205
626480
|
`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`,
|
|
626206
626481
|
{ stdio: "pipe", timeout: 1e4 }
|
|
626207
626482
|
);
|
|
@@ -626237,7 +626512,7 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
626237
626512
|
const archMap = { x64: "amd64", arm64: "arm64", arm: "arm" };
|
|
626238
626513
|
const cfArch = archMap[arch3] ?? "amd64";
|
|
626239
626514
|
try {
|
|
626240
|
-
|
|
626515
|
+
execSync52(
|
|
626241
626516
|
`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${homedir43()}/.local/bin" && mv /tmp/cloudflared "${homedir43()}/.local/bin/cloudflared"`,
|
|
626242
626517
|
{ stdio: "pipe", timeout: 6e4 }
|
|
626243
626518
|
);
|
|
@@ -626253,7 +626528,7 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
626253
626528
|
try {
|
|
626254
626529
|
const terminalElevation = process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY;
|
|
626255
626530
|
const sudoMove = terminalElevation ? `sudo mv /tmp/cloudflared /usr/local/bin/cloudflared` : `sudo mv /tmp/cloudflared /usr/local/bin/cloudflared 2>/dev/null`;
|
|
626256
|
-
|
|
626531
|
+
execSync52(
|
|
626257
626532
|
`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && ` + sudoMove,
|
|
626258
626533
|
{ stdio: terminalElevation ? "inherit" : "pipe", timeout: 6e4 }
|
|
626259
626534
|
);
|
|
@@ -626265,7 +626540,7 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
626265
626540
|
}
|
|
626266
626541
|
} else if (os9 === "darwin") {
|
|
626267
626542
|
try {
|
|
626268
|
-
|
|
626543
|
+
execSync52("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
|
|
626269
626544
|
if (hasCmd("cloudflared")) {
|
|
626270
626545
|
log22("cloudflared installed via Homebrew.");
|
|
626271
626546
|
return true;
|
|
@@ -626462,7 +626737,7 @@ function createExpandedVariantNamed(targetModel, baseModel, specs, sizeGB, kvByt
|
|
|
626462
626737
|
for (let i2 = 0; i2 < modelfileCandidates.length; i2++) {
|
|
626463
626738
|
writeFileSync62(modelfilePath, modelfileCandidates[i2] + "\n", "utf8");
|
|
626464
626739
|
try {
|
|
626465
|
-
|
|
626740
|
+
execSync52(`ollama create ${targetModel} -f ${modelfilePath}`, {
|
|
626466
626741
|
stdio: "pipe",
|
|
626467
626742
|
timeout: 12e4
|
|
626468
626743
|
});
|
|
@@ -626748,7 +627023,7 @@ async function repairAllExpandedVariants(backendUrl2) {
|
|
|
626748
627023
|
}
|
|
626749
627024
|
async function ensureNeovim() {
|
|
626750
627025
|
try {
|
|
626751
|
-
const nvimPath =
|
|
627026
|
+
const nvimPath = execSync52("which nvim 2>/dev/null || where nvim 2>nul", {
|
|
626752
627027
|
encoding: "utf8",
|
|
626753
627028
|
stdio: "pipe",
|
|
626754
627029
|
timeout: 5e3
|
|
@@ -626769,14 +627044,14 @@ async function ensureNeovim() {
|
|
|
626769
627044
|
const url = `https://github.com/neovim/neovim/releases/latest/download/${appImageName}`;
|
|
626770
627045
|
console.log(` Downloading Neovim (${appImageName})...`);
|
|
626771
627046
|
try {
|
|
626772
|
-
|
|
626773
|
-
|
|
627047
|
+
execSync52(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
|
|
627048
|
+
execSync52(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
|
|
626774
627049
|
} catch (err) {
|
|
626775
627050
|
console.log(` Failed to download Neovim: ${err instanceof Error ? err.message : String(err)}`);
|
|
626776
627051
|
return null;
|
|
626777
627052
|
}
|
|
626778
627053
|
try {
|
|
626779
|
-
const ver =
|
|
627054
|
+
const ver = execSync52(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
|
|
626780
627055
|
console.log(` Installed: ${ver}`);
|
|
626781
627056
|
} catch {
|
|
626782
627057
|
console.log(" Warning: nvim binary downloaded but may not work (missing FUSE? Try: nvim --appimage-extract)");
|
|
@@ -626791,8 +627066,8 @@ async function ensureNeovim() {
|
|
|
626791
627066
|
if (hasCmd("brew")) {
|
|
626792
627067
|
console.log(" Installing Neovim via Homebrew...");
|
|
626793
627068
|
try {
|
|
626794
|
-
|
|
626795
|
-
const nvimPath =
|
|
627069
|
+
execSync52("brew install neovim", { stdio: "inherit", timeout: 12e4 });
|
|
627070
|
+
const nvimPath = execSync52("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
|
|
626796
627071
|
return nvimPath || null;
|
|
626797
627072
|
} catch {
|
|
626798
627073
|
console.log(" brew install neovim failed.");
|
|
@@ -626806,7 +627081,7 @@ async function ensureNeovim() {
|
|
|
626806
627081
|
if (hasCmd("choco")) {
|
|
626807
627082
|
console.log(" Installing Neovim via Chocolatey...");
|
|
626808
627083
|
try {
|
|
626809
|
-
|
|
627084
|
+
execSync52("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
|
|
626810
627085
|
return "nvim";
|
|
626811
627086
|
} catch {
|
|
626812
627087
|
console.log(" choco install neovim failed.");
|
|
@@ -626815,7 +627090,7 @@ async function ensureNeovim() {
|
|
|
626815
627090
|
if (hasCmd("winget")) {
|
|
626816
627091
|
console.log(" Installing Neovim via winget...");
|
|
626817
627092
|
try {
|
|
626818
|
-
|
|
627093
|
+
execSync52("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
|
|
626819
627094
|
stdio: "inherit",
|
|
626820
627095
|
timeout: 12e4
|
|
626821
627096
|
});
|
|
@@ -630884,7 +631159,7 @@ var init_audio_waveform = __esm({
|
|
|
630884
631159
|
import { existsSync as existsSync125, unlinkSync as unlinkSync24 } from "node:fs";
|
|
630885
631160
|
import { tmpdir as tmpdir20 } from "node:os";
|
|
630886
631161
|
import { join as join137 } from "node:path";
|
|
630887
|
-
import { execSync as
|
|
631162
|
+
import { execSync as execSync53 } from "node:child_process";
|
|
630888
631163
|
function isNeovimActive() {
|
|
630889
631164
|
return _state2 !== null && !_state2.cleanedUp;
|
|
630890
631165
|
}
|
|
@@ -630901,7 +631176,7 @@ async function startNeovimMode(opts) {
|
|
|
630901
631176
|
}
|
|
630902
631177
|
let nvimPath;
|
|
630903
631178
|
try {
|
|
630904
|
-
nvimPath =
|
|
631179
|
+
nvimPath = execSync53("which nvim 2>/dev/null", { encoding: "utf8" }).trim();
|
|
630905
631180
|
if (!nvimPath) throw new Error();
|
|
630906
631181
|
} catch {
|
|
630907
631182
|
const installed = await ensureNeovim();
|
|
@@ -631628,8 +631903,8 @@ async function forceKillDaemon(port) {
|
|
|
631628
631903
|
}
|
|
631629
631904
|
}
|
|
631630
631905
|
try {
|
|
631631
|
-
const { execSync:
|
|
631632
|
-
const out =
|
|
631906
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
631907
|
+
const out = execSync62(
|
|
631633
631908
|
`lsof -ti :${p2} 2>/dev/null || fuser ${p2}/tcp 2>/dev/null || true`,
|
|
631634
631909
|
{ encoding: "utf8", timeout: 3e3 }
|
|
631635
631910
|
).trim();
|
|
@@ -634520,7 +634795,7 @@ import {
|
|
|
634520
634795
|
import { join as join143, dirname as dirname44, resolve as resolve60 } from "node:path";
|
|
634521
634796
|
import { homedir as homedir48, tmpdir as tmpdir21, platform as platform6 } from "node:os";
|
|
634522
634797
|
import {
|
|
634523
|
-
execSync as
|
|
634798
|
+
execSync as execSync54,
|
|
634524
634799
|
spawn as nodeSpawn
|
|
634525
634800
|
} from "node:child_process";
|
|
634526
634801
|
import { createRequire as createRequire7 } from "node:module";
|
|
@@ -636867,7 +637142,7 @@ except Exception as exc:
|
|
|
636867
637142
|
}
|
|
636868
637143
|
for (const player of ["paplay", "pw-play", "aplay"]) {
|
|
636869
637144
|
try {
|
|
636870
|
-
|
|
637145
|
+
execSync54(`which ${player}`, { stdio: "pipe" });
|
|
636871
637146
|
return [player, path12];
|
|
636872
637147
|
} catch {
|
|
636873
637148
|
}
|
|
@@ -637045,7 +637320,7 @@ except Exception as exc:
|
|
|
637045
637320
|
return false;
|
|
637046
637321
|
}
|
|
637047
637322
|
try {
|
|
637048
|
-
|
|
637323
|
+
execSync54(`${JSON.stringify(venvPy)} -c "import supertonic"`, {
|
|
637049
637324
|
stdio: "pipe",
|
|
637050
637325
|
timeout: 1e4
|
|
637051
637326
|
});
|
|
@@ -637177,7 +637452,7 @@ except Exception as exc:
|
|
|
637177
637452
|
if (this.python3Path) return this.python3Path;
|
|
637178
637453
|
for (const bin of ["python3", "python"]) {
|
|
637179
637454
|
try {
|
|
637180
|
-
const path12 =
|
|
637455
|
+
const path12 = execSync54(`which ${bin}`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
|
|
637181
637456
|
if (path12) {
|
|
637182
637457
|
this.python3Path = path12;
|
|
637183
637458
|
return path12;
|
|
@@ -637241,7 +637516,7 @@ except Exception as exc:
|
|
|
637241
637516
|
return false;
|
|
637242
637517
|
}
|
|
637243
637518
|
try {
|
|
637244
|
-
|
|
637519
|
+
execSync54(`${py} -c "import mlx_audio"`, {
|
|
637245
637520
|
stdio: "pipe",
|
|
637246
637521
|
timeout: 1e4
|
|
637247
637522
|
});
|
|
@@ -637310,14 +637585,14 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
|
637310
637585
|
`tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
|
|
637311
637586
|
].join("; ");
|
|
637312
637587
|
try {
|
|
637313
|
-
|
|
637588
|
+
execSync54(
|
|
637314
637589
|
`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`,
|
|
637315
637590
|
{ stdio: "pipe", timeout: 6e4, cwd: tmpdir21() }
|
|
637316
637591
|
);
|
|
637317
637592
|
} catch (err) {
|
|
637318
637593
|
try {
|
|
637319
637594
|
const safeText = cleaned.replace(/'/g, "'\\''");
|
|
637320
|
-
|
|
637595
|
+
execSync54(
|
|
637321
637596
|
`${py} -m mlx_audio.tts.generate --model ${mlxModelId} --text '${safeText}' --voice ${mlxVoice} --lang_code ${mlxLangCode} --audio_path ${JSON.stringify(wavPath)}`,
|
|
637322
637597
|
{ stdio: "pipe", timeout: 6e4, cwd: tmpdir21() }
|
|
637323
637598
|
);
|
|
@@ -637391,14 +637666,14 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
|
637391
637666
|
`tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
|
|
637392
637667
|
].join("; ");
|
|
637393
637668
|
try {
|
|
637394
|
-
|
|
637669
|
+
execSync54(
|
|
637395
637670
|
`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`,
|
|
637396
637671
|
{ stdio: "pipe", timeout: 6e4, cwd: tmpdir21() }
|
|
637397
637672
|
);
|
|
637398
637673
|
} catch {
|
|
637399
637674
|
try {
|
|
637400
637675
|
const safeText = cleaned.replace(/'/g, "'\\''");
|
|
637401
|
-
|
|
637676
|
+
execSync54(
|
|
637402
637677
|
`${py} -m mlx_audio.tts.generate --model ${mlxModelId} --text '${safeText}' --voice ${mlxVoice} --lang_code ${mlxLangCode} --audio_path ${JSON.stringify(wavPath)}`,
|
|
637403
637678
|
{ stdio: "pipe", timeout: 6e4, cwd: tmpdir21() }
|
|
637404
637679
|
);
|
|
@@ -637694,11 +637969,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
|
637694
637969
|
...isJetson ? (() => {
|
|
637695
637970
|
let jpVer = "v60";
|
|
637696
637971
|
try {
|
|
637697
|
-
const tegra = existsSync132("/etc/nv_tegra_release") ?
|
|
637972
|
+
const tegra = existsSync132("/etc/nv_tegra_release") ? execSync54("cat /etc/nv_tegra_release 2>/dev/null", {
|
|
637698
637973
|
encoding: "utf8",
|
|
637699
637974
|
timeout: 3e3
|
|
637700
637975
|
}).trim() : "";
|
|
637701
|
-
const dpkg =
|
|
637976
|
+
const dpkg = execSync54(
|
|
637702
637977
|
"dpkg -l nvidia-jetpack 2>/dev/null | grep nvidia-jetpack | awk '{print $3}'",
|
|
637703
637978
|
{ encoding: "utf8", timeout: 5e3 }
|
|
637704
637979
|
).trim();
|
|
@@ -643332,10 +643607,10 @@ ${result.output}`);
|
|
|
643332
643607
|
"Requesting sudo to migrate daemon to current user and restart..."
|
|
643333
643608
|
);
|
|
643334
643609
|
const nodeBin = process.execPath;
|
|
643335
|
-
const { execSync:
|
|
643610
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
643336
643611
|
let npmRoot = "";
|
|
643337
643612
|
try {
|
|
643338
|
-
npmRoot =
|
|
643613
|
+
npmRoot = execSync62("npm root -g", { encoding: "utf8" }).trim();
|
|
643339
643614
|
} catch {
|
|
643340
643615
|
}
|
|
643341
643616
|
const launcher = npmRoot ? `${npmRoot}/omnius/dist/launcher.cjs` : "";
|
|
@@ -652043,7 +652318,7 @@ async function handleBroker(arg, _ctx) {
|
|
|
652043
652318
|
);
|
|
652044
652319
|
}
|
|
652045
652320
|
async function handleParallel(arg, ctx3) {
|
|
652046
|
-
const { execSync:
|
|
652321
|
+
const { execSync: execSync62 } = await import("node:child_process");
|
|
652047
652322
|
const baseUrl2 = ctx3.config.backendUrl || "http://localhost:11434";
|
|
652048
652323
|
const isRemote = ctx3.config.backendType === "nexus";
|
|
652049
652324
|
if (isRemote) {
|
|
@@ -652075,7 +652350,7 @@ async function handleParallel(arg, ctx3) {
|
|
|
652075
652350
|
}
|
|
652076
652351
|
let systemdVal = "";
|
|
652077
652352
|
try {
|
|
652078
|
-
const out =
|
|
652353
|
+
const out = execSync62(
|
|
652079
652354
|
"systemctl show ollama.service -p Environment 2>/dev/null || true",
|
|
652080
652355
|
{ encoding: "utf8" }
|
|
652081
652356
|
);
|
|
@@ -652110,7 +652385,7 @@ async function handleParallel(arg, ctx3) {
|
|
|
652110
652385
|
}
|
|
652111
652386
|
const isSystemd = (() => {
|
|
652112
652387
|
try {
|
|
652113
|
-
const out =
|
|
652388
|
+
const out = execSync62("systemctl is-active ollama.service 2>/dev/null", {
|
|
652114
652389
|
encoding: "utf8"
|
|
652115
652390
|
}).trim();
|
|
652116
652391
|
return out === "active" || out === "inactive";
|
|
@@ -654412,13 +654687,13 @@ async function showExposeDashboard(gateway, rl, ctx3) {
|
|
|
654412
654687
|
const cmd = `/endpoint ${id} --auth ${gateway.authKey ?? ""}`;
|
|
654413
654688
|
let copied = false;
|
|
654414
654689
|
try {
|
|
654415
|
-
const { execSync:
|
|
654690
|
+
const { execSync: execSync62 } = __require("node:child_process");
|
|
654416
654691
|
const platform7 = process.platform;
|
|
654417
654692
|
if (platform7 === "darwin") {
|
|
654418
|
-
|
|
654693
|
+
execSync62("pbcopy", { input: cmd, timeout: 3e3 });
|
|
654419
654694
|
copied = true;
|
|
654420
654695
|
} else if (platform7 === "win32") {
|
|
654421
|
-
|
|
654696
|
+
execSync62("clip", { input: cmd, timeout: 3e3 });
|
|
654422
654697
|
copied = true;
|
|
654423
654698
|
} else {
|
|
654424
654699
|
for (const tool of [
|
|
@@ -654427,7 +654702,7 @@ async function showExposeDashboard(gateway, rl, ctx3) {
|
|
|
654427
654702
|
"wl-copy"
|
|
654428
654703
|
]) {
|
|
654429
654704
|
try {
|
|
654430
|
-
|
|
654705
|
+
execSync62(tool, {
|
|
654431
654706
|
input: cmd,
|
|
654432
654707
|
timeout: 3e3,
|
|
654433
654708
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -654818,7 +655093,7 @@ var init_commands = __esm({
|
|
|
654818
655093
|
// packages/cli/src/tui/project-context.ts
|
|
654819
655094
|
import { existsSync as existsSync134, readFileSync as readFileSync107, readdirSync as readdirSync46, mkdirSync as mkdirSync79, writeFileSync as writeFileSync69 } from "node:fs";
|
|
654820
655095
|
import { join as join145, basename as basename27 } from "node:path";
|
|
654821
|
-
import { execSync as
|
|
655096
|
+
import { execSync as execSync55 } from "node:child_process";
|
|
654822
655097
|
import { homedir as homedir50 } from "node:os";
|
|
654823
655098
|
function projectContextUrlSpanAt(text2, index) {
|
|
654824
655099
|
PROJECT_CONTEXT_URL_RE.lastIndex = 0;
|
|
@@ -654877,18 +655152,18 @@ function loadProjectMap(repoRoot) {
|
|
|
654877
655152
|
}
|
|
654878
655153
|
function getGitInfo(repoRoot) {
|
|
654879
655154
|
try {
|
|
654880
|
-
|
|
655155
|
+
execSync55("git rev-parse --is-inside-work-tree", { cwd: repoRoot, stdio: "pipe" });
|
|
654881
655156
|
} catch {
|
|
654882
655157
|
return "";
|
|
654883
655158
|
}
|
|
654884
655159
|
const lines = [];
|
|
654885
655160
|
try {
|
|
654886
|
-
const branch =
|
|
655161
|
+
const branch = execSync55("git branch --show-current", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
|
|
654887
655162
|
if (branch) lines.push(`Branch: ${branch}`);
|
|
654888
655163
|
} catch {
|
|
654889
655164
|
}
|
|
654890
655165
|
try {
|
|
654891
|
-
const status =
|
|
655166
|
+
const status = execSync55("git status --porcelain", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
|
|
654892
655167
|
if (status) {
|
|
654893
655168
|
const changed = status.split("\n").length;
|
|
654894
655169
|
lines.push(`Working tree: ${changed} changed file(s)`);
|
|
@@ -654898,7 +655173,7 @@ function getGitInfo(repoRoot) {
|
|
|
654898
655173
|
} catch {
|
|
654899
655174
|
}
|
|
654900
655175
|
try {
|
|
654901
|
-
const log22 =
|
|
655176
|
+
const log22 = execSync55("git log --oneline -5 --no-decorate", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
|
|
654902
655177
|
if (log22) lines.push(`Recent commits:
|
|
654903
655178
|
${log22}`);
|
|
654904
655179
|
} catch {
|
|
@@ -659836,7 +660111,7 @@ var init_promptLoader3 = __esm({
|
|
|
659836
660111
|
// packages/cli/src/tui/dream-engine.ts
|
|
659837
660112
|
import { mkdirSync as mkdirSync86, writeFileSync as writeFileSync74, readFileSync as readFileSync114, existsSync as existsSync142, readdirSync as readdirSync51 } from "node:fs";
|
|
659838
660113
|
import { join as join154, basename as basename33 } from "node:path";
|
|
659839
|
-
import { execSync as
|
|
660114
|
+
import { execSync as execSync56 } from "node:child_process";
|
|
659840
660115
|
function setDreamWriteContent(fn) {
|
|
659841
660116
|
_dreamWriteContent = fn;
|
|
659842
660117
|
}
|
|
@@ -660209,7 +660484,7 @@ var init_dream_engine = __esm({
|
|
|
660209
660484
|
}
|
|
660210
660485
|
}
|
|
660211
660486
|
try {
|
|
660212
|
-
const output =
|
|
660487
|
+
const output = execSync56(cmd, {
|
|
660213
660488
|
cwd: this.repoRoot,
|
|
660214
660489
|
timeout: 3e4,
|
|
660215
660490
|
encoding: "utf-8",
|
|
@@ -661186,17 +661461,17 @@ ${summary}` };
|
|
|
661186
661461
|
try {
|
|
661187
661462
|
mkdirSync86(checkpointDir3, { recursive: true });
|
|
661188
661463
|
try {
|
|
661189
|
-
const gitStatus =
|
|
661464
|
+
const gitStatus = execSync56("git status --porcelain", {
|
|
661190
661465
|
cwd: this.repoRoot,
|
|
661191
661466
|
encoding: "utf-8",
|
|
661192
661467
|
timeout: 1e4
|
|
661193
661468
|
});
|
|
661194
|
-
const gitDiff =
|
|
661469
|
+
const gitDiff = execSync56("git diff", {
|
|
661195
661470
|
cwd: this.repoRoot,
|
|
661196
661471
|
encoding: "utf-8",
|
|
661197
661472
|
timeout: 1e4
|
|
661198
661473
|
});
|
|
661199
|
-
const gitHash =
|
|
661474
|
+
const gitHash = execSync56("git rev-parse HEAD 2>/dev/null || echo 'no-git'", {
|
|
661200
661475
|
cwd: this.repoRoot,
|
|
661201
661476
|
encoding: "utf-8",
|
|
661202
661477
|
timeout: 5e3
|
|
@@ -690722,7 +690997,7 @@ __export(aiwg_exports, {
|
|
|
690722
690997
|
import { existsSync as existsSync154, readFileSync as readFileSync124, readdirSync as readdirSync55, statSync as statSync55 } from "node:fs";
|
|
690723
690998
|
import { join as join165 } from "node:path";
|
|
690724
690999
|
import { homedir as homedir55 } from "node:os";
|
|
690725
|
-
import { execSync as
|
|
691000
|
+
import { execSync as execSync57 } from "node:child_process";
|
|
690726
691001
|
function resolveAiwgRoot() {
|
|
690727
691002
|
if (_cachedAiwgRoot !== void 0) return _cachedAiwgRoot;
|
|
690728
691003
|
const envRoot = process.env["OMNIUS_AIWG_ROOT"];
|
|
@@ -690736,7 +691011,7 @@ function resolveAiwgRoot() {
|
|
|
690736
691011
|
return shareDir;
|
|
690737
691012
|
}
|
|
690738
691013
|
try {
|
|
690739
|
-
const globalRoot =
|
|
691014
|
+
const globalRoot = execSync57("npm root -g", {
|
|
690740
691015
|
encoding: "utf-8",
|
|
690741
691016
|
timeout: 5e3,
|
|
690742
691017
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -690778,7 +691053,7 @@ function resolveAiwgRoot() {
|
|
|
690778
691053
|
}
|
|
690779
691054
|
}
|
|
690780
691055
|
try {
|
|
690781
|
-
const whichAiwg =
|
|
691056
|
+
const whichAiwg = execSync57("which aiwg 2>/dev/null || where aiwg 2>nul", {
|
|
690782
691057
|
encoding: "utf-8",
|
|
690783
691058
|
timeout: 3e3,
|
|
690784
691059
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -693744,9 +694019,9 @@ function resolveLocalPeerId() {
|
|
|
693744
694019
|
}
|
|
693745
694020
|
let scanResult = null;
|
|
693746
694021
|
try {
|
|
693747
|
-
const { execSync:
|
|
694022
|
+
const { execSync: execSync62 } = __require("node:child_process");
|
|
693748
694023
|
const cmd = `find "${homedir58()}" -maxdepth 4 -path '*/.omnius/nexus/status.json' -type f 2>/dev/null | head -50`;
|
|
693749
|
-
const out =
|
|
694024
|
+
const out = execSync62(cmd, { encoding: "utf-8", timeout: 2e3 }).trim();
|
|
693750
694025
|
for (const line of out.split("\n")) {
|
|
693751
694026
|
const f2 = line.trim();
|
|
693752
694027
|
if (!f2) continue;
|
|
@@ -693776,8 +694051,8 @@ function locateTorScript(filename) {
|
|
|
693776
694051
|
if (existsSync158(p2)) return p2;
|
|
693777
694052
|
}
|
|
693778
694053
|
try {
|
|
693779
|
-
const { execSync:
|
|
693780
|
-
const root =
|
|
694054
|
+
const { execSync: execSync62 } = __require("node:child_process");
|
|
694055
|
+
const root = execSync62("npm root -g", { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
693781
694056
|
const p2 = join169(root, "omnius", "dist", "scripts", "tor", filename);
|
|
693782
694057
|
if (existsSync158(p2)) return p2;
|
|
693783
694058
|
} catch {
|
|
@@ -707147,7 +707422,7 @@ var init_chat_followup = __esm({
|
|
|
707147
707422
|
});
|
|
707148
707423
|
|
|
707149
707424
|
// packages/cli/src/docker.ts
|
|
707150
|
-
import { execSync as
|
|
707425
|
+
import { execSync as execSync58, spawn as spawn32 } from "node:child_process";
|
|
707151
707426
|
import { existsSync as existsSync160, mkdirSync as mkdirSync101, writeFileSync as writeFileSync85 } from "node:fs";
|
|
707152
707427
|
import { join as join171, resolve as resolve68, dirname as dirname50 } from "node:path";
|
|
707153
707428
|
import { homedir as homedir59 } from "node:os";
|
|
@@ -707168,7 +707443,7 @@ function getDockerDir() {
|
|
|
707168
707443
|
}
|
|
707169
707444
|
function isDockerAvailable() {
|
|
707170
707445
|
try {
|
|
707171
|
-
|
|
707446
|
+
execSync58("docker info", { stdio: "pipe", timeout: 1e4 });
|
|
707172
707447
|
return true;
|
|
707173
707448
|
} catch {
|
|
707174
707449
|
return false;
|
|
@@ -707176,7 +707451,7 @@ function isDockerAvailable() {
|
|
|
707176
707451
|
}
|
|
707177
707452
|
function isDockerInstalled() {
|
|
707178
707453
|
try {
|
|
707179
|
-
|
|
707454
|
+
execSync58("docker --version", { stdio: "pipe", timeout: 5e3 });
|
|
707180
707455
|
return true;
|
|
707181
707456
|
} catch {
|
|
707182
707457
|
return false;
|
|
@@ -707201,31 +707476,31 @@ async function ensureDocker() {
|
|
|
707201
707476
|
}
|
|
707202
707477
|
try {
|
|
707203
707478
|
console.log("[omnius-docker] Docker not found. Installing via get.docker.com...");
|
|
707204
|
-
|
|
707479
|
+
execSync58("curl -fsSL https://get.docker.com | sh", {
|
|
707205
707480
|
stdio: "inherit",
|
|
707206
707481
|
timeout: 3e5
|
|
707207
707482
|
});
|
|
707208
707483
|
const user = process.env["USER"] || process.env["LOGNAME"];
|
|
707209
707484
|
if (user) {
|
|
707210
707485
|
try {
|
|
707211
|
-
|
|
707486
|
+
execSync58(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
|
|
707212
707487
|
} catch {
|
|
707213
707488
|
}
|
|
707214
707489
|
}
|
|
707215
707490
|
try {
|
|
707216
|
-
|
|
707491
|
+
execSync58("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
|
|
707217
707492
|
} catch {
|
|
707218
707493
|
}
|
|
707219
707494
|
try {
|
|
707220
|
-
|
|
707221
|
-
const runtimes =
|
|
707495
|
+
execSync58("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
|
|
707496
|
+
const runtimes = execSync58("docker info --format '{{json .Runtimes}}'", {
|
|
707222
707497
|
stdio: "pipe",
|
|
707223
707498
|
timeout: 5e3
|
|
707224
707499
|
}).toString();
|
|
707225
707500
|
if (!runtimes.includes("nvidia")) {
|
|
707226
707501
|
console.log("[omnius-docker] NVIDIA GPU detected. Installing nvidia-container-toolkit...");
|
|
707227
707502
|
try {
|
|
707228
|
-
|
|
707503
|
+
execSync58(`
|
|
707229
707504
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
|
|
707230
707505
|
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 2>&1
|
|
707231
707506
|
sudo apt-get update -qq 2>/dev/null && sudo apt-get install -y -qq nvidia-container-toolkit 2>/dev/null || ( sudo dnf install -y nvidia-container-toolkit 2>/dev/null || sudo yum install -y nvidia-container-toolkit 2>/dev/null || true )
|
|
@@ -707255,7 +707530,7 @@ async function ensureDocker() {
|
|
|
707255
707530
|
}
|
|
707256
707531
|
async function ensureNvidiaToolkit() {
|
|
707257
707532
|
try {
|
|
707258
|
-
|
|
707533
|
+
execSync58("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
|
|
707259
707534
|
} catch {
|
|
707260
707535
|
return { ok: false, message: "No NVIDIA GPU detected (nvidia-smi not found)" };
|
|
707261
707536
|
}
|
|
@@ -707266,7 +707541,7 @@ async function ensureNvidiaToolkit() {
|
|
|
707266
707541
|
return { ok: false, message: "Auto-install only supported on Linux. Install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html" };
|
|
707267
707542
|
}
|
|
707268
707543
|
try {
|
|
707269
|
-
|
|
707544
|
+
execSync58(`
|
|
707270
707545
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
|
|
707271
707546
|
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 2>&1
|
|
707272
707547
|
sudo apt-get update -qq 2>/dev/null && sudo apt-get install -y -qq nvidia-container-toolkit 2>/dev/null || ( sudo dnf install -y nvidia-container-toolkit 2>/dev/null || sudo yum install -y nvidia-container-toolkit 2>/dev/null || true )
|
|
@@ -707280,7 +707555,7 @@ async function ensureNvidiaToolkit() {
|
|
|
707280
707555
|
}
|
|
707281
707556
|
function isOmniusImageBuilt() {
|
|
707282
707557
|
try {
|
|
707283
|
-
const out =
|
|
707558
|
+
const out = execSync58(`docker images -q ${OMNIUS_IMAGE}:${OMNIUS_IMAGE_TAG}`, {
|
|
707284
707559
|
stdio: "pipe",
|
|
707285
707560
|
timeout: 5e3
|
|
707286
707561
|
}).toString().trim();
|
|
@@ -707304,7 +707579,7 @@ async function ensureOmniusImage(force = false) {
|
|
|
707304
707579
|
}
|
|
707305
707580
|
try {
|
|
707306
707581
|
console.log(`[omnius-docker] Building image ${OMNIUS_IMAGE}:${OMNIUS_IMAGE_TAG}...`);
|
|
707307
|
-
|
|
707582
|
+
execSync58(`docker build -t ${OMNIUS_IMAGE}:${OMNIUS_IMAGE_TAG} ${buildContext}`, {
|
|
707308
707583
|
stdio: "inherit",
|
|
707309
707584
|
timeout: 6e5
|
|
707310
707585
|
// 10 min
|
|
@@ -707378,11 +707653,11 @@ exec "$@"
|
|
|
707378
707653
|
}
|
|
707379
707654
|
function hasNvidiaGpu() {
|
|
707380
707655
|
try {
|
|
707381
|
-
|
|
707656
|
+
execSync58("nvidia-smi --query-gpu=name --format=csv,noheader", {
|
|
707382
707657
|
stdio: "pipe",
|
|
707383
707658
|
timeout: 5e3
|
|
707384
707659
|
});
|
|
707385
|
-
const runtimes =
|
|
707660
|
+
const runtimes = execSync58("docker info --format '{{json .Runtimes}}'", {
|
|
707386
707661
|
stdio: "pipe",
|
|
707387
707662
|
timeout: 5e3
|
|
707388
707663
|
}).toString();
|
|
@@ -707631,7 +707906,7 @@ import { createRequire as createRequire8 } from "node:module";
|
|
|
707631
707906
|
import { fileURLToPath as fileURLToPath22 } from "node:url";
|
|
707632
707907
|
import { dirname as dirname51, join as join173, resolve as resolve69 } from "node:path";
|
|
707633
707908
|
import { homedir as homedir60 } from "node:os";
|
|
707634
|
-
import { spawn as spawn33, execSync as
|
|
707909
|
+
import { spawn as spawn33, execSync as execSync59 } from "node:child_process";
|
|
707635
707910
|
import {
|
|
707636
707911
|
createReadStream as createReadStream2,
|
|
707637
707912
|
mkdirSync as mkdirSync102,
|
|
@@ -712090,7 +712365,7 @@ function handleV1RunsDelete(res, id) {
|
|
|
712090
712365
|
const containerName = `omnius-${id}`;
|
|
712091
712366
|
if (job.sandbox === "container") {
|
|
712092
712367
|
try {
|
|
712093
|
-
|
|
712368
|
+
execSync59(`docker stop ${containerName}`, {
|
|
712094
712369
|
timeout: 5e3,
|
|
712095
712370
|
stdio: "ignore"
|
|
712096
712371
|
});
|
|
@@ -714440,8 +714715,8 @@ data: ${JSON.stringify(data)}
|
|
|
714440
714715
|
}
|
|
714441
714716
|
setImmediate(() => {
|
|
714442
714717
|
try {
|
|
714443
|
-
const { execSync:
|
|
714444
|
-
|
|
714718
|
+
const { execSync: execSync62 } = require4("node:child_process");
|
|
714719
|
+
execSync62("npm update -g omnius 2>/dev/null || true", {
|
|
714445
714720
|
stdio: "pipe"
|
|
714446
714721
|
});
|
|
714447
714722
|
} catch {
|
|
@@ -714484,7 +714759,7 @@ data: ${JSON.stringify(data)}
|
|
|
714484
714759
|
return;
|
|
714485
714760
|
}
|
|
714486
714761
|
try {
|
|
714487
|
-
const { execSync:
|
|
714762
|
+
const { execSync: execSync62 } = require4("node:child_process");
|
|
714488
714763
|
let audioPath = null;
|
|
714489
714764
|
const ttsCmds = [
|
|
714490
714765
|
`espeak "${text2}" -w /tmp/tts_${Date.now()}.wav 2>/dev/null`,
|
|
@@ -714493,7 +714768,7 @@ data: ${JSON.stringify(data)}
|
|
|
714493
714768
|
];
|
|
714494
714769
|
for (const cmd of ttsCmds) {
|
|
714495
714770
|
try {
|
|
714496
|
-
|
|
714771
|
+
execSync62(cmd, { stdio: "pipe" });
|
|
714497
714772
|
audioPath = "/tmp/tts_" + Date.now() + ".wav";
|
|
714498
714773
|
break;
|
|
714499
714774
|
} catch {
|
|
@@ -718223,7 +718498,7 @@ var clipboard_media_exports = {};
|
|
|
718223
718498
|
__export(clipboard_media_exports, {
|
|
718224
718499
|
pasteClipboardImageToFile: () => pasteClipboardImageToFile
|
|
718225
718500
|
});
|
|
718226
|
-
import { execFileSync as execFileSync11, execSync as
|
|
718501
|
+
import { execFileSync as execFileSync11, execSync as execSync60 } from "node:child_process";
|
|
718227
718502
|
import { mkdirSync as mkdirSync103, readFileSync as readFileSync130, rmSync as rmSync13, writeFileSync as writeFileSync87 } from "node:fs";
|
|
718228
718503
|
import { join as join174 } from "node:path";
|
|
718229
718504
|
function pasteClipboardImageToFile(repoRoot) {
|
|
@@ -718238,7 +718513,7 @@ function pasteClipboardImageToFile(repoRoot) {
|
|
|
718238
718513
|
function readClipboardImage() {
|
|
718239
718514
|
if (process.platform === "darwin") {
|
|
718240
718515
|
try {
|
|
718241
|
-
|
|
718516
|
+
execSync60("command -v pngpaste", { stdio: "ignore", timeout: 1e3 });
|
|
718242
718517
|
const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
|
|
718243
718518
|
execFileSync11("pngpaste", [tmp], { timeout: 3e3 });
|
|
718244
718519
|
const buffer2 = readFileSync130(tmp);
|
|
@@ -718314,7 +718589,7 @@ import {
|
|
|
718314
718589
|
writeFile as writeFileAsync2,
|
|
718315
718590
|
mkdir as mkdirAsync
|
|
718316
718591
|
} from "node:fs/promises";
|
|
718317
|
-
import { execSync as
|
|
718592
|
+
import { execSync as execSync61 } from "node:child_process";
|
|
718318
718593
|
import { homedir as homedir61 } from "node:os";
|
|
718319
718594
|
function formatTimeAgo2(date) {
|
|
718320
718595
|
const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
|
|
@@ -726599,7 +726874,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
726599
726874
|
try {
|
|
726600
726875
|
if (process.platform === "win32") {
|
|
726601
726876
|
try {
|
|
726602
|
-
|
|
726877
|
+
execSync61(`taskkill /F /PID ${pid}`, {
|
|
726603
726878
|
timeout: 5e3,
|
|
726604
726879
|
stdio: "ignore"
|
|
726605
726880
|
});
|
|
@@ -726631,7 +726906,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
726631
726906
|
if (pid > 0) {
|
|
726632
726907
|
if (process.platform === "win32") {
|
|
726633
726908
|
try {
|
|
726634
|
-
|
|
726909
|
+
execSync61(`taskkill /F /PID ${pid}`, {
|
|
726635
726910
|
timeout: 5e3,
|
|
726636
726911
|
stdio: "ignore"
|
|
726637
726912
|
});
|
|
@@ -726651,7 +726926,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
726651
726926
|
} catch {
|
|
726652
726927
|
}
|
|
726653
726928
|
try {
|
|
726654
|
-
|
|
726929
|
+
execSync61(
|
|
726655
726930
|
process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5",
|
|
726656
726931
|
{ timeout: 3e3, stdio: "ignore" }
|
|
726657
726932
|
);
|
|
@@ -726668,7 +726943,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
726668
726943
|
} catch (err) {
|
|
726669
726944
|
if (attempt < 2) {
|
|
726670
726945
|
try {
|
|
726671
|
-
|
|
726946
|
+
execSync61(
|
|
726672
726947
|
process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3",
|
|
726673
726948
|
{ timeout: 3e3, stdio: "ignore" }
|
|
726674
726949
|
);
|
|
@@ -726682,7 +726957,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
726682
726957
|
);
|
|
726683
726958
|
if (process.platform === "win32") {
|
|
726684
726959
|
try {
|
|
726685
|
-
|
|
726960
|
+
execSync61(`rd /s /q "${omniusPath}"`, {
|
|
726686
726961
|
timeout: 1e4,
|
|
726687
726962
|
stdio: "ignore"
|
|
726688
726963
|
});
|