open-agents-ai 0.187.327 → 0.187.329

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 +75 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -299521,6 +299521,17 @@ sleep 1
299521
299521
  const r3 = await doFetch(`/v1/scheduled/${encodeURIComponent(task.id)}`, { method: "DELETE", headers: { "Content-Type": "application/json" } });
299522
299522
  if (r3.ok) {
299523
299523
  renderInfo2(`Deleted scheduled task ${task.id}`);
299524
+ try {
299525
+ const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
299526
+ const resp = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pattern: dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") }) });
299527
+ try {
299528
+ const j = await resp.json();
299529
+ const cnt = (Array.isArray(j.killed) ? j.killed.length : 0) + (Array.isArray(j.additionally) ? j.additionally.length : 0);
299530
+ if (cnt > 0) renderInfo2(`Killed ${cnt} residual process(es).`);
299531
+ } catch {
299532
+ }
299533
+ } catch {
299534
+ }
299524
299535
  done(true);
299525
299536
  } else {
299526
299537
  renderWarning2(`Failed to delete ${task.id}`);
@@ -327999,7 +328010,22 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
327999
328010
  jsonResponse(res, 400, { error: "Missing id" });
328000
328011
  return;
328001
328012
  }
328002
- const ok2 = deleteScheduledById(id);
328013
+ let ok2 = false;
328014
+ if (id.startsWith("timer:")) {
328015
+ const name11 = id.slice("timer:".length);
328016
+ try {
328017
+ userServiceAction(`${name11}.timer`, "disable");
328018
+ ok2 = true;
328019
+ } catch {
328020
+ ok2 = false;
328021
+ }
328022
+ try {
328023
+ userServiceAction(`${name11}.timer`, "stop");
328024
+ } catch {
328025
+ }
328026
+ } else {
328027
+ ok2 = deleteScheduledById(id);
328028
+ }
328003
328029
  jsonResponse(res, ok2 ? 200 : 404, ok2 ? { id, deleted: true } : { error: "Not found" });
328004
328030
  return;
328005
328031
  }
@@ -328934,7 +328960,9 @@ function listScheduledTasks() {
328934
328960
  const name11 = String(t2?.name || t2?.task || t2?.command || `task-${i2}`);
328935
328961
  const schedule = String(t2?.schedule || t2?.cron || t2?.when || "");
328936
328962
  const enabled2 = typeof t2?.enabled === "boolean" ? t2.enabled : true;
328937
- const uid = createHash9("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
328963
+ const realId = typeof t2?.id === "string" && t2.id ? t2.id : null;
328964
+ const fallbackId = createHash9("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
328965
+ const uid = realId || fallbackId;
328938
328966
  const key = `${uid}`;
328939
328967
  if (seen.has(key)) return;
328940
328968
  seen.add(key);
@@ -329036,6 +329064,7 @@ function deleteScheduledById(id) {
329036
329064
  const json = JSON.parse(raw);
329037
329065
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
329038
329066
  if (!arr[target.index]) return false;
329067
+ const entry = arr[target.index];
329039
329068
  arr.splice(target.index, 1);
329040
329069
  if (Array.isArray(json?.tasks)) {
329041
329070
  json.tasks = arr;
@@ -329045,12 +329074,28 @@ function deleteScheduledById(id) {
329045
329074
  } else {
329046
329075
  writeFileSync45(target.file, JSON.stringify({ tasks: arr }, null, 2));
329047
329076
  }
329077
+ const candidates = [];
329078
+ if (id) candidates.push(id);
329079
+ if (typeof entry?.id === "string" && entry.id && !candidates.includes(entry.id)) candidates.push(entry.id);
329048
329080
  try {
329049
- removeCronByMarker(id);
329081
+ const { createHash: createHash11 } = __require("node:crypto");
329082
+ const fallback = createHash11("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
329083
+ if (!candidates.includes(fallback)) candidates.push(fallback);
329050
329084
  } catch {
329051
329085
  }
329086
+ for (const cid of candidates) {
329087
+ try {
329088
+ removeCronByMarker(cid);
329089
+ } catch {
329090
+ }
329091
+ try {
329092
+ disableUserTimerById(cid);
329093
+ } catch {
329094
+ }
329095
+ }
329052
329096
  try {
329053
- disableUserTimerById(id);
329097
+ const dir = target.file.split("/").slice(0, -1).join("/") || target.file;
329098
+ removeCronByDirectory(dir);
329054
329099
  } catch {
329055
329100
  }
329056
329101
  return true;
@@ -329058,6 +329103,21 @@ function deleteScheduledById(id) {
329058
329103
  return false;
329059
329104
  }
329060
329105
  }
329106
+ function removeCronByDirectory(dir) {
329107
+ try {
329108
+ const lines = getCurrentCrontabLines();
329109
+ if (!lines.length) return 0;
329110
+ const quoted = `cd "${dir}"`;
329111
+ const single = `cd '${dir}'`;
329112
+ const next = lines.filter((l2) => !(l2.includes(CRON_MARKER2) && (l2.includes(quoted) || l2.includes(single) || l2.includes(dir))));
329113
+ if (next.length !== lines.length) {
329114
+ writeCrontabLines(next);
329115
+ return lines.length - next.length;
329116
+ }
329117
+ } catch {
329118
+ }
329119
+ return 0;
329120
+ }
329061
329121
  function killProcessGroups(pids, pattern) {
329062
329122
  const killed = [];
329063
329123
  try {
@@ -330018,9 +330078,18 @@ function removeCronByMarker(id) {
330018
330078
  }
330019
330079
  function disableUserTimerById(id) {
330020
330080
  try {
330021
- const unit = `oa-${id}.timer`;
330022
330081
  const { execSync: es } = __require("node:child_process");
330023
- es(`systemctl --user disable --now ${unit}`, { stdio: "pipe" });
330082
+ const names = [`oa-${id}`, `oa-sched-${id}`, id];
330083
+ for (const n2 of names) {
330084
+ try {
330085
+ es(`systemctl --user disable --now ${n2}.timer`, { stdio: "pipe" });
330086
+ } catch {
330087
+ }
330088
+ try {
330089
+ es(`systemctl --user stop ${n2}.service`, { stdio: "pipe" });
330090
+ } catch {
330091
+ }
330092
+ }
330024
330093
  } catch {
330025
330094
  }
330026
330095
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.327",
3
+ "version": "0.187.329",
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",