open-agents-ai 0.186.12 → 0.186.13

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 +51 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -49013,6 +49013,41 @@ import * as nodeOs from "node:os";
49013
49013
  import { execSync as nodeExecSync } from "node:child_process";
49014
49014
  import { existsSync as existsSync44, readFileSync as readFileSync33, writeFileSync as writeFileSync21, mkdirSync as mkdirSync20, readdirSync as readdirSync13, statSync as statSync15, rmSync } from "node:fs";
49015
49015
  import { join as join60 } from "node:path";
49016
+ function startSponsorHeartbeat(payload, getExposeGateway) {
49017
+ stopSponsorHeartbeat();
49018
+ _lastRegisteredSponsorPayload = { ...payload };
49019
+ const HEARTBEAT_MS = 5 * 60 * 1e3;
49020
+ _sponsorHeartbeatTimer = setInterval(async () => {
49021
+ if (!_lastRegisteredSponsorPayload)
49022
+ return;
49023
+ try {
49024
+ const gw = getExposeGateway?.();
49025
+ if (gw && gw.tunnelUrl && gw.tunnelUrl !== _lastRegisteredSponsorPayload.tunnelUrl) {
49026
+ _lastRegisteredSponsorPayload.tunnelUrl = gw.tunnelUrl;
49027
+ _lastRegisteredSponsorPayload.status = "active";
49028
+ }
49029
+ } catch {
49030
+ }
49031
+ try {
49032
+ await fetch("https://openagents.nexus/api/v1/sponsors", {
49033
+ method: "POST",
49034
+ headers: { "Content-Type": "application/json" },
49035
+ body: JSON.stringify(_lastRegisteredSponsorPayload),
49036
+ signal: AbortSignal.timeout(1e4)
49037
+ });
49038
+ } catch {
49039
+ }
49040
+ }, HEARTBEAT_MS);
49041
+ if (_sponsorHeartbeatTimer.unref)
49042
+ _sponsorHeartbeatTimer.unref();
49043
+ }
49044
+ function stopSponsorHeartbeat() {
49045
+ if (_sponsorHeartbeatTimer) {
49046
+ clearInterval(_sponsorHeartbeatTimer);
49047
+ _sponsorHeartbeatTimer = null;
49048
+ }
49049
+ _lastRegisteredSponsorPayload = null;
49050
+ }
49016
49051
  function safeLog(text) {
49017
49052
  if (isNeovimActive()) {
49018
49053
  writeToNeovimOutput(text + "\n");
@@ -50773,6 +50808,7 @@ Clone a new voice: /voice clone <wav-file> [name]`);
50773
50808
  if (arg === "pause" && existingConfig?.status === "active") {
50774
50809
  existingConfig.status = "paused";
50775
50810
  saveSponsorConfig2(projectDir, existingConfig);
50811
+ stopSponsorHeartbeat();
50776
50812
  const pauseGw = ctx.getExposeGateway?.();
50777
50813
  if (pauseGw && "setSponsorLimits" in pauseGw) {
50778
50814
  pauseGw.setSponsorLimits({ maxRequestsPerMinute: 0, maxTokensPerDay: 0, maxConcurrent: 0, allowedModels: [] });
@@ -50784,6 +50820,7 @@ Clone a new voice: /voice clone <wav-file> [name]`);
50784
50820
  if (arg === "remove" && existingConfig) {
50785
50821
  existingConfig.status = "inactive";
50786
50822
  saveSponsorConfig2(projectDir, existingConfig);
50823
+ stopSponsorHeartbeat();
50787
50824
  if (ctx.isExposeActive?.()) {
50788
50825
  try {
50789
50826
  await ctx.exposeStop?.();
@@ -51000,6 +51037,8 @@ Clone a new voice: /voice clone <wav-file> [name]`);
51000
51037
  const kvResult = await kvResp.json();
51001
51038
  if (kvResult.persisted) {
51002
51039
  renderInfo("Registered in sponsor directory \u2014 consumers can discover you via /endpoint sponsor");
51040
+ startSponsorHeartbeat(sponsorPayload, ctx.getExposeGateway);
51041
+ renderInfo("Heartbeat active \u2014 re-registering every 5 min");
51003
51042
  } else {
51004
51043
  renderWarning(`Sponsor directory: ${kvResult.reason || "not persisted"}`);
51005
51044
  }
@@ -53026,6 +53065,15 @@ async function handleSponsoredEndpoint(ctx, local) {
53026
53065
  }
53027
53066
  sponsors.length = 0;
53028
53067
  sponsors.push(...verified);
53068
+ if (verified.length > 0) {
53069
+ try {
53070
+ const { mkdirSync: mkdirSync34, writeFileSync: writeFileSync32 } = __require("node:fs");
53071
+ mkdirSync34(sponsorDir2, { recursive: true });
53072
+ const cached = verified.map((s) => ({ ...s, lastVerified: Date.now() }));
53073
+ writeFileSync32(knownFile, JSON.stringify(cached, null, 2));
53074
+ } catch {
53075
+ }
53076
+ }
53029
53077
  }
53030
53078
  process.stdout.write("\n");
53031
53079
  if (sponsors.length === 0) {
@@ -54222,7 +54270,7 @@ async function showExposeDashboard(gateway, rl, ctx) {
54222
54270
  renderInfo("Expose gateway stopped.");
54223
54271
  }
54224
54272
  }
54225
- var DASH_INTERNAL;
54273
+ var _sponsorHeartbeatTimer, _lastRegisteredSponsorPayload, DASH_INTERNAL;
54226
54274
  var init_commands = __esm({
54227
54275
  "packages/cli/dist/tui/commands.js"() {
54228
54276
  "use strict";
@@ -54242,6 +54290,8 @@ var init_commands = __esm({
54242
54290
  init_drop_panel();
54243
54291
  init_neovim_mode();
54244
54292
  init_daemon_registry();
54293
+ _sponsorHeartbeatTimer = null;
54294
+ _lastRegisteredSponsorPayload = null;
54245
54295
  DASH_INTERNAL = /* @__PURE__ */ new Set(["system_metrics", "__list_capabilities"]);
54246
54296
  }
54247
54297
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.186.12",
4
- "description": "AI coding agent powered by open-source models (Ollama/vLLM) \u2014 interactive TUI with agentic tool-calling loop",
3
+ "version": "0.186.13",
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",
7
7
  "types": "./dist/index.d.ts",