open-agents-ai 0.184.92 → 0.184.93
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 +24 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66329,8 +66329,26 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66329
66329
|
if (spResp.ok) {
|
|
66330
66330
|
const spData = await spResp.json();
|
|
66331
66331
|
const active = (spData.sponsors || []).filter((s) => s.status === "active" && s.tunnelUrl);
|
|
66332
|
-
|
|
66333
|
-
|
|
66332
|
+
const tunnelSponsors = active.filter((s) => /trycloudflare\.com/i.test(s.tunnelUrl));
|
|
66333
|
+
const directSponsors = active.filter((s) => !/trycloudflare\.com/i.test(s.tunnelUrl));
|
|
66334
|
+
const sorted = [...tunnelSponsors, ...directSponsors];
|
|
66335
|
+
let best = null;
|
|
66336
|
+
for (const sponsor of sorted) {
|
|
66337
|
+
try {
|
|
66338
|
+
const baseUrl = normalizeBaseUrl(sponsor.tunnelUrl);
|
|
66339
|
+
const testUrl = baseUrl + "/v1/models";
|
|
66340
|
+
const headers = {};
|
|
66341
|
+
if (sponsor.authKey)
|
|
66342
|
+
headers["Authorization"] = `Bearer ${sponsor.authKey}`;
|
|
66343
|
+
const probe = await fetch(testUrl, { headers, signal: AbortSignal.timeout(5e3) });
|
|
66344
|
+
if (probe.ok) {
|
|
66345
|
+
best = sponsor;
|
|
66346
|
+
break;
|
|
66347
|
+
}
|
|
66348
|
+
} catch {
|
|
66349
|
+
}
|
|
66350
|
+
}
|
|
66351
|
+
if (best) {
|
|
66334
66352
|
writeContent(() => {
|
|
66335
66353
|
renderInfo(`No local Ollama detected. Auto-connecting to sponsored inference: ${best.name}`);
|
|
66336
66354
|
renderInfo(`Endpoint: ${best.tunnelUrl}`);
|
|
@@ -66340,6 +66358,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66340
66358
|
currentConfig.backendUrl = best.tunnelUrl;
|
|
66341
66359
|
currentConfig.apiKey = best.authKey;
|
|
66342
66360
|
currentConfig.backendType = "openai";
|
|
66361
|
+
} else if (active.length > 0) {
|
|
66362
|
+
writeContent(() => {
|
|
66363
|
+
renderInfo(`No local Ollama and no reachable sponsors. Use /endpoint to configure.`);
|
|
66364
|
+
});
|
|
66343
66365
|
}
|
|
66344
66366
|
}
|
|
66345
66367
|
} catch {
|
package/package.json
CHANGED