open-agents-ai 0.187.317 → 0.187.319
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 +58 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299531,7 +299531,7 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
299531
299531
|
}
|
|
299532
299532
|
if (sub === "list") {
|
|
299533
299533
|
try {
|
|
299534
|
-
const r2 = await doFetch("/v1/scheduled");
|
|
299534
|
+
const r2 = await doFetch("/v1/scheduled/status");
|
|
299535
299535
|
const d2 = await r2.json();
|
|
299536
299536
|
const tasks = Array.isArray(d2.tasks) ? d2.tasks : [];
|
|
299537
299537
|
if (!tasks.length) {
|
|
@@ -299540,7 +299540,7 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
299540
299540
|
}
|
|
299541
299541
|
for (const t2 of tasks) {
|
|
299542
299542
|
renderInfo2(`${t2.enabled ? "[on ]" : "[off]"} ${t2.id} ${t2.name || "(task)"} ${t2.schedule || ""}`);
|
|
299543
|
-
renderInfo2(` ${t2.file}
|
|
299543
|
+
renderInfo2(` ${t2.file}${t2.index >= 0 ? "#" + t2.index : ""}`);
|
|
299544
299544
|
}
|
|
299545
299545
|
} catch (e2) {
|
|
299546
299546
|
renderError2(e2?.message || String(e2));
|
|
@@ -327777,9 +327777,18 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
327777
327777
|
}
|
|
327778
327778
|
if (pathname === "/v1/scheduled/status" && method === "GET") {
|
|
327779
327779
|
const tasks = listScheduledTasks();
|
|
327780
|
-
const
|
|
327780
|
+
const timers = listOaUserTimers().map((t2) => ({
|
|
327781
|
+
id: `timer:${t2.name}`,
|
|
327782
|
+
file: "(systemd)",
|
|
327783
|
+
index: -1,
|
|
327784
|
+
name: t2.name,
|
|
327785
|
+
schedule: t2.schedule,
|
|
327786
|
+
enabled: (t2.enabled || "").toLowerCase().startsWith("enabled")
|
|
327787
|
+
}));
|
|
327788
|
+
const all2 = tasks.concat(timers);
|
|
327789
|
+
const enriched = all2.map((t2) => {
|
|
327781
327790
|
const dir = t2.file.split("/").slice(0, -1).join("/") || t2.file;
|
|
327782
|
-
const safe = dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
327791
|
+
const safe = dir.startsWith("(") ? "(open-agents-ai|oa |OPEN-AGENTS-SCHEDULED)" : dir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
327783
327792
|
const procs = listMatchingProcesses(safe);
|
|
327784
327793
|
return { ...t2, procs };
|
|
327785
327794
|
});
|
|
@@ -327795,7 +327804,13 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
327795
327804
|
jsonResponse(res, 400, { error: "Missing id or enabled flag" });
|
|
327796
327805
|
return;
|
|
327797
327806
|
}
|
|
327798
|
-
|
|
327807
|
+
let ok2 = false;
|
|
327808
|
+
if (id.startsWith("timer:")) {
|
|
327809
|
+
const name11 = id.slice("timer:".length);
|
|
327810
|
+
ok2 = setTimerEnabled(name11, enabled2);
|
|
327811
|
+
} else {
|
|
327812
|
+
ok2 = setScheduledEnabled(id, enabled2);
|
|
327813
|
+
}
|
|
327799
327814
|
jsonResponse(res, ok2 ? 200 : 404, ok2 ? { id, enabled: enabled2 } : { error: "Not found" });
|
|
327800
327815
|
return;
|
|
327801
327816
|
}
|
|
@@ -328794,6 +328809,33 @@ function listScheduledTasks() {
|
|
|
328794
328809
|
}
|
|
328795
328810
|
return results;
|
|
328796
328811
|
}
|
|
328812
|
+
function listOaUserTimers() {
|
|
328813
|
+
const out = [];
|
|
328814
|
+
try {
|
|
328815
|
+
const { execSync: es } = __require("node:child_process");
|
|
328816
|
+
const files = es("systemctl --user list-unit-files --type=timer --no-legend", { encoding: "utf8", stdio: "pipe" }).trim().split("\n");
|
|
328817
|
+
const enabledMap = /* @__PURE__ */ new Map();
|
|
328818
|
+
for (const line of files) {
|
|
328819
|
+
const m2 = line.trim().match(/^(\S+)\s+(\S+)/);
|
|
328820
|
+
if (!m2) continue;
|
|
328821
|
+
const unit = m2[1], state = m2[2];
|
|
328822
|
+
if (/^(oa(-sched)?-)/.test(unit)) enabledMap.set(unit, state);
|
|
328823
|
+
}
|
|
328824
|
+
for (const unit of enabledMap.keys()) {
|
|
328825
|
+
let sched = "";
|
|
328826
|
+
try {
|
|
328827
|
+
const show = es(`systemctl --user show ${unit} --property=OnCalendar,OnUnitActiveSec`, { encoding: "utf8", stdio: "pipe" });
|
|
328828
|
+
const oc = show.match(/OnCalendar=(.*)/)?.[1]?.trim() || "";
|
|
328829
|
+
const ua = show.match(/OnUnitActiveSec=(.*)/)?.[1]?.trim() || "";
|
|
328830
|
+
sched = oc || (ua ? `every ${ua}` : "");
|
|
328831
|
+
} catch {
|
|
328832
|
+
}
|
|
328833
|
+
out.push({ unit, name: unit.replace(/\.timer$/, ""), enabled: enabledMap.get(unit) || "", schedule: sched });
|
|
328834
|
+
}
|
|
328835
|
+
} catch {
|
|
328836
|
+
}
|
|
328837
|
+
return out;
|
|
328838
|
+
}
|
|
328797
328839
|
function walk(dir, depth, onDir, maxDepth) {
|
|
328798
328840
|
if (depth > maxDepth) return;
|
|
328799
328841
|
onDir(dir);
|
|
@@ -329768,6 +329810,17 @@ function disableUserTimerById(id) {
|
|
|
329768
329810
|
} catch {
|
|
329769
329811
|
}
|
|
329770
329812
|
}
|
|
329813
|
+
function setTimerEnabled(name11, enabled2) {
|
|
329814
|
+
try {
|
|
329815
|
+
const unit = `${name11}.timer`;
|
|
329816
|
+
const { execSync: es } = __require("node:child_process");
|
|
329817
|
+
if (enabled2) es(`systemctl --user enable --now ${unit}`, { stdio: "pipe" });
|
|
329818
|
+
else es(`systemctl --user disable --now ${unit}`, { stdio: "pipe" });
|
|
329819
|
+
return true;
|
|
329820
|
+
} catch {
|
|
329821
|
+
return false;
|
|
329822
|
+
}
|
|
329823
|
+
}
|
|
329771
329824
|
var endpointRegistry, modelRouteMap, endpointUsage, metrics, startedAt, _corsOrigins, _corsLocalOnly, runningProcesses, perKeyUsage, CRON_MARKER2;
|
|
329772
329825
|
var init_serve = __esm({
|
|
329773
329826
|
"packages/cli/src/api/serve.ts"() {
|
package/package.json
CHANGED