@dvmkit/sdk 0.1.3-rc.7 → 0.1.5-rc.7

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 (38) hide show
  1. package/README.md +116 -9
  2. package/dist/{chunk-ANFX5HEG.js → chunk-2UUXIIOC.js} +43 -13
  3. package/dist/{chunk-C6JHBLMW.js → chunk-BIP6G74V.js} +1 -1
  4. package/dist/{chunk-EPNDZ5DH.js → chunk-CEOAHV2I.js} +0 -30
  5. package/dist/{chunk-TSWKITGR.js → chunk-CGKZDODG.js} +8 -1
  6. package/dist/{chunk-YDIYXGYL.js → chunk-E4EVGPDX.js} +16 -9
  7. package/dist/{chunk-NFRM5QYP.js → chunk-EVBK675R.js} +5 -0
  8. package/dist/{chunk-DBCLBYHP.js → chunk-KVEHHC7W.js} +11 -1
  9. package/dist/{chunk-2K7E3N2D.js → chunk-KXCKFIJI.js} +77 -14
  10. package/dist/{chunk-3ZHMQCYP.js → chunk-NJFOV36R.js} +663 -235
  11. package/dist/{chunk-5GFED3GJ.js → chunk-NPIW5VR5.js} +40 -6
  12. package/dist/{chunk-LLXV32HA.js → chunk-SSSZUVWM.js} +96 -3
  13. package/dist/{chunk-7AKBC4PW.js → chunk-TQWGQCNV.js} +1 -1
  14. package/dist/{chunk-4B56DEEV.js → chunk-U6M3ATSG.js} +7 -1
  15. package/dist/{credit-menu-C7zAJElJ.d.ts → credit-menu-B-e3vZGo.d.ts} +136 -21
  16. package/dist/{fx-BF_SG2i0.d.ts → fx-CGRJE8rm.d.ts} +1 -1
  17. package/dist/index.d.ts +5 -5
  18. package/dist/internal/caller.d.ts +54 -22
  19. package/dist/internal/caller.js +171 -38
  20. package/dist/internal/index.js +1 -1
  21. package/dist/internal/server.d.ts +8 -8
  22. package/dist/internal/server.js +7 -7
  23. package/dist/{job-store-Bn23V3QU.d.ts → job-store-Cnlv9pOx.d.ts} +16 -1
  24. package/dist/{lightning-backend-C04nH94l.d.ts → lightning-backend-KvQM0YHi.d.ts} +1 -1
  25. package/dist/{memory-credit-ledger-OP24Z2KO.js → memory-credit-ledger-MNUOTQO5.js} +1 -1
  26. package/dist/{mpp-setup-MOBWGTWJ.js → mpp-setup-SPBOF5AM.js} +11 -1
  27. package/dist/{postgres-job-store-TAONYLIF.js → postgres-job-store-3RAXMNSY.js} +1 -1
  28. package/dist/{revenue-reporter-XXSU5KVB.js → revenue-reporter-ASZ7SHHH.js} +1 -1
  29. package/dist/server/index.d.ts +26 -13
  30. package/dist/server/index.js +219 -55
  31. package/dist/{step-cache-3cT4Shk0.d.ts → step-cache-CwM_Q8rK.d.ts} +149 -3
  32. package/dist/{tempo-lifecycle-SQL3KLEZ.js → tempo-lifecycle-DFIXQ54Q.js} +3 -3
  33. package/dist/{tempo-wallet-QOLEIPCV.js → tempo-wallet-4QKSV65O.js} +10 -2
  34. package/dist/testing/index.d.ts +13 -3
  35. package/dist/testing/index.js +31 -2
  36. package/dist/{usd-BnuXoFl5.d.ts → usd-nYZSb7KQ.d.ts} +1 -1
  37. package/dist/{x402-T2C5MX3T.js → x402-5H27DCBE.js} +2 -2
  38. package/package.json +6 -4
@@ -313,6 +313,10 @@ var TEMPO_SETTLEMENT_LEASE_OWNER_FIELD = "settlementLeaseOwner";
313
313
  var TEMPO_SETTLEMENT_LEASE_MS = 3e5;
314
314
  var TEMPO_SETTLEMENT_IN_FLIGHT = "settlement already in flight";
315
315
  var TEMPO_USDC_MAINNET = "0x20C000000000000000000000b9537d11c60E8b50";
316
+ var TEMPO_MAINNET_CHAIN_ID = 4217;
317
+ var TEMPO_MODERATO_CHAIN_ID = 42431;
318
+ var TEMPO_PATH_USD_MODERATO = "0x20c0000000000000000000000000000000000000";
319
+ var TEMPO_MODERATO_RPC = "https://rpc.moderato.tempo.xyz";
316
320
  var HEX_ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
