@dvmkit/sdk 0.17.1 → 0.19.0

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.
Files changed (31) hide show
  1. package/dist/{chunk-ORBWKYDE.js → chunk-34H4ZKBM.js} +1 -1
  2. package/dist/{chunk-WMGXJQI3.js → chunk-5RGZN6WQ.js} +1 -1
  3. package/dist/{chunk-3KRFFLAT.js → chunk-C65P6MGZ.js} +1 -1
  4. package/dist/{chunk-C5XNZLZ7.js → chunk-DJRTYBEE.js} +1 -1
  5. package/dist/{chunk-B5MPLDRC.js → chunk-I5MXADJS.js} +1 -1
  6. package/dist/{chunk-EIDRCGTY.js → chunk-INYFUPXV.js} +41 -13
  7. package/dist/{chunk-5CCQEAQV.js → chunk-MXESSBXF.js} +47 -0
  8. package/dist/{chunk-YRQMDRI4.js → chunk-NLMRNLKA.js} +14270 -13793
  9. package/dist/{chunk-62FI3NJF.js → chunk-NUDHO4HV.js} +4 -2
  10. package/dist/{chunk-VKFR5PCW.js → chunk-OTNHKRHA.js} +2 -2
  11. package/dist/{content-retention-B_hOQS36.d.ts → content-retention-sUCPlA1J.d.ts} +1 -1
  12. package/dist/{credit-ledger-5HMJ6VUX.js → credit-ledger-ZCJXJG6R.js} +2 -2
  13. package/dist/{credit-menu-D-h0zJCZ.d.ts → credit-menu-D88XuTLU.d.ts} +145 -6
  14. package/dist/{fx-CpqQaIfg.d.ts → fx-QoVA2oBc.d.ts} +1 -1
  15. package/dist/index.d.ts +5 -5
  16. package/dist/index.js +18 -3
  17. package/dist/internal/caller.d.ts +12 -8
  18. package/dist/internal/caller.js +3 -3
  19. package/dist/internal/server.d.ts +7 -7
  20. package/dist/internal/server.js +9 -9
  21. package/dist/{job-store-CgXT79tS.d.ts → job-store-Dy-ogco6.d.ts} +1 -1
  22. package/dist/{lightning-backend-B1hRUIOb.d.ts → lightning-backend-B2wMBR-x.d.ts} +1 -1
  23. package/dist/{memory-credit-ledger-ME6FH462.js → memory-credit-ledger-N4PZKTT5.js} +3 -3
  24. package/dist/server/index.d.ts +10 -10
  25. package/dist/server/index.js +10 -10
  26. package/dist/{step-cache-Bezn-_ZL.d.ts → step-cache-B83Y9T9p.d.ts} +73 -9
  27. package/dist/{tempo-session-store-EWBE5HJM.js → tempo-session-store-XJE6GIXN.js} +2 -2
  28. package/dist/testing/index.d.ts +3 -3
  29. package/dist/{usd-CJwU3-A4.d.ts → usd-g9kCw86F.d.ts} +1 -1
  30. package/dist/{x402-HVCUEWWU.js → x402-XLFD43RF.js} +4 -4
  31. package/package.json +1 -1
@@ -9,11 +9,13 @@ var X402_DEFAULT_FACILITATOR = "https://x402.org/facilitator";
9
9
  // src/lib/x402/spec.ts
10
10
  var X402_VERSION = 2;
11
11
  var X402_V1_VERSION = 1;
12
+ var DEFAULT_MAX_TIMEOUT_SECONDS = 60;
12
13
  var X402_DEFAULT_NETWORK = "eip155:8453";
13
14
  var X402_EXACT_SCHEME = "exact";
14
15
  var X402_BATCH_SETTLEMENT_SCHEME = "batch-settlement";
15
16
  function buildPaymentRequirements(opts) {
16
17
  const { x402Config, requiredUsdcMicro, resource, description, mimeType } = opts;
18
+ const maxTimeoutSeconds = opts.maxTimeoutSeconds ?? DEFAULT_MAX_TIMEOUT_SECONDS;
17
19
  const version = opts.version ?? X402_VERSION;
18
20
  const network = version === X402_V1_VERSION ? caip2ToX402Network(x402Config.network) : x402Config.network;
19
21
  const usdcContract = usdcContractByCaip2(x402Config.network);
@@ -27,7 +29,7 @@ function buildPaymentRequirements(opts) {
27
29
  amount: requiredUsdcMicro.toString(),
28
30
  payTo: x402Config.payTo,
29
31
  asset,
30
- maxTimeoutSeconds: 60,
32
+ maxTimeoutSeconds,
31
33
  extra
32
34
  };
33
35
  }
@@ -40,7 +42,7 @@ function buildPaymentRequirements(opts) {
40
42
  mimeType: mimeType ?? "application/json",
41
43
  payTo: x402Config.payTo,
42
44
  asset,
43
- maxTimeoutSeconds: 60,
45
+ maxTimeoutSeconds,
44
46
  ...Object.keys(extra).length > 0 ? { extra } : {}
45
47
  };
46
48
  }
@@ -2,14 +2,14 @@ import {
2
2
  createX402FacilitatorAuthHeaders,
3
3
  settleWithFacilitator,
4
4
  verifyWithFacilitator
5
- } from "./chunk-3KRFFLAT.js";
5
+ } from "./chunk-C65P6MGZ.js";
6
6
  import {
7
7
  buildPaymentRequirements,
8
8
  decodePayment,
9
9
  encodeSettleResponseHeader,
10
10
  exactEvmAuthorization,
11
11
  usdcToMsats
12
- } from "./chunk-62FI3NJF.js";
12
+ } from "./chunk-NUDHO4HV.js";
13
13
  import {
14
14
  callerLoggers
15
15
  } from "./chunk-66HGCPBU.js";
@@ -1,4 +1,4 @@
1
- import { b as JobStore, J as JobRecord } from './job-store-CgXT79tS.js';
1
+ import { b as JobStore, J as JobRecord } from './job-store-Dy-ogco6.js';
2
2
 
3
3
  /** Authenticated caller metadata; omitted fields on older services mean unknown. */
