open-agents-ai 0.187.65 → 0.187.67

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.
Files changed (2) hide show
  1. package/dist/index.js +501 -345
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1345,6 +1345,154 @@ var init_process_kill = __esm({
1345
1345
  }
1346
1346
  });
1347
1347
 
1348
+ // packages/execution/dist/system-auth.js
1349
+ import { execSync as execSync2, spawnSync } from "node:child_process";
1350
+ function detectElevationMethod() {
1351
+ const platform6 = process.platform;
1352
+ if (platform6 === "darwin") {
1353
+ return "osascript";
1354
+ }
1355
+ if (platform6 === "win32") {
1356
+ return "powershell";
1357
+ }
1358
+ const hasDisplay = !!(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
1359
+ if (hasDisplay) {
1360
+ try {
1361
+ execSync2("which pkexec", { stdio: "pipe", timeout: 3e3 });
1362
+ return "pkexec";
1363
+ } catch {
1364
+ }
1365
+ }
1366
+ if (hasDisplay && process.env.SSH_ASKPASS) {
1367
+ return "sudo-askpass";
1368
+ }
1369
+ return "sudo-tty";
1370
+ }
1371
+ async function runElevated(command, options2) {
1372
+ const method = detectElevationMethod();
1373
+ const timeout2 = options2?.timeout ?? 12e4;
1374
+ const cwd4 = options2?.cwd ?? process.cwd();
1375
+ const desc = options2?.description ?? "Open Agents needs elevated privileges";
1376
+ switch (method) {
1377
+ case "pkexec":
1378
+ return runPkexec(command, timeout2, cwd4);
1379
+ case "osascript":
1380
+ return runOsascript(command, timeout2, cwd4, desc);
1381
+ case "powershell":
1382
+ return runPowershell(command, timeout2, cwd4);
1383
+ case "sudo-askpass":
1384
+ return runSudoAskpass(command, timeout2, cwd4);
1385
+ case "sudo-tty":
1386
+ return runSudoTty(command, timeout2, cwd4);
1387
+ }
1388
+ }
1389
+ function runPkexec(command, timeout2, cwd4) {
1390
+ try {
1391
+ const result = spawnSync("pkexec", ["bash", "-c", command], {
1392
+ timeout: timeout2,
1393
+ cwd: cwd4,
1394
+ stdio: ["pipe", "pipe", "pipe"],
1395
+ env: { ...process.env }
1396
+ });
1397
+ return {
1398
+ success: result.status === 0,
1399
+ stdout: result.stdout?.toString("utf-8") ?? "",
1400
+ stderr: result.stderr?.toString("utf-8") ?? "",
1401
+ exitCode: result.status ?? 1
1402
+ };
1403
+ } catch (err) {
1404
+ return { success: false, stdout: "", stderr: String(err), exitCode: 1 };
1405
+ }
1406
+ }
1407
+ function runOsascript(command, timeout2, cwd4, description) {
1408
+ const escaped = command.replace(/'/g, "'\\''");
1409
+ const script = `do shell script 'cd ${cwd4.replace(/'/g, "'\\''")} && ${escaped}' with administrator privileges with prompt "${description}"`;
1410
+ try {
1411
+ const result = spawnSync("osascript", ["-e", script], {
1412
+ timeout: timeout2,
1413
+ stdio: ["pipe", "pipe", "pipe"],
1414
+ env: { ...process.env }
1415
+ });
1416
+ return {
1417
+ success: result.status === 0,
1418
+ stdout: result.stdout?.toString("utf-8") ?? "",
1419
+ stderr: result.stderr?.toString("utf-8") ?? "",
1420
+ exitCode: result.status ?? 1
1421
+ };
1422
+ } catch (err) {
1423
+ return { success: false, stdout: "", stderr: String(err), exitCode: 1 };
1424
+ }
1425
+ }
1426
+ function runPowershell(command, timeout2, _cwd) {
1427
+ const encoded = Buffer.from(command, "utf16le").toString("base64");
1428
+ const psCmd = `Start-Process -FilePath 'cmd.exe' -ArgumentList '/c ${command.replace(/'/g, "''")}' -Verb RunAs -Wait -PassThru`;
1429
+ try {
1430
+ const result = spawnSync("powershell", ["-NoProfile", "-Command", psCmd], {
1431
+ timeout: timeout2,
1432
+ stdio: ["pipe", "pipe", "pipe"]
1433
+ });
1434
+ return {
1435
+ success: result.status === 0,
1436
+ stdout: result.stdout?.toString("utf-8") ?? "",
1437
+ stderr: result.stderr?.toString("utf-8") ?? "",
1438
+ exitCode: result.status ?? 1
1439
+ };
1440
+ } catch (err) {
1441
+ return { success: false, stdout: "", stderr: String(err), exitCode: 1 };
1442
+ }
1443
+ }
1444
+ function runSudoAskpass(command, timeout2, cwd4) {
1445
+ try {
1446
+ const result = spawnSync("sudo", ["-A", "bash", "-c", command], {
1447
+ timeout: timeout2,
1448
+ cwd: cwd4,
1449
+ stdio: ["pipe", "pipe", "pipe"],
1450
+ env: {
1451
+ ...process.env,
1452
+ SUDO_ASKPASS: process.env.SSH_ASKPASS ?? "/usr/bin/ssh-askpass"
1453
+ }
1454
+ });
1455
+ return {
1456
+ success: result.status === 0,
1457
+ stdout: result.stdout?.toString("utf-8") ?? "",
1458
+ stderr: result.stderr?.toString("utf-8") ?? "",
1459
+ exitCode: result.status ?? 1
1460
+ };
1461
+ } catch (err) {
1462
+ return { success: false, stdout: "", stderr: String(err), exitCode: 1 };
1463
+ }
1464
+ }
1465
+ function runSudoTty(command, timeout2, cwd4) {
1466
+ try {
1467
+ const validate5 = spawnSync("sudo", ["-v"], {
1468
+ timeout: 6e4,
1469
+ stdio: "inherit"
1470
+ // Passes through to terminal for native sudo prompt
1471
+ });
1472
+ if (validate5.status !== 0) {
1473
+ return { success: false, stdout: "", stderr: "sudo authentication failed", exitCode: 1 };
1474
+ }
1475
+ const result = spawnSync("sudo", ["bash", "-c", command], {
1476
+ timeout: timeout2,
1477
+ cwd: cwd4,
1478
+ stdio: ["pipe", "pipe", "pipe"]
1479
+ });
1480
+ return {
1481
+ success: result.status === 0,
1482
+ stdout: result.stdout?.toString("utf-8") ?? "",
1483
+ stderr: result.stderr?.toString("utf-8") ?? "",
1484
+ exitCode: result.status ?? 1
1485
+ };
1486
+ } catch (err) {
1487
+ return { success: false, stdout: "", stderr: String(err), exitCode: 1 };
1488
+ }
1489
+ }
1490
+ var init_system_auth = __esm({
1491
+ "packages/execution/dist/system-auth.js"() {
1492
+ "use strict";
1493
+ }
1494
+ });
1495
+
1348
1496
  // packages/execution/dist/tools/shell.js
1349
1497
  import { spawn } from "node:child_process";
1350
1498
  var PERMISSION_ERROR_RE, ShellTool;
@@ -1352,6 +1500,7 @@ var init_shell = __esm({
1352
1500
  "packages/execution/dist/tools/shell.js"() {
1353
1501
  "use strict";
1354
1502
  init_process_kill();
1503
+ init_system_auth();
1355
1504
  PERMISSION_ERROR_RE = /Permission denied|Operation not permitted|EACCES|EPERM|PermissionError|sudo:|not permitted|password is required|authentication failure/i;
1356
1505
  ShellTool = class {
1357
1506
  name = "shell";
@@ -1405,30 +1554,31 @@ var init_shell = __esm({
1405
1554
  return this._sudoPassword !== null;
1406
1555
  }
1407
1556
  async execute(args) {
1557
+ const start2 = performance.now();
1408
1558
  const command = args["command"];
1409
1559
  const timeout2 = args["timeout"] ?? this.defaultTimeout;
1410
1560
  const stdinInput = args["stdin"];
1411
1561
  const result = await this.runCommand(command, timeout2, stdinInput);
1412
- if (!result.success && this._sudoPassword && this.isPermissionError(result)) {
1413
- const sudoCmd = command.trimStart().startsWith("sudo ") ? command : `sudo -S ${command}`;
1414
- const sudoResult = await this.runCommand(sudoCmd, timeout2, `${this._sudoPassword}
1415
- ${stdinInput ?? ""}`);
1416
- if (sudoResult.success) {
1417
- return sudoResult;
1418
- }
1419
- if (this.isPermissionError(sudoResult) || /incorrect password|Sorry, try again/i.test((sudoResult.error ?? "") + sudoResult.output)) {
1420
- this._sudoPassword = null;
1562
+ if (!result.success && this.isPermissionError(result)) {
1563
+ const method = detectElevationMethod();
1564
+ const elevatedResult = await runElevated(command, {
1565
+ timeout: timeout2,
1566
+ cwd: this.workingDir,
1567
+ description: `Open Agents: ${command.slice(0, 60)}`
1568
+ });
1569
+ if (elevatedResult.success) {
1421
1570
  return {
1422
- ...sudoResult,
1423
- error: (sudoResult.error ?? "") + "\n\n[SUDO_PASSWORD_INCORRECT] The cached sudo password was rejected. Ask the user for the correct password."
1571
+ success: true,
1572
+ output: elevatedResult.stdout + (elevatedResult.stderr ? `
1573
+ ${elevatedResult.stderr}` : ""),
1574
+ durationMs: performance.now() - start2
1424
1575
  };
1425
1576
  }
1426
- return sudoResult;
1427
- }
1428
- if (!result.success && this.isPermissionError(result) && !this._sudoPassword) {
1429
1577
  return {
1430
1578
  ...result,
1431
- error: (result.error ?? "") + "\n\n[PERMISSION_ERROR] This command requires elevated privileges. The user needs to provide their sudo password. Wait for the user to enter their password \u2014 the system is prompting them now."
1579
+ error: (result.error ?? "") + `
1580
+
1581
+ [PERMISSION_ERROR] Command requires elevated privileges. System auth dialog was shown (method: ${method}). ` + (elevatedResult.stderr ? `Error: ${elevatedResult.stderr.slice(0, 200)}` : "User may have cancelled.")
1432
1582
  };
1433
1583
  }
1434
1584
  return result;
@@ -3928,7 +4078,7 @@ var init_list_directory = __esm({
3928
4078
  });
3929
4079
 
3930
4080
  // packages/execution/dist/tools/aiwg-setup.js
3931
- import { execSync as execSync2 } from "node:child_process";
4081
+ import { execSync as execSync3 } from "node:child_process";
3932
4082
  var AiwgSetupTool;
3933
4083
  var init_aiwg_setup = __esm({
3934
4084
  "packages/execution/dist/tools/aiwg-setup.js"() {
@@ -3967,7 +4117,7 @@ var init_aiwg_setup = __esm({
3967
4117
  };
3968
4118
  }
3969
4119
  try {
3970
- const output = execSync2(`aiwg use ${framework}`, {
4120
+ const output = execSync3(`aiwg use ${framework}`, {
3971
4121
  cwd: projectDir,
3972
4122
  encoding: "utf8",
3973
4123
  timeout: 6e4,
@@ -3991,7 +4141,7 @@ ${output}`,
3991
4141
  }
3992
4142
  isAiwgInstalled() {
3993
4143
  try {
3994
- execSync2("aiwg --version", {
4144
+ execSync3("aiwg --version", {
3995
4145
  encoding: "utf8",
3996
4146
  timeout: 5e3,
3997
4147
  stdio: ["pipe", "pipe", "pipe"]
@@ -4006,7 +4156,7 @@ ${output}`,
4006
4156
  });
4007
4157
 
4008
4158
  // packages/execution/dist/tools/aiwg-health.js
4009
- import { execSync as execSync3 } from "node:child_process";
4159
+ import { execSync as execSync4 } from "node:child_process";
4010
4160
  import { existsSync as existsSync7, readdirSync as readdirSync2, readFileSync as readFileSync5, statSync as statSync2 } from "node:fs";
4011
4161
  import { join as join10 } from "node:path";
4012
4162
  var AiwgHealthTool;
@@ -4086,7 +4236,7 @@ var init_aiwg_health = __esm({
4086
4236
  }
4087
4237
  if (this.isAiwgInstalled()) {
4088
4238
  try {
4089
- const runtimeInfo = execSync3("aiwg runtime-info 2>/dev/null", {
4239
+ const runtimeInfo = execSync4("aiwg runtime-info 2>/dev/null", {
4090
4240
  cwd: projectDir,
4091
4241
  encoding: "utf8",
4092
4242
  timeout: 15e3
@@ -4207,7 +4357,7 @@ var init_aiwg_health = __esm({
4207
4357
  }
4208
4358
  isAiwgInstalled() {
4209
4359
  try {
4210
- execSync3("aiwg --version", { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] });
4360
+ execSync4("aiwg --version", { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] });
4211
4361
  return true;
4212
4362
  } catch {
4213
4363
  return false;
@@ -4218,7 +4368,7 @@ var init_aiwg_health = __esm({
4218
4368
  });
4219
4369
 
4220
4370
  // packages/execution/dist/tools/aiwg-workflow.js
4221
- import { execSync as execSync4 } from "node:child_process";
4371
+ import { execSync as execSync5 } from "node:child_process";
4222
4372
  var AiwgWorkflowTool;
4223
4373
  var init_aiwg_workflow = __esm({
4224
4374
  "packages/execution/dist/tools/aiwg-workflow.js"() {
@@ -4266,7 +4416,7 @@ var init_aiwg_workflow = __esm({
4266
4416
  }
4267
4417
  const sanitized = command.replace(/[;&|`$()]/g, "");
4268
4418
  try {
4269
- const output = execSync4(`aiwg ${sanitized}`, {
4419
+ const output = execSync5(`aiwg ${sanitized}`, {
4270
4420
  cwd: projectDir,
4271
4421
  encoding: "utf8",
4272
4422
  timeout: 12e4,
@@ -4292,7 +4442,7 @@ var init_aiwg_workflow = __esm({
4292
4442
  }
4293
4443
  isAiwgInstalled() {
4294
4444
  try {
4295
- execSync4("aiwg --version", { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] });
4445
+ execSync5("aiwg --version", { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] });
4296
4446
  return true;
4297
4447
  } catch {
4298
4448
  return false;
@@ -4903,7 +5053,7 @@ var init_codebase_map = __esm({
4903
5053
  });
4904
5054
 
4905
5055
  // packages/execution/dist/tools/diagnostic.js
4906
- import { execSync as execSync5 } from "node:child_process";
5056
+ import { execSync as execSync6 } from "node:child_process";
4907
5057
  import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
4908
5058
  import { join as join12 } from "node:path";
4909
5059
  var DiagnosticTool;
@@ -5018,7 +5168,7 @@ var init_diagnostic = __esm({
5018
5168
  runStep(step, command, cwd4) {
5019
5169
  const start2 = performance.now();
5020
5170
  try {
5021
- const output = execSync5(command, {
5171
+ const output = execSync6(command, {
5022
5172
  cwd: cwd4,
5023
5173
  encoding: "utf8",
5024
5174
  timeout: 12e4,
@@ -5048,7 +5198,7 @@ ${err.stderr ?? ""}`.trim(),
5048
5198
  });
5049
5199
 
5050
5200
  // packages/execution/dist/tools/git-info.js
5051
- import { execSync as execSync6 } from "node:child_process";
5201
+ import { execSync as execSync7 } from "node:child_process";
5052
5202
  import { existsSync as existsSync10 } from "node:fs";
5053
5203
  import { join as join13 } from "node:path";
5054
5204
  var GitInfoTool;
@@ -5164,7 +5314,7 @@ var init_git_info = __esm({
5164
5314
  }
5165
5315
  git(cwd4, cmd) {
5166
5316
  try {
5167
- return execSync6(`git ${cmd}`, {
5317
+ return execSync7(`git ${cmd}`, {
5168
5318
  cwd: cwd4,
5169
5319
  encoding: "utf8",
5170
5320
  timeout: 1e4,
@@ -5187,7 +5337,7 @@ import { readFile as readFile8, writeFile as writeFile6, mkdir as mkdir3, chmod,
5187
5337
  import { existsSync as existsSync11, readFileSync as readFileSync8, watch as fsWatchLocal } from "node:fs";
5188
5338
  import { resolve as resolve13, join as join14 } from "node:path";
5189
5339
  import { randomBytes as randomBytes4, createCipheriv, createDecipheriv, scryptSync, createHash } from "node:crypto";
5190
- import { execSync as execSync7, spawn as spawn2 } from "node:child_process";
5340
+ import { execSync as execSync8, spawn as spawn2 } from "node:child_process";
5191
5341
  import { hostname, userInfo, homedir as homedir4 } from "node:os";
5192
5342
  function containsKeyMaterial(input) {
5193
5343
  for (const pattern of KEY_PATTERNS) {
@@ -11016,7 +11166,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
11016
11166
  }
11017
11167
  async doInferenceProof() {
11018
11168
  try {
11019
- const psRaw = execSync7("ollama ps 2>/dev/null", { timeout: 1e4, encoding: "utf8" });
11169
+ const psRaw = execSync8("ollama ps 2>/dev/null", { timeout: 1e4, encoding: "utf8" });
11020
11170
  const lines = psRaw.trim().split("\n").filter((l2) => l2.trim());
11021
11171
  if (lines.length < 2)
11022
11172
  return "No model loaded. Run 'ollama ps' to check.";
@@ -11024,7 +11174,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
11024
11174
  const modelName = parts[0] || "unknown";
11025
11175
  let gpuName = "none", vramMb = 0;
11026
11176
  try {
11027
- const smi = execSync7("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null", {
11177
+ const smi = execSync8("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null", {
11028
11178
  timeout: 5e3,
11029
11179
  encoding: "utf8"
11030
11180
  });
@@ -11033,7 +11183,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
11033
11183
  vramMb = parseInt(gp[1]?.trim() || "0", 10);
11034
11184
  } catch {
11035
11185
  try {
11036
- execSync7("rocm-smi 2>/dev/null", { timeout: 5e3 });
11186
+ execSync8("rocm-smi 2>/dev/null", { timeout: 5e3 });
11037
11187
  gpuName = "AMD GPU";
11038
11188
  } catch {
11039
11189
  }
@@ -11469,7 +11619,7 @@ Exit code: ${task.exitCode ?? "N/A"}`,
11469
11619
  });
11470
11620
 
11471
11621
  // packages/execution/dist/system-deps.js
11472
- import { execSync as execSync8 } from "node:child_process";
11622
+ import { execSync as execSync9 } from "node:child_process";
11473
11623
  function detectPackageManager() {
11474
11624
  if (_detectedPkgManager !== void 0)
11475
11625
  return _detectedPkgManager;
@@ -11502,7 +11652,7 @@ function detectPackageManager() {
11502
11652
  function hasCommand(cmd) {
11503
11653
  try {
11504
11654
  const whichCmd = process.platform === "win32" ? `where ${cmd}` : `which ${cmd}`;
11505
- execSync8(whichCmd, { stdio: "pipe", timeout: 3e3 });
11655
+ execSync9(whichCmd, { stdio: "pipe", timeout: 3e3 });
11506
11656
  return true;
11507
11657
  } catch {
11508
11658
  return false;
@@ -11521,7 +11671,7 @@ function runInstall(installCmd) {
11521
11671
  cmd = `sudo -n ${installCmd}`;
11522
11672
  }
11523
11673
  }
11524
- execSync8(cmd, {
11674
+ execSync9(cmd, {
11525
11675
  stdio: "pipe",
11526
11676
  timeout: 12e4,
11527
11677
  // 2 min for package install
@@ -11714,7 +11864,7 @@ var init_system_deps = __esm({
11714
11864
  // packages/execution/dist/tools/image.js
11715
11865
  import { existsSync as existsSync12, readFileSync as readFileSync9, statSync as statSync4 } from "node:fs";
11716
11866
  import { resolve as resolve14, extname as extname2, basename as basename2 } from "node:path";
11717
- import { execSync as execSync9 } from "node:child_process";
11867
+ import { execSync as execSync10 } from "node:child_process";
11718
11868
  import { tmpdir } from "node:os";
11719
11869
  import { join as join15 } from "node:path";
11720
11870
  function isImagePath(path5) {
@@ -11741,7 +11891,7 @@ function getMimeType(filePath) {
11741
11891
  }
11742
11892
  function getImageDimensions(filePath) {
11743
11893
  try {
11744
- const out = execSync9(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
11894
+ const out = execSync10(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
11745
11895
  encoding: "utf8",
11746
11896
  stdio: ["pipe", "pipe", "pipe"],
11747
11897
  timeout: 5e3
@@ -11753,7 +11903,7 @@ function getImageDimensions(filePath) {
11753
11903
  const dep = ensureCommand("identify");
11754
11904
  if (dep.installed) {
11755
11905
  try {
11756
- const out = execSync9(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
11906
+ const out = execSync10(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
11757
11907
  encoding: "utf8",
11758
11908
  stdio: ["pipe", "pipe", "pipe"],
11759
11909
  timeout: 5e3
@@ -11766,7 +11916,7 @@ function getImageDimensions(filePath) {
11766
11916
  }
11767
11917
  }
11768
11918
  try {
11769
- const out = execSync9(`file ${JSON.stringify(filePath)}`, {
11919
+ const out = execSync10(`file ${JSON.stringify(filePath)}`, {
11770
11920
  encoding: "utf8",
11771
11921
  stdio: ["pipe", "pipe", "pipe"],
11772
11922
  timeout: 5e3
@@ -11780,7 +11930,7 @@ function getImageDimensions(filePath) {
11780
11930
  }
11781
11931
  function hasTesseract() {
11782
11932
  try {
11783
- execSync9("tesseract --version", { stdio: "pipe", timeout: 5e3 });
11933
+ execSync10("tesseract --version", { stdio: "pipe", timeout: 5e3 });
11784
11934
  return true;
11785
11935
  } catch {
11786
11936
  const dep = ensureCommand("tesseract");
@@ -11789,7 +11939,7 @@ function hasTesseract() {
11789
11939
  }
11790
11940
  function runOCR(filePath) {
11791
11941
  try {
11792
- return execSync9(`tesseract ${JSON.stringify(filePath)} stdout 2>/dev/null`, {
11942
+ return execSync10(`tesseract ${JSON.stringify(filePath)} stdout 2>/dev/null`, {
11793
11943
  encoding: "utf8",
11794
11944
  stdio: ["pipe", "pipe", "pipe"],
11795
11945
  timeout: 3e4
@@ -11923,7 +12073,7 @@ ${ocrText}`);
11923
12073
  };
11924
12074
  }
11925
12075
  try {
11926
- execSync9(cmd, { stdio: "pipe", timeout: 1e4 });
12076
+ execSync10(cmd, { stdio: "pipe", timeout: 1e4 });
11927
12077
  } catch (err) {
11928
12078
  return {
11929
12079
  success: false,
@@ -11971,7 +12121,7 @@ ${ocrText}`);
11971
12121
  if (plat === "linux") {
11972
12122
  for (const tool of ["scrot", "gnome-screenshot", "import"]) {
11973
12123
  try {
11974
- execSync9(`which ${tool}`, { stdio: "pipe" });
12124
+ execSync10(`which ${tool}`, { stdio: "pipe" });
11975
12125
  if (tool === "scrot") {
11976
12126
  if (region === "active")
11977
12127
  return `scrot -u ${out}`;
@@ -12058,14 +12208,14 @@ ${ocrText}`);
12058
12208
  if (x != null && y != null && w != null && h != null) {
12059
12209
  const croppedPath = join15(tmpdir(), `oa-ocr-crop-${Date.now()}.png`);
12060
12210
  try {
12061
- execSync9(`convert ${JSON.stringify(fullPath)} -crop ${w}x${h}+${x}+${y} +repage ${JSON.stringify(croppedPath)}`, { stdio: "pipe", timeout: 1e4 });
12211
+ execSync10(`convert ${JSON.stringify(fullPath)} -crop ${w}x${h}+${x}+${y} +repage ${JSON.stringify(croppedPath)}`, { stdio: "pipe", timeout: 1e4 });
12062
12212
  inputPath = croppedPath;
12063
12213
  } catch {
12064
12214
  }
12065
12215
  }
12066
12216
  }
12067
12217
  try {
12068
- const text = execSync9(`tesseract ${JSON.stringify(inputPath)} stdout -l ${language} --psm ${psm} 2>/dev/null`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3e4 }).trim();
12218
+ const text = execSync10(`tesseract ${JSON.stringify(inputPath)} stdout -l ${language} --psm ${psm} 2>/dev/null`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3e4 }).trim();
12069
12219
  if (!text) {
12070
12220
  return { success: true, output: "(no text detected in image)", durationMs: Date.now() - start2 };
12071
12221
  }
@@ -12600,7 +12750,7 @@ var init_tool_creator = __esm({
12600
12750
  import { existsSync as existsSync14, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "node:fs";
12601
12751
  import { join as join17, basename as basename3, dirname as dirname3 } from "node:path";
12602
12752
  import { homedir as homedir6 } from "node:os";
12603
- import { execSync as execSync10 } from "node:child_process";
12753
+ import { execSync as execSync11 } from "node:child_process";
12604
12754
  function getAiwgPaths() {
12605
12755
  const dataDir = join17(homedir6(), ".local", "share", "ai-writing-guide");
12606
12756
  return {
@@ -12613,7 +12763,7 @@ function findAiwgPackageRoot() {
12613
12763
  if (_cachedAiwgPkgRoot !== void 0)
12614
12764
  return _cachedAiwgPkgRoot;
12615
12765
  try {
12616
- const globalRoot = execSync10("npm root -g", {
12766
+ const globalRoot = execSync11("npm root -g", {
12617
12767
  encoding: "utf-8",
12618
12768
  timeout: 5e3,
12619
12769
  stdio: ["pipe", "pipe", "pipe"]
@@ -13314,7 +13464,7 @@ ${content}`
13314
13464
  import { existsSync as existsSync16, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7, readFileSync as readFileSync13, unlinkSync } from "node:fs";
13315
13465
  import { join as join19, basename as basename4, extname as extname3, resolve as resolve15 } from "node:path";
13316
13466
  import { homedir as homedir7 } from "node:os";
13317
- import { execSync as execSync11, spawn as spawn5 } from "node:child_process";
13467
+ import { execSync as execSync12, spawn as spawn5 } from "node:child_process";
13318
13468
  function isTranscribable(path5) {
13319
13469
  const ext = extname3(path5).toLowerCase();
13320
13470
  return AUDIO_EXTS.has(ext) || VIDEO_EXTS.has(ext);
@@ -13324,7 +13474,7 @@ async function loadTranscribeCli() {
13324
13474
  return _tcModule;
13325
13475
  _tcChecked = true;
13326
13476
  try {
13327
- const globalRoot = execSync11("npm root -g", {
13477
+ const globalRoot = execSync12("npm root -g", {
13328
13478
  encoding: "utf-8",
13329
13479
  timeout: 5e3,
13330
13480
  stdio: ["pipe", "pipe", "pipe"]
@@ -13361,11 +13511,11 @@ function isYouTubeUrl(url) {
13361
13511
  }
13362
13512
  function ensureYtDlp() {
13363
13513
  try {
13364
- execSync11("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
13514
+ execSync12("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
13365
13515
  return true;
13366
13516
  } catch {
13367
13517
  try {
13368
- execSync11("pip3 install --user yt-dlp 2>/dev/null || pip install --user yt-dlp 2>/dev/null", {
13518
+ execSync12("pip3 install --user yt-dlp 2>/dev/null || pip install --user yt-dlp 2>/dev/null", {
13369
13519
  timeout: 6e4,
13370
13520
  stdio: "pipe"
13371
13521
  });
@@ -13554,7 +13704,7 @@ var init_transcribe_tool = __esm({
13554
13704
  const args = [filePath, "-m", model, "-f", "txt"];
13555
13705
  if (diarize)
13556
13706
  args.push("--diarize");
13557
- const output = execSync11(`transcribe-cli ${args.join(" ")}`, {
13707
+ const output = execSync12(`transcribe-cli ${args.join(" ")}`, {
13558
13708
  encoding: "utf-8",
13559
13709
  timeout: 3e5,
13560
13710
  // 5 min max
@@ -13627,7 +13777,7 @@ var init_transcribe_tool = __esm({
13627
13777
  }
13628
13778
  tmpFile = `${tmpBase}.mp3`;
13629
13779
  try {
13630
- execSync11(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o "${tmpBase}.%(ext)s" "${url}" 2>&1`, { timeout: 3e5, stdio: ["pipe", "pipe", "pipe"] });
13780
+ execSync12(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o "${tmpBase}.%(ext)s" "${url}" 2>&1`, { timeout: 3e5, stdio: ["pipe", "pipe", "pipe"] });
13631
13781
  if (!existsSync16(tmpFile)) {
13632
13782
  const { readdirSync: rd } = __require("node:fs");
13633
13783
  const files = rd(tmpDir).filter((f2) => f2.startsWith(`download-`) && f2 !== ".gitkeep");
@@ -13652,12 +13802,12 @@ var init_transcribe_tool = __esm({
13652
13802
  }
13653
13803
  tmpFile = `${tmpBase}${ext}`;
13654
13804
  try {
13655
- execSync11(`curl -sL -o "${tmpFile}" "${url}"`, {
13805
+ execSync12(`curl -sL -o "${tmpFile}" "${url}"`, {
13656
13806
  timeout: 12e4,
13657
13807
  stdio: ["pipe", "pipe", "pipe"]
13658
13808
  });
13659
13809
  } catch {
13660
- execSync11(`wget -q -O "${tmpFile}" "${url}"`, {
13810
+ execSync12(`wget -q -O "${tmpFile}" "${url}"`, {
13661
13811
  timeout: 12e4,
13662
13812
  stdio: ["pipe", "pipe", "pipe"]
13663
13813
  });
@@ -13742,13 +13892,13 @@ ${result.output}`,
13742
13892
  try {
13743
13893
  let title = "download";
13744
13894
  try {
13745
- title = execSync11(`yt-dlp --get-title "${url}"`, { timeout: 15e3, stdio: "pipe" }).toString().trim().replace(/[<>:"/\\|?*]/g, "_").slice(0, 100);
13895
+ title = execSync12(`yt-dlp --get-title "${url}"`, { timeout: 15e3, stdio: "pipe" }).toString().trim().replace(/[<>:"/\\|?*]/g, "_").slice(0, 100);
13746
13896
  } catch {
13747
13897
  }
13748
13898
  if (format3 === "mp4") {
13749
13899
  const outPath = join19(outputDir, `${title}.mp4`);
13750
13900
  const outTemplate = join19(outputDir, `${title}.%(ext)s`);
13751
- execSync11(`yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --merge-output-format mp4 -o "${outTemplate}" "${url}"`, { timeout: 6e5, stdio: "pipe", cwd: outputDir });
13901
+ execSync12(`yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --merge-output-format mp4 -o "${outTemplate}" "${url}"`, { timeout: 6e5, stdio: "pipe", cwd: outputDir });
13752
13902
  const actualPath = existsSync16(outPath) ? outPath : outTemplate.replace("%(ext)s", "mp4");
13753
13903
  return {
13754
13904
  success: true,
@@ -13760,7 +13910,7 @@ Format: mp4`,
13760
13910
  } else {
13761
13911
  const outPath = join19(outputDir, `${title}.mp3`);
13762
13912
  const outTemplate = join19(outputDir, `${title}.%(ext)s`);
13763
- execSync11(`yt-dlp -x --audio-format mp3 --audio-quality 0 -o "${outTemplate}" "${url}"`, { timeout: 6e5, stdio: "pipe", cwd: outputDir });
13913
+ execSync12(`yt-dlp -x --audio-format mp3 --audio-quality 0 -o "${outTemplate}" "${url}"`, { timeout: 6e5, stdio: "pipe", cwd: outputDir });
13764
13914
  const actualPath = existsSync16(outPath) ? outPath : outTemplate.replace("%(ext)s", "mp3");
13765
13915
  return {
13766
13916
  success: true,
@@ -247369,7 +247519,7 @@ __export(vision_exports, {
247369
247519
  resetMoondreamClient: () => resetMoondreamClient
247370
247520
  });
247371
247521
  import { readFileSync as readFileSync14, existsSync as existsSync17, statSync as statSync5 } from "node:fs";
247372
- import { execSync as execSync12, spawn as spawn8 } from "node:child_process";
247522
+ import { execSync as execSync13, spawn as spawn8 } from "node:child_process";
247373
247523
  import { resolve as resolve19, extname as extname6, basename as basename6, dirname as dirname7, join as join29 } from "node:path";
247374
247524
  import { fileURLToPath as fileURLToPath3 } from "node:url";
247375
247525
  async function probeStation(endpoint) {
@@ -247391,7 +247541,7 @@ function findStationBinary() {
247391
247541
  const oaVenvPython = isWin2 ? join29(venvBase, "Scripts", "python.exe") : join29(venvBase, "bin", "python");
247392
247542
  if (existsSync17(oaVenvPython)) {
247393
247543
  try {
247394
- execSync12(`${JSON.stringify(oaVenvPython)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
247544
+ execSync13(`${JSON.stringify(oaVenvPython)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
247395
247545
  return oaVenvPython;
247396
247546
  } catch {
247397
247547
  }
@@ -247408,14 +247558,14 @@ function findStationBinary() {
247408
247558
  for (const p2 of localVenvPaths) {
247409
247559
  if (existsSync17(p2)) {
247410
247560
  try {
247411
- execSync12(`${JSON.stringify(p2)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
247561
+ execSync13(`${JSON.stringify(p2)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
247412
247562
  return p2;
247413
247563
  } catch {
247414
247564
  }
247415
247565
  }
247416
247566
  }
247417
247567
  try {
247418
- const path5 = execSync12("which moondream-station", { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3e3 }).trim();
247568
+ const path5 = execSync13("which moondream-station", { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 3e3 }).trim();
247419
247569
  if (path5)
247420
247570
  return path5;
247421
247571
  } catch {
@@ -247629,9 +247779,9 @@ var init_vision = __esm({
247629
247779
  if (ollamaResult)
247630
247780
  return ollamaResult;
247631
247781
  try {
247632
- const { execSync: execSync40 } = await import("node:child_process");
247782
+ const { execSync: execSync41 } = await import("node:child_process");
247633
247783
  try {
247634
- execSync40("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
247784
+ execSync41("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
247635
247785
  timeout: 12e4,
247636
247786
  stdio: "pipe"
247637
247787
  });
@@ -247644,7 +247794,7 @@ var init_vision = __esm({
247644
247794
  } catch {
247645
247795
  }
247646
247796
  try {
247647
- execSync40("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247797
+ execSync41("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247648
247798
  const retryOllama = await this.tryOllamaVision(buffer2, filename, action, prompt, length4, start2);
247649
247799
  if (retryOllama)
247650
247800
  return retryOllama;
@@ -247752,8 +247902,8 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
247752
247902
  const errText = await res.text().catch(() => "");
247753
247903
  if (res.status === 404 || /not found|does not exist/i.test(errText)) {
247754
247904
  try {
247755
- const { execSync: execSync40 } = await import("node:child_process");
247756
- execSync40("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247905
+ const { execSync: execSync41 } = await import("node:child_process");
247906
+ execSync41("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247757
247907
  res = await fetch(`${ollamaHost}/api/generate`, {
247758
247908
  method: "POST",
247759
247909
  headers: { "Content-Type": "application/json" },
@@ -247836,13 +247986,13 @@ ${response}`, durationMs: performance.now() - start2 };
247836
247986
 
247837
247987
  // packages/execution/dist/tools/desktop-click.js
247838
247988
  import { readFileSync as readFileSync15, existsSync as existsSync18 } from "node:fs";
247839
- import { execSync as execSync13 } from "node:child_process";
247989
+ import { execSync as execSync14 } from "node:child_process";
247840
247990
  import { tmpdir as tmpdir4 } from "node:os";
247841
247991
  import { join as join30, dirname as dirname8 } from "node:path";
247842
247992
  import { fileURLToPath as fileURLToPath4 } from "node:url";
247843
247993
  function hasCommand2(cmd) {
247844
247994
  try {
247845
- execSync13(`which ${cmd}`, { stdio: "pipe", timeout: 3e3 });
247995
+ execSync14(`which ${cmd}`, { stdio: "pipe", timeout: 3e3 });
247846
247996
  return true;
247847
247997
  } catch {
247848
247998
  return false;
@@ -247850,7 +248000,7 @@ function hasCommand2(cmd) {
247850
248000
  }
247851
248001
  function getImageDimensions2(filePath) {
247852
248002
  try {
247853
- const out = execSync13(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
248003
+ const out = execSync14(`identify -format "%w %h" ${JSON.stringify(filePath)}`, {
247854
248004
  encoding: "utf8",
247855
248005
  stdio: ["pipe", "pipe", "pipe"],
247856
248006
  timeout: 5e3
@@ -247861,14 +248011,14 @@ function getImageDimensions2(filePath) {
247861
248011
  } catch {
247862
248012
  }
247863
248013
  try {
247864
- const out = execSync13(`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();
248014
+ const out = execSync14(`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();
247865
248015
  const [w, h] = out.split(" ").map(Number);
247866
248016
  if (w && h)
247867
248017
  return { width: w, height: h };
247868
248018
  } catch {
247869
248019
  }
247870
248020
  try {
247871
- const out = execSync13(`file ${JSON.stringify(filePath)}`, {
248021
+ const out = execSync14(`file ${JSON.stringify(filePath)}`, {
247872
248022
  encoding: "utf8",
247873
248023
  stdio: ["pipe", "pipe", "pipe"],
247874
248024
  timeout: 5e3
@@ -247899,7 +248049,7 @@ function captureScreenshot(outputPath) {
247899
248049
  cmd = `scrot ${out}`;
247900
248050
  } else {
247901
248051
  try {
247902
- execSync13(`DISPLAY=:0 python3 -c "from PIL import ImageGrab; ImageGrab.grab().save(${JSON.stringify(outputPath)})"`, { stdio: "pipe", timeout: 1e4 });
248052
+ execSync14(`DISPLAY=:0 python3 -c "from PIL import ImageGrab; ImageGrab.grab().save(${JSON.stringify(outputPath)})"`, { stdio: "pipe", timeout: 1e4 });
247903
248053
  if (existsSync18(outputPath))
247904
248054
  return;
247905
248055
  } catch {
@@ -247910,7 +248060,7 @@ function captureScreenshot(outputPath) {
247910
248060
  if (!cmd) {
247911
248061
  throw new Error("No screenshot tool found. Auto-install failed. Try manually: sudo apt install scrot");
247912
248062
  }
247913
- execSync13(cmd, { stdio: "pipe", timeout: 1e4 });
248063
+ execSync14(cmd, { stdio: "pipe", timeout: 1e4 });
247914
248064
  if (!existsSync18(outputPath)) {
247915
248065
  throw new Error("Screenshot file was not created");
247916
248066
  }
@@ -247928,11 +248078,11 @@ function clickAt(x, y, button, clickType) {
247928
248078
  hasXdotool = dep.available;
247929
248079
  }
247930
248080
  if (hasXdotool) {
247931
- execSync13(`xdotool mousemove --sync ${rx} ${ry}`, { stdio: "pipe", timeout: 5e3 });
248081
+ execSync14(`xdotool mousemove --sync ${rx} ${ry}`, { stdio: "pipe", timeout: 5e3 });
247932
248082
  if (clickType === "double") {
247933
- execSync13(`xdotool click --repeat 2 --delay 50 ${buttonNum}`, { stdio: "pipe", timeout: 5e3 });
248083
+ execSync14(`xdotool click --repeat 2 --delay 50 ${buttonNum}`, { stdio: "pipe", timeout: 5e3 });
247934
248084
  } else {
247935
- execSync13(`xdotool click ${buttonNum}`, { stdio: "pipe", timeout: 5e3 });
248085
+ execSync14(`xdotool click ${buttonNum}`, { stdio: "pipe", timeout: 5e3 });
247936
248086
  }
247937
248087
  return;
247938
248088
  }
@@ -247957,14 +248107,14 @@ for i in range(${clicks}):
247957
248107
  time.sleep(0.05)
247958
248108
  `.trim().replace(/\n/g, "; ");
247959
248109
  try {
247960
- execSync13(`DISPLAY=:0 python3 -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
248110
+ execSync14(`DISPLAY=:0 python3 -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
247961
248111
  return;
247962
248112
  } catch {
247963
248113
  }
247964
248114
  try {
247965
248115
  const pyBin = process.platform === "win32" ? "Scripts/python.exe" : "bin/python";
247966
248116
  const venvPy = join30(__dirname3, `../../../../.moondream-venv/${pyBin}`);
247967
- execSync13(`DISPLAY=:0 ${JSON.stringify(venvPy)} -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
248117
+ execSync14(`DISPLAY=:0 ${JSON.stringify(venvPy)} -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
247968
248118
  return;
247969
248119
  } catch {
247970
248120
  }
@@ -247976,11 +248126,11 @@ for i in range(${clicks}):
247976
248126
  const rx2 = Math.round(x);
247977
248127
  const ry2 = Math.round(y);
247978
248128
  if (clickType === "double") {
247979
- execSync13(`cliclick dc:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
248129
+ execSync14(`cliclick dc:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
247980
248130
  } else if (button === "right") {
247981
- execSync13(`cliclick rc:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
248131
+ execSync14(`cliclick rc:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
247982
248132
  } else {
247983
- execSync13(`cliclick c:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
248133
+ execSync14(`cliclick c:${rx2},${ry2}`, { stdio: "pipe", timeout: 5e3 });
247984
248134
  }
247985
248135
  } else {
247986
248136
  throw new Error(`Desktop click not supported on platform: ${plat}`);
@@ -248343,7 +248493,7 @@ ${data.response}`);
248343
248493
  const tess = ensureCommand("tesseract");
248344
248494
  if (tess.available) {
248345
248495
  try {
248346
- ocrText = execSync13(`tesseract ${JSON.stringify(screenshotPath)} stdout 2>/dev/null`, {
248496
+ ocrText = execSync14(`tesseract ${JSON.stringify(screenshotPath)} stdout 2>/dev/null`, {
248347
248497
  encoding: "utf8",
248348
248498
  timeout: 15e3
248349
248499
  }).trim();
@@ -248394,7 +248544,7 @@ Screen: ${dims.width}x${dims.height}`);
248394
248544
  // packages/execution/dist/tools/ocr-pdf.js
248395
248545
  import { existsSync as existsSync19, statSync as statSync6 } from "node:fs";
248396
248546
  import { resolve as resolve20, basename as basename7 } from "node:path";
248397
- import { execSync as execSync14 } from "node:child_process";
248547
+ import { execSync as execSync15 } from "node:child_process";
248398
248548
  var OcrPdfTool;
248399
248549
  var init_ocr_pdf = __esm({
248400
248550
  "packages/execution/dist/tools/ocr-pdf.js"() {
@@ -248481,7 +248631,7 @@ var init_ocr_pdf = __esm({
248481
248631
  cmdParts.push(JSON.stringify(inputPath));
248482
248632
  cmdParts.push(JSON.stringify(outputPath));
248483
248633
  try {
248484
- const stdout = execSync14(cmdParts.join(" "), {
248634
+ const stdout = execSync15(cmdParts.join(" "), {
248485
248635
  encoding: "utf8",
248486
248636
  stdio: ["pipe", "pipe", "pipe"],
248487
248637
  timeout: 6e5,
@@ -248517,7 +248667,7 @@ Language: ${language}
248517
248667
  // packages/execution/dist/tools/pdf-to-text.js
248518
248668
  import { existsSync as existsSync20, statSync as statSync7, readFileSync as readFileSync16, unlinkSync as unlinkSync3 } from "node:fs";
248519
248669
  import { resolve as resolve21, basename as basename8, join as join31 } from "node:path";
248520
- import { execSync as execSync15 } from "node:child_process";
248670
+ import { execSync as execSync16 } from "node:child_process";
248521
248671
  import { tmpdir as tmpdir5 } from "node:os";
248522
248672
  var PdfToTextTool;
248523
248673
  var init_pdf_to_text = __esm({
@@ -248613,7 +248763,7 @@ var init_pdf_to_text = __esm({
248613
248763
  cmdParts.push("-l", String(lastPage));
248614
248764
  cmdParts.push(JSON.stringify(fullPath), "-");
248615
248765
  try {
248616
- let text = execSync15(cmdParts.join(" "), {
248766
+ let text = execSync16(cmdParts.join(" "), {
248617
248767
  encoding: "utf8",
248618
248768
  stdio: ["pipe", "pipe", "pipe"],
248619
248769
  timeout: 12e4
@@ -248673,14 +248823,14 @@ ${text}`,
248673
248823
  const tmpPdf = join31(tmpdir5(), `oa-ocr-${Date.now()}.pdf`);
248674
248824
  try {
248675
248825
  const ocrCmd = `ocrmypdf -l ${language} --skip-text ${JSON.stringify(inputPath)} ${JSON.stringify(tmpPdf)}`;
248676
- execSync15(ocrCmd, { stdio: "pipe", timeout: 6e5 });
248826
+ execSync16(ocrCmd, { stdio: "pipe", timeout: 6e5 });
248677
248827
  const textCmdParts = ["pdftotext"];
248678
248828
  if (firstPage)
248679
248829
  textCmdParts.push("-f", String(firstPage));
248680
248830
  if (lastPage)
248681
248831
  textCmdParts.push("-l", String(lastPage));
248682
248832
  textCmdParts.push(JSON.stringify(tmpPdf), "-");
248683
- const text = execSync15(textCmdParts.join(" "), {
248833
+ const text = execSync16(textCmdParts.join(" "), {
248684
248834
  encoding: "utf8",
248685
248835
  stdio: ["pipe", "pipe", "pipe"],
248686
248836
  timeout: 12e4
@@ -248702,7 +248852,7 @@ ${text}`,
248702
248852
  // packages/execution/dist/tools/ocr-image-advanced.js
248703
248853
  import { existsSync as existsSync21, statSync as statSync8 } from "node:fs";
248704
248854
  import { resolve as resolve22, basename as basename9, dirname as dirname9, join as join32 } from "node:path";
248705
- import { execSync as execSync16 } from "node:child_process";
248855
+ import { execSync as execSync17 } from "node:child_process";
248706
248856
  import { fileURLToPath as fileURLToPath5 } from "node:url";
248707
248857
  import { homedir as homedir8, tmpdir as tmpdir6 } from "node:os";
248708
248858
  function findOcrScript() {
@@ -248723,7 +248873,7 @@ function findPython() {
248723
248873
  const venvPython2 = isWin2 ? join32(homedir8(), ".open-agents", "venv", "Scripts", "python.exe") : join32(homedir8(), ".open-agents", "venv", "bin", "python");
248724
248874
  if (existsSync21(venvPython2)) {
248725
248875
  try {
248726
- execSync16(`${JSON.stringify(venvPython2)} -c "import cv2, pytesseract, numpy, PIL"`, {
248876
+ execSync17(`${JSON.stringify(venvPython2)} -c "import cv2, pytesseract, numpy, PIL"`, {
248727
248877
  stdio: "pipe",
248728
248878
  timeout: 5e3
248729
248879
  });
@@ -248732,7 +248882,7 @@ function findPython() {
248732
248882
  }
248733
248883
  }
248734
248884
  try {
248735
- execSync16(`python3 -c "import cv2, pytesseract, numpy, PIL"`, {
248885
+ execSync17(`python3 -c "import cv2, pytesseract, numpy, PIL"`, {
248736
248886
  stdio: "pipe",
248737
248887
  timeout: 5e3
248738
248888
  });
@@ -248870,7 +249020,7 @@ var init_ocr_image_advanced = __esm({
248870
249020
  cmdParts.push("--debug-dir", debugDir);
248871
249021
  }
248872
249022
  try {
248873
- const stdout = execSync16(cmdParts.join(" "), {
249023
+ const stdout = execSync17(cmdParts.join(" "), {
248874
249024
  encoding: "utf8",
248875
249025
  stdio: ["pipe", "pipe", "pipe"],
248876
249026
  timeout: 3e5,
@@ -248966,14 +249116,14 @@ var init_ocr_image_advanced = __esm({
248966
249116
  try {
248967
249117
  const [x, y, w, h] = region.split(",").map(Number);
248968
249118
  const croppedPath = join32(tmpdir6(), `oa-ocr-crop-${Date.now()}.png`);
248969
- execSync16(`convert ${JSON.stringify(imagePath)} -crop ${w}x${h}+${x}+${y} +repage ${JSON.stringify(croppedPath)}`, { stdio: "pipe", timeout: 1e4 });
249119
+ execSync17(`convert ${JSON.stringify(imagePath)} -crop ${w}x${h}+${x}+${y} +repage ${JSON.stringify(croppedPath)}`, { stdio: "pipe", timeout: 1e4 });
248970
249120
  inputPath = croppedPath;
248971
249121
  } catch {
248972
249122
  }
248973
249123
  }
248974
249124
  const psmArg = psm ?? 6;
248975
249125
  try {
248976
- const text = execSync16(`tesseract ${JSON.stringify(inputPath)} stdout -l ${language} --psm ${psmArg} 2>/dev/null`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 6e4 }).trim();
249126
+ const text = execSync17(`tesseract ${JSON.stringify(inputPath)} stdout -l ${language} --psm ${psmArg} 2>/dev/null`, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 6e4 }).trim();
248977
249127
  if (!text) {
248978
249128
  return {
248979
249129
  success: true,
@@ -249004,7 +249154,7 @@ Note: Advanced Python pipeline not available \u2014 install pytesseract, opencv-
249004
249154
  });
249005
249155
 
249006
249156
  // packages/execution/dist/tools/browser-action.js
249007
- import { execSync as execSync17, spawn as spawn9 } from "node:child_process";
249157
+ import { execSync as execSync18, spawn as spawn9 } from "node:child_process";
249008
249158
  import { existsSync as existsSync22, readFileSync as readFileSync17 } from "node:fs";
249009
249159
  import { join as join33, dirname as dirname10 } from "node:path";
249010
249160
  import { fileURLToPath as fileURLToPath6 } from "node:url";
@@ -249035,7 +249185,7 @@ async function probeService() {
249035
249185
  function findPython2() {
249036
249186
  for (const cmd of ["python3", "python"]) {
249037
249187
  try {
249038
- const ver = execSync17(`${cmd} --version 2>&1`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
249188
+ const ver = execSync18(`${cmd} --version 2>&1`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
249039
249189
  if (ver.includes("Python 3"))
249040
249190
  return cmd;
249041
249191
  } catch {
@@ -249498,7 +249648,7 @@ var init_browser_action = __esm({
249498
249648
  });
249499
249649
 
249500
249650
  // packages/execution/dist/tools/autoresearch.js
249501
- import { execSync as execSync18, spawn as spawn10 } from "node:child_process";
249651
+ import { execSync as execSync19, spawn as spawn10 } from "node:child_process";
249502
249652
  import { existsSync as existsSync23, readFileSync as readFileSync18, writeFileSync as writeFileSync8, mkdirSync as mkdirSync8, appendFileSync, copyFileSync } from "node:fs";
249503
249653
  import { join as join34, resolve as resolve23, dirname as dirname11 } from "node:path";
249504
249654
  import { fileURLToPath as fileURLToPath7 } from "node:url";
@@ -249628,13 +249778,13 @@ Requires: NVIDIA GPU, Python 3.10+, uv (astral.sh package manager).`;
249628
249778
  async setup(workspace, args, start2) {
249629
249779
  const output = [];
249630
249780
  try {
249631
- execSync18("which uv", { encoding: "utf-8", timeout: 5e3 });
249781
+ execSync19("which uv", { encoding: "utf-8", timeout: 5e3 });
249632
249782
  output.push("uv: found");
249633
249783
  } catch {
249634
249784
  return { success: false, output: "", error: "uv not found. Install with: curl -LsSf https://astral.sh/uv/install.sh | sh", durationMs: Date.now() - start2 };
249635
249785
  }
249636
249786
  try {
249637
- const gpuInfo = execSync18("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null || echo 'no GPU'", { encoding: "utf-8", timeout: 1e4 }).trim();
249787
+ const gpuInfo = execSync19("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null || echo 'no GPU'", { encoding: "utf-8", timeout: 1e4 }).trim();
249638
249788
  output.push(`GPU: ${gpuInfo}`);
249639
249789
  } catch {
249640
249790
  output.push("GPU: detection failed (nvidia-smi not available)");
@@ -249684,10 +249834,10 @@ explicit = true
249684
249834
  writeFileSync8(join34(workspace, "pyproject.toml"), pyprojectContent, "utf-8");
249685
249835
  output.push("Created pyproject.toml");
249686
249836
  try {
249687
- execSync18("git rev-parse --git-dir", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
249837
+ execSync19("git rev-parse --git-dir", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
249688
249838
  output.push("Git: already initialized");
249689
249839
  } catch {
249690
- execSync18("git init && git add -A && git commit -m 'autoresearch: initial setup'", {
249840
+ execSync19("git init && git add -A && git commit -m 'autoresearch: initial setup'", {
249691
249841
  cwd: workspace,
249692
249842
  encoding: "utf-8",
249693
249843
  timeout: 1e4
@@ -249697,14 +249847,14 @@ explicit = true
249697
249847
  const tag = String(args["tag"] ?? (/* @__PURE__ */ new Date()).toISOString().slice(5, 10).replace("-", ""));
249698
249848
  const branchName = `autoresearch/${tag}`;
249699
249849
  try {
249700
- execSync18(`git checkout -b ${branchName}`, { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
249850
+ execSync19(`git checkout -b ${branchName}`, { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
249701
249851
  output.push(`Branch: created ${branchName}`);
249702
249852
  } catch {
249703
249853
  output.push(`Branch: ${branchName} may already exist, staying on current branch`);
249704
249854
  }
249705
249855
  output.push("Installing dependencies with uv sync (this may take a while)...");
249706
249856
  try {
249707
- const uvOut = execSync18("uv sync 2>&1", { cwd: workspace, encoding: "utf-8", timeout: 3e5 });
249857
+ const uvOut = execSync19("uv sync 2>&1", { cwd: workspace, encoding: "utf-8", timeout: 3e5 });
249708
249858
  output.push(`uv sync: ${uvOut.trim().split("\n").slice(-3).join(" | ")}`);
249709
249859
  } catch (err) {
249710
249860
  const e2 = err;
@@ -249713,7 +249863,7 @@ explicit = true
249713
249863
  const numShards = Number(args["num_shards"] ?? 10);
249714
249864
  output.push(`Preparing data (${numShards} shards)...`);
249715
249865
  try {
249716
- const prepOut = execSync18(`uv run prepare.py --num-shards ${numShards} 2>&1`, {
249866
+ const prepOut = execSync19(`uv run prepare.py --num-shards ${numShards} 2>&1`, {
249717
249867
  cwd: workspace,
249718
249868
  encoding: "utf-8",
249719
249869
  timeout: 6e5
@@ -249750,7 +249900,7 @@ Next steps:
249750
249900
  }
249751
249901
  if (!existsSync23(join34(workspace, ".venv")) && existsSync23(join34(workspace, "pyproject.toml"))) {
249752
249902
  try {
249753
- execSync18("uv sync 2>&1", { cwd: workspace, encoding: "utf-8", timeout: 3e5 });
249903
+ execSync19("uv sync 2>&1", { cwd: workspace, encoding: "utf-8", timeout: 3e5 });
249754
249904
  } catch {
249755
249905
  }
249756
249906
  }
@@ -249900,15 +250050,15 @@ Run autoresearch(action="setup") to begin.`,
249900
250050
  }
249901
250051
  output.push(`Workspace: ${workspace}`);
249902
250052
  try {
249903
- const branch = execSync18("git branch --show-current", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
250053
+ const branch = execSync19("git branch --show-current", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
249904
250054
  output.push(`Branch: ${branch}`);
249905
- const lastCommit = execSync18("git log --oneline -1", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
250055
+ const lastCommit = execSync19("git log --oneline -1", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
249906
250056
  output.push(`Last commit: ${lastCommit}`);
249907
250057
  } catch {
249908
250058
  output.push("Git: not initialized");
249909
250059
  }
249910
250060
  try {
249911
- const gpuInfo = execSync18("nvidia-smi --query-gpu=name,memory.total,memory.used --format=csv,noheader 2>/dev/null", { encoding: "utf-8", timeout: 1e4 }).trim();
250061
+ const gpuInfo = execSync19("nvidia-smi --query-gpu=name,memory.total,memory.used --format=csv,noheader 2>/dev/null", { encoding: "utf-8", timeout: 1e4 }).trim();
249912
250062
  output.push(`GPU: ${gpuInfo}`);
249913
250063
  } catch {
249914
250064
  output.push("GPU: not detected");
@@ -249951,12 +250101,12 @@ Run autoresearch(action="setup") to begin.`,
249951
250101
  memGb = memGb ?? 0;
249952
250102
  let commitHash = "0000000";
249953
250103
  try {
249954
- execSync18("git add train.py", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
249955
- execSync18(`git commit -m "autoresearch: ${desc}"`, { cwd: workspace, encoding: "utf-8", timeout: 1e4 });
249956
- commitHash = execSync18("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
250104
+ execSync19("git add train.py", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
250105
+ execSync19(`git commit -m "autoresearch: ${desc}"`, { cwd: workspace, encoding: "utf-8", timeout: 1e4 });
250106
+ commitHash = execSync19("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
249957
250107
  } catch {
249958
250108
  try {
249959
- commitHash = execSync18("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
250109
+ commitHash = execSync19("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
249960
250110
  } catch {
249961
250111
  }
249962
250112
  }
@@ -249990,14 +250140,14 @@ Branch advanced. Ready for next experiment.`,
249990
250140
  memGb = memGb ?? 0;
249991
250141
  let commitHash = "0000000";
249992
250142
  try {
249993
- commitHash = execSync18("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
250143
+ commitHash = execSync19("git rev-parse --short HEAD", { cwd: workspace, encoding: "utf-8", timeout: 5e3 }).trim();
249994
250144
  } catch {
249995
250145
  }
249996
250146
  const row = `${commitHash} ${valBpb.toFixed(6)} ${memGb.toFixed(1)} discard ${desc}
249997
250147
  `;
249998
250148
  appendFileSync(tsvPath, row, "utf-8");
249999
250149
  try {
250000
- execSync18("git checkout -- train.py", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
250150
+ execSync19("git checkout -- train.py", { cwd: workspace, encoding: "utf-8", timeout: 5e3 });
250001
250151
  } catch {
250002
250152
  return {
250003
250153
  success: false,
@@ -250018,7 +250168,7 @@ train.py reverted to last kept state. Ready for next experiment.`,
250018
250168
  });
250019
250169
 
250020
250170
  // packages/execution/dist/tools/scheduler.js
250021
- import { execSync as execSync19, exec as execCb } from "node:child_process";
250171
+ import { execSync as execSync20, exec as execCb } from "node:child_process";
250022
250172
  import { readFile as readFile15, writeFile as writeFile17, mkdir as mkdir12 } from "node:fs/promises";
250023
250173
  import { resolve as resolve24, join as join35 } from "node:path";
250024
250174
  import { homedir as homedir9 } from "node:os";
@@ -250081,19 +250231,19 @@ function describeCron(expr) {
250081
250231
  }
250082
250232
  function getCurrentCrontab() {
250083
250233
  try {
250084
- return execSync19("crontab -l 2>/dev/null", { stdio: "pipe" }).toString().split("\n");
250234
+ return execSync20("crontab -l 2>/dev/null", { stdio: "pipe" }).toString().split("\n");
250085
250235
  } catch {
250086
250236
  return [];
250087
250237
  }
250088
250238
  }
250089
250239
  function writeCrontab(lines) {
250090
250240
  const content = lines.join("\n") + "\n";
250091
- execSync19(`echo ${JSON.stringify(content)} | crontab -`, { stdio: "pipe" });
250241
+ execSync20(`echo ${JSON.stringify(content)} | crontab -`, { stdio: "pipe" });
250092
250242
  }
250093
250243
  function findOaBinary() {
250094
250244
  for (const cmd of ["oa", "open-agents"]) {
250095
250245
  try {
250096
- const path5 = execSync19(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
250246
+ const path5 = execSync20(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
250097
250247
  if (path5)
250098
250248
  return path5;
250099
250249
  } catch {
@@ -251084,13 +251234,13 @@ ${sections.join("\n")}`,
251084
251234
  });
251085
251235
 
251086
251236
  // packages/execution/dist/tools/opencode.js
251087
- import { execSync as execSync20, spawn as spawn11 } from "node:child_process";
251237
+ import { execSync as execSync21, spawn as spawn11 } from "node:child_process";
251088
251238
  import { existsSync as existsSync24 } from "node:fs";
251089
251239
  import { join as join38, resolve as resolve27 } from "node:path";
251090
251240
  function findOpencode() {
251091
251241
  for (const cmd of ["opencode"]) {
251092
251242
  try {
251093
- const path5 = execSync20(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
251243
+ const path5 = execSync21(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
251094
251244
  if (path5)
251095
251245
  return path5;
251096
251246
  } catch {
@@ -251110,7 +251260,7 @@ function findOpencode() {
251110
251260
  }
251111
251261
  function getVersion(binary) {
251112
251262
  try {
251113
- return execSync20(`${binary} --version 2>/dev/null`, { stdio: "pipe", timeout: 1e4 }).toString().trim();
251263
+ return execSync21(`${binary} --version 2>/dev/null`, { stdio: "pipe", timeout: 1e4 }).toString().trim();
251114
251264
  } catch {
251115
251265
  return "unknown";
251116
251266
  }
@@ -251119,12 +251269,12 @@ function installOpencode() {
251119
251269
  const platform6 = process.platform;
251120
251270
  try {
251121
251271
  if (platform6 === "win32") {
251122
- execSync20('powershell -Command "irm https://opencode.ai/install | iex"', {
251272
+ execSync21('powershell -Command "irm https://opencode.ai/install | iex"', {
251123
251273
  stdio: "pipe",
251124
251274
  timeout: 12e4
251125
251275
  });
251126
251276
  } else {
251127
- execSync20("curl -fsSL https://opencode.ai/install | bash", {
251277
+ execSync21("curl -fsSL https://opencode.ai/install | bash", {
251128
251278
  stdio: "pipe",
251129
251279
  timeout: 12e4
251130
251280
  });
@@ -251358,13 +251508,13 @@ var init_opencode = __esm({
251358
251508
  });
251359
251509
 
251360
251510
  // packages/execution/dist/tools/factory.js
251361
- import { execSync as execSync21, spawn as spawn12 } from "node:child_process";
251511
+ import { execSync as execSync22, spawn as spawn12 } from "node:child_process";
251362
251512
  import { existsSync as existsSync25 } from "node:fs";
251363
251513
  import { join as join39 } from "node:path";
251364
251514
  function findDroid() {
251365
251515
  for (const cmd of ["droid"]) {
251366
251516
  try {
251367
- const path5 = execSync21(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
251517
+ const path5 = execSync22(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
251368
251518
  if (path5)
251369
251519
  return path5;
251370
251520
  } catch {
@@ -251384,7 +251534,7 @@ function findDroid() {
251384
251534
  }
251385
251535
  function getVersion2(binary) {
251386
251536
  try {
251387
- return execSync21(`${binary} --version 2>/dev/null`, { stdio: "pipe", timeout: 1e4 }).toString().trim();
251537
+ return execSync22(`${binary} --version 2>/dev/null`, { stdio: "pipe", timeout: 1e4 }).toString().trim();
251388
251538
  } catch {
251389
251539
  return "unknown";
251390
251540
  }
@@ -251393,12 +251543,12 @@ function installDroid() {
251393
251543
  const platform6 = process.platform;
251394
251544
  try {
251395
251545
  if (platform6 === "win32") {
251396
- execSync21('powershell -Command "irm https://app.factory.ai/cli/windows | iex"', {
251546
+ execSync22('powershell -Command "irm https://app.factory.ai/cli/windows | iex"', {
251397
251547
  stdio: "pipe",
251398
251548
  timeout: 12e4
251399
251549
  });
251400
251550
  } else {
251401
- execSync21("curl -fsSL https://app.factory.ai/cli | sh", {
251551
+ execSync22("curl -fsSL https://app.factory.ai/cli | sh", {
251402
251552
  stdio: "pipe",
251403
251553
  timeout: 12e4
251404
251554
  });
@@ -251667,7 +251817,7 @@ var init_factory = __esm({
251667
251817
  });
251668
251818
 
251669
251819
  // packages/execution/dist/tools/cron-agent.js
251670
- import { execSync as execSync22 } from "node:child_process";
251820
+ import { execSync as execSync23 } from "node:child_process";
251671
251821
  import { readFile as readFile18, writeFile as writeFile20, mkdir as mkdir15 } from "node:fs/promises";
251672
251822
  import { resolve as resolve28, join as join40 } from "node:path";
251673
251823
  import { homedir as homedir10 } from "node:os";
@@ -251732,19 +251882,19 @@ function resolveSchedule2(schedule) {
251732
251882
  }
251733
251883
  function getCurrentCrontab2() {
251734
251884
  try {
251735
- return execSync22("crontab -l 2>/dev/null", { stdio: "pipe" }).toString().split("\n");
251885
+ return execSync23("crontab -l 2>/dev/null", { stdio: "pipe" }).toString().split("\n");
251736
251886
  } catch {
251737
251887
  return [];
251738
251888
  }
251739
251889
  }
251740
251890
  function writeCrontab2(lines) {
251741
251891
  const content = lines.join("\n") + "\n";
251742
- execSync22(`echo ${JSON.stringify(content)} | crontab -`, { stdio: "pipe" });
251892
+ execSync23(`echo ${JSON.stringify(content)} | crontab -`, { stdio: "pipe" });
251743
251893
  }
251744
251894
  function findOaBinary2() {
251745
251895
  for (const cmd of ["oa", "open-agents"]) {
251746
251896
  try {
251747
- const path5 = execSync22(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
251897
+ const path5 = execSync23(`which ${cmd} 2>/dev/null`, { stdio: "pipe" }).toString().trim();
251748
251898
  if (path5)
251749
251899
  return path5;
251750
251900
  } catch {
@@ -252144,7 +252294,7 @@ ${truncated}`, durationMs: performance.now() - start2 };
252144
252294
  ];
252145
252295
  if (job.verifyCommand) {
252146
252296
  try {
252147
- const result = execSync22(job.verifyCommand, {
252297
+ const result = execSync23(job.verifyCommand, {
252148
252298
  cwd: this.workingDir,
252149
252299
  stdio: "pipe",
252150
252300
  timeout: 3e4
@@ -253225,11 +253375,11 @@ var init_import_graph = __esm({
253225
253375
  });
253226
253376
 
253227
253377
  // packages/execution/dist/tools/process-health.js
253228
- import { execSync as execSync23 } from "node:child_process";
253378
+ import { execSync as execSync24 } from "node:child_process";
253229
253379
  function getSystemStatus() {
253230
253380
  const lines = ["# System Health\n"];
253231
253381
  try {
253232
- const uptime2 = execSync23("uptime", { encoding: "utf-8", timeout: 3e3 }).trim();
253382
+ const uptime2 = execSync24("uptime", { encoding: "utf-8", timeout: 3e3 }).trim();
253233
253383
  const loadMatch = uptime2.match(/load average:\s*([\d.]+),\s*([\d.]+),\s*([\d.]+)/);
253234
253384
  if (loadMatch) {
253235
253385
  lines.push(`CPU Load: ${loadMatch[1]} (1m) ${loadMatch[2]} (5m) ${loadMatch[3]} (15m)`);
@@ -253242,20 +253392,20 @@ function getSystemStatus() {
253242
253392
  } catch {
253243
253393
  }
253244
253394
  try {
253245
- const mem = execSync23("free -h | head -2", { encoding: "utf-8", timeout: 3e3 }).trim();
253395
+ const mem = execSync24("free -h | head -2", { encoding: "utf-8", timeout: 3e3 }).trim();
253246
253396
  lines.push(`
253247
253397
  ${mem}`);
253248
253398
  } catch {
253249
253399
  }
253250
253400
  try {
253251
- const top = execSync23("ps aux --sort=-%cpu | head -8", { encoding: "utf-8", timeout: 3e3 }).trim();
253401
+ const top = execSync24("ps aux --sort=-%cpu | head -8", { encoding: "utf-8", timeout: 3e3 }).trim();
253252
253402
  lines.push(`
253253
253403
  Top processes by CPU:
253254
253404
  ${top}`);
253255
253405
  } catch {
253256
253406
  }
253257
253407
  try {
253258
- const nodeCount = execSync23("ps aux | grep 'node ' | grep -v grep | wc -l", { encoding: "utf-8", timeout: 3e3 }).trim();
253408
+ const nodeCount = execSync24("ps aux | grep 'node ' | grep -v grep | wc -l", { encoding: "utf-8", timeout: 3e3 }).trim();
253259
253409
  lines.push(`
253260
253410
  Node.js processes: ${nodeCount}`);
253261
253411
  } catch {
@@ -253264,7 +253414,7 @@ Node.js processes: ${nodeCount}`);
253264
253414
  }
253265
253415
  function findOrphans() {
253266
253416
  try {
253267
- const psOutput = execSync23(`ps -eo pid,ppid,%cpu,%mem,etime,args --no-headers 2>/dev/null | grep -E "${OA_PATTERNS}" | grep -v grep`, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
253417
+ const psOutput = execSync24(`ps -eo pid,ppid,%cpu,%mem,etime,args --no-headers 2>/dev/null | grep -E "${OA_PATTERNS}" | grep -v grep`, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
253268
253418
  if (!psOutput)
253269
253419
  return "No OA-related orphan processes found.";
253270
253420
  const myPid = process.pid;
@@ -253302,7 +253452,7 @@ function killProcess2(pid) {
253302
253452
  }
253303
253453
  process.kill(pid, "SIGTERM");
253304
253454
  try {
253305
- execSync23(`sleep 1 && kill -0 ${pid} 2>/dev/null && kill -9 ${pid} 2>/dev/null`, {
253455
+ execSync24(`sleep 1 && kill -0 ${pid} 2>/dev/null && kill -9 ${pid} 2>/dev/null`, {
253306
253456
  timeout: 3e3,
253307
253457
  stdio: "pipe"
253308
253458
  });
@@ -253822,7 +253972,7 @@ var init_agent_tool = __esm({
253822
253972
  });
253823
253973
 
253824
253974
  // packages/execution/dist/tools/worktree.js
253825
- import { execSync as execSync24 } from "node:child_process";
253975
+ import { execSync as execSync25 } from "node:child_process";
253826
253976
  import { existsSync as existsSync27, mkdirSync as mkdirSync9, rmSync } from "node:fs";
253827
253977
  import { join as join42, resolve as resolve30 } from "node:path";
253828
253978
  function validateSlug(slug) {
@@ -253841,7 +253991,7 @@ function flattenSlug(slug) {
253841
253991
  }
253842
253992
  function isGitRepo(cwd4) {
253843
253993
  try {
253844
- execSync24("git rev-parse --is-inside-work-tree", { cwd: cwd4, stdio: "pipe" });
253994
+ execSync25("git rev-parse --is-inside-work-tree", { cwd: cwd4, stdio: "pipe" });
253845
253995
  return true;
253846
253996
  } catch {
253847
253997
  return false;
@@ -253849,14 +253999,14 @@ function isGitRepo(cwd4) {
253849
253999
  }
253850
254000
  function getCurrentBranch(cwd4) {
253851
254001
  try {
253852
- return execSync24("git rev-parse --abbrev-ref HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
254002
+ return execSync25("git rev-parse --abbrev-ref HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
253853
254003
  } catch {
253854
254004
  return void 0;
253855
254005
  }
253856
254006
  }
253857
254007
  function getCurrentCommit(cwd4) {
253858
254008
  try {
253859
- return execSync24("git rev-parse --short HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
254009
+ return execSync25("git rev-parse --short HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
253860
254010
  } catch {
253861
254011
  return void 0;
253862
254012
  }
@@ -253887,13 +254037,13 @@ function createWorktree(repoRoot, slug) {
253887
254037
  }
253888
254038
  mkdirSync9(worktreeBase, { recursive: true });
253889
254039
  try {
253890
- execSync24(`git worktree add "${worktreePath}" -b "${branchName}"`, {
254040
+ execSync25(`git worktree add "${worktreePath}" -b "${branchName}"`, {
253891
254041
  cwd: repoRoot,
253892
254042
  stdio: "pipe"
253893
254043
  });
253894
254044
  } catch (err) {
253895
254045
  try {
253896
- execSync24(`git worktree add "${worktreePath}" "${branchName}"`, {
254046
+ execSync25(`git worktree add "${worktreePath}" "${branchName}"`, {
253897
254047
  cwd: repoRoot,
253898
254048
  stdio: "pipe"
253899
254049
  });
@@ -253915,7 +254065,7 @@ function createWorktree(repoRoot, slug) {
253915
254065
  }
253916
254066
  function worktreeHasChanges(worktreePath) {
253917
254067
  try {
253918
- const status = execSync24("git status --porcelain", {
254068
+ const status = execSync25("git status --porcelain", {
253919
254069
  cwd: worktreePath,
253920
254070
  stdio: "pipe"
253921
254071
  }).toString().trim();
@@ -253936,20 +254086,20 @@ function removeWorktree(repoRoot, slug, force = false) {
253936
254086
  return "Worktree has uncommitted changes. Use force=true to discard, or commit/stash first.";
253937
254087
  }
253938
254088
  try {
253939
- execSync24(`git worktree remove "${worktreePath}" ${force ? "--force" : ""}`, {
254089
+ execSync25(`git worktree remove "${worktreePath}" ${force ? "--force" : ""}`, {
253940
254090
  cwd: repoRoot,
253941
254091
  stdio: "pipe"
253942
254092
  });
253943
254093
  } catch (err) {
253944
254094
  try {
253945
254095
  rmSync(worktreePath, { recursive: true, force: true });
253946
- execSync24("git worktree prune", { cwd: repoRoot, stdio: "pipe" });
254096
+ execSync25("git worktree prune", { cwd: repoRoot, stdio: "pipe" });
253947
254097
  } catch {
253948
254098
  return `Failed to remove worktree: ${err}`;
253949
254099
  }
253950
254100
  }
253951
254101
  try {
253952
- execSync24(`git branch -D "${branchName}"`, { cwd: repoRoot, stdio: "pipe" });
254102
+ execSync25(`git branch -D "${branchName}"`, { cwd: repoRoot, stdio: "pipe" });
253953
254103
  } catch {
253954
254104
  }
253955
254105
  _sessions.delete(slug);
@@ -255226,7 +255376,7 @@ var init_notebook_edit = __esm({
255226
255376
  });
255227
255377
 
255228
255378
  // packages/execution/dist/tools/environment-snapshot.js
255229
- import { execSync as execSync25 } from "node:child_process";
255379
+ import { execSync as execSync26 } from "node:child_process";
255230
255380
  import { cpus, totalmem, freemem, hostname as hostname2, platform, arch, uptime } from "node:os";
255231
255381
  import { statfsSync } from "node:fs";
255232
255382
  function collectSnapshot(workingDir) {
@@ -255244,7 +255394,7 @@ function collectSnapshot(workingDir) {
255244
255394
  }
255245
255395
  let gpu = void 0;
255246
255396
  try {
255247
- const nvOut = execSync25("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());
255397
+ const nvOut = execSync26("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());
255248
255398
  if (nvOut.length >= 3) {
255249
255399
  gpu = {
255250
255400
  name: nvOut[0],
@@ -255259,12 +255409,12 @@ function collectSnapshot(workingDir) {
255259
255409
  let battery = void 0;
255260
255410
  try {
255261
255411
  if (platform() === "linux") {
255262
- const cap = execSync25("cat /sys/class/power_supply/BAT0/capacity 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
255263
- const status = execSync25("cat /sys/class/power_supply/BAT0/status 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
255412
+ const cap = execSync26("cat /sys/class/power_supply/BAT0/capacity 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
255413
+ const status = execSync26("cat /sys/class/power_supply/BAT0/status 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
255264
255414
  if (cap)
255265
255415
  battery = { percent: parseInt(cap, 10), charging: status === "Charging" || status === "Full" };
255266
255416
  } else if (platform() === "darwin") {
255267
- const pmOut = execSync25("pmset -g batt", { encoding: "utf-8", timeout: 2e3 });
255417
+ const pmOut = execSync26("pmset -g batt", { encoding: "utf-8", timeout: 2e3 });
255268
255418
  const match = pmOut.match(/(\d+)%;\s*(charging|discharging|charged)/i);
255269
255419
  if (match)
255270
255420
  battery = { percent: parseInt(match[1], 10), charging: match[2].toLowerCase() !== "discharging" };
@@ -255285,8 +255435,8 @@ function collectSnapshot(workingDir) {
255285
255435
  }
255286
255436
  let processInfo = { total: 0, nodeCount: 0, oaSpawned: 0, topCpu: [] };
255287
255437
  try {
255288
- const psLines = execSync25("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");
255289
- const total = parseInt(execSync25("ps aux | wc -l", { encoding: "utf-8", timeout: 2e3 }).trim(), 10);
255438
+ const psLines = execSync26("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");
255439
+ const total = parseInt(execSync26("ps aux | wc -l", { encoding: "utf-8", timeout: 2e3 }).trim(), 10);
255290
255440
  let nodeCount = 0;
255291
255441
  let oaSpawned = 0;
255292
255442
  const topCpu = [];
@@ -255367,7 +255517,7 @@ var init_environment_snapshot = __esm({
255367
255517
  });
255368
255518
 
255369
255519
  // packages/execution/dist/tools/video-understand.js
255370
- import { execSync as execSync26 } from "node:child_process";
255520
+ import { execSync as execSync27 } from "node:child_process";
255371
255521
  import { existsSync as existsSync31, mkdirSync as mkdirSync10, writeFileSync as writeFileSync10, readFileSync as readFileSync23, readdirSync as readdirSync8, unlinkSync as unlinkSync4 } from "node:fs";
255372
255522
  import { join as join45, basename as basename11 } from "node:path";
255373
255523
  import { createHash as createHash2 } from "node:crypto";
@@ -255376,11 +255526,11 @@ function isYouTubeUrl2(url) {
255376
255526
  }
255377
255527
  function ensureYtDlp2() {
255378
255528
  try {
255379
- execSync26("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
255529
+ execSync27("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
255380
255530
  return true;
255381
255531
  } catch {
255382
255532
  try {
255383
- execSync26("pip3 install --break-system-packages yt-dlp 2>/dev/null || pip3 install --user yt-dlp 2>/dev/null", { timeout: 6e4, stdio: "pipe" });
255533
+ execSync27("pip3 install --break-system-packages yt-dlp 2>/dev/null || pip3 install --user yt-dlp 2>/dev/null", { timeout: 6e4, stdio: "pipe" });
255384
255534
  return true;
255385
255535
  } catch {
255386
255536
  return false;
@@ -255389,7 +255539,7 @@ function ensureYtDlp2() {
255389
255539
  }
255390
255540
  function ensureFfmpeg() {
255391
255541
  try {
255392
- execSync26("ffmpeg -version", { timeout: 3e3, stdio: "pipe" });
255542
+ execSync27("ffmpeg -version", { timeout: 3e3, stdio: "pipe" });
255393
255543
  return true;
255394
255544
  } catch {
255395
255545
  return false;
@@ -255469,32 +255619,32 @@ var init_video_understand = __esm({
255469
255619
  return { success: false, output: "", error: "yt-dlp required but not available. Install: pip3 install yt-dlp", durationMs: performance.now() - start2 };
255470
255620
  }
255471
255621
  try {
255472
- execSync26(`yt-dlp -f "worst[ext=mp4]" -o "${join45(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255622
+ execSync27(`yt-dlp -f "worst[ext=mp4]" -o "${join45(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255473
255623
  } catch {
255474
- execSync26(`yt-dlp -f worst -o "${join45(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255624
+ execSync27(`yt-dlp -f worst -o "${join45(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255475
255625
  }
255476
- execSync26(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o "${join45(tmpDir, "audio.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255626
+ execSync27(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o "${join45(tmpDir, "audio.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255477
255627
  try {
255478
- title = execSync26(`yt-dlp --get-title "${url}"`, { encoding: "utf-8", timeout: 15e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
255628
+ title = execSync27(`yt-dlp --get-title "${url}"`, { encoding: "utf-8", timeout: 15e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
255479
255629
  } catch {
255480
255630
  }
255481
255631
  } else {
255482
- execSync26(`curl -sL -o "${join45(tmpDir, "video.mp4")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255483
- execSync26(`ffmpeg -i "${join45(tmpDir, "video.mp4")}" -vn -acodec libmp3lame -q:a 5 "${join45(tmpDir, "audio.mp3")}" -y`, { timeout: 12e4, stdio: "pipe" });
255632
+ execSync27(`curl -sL -o "${join45(tmpDir, "video.mp4")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
255633
+ execSync27(`ffmpeg -i "${join45(tmpDir, "video.mp4")}" -vn -acodec libmp3lame -q:a 5 "${join45(tmpDir, "audio.mp3")}" -y`, { timeout: 12e4, stdio: "pipe" });
255484
255634
  }
255485
255635
  videoPath = readdirSync8(tmpDir).find((f2) => f2.startsWith("video")) ? join45(tmpDir, readdirSync8(tmpDir).find((f2) => f2.startsWith("video"))) : join45(tmpDir, "video.mp4");
255486
255636
  audioPath = readdirSync8(tmpDir).find((f2) => f2.startsWith("audio")) ? join45(tmpDir, readdirSync8(tmpDir).find((f2) => f2.startsWith("audio"))) : join45(tmpDir, "audio.mp3");
255487
255637
  } else {
255488
255638
  videoPath = localPath;
255489
255639
  audioPath = join45(tmpDir, "audio.mp3");
255490
- execSync26(`ffmpeg -i "${videoPath}" -vn -acodec libmp3lame -q:a 5 "${audioPath}" -y`, { timeout: 12e4, stdio: "pipe" });
255640
+ execSync27(`ffmpeg -i "${videoPath}" -vn -acodec libmp3lame -q:a 5 "${audioPath}" -y`, { timeout: 12e4, stdio: "pipe" });
255491
255641
  }
255492
255642
  let segments = [];
255493
255643
  let language = "en";
255494
255644
  let duration = 0;
255495
255645
  try {
255496
255646
  const jsonOut = join45(tmpDir, "transcript.json");
255497
- execSync26(`transcribe-cli transcribe "${audioPath}" --model ${whisperModel} --format json -o "${tmpDir}"`, { timeout: 6e5, stdio: "pipe" });
255647
+ execSync27(`transcribe-cli transcribe "${audioPath}" --model ${whisperModel} --format json -o "${tmpDir}"`, { timeout: 6e5, stdio: "pipe" });
255498
255648
  const jsonFile = readdirSync8(tmpDir).find((f2) => f2.endsWith(".json") && f2 !== "result.json");
255499
255649
  if (jsonFile) {
255500
255650
  const data = JSON.parse(readFileSync23(join45(tmpDir, jsonFile), "utf-8"));
@@ -255517,7 +255667,7 @@ var init_video_understand = __esm({
255517
255667
  const fps = 25;
255518
255668
  const intervalFrames = Math.max(1, frameInterval * fps);
255519
255669
  try {
255520
- execSync26(`ffmpeg -i "${videoPath}" -vf "select='gt(scene\\,${sceneThreshold})+not(mod(n\\,${intervalFrames}))',showinfo" -vsync vfr "${join45(framesDir, "frame_%04d.jpg")}" -y`, { timeout: 3e5, stdio: "pipe" });
255670
+ execSync27(`ffmpeg -i "${videoPath}" -vf "select='gt(scene\\,${sceneThreshold})+not(mod(n\\,${intervalFrames}))',showinfo" -vsync vfr "${join45(framesDir, "frame_%04d.jpg")}" -y`, { timeout: 3e5, stdio: "pipe" });
255521
255671
  } catch {
255522
255672
  }
255523
255673
  const frameFiles = readdirSync8(framesDir).filter((f2) => f2.endsWith(".jpg")).sort();
@@ -255650,7 +255800,7 @@ Topic: ${segments.slice(0, 5).map((s2) => s2.text).join(" ").slice(0, 300)}`,
255650
255800
  }
255651
255801
  }
255652
255802
  try {
255653
- execSync26(`rm -rf "${tmpDir}"`, { timeout: 1e4, stdio: "pipe" });
255803
+ execSync27(`rm -rf "${tmpDir}"`, { timeout: 1e4, stdio: "pipe" });
255654
255804
  } catch {
255655
255805
  }
255656
255806
  return {
@@ -256636,6 +256786,7 @@ __export(dist_exports, {
256636
256786
  createFortemiBridgeTools: () => createFortemiBridgeTools,
256637
256787
  createTransport: () => createTransport,
256638
256788
  createWorktree: () => createWorktree2,
256789
+ detectElevationMethod: () => detectElevationMethod,
256639
256790
  detectSearchProvider: () => detectSearchProvider,
256640
256791
  discoverPlugins: () => discoverPlugins,
256641
256792
  discoverSkills: () => discoverSkills,
@@ -256686,6 +256837,7 @@ __export(dist_exports, {
256686
256837
  resetDepCache: () => resetDepCache,
256687
256838
  resetMoondreamClient: () => resetMoondreamClient,
256688
256839
  runBuild: () => runBuild,
256840
+ runElevated: () => runElevated,
256689
256841
  runFormatter: () => runFormatter,
256690
256842
  runLinter: () => runLinter,
256691
256843
  runPageRank: () => runPageRank,
@@ -256770,6 +256922,7 @@ var init_dist4 = __esm({
256770
256922
  init_repo_map();
256771
256923
  init_import_graph();
256772
256924
  init_process_health();
256925
+ init_system_auth();
256773
256926
  init_full_sub_agent();
256774
256927
  init_agent_tool();
256775
256928
  init_worktree();
@@ -259673,12 +259826,12 @@ var init_tool_batching = __esm({
259673
259826
  });
259674
259827
 
259675
259828
  // packages/orchestrator/dist/hooks.js
259676
- import { execSync as execSync27 } from "node:child_process";
259829
+ import { execSync as execSync28 } from "node:child_process";
259677
259830
  function executeHook(hook, env2 = {}) {
259678
259831
  const start2 = performance.now();
259679
259832
  const timeout2 = hook.timeoutMs ?? DEFAULT_HOOK_TIMEOUT;
259680
259833
  try {
259681
- const output = execSync27(hook.command, {
259834
+ const output = execSync28(hook.command, {
259682
259835
  timeout: timeout2,
259683
259836
  env: { ...process.env, ...env2 },
259684
259837
  encoding: "utf8",
@@ -263891,7 +264044,7 @@ ${result}`
263891
264044
  const buffer2 = Buffer.from(rawBase64, "base64");
263892
264045
  let resizedBase64 = null;
263893
264046
  try {
263894
- const { execSync: execSync40 } = await import("node:child_process");
264047
+ const { execSync: execSync41 } = await import("node:child_process");
263895
264048
  const { writeFileSync: writeFileSync35, readFileSync: readFileSync53, unlinkSync: unlinkSync14 } = await import("node:fs");
263896
264049
  const { join: join87 } = await import("node:path");
263897
264050
  const { tmpdir: tmpdir11 } = await import("node:os");
@@ -263901,7 +264054,7 @@ ${result}`
263901
264054
  const pyBin = process.platform === "win32" ? "python" : "python3";
263902
264055
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
263903
264056
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
263904
- execSync40(`${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" });
264057
+ execSync41(`${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" });
263905
264058
  const resizedBuf = readFileSync53(tmpOut);
263906
264059
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
263907
264060
  try {
@@ -263955,8 +264108,8 @@ ${result}`
263955
264108
  if (!res.ok && model === "moondream" && res.status === 404) {
263956
264109
  this.emit({ type: "status", content: `Pulling moondream vision model...`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
263957
264110
  try {
263958
- const { execSync: execSync40 } = await import("node:child_process");
263959
- execSync40("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
264111
+ const { execSync: execSync41 } = await import("node:child_process");
264112
+ execSync41("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
263960
264113
  res = await fetch(`${ollamaHost}/api/generate`, {
263961
264114
  method: "POST",
263962
264115
  headers: { "Content-Type": "application/json" },
@@ -266316,7 +266469,7 @@ __export(listen_exports, {
266316
266469
  isVideoPath: () => isVideoPath,
266317
266470
  waitForTranscribeCli: () => waitForTranscribeCli
266318
266471
  });
266319
- import { spawn as spawn17, execSync as execSync28 } from "node:child_process";
266472
+ import { spawn as spawn17, execSync as execSync29 } from "node:child_process";
266320
266473
  import { existsSync as existsSync37, mkdirSync as mkdirSync13, writeFileSync as writeFileSync14, readdirSync as readdirSync9 } from "node:fs";
266321
266474
  import { join as join53, dirname as dirname15 } from "node:path";
266322
266475
  import { homedir as homedir14 } from "node:os";
@@ -266338,7 +266491,7 @@ function findMicCaptureCommand() {
266338
266491
  const platform6 = process.platform;
266339
266492
  if (platform6 === "linux") {
266340
266493
  try {
266341
- execSync28("which arecord", { stdio: "pipe" });
266494
+ execSync29("which arecord", { stdio: "pipe" });
266342
266495
  return {
266343
266496
  cmd: "arecord",
266344
266497
  args: ["-f", "S16_LE", "-r", "16000", "-c", "1", "-t", "raw", "-q", "-"]
@@ -266348,7 +266501,7 @@ function findMicCaptureCommand() {
266348
266501
  }
266349
266502
  if (platform6 === "darwin") {
266350
266503
  try {
266351
- execSync28("which sox", { stdio: "pipe" });
266504
+ execSync29("which sox", { stdio: "pipe" });
266352
266505
  return {
266353
266506
  cmd: "sox",
266354
266507
  args: ["-d", "-t", "raw", "-r", "16000", "-c", "1", "-b", "16", "-e", "signed-integer", "-"]
@@ -266357,7 +266510,7 @@ function findMicCaptureCommand() {
266357
266510
  }
266358
266511
  }
266359
266512
  try {
266360
- execSync28("which ffmpeg", { stdio: "pipe" });
266513
+ execSync29("which ffmpeg", { stdio: "pipe" });
266361
266514
  if (platform6 === "linux") {
266362
266515
  return {
266363
266516
  cmd: "ffmpeg",
@@ -266416,7 +266569,7 @@ function findLiveWhisperScript() {
266416
266569
  return p2;
266417
266570
  }
266418
266571
  try {
266419
- const globalRoot = execSync28("npm root -g", {
266572
+ const globalRoot = execSync29("npm root -g", {
266420
266573
  encoding: "utf-8",
266421
266574
  timeout: 5e3,
266422
266575
  stdio: ["pipe", "pipe", "pipe"]
@@ -266449,7 +266602,7 @@ function ensureTranscribeCliBackground() {
266449
266602
  return;
266450
266603
  _bgInstallPromise = (async () => {
266451
266604
  try {
266452
- const globalRoot = execSync28("npm root -g", {
266605
+ const globalRoot = execSync29("npm root -g", {
266453
266606
  encoding: "utf-8",
266454
266607
  timeout: 5e3,
266455
266608
  stdio: ["pipe", "pipe", "pipe"]
@@ -266655,7 +266808,7 @@ var init_listen = __esm({
266655
266808
  }
266656
266809
  if (!this.transcribeCliAvailable) {
266657
266810
  try {
266658
- execSync28("which transcribe-cli", { stdio: "pipe" });
266811
+ execSync29("which transcribe-cli", { stdio: "pipe" });
266659
266812
  this.transcribeCliAvailable = true;
266660
266813
  } catch {
266661
266814
  this.transcribeCliAvailable = false;
@@ -266672,7 +266825,7 @@ var init_listen = __esm({
266672
266825
  } catch {
266673
266826
  }
266674
266827
  try {
266675
- const globalRoot = execSync28("npm root -g", {
266828
+ const globalRoot = execSync29("npm root -g", {
266676
266829
  encoding: "utf-8",
266677
266830
  timeout: 5e3,
266678
266831
  stdio: ["pipe", "pipe", "pipe"]
@@ -266722,7 +266875,7 @@ var init_listen = __esm({
266722
266875
  }
266723
266876
  if (!tc) {
266724
266877
  try {
266725
- execSync28("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
266878
+ execSync29("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
266726
266879
  this.transcribeCliAvailable = null;
266727
266880
  tc = await this.loadTranscribeCli();
266728
266881
  } catch {
@@ -266905,7 +267058,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
266905
267058
  }
266906
267059
  if (!tc) {
266907
267060
  try {
266908
- execSync28("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
267061
+ execSync29("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
266909
267062
  this.transcribeCliAvailable = null;
266910
267063
  tc = await this.loadTranscribeCli();
266911
267064
  } catch {
@@ -266959,7 +267112,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
266959
267112
  }
266960
267113
  if (!tc) {
266961
267114
  try {
266962
- execSync28("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
267115
+ execSync29("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
266963
267116
  this.transcribeCliAvailable = null;
266964
267117
  tc = await this.loadTranscribeCli();
266965
267118
  } catch {
@@ -271466,7 +271619,7 @@ var init_render = __esm({
271466
271619
 
271467
271620
  // packages/cli/dist/tui/voice-session.js
271468
271621
  import { createServer as createServer3 } from "node:http";
271469
- import { spawn as spawn18, execSync as execSync29 } from "node:child_process";
271622
+ import { spawn as spawn18, execSync as execSync30 } from "node:child_process";
271470
271623
  import { EventEmitter as EventEmitter4 } from "node:events";
271471
271624
  function generateFrontendHTML() {
271472
271625
  return `<!DOCTYPE html>
@@ -277523,7 +277676,7 @@ __export(text_selection_exports, {
277523
277676
  stripAnsi: () => stripAnsi,
277524
277677
  visibleLength: () => visibleLength
277525
277678
  });
277526
- import { execSync as execSync30 } from "node:child_process";
277679
+ import { execSync as execSync31 } from "node:child_process";
277527
277680
  function stripAnsi(s2) {
277528
277681
  return s2.replace(/\x1B\[[0-9;]*[A-Za-z]|\x1B\].*?(?:\x07|\x1B\\)/g, "");
277529
277682
  }
@@ -277534,16 +277687,16 @@ function copyText(text) {
277534
277687
  try {
277535
277688
  const platform6 = process.platform;
277536
277689
  if (platform6 === "darwin") {
277537
- execSync30("pbcopy", { input: text, timeout: 3e3 });
277690
+ execSync31("pbcopy", { input: text, timeout: 3e3 });
277538
277691
  return true;
277539
277692
  }
277540
277693
  if (platform6 === "win32") {
277541
- execSync30("clip", { input: text, timeout: 3e3 });
277694
+ execSync31("clip", { input: text, timeout: 3e3 });
277542
277695
  return true;
277543
277696
  }
277544
277697
  for (const tool of ["xclip -selection clipboard", "xsel --clipboard --input", "wl-copy"]) {
277545
277698
  try {
277546
- execSync30(tool, { input: text, timeout: 3e3 });
277699
+ execSync31(tool, { input: text, timeout: 3e3 });
277547
277700
  return true;
277548
277701
  } catch {
277549
277702
  continue;
@@ -277552,10 +277705,10 @@ function copyText(text) {
277552
277705
  if (!_clipboardAutoInstallAttempted) {
277553
277706
  _clipboardAutoInstallAttempted = true;
277554
277707
  try {
277555
- execSync30("which apt-get", { timeout: 2e3, stdio: "pipe" });
277708
+ execSync31("which apt-get", { timeout: 2e3, stdio: "pipe" });
277556
277709
  try {
277557
- execSync30("sudo -n apt-get install -y xclip 2>/dev/null", { timeout: 15e3, stdio: "pipe" });
277558
- execSync30("xclip -selection clipboard", { input: text, timeout: 3e3 });
277710
+ execSync31("sudo -n apt-get install -y xclip 2>/dev/null", { timeout: 15e3, stdio: "pipe" });
277711
+ execSync31("xclip -selection clipboard", { input: text, timeout: 3e3 });
277559
277712
  return true;
277560
277713
  } catch {
277561
277714
  }
@@ -280481,9 +280634,9 @@ ${CONTENT_BG_SEQ}`);
280481
280634
  const currentLine = rl.line ?? "";
280482
280635
  rl.line = "";
280483
280636
  rl.cursor = 0;
280484
- rl.emit("line", currentLine);
280485
280637
  self2.updateFooterHeight();
280486
280638
  self2.renderFooterAndPositionInput();
280639
+ setImmediate(() => rl.emit("line", currentLine));
280487
280640
  return;
280488
280641
  }
280489
280642
  if (self2.inputStateProvider && key?.name !== "backspace") {
@@ -280723,7 +280876,7 @@ function tuiSelect(opts) {
280723
280876
  const first2 = findSelectable(0, 1);
280724
280877
  cursor = first2 >= 0 ? first2 : 0;
280725
280878
  }
280726
- const reservedTopBottom = 1;
280879
+ const reservedTopBottom = 0;
280727
280880
  const hasCrumbs = opts.breadcrumbs && opts.breadcrumbs.length > 0;
280728
280881
  const selectChrome = (hasCrumbs ? 11 : 10) + 3;
280729
280882
  const contentArea = opts.availableRows ? opts.availableRows + reservedTopBottom : process.stdout.rows ?? 24;
@@ -281273,7 +281426,7 @@ __export(personaplex_exports, {
281273
281426
  import { existsSync as existsSync42, writeFileSync as writeFileSync18, readFileSync as readFileSync33, mkdirSync as mkdirSync17, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync13 } from "node:fs";
281274
281427
  import { join as join59, dirname as dirname19 } from "node:path";
281275
281428
  import { homedir as homedir16 } from "node:os";
281276
- import { execSync as execSync31, spawn as spawn20, execFile as execFile7 } from "node:child_process";
281429
+ import { execSync as execSync32, spawn as spawn20, execFile as execFile7 } from "node:child_process";
281277
281430
  import { fileURLToPath as fileURLToPath12 } from "node:url";
281278
281431
  function execAsync(cmd, opts = {}) {
281279
281432
  return new Promise((resolve39, reject) => {
@@ -281310,7 +281463,7 @@ function detectJetson() {
281310
281463
  try {
281311
281464
  const model = readFileSync33("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
281312
281465
  if (/jetson|orin|tegra/i.test(model)) {
281313
- const memInfo = execSync31("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
281466
+ const memInfo = execSync32("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
281314
281467
  const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
281315
281468
  return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
281316
281469
  }
@@ -281345,7 +281498,7 @@ function detectPersonaPlexCapability() {
281345
281498
  };
281346
281499
  }
281347
281500
  try {
281348
- const nvsmi = execSync31("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader,nounits", {
281501
+ const nvsmi = execSync32("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader,nounits", {
281349
281502
  encoding: "utf8",
281350
281503
  timeout: 5e3,
281351
281504
  stdio: "pipe"
@@ -281358,7 +281511,7 @@ function detectPersonaPlexCapability() {
281358
281511
  return { ...fail(`GPU has ${vramGB.toFixed(1)}GB VRAM (need \u22658GB)`), gpuName: gpuName ?? "", vramGB };
281359
281512
  }
281360
281513
  try {
281361
- execSync31('python3 -c "import torch; assert torch.cuda.is_available()"', {
281514
+ execSync32('python3 -c "import torch; assert torch.cuda.is_available()"', {
281362
281515
  timeout: 1e4,
281363
281516
  stdio: "pipe"
281364
281517
  });
@@ -281435,7 +281588,7 @@ async function installPersonaPlex(onInfo, weightTier) {
281435
281588
  mkdirSync17(PERSONAPLEX_DIR, { recursive: true });
281436
281589
  let arch2 = "";
281437
281590
  try {
281438
- arch2 = execSync31("uname -m", { encoding: "utf8", timeout: 3e3, stdio: "pipe" }).trim();
281591
+ arch2 = execSync32("uname -m", { encoding: "utf8", timeout: 3e3, stdio: "pipe" }).trim();
281439
281592
  } catch {
281440
281593
  }
281441
281594
  const isAarch64 = arch2 === "aarch64" || arch2 === "arm64";
@@ -281457,16 +281610,16 @@ async function installPersonaPlex(onInfo, weightTier) {
281457
281610
  log22("Checking system dependencies (libopus)...");
281458
281611
  try {
281459
281612
  if (process.platform === "linux") {
281460
- execSync31("dpkg -l libopus-dev 2>/dev/null || sudo apt-get install -y libopus-dev", { timeout: 3e4, stdio: "pipe" });
281613
+ execSync32("dpkg -l libopus-dev 2>/dev/null || sudo apt-get install -y libopus-dev", { timeout: 3e4, stdio: "pipe" });
281461
281614
  } else if (process.platform === "darwin") {
281462
- execSync31("brew list opus 2>/dev/null || brew install opus", { timeout: 6e4, stdio: "pipe" });
281615
+ execSync32("brew list opus 2>/dev/null || brew install opus", { timeout: 6e4, stdio: "pipe" });
281463
281616
  }
281464
281617
  } catch {
281465
281618
  }
281466
281619
  if (isAarch64) {
281467
281620
  log22("ARM64: Checking Rust toolchain for sphn build...");
281468
281621
  try {
281469
- execSync31("rustc --version", { timeout: 5e3, stdio: "pipe" });
281622
+ execSync32("rustc --version", { timeout: 5e3, stdio: "pipe" });
281470
281623
  } catch {
281471
281624
  log22("ARM64: Installing Rust toolchain (needed for sphn audio codec)...");
281472
281625
  try {
@@ -281523,7 +281676,7 @@ async function installPersonaPlex(onInfo, weightTier) {
281523
281676
  }
281524
281677
  const serverPy = join59(venvDir, "lib", `python3.${process.versions.node ? "12" : "10"}`, "site-packages", "moshi", "server.py");
281525
281678
  try {
281526
- const sitePackages = execSync31(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
281679
+ const sitePackages = execSync32(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
281527
281680
  encoding: "utf8",
281528
281681
  timeout: 5e3,
281529
281682
  stdio: "pipe"
@@ -281540,7 +281693,7 @@ async function installPersonaPlex(onInfo, weightTier) {
281540
281693
  } catch {
281541
281694
  }
281542
281695
  try {
281543
- const sitePackages = execSync31(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
281696
+ const sitePackages = execSync32(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
281544
281697
  encoding: "utf8",
281545
281698
  timeout: 5e3,
281546
281699
  stdio: "pipe"
@@ -281638,7 +281791,7 @@ $2if filename.endswith(".safetensors"):`);
281638
281791
  } catch {
281639
281792
  }
281640
281793
  try {
281641
- const sitePackages2 = execSync31(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
281794
+ const sitePackages2 = execSync32(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
281642
281795
  encoding: "utf8",
281643
281796
  timeout: 5e3,
281644
281797
  stdio: "pipe"
@@ -281767,11 +281920,11 @@ async function startPersonaPlexDaemon(onInfo) {
281767
281920
  if (tier === "nf4-distilled") {
281768
281921
  log22(`Weight tier: ${tier} \u2014 distilled NF4 (90% token match, ${repoInfo.sizeGB}GB)...`);
281769
281922
  try {
281770
- const weightPath = execSync31(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}', token=False))"`, { encoding: "utf8", timeout: 6e4, stdio: "pipe" }).trim();
281923
+ const weightPath = execSync32(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}', token=False))"`, { encoding: "utf8", timeout: 6e4, stdio: "pipe" }).trim();
281771
281924
  if (existsSync42(weightPath)) {
281772
281925
  if (!existsSync42(cachedBf16)) {
281773
281926
  log22("Converting .pt checkpoint to safetensors (one-time)...");
281774
- execSync31(`"${venvPython2}" -c "
281927
+ execSync32(`"${venvPython2}" -c "
281775
281928
  import torch; from safetensors.torch import save_file
281776
281929
  state = torch.load('${weightPath}', map_location='cpu', weights_only=True)
281777
281930
  state = {k: v.to(torch.bfloat16) if v.is_floating_point() else v for k, v in state.items()}
@@ -281801,10 +281954,10 @@ print('Converted')
281801
281954
  }
281802
281955
  }
281803
281956
  try {
281804
- const weightPath = execSync31(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}'${repoInfo.needsToken ? "" : ", token=False"}))"`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" }).trim();
281957
+ const weightPath = execSync32(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}'${repoInfo.needsToken ? "" : ", token=False"}))"`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" }).trim();
281805
281958
  if (existsSync42(dequantScript) && existsSync42(weightPath)) {
281806
281959
  try {
281807
- execSync31(`"${venvPython2}" "${dequantScript}" --input "${weightPath}" --output "${cachedBf16}"`, { timeout: 3e5, stdio: "pipe" });
281960
+ execSync32(`"${venvPython2}" "${dequantScript}" --input "${weightPath}" --output "${cachedBf16}"`, { timeout: 3e5, stdio: "pipe" });
281808
281961
  if (existsSync42(cachedBf16)) {
281809
281962
  extraArgs.push("--moshi-weight", cachedBf16);
281810
281963
  log22(`Using dequantized cache: ${(statSync13(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
@@ -281814,13 +281967,13 @@ print('Converted')
281814
281967
  }
281815
281968
  }
281816
281969
  try {
281817
- const mimiPath = execSync31(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer-e351c8d8-checkpoint125.safetensors', token=False))"`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" }).trim();
281970
+ const mimiPath = execSync32(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer-e351c8d8-checkpoint125.safetensors', token=False))"`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" }).trim();
281818
281971
  if (existsSync42(mimiPath))
281819
281972
  extraArgs.push("--mimi-weight", mimiPath);
281820
281973
  } catch {
281821
281974
  }
281822
281975
  try {
281823
- const tokPath = execSync31(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer_spm_32k_3.model', token=False))"`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" }).trim();
281976
+ const tokPath = execSync32(`"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer_spm_32k_3.model', token=False))"`, { encoding: "utf8", timeout: 3e4, stdio: "pipe" }).trim();
281824
281977
  if (existsSync42(tokPath))
281825
281978
  extraArgs.push("--tokenizer", tokPath);
281826
281979
  } catch {
@@ -281844,7 +281997,7 @@ print('Converted')
281844
281997
  if (!ollamaModel)
281845
281998
  ollamaModel = "qwen3.5:4b";
281846
281999
  try {
281847
- const ollamaCheck = execSync31("curl -s http://localhost:11434/api/tags", {
282000
+ const ollamaCheck = execSync32("curl -s http://localhost:11434/api/tags", {
281848
282001
  timeout: 3e3,
281849
282002
  stdio: "pipe",
281850
282003
  encoding: "utf8"
@@ -281921,7 +282074,7 @@ print('Converted')
281921
282074
  return null;
281922
282075
  }
281923
282076
  try {
281924
- execSync31(`curl -sk -o /dev/null -w "%{http_code}" https://127.0.0.1:${PORT}/`, {
282077
+ execSync32(`curl -sk -o /dev/null -w "%{http_code}" https://127.0.0.1:${PORT}/`, {
281925
282078
  timeout: 3e3,
281926
282079
  stdio: "pipe",
281927
282080
  encoding: "utf8"
@@ -281947,7 +282100,7 @@ function stopPersonaPlex() {
281947
282100
  return;
281948
282101
  try {
281949
282102
  if (process.platform === "win32") {
281950
- execSync31(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
282103
+ execSync32(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
281951
282104
  } else {
281952
282105
  process.kill(pid, "SIGTERM");
281953
282106
  }
@@ -282261,7 +282414,7 @@ __export(setup_exports, {
282261
282414
  updateOllama: () => updateOllama
282262
282415
  });
282263
282416
  import * as readline from "node:readline";
282264
- import { execSync as execSync32, spawn as spawn21, exec as exec3 } from "node:child_process";
282417
+ import { execSync as execSync33, spawn as spawn21, exec as exec3 } from "node:child_process";
282265
282418
  import { promisify as promisify7 } from "node:util";
282266
282419
  import { existsSync as existsSync43, writeFileSync as writeFileSync19, readFileSync as readFileSync34, appendFileSync as appendFileSync2, mkdirSync as mkdirSync18 } from "node:fs";
282267
282420
  import { join as join60 } from "node:path";
@@ -282300,7 +282453,7 @@ function detectSystemSpecs() {
282300
282453
  let gpuVramGB = 0;
282301
282454
  let gpuName = "";
282302
282455
  try {
282303
- const memInfo = execSync32("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
282456
+ const memInfo = execSync33("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
282304
282457
  encoding: "utf8",
282305
282458
  timeout: 5e3
282306
282459
  });
@@ -282320,7 +282473,7 @@ function detectSystemSpecs() {
282320
282473
  } catch {
282321
282474
  }
282322
282475
  try {
282323
- const nvidiaSmi = execSync32("nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
282476
+ const nvidiaSmi = execSync33("nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits 2>/dev/null", { encoding: "utf8", timeout: 5e3 });
282324
282477
  const lines = nvidiaSmi.trim().split("\n");
282325
282478
  if (lines.length > 0) {
282326
282479
  for (const line of lines) {
@@ -282491,7 +282644,7 @@ function ensureCurl() {
282491
282644
  for (const s2 of strategies) {
282492
282645
  if (hasCmd(s2.check)) {
282493
282646
  try {
282494
- execSync32(s2.install, { stdio: "inherit", timeout: 12e4 });
282647
+ execSync33(s2.install, { stdio: "inherit", timeout: 12e4 });
282495
282648
  if (hasCmd("curl")) {
282496
282649
  process.stdout.write(` ${c3.green("\u2714")} curl installed via ${s2.label}.
282497
282650
  `);
@@ -282505,7 +282658,7 @@ function ensureCurl() {
282505
282658
  }
282506
282659
  if (plat === "darwin") {
282507
282660
  try {
282508
- execSync32("xcode-select --install", { stdio: "inherit", timeout: 3e5 });
282661
+ execSync33("xcode-select --install", { stdio: "inherit", timeout: 3e5 });
282509
282662
  if (hasCmd("curl"))
282510
282663
  return true;
282511
282664
  } catch {
@@ -282540,7 +282693,7 @@ function installOllamaLinux() {
282540
282693
 
282541
282694
  `);
282542
282695
  try {
282543
- execSync32("curl -fsSL https://ollama.com/install.sh | sh", {
282696
+ execSync33("curl -fsSL https://ollama.com/install.sh | sh", {
282544
282697
  stdio: "inherit",
282545
282698
  timeout: 3e5
282546
282699
  });
@@ -282568,7 +282721,7 @@ async function installOllamaMac(_rl) {
282568
282721
 
282569
282722
  `);
282570
282723
  try {
282571
- execSync32('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "inherit", timeout: 6e5 });
282724
+ execSync33('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "inherit", timeout: 6e5 });
282572
282725
  if (!hasCmd("brew")) {
282573
282726
  try {
282574
282727
  const brewPrefix = existsSync43("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
@@ -282601,7 +282754,7 @@ async function installOllamaMac(_rl) {
282601
282754
 
282602
282755
  `);
282603
282756
  try {
282604
- execSync32("brew install ollama", {
282757
+ execSync33("brew install ollama", {
282605
282758
  stdio: "inherit",
282606
282759
  timeout: 3e5
282607
282760
  });
@@ -282628,7 +282781,7 @@ function installOllamaWindows() {
282628
282781
 
282629
282782
  `);
282630
282783
  try {
282631
- execSync32('powershell -Command "irm https://ollama.com/install.ps1 | iex"', {
282784
+ execSync33('powershell -Command "irm https://ollama.com/install.ps1 | iex"', {
282632
282785
  stdio: "inherit",
282633
282786
  timeout: 3e5
282634
282787
  });
@@ -282709,7 +282862,7 @@ async function ensureOllamaRunning(backendUrl, rl) {
282709
282862
  }
282710
282863
  function getOllamaVersion() {
282711
282864
  try {
282712
- const out = execSync32("ollama --version", { encoding: "utf8", timeout: 5e3 });
282865
+ const out = execSync33("ollama --version", { encoding: "utf8", timeout: 5e3 });
282713
282866
  const match = out.match(/(\d+\.\d+\.\d+)/);
282714
282867
  return match ? match[1] : null;
282715
282868
  } catch {
@@ -282760,7 +282913,7 @@ function updateOllama() {
282760
282913
  return false;
282761
282914
  }
282762
282915
  try {
282763
- execSync32("curl -fsSL https://ollama.com/install.sh | sh", {
282916
+ execSync33("curl -fsSL https://ollama.com/install.sh | sh", {
282764
282917
  stdio: "inherit",
282765
282918
  timeout: 3e5
282766
282919
  });
@@ -282771,7 +282924,7 @@ function updateOllama() {
282771
282924
  }
282772
282925
  function pullModelWithAutoUpdate(tag) {
282773
282926
  try {
282774
- execSync32(`ollama pull ${tag}`, {
282927
+ execSync33(`ollama pull ${tag}`, {
282775
282928
  stdio: "inherit",
282776
282929
  timeout: 36e5
282777
282930
  // 1 hour max
@@ -282791,7 +282944,7 @@ function pullModelWithAutoUpdate(tag) {
282791
282944
 
282792
282945
  `);
282793
282946
  try {
282794
- execSync32("curl -fsSL https://ollama.com/install.sh | sh", {
282947
+ execSync33("curl -fsSL https://ollama.com/install.sh | sh", {
282795
282948
  stdio: "inherit",
282796
282949
  timeout: 3e5
282797
282950
  // 5 min max for install
@@ -282802,7 +282955,7 @@ function pullModelWithAutoUpdate(tag) {
282802
282955
  process.stdout.write(` ${c3.cyan("\u25CF")} Retrying pull of ${c3.bold(tag)}...
282803
282956
 
282804
282957
  `);
282805
- execSync32(`ollama pull ${tag}`, {
282958
+ execSync33(`ollama pull ${tag}`, {
282806
282959
  stdio: "inherit",
282807
282960
  timeout: 36e5
282808
282961
  });
@@ -282904,7 +283057,7 @@ function ensurePython3() {
282904
283057
  if (plat === "darwin") {
282905
283058
  if (hasCmd("brew")) {
282906
283059
  try {
282907
- execSync32("brew install python3", { stdio: "inherit", timeout: 3e5 });
283060
+ execSync33("brew install python3", { stdio: "inherit", timeout: 3e5 });
282908
283061
  if (hasCmd("python3")) {
282909
283062
  process.stdout.write(` ${c3.green("\u2714")} Python3 installed via Homebrew.
282910
283063
  `);
@@ -282917,7 +283070,7 @@ function ensurePython3() {
282917
283070
  for (const s2 of strategies) {
282918
283071
  if (hasCmd(s2.check)) {
282919
283072
  try {
282920
- execSync32(s2.install, { stdio: "inherit", timeout: 12e4 });
283073
+ execSync33(s2.install, { stdio: "inherit", timeout: 12e4 });
282921
283074
  if (hasCmd("python3") || hasCmd("python")) {
282922
283075
  process.stdout.write(` ${c3.green("\u2714")} Python3 installed via ${s2.label}.
282923
283076
  `);
@@ -282933,11 +283086,11 @@ function ensurePython3() {
282933
283086
  }
282934
283087
  function checkPythonVenv() {
282935
283088
  try {
282936
- execSync32("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
283089
+ execSync33("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
282937
283090
  return true;
282938
283091
  } catch {
282939
283092
  try {
282940
- execSync32("python -m venv --help", { stdio: "pipe", timeout: 5e3 });
283093
+ execSync33("python -m venv --help", { stdio: "pipe", timeout: 5e3 });
282941
283094
  return true;
282942
283095
  } catch {
282943
283096
  return false;
@@ -282956,7 +283109,7 @@ function ensurePythonVenv() {
282956
283109
  for (const s2 of strategies) {
282957
283110
  if (hasCmd(s2.check)) {
282958
283111
  try {
282959
- execSync32(s2.install, { stdio: "inherit", timeout: 12e4 });
283112
+ execSync33(s2.install, { stdio: "inherit", timeout: 12e4 });
282960
283113
  if (checkPythonVenv()) {
282961
283114
  process.stdout.write(` ${c3.green("\u2714")} python3-venv installed via ${s2.label}.
282962
283115
  `);
@@ -283383,7 +283536,7 @@ async function doSetup(config, rl) {
283383
283536
  const modelfilePath = join60(modelDir2, `Modelfile.${customName}`);
283384
283537
  writeFileSync19(modelfilePath, modelfileContent + "\n", "utf8");
283385
283538
  process.stdout.write(` ${c3.dim("Creating model...")} `);
283386
- execSync32(`ollama create ${customName} -f ${modelfilePath}`, {
283539
+ execSync33(`ollama create ${customName} -f ${modelfilePath}`, {
283387
283540
  stdio: "pipe",
283388
283541
  timeout: 12e4
283389
283542
  });
@@ -283434,7 +283587,7 @@ function isFirstRun() {
283434
283587
  function hasCmd(cmd) {
283435
283588
  try {
283436
283589
  const whichCmd = process.platform === "win32" ? `where ${cmd}` : `which ${cmd}`;
283437
- execSync32(whichCmd, { stdio: "pipe", timeout: 3e3 });
283590
+ execSync33(whichCmd, { stdio: "pipe", timeout: 3e3 });
283438
283591
  return true;
283439
283592
  } catch {
283440
283593
  return false;
@@ -283448,7 +283601,7 @@ function detectPkgManager() {
283448
283601
  if (hasCmd("winget"))
283449
283602
  return "winget";
283450
283603
  try {
283451
- execSync32(`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'))"`, { stdio: "pipe", timeout: 12e4 });
283604
+ execSync33(`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'))"`, { stdio: "pipe", timeout: 12e4 });
283452
283605
  if (hasCmd("choco"))
283453
283606
  return "choco";
283454
283607
  } catch {
@@ -283459,7 +283612,7 @@ function detectPkgManager() {
283459
283612
  if (hasCmd("brew"))
283460
283613
  return "brew";
283461
283614
  try {
283462
- execSync32('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "pipe", timeout: 3e5, env: { ...process.env, NONINTERACTIVE: "1" } });
283615
+ execSync33('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "pipe", timeout: 3e5, env: { ...process.env, NONINTERACTIVE: "1" } });
283463
283616
  if (hasCmd("brew"))
283464
283617
  return "brew";
283465
283618
  } catch {
@@ -283481,7 +283634,7 @@ function getVenvDir() {
283481
283634
  }
283482
283635
  function hasVenvModule() {
283483
283636
  try {
283484
- execSync32("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
283637
+ execSync33("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
283485
283638
  return true;
283486
283639
  } catch {
283487
283640
  return false;
@@ -283506,8 +283659,8 @@ function ensureVenv(log22) {
283506
283659
  try {
283507
283660
  mkdirSync18(join60(homedir17(), ".open-agents"), { recursive: true });
283508
283661
  const pyCmd = hasCmd(pythonCmd) ? pythonCmd : "python3";
283509
- execSync32(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
283510
- execSync32(`"${pipPath}" install --upgrade pip`, {
283662
+ execSync33(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
283663
+ execSync33(`"${pipPath}" install --upgrade pip`, {
283511
283664
  stdio: "pipe",
283512
283665
  timeout: 6e4
283513
283666
  });
@@ -283520,7 +283673,7 @@ function ensureVenv(log22) {
283520
283673
  }
283521
283674
  function trySudoPasswordless(cmd, timeoutMs = 12e4) {
283522
283675
  try {
283523
- execSync32(`sudo -n ${cmd}`, {
283676
+ execSync33(`sudo -n ${cmd}`, {
283524
283677
  stdio: "pipe",
283525
283678
  timeout: timeoutMs,
283526
283679
  env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
@@ -283533,7 +283686,7 @@ function trySudoPasswordless(cmd, timeoutMs = 12e4) {
283533
283686
  function runWithSudo(cmd, password, timeoutMs = 12e4) {
283534
283687
  try {
283535
283688
  const escaped = cmd.replace(/'/g, "'\\''");
283536
- execSync32(`sudo -S bash -c '${escaped}'`, {
283689
+ execSync33(`sudo -S bash -c '${escaped}'`, {
283537
283690
  input: password + "\n",
283538
283691
  stdio: ["pipe", "pipe", "pipe"],
283539
283692
  timeout: timeoutMs,
@@ -283636,7 +283789,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283636
283789
  let winNeedsElevation = false;
283637
283790
  if (process.platform === "win32") {
283638
283791
  try {
283639
- execSync32("net session", { stdio: "pipe", timeout: 3e3 });
283792
+ execSync33("net session", { stdio: "pipe", timeout: 3e3 });
283640
283793
  } catch {
283641
283794
  winNeedsElevation = true;
283642
283795
  log22(`Installing ${labels} via ${pm2} (requires admin \u2014 UAC prompt will appear)...`);
@@ -283684,9 +283837,9 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283684
283837
  if (needsSudo) {
283685
283838
  await sudoInstall(installCmd, getPassword, log22, cachedPasswordRef, 18e4);
283686
283839
  } else if (winNeedsElevation) {
283687
- execSync32(`powershell -NoProfile -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c ${installCmd.replace(/'/g, "''")}' -Verb RunAs -Wait"`, { stdio: "pipe", timeout: 18e4 });
283840
+ execSync33(`powershell -NoProfile -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c ${installCmd.replace(/'/g, "''")}' -Verb RunAs -Wait"`, { stdio: "pipe", timeout: 18e4 });
283688
283841
  } else {
283689
- execSync32(installCmd, { stdio: "pipe", timeout: 18e4 });
283842
+ execSync33(installCmd, { stdio: "pipe", timeout: 18e4 });
283690
283843
  }
283691
283844
  } catch (e2) {
283692
283845
  const stderr = e2.stderr?.toString?.()?.trim?.() ?? "";
@@ -283700,7 +283853,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283700
283853
  if (!hasCmd(d2.binary) && pipPkg) {
283701
283854
  try {
283702
283855
  const pipCmd = process.platform === "win32" ? `pip install ${pipPkg}` : `pip3 install ${pipPkg}`;
283703
- execSync32(pipCmd, { stdio: "pipe", timeout: 12e4 });
283856
+ execSync33(pipCmd, { stdio: "pipe", timeout: 12e4 });
283704
283857
  lastError = "";
283705
283858
  } catch (e2) {
283706
283859
  const stderr = e2.stderr?.toString?.()?.trim?.() ?? "";
@@ -283712,7 +283865,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283712
283865
  }
283713
283866
  if (process.platform === "win32" && !hasCmd(d2.binary)) {
283714
283867
  try {
283715
- const freshPath = execSync32(`powershell -NoProfile -Command "[System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')"`, { encoding: "utf8", timeout: 5e3, stdio: "pipe" }).trim();
283868
+ const freshPath = execSync33(`powershell -NoProfile -Command "[System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')"`, { encoding: "utf8", timeout: 5e3, stdio: "pipe" }).trim();
283716
283869
  if (freshPath)
283717
283870
  process.env.PATH = freshPath;
283718
283871
  } catch {
@@ -283756,7 +283909,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283756
283909
  const venvCmds = {
283757
283910
  apt: () => {
283758
283911
  try {
283759
- const pyVer = execSync32(`python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).trim();
283912
+ const pyVer = execSync33(`python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).trim();
283760
283913
  return `apt-get install -y python3-venv python${pyVer}-venv`;
283761
283914
  } catch {
283762
283915
  return "apt-get install -y python3-venv";
@@ -283785,12 +283938,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283785
283938
  const venvPip2 = join60(venvBin, "pip");
283786
283939
  log22("Installing moondream-station in ~/.open-agents/venv...");
283787
283940
  try {
283788
- execSync32(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
283941
+ execSync33(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
283789
283942
  if (existsSync43(venvMoondream)) {
283790
283943
  log22("moondream-station installed successfully.");
283791
283944
  } else {
283792
283945
  try {
283793
- const check = execSync32(`"${venvPip2}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
283946
+ const check = execSync33(`"${venvPip2}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
283794
283947
  if (check.includes("moondream")) {
283795
283948
  log22("moondream-station package installed.");
283796
283949
  }
@@ -283807,7 +283960,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283807
283960
  const venvPip2 = join60(venvBin, isWin2 ? "pip.exe" : "pip");
283808
283961
  let ocrStackInstalled = false;
283809
283962
  try {
283810
- execSync32(`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
283963
+ execSync33(`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
283811
283964
  ocrStackInstalled = true;
283812
283965
  } catch {
283813
283966
  }
@@ -283815,9 +283968,9 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
283815
283968
  const ocrPackages = "pytesseract Pillow opencv-python-headless numpy";
283816
283969
  log22("Installing OCR Python stack (pytesseract, OpenCV, Pillow, numpy)...");
283817
283970
  try {
283818
- execSync32(`"${venvPip2}" install ${ocrPackages}`, { stdio: "pipe", timeout: 3e5 });
283971
+ execSync33(`"${venvPip2}" install ${ocrPackages}`, { stdio: "pipe", timeout: 3e5 });
283819
283972
  try {
283820
- execSync32(`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
283973
+ execSync33(`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
283821
283974
  log22("OCR Python stack installed successfully.");
283822
283975
  } catch {
283823
283976
  log22("OCR Python stack install completed but import verification failed.");
@@ -283851,7 +284004,7 @@ function ensureCloudflaredBackground(onInfo) {
283851
284004
  const archMap = { x64: "amd64", arm64: "arm64", arm: "arm" };
283852
284005
  const cfArch = archMap[arch2] ?? "amd64";
283853
284006
  try {
283854
- execSync32(`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${homedir17()}/.local/bin" && mv /tmp/cloudflared "${homedir17()}/.local/bin/cloudflared"`, { stdio: "pipe", timeout: 6e4 });
284007
+ execSync33(`curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${homedir17()}/.local/bin" && mv /tmp/cloudflared "${homedir17()}/.local/bin/cloudflared"`, { stdio: "pipe", timeout: 6e4 });
283855
284008
  if (!process.env.PATH?.includes(`${homedir17()}/.local/bin`)) {
283856
284009
  process.env.PATH = `${homedir17()}/.local/bin:${process.env.PATH}`;
283857
284010
  }
@@ -283862,7 +284015,7 @@ function ensureCloudflaredBackground(onInfo) {
283862
284015
  } catch {
283863
284016
  }
283864
284017
  try {
283865
- execSync32(`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 });
284018
+ execSync33(`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 });
283866
284019
  if (hasCmd("cloudflared")) {
283867
284020
  log22("cloudflared installed.");
283868
284021
  return true;
@@ -283871,7 +284024,7 @@ function ensureCloudflaredBackground(onInfo) {
283871
284024
  }
283872
284025
  } else if (os8 === "darwin") {
283873
284026
  try {
283874
- execSync32("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
284027
+ execSync33("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
283875
284028
  if (hasCmd("cloudflared")) {
283876
284029
  log22("cloudflared installed via Homebrew.");
283877
284030
  return true;
@@ -283959,7 +284112,7 @@ function createExpandedVariant(baseModel, specs, sizeGB, kvBytesPerToken, archMa
283959
284112
  mkdirSync18(modelDir2, { recursive: true });
283960
284113
  const modelfilePath = join60(modelDir2, `Modelfile.${customName}`);
283961
284114
  writeFileSync19(modelfilePath, modelfileContent + "\n", "utf8");
283962
- execSync32(`ollama create ${customName} -f ${modelfilePath}`, {
284115
+ execSync33(`ollama create ${customName} -f ${modelfilePath}`, {
283963
284116
  stdio: "pipe",
283964
284117
  timeout: 12e4
283965
284118
  });
@@ -284045,7 +284198,7 @@ async function ensureExpandedContext(modelName, backendUrl) {
284045
284198
  }
284046
284199
  async function ensureNeovim() {
284047
284200
  try {
284048
- const nvimPath = execSync32("which nvim 2>/dev/null || where nvim 2>nul", {
284201
+ const nvimPath = execSync33("which nvim 2>/dev/null || where nvim 2>nul", {
284049
284202
  encoding: "utf8",
284050
284203
  stdio: "pipe",
284051
284204
  timeout: 5e3
@@ -284067,14 +284220,14 @@ async function ensureNeovim() {
284067
284220
  const url = `https://github.com/neovim/neovim/releases/latest/download/${appImageName}`;
284068
284221
  console.log(` Downloading Neovim (${appImageName})...`);
284069
284222
  try {
284070
- execSync32(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
284071
- execSync32(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
284223
+ execSync33(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
284224
+ execSync33(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
284072
284225
  } catch (err) {
284073
284226
  console.log(` Failed to download Neovim: ${err instanceof Error ? err.message : String(err)}`);
284074
284227
  return null;
284075
284228
  }
284076
284229
  try {
284077
- const ver = execSync32(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
284230
+ const ver = execSync33(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
284078
284231
  console.log(` Installed: ${ver}`);
284079
284232
  } catch {
284080
284233
  console.log(" Warning: nvim binary downloaded but may not work (missing FUSE? Try: nvim --appimage-extract)");
@@ -284089,8 +284242,8 @@ async function ensureNeovim() {
284089
284242
  if (hasCmd("brew")) {
284090
284243
  console.log(" Installing Neovim via Homebrew...");
284091
284244
  try {
284092
- execSync32("brew install neovim", { stdio: "inherit", timeout: 12e4 });
284093
- const nvimPath = execSync32("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
284245
+ execSync33("brew install neovim", { stdio: "inherit", timeout: 12e4 });
284246
+ const nvimPath = execSync33("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
284094
284247
  return nvimPath || null;
284095
284248
  } catch {
284096
284249
  console.log(" brew install neovim failed.");
@@ -284104,7 +284257,7 @@ async function ensureNeovim() {
284104
284257
  if (hasCmd("choco")) {
284105
284258
  console.log(" Installing Neovim via Chocolatey...");
284106
284259
  try {
284107
- execSync32("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
284260
+ execSync33("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
284108
284261
  return "nvim";
284109
284262
  } catch {
284110
284263
  console.log(" choco install neovim failed.");
@@ -284113,7 +284266,7 @@ async function ensureNeovim() {
284113
284266
  if (hasCmd("winget")) {
284114
284267
  console.log(" Installing Neovim via winget...");
284115
284268
  try {
284116
- execSync32("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
284269
+ execSync33("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
284117
284270
  stdio: "inherit",
284118
284271
  timeout: 12e4
284119
284272
  });
@@ -284359,7 +284512,7 @@ var init_drop_panel = __esm({
284359
284512
  import { existsSync as existsSync45, unlinkSync as unlinkSync8 } from "node:fs";
284360
284513
  import { tmpdir as tmpdir8 } from "node:os";
284361
284514
  import { join as join61 } from "node:path";
284362
- import { execSync as execSync33 } from "node:child_process";
284515
+ import { execSync as execSync34 } from "node:child_process";
284363
284516
  function isNeovimActive() {
284364
284517
  return _state !== null && !_state.cleanedUp;
284365
284518
  }
@@ -284377,7 +284530,7 @@ async function startNeovimMode(opts) {
284377
284530
  }
284378
284531
  let nvimPath;
284379
284532
  try {
284380
- nvimPath = execSync33("which nvim 2>/dev/null", { encoding: "utf8" }).trim();
284533
+ nvimPath = execSync34("which nvim 2>/dev/null", { encoding: "utf8" }).trim();
284381
284534
  if (!nvimPath)
284382
284535
  throw new Error();
284383
284536
  } catch {
@@ -284883,8 +285036,8 @@ async function startDaemon() {
284883
285036
  let oaScript = process.argv[1];
284884
285037
  if (!oaScript) {
284885
285038
  try {
284886
- const { execSync: execSync40 } = await import("node:child_process");
284887
- const whichOa = execSync40("which oa 2>/dev/null || where oa 2>nul", { encoding: "utf8" }).trim();
285039
+ const { execSync: execSync41 } = await import("node:child_process");
285040
+ const whichOa = execSync41("which oa 2>/dev/null || where oa 2>nul", { encoding: "utf8" }).trim();
284888
285041
  if (whichOa)
284889
285042
  oaScript = whichOa;
284890
285043
  } catch {
@@ -286319,7 +286472,7 @@ __export(voice_exports, {
286319
286472
  import { existsSync as existsSync48, mkdirSync as mkdirSync21, writeFileSync as writeFileSync22, readFileSync as readFileSync37, unlinkSync as unlinkSync10, readdirSync as readdirSync13, renameSync, statSync as statSync14 } from "node:fs";
286320
286473
  import { join as join64, dirname as dirname21 } from "node:path";
286321
286474
  import { homedir as homedir19, tmpdir as tmpdir9, platform as platform4 } from "node:os";
286322
- import { execSync as execSync34, spawn as nodeSpawn } from "node:child_process";
286475
+ import { execSync as execSync35, spawn as nodeSpawn } from "node:child_process";
286323
286476
  import { createRequire as createRequire2 } from "node:module";
286324
286477
  function sanitizeForTTS(text) {
286325
286478
  return text.replace(/^#{1,6}\s+/gm, "").replace(/\*{1,3}([^*]+)\*{1,3}/g, "$1").replace(/_{1,3}([^_]+)_{1,3}/g, "$1").replace(/~~([^~]+)~~/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/```[\s\S]*?```/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/^[\s]*[-*+]\s+/gm, "").replace(/^[\s]*\d+\.\s+/gm, "").replace(/^>\s+/gm, "").replace(/^[-*_]{3,}$/gm, "").replace(/\[[ xX]\]\s*/g, "").replace(/[\u{1F600}-\u{1F64F}]/gu, "").replace(/[\u{1F300}-\u{1F5FF}]/gu, "").replace(/[\u{1F680}-\u{1F6FF}]/gu, "").replace(/[\u{1F1E0}-\u{1F1FF}]/gu, "").replace(/[\u{2600}-\u{26FF}]/gu, "").replace(/[\u{2700}-\u{27BF}]/gu, "").replace(/[\u{FE00}-\u{FE0F}]/gu, "").replace(/[\u{1F900}-\u{1F9FF}]/gu, "").replace(/[\u{1FA00}-\u{1FA6F}]/gu, "").replace(/[\u{1FA70}-\u{1FAFF}]/gu, "").replace(/[\u{200D}]/gu, "").replace(/[\u{20E3}]/gu, "").replace(/[✓✔✗✘✕✖⚠️⏸⏹⏵●○◆◇■□▪▫►▼▲◀⬆⬇⬅➡↑↓←→⇐⇒⇑⇓]/g, "").replace(/[─━│┃┌┐└┘├┤┬┴┼╔╗╚╝╠╣╦╩╬⎿⎾▕▏⏐░▒▓█⠀-⣿]/g, "").replace(/\s{2,}/g, " ").trim();
@@ -288061,7 +288214,7 @@ var init_voice = __esm({
288061
288214
  }
288062
288215
  for (const player of ["paplay", "pw-play", "aplay"]) {
288063
288216
  try {
288064
- execSync34(`which ${player}`, { stdio: "pipe" });
288217
+ execSync35(`which ${player}`, { stdio: "pipe" });
288065
288218
  return [player, path5];
288066
288219
  } catch {
288067
288220
  }
@@ -288090,7 +288243,7 @@ var init_voice = __esm({
288090
288243
  return this.python3Path;
288091
288244
  for (const bin of ["python3", "python"]) {
288092
288245
  try {
288093
- const path5 = execSync34(`which ${bin}`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
288246
+ const path5 = execSync35(`which ${bin}`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
288094
288247
  if (path5) {
288095
288248
  this.python3Path = path5;
288096
288249
  return path5;
@@ -288156,7 +288309,7 @@ var init_voice = __esm({
288156
288309
  return false;
288157
288310
  }
288158
288311
  try {
288159
- execSync34(`${py} -c "import mlx_audio"`, { stdio: "pipe", timeout: 1e4 });
288312
+ execSync35(`${py} -c "import mlx_audio"`, { stdio: "pipe", timeout: 1e4 });
288160
288313
  this.mlxInstalled = true;
288161
288314
  return true;
288162
288315
  } catch {
@@ -288217,11 +288370,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
288217
288370
  `tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
288218
288371
  ].join("; ");
288219
288372
  try {
288220
- execSync34(`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
288373
+ execSync35(`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
288221
288374
  } catch (err) {
288222
288375
  try {
288223
288376
  const safeText = cleaned.replace(/'/g, "'\\''");
288224
- execSync34(`${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() });
288377
+ execSync35(`${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() });
288225
288378
  } catch (err2) {
288226
288379
  return;
288227
288380
  }
@@ -288285,11 +288438,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
288285
288438
  `tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
288286
288439
  ].join("; ");
288287
288440
  try {
288288
- execSync34(`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
288441
+ execSync35(`${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`, { stdio: "pipe", timeout: 6e4, cwd: tmpdir9() });
288289
288442
  } catch {
288290
288443
  try {
288291
288444
  const safeText = cleaned.replace(/'/g, "'\\''");
288292
- execSync34(`${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() });
288445
+ execSync35(`${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() });
288293
288446
  } catch {
288294
288447
  return null;
288295
288448
  }
@@ -288426,15 +288579,15 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
288426
288579
  renderInfo(" ARM device detected \u2014 installing build prerequisites then deps individually.");
288427
288580
  const isMac = process.platform === "darwin";
288428
288581
  try {
288429
- const { spawnSync } = await import("node:child_process");
288582
+ const { spawnSync: spawnSync2 } = await import("node:child_process");
288430
288583
  if (process.stdout.isTTY) {
288431
288584
  process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l");
288432
288585
  }
288433
288586
  if (isMac) {
288434
288587
  renderInfo(" macOS ARM detected \u2014 installing build deps via Homebrew...");
288435
- const brewCheck = spawnSync("which", ["brew"], { stdio: "pipe", timeout: 5e3 });
288588
+ const brewCheck = spawnSync2("which", ["brew"], { stdio: "pipe", timeout: 5e3 });
288436
288589
  if (brewCheck.status === 0) {
288437
- const brewResult = spawnSync("brew", ["install", "llvm", "gcc", "openblas", "libsndfile"], {
288590
+ const brewResult = spawnSync2("brew", ["install", "llvm", "gcc", "openblas", "libsndfile"], {
288438
288591
  stdio: "pipe",
288439
288592
  timeout: 3e5
288440
288593
  });
@@ -288442,11 +288595,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
288442
288595
  process.stdout.write(brewResult.stdout);
288443
288596
  if (brewResult.stderr)
288444
288597
  process.stderr.write(brewResult.stderr);
288445
- const llvmPrefix = spawnSync("brew", ["--prefix", "llvm"], { stdio: "pipe", timeout: 5e3 });
288598
+ const llvmPrefix = spawnSync2("brew", ["--prefix", "llvm"], { stdio: "pipe", timeout: 5e3 });
288446
288599
  if (llvmPrefix.stdout) {
288447
288600
  const prefix = llvmPrefix.stdout.toString().trim();
288448
288601
  process.env.LLVM_CONFIG = `${prefix}/bin/llvm-config`;
288449
- const openblas = spawnSync("brew", ["--prefix", "openblas"], { stdio: "pipe", timeout: 5e3 });
288602
+ const openblas = spawnSync2("brew", ["--prefix", "openblas"], { stdio: "pipe", timeout: 5e3 });
288450
288603
  if (openblas.stdout) {
288451
288604
  const obPrefix = openblas.stdout.toString().trim();
288452
288605
  process.env.LDFLAGS = `${process.env.LDFLAGS ?? ""} -L${obPrefix}/lib`.trim();
@@ -288459,10 +288612,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
288459
288612
  }
288460
288613
  } else {
288461
288614
  renderInfo(" System build tools needed (llvm, gcc). Requesting sudo access...");
288462
- const sudoCheck = spawnSync("sudo", ["-v"], { stdio: "inherit", timeout: 6e4 });
288615
+ const sudoCheck = spawnSync2("sudo", ["-v"], { stdio: "inherit", timeout: 6e4 });
288463
288616
  if (sudoCheck.status === 0) {
288464
288617
  renderInfo(" Installing system build dependencies (this may take a minute)...");
288465
- const aptResult = spawnSync("sudo", [
288618
+ const aptResult = spawnSync2("sudo", [
288466
288619
  "apt-get",
288467
288620
  "install",
288468
288621
  "-y",
@@ -293738,7 +293891,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
293738
293891
  }
293739
293892
  }
293740
293893
  async function handleParallel(arg, ctx3) {
293741
- const { execSync: execSync40 } = await import("node:child_process");
293894
+ const { execSync: execSync41 } = await import("node:child_process");
293742
293895
  const baseUrl = ctx3.config.backendUrl || "http://localhost:11434";
293743
293896
  const isRemote = ctx3.config.backendType === "nexus";
293744
293897
  if (isRemote) {
@@ -293762,7 +293915,7 @@ async function handleParallel(arg, ctx3) {
293762
293915
  }
293763
293916
  let systemdVal = "";
293764
293917
  try {
293765
- const out = execSync40("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
293918
+ const out = execSync41("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
293766
293919
  const match = out.match(/OLLAMA_NUM_PARALLEL=(\d+)/);
293767
293920
  if (match)
293768
293921
  systemdVal = match[1];
@@ -293791,7 +293944,7 @@ async function handleParallel(arg, ctx3) {
293791
293944
  }
293792
293945
  const isSystemd = (() => {
293793
293946
  try {
293794
- const out = execSync40("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
293947
+ const out = execSync41("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
293795
293948
  return out === "active" || out === "inactive";
293796
293949
  } catch {
293797
293950
  return false;
@@ -293805,10 +293958,10 @@ async function handleParallel(arg, ctx3) {
293805
293958
  const overrideContent = `[Service]
293806
293959
  Environment="OLLAMA_NUM_PARALLEL=${n2}"
293807
293960
  `;
293808
- execSync40(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
293809
- execSync40(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
293810
- execSync40("sudo systemctl daemon-reload", { stdio: "pipe" });
293811
- execSync40("sudo systemctl restart ollama.service", { stdio: "pipe" });
293961
+ execSync41(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
293962
+ execSync41(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
293963
+ execSync41("sudo systemctl daemon-reload", { stdio: "pipe" });
293964
+ execSync41("sudo systemctl restart ollama.service", { stdio: "pipe" });
293812
293965
  let ready = false;
293813
293966
  for (let i2 = 0; i2 < 30 && !ready; i2++) {
293814
293967
  await new Promise((r2) => setTimeout(r2, 500));
@@ -293835,7 +293988,7 @@ Environment="OLLAMA_NUM_PARALLEL=${n2}"
293835
293988
  renderInfo(`Setting OLLAMA_NUM_PARALLEL=${n2}...`);
293836
293989
  try {
293837
293990
  try {
293838
- execSync40("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
293991
+ execSync41("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
293839
293992
  } catch {
293840
293993
  }
293841
293994
  await new Promise((r2) => setTimeout(r2, 1e3));
@@ -293922,13 +294075,16 @@ async function handleUpdate(subcommand, ctx3) {
293922
294075
  function renderInstallFrame(version4, _frame, statusLine) {
293923
294076
  const cols = process.stdout.columns ?? 80;
293924
294077
  const rows = process.stdout.rows ?? 24;
293925
- const yellow = 178;
294078
+ const { tuiAccent: getAccent, tuiBgSeq: getBgSeq, tuiBoxFg: getBoxFg } = (init_theme(), __toCommonJS(theme_exports));
294079
+ const accentColor = getAccent() < 0 ? 252 : getAccent();
294080
+ const boxFg = getBoxFg();
294081
+ const bgSeq = getBgSeq();
293926
294082
  const contentTop = 4;
293927
294083
  const contentBottom = rows - 5;
293928
294084
  const contentHeight = Math.max(5, contentBottom - contentTop + 1);
293929
294085
  let buf = "\x1B[?2026h\x1B7\x1B[?25l";
293930
294086
  for (let r2 = contentTop; r2 <= contentBottom; r2++) {
293931
- buf += `\x1B[${r2};1H\x1B[49m\x1B[2K`;
294087
+ buf += `\x1B[${r2};1H${bgSeq}\x1B[2K`;
293932
294088
  }
293933
294089
  const centerRow = contentTop + Math.floor(contentHeight / 2);
293934
294090
  const centerCol = Math.floor(cols / 2);
@@ -293937,14 +294093,14 @@ async function handleUpdate(subcommand, ctx3) {
293937
294093
  const boxTop = centerRow - Math.floor(boxH / 2);
293938
294094
  const boxLeft = centerCol - Math.floor(boxW / 2);
293939
294095
  const innerW = boxW - 2;
293940
- buf += `\x1B[${boxTop};${boxLeft}H\x1B[38;5;${yellow}m\u256D${"\u2500".repeat(innerW)}\u256E`;
294096
+ buf += `\x1B[${boxTop};${boxLeft}H${boxFg}\u256D${"\u2500".repeat(innerW)}\u256E`;
293941
294097
  for (let r2 = 1; r2 < boxH - 1; r2++) {
293942
- buf += `\x1B[${boxTop + r2};${boxLeft}H\x1B[38;5;${yellow}m\u2502${" ".repeat(innerW)}\u2502`;
294098
+ buf += `\x1B[${boxTop + r2};${boxLeft}H${boxFg}\u2502${bgSeq}${" ".repeat(innerW)}${boxFg}\u2502`;
293943
294099
  }
293944
- buf += `\x1B[${boxTop + boxH - 1};${boxLeft}H\x1B[38;5;${yellow}m\u2570${"\u2500".repeat(innerW)}\u256F`;
294100
+ buf += `\x1B[${boxTop + boxH - 1};${boxLeft}H${boxFg}\u2570${"\u2500".repeat(innerW)}\u256F`;
293945
294101
  const isDone = statusLine === "__DONE__";
293946
294102
  const label = isDone ? "INSTALLED" : "INSTALLING";
293947
- const labelColor = isDone ? 82 : yellow;
294103
+ const labelColor = isDone ? 82 : accentColor;
293948
294104
  const labelCol = centerCol - Math.floor(label.length / 2);
293949
294105
  buf += `\x1B[${boxTop + 1};${labelCol}H\x1B[1;38;5;${labelColor}m${label}\x1B[0m`;
293950
294106
  const progress = isDone ? 1 : Math.min(0.95, _installProgress / Math.max(1, _installTotal));
@@ -293963,7 +294119,7 @@ async function handleUpdate(subcommand, ctx3) {
293963
294119
  }
293964
294120
  }
293965
294121
  const barCol = boxLeft + 3;
293966
- buf += `\x1B[${boxTop + 2};${barCol}H\x1B[38;5;${yellow}m${bar}\x1B[0m`;
294122
+ buf += `\x1B[${boxTop + 2};${barCol}H\x1B[38;5;${accentColor}m${bar}\x1B[0m`;
293967
294123
  const statusText = isDone ? `v${version4}` : statusLine || `v${version4}`;
293968
294124
  const statusTrunc = statusText.slice(0, innerW - 2);
293969
294125
  const sCol = centerCol - Math.floor(statusTrunc.length / 2);
@@ -293995,13 +294151,13 @@ async function handleUpdate(subcommand, ctx3) {
293995
294151
  /** Clear the overlay content area entirely — return to normal scroll area */
293996
294152
  dismiss() {
293997
294153
  clearInterval(timer);
293998
- const cols = process.stdout.columns ?? 80;
293999
294154
  const rows = process.stdout.rows ?? 24;
294000
294155
  const contentTop = 4;
294001
294156
  const contentBottom = rows - 5;
294157
+ const { tuiBgSeq: getDismissBg } = (init_theme(), __toCommonJS(theme_exports));
294002
294158
  let buf = "\x1B7";
294003
294159
  for (let r2 = contentTop; r2 <= contentBottom; r2++) {
294004
- buf += `\x1B[${r2};1H\x1B[49m\x1B[2K`;
294160
+ buf += `\x1B[${r2};1H${getDismissBg()}\x1B[2K`;
294005
294161
  }
294006
294162
  buf += "\x1B8";
294007
294163
  process.stdout.write(buf);
@@ -294224,8 +294380,8 @@ async function handleUpdate(subcommand, ctx3) {
294224
294380
  renderInfo("Enter your password if prompted...");
294225
294381
  safeWrite("\n");
294226
294382
  try {
294227
- const { spawnSync } = await import("node:child_process");
294228
- const sudoResult = spawnSync("sudo", ["-v"], { stdio: "inherit", timeout: 6e4 });
294383
+ const { spawnSync: spawnSync2 } = await import("node:child_process");
294384
+ const sudoResult = spawnSync2("sudo", ["-v"], { stdio: "inherit", timeout: 6e4 });
294229
294385
  if (sudoResult.status !== 0)
294230
294386
  throw new Error("sudo failed");
294231
294387
  } catch {
@@ -294854,18 +295010,18 @@ async function showExposeDashboard(gateway, rl, ctx3) {
294854
295010
  const cmd = `/endpoint ${id} --auth ${gateway.authKey ?? ""}`;
294855
295011
  let copied = false;
294856
295012
  try {
294857
- const { execSync: execSync40 } = __require("node:child_process");
295013
+ const { execSync: execSync41 } = __require("node:child_process");
294858
295014
  const platform6 = process.platform;
294859
295015
  if (platform6 === "darwin") {
294860
- execSync40("pbcopy", { input: cmd, timeout: 3e3 });
295016
+ execSync41("pbcopy", { input: cmd, timeout: 3e3 });
294861
295017
  copied = true;
294862
295018
  } else if (platform6 === "win32") {
294863
- execSync40("clip", { input: cmd, timeout: 3e3 });
295019
+ execSync41("clip", { input: cmd, timeout: 3e3 });
294864
295020
  copied = true;
294865
295021
  } else {
294866
295022
  for (const tool of ["xclip -selection clipboard", "xsel --clipboard --input", "wl-copy"]) {
294867
295023
  try {
294868
- execSync40(tool, { input: cmd, timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] });
295024
+ execSync41(tool, { input: cmd, timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] });
294869
295025
  copied = true;
294870
295026
  break;
294871
295027
  } catch {
@@ -294959,7 +295115,7 @@ var init_commands = __esm({
294959
295115
  // packages/cli/dist/tui/project-context.js
294960
295116
  import { existsSync as existsSync50, readFileSync as readFileSync39, readdirSync as readdirSync15 } from "node:fs";
294961
295117
  import { join as join66, basename as basename13 } from "node:path";
294962
- import { execSync as execSync35 } from "node:child_process";
295118
+ import { execSync as execSync36 } from "node:child_process";
294963
295119
  import { homedir as homedir21, platform as platform5, release } from "node:os";
294964
295120
  function getModelTier(modelName) {
294965
295121
  const m2 = modelName.toLowerCase();
@@ -295005,19 +295161,19 @@ function loadProjectMap(repoRoot) {
295005
295161
  }
295006
295162
  function getGitInfo(repoRoot) {
295007
295163
  try {
295008
- execSync35("git rev-parse --is-inside-work-tree", { cwd: repoRoot, stdio: "pipe" });
295164
+ execSync36("git rev-parse --is-inside-work-tree", { cwd: repoRoot, stdio: "pipe" });
295009
295165
  } catch {
295010
295166
  return "";
295011
295167
  }
295012
295168
  const lines = [];
295013
295169
  try {
295014
- const branch = execSync35("git branch --show-current", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
295170
+ const branch = execSync36("git branch --show-current", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
295015
295171
  if (branch)
295016
295172
  lines.push(`Branch: ${branch}`);
295017
295173
  } catch {
295018
295174
  }
295019
295175
  try {
295020
- const status = execSync35("git status --porcelain", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
295176
+ const status = execSync36("git status --porcelain", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
295021
295177
  if (status) {
295022
295178
  const changed = status.split("\n").length;
295023
295179
  lines.push(`Working tree: ${changed} changed file(s)`);
@@ -295027,7 +295183,7 @@ function getGitInfo(repoRoot) {
295027
295183
  } catch {
295028
295184
  }
295029
295185
  try {
295030
- const log22 = execSync35("git log --oneline -5 --no-decorate", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
295186
+ const log22 = execSync36("git log --oneline -5 --no-decorate", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
295031
295187
  if (log22)
295032
295188
  lines.push(`Recent commits:
295033
295189
  ${log22}`);
@@ -297705,7 +297861,7 @@ var init_promptLoader3 = __esm({
297705
297861
  // packages/cli/dist/tui/dream-engine.js
297706
297862
  import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync26, readFileSync as readFileSync43, existsSync as existsSync54, cpSync, rmSync as rmSync3, readdirSync as readdirSync17 } from "node:fs";
297707
297863
  import { join as join71, basename as basename15 } from "node:path";
297708
- import { execSync as execSync36 } from "node:child_process";
297864
+ import { execSync as execSync37 } from "node:child_process";
297709
297865
  function setDreamWriteContent(fn) {
297710
297866
  _dreamWriteContent = fn;
297711
297867
  }
@@ -298088,7 +298244,7 @@ var init_dream_engine = __esm({
298088
298244
  }
298089
298245
  }
298090
298246
  try {
298091
- const output = execSync36(cmd, {
298247
+ const output = execSync37(cmd, {
298092
298248
  cwd: this.repoRoot,
298093
298249
  timeout: 3e4,
298094
298250
  encoding: "utf-8",
@@ -298868,17 +299024,17 @@ ${summaryResult}
298868
299024
  try {
298869
299025
  mkdirSync26(checkpointDir, { recursive: true });
298870
299026
  try {
298871
- const gitStatus = execSync36("git status --porcelain", {
299027
+ const gitStatus = execSync37("git status --porcelain", {
298872
299028
  cwd: this.repoRoot,
298873
299029
  encoding: "utf-8",
298874
299030
  timeout: 1e4
298875
299031
  });
298876
- const gitDiff = execSync36("git diff", {
299032
+ const gitDiff = execSync37("git diff", {
298877
299033
  cwd: this.repoRoot,
298878
299034
  encoding: "utf-8",
298879
299035
  timeout: 1e4
298880
299036
  });
298881
- const gitHash = execSync36("git rev-parse HEAD 2>/dev/null || echo 'no-git'", {
299037
+ const gitHash = execSync37("git rev-parse HEAD 2>/dev/null || echo 'no-git'", {
298882
299038
  cwd: this.repoRoot,
298883
299039
  encoding: "utf-8",
298884
299040
  timeout: 5e3
@@ -304486,7 +304642,7 @@ var init_profiles = __esm({
304486
304642
  });
304487
304643
 
304488
304644
  // packages/cli/dist/docker.js
304489
- import { execSync as execSync37, spawn as spawn23 } from "node:child_process";
304645
+ import { execSync as execSync38, spawn as spawn23 } from "node:child_process";
304490
304646
  import { existsSync as existsSync62, mkdirSync as mkdirSync32, writeFileSync as writeFileSync30 } from "node:fs";
304491
304647
  import { join as join79, resolve as resolve33, dirname as dirname23 } from "node:path";
304492
304648
  import { homedir as homedir23 } from "node:os";
@@ -304507,7 +304663,7 @@ function getDockerDir() {
304507
304663
  }
304508
304664
  function isDockerAvailable() {
304509
304665
  try {
304510
- execSync37("docker info", { stdio: "pipe", timeout: 1e4 });
304666
+ execSync38("docker info", { stdio: "pipe", timeout: 1e4 });
304511
304667
  return true;
304512
304668
  } catch {
304513
304669
  return false;
@@ -304515,7 +304671,7 @@ function isDockerAvailable() {
304515
304671
  }
304516
304672
  function isDockerInstalled() {
304517
304673
  try {
304518
- execSync37("docker --version", { stdio: "pipe", timeout: 5e3 });
304674
+ execSync38("docker --version", { stdio: "pipe", timeout: 5e3 });
304519
304675
  return true;
304520
304676
  } catch {
304521
304677
  return false;
@@ -304540,31 +304696,31 @@ async function ensureDocker() {
304540
304696
  }
304541
304697
  try {
304542
304698
  console.log("[oa-docker] Docker not found. Installing via get.docker.com...");
304543
- execSync37("curl -fsSL https://get.docker.com | sh", {
304699
+ execSync38("curl -fsSL https://get.docker.com | sh", {
304544
304700
  stdio: "inherit",
304545
304701
  timeout: 3e5
304546
304702
  });
304547
304703
  const user = process.env["USER"] || process.env["LOGNAME"];
304548
304704
  if (user) {
304549
304705
  try {
304550
- execSync37(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
304706
+ execSync38(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
304551
304707
  } catch {
304552
304708
  }
304553
304709
  }
304554
304710
  try {
304555
- execSync37("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
304711
+ execSync38("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
304556
304712
  } catch {
304557
304713
  }
304558
304714
  try {
304559
- execSync37("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
304560
- const runtimes = execSync37("docker info --format '{{json .Runtimes}}'", {
304715
+ execSync38("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
304716
+ const runtimes = execSync38("docker info --format '{{json .Runtimes}}'", {
304561
304717
  stdio: "pipe",
304562
304718
  timeout: 5e3
304563
304719
  }).toString();
304564
304720
  if (!runtimes.includes("nvidia")) {
304565
304721
  console.log("[oa-docker] NVIDIA GPU detected. Installing nvidia-container-toolkit...");
304566
304722
  try {
304567
- execSync37(`
304723
+ execSync38(`
304568
304724
  curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
304569
304725
  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
304570
304726
  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 )
@@ -304594,7 +304750,7 @@ async function ensureDocker() {
304594
304750
  }
304595
304751
  async function ensureNvidiaToolkit() {
304596
304752
  try {
304597
- execSync37("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
304753
+ execSync38("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
304598
304754
  } catch {
304599
304755
  return { ok: false, message: "No NVIDIA GPU detected (nvidia-smi not found)" };
304600
304756
  }
@@ -304605,7 +304761,7 @@ async function ensureNvidiaToolkit() {
304605
304761
  return { ok: false, message: "Auto-install only supported on Linux. Install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html" };
304606
304762
  }
304607
304763
  try {
304608
- execSync37(`
304764
+ execSync38(`
304609
304765
  curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
304610
304766
  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
304611
304767
  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 )
@@ -304619,7 +304775,7 @@ async function ensureNvidiaToolkit() {
304619
304775
  }
304620
304776
  function isOaImageBuilt() {
304621
304777
  try {
304622
- const out = execSync37(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
304778
+ const out = execSync38(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
304623
304779
  stdio: "pipe",
304624
304780
  timeout: 5e3
304625
304781
  }).toString().trim();
@@ -304643,7 +304799,7 @@ async function ensureOaImage(force = false) {
304643
304799
  }
304644
304800
  try {
304645
304801
  console.log(`[oa-docker] Building image ${OA_IMAGE}:${OA_IMAGE_TAG}...`);
304646
- execSync37(`docker build -t ${OA_IMAGE}:${OA_IMAGE_TAG} ${buildContext}`, {
304802
+ execSync38(`docker build -t ${OA_IMAGE}:${OA_IMAGE_TAG} ${buildContext}`, {
304647
304803
  stdio: "inherit",
304648
304804
  timeout: 6e5
304649
304805
  // 10 min
@@ -304717,11 +304873,11 @@ exec "$@"
304717
304873
  }
304718
304874
  function hasNvidiaGpu() {
304719
304875
  try {
304720
- execSync37("nvidia-smi --query-gpu=name --format=csv,noheader", {
304876
+ execSync38("nvidia-smi --query-gpu=name --format=csv,noheader", {
304721
304877
  stdio: "pipe",
304722
304878
  timeout: 5e3
304723
304879
  });
304724
- const runtimes = execSync37("docker info --format '{{json .Runtimes}}'", {
304880
+ const runtimes = execSync38("docker info --format '{{json .Runtimes}}'", {
304725
304881
  stdio: "pipe",
304726
304882
  timeout: 5e3
304727
304883
  }).toString();
@@ -304794,7 +304950,7 @@ import * as https3 from "node:https";
304794
304950
  import { createRequire as createRequire4 } from "node:module";
304795
304951
  import { fileURLToPath as fileURLToPath16 } from "node:url";
304796
304952
  import { dirname as dirname24, join as join80, resolve as resolve34 } from "node:path";
304797
- import { spawn as spawn24, execSync as execSync38 } from "node:child_process";
304953
+ import { spawn as spawn24, execSync as execSync39 } from "node:child_process";
304798
304954
  import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync31, readFileSync as readFileSync50, readdirSync as readdirSync23, existsSync as existsSync63 } from "node:fs";
304799
304955
  import { randomBytes as randomBytes19, randomUUID as randomUUID5 } from "node:crypto";
304800
304956
  function getVersion3() {
@@ -305822,7 +305978,7 @@ function handleV1RunsDelete(res, id) {
305822
305978
  const containerName = `oa-${id}`;
305823
305979
  if (job.sandbox === "container") {
305824
305980
  try {
305825
- execSync38(`docker stop ${containerName}`, { timeout: 5e3, stdio: "ignore" });
305981
+ execSync39(`docker stop ${containerName}`, { timeout: 5e3, stdio: "ignore" });
305826
305982
  } catch {
305827
305983
  }
305828
305984
  }
@@ -306762,7 +306918,7 @@ import { createRequire as createRequire5 } from "node:module";
306762
306918
  import { fileURLToPath as fileURLToPath17 } from "node:url";
306763
306919
  import { readFileSync as readFileSync51, writeFileSync as writeFileSync32, appendFileSync as appendFileSync6, rmSync as rmSync4, readdirSync as readdirSync24, mkdirSync as mkdirSync34 } from "node:fs";
306764
306920
  import { existsSync as existsSync64 } from "node:fs";
306765
- import { execSync as execSync39 } from "node:child_process";
306921
+ import { execSync as execSync40 } from "node:child_process";
306766
306922
  import { homedir as homedir24 } from "node:os";
306767
306923
  function formatTimeAgo(date) {
306768
306924
  const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
@@ -310986,7 +311142,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
310986
311142
  try {
310987
311143
  if (process.platform === "win32") {
310988
311144
  try {
310989
- execSync39(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
311145
+ execSync40(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
310990
311146
  } catch {
310991
311147
  }
310992
311148
  } else {
@@ -311013,7 +311169,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
311013
311169
  if (pid > 0) {
311014
311170
  if (process.platform === "win32") {
311015
311171
  try {
311016
- execSync39(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
311172
+ execSync40(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
311017
311173
  } catch {
311018
311174
  }
311019
311175
  } else {
@@ -311030,7 +311186,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
311030
311186
  } catch {
311031
311187
  }
311032
311188
  try {
311033
- execSync39(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
311189
+ execSync40(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
311034
311190
  } catch {
311035
311191
  }
311036
311192
  const oaPath = join81(repoRoot, OA_DIR);
@@ -311044,14 +311200,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
311044
311200
  } catch (err) {
311045
311201
  if (attempt < 2) {
311046
311202
  try {
311047
- execSync39(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
311203
+ execSync40(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
311048
311204
  } catch {
311049
311205
  }
311050
311206
  } else {
311051
311207
  writeContent(() => renderWarning(`Could not fully remove ${OA_DIR}/: ${err instanceof Error ? err.message : String(err)}`));
311052
311208
  if (process.platform === "win32") {
311053
311209
  try {
311054
- execSync39(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
311210
+ execSync40(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
311055
311211
  deleted = true;
311056
311212
  } catch {
311057
311213
  }