open-agents-ai 0.105.4 → 0.105.6

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 +34 -64
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14438,6 +14438,15 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
14438
14438
  const nodeModulesDir = resolve26(this.repoRoot, "node_modules");
14439
14439
  let nexusResolved = false;
14440
14440
  let installedVersion = "";
14441
+ const execAsync2 = (cmd, opts = {}) => new Promise((res, rej) => {
14442
+ const { exec: ex } = __require("node:child_process");
14443
+ ex(cmd, { encoding: "utf8", timeout: opts.timeout ?? 3e4, cwd: opts.cwd, maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => {
14444
+ if (err)
14445
+ rej(err);
14446
+ else
14447
+ res((stdout || "").trim());
14448
+ });
14449
+ });
14441
14450
  try {
14442
14451
  const nexusPkg = join30(nodeModulesDir, "open-agents-nexus", "package.json");
14443
14452
  if (existsSync23(nexusPkg)) {
@@ -14448,30 +14457,29 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
14448
14457
  } catch {
14449
14458
  }
14450
14459
  } else {
14451
- const globalDir = execSync22("npm root -g", { encoding: "utf8", timeout: 5e3 }).trim();
14452
- const globalPkg = join30(globalDir, "open-agents-nexus", "package.json");
14453
- if (existsSync23(globalPkg)) {
14454
- nexusResolved = true;
14455
- try {
14456
- const pkg = JSON.parse(readFileSync16(globalPkg, "utf8"));
14457
- installedVersion = pkg.version || "";
14458
- } catch {
14460
+ try {
14461
+ const globalDir = await execAsync2("npm root -g", { timeout: 5e3 });
14462
+ const globalPkg = join30(globalDir, "open-agents-nexus", "package.json");
14463
+ if (existsSync23(globalPkg)) {
14464
+ nexusResolved = true;
14465
+ try {
14466
+ const pkg = JSON.parse(readFileSync16(globalPkg, "utf8"));
14467
+ installedVersion = pkg.version || "";
14468
+ } catch {
14469
+ }
14459
14470
  }
14471
+ } catch {
14460
14472
  }
14461
14473
  }
14462
14474
  } catch {
14463
14475
  }
14464
14476
  if (nexusResolved && installedVersion) {
14465
14477
  try {
14466
- const latestRaw = execSync22("npm view open-agents-nexus version 2>/dev/null", {
14467
- encoding: "utf8",
14468
- timeout: 8e3
14469
- }).trim();
14478
+ const latestRaw = await execAsync2("npm view open-agents-nexus version 2>/dev/null", { timeout: 8e3 });
14470
14479
  if (latestRaw && latestRaw !== installedVersion) {
14471
14480
  try {
14472
- execSync22(`npm install open-agents-nexus@${latestRaw} --save 2>&1`, {
14481
+ await execAsync2(`npm install open-agents-nexus@${latestRaw} --save 2>&1`, {
14473
14482
  cwd: this.repoRoot,
14474
- stdio: "pipe",
14475
14483
  timeout: 6e4
14476
14484
  });
14477
14485
  installedVersion = latestRaw;
@@ -14483,14 +14491,13 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
14483
14491
  }
14484
14492
  if (!nexusResolved) {
14485
14493
  try {
14486
- execSync22("npm install open-agents-nexus@latest 2>&1", {
14494
+ await execAsync2("npm install open-agents-nexus@latest 2>&1", {
14487
14495
  cwd: this.repoRoot,
14488
- stdio: "pipe",
14489
14496
  timeout: 12e4
14490
14497
  });
14491
14498
  } catch {
14492
14499
  try {
14493
- execSync22("npm install -g open-agents-nexus@latest 2>&1", { stdio: "pipe", timeout: 12e4 });
14500
+ await execAsync2("npm install -g open-agents-nexus@latest 2>&1", { timeout: 12e4 });
14494
14501
  } catch {
14495
14502
  throw new Error("Failed to install open-agents-nexus. Run: npm install open-agents-nexus");
14496
14503
  }
@@ -14503,7 +14510,7 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
14503
14510
  const agentType = args.agent_type || "general";
14504
14511
  const nodePaths = [nodeModulesDir];
14505
14512
  try {
14506
- const globalDir = execSync22("npm root -g", { encoding: "utf8", timeout: 5e3 }).trim();
14513
+ const globalDir = await execAsync2("npm root -g", { timeout: 5e3 });
14507
14514
  nodePaths.push(globalDir);
14508
14515
  } catch {
14509
14516
  }
@@ -40257,9 +40264,10 @@ async function handleUpdate(subcommand, ctx) {
40257
40264
  }
40258
40265
  const info = await checkForUpdate(currentVersion, true);
40259
40266
  const { exec: exec4, execSync: es2 } = await import("node:child_process");
40267
+ const execA = (cmd, opts) => new Promise((res, rej) => exec4(cmd, { encoding: "utf8", timeout: opts?.timeout ?? 3e4, cwd: opts?.cwd }, (err, stdout) => err ? rej(err) : res((stdout || "").trim())));
40260
40268
  let needsSudo = false;
40261
40269
  try {
40262
- const prefix = es2("npm prefix -g", { encoding: "utf8", timeout: 5e3 }).trim();
40270
+ const prefix = await execA("npm prefix -g", { timeout: 5e3 });
40263
40271
  const { accessSync, constants } = await import("node:fs");
40264
40272
  try {
40265
40273
  accessSync(prefix, constants.W_OK);
@@ -40363,10 +40371,10 @@ async function handleUpdate(subcommand, ctx) {
40363
40371
  if (!installOk && /ENOTEMPTY|errno -39/i.test(installError)) {
40364
40372
  installSpinner.stop("Cleaning stale npm temp files...");
40365
40373
  try {
40366
- const prefix = es2("npm prefix -g", { encoding: "utf8", timeout: 5e3 }).trim();
40374
+ const prefix = await execA("npm prefix -g", { timeout: 5e3 });
40367
40375
  const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
40368
- es2(`${sudoPrefix}find "${globalModules}" -maxdepth 1 -name ".open-agents-ai-*" -type d -exec rm -rf {} + 2>/dev/null || true`, { timeout: 15e3 });
40369
- es2(`${sudoPrefix}rm -rf "${globalModules}/open-agents-ai" 2>/dev/null || true`, { timeout: 15e3 });
40376
+ await execA(`${sudoPrefix}find "${globalModules}" -maxdepth 1 -name ".open-agents-ai-*" -type d -exec rm -rf {} + 2>/dev/null || true`, { timeout: 15e3 });
40377
+ await execA(`${sudoPrefix}rm -rf "${globalModules}/open-agents-ai" 2>/dev/null || true`, { timeout: 15e3 });
40370
40378
  } catch {
40371
40379
  }
40372
40380
  const retrySpinner = startInlineSpinner("Retrying install");
@@ -40390,7 +40398,7 @@ async function handleUpdate(subcommand, ctx) {
40390
40398
  if (doDeps) {
40391
40399
  const depsSpinner = startInlineSpinner("Updating subordinate dependencies");
40392
40400
  try {
40393
- const prefix = es2("npm prefix -g", { encoding: "utf8", timeout: 5e3 }).trim();
40401
+ const prefix = await execA("npm prefix -g", { timeout: 5e3 });
40394
40402
  const globalModules = prefix.endsWith("/lib") ? prefix + "/node_modules" : prefix + "/lib/node_modules";
40395
40403
  const { existsSync: fe, readFileSync: rf } = await import("node:fs");
40396
40404
  const { join: pj } = await import("node:path");
@@ -48477,10 +48485,10 @@ var init_status_bar = __esm({
48477
48485
  const metricsPath = nexusDir + "/remote-metrics.json";
48478
48486
  const raw = readFileSync31(metricsPath, "utf8");
48479
48487
  const cached = JSON.parse(raw);
48480
- if (cached && cached.ts && Date.now() - cached.ts < 3e4) {
48488
+ if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
48481
48489
  const m = cached.data;
48482
48490
  if (m?.cpu) {
48483
- lastPeerMetricsDebug = `ok(piggyback): cpu=${m.cpu?.utilization}%`;
48491
+ lastPeerMetricsDebug = `ok: cpu=${m.cpu?.utilization}%`;
48484
48492
  this.setRemoteMetrics({
48485
48493
  cpuUtil: m.cpu?.utilization ?? 0,
48486
48494
  cpuCores: m.cpu?.cores ?? 0,
@@ -48500,48 +48508,10 @@ var init_status_bar = __esm({
48500
48508
  } catch {
48501
48509
  }
48502
48510
  }
48503
- try {
48504
- const queryData = { type: "query" };
48505
- if (authKey)
48506
- queryData.auth_key = authKey;
48507
- const raw = await sendCommand("invoke_capability", {
48508
- target_peer: peerId,
48509
- capability: "system_metrics",
48510
- input: queryData
48511
- }, 15e3);
48512
- if (typeof raw === "string" && raw.startsWith("Invoke error:")) {
48513
- lastPeerMetricsDebug = `invoke error: ${raw.slice(0, 200)}`;
48514
- throw new Error(raw);
48515
- }
48516
- const metricsData = extractMetrics(raw);
48517
- if (metricsData?.cpu) {
48518
- lastPeerMetricsDebug = `ok: cpu=${metricsData.cpu.utilization}%`;
48519
- this.setRemoteMetrics({
48520
- cpuUtil: metricsData.cpu?.utilization ?? 0,
48521
- cpuCores: metricsData.cpu?.cores ?? 0,
48522
- cpuModel: metricsData.cpu?.model ?? "",
48523
- gpuUtil: metricsData.gpu?.available ? metricsData.gpu.utilization ?? 0 : -1,
48524
- gpuName: metricsData.gpu?.name ?? "",
48525
- vramUtil: metricsData.gpu?.available ? metricsData.gpu.vramUtilization ?? 0 : -1,
48526
- vramUsedMB: metricsData.gpu?.vramUsedMB ?? 0,
48527
- vramTotalMB: metricsData.gpu?.vramTotalMB ?? 0,
48528
- memUtil: metricsData.memory?.utilization ?? 0,
48529
- memTotalGB: metricsData.memory?.totalGB ?? 0,
48530
- memUsedGB: metricsData.memory?.usedGB ?? 0
48531
- });
48532
- return;
48533
- }
48534
- lastPeerMetricsDebug = `parse fail: ${typeof raw === "string" ? raw.slice(0, 300) : "non-string"}`;
48535
- } catch (e) {
48536
- if (!lastPeerMetricsDebug.startsWith("invoke error:")) {
48537
- lastPeerMetricsDebug = `exception: ${e instanceof Error ? e.message.slice(0, 200) : String(e).slice(0, 200)}`;
48538
- }
48539
- }
48540
48511
  this.setRemoteMetrics({
48541
48512
  cpuUtil: -1,
48542
- // -1 = unavailable (won't render bar)
48543
48513
  gpuUtil: -1,
48544
- gpuName: pollAttempt <= 5 ? "connecting..." : `peer (${lastPeerMetricsDebug.slice(0, 40)})`,
48514
+ gpuName: "peer (send a message to get metrics)",
48545
48515
  vramUtil: -1,
48546
48516
  memUtil: -1
48547
48517
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.105.4",
3
+ "version": "0.105.6",
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",