4
4
  interface JobContentMetadata {
@@ -10,11 +10,11 @@ import {
10
10
  isDrainMethod,
11
11
  isFundingRail,
12
12
  x402SettlementPending
13
- } from "./chunk-B5MPLDRC.js";
13
+ } from "./chunk-I5MXADJS.js";
14
14
  import "./chunk-YG7G4DPZ.js";
15
15
  import "./chunk-COYKJRMM.js";
16
16
  import "./chunk-5UC7TOQC.js";
17
- import "./chunk-EIDRCGTY.js";
17
+ import "./chunk-INYFUPXV.js";
18
18
  import "./chunk-BPYMEMQX.js";
19
19
  import "./chunk-H3GGFEE5.js";
20
20
  import "./chunk-ALTE7I6C.js";
@@ -1,11 +1,11 @@
1
- import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-B1hRUIOb.js';
2
- import { cp as HostingCleanupFence, da as HostedIntent, al as FundingMethod, p as PaymentMethod, bV as CreditLedgerLike, a7 as Message, O as UpfrontPayment, a1 as FundingReceipt, bX as CreditSnapshot, a2 as JobReceipt, S as SDKJobContext, az as StepCache, v as ResponseContent, P as PaymentContent, a3 as MessageType, bq as X402Receipt, aI as X402Config, bp as X402ExactVersionSupport, db as X402SettlementIntent, ad as PaymentRequirementsV2, dc as HostedFundingReservation, bR as CreditLedgerQuerier, dd as X402SettlementCursor, b$ as X402SettlementStatus, de as X402SettlementWriteOff, bW as X402RefundSettlementGate, df as X402FacilitatorAuth, dg as X402BatchSettlementConfig, cM as PostgresX402ChannelStorage, dh as X402PayoutObserver, bT as HostedSettlementReportObligations, bt as CreditDepositPayload, by as MppxServer, ag as CashuMode, di as CreditDepositEnqueue, dj as X402SettlementReconciliationReason, as as PaymentRequirements, c3 as FundingRecord, a5 as MppxCredential, b_ as DrawResult, cz as CreditLedgerError, a9 as ReceiptCredit, ai as DrainReceiptEvent, aa as DrainReceipt, a0 as DrawFundingReceipt, K as KVStore, z as SignedRequestAudience, dk as CreditDrawReleaseEnqueue, cK as JobCostReportPayload, cL as JobTerminalReportPayload, cO as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, c5 as CreditInvoiceRecord, c6 as InvoiceSettlement, ct as ClientCompatibilityGate, cr as ClientCompatibility, bC as PostgresTempoSessionStore, bB as PayoutReporter, R as ResolvedCreditConfig, h as CreditView } from './step-cache-Bezn-_ZL.js';
1
+ import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-B2wMBR-x.js';
2
+ import { cr as HostingCleanupFence, dc as HostedIntent, an as FundingMethod, q as PaymentMethod, bX as CreditLedgerLike, a9 as Message, V as UpfrontPayment, a3 as FundingReceipt, bZ as CreditSnapshot, a4 as JobReceipt, S as SDKJobContext, aB as StepCache, x as ResponseContent, P as PaymentContent, a5 as MessageType, bs as X402Receipt, aK as X402Config, br as X402ExactVersionSupport, ap as PaymentPayload, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, dd as X402SettlementIntent, de as HostedFundingReservation, bT as CreditLedgerQuerier, df as X402SettlementCursor, c1 as X402SettlementStatus, dg as X402SettlementWriteOff, bY as X402RefundSettlementGate, dh as X402FacilitatorAuth, di as X402BatchSettlementConfig, cO as PostgresX402ChannelStorage, dj as X402PayoutObserver, bV as HostedSettlementReportObligations, bv as CreditDepositPayload, bA as MppxServer, ai as CashuMode, dk as CreditDepositEnqueue, dl as X402SettlementReconciliationReason, au as PaymentRequirements, c5 as FundingRecord, a7 as MppxCredential, c0 as DrawResult, cB as CreditLedgerError, ab as ReceiptCredit, ak as DrainReceiptEvent, ac as DrainReceipt, a2 as DrawFundingReceipt, K as KVStore, E as SignedRequestAudience, dm as CreditDrawReleaseEnqueue, cM as JobCostReportPayload, cN as JobTerminalReportPayload, cQ as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, c7 as CreditInvoiceRecord, c8 as InvoiceSettlement, cv as ClientCompatibilityGate, ct as ClientCompatibility, bE as PostgresTempoSessionStore, bD as PayoutReporter, w as ResolvedCreditConfig, i as CreditView } from './step-cache-B83Y9T9p.js';
3
3
  import { ProofLike, SerializedDLEQ, Proof } from '@cashu/cashu-ts';
4
4
  import { Hono, Context } from 'hono';
5
5
  import { Pool } from 'pg';
6
- import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-CpqQaIfg.js';
6
+ import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-QoVA2oBc.js';
7
7
  import { Store, Challenge } from 'mppx';
8
- import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-CgXT79tS.js';
8
+ import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-Dy-ogco6.js';
9
9
  import { SettleResponse, SupportedResponse } from '@x402/core/types';
10
10
  import { Channel, AutoSettlementConfig } from '@x402/evm/batch-settlement/server';
11
11
  import { FacilitatorClient } from '@x402/core/server';
