open-agents-ai 0.186.34 → 0.186.35
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 +22 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49420,6 +49420,10 @@ function startSponsorHeartbeat(payload, getExposeGateway) {
|
|
|
49420
49420
|
if (gw.tunnelUrl && gw.tunnelUrl !== _lastRegisteredSponsorPayload.tunnelUrl) {
|
|
49421
49421
|
_lastRegisteredSponsorPayload.tunnelUrl = gw.tunnelUrl;
|
|
49422
49422
|
}
|
|
49423
|
+
if (gw.peerId && (!_lastRegisteredSponsorPayload.peerId || _lastRegisteredSponsorPayload.peerId === "unknown" || String(_lastRegisteredSponsorPayload.peerId).startsWith("oa-"))) {
|
|
49424
|
+
_lastRegisteredSponsorPayload.peerId = gw.peerId;
|
|
49425
|
+
_lastRegisteredSponsorPayload.libp2pPeerId = gw.peerId;
|
|
49426
|
+
}
|
|
49423
49427
|
if (gw.models && Array.isArray(gw.models)) {
|
|
49424
49428
|
_lastRegisteredSponsorPayload.models = gw.models;
|
|
49425
49429
|
}
|
|
@@ -49427,8 +49431,24 @@ function startSponsorHeartbeat(payload, getExposeGateway) {
|
|
|
49427
49431
|
}
|
|
49428
49432
|
} catch {
|
|
49429
49433
|
}
|
|
49430
|
-
if (!_lastRegisteredSponsorPayload.
|
|
49431
|
-
|
|
49434
|
+
if (!_lastRegisteredSponsorPayload.peerId || _lastRegisteredSponsorPayload.peerId === "unknown" || String(_lastRegisteredSponsorPayload.peerId).startsWith("oa-")) {
|
|
49435
|
+
try {
|
|
49436
|
+
const { existsSync: _fe, readFileSync: _rf } = __require("node:fs");
|
|
49437
|
+
const { join: _pj } = __require("node:path");
|
|
49438
|
+
for (const base of [process.cwd(), __require("node:os").homedir() + "/.open-agents"]) {
|
|
49439
|
+
const sf = _pj(base, ".oa", "nexus", "status.json");
|
|
49440
|
+
if (_fe(sf)) {
|
|
49441
|
+
const st = JSON.parse(_rf(sf, "utf8"));
|
|
49442
|
+
if (st.connected && st.peerId && st.peerId.startsWith("12D3KooW")) {
|
|
49443
|
+
_lastRegisteredSponsorPayload.peerId = st.peerId;
|
|
49444
|
+
_lastRegisteredSponsorPayload.libp2pPeerId = st.peerId;
|
|
49445
|
+
break;
|
|
49446
|
+
}
|
|
49447
|
+
}
|
|
49448
|
+
}
|
|
49449
|
+
} catch {
|
|
49450
|
+
}
|
|
49451
|
+
}
|
|
49432
49452
|
try {
|
|
49433
49453
|
await fetch("https://openagents.nexus/api/v1/sponsors", {
|
|
49434
49454
|
method: "POST",
|
package/package.json
CHANGED