317
321
  function challengeMeta(challenge) {
318
322
  if (challenge.opaque) {
@@ -417,15 +421,21 @@ function buildMppMethods(opts, env) {
417
421
  `DVMKIT_TEMPO_RECIPIENT must be a 0x-prefixed 40-char hex address; got '${opts.tempoRecipient}'.`
418
422
  );
419
423
  }
420
- const tempoCurrency = env.DVMKIT_TEMPO_CURRENCY ?? TEMPO_USDC_MAINNET;
424
+ const { chainId, currency: tempoCurrency } = resolveTempoNetwork(env);
421
425
  if (!HEX_ADDRESS_RE.test(tempoCurrency)) {
422
426
  throw new Error(
423
427
  `DVMKIT_TEMPO_CURRENCY must be a 0x-prefixed 40-char hex address; got '${tempoCurrency}'.`
424
428
  );
425
429
  }
430
+ if (opts.tempoSession?.chainId !== void 0 && opts.tempoSession.chainId !== chainId) {
431
+ throw new Error(
432
+ `Tempo session chain ${opts.tempoSession.chainId} does not match the configured Tempo chain ${chainId}.`
433
+ );
434
+ }
426
435
  tempoConfiguration = {
427
436
  recipient: opts.tempoRecipient,
428
437
  paymentToken: tempoCurrency,
438
+ chainId,
429
439
  ...opts.tempoSession && {
430
440
  operator: opts.tempoSession.account.address,
431
441
  feeToken: tempoCurrency
@@ -435,6 +445,7 @@ function buildMppMethods(opts, env) {
435
445
  tempo.charge({
436
446
  recipient: opts.tempoRecipient,
437
447
  currency: tempoCurrency,
448
+ chainId,
438
449
  decimals: 6,
439
450
  // Without this mppx installs `Store.memory()`, so the consumed-hash
440
451
  // guard is per-process and a credential replayed onto a sibling machine
@@ -462,9 +473,7 @@ function buildMppMethods(opts, env) {
462
473
  // dvmkit's watcher owns scheduled settlement because it gates on
463
474
  // terminal ledger consumption. mppx's in-request scheduler settles
464
475
  // the full accepted voucher and can capture caller-owned balance.
465
- ...opts.tempoSession.chainId !== void 0 && {
466
- chainId: opts.tempoSession.chainId
467
- },
476
+ chainId: opts.tempoSession.chainId ?? chainId,
468
477
  ...opts.tempoSession.getClient && { getClient: opts.tempoSession.getClient },
469
478
  ...opts.tempoSession.onSessionSettlement && {
470
479
  onSessionSettlement: opts.tempoSession.onSessionSettlement
@@ -476,6 +485,24 @@ function buildMppMethods(opts, env) {
476
485
  if (methods.length === 0 || !tempoConfiguration) return void 0;
477
486
  return { methods, tempoConfiguration };
478
487
  }
488
+ function resolveTempoNetwork(env) {
489
+ const testnet = env.DVMKIT_TEMPO_TESTNET === "1" || env.DVMKIT_TEMPO_TESTNET === "true";
490
+ const rawChainId = env.DVMKIT_TEMPO_CHAIN_ID?.trim();
491
+ const chainId = rawChainId ? Number(rawChainId) : testnet ? TEMPO_MODERATO_CHAIN_ID : TEMPO_MAINNET_CHAIN_ID;
492
+ if (!Number.isSafeInteger(chainId) || chainId <= 0) {
493
+ throw new Error(
494
+ `DVMKIT_TEMPO_CHAIN_ID must be a positive safe integer; got '${env.DVMKIT_TEMPO_CHAIN_ID}'.`
495
+ );
496
+ }
497
+ const currency = env.DVMKIT_TEMPO_CURRENCY ?? (chainId === TEMPO_MODERATO_CHAIN_ID ? TEMPO_PATH_USD_MODERATO : TEMPO_USDC_MAINNET);
498
+ const normalizedCurrency = currency.toLowerCase();
499
+ if (chainId === TEMPO_MODERATO_CHAIN_ID && normalizedCurrency === TEMPO_USDC_MAINNET.toLowerCase()) {
500
+ throw new Error(
501
+ `DVMKIT_TEMPO_CURRENCY ${currency} is incompatible with DVMKIT_TEMPO_CHAIN_ID ${chainId}.`
502
+ );
503
+ }
504
+ return { chainId, currency, testnet };
505
+ }
479
506
  function isHmacMismatch(err) {
480
507
  if (!(err instanceof MppxErrors.InvalidChallengeError)) return false;
481
508
  return typeof err.message === "string" && err.message.includes(MPPX_HMAC_MISMATCH_REASON);
@@ -491,14 +518,16 @@ function decorateRapidRotation(original, rapidRotationAtMs) {
491
518
  }
492
519
  function wrapMppx(mppx) {
493
520
  const dispatcher = mppx.challenge;
521
+ const server = mppx;
494
522
  const issueChallenge = (method, intent, o) => {
495
523
  const handler = dispatcher[method][intent];
496
524
  if (!handler) {
497
525
  throw new Error(`Mppx: no challenge handler registered for ${method}/${intent}`);
498
526
  }
499
- return handler(o);
527
+ const chainId = method === "tempo" ? server.tempoConfiguration?.chainId : void 0;
528
+ return handler(chainId === void 0 ? o : { chainId, ...o });
500
529
  };
501
- return Object.assign(mppx, { issueChallenge });
530
+ return Object.assign(server, { issueChallenge });
502
531
  }
503
532
  var DEFAULT_TEMPO_SESSION_CHAIN_OPS = {
504
533
  getChannelStatesBatch: TempoSession.Precompile.Chain.getChannelStatesBatch,
@@ -945,9 +974,14 @@ export {
945
974
  TEMPO_SETTLEMENT_LEASE_MS,
946
975
  TEMPO_SETTLEMENT_IN_FLIGHT,
947
976
  TEMPO_USDC_MAINNET,
977
+ TEMPO_MAINNET_CHAIN_ID,
978
+ TEMPO_MODERATO_CHAIN_ID,
979
+ TEMPO_PATH_USD_MODERATO,
980
+ TEMPO_MODERATO_RPC,
948
981
  challengeMeta,
949
982
  createMppFromOpts,
950
983
  createDualKeyMppxFromOpts,
984
+ resolveTempoNetwork,
951
985
  wrapMppx,
952
986
  parseMppMethodsAllowlist,
953
987
  advertisedMethods,
@@ -125,6 +125,7 @@ var ListenChannel = class {
125
125
 
126
126
  // src/sdk/server/postgres-job-store.ts
127
127
  var JOB_MESSAGES_CHANNEL = "job_messages";
128
+ var JOB_DVM_ID = /* @__PURE__ */ Symbol("jobDvmId");
128
129
  var PostgresJobStore = class {
129
130
  pool;
130
131
  listenChannel = null;
@@ -177,6 +178,18 @@ var PostgresJobStore = class {
177
178
  ALTER TABLE jobs ADD COLUMN IF NOT EXISTS native_amount DOUBLE PRECISION;
178
179
  ALTER TABLE jobs ADD COLUMN IF NOT EXISTS native_asset TEXT;
179
180
  ALTER TABLE jobs ADD COLUMN IF NOT EXISTS cashu_flow TEXT;
181
+ -- internal-review: what the job cost the BUILDER to serve, declared by the
182
+ -- handler through ctx.cost(). NULL is "unreported", deliberately
183
+ -- distinguishable from a declared zero.
184
+ ALTER TABLE jobs ADD COLUMN IF NOT EXISTS cost_amount_micro BIGINT;
185
+ ALTER TABLE jobs ADD COLUMN IF NOT EXISTS cost_currency TEXT;
186
+ ALTER TABLE jobs ADD COLUMN IF NOT EXISTS cost_revision BIGINT;
187
+ -- Cost-only reports are queued after the terminal row lands. Keep the
188
+ -- owning DVM and the last durably-enqueued revision on that row so a
189
+ -- restarted (or sibling) process can close that crash window without
190
+ -- replaying another mount's jobs.
191
+ ALTER TABLE jobs ADD COLUMN IF NOT EXISTS dvm_id TEXT;
192
+ ALTER TABLE jobs ADD COLUMN IF NOT EXISTS cost_reported_revision BIGINT;
180
193
  ALTER TABLE jobs ADD COLUMN IF NOT EXISTS required_msats BIGINT;
181
194
  -- next_seq is intentionally absent from isolate_jobs (platform/db.ts).
182
195
  -- It powers StreamableJobStore cross-machine seq allocation; isolate
@@ -245,6 +258,10 @@ var PostgresJobStore = class {
245
258
  CREATE INDEX IF NOT EXISTS idx_jobs_retention
246
259
  ON jobs (last_activity_at, id)
247
260
  WHERE redacted_at IS NULL AND status IN ('completed', 'failed', 'cancelled');
261
+ CREATE INDEX IF NOT EXISTS idx_jobs_pending_cost_report
262
+ ON jobs (dvm_id, id)
263
+ WHERE cost_revision IS NOT NULL
264
+ AND status IN ('completed', 'failed', 'cancelled');
248
265
  -- internal-review: the idempotent-replay lookup. payment_tx_hash carries the
249
266
  -- caller's X-Cashu-Request-Id on the accumulator path, so a retried paid
250
267
  -- submit finds the job its payment already created.
@@ -413,18 +430,32 @@ var PostgresJobStore = class {
413
430
  held.client.release();
414
431
  }
415
432
  async save(record) {
433
+ await this.saveRecord(record, record[JOB_DVM_ID]);
434
+ }
435
+ /** Persist a job while retaining its mount identity for cost-report recovery. */
436
+ async saveForDvm(record, dvmId) {
437
+ const scoped = record;
438
+ scoped[JOB_DVM_ID] = dvmId;
439
+ try {
440
+ await this.save(scoped);
441
+ } finally {
442
+ delete scoped[JOB_DVM_ID];
443
+ }
444
+ }
445
+ async saveRecord(record, dvmId) {
416
446
  const { rowCount } = await this.pool.query(
417
447
  `INSERT INTO jobs (
418
448
  id, tags, capability, input, params, requester_id, status, summary,
419
449
  messages, seq, paid_msats, payment_mint, payment_rail,
420
450
  payment_tx_hash, payment_transaction_hash, native_amount, native_asset, cashu_flow,
451
+ cost_amount_micro, cost_currency, cost_revision,
421
452
  received_proofs, pending_payment_msats, pending_mpp_challenge_ids,
422
453
  pending_x402_nonce, pending_x402_amount_usdc_micro, required_msats, step_cache, state, created_at,
423
454
  last_activity_at, next_seq, requester_token_hash, requester_token,
424
455
  request_fingerprint, requester_pubkey, request_id, credit_id, draw_id,
425
456
  pending_payment_fiat_micro, pending_payment_fiat_currency, auth_request_path,
426
- funding_receipt, funding_credit
427
- ) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41)
457
+ funding_receipt, funding_credit, dvm_id
458
+ ) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45)
428
459
  ON CONFLICT (id) DO UPDATE SET
429
460
  status = EXCLUDED.status,
430
461
  summary = EXCLUDED.summary,
@@ -440,6 +471,29 @@ var PostgresJobStore = class {
440
471
  native_amount = EXCLUDED.native_amount,
441
472
  native_asset = EXCLUDED.native_asset,
442
473
  cashu_flow = EXCLUDED.cashu_flow,
474
+ -- Cost declarations are revisioned because a terminal snapshot can be
475
+ -- re-saved by a different machine. Never let a stale persisted prefix
476
+ -- replace the handler owner's later cumulative declaration; a higher
477
+ -- revision with NULL amount/currency is an intentional invalidation.
478
+ cost_amount_micro = CASE
479
+ WHEN EXCLUDED.cost_revision IS NOT NULL
480
+ AND (jobs.cost_revision IS NULL OR EXCLUDED.cost_revision >= jobs.cost_revision)
481
+ THEN EXCLUDED.cost_amount_micro
482
+ ELSE jobs.cost_amount_micro
483
+ END,
484
+ cost_currency = CASE
485
+ WHEN EXCLUDED.cost_revision IS NOT NULL
486
+ AND (jobs.cost_revision IS NULL OR EXCLUDED.cost_revision >= jobs.cost_revision)
487
+ THEN EXCLUDED.cost_currency
488
+ ELSE jobs.cost_currency
489
+ END,
490
+ cost_revision = CASE
491
+ WHEN EXCLUDED.cost_revision IS NOT NULL
492
+ AND (jobs.cost_revision IS NULL OR EXCLUDED.cost_revision >= jobs.cost_revision)
493
+ THEN EXCLUDED.cost_revision
494
+ ELSE jobs.cost_revision
495
+ END,
496
+ dvm_id = COALESCE(jobs.dvm_id, EXCLUDED.dvm_id),
443
497
  received_proofs = EXCLUDED.received_proofs,
444
498
  pending_mpp_challenge_ids = EXCLUDED.pending_mpp_challenge_ids,
445
499
  pending_x402_nonce = EXCLUDED.pending_x402_nonce,
@@ -478,6 +532,9 @@ var PostgresJobStore = class {
478
532
  record.nativeAmount ?? null,
479
533
  record.nativeAsset ?? null,
480
534
  record.cashuFlow ?? null,
535
+ record.costAmountMicro ?? null,
536
+ record.costCurrency ?? null,
537
+ record.costRevision ?? null,
481
538
  JSON.stringify(record.receivedProofs),
482
539
  record.pendingPaymentMsats ?? null,
483
540
  record.pendingMppChallengeIds ? JSON.stringify(record.pendingMppChallengeIds) : null,
@@ -513,7 +570,8 @@ var PostgresJobStore = class {
513
570
  // whose live gate accepted this proof.
514
571
  record.authRequestPath ?? null,
515
572
  record.fundingReceipt ? JSON.stringify(record.fundingReceipt) : null,
516
- record.fundingCredit ? JSON.stringify(record.fundingCredit) : null
573
+ record.fundingCredit ? JSON.stringify(record.fundingCredit) : null,
574
+ dvmId ?? null
517
575
  ]
518
576
  );
519
577
  if (rowCount === 0) {
@@ -530,6 +588,38 @@ var PostgresJobStore = class {
530
588
  await this.pool.query("DELETE FROM job_messages WHERE job_id = $1", [record.id]).catch(() => void 0);
531
589
  }
532
590
  }
591
+ /**
592
+ * Read terminal zero-revenue jobs whose latest declared-cost revision has
593
+ * not yet reached the durable reporter outbox.
594
+ */
595
+ async listUnreportedTerminalCosts(args) {
596
+ const { rows } = await this.pool.query(
597
+ `SELECT *
598
+ FROM jobs
599
+ WHERE dvm_id = $1
600
+ AND cost_revision IS NOT NULL
601
+ AND (cost_reported_revision IS NULL OR cost_reported_revision < cost_revision)
602
+ AND (
603
+ status IN ('failed', 'cancelled')
604
+ OR (status = 'completed' AND paid_msats = 0)
605
+ )
606
+ AND ($2::text IS NULL OR id > $2)
607
+ ORDER BY id
608
+ LIMIT $3`,
609
+ [args.dvmId, args.afterJobId ?? null, args.limit]
610
+ );
611
+ return rows.map(rowToRecord);
612
+ }
613
+ /** Mark one revision only after its report has reached durable enqueue. */
614
+ async markTerminalCostReported(jobId, costRevision) {
615
+ const { rowCount } = await this.pool.query(
616
+ `UPDATE jobs
617
+ SET cost_reported_revision = GREATEST(COALESCE(cost_reported_revision, -1), $2)
618
+ WHERE id = $1 AND cost_revision = $2`,
619
+ [jobId, costRevision]
620
+ );
621
+ return rowCount === 1;
622
+ }
533
623
  async delete(id) {
534
624
  await this.pool.query("DELETE FROM jobs WHERE id = $1", [id]);
535
625
  await this.pool.query("DELETE FROM job_messages WHERE job_id = $1", [id]).catch(() => void 0);
@@ -1203,6 +1293,9 @@ function rowToRecord(row) {
1203
1293
  nativeAmount: row.native_amount,
1204
1294
  nativeAsset: row.native_asset,
1205
1295
  cashuFlow: row.cashu_flow,
1296
+ costAmountMicro: row.cost_amount_micro == null ? void 0 : Number(row.cost_amount_micro),
1297
+ costCurrency: row.cost_currency ?? void 0,
1298
+ costRevision: row.cost_revision == null ? void 0 : Number(row.cost_revision),
1206
1299
  creditId: row.credit_id ?? void 0,
1207
1300
  drawId: row.draw_id ?? void 0,
1208
1301
  fundingReceipt: row.funding_receipt ?? void 0,
@@ -2,7 +2,7 @@ import {
2
2
  connectedTempoAccount,
3
3
  tempoBalanceCheckHint,
4
4
  tempoTokenReference
5
- } from "./chunk-ANFX5HEG.js";
5
+ } from "./chunk-2UUXIIOC.js";
6
6
  import {
7
7
  fundingReachableAt,
8
8
  listCredits,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  StepCache,
3
3
  loggers
4
- } from "./chunk-YDIYXGYL.js";
4
+ } from "./chunk-E4EVGPDX.js";
5
5
  import {
6
6
  redactUrl
7
7
  } from "./chunk-FUJ36YDV.js";
@@ -33,6 +33,9 @@ function toJobRecord(job) {
33
33
  nativeAmount: job.nativeAmount,
34
34
  nativeAsset: job.nativeAsset,
35
35
  cashuFlow: job.cashuFlow,
36
+ costAmountMicro: job.costAmountMicro,
37
+ costCurrency: job.costCurrency,
38
+ costRevision: job.costRevision,
36
39
  creditId: job.creditId,
37
40
  drawId: job.drawId,
38
41
  fundingReceipt: job.fundingReceipt,
@@ -76,6 +79,9 @@ function fromJobRecord(record) {
76
79
  nativeAmount: record.nativeAmount,
77
80
  nativeAsset: record.nativeAsset,
78
81
  cashuFlow: record.cashuFlow,
82
+ costAmountMicro: record.costAmountMicro,
83
+ costCurrency: record.costCurrency,
84
+ costRevision: record.costRevision,
79
85
  creditId: record.creditId,
80
86
  drawId: record.drawId,
81
87
  fundingReceipt: record.fundingReceipt,
@@ -1,10 +1,10 @@
1
+ import { ah as FundingMethod, o as PaymentMethod, bM as CreditLedgerLike, a1 as Message, X as FundingReceipt, bO as CreditSnapshot, Y as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a2 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cS as X402SettlementIntent, aq as PaymentRequirementsV2, c1 as CreditLedgerQuerier, cT as X402SettlementCursor, bQ as X402SettlementStatus, cU as X402SettlementWriteOff, bN as X402RefundSettlementGate, cV as X402FacilitatorAuth, cW as X402BatchSettlementConfig, cy as PostgresX402ChannelStorage, cX as X402PayoutObserver, br as MppxServer, ab as CashuMode, cY as CreditDepositEnqueue, cZ as X402SettlementReconciliationReason, ao as PaymentRequirements, a0 as MppxCredential, bm as CreditDepositPayload, bP as DrawResult, cn as CreditLedgerError, a6 as ReceiptCredit, ae as DrainReceiptEvent, ad as DrainReceipt, K as KVStore, y as SignedRequestAudience, c_ as CreditDrawReleaseEnqueue, cx as JobCostReportPayload, cA as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bV as CreditInvoiceRecord, bW as InvoiceSettlement, ch as ClientCompatibilityGate, cf as ClientCompatibility, bu as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-CwM_Q8rK.js';
2
+ import { ProofLike, SerializedDLEQ, Proof } from '@cashu/cashu-ts';
1
3
  import { Hono, Context } from 'hono';
2
4
  import { Pool } from 'pg';
3
- import { a0 as Message, ag as FundingMethod, W as FundingReceipt, bN as CreditSnapshot, X as JobReceipt, S as SDKJobContext, av as StepCache, u as ResponseContent, P as PaymentContent, a1 as MessageType, bi as X402Receipt, aD as X402Config, bh as X402ExactVersionSupport, cQ as X402SettlementIntent, ap as PaymentRequirementsV2, c0 as CreditLedgerQuerier, cR as X402SettlementCursor, bP as X402SettlementStatus, cS as X402SettlementWriteOff, bM as X402RefundSettlementGate, cT as X402FacilitatorAuth, cU as X402BatchSettlementConfig, cw as PostgresX402ChannelStorage, cV as X402PayoutObserver, bq as MppxServer, aa as CashuMode, bL as CreditLedgerLike, cW as CreditDepositEnqueue, cX as X402SettlementReconciliationReason, an as PaymentRequirements, $ as MppxCredential, o as PaymentMethod, bl as CreditDepositPayload, bO as DrawResult, cm as CreditLedgerError, a5 as ReceiptCredit, ad as DrainReceiptEvent, ac as DrainReceipt, K as KVStore, y as SignedRequestAudience, cY as CreditDrawReleaseEnqueue, cy as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bU as CreditInvoiceRecord, bV as InvoiceSettlement, cg as ClientCompatibilityGate, ce as ClientCompatibility, bt as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-3cT4Shk0.js';
4
- import { b as FxRateSnapshot, F as FxFetcher } from './fx-BF_SG2i0.js';
5
- import { g as LockPubkey, f as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-C04nH94l.js';
6
- import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-Bn23V3QU.js';
7
- import { ProofLike, SerializedDLEQ } from '@cashu/cashu-ts';
5
+ import { b as FxRateSnapshot, F as FxFetcher } from './fx-CGRJE8rm.js';
6
+ import { g as LockPubkey, f as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-KvQM0YHi.js';
7
+ import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-Cnlv9pOx.js';
8
8
  import { Challenge } from 'mppx';
9
9
  import { SettleResponse, SupportedResponse } from '@x402/core/types';
10
10
  import { Channel, AutoSettlementConfig } from '@x402/evm/batch-settlement/server';
@@ -149,6 +149,32 @@ declare class MemoryConsumedCredentialStore implements ConsumedCredentialStore {
149
149
  mark(realm: string, challengeId: string, ttlSeconds: number): Promise<void>;
150
150
  }
151
151
 
152
+ /** Effective boot-time payment configuration for one mounted DVM. Health may change later. */
153
+ interface PaymentMode {
154
+ mount: string;
155
+ verification: "required" | "skipped";
156
+ storage: "durable" | "disposable";
157
+ rails: Record<PaymentMethod, {
158
+ status: "verifying" | "unavailable" | "absent";
159
+ testFunds: boolean | null;
160
+ }>;
161
+ }
162
+ /** A completed job's settled customer charge, never the builder's reported cost. */
163
+ interface PaidJobCompletion {
164
+ jobId: string;
165
+ rail: FundingMethod;
166
+ /** Checked integer micro-units in the credit's declared currency. */
167
+ amountMicro: number;
168
+ currency: string;
169
+ /** True only for a recognized test mint/network; null when configuration cannot establish this. */
170
+ testFunds: boolean | null;
171
+ }
172
+
173
+ /** Typed transaction boundary; proof ownership and accounting commit together. */
174
+ interface DisposableCashuCommit {
175
+ commit(requestId: string, proofs: Proof[], account: (ledger: CreditLedgerLike) => Promise<void>): Promise<void>;
176
+ }
177
+
152
178
  /** How often the sweep runs, and how long after boot its first pass fires. */
153
179
  interface CreditExpirySweepOpts {
154
180
  /** Sweep period. Defaults to {@link DEFAULT_SWEEP_INTERVAL_MS}; `0` disables the timer. */
@@ -239,6 +265,25 @@ interface ServerJob {
239
265
  nativeAsset?: "sats" | "usdc" | "usdc.e" | "usd-cents";
240
266
  /** Cashu flow discriminator written into `revenue_events.metadata.cashu_flow` (internal-review). */
241
267
  cashuFlow?: "p2pk_accumulator";
268
+ /**
269
+ * What this job cost the **builder** to serve, in 1e-6 of
270
+ * {@link ServerJob.costCurrency} — the running total the handler declared
271
+ * through `ctx.cost()` (internal-review). Absent until a handler declares
272
+ * something; absent is "unreported", which is not the same fact as a
273
+ * declared zero and is reported differently.
274
+ *
275
+ * Persisted on the row rather than held in the context because the report
276
+ * has to survive a crash between the job finishing and the report landing:
277
+ * the terminal funnel writes this row before it books, and Postgres cost
278
+ * reconciliation retries any revision whose durable-enqueue marker still
279
+ * lags. Never netted against `paidMsats` or the draw — the builder's cost
280
+ * and the caller's payment are two questions.
281
+ */
282
+ costAmountMicro?: number;
283
+ /** Currency {@link ServerJob.costAmountMicro} is 1e-6 of (lowercase ISO-4217). */
284
+ costCurrency?: string;
285
+ /** Number of `ctx.cost()` declarations incorporated into the current cost state. */
286
+ costRevision?: number;
242
287
  /** Credit the upfront payment funded/drew (internal-review). See `JobRecord.creditId`. */
243
288
  creditId?: string;
244
289
  /** The draw placed for this job on `creditId` (internal-review). */
@@ -1870,6 +1915,7 @@ interface UpfrontPaymentOpts {
1870
1915
  cashuMode?: CashuMode;
1871
1916
  /** Per-DVM Postgres pool — required for the `p2pk-accumulator` path. */
1872
1917
  accumulatorDb?: AccumulatorPool;
1918
+ disposableCashu?: DisposableCashuCommit;
1873
1919
  /** DVM identifier — required for the `p2pk-accumulator` path. */
1874
1920
  dvmId?: string;
1875
1921
  /**
@@ -2068,21 +2114,18 @@ type PaymentResult = PaymentInfo & {
2068
2114
  /**
2069
2115
  * Whether a dev-mode server skips payment verification outright (internal-review).
2070
2116
  *
2071
- * One rule, both accept paths: a dev server with **no mints configured**
2072
- * auto-credits, so a builder can drive a priced handler with no wallet and no
2073
- * mint; a dev server wired to a mint verifies for real — upfront at `/v1/job`
2074
- * and mid-job at `POST /v1/job/:id/messages` alike. The two drifted once (the
2075
- * mid-job branch skipped unconditionally), and the asymmetry made the internal-review
2076
- * top-up leg — every rail branch of `verifyIncomingPayment`, plus `fund` +
2077
- * `growDraw` — unreachable at L2: the caller's sats left the wallet and the
2078
- * server credited the job without receiving them. Both call sites read this
2079
- * predicate so they cannot drift again.
2117
+ * Both upfront and mid-job acceptance require verification whenever any Cashu,
2118
+ * x402, or Tempo rail is configured. An unusable configured rail fails closed;
2119
+ * it never silently becomes synthetic development payment.
2080
2120
  *
2081
2121
  * Truthiness on the array reference is deliberate: `mints: []` does not skip.
2082
2122
  */
2083
2123
  declare function devModeSkipsPaymentVerification(opts: {
2084
2124
  devMode?: boolean;
2085
2125
  mints?: string[];
2126
+ x402?: X402Config;
2127
+ mpp?: MppxServer;
2128
+ paymentMethods?: PaymentMethod[];
2086
2129
  }): boolean;
2087
2130
  /**
2088
2131
  * The keys a `payment` message carries money on, in the order
@@ -2249,6 +2292,7 @@ interface IncomingPaymentOpts {
2249
2292
  cashuMode?: CashuMode;
2250
2293
  /** Per-DVM Postgres pool — required for the `p2pk-accumulator` path. */
2251
2294
  accumulatorDb?: AccumulatorPool;
2295
+ disposableCashu?: DisposableCashuCommit;
2252
2296
  /** DVM identifier — required for the `p2pk-accumulator` path. */
2253
2297
  dvmId?: string;
2254
2298
  /** Active NUT-11 P2PK lock pubkeys (current + retired-in-grace). */
@@ -2632,6 +2676,8 @@ interface JobManagerOpts {
2632
2676
  cashuMode?: CashuMode;
2633
2677
  /** Builder's NUT-11 P2PK lock pubkey (internal-review). Required for accumulator mode. */
2634
2678
  lockPubkey?: string;
2679
+ /** Test-only atomic Cashu backend, supplied by the development host. */
2680
+ disposableCashu?: DisposableCashuCommit;
2635
2681
  /** Postgres pool for wallet accumulator persistence. */
2636
2682
  db?: Pool;
2637
2683
  /**
@@ -2699,9 +2745,13 @@ interface JobManagerOpts {
2699
2745
  * use this to report revenue to the platform via `RevenueReporter`. Mirrors
2700
2746
  * the isolate path's `IsolateJobManager.opts.onJobCompleted`.
2701
2747
  */
2748
+ onPaidJobCompleted?: (event: PaidJobCompletion) => void | Promise<void>;
2749
+ paymentMode?: PaymentMode;
2702
2750
  onJobCompleted?: (info: {
2703
2751
  dvmId: string;
2704
2752
  jobId: string;
2753
+ /** Dispatched capability. Omitted only for legacy persisted jobs that predate dispatch. */
2754
+ capability?: string;
2705
2755
  paidMsats: number;
2706
2756
  paymentMint?: string;
2707
2757
  rail: string;
@@ -2709,6 +2759,10 @@ interface JobManagerOpts {
2709
2759
  nativeAmount?: number;
2710
2760
  nativeAsset?: string;
2711
2761
  cashuFlow?: string;
2762
+ cost?: {
2763
+ amountMicro: number;
2764
+ currency: string;
2765
+ };
2712
2766
  creditId?: string;
2713
2767
  drawId?: string;
2714
2768
  drawAmountMicro?: number;
@@ -2717,6 +2771,13 @@ interface JobManagerOpts {
2717
2771
  fundingRef?: string;
2718
2772
  kind?: string;
2719
2773
  }) => void | Promise<void>;
2774
+ /**
2775
+ * Callback fired when a terminal job declared a builder cost but emitted no
2776
+ * revenue report (internal-review). Container-runtime DVMs use the reporter's
2777
+ * durable `job-cost` outbox path. The receiver de-duplicates by DVM + job,
2778
+ * independently of the rail-keyed revenue ledger.
2779
+ */
2780
+ onJobCost?: (info: JobCostReportPayload) => void | Promise<void>;
2720
2781
  /**
2721
2782
  * Callback fired when the stale-job reaper force-fails a *paid* job — its
2722
2783
  * pending credit draw is released rather than settled, because only a
@@ -2895,6 +2956,8 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
2895
2956
  private readonly jobStore;
2896
2957
  private readonly idleTimers;
2897
2958
  private readonly cleanupTimers;
2959
+ /** Cost revisions held only by a terminal handler owner until its durable merge succeeds. */
2960
+ private readonly terminalCostHandoffRetryTimers;
2898
2961
  /** Per-job NOTIFY unsubscribe handles for the durable-status watch (internal-review). */
2899
2962
  private readonly statusWatchers;
2900
2963
  /** Job ids whose durable-status re-read is in flight — coalesces notify storms (internal-review). */
@@ -2918,6 +2981,7 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
2918
2981
  private staleSweepTimer?;
2919
2982
  private heartbeatTimer?;
2920
2983
  private orphanDrawSweepTimer?;
2984
+ private terminalCostRecoveryTimer?;
2921
2985
  private jobRetentionSweepTimer?;
2922
2986
  private jobRetentionBootTimer?;
2923
2987
  /** This manager holds {@link ORPHAN_SWEEP_CLAIMS} for its ledger. */
@@ -2935,6 +2999,8 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
2935
2999
  private readonly monotonicNowMs;
2936
3000
  private sweepInFlight;
2937
3001
  private orphanSweepInFlight;
3002
+ private terminalCostRecoveryInFlight;
3003
+ private terminalCostRecoveryResumeAfter?;
2938
3004
  private jobRetentionSweepInFlight;
2939
3005
  private heartbeatInFlight;
2940
3006
  /**
@@ -3086,6 +3152,16 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
3086
3152
  * stores' terminal-sticky `save`, which keeps the row itself correct).
3087
3153
  */
3088
3154
  private adoptDurableTerminal;
3155
+ /**
3156
+ * Persist an adopted terminal cost, retaining the in-memory revision for a
3157
+ * later retry when the durable store is transiently unavailable.
3158
+ */
3159
+ private tryPersistAdoptedTerminalCost;
3160
+ /** Retry outside the status watcher, which correctly stops once the job is terminal. */
3161
+ private scheduleTerminalCostHandoffRetry;
3162
+ private retryTerminalCostHandoff;
3163
+ /** Durably merge a terminal handler owner's latest cost before reporting it. */
3164
+ private persistAdoptedTerminalCost;
3089
3165
  /**
3090
3166
  * Watch the durable status of a locally-active job (internal-review).
3091
3167
  *
@@ -3582,6 +3658,7 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
3582
3658
  * `context.ts`). The gap is visible to callers — the `seq` series skips a
3583
3659
  * number — which is precisely the completeness signal receipts exist for.
3584
3660
  */
3661
+ private observePaidCompletion;
3585
3662
  issueReceipt(record: JobRecord): Promise<JobReceipt | undefined>;
3586
3663
  /** Build the common settle/release args, adding the hosted release outbox when wired. */
3587
3664
  private drawResolutionArgs;
@@ -3645,8 +3722,27 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
3645
3722
  * from whatever the caller happened to have in hand.
3646
3723
  */
3647
3724
  issueReceiptForStoredJob(jobId: string): Promise<JobReceipt | undefined>;
3725
+ /**
3726
+ * Finish accounting for a terminal written directly to the store — the
3727
+ * stale reaper and a cancel handled on a different machine (internal-review).
3728
+ */
3729
+ finalizeStoredTerminal(jobId: string): Promise<JobReceipt | undefined>;
3648
3730
  /** Handle job reaching terminal state (completed, failed, cancelled). */
3649
3731
  private handleJobTerminal;
3732
+ /**
3733
+ * Re-enqueue terminal cost-only rows left between the job commit and outbox
3734
+ * insert. The marker advances only after `onJobCost` resolves, which for the
3735
+ * SDK reporter means the local durable insert has committed; a crash after
3736
+ * that insert but before the marker can duplicate a payload, but the
3737
+ * revisioned platform contract makes that replay harmless.
3738
+ */
3739
+ recoverTerminalCosts(): Promise<{
3740
+ examined: number;
3741
+ queued: number;
3742
+ complete: boolean;
3743
+ }>;
3744
+ /** Report the latest declared-cost state only when no revenue event carried it. */
3745
+ private reportJobCost;
3650
3746
  /**
3651
3747
  * Report a completed paid job's revenue (internal-review, re-keyed by internal-review).
3652
3748
  * Fire-and-forget — the `RevenueReporter` owns persistence and retry.
@@ -3958,6 +4054,13 @@ interface PlatformReporterOpts {
3958
4054
  /** Platform internal URL. Defaults to `DVMKIT_PLATFORM_URL` env. */
3959
4055
  url?: string;
3960
4056
  }
4057
+ /** Running host handle returned by serve(). */
4058
+ interface DVMServeResult {
4059
+ url: string;
4060
+ close: () => Promise<void>;
4061
+ /** Boot snapshot for each mount; configured but unusable rails remain payment-required. */
4062
+ paymentModes: PaymentMode[];
4063
+ }
3961
4064
  /** Options for {@link createDVMHost}. */
3962
4065
  interface DVMHostOpts {
3963
4066
  /**
@@ -4014,7 +4117,12 @@ interface DVMHostOpts {
4014
4117
  * production must always come through the URI.
4015
4118
  */
4016
4119
  lightningReceive?: LightningReceiveConfig;
4017
- /** When true, payment is skipped if no mints are configured (dev/test). */
4120
+ /** Observe verified completed charges after settlement and receipt issuance, when enabled.
4121
+ * May repeat after reconciliation/reload: deduplicate by jobId. Exceptions are logged and
4122
+ * cannot undo a completed job. Free, synthetic development, failed and released draws do not emit.
4123
+ */
4124
+ onPaidJobCompleted?: (event: PaidJobCompletion) => void | Promise<void>;
4125
+ /** When true, payment is skipped only when no payment rail is configured. */
4018
4126
  devMode?: boolean;
4019
4127
  /** Consumed-credential store override (test seam). */
4020
4128
  consumedCredentialStore?: ConsumedCredentialStore;
@@ -4068,10 +4176,7 @@ interface DVMHost {
4068
4176
  /** Start listening. Returns the live server handle. */
4069
4177
  serve(opts?: {
4070
4178
  port?: number;
4071
- }): Promise<{
4072
- url: string;
4073
- close: () => Promise<void>;
4074
- }>;
4179
+ }): Promise<DVMServeResult>;
4075
4180
  /** Graceful shutdown. Runs descriptor `onShutdown` hooks in reverse mount order. */
4076
4181
  shutdown(): Promise<void>;
4077
4182
  }
@@ -4375,6 +4480,8 @@ interface SDKServerOpts {
4375
4480
  * directly.
4376
4481
  */
4377
4482
  lockPubkey?: string;
4483
+ /** Test-only atomic Cashu backend, supplied by the development host. */
4484
+ disposableCashu?: DisposableCashuCommit;
4378
4485
  /**
4379
4486
  * Rotation grace window (seconds) — retired pubkeys remain advertised on
4380
4487
  * `cashu.lock_pubkeys` and accepted by the receive path until they age out.
@@ -4434,7 +4541,15 @@ interface SDKServerOpts {
4434
4541
  * caller assumes full responsibility for revenue tracking. Intended for
4435
4542
  * tests and advanced integrations only.
4436
4543
  */
4544
+ onPaidJobCompleted?: (event: PaidJobCompletion) => void | Promise<void>;
4545
+ paymentMode?: PaymentMode;
4437
4546
  onJobCompleted?: JobManagerOpts["onJobCompleted"];
4547
+ /**
4548
+ * Advanced override for a declared cost on a terminal job that emitted no
4549
+ * revenue report (internal-review). Auto-wired to the reporter's durable
4550
+ * job-cost path; intended for tests and advanced integrations only.
4551
+ */
4552
+ onJobCost?: JobManagerOpts["onJobCost"];
4438
4553
  /**
4439
4554
  * Advanced override: callback fired when the stale-job reaper force-fails a
4440
4555
  * *paid* job (internal-review). Auto-wired to the `RevenueReporter`'s paid-job-death
@@ -4536,7 +4651,7 @@ interface SDKServerOpts {
4536
4651
  declare function createDVMServer<State, InputSchema extends ZodLike | undefined>(descriptor: DVMDescriptor<State, InputSchema>, opts: SDKServerOpts): Promise<{
4537
4652
  app: Hono<AppEnv>;
4538
4653
  authAudience?: SignedRequestAudience;
4539
- shutdown: () => void;
4654
+ shutdown: () => Promise<void>;
4540
4655
  jobManager: JobManager<State, InputSchema>;
4541
4656
  revenueReporterActive: boolean;
4542
4657
  /** The payout reporter (internal-review), for the host to attach its Tempo readers to. */
@@ -4808,4 +4923,4 @@ declare function attachCreditMenu(body: Record<string, unknown>, menu: CreditMen
4808
4923
  */
4809
4924
  declare function toCreditTerms(menu: CreditMenu): CreditTerms;
4810
4925
 
4811
- export { isTerminal as $, type AccumulatorPool as A, buildPaymentErrorResponse as B, type ConsumedCredentialStore as C, clearAccumulatorForDvm as D, createDVMServer as E, type FiatDenomination as F, creditDepositPayload as G, derivedFundCreditId as H, type IncomingPaymentOpts as I, JobCancelledError as J, devModeSkipsPaymentVerification as K, fromJobRecord as L, MintHealthTracker as M, fundedMicroFor as N, hasPaymentProof as O, PAYMENT_PROOF_KEYS as P, hashLockKey as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, implicitCreditId as W, type X402BatchChannelObservation as X, initWalletAccumulatorTable as Y, insertAccumulatorRows as Z, isDerivedCreditId as _, type AccumulatorQuerier as a, X402ExactSettlementEvidenceMissingError as a$, isYieldMessage as a0, issueUpfrontChallenges as a1, msatsToFiatMicro as a2, paymentErrorBody as a3, pinAskFiat as a4, priceFiatMicro as a5, processIncomingPayment as a6, providerMessage as a7, repairX402ExactSettlementEffect as a8, resolveFxSnapshot as a9, type JobManagerOpts as aA, type LightningReceiveConfig as aB, MIN_INVOICE_TTL_SECONDS as aC, MemoryConsumedCredentialStore as aD, type MemoryConsumedCredentialStoreOpts as aE, MemoryProcessedPaymentStore as aF, MemoryX402ExactSettlementStore as aG, type MountOpts as aH, type OwnerDisplay as aI, type PlatformReporterOpts as aJ, PostgresProcessedPaymentStore as aK, PostgresX402ExactSettlementStore as aL, type PriceFiat as aM, type ProcessedPaymentQuerier as aN, type ProcessedPaymentRail as aO, type ProcessedPaymentRecord as aP, ProcessedPaymentReplayError as aQ, type ProcessedPaymentStore as aR, type X402BatchAcceptance as aS, type X402BatchFunding as aT, type X402BatchRefusal as aU, type X402BatchSettlementServer as aV, type X402ExactAcceptance as aW, X402ExactIntentConflictError as aX, type X402ExactSettlementAttempt as aY, type X402ExactSettlementChainEvidence as aZ, type X402ExactSettlementEffect as a_, resolvePriceFiat as aa, revenueReporterBannerState as ab, toCreditTerms as ac, toJobRecord as ad, unknownRouteNotFound as ae, verifyIncomingPayment as af, verifyTempoSessionManagementCredential as ag, verifyUpfrontPayment as ah, x402RequiredUsdcMicro as ai, x402SettledShare as aj, type CreditMenu as ak, ReceiptIssuer as al, LightningReceive as am, TempoSettlementReadiness as an, type DVMHostOpts as ao, type BuildCreditMenuArgs as ap, type BuilderIdentity as aq, CREDIT_ENVELOPE_KEYS as ar, type CreateX402BatchSettlementServerOpts as as, type CreditEnvelope as at, CreditEnvelopeError as au, type CreditFundCommitment as av, type CreditTerms as aw, DEFAULT_INVOICE_TTL_SECONDS as ax, type DVMHost as ay, JobManager as az, type AppEnv as b, type X402ExactSettlementEvidenceReader as b0, type X402ExactSettlementIntent as b1, X402ExactSettlementNotReadyError as b2, X402ExactSettlementServer as b3, type X402ExactSettlementServerOpts as b4, type X402ExactSettlementStatus as b5, type X402ExactSettlementStore as b6, type X402SettlementChainEvidence as b7, type X402SettlementEvidenceReader as b8, X402SettlementSubmissionError as b9, X402_BATCH_AUTO_SETTLEMENT as ba, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as bb, X402_BATCH_SETTLEMENT_NETWORK as bc, attachCreditMenu as bd, buildCreditMenu as be, createDVMHost as bf, createX402BatchSettlementServer as bg, creditEnvelopeIgnoreFields as bh, drawSettlementRef as bi, extractCreditEnvelope as bj, fundingCommitment as bk, selectPrimaryCredit as bl, stripCreditEnvelope as bm, toCreditView as bn, type CreditFundingReport as c, type FiatDenominationFailure as d, type FundOnlyRequest as e, type PaymentErrorCode as f, type PaymentErrorDetail as g, type PaymentInfo as h, type ResolvedFx as i, type RevenueBootCheckOpts as j, type ServerJob as k, type ShortPayForfeit as l, type TempoObserverHealth as m, TempoSessionChannelMismatchError as n, type VerifyIncomingSnapshot as o, X402FacilitatorHealth as p, type X402SettlementEvidenceOutcome as q, type X402SettlementRepair as r, type X402SettlementRepairRefusal as s, type X402SettlementRepaired as t, type X402WedgedSettlement as u, type X402WedgedSettlementPage as v, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as w, abortJob as x, applyPaymentInfoToJob as y, assertRevenueReporterReady as z };
4926
+ export { isTerminal as $, type AccumulatorPool as A, buildPaymentErrorResponse as B, type ConsumedCredentialStore as C, clearAccumulatorForDvm as D, createDVMServer as E, type FiatDenomination as F, creditDepositPayload as G, derivedFundCreditId as H, type IncomingPaymentOpts as I, JobCancelledError as J, devModeSkipsPaymentVerification as K, fromJobRecord as L, MintHealthTracker as M, fundedMicroFor as N, hasPaymentProof as O, PAYMENT_PROOF_KEYS as P, hashLockKey as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, implicitCreditId as W, type X402BatchChannelObservation as X, initWalletAccumulatorTable as Y, insertAccumulatorRows as Z, isDerivedCreditId as _, type AccumulatorQuerier as a, type X402ExactSettlementAttempt as a$, isYieldMessage as a0, issueUpfrontChallenges as a1, msatsToFiatMicro as a2, paymentErrorBody as a3, pinAskFiat as a4, priceFiatMicro as a5, processIncomingPayment as a6, providerMessage as a7, repairX402ExactSettlementEffect as a8, resolveFxSnapshot as a9, JobManager as aA, type JobManagerOpts as aB, type LightningReceiveConfig as aC, MIN_INVOICE_TTL_SECONDS as aD, MemoryConsumedCredentialStore as aE, type MemoryConsumedCredentialStoreOpts as aF, MemoryProcessedPaymentStore as aG, MemoryX402ExactSettlementStore as aH, type MountOpts as aI, type OwnerDisplay as aJ, type PaidJobCompletion as aK, type PaymentMode as aL, type PlatformReporterOpts as aM, PostgresProcessedPaymentStore as aN, PostgresX402ExactSettlementStore as aO, type PriceFiat as aP, type ProcessedPaymentQuerier as aQ, type ProcessedPaymentRail as aR, type ProcessedPaymentRecord as aS, ProcessedPaymentReplayError as aT, type ProcessedPaymentStore as aU, type X402BatchAcceptance as aV, type X402BatchFunding as aW, type X402BatchRefusal as aX, type X402BatchSettlementServer as aY, type X402ExactAcceptance as aZ, X402ExactIntentConflictError as a_, resolvePriceFiat as aa, revenueReporterBannerState as ab, toCreditTerms as ac, toJobRecord as ad, unknownRouteNotFound as ae, verifyIncomingPayment as af, verifyTempoSessionManagementCredential as ag, verifyUpfrontPayment as ah, x402RequiredUsdcMicro as ai, x402SettledShare as aj, type CreditMenu as ak, ReceiptIssuer as al, LightningReceive as am, TempoSettlementReadiness as an, type DVMHostOpts as ao, type DVMServeResult as ap, type BuildCreditMenuArgs as aq, type BuilderIdentity as ar, CREDIT_ENVELOPE_KEYS as as, type CreateX402BatchSettlementServerOpts as at, type CreditEnvelope as au, CreditEnvelopeError as av, type CreditFundCommitment as aw, type CreditTerms as ax, DEFAULT_INVOICE_TTL_SECONDS as ay, type DVMHost as az, type AppEnv as b, type X402ExactSettlementChainEvidence as b0, type X402ExactSettlementEffect as b1, X402ExactSettlementEvidenceMissingError as b2, type X402ExactSettlementEvidenceReader as b3, type X402ExactSettlementIntent as b4, X402ExactSettlementNotReadyError as b5, X402ExactSettlementServer as b6, type X402ExactSettlementServerOpts as b7, type X402ExactSettlementStatus as b8, type X402ExactSettlementStore as b9, type X402SettlementChainEvidence as ba, type X402SettlementEvidenceReader as bb, X402SettlementSubmissionError as bc, X402_BATCH_AUTO_SETTLEMENT as bd, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as be, X402_BATCH_SETTLEMENT_NETWORK as bf, attachCreditMenu as bg, buildCreditMenu as bh, createDVMHost as bi, createX402BatchSettlementServer as bj, creditEnvelopeIgnoreFields as bk, drawSettlementRef as bl, extractCreditEnvelope as bm, fundingCommitment as bn, selectPrimaryCredit as bo, stripCreditEnvelope as bp, toCreditView as bq, type CreditFundingReport as c, type FiatDenominationFailure as d, type FundOnlyRequest as e, type PaymentErrorCode as f, type PaymentErrorDetail as g, type PaymentInfo as h, type ResolvedFx as i, type RevenueBootCheckOpts as j, type ServerJob as k, type ShortPayForfeit as l, type TempoObserverHealth as m, TempoSessionChannelMismatchError as n, type VerifyIncomingSnapshot as o, X402FacilitatorHealth as p, type X402SettlementEvidenceOutcome as q, type X402SettlementRepair as r, type X402SettlementRepairRefusal as s, type X402SettlementRepaired as t, type X402WedgedSettlement as u, type X402WedgedSettlementPage as v, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as w, abortJob as x, applyPaymentInfoToJob as y, assertRevenueReporterReady as z };