@@ -1163,7 +1163,7 @@ declare class MemoryProcessedPaymentStore implements ProcessedPaymentStore {
1163
1163
  */
1164
1164
  type AccumulatorRejectionCode = "missing_request_id" | "reserved_request_id" | "missing_lock_pubkey" | "not_p2pk_locked" | "wrong_lock_pubkey" | "lock_not_exclusive" | "proof_not_unspent" | "proof_pending" | "replay_rejected" | "request_id_reused" | "mint_unreachable" | "invalid_token";
1165
1165
 
1166
- type X402ExactSettlementStatus = "prepared" | "submitting" | "settled" | "local_committed" | "ambiguous" | "rejected" | "complete";
1166
+ type X402ExactSettlementStatus = "prepared" | "submitting" | "settled" | "local_committed" | "ambiguous" | "rejected" | "released" | "complete";
1167
1167
  /** Serializable local economic effect that follows an exact settlement. */
1168
1168
  interface X402ExactSettlementEffect {
1169
1169
  priceFiat: {
@@ -1239,6 +1239,15 @@ interface X402ExactSettlementAttempt {
1239
1239
  /** Persistence contract for exact x402 settlement recovery. */
1240
1240
  interface X402ExactSettlementStore {
1241
1241
  prepare(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<X402ExactSettlementIntent>;
1242
+ /**
1243
+ * Same binding checks as {@link prepare}, but reports whether this call
1244
+ * created the row. Concurrent callers presenting one authorization race to
1245
+ * insert it, so exactly one sees `inserted: true`.
1246
+ */
1247
+ claim(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<{
1248
+ intent: X402ExactSettlementIntent;
1249
+ inserted: boolean;
1250
+ }>;
1242
1251
  get(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent | undefined>;
1243
1252
  markSubmitting(args: {
1244
1253
  dvmId: string;
@@ -1259,6 +1268,16 @@ interface X402ExactSettlementStore {
1259
1268
  value?: T;
1260
1269
  replayed: boolean;
1261
1270
  }>;
1271
+ /**
1272
+ * Retire a `prepared` intent whose work did not succeed so it is never sent
1273
+ * for settlement. Returns false for any other status, which keeps a
1274
+ * submitted or settled authorization from being disowned.
1275
+ */
1276
+ release(args: {
1277
+ dvmId: string;
1278
+ intentId: string;
1279
+ reason: string;
1280
+ }): Promise<boolean>;
1262
1281
  markAdmissionComplete(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent>;
1263
1282
  list(args: {
1264
1283
  dvmId: string;
@@ -1274,6 +1293,10 @@ declare class PostgresX402ExactSettlementStore implements X402ExactSettlementSto
1274
1293
  constructor(pool: Pick<Pool, "query" | "connect">);
1275
1294
  init(): Promise<void>;
1276
1295
  prepare(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<X402ExactSettlementIntent>;
1296
+ claim(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<{
1297
+ intent: X402ExactSettlementIntent;
1298
+ inserted: boolean;
1299
+ }>;
1277
1300
  get(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent | undefined>;
1278
1301
  markSubmitting(args: {
1279
1302
  dvmId: string;
@@ -1294,6 +1317,11 @@ declare class PostgresX402ExactSettlementStore implements X402ExactSettlementSto
1294
1317
  value?: T;
1295
1318
  replayed: boolean;
1296
1319
  }>;
1320
+ release(args: {
1321
+ dvmId: string;
1322
+ intentId: string;
1323
+ reason: string;
1324
+ }): Promise<boolean>;
1297
1325
  markAdmissionComplete(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent>;
1298
1326
  list(args: {
1299
1327
  dvmId: string;
@@ -1310,6 +1338,10 @@ declare class MemoryX402ExactSettlementStore implements X402ExactSettlementStore
1310
1338
  private readonly authBindings;
1311
1339
  private readonly locks;
1312
1340
  prepare(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<X402ExactSettlementIntent>;
1341
+ claim(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<{
1342
+ intent: X402ExactSettlementIntent;
1343
+ inserted: boolean;
1344
+ }>;
1313
1345
  get(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent | undefined>;
1314
1346
  markSubmitting(args: {
1315
1347
  dvmId: string;
@@ -1330,6 +1362,11 @@ declare class MemoryX402ExactSettlementStore implements X402ExactSettlementStore
1330
1362
  value?: T;
1331
1363
  replayed: boolean;
1332
1364
  }>;
1365
+ release(args: {
1366
+ dvmId: string;
1367
+ intentId: string;
1368
+ reason: string;
1369
+ }): Promise<boolean>;
1333
1370
  markAdmissionComplete(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent>;
1334
1371
  list(args: {
1335
1372
  dvmId: string;
@@ -1402,6 +1439,61 @@ declare class X402ExactSettlementServer {
1402
1439
  effect?: X402ExactSettlementEffect;
1403
1440
  commit: (receipt: X402Receipt, tx?: ProcessedPaymentQuerier, effect?: X402ExactSettlementEffect) => Promise<T>;
1404
1441
  }): Promise<X402ExactAcceptance<T>>;
1442
+ /**
1443
+ * Verify an authorization and record it as `prepared` without settling it.
1444
+ * The caller must run {@link settlePrepared} once the work it pays for has
1445
+ * succeeded, or {@link release} when it has not. A presentation whose
1446
+ * intent already exists is reported as `replayed` and neither verified nor
1447
+ * prepared again, so one authorization admits one piece of work.
1448
+ */
1449
+ verifyAndPrepare(args: {
1450
+ paymentHeader: string;
1451
+ config: X402Config;
1452
+ requiredUsdcMicro: bigint;
1453
+ resource: string;
1454
+ exactVersions?: X402ExactVersionSupport;
1455
+ dvmId: string;
1456
+ effect: X402ExactSettlementEffect;
1457
+ /** Refuse, before any facilitator call, an authorization that expires sooner than this. */
1458
+ minValidSeconds: number;
1459
+ maxTimeoutSeconds: number;
1460
+ nowMs?: number;
1461
+ }): Promise<{
1462
+ outcome: "prepared";
1463
+ intentId: string;
1464
+ payload: PaymentPayload;
1465
+ requirements: PaymentRequirementsV1 | PaymentRequirementsV2;
1466
+ validBeforeMs: number;
1467
+ } | {
1468
+ outcome: "replayed";
1469
+ intentId: string;
1470
+ } | {
1471
+ outcome: "authorization_too_short";
1472
+ intentId: string;
1473
+ validBefore: string;
1474
+ } | {
1475
+ outcome: "rejected";
1476
+ intentId?: string;
1477
+ reason: string;
1478
+ }>;
1479
+ /** Settle an authorization recorded by {@link verifyAndPrepare} and commit its local effect. */
1480
+ settlePrepared<T>(args: {
1481
+ dvmId: string;
1482
+ intentId: string;
1483
+ payload: PaymentPayload;
1484
+ requirements: PaymentRequirementsV1 | PaymentRequirementsV2;
1485
+ config: X402Config;
1486
+ btcUsdRate: number;
1487
+ commit: (receipt: X402Receipt, tx?: ProcessedPaymentQuerier, effect?: X402ExactSettlementEffect) => Promise<T>;
1488
+ }): Promise<X402ExactAcceptance<T>>;
1489
+ /**
1490
+ * Abandon a prepared authorization whose work did not succeed. The
1491
+ * authorization is never sent to the facilitator, so it expires unspent.
1492
+ * Returns false when the intent is no longer `prepared`.
1493
+ */
1494
+ release(dvmId: string, intentId: string, reason: string): Promise<boolean>;
1495
+ private advance;
1496
+ get(dvmId: string, intentId: string): Promise<X402ExactSettlementIntent | undefined>;
1405
1497
  list(args: {
1406
1498
  dvmId: string;
1407
1499
  limit: number;
@@ -1424,6 +1516,28 @@ declare class X402ExactSettlementEvidenceMissingError extends Error {
1424
1516
  readonly intentId: string;
1425
1517
  constructor(intentId: string);
1426
1518
  }
1519
+ /** A verified authorization kept in memory until its job finishes. */
1520
+ interface HeldX402Authorization {
1521
+ payload: PaymentPayload;
1522
+ requirements: PaymentRequirementsV1 | PaymentRequirementsV2;
1523
+ config: X402Config;
1524
+ btcUsdRate: number;
1525
+ validBeforeMs: number;
1526
+ }
1527
+ /** How a finished job's deferred authorization ended. */
1528
+ type DeferredX402Outcome = "settled" | "unpaid";
1529
+ interface DeferredX402Settler {
1530
+ hold(intentId: string, held: HeldX402Authorization): void;
1531
+ /**
1532
+ * Settle the job's authorization. Resolves `settled` once the funding is
1533
+ * committed (also when an earlier call already did) and `unpaid` when the
1534
+ * payment is definitively not collected. Rejects while the outcome is still
1535
+ * unknown, so the caller retries.
1536
+ */
1537
+ settle(intentId: string): Promise<DeferredX402Outcome>;
1538
+ /** Give up the authorization without sending it to the facilitator. */
1539
+ release(intentId: string, reason: string): Promise<void>;
1540
+ }
1427
1541
 
1428
1542
  /** Exact successful chain action recovered for one ambiguous settlement attempt. */
1429
1543
  interface X402SettlementChainEvidence {
@@ -1909,6 +2023,15 @@ interface UpfrontPaymentOpts {
1909
2023
  x402ExactSettlement?: X402ExactSettlementServer;
1910
2024
  /** Exact generations the facilitator currently advertises. Defaults to both. */
1911
2025
  x402ExactVersions?: X402ExactVersionSupport;
2026
+ /**
2027
+ * Unsigned caller paying with exact x402: verify the authorization now and
2028
+ * send it for settlement only when the job succeeds. Requires
2029
+ * {@link x402ExactSettlement} and a credit ledger.
2030
+ */
2031
+ x402Deferred?: {
2032
+ maxRuntimeSeconds: number;
2033
+ settler: DeferredX402Settler;
2034
+ };
1912
2035
  /** Reusable channel acceptor. Only consulted for fund-only `/v1/credit` requests. */
1913
2036
  x402BatchSettlement?: X402BatchSettlementServer;
1914
2037
  /**
@@ -1966,6 +2089,14 @@ interface UpfrontPaymentOpts {
1966
2089
  lockPubkeys?: LockPubkey[];
1967
2090
  /** UUIDv4 from `X-Cashu-Request-Id` header. */
1968
2091
  requestId?: string;
2092
+ /**
2093
+ * Enforced refund-locktime window; see
2094
+ * {@link AccumulatorReceiveOpts.lockWindowSeconds}. The SDK host always
2095
+ * sets it; a direct caller that omits it gets the default window.
2096
+ */
2097
+ cashuLockWindowSeconds?: number;
2098
+ /** Replaces the `lock_not_exclusive` hint when the floor that applied is not the signed one. */
2099
+ cashuLockRefusalHint?: string;
1969
2100
  /**
1970
2101
  * Per-call Cashu the NUT-24 way, for a `POST /v1/job` the payer could pay
1971
2102
  * without signing. The unpaid 402 then carries the `X-Cashu` payment request
@@ -2279,7 +2410,7 @@ declare function verifyTempoSessionManagementCredential(args: {
2279
2410
  * here: the former is already complete, the latter is a challenge envelope, not
2280
2411
  * an error report.
2281
2412
  */
2282
- type PaymentErrorCode = "payment_invalid" | "x402_not_offered" | "payment_method_requires_signature" | "x402_settlement_ambiguous" | "cashu_unavailable" | "cashu_not_p2pk_locked" | "mint_health_pending" | "cashu_mint_sick" | "payment_insufficient" | "payment_unapplied" | "insufficient_credit" | "credit_expired" | "credit_unbacked" | "credit_not_found" | "tempo_channel_closing" | "settlement_pending" | "draw_conflict" | "funding_commitment_mismatch" | "credit_not_supported" | "one_shot_credit_not_supported" | "credit_below_min" | "below_rail_minimum" | "credit_over_max" | "credit_id_unavailable" | "nothing_to_drain" | "drain_below_dust" | "drain_not_found" | "drain_conflict" | "drain_method_unsupported" | "tempo_channel_exit_required" | "x402_settlement_submission_failed" | X402SettlementReconciliationReason | "lightning_settlement_pending" | "lightning_invoice_expired" | "lightning_unavailable" | AccumulatorRejectionCode;
2413
+ type PaymentErrorCode = "payment_invalid" | "x402_not_offered" | "payment_method_requires_signature" | "payment_authorization_too_short" | "x402_settlement_ambiguous" | "cashu_unavailable" | "cashu_not_p2pk_locked" | "mint_health_pending" | "cashu_mint_sick" | "payment_insufficient" | "payment_unapplied" | "insufficient_credit" | "credit_expired" | "credit_unbacked" | "credit_not_found" | "tempo_channel_closing" | "settlement_pending" | "draw_conflict" | "funding_commitment_mismatch" | "credit_not_supported" | "one_shot_credit_not_supported" | "credit_below_min" | "below_rail_minimum" | "credit_over_max" | "credit_id_unavailable" | "nothing_to_drain" | "drain_below_dust" | "drain_not_found" | "drain_conflict" | "drain_method_unsupported" | "tempo_channel_exit_required" | "x402_settlement_submission_failed" | X402SettlementReconciliationReason | "lightning_settlement_pending" | "lightning_invoice_expired" | "lightning_unavailable" | AccumulatorRejectionCode;
2283
2414
  /**
2284
2415
  * Per-code display, hint and retryability may be overridden for a particular
2285
2416
  * refusal. Keep the hint and retry decision consistent. Extra fields merge
@@ -2335,6 +2466,8 @@ interface IncomingPaymentOpts {
2335
2466
  dvmId?: string;
2336
2467
  /** Active NUT-11 P2PK lock pubkeys (current + retired-in-grace). */
2337
2468
  lockPubkeys?: LockPubkey[];
2469
+ /** Enforced refund-locktime window. Mirrors {@link UpfrontPaymentOpts.cashuLockWindowSeconds}. */
2470
+ cashuLockWindowSeconds?: number;
2338
2471
  /** Runtime mint-health tracker. */
2339
2472
  mintHealthTracker?: MintHealthTracker;
2340
2473
  /**
@@ -2754,6 +2887,11 @@ interface JobManagerOpts {
2754
2887
  enqueueCreditDeposit?: CreditDepositEnqueue;
2755
2888
  /** Reporter outbox inserted atomically with a terminal draw release. */
2756
2889
  enqueueCreditDrawRelease?: CreditDrawReleaseEnqueue;
2890
+ /**
2891
+ * Settles or releases the x402 authorization behind an unsigned job once the
2892
+ * job is terminal. Absent on a DVM that takes no unsigned x402.
2893
+ */
2894
+ deferredX402?: DeferredX402Settler;
2757
2895
  /** Credit lifetime a top-up mints with, from the DVM's advertised `credit.ttl`. */
2758
2896
  creditTtlMs?: number;
2759
2897
  /**
@@ -2992,6 +3130,7 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
2992
3130
  private readonly jobStore;
2993
3131
  private readonly idleTimers;
2994
3132
  private readonly cleanupTimers;
3133
+ private readonly terminalReadRepairs;
2995
3134
  /** Cost revisions held only by a terminal handler owner until its durable merge succeeds. */
2996
3135
  private readonly terminalCostHandoffRetryTimers;
2997
3136
  /** Per-job NOTIFY unsubscribe handles for the durable-status watch. */
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-Bezn-_ZL.js';
1
+ import { C as Currency } from './step-cache-B83Y9T9p.js';
2
2
 
3
3
  /**
4
4
  * Quote-time FX snapshot. `rates` maps configured lowercase currency codes to
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-Bezn-_ZL.js';
2
- export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CreateSignedRequestVerifierOpts, g as CreditConfig, h as CreditView, i as DEFAULT_CREDIT_MAX, j as DEFAULT_CREDIT_MIN, k as DEFAULT_CREDIT_TTL_SECONDS, l as DEFAULT_JOB_RETENTION_DAYS, m as DVMRouteContext, I as IncomingMessage, n as InputType, o as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, p as PaymentMethod, q as PriceValue, r as ProgressContent, s as PromptOpts, Q as QuoteConfig, t as QuoteContext, u as QuoteResult, R as ResolvedCreditConfig, v as ResponseContent, S as SDKJobContext, w as SDKPaymentRequestOpts, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, z as SignedRequestAudience, B as SignedRequestDomain, E as SignedRequestError, F as SignedRequestFailure, G as SignedRequestReplayStore, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, U as UnsupportedCurrencyError, O as UpfrontPayment, T as createSignedRequestVerifier, V as isZodSchema, W as signedRequestStatementHeader, X as validateCurrency } from './step-cache-Bezn-_ZL.js';
3
- export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-CpqQaIfg.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-CJwU3-A4.js';
5
- export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-CgXT79tS.js';
1
+ import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-B83Y9T9p.js';
2
+ export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CashuConfig, g as CreateSignedRequestVerifierOpts, h as CreditConfig, i as CreditView, j as DEFAULT_CREDIT_MAX, k as DEFAULT_CREDIT_MIN, l as DEFAULT_CREDIT_TTL_SECONDS, m as DEFAULT_JOB_RETENTION_DAYS, n as DVMRouteContext, I as IncomingMessage, o as InputType, p as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, q as PaymentMethod, r as PriceValue, s as ProgressContent, t as PromptOpts, Q as QuoteConfig, u as QuoteContext, v as QuoteResult, R as ResolvedCashuConfig, w as ResolvedCreditConfig, x as ResponseContent, S as SDKJobContext, y as SDKPaymentRequestOpts, z as SIGNED_REQUEST_AUTH_ID, B as SIGNED_REQUEST_STATEMENT_VERSION, E as SignedRequestAudience, F as SignedRequestDomain, G as SignedRequestError, H as SignedRequestFailure, M as SignedRequestReplayStore, N as SignedRequestSignOpts, O as SignedRequestStatementHeader, T as SignedRequestVerifier, U as UnsupportedCurrencyError, V as UpfrontPayment, W as createSignedRequestVerifier, X as isZodSchema, Y as signedRequestStatementHeader, _ as validateCurrency } from './step-cache-B83Y9T9p.js';
3
+ export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-QoVA2oBc.js';
4
+ export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-g9kCw86F.js';
5
+ export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-Dy-ogco6.js';
6
6
  export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from './ssrf-dMooihtY.js';
7
7
  export { z } from 'zod';
8
8
  import 'hono';
package/dist/index.js CHANGED
@@ -9,8 +9,9 @@ import {
9
9
  } from "./chunk-A262WVYX.js";
10
10
  import {
11
11
  SignedRequestError,
12
- createSignedRequestVerifier
13
- } from "./chunk-5CCQEAQV.js";
12
+ createSignedRequestVerifier,
13
+ resolveCashuConfig
14
+ } from "./chunk-MXESSBXF.js";
14
15
  import {
15
16
  DEFAULT_CREDIT_MAX,
16
17
  DEFAULT_CREDIT_MIN,
@@ -69,6 +70,7 @@ function configureDVM(config) {
69
70
  x402: config.x402,
70
71
  mpp: config.mpp,
71
72
  credit: resolveCreditConfig(config.credit),
73
+ cashu: resolveCashuConfig(config.cashu),
72
74
  auth: config.auth
73
75
  };
74
76
  CONFIGURED_DVM_DESCRIPTORS.add(descriptor);
@@ -146,6 +148,15 @@ function validateCapabilityPrice(price, capabilityName, currency) {
146
148
  }
147
149
  validatePriceLiteral(price, `configureDVM: capability "${capabilityName}" price`, "price");
148
150
  }
151
+ var MAX_RUNTIME_SECONDS_LIMIT = 600;
152
+ function validateMaxRuntimeSeconds(value, capabilityName) {
153
+ if (value === void 0) return;
154
+ if (!Number.isInteger(value) || value < 1 || value > MAX_RUNTIME_SECONDS_LIMIT) {
155
+ throw new Error(
156
+ `configureDVM: capability "${capabilityName}" maxRuntimeSeconds must be a whole number of seconds from 1 to ${MAX_RUNTIME_SECONDS_LIMIT}, got ${JSON.stringify(value)}`
157
+ );
158
+ }
159
+ }
149
160
  function collectTags(config) {
150
161
  const tagSet = /* @__PURE__ */ new Set();
151
162
  if (config.tag) tagSet.add(config.tag);
@@ -172,6 +183,7 @@ function buildCapabilityMap(config, currency) {
172
183
  const name = typeof config.capability === "string" ? config.capability : slugifyCapabilityName(config.name);
173
184
  validateCapabilityName(name);
174
185
  validateCapabilityPrice(config.price, name, currency);
186
+ validateMaxRuntimeSeconds(config.maxRuntimeSeconds, name);
175
187
  validateExampleAgainstInput(name, config.input, config.example);
176
188
  const entry = {
177
189
  name,
@@ -182,6 +194,7 @@ function buildCapabilityMap(config, currency) {
182
194
  price: config.price,
183
195
  onQuote: config.onQuote,
184
196
  rates: snapshotRates(config.rates),
197
+ maxRuntimeSeconds: config.maxRuntimeSeconds,
185
198
  onJob: config.onJob,
186
199
  onResponse: config.onResponse,
187
200
  onPayment: config.onPayment,
@@ -204,6 +217,7 @@ function buildExplicitCapabilities(capabilities, currency) {
204
217
  throw new Error(`configureDVM: capability "${name}" is missing required onJob handler`);
205
218
  }
206
219
  validateCapabilityPrice(cap.price, name, currency);
220
+ validateMaxRuntimeSeconds(cap.maxRuntimeSeconds, name);
207
221
  validateExampleAgainstInput(name, cap.input, cap.example);
208
222
  const entry = {
209
223
  name,
@@ -218,6 +232,7 @@ function buildExplicitCapabilities(capabilities, currency) {
218
232
  price: cap.price,
219
233
  onQuote: cap.onQuote,
220
234
  rates: snapshotRates(cap.rates),
235
+ maxRuntimeSeconds: cap.maxRuntimeSeconds,
221
236
  onJob: cap.onJob,
222
237
  onResponse: cap.onResponse,
223
238
  onPayment: cap.onPayment,
@@ -230,7 +245,7 @@ function buildExplicitCapabilities(capabilities, currency) {
230
245
  return out;
231
246
  }
232
247
  function flatPerCapFieldsSet(config) {
233
- return config.input !== void 0 || config.example !== void 0 || config.state !== void 0 || config.price !== void 0 || config.onQuote !== void 0 || config.rates !== void 0 || typeof config.onResponse === "function" || typeof config.onPayment === "function" || typeof config.onApproval === "function" || typeof config.onCancel === "function" || typeof config.onMessage === "function";
248
+ return config.input !== void 0 || config.example !== void 0 || config.state !== void 0 || config.price !== void 0 || config.onQuote !== void 0 || config.rates !== void 0 || config.maxRuntimeSeconds !== void 0 || typeof config.onResponse === "function" || typeof config.onPayment === "function" || typeof config.onApproval === "function" || typeof config.onCancel === "function" || typeof config.onMessage === "function";
234
249
  }
235
250
  function validateExampleAgainstInput(capName, input, example) {
236
251
  if (example === void 0) return;
@@ -1,7 +1,7 @@
1
- import { Y as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, _ as X402_BATCH_SETTLEMENT_SCHEME, $ as X402_EXACT_SCHEME, a0 as DrawFundingReceipt, a1 as FundingReceipt, a2 as JobReceipt$1, O as UpfrontPayment, a3 as MessageType, a4 as X402Version, a5 as MppxCredential, z as SignedRequestAudience, a6 as PaymentRequired, a7 as Message, a8 as MppxChallenge, a9 as ReceiptCredit, aa as DrainReceipt, C as Currency, ab as X402Wallet, ac as PaymentRequirementsV1, ad as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-Bezn-_ZL.js';
2
- export { ae as BuildPaymentRequirementsOpts, af as CapabilityDescriptor, ag as CashuMode, ah as CompleteContent, ai as DrainReceiptEvent, aj as ExactEvmPayload, ak as ExactEvmPayloadAuthorization, al as FundingMethod, am as MessageFrom, an as PaymentPayload, ao as PaymentPayloadV1, ap as PaymentPayloadV2, aq as PaymentRequestContent, ar as PaymentRequiredV2, as as PaymentRequirements, at as PromptContent, au as RAIL_REFUNDABLE, av as ReceiptOutcome, aw as ReceiptPayment, ax as ResourceInfo, ay as SettleResponse, az as StepCache, aA as StepRecord, aB as TextContent, aC as UnsignedDrainReceipt, aD as UnsignedDrawFundingReceipt, aE as UnsignedFundingReceipt, aF as UnsignedJobReceipt, aG as VerifyResponse, aH as WorkingContent, aI as X402Config, aJ as X402ResponseBody, aK as X402SelfRelayRpcFailureReason, aL as X402_DEFAULT_NETWORK, aM as X402_V1_VERSION, aN as X402_VERSION, aO as buildPaymentRequiredV2, aP as buildPaymentRequirements, aQ as caip2ToX402Network, aR as canonicalRequestPath, aS as canonicaliseForSigning, aT as canonicalize, aU as chainIdFromCaip2, aV as computeResultHash, aW as decodePayment, aX as decodePaymentRequiredHeader, aY as encodePayment, aZ as encodePaymentRequiredHeader, a_ as encodeSettleResponseHeader, a$ as exactEvmAuthorization, b0 as isArtifactMessage, b1 as isCancelMessage, b2 as isCompleteMessage, b3 as isDrainReceipt, b4 as isDrawFundingReceipt, b5 as isFundingReceipt, b6 as isPaymentRequestMessage, b7 as isPromptMessage, b8 as isSignedJobReceipt, b9 as isTextMessage, ba as isWorkingMessage, bb as paymentRequiredV2FromV1, bc as signDrainReceipt, bd as signDrawFundingReceipt, be as signFundingReceipt, bf as signReceipt, bg as usdcContractByCaip2, bh as usdcContractFor, bi as usdcDomainNameFor, bj as usdcDomainVersionFor, bk as verifyDrainReceipt, bl as verifyDrawFundingReceipt, bm as verifyFundingReceipt, bn as verifyReceipt, bo as x402NetworkToCaip2 } from '../step-cache-Bezn-_ZL.js';
3
- import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-B1hRUIOb.js';
4
- export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-B1hRUIOb.js';
1
+ import { $ as JsonValue, F as SignedRequestDomain, O as SignedRequestStatementHeader, a0 as X402_BATCH_SETTLEMENT_SCHEME, a1 as X402_EXACT_SCHEME, a2 as DrawFundingReceipt, a3 as FundingReceipt, a4 as JobReceipt$1, V as UpfrontPayment, a5 as MessageType, a6 as X402Version, a7 as MppxCredential, E as SignedRequestAudience, a8 as PaymentRequired, a9 as Message, aa as MppxChallenge, ab as ReceiptCredit, ac as DrainReceipt, C as Currency, ad as X402Wallet, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-B83Y9T9p.js';
2
+ export { ag as BuildPaymentRequirementsOpts, ah as CapabilityDescriptor, ai as CashuMode, aj as CompleteContent, ak as DrainReceiptEvent, al as ExactEvmPayload, am as ExactEvmPayloadAuthorization, an as FundingMethod, ao as MessageFrom, ap as PaymentPayload, aq as PaymentPayloadV1, ar as PaymentPayloadV2, as as PaymentRequestContent, at as PaymentRequiredV2, au as PaymentRequirements, av as PromptContent, aw as RAIL_REFUNDABLE, ax as ReceiptOutcome, ay as ReceiptPayment, az as ResourceInfo, aA as SettleResponse, aB as StepCache, aC as StepRecord, aD as TextContent, aE as UnsignedDrainReceipt, aF as UnsignedDrawFundingReceipt, aG as UnsignedFundingReceipt, aH as UnsignedJobReceipt, aI as VerifyResponse, aJ as WorkingContent, aK as X402Config, aL as X402ResponseBody, aM as X402SelfRelayRpcFailureReason, aN as X402_DEFAULT_NETWORK, aO as X402_V1_VERSION, aP as X402_VERSION, aQ as buildPaymentRequiredV2, aR as buildPaymentRequirements, aS as caip2ToX402Network, aT as canonicalRequestPath, aU as canonicaliseForSigning, aV as canonicalize, aW as chainIdFromCaip2, aX as computeResultHash, aY as decodePayment, aZ as decodePaymentRequiredHeader, a_ as encodePayment, a$ as encodePaymentRequiredHeader, b0 as encodeSettleResponseHeader, b1 as exactEvmAuthorization, b2 as isArtifactMessage, b3 as isCancelMessage, b4 as isCompleteMessage, b5 as isDrainReceipt, b6 as isDrawFundingReceipt, b7 as isFundingReceipt, b8 as isPaymentRequestMessage, b9 as isPromptMessage, ba as isSignedJobReceipt, bb as isTextMessage, bc as isWorkingMessage, bd as paymentRequiredV2FromV1, be as signDrainReceipt, bf as signDrawFundingReceipt, bg as signFundingReceipt, bh as signReceipt, bi as usdcContractByCaip2, bj as usdcContractFor, bk as usdcDomainNameFor, bl as usdcDomainVersionFor, bm as verifyDrainReceipt, bn as verifyDrawFundingReceipt, bo as verifyFundingReceipt, bp as verifyReceipt, bq as x402NetworkToCaip2 } from '../step-cache-B83Y9T9p.js';
3
+ import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-B2wMBR-x.js';
4
+ export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-B2wMBR-x.js';
5
5
  import { ProofLike, MeltQuoteBolt11Response, Proof, Wallet, MintQuoteBolt11Response, MintPreview, CounterSource, CounterRange, SerializedDLEQ, OutputData, OutputDataLike } from '@cashu/cashu-ts';
6
6
  export { g as getWallet } from '../wallet-Dwjs5n_M.js';
7
7
  import { SimplePool } from 'nostr-tools/pool';
@@ -9,8 +9,8 @@ import { Session } from 'mppx/tempo';
9
9
  import { Pool } from 'pg';
10
10
  import { PaymentRequired as PaymentRequired$1 } from '@x402/core/types';
11
11
  import { ClientChannelStorage, BatchSettlementClientContext, BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
12
- export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-CpqQaIfg.js';
13
- export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-CJwU3-A4.js';
12
+ export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-QoVA2oBc.js';
13
+ export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-g9kCw86F.js';
14
14
  import 'hono';
15
15
  import 'mppx';
16
16
  import '@x402/core/server';
@@ -1635,6 +1635,8 @@ interface V1InfoResponse {
1635
1635
  lock_pubkeys: string[];
1636
1636
  lock_pubkey_grace_seconds: number;
1637
1637
  min_locktime: number;
1638
+ /** Refund-locktime floor, in seconds, for an unsigned paid call; present only when the DVM configures one. */
1639
+ unsigned_min_locktime?: number;
1638
1640
  canonical_id: string | null;
1639
1641
  };
1640
1642
  }
@@ -1718,6 +1720,7 @@ interface ProviderInfo {
1718
1720
  mints: string[];
1719
1721
  lock_pubkeys: string[];
1720
1722
  min_locktime: number;
1723
+ unsigned_min_locktime?: number;
1721
1724
  canonical_id: string | null;
1722
1725
  };
1723
1726
  /** Git SHA the deployed image was built from. `"unknown"` when baked-in SHA is absent. */
@@ -3950,8 +3953,9 @@ declare function withinAdvertisedTolerance(advertisedMicro: bigint, localMicro:
3950
3953
  declare function withInitRetry(fn: () => Promise<void>, label: string, delays?: number[]): Promise<void>;
3951
3954
  /** Patches pool.query and pool.connect in-place to retry transport errors.
3952
3955
  * Idempotent — safe to call multiple times on the same pool instance.
3953
- * Ordinary work retries once; a bounded recovery context may replace every
3954
- * socket in the configured pool during a money-protection request.
3956
+ * Recovery may replace every socket in the configured pool. The connection
3957
+ * timeout bounds how long ordinary work starts retries; a request context can
3958
+ * supply its own deadline.
3955
3959
  * Registers pool.on("error") to prevent idle-client eviction errors from crashing the process,
3956
3960
  * and attaches an 'error' guard to every checked-out client for the same reason (see
3957
3961
  * {@link guardCheckedOutClient}). */
@@ -4,7 +4,7 @@ import {
4
4
  getX402Balance,
5
5
  isValidEvmPrivateKey,
6
6
  resolveX402Asset
7
- } from "../chunk-WMGXJQI3.js";
7
+ } from "../chunk-5RGZN6WQ.js";
8
8
  import {
9
9
  CAPABILITY_NAME_RE
10
10
  } from "../chunk-A262WVYX.js";
@@ -167,7 +167,7 @@ import {
167
167
  usdcDomainVersionFor,
168
168
  usdcToMsats,
169
169
  x402NetworkToCaip2
170
- } from "../chunk-62FI3NJF.js";
170
+ } from "../chunk-NUDHO4HV.js";
171
171
  import {
172
172
  RAIL_REFUNDABLE,
173
173
  SIGNED_REQUEST_AUTH_ID,
@@ -211,7 +211,7 @@ import {
211
211
  import {
212
212
  applyRetryToPool,
213
213
  withInitRetry
214
- } from "../chunk-EIDRCGTY.js";
214
+ } from "../chunk-INYFUPXV.js";
215
215
  import {
216
216
  DvmError,
217
217
  X402_NETWORKS,
@@ -1,22 +1,22 @@
1
1
  import { FacilitatorConfig } from '@x402/core/server';
2
- import { an as PaymentPayload, ac as PaymentRequirementsV1, ad as PaymentRequirementsV2, aI as X402Config, ay as SettleResponse, aG as VerifyResponse, bp as X402ExactVersionSupport, bq as X402Receipt, br as TransactionalPayoutHook, bs as CashuMeltCompleted } from '../step-cache-Bezn-_ZL.js';
3
- export { bt as CreditDepositPayload, bu as CreditDrainPayload, bv as FundingLot, bw as LotDebit, bx as LotDepletion, by as MppxServer, bz as NON_CHANNEL_BITCOIN_RAILS, bA as NonChannelBitcoinRail, bB as PayoutReporter, bC as PostgresTempoSessionStore, bD as RevenueReporter, bE as SIGNED_ENVELOPE_FIELDS, bF as SIGNED_ENVELOPE_TYPES, bG as X402TrackedChannel, bH as _testing, bI as createDefaultReplayStore, bJ as depleteLots, bK as fifoOrder, bL as inKindDrawMsats, bM as isInKindDepletion, bN as isNonChannelBitcoinRail, bO as lotOwedSats, bP as netOwedSats, bQ as wrapMppx } from '../step-cache-Bezn-_ZL.js';
2
+ import { ap as PaymentPayload, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, aK as X402Config, aA as SettleResponse, aI as VerifyResponse, br as X402ExactVersionSupport, bs as X402Receipt, bt as TransactionalPayoutHook, bu as CashuMeltCompleted } from '../step-cache-B83Y9T9p.js';
3
+ export { bv as CreditDepositPayload, bw as CreditDrainPayload, bx as FundingLot, by as LotDebit, bz as LotDepletion, bA as MppxServer, bB as NON_CHANNEL_BITCOIN_RAILS, bC as NonChannelBitcoinRail, bD as PayoutReporter, bE as PostgresTempoSessionStore, bF as RevenueReporter, bG as SIGNED_ENVELOPE_FIELDS, bH as SIGNED_ENVELOPE_TYPES, bI as X402TrackedChannel, bJ as _testing, bK as createDefaultReplayStore, bL as depleteLots, bM as fifoOrder, bN as inKindDrawMsats, bO as isInKindDepletion, bP as isNonChannelBitcoinRail, bQ as lotOwedSats, bR as netOwedSats, bS as wrapMppx } from '../step-cache-B83Y9T9p.js';
4
4
  import { Hono } from 'hono';
5
5
  import { Env, BlankSchema } from 'hono/types';
6
6
  import { Pool } from 'pg';
7
7
  export { Pool } from 'pg';
8
8
  import { g as getWallet } from '../wallet-Dwjs5n_M.js';
9
- import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-D-h0zJCZ.js';
10
- export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-D-h0zJCZ.js';
11
- export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-CgXT79tS.js';
9
+ import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-D88XuTLU.js';
10
+ export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-D88XuTLU.js';
11
+ export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-Dy-ogco6.js';
12
12
  import { z } from 'zod';
13
- export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-B1hRUIOb.js';
13
+ export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-B2wMBR-x.js';
14
14
  import 'mppx';
15
15
  import '@x402/evm/batch-settlement/server';
16
16
  import '@x402/core/types';
17
17
  import 'viem';
18
18
  import '@cashu/cashu-ts';
19
- import '../fx-CpqQaIfg.js';
19
+ import '../fx-QoVA2oBc.js';
20
20
 
21
21
  declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
22
22
  declare function settleWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<SettleResponse>;