open-agents-ai 0.187.326 → 0.187.327
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 +70 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299457,6 +299457,7 @@ sleep 1
|
|
|
299457
299457
|
const result = await tuiSelect({
|
|
299458
299458
|
items,
|
|
299459
299459
|
title: "Scheduled Tasks",
|
|
299460
|
+
customKeyHint: " Del delete",
|
|
299460
299461
|
onAction: (item, action) => {
|
|
299461
299462
|
if (item.key === "__kill__") return false;
|
|
299462
299463
|
const task = tasks.find((t2) => t2.id === item.key);
|
|
@@ -299505,6 +299506,32 @@ sleep 1
|
|
|
299505
299506
|
})();
|
|
299506
299507
|
return true;
|
|
299507
299508
|
},
|
|
299509
|
+
onDelete: (item, done) => {
|
|
299510
|
+
if (item.key === "__kill__") {
|
|
299511
|
+
done(false);
|
|
299512
|
+
return;
|
|
299513
|
+
}
|
|
299514
|
+
const task = tasks.find((t2) => t2.id === item.key);
|
|
299515
|
+
if (!task) {
|
|
299516
|
+
done(false);
|
|
299517
|
+
return;
|
|
299518
|
+
}
|
|
299519
|
+
(async () => {
|
|
299520
|
+
try {
|
|
299521
|
+
const r3 = await doFetch(`/v1/scheduled/${encodeURIComponent(task.id)}`, { method: "DELETE", headers: { "Content-Type": "application/json" } });
|
|
299522
|
+
if (r3.ok) {
|
|
299523
|
+
renderInfo2(`Deleted scheduled task ${task.id}`);
|
|
299524
|
+
done(true);
|
|
299525
|
+
} else {
|
|
299526
|
+
renderWarning2(`Failed to delete ${task.id}`);
|
|
299527
|
+
done(false);
|
|
299528
|
+
}
|
|
299529
|
+
} catch {
|
|
299530
|
+
renderWarning2(`Failed to delete ${task.id}`);
|
|
299531
|
+
done(false);
|
|
299532
|
+
}
|
|
299533
|
+
})();
|
|
299534
|
+
},
|
|
299508
299535
|
onEnter: (item, { done }) => {
|
|
299509
299536
|
(async () => {
|
|
299510
299537
|
if (item.key === "__kill__") {
|
|
@@ -327901,7 +327928,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
327901
327928
|
if (pathname === "/v1/scheduled/kill" && method === "POST") {
|
|
327902
327929
|
const body = await parseJsonBody(req2);
|
|
327903
327930
|
const pids = Array.isArray(body?.pids) ? body.pids.filter((n2) => Number.isInteger(n2)) : void 0;
|
|
327904
|
-
const pattern = typeof body?.pattern === "string" && body.pattern.trim() ? body.pattern.trim() : "(/bin/oa|open-agents-ai|nexus-daemon|OPEN-AGENTS-SCHEDULED|oa-sched-|ollama)";
|
|
327931
|
+
const pattern = typeof body?.pattern === "string" && body.pattern.trim() ? body.pattern.trim() : "(/bin/oa\\b|open-agents-ai(.*)/dist|nexus-daemon|OPEN-AGENTS-SCHEDULED|oa-sched-|ollama)";
|
|
327905
327932
|
const timersDisabled = disableAllOaTimers();
|
|
327906
327933
|
const cronRemoved = removeAllOaCrons();
|
|
327907
327934
|
const procsBefore = listMatchingProcesses(pattern);
|
|
@@ -327965,6 +327992,17 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
327965
327992
|
});
|
|
327966
327993
|
return;
|
|
327967
327994
|
}
|
|
327995
|
+
if (pathname?.startsWith("/v1/scheduled/") && method === "DELETE") {
|
|
327996
|
+
const parts = pathname.split("/");
|
|
327997
|
+
const id = parts[3] ?? "";
|
|
327998
|
+
if (!id) {
|
|
327999
|
+
jsonResponse(res, 400, { error: "Missing id" });
|
|
328000
|
+
return;
|
|
328001
|
+
}
|
|
328002
|
+
const ok2 = deleteScheduledById(id);
|
|
328003
|
+
jsonResponse(res, ok2 ? 200 : 404, ok2 ? { id, deleted: true } : { error: "Not found" });
|
|
328004
|
+
return;
|
|
328005
|
+
}
|
|
327968
328006
|
if (pathname === "/v1/scheduled/reconcile" && (method === "GET" || method === "POST")) {
|
|
327969
328007
|
const body = method === "POST" ? await parseJsonBody(req2) : {};
|
|
327970
328008
|
const apply = Boolean(body?.apply);
|
|
@@ -328989,6 +329027,37 @@ function setScheduledEnabled(id, enabled2) {
|
|
|
328989
329027
|
return false;
|
|
328990
329028
|
}
|
|
328991
329029
|
}
|
|
329030
|
+
function deleteScheduledById(id) {
|
|
329031
|
+
const tasks = listScheduledTasks();
|
|
329032
|
+
const target = tasks.find((t2) => t2.id === id);
|
|
329033
|
+
if (!target) return false;
|
|
329034
|
+
try {
|
|
329035
|
+
const raw = readFileSync65(target.file, "utf-8");
|
|
329036
|
+
const json = JSON.parse(raw);
|
|
329037
|
+
const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
|
|
329038
|
+
if (!arr[target.index]) return false;
|
|
329039
|
+
arr.splice(target.index, 1);
|
|
329040
|
+
if (Array.isArray(json?.tasks)) {
|
|
329041
|
+
json.tasks = arr;
|
|
329042
|
+
writeFileSync45(target.file, JSON.stringify(json, null, 2));
|
|
329043
|
+
} else if (Array.isArray(json)) {
|
|
329044
|
+
writeFileSync45(target.file, JSON.stringify(arr, null, 2));
|
|
329045
|
+
} else {
|
|
329046
|
+
writeFileSync45(target.file, JSON.stringify({ tasks: arr }, null, 2));
|
|
329047
|
+
}
|
|
329048
|
+
try {
|
|
329049
|
+
removeCronByMarker(id);
|
|
329050
|
+
} catch {
|
|
329051
|
+
}
|
|
329052
|
+
try {
|
|
329053
|
+
disableUserTimerById(id);
|
|
329054
|
+
} catch {
|
|
329055
|
+
}
|
|
329056
|
+
return true;
|
|
329057
|
+
} catch {
|
|
329058
|
+
return false;
|
|
329059
|
+
}
|
|
329060
|
+
}
|
|
328992
329061
|
function killProcessGroups(pids, pattern) {
|
|
328993
329062
|
const killed = [];
|
|
328994
329063
|
try {
|
package/package.json
CHANGED