open-agents-ai 0.184.17 → 0.184.19
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 +80 -32
- 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
|
}
|
|
@@ -48019,45 +48048,56 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48019
48048
|
ollamaUrl: "http://localhost:11434",
|
|
48020
48049
|
availableRows: ctx.availableContentRows?.(),
|
|
48021
48050
|
onGoLive: async (config) => {
|
|
48022
|
-
|
|
48023
|
-
|
|
48024
|
-
|
|
48025
|
-
renderInfo("Connecting to nexus P2P mesh...");
|
|
48026
|
-
await nexus.execute({ action: "connect" });
|
|
48027
|
-
await new Promise((r) => setTimeout(r, 3e3));
|
|
48028
|
-
renderInfo("Nexus daemon connected.");
|
|
48029
|
-
} catch (err) {
|
|
48030
|
-
renderWarning(`Nexus auto-connect: ${err instanceof Error ? err.message : String(err)}`);
|
|
48031
|
-
}
|
|
48032
|
-
}
|
|
48051
|
+
const existingGateway = ctx.getExposeGateway?.();
|
|
48052
|
+
const tunnelAlreadyActive = existingGateway?.isActive && existingGateway?.tunnelUrl;
|
|
48053
|
+
const p2pAlreadyActive = ctx.isExposeActive?.() && !existingGateway?.tunnelUrl;
|
|
48033
48054
|
if (config.transport.cloudflared && ctx.exposeStart) {
|
|
48034
|
-
|
|
48035
|
-
|
|
48036
|
-
if (
|
|
48037
|
-
|
|
48038
|
-
|
|
48039
|
-
|
|
48040
|
-
|
|
48041
|
-
|
|
48055
|
+
if (tunnelAlreadyActive) {
|
|
48056
|
+
renderInfo(`Tunnel already active: ${existingGateway.tunnelUrl}`);
|
|
48057
|
+
if ("setSponsorLimits" in existingGateway) {
|
|
48058
|
+
existingGateway.setSponsorLimits(config.rateLimits);
|
|
48059
|
+
}
|
|
48060
|
+
renderInfo(`Rate limits updated: ${config.rateLimits.maxRequestsPerMinute} req/min, ${config.rateLimits.maxTokensPerDay.toLocaleString()} tokens/day`);
|
|
48061
|
+
} else {
|
|
48062
|
+
try {
|
|
48063
|
+
const url = await ctx.exposeStart("ollama", void 0, "tunnel");
|
|
48064
|
+
if (url) {
|
|
48065
|
+
renderInfo(`Tunnel: ${url}`);
|
|
48066
|
+
const gw = ctx.getExposeGateway?.();
|
|
48067
|
+
if (gw && "setSponsorLimits" in gw) {
|
|
48068
|
+
gw.setSponsorLimits(config.rateLimits);
|
|
48069
|
+
renderInfo(`Rate limits active: ${config.rateLimits.maxRequestsPerMinute} req/min, ${config.rateLimits.maxTokensPerDay.toLocaleString()} tokens/day`);
|
|
48070
|
+
}
|
|
48042
48071
|
}
|
|
48072
|
+
} catch (err) {
|
|
48073
|
+
renderError(`Tunnel start failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
48043
48074
|
}
|
|
48044
|
-
} catch (err) {
|
|
48045
|
-
renderError(`Tunnel start failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
48046
48075
|
}
|
|
48047
48076
|
}
|
|
48048
48077
|
if (config.transport.libp2p && ctx.exposeStart) {
|
|
48049
48078
|
try {
|
|
48050
|
-
const
|
|
48051
|
-
|
|
48052
|
-
|
|
48053
|
-
|
|
48054
|
-
if (gateway && "setSponsorLimits" in gateway) {
|
|
48055
|
-
gateway.setSponsorLimits(config.rateLimits);
|
|
48056
|
-
}
|
|
48057
|
-
}
|
|
48079
|
+
const nexus = new NexusTool(projectDir);
|
|
48080
|
+
renderInfo("Ensuring nexus daemon is connected...");
|
|
48081
|
+
await nexus.execute({ action: "connect" });
|
|
48082
|
+
await new Promise((r) => setTimeout(r, 2e3));
|
|
48058
48083
|
} catch (err) {
|
|
48059
|
-
|
|
48084
|
+
renderWarning(`Nexus: ${err instanceof Error ? err.message : String(err)}`);
|
|
48060
48085
|
}
|
|
48086
|
+
if (!p2pAlreadyActive) {
|
|
48087
|
+
try {
|
|
48088
|
+
const url = await ctx.exposeStart("ollama", void 0, "libp2p");
|
|
48089
|
+
if (url)
|
|
48090
|
+
renderInfo(`P2P: ${url}`);
|
|
48091
|
+
} catch (err) {
|
|
48092
|
+
renderError(`P2P start failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
48093
|
+
}
|
|
48094
|
+
} else {
|
|
48095
|
+
renderInfo("P2P gateway already active.");
|
|
48096
|
+
}
|
|
48097
|
+
}
|
|
48098
|
+
const activeGw = ctx.getExposeGateway?.();
|
|
48099
|
+
if (activeGw && "setSponsorLimits" in activeGw) {
|
|
48100
|
+
activeGw.setSponsorLimits(config.rateLimits);
|
|
48061
48101
|
}
|
|
48062
48102
|
try {
|
|
48063
48103
|
const nexus = new NexusTool(projectDir);
|
|
@@ -48065,7 +48105,6 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48065
48105
|
await nexus.execute({ action: "connect" });
|
|
48066
48106
|
} catch {
|
|
48067
48107
|
}
|
|
48068
|
-
await new Promise((r) => setTimeout(r, 2e3));
|
|
48069
48108
|
const tunnelGw = ctx.getExposeGateway?.();
|
|
48070
48109
|
const enabledEps = config.endpoints.filter((e) => e.enabled);
|
|
48071
48110
|
const allModels = enabledEps.flatMap((e) => e.models || []);
|
|
@@ -63500,6 +63539,15 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
63500
63539
|
writeContent(() => {
|
|
63501
63540
|
renderInfo(`Reconnected to existing expose tunnel: ${reconnected.tunnelUrl}`);
|
|
63502
63541
|
});
|
|
63542
|
+
try {
|
|
63543
|
+
const { loadSponsorConfig: loadSponsorConfig2 } = await Promise.resolve().then(() => (init_sponsor_wizard(), sponsor_wizard_exports));
|
|
63544
|
+
const spCfg = loadSponsorConfig2(repoRoot);
|
|
63545
|
+
if (spCfg && spCfg.status === "active" && "setSponsorLimits" in reconnected) {
|
|
63546
|
+
reconnected.setSponsorLimits(spCfg.rateLimits);
|
|
63547
|
+
writeContent(() => renderInfo(`Sponsor rate limits restored: ${spCfg.rateLimits.maxRequestsPerMinute} req/min`));
|
|
63548
|
+
}
|
|
63549
|
+
} catch {
|
|
63550
|
+
}
|
|
63503
63551
|
}
|
|
63504
63552
|
} catch {
|
|
63505
63553
|
}
|
package/package.json
CHANGED