open-agents-ai 0.184.28 → 0.184.29
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 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48233,21 +48233,38 @@ async function handleSlashCommand(input, ctx) {
|
|
|
48233
48233
|
const tunnelGw = ctx.getExposeGateway?.();
|
|
48234
48234
|
const enabledEps = config.endpoints.filter((e) => e.enabled);
|
|
48235
48235
|
const allModels = enabledEps.flatMap((e) => e.models || []);
|
|
48236
|
+
const sponsorUrl = tunnelGw?.tunnelUrl || "";
|
|
48237
|
+
if (!sponsorUrl) {
|
|
48238
|
+
renderWarning("No tunnel URL available \u2014 sponsor not registered in directory. Start with cloudflared or libp2p first.");
|
|
48239
|
+
}
|
|
48240
|
+
let sponsorName = (config.header.message || "").replace(/^\/+/, "").trim();
|
|
48241
|
+
if (!sponsorName || sponsorName.length < 2) {
|
|
48242
|
+
try {
|
|
48243
|
+
const { homedir: homedir19 } = __require("os");
|
|
48244
|
+
const namePath = __require("path").join(homedir19(), ".open-agents", "agent-name");
|
|
48245
|
+
if (existsSync42(namePath))
|
|
48246
|
+
sponsorName = readFileSync31(namePath, "utf8").trim();
|
|
48247
|
+
} catch {
|
|
48248
|
+
}
|
|
48249
|
+
if (!sponsorName)
|
|
48250
|
+
sponsorName = "OA Sponsor";
|
|
48251
|
+
}
|
|
48236
48252
|
const sponsorPayload = {
|
|
48237
|
-
peerId: tunnelGw?.peerId ||
|
|
48238
|
-
name:
|
|
48253
|
+
peerId: tunnelGw?.peerId || sponsorUrl || `oa-${Date.now()}`,
|
|
48254
|
+
name: sponsorName,
|
|
48239
48255
|
models: allModels,
|
|
48240
|
-
tunnelUrl:
|
|
48256
|
+
tunnelUrl: sponsorUrl,
|
|
48241
48257
|
authKey: tunnelGw?.authKey || "",
|
|
48242
48258
|
limits: {
|
|
48243
48259
|
maxRequestsPerMinute: config.rateLimits.maxRequestsPerMinute,
|
|
48244
48260
|
maxTokensPerDay: config.rateLimits.maxTokensPerDay
|
|
48245
48261
|
},
|
|
48246
48262
|
banner: config.banner.preset,
|
|
48247
|
-
message: config.header.message,
|
|
48263
|
+
message: config.header.message || sponsorName,
|
|
48248
48264
|
linkUrl: config.header.linkUrl,
|
|
48249
48265
|
linkText: config.header.linkText,
|
|
48250
|
-
status: "active"
|
|
48266
|
+
status: sponsorUrl ? "active" : "inactive"
|
|
48267
|
+
// don't register without a URL
|
|
48251
48268
|
};
|
|
48252
48269
|
try {
|
|
48253
48270
|
const kvResp = await fetch("https://openagents.nexus/api/v1/sponsors", {
|
package/package.json
CHANGED