open-agents-ai 0.187.337 → 0.187.339

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 +116 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -299783,12 +299783,19 @@ sleep 1
299783
299783
  onEnter: (item, { done }) => {
299784
299784
  (async () => {
299785
299785
  if (item.key === "__kill__") {
299786
- const resp = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
299786
+ renderInfo2("Scorched earth: removing all scheduled tasks, timers, crons, and killing processes...");
299787
299787
  try {
299788
+ const delResp = await doFetch("/v1/scheduled/all", { method: "DELETE", headers: { "Content-Type": "application/json" } });
299789
+ const delJ = await delResp.json();
299790
+ renderInfo2(`Deleted ${delJ.deleted || 0} tasks, ${delJ.timers_disabled || 0} timers, ${delJ.cron_lines_removed || 0} cron entries.`);
299791
+ } catch {
299792
+ }
299793
+ try {
299794
+ const resp = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
299788
299795
  const j = await resp.json();
299789
299796
  const kb = Array.isArray(j.killed) ? j.killed.length : 0;
299790
299797
  const ka = Array.isArray(j.additionally) ? j.additionally.length : 0;
299791
- renderInfo2(`Killed ${kb + ka} processes (schedulers + active runs).`);
299798
+ renderInfo2(`Killed ${kb + ka} processes.`);
299792
299799
  const before = j.gpu_before?.[0];
299793
299800
  const after = j.gpu_after?.[0];
299794
299801
  if (before && after) {
@@ -299796,19 +299803,18 @@ sleep 1
299796
299803
  }
299797
299804
  const rem = Array.isArray(j.procs_after) ? j.procs_after.length : 0;
299798
299805
  if (rem > 0) {
299799
- renderWarning2(`Remaining matched processes: ${rem}. Escalating with sudo...`);
299800
- 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`;
299806
+ renderWarning2(`${rem} processes remain. Escalating with sudo...`);
299807
+ const script = [
299808
+ `for u in $(systemctl list-unit-files 'oa-*.timer' --no-legend 2>/dev/null | awk '{print $1}'); do systemctl disable --now "$u" 2>/dev/null; done`,
299809
+ `for u in $(systemctl list-unit-files 'oa-*.service' --no-legend 2>/dev/null | awk '{print $1}'); do systemctl disable --now "$u" 2>/dev/null; done`,
299810
+ `crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED/d' | crontab - || true`,
299811
+ `pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-' || true`,
299812
+ `sleep 1`,
299813
+ `pkill -9 -f 'OPEN-AGENTS-SCHEDULED|oa-sched-' || true`
299814
+ ].join("; ");
299801
299815
  await runSudoScript(ctx3, script);
299802
- try {
299803
- const r22 = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
299804
- const j2 = await r22.json();
299805
- const rem2 = Array.isArray(j2.procs_after) ? j2.procs_after.length : 0;
299806
- if (rem2 > 0) renderWarning2(`Remaining after escalation: ${rem2}`);
299807
- else renderInfo2("No remaining matched processes after escalation.");
299808
- } catch {
299809
- }
299810
299816
  } else {
299811
- renderInfo2("No remaining matched processes.");
299817
+ renderInfo2("All clear — no remaining processes.");
299812
299818
  }
299813
299819
  } catch {
299814
299820
  renderInfo2("Kill signal sent.");
@@ -328163,6 +328169,39 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
328163
328169
  jsonResponse(res, ok2 ? 200 : 404, ok2 ? { id, enabled: enabled2 } : { error: "Not found" });
328164
328170
  return;
328165
328171
  }
328172
+ if (pathname === "/v1/scheduled/all" && method === "DELETE") {
328173
+ let deleted = 0;
328174
+ try {
328175
+ const tasks = listScheduledTasks();
328176
+ for (let i2 = tasks.length - 1; i2 >= 0; i2--) {
328177
+ try {
328178
+ deleteScheduledById(tasks[i2].id);
328179
+ deleted++;
328180
+ } catch {
328181
+ }
328182
+ }
328183
+ } catch {
328184
+ }
328185
+ const timersDisabled = disableAllOaTimers();
328186
+ const cronRemoved = removeAllOaCrons();
328187
+ try {
328188
+ const tasks = listScheduledTasks();
328189
+ const seenFiles = /* @__PURE__ */ new Set();
328190
+ for (const t2 of tasks) {
328191
+ if (t2.file && t2.file !== "(systemd)") seenFiles.add(t2.file);
328192
+ }
328193
+ for (const f2 of seenFiles) {
328194
+ try {
328195
+ writeFileSync45(f2, JSON.stringify({ tasks: [] }, null, 2));
328196
+ deleted++;
328197
+ } catch {
328198
+ }
328199
+ }
328200
+ } catch {
328201
+ }
328202
+ jsonResponse(res, 200, { deleted, timers_disabled: timersDisabled, cron_lines_removed: cronRemoved });
328203
+ return;
328204
+ }
328166
328205
  if (pathname === "/v1/scheduled/kill" && method === "POST") {
328167
328206
  const body = await parseJsonBody(req2);
328168
328207
  const pids = Array.isArray(body?.pids) ? body.pids.filter((n2) => Number.isInteger(n2)) : void 0;
@@ -328240,16 +328279,43 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
328240
328279
  let ok2 = false;
328241
328280
  if (id.startsWith("timer:")) {
328242
328281
  const name11 = id.slice("timer:".length);
328282
+ try {
328283
+ userServiceAction(`${name11}.timer`, "stop");
328284
+ } catch {
328285
+ }
328286
+ try {
328287
+ userServiceAction(`${name11}.service`, "stop");
328288
+ } catch {
328289
+ }
328243
328290
  try {
328244
328291
  userServiceAction(`${name11}.timer`, "disable");
328245
- ok2 = true;
328246
328292
  } catch {
328247
- ok2 = false;
328248
328293
  }
328249
328294
  try {
328250
- userServiceAction(`${name11}.timer`, "stop");
328295
+ userServiceAction(`${name11}.service`, "disable");
328296
+ } catch {
328297
+ }
328298
+ try {
328299
+ const { execSync: es, spawnSync: ss } = __require("node:child_process");
328300
+ const home = process.env.HOME || __require("node:os").homedir();
328301
+ const userDir = `${home}/.config/systemd/user`;
328302
+ for (const suffix of [".timer", ".service"]) {
328303
+ try {
328304
+ es(`rm -f "${userDir}/${name11}${suffix}"`, { stdio: "pipe" });
328305
+ } catch {
328306
+ }
328307
+ }
328308
+ try {
328309
+ es("systemctl --user daemon-reload", { stdio: "pipe" });
328310
+ } catch {
328311
+ }
328312
+ try {
328313
+ ss("pkill", ["-f", name11], { stdio: "pipe", timeout: 3e3 });
328314
+ } catch {
328315
+ }
328251
328316
  } catch {
328252
328317
  }
328318
+ ok2 = true;
328253
328319
  } else {
328254
328320
  ok2 = deleteScheduledById(id);
328255
328321
  }
@@ -329415,17 +329481,38 @@ function killProcessGroups(pids, pattern) {
329415
329481
  function disableAllOaTimers() {
329416
329482
  let disabled = 0;
329417
329483
  try {
329484
+ const { execSync: es } = __require("node:child_process");
329485
+ const home = process.env.HOME || __require("node:os").homedir();
329486
+ const userDir = `${home}/.config/systemd/user`;
329418
329487
  const timers = listOaUserTimers();
329419
329488
  for (const t2 of timers) {
329489
+ try {
329490
+ userServiceAction(`${t2.name}.timer`, "stop");
329491
+ } catch {
329492
+ }
329493
+ try {
329494
+ userServiceAction(`${t2.name}.service`, "stop");
329495
+ } catch {
329496
+ }
329420
329497
  try {
329421
329498
  userServiceAction(`${t2.name}.timer`, "disable");
329422
329499
  disabled++;
329423
329500
  } catch {
329424
329501
  }
329425
329502
  try {
329426
- userServiceAction(`${t2.name}.timer`, "stop");
329503
+ userServiceAction(`${t2.name}.service`, "disable");
329427
329504
  } catch {
329428
329505
  }
329506
+ for (const suffix of [".timer", ".service"]) {
329507
+ try {
329508
+ es(`rm -f "${userDir}/${t2.name}${suffix}"`, { stdio: "pipe" });
329509
+ } catch {
329510
+ }
329511
+ }
329512
+ }
329513
+ try {
329514
+ es("systemctl --user daemon-reload", { stdio: "pipe" });
329515
+ } catch {
329429
329516
  }
329430
329517
  } catch {
329431
329518
  }
@@ -330312,6 +330399,8 @@ function removeCronByMarker(id) {
330312
330399
  function disableUserTimerById(id) {
330313
330400
  try {
330314
330401
  const { execSync: es } = __require("node:child_process");
330402
+ const home = process.env.HOME || __require("node:os").homedir();
330403
+ const userDir = `${home}/.config/systemd/user`;
330315
330404
  const names = [`oa-${id}`, `oa-sched-${id}`, id];
330316
330405
  for (const n2 of names) {
330317
330406
  try {
@@ -330322,6 +330411,16 @@ function disableUserTimerById(id) {
330322
330411
  es(`systemctl --user stop ${n2}.service`, { stdio: "pipe" });
330323
330412
  } catch {
330324
330413
  }
330414
+ for (const suffix of [".timer", ".service"]) {
330415
+ try {
330416
+ es(`rm -f "${userDir}/${n2}${suffix}"`, { stdio: "pipe" });
330417
+ } catch {
330418
+ }
330419
+ }
330420
+ }
330421
+ try {
330422
+ es("systemctl --user daemon-reload", { stdio: "pipe" });
330423
+ } catch {
330325
330424
  }
330326
330425
  } catch {
330327
330426
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.337",
3
+ "version": "0.187.339",
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",