open-agents-ai 0.187.335 → 0.187.336

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 +49 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -299703,51 +299703,66 @@ sleep 1
299703
299703
  done(false);
299704
299704
  return;
299705
299705
  }
299706
+ const isSystemdTimer = String(task.id || "").startsWith("timer:") || task.file === "(systemd)" || task.index === -1;
299706
299707
  (async () => {
299707
299708
  try {
299708
299709
  const r3 = await doFetch(`/v1/scheduled/${encodeURIComponent(task.id)}`, { method: "DELETE", headers: { "Content-Type": "application/json" } });
299709
299710
  if (r3.ok) {
299710
299711
  renderInfo2(`Deleted scheduled task ${task.id}`);
299711
- try {
299712
- const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299713
- const resp = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pattern: dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") }) });
299712
+ if (isSystemdTimer) {
299714
299713
  try {
299715
- const j = await resp.json();
299716
- const cnt = (Array.isArray(j.killed) ? j.killed.length : 0) + (Array.isArray(j.additionally) ? j.additionally.length : 0);
299717
- if (cnt > 0) renderInfo2(`Killed ${cnt} residual process(es).`);
299714
+ const timerName = String(task.id || "").replace(/^timer:/, "");
299715
+ const { execSync: es } = await import("node:child_process");
299716
+ const userSystemd = `${process.env.HOME}/.config/systemd/user`;
299717
+ for (const suffix of [".timer", ".service"]) {
299718
+ try {
299719
+ es(`rm -f "${userSystemd}/${timerName}${suffix}"`, { stdio: "pipe" });
299720
+ } catch {
299721
+ }
299722
+ }
299723
+ try {
299724
+ es("systemctl --user daemon-reload", { stdio: "pipe" });
299725
+ } catch {
299726
+ }
299727
+ try {
299728
+ es(`pkill -f '${timerName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}' || true`, { stdio: "pipe", timeout: 5e3 });
299729
+ } catch {
299730
+ }
299731
+ renderInfo2(`Cleaned up systemd timer: ${timerName}`);
299718
299732
  } catch {
299719
299733
  }
299720
- } catch {
299721
- }
299722
- try {
299723
- const id = String(task.id || "");
299724
- const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299725
- const escId = id.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
299726
- const escDir = dir.replace(/['"\\]/g, "\\$&");
299727
- const script = [
299728
- // Disable both naming schemes if present
299729
- `systemctl disable --now "oa-${escId}.timer" 2>/dev/null || true`,
299730
- `systemctl disable --now "oa-${escId}.service" 2>/dev/null || true`,
299731
- `systemctl disable --now "oa-sched-${escId}.timer" 2>/dev/null || true`,
299732
- `systemctl disable --now "oa-sched-${escId}.service" 2>/dev/null || true`,
299733
- // Remove root cron OA markers for this id
299734
- `crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED:${escId}/d' | crontab - || true`,
299735
- // Kill lingering processes broadly
299736
- `pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|open-agents-ai|/bin/oa|nexus-daemon|ollama' || true`,
299737
- `sleep 1`,
299738
- `pkill -9 -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|open-agents-ai|/bin/oa|nexus-daemon|ollama' || true`
299739
- ].join("; ");
299740
- await runSudoScript(ctx3, script);
299734
+ } else {
299741
299735
  try {
299742
- const dir2 = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299743
- const r22 = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pattern: dir2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") }) });
299744
- const j2 = await r22.json();
299745
- const rem2 = Array.isArray(j2.procs_after) ? j2.procs_after.length : 0;
299746
- if (rem2 > 0) renderWarning2(`Remaining after sudo cleanup: ${rem2}`);
299747
- else renderInfo2("No remaining matched processes after sudo cleanup.");
299736
+ const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299737
+ const resp = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pattern: dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") }) });
299738
+ try {
299739
+ const j = await resp.json();
299740
+ const cnt = (Array.isArray(j.killed) ? j.killed.length : 0) + (Array.isArray(j.additionally) ? j.additionally.length : 0);
299741
+ if (cnt > 0) renderInfo2(`Killed ${cnt} residual process(es).`);
299742
+ } catch {
299743
+ }
299744
+ } catch {
299745
+ }
299746
+ try {
299747
+ const rawId = String(task.id || "");
299748
+ const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299749
+ const baseId = rawId.replace(/^timer:/, "").replace(/^oa-sched-/, "").replace(/^oa-/, "");
299750
+ const escBase = baseId.replace(/['"\\]/g, "\\$&");
299751
+ const escDir = dir.replace(/['"\\]/g, "\\$&");
299752
+ const script = [
299753
+ // Disable both naming schemes if present
299754
+ `systemctl disable --now "oa-${escBase}.timer" 2>/dev/null || true`,
299755
+ `systemctl disable --now "oa-${escBase}.service" 2>/dev/null || true`,
299756
+ `systemctl disable --now "oa-sched-${escBase}.timer" 2>/dev/null || true`,
299757
+ `systemctl disable --now "oa-sched-${escBase}.service" 2>/dev/null || true`,
299758
+ // Remove root cron OA markers for this id
299759
+ `crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED.*${escBase}/d' | crontab - || true`,
299760
+ // Kill only processes matching this specific task (not all OA/ollama/nexus)
299761
+ `pkill -f 'OPEN-AGENTS-SCHEDULED.*${escBase}' || true`
299762
+ ].join("; ");
299763
+ await runSudoScript(ctx3, script);
299748
299764
  } catch {
299749
299765
  }
299750
- } catch {
299751
299766
  }
299752
299767
  done(true);
299753
299768
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.335",
3
+ "version": "0.187.336",
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",