@elisym/sdk 0.16.0 → 0.18.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.
package/dist/index.cjs CHANGED
@@ -1965,6 +1965,14 @@ var MarketplaceService = class {
1965
1965
  cb.onFeedback?.(statusTag[1], amt, paymentReq, ev.pubkey);
1966
1966
  } catch {
1967
1967
  }
1968
+ if (provPk && statusTag[1] === "error" && !resolved) {
1969
+ const errorMessage = ev.content?.trim() || "Provider returned an error";
1970
+ done();
1971
+ try {
1972
+ cb.onError?.(errorMessage);
1973
+ } catch {
1974
+ }
1975
+ }
1968
1976
  }
1969
1977
  }
1970
1978
  )
@@ -3038,6 +3046,32 @@ var ElisymClient = class {
3038
3046
  this.pool.close();
3039
3047
  }
3040
3048
  };
3049
+
3050
+ // src/services/jobErrors.ts
3051
+ var AGENT_UNAVAILABLE_MARKERS = [
3052
+ "agent temporarily unavailable",
3053
+ "internal processing error",
3054
+ "invalid x-api-key",
3055
+ "invalid api key",
3056
+ "invalid_api_key",
3057
+ "x-api-key",
3058
+ "credit balance",
3059
+ "billing",
3060
+ "insufficient",
3061
+ "insufficient_quota",
3062
+ "authentication_error",
3063
+ "unauthorized",
3064
+ "unauthenticated"
3065
+ ];
3066
+ function classifyJobError(message) {
3067
+ const lower = message.toLowerCase();
3068
+ for (const marker of AGENT_UNAVAILABLE_MARKERS) {
3069
+ if (lower.includes(marker)) {
3070
+ return "agent-unavailable";
3071
+ }
3072
+ }
3073
+ return "unknown";
3074
+ }
3041
3075
  var DEFAULT_COMPUTE_UNIT_LIMIT2 = 2e5;
3042
3076
  var DEFAULT_PRIORITY_FEE_PERCENTILE2 = 75;
3043
3077
  var BASE_FEE_LAMPORTS_PER_SIGNATURE = 5000n;
@@ -3603,6 +3637,7 @@ exports.assetByKey = assetByKey;
3603
3637
  exports.assetKey = assetKey;
3604
3638
  exports.buildPaymentInstructions = buildPaymentInstructions;
3605
3639
  exports.calculateProtocolFee = calculateProtocolFee;
3640
+ exports.classifyJobError = classifyJobError;
3606
3641
  exports.clearPriorityFeeCache = clearPriorityFeeCache;
3607
3642
  exports.clearProtocolConfigCache = clearProtocolConfigCache;
3608
3643
  exports.clearQuickVerifyCache = clearQuickVerifyCache;