open-agents-ai 0.186.17 → 0.186.18

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 +62 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49313,18 +49313,26 @@ import { join as join60 } from "node:path";
49313
49313
  function startSponsorHeartbeat(payload, getExposeGateway) {
49314
49314
  stopSponsorHeartbeat();
49315
49315
  _lastRegisteredSponsorPayload = { ...payload };
49316
+ const _stableGetGateway = getExposeGateway;
49316
49317
  const HEARTBEAT_MS = 5 * 60 * 1e3;
49317
49318
  _sponsorHeartbeatTimer = setInterval(async () => {
49318
49319
  if (!_lastRegisteredSponsorPayload)
49319
49320
  return;
49320
49321
  try {
49321
- const gw = getExposeGateway?.();
49322
- if (gw && gw.tunnelUrl && gw.tunnelUrl !== _lastRegisteredSponsorPayload.tunnelUrl) {
49323
- _lastRegisteredSponsorPayload.tunnelUrl = gw.tunnelUrl;
49322
+ const gw = _stableGetGateway?.();
49323
+ if (gw) {
49324
+ if (gw.tunnelUrl && gw.tunnelUrl !== _lastRegisteredSponsorPayload.tunnelUrl) {
49325
+ _lastRegisteredSponsorPayload.tunnelUrl = gw.tunnelUrl;
49326
+ }
49327
+ if (gw.models && Array.isArray(gw.models)) {
49328
+ _lastRegisteredSponsorPayload.models = gw.models;
49329
+ }
49324
49330
  _lastRegisteredSponsorPayload.status = "active";
49325
49331
  }
49326
49332
  } catch {
49327
49333
  }
49334
+ if (!_lastRegisteredSponsorPayload.tunnelUrl)
49335
+ return;
49328
49336
  try {
49329
49337
  await fetch("https://openagents.nexus/api/v1/sponsors", {
49330
49338
  method: "POST",
@@ -51110,6 +51118,15 @@ Clone a new voice: /voice clone <wav-file> [name]`);
51110
51118
  if (pauseGw && "setSponsorLimits" in pauseGw) {
51111
51119
  pauseGw.setSponsorLimits({ maxRequestsPerMinute: 0, maxTokensPerDay: 0, maxConcurrent: 0, allowedModels: [] });
51112
51120
  }
51121
+ try {
51122
+ await fetch("https://openagents.nexus/api/v1/sponsors", {
51123
+ method: "POST",
51124
+ headers: { "Content-Type": "application/json" },
51125
+ body: JSON.stringify({ name: existingConfig.header?.message || "unknown", status: "inactive", tunnelUrl: pauseGw?.tunnelUrl || "" }),
51126
+ signal: AbortSignal.timeout(5e3)
51127
+ });
51128
+ } catch {
51129
+ }
51113
51130
  renderInfo("Sponsorship paused. Tunnel still alive for quick resume.");
51114
51131
  renderInfo("/sponsor to resume, /sponsor remove to fully stop.");
51115
51132
  return "handled";
@@ -51165,13 +51182,44 @@ Clone a new voice: /voice clone <wav-file> [name]`);
51165
51182
  case "pause":
51166
51183
  existingConfig.status = "paused";
51167
51184
  saveSponsorConfig2(projectDir, existingConfig);
51185
+ stopSponsorHeartbeat();
51186
+ try {
51187
+ await fetch("https://openagents.nexus/api/v1/sponsors", {
51188
+ method: "POST",
51189
+ headers: { "Content-Type": "application/json" },
51190
+ body: JSON.stringify({ name: existingConfig.header?.message || "unknown", status: "inactive" }),
51191
+ signal: AbortSignal.timeout(5e3)
51192
+ });
51193
+ } catch {
51194
+ }
51168
51195
  renderInfo("Sponsorship paused. /sponsor to resume.");
51169
51196
  return "handled";
51170
- case "resume":
51197
+ case "resume": {
51171
51198
  existingConfig.status = "active";
51172
51199
  saveSponsorConfig2(projectDir, existingConfig);
51173
- renderInfo("Sponsorship resumed.");
51200
+ const resumeGw = ctx.getExposeGateway?.();
51201
+ if (resumeGw?.tunnelUrl) {
51202
+ const resumePayload = {
51203
+ name: existingConfig.header?.message || "OA Sponsor",
51204
+ tunnelUrl: resumeGw.tunnelUrl,
51205
+ authKey: resumeGw.authKey || "",
51206
+ models: [],
51207
+ status: "active"
51208
+ };
51209
+ startSponsorHeartbeat(resumePayload, ctx.getExposeGateway);
51210
+ try {
51211
+ await fetch("https://openagents.nexus/api/v1/sponsors", {
51212
+ method: "POST",
51213
+ headers: { "Content-Type": "application/json" },
51214
+ body: JSON.stringify(resumePayload),
51215
+ signal: AbortSignal.timeout(5e3)
51216
+ });
51217
+ } catch {
51218
+ }
51219
+ }
51220
+ renderInfo("Sponsorship resumed. Heartbeat restarted.");
51174
51221
  return "handled";
51222
+ }
51175
51223
  case "remove":
51176
51224
  existingConfig.status = "inactive";
51177
51225
  saveSponsorConfig2(projectDir, existingConfig);
@@ -53352,9 +53400,14 @@ async function handleSponsoredEndpoint(ctx, local) {
53352
53400
  if (sp.authKey)
53353
53401
  headers["Authorization"] = `Bearer ${sp.authKey}`;
53354
53402
  const resp = await fetch(`${base}/v1/models`, { headers, signal: AbortSignal.timeout(15e3) });
53403
+ if (resp.status === 429 || resp.status === 503)
53404
+ return true;
53355
53405
  if (!resp.ok && sp.authKey) {
53356
- const noAuth = await fetch(`${base}/v1/models`, { signal: AbortSignal.timeout(1e4) });
53357
- return noAuth.ok;
53406
+ if (resp.status === 401) {
53407
+ const noAuth = await fetch(`${base}/v1/models`, { signal: AbortSignal.timeout(1e4) });
53408
+ return noAuth.ok || noAuth.status === 429 || noAuth.status === 503;
53409
+ }
53410
+ return false;
53358
53411
  }
53359
53412
  return resp.ok;
53360
53413
  } catch {
@@ -71800,13 +71853,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
71800
71853
  if (sponsor.authKey)
71801
71854
  headers["Authorization"] = `Bearer ${sponsor.authKey}`;
71802
71855
  const probe = await fetch(testUrl, { headers, signal: AbortSignal.timeout(15e3) });
71803
- if (probe.ok) {
71856
+ if (probe.ok || probe.status === 429 || probe.status === 503) {
71804
71857
  best = sponsor;
71805
71858
  break;
71806
71859
  }
71807
71860
  if (probe.status === 401 && sponsor.authKey) {
71808
71861
  const noAuthProbe = await fetch(testUrl, { signal: AbortSignal.timeout(1e4) });
71809
- if (noAuthProbe.ok) {
71862
+ if (noAuthProbe.ok || noAuthProbe.status === 429 || noAuthProbe.status === 503) {
71810
71863
  best = sponsor;
71811
71864
  bestNoAuth = true;
71812
71865
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.186.17",
3
+ "version": "0.186.18",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",