open-agents-ai 0.186.15 → 0.186.16
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 +19 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71731,10 +71731,25 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
71731
71731
|
}
|
|
71732
71732
|
if (!ollamaAlive) {
|
|
71733
71733
|
try {
|
|
71734
|
-
const
|
|
71734
|
+
const savedSponsorsPath = join75(repoRoot, ".oa", "sponsor", "known-sponsors.json");
|
|
71735
|
+
let savedSponsors = [];
|
|
71736
|
+
try {
|
|
71737
|
+
if (existsSync58(savedSponsorsPath)) {
|
|
71738
|
+
savedSponsors = JSON.parse(readFileSync47(savedSponsorsPath, "utf8"));
|
|
71739
|
+
const oneHourAgo = Date.now() - 36e5;
|
|
71740
|
+
savedSponsors = savedSponsors.filter((s) => (s.lastVerified || 0) > oneHourAgo);
|
|
71741
|
+
}
|
|
71742
|
+
} catch {
|
|
71743
|
+
}
|
|
71744
|
+
const spResp = await fetch("https://openagents.nexus/api/v1/sponsors", { signal: AbortSignal.timeout(8e3) });
|
|
71735
71745
|
if (spResp.ok) {
|
|
71736
71746
|
const spData = await spResp.json();
|
|
71737
|
-
|
|
71747
|
+
let active = (spData.sponsors || []).filter((s) => s.status === "active" && s.tunnelUrl);
|
|
71748
|
+
for (const saved of savedSponsors) {
|
|
71749
|
+
if (saved.tunnelUrl && !active.some((a) => a.tunnelUrl === saved.tunnelUrl || a.name === saved.name)) {
|
|
71750
|
+
active.push({ ...saved, status: "active" });
|
|
71751
|
+
}
|
|
71752
|
+
}
|
|
71738
71753
|
const tunnelSponsors = active.filter((s) => /trycloudflare\.com/i.test(s.tunnelUrl));
|
|
71739
71754
|
const directSponsors = active.filter((s) => !/trycloudflare\.com/i.test(s.tunnelUrl));
|
|
71740
71755
|
const sorted = [...tunnelSponsors, ...directSponsors];
|
|
@@ -71747,13 +71762,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
71747
71762
|
const headers = {};
|
|
71748
71763
|
if (sponsor.authKey)
|
|
71749
71764
|
headers["Authorization"] = `Bearer ${sponsor.authKey}`;
|
|
71750
|
-
const probe = await fetch(testUrl, { headers, signal: AbortSignal.timeout(
|
|
71765
|
+
const probe = await fetch(testUrl, { headers, signal: AbortSignal.timeout(15e3) });
|
|
71751
71766
|
if (probe.ok) {
|
|
71752
71767
|
best = sponsor;
|
|
71753
71768
|
break;
|
|
71754
71769
|
}
|
|
71755
71770
|
if (probe.status === 401 && sponsor.authKey) {
|
|
71756
|
-
const noAuthProbe = await fetch(testUrl, { signal: AbortSignal.timeout(
|
|
71771
|
+
const noAuthProbe = await fetch(testUrl, { signal: AbortSignal.timeout(1e4) });
|
|
71757
71772
|
if (noAuthProbe.ok) {
|
|
71758
71773
|
best = sponsor;
|
|
71759
71774
|
bestNoAuth = true;
|
package/package.json
CHANGED