open-agents-ai 0.187.306 → 0.187.308
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 +55 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299193,12 +299193,64 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
299193
299193
|
return "handled";
|
|
299194
299194
|
}
|
|
299195
299195
|
case "scheduler": {
|
|
299196
|
-
const
|
|
299196
|
+
const tokens = (arg || "").trim().length ? (arg || "").trim().split(/\s+/) : [];
|
|
299197
|
+
const sub = (tokens[0] || "menu").toLowerCase();
|
|
299197
299198
|
const base3 = `http://127.0.0.1:${process.env["OA_PORT"] || "11435"}`;
|
|
299198
299199
|
const doFetch = async (path5, init2) => {
|
|
299199
299200
|
const url = base3 + path5;
|
|
299200
299201
|
return await fetch(url, init2);
|
|
299201
299202
|
};
|
|
299203
|
+
if (sub === "menu") {
|
|
299204
|
+
try {
|
|
299205
|
+
const r2 = await doFetch("/v1/scheduled");
|
|
299206
|
+
const d2 = await r2.json();
|
|
299207
|
+
const tasks = Array.isArray(d2.tasks) ? d2.tasks : [];
|
|
299208
|
+
if (!tasks.length) {
|
|
299209
|
+
renderInfo2("No scheduled tasks found.");
|
|
299210
|
+
return "handled";
|
|
299211
|
+
}
|
|
299212
|
+
const items = tasks.map((t2) => ({
|
|
299213
|
+
key: t2.id,
|
|
299214
|
+
label: `${t2.enabled ? "●" : "○"} ${t2.name || "(task)"} ${t2.schedule ? "[" + t2.schedule + "]" : ""}`,
|
|
299215
|
+
detail: `${t2.file}#${t2.index}`
|
|
299216
|
+
}));
|
|
299217
|
+
items.push({ key: "__kill__", label: "Kill OA schedulers", detail: "Stop scheduler/nexus background processes" });
|
|
299218
|
+
const result = await tuiSelect({
|
|
299219
|
+
items,
|
|
299220
|
+
title: "Scheduled Tasks",
|
|
299221
|
+
onEnter: (item, { done }) => {
|
|
299222
|
+
(async () => {
|
|
299223
|
+
if (item.key === "__kill__") {
|
|
299224
|
+
await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
|
|
299225
|
+
renderInfo2("Kill signal sent to OA scheduler processes.");
|
|
299226
|
+
done();
|
|
299227
|
+
return;
|
|
299228
|
+
}
|
|
299229
|
+
const task = tasks.find((t2) => t2.id === item.key);
|
|
299230
|
+
if (!task) {
|
|
299231
|
+
done();
|
|
299232
|
+
return;
|
|
299233
|
+
}
|
|
299234
|
+
const next = !task.enabled;
|
|
299235
|
+
const rr = await doFetch(`/v1/scheduled/${encodeURIComponent(task.id)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ enabled: next }) });
|
|
299236
|
+
if (rr.ok) {
|
|
299237
|
+
task.enabled = next;
|
|
299238
|
+
item.label = `${next ? "●" : "○"} ${task.name || "(task)"} ${task.schedule ? "[" + task.schedule + "]" : ""}`;
|
|
299239
|
+
renderInfo2(`${next ? "Enabled" : "Disabled"} ${task.id}`);
|
|
299240
|
+
} else {
|
|
299241
|
+
renderWarning2(`Failed to toggle ${task.id}`);
|
|
299242
|
+
}
|
|
299243
|
+
done();
|
|
299244
|
+
})();
|
|
299245
|
+
return true;
|
|
299246
|
+
}
|
|
299247
|
+
});
|
|
299248
|
+
void result;
|
|
299249
|
+
} catch (e2) {
|
|
299250
|
+
renderError2(e2?.message || String(e2));
|
|
299251
|
+
}
|
|
299252
|
+
return "handled";
|
|
299253
|
+
}
|
|
299202
299254
|
if (sub === "list") {
|
|
299203
299255
|
try {
|
|
299204
299256
|
const r2 = await doFetch("/v1/scheduled");
|
|
@@ -299217,8 +299269,8 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
299217
299269
|
}
|
|
299218
299270
|
return "handled";
|
|
299219
299271
|
}
|
|
299220
|
-
if ((sub === "enable" || sub === "disable") &&
|
|
299221
|
-
const id =
|
|
299272
|
+
if ((sub === "enable" || sub === "disable") && tokens[1]) {
|
|
299273
|
+
const id = tokens[1];
|
|
299222
299274
|
try {
|
|
299223
299275
|
const r2 = await doFetch(`/v1/scheduled/${encodeURIComponent(id)}`, { method: "POST", body: JSON.stringify({ enabled: sub === "enable" }), headers: { "Content-Type": "application/json" } });
|
|
299224
299276
|
if (r2.ok) renderInfo2(`${sub}d ${id}`);
|
package/package.json
CHANGED