open-agents-ai 0.184.8 → 0.184.9
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 +18 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49185,8 +49185,9 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49185
49185
|
sponsors.push({
|
|
49186
49186
|
name: ns.name || "Unknown Sponsor",
|
|
49187
49187
|
url: ns.tunnelUrl || "",
|
|
49188
|
+
peerId: ns.peerId || void 0,
|
|
49188
49189
|
authKey: ns.authKey || "",
|
|
49189
|
-
models: ns.models ||
|
|
49190
|
+
models: Array.isArray(ns.models) ? ns.models : (ns.models || "").split(",").filter(Boolean),
|
|
49190
49191
|
limits: {
|
|
49191
49192
|
rpm: ns.limits?.maxRequestsPerMinute || 60,
|
|
49192
49193
|
tpd: ns.limits?.maxTokensPerDay || 1e5
|
|
@@ -49247,9 +49248,10 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49247
49248
|
];
|
|
49248
49249
|
for (const sp of sponsors) {
|
|
49249
49250
|
const modelList = sp.models.length > 0 ? sp.models.slice(0, 3).join(", ") + (sp.models.length > 3 ? ` +${sp.models.length - 3}` : "") : "probing...";
|
|
49251
|
+
const transport = sp.url ? "tunnel" : sp.peerId ? "p2p" : "?";
|
|
49250
49252
|
items.push({
|
|
49251
|
-
key: sp.url,
|
|
49252
|
-
label: ` ${sp.name} (${sp.source})`,
|
|
49253
|
+
key: sp.url || sp.peerId || sp.name,
|
|
49254
|
+
label: ` ${sp.name} (${sp.source}, ${transport})`,
|
|
49253
49255
|
detail: ` Models: ${modelList} | ${sp.limits.rpm} req/min, ${sp.limits.tpd >= 1e3 ? (sp.limits.tpd / 1e3).toFixed(0) + "K" : sp.limits.tpd} tokens/day`
|
|
49254
49256
|
});
|
|
49255
49257
|
}
|
|
@@ -49277,15 +49279,24 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
49277
49279
|
renderInfo("Use: /endpoint <tunnel-url> --auth <key>");
|
|
49278
49280
|
return;
|
|
49279
49281
|
}
|
|
49280
|
-
const
|
|
49282
|
+
const selectedKey = result.key;
|
|
49283
|
+
const selected = sponsors.find((s) => (s.url || s.peerId || s.name) === selectedKey);
|
|
49281
49284
|
if (!selected)
|
|
49282
49285
|
return;
|
|
49283
|
-
|
|
49284
|
-
|
|
49286
|
+
if (selected.url && selected.url.startsWith("http")) {
|
|
49287
|
+
const endpointArg = selected.authKey ? `${selected.url} --auth ${selected.authKey}` : selected.url;
|
|
49288
|
+
await handleEndpoint(endpointArg, ctx, local);
|
|
49289
|
+
} else if (selected.peerId) {
|
|
49290
|
+
await handlePeerEndpoint(selected.peerId, selected.authKey || void 0, ctx, local);
|
|
49291
|
+
} else {
|
|
49292
|
+
renderError("Sponsor has no reachable endpoint (no tunnel URL or peer ID).");
|
|
49293
|
+
return;
|
|
49294
|
+
}
|
|
49295
|
+
const saveKey = selected.url || selected.peerId || selected.name;
|
|
49285
49296
|
try {
|
|
49286
49297
|
mkdirSync18(sponsorDir2, { recursive: true });
|
|
49287
49298
|
const existing = existsSync42(knownFile) ? JSON.parse(readFileSync31(knownFile, "utf8")) : [];
|
|
49288
|
-
const updated = existing.filter((s) => s.url
|
|
49299
|
+
const updated = existing.filter((s) => (s.url || s.peerId || s.name) !== saveKey);
|
|
49289
49300
|
updated.push(selected);
|
|
49290
49301
|
writeFileSync19(knownFile, JSON.stringify(updated, null, 2), "utf8");
|
|
49291
49302
|
} catch {
|
package/package.json
CHANGED