open-agents-ai 0.103.22 → 0.103.23

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 +53 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -27508,7 +27508,30 @@ var init_expose = __esm({
27508
27508
  this.server.listen(port, "127.0.0.1", () => resolve31());
27509
27509
  this.server.on("error", reject);
27510
27510
  });
27511
- this._tunnelUrl = await this.startCloudflared(port);
27511
+ let lastStartErr;
27512
+ for (let attempt = 0; attempt < 3; attempt++) {
27513
+ try {
27514
+ this._tunnelUrl = await this.startCloudflared(port);
27515
+ break;
27516
+ } catch (err) {
27517
+ lastStartErr = err instanceof Error ? err : new Error(String(err));
27518
+ const is429 = lastStartErr.message.includes("429") || lastStartErr.message.includes("Too Many Requests");
27519
+ if (is429 && attempt < 2) {
27520
+ const delaySec = (attempt + 1) * 15;
27521
+ this.options.onInfo?.(`Cloudflare rate limited \u2014 retrying in ${delaySec}s (attempt ${attempt + 2}/3)...`);
27522
+ await new Promise((r) => setTimeout(r, delaySec * 1e3));
27523
+ continue;
27524
+ }
27525
+ if (this.server) {
27526
+ await new Promise((r) => this.server.close(() => r()));
27527
+ this.server = null;
27528
+ }
27529
+ throw lastStartErr;
27530
+ }
27531
+ }
27532
+ if (!this._tunnelUrl) {
27533
+ throw lastStartErr ?? new Error("Cloudflared tunnel start failed after retries");
27534
+ }
27512
27535
  this._stats.status = "active";
27513
27536
  this.emitStats();
27514
27537
  if (this._stateDir) {
@@ -27931,25 +27954,37 @@ var init_expose = __esm({
27931
27954
  async restartCloudflared() {
27932
27955
  if (!this.server || this._proxyPort === 0)
27933
27956
  return;
27934
- try {
27935
- this._tunnelUrl = await this.startCloudflared(this._proxyPort);
27936
- this._stats.status = "active";
27937
- this.emitStats();
27938
- this.options.onInfo?.(`Tunnel restarted with new URL \u2014 share with consumers:
27957
+ for (let attempt = 0; attempt < 3; attempt++) {
27958
+ try {
27959
+ this._tunnelUrl = await this.startCloudflared(this._proxyPort);
27960
+ this._stats.status = "active";
27961
+ this.emitStats();
27962
+ this.options.onInfo?.(`Tunnel restarted with new URL \u2014 share with consumers:
27939
27963
  ${this.formatConnectionInfo()}`);
27940
- if (this._stateDir) {
27941
- writeExposeState(this._stateDir, {
27942
- pid: this._cloudflaredPid,
27943
- tunnelUrl: this._tunnelUrl,
27944
- authKey: this._authKey,
27945
- proxyPort: this._proxyPort,
27946
- targetUrl: this._targetUrl,
27947
- kind: this._kind,
27948
- startedAt: (/* @__PURE__ */ new Date()).toISOString()
27949
- });
27964
+ if (this._stateDir) {
27965
+ writeExposeState(this._stateDir, {
27966
+ pid: this._cloudflaredPid,
27967
+ tunnelUrl: this._tunnelUrl,
27968
+ authKey: this._authKey,
27969
+ proxyPort: this._proxyPort,
27970
+ targetUrl: this._targetUrl,
27971
+ kind: this._kind,
27972
+ startedAt: (/* @__PURE__ */ new Date()).toISOString()
27973
+ });
27974
+ }
27975
+ return;
27976
+ } catch (err) {
27977
+ const msg = err instanceof Error ? err.message : String(err);
27978
+ const is429 = msg.includes("429") || msg.includes("Too Many Requests");
27979
+ if (is429 && attempt < 2) {
27980
+ const delaySec = (attempt + 1) * 15;
27981
+ this.options.onInfo?.(`Cloudflare rate limited \u2014 retrying in ${delaySec}s...`);
27982
+ await new Promise((r) => setTimeout(r, delaySec * 1e3));
27983
+ continue;
27984
+ }
27985
+ this.options.onError?.(`Tunnel restart failed: ${msg}`);
27986
+ return;
27950
27987
  }
27951
- } catch (err) {
27952
- this.options.onError?.(`Tunnel restart failed: ${err instanceof Error ? err.message : String(err)}`);
27953
27988
  }
27954
27989
  }
27955
27990
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.103.22",
3
+ "version": "0.103.23",
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",