@blockrun/clawrouter 0.12.65 → 0.12.66

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/cli.js CHANGED
@@ -49100,6 +49100,26 @@ data: [DONE]
49100
49100
  reason: result.errorCategory || `HTTP ${result.errorStatus || 500}`,
49101
49101
  status: result.errorStatus || 500
49102
49102
  });
49103
+ const isPaymentErr = /payment.*verification.*failed|payment.*settlement.*failed|insufficient.*funds|transaction_simulation_failed/i.test(
49104
+ result.errorBody || ""
49105
+ );
49106
+ if (isPaymentErr && tryModel !== FREE_MODEL && !isLastAttempt) {
49107
+ failedAttempts.push({
49108
+ ...failedAttempts[failedAttempts.length - 1],
49109
+ reason: "payment_error"
49110
+ });
49111
+ const freeIdx = modelsToTry.indexOf(FREE_MODEL);
49112
+ if (freeIdx > i + 1) {
49113
+ console.log(`[ClawRouter] Payment error \u2014 skipping to free model: ${FREE_MODEL}`);
49114
+ i = freeIdx - 1;
49115
+ continue;
49116
+ }
49117
+ if (freeIdx === -1) {
49118
+ modelsToTry.push(FREE_MODEL);
49119
+ console.log(`[ClawRouter] Payment error \u2014 appending free model: ${FREE_MODEL}`);
49120
+ continue;
49121
+ }
49122
+ }
49103
49123
  if (result.isProviderError && !isLastAttempt) {
49104
49124
  const isExplicitModelError = !routingDecision;
49105
49125
  const isUnknownExplicitModel = isExplicitModelError && /unknown.*model|invalid.*model/i.test(result.errorBody || "");
@@ -49177,17 +49197,6 @@ data: [DONE]
49177
49197
  `[ClawRouter] \u{1F511} ${errorCat === "auth_failure" ? "Auth failure" : "Quota exceeded"} for ${tryModel} \u2014 check provider config`
49178
49198
  );
49179
49199
  }
49180
- const isPaymentErr = /payment.*verification.*failed|payment.*settlement.*failed|insufficient.*funds|transaction_simulation_failed/i.test(
49181
- result.errorBody || ""
49182
- );
49183
- if (isPaymentErr && tryModel !== FREE_MODEL) {
49184
- const freeIdx = modelsToTry.indexOf(FREE_MODEL);
49185
- if (freeIdx > i + 1) {
49186
- console.log(`[ClawRouter] Payment error \u2014 skipping to free model: ${FREE_MODEL}`);
49187
- i = freeIdx - 1;
49188
- continue;
49189
- }
49190
- }
49191
49200
  console.log(
49192
49201
  `[ClawRouter] Provider error from ${tryModel}, trying fallback: ${result.errorBody?.slice(0, 100)}`
49193
49202
  );