@dvmkit/sdk 0.18.0 → 0.19.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/{chunk-JQ2Z3MIC.js → chunk-34H4ZKBM.js} +1 -1
- package/dist/{chunk-WMGXJQI3.js → chunk-5RGZN6WQ.js} +1 -1
- package/dist/{chunk-Y6JJDOGO.js → chunk-6RJAE332.js} +17 -7
- package/dist/{chunk-3KRFFLAT.js → chunk-C65P6MGZ.js} +1 -1
- package/dist/{chunk-AYEBQDAZ.js → chunk-DJRTYBEE.js} +1 -1
- package/dist/{chunk-B6T3FEVX.js → chunk-I5MXADJS.js} +1 -1
- package/dist/{chunk-IKMRT7O5.js → chunk-INYFUPXV.js} +1 -0
- package/dist/{chunk-62FI3NJF.js → chunk-NUDHO4HV.js} +4 -2
- package/dist/{chunk-VKFR5PCW.js → chunk-OTNHKRHA.js} +2 -2
- package/dist/{chunk-A6EY4K46.js → chunk-QCZXKUS2.js} +45 -13
- package/dist/{chunk-QNAYENWA.js → chunk-RPJKEWRR.js} +14050 -13530
- package/dist/{content-retention-Cxn-umvR.d.ts → content-retention-C_TToHCi.d.ts} +1 -1
- package/dist/{credit-ledger-SBLDJCLE.js → credit-ledger-ZCJXJG6R.js} +2 -2
- package/dist/{credit-menu-CYjp3FA3.d.ts → credit-menu-BlODG4E7.d.ts} +144 -6
- package/dist/{fx-D2w3wCvY.d.ts → fx-QoVA2oBc.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +14 -1
- package/dist/internal/caller.d.ts +6 -6
- package/dist/internal/caller.js +3 -3
- package/dist/internal/server.d.ts +7 -7
- package/dist/internal/server.js +10 -10
- package/dist/{job-store-Ci2ihiVr.d.ts → job-store-D4-18IKm.d.ts} +5 -1
- package/dist/{lightning-backend-DMBY7PaJ.d.ts → lightning-backend-B2wMBR-x.d.ts} +1 -1
- package/dist/{memory-credit-ledger-DMIGIH2H.js → memory-credit-ledger-N4PZKTT5.js} +3 -3
- package/dist/{postgres-job-store-E5GXLRB4.js → postgres-job-store-QKN5LGAH.js} +1 -1
- package/dist/server/index.d.ts +11 -10
- package/dist/server/index.js +12 -12
- package/dist/{step-cache-B_18RAPb.d.ts → step-cache-B83Y9T9p.d.ts} +31 -8
- package/dist/{tempo-session-store-N3TFZ26X.js → tempo-session-store-XJE6GIXN.js} +2 -2
- package/dist/testing/index.d.ts +5 -3
- package/dist/testing/index.js +1 -1
- package/dist/{usd-ROzdYbbm.d.ts → usd-g9kCw86F.d.ts} +1 -1
- package/dist/{x402-HVCUEWWU.js → x402-XLFD43RF.js} +4 -4
- package/package.json +2 -2
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
isDrainMethod,
|
|
11
11
|
isFundingRail,
|
|
12
12
|
x402SettlementPending
|
|
13
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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,
|
|
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-
|
|
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-
|
|
8
|
+
import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-D4-18IKm.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
|
/**
|
|
@@ -2287,7 +2410,7 @@ declare function verifyTempoSessionManagementCredential(args: {
|
|
|
2287
2410
|
* here: the former is already complete, the latter is a challenge envelope, not
|
|
2288
2411
|
* an error report.
|
|
2289
2412
|
*/
|
|
2290
|
-
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;
|
|
2291
2414
|
/**
|
|
2292
2415
|
* Per-code display, hint and retryability may be overridden for a particular
|
|
2293
2416
|
* refusal. Keep the hint and retry decision consistent. Extra fields merge
|
|
@@ -2764,6 +2887,11 @@ interface JobManagerOpts {
|
|
|
2764
2887
|
enqueueCreditDeposit?: CreditDepositEnqueue;
|
|
2765
2888
|
/** Reporter outbox inserted atomically with a terminal draw release. */
|
|
2766
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;
|
|
2767
2895
|
/** Credit lifetime a top-up mints with, from the DVM's advertised `credit.ttl`. */
|
|
2768
2896
|
creditTtlMs?: number;
|
|
2769
2897
|
/**
|
|
@@ -3002,6 +3130,12 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
|
|
|
3002
3130
|
private readonly jobStore;
|
|
3003
3131
|
private readonly idleTimers;
|
|
3004
3132
|
private readonly cleanupTimers;
|
|
3133
|
+
private readonly terminalReadRepairs;
|
|
3134
|
+
private readonly terminalSnapshots;
|
|
3135
|
+
private readonly terminalFailures;
|
|
3136
|
+
private readonly terminalPersistenceRetries;
|
|
3137
|
+
private terminalPersistenceStopped;
|
|
3138
|
+
private readonly outgoingQueues;
|
|
3005
3139
|
/** Cost revisions held only by a terminal handler owner until its durable merge succeeds. */
|
|
3006
3140
|
private readonly terminalCostHandoffRetryTimers;
|
|
3007
3141
|
/** Per-job NOTIFY unsubscribe handles for the durable-status watch. */
|
|
@@ -3194,6 +3328,9 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
|
|
|
3194
3328
|
* subscriber's NOTIFY-driven fetch can see it).
|
|
3195
3329
|
*/
|
|
3196
3330
|
persistJob(job: ServerJob): Promise<void>;
|
|
3331
|
+
private scheduleTerminalPersistenceRetry;
|
|
3332
|
+
private persistTerminalSnapshot;
|
|
3333
|
+
private persistSnapshot;
|
|
3197
3334
|
/**
|
|
3198
3335
|
* Cross-machine terminal guard. `buildContext`'s guard reads the
|
|
3199
3336
|
* in-memory `job.status`, so on its own it only protects the machine running
|
|
@@ -3278,6 +3415,7 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
|
|
|
3278
3415
|
* `artifact`'s NOTIFY silently drops the artifact.
|
|
3279
3416
|
*/
|
|
3280
3417
|
private wireMessageAppender;
|
|
3418
|
+
private flushOutgoing;
|
|
3281
3419
|
startIdleTimer(job: ServerJob, deadline?: number | undefined): void;
|
|
3282
3420
|
clearIdleTimer(id: string): void;
|
|
3283
3421
|
/** Cancel a job due to idle timeout. Exposed for the reactivation path's idle-expiry guard. */
|
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-
|
|
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-
|
|
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-
|
|
4
|
-
export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-
|
|
5
|
-
export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-
|
|
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-D4-18IKm.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
|
@@ -148,6 +148,15 @@ function validateCapabilityPrice(price, capabilityName, currency) {
|
|
|
148
148
|
}
|
|
149
149
|
validatePriceLiteral(price, `configureDVM: capability "${capabilityName}" price`, "price");
|
|
150
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
|
+
}
|
|
151
160
|
function collectTags(config) {
|
|
152
161
|
const tagSet = /* @__PURE__ */ new Set();
|
|
153
162
|
if (config.tag) tagSet.add(config.tag);
|
|
@@ -174,6 +183,7 @@ function buildCapabilityMap(config, currency) {
|
|
|
174
183
|
const name = typeof config.capability === "string" ? config.capability : slugifyCapabilityName(config.name);
|
|
175
184
|
validateCapabilityName(name);
|
|
176
185
|
validateCapabilityPrice(config.price, name, currency);
|
|
186
|
+
validateMaxRuntimeSeconds(config.maxRuntimeSeconds, name);
|
|
177
187
|
validateExampleAgainstInput(name, config.input, config.example);
|
|
178
188
|
const entry = {
|
|
179
189
|
name,
|
|
@@ -184,6 +194,7 @@ function buildCapabilityMap(config, currency) {
|
|
|
184
194
|
price: config.price,
|
|
185
195
|
onQuote: config.onQuote,
|
|
186
196
|
rates: snapshotRates(config.rates),
|
|
197
|
+
maxRuntimeSeconds: config.maxRuntimeSeconds,
|
|
187
198
|
onJob: config.onJob,
|
|
188
199
|
onResponse: config.onResponse,
|
|
189
200
|
onPayment: config.onPayment,
|
|
@@ -206,6 +217,7 @@ function buildExplicitCapabilities(capabilities, currency) {
|
|
|
206
217
|
throw new Error(`configureDVM: capability "${name}" is missing required onJob handler`);
|
|
207
218
|
}
|
|
208
219
|
validateCapabilityPrice(cap.price, name, currency);
|
|
220
|
+
validateMaxRuntimeSeconds(cap.maxRuntimeSeconds, name);
|
|
209
221
|
validateExampleAgainstInput(name, cap.input, cap.example);
|
|
210
222
|
const entry = {
|
|
211
223
|
name,
|
|
@@ -220,6 +232,7 @@ function buildExplicitCapabilities(capabilities, currency) {
|
|
|
220
232
|
price: cap.price,
|
|
221
233
|
onQuote: cap.onQuote,
|
|
222
234
|
rates: snapshotRates(cap.rates),
|
|
235
|
+
maxRuntimeSeconds: cap.maxRuntimeSeconds,
|
|
223
236
|
onJob: cap.onJob,
|
|
224
237
|
onResponse: cap.onResponse,
|
|
225
238
|
onPayment: cap.onPayment,
|
|
@@ -232,7 +245,7 @@ function buildExplicitCapabilities(capabilities, currency) {
|
|
|
232
245
|
return out;
|
|
233
246
|
}
|
|
234
247
|
function flatPerCapFieldsSet(config) {
|
|
235
|
-
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";
|
|
236
249
|
}
|
|
237
250
|
function validateExampleAgainstInput(capName, input, example) {
|
|
238
251
|
if (example === void 0) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
13
|
-
export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-
|
|
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';
|
package/dist/internal/caller.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getX402Balance,
|
|
5
5
|
isValidEvmPrivateKey,
|
|
6
6
|
resolveX402Asset
|
|
7
|
-
} from "../chunk-
|
|
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-
|
|
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-
|
|
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 { 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-
|
|
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-
|
|
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-
|
|
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-
|
|
11
|
-
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-
|
|
9
|
+
import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-BlODG4E7.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-BlODG4E7.js';
|
|
11
|
+
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-D4-18IKm.js';
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-
|
|
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-
|
|
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>;
|
package/dist/internal/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PostgresTempoSessionStore
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-34H4ZKBM.js";
|
|
4
4
|
import {
|
|
5
5
|
verifyX402Payment
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-OTNHKRHA.js";
|
|
7
7
|
import {
|
|
8
8
|
RevenueReporter
|
|
9
9
|
} from "../chunk-CVN2YNMG.js";
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
verifyUpfrontPayment,
|
|
62
62
|
x402RequiredUsdcMicro,
|
|
63
63
|
x402SettledShare
|
|
64
|
-
} from "../chunk-
|
|
64
|
+
} from "../chunk-RPJKEWRR.js";
|
|
65
65
|
import "../chunk-XRLKGCAW.js";
|
|
66
66
|
import {
|
|
67
67
|
PayoutReporter
|
|
@@ -69,9 +69,9 @@ import {
|
|
|
69
69
|
import {
|
|
70
70
|
settleWithFacilitator,
|
|
71
71
|
verifyWithFacilitator
|
|
72
|
-
} from "../chunk-
|
|
73
|
-
import "../chunk-
|
|
74
|
-
import "../chunk-
|
|
72
|
+
} from "../chunk-C65P6MGZ.js";
|
|
73
|
+
import "../chunk-DJRTYBEE.js";
|
|
74
|
+
import "../chunk-QCZXKUS2.js";
|
|
75
75
|
import {
|
|
76
76
|
SIGNED_ENVELOPE_FIELDS,
|
|
77
77
|
SIGNED_ENVELOPE_TYPES,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
import {
|
|
82
82
|
createInstrumentedFetch,
|
|
83
83
|
isStaleJobReapable
|
|
84
|
-
} from "../chunk-
|
|
84
|
+
} from "../chunk-6RJAE332.js";
|
|
85
85
|
import {
|
|
86
86
|
JobCancelledError,
|
|
87
87
|
abortJob,
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
import {
|
|
95
95
|
toLockPubkey
|
|
96
96
|
} from "../chunk-7RWE6ELV.js";
|
|
97
|
-
import "../chunk-
|
|
97
|
+
import "../chunk-NUDHO4HV.js";
|
|
98
98
|
import "../chunk-SXL44PL5.js";
|
|
99
99
|
import "../chunk-QTKGFG3I.js";
|
|
100
100
|
import "../chunk-FUJ36YDV.js";
|
|
@@ -110,11 +110,11 @@ import {
|
|
|
110
110
|
isNonChannelBitcoinRail,
|
|
111
111
|
lotOwedSats,
|
|
112
112
|
netOwedSats
|
|
113
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-I5MXADJS.js";
|
|
114
114
|
import "../chunk-YG7G4DPZ.js";
|
|
115
115
|
import "../chunk-COYKJRMM.js";
|
|
116
116
|
import "../chunk-5UC7TOQC.js";
|
|
117
|
-
import "../chunk-
|
|
117
|
+
import "../chunk-INYFUPXV.js";
|
|
118
118
|
import "../chunk-BPYMEMQX.js";
|
|
119
119
|
import "../chunk-H3GGFEE5.js";
|
|
120
120
|
import {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a9 as Message, V as UpfrontPayment, an as FundingMethod, a3 as FundingReceipt, bZ as CreditSnapshot, a4 as JobReceipt, aC as StepRecord, a5 as MessageType } from './step-cache-
|
|
1
|
+
import { a9 as Message, V as UpfrontPayment, an as FundingMethod, a3 as FundingReceipt, bZ as CreditSnapshot, a4 as JobReceipt, aC as StepRecord, a5 as MessageType } from './step-cache-B83Y9T9p.js';
|
|
2
2
|
import { ProofLike } from '@cashu/cashu-ts';
|
|
3
3
|
|
|
4
4
|
type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
|
|
@@ -256,6 +256,8 @@ interface PaymentCreditDelta {
|
|
|
256
256
|
}
|
|
257
257
|
/** Atomic side effects applied with an outgoing provider message. */
|
|
258
258
|
interface AppendOutgoingOptions {
|
|
259
|
+
/** Stable identity for retrying an append whose commit acknowledgement was lost. */
|
|
260
|
+
appendId?: string;
|
|
259
261
|
/** A suspending SDK prompt/payment yield; event-driven messages leave status unchanged. */
|
|
260
262
|
awaitingInput?: boolean;
|
|
261
263
|
pendingPaymentDelta?: number;
|
|
@@ -567,6 +569,8 @@ interface StreamableJobStore extends JobStore {
|
|
|
567
569
|
* machine won).
|
|
568
570
|
*/
|
|
569
571
|
cancelJob(jobId: string, reason: string): Promise<boolean>;
|
|
572
|
+
/** Atomically fail a nonterminal job with its final reason and durable message history. */
|
|
573
|
+
failJob?(jobId: string, reason: string): Promise<boolean>;
|
|
570
574
|
/**
|
|
571
575
|
* Bump `last_activity_at` to `now` (Unix ms) for the given jobs that are
|
|
572
576
|
* still in `processing`/`working`. Called on a
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryCreditLedger
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-DJRTYBEE.js";
|
|
4
|
+
import "./chunk-I5MXADJS.js";
|
|
5
5
|
import "./chunk-YG7G4DPZ.js";
|
|
6
6
|
import "./chunk-COYKJRMM.js";
|
|
7
7
|
import "./chunk-5UC7TOQC.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-INYFUPXV.js";
|
|
9
9
|
import "./chunk-BPYMEMQX.js";
|
|
10
10
|
import "./chunk-H3GGFEE5.js";
|
|
11
11
|
import "./chunk-ALTE7I6C.js";
|