open-agents-ai 0.187.313 → 0.187.314
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 +69 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299357,22 +299357,74 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
299357
299357
|
};
|
|
299358
299358
|
if (sub === "menu") {
|
|
299359
299359
|
try {
|
|
299360
|
-
const r2 = await doFetch("/v1/scheduled");
|
|
299360
|
+
const r2 = await doFetch("/v1/scheduled/status");
|
|
299361
299361
|
const d2 = await r2.json();
|
|
299362
299362
|
const tasks = Array.isArray(d2.tasks) ? d2.tasks : [];
|
|
299363
299363
|
if (!tasks.length) {
|
|
299364
299364
|
renderInfo2("No scheduled tasks found.");
|
|
299365
299365
|
return "handled";
|
|
299366
299366
|
}
|
|
299367
|
-
const items = tasks.map((t2) =>
|
|
299368
|
-
|
|
299369
|
-
|
|
299370
|
-
|
|
299371
|
-
|
|
299367
|
+
const items = tasks.map((t2) => {
|
|
299368
|
+
const procInfo = t2.procs && t2.procs.length ? ` (${t2.procs.length} proc)` : "";
|
|
299369
|
+
const uptime2 = t2.procs && t2.procs[0]?.uptime_s ? ` • up ${Math.max(1, Math.round(t2.procs[0].uptime_s / 60))}m` : "";
|
|
299370
|
+
return {
|
|
299371
|
+
key: t2.id,
|
|
299372
|
+
label: `${t2.enabled ? "●" : "○"} ${t2.name || "(task)"} ${t2.schedule ? "[" + t2.schedule + "]" : ""}${procInfo}${uptime2}`,
|
|
299373
|
+
detail: `${t2.file}#${t2.index}`
|
|
299374
|
+
};
|
|
299375
|
+
});
|
|
299372
299376
|
items.push({ key: "__kill__", label: "Kill OA schedulers + active runs", detail: "Stop scheduler/nexus processes and terminate active OA runs" });
|
|
299373
299377
|
const result = await tuiSelect({
|
|
299374
299378
|
items,
|
|
299375
299379
|
title: "Scheduled Tasks",
|
|
299380
|
+
onAction: (item, action) => {
|
|
299381
|
+
if (item.key === "__kill__") return false;
|
|
299382
|
+
const task = tasks.find((t2) => t2.id === item.key);
|
|
299383
|
+
if (!task) return false;
|
|
299384
|
+
(async () => {
|
|
299385
|
+
const next = !task.enabled;
|
|
299386
|
+
const rr = await doFetch(`/v1/scheduled/${encodeURIComponent(task.id)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ enabled: next }) });
|
|
299387
|
+
if (rr.ok) {
|
|
299388
|
+
task.enabled = next;
|
|
299389
|
+
try {
|
|
299390
|
+
const rs = await doFetch("/v1/scheduled/status");
|
|
299391
|
+
const ds = await rs.json();
|
|
299392
|
+
const t2 = (Array.isArray(ds.tasks) ? ds.tasks : []).find((x) => x.id === task.id);
|
|
299393
|
+
if (t2) task.procs = t2.procs;
|
|
299394
|
+
} catch {
|
|
299395
|
+
}
|
|
299396
|
+
const pi = task.procs && task.procs.length ? ` (${task.procs.length} proc)` : "";
|
|
299397
|
+
const up = task.procs && task.procs[0]?.uptime_s ? ` • up ${Math.max(1, Math.round(task.procs[0].uptime_s / 60))}m` : "";
|
|
299398
|
+
item.label = `${next ? "●" : "○"} ${task.name || "(task)"} ${task.schedule ? "[" + task.schedule + "]" : ""}${pi}${up}`;
|
|
299399
|
+
renderInfo2(`${next ? "Enabled" : "Disabled"} ${task.id}`);
|
|
299400
|
+
} else {
|
|
299401
|
+
renderWarning2(`Failed to toggle ${task.id}`);
|
|
299402
|
+
}
|
|
299403
|
+
})();
|
|
299404
|
+
return true;
|
|
299405
|
+
},
|
|
299406
|
+
onCustomKey: (item, key, { done }) => {
|
|
299407
|
+
if (item.key === "__kill__") return false;
|
|
299408
|
+
if (key.toLowerCase() !== "k") return false;
|
|
299409
|
+
const task = tasks.find((t2) => t2.id === item.key);
|
|
299410
|
+
if (!task) return true;
|
|
299411
|
+
(async () => {
|
|
299412
|
+
const dir = (task.file || "").split("/").slice(0, -1).join("/") || task.file;
|
|
299413
|
+
const resp = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pattern: dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") }) });
|
|
299414
|
+
try {
|
|
299415
|
+
const j = await resp.json();
|
|
299416
|
+
const kb = Array.isArray(j.killed) ? j.killed.length : 0;
|
|
299417
|
+
const ka = Array.isArray(j.additionally) ? j.additionally.length : 0;
|
|
299418
|
+
renderInfo2(`Killed ${kb + ka} procs for selected task.`);
|
|
299419
|
+
const before = j.gpu_before?.[0];
|
|
299420
|
+
const after = j.gpu_after?.[0];
|
|
299421
|
+
if (before && after) renderInfo2(`GPU util: ${before.gpu_pct}% → ${after.gpu_pct}%`);
|
|
299422
|
+
} catch {
|
|
299423
|
+
}
|
|
299424
|
+
done();
|
|
299425
|
+
})();
|
|
299426
|
+
return true;
|
|
299427
|
+
},
|
|
299376
299428
|
onEnter: (item, { done }) => {
|
|
299377
299429
|
(async () => {
|
|
299378
299430
|
if (item.key === "__kill__") {
|
|
@@ -327557,6 +327609,17 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
327557
327609
|
jsonResponse(res, 200, { tasks: listScheduledTasks() });
|
|
327558
327610
|
return;
|
|
327559
327611
|
}
|
|
327612
|
+
if (pathname === "/v1/scheduled/status" && method === "GET") {
|
|
327613
|
+
const tasks = listScheduledTasks();
|
|
327614
|
+
const enriched = tasks.map((t2) => {
|
|
327615
|
+
const dir = t2.file.split("/").slice(0, -1).join("/") || t2.file;
|
|
327616
|
+
const safe = dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
327617
|
+
const procs = listMatchingProcesses(safe);
|
|
327618
|
+
return { ...t2, procs };
|
|
327619
|
+
});
|
|
327620
|
+
jsonResponse(res, 200, { tasks: enriched });
|
|
327621
|
+
return;
|
|
327622
|
+
}
|
|
327560
327623
|
if (pathname?.startsWith("/v1/scheduled/") && method === "POST") {
|
|
327561
327624
|
const parts = pathname.split("/");
|
|
327562
327625
|
const id = parts[3] ?? "";
|
package/package.json
CHANGED