open-agents-ai 0.185.17 → 0.185.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 +37 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48556,6 +48556,22 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48556
48556
|
}
|
|
48557
48557
|
if (orphansKilled > 0)
|
|
48558
48558
|
renderInfo(`Killed ${orphansKilled} orphaned cloudflared process(es).`);
|
|
48559
|
+
try {
|
|
48560
|
+
const retirePayload = {
|
|
48561
|
+
name: existingConfig.header?.message || "unknown",
|
|
48562
|
+
status: "inactive",
|
|
48563
|
+
tunnelUrl: ""
|
|
48564
|
+
};
|
|
48565
|
+
await fetch("https://openagents.nexus/api/v1/sponsors", {
|
|
48566
|
+
method: "POST",
|
|
48567
|
+
headers: { "Content-Type": "application/json" },
|
|
48568
|
+
body: JSON.stringify(retirePayload),
|
|
48569
|
+
signal: AbortSignal.timeout(5e3)
|
|
48570
|
+
});
|
|
48571
|
+
renderInfo("Sponsor directory notified (marked inactive).");
|
|
48572
|
+
} catch {
|
|
48573
|
+
renderWarning("Could not notify sponsor directory \u2014 entry may remain until it expires.");
|
|
48574
|
+
}
|
|
48559
48575
|
renderInfo("Sponsorship removed.");
|
|
48560
48576
|
return "handled";
|
|
48561
48577
|
}
|
|
@@ -48596,9 +48612,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48596
48612
|
const existingGateway = ctx.getExposeGateway?.();
|
|
48597
48613
|
const managedPid = existingGateway?._cloudflaredPid || null;
|
|
48598
48614
|
if (!existingGateway?.isActive) {
|
|
48599
|
-
const
|
|
48615
|
+
const staleOrphans2 = findPidsByPattern("cloudflared tunnel --url http").filter((p) => p !== managedPid);
|
|
48600
48616
|
let cleanedUp = 0;
|
|
48601
|
-
for (const pid of
|
|
48617
|
+
for (const pid of staleOrphans2) {
|
|
48602
48618
|
if (killPid(pid))
|
|
48603
48619
|
cleanedUp++;
|
|
48604
48620
|
}
|
|
@@ -48609,6 +48625,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48609
48625
|
}
|
|
48610
48626
|
const tunnelAlreadyActive = existingGateway?.isActive && existingGateway?.tunnelUrl;
|
|
48611
48627
|
const p2pAlreadyActive = ctx.isExposeActive?.() && !existingGateway?.tunnelUrl;
|
|
48628
|
+
const staleOrphans = findPidsByPattern("cloudflared tunnel --url http");
|
|
48629
|
+
for (const pid of staleOrphans)
|
|
48630
|
+
killPid(pid);
|
|
48612
48631
|
if (config.transport.cloudflared && ctx.exposeStart) {
|
|
48613
48632
|
if (tunnelAlreadyActive) {
|
|
48614
48633
|
renderInfo(`Tunnel already active: ${existingGateway.tunnelUrl}`);
|
|
@@ -48636,6 +48655,11 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48636
48655
|
let daemonReady = false;
|
|
48637
48656
|
try {
|
|
48638
48657
|
const nexus = new NexusTool(projectDir);
|
|
48658
|
+
try {
|
|
48659
|
+
await nexus.execute({ action: "disconnect" });
|
|
48660
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
48661
|
+
} catch {
|
|
48662
|
+
}
|
|
48639
48663
|
renderInfo("Starting nexus daemon...");
|
|
48640
48664
|
await nexus.execute({ action: "connect" });
|
|
48641
48665
|
for (let wait = 0; wait < 15; wait++) {
|
|
@@ -48677,6 +48701,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48677
48701
|
const sponsorUrl = tunnelGw?.tunnelUrl || "";
|
|
48678
48702
|
if (!sponsorUrl) {
|
|
48679
48703
|
renderWarning("No tunnel URL available \u2014 sponsor not registered in directory. Start with cloudflared or libp2p first.");
|
|
48704
|
+
renderInfo("Sponsor wizard completed (offline mode \u2014 no public endpoint).");
|
|
48705
|
+
return;
|
|
48680
48706
|
}
|
|
48681
48707
|
let sponsorName = (config.header.message || "").replace(/^\/+/, "").trim();
|
|
48682
48708
|
if (!sponsorName || sponsorName.length < 2) {
|
|
@@ -50604,9 +50630,7 @@ async function handleEndpoint(arg, ctx, local = false) {
|
|
|
50604
50630
|
}
|
|
50605
50631
|
}
|
|
50606
50632
|
async function handleSponsoredEndpoint(ctx, local) {
|
|
50607
|
-
|
|
50608
|
-
${c2.dim("Scanning for sponsored inference endpoints...")}
|
|
50609
|
-
`);
|
|
50633
|
+
renderInfo("Scanning for sponsored inference endpoints...");
|
|
50610
50634
|
const sponsors = [];
|
|
50611
50635
|
let nexusTool = null;
|
|
50612
50636
|
try {
|
|
@@ -50618,16 +50642,13 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
50618
50642
|
const statusResult = String(await nexusTool.execute({ action: "status" }) ?? "");
|
|
50619
50643
|
const isConnected = /Connected:\s*true/i.test(statusResult) || statusResult.includes("Daemon running");
|
|
50620
50644
|
if (isConnected) {
|
|
50621
|
-
|
|
50622
|
-
`);
|
|
50645
|
+
renderInfo("Using existing nexus connection...");
|
|
50623
50646
|
} else {
|
|
50624
|
-
|
|
50625
|
-
`);
|
|
50647
|
+
renderInfo("Starting nexus daemon...");
|
|
50626
50648
|
await nexusTool.execute({ action: "connect" });
|
|
50627
50649
|
await new Promise((r) => setTimeout(r, 3e3));
|
|
50628
50650
|
}
|
|
50629
|
-
|
|
50630
|
-
`);
|
|
50651
|
+
renderInfo("Querying sponsors on the mesh...");
|
|
50631
50652
|
const discoverResult = await nexusTool.execute({
|
|
50632
50653
|
action: "sponsor_discover",
|
|
50633
50654
|
timeout_ms: "5000"
|
|
@@ -50657,15 +50678,13 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
50657
50678
|
});
|
|
50658
50679
|
}
|
|
50659
50680
|
if (nexusSponsors.length > 0) {
|
|
50660
|
-
|
|
50661
|
-
`);
|
|
50681
|
+
renderInfo(`Found ${nexusSponsors.length} sponsor(s) on nexus mesh`);
|
|
50662
50682
|
}
|
|
50663
50683
|
} catch {
|
|
50664
50684
|
}
|
|
50665
50685
|
}
|
|
50666
50686
|
} catch (nexusErr) {
|
|
50667
|
-
|
|
50668
|
-
`);
|
|
50687
|
+
renderInfo(`Nexus unavailable: ${(nexusErr instanceof Error ? nexusErr.message : String(nexusErr)).slice(0, 60)}`);
|
|
50669
50688
|
}
|
|
50670
50689
|
}
|
|
50671
50690
|
const gateway = ctx.getExposeGateway?.();
|
|
@@ -50716,8 +50735,7 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
50716
50735
|
kvAdded++;
|
|
50717
50736
|
}
|
|
50718
50737
|
if (kvAdded > 0) {
|
|
50719
|
-
|
|
50720
|
-
`);
|
|
50738
|
+
renderInfo(`Found ${kvAdded} sponsor(s) in directory`);
|
|
50721
50739
|
}
|
|
50722
50740
|
}
|
|
50723
50741
|
} catch {
|
|
@@ -50748,8 +50766,7 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
50748
50766
|
sponsors.length = 0;
|
|
50749
50767
|
sponsors.push(...deduped);
|
|
50750
50768
|
if (sponsors.length > 0) {
|
|
50751
|
-
|
|
50752
|
-
`);
|
|
50769
|
+
renderInfo(`Verifying ${sponsors.length} sponsor(s)...`);
|
|
50753
50770
|
const probeResults = await Promise.all(sponsors.map(async (sp) => {
|
|
50754
50771
|
if (!sp.url)
|
|
50755
50772
|
return true;
|
|
@@ -50771,8 +50788,7 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
50771
50788
|
const staleCount = probeResults.filter((ok) => !ok).length;
|
|
50772
50789
|
const verified = sponsors.filter((_, i) => probeResults[i]);
|
|
50773
50790
|
if (staleCount > 0) {
|
|
50774
|
-
|
|
50775
|
-
`);
|
|
50791
|
+
renderInfo(`${staleCount} stale sponsor(s) hidden (unreachable)`);
|
|
50776
50792
|
}
|
|
50777
50793
|
sponsors.length = 0;
|
|
50778
50794
|
sponsors.push(...verified);
|
package/package.json
CHANGED