open-agents-ai 0.187.198 → 0.187.199

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 +61 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -319445,28 +319445,78 @@ async function handleV1Update(req2, res, requestId) {
319445
319445
  from: currentVersion,
319446
319446
  to: targetVersion
319447
319447
  }, { subject: req2._authUser ?? "anonymous" });
319448
- const pkgSpec = `open-agents-ai@${targetVersion}`;
319449
- const installCmd = `npm install -g ${pkgSpec} --no-audit --no-fund --no-progress > "${logPath2}" 2>&1; echo "__EXIT_CODE=$?" >> "${logPath2}"`;
319450
319448
  const fs4 = __require("node:fs");
319449
+ const nodeBin = process.execPath;
319450
+ const nodeDir = dirname26(nodeBin);
319451
+ const isWin2 = process.platform === "win32";
319452
+ let npmBin = "";
319453
+ for (const candidate of isWin2 ? [join95(nodeDir, "npm.cmd"), join95(nodeDir, "npm")] : [join95(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm"]) {
319454
+ if (existsSync78(candidate)) {
319455
+ npmBin = candidate;
319456
+ break;
319457
+ }
319458
+ }
319459
+ if (!npmBin) npmBin = isWin2 ? "npm.cmd" : "npm";
319460
+ const pkgSpec = `open-agents-ai@${targetVersion}`;
319451
319461
  const dir = join95(homedir32(), ".open-agents");
319452
319462
  fs4.mkdirSync(dir, { recursive: true });
319453
- const isWin2 = process.platform === "win32";
319463
+ const logFd = fs4.openSync(logPath2, "w");
319464
+ const npmPrefix = dirname26(nodeDir);
319465
+ const cleanEnv = {};
319466
+ for (const [k, v] of Object.entries(process.env)) {
319467
+ if (k === "OA_DAEMON" || k === "OA_PORT") continue;
319468
+ if (typeof v === "string") cleanEnv[k] = v;
319469
+ }
319470
+ cleanEnv.PATH = `${nodeDir}:${cleanEnv.PATH || ""}`;
319454
319471
  let child;
319455
319472
  if (isWin2) {
319456
- child = spawn25("cmd.exe", ["/c", installCmd], {
319473
+ child = spawn25(npmBin, ["install", "-g", pkgSpec, "--no-audit", "--no-fund", "--no-progress"], {
319457
319474
  detached: true,
319458
- stdio: "ignore",
319475
+ stdio: ["ignore", logFd, logFd],
319459
319476
  windowsHide: true,
319460
- env: { ...process.env, npm_config_yes: "true" }
319477
+ env: cleanEnv
319461
319478
  });
319462
319479
  } else {
319463
- child = spawn25("bash", ["-lc", `nohup bash -c 'setsid bash -c ${JSON.stringify(installCmd)} &' >/dev/null 2>&1; exit 0`], {
319464
- detached: true,
319465
- stdio: "ignore",
319466
- env: { ...process.env }
319467
- });
319480
+ const npmCliCandidates = [
319481
+ join95(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
319482
+ join95(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
319483
+ ];
319484
+ let npmCli = "";
319485
+ for (const c7 of npmCliCandidates) {
319486
+ try {
319487
+ if (existsSync78(c7)) {
319488
+ npmCli = c7;
319489
+ break;
319490
+ }
319491
+ } catch {
319492
+ }
319493
+ }
319494
+ if (npmCli) {
319495
+ child = spawn25(nodeBin, [npmCli, "install", "-g", pkgSpec, "--no-audit", "--no-fund", "--no-progress"], {
319496
+ detached: true,
319497
+ stdio: ["ignore", logFd, logFd],
319498
+ env: cleanEnv
319499
+ });
319500
+ } else {
319501
+ child = spawn25(npmBin, ["install", "-g", pkgSpec, "--no-audit", "--no-fund", "--no-progress"], {
319502
+ detached: true,
319503
+ stdio: ["ignore", logFd, logFd],
319504
+ env: cleanEnv
319505
+ });
319506
+ }
319468
319507
  }
319469
319508
  child.unref();
319509
+ const installPid = child.pid ?? 0;
319510
+ if (installPid > 0 && !isWin2) {
319511
+ try {
319512
+ const follower = spawn25("bash", ["-c", `while kill -0 ${installPid} 2>/dev/null; do sleep 1; done; echo "__EXIT_CODE=0" >> "${logPath2}"`], {
319513
+ detached: true,
319514
+ stdio: "ignore"
319515
+ });
319516
+ follower.unref();
319517
+ } catch {
319518
+ }
319519
+ }
319470
319520
  const initialPid = child.pid ?? 0;
319471
319521
  writeUpdateState({
319472
319522
  status: "running",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.198",
3
+ "version": "0.187.199",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",