@thirdfy/agent-cli 0.2.13 → 0.2.14

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.14] - 2026-06-24
8
+
9
+ ### Changed
10
+
11
+ - HTTP client (`src/core/http.mjs`) retries once on **502/503/504** and timeout/abort errors with short jittered backoff. Pairs with Thirdfy API **v3.5.6+** Supabase REST resilience (`UPSTREAM_DB_UNAVAILABLE`).
12
+
7
13
  ## [0.2.13] - 2026-06-23
8
14
 
9
15
  ### Changed
package/README.md CHANGED
@@ -40,14 +40,9 @@ Run without global install:
40
40
  npx @thirdfy/agent-cli --help
41
41
  ```
42
42
 
43
- ## What's new in v0.2.13
43
+ ## What's new in v0.2.14
44
44
 
45
- - Lighter provider hints prioritize Base-first `complete_lighter_onboarding` and catalog-aligned action names for CCTP funding, API-key setup, and integrator approval. Pairs with Thirdfy API **v3.5.3+** and `thirdfy-mcp` **v0.0.62+**.
46
-
47
- ## What's new in v0.2.12
48
-
49
- - Lighter perps provider support: funding discovery, `complete_lighter_onboarding`, market/account reads, API-key setup, and signed perps order management via the `lighter` command group. Pairs with Thirdfy API **v3.5.2+**.
50
- - Provider parity validation and command reference updated for `provider=lighter` actions.
45
+ - HTTP client retries once on Thirdfy API **502/503/504** and client timeouts (bounded `AbortController`), so PostgREST outages surface as transient failures instead of hanging Hermes read cycles. Pairs with Thirdfy API **v3.5.6+**.
51
46
 
52
47
  Older versions: see [CHANGELOG.md](./CHANGELOG.md) and [GitHub Releases](https://github.com/thirdfy/agent-cli/releases).
53
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdfy/agent-cli",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/core/http.mjs CHANGED
@@ -4,6 +4,25 @@ import {
4
4
  resolveExecutionContextFromInput,
5
5
  } from './executionContext.mjs';
6
6
 
7
+ function sleep(ms) {
8
+ return new Promise((resolve) => setTimeout(resolve, ms));
9
+ }
10
+
11
+ function isRetryableApiStatus(statusCode) {
12
+ return statusCode === 502 || statusCode === 503 || statusCode === 504;
13
+ }
14
+
15
+ function isRetryableApiError(error) {
16
+ const statusCode = Number(error?.statusCode || 0);
17
+ const message = String(error?.message || '').toLowerCase();
18
+ return (
19
+ isRetryableApiStatus(statusCode) ||
20
+ error?.name === 'AbortError' ||
21
+ message.includes('abort') ||
22
+ message.includes('timeout')
23
+ );
24
+ }
25
+
7
26
  export async function apiGet(ctx, route, headers = {}) {
8
27
  return requestJson(ctx, route, { method: 'GET', headers: mergeExecutionContextHeaders(headers) });
9
28
  }
@@ -28,7 +47,7 @@ export async function apiPost(ctx, route, body, headers = {}) {
28
47
  });
29
48
  }
30
49
 
31
- export async function requestJson(ctx, route, init) {
50
+ async function requestJsonOnce(ctx, route, init) {
32
51
  const controller = new AbortController();
33
52
  const timeout = setTimeout(() => controller.abort(), ctx.timeoutMs);
34
53
  try {
@@ -50,6 +69,23 @@ export async function requestJson(ctx, route, init) {
50
69
  }
51
70
  }
52
71
 
72
+ export async function requestJson(ctx, route, init) {
73
+ let lastError = null;
74
+ for (let attempt = 0; attempt < 2; attempt += 1) {
75
+ try {
76
+ return await requestJsonOnce(ctx, route, init);
77
+ } catch (error) {
78
+ lastError = error;
79
+ if (attempt === 0 && isRetryableApiError(error)) {
80
+ await sleep(250 + Math.floor(Math.random() * 250));
81
+ continue;
82
+ }
83
+ throw error;
84
+ }
85
+ }
86
+ throw lastError || new Error('Request failed');
87
+ }
88
+
53
89
  export async function requestWithRouteFallback(ctx, options) {
54
90
  const routes = Array.isArray(options.routes) ? options.routes : [];
55
91
  let lastError = null;