@blockrun/clawrouter 0.12.299 → 0.12.300
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 +3 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -43186,7 +43186,7 @@ function createPayFetchWithPreAuth(baseFetch, client, ttlMs = DEFAULT_TTL_MS, op
|
|
|
43186
43186
|
}
|
|
43187
43187
|
};
|
|
43188
43188
|
const cached = !options?.skipPreAuth ? cache2.get(cacheKey3) : void 0;
|
|
43189
|
-
const preAuthCovers = cached !== void 0 && Date.now() - cached.cachedAt < ttlMs && cached.coverMicros !== void 0 && needMicros !== void 0 && needMicros <= cached.coverMicros;
|
|
43189
|
+
const preAuthCovers = cached !== void 0 && Date.now() - cached.cachedAt < ttlMs && cached.coverMicros !== void 0 && needMicros !== void 0 && needMicros <= cached.coverMicros && cached.coverMicros <= needMicros * (1 + PREAUTH_OVERPAY_TOLERANCE);
|
|
43190
43190
|
if (preAuthCovers) {
|
|
43191
43191
|
let paymentInFlight = false;
|
|
43192
43192
|
try {
|
|
@@ -43355,7 +43355,7 @@ function receiptChargedMicros(response) {
|
|
|
43355
43355
|
}
|
|
43356
43356
|
return void 0;
|
|
43357
43357
|
}
|
|
43358
|
-
var DEFAULT_TTL_MS, PaymentInDoubtError;
|
|
43358
|
+
var DEFAULT_TTL_MS, PREAUTH_OVERPAY_TOLERANCE, PaymentInDoubtError;
|
|
43359
43359
|
var init_payment_preauth = __esm({
|
|
43360
43360
|
"src/payment-preauth.ts"() {
|
|
43361
43361
|
"use strict";
|
|
@@ -43363,6 +43363,7 @@ var init_payment_preauth = __esm({
|
|
|
43363
43363
|
init_max_tokens();
|
|
43364
43364
|
init_spend_control();
|
|
43365
43365
|
DEFAULT_TTL_MS = 36e5;
|
|
43366
|
+
PREAUTH_OVERPAY_TOLERANCE = 0.03;
|
|
43366
43367
|
PaymentInDoubtError = class extends Error {
|
|
43367
43368
|
constructor(cause) {
|
|
43368
43369
|
super(
|
package/dist/index.js
CHANGED
|
@@ -255465,6 +255465,7 @@ function formatDuration(seconds) {
|
|
|
255465
255465
|
|
|
255466
255466
|
// src/payment-preauth.ts
|
|
255467
255467
|
var DEFAULT_TTL_MS = 36e5;
|
|
255468
|
+
var PREAUTH_OVERPAY_TOLERANCE = 0.03;
|
|
255468
255469
|
var PaymentInDoubtError = class extends Error {
|
|
255469
255470
|
constructor(cause) {
|
|
255470
255471
|
super(
|
|
@@ -255538,7 +255539,7 @@ function createPayFetchWithPreAuth(baseFetch, client, ttlMs = DEFAULT_TTL_MS, op
|
|
|
255538
255539
|
}
|
|
255539
255540
|
};
|
|
255540
255541
|
const cached = !options?.skipPreAuth ? cache2.get(cacheKey3) : void 0;
|
|
255541
|
-
const preAuthCovers = cached !== void 0 && Date.now() - cached.cachedAt < ttlMs && cached.coverMicros !== void 0 && needMicros !== void 0 && needMicros <= cached.coverMicros;
|
|
255542
|
+
const preAuthCovers = cached !== void 0 && Date.now() - cached.cachedAt < ttlMs && cached.coverMicros !== void 0 && needMicros !== void 0 && needMicros <= cached.coverMicros && cached.coverMicros <= needMicros * (1 + PREAUTH_OVERPAY_TOLERANCE);
|
|
255542
255543
|
if (preAuthCovers) {
|
|
255543
255544
|
let paymentInFlight = false;
|
|
255544
255545
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/clawrouter",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.300",
|
|
4
4
|
"description": "Smart LLM router — save 84% on inference costs. 90 models (7 free). Pay by credit card (API key) or USDC (x402 wallet).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|