open-agents-ai 0.184.26 → 0.184.28

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.
Files changed (2) hide show
  1. package/dist/index.js +98 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -48230,29 +48230,53 @@ async function handleSlashCommand(input, ctx) {
48230
48230
  if (activeGw && "setSponsorLimits" in activeGw) {
48231
48231
  activeGw.setSponsorLimits(config.rateLimits);
48232
48232
  }
48233
+ const tunnelGw = ctx.getExposeGateway?.();
48234
+ const enabledEps = config.endpoints.filter((e) => e.enabled);
48235
+ const allModels = enabledEps.flatMap((e) => e.models || []);
48236
+ const sponsorPayload = {
48237
+ peerId: tunnelGw?.peerId || tunnelGw?.tunnelUrl || `oa-${Date.now()}`,
48238
+ name: config.header.message || "OA Sponsor",
48239
+ models: allModels,
48240
+ tunnelUrl: tunnelGw?.tunnelUrl || "",
48241
+ authKey: tunnelGw?.authKey || "",
48242
+ limits: {
48243
+ maxRequestsPerMinute: config.rateLimits.maxRequestsPerMinute,
48244
+ maxTokensPerDay: config.rateLimits.maxTokensPerDay
48245
+ },
48246
+ banner: config.banner.preset,
48247
+ message: config.header.message,
48248
+ linkUrl: config.header.linkUrl,
48249
+ linkText: config.header.linkText,
48250
+ status: "active"
48251
+ };
48252
+ try {
48253
+ const kvResp = await fetch("https://openagents.nexus/api/v1/sponsors", {
48254
+ method: "POST",
48255
+ headers: { "Content-Type": "application/json" },
48256
+ body: JSON.stringify(sponsorPayload),
48257
+ signal: AbortSignal.timeout(1e4)
48258
+ });
48259
+ const kvResult = await kvResp.json();
48260
+ if (kvResult.persisted) {
48261
+ renderInfo("Registered in sponsor directory \u2014 consumers can discover you via /endpoint sponsor");
48262
+ } else {
48263
+ renderWarning(`Sponsor directory: ${kvResult.reason || "not persisted"}`);
48264
+ }
48265
+ } catch (kvErr) {
48266
+ renderWarning(`Sponsor directory unreachable: ${kvErr instanceof Error ? kvErr.message : String(kvErr)}`);
48267
+ }
48233
48268
  try {
48234
48269
  const nexus = new NexusTool(projectDir);
48235
- try {
48236
- await nexus.execute({ action: "connect" });
48237
- } catch {
48270
+ const statusCheck = String(await nexus.execute({ action: "status" }) ?? "");
48271
+ if (/Connected:\s*true/i.test(statusCheck)) {
48272
+ await nexus.execute({
48273
+ action: "sponsor_announce",
48274
+ ...Object.fromEntries(Object.entries(sponsorPayload).map(([k, v]) => [
48275
+ k === "tunnelUrl" ? "tunnel_url" : k === "authKey" ? "auth_key" : k === "linkUrl" ? "link_url" : k === "linkText" ? "link_text" : k,
48276
+ Array.isArray(v) ? v.join(",") : String(v)
48277
+ ]))
48278
+ });
48238
48279
  }
48239
- const tunnelGw = ctx.getExposeGateway?.();
48240
- const enabledEps = config.endpoints.filter((e) => e.enabled);
48241
- const allModels = enabledEps.flatMap((e) => e.models || []);
48242
- await nexus.execute({
48243
- action: "sponsor_announce",
48244
- name: config.header.message || "OA Sponsor",
48245
- models: allModels.join(","),
48246
- tunnel_url: tunnelGw?.tunnelUrl || "",
48247
- auth_key: tunnelGw?.authKey || "",
48248
- rpm: String(config.rateLimits.maxRequestsPerMinute),
48249
- tpd: String(config.rateLimits.maxTokensPerDay),
48250
- banner: config.banner.preset,
48251
- message: config.header.message,
48252
- link_url: config.header.linkUrl,
48253
- link_text: config.header.linkText
48254
- });
48255
- renderInfo("Announced on nexus P2P mesh \u2014 other users can discover you via /endpoint sponsor");
48256
48280
  } catch {
48257
48281
  }
48258
48282
  }
@@ -63723,6 +63747,60 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
63723
63747
  }
63724
63748
  } catch {
63725
63749
  }
63750
+ try {
63751
+ const { homedir: _hd } = await import("node:os");
63752
+ const globalNamePath = join67(_hd(), ".open-agents", "agent-name");
63753
+ let agName = "oa-node";
63754
+ try {
63755
+ if (existsSync50(globalNamePath))
63756
+ agName = readFileSync39(globalNamePath, "utf8").trim() || agName;
63757
+ } catch {
63758
+ }
63759
+ fetch("https://openagents.nexus/api/v1/directory", {
63760
+ method: "POST",
63761
+ headers: { "Content-Type": "application/json" },
63762
+ body: JSON.stringify({
63763
+ peerId: agName + "-" + Date.now(),
63764
+ agentName: agName,
63765
+ multiaddrs: [],
63766
+ rooms: []
63767
+ }),
63768
+ signal: AbortSignal.timeout(5e3)
63769
+ }).catch(() => {
63770
+ });
63771
+ const isDefaultOllama = currentConfig.backendUrl === "http://127.0.0.1:11434" || currentConfig.backendUrl === "http://localhost:11434";
63772
+ if (isDefaultOllama) {
63773
+ let ollamaAlive = false;
63774
+ try {
63775
+ const probe = await fetch(`${currentConfig.backendUrl}/api/tags`, { signal: AbortSignal.timeout(3e3) });
63776
+ ollamaAlive = probe.ok;
63777
+ } catch {
63778
+ }
63779
+ if (!ollamaAlive) {
63780
+ try {
63781
+ const spResp = await fetch("https://openagents.nexus/api/v1/sponsors", { signal: AbortSignal.timeout(5e3) });
63782
+ if (spResp.ok) {
63783
+ const spData = await spResp.json();
63784
+ const active = (spData.sponsors || []).filter((s) => s.status === "active" && s.tunnelUrl);
63785
+ if (active.length > 0) {
63786
+ const best = active[0];
63787
+ writeContent(() => {
63788
+ renderInfo(`No local Ollama detected. Auto-connecting to sponsored inference: ${best.name}`);
63789
+ renderInfo(`Endpoint: ${best.tunnelUrl}`);
63790
+ renderInfo(`Models: ${best.models?.slice(0, 3).join(", ") || "available"}`);
63791
+ renderInfo(`Change anytime: /endpoint or /endpoint sponsor`);
63792
+ });
63793
+ currentConfig.backendUrl = best.tunnelUrl;
63794
+ currentConfig.apiKey = best.authKey;
63795
+ currentConfig.backendType = "openai";
63796
+ }
63797
+ }
63798
+ } catch {
63799
+ }
63800
+ }
63801
+ }
63802
+ } catch {
63803
+ }
63726
63804
  })().catch(() => {
63727
63805
  });
63728
63806
  let passwordShowPlain = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.184.26",
3
+ "version": "0.184.28",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) \u2014 interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",