open-agents-ai 0.187.330 → 0.187.332

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 +66 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -297234,6 +297234,40 @@ function safeLog(text) {
297234
297234
  process.stdout.write(text + "\n");
297235
297235
  }
297236
297236
  }
297237
+ async function runSudoScript(ctx3, script) {
297238
+ const stdinAny = process.stdin;
297239
+ const hadRaw = !!(stdinAny && stdinAny.isTTY && stdinAny.isRaw);
297240
+ try {
297241
+ ctx3.deactivateStatusBar?.();
297242
+ } catch {
297243
+ }
297244
+ try {
297245
+ if (stdinAny && stdinAny.isTTY && typeof stdinAny.setRawMode === "function") {
297246
+ stdinAny.setRawMode(false);
297247
+ }
297248
+ } catch {
297249
+ }
297250
+ try {
297251
+ const { spawn: spawn27 } = await import("node:child_process");
297252
+ const full = `set -e; sudo -v; ${script}`;
297253
+ await new Promise((resolve40) => {
297254
+ const child = spawn27("bash", ["-lc", full], { stdio: "inherit" });
297255
+ child.on("exit", () => resolve40());
297256
+ child.on("error", () => resolve40());
297257
+ });
297258
+ } catch {
297259
+ }
297260
+ try {
297261
+ if (hadRaw && stdinAny && stdinAny.isTTY && typeof stdinAny.setRawMode === "function") {
297262
+ stdinAny.setRawMode(true);
297263
+ }
297264
+ } catch {
297265
+ }
297266
+ try {
297267
+ ctx3.showPrompt?.();
297268
+ } catch {
297269
+ }
297270
+ }
297237
297271
  function findPidsByPattern(pattern) {
297238
297272
  const isWin2 = process.platform === "win32";
297239
297273
  try {
@@ -299532,6 +299566,36 @@ sleep 1
299532
299566
  }
299533
299567
  } catch {
299534
299568
  }
299569
+ try {
299570
+ const id = String(task.id || "");
299571
+ const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299572
+ const escId = id.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
299573
+ const escDir = dir.replace(/['"\\]/g, "\\$&");
299574
+ const script = [
299575
+ // Disable both naming schemes if present
299576
+ `systemctl disable --now "oa-${escId}.timer" 2>/dev/null || true`,
299577
+ `systemctl disable --now "oa-${escId}.service" 2>/dev/null || true`,
299578
+ `systemctl disable --now "oa-sched-${escId}.timer" 2>/dev/null || true`,
299579
+ `systemctl disable --now "oa-sched-${escId}.service" 2>/dev/null || true`,
299580
+ // Remove root cron OA markers for this id
299581
+ `crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED:${escId}/d' | crontab - || true`,
299582
+ // Kill lingering processes broadly
299583
+ `pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|open-agents-ai|/bin/oa|nexus-daemon|ollama' || true`,
299584
+ `sleep 1`,
299585
+ `pkill -9 -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|open-agents-ai|/bin/oa|nexus-daemon|ollama' || true`
299586
+ ].join("; ");
299587
+ await runSudoScript(ctx3, script);
299588
+ try {
299589
+ const dir2 = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299590
+ const r22 = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pattern: dir2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") }) });
299591
+ const j2 = await r22.json();
299592
+ const rem2 = Array.isArray(j2.procs_after) ? j2.procs_after.length : 0;
299593
+ if (rem2 > 0) renderWarning2(`Remaining after sudo cleanup: ${rem2}`);
299594
+ else renderInfo2("No remaining matched processes after sudo cleanup.");
299595
+ } catch {
299596
+ }
299597
+ } catch {
299598
+ }
299535
299599
  done(true);
299536
299600
  } else {
299537
299601
  renderWarning2(`Failed to delete ${task.id}`);
@@ -299560,22 +299624,8 @@ sleep 1
299560
299624
  const rem = Array.isArray(j.procs_after) ? j.procs_after.length : 0;
299561
299625
  if (rem > 0) {
299562
299626
  renderWarning2(`Remaining matched processes: ${rem}. Escalating with sudo...`);
299563
- const script = `set -e
299564
- sudo -v
299565
- sudo bash -lc 'systemctl disable --now "oa-*".timer 2>/dev/null || true'
299566
- sudo bash -lc 'systemctl disable --now "oa-*".service 2>/dev/null || true'
299567
- sudo bash -lc 'crontab -l 2>/dev/null | sed "/OPEN-AGENTS-SCHEDULED/d" | crontab -' || true
299568
- sudo pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|nexus|ollama' || true
299569
- sleep 1
299570
- `;
299571
- try {
299572
- const { spawn: spawn27 } = await import("node:child_process");
299573
- await new Promise((resolve40) => {
299574
- const c7 = spawn27("bash", ["-lc", script], { stdio: "inherit" });
299575
- c7.on("exit", () => resolve40());
299576
- });
299577
- } catch {
299578
- }
299627
+ const script = `systemctl disable --now "oa-*".timer 2>/dev/null || true; systemctl disable --now "oa-*".service 2>/dev/null || true; crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED/d' | crontab - || true; pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|nexus|ollama' || true; sleep 1`;
299628
+ await runSudoScript(ctx3, script);
299579
299629
  try {
299580
299630
  const r22 = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
299581
299631
  const j2 = await r22.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.330",
3
+ "version": "0.187.332",
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",