@toon-protocol/client-mcp 0.32.0 → 0.33.1

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.
@@ -1298,8 +1298,9 @@ function removeApexTarget(btpUrl, path = defaultTargetsPath()) {
1298
1298
 
1299
1299
  // src/daemon/apex-discovery.ts
1300
1300
  var ApexDiscoveryError = class extends Error {
1301
- constructor(message) {
1301
+ constructor(message, retryable = false) {
1302
1302
  super(message);
1303
+ this.retryable = retryable;
1303
1304
  this.name = "ApexDiscoveryError";
1304
1305
  }
1305
1306
  };
@@ -1327,7 +1328,9 @@ async function discoverApex(params) {
1327
1328
  await delay(pollMs);
1328
1329
  }
1329
1330
  throw new ApexDiscoveryError(
1330
- `Timed out after ${timeoutMs}ms waiting for the apex kind:${ILP_PEER_INFO_KIND} announcement for "${ilpAddress}" on the relay. Is the relay reachable and the apex online?`
1331
+ `Timed out after ${timeoutMs}ms waiting for the apex kind:${ILP_PEER_INFO_KIND} announcement for "${ilpAddress}" on the relay. Is the relay reachable and the apex online?`,
1332
+ true
1333
+ // retryable: the apex may just be slow/offline
1331
1334
  );
1332
1335
  } finally {
1333
1336
  relay.unsubscribe(subId);
@@ -2208,6 +2211,12 @@ function mapError(reply, err) {
2208
2211
  const status = /no such/i.test(err.message) ? 404 : 400;
2209
2212
  return sendError(reply, status, "invalid_target", { detail: err.message });
2210
2213
  }
2214
+ if (err instanceof ApexDiscoveryError) {
2215
+ return err.retryable ? sendError(reply, 504, "discovery_timeout", {
2216
+ detail: err.message,
2217
+ retryable: true
2218
+ }) : sendError(reply, 502, "discovery_failed", { detail: err.message });
2219
+ }
2211
2220
  return sendError(reply, 500, "internal_error", {
2212
2221
  detail: err instanceof Error ? err.message : String(err)
2213
2222
  });
@@ -2230,4 +2239,4 @@ export {
2230
2239
  PublishRejectedError,
2231
2240
  registerRoutes
2232
2241
  };
2233
- //# sourceMappingURL=chunk-AYZWVPNQ.js.map
2242
+ //# sourceMappingURL=chunk-7WCDT25E.js.map