open-agents-ai 0.186.18 → 0.186.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 +74 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38028,6 +38028,7 @@ Type /expose tunnel to retry manually, or /expose libp2p as alternative.`);
|
|
|
38028
38028
|
this.emitStats();
|
|
38029
38029
|
this.options.onInfo?.(`Tunnel restarted with new URL \u2014 share with consumers:
|
|
38030
38030
|
${this.formatConnectionInfo()}`);
|
|
38031
|
+
this.options.onTunnelRestart?.(this._tunnelUrl);
|
|
38031
38032
|
if (this._stateDir) {
|
|
38032
38033
|
writeExposeState(this._stateDir, {
|
|
38033
38034
|
pid: this._cloudflaredPid,
|
|
@@ -46489,11 +46490,25 @@ async function runSponsorWizard(ctx) {
|
|
|
46489
46490
|
}
|
|
46490
46491
|
config.status = "active";
|
|
46491
46492
|
saveSponsorConfig(ctx.projectDir, config);
|
|
46493
|
+
let goLiveSuccess = true;
|
|
46492
46494
|
if (ctx.onGoLive) {
|
|
46493
|
-
|
|
46495
|
+
try {
|
|
46496
|
+
const result = await ctx.onGoLive(config);
|
|
46497
|
+
if (result === false || result === "failed")
|
|
46498
|
+
goLiveSuccess = false;
|
|
46499
|
+
} catch {
|
|
46500
|
+
goLiveSuccess = false;
|
|
46501
|
+
}
|
|
46502
|
+
}
|
|
46503
|
+
if (goLiveSuccess) {
|
|
46504
|
+
renderInfo("\u2726 Sponsorship active!");
|
|
46505
|
+
renderInfo("Toggle: /sponsor status | Pause: /sponsor pause | Remove: /sponsor remove");
|
|
46506
|
+
} else {
|
|
46507
|
+
config.status = "inactive";
|
|
46508
|
+
saveSponsorConfig(ctx.projectDir, config);
|
|
46509
|
+
renderWarning("Sponsorship could not go live \u2014 no public endpoint available.");
|
|
46510
|
+
renderInfo("Fix the tunnel/P2P issue and run /sponsor again.");
|
|
46494
46511
|
}
|
|
46495
|
-
renderInfo("\u2726 Sponsorship active!");
|
|
46496
|
-
renderInfo("Toggle: /sponsor status | Pause: /sponsor pause | Remove: /sponsor remove");
|
|
46497
46512
|
return config;
|
|
46498
46513
|
}
|
|
46499
46514
|
var COLOR_PRESETS, GRADIENT_PRESETS, ANIM_PRESETS2;
|
|
@@ -49310,10 +49325,34 @@ import * as nodeOs from "node:os";
|
|
|
49310
49325
|
import { execSync as nodeExecSync } from "node:child_process";
|
|
49311
49326
|
import { existsSync as existsSync44, readFileSync as readFileSync33, writeFileSync as writeFileSync21, mkdirSync as mkdirSync20, readdirSync as readdirSync13, statSync as statSync15, rmSync } from "node:fs";
|
|
49312
49327
|
import { join as join60 } from "node:path";
|
|
49328
|
+
async function _immediateReregister(newUrl) {
|
|
49329
|
+
if (!_lastRegisteredSponsorPayload)
|
|
49330
|
+
return;
|
|
49331
|
+
_lastRegisteredSponsorPayload.tunnelUrl = newUrl;
|
|
49332
|
+
_lastRegisteredSponsorPayload.status = "active";
|
|
49333
|
+
try {
|
|
49334
|
+
await fetch("https://openagents.nexus/api/v1/sponsors", {
|
|
49335
|
+
method: "POST",
|
|
49336
|
+
headers: { "Content-Type": "application/json" },
|
|
49337
|
+
body: JSON.stringify(_lastRegisteredSponsorPayload),
|
|
49338
|
+
signal: AbortSignal.timeout(1e4)
|
|
49339
|
+
});
|
|
49340
|
+
} catch {
|
|
49341
|
+
}
|
|
49342
|
+
}
|
|
49313
49343
|
function startSponsorHeartbeat(payload, getExposeGateway) {
|
|
49314
49344
|
stopSponsorHeartbeat();
|
|
49315
49345
|
_lastRegisteredSponsorPayload = { ...payload };
|
|
49316
49346
|
const _stableGetGateway = getExposeGateway;
|
|
49347
|
+
try {
|
|
49348
|
+
const gw = _stableGetGateway?.();
|
|
49349
|
+
if (gw && !gw._sponsorRestartWired) {
|
|
49350
|
+
gw._sponsorRestartWired = true;
|
|
49351
|
+
if (gw.options)
|
|
49352
|
+
gw.options.onTunnelRestart = _immediateReregister;
|
|
49353
|
+
}
|
|
49354
|
+
} catch {
|
|
49355
|
+
}
|
|
49317
49356
|
const HEARTBEAT_MS = 5 * 60 * 1e3;
|
|
49318
49357
|
_sponsorHeartbeatTimer = setInterval(async () => {
|
|
49319
49358
|
if (!_lastRegisteredSponsorPayload)
|
|
@@ -51281,27 +51320,42 @@ Clone a new voice: /voice clone <wav-file> [name]`);
|
|
|
51281
51320
|
let daemonReady = false;
|
|
51282
51321
|
try {
|
|
51283
51322
|
const nexus = new NexusTool(projectDir);
|
|
51284
|
-
|
|
51285
|
-
|
|
51286
|
-
|
|
51287
|
-
|
|
51288
|
-
}
|
|
51289
|
-
|
|
51290
|
-
|
|
51291
|
-
|
|
51292
|
-
|
|
51293
|
-
|
|
51294
|
-
|
|
51295
|
-
|
|
51323
|
+
const curStatus = String(await nexus.execute({ action: "status" }) ?? "");
|
|
51324
|
+
if (/Connected:\s*true/i.test(curStatus)) {
|
|
51325
|
+
daemonReady = true;
|
|
51326
|
+
renderInfo("Using existing nexus daemon connection.");
|
|
51327
|
+
} else if (curStatus.includes("not running")) {
|
|
51328
|
+
renderInfo("Starting nexus daemon...");
|
|
51329
|
+
await nexus.execute({ action: "connect" });
|
|
51330
|
+
for (let wait = 0; wait < 25; wait++) {
|
|
51331
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
51332
|
+
try {
|
|
51333
|
+
const status = String(await nexus.execute({ action: "status" }) ?? "");
|
|
51334
|
+
if (/Connected:\s*true/i.test(status)) {
|
|
51335
|
+
daemonReady = true;
|
|
51336
|
+
renderInfo("Nexus daemon ready.");
|
|
51337
|
+
break;
|
|
51338
|
+
}
|
|
51339
|
+
} catch {
|
|
51340
|
+
}
|
|
51341
|
+
}
|
|
51342
|
+
if (!daemonReady)
|
|
51343
|
+
renderWarning("Nexus daemon did not become ready in 25s. P2P may fail.");
|
|
51344
|
+
} else {
|
|
51345
|
+
renderInfo("Waiting for nexus daemon to finish connecting...");
|
|
51346
|
+
for (let wait = 0; wait < 15; wait++) {
|
|
51347
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
51348
|
+
const s = String(await nexus.execute({ action: "status" }) ?? "");
|
|
51349
|
+
if (/Connected:\s*true/i.test(s)) {
|
|
51296
51350
|
daemonReady = true;
|
|
51297
|
-
renderInfo("Nexus daemon ready.");
|
|
51298
51351
|
break;
|
|
51299
51352
|
}
|
|
51300
|
-
} catch {
|
|
51301
51353
|
}
|
|
51354
|
+
if (daemonReady)
|
|
51355
|
+
renderInfo("Nexus daemon ready.");
|
|
51356
|
+
else
|
|
51357
|
+
renderWarning("Nexus daemon still connecting \u2014 P2P may be delayed.");
|
|
51302
51358
|
}
|
|
51303
|
-
if (!daemonReady)
|
|
51304
|
-
renderWarning("Nexus daemon did not become ready in 15s. P2P may fail.");
|
|
51305
51359
|
} catch (err) {
|
|
51306
51360
|
renderWarning(`Nexus connect: ${err instanceof Error ? err.message : String(err)}`);
|
|
51307
51361
|
}
|
|
@@ -51327,8 +51381,7 @@ Clone a new voice: /voice clone <wav-file> [name]`);
|
|
|
51327
51381
|
const sponsorUrl = tunnelGw?.tunnelUrl || "";
|
|
51328
51382
|
if (!sponsorUrl) {
|
|
51329
51383
|
renderWarning("No tunnel URL available \u2014 sponsor not registered in directory. Start with cloudflared or libp2p first.");
|
|
51330
|
-
|
|
51331
|
-
return;
|
|
51384
|
+
return false;
|
|
51332
51385
|
}
|
|
51333
51386
|
let sponsorName = (config.header.message || "").replace(/^\/+/, "").trim();
|
|
51334
51387
|
if (!sponsorName || sponsorName.length < 2) {
|
package/package.json
CHANGED