open-agents-ai 0.187.308 → 0.187.310
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 +100 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299270,11 +299270,34 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
|
|
|
299270
299270
|
return "handled";
|
|
299271
299271
|
}
|
|
299272
299272
|
if ((sub === "enable" || sub === "disable") && tokens[1]) {
|
|
299273
|
-
const
|
|
299273
|
+
const target = tokens[1];
|
|
299274
|
+
if (target.toLowerCase() === "all") {
|
|
299275
|
+
try {
|
|
299276
|
+
const r2 = await doFetch("/v1/scheduled");
|
|
299277
|
+
const d2 = await r2.json();
|
|
299278
|
+
const tasks = Array.isArray(d2.tasks) ? d2.tasks : [];
|
|
299279
|
+
if (!tasks.length) {
|
|
299280
|
+
renderInfo2("No scheduled tasks found.");
|
|
299281
|
+
return "handled";
|
|
299282
|
+
}
|
|
299283
|
+
const want = sub === "enable";
|
|
299284
|
+
let changed = 0, failed = 0;
|
|
299285
|
+
for (const t2 of tasks) {
|
|
299286
|
+
if (!!t2.enabled === want) continue;
|
|
299287
|
+
const rr = await doFetch(`/v1/scheduled/${encodeURIComponent(t2.id)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ enabled: want }) });
|
|
299288
|
+
if (rr.ok) changed++;
|
|
299289
|
+
else failed++;
|
|
299290
|
+
}
|
|
299291
|
+
renderInfo2(`${sub} all: ${changed} changed${failed ? `, ${failed} failed` : ""}.`);
|
|
299292
|
+
} catch (e2) {
|
|
299293
|
+
renderError2(e2?.message || String(e2));
|
|
299294
|
+
}
|
|
299295
|
+
return "handled";
|
|
299296
|
+
}
|
|
299274
299297
|
try {
|
|
299275
|
-
const r2 = await doFetch(`/v1/scheduled/${encodeURIComponent(
|
|
299276
|
-
if (r2.ok) renderInfo2(`${sub}d ${
|
|
299277
|
-
else renderWarning2(`Failed to ${sub} ${
|
|
299298
|
+
const r2 = await doFetch(`/v1/scheduled/${encodeURIComponent(target)}`, { method: "POST", body: JSON.stringify({ enabled: sub === "enable" }), headers: { "Content-Type": "application/json" } });
|
|
299299
|
+
if (r2.ok) renderInfo2(`${sub}d ${target}`);
|
|
299300
|
+
else renderWarning2(`Failed to ${sub} ${target}`);
|
|
299278
299301
|
} catch (e2) {
|
|
299279
299302
|
renderError2(e2?.message || String(e2));
|
|
299280
299303
|
}
|
|
@@ -321597,7 +321620,11 @@ async function loadScheduled() {
|
|
|
321597
321620
|
return row;
|
|
321598
321621
|
}).join('');
|
|
321599
321622
|
el.innerHTML = '<h3 style="color:#b2920a;font-size:0.7rem;margin-bottom:8px">Scheduled Tasks</h3>' + rows
|
|
321600
|
-
+ '<div style="margin-top:6px
|
|
321623
|
+
+ '<div style="margin-top:6px;display:flex;gap:8px">'
|
|
321624
|
+
+ '<button onclick="disableAllScheduled()" title="Disable all scheduled tasks" style="background:#2a2a30;border:1px solid #5a2a2a;color:#b25f5f;padding:3px 8px;border-radius:3px;font-size:0.65rem;cursor:pointer">disable all</button>'
|
|
321625
|
+
+ '<button onclick="enableAllScheduled()" title="Enable all scheduled tasks" style="background:#2a2a30;border:1px solid #2a3a2a;color:#4ec94e;padding:3px 8px;border-radius:3px;font-size:0.65rem;cursor:pointer">enable all</button>'
|
|
321626
|
+
+ '<button onclick="killScheduled()" title="Kill OA scheduler processes" style="background:#2a2a30;border:1px solid #5a2a2a;color:#b25f5f;padding:3px 8px;border-radius:3px;font-size:0.65rem;cursor:pointer">kill OA schedulers</button>'
|
|
321627
|
+
+ '</div>';
|
|
321601
321628
|
} catch {}
|
|
321602
321629
|
}
|
|
321603
321630
|
|
|
@@ -321615,6 +321642,40 @@ async function loadScheduled() {
|
|
|
321615
321642
|
} catch {}
|
|
321616
321643
|
}
|
|
321617
321644
|
|
|
321645
|
+
(window as any).disableAllScheduled = async function() {
|
|
321646
|
+
try {
|
|
321647
|
+
const r = await fetch('/v1/scheduled', { headers: headers() });
|
|
321648
|
+
const d = await r.json();
|
|
321649
|
+
const tasks = Array.isArray(d.tasks) ? d.tasks : [];
|
|
321650
|
+
let changed = 0;
|
|
321651
|
+
for (const t of tasks) {
|
|
321652
|
+
if (t.enabled) {
|
|
321653
|
+
const rr = await fetch('/v1/scheduled/' + encodeURIComponent(t.id), { method:'POST', headers: headers(), body: JSON.stringify({ enabled: false }) });
|
|
321654
|
+
if (rr.ok) changed++;
|
|
321655
|
+
}
|
|
321656
|
+
}
|
|
321657
|
+
alert('Disabled ' + changed + ' tasks');
|
|
321658
|
+
loadScheduled();
|
|
321659
|
+
} catch {}
|
|
321660
|
+
}
|
|
321661
|
+
|
|
321662
|
+
(window as any).enableAllScheduled = async function() {
|
|
321663
|
+
try {
|
|
321664
|
+
const r = await fetch('/v1/scheduled', { headers: headers() });
|
|
321665
|
+
const d = await r.json();
|
|
321666
|
+
const tasks = Array.isArray(d.tasks) ? d.tasks : [];
|
|
321667
|
+
let changed = 0;
|
|
321668
|
+
for (const t of tasks) {
|
|
321669
|
+
if (!t.enabled) {
|
|
321670
|
+
const rr = await fetch('/v1/scheduled/' + encodeURIComponent(t.id), { method:'POST', headers: headers(), body: JSON.stringify({ enabled: true }) });
|
|
321671
|
+
if (rr.ok) changed++;
|
|
321672
|
+
}
|
|
321673
|
+
}
|
|
321674
|
+
alert('Enabled ' + changed + ' tasks');
|
|
321675
|
+
loadScheduled();
|
|
321676
|
+
} catch {}
|
|
321677
|
+
}
|
|
321678
|
+
|
|
321618
321679
|
// Agent task
|
|
321619
321680
|
let currentRunId = null;
|
|
321620
321681
|
async function loadProfiles() {
|
|
@@ -328402,18 +328463,44 @@ function killScheduledProcesses(pids, pattern) {
|
|
|
328402
328463
|
const killed = [];
|
|
328403
328464
|
try {
|
|
328404
328465
|
const { execSync: es } = __require("node:child_process");
|
|
328466
|
+
const targets = /* @__PURE__ */ new Set();
|
|
328405
328467
|
if (pids && pids.length > 0) {
|
|
328406
|
-
for (const pid of pids)
|
|
328407
|
-
|
|
328408
|
-
|
|
328409
|
-
|
|
328410
|
-
|
|
328411
|
-
|
|
328468
|
+
for (const pid of pids) if (Number.isInteger(pid)) targets.add(pid);
|
|
328469
|
+
} else {
|
|
328470
|
+
try {
|
|
328471
|
+
const ps = es("ps -eo pid,command", { encoding: "utf8", stdio: "pipe" });
|
|
328472
|
+
const re = new RegExp(pattern, "i");
|
|
328473
|
+
for (const line of ps.split("\n")) {
|
|
328474
|
+
const m2 = line.trim().match(/^(\d+)\s+(.*)$/);
|
|
328475
|
+
if (!m2) continue;
|
|
328476
|
+
const pid = parseInt(m2[1], 10);
|
|
328477
|
+
const cmd = m2[2] || "";
|
|
328478
|
+
if (!isFinite(pid)) continue;
|
|
328479
|
+
if (re.test(cmd)) targets.add(pid);
|
|
328412
328480
|
}
|
|
328481
|
+
} catch {
|
|
328413
328482
|
}
|
|
328414
|
-
}
|
|
328483
|
+
}
|
|
328484
|
+
for (const pid of targets) {
|
|
328415
328485
|
try {
|
|
328416
|
-
|
|
328486
|
+
process.kill(pid, "SIGTERM");
|
|
328487
|
+
killed.push({ pid, ok: true, signal: "TERM" });
|
|
328488
|
+
} catch {
|
|
328489
|
+
killed.push({ pid, ok: false, signal: "TERM" });
|
|
328490
|
+
}
|
|
328491
|
+
}
|
|
328492
|
+
const start2 = Date.now();
|
|
328493
|
+
while (Date.now() - start2 < 500) {
|
|
328494
|
+
}
|
|
328495
|
+
for (const pid of targets) {
|
|
328496
|
+
try {
|
|
328497
|
+
process.kill(pid, 0);
|
|
328498
|
+
try {
|
|
328499
|
+
process.kill(pid, "SIGKILL");
|
|
328500
|
+
killed.push({ pid, ok: true, signal: "KILL" });
|
|
328501
|
+
} catch {
|
|
328502
|
+
killed.push({ pid, ok: false, signal: "KILL" });
|
|
328503
|
+
}
|
|
328417
328504
|
} catch {
|
|
328418
328505
|
}
|
|
328419
328506
|
}
|
package/package.json
CHANGED