open-agents-ai 0.184.18 → 0.184.20
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 +57 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47976,12 +47976,41 @@ async function handleSlashCommand(input, ctx) {
|
|
|
47976
47976
|
if (arg === "pause" && existingConfig?.status === "active") {
|
|
47977
47977
|
existingConfig.status = "paused";
|
|
47978
47978
|
saveSponsorConfig2(projectDir, existingConfig);
|
|
47979
|
-
|
|
47979
|
+
const pauseGw = ctx.getExposeGateway?.();
|
|
47980
|
+
if (pauseGw && "setSponsorLimits" in pauseGw) {
|
|
47981
|
+
pauseGw.setSponsorLimits({ maxRequestsPerMinute: 0, maxTokensPerDay: 0, maxConcurrent: 0, allowedModels: [] });
|
|
47982
|
+
}
|
|
47983
|
+
renderInfo("Sponsorship paused. Tunnel still alive for quick resume.");
|
|
47984
|
+
renderInfo("/sponsor to resume, /sponsor remove to fully stop.");
|
|
47980
47985
|
return "handled";
|
|
47981
47986
|
}
|
|
47982
47987
|
if (arg === "remove" && existingConfig) {
|
|
47983
47988
|
existingConfig.status = "inactive";
|
|
47984
47989
|
saveSponsorConfig2(projectDir, existingConfig);
|
|
47990
|
+
if (ctx.isExposeActive?.()) {
|
|
47991
|
+
try {
|
|
47992
|
+
await ctx.exposeStop?.();
|
|
47993
|
+
renderInfo("Tunnel/P2P gateway stopped.");
|
|
47994
|
+
} catch (err) {
|
|
47995
|
+
renderWarning(`Gateway stop: ${err instanceof Error ? err.message : String(err)}`);
|
|
47996
|
+
}
|
|
47997
|
+
}
|
|
47998
|
+
try {
|
|
47999
|
+
const { execSync: execSync34 } = __require("child_process");
|
|
48000
|
+
const pids = execSync34("pgrep -f 'cloudflared tunnel --url http://127.0.0.1'", { encoding: "utf8", timeout: 3e3 }).trim().split("\n");
|
|
48001
|
+
for (const pid of pids) {
|
|
48002
|
+
const p = parseInt(pid, 10);
|
|
48003
|
+
if (p > 0) {
|
|
48004
|
+
try {
|
|
48005
|
+
process.kill(p, "SIGTERM");
|
|
48006
|
+
} catch {
|
|
48007
|
+
}
|
|
48008
|
+
}
|
|
48009
|
+
}
|
|
48010
|
+
if (pids.length > 0 && pids[0])
|
|
48011
|
+
renderInfo(`Killed ${pids.length} orphaned cloudflared process(es).`);
|
|
48012
|
+
} catch {
|
|
48013
|
+
}
|
|
47985
48014
|
renderInfo("Sponsorship removed.");
|
|
47986
48015
|
return "handled";
|
|
47987
48016
|
}
|
|
@@ -48020,6 +48049,24 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48020
48049
|
availableRows: ctx.availableContentRows?.(),
|
|
48021
48050
|
onGoLive: async (config) => {
|
|
48022
48051
|
const existingGateway = ctx.getExposeGateway?.();
|
|
48052
|
+
const managedPid = existingGateway?._cloudflaredPid || null;
|
|
48053
|
+
if (!existingGateway?.isActive) {
|
|
48054
|
+
try {
|
|
48055
|
+
const { execSync: execSync34 } = __require("child_process");
|
|
48056
|
+
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);
|
|
48057
|
+
for (const pid of orphanPids) {
|
|
48058
|
+
try {
|
|
48059
|
+
process.kill(pid, "SIGTERM");
|
|
48060
|
+
} catch {
|
|
48061
|
+
}
|
|
48062
|
+
}
|
|
48063
|
+
if (orphanPids.length > 0) {
|
|
48064
|
+
renderInfo(`Cleaned up ${orphanPids.length} orphaned tunnel(s) from previous session.`);
|
|
48065
|
+
await new Promise((r) => setTimeout(r, 2e3));
|
|
48066
|
+
}
|
|
48067
|
+
} catch {
|
|
48068
|
+
}
|
|
48069
|
+
}
|
|
48023
48070
|
const tunnelAlreadyActive = existingGateway?.isActive && existingGateway?.tunnelUrl;
|
|
48024
48071
|
const p2pAlreadyActive = ctx.isExposeActive?.() && !existingGateway?.tunnelUrl;
|
|
48025
48072
|
if (config.transport.cloudflared && ctx.exposeStart) {
|
|
@@ -63510,6 +63557,15 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
63510
63557
|
writeContent(() => {
|
|
63511
63558
|
renderInfo(`Reconnected to existing expose tunnel: ${reconnected.tunnelUrl}`);
|
|
63512
63559
|
});
|
|
63560
|
+
try {
|
|
63561
|
+
const { loadSponsorConfig: loadSponsorConfig2 } = await Promise.resolve().then(() => (init_sponsor_wizard(), sponsor_wizard_exports));
|
|
63562
|
+
const spCfg = loadSponsorConfig2(repoRoot);
|
|
63563
|
+
if (spCfg && spCfg.status === "active" && "setSponsorLimits" in reconnected) {
|
|
63564
|
+
reconnected.setSponsorLimits(spCfg.rateLimits);
|
|
63565
|
+
writeContent(() => renderInfo(`Sponsor rate limits restored: ${spCfg.rateLimits.maxRequestsPerMinute} req/min`));
|
|
63566
|
+
}
|
|
63567
|
+
} catch {
|
|
63568
|
+
}
|
|
63513
63569
|
}
|
|
63514
63570
|
} catch {
|
|
63515
63571
|
}
|
package/package.json
CHANGED