open-agents-ai 0.93.0 → 0.93.1

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 +50 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -320,23 +320,39 @@ async function checkForUpdate(currentVersion, forceCheck = false) {
320
320
  latestVersion: latest
321
321
  };
322
322
  }
323
+ function cleanStaleNpmTempDirs(sudo) {
324
+ try {
325
+ const prefix = execSync("npm prefix -g", { encoding: "utf-8", stdio: "pipe", timeout: 5e3 }).trim();
326
+ const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
327
+ const sudoCmd = sudo ? "sudo " : "";
328
+ execSync(`${sudoCmd}find "${globalModules}" -maxdepth 1 -name ".${PACKAGE_NAME}-*" -type d -exec rm -rf {} + 2>/dev/null || true`, { stdio: "pipe", timeout: 15e3 });
329
+ execSync(`${sudoCmd}rm -rf "${globalModules}/${PACKAGE_NAME}" 2>/dev/null || true`, { stdio: "pipe", timeout: 15e3 });
330
+ } catch {
331
+ }
332
+ }
323
333
  function performSilentUpdate() {
324
334
  const installCmd = `npm install -g ${PACKAGE_NAME}@latest --prefer-online`;
325
- try {
326
- execSync(installCmd, { stdio: "pipe", timeout: 12e4 });
327
- return true;
328
- } catch (err) {
329
- const msg = err instanceof Error ? err.message : String(err);
330
- if (/EACCES|permission denied/i.test(msg)) {
331
- try {
332
- execSync(`sudo -n ${installCmd}`, { stdio: "pipe", timeout: 12e4 });
333
- return true;
334
- } catch {
335
- return false;
335
+ const trySilent = (cmd, sudo) => {
336
+ try {
337
+ execSync(cmd, { stdio: "pipe", timeout: 12e4 });
338
+ return true;
339
+ } catch (err) {
340
+ const msg = err instanceof Error ? err.message : String(err);
341
+ if (/ENOTEMPTY|errno -39/i.test(msg)) {
342
+ cleanStaleNpmTempDirs(sudo);
343
+ try {
344
+ execSync(cmd, { stdio: "pipe", timeout: 12e4 });
345
+ return true;
346
+ } catch {
347
+ return false;
348
+ }
336
349
  }
350
+ return false;
337
351
  }
338
- return false;
339
- }
352
+ };
353
+ if (trySilent(installCmd, false))
354
+ return true;
355
+ return trySilent(`sudo -n ${installCmd}`, true);
340
356
  }
341
357
  function formatUpdateBanner(info) {
342
358
  return `
@@ -30370,14 +30386,33 @@ async function handleUpdate(subcommand, ctx) {
30370
30386
  const installCmd = `${sudoPrefix}npm install -g open-agents-ai@latest --prefer-online`;
30371
30387
  let installOk = false;
30372
30388
  let installError = "";
30373
- installOk = await new Promise((resolve31) => {
30374
- const child = exec(installCmd, { timeout: 18e4 }, (err, _stdout, stderr) => {
30389
+ const runInstall2 = (cmd) => new Promise((resolve31) => {
30390
+ const child = exec(cmd, { timeout: 18e4 }, (err, _stdout, stderr) => {
30375
30391
  if (err)
30376
30392
  installError = (stderr || err.message || "").trim();
30377
30393
  resolve31(!err);
30378
30394
  });
30379
30395
  child.stdout?.resume();
30380
30396
  });
30397
+ installOk = await runInstall2(installCmd);
30398
+ if (!installOk && /ENOTEMPTY|errno -39/i.test(installError)) {
30399
+ installSpinner.stop("Cleaning stale npm temp files...");
30400
+ try {
30401
+ const prefix = es2("npm prefix -g", { encoding: "utf8", timeout: 5e3 }).trim();
30402
+ const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
30403
+ es2(`${sudoPrefix}find "${globalModules}" -maxdepth 1 -name ".open-agents-ai-*" -type d -exec rm -rf {} + 2>/dev/null || true`, { timeout: 15e3 });
30404
+ es2(`${sudoPrefix}rm -rf "${globalModules}/open-agents-ai" 2>/dev/null || true`, { timeout: 15e3 });
30405
+ } catch {
30406
+ }
30407
+ const retrySpinner = startInlineSpinner("Retrying install");
30408
+ installError = "";
30409
+ installOk = await runInstall2(installCmd);
30410
+ if (!installOk) {
30411
+ retrySpinner.stop("Retry failed.");
30412
+ } else {
30413
+ retrySpinner.stop(`Update installed (v${info.latestVersion}).`);
30414
+ }
30415
+ }
30381
30416
  if (!installOk) {
30382
30417
  installSpinner.stop("Update install failed.");
30383
30418
  const errPreview = installError.split("\n").filter((l) => l.trim()).slice(-3).join("\n ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.93.0",
3
+ "version": "0.93.1",
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",