open-agents-ai 0.187.329 → 0.187.331
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 +43 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -297234,6 +297234,40 @@ function safeLog(text) {
|
|
|
297234
297234
|
process.stdout.write(text + "\n");
|
|
297235
297235
|
}
|
|
297236
297236
|
}
|
|
297237
|
+
async function runSudoScript(ctx3, script) {
|
|
297238
|
+
const stdinAny = process.stdin;
|
|
297239
|
+
const hadRaw = !!(stdinAny && stdinAny.isTTY && stdinAny.isRaw);
|
|
297240
|
+
try {
|
|
297241
|
+
ctx3.deactivateStatusBar?.();
|
|
297242
|
+
} catch {
|
|
297243
|
+
}
|
|
297244
|
+
try {
|
|
297245
|
+
if (stdinAny && stdinAny.isTTY && typeof stdinAny.setRawMode === "function") {
|
|
297246
|
+
stdinAny.setRawMode(false);
|
|
297247
|
+
}
|
|
297248
|
+
} catch {
|
|
297249
|
+
}
|
|
297250
|
+
try {
|
|
297251
|
+
const { spawn: spawn27 } = await import("node:child_process");
|
|
297252
|
+
const full = `set -e; sudo -v; ${script}`;
|
|
297253
|
+
await new Promise((resolve40) => {
|
|
297254
|
+
const child = spawn27("bash", ["-lc", full], { stdio: "inherit" });
|
|
297255
|
+
child.on("exit", () => resolve40());
|
|
297256
|
+
child.on("error", () => resolve40());
|
|
297257
|
+
});
|
|
297258
|
+
} catch {
|
|
297259
|
+
}
|
|
297260
|
+
try {
|
|
297261
|
+
if (hadRaw && stdinAny && stdinAny.isTTY && typeof stdinAny.setRawMode === "function") {
|
|
297262
|
+
stdinAny.setRawMode(true);
|
|
297263
|
+
}
|
|
297264
|
+
} catch {
|
|
297265
|
+
}
|
|
297266
|
+
try {
|
|
297267
|
+
ctx3.showPrompt?.();
|
|
297268
|
+
} catch {
|
|
297269
|
+
}
|
|
297270
|
+
}
|
|
297237
297271
|
function findPidsByPattern(pattern) {
|
|
297238
297272
|
const isWin2 = process.platform === "win32";
|
|
297239
297273
|
try {
|
|
@@ -299560,22 +299594,8 @@ sleep 1
|
|
|
299560
299594
|
const rem = Array.isArray(j.procs_after) ? j.procs_after.length : 0;
|
|
299561
299595
|
if (rem > 0) {
|
|
299562
299596
|
renderWarning2(`Remaining matched processes: ${rem}. Escalating with sudo...`);
|
|
299563
|
-
const script = `
|
|
299564
|
-
|
|
299565
|
-
sudo bash -lc 'systemctl disable --now "oa-*".timer 2>/dev/null || true'
|
|
299566
|
-
sudo bash -lc 'systemctl disable --now "oa-*".service 2>/dev/null || true'
|
|
299567
|
-
sudo bash -lc 'crontab -l 2>/dev/null | sed "/OPEN-AGENTS-SCHEDULED/d" | crontab -' || true
|
|
299568
|
-
sudo pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|nexus|ollama' || true
|
|
299569
|
-
sleep 1
|
|
299570
|
-
`;
|
|
299571
|
-
try {
|
|
299572
|
-
const { spawn: spawn27 } = await import("node:child_process");
|
|
299573
|
-
await new Promise((resolve40) => {
|
|
299574
|
-
const c7 = spawn27("bash", ["-lc", script], { stdio: "inherit" });
|
|
299575
|
-
c7.on("exit", () => resolve40());
|
|
299576
|
-
});
|
|
299577
|
-
} catch {
|
|
299578
|
-
}
|
|
299597
|
+
const script = `systemctl disable --now "oa-*".timer 2>/dev/null || true; systemctl disable --now "oa-*".service 2>/dev/null || true; crontab -l 2>/dev/null | sed '/OPEN-AGENTS-SCHEDULED/d' | crontab - || true; pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|nexus|ollama' || true; sleep 1`;
|
|
299598
|
+
await runSudoScript(ctx3, script);
|
|
299579
299599
|
try {
|
|
299580
299600
|
const r22 = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
|
|
299581
299601
|
const j2 = await r22.json();
|
|
@@ -329109,7 +329129,13 @@ function removeCronByDirectory(dir) {
|
|
|
329109
329129
|
if (!lines.length) return 0;
|
|
329110
329130
|
const quoted = `cd "${dir}"`;
|
|
329111
329131
|
const single = `cd '${dir}'`;
|
|
329112
|
-
const next = lines.filter((l2) =>
|
|
329132
|
+
const next = lines.filter((l2) => {
|
|
329133
|
+
const dirMatch = l2.includes(quoted) || l2.includes(single) || l2.includes(dir);
|
|
329134
|
+
const markerMatch = l2.includes(CRON_MARKER2);
|
|
329135
|
+
const cmdMatch = /\b(oa|open-agents)\b/.test(l2);
|
|
329136
|
+
if (dirMatch && (markerMatch || cmdMatch)) return false;
|
|
329137
|
+
return true;
|
|
329138
|
+
});
|
|
329113
329139
|
if (next.length !== lines.length) {
|
|
329114
329140
|
writeCrontabLines(next);
|
|
329115
329141
|
return lines.length - next.length;
|
package/package.json
CHANGED