open-agents-ai 0.187.327 → 0.187.328
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.
- package/dist/index.js +39 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299521,6 +299521,26 @@ 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 id = String(task.id || "");
|
|
299526
|
+
const unit = id.startsWith("timer:") ? id.slice(6) : "";
|
|
299527
|
+
const script = `set -e
|
|
299528
|
+
sudo -v
|
|
299529
|
+
` + (unit ? `sudo bash -lc 'systemctl disable --now "${unit}.timer" 2>/dev/null || true'
|
|
299530
|
+
sudo bash -lc 'systemctl disable --now "${unit}.service" 2>/dev/null || true'
|
|
299531
|
+
rm -f "$HOME/.config/systemd/user/${unit}.timer" "$HOME/.config/systemd/user/${unit}.service" 2>/dev/null || true
|
|
299532
|
+
systemctl --user daemon-reload || true
|
|
299533
|
+
` : `for n in oa-${id} oa-sched-${id}; do sudo bash -lc "systemctl disable --now "$n.timer" 2>/dev/null || true"; done
|
|
299534
|
+
for n in oa-${id} oa-sched-${id}; do sudo bash -lc "systemctl disable --now "$n.service" 2>/dev/null || true"; done
|
|
299535
|
+
`) + `sudo bash -lc 'crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED:${id.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}/d' | crontab -' || true
|
|
299536
|
+
`;
|
|
299537
|
+
const { spawn: spawn27 } = await import("node:child_process");
|
|
299538
|
+
await new Promise((resolve40) => {
|
|
299539
|
+
const c7 = spawn27("bash", ["-lc", script], { stdio: "inherit" });
|
|
299540
|
+
c7.on("exit", () => resolve40());
|
|
299541
|
+
});
|
|
299542
|
+
} catch {
|
|
299543
|
+
}
|
|
299524
299544
|
done(true);
|
|
299525
299545
|
} else {
|
|
299526
299546
|
renderWarning2(`Failed to delete ${task.id}`);
|
|
@@ -327999,7 +328019,22 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
327999
328019
|
jsonResponse(res, 400, { error: "Missing id" });
|
|
328000
328020
|
return;
|
|
328001
328021
|
}
|
|
328002
|
-
|
|
328022
|
+
let ok2 = false;
|
|
328023
|
+
if (id.startsWith("timer:")) {
|
|
328024
|
+
const name11 = id.slice("timer:".length);
|
|
328025
|
+
try {
|
|
328026
|
+
userServiceAction(`${name11}.timer`, "disable");
|
|
328027
|
+
ok2 = true;
|
|
328028
|
+
} catch {
|
|
328029
|
+
ok2 = false;
|
|
328030
|
+
}
|
|
328031
|
+
try {
|
|
328032
|
+
userServiceAction(`${name11}.timer`, "stop");
|
|
328033
|
+
} catch {
|
|
328034
|
+
}
|
|
328035
|
+
} else {
|
|
328036
|
+
ok2 = deleteScheduledById(id);
|
|
328037
|
+
}
|
|
328003
328038
|
jsonResponse(res, ok2 ? 200 : 404, ok2 ? { id, deleted: true } : { error: "Not found" });
|
|
328004
328039
|
return;
|
|
328005
328040
|
}
|
|
@@ -328934,7 +328969,9 @@ function listScheduledTasks() {
|
|
|
328934
328969
|
const name11 = String(t2?.name || t2?.task || t2?.command || `task-${i2}`);
|
|
328935
328970
|
const schedule = String(t2?.schedule || t2?.cron || t2?.when || "");
|
|
328936
328971
|
const enabled2 = typeof t2?.enabled === "boolean" ? t2.enabled : true;
|
|
328937
|
-
const
|
|
328972
|
+
const realId = typeof t2?.id === "string" && t2.id ? t2.id : null;
|
|
328973
|
+
const fallbackId = createHash9("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
|
|
328974
|
+
const uid = realId || fallbackId;
|
|
328938
328975
|
const key = `${uid}`;
|
|
328939
328976
|
if (seen.has(key)) return;
|
|
328940
328977
|
seen.add(key);
|
package/package.json
CHANGED