open-agents-ai 0.184.19 → 0.184.21
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 +41 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46479,6 +46479,8 @@ async function destroyOrphanProcesses(ctx, global) {
|
|
|
46479
46479
|
// Stale eval/cron OA instances
|
|
46480
46480
|
"nexus-daemon\\.mjs",
|
|
46481
46481
|
// Detached nexus daemons
|
|
46482
|
+
"cloudflared tunnel --url",
|
|
46483
|
+
// Detached cloudflared quick tunnels (NOT named tunnels)
|
|
46482
46484
|
"vitest",
|
|
46483
46485
|
// Orphaned test runners
|
|
46484
46486
|
"esbuild.*--service.*--ping",
|
|
@@ -46497,13 +46499,21 @@ async function destroyOrphanProcesses(ctx, global) {
|
|
|
46497
46499
|
// Moondream vision server
|
|
46498
46500
|
"live-whisper\\.py",
|
|
46499
46501
|
// Whisper ASR server
|
|
46500
|
-
"jest.*--forceExit"
|
|
46502
|
+
"jest.*--forceExit",
|
|
46501
46503
|
// Orphaned Jest runners
|
|
46504
|
+
"node.*open-agents-ai.*dist",
|
|
46505
|
+
// Orphaned OA node processes from previous runs
|
|
46506
|
+
"transcribe-cli\\.py",
|
|
46507
|
+
// Audio transcription workers
|
|
46508
|
+
"kokoro-tts\\.py",
|
|
46509
|
+
// Kokoro TTS server
|
|
46510
|
+
"glados-tts\\.py"
|
|
46511
|
+
// GLaDOS TTS server
|
|
46502
46512
|
];
|
|
46503
46513
|
const patternArg = patterns.join("|");
|
|
46504
46514
|
let killed = 0;
|
|
46505
46515
|
try {
|
|
46506
|
-
const psOutput = nodeExecSync(`ps -eo pid,ppid,lstart,args --no-headers 2>/dev/null | grep -E "${patternArg}" | grep -v grep`, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
46516
|
+
const psOutput = nodeExecSync(`ps -eo pid,ppid,rss,%cpu,lstart,args --no-headers 2>/dev/null | grep -E "${patternArg}" | grep -v grep`, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
46507
46517
|
if (!psOutput)
|
|
46508
46518
|
return 0;
|
|
46509
46519
|
const lines = psOutput.split("\n").filter((l) => l.trim());
|
|
@@ -46512,12 +46522,14 @@ async function destroyOrphanProcesses(ctx, global) {
|
|
|
46512
46522
|
const parts = line.trim().split(/\s+/);
|
|
46513
46523
|
const pid = parseInt(parts[0], 10);
|
|
46514
46524
|
const ppid = parseInt(parts[1], 10);
|
|
46525
|
+
const rssKb = parseInt(parts[2], 10) || 0;
|
|
46526
|
+
const cpuPct = parseFloat(parts[3]) || 0;
|
|
46515
46527
|
if (pid === myPid || pid === myPpid)
|
|
46516
46528
|
continue;
|
|
46517
46529
|
if (pid <= 10)
|
|
46518
46530
|
continue;
|
|
46519
|
-
const cmd = parts.slice(
|
|
46520
|
-
candidates.push({ pid, ppid, cmd });
|
|
46531
|
+
const cmd = parts.slice(8).join(" ");
|
|
46532
|
+
candidates.push({ pid, ppid, rssMb: Math.round(rssKb / 1024), cpuPct, cmd });
|
|
46521
46533
|
}
|
|
46522
46534
|
if (!global) {
|
|
46523
46535
|
const localCandidates = [];
|
|
@@ -46538,10 +46550,14 @@ async function destroyOrphanProcesses(ctx, global) {
|
|
|
46538
46550
|
}
|
|
46539
46551
|
if (candidates.length === 0)
|
|
46540
46552
|
return 0;
|
|
46541
|
-
|
|
46553
|
+
const totalMb = candidates.reduce((sum, c3) => sum + c3.rssMb, 0);
|
|
46554
|
+
const totalCpu = candidates.reduce((sum, c3) => sum + c3.cpuPct, 0);
|
|
46555
|
+
renderInfo(`Found ${candidates.length} orphaned OA process(es)${global ? " (system-wide)" : ""} \u2014 using ${totalMb}MB RAM, ${totalCpu.toFixed(1)}% CPU:`);
|
|
46542
46556
|
for (const c3 of candidates) {
|
|
46543
|
-
const shortCmd = c3.cmd.length >
|
|
46544
|
-
|
|
46557
|
+
const shortCmd = c3.cmd.length > 60 ? c3.cmd.slice(0, 57) + "..." : c3.cmd;
|
|
46558
|
+
const mem = c3.rssMb > 0 ? `${c3.rssMb}MB` : "0MB";
|
|
46559
|
+
const cpu = c3.cpuPct > 0 ? `${c3.cpuPct.toFixed(1)}%` : "0%";
|
|
46560
|
+
process.stdout.write(` PID ${c3.pid} [${mem} / ${cpu}]: ${shortCmd}
|
|
46545
46561
|
`);
|
|
46546
46562
|
}
|
|
46547
46563
|
for (const c3 of candidates) {
|
|
@@ -48049,6 +48065,24 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48049
48065
|
availableRows: ctx.availableContentRows?.(),
|
|
48050
48066
|
onGoLive: async (config) => {
|
|
48051
48067
|
const existingGateway = ctx.getExposeGateway?.();
|
|
48068
|
+
const managedPid = existingGateway?._cloudflaredPid || null;
|
|
48069
|
+
if (!existingGateway?.isActive) {
|
|
48070
|
+
try {
|
|
48071
|
+
const { execSync: execSync34 } = __require("child_process");
|
|
48072
|
+
const orphanPids = execSync34("pgrep -f 'cloudflared tunnel --url http://127.0.0.1'", { encoding: "utf8", timeout: 3e3 }).trim().split("\n").map((s) => parseInt(s, 10)).filter((p) => p > 0 && p !== managedPid);
|
|
48073
|
+
for (const pid of orphanPids) {
|
|
48074
|
+
try {
|
|
48075
|
+
process.kill(pid, "SIGTERM");
|
|
48076
|
+
} catch {
|
|
48077
|
+
}
|
|
48078
|
+
}
|
|
48079
|
+
if (orphanPids.length > 0) {
|
|
48080
|
+
renderInfo(`Cleaned up ${orphanPids.length} orphaned tunnel(s) from previous session.`);
|
|
48081
|
+
await new Promise((r) => setTimeout(r, 2e3));
|
|
48082
|
+
}
|
|
48083
|
+
} catch {
|
|
48084
|
+
}
|
|
48085
|
+
}
|
|
48052
48086
|
const tunnelAlreadyActive = existingGateway?.isActive && existingGateway?.tunnelUrl;
|
|
48053
48087
|
const p2pAlreadyActive = ctx.isExposeActive?.() && !existingGateway?.tunnelUrl;
|
|
48054
48088
|
if (config.transport.cloudflared && ctx.exposeStart) {
|
package/package.json
CHANGED