open-agents-ai 0.132.0 → 0.134.0
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 +210 -238
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -255,7 +255,6 @@ var init_output = __esm({
|
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
// packages/cli/dist/updater.js
|
|
258
|
-
import { execSync } from "node:child_process";
|
|
259
258
|
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
260
259
|
import { join as join2 } from "node:path";
|
|
261
260
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -320,40 +319,6 @@ async function checkForUpdate(currentVersion, forceCheck = false) {
|
|
|
320
319
|
latestVersion: latest
|
|
321
320
|
};
|
|
322
321
|
}
|
|
323
|
-
function cleanStaleNpmTempDirs(sudo) {
|
|
324
|
-
try {
|
|
325
|
-
const prefix = execSync("npm prefix -g", { encoding: "utf-8", stdio: "pipe", timeout: 5e3 }).trim();
|
|
326
|
-
const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
|
|
327
|
-
const sudoCmd = sudo ? "sudo " : "";
|
|
328
|
-
execSync(`${sudoCmd}find "${globalModules}" -maxdepth 1 -name ".${PACKAGE_NAME}-*" -type d -exec rm -rf {} + 2>/dev/null || true`, { stdio: "pipe", timeout: 15e3 });
|
|
329
|
-
execSync(`${sudoCmd}rm -rf "${globalModules}/${PACKAGE_NAME}" 2>/dev/null || true`, { stdio: "pipe", timeout: 15e3 });
|
|
330
|
-
} catch {
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
function performSilentUpdate() {
|
|
334
|
-
const installCmd = `npm install -g ${PACKAGE_NAME}@latest --prefer-online`;
|
|
335
|
-
const trySilent = (cmd, sudo) => {
|
|
336
|
-
try {
|
|
337
|
-
execSync(cmd, { stdio: "pipe", timeout: 12e4 });
|
|
338
|
-
return true;
|
|
339
|
-
} catch (err) {
|
|
340
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
341
|
-
if (/ENOTEMPTY|errno -39/i.test(msg)) {
|
|
342
|
-
cleanStaleNpmTempDirs(sudo);
|
|
343
|
-
try {
|
|
344
|
-
execSync(cmd, { stdio: "pipe", timeout: 12e4 });
|
|
345
|
-
return true;
|
|
346
|
-
} catch {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
if (trySilent(installCmd, false))
|
|
354
|
-
return true;
|
|
355
|
-
return trySilent(`sudo -n ${installCmd}`, true);
|
|
356
|
-
}
|
|
357
322
|
function formatUpdateBanner(info) {
|
|
358
323
|
return `
|
|
359
324
|
Update available: v${info.currentVersion} \u2192 v${info.latestVersion}
|
|
@@ -3429,7 +3394,7 @@ var init_list_directory = __esm({
|
|
|
3429
3394
|
});
|
|
3430
3395
|
|
|
3431
3396
|
// packages/execution/dist/tools/aiwg-setup.js
|
|
3432
|
-
import { execSync
|
|
3397
|
+
import { execSync } from "node:child_process";
|
|
3433
3398
|
var AiwgSetupTool;
|
|
3434
3399
|
var init_aiwg_setup = __esm({
|
|
3435
3400
|
"packages/execution/dist/tools/aiwg-setup.js"() {
|
|
@@ -3468,7 +3433,7 @@ var init_aiwg_setup = __esm({
|
|
|
3468
3433
|
};
|
|
3469
3434
|
}
|
|
3470
3435
|
try {
|
|
3471
|
-
const output =
|
|
3436
|
+
const output = execSync(`aiwg use ${framework}`, {
|
|
3472
3437
|
cwd: projectDir,
|
|
3473
3438
|
encoding: "utf8",
|
|
3474
3439
|
timeout: 6e4,
|
|
@@ -3492,7 +3457,7 @@ ${output}`,
|
|
|
3492
3457
|
}
|
|
3493
3458
|
isAiwgInstalled() {
|
|
3494
3459
|
try {
|
|
3495
|
-
|
|
3460
|
+
execSync("aiwg --version", {
|
|
3496
3461
|
encoding: "utf8",
|
|
3497
3462
|
timeout: 5e3,
|
|
3498
3463
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -3507,7 +3472,7 @@ ${output}`,
|
|
|
3507
3472
|
});
|
|
3508
3473
|
|
|
3509
3474
|
// packages/execution/dist/tools/aiwg-health.js
|
|
3510
|
-
import { execSync as
|
|
3475
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
3511
3476
|
import { existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
3512
3477
|
import { join as join8 } from "node:path";
|
|
3513
3478
|
var AiwgHealthTool;
|
|
@@ -3587,7 +3552,7 @@ var init_aiwg_health = __esm({
|
|
|
3587
3552
|
}
|
|
3588
3553
|
if (this.isAiwgInstalled()) {
|
|
3589
3554
|
try {
|
|
3590
|
-
const runtimeInfo =
|
|
3555
|
+
const runtimeInfo = execSync2("aiwg runtime-info 2>/dev/null", {
|
|
3591
3556
|
cwd: projectDir,
|
|
3592
3557
|
encoding: "utf8",
|
|
3593
3558
|
timeout: 15e3
|
|
@@ -3708,7 +3673,7 @@ var init_aiwg_health = __esm({
|
|
|
3708
3673
|
}
|
|
3709
3674
|
isAiwgInstalled() {
|
|
3710
3675
|
try {
|
|
3711
|
-
|
|
3676
|
+
execSync2("aiwg --version", { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] });
|
|
3712
3677
|
return true;
|
|
3713
3678
|
} catch {
|
|
3714
3679
|
return false;
|
|
@@ -3719,7 +3684,7 @@ var init_aiwg_health = __esm({
|
|
|
3719
3684
|
});
|
|
3720
3685
|
|
|
3721
3686
|
// packages/execution/dist/tools/aiwg-workflow.js
|
|
3722
|
-
import { execSync as
|
|
3687
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
3723
3688
|
var AiwgWorkflowTool;
|
|
3724
3689
|
var init_aiwg_workflow = __esm({
|
|
3725
3690
|
"packages/execution/dist/tools/aiwg-workflow.js"() {
|
|
@@ -3767,7 +3732,7 @@ var init_aiwg_workflow = __esm({
|
|
|
3767
3732
|
}
|
|
3768
3733
|
const sanitized = command.replace(/[;&|`$()]/g, "");
|
|
3769
3734
|
try {
|
|
3770
|
-
const output =
|
|
3735
|
+
const output = execSync3(`aiwg ${sanitized}`, {
|
|
3771
3736
|
cwd: projectDir,
|
|
3772
3737
|
encoding: "utf8",
|
|
3773
3738
|
timeout: 12e4,
|
|
@@ -3793,7 +3758,7 @@ var init_aiwg_workflow = __esm({
|
|
|
3793
3758
|
}
|
|
3794
3759
|
isAiwgInstalled() {
|
|
3795
3760
|
try {
|
|
3796
|
-
|
|
3761
|
+
execSync3("aiwg --version", { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] });
|
|
3797
3762
|
return true;
|
|
3798
3763
|
} catch {
|
|
3799
3764
|
return false;
|
|
@@ -4390,7 +4355,7 @@ var init_codebase_map = __esm({
|
|
|
4390
4355
|
});
|
|
4391
4356
|
|
|
4392
4357
|
// packages/execution/dist/tools/diagnostic.js
|
|
4393
|
-
import { execSync as
|
|
4358
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
4394
4359
|
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "node:fs";
|
|
4395
4360
|
import { join as join10 } from "node:path";
|
|
4396
4361
|
var DiagnosticTool;
|
|
@@ -4505,7 +4470,7 @@ var init_diagnostic = __esm({
|
|
|
4505
4470
|
runStep(step, command, cwd4) {
|
|
4506
4471
|
const start = performance.now();
|
|
4507
4472
|
try {
|
|
4508
|
-
const output =
|
|
4473
|
+
const output = execSync4(command, {
|
|
4509
4474
|
cwd: cwd4,
|
|
4510
4475
|
encoding: "utf8",
|
|
4511
4476
|
timeout: 12e4,
|
|
@@ -4535,7 +4500,7 @@ ${err.stderr ?? ""}`.trim(),
|
|
|
4535
4500
|
});
|
|
4536
4501
|
|
|
4537
4502
|
// packages/execution/dist/tools/git-info.js
|
|
4538
|
-
import { execSync as
|
|
4503
|
+
import { execSync as execSync5 } from "node:child_process";
|
|
4539
4504
|
import { existsSync as existsSync8 } from "node:fs";
|
|
4540
4505
|
import { join as join11 } from "node:path";
|
|
4541
4506
|
var GitInfoTool;
|
|
@@ -4651,7 +4616,7 @@ var init_git_info = __esm({
|
|
|
4651
4616
|
}
|
|
4652
4617
|
git(cwd4, cmd) {
|
|
4653
4618
|
try {
|
|
4654
|
-
return
|
|
4619
|
+
return execSync5(`git ${cmd}`, {
|
|
4655
4620
|
cwd: cwd4,
|
|
4656
4621
|
encoding: "utf8",
|
|
4657
4622
|
timeout: 1e4,
|
|
@@ -4972,7 +4937,7 @@ Exit code: ${task.exitCode ?? "N/A"}`,
|
|
|
4972
4937
|
});
|
|
4973
4938
|
|
|
4974
4939
|
// packages/execution/dist/system-deps.js
|
|
4975
|
-
import { execSync as
|
|
4940
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
4976
4941
|
function detectPackageManager() {
|
|
4977
4942
|
if (_detectedPkgManager !== void 0)
|
|
4978
4943
|
return _detectedPkgManager;
|
|
@@ -5005,7 +4970,7 @@ function detectPackageManager() {
|
|
|
5005
4970
|
function hasCommand(cmd) {
|
|
5006
4971
|
try {
|
|
5007
4972
|
const whichCmd = process.platform === "win32" ? `where ${cmd}` : `which ${cmd}`;
|
|
5008
|
-
|
|
4973
|
+
execSync6(whichCmd, { stdio: "pipe", timeout: 3e3 });
|
|
5009
4974
|
return true;
|
|
5010
4975
|
} catch {
|
|
5011
4976
|
return false;
|
|
@@ -5024,7 +4989,7 @@ function runInstall(installCmd) {
|
|
|
5024
4989
|
cmd = `sudo -n ${installCmd}`;
|
|
5025
4990
|
}
|
|
5026
4991
|
}
|
|
5027
|
-
|
|
4992
|
+
execSync6(cmd, {
|
|
5028
4993
|
stdio: "pipe",
|
|
5029
4994
|
timeout: 12e4,
|
|
5030
4995
|
// 2 min for package install
|
|
@@ -5217,7 +5182,7 @@ var init_system_deps = __esm({
|
|
|
5217
5182
|
// packages/execution/dist/tools/image.js
|
|
5218
5183
|
import { existsSync as existsSync9, readFileSync as readFileSync6, statSync as statSync4 } from "node:fs";
|
|
5219
5184
|
import { resolve as resolve12, extname as extname2, basename as basename2 } from "node:path";
|
|
5220
|
-
import { execSync as
|
|
5185
|
+
import { execSync as execSync7 } from "node:child_process";
|
|
5221
5186
|
import { tmpdir } from "node:os";
|
|
5222
5187
|
import { join as join12 } from "node:path";
|
|
5223
5188
|
function isImagePath(path) {
|
|
@@ -5244,7 +5209,7 @@ function getMimeType(filePath) {
|
|
|
5244
5209
|
}
|
|
5245
5210
|
function getImageDimensions(filePath) {
|
|
5246
5211
|
try {
|
|
5247
|
-
const out =
|
|
5212
|
+
const out = execSync7(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
|
|
5248
5213
|
encoding: "utf8",
|
|
5249
5214
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5250
5215
|
timeout: 5e3
|
|
@@ -5256,7 +5221,7 @@ function getImageDimensions(filePath) {
|
|
|
5256
5221
|
const dep = ensureCommand("identify");
|
|
5257
5222
|
if (dep.installed) {
|
|
5258
5223
|
try {
|
|
5259
|
-
const out =
|
|
5224
|
+
const out = execSync7(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
|
|
5260
5225
|
encoding: "utf8",
|
|
5261
5226
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5262
5227
|
timeout: 5e3
|
|
@@ -5269,7 +5234,7 @@ function getImageDimensions(filePath) {
|
|
|
5269
5234
|
}
|
|
5270
5235
|
}
|
|
5271
5236
|
try {
|
|
5272
|
-
const out =
|
|
5237
|
+
const out = execSync7(`file ${JSON.stringify(filePath)}`, {
|
|
5273
5238
|
encoding: "utf8",
|
|
5274
5239
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5275
5240
|
timeout: 5e3
|
|
@@ -5283,7 +5248,7 @@ function getImageDimensions(filePath) {
|
|
|
5283
5248
|
}
|
|
5284
5249
|
function hasTesseract() {
|
|
5285
5250
|
try {
|
|
5286
|
-
|
|
5251
|
+
execSync7("tesseract --version", { stdio: "pipe", timeout: 5e3 });
|
|
5287
5252
|
return true;
|
|
5288
5253
|
} catch {
|
|
5289
5254
|
const dep = ensureCommand("tesseract");
|
|
@@ -5292,7 +5257,7 @@ function hasTesseract() {
|
|
|
5292
5257
|
}
|
|
5293
5258
|
function runOCR(filePath) {
|
|
5294
5259
|
try {
|
|
5295
|
-
return
|
|
5260
|
+
return execSync7(`tesseract ${JSON.stringify(filePath)} stdout 2>/dev/null`, {
|
|
5296
5261
|
encoding: "utf8",
|
|
5297
5262
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5298
5263
|
timeout: 3e4
|
|
@@ -5426,7 +5391,7 @@ ${ocrText}`);
|
|
|
5426
5391
|
};
|
|
5427
5392
|
}
|
|
5428
5393
|
try {
|
|
5429
|
-
|
|
5394
|
+
execSync7(cmd, { stdio: "pipe", timeout: 1e4 });
|
|
5430
5395
|
} catch (err) {
|
|
5431
5396
|
return {
|
|
5432
5397
|
success: false,
|
|
@@ -5474,7 +5439,7 @@ ${ocrText}`);
|
|
|
5474
5439
|
if (plat === "linux") {
|
|
5475
5440
|
for (const tool of ["scrot", "gnome-screenshot", "import"]) {
|
|
5476
5441
|
try {
|
|
5477
|
-
|
|
5442
|
+
execSync7(`which ${tool}`, { stdio: "pipe" });
|
|
5478
5443
|
if (tool === "scrot") {
|
|
5479
5444
|
if (region === "active")
|
|
5480
5445
|
return `scrot -u ${out}`;
|
|
@@ -5561,14 +5526,14 @@ ${ocrText}`);
|
|
|
5561
5526
|
if (x != null && y != null && w != null && h != null) {
|
|
5562
5527
|
const croppedPath = join12(tmpdir(), `oa-ocr-crop-${Date.now()}.png`);
|
|
5563
5528
|
try {
|
|
5564
|
-
|
|
5529
|
+
execSync7(`convert ${JSON.stringify(fullPath)} -crop ${w}x${h}+${x}+${y} +repage ${JSON.stringify(croppedPath)}`, { stdio: "pipe", timeout: 1e4 });
|
|
5565
5530
|
inputPath = croppedPath;
|
|
5566
5531
|
} catch {
|
|
5567
5532
|
}
|
|
5568
5533
|
}
|
|
5569
5534
|
}
|
|
5570
5535
|
try {
|
|
5571
|
-
const text =
|
|
5536
|
+
const text = execSync7(`tesseract ${JSON.stringify(inputPath)} stdout -l ${language} --psm ${psm} 2>/dev/null`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3e4 }).trim();
|
|
5572
5537
|
if (!text) {
|
|
5573
5538
|
return { success: true, output: "(no text detected in image)", durationMs: Date.now() - start };
|
|
5574
5539
|
}
|
|
@@ -6103,7 +6068,7 @@ var init_tool_creator = __esm({
|
|
|
6103
6068
|
import { existsSync as existsSync11, readdirSync as readdirSync5, readFileSync as readFileSync8 } from "node:fs";
|
|
6104
6069
|
import { join as join14, basename as basename3, dirname as dirname3 } from "node:path";
|
|
6105
6070
|
import { homedir as homedir5 } from "node:os";
|
|
6106
|
-
import { execSync as
|
|
6071
|
+
import { execSync as execSync8 } from "node:child_process";
|
|
6107
6072
|
function getAiwgPaths() {
|
|
6108
6073
|
const dataDir = join14(homedir5(), ".local", "share", "ai-writing-guide");
|
|
6109
6074
|
return {
|
|
@@ -6116,7 +6081,7 @@ function findAiwgPackageRoot() {
|
|
|
6116
6081
|
if (_cachedAiwgPkgRoot !== void 0)
|
|
6117
6082
|
return _cachedAiwgPkgRoot;
|
|
6118
6083
|
try {
|
|
6119
|
-
const globalRoot =
|
|
6084
|
+
const globalRoot = execSync8("npm root -g", {
|
|
6120
6085
|
encoding: "utf-8",
|
|
6121
6086
|
timeout: 5e3,
|
|
6122
6087
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -6788,7 +6753,7 @@ ${content}`
|
|
|
6788
6753
|
import { existsSync as existsSync13, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5, readFileSync as readFileSync10, unlinkSync } from "node:fs";
|
|
6789
6754
|
import { join as join16, basename as basename4, extname as extname3, resolve as resolve13 } from "node:path";
|
|
6790
6755
|
import { homedir as homedir6 } from "node:os";
|
|
6791
|
-
import { execSync as
|
|
6756
|
+
import { execSync as execSync9, spawn as spawn4 } from "node:child_process";
|
|
6792
6757
|
function isTranscribable(path) {
|
|
6793
6758
|
const ext = extname3(path).toLowerCase();
|
|
6794
6759
|
return AUDIO_EXTS.has(ext) || VIDEO_EXTS.has(ext);
|
|
@@ -6798,7 +6763,7 @@ async function loadTranscribeCli() {
|
|
|
6798
6763
|
return _tcModule;
|
|
6799
6764
|
_tcChecked = true;
|
|
6800
6765
|
try {
|
|
6801
|
-
const globalRoot =
|
|
6766
|
+
const globalRoot = execSync9("npm root -g", {
|
|
6802
6767
|
encoding: "utf-8",
|
|
6803
6768
|
timeout: 5e3,
|
|
6804
6769
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -6963,7 +6928,7 @@ var init_transcribe_tool = __esm({
|
|
|
6963
6928
|
const args = [filePath, "-m", model, "-f", "txt"];
|
|
6964
6929
|
if (diarize)
|
|
6965
6930
|
args.push("--diarize");
|
|
6966
|
-
const output =
|
|
6931
|
+
const output = execSync9(`transcribe-cli ${args.join(" ")}`, {
|
|
6967
6932
|
encoding: "utf-8",
|
|
6968
6933
|
timeout: 3e5,
|
|
6969
6934
|
// 5 min max
|
|
@@ -7030,12 +6995,12 @@ var init_transcribe_tool = __esm({
|
|
|
7030
6995
|
const tmpFile = join16(tmpDir, `download-${Date.now()}${ext}`);
|
|
7031
6996
|
try {
|
|
7032
6997
|
try {
|
|
7033
|
-
|
|
6998
|
+
execSync9(`curl -sL -o "${tmpFile}" "${url}"`, {
|
|
7034
6999
|
timeout: 12e4,
|
|
7035
7000
|
stdio: ["pipe", "pipe", "pipe"]
|
|
7036
7001
|
});
|
|
7037
7002
|
} catch {
|
|
7038
|
-
|
|
7003
|
+
execSync9(`wget -q -O "${tmpFile}" "${url}"`, {
|
|
7039
7004
|
timeout: 12e4,
|
|
7040
7005
|
stdio: ["pipe", "pipe", "pipe"]
|
|
7041
7006
|
});
|
|
@@ -9743,7 +9708,7 @@ ${parts.join("\n\n")}`,
|
|
|
9743
9708
|
|
|
9744
9709
|
// packages/execution/dist/tools/vision.js
|
|
9745
9710
|
import { readFileSync as readFileSync11, existsSync as existsSync14, statSync as statSync5 } from "node:fs";
|
|
9746
|
-
import { execSync as
|
|
9711
|
+
import { execSync as execSync10, spawn as spawn7 } from "node:child_process";
|
|
9747
9712
|
import { resolve as resolve16, extname as extname6, basename as basename5, dirname as dirname6, join as join24 } from "node:path";
|
|
9748
9713
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
9749
9714
|
async function probeStation(endpoint) {
|
|
@@ -9762,7 +9727,7 @@ function findStationBinary() {
|
|
|
9762
9727
|
const oaVenvPython = join24(process.env["HOME"] || "/root", ".open-agents", "venv", "bin", "python");
|
|
9763
9728
|
if (existsSync14(oaVenvPython)) {
|
|
9764
9729
|
try {
|
|
9765
|
-
|
|
9730
|
+
execSync10(`${JSON.stringify(oaVenvPython)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
|
|
9766
9731
|
return oaVenvPython;
|
|
9767
9732
|
} catch {
|
|
9768
9733
|
}
|
|
@@ -9778,14 +9743,14 @@ function findStationBinary() {
|
|
|
9778
9743
|
for (const p of localVenvPaths) {
|
|
9779
9744
|
if (existsSync14(p)) {
|
|
9780
9745
|
try {
|
|
9781
|
-
|
|
9746
|
+
execSync10(`${JSON.stringify(p)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
|
|
9782
9747
|
return p;
|
|
9783
9748
|
} catch {
|
|
9784
9749
|
}
|
|
9785
9750
|
}
|
|
9786
9751
|
}
|
|
9787
9752
|
try {
|
|
9788
|
-
const path =
|
|
9753
|
+
const path = execSync10("which moondream-station", { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3e3 }).trim();
|
|
9789
9754
|
if (path)
|
|
9790
9755
|
return path;
|
|
9791
9756
|
} catch {
|
|
@@ -10117,13 +10082,13 @@ ${response}`, durationMs: performance.now() - start };
|
|
|
10117
10082
|
|
|
10118
10083
|
// packages/execution/dist/tools/desktop-click.js
|
|
10119
10084
|
import { readFileSync as readFileSync12, existsSync as existsSync15 } from "node:fs";
|
|
10120
|
-
import { execSync as
|
|
10085
|
+
import { execSync as execSync11 } from "node:child_process";
|
|
10121
10086
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
10122
10087
|
import { join as join25, dirname as dirname7 } from "node:path";
|
|
10123
10088
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
10124
10089
|
function hasCommand2(cmd) {
|
|
10125
10090
|
try {
|
|
10126
|
-
|
|
10091
|
+
execSync11(`which ${cmd}`, { stdio: "pipe", timeout: 3e3 });
|
|
10127
10092
|
return true;
|
|
10128
10093
|
} catch {
|
|
10129
10094
|
return false;
|
|
@@ -10131,7 +10096,7 @@ function hasCommand2(cmd) {
|
|
|
10131
10096
|
}
|
|
10132
10097
|
function getImageDimensions2(filePath) {
|
|
10133
10098
|
try {
|
|
10134
|
-
const out =
|
|
10099
|
+
const out = execSync11(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
|
|
10135
10100
|
encoding: "utf8",
|
|
10136
10101
|
stdio: ["pipe", "pipe", "pipe"],
|
|
10137
10102
|
timeout: 5e3
|
|
@@ -10142,14 +10107,14 @@ function getImageDimensions2(filePath) {
|
|
|
10142
10107
|
} catch {
|
|
10143
10108
|
}
|
|
10144
10109
|
try {
|
|
10145
|
-
const out =
|
|
10110
|
+
const out = execSync11(`python3 -c "from PIL import Image; i=Image.open(${JSON.stringify(filePath)}); print(i.size[0], i.size[1])"`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 5e3 }).trim();
|
|
10146
10111
|
const [w, h] = out.split(" ").map(Number);
|
|
10147
10112
|
if (w && h)
|
|
10148
10113
|
return { width: w, height: h };
|
|
10149
10114
|
} catch {
|
|
10150
10115
|
}
|
|
10151
10116
|
try {
|
|
10152
|
-
const out =
|
|
10117
|
+
const out = execSync11(`file ${JSON.stringify(filePath)}`, {
|
|
10153
10118
|
encoding: "utf8",
|
|
10154
10119
|
stdio: ["pipe", "pipe", "pipe"],
|
|
10155
10120
|
timeout: 5e3
|
|
@@ -10180,7 +10145,7 @@ function captureScreenshot(outputPath) {
|
|
|
10180
10145
|
cmd = `scrot ${out}`;
|
|
10181
10146
|
} else {
|
|
10182
10147
|
try {
|
|
10183
|
-
|
|
10148
|
+
execSync11(`DISPLAY=:0 python3 -c "from PIL import ImageGrab; ImageGrab.grab().save(${JSON.stringify(outputPath)})"`, { stdio: "pipe", timeout: 1e4 });
|
|
10184
10149
|
if (existsSync15(outputPath))
|
|
10185
10150
|
return;
|
|
10186
10151
|
} catch {
|
|
@@ -10191,7 +10156,7 @@ function captureScreenshot(outputPath) {
|
|
|
10191
10156
|
if (!cmd) {
|
|
10192
10157
|
throw new Error("No screenshot tool found. Auto-install failed. Try manually: sudo apt install scrot");
|
|
10193
10158
|
}
|
|
10194
|
-
|
|
10159
|
+
execSync11(cmd, { stdio: "pipe", timeout: 1e4 });
|
|
10195
10160
|
if (!existsSync15(outputPath)) {
|
|
10196
10161
|
throw new Error("Screenshot file was not created");
|
|
10197
10162
|
}
|
|
@@ -10209,11 +10174,11 @@ function clickAt(x, y, button, clickType) {
|
|
|
10209
10174
|
hasXdotool = dep.available;
|
|
10210
10175
|
}
|
|
10211
10176
|
if (hasXdotool) {
|
|
10212
|
-
|
|
10177
|
+
execSync11(`xdotool mousemove --sync ${rx} ${ry}`, { stdio: "pipe", timeout: 5e3 });
|
|
10213
10178
|
if (clickType === "double") {
|
|
10214
|
-
|
|
10179
|
+
execSync11(`xdotool click --repeat 2 --delay 50 ${buttonNum}`, { stdio: "pipe", timeout: 5e3 });
|
|
10215
10180
|
} else {
|
|
10216
|
-
|
|
10181
|
+
execSync11(`xdotool click ${buttonNum}`, { stdio: "pipe", timeout: 5e3 });
|
|
10217
10182
|
}
|
|
10218
10183
|
return;
|
|
10219
10184
|
}
|
|
@@ -10238,13 +10203,13 @@ for i in range(${clicks}):
|
|
|
10238
10203
|
time.sleep(0.05)
|
|
10239
10204
|
`.trim().replace(/\n/g, "; ");
|
|
10240
10205
|
try {
|
|
10241
|
-
|
|
10206
|
+
execSync11(`DISPLAY=:0 python3 -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
|
|
10242
10207
|
return;
|
|
10243
10208
|
} catch {
|
|
10244
10209
|
}
|
|
10245
10210
|
try {
|
|
10246
10211
|
const venvPy = join25(__dirname2, "../../../../.moondream-venv/bin/python");
|
|
10247
|
-
|
|
10212
|
+
execSync11(`DISPLAY=:0 ${JSON.stringify(venvPy)} -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
|
|
10248
10213
|
return;
|
|
10249
10214
|
} catch {
|
|
10250
10215
|
}
|
|
@@ -10256,11 +10221,11 @@ for i in range(${clicks}):
|
|
|
10256
10221
|
const rx2 = Math.round(x);
|
|
10257
10222
|
const ry2 = Math.round(y);
|
|
10258
10223
|
if (clickType === "double") {
|
|
10259
|
-
|
|
10224
|
+
execSync11(`cliclick dc:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
|
|
10260
10225
|
} else if (button === "right") {
|
|
10261
|
-
|
|
10226
|
+
execSync11(`cliclick rc:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
|
|
10262
10227
|
} else {
|
|
10263
|
-
|
|
10228
|
+
execSync11(`cliclick c:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
|
|
10264
10229
|
}
|
|
10265
10230
|
} else {
|
|
10266
10231
|
throw new Error(`Desktop click not supported on platform: ${plat}`);
|
|
@@ -10576,7 +10541,7 @@ ${data.response}`);
|
|
|
10576
10541
|
const tess = ensureCommand("tesseract");
|
|
10577
10542
|
if (tess.available) {
|
|
10578
10543
|
try {
|
|
10579
|
-
ocrText =
|
|
10544
|
+
ocrText = execSync11(`tesseract ${JSON.stringify(screenshotPath)} stdout 2>/dev/null`, {
|
|
10580
10545
|
encoding: "utf8",
|
|
10581
10546
|
timeout: 15e3
|
|
10582
10547
|
}).trim();
|
|
@@ -10627,7 +10592,7 @@ Screen: ${dims.width}x${dims.height}`);
|
|
|
10627
10592
|
// packages/execution/dist/tools/ocr-pdf.js
|
|
10628
10593
|
import { existsSync as existsSync16, statSync as statSync6 } from "node:fs";
|
|
10629
10594
|
import { resolve as resolve17, basename as basename6 } from "node:path";
|
|
10630
|
-
import { execSync as
|
|
10595
|
+
import { execSync as execSync12 } from "node:child_process";
|
|
10631
10596
|
var OcrPdfTool;
|
|
10632
10597
|
var init_ocr_pdf = __esm({
|
|
10633
10598
|
"packages/execution/dist/tools/ocr-pdf.js"() {
|
|
@@ -10714,7 +10679,7 @@ var init_ocr_pdf = __esm({
|
|
|
10714
10679
|
cmdParts.push(JSON.stringify(inputPath));
|
|
10715
10680
|
cmdParts.push(JSON.stringify(outputPath));
|
|
10716
10681
|
try {
|
|
10717
|
-
const stdout =
|
|
10682
|
+
const stdout = execSync12(cmdParts.join(" "), {
|
|
10718
10683
|
encoding: "utf8",
|
|
10719
10684
|
stdio: ["pipe", "pipe", "pipe"],
|
|
10720
10685
|
timeout: 6e5,
|
|
@@ -10750,7 +10715,7 @@ Language: ${language}
|
|
|
10750
10715
|
// packages/execution/dist/tools/pdf-to-text.js
|
|
10751
10716
|
import { existsSync as existsSync17, statSync as statSync7, readFileSync as readFileSync13, unlinkSync as unlinkSync3 } from "node:fs";
|
|
10752
10717
|
import { resolve as resolve18, basename as basename7, join as join26 } from "node:path";
|
|
10753
|
-
import { execSync as
|
|
10718
|
+
import { execSync as execSync13 } from "node:child_process";
|
|
10754
10719
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
10755
10720
|
var PdfToTextTool;
|
|
10756
10721
|
var init_pdf_to_text = __esm({
|
|
@@ -10846,7 +10811,7 @@ var init_pdf_to_text = __esm({
|
|
|
10846
10811
|
cmdParts.push("-l", String(lastPage));
|
|
10847
10812
|
cmdParts.push(JSON.stringify(fullPath), "-");
|
|
10848
10813
|
try {
|
|
10849
|
-
let text =
|
|
10814
|
+
let text = execSync13(cmdParts.join(" "), {
|
|
10850
10815
|
encoding: "utf8",
|
|
10851
10816
|
stdio: ["pipe", "pipe", "pipe"],
|
|
10852
10817
|
timeout: 12e4
|
|
@@ -10906,14 +10871,14 @@ ${text}`,
|
|
|
10906
10871
|
const tmpPdf = join26(tmpdir5(), `oa-ocr-${Date.now()}.pdf`);
|
|
10907
10872
|
try {
|
|
10908
10873
|
const ocrCmd = `ocrmypdf -l ${language} --skip-text ${JSON.stringify(inputPath)} ${JSON.stringify(tmpPdf)}`;
|
|
10909
|
-
|
|
10874
|
+
execSync13(ocrCmd, { stdio: "pipe", timeout: 6e5 });
|
|
10910
10875
|
const textCmdParts = ["pdftotext"];
|
|
10911
10876
|
if (firstPage)
|
|
10912
10877
|
textCmdParts.push("-f", String(firstPage));
|
|
10913
10878
|
if (lastPage)
|
|
10914
10879
|
textCmdParts.push("-l", String(lastPage));
|
|
10915
10880
|
textCmdParts.push(JSON.stringify(tmpPdf), "-");
|
|
10916
|
-
const text =
|
|
10881
|
+
const text = execSync13(textCmdParts.join(" "), {
|
|
10917
10882
|
encoding: "utf8",
|
|
10918
10883
|
stdio: ["pipe", "pipe", "pipe"],
|
|
10919
10884
|
timeout: 12e4
|
|
@@ -10935,7 +10900,7 @@ ${text}`,
|
|
|
10935
10900
|
// packages/execution/dist/tools/ocr-image-advanced.js
|
|
10936
10901
|
import { existsSync as existsSync18, statSync as statSync8 } from "node:fs";
|
|
10937
10902
|
import { resolve as resolve19, basename as basename8, dirname as dirname8, join as join27 } from "node:path";
|
|
10938
|
-
import { execSync as
|
|
10903
|
+
import { execSync as execSync14 } from "node:child_process";
|
|
10939
10904
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
10940
10905
|
import { homedir as homedir7, tmpdir as tmpdir6 } from "node:os";
|
|
10941
10906
|
function findOcrScript() {
|
|
@@ -10955,7 +10920,7 @@ function findPython() {
|
|
|
10955
10920
|
const venvPython = join27(homedir7(), ".open-agents", "venv", "bin", "python");
|
|
10956
10921
|
if (existsSync18(venvPython)) {
|
|
10957
10922
|
try {
|
|
10958
|
-
|
|
10923
|
+
execSync14(`${JSON.stringify(venvPython)} -c "import cv2, pytesseract, numpy, PIL"`, {
|
|
10959
10924
|
stdio: "pipe",
|
|
10960
10925
|
timeout: 5e3
|
|
10961
10926
|
});
|
|
@@ -10964,7 +10929,7 @@ function findPython() {
|
|
|
10964
10929
|
}
|
|
10965
10930
|
}
|
|
10966
10931
|
try {
|
|
10967
|
-
|
|
10932
|
+
execSync14(`python3 -c "import cv2, pytesseract, numpy, PIL"`, {
|
|
10968
10933
|
stdio: "pipe",
|
|
10969
10934
|
timeout: 5e3
|
|
10970
10935
|
});
|
|
@@ -11102,7 +11067,7 @@ var init_ocr_image_advanced = __esm({
|
|
|
11102
11067
|
cmdParts.push("--debug-dir", debugDir);
|
|
11103
11068
|
}
|
|
11104
11069
|
try {
|
|
11105
|
-
const stdout =
|
|
11070
|
+
const stdout = execSync14(cmdParts.join(" "), {
|
|
11106
11071
|
encoding: "utf8",
|
|
11107
11072
|
stdio: ["pipe", "pipe", "pipe"],
|
|
11108
11073
|
timeout: 3e5,
|
|
@@ -11198,14 +11163,14 @@ var init_ocr_image_advanced = __esm({
|
|
|
11198
11163
|
try {
|
|
11199
11164
|
const [x, y, w, h] = region.split(",").map(Number);
|
|
11200
11165
|
const croppedPath = join27(tmpdir6(), `oa-ocr-crop-${Date.now()}.png`);
|
|
11201
|
-
|
|
11166
|
+
execSync14(`convert ${JSON.stringify(imagePath)} -crop ${w}x${h}+${x}+${y} +repage ${JSON.stringify(croppedPath)}`, { stdio: "pipe", timeout: 1e4 });
|
|
11202
11167
|
inputPath = croppedPath;
|
|
11203
11168
|
} catch {
|
|
11204
11169
|
}
|
|
11205
11170
|
}
|
|
11206
11171
|
const psmArg = psm ?? 6;
|
|
11207
11172
|
try {
|
|
11208
|
-
const text =
|
|
11173
|
+
const text = execSync14(`tesseract ${JSON.stringify(inputPath)} stdout -l ${language} --psm ${psmArg} 2>/dev/null`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 6e4 }).trim();
|
|
11209
11174
|
if (!text) {
|
|
11210
11175
|
return {
|
|
11211
11176
|
success: true,
|
|
@@ -11236,7 +11201,7 @@ Note: Advanced Python pipeline not available \u2014 install pytesseract, opencv-
|
|
|
11236
11201
|
});
|
|
11237
11202
|
|
|
11238
11203
|
// packages/execution/dist/tools/browser-action.js
|
|
11239
|
-
import { execSync as
|
|
11204
|
+
import { execSync as execSync15, spawn as spawn8 } from "node:child_process";
|
|
11240
11205
|
import { existsSync as existsSync19, readFileSync as readFileSync14 } from "node:fs";
|
|
11241
11206
|
import { join as join28, dirname as dirname9 } from "node:path";
|
|
11242
11207
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
@@ -11267,7 +11232,7 @@ async function probeService() {
|
|
|
11267
11232
|
function findPython2() {
|
|
11268
11233
|
for (const cmd of ["python3", "python"]) {
|
|
11269
11234
|
try {
|
|
11270
|
-
const ver =
|
|
11235
|
+
const ver = execSync15(`${cmd} --version 2>&1`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
|
|
11271
11236
|
if (ver.includes("Python 3"))
|
|
11272
11237
|
return cmd;
|
|
11273
11238
|
} catch {
|
|
@@ -11502,7 +11467,7 @@ var init_browser_action = __esm({
|
|
|
11502
11467
|
});
|
|
11503
11468
|
|
|
11504
11469
|
// packages/execution/dist/tools/autoresearch.js
|
|
11505
|
-
import { execSync as
|
|
11470
|
+
import { execSync as execSync16, spawn as spawn9 } from "node:child_process";
|
|
11506
11471
|
import { existsSync as existsSync20, readFileSync as readFileSync15, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6, appendFileSync, copyFileSync } from "node:fs";
|
|
11507
11472
|
import { join as join29, resolve as resolve20, dirname as dirname10 } from "node:path";
|
|
11508
11473
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
@@ -11632,13 +11597,13 @@ Requires: NVIDIA GPU, Python 3.10+, uv (astral.sh package manager).`;
|
|
|
11632
11597
|
async setup(workspace, args, start) {
|
|
11633
11598
|
const output = [];
|
|
11634
11599
|
try {
|
|
11635
|
-
|
|
11600
|
+
execSync16("which uv", { encoding: "utf-8", timeout: 5e3 });
|
|
11636
11601
|
output.push("uv: found");
|
|
11637
11602
|
} catch {
|
|
11638
11603
|
return { success: false, output: "", error: "uv not found. Install with: curl -LsSf https://astral.sh/uv/install.sh | sh", durationMs: Date.now() - start };
|
|
11639
11604
|
}
|
|
11640
11605
|
try {
|
|
11641
|
-
const gpuInfo =
|
|
11606
|
+
const gpuInfo = execSync16("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null || echo 'no GPU'", { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
11642
11607
|
output.push(`GPU: ${gpuInfo}`);
|
|
11643
11608
|
} catch {
|
|
11644
11609
|
output.push("GPU: detection failed (nvidia-smi not available)");
|
|
@@ -11688,10 +11653,10 @@ explicit = true
|
|
|
11688
11653
|
writeFileSync6(join29(workspace, "pyproject.toml"), pyprojectContent, "utf-8");
|
|
11689
11654
|
output.push("Created pyproject.toml");
|
|
11690
11655
|
try {
|
|
11691
|
-
|
|
11656
|
+
execSync16("git rev-parse --git-dir", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
|
|
11692
11657
|
output.push("Git: already initialized");
|
|
11693
11658
|
} catch {
|
|
11694
|
-
|
|
11659
|
+
execSync16("git init && git add -A && git commit -m 'autoresearch: initial setup'", {
|
|
11695
11660
|
cwd: workspace,
|
|
11696
11661
|
encoding: "utf-8",
|
|
11697
11662
|
timeout: 1e4
|
|
@@ -11701,14 +11666,14 @@ explicit = true
|
|
|
11701
11666
|
const tag = String(args["tag"] ?? (/* @__PURE__ */ new Date()).toISOString().slice(5, 10).replace("-", ""));
|
|
11702
11667
|
const branchName = `autoresearch/${tag}`;
|
|
11703
11668
|
try {
|
|
11704
|
-
|
|
11669
|
+
execSync16(`git checkout -b ${branchName}`, { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
|
|
11705
11670
|
output.push(`Branch: created ${branchName}`);
|
|
11706
11671
|
} catch {
|
|
11707
11672
|
output.push(`Branch: ${branchName} may already exist, staying on current branch`);
|
|
11708
11673
|
}
|
|
11709
11674
|
output.push("Installing dependencies with uv sync (this may take a while)...");
|
|
11710
11675
|
try {
|
|
11711
|
-
const uvOut =
|
|
11676
|
+
const uvOut = execSync16("uv sync 2>&1", { cwd: workspace, encoding: "utf-8", timeout: 3e5 });
|
|
11712
11677
|
output.push(`uv sync: ${uvOut.trim().split("\n").slice(-3).join(" | ")}`);
|
|
11713
11678
|
} catch (err) {
|
|
11714
11679
|
const e = err;
|
|
@@ -11717,7 +11682,7 @@ explicit = true
|
|
|
11717
11682
|
const numShards = Number(args["num_shards"] ?? 10);
|
|
11718
11683
|
output.push(`Preparing data (${numShards} shards)...`);
|
|
11719
11684
|
try {
|
|
11720
|
-
const prepOut =
|
|
11685
|
+
const prepOut = execSync16(`uv run prepare.py --num-shards ${numShards} 2>&1`, {
|
|
11721
11686
|
cwd: workspace,
|
|
11722
11687
|
encoding: "utf-8",
|
|
11723
11688
|
timeout: 6e5
|
|
@@ -11754,7 +11719,7 @@ Next steps:
|
|
|
11754
11719
|
}
|
|
11755
11720
|
if (!existsSync20(join29(workspace, ".venv")) && existsSync20(join29(workspace, "pyproject.toml"))) {
|
|
11756
11721
|
try {
|
|
11757
|
-
|
|
11722
|
+
execSync16("uv sync 2>&1", { cwd: workspace, encoding: "utf-8", timeout: 3e5 });
|
|
11758
11723
|
} catch {
|
|
11759
11724
|
}
|
|
11760
11725
|
}
|
|
@@ -11904,15 +11869,15 @@ Run autoresearch(action="setup") to begin.`,
|
|
|
11904
11869
|
}
|
|
11905
11870
|
output.push(`Workspace: ${workspace}`);
|
|
11906
11871
|
try {
|
|
11907
|
-
const branch =
|
|
11872
|
+
const branch = execSync16("git branch --show-current", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
|
|
11908
11873
|
output.push(`Branch: ${branch}`);
|
|
11909
|
-
const lastCommit =
|
|
11874
|
+
const lastCommit = execSync16("git log --oneline -1", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
|
|
11910
11875
|
output.push(`Last commit: ${lastCommit}`);
|
|
11911
11876
|
} catch {
|
|
11912
11877
|
output.push("Git: not initialized");
|
|
11913
11878
|
}
|
|
11914
11879
|
try {
|
|
11915
|
-
const gpuInfo =
|
|
11880
|
+
const gpuInfo = execSync16("nvidia-smi --query-gpu=name,memory.total,memory.used --format=csv,noheader 2>/dev/null", { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
11916
11881
|
output.push(`GPU: ${gpuInfo}`);
|
|
11917
11882
|
} catch {
|
|
11918
11883
|
output.push("GPU: not detected");
|
|
@@ -11955,12 +11920,12 @@ Run autoresearch(action="setup") to begin.`,
|
|
|
11955
11920
|
memGb = memGb ?? 0;
|
|
11956
11921
|
let commitHash = "0000000";
|
|
11957
11922
|
try {
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
commitHash =
|
|
11923
|
+
execSync16("git add train.py", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
|
|
11924
|
+
execSync16(`git commit -m "autoresearch: ${desc}"`, { cwd: workspace, encoding: "utf-8", timeout: 1e4 });
|
|
11925
|
+
commitHash = execSync16("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
|
|
11961
11926
|
} catch {
|
|
11962
11927
|
try {
|
|
11963
|
-
commitHash =
|
|
11928
|
+
commitHash = execSync16("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
|
|
11964
11929
|
} catch {
|
|
11965
11930
|
}
|
|
11966
11931
|
}
|
|
@@ -11994,14 +11959,14 @@ Branch advanced. Ready for next experiment.`,
|
|
|
11994
11959
|
memGb = memGb ?? 0;
|
|
11995
11960
|
let commitHash = "0000000";
|
|
11996
11961
|
try {
|
|
11997
|
-
commitHash =
|
|
11962
|
+
commitHash = execSync16("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
|
|
11998
11963
|
} catch {
|
|
11999
11964
|
}
|
|
12000
11965
|
const row = `${commitHash} ${valBpb.toFixed(6)} ${memGb.toFixed(1)} discard ${desc}
|
|
12001
11966
|
`;
|
|
12002
11967
|
appendFileSync(tsvPath, row, "utf-8");
|
|
12003
11968
|
try {
|
|
12004
|
-
|
|
11969
|
+
execSync16("git checkout -- train.py", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
|
|
12005
11970
|
} catch {
|
|
12006
11971
|
return {
|
|
12007
11972
|
success: false,
|
|
@@ -12022,7 +11987,7 @@ train.py reverted to last kept state. Ready for next experiment.`,
|
|
|
12022
11987
|
});
|
|
12023
11988
|
|
|
12024
11989
|
// packages/execution/dist/tools/scheduler.js
|
|
12025
|
-
import { execSync as
|
|
11990
|
+
import { execSync as execSync17, exec as execCb } from "node:child_process";
|
|
12026
11991
|
import { readFile as readFile14, writeFile as writeFile13, mkdir as mkdir9 } from "node:fs/promises";
|
|
12027
11992
|
import { resolve as resolve21, join as join30 } from "node:path";
|
|
12028
11993
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -12084,19 +12049,19 @@ function describeCron(expr) {
|
|
|
12084
12049
|
}
|
|
12085
12050
|
function getCurrentCrontab() {
|
|
12086
12051
|
try {
|
|
12087
|
-
return
|
|
12052
|
+
return execSync17("crontab -l 2>/dev/null", { stdio: "pipe" }).toString().split("\n");
|
|
12088
12053
|
} catch {
|
|
12089
12054
|
return [];
|
|
12090
12055
|
}
|
|
12091
12056
|
}
|
|
12092
12057
|
function writeCrontab(lines) {
|
|
12093
12058
|
const content = lines.join("\n") + "\n";
|
|
12094
|
-
|
|
12059
|
+
execSync17(`echo ${JSON.stringify(content)} | crontab -`, { stdio: "pipe" });
|
|
12095
12060
|
}
|
|
12096
12061
|
function findOaBinary() {
|
|
12097
12062
|
for (const cmd of ["oa", "open-agents"]) {
|
|
12098
12063
|
try {
|
|
12099
|
-
const path =
|
|
12064
|
+
const path = execSync17(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
|
|
12100
12065
|
if (path)
|
|
12101
12066
|
return path;
|
|
12102
12067
|
} catch {
|
|
@@ -13022,13 +12987,13 @@ ${sections.join("\n")}`,
|
|
|
13022
12987
|
});
|
|
13023
12988
|
|
|
13024
12989
|
// packages/execution/dist/tools/opencode.js
|
|
13025
|
-
import { execSync as
|
|
12990
|
+
import { execSync as execSync18, spawn as spawn10 } from "node:child_process";
|
|
13026
12991
|
import { existsSync as existsSync21 } from "node:fs";
|
|
13027
12992
|
import { join as join33, resolve as resolve24 } from "node:path";
|
|
13028
12993
|
function findOpencode() {
|
|
13029
12994
|
for (const cmd of ["opencode"]) {
|
|
13030
12995
|
try {
|
|
13031
|
-
const path =
|
|
12996
|
+
const path = execSync18(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
|
|
13032
12997
|
if (path)
|
|
13033
12998
|
return path;
|
|
13034
12999
|
} catch {
|
|
@@ -13048,7 +13013,7 @@ function findOpencode() {
|
|
|
13048
13013
|
}
|
|
13049
13014
|
function getVersion(binary) {
|
|
13050
13015
|
try {
|
|
13051
|
-
return
|
|
13016
|
+
return execSync18(`${binary} --version 2>/dev/null`, { stdio: "pipe", timeout: 1e4 }).toString().trim();
|
|
13052
13017
|
} catch {
|
|
13053
13018
|
return "unknown";
|
|
13054
13019
|
}
|
|
@@ -13057,12 +13022,12 @@ function installOpencode() {
|
|
|
13057
13022
|
const platform5 = process.platform;
|
|
13058
13023
|
try {
|
|
13059
13024
|
if (platform5 === "win32") {
|
|
13060
|
-
|
|
13025
|
+
execSync18('powershell -Command "irm https://opencode.ai/install | iex"', {
|
|
13061
13026
|
stdio: "pipe",
|
|
13062
13027
|
timeout: 12e4
|
|
13063
13028
|
});
|
|
13064
13029
|
} else {
|
|
13065
|
-
|
|
13030
|
+
execSync18("curl -fsSL https://opencode.ai/install | bash", {
|
|
13066
13031
|
stdio: "pipe",
|
|
13067
13032
|
timeout: 12e4
|
|
13068
13033
|
});
|
|
@@ -13296,13 +13261,13 @@ var init_opencode = __esm({
|
|
|
13296
13261
|
});
|
|
13297
13262
|
|
|
13298
13263
|
// packages/execution/dist/tools/factory.js
|
|
13299
|
-
import { execSync as
|
|
13264
|
+
import { execSync as execSync19, spawn as spawn11 } from "node:child_process";
|
|
13300
13265
|
import { existsSync as existsSync22 } from "node:fs";
|
|
13301
13266
|
import { join as join34 } from "node:path";
|
|
13302
13267
|
function findDroid() {
|
|
13303
13268
|
for (const cmd of ["droid"]) {
|
|
13304
13269
|
try {
|
|
13305
|
-
const path =
|
|
13270
|
+
const path = execSync19(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
|
|
13306
13271
|
if (path)
|
|
13307
13272
|
return path;
|
|
13308
13273
|
} catch {
|
|
@@ -13322,7 +13287,7 @@ function findDroid() {
|
|
|
13322
13287
|
}
|
|
13323
13288
|
function getVersion2(binary) {
|
|
13324
13289
|
try {
|
|
13325
|
-
return
|
|
13290
|
+
return execSync19(`${binary} --version 2>/dev/null`, { stdio: "pipe", timeout: 1e4 }).toString().trim();
|
|
13326
13291
|
} catch {
|
|
13327
13292
|
return "unknown";
|
|
13328
13293
|
}
|
|
@@ -13331,12 +13296,12 @@ function installDroid() {
|
|
|
13331
13296
|
const platform5 = process.platform;
|
|
13332
13297
|
try {
|
|
13333
13298
|
if (platform5 === "win32") {
|
|
13334
|
-
|
|
13299
|
+
execSync19('powershell -Command "irm https://app.factory.ai/cli/windows | iex"', {
|
|
13335
13300
|
stdio: "pipe",
|
|
13336
13301
|
timeout: 12e4
|
|
13337
13302
|
});
|
|
13338
13303
|
} else {
|
|
13339
|
-
|
|
13304
|
+
execSync19("curl -fsSL https://app.factory.ai/cli | sh", {
|
|
13340
13305
|
stdio: "pipe",
|
|
13341
13306
|
timeout: 12e4
|
|
13342
13307
|
});
|
|
@@ -13605,7 +13570,7 @@ var init_factory = __esm({
|
|
|
13605
13570
|
});
|
|
13606
13571
|
|
|
13607
13572
|
// packages/execution/dist/tools/cron-agent.js
|
|
13608
|
-
import { execSync as
|
|
13573
|
+
import { execSync as execSync20 } from "node:child_process";
|
|
13609
13574
|
import { readFile as readFile17, writeFile as writeFile16, mkdir as mkdir12 } from "node:fs/promises";
|
|
13610
13575
|
import { resolve as resolve25, join as join35 } from "node:path";
|
|
13611
13576
|
import { randomBytes as randomBytes6 } from "node:crypto";
|
|
@@ -13669,19 +13634,19 @@ function resolveSchedule2(schedule) {
|
|
|
13669
13634
|
}
|
|
13670
13635
|
function getCurrentCrontab2() {
|
|
13671
13636
|
try {
|
|
13672
|
-
return
|
|
13637
|
+
return execSync20("crontab -l 2>/dev/null", { stdio: "pipe" }).toString().split("\n");
|
|
13673
13638
|
} catch {
|
|
13674
13639
|
return [];
|
|
13675
13640
|
}
|
|
13676
13641
|
}
|
|
13677
13642
|
function writeCrontab2(lines) {
|
|
13678
13643
|
const content = lines.join("\n") + "\n";
|
|
13679
|
-
|
|
13644
|
+
execSync20(`echo ${JSON.stringify(content)} | crontab -`, { stdio: "pipe" });
|
|
13680
13645
|
}
|
|
13681
13646
|
function findOaBinary2() {
|
|
13682
13647
|
for (const cmd of ["oa", "open-agents"]) {
|
|
13683
13648
|
try {
|
|
13684
|
-
const path =
|
|
13649
|
+
const path = execSync20(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
|
|
13685
13650
|
if (path)
|
|
13686
13651
|
return path;
|
|
13687
13652
|
} catch {
|
|
@@ -14024,7 +13989,7 @@ ${truncated}`, durationMs: performance.now() - start };
|
|
|
14024
13989
|
];
|
|
14025
13990
|
if (job.verifyCommand) {
|
|
14026
13991
|
try {
|
|
14027
|
-
const result =
|
|
13992
|
+
const result = execSync20(job.verifyCommand, {
|
|
14028
13993
|
cwd: this.workingDir,
|
|
14029
13994
|
stdio: "pipe",
|
|
14030
13995
|
timeout: 3e4
|
|
@@ -14074,7 +14039,7 @@ import { readFile as readFile18, writeFile as writeFile17, mkdir as mkdir13, chm
|
|
|
14074
14039
|
import { existsSync as existsSync23, readFileSync as readFileSync16, watch as fsWatchLocal } from "node:fs";
|
|
14075
14040
|
import { resolve as resolve26, join as join36 } from "node:path";
|
|
14076
14041
|
import { randomBytes as randomBytes7, createCipheriv, createDecipheriv, scryptSync, createHash } from "node:crypto";
|
|
14077
|
-
import { execSync as
|
|
14042
|
+
import { execSync as execSync21, spawn as spawn12 } from "node:child_process";
|
|
14078
14043
|
import { hostname, userInfo } from "node:os";
|
|
14079
14044
|
function containsKeyMaterial(input) {
|
|
14080
14045
|
for (const pattern of KEY_PATTERNS) {
|
|
@@ -17280,7 +17245,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
17280
17245
|
}
|
|
17281
17246
|
async doInferenceProof() {
|
|
17282
17247
|
try {
|
|
17283
|
-
const psRaw =
|
|
17248
|
+
const psRaw = execSync21("ollama ps 2>/dev/null", { timeout: 1e4, encoding: "utf8" });
|
|
17284
17249
|
const lines = psRaw.trim().split("\n").filter((l) => l.trim());
|
|
17285
17250
|
if (lines.length < 2)
|
|
17286
17251
|
return "No model loaded. Run 'ollama ps' to check.";
|
|
@@ -17288,7 +17253,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
17288
17253
|
const modelName = parts[0] || "unknown";
|
|
17289
17254
|
let gpuName = "none", vramMb = 0;
|
|
17290
17255
|
try {
|
|
17291
|
-
const smi =
|
|
17256
|
+
const smi = execSync21("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null", {
|
|
17292
17257
|
timeout: 5e3,
|
|
17293
17258
|
encoding: "utf8"
|
|
17294
17259
|
});
|
|
@@ -17297,7 +17262,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
17297
17262
|
vramMb = parseInt(gp[1]?.trim() || "0", 10);
|
|
17298
17263
|
} catch {
|
|
17299
17264
|
try {
|
|
17300
|
-
|
|
17265
|
+
execSync21("rocm-smi 2>/dev/null", { timeout: 5e3 });
|
|
17301
17266
|
gpuName = "AMD GPU";
|
|
17302
17267
|
} catch {
|
|
17303
17268
|
}
|
|
@@ -24770,7 +24735,7 @@ __export(listen_exports, {
|
|
|
24770
24735
|
isVideoPath: () => isVideoPath,
|
|
24771
24736
|
waitForTranscribeCli: () => waitForTranscribeCli
|
|
24772
24737
|
});
|
|
24773
|
-
import { spawn as spawn15, execSync as
|
|
24738
|
+
import { spawn as spawn15, execSync as execSync22 } from "node:child_process";
|
|
24774
24739
|
import { existsSync as existsSync27, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, readdirSync as readdirSync6 } from "node:fs";
|
|
24775
24740
|
import { join as join41, dirname as dirname13 } from "node:path";
|
|
24776
24741
|
import { homedir as homedir8 } from "node:os";
|
|
@@ -24792,7 +24757,7 @@ function findMicCaptureCommand() {
|
|
|
24792
24757
|
const platform5 = process.platform;
|
|
24793
24758
|
if (platform5 === "linux") {
|
|
24794
24759
|
try {
|
|
24795
|
-
|
|
24760
|
+
execSync22("which arecord", { stdio: "pipe" });
|
|
24796
24761
|
return {
|
|
24797
24762
|
cmd: "arecord",
|
|
24798
24763
|
args: ["-f", "S16_LE", "-r", "16000", "-c", "1", "-t", "raw", "-q", "-"]
|
|
@@ -24802,7 +24767,7 @@ function findMicCaptureCommand() {
|
|
|
24802
24767
|
}
|
|
24803
24768
|
if (platform5 === "darwin") {
|
|
24804
24769
|
try {
|
|
24805
|
-
|
|
24770
|
+
execSync22("which sox", { stdio: "pipe" });
|
|
24806
24771
|
return {
|
|
24807
24772
|
cmd: "sox",
|
|
24808
24773
|
args: ["-d", "-t", "raw", "-r", "16000", "-c", "1", "-b", "16", "-e", "signed-integer", "-"]
|
|
@@ -24811,7 +24776,7 @@ function findMicCaptureCommand() {
|
|
|
24811
24776
|
}
|
|
24812
24777
|
}
|
|
24813
24778
|
try {
|
|
24814
|
-
|
|
24779
|
+
execSync22("which ffmpeg", { stdio: "pipe" });
|
|
24815
24780
|
if (platform5 === "linux") {
|
|
24816
24781
|
return {
|
|
24817
24782
|
cmd: "ffmpeg",
|
|
@@ -24870,7 +24835,7 @@ function findLiveWhisperScript() {
|
|
|
24870
24835
|
return p;
|
|
24871
24836
|
}
|
|
24872
24837
|
try {
|
|
24873
|
-
const globalRoot =
|
|
24838
|
+
const globalRoot = execSync22("npm root -g", {
|
|
24874
24839
|
encoding: "utf-8",
|
|
24875
24840
|
timeout: 5e3,
|
|
24876
24841
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -24903,7 +24868,7 @@ function ensureTranscribeCliBackground() {
|
|
|
24903
24868
|
return;
|
|
24904
24869
|
_bgInstallPromise = (async () => {
|
|
24905
24870
|
try {
|
|
24906
|
-
const globalRoot =
|
|
24871
|
+
const globalRoot = execSync22("npm root -g", {
|
|
24907
24872
|
encoding: "utf-8",
|
|
24908
24873
|
timeout: 5e3,
|
|
24909
24874
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -25109,7 +25074,7 @@ var init_listen = __esm({
|
|
|
25109
25074
|
}
|
|
25110
25075
|
if (!this.transcribeCliAvailable) {
|
|
25111
25076
|
try {
|
|
25112
|
-
|
|
25077
|
+
execSync22("which transcribe-cli", { stdio: "pipe" });
|
|
25113
25078
|
this.transcribeCliAvailable = true;
|
|
25114
25079
|
} catch {
|
|
25115
25080
|
this.transcribeCliAvailable = false;
|
|
@@ -25126,7 +25091,7 @@ var init_listen = __esm({
|
|
|
25126
25091
|
} catch {
|
|
25127
25092
|
}
|
|
25128
25093
|
try {
|
|
25129
|
-
const globalRoot =
|
|
25094
|
+
const globalRoot = execSync22("npm root -g", {
|
|
25130
25095
|
encoding: "utf-8",
|
|
25131
25096
|
timeout: 5e3,
|
|
25132
25097
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -25176,7 +25141,7 @@ var init_listen = __esm({
|
|
|
25176
25141
|
}
|
|
25177
25142
|
if (!tc) {
|
|
25178
25143
|
try {
|
|
25179
|
-
|
|
25144
|
+
execSync22("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
|
|
25180
25145
|
this.transcribeCliAvailable = null;
|
|
25181
25146
|
tc = await this.loadTranscribeCli();
|
|
25182
25147
|
} catch {
|
|
@@ -25359,7 +25324,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
25359
25324
|
}
|
|
25360
25325
|
if (!tc) {
|
|
25361
25326
|
try {
|
|
25362
|
-
|
|
25327
|
+
execSync22("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
|
|
25363
25328
|
this.transcribeCliAvailable = null;
|
|
25364
25329
|
tc = await this.loadTranscribeCli();
|
|
25365
25330
|
} catch {
|
|
@@ -25413,7 +25378,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
25413
25378
|
}
|
|
25414
25379
|
if (!tc) {
|
|
25415
25380
|
try {
|
|
25416
|
-
|
|
25381
|
+
execSync22("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
|
|
25417
25382
|
this.transcribeCliAvailable = null;
|
|
25418
25383
|
tc = await this.loadTranscribeCli();
|
|
25419
25384
|
} catch {
|
|
@@ -30057,7 +30022,7 @@ var init_render = __esm({
|
|
|
30057
30022
|
|
|
30058
30023
|
// packages/cli/dist/tui/voice-session.js
|
|
30059
30024
|
import { createServer as createServer2 } from "node:http";
|
|
30060
|
-
import { spawn as spawn16, execSync as
|
|
30025
|
+
import { spawn as spawn16, execSync as execSync23 } from "node:child_process";
|
|
30061
30026
|
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
30062
30027
|
function generateFrontendHTML() {
|
|
30063
30028
|
return `<!DOCTYPE html>
|
|
@@ -34623,7 +34588,7 @@ var init_oa_directory = __esm({
|
|
|
34623
34588
|
|
|
34624
34589
|
// packages/cli/dist/tui/setup.js
|
|
34625
34590
|
import * as readline from "node:readline";
|
|
34626
|
-
import { execSync as
|
|
34591
|
+
import { execSync as execSync24, spawn as spawn18, exec as exec2 } from "node:child_process";
|
|
34627
34592
|
import { promisify as promisify5 } from "node:util";
|
|
34628
34593
|
import { existsSync as existsSync32, writeFileSync as writeFileSync13, readFileSync as readFileSync23, appendFileSync as appendFileSync2, mkdirSync as mkdirSync12 } from "node:fs";
|
|
34629
34594
|
import { join as join47 } from "node:path";
|
|
@@ -34634,7 +34599,7 @@ function detectSystemSpecs() {
|
|
|
34634
34599
|
let gpuVramGB = 0;
|
|
34635
34600
|
let gpuName = "";
|
|
34636
34601
|
try {
|
|
34637
|
-
const memInfo =
|
|
34602
|
+
const memInfo = execSync24("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
|
|
34638
34603
|
encoding: "utf8",
|
|
34639
34604
|
timeout: 5e3
|
|
34640
34605
|
});
|
|
@@ -34654,7 +34619,7 @@ function detectSystemSpecs() {
|
|
|
34654
34619
|
} catch {
|
|
34655
34620
|
}
|
|
34656
34621
|
try {
|
|
34657
|
-
const nvidiaSmi =
|
|
34622
|
+
const nvidiaSmi = execSync24("nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
|
|
34658
34623
|
const lines = nvidiaSmi.trim().split("\n");
|
|
34659
34624
|
if (lines.length > 0) {
|
|
34660
34625
|
for (const line of lines) {
|
|
@@ -34833,7 +34798,7 @@ function ensureCurl() {
|
|
|
34833
34798
|
for (const s of strategies) {
|
|
34834
34799
|
if (hasCmd(s.check)) {
|
|
34835
34800
|
try {
|
|
34836
|
-
|
|
34801
|
+
execSync24(s.install, { stdio: "inherit", timeout: 12e4 });
|
|
34837
34802
|
if (hasCmd("curl")) {
|
|
34838
34803
|
process.stdout.write(` ${c2.green("\u2714")} curl installed via ${s.label}.
|
|
34839
34804
|
`);
|
|
@@ -34847,7 +34812,7 @@ function ensureCurl() {
|
|
|
34847
34812
|
}
|
|
34848
34813
|
if (plat === "darwin") {
|
|
34849
34814
|
try {
|
|
34850
|
-
|
|
34815
|
+
execSync24("xcode-select --install", { stdio: "inherit", timeout: 3e5 });
|
|
34851
34816
|
if (hasCmd("curl"))
|
|
34852
34817
|
return true;
|
|
34853
34818
|
} catch {
|
|
@@ -34882,7 +34847,7 @@ function installOllamaLinux() {
|
|
|
34882
34847
|
|
|
34883
34848
|
`);
|
|
34884
34849
|
try {
|
|
34885
|
-
|
|
34850
|
+
execSync24("curl -fsSL https://ollama.com/install.sh | sh", {
|
|
34886
34851
|
stdio: "inherit",
|
|
34887
34852
|
timeout: 3e5
|
|
34888
34853
|
});
|
|
@@ -34910,7 +34875,7 @@ async function installOllamaMac(_rl) {
|
|
|
34910
34875
|
|
|
34911
34876
|
`);
|
|
34912
34877
|
try {
|
|
34913
|
-
|
|
34878
|
+
execSync24('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "inherit", timeout: 6e5 });
|
|
34914
34879
|
if (!hasCmd("brew")) {
|
|
34915
34880
|
try {
|
|
34916
34881
|
const brewPrefix = existsSync32("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
|
|
@@ -34943,7 +34908,7 @@ async function installOllamaMac(_rl) {
|
|
|
34943
34908
|
|
|
34944
34909
|
`);
|
|
34945
34910
|
try {
|
|
34946
|
-
|
|
34911
|
+
execSync24("brew install ollama", {
|
|
34947
34912
|
stdio: "inherit",
|
|
34948
34913
|
timeout: 3e5
|
|
34949
34914
|
});
|
|
@@ -34970,7 +34935,7 @@ function installOllamaWindows() {
|
|
|
34970
34935
|
|
|
34971
34936
|
`);
|
|
34972
34937
|
try {
|
|
34973
|
-
|
|
34938
|
+
execSync24('powershell -Command "irm https://ollama.com/install.ps1 | iex"', {
|
|
34974
34939
|
stdio: "inherit",
|
|
34975
34940
|
timeout: 3e5
|
|
34976
34941
|
});
|
|
@@ -35051,7 +35016,7 @@ async function ensureOllamaRunning(backendUrl, rl) {
|
|
|
35051
35016
|
}
|
|
35052
35017
|
function pullModelWithAutoUpdate(tag) {
|
|
35053
35018
|
try {
|
|
35054
|
-
|
|
35019
|
+
execSync24(`ollama pull ${tag}`, {
|
|
35055
35020
|
stdio: "inherit",
|
|
35056
35021
|
timeout: 36e5
|
|
35057
35022
|
// 1 hour max
|
|
@@ -35071,7 +35036,7 @@ function pullModelWithAutoUpdate(tag) {
|
|
|
35071
35036
|
|
|
35072
35037
|
`);
|
|
35073
35038
|
try {
|
|
35074
|
-
|
|
35039
|
+
execSync24("curl -fsSL https://ollama.com/install.sh | sh", {
|
|
35075
35040
|
stdio: "inherit",
|
|
35076
35041
|
timeout: 3e5
|
|
35077
35042
|
// 5 min max for install
|
|
@@ -35082,7 +35047,7 @@ function pullModelWithAutoUpdate(tag) {
|
|
|
35082
35047
|
process.stdout.write(` ${c2.cyan("\u25CF")} Retrying pull of ${c2.bold(tag)}...
|
|
35083
35048
|
|
|
35084
35049
|
`);
|
|
35085
|
-
|
|
35050
|
+
execSync24(`ollama pull ${tag}`, {
|
|
35086
35051
|
stdio: "inherit",
|
|
35087
35052
|
timeout: 36e5
|
|
35088
35053
|
});
|
|
@@ -35184,7 +35149,7 @@ function ensurePython3() {
|
|
|
35184
35149
|
if (plat === "darwin") {
|
|
35185
35150
|
if (hasCmd("brew")) {
|
|
35186
35151
|
try {
|
|
35187
|
-
|
|
35152
|
+
execSync24("brew install python3", { stdio: "inherit", timeout: 3e5 });
|
|
35188
35153
|
if (hasCmd("python3")) {
|
|
35189
35154
|
process.stdout.write(` ${c2.green("\u2714")} Python3 installed via Homebrew.
|
|
35190
35155
|
`);
|
|
@@ -35197,7 +35162,7 @@ function ensurePython3() {
|
|
|
35197
35162
|
for (const s of strategies) {
|
|
35198
35163
|
if (hasCmd(s.check)) {
|
|
35199
35164
|
try {
|
|
35200
|
-
|
|
35165
|
+
execSync24(s.install, { stdio: "inherit", timeout: 12e4 });
|
|
35201
35166
|
if (hasCmd("python3") || hasCmd("python")) {
|
|
35202
35167
|
process.stdout.write(` ${c2.green("\u2714")} Python3 installed via ${s.label}.
|
|
35203
35168
|
`);
|
|
@@ -35213,11 +35178,11 @@ function ensurePython3() {
|
|
|
35213
35178
|
}
|
|
35214
35179
|
function checkPythonVenv() {
|
|
35215
35180
|
try {
|
|
35216
|
-
|
|
35181
|
+
execSync24("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
|
|
35217
35182
|
return true;
|
|
35218
35183
|
} catch {
|
|
35219
35184
|
try {
|
|
35220
|
-
|
|
35185
|
+
execSync24("python -m venv --help", { stdio: "pipe", timeout: 5e3 });
|
|
35221
35186
|
return true;
|
|
35222
35187
|
} catch {
|
|
35223
35188
|
return false;
|
|
@@ -35236,7 +35201,7 @@ function ensurePythonVenv() {
|
|
|
35236
35201
|
for (const s of strategies) {
|
|
35237
35202
|
if (hasCmd(s.check)) {
|
|
35238
35203
|
try {
|
|
35239
|
-
|
|
35204
|
+
execSync24(s.install, { stdio: "inherit", timeout: 12e4 });
|
|
35240
35205
|
if (checkPythonVenv()) {
|
|
35241
35206
|
process.stdout.write(` ${c2.green("\u2714")} python3-venv installed via ${s.label}.
|
|
35242
35207
|
`);
|
|
@@ -35672,7 +35637,7 @@ async function doSetup(config, rl) {
|
|
|
35672
35637
|
const modelfilePath = join47(modelDir2, `Modelfile.${customName}`);
|
|
35673
35638
|
writeFileSync13(modelfilePath, modelfileContent + "\n", "utf8");
|
|
35674
35639
|
process.stdout.write(` ${c2.dim("Creating model...")} `);
|
|
35675
|
-
|
|
35640
|
+
execSync24(`ollama create ${customName} -f ${modelfilePath}`, {
|
|
35676
35641
|
stdio: "pipe",
|
|
35677
35642
|
timeout: 12e4
|
|
35678
35643
|
});
|
|
@@ -35723,7 +35688,7 @@ function isFirstRun() {
|
|
|
35723
35688
|
function hasCmd(cmd) {
|
|
35724
35689
|
try {
|
|
35725
35690
|
const whichCmd = process.platform === "win32" ? `where ${cmd}` : `which ${cmd}`;
|
|
35726
|
-
|
|
35691
|
+
execSync24(whichCmd, { stdio: "pipe", timeout: 3e3 });
|
|
35727
35692
|
return true;
|
|
35728
35693
|
} catch {
|
|
35729
35694
|
return false;
|
|
@@ -35756,7 +35721,7 @@ function getVenvDir() {
|
|
|
35756
35721
|
}
|
|
35757
35722
|
function hasVenvModule() {
|
|
35758
35723
|
try {
|
|
35759
|
-
|
|
35724
|
+
execSync24("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
|
|
35760
35725
|
return true;
|
|
35761
35726
|
} catch {
|
|
35762
35727
|
return false;
|
|
@@ -35778,8 +35743,8 @@ function ensureVenv(log) {
|
|
|
35778
35743
|
}
|
|
35779
35744
|
try {
|
|
35780
35745
|
mkdirSync12(join47(homedir10(), ".open-agents"), { recursive: true });
|
|
35781
|
-
|
|
35782
|
-
|
|
35746
|
+
execSync24(`python3 -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
|
|
35747
|
+
execSync24(`"${join47(venvDir, "bin", "pip")}" install --upgrade pip`, {
|
|
35783
35748
|
stdio: "pipe",
|
|
35784
35749
|
timeout: 6e4
|
|
35785
35750
|
});
|
|
@@ -35792,7 +35757,7 @@ function ensureVenv(log) {
|
|
|
35792
35757
|
}
|
|
35793
35758
|
function trySudoPasswordless(cmd, timeoutMs = 12e4) {
|
|
35794
35759
|
try {
|
|
35795
|
-
|
|
35760
|
+
execSync24(`sudo -n ${cmd}`, {
|
|
35796
35761
|
stdio: "pipe",
|
|
35797
35762
|
timeout: timeoutMs,
|
|
35798
35763
|
env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
|
|
@@ -35805,7 +35770,7 @@ function trySudoPasswordless(cmd, timeoutMs = 12e4) {
|
|
|
35805
35770
|
function runWithSudo(cmd, password, timeoutMs = 12e4) {
|
|
35806
35771
|
try {
|
|
35807
35772
|
const escaped = cmd.replace(/'/g, "'\\''");
|
|
35808
|
-
|
|
35773
|
+
execSync24(`sudo -S bash -c '${escaped}'`, {
|
|
35809
35774
|
input: password + "\n",
|
|
35810
35775
|
stdio: ["pipe", "pipe", "pipe"],
|
|
35811
35776
|
timeout: timeoutMs,
|
|
@@ -35912,7 +35877,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
35912
35877
|
ok = await sudoInstall(batchCmd, getPassword, log, cachedPasswordRef, 18e4);
|
|
35913
35878
|
} else {
|
|
35914
35879
|
try {
|
|
35915
|
-
|
|
35880
|
+
execSync24(batchCmd, { stdio: "pipe", timeout: 18e4 });
|
|
35916
35881
|
ok = true;
|
|
35917
35882
|
} catch {
|
|
35918
35883
|
ok = false;
|
|
@@ -35949,7 +35914,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
35949
35914
|
const venvCmds = {
|
|
35950
35915
|
apt: () => {
|
|
35951
35916
|
try {
|
|
35952
|
-
const pyVer =
|
|
35917
|
+
const pyVer = execSync24(`python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).trim();
|
|
35953
35918
|
return `apt-get install -y python3-venv python${pyVer}-venv`;
|
|
35954
35919
|
} catch {
|
|
35955
35920
|
return "apt-get install -y python3-venv";
|
|
@@ -35977,12 +35942,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
35977
35942
|
const venvPip = join47(venvBin, "pip");
|
|
35978
35943
|
log("Installing moondream-station in ~/.open-agents/venv...");
|
|
35979
35944
|
try {
|
|
35980
|
-
|
|
35945
|
+
execSync24(`"${venvPip}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
|
|
35981
35946
|
if (existsSync32(venvMoondream)) {
|
|
35982
35947
|
log("moondream-station installed successfully.");
|
|
35983
35948
|
} else {
|
|
35984
35949
|
try {
|
|
35985
|
-
const check =
|
|
35950
|
+
const check = execSync24(`"${venvPip}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
|
|
35986
35951
|
if (check.includes("moondream")) {
|
|
35987
35952
|
log("moondream-station package installed.");
|
|
35988
35953
|
}
|
|
@@ -35999,7 +35964,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
35999
35964
|
const venvPip2 = join47(venvBin, "pip");
|
|
36000
35965
|
let ocrStackInstalled = false;
|
|
36001
35966
|
try {
|
|
36002
|
-
|
|
35967
|
+
execSync24(`"${venvPython}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
|
|
36003
35968
|
ocrStackInstalled = true;
|
|
36004
35969
|
} catch {
|
|
36005
35970
|
}
|
|
@@ -36007,9 +35972,9 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
36007
35972
|
const ocrPackages = "pytesseract Pillow opencv-python-headless numpy";
|
|
36008
35973
|
log("Installing OCR Python stack (pytesseract, OpenCV, Pillow, numpy)...");
|
|
36009
35974
|
try {
|
|
36010
|
-
|
|
35975
|
+
execSync24(`"${venvPip2}" install ${ocrPackages}`, { stdio: "pipe", timeout: 3e5 });
|
|
36011
35976
|
try {
|
|
36012
|
-
|
|
35977
|
+
execSync24(`"${venvPython}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
|
|
36013
35978
|
log("OCR Python stack installed successfully.");
|
|
36014
35979
|
} catch {
|
|
36015
35980
|
log("OCR Python stack install completed but import verification failed.");
|
|
@@ -36043,7 +36008,7 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
36043
36008
|
const archMap = { x64: "amd64", arm64: "arm64", arm: "arm" };
|
|
36044
36009
|
const cfArch = archMap[arch] ?? "amd64";
|
|
36045
36010
|
try {
|
|
36046
|
-
|
|
36011
|
+
execSync24(`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${homedir10()}/.local/bin" && mv /tmp/cloudflared "${homedir10()}/.local/bin/cloudflared"`, { stdio: "pipe", timeout: 6e4 });
|
|
36047
36012
|
if (!process.env.PATH?.includes(`${homedir10()}/.local/bin`)) {
|
|
36048
36013
|
process.env.PATH = `${homedir10()}/.local/bin:${process.env.PATH}`;
|
|
36049
36014
|
}
|
|
@@ -36054,7 +36019,7 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
36054
36019
|
} catch {
|
|
36055
36020
|
}
|
|
36056
36021
|
try {
|
|
36057
|
-
|
|
36022
|
+
execSync24(`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && sudo mv /tmp/cloudflared /usr/local/bin/cloudflared 2>/dev/null`, { stdio: "pipe", timeout: 6e4 });
|
|
36058
36023
|
if (hasCmd("cloudflared")) {
|
|
36059
36024
|
log("cloudflared installed.");
|
|
36060
36025
|
return true;
|
|
@@ -36063,7 +36028,7 @@ function ensureCloudflaredBackground(onInfo) {
|
|
|
36063
36028
|
}
|
|
36064
36029
|
} else if (os === "darwin") {
|
|
36065
36030
|
try {
|
|
36066
|
-
|
|
36031
|
+
execSync24("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
|
|
36067
36032
|
if (hasCmd("cloudflared")) {
|
|
36068
36033
|
log("cloudflared installed via Homebrew.");
|
|
36069
36034
|
return true;
|
|
@@ -36205,7 +36170,7 @@ async function ensureExpandedContext(modelName, backendUrl) {
|
|
|
36205
36170
|
}
|
|
36206
36171
|
async function ensureNeovim() {
|
|
36207
36172
|
try {
|
|
36208
|
-
const nvimPath =
|
|
36173
|
+
const nvimPath = execSync24("which nvim 2>/dev/null || where nvim 2>nul", {
|
|
36209
36174
|
encoding: "utf8",
|
|
36210
36175
|
stdio: "pipe",
|
|
36211
36176
|
timeout: 5e3
|
|
@@ -36227,14 +36192,14 @@ async function ensureNeovim() {
|
|
|
36227
36192
|
const url = `https://github.com/neovim/neovim/releases/latest/download/${appImageName}`;
|
|
36228
36193
|
console.log(` Downloading Neovim (${appImageName})...`);
|
|
36229
36194
|
try {
|
|
36230
|
-
|
|
36231
|
-
|
|
36195
|
+
execSync24(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
|
|
36196
|
+
execSync24(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
|
|
36232
36197
|
} catch (err) {
|
|
36233
36198
|
console.log(` Failed to download Neovim: ${err instanceof Error ? err.message : String(err)}`);
|
|
36234
36199
|
return null;
|
|
36235
36200
|
}
|
|
36236
36201
|
try {
|
|
36237
|
-
const ver =
|
|
36202
|
+
const ver = execSync24(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
|
|
36238
36203
|
console.log(` Installed: ${ver}`);
|
|
36239
36204
|
} catch {
|
|
36240
36205
|
console.log(" Warning: nvim binary downloaded but may not work (missing FUSE? Try: nvim --appimage-extract)");
|
|
@@ -36249,8 +36214,8 @@ async function ensureNeovim() {
|
|
|
36249
36214
|
if (hasCmd("brew")) {
|
|
36250
36215
|
console.log(" Installing Neovim via Homebrew...");
|
|
36251
36216
|
try {
|
|
36252
|
-
|
|
36253
|
-
const nvimPath =
|
|
36217
|
+
execSync24("brew install neovim", { stdio: "inherit", timeout: 12e4 });
|
|
36218
|
+
const nvimPath = execSync24("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
|
|
36254
36219
|
return nvimPath || null;
|
|
36255
36220
|
} catch {
|
|
36256
36221
|
console.log(" brew install neovim failed.");
|
|
@@ -36264,7 +36229,7 @@ async function ensureNeovim() {
|
|
|
36264
36229
|
if (hasCmd("choco")) {
|
|
36265
36230
|
console.log(" Installing Neovim via Chocolatey...");
|
|
36266
36231
|
try {
|
|
36267
|
-
|
|
36232
|
+
execSync24("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
|
|
36268
36233
|
return "nvim";
|
|
36269
36234
|
} catch {
|
|
36270
36235
|
console.log(" choco install neovim failed.");
|
|
@@ -36273,7 +36238,7 @@ async function ensureNeovim() {
|
|
|
36273
36238
|
if (hasCmd("winget")) {
|
|
36274
36239
|
console.log(" Installing Neovim via winget...");
|
|
36275
36240
|
try {
|
|
36276
|
-
|
|
36241
|
+
execSync24("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
|
|
36277
36242
|
stdio: "inherit",
|
|
36278
36243
|
timeout: 12e4
|
|
36279
36244
|
});
|
|
@@ -37062,7 +37027,7 @@ var init_drop_panel = __esm({
|
|
|
37062
37027
|
import { existsSync as existsSync34, unlinkSync as unlinkSync7 } from "node:fs";
|
|
37063
37028
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
37064
37029
|
import { join as join48 } from "node:path";
|
|
37065
|
-
import { execSync as
|
|
37030
|
+
import { execSync as execSync25 } from "node:child_process";
|
|
37066
37031
|
function isNeovimActive() {
|
|
37067
37032
|
return _state !== null && !_state.cleanedUp;
|
|
37068
37033
|
}
|
|
@@ -37080,7 +37045,7 @@ async function startNeovimMode(opts) {
|
|
|
37080
37045
|
}
|
|
37081
37046
|
let nvimPath;
|
|
37082
37047
|
try {
|
|
37083
|
-
nvimPath =
|
|
37048
|
+
nvimPath = execSync25("which nvim 2>/dev/null", { encoding: "utf8" }).trim();
|
|
37084
37049
|
if (!nvimPath)
|
|
37085
37050
|
throw new Error();
|
|
37086
37051
|
} catch {
|
|
@@ -37463,7 +37428,7 @@ __export(voice_exports, {
|
|
|
37463
37428
|
import { existsSync as existsSync35, mkdirSync as mkdirSync13, writeFileSync as writeFileSync14, readFileSync as readFileSync24, unlinkSync as unlinkSync8, readdirSync as readdirSync9, renameSync, statSync as statSync12 } from "node:fs";
|
|
37464
37429
|
import { join as join49 } from "node:path";
|
|
37465
37430
|
import { homedir as homedir11, tmpdir as tmpdir9, platform as platform2 } from "node:os";
|
|
37466
|
-
import { execSync as
|
|
37431
|
+
import { execSync as execSync26, spawn as nodeSpawn } from "node:child_process";
|
|
37467
37432
|
import { createRequire } from "node:module";
|
|
37468
37433
|
function registerCustomOnnxModel(id, label) {
|
|
37469
37434
|
VOICE_MODELS[id] = {
|
|
@@ -39023,7 +38988,7 @@ var init_voice = __esm({
|
|
|
39023
38988
|
}
|
|
39024
38989
|
for (const player of ["paplay", "pw-play", "aplay"]) {
|
|
39025
38990
|
try {
|
|
39026
|
-
|
|
38991
|
+
execSync26(`which ${player}`, { stdio: "pipe" });
|
|
39027
38992
|
return [player, path];
|
|
39028
38993
|
} catch {
|
|
39029
38994
|
}
|
|
@@ -39052,7 +39017,7 @@ var init_voice = __esm({
|
|
|
39052
39017
|
return this.python3Path;
|
|
39053
39018
|
for (const bin of ["python3", "python"]) {
|
|
39054
39019
|
try {
|
|
39055
|
-
const path =
|
|
39020
|
+
const path = execSync26(`which ${bin}`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
|
|
39056
39021
|
if (path) {
|
|
39057
39022
|
this.python3Path = path;
|
|
39058
39023
|
return path;
|
|
@@ -39118,7 +39083,7 @@ var init_voice = __esm({
|
|
|
39118
39083
|
return false;
|
|
39119
39084
|
}
|
|
39120
39085
|
try {
|
|
39121
|
-
|
|
39086
|
+
execSync26(`${py} -c "import mlx_audio"`, { stdio: "pipe", timeout: 1e4 });
|
|
39122
39087
|
this.mlxInstalled = true;
|
|
39123
39088
|
return true;
|
|
39124
39089
|
} catch {
|
|
@@ -39142,7 +39107,7 @@ var init_voice = __esm({
|
|
|
39142
39107
|
return;
|
|
39143
39108
|
renderInfo("Installing MLX Audio for voice synthesis (first time setup)...");
|
|
39144
39109
|
try {
|
|
39145
|
-
|
|
39110
|
+
execSync26(`${py} -m pip install mlx-audio --quiet`, {
|
|
39146
39111
|
stdio: "pipe",
|
|
39147
39112
|
timeout: 3e5
|
|
39148
39113
|
// 5 min — may need to compile
|
|
@@ -39150,7 +39115,7 @@ var init_voice = __esm({
|
|
|
39150
39115
|
this.mlxInstalled = true;
|
|
39151
39116
|
} catch (err) {
|
|
39152
39117
|
try {
|
|
39153
|
-
|
|
39118
|
+
execSync26(`${py} -m pip install mlx-audio --user --quiet`, {
|
|
39154
39119
|
stdio: "pipe",
|
|
39155
39120
|
timeout: 3e5
|
|
39156
39121
|
});
|
|
@@ -39186,11 +39151,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
39186
39151
|
`tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
|
|
39187
39152
|
].join("; ");
|
|
39188
39153
|
try {
|
|
39189
|
-
|
|
39154
|
+
execSync26(`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
|
|
39190
39155
|
} catch (err) {
|
|
39191
39156
|
try {
|
|
39192
39157
|
const safeText = cleaned.replace(/'/g, "'\\''");
|
|
39193
|
-
|
|
39158
|
+
execSync26(`${py} -m mlx_audio.tts.generate --model ${mlxModelId} --text '${safeText}' --voice ${mlxVoice} --lang_code ${mlxLangCode} --audio_path ${JSON.stringify(wavPath)}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
|
|
39194
39159
|
} catch (err2) {
|
|
39195
39160
|
return;
|
|
39196
39161
|
}
|
|
@@ -39254,11 +39219,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
39254
39219
|
`tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
|
|
39255
39220
|
].join("; ");
|
|
39256
39221
|
try {
|
|
39257
|
-
|
|
39222
|
+
execSync26(`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
|
|
39258
39223
|
} catch {
|
|
39259
39224
|
try {
|
|
39260
39225
|
const safeText = cleaned.replace(/'/g, "'\\''");
|
|
39261
|
-
|
|
39226
|
+
execSync26(`${py} -m mlx_audio.tts.generate --model ${mlxModelId} --text '${safeText}' --voice ${mlxVoice} --lang_code ${mlxLangCode} --audio_path ${JSON.stringify(wavPath)}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
|
|
39262
39227
|
} catch {
|
|
39263
39228
|
return null;
|
|
39264
39229
|
}
|
|
@@ -39732,7 +39697,7 @@ if __name__ == '__main__':
|
|
|
39732
39697
|
const voiceRequire = createRequire(join49(voiceDir(), "index.js"));
|
|
39733
39698
|
const probeOnnx = () => {
|
|
39734
39699
|
try {
|
|
39735
|
-
const result =
|
|
39700
|
+
const result = execSync26(`node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`, { cwd: voiceDir(), stdio: "pipe", timeout: 15e3, env: { ...process.env, NODE_PATH: join49(voiceDir(), "node_modules") } });
|
|
39736
39701
|
const output = result.toString().trim();
|
|
39737
39702
|
return output === "OK";
|
|
39738
39703
|
} catch {
|
|
@@ -39749,7 +39714,7 @@ if __name__ == '__main__':
|
|
|
39749
39714
|
} catch {
|
|
39750
39715
|
renderInfo("Installing ONNX runtime for voice synthesis...");
|
|
39751
39716
|
try {
|
|
39752
|
-
|
|
39717
|
+
execSync26("npm install --no-audit --no-fund", {
|
|
39753
39718
|
cwd: voiceDir(),
|
|
39754
39719
|
stdio: "pipe",
|
|
39755
39720
|
timeout: 12e4
|
|
@@ -39774,7 +39739,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
39774
39739
|
} catch {
|
|
39775
39740
|
renderInfo("Installing phonemizer for voice synthesis...");
|
|
39776
39741
|
try {
|
|
39777
|
-
|
|
39742
|
+
execSync26("npm install --no-audit --no-fund", {
|
|
39778
39743
|
cwd: voiceDir(),
|
|
39779
39744
|
stdio: "pipe",
|
|
39780
39745
|
timeout: 12e4
|
|
@@ -42195,7 +42160,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
42195
42160
|
}
|
|
42196
42161
|
}
|
|
42197
42162
|
async function handleParallel(arg, ctx) {
|
|
42198
|
-
const { execSync:
|
|
42163
|
+
const { execSync: execSync29 } = await import("node:child_process");
|
|
42199
42164
|
const baseUrl = ctx.config.backendUrl || "http://localhost:11434";
|
|
42200
42165
|
const isRemote = ctx.config.backendType === "nexus";
|
|
42201
42166
|
if (isRemote) {
|
|
@@ -42219,7 +42184,7 @@ async function handleParallel(arg, ctx) {
|
|
|
42219
42184
|
}
|
|
42220
42185
|
let systemdVal = "";
|
|
42221
42186
|
try {
|
|
42222
|
-
const out =
|
|
42187
|
+
const out = execSync29("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
|
|
42223
42188
|
const match = out.match(/OLLAMA_NUM_PARALLEL=(\d+)/);
|
|
42224
42189
|
if (match)
|
|
42225
42190
|
systemdVal = match[1];
|
|
@@ -42248,7 +42213,7 @@ async function handleParallel(arg, ctx) {
|
|
|
42248
42213
|
}
|
|
42249
42214
|
const isSystemd = (() => {
|
|
42250
42215
|
try {
|
|
42251
|
-
const out =
|
|
42216
|
+
const out = execSync29("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
|
|
42252
42217
|
return out === "active" || out === "inactive";
|
|
42253
42218
|
} catch {
|
|
42254
42219
|
return false;
|
|
@@ -42262,10 +42227,10 @@ async function handleParallel(arg, ctx) {
|
|
|
42262
42227
|
const overrideContent = `[Service]
|
|
42263
42228
|
Environment="OLLAMA_NUM_PARALLEL=${n}"
|
|
42264
42229
|
`;
|
|
42265
|
-
|
|
42266
|
-
|
|
42267
|
-
|
|
42268
|
-
|
|
42230
|
+
execSync29(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
|
|
42231
|
+
execSync29(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
|
|
42232
|
+
execSync29("sudo systemctl daemon-reload", { stdio: "pipe" });
|
|
42233
|
+
execSync29("sudo systemctl restart ollama.service", { stdio: "pipe" });
|
|
42269
42234
|
let ready = false;
|
|
42270
42235
|
for (let i = 0; i < 30 && !ready; i++) {
|
|
42271
42236
|
await new Promise((r) => setTimeout(r, 500));
|
|
@@ -42292,7 +42257,7 @@ Environment="OLLAMA_NUM_PARALLEL=${n}"
|
|
|
42292
42257
|
renderInfo(`Setting OLLAMA_NUM_PARALLEL=${n}...`);
|
|
42293
42258
|
try {
|
|
42294
42259
|
try {
|
|
42295
|
-
|
|
42260
|
+
execSync29("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
|
|
42296
42261
|
} catch {
|
|
42297
42262
|
}
|
|
42298
42263
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
@@ -43105,7 +43070,7 @@ var init_commands = __esm({
|
|
|
43105
43070
|
// packages/cli/dist/tui/project-context.js
|
|
43106
43071
|
import { existsSync as existsSync36, readFileSync as readFileSync25, readdirSync as readdirSync10 } from "node:fs";
|
|
43107
43072
|
import { join as join50, basename as basename10 } from "node:path";
|
|
43108
|
-
import { execSync as
|
|
43073
|
+
import { execSync as execSync27 } from "node:child_process";
|
|
43109
43074
|
import { homedir as homedir12, platform as platform3, release } from "node:os";
|
|
43110
43075
|
function getModelTier(modelName) {
|
|
43111
43076
|
const m = modelName.toLowerCase();
|
|
@@ -43151,19 +43116,19 @@ function loadProjectMap(repoRoot) {
|
|
|
43151
43116
|
}
|
|
43152
43117
|
function getGitInfo(repoRoot) {
|
|
43153
43118
|
try {
|
|
43154
|
-
|
|
43119
|
+
execSync27("git rev-parse --is-inside-work-tree", { cwd: repoRoot, stdio: "pipe" });
|
|
43155
43120
|
} catch {
|
|
43156
43121
|
return "";
|
|
43157
43122
|
}
|
|
43158
43123
|
const lines = [];
|
|
43159
43124
|
try {
|
|
43160
|
-
const branch =
|
|
43125
|
+
const branch = execSync27("git branch --show-current", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
|
|
43161
43126
|
if (branch)
|
|
43162
43127
|
lines.push(`Branch: ${branch}`);
|
|
43163
43128
|
} catch {
|
|
43164
43129
|
}
|
|
43165
43130
|
try {
|
|
43166
|
-
const status =
|
|
43131
|
+
const status = execSync27("git status --porcelain", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
|
|
43167
43132
|
if (status) {
|
|
43168
43133
|
const changed = status.split("\n").length;
|
|
43169
43134
|
lines.push(`Working tree: ${changed} changed file(s)`);
|
|
@@ -43173,7 +43138,7 @@ function getGitInfo(repoRoot) {
|
|
|
43173
43138
|
} catch {
|
|
43174
43139
|
}
|
|
43175
43140
|
try {
|
|
43176
|
-
const log =
|
|
43141
|
+
const log = execSync27("git log --oneline -5 --no-decorate", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
|
|
43177
43142
|
if (log)
|
|
43178
43143
|
lines.push(`Recent commits:
|
|
43179
43144
|
${log}`);
|
|
@@ -44373,7 +44338,7 @@ var init_banner = __esm({
|
|
|
44373
44338
|
this._resizeHandler = null;
|
|
44374
44339
|
}
|
|
44375
44340
|
}
|
|
44376
|
-
/** Render the current frame into the top 3 rows */
|
|
44341
|
+
/** Render the current frame into the top 3 rows (public for refresh callbacks) */
|
|
44377
44342
|
renderCurrentFrame() {
|
|
44378
44343
|
if (!isTTY7 || !this.currentDesign)
|
|
44379
44344
|
return;
|
|
@@ -45413,7 +45378,7 @@ var init_promptLoader3 = __esm({
|
|
|
45413
45378
|
// packages/cli/dist/tui/dream-engine.js
|
|
45414
45379
|
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync16, readFileSync as readFileSync28, existsSync as existsSync39, cpSync, rmSync, readdirSync as readdirSync12 } from "node:fs";
|
|
45415
45380
|
import { join as join54, basename as basename12 } from "node:path";
|
|
45416
|
-
import { execSync as
|
|
45381
|
+
import { execSync as execSync28 } from "node:child_process";
|
|
45417
45382
|
function loadAutoresearchMemory(repoRoot) {
|
|
45418
45383
|
const memoryPath = join54(repoRoot, ".oa", "memory", "autoresearch.json");
|
|
45419
45384
|
if (!existsSync39(memoryPath))
|
|
@@ -45777,7 +45742,7 @@ var init_dream_engine = __esm({
|
|
|
45777
45742
|
}
|
|
45778
45743
|
}
|
|
45779
45744
|
try {
|
|
45780
|
-
const output =
|
|
45745
|
+
const output = execSync28(cmd, {
|
|
45781
45746
|
cwd: this.repoRoot,
|
|
45782
45747
|
timeout: 3e4,
|
|
45783
45748
|
encoding: "utf-8",
|
|
@@ -46554,17 +46519,17 @@ ${summaryResult}
|
|
|
46554
46519
|
try {
|
|
46555
46520
|
mkdirSync16(checkpointDir, { recursive: true });
|
|
46556
46521
|
try {
|
|
46557
|
-
const gitStatus =
|
|
46522
|
+
const gitStatus = execSync28("git status --porcelain", {
|
|
46558
46523
|
cwd: this.repoRoot,
|
|
46559
46524
|
encoding: "utf-8",
|
|
46560
46525
|
timeout: 1e4
|
|
46561
46526
|
});
|
|
46562
|
-
const gitDiff =
|
|
46527
|
+
const gitDiff = execSync28("git diff", {
|
|
46563
46528
|
cwd: this.repoRoot,
|
|
46564
46529
|
encoding: "utf-8",
|
|
46565
46530
|
timeout: 1e4
|
|
46566
46531
|
});
|
|
46567
|
-
const gitHash =
|
|
46532
|
+
const gitHash = execSync28("git rev-parse HEAD 2>/dev/null || echo 'no-git'", {
|
|
46568
46533
|
cwd: this.repoRoot,
|
|
46569
46534
|
encoding: "utf-8",
|
|
46570
46535
|
timeout: 5e3
|
|
@@ -50474,6 +50439,8 @@ var init_status_bar = __esm({
|
|
|
50474
50439
|
stdinHooked = false;
|
|
50475
50440
|
/** COHERE distributed cognitive commons active flag */
|
|
50476
50441
|
_cohereActive = false;
|
|
50442
|
+
/** Banner refresh callback — called after resize to re-render top rows */
|
|
50443
|
+
_bannerRefresh = null;
|
|
50477
50444
|
/** Track previous terminal dimensions to clear ghost separators on resize */
|
|
50478
50445
|
_prevTermRows = 0;
|
|
50479
50446
|
_prevTermCols = 0;
|
|
@@ -51069,6 +51036,10 @@ var init_status_bar = __esm({
|
|
|
51069
51036
|
get cohereActive() {
|
|
51070
51037
|
return this._cohereActive;
|
|
51071
51038
|
}
|
|
51039
|
+
/** Set a callback to re-render the banner after resize/redraw */
|
|
51040
|
+
setBannerRefresh(refresh) {
|
|
51041
|
+
this._bannerRefresh = refresh;
|
|
51042
|
+
}
|
|
51072
51043
|
/** Whether content is currently being written to the scroll region */
|
|
51073
51044
|
get isWritingContent() {
|
|
51074
51045
|
return this.writeDepth > 0;
|
|
@@ -51159,6 +51130,8 @@ var init_status_bar = __esm({
|
|
|
51159
51130
|
clearBuf += "\x1B[?7h";
|
|
51160
51131
|
process.stdout.write(clearBuf);
|
|
51161
51132
|
this.renderFooterAndPositionInput();
|
|
51133
|
+
if (this._bannerRefresh)
|
|
51134
|
+
this._bannerRefresh();
|
|
51162
51135
|
}
|
|
51163
51136
|
}
|
|
51164
51137
|
/**
|
|
@@ -53071,6 +53044,7 @@ async function startInteractive(config, repoPath) {
|
|
|
53071
53044
|
if (process.stdout.isTTY) {
|
|
53072
53045
|
const scrollTop = carouselLines > 0 ? carouselLines + 1 : 1;
|
|
53073
53046
|
statusBar.activate(scrollTop);
|
|
53047
|
+
statusBar.setBannerRefresh(() => banner.renderCurrentFrame());
|
|
53074
53048
|
setContentWriteHook({
|
|
53075
53049
|
begin: () => statusBar.beginContentWrite(),
|
|
53076
53050
|
end: () => statusBar.endContentWrite(),
|
|
@@ -53157,22 +53131,20 @@ async function startInteractive(config, repoPath) {
|
|
|
53157
53131
|
statusBar.endContentWrite();
|
|
53158
53132
|
};
|
|
53159
53133
|
writeMsg();
|
|
53160
|
-
const updateMode = savedSettings.updateMode ?? "auto";
|
|
53161
|
-
if (updateMode !== "manual") {
|
|
53162
|
-
performSilentUpdate();
|
|
53163
|
-
}
|
|
53164
53134
|
}
|
|
53165
53135
|
}).catch(() => {
|
|
53166
53136
|
});
|
|
53167
53137
|
}
|
|
53168
|
-
const AUTO_UPDATE_INTERVAL_MS = 60 * 1e3;
|
|
53138
|
+
const AUTO_UPDATE_INTERVAL_MS = 30 * 60 * 1e3;
|
|
53169
53139
|
const autoUpdateTimer = setInterval(() => {
|
|
53170
53140
|
const updateMode = savedSettings.updateMode ?? "auto";
|
|
53171
53141
|
if (updateMode === "manual")
|
|
53172
53142
|
return;
|
|
53173
53143
|
checkForUpdate(version).then((updateInfo) => {
|
|
53174
|
-
if (updateInfo) {
|
|
53175
|
-
|
|
53144
|
+
if (updateInfo && statusBar?.isActive) {
|
|
53145
|
+
statusBar.beginContentWrite();
|
|
53146
|
+
renderInfo(`Update available: v${version} \u2192 v${updateInfo.latestVersion}. Run /update to install.`);
|
|
53147
|
+
statusBar.endContentWrite();
|
|
53176
53148
|
}
|
|
53177
53149
|
}).catch(() => {
|
|
53178
53150
|
